1736 lines
1.6 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Lk=Object.defineProperty,Dk=Object.defineProperties;var Pk=Object.getOwnPropertyDescriptors;var Zu=Object.getOwnPropertySymbols;var Gb=Object.prototype.hasOwnProperty,Zb=Object.prototype.propertyIsEnumerable;var rc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rk=e=>{throw TypeError(e)};var ig=(e,t,r)=>t in e?Lk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ne=(e,t)=>{for(var r in t||(t={}))Gb.call(t,r)&&ig(e,r,t[r]);if(Zu)for(var r of Zu(t))Zb.call(t,r)&&ig(e,r,t[r]);return e},Se=(e,t)=>Dk(e,Pk(t));var gn=(e,t)=>{var r={};for(var s in e)Gb.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&Zu)for(var s of Zu(e))t.indexOf(s)<0&&Zb.call(e,s)&&(r[s]=e[s]);return r};var Fk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Kn=(e,t,r)=>ig(e,typeof t!="symbol"?t+"":t,r);var le=(e,t,r)=>new Promise((s,i)=>{var d=p=>{try{f(r.next(p))}catch(g){i(g)}},c=p=>{try{f(r.throw(p))}catch(g){i(g)}},f=p=>p.done?s(p.value):Promise.resolve(p.value).then(d,c);f((r=r.apply(e,t)).next())}),Zl=function(e,t){this[0]=e,this[1]=t},lg=(e,t,r)=>{var s=(c,f,p,g)=>{try{var x=r[c](f),y=(f=x.value)instanceof Zl,v=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,p,g):p({value:k,done:v})).catch(k=>s("throw",k,p,g))}catch(k){g(k)}},i=c=>d[c]=f=>new Promise((p,g)=>s(c,f,p,g)),d={};return r=r.apply(e,t),d[rc("asyncIterator")]=()=>d,i("next"),i("throw"),i("return"),d},og=e=>{var t=e[rc("asyncIterator")],r=!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(r){if(r=!1,d==="throw")throw c;return c}return r=!0,{done:!1,value:new Zl(new Promise(f=>{var p=t[d](c);p instanceof Object||Rk("Object expected"),f(p)}),1)}}),i[rc("iterator")]=()=>i,s("next"),"throw"in t?s("throw"):i.throw=d=>{throw d},"return"in t&&s("return"),i},qb=(e,t,r)=>(t=e[rc("asyncIterator")])?t.call(e):(e=e[rc("iterator")](),t={},r=(s,i)=>(i=e[s])&&(t[s]=d=>new Promise((c,f,p)=>(d=i.call(e,d),p=d.done,Promise.resolve(d.value).then(g=>c({value:g,done:p}),f)))),r("next"),r("return"),t);var wD=Fk(Ye=>{(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 r(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=r(i);fetch(i.href,d)}})();function t_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cg={exports:{}},Rd={};var Yb;function Ik(){if(Yb)return Rd;Yb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(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=r,Rd.jsxs=r,Rd}var Xb;function zk(){return Xb||(Xb=1,cg.exports=Ik()),cg.exports}var a=zk(),dg={exports:{}},Gt={};var Jb;function Bk(){if(Jb)return Gt;Jb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=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"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),v=Symbol.iterator;function k(F){return F===null||typeof F!="object"?null:(F=v&&F[v]||F["@@iterator"],typeof F=="function"?F:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function A(F,D,H){this.props=F,this.context=D,this.refs=S,this.updater=H||T}A.prototype.isReactComponent={},A.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")},A.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function C(){}C.prototype=A.prototype;function O(F,D,H){this.props=F,this.context=D,this.refs=S,this.updater=H||T}var P=O.prototype=new C;P.constructor=O,N(P,A.prototype),P.isPureReactComponent=!0;var B=Array.isArray;function V(){}var z={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function J(F,D,H){var Z=H.ref;return{$$typeof:e,type:F,key:D,ref:Z!==void 0?Z:null,props:H}}function de(F,D){return J(F.type,D,F.props)}function ye(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function ie(F){var D={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(H){return D[H]})}var he=/\/+/g;function ve(F,D){return typeof F=="object"&&F!==null&&F.key!=null?ie(""+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(V,V):(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 ee(F,D,H,Z,K){var ue=typeof F;(ue==="undefined"||ue==="boolean")&&(F=null);var Le=!1;if(F===null)Le=!0;else switch(ue){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(F.$$typeof){case e:case t:Le=!0;break;case x:return Le=F._init,ee(Le(F._payload),D,H,Z,K)}}if(Le)return K=K(F),Le=Z===""?"."+ve(F,0):Z,B(K)?(H="",Le!=null&&(H=Le.replace(he,"$&/")+"/"),ee(K,D,H,"",function(Fe){return Fe})):K!=null&&(ye(K)&&(K=de(K,H+(K.key==null||F&&F.key===K.key?"":(""+K.key).replace(he,"$&/")+"/")+Le)),D.push(K)),1;Le=0;var Ne=Z===""?".":Z+":";if(B(F))for(var We=0;We<F.length;We++)Z=F[We],ue=Ne+ve(Z,We),Le+=ee(Z,D,H,ue,K);else if(We=k(F),typeof We=="function")for(F=We.call(F),We=0;!(Z=F.next()).done;)Z=Z.value,ue=Ne+ve(Z,We++),Le+=ee(Z,D,H,ue,K);else if(ue==="object"){if(typeof F.then=="function")return ee(me(F),D,H,Z,K);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 Le}function q(F,D,H){if(F==null)return F;var Z=[],K=0;return ee(F,Z,"","",function(ue){return D.call(H,ue,K++)}),Z}function Q(F){if(F._status===-1){var D=F._result;D=D(),D.then(function(H){(F._status===0||F._status===-1)&&(F._status=1,F._result=H)},function(H){(F._status===0||F._status===-1)&&(F._status=2,F._result=H)}),F._status===-1&&(F._status=0,F._result=D)}if(F._status===1)return F._result.default;throw F._result}var fe=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)},ae={map:q,forEach:function(F,D,H){q(F,function(){D.apply(this,arguments)},H)},count:function(F){var D=0;return q(F,function(){D++}),D},toArray:function(F){return q(F,function(D){return D})||[]},only:function(F){if(!ye(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Gt.Activity=y,Gt.Children=ae,Gt.Component=A,Gt.Fragment=r,Gt.Profiler=i,Gt.PureComponent=O,Gt.StrictMode=s,Gt.Suspense=p,Gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Gt.__COMPILER_RUNTIME={__proto__:null,c:function(F){return z.H.useMemoCache(F)}},Gt.cache=function(F){return function(){return F.apply(null,arguments)}},Gt.cacheSignal=function(){return null},Gt.cloneElement=function(F,D,H){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var Z=N({},F.props),K=F.key;if(D!=null)for(ue in D.key!==void 0&&(K=""+D.key),D)!U.call(D,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&D.ref===void 0||(Z[ue]=D[ue]);var ue=arguments.length-2;if(ue===1)Z.children=H;else if(1<ue){for(var Le=Array(ue),Ne=0;Ne<ue;Ne++)Le[Ne]=arguments[Ne+2];Z.children=Le}return J(F.type,K,Z)},Gt.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},Gt.createElement=function(F,D,H){var Z,K={},ue=null;if(D!=null)for(Z in D.key!==void 0&&(ue=""+D.key),D)U.call(D,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(K[Z]=D[Z]);var Le=arguments.length-2;if(Le===1)K.children=H;else if(1<Le){for(var Ne=Array(Le),We=0;We<Le;We++)Ne[We]=arguments[We+2];K.children=Ne}if(F&&F.defaultProps)for(Z in Le=F.defaultProps,Le)K[Z]===void 0&&(K[Z]=Le[Z]);return J(F,ue,K)},Gt.createRef=function(){return{current:null}},Gt.forwardRef=function(F){return{$$typeof:f,render:F}},Gt.isValidElement=ye,Gt.lazy=function(F){return{$$typeof:x,_payload:{_status:-1,_result:F},_init:Q}},Gt.memo=function(F,D){return{$$typeof:g,type:F,compare:D===void 0?null:D}},Gt.startTransition=function(F){var D=z.T,H={};z.T=H;try{var Z=F(),K=z.S;K!==null&&K(H,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(V,fe)}catch(ue){fe(ue)}finally{D!==null&&H.types!==null&&(D.types=H.types),z.T=D}},Gt.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Gt.use=function(F){return z.H.use(F)},Gt.useActionState=function(F,D,H){return z.H.useActionState(F,D,H)},Gt.useCallback=function(F,D){return z.H.useCallback(F,D)},Gt.useContext=function(F){return z.H.useContext(F)},Gt.useDebugValue=function(){},Gt.useDeferredValue=function(F,D){return z.H.useDeferredValue(F,D)},Gt.useEffect=function(F,D){return z.H.useEffect(F,D)},Gt.useEffectEvent=function(F){return z.H.useEffectEvent(F)},Gt.useId=function(){return z.H.useId()},Gt.useImperativeHandle=function(F,D,H){return z.H.useImperativeHandle(F,D,H)},Gt.useInsertionEffect=function(F,D){return z.H.useInsertionEffect(F,D)},Gt.useLayoutEffect=function(F,D){return z.H.useLayoutEffect(F,D)},Gt.useMemo=function(F,D){return z.H.useMemo(F,D)},Gt.useOptimistic=function(F,D){return z.H.useOptimistic(F,D)},Gt.useReducer=function(F,D,H){return z.H.useReducer(F,D,H)},Gt.useRef=function(F){return z.H.useRef(F)},Gt.useState=function(F){return z.H.useState(F)},Gt.useSyncExternalStore=function(F,D,H){return z.H.useSyncExternalStore(F,D,H)},Gt.useTransition=function(){return z.H.useTransition()},Gt.version="19.2.1",Gt}var Kb;function Hf(){return Kb||(Kb=1,dg.exports=Bk()),dg.exports}var j=Hf();const sa=t_(j);var ug={exports:{}},Fd={},fg={exports:{}},hg={};var Qb;function Uk(){return Qb||(Qb=1,(function(e){function t(ee,q){var Q=ee.length;ee.push(q);e:for(;0<Q;){var fe=Q-1>>>1,ae=ee[fe];if(0<i(ae,q))ee[fe]=q,ee[Q]=ae,Q=fe;else break e}}function r(ee){return ee.length===0?null:ee[0]}function s(ee){if(ee.length===0)return null;var q=ee[0],Q=ee.pop();if(Q!==q){ee[0]=Q;e:for(var fe=0,ae=ee.length,F=ae>>>1;fe<F;){var D=2*(fe+1)-1,H=ee[D],Z=D+1,K=ee[Z];if(0>i(H,Q))Z<ae&&0>i(K,H)?(ee[fe]=K,ee[Z]=Q,fe=Z):(ee[fe]=H,ee[D]=Q,fe=D);else if(Z<ae&&0>i(K,Q))ee[fe]=K,ee[Z]=Q,fe=Z;else break e}}return q}function i(ee,q){var Q=ee.sortIndex-q.sortIndex;return Q!==0?Q:ee.id-q.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 p=[],g=[],x=1,y=null,v=3,k=!1,T=!1,N=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate!="undefined"?setImmediate:null;function P(ee){for(var q=r(g);q!==null;){if(q.callback===null)s(g);else if(q.startTime<=ee)s(g),q.sortIndex=q.expirationTime,t(p,q);else break;q=r(g)}}function B(ee){if(N=!1,P(ee),!T)if(r(p)!==null)T=!0,V||(V=!0,ie());else{var q=r(g);q!==null&&me(B,q.startTime-ee)}}var V=!1,z=-1,U=5,J=-1;function de(){return S?!0:!(e.unstable_now()-J<U)}function ye(){if(S=!1,V){var ee=e.unstable_now();J=ee;var q=!0;try{e:{T=!1,N&&(N=!1,C(z),z=-1),k=!0;var Q=v;try{t:{for(P(ee),y=r(p);y!==null&&!(y.expirationTime>ee&&de());){var fe=y.callback;if(typeof fe=="function"){y.callback=null,v=y.priorityLevel;var ae=fe(y.expirationTime<=ee);if(ee=e.unstable_now(),typeof ae=="function"){y.callback=ae,P(ee),q=!0;break t}y===r(p)&&s(p),P(ee)}else s(p);y=r(p)}if(y!==null)q=!0;else{var F=r(g);F!==null&&me(B,F.startTime-ee),q=!1}}break e}finally{y=null,v=Q,k=!1}q=void 0}}finally{q?ie():V=!1}}}var ie;if(typeof O=="function")ie=function(){O(ye)};else if(typeof MessageChannel!="undefined"){var he=new MessageChannel,ve=he.port2;he.port1.onmessage=ye,ie=function(){ve.postMessage(null)}}else ie=function(){A(ye,0)};function me(ee,q){z=A(function(){ee(e.unstable_now())},q)}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(ee){ee.callback=null},e.unstable_forceFrameRate=function(ee){0>ee||125<ee?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<ee?Math.floor(1e3/ee):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(ee){switch(v){case 1:case 2:case 3:var q=3;break;default:q=v}var Q=v;v=q;try{return ee()}finally{v=Q}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(ee,q){switch(ee){case 1:case 2:case 3:case 4:case 5:break;default:ee=3}var Q=v;v=ee;try{return q()}finally{v=Q}},e.unstable_scheduleCallback=function(ee,q,Q){var fe=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?fe+Q:fe):Q=fe,ee){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=Q+ae,ee={id:x++,callback:q,priorityLevel:ee,startTime:Q,expirationTime:ae,sortIndex:-1},Q>fe?(ee.sortIndex=Q,t(g,ee),r(p)===null&&ee===r(g)&&(N?(C(z),z=-1):N=!0,me(B,Q-fe))):(ee.sortIndex=ae,t(p,ee),T||k||(T=!0,V||(V=!0,ie()))),ee},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(ee){var q=v;return function(){var Q=v;v=q;try{return ee.apply(this,arguments)}finally{v=Q}}}})(hg)),hg}var e1;function Hk(){return e1||(e1=1,fg.exports=Uk()),fg.exports}var mg={exports:{}},Ur={};var t1;function $k(){if(t1)return Ur;t1=1;var e=Hf();function t(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function d(p,g,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:p,containerInfo:g,implementation:x}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Ur.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Ur.createPortal=function(p,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return d(p,g,null,x)},Ur.flushSync=function(p){var g=c.T,x=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=g,s.p=x,s.d.f()}},Ur.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,s.d.C(p,g))},Ur.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Ur.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var x=g.as,y=f(x,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:v,fetchPriority:k}):x==="script"&&s.d.X(p,{crossOrigin:y,integrity:v,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Ur.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=f(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&s.d.M(p)},Ur.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,y=f(x,g.crossOrigin);s.d.L(p,x,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Ur.preloadModule=function(p,g){if(typeof p=="string")if(g){var x=f(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},Ur.requestFormReset=function(p){s.d.r(p)},Ur.unstable_batchedUpdates=function(p,g){return p(g)},Ur.useFormState=function(p,g,x){return c.H.useFormState(p,g,x)},Ur.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ur.version="19.2.1",Ur}var a1;function a_(){if(a1)return mg.exports;a1=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(),mg.exports=$k(),mg.exports}var r1;function Wk(){if(r1)return Fd;r1=1;var e=Hk(),t=Hf(),r=a_();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 p(n){if(d(n)!==n)throw Error(s(188))}function g(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 _=u.return;if(_===null)break;var w=_.alternate;if(w===null){if(m=_.return,m!==null){u=m;continue}break}if(_.child===w.child){for(w=_.child;w;){if(w===u)return p(_),n;if(w===m)return p(_),l;w=w.sibling}throw Error(s(188))}if(u.return!==m.return)u=_,m=w;else{for(var R=!1,X=_.child;X;){if(X===u){R=!0,u=_,m=w;break}if(X===m){R=!0,m=_,u=w;break}X=X.sibling}if(!R){for(X=w.child;X;){if(X===u){R=!0,u=w,m=_;break}if(X===m){R=!0,m=w,u=_;break}X=X.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,v=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"),A=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),de=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function ie(n){return n===null||typeof n!="object"?null:(n=ye&&n[ye]||n["@@iterator"],typeof n=="function"?n:null)}var he=Symbol.for("react.client.reference");function ve(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===he?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case N:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case B:return"Suspense";case V:return"SuspenseList";case J:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case O: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 z:return l=n.displayName||null,l!==null?l:ve(n.type)||"Memo";case U:l=n._payload,n=n._init;try{return ve(n(l))}catch(u){}}return null}var me=Array.isArray,ee=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},fe=[],ae=-1;function F(n){return{current:n}}function D(n){0>ae||(n.current=fe[ae],fe[ae]=null,ae--)}function H(n,l){ae++,fe[ae]=n.current,n.current=l}var Z=F(null),K=F(null),ue=F(null),Le=F(null);function Ne(n,l){switch(H(ue,l),H(K,n),H(Z,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?gb(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=gb(l),n=pb(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}D(Z),H(Z,n)}function We(){D(Z),D(K),D(ue)}function Fe(n){n.memoizedState!==null&&H(Le,n);var l=Z.current,u=pb(l,n.type);l!==u&&(H(K,n),H(Z,u))}function tt(n){K.current===n&&(D(Z),D(K)),Le.current===n&&(D(Le),Md._currentValue=Q)}var ft,Dt;function Ve(n){if(ft===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);ft=l&&l[1]||"",Dt=-1<u.stack.indexOf(`
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ft+n+Dt}var At=!1;function jt(n,l){if(!n||At)return"";At=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var Ke=function(){throw Error()};if(Object.defineProperty(Ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ke,[])}catch($e){var Re=$e}Reflect.construct(n,[],Ke)}else{try{Ke.call()}catch($e){Re=$e}n.call(Ke.prototype)}}else{try{throw Error()}catch($e){Re=$e}(Ke=n())&&typeof Ke.catch=="function"&&Ke.catch(function(){})}}catch($e){if($e&&Re&&typeof $e.stack=="string")return[$e.stack,Re.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=m.DetermineComponentFrameRoot(),R=w[0],X=w[1];if(R&&X){var be=R.split(`
`),Me=X.split(`
`);for(_=m=0;m<be.length&&!be[m].includes("DetermineComponentFrameRoot");)m++;for(;_<Me.length&&!Me[_].includes("DetermineComponentFrameRoot");)_++;if(m===be.length||_===Me.length)for(m=be.length-1,_=Me.length-1;1<=m&&0<=_&&be[m]!==Me[_];)_--;for(;1<=m&&0<=_;m--,_--)if(be[m]!==Me[_]){if(m!==1||_!==1)do if(m--,_--,0>_||be[m]!==Me[_]){var Ze=`
`+be[m].replace(" at new "," at ");return n.displayName&&Ze.includes("<anonymous>")&&(Ze=Ze.replace("<anonymous>",n.displayName)),Ze}while(1<=m&&0<=_);break}}}finally{At=!1,Error.prepareStackTrace=u}return(u=n?n.displayName||n.name:"")?Ve(u):""}function He(n,l){switch(n.tag){case 26:case 27:case 5:return Ve(n.type);case 16:return Ve("Lazy");case 13:return n.child!==l&&l!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return jt(n.type,!1);case 11:return jt(n.type.render,!1);case 1:return jt(n.type,!0);case 31:return Ve("Activity");default:return""}}function oe(n){try{var l="",u=null;do l+=He(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,ot=e.unstable_cancelCallback,bt=e.unstable_shouldYield,qe=e.unstable_requestPaint,Ue=e.unstable_now,ht=e.unstable_getCurrentPriorityLevel,wt=e.unstable_ImmediatePriority,Mt=e.unstable_UserBlockingPriority,Ft=e.unstable_NormalPriority,je=e.unstable_LowPriority,it=e.unstable_IdlePriority,vt=e.log,Bt=e.unstable_setDisableYieldValue,De=null,ct=null;function ut(n){if(typeof vt=="function"&&Bt(n),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(De,n)}catch(l){}}var Nt=Math.clz32?Math.clz32:et,Rt=Math.log,ia=Math.LN2;function et(n){return n>>>=0,n===0?32:31-(Rt(n)/ia|0)|0}var pe=256,ze=262144,st=4194304;function Ut(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 la(n,l,u){var m=n.pendingLanes;if(m===0)return 0;var _=0,w=n.suspendedLanes,R=n.pingedLanes;n=n.warmLanes;var X=m&134217727;return X!==0?(m=X&~w,m!==0?_=Ut(m):(R&=X,R!==0?_=Ut(R):u||(u=X&~n,u!==0&&(_=Ut(u))))):(X=m&~w,X!==0?_=Ut(X):R!==0?_=Ut(R):u||(u=m&~n,u!==0&&(_=Ut(u)))),_===0?0:l!==0&&l!==_&&(l&w)===0&&(w=_&-_,u=l&-l,w>=u||w===32&&(u&4194048)!==0)?l:_}function va(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function ar(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 tn(){var n=st;return st<<=1,(st&62914560)===0&&(st=4194304),n}function Bn(n){for(var l=[],u=0;31>u;u++)l.push(n);return l}function Gr(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Zs(n,l,u,m,_,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 X=n.entanglements,be=n.expirationTimes,Me=n.hiddenUpdates;for(u=R&~u;0<u;){var Ze=31-Nt(u),Ke=1<<Ze;X[Ze]=0,be[Ze]=-1;var Re=Me[Ze];if(Re!==null)for(Me[Ze]=null,Ze=0;Ze<Re.length;Ze++){var $e=Re[Ze];$e!==null&&($e.lane&=-536870913)}u&=~Ke}m!==0&&Ss(n,m,0),w!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=w&~(R&~l))}function Ss(n,l,u){n.pendingLanes|=l,n.suspendedLanes&=~l;var m=31-Nt(l);n.entangledLanes|=l,n.entanglements[m]=n.entanglements[m]|1073741824|u&261930}function an(n,l){var u=n.entangledLanes|=l;for(n=n.entanglements;u;){var m=31-Nt(u),_=1<<m;_&l|n[m]&l&&(n[m]|=l),u&=~_}}function _n(n,l){var u=l&-l;return u=(u&42)!==0?1:rr(u),(u&(n.suspendedLanes|l))!==0?0:u}function rr(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 Et(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function W(){var n=q.p;return n!==0?n:(n=window.event,n===void 0?32:zb(n.type))}function ce(n,l){var u=q.p;try{return q.p=n,l()}finally{q.p=u}}var I=Math.random().toString(36).slice(2),Y="__reactFiber$"+I,te="__reactProps$"+I,se="__reactContainer$"+I,Ee="__reactEvents$"+I,re="__reactListeners$"+I,xe="__reactHandles$"+I,ke="__reactResources$"+I,Ce="__reactMarker$"+I;function Qe(n){delete n[Y],delete n[te],delete n[Ee],delete n[re],delete n[xe]}function lt(n){var l=n[Y];if(l)return l;for(var u=n.parentNode;u;){if(l=u[se]||u[Y]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(n=kb(n);n!==null;){if(u=n[Y])return u;n=kb(n)}return l}n=u,u=n.parentNode}return null}function dt(n){if(n=n[Y]||n[se]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function nt(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(s(33))}function mt(n){var l=n[ke];return l||(l=n[ke]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function St(n){n[Ce]=!0}var ya=new Set,ta={};function Ra(n,l){Ir(n,l),Ir(n+"Capture",l)}function Ir(n,l){for(ta[n]=l,n=0;n<l.length;n++)ya.add(l[n])}var wn=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]*$"),ns={},kn={};function ss(n){return we.call(kn,n)?!0:we.call(ns,n)?!1:wn.test(n)?kn[n]=!0:(ns[n]=!0,!1)}function $t(n,l,u){if(ss(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 rn(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 qs(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 _=m.get,w=m.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return _.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 Vt(n){if(!n._valueTracker){var l=qs(n)?"checked":"value";n._valueTracker=Bc(n,l,""+n[l])}}function Ba(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var u=l.getValue(),m="";return n&&(m=qs(n)?n.checked?"true":"false":n.value),n=m,n!==u?(l.setValue(n),!0):!1}function Ni(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 Fa(n){return n.replace(xo,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Uc(n,l,u,m,_,w,R,X){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?is(n,R,ur(l)):u!=null?is(n,R,ur(u)):m!=null&&n.removeAttribute("value"),_==null&&w!=null&&(n.defaultChecked=!!w),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),X!=null&&typeof X!="function"&&typeof X!="symbol"&&typeof X!="boolean"?n.name=""+ur(X):n.removeAttribute("name")}function gl(n,l,u,m,_,w,R,X){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)){Vt(n);return}u=u!=null?""+ur(u):"",l=l!=null?""+ur(l):u,X||l===n.value||(n.value=l),n.defaultValue=l}m=m!=null?m:_,m=typeof m!="function"&&typeof m!="symbol"&&!!m,n.checked=X?n.checked:!!m,n.defaultChecked=!!m,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(n.name=R),Vt(n)}function is(n,l,u){l==="number"&&Ni(n.ownerDocument)===n||n.defaultValue===""+u||(n.defaultValue=""+u)}function Da(n,l,u,m){if(n=n.options,l){l={};for(var _=0;_<u.length;_++)l["$"+u[_]]=!0;for(u=0;u<n.length;u++)_=l.hasOwnProperty("$"+n[u].value),n[u].selected!==_&&(n[u].selected=_),_&&m&&(n[u].defaultSelected=!0)}else{for(u=""+ur(u),l=null,_=0;_<n.length;_++){if(n[_].value===u){n[_].selected=!0,m&&(n[_].defaultSelected=!0);return}l!==null||n[_].disabled||(l=n[_])}l!==null&&(l.selected=!0)}}function Ts(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 ji(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),Vt(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 Si(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 _ in l)m=l[_],l.hasOwnProperty(_)&&u[_]!==m&&Si(n,_,m)}else for(var w in l)l.hasOwnProperty(w)&&Si(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 Ti(n){return $c.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function nn(){}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 Ei=null,Ht=null;function Nn(n){var l=dt(n);if(l&&(n=l.stateNode)){var u=n[te]||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="'+Fa(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var m=u[l];if(m!==n&&m.form===n.form){var _=m[te]||null;if(!_)throw Error(s(90));Uc(m,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(l=0;l<u.length;l++)m=u[l],m.form===n.form&&Ba(m)}break e;case"textarea":Ts(n,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&Da(n,!!u.multiple,l,!1)}}}var ba=!1;function Wc(n,l,u){if(ba)return n(l,u);ba=!0;try{var m=n(l);return m}finally{if(ba=!1,(Ei!==null||Ht!==null)&&(ju(),Ei&&(l=Ei,n=Ht,Ht=Ei=null,Nn(l),n)))for(l=0;l<n.length;l++)Nn(n[l])}}function Ys(n,l){var u=n.stateNode;if(u===null)return null;var m=u[te]||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 jn=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),yl=!1;if(jn)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){yl=!0}}),window.addEventListener("test",Sn,Sn),window.removeEventListener("test",Sn,Sn)}catch(n){yl=!1}var Hn=null,Xs=null,Ga=null;function Es(){if(Ga)return Ga;var n,l=Xs,u=l.length,m,_="value"in Hn?Hn.value:Hn.textContent,w=_.length;for(n=0;n<u&&l[n]===_[n];n++);var R=u-n;for(m=1;m<=R&&l[u-m]===_[w-m];m++);return Ga=_.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 A0(){return!1}function Tr(n){function l(u,m,_,w,R){this._reactName=u,this._targetInst=_,this.type=m,this.nativeEvent=w,this.target=R,this.currentTarget=null;for(var X in n)n.hasOwnProperty(X)&&(u=n[X],this[X]=u?u(w):w[X]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?vl:A0,this.isPropagationStopped=A0,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 ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_o=Tr(ls),Ci=y({},ls,{view:0,detail:0}),aa=Tr(Ci),Vc,Zr,os,_l=y({},Ci,{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!==os&&(os&&n.type==="mousemove"?(Vc=n.screenX-os.screenX,Zr=n.screenY-os.screenY):Zr=Vc=0,os=n),Vc)},movementY:function(n){return"movementY"in n?n.movementY:Zr}}),O0=Tr(_l),Gc=y({},_l,{dataTransfer:0}),ph=Tr(Gc),M0=y({},Ci,{relatedTarget:0}),Zc=Tr(M0),xh=y({},ls,{animationName:0,elapsedTime:0,pseudoElement:0}),qc=Tr(xh),yh=y({},ls,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),$n=Tr(yh),bh=y({},ls,{data:0}),Yc=Tr(bh),Cs={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},L0={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"},D0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xc(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=D0[n])?!!l[n]:!1}function Jc(){return Xc}var P0=y({},Ci,{key:function(n){if(n.key){var l=Cs[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"?L0[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}}),R0=Tr(P0),vh=y({},_l,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),F0=Tr(vh),Kc=y({},Ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jc}),_h=Tr(Kc),I0=y({},ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=Tr(I0),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}),Js=Tr(wo),wh=y({},ls,{newState:0,oldState:0}),wl=Tr(wh),sn=[9,13,27,32],ko=jn&&"CompositionEvent"in window,Ai=null;jn&&"documentMode"in document&&(Ai=document.documentMode);var kh=jn&&"TextEvent"in window&&!Ai,No=jn&&(!ko||Ai&&8<Ai&&11>=Ai),jo=" ",B0=!1;function U0(n,l){switch(n){case"keyup":return sn.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 Oi=!1;function Tn(n,l){switch(n){case"compositionend":return Qc(l);case"keypress":return l.which!==32?null:(B0=!0,jo);case"textInput":return n=l.data,n===jo&&B0?null:n;default:return null}}function Mi(n,l){if(Oi)return n==="compositionend"||!ko&&U0(n,l)?(n=Es(),Ga=Xs=Hn=null,Oi=!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 Nh={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"?!!Nh[n.type]:l==="textarea"}function H0(n,l,u,m){Ei?Ht?Ht.push(m):Ht=[m]:Ei=m,l=Mu(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){cb(n,0)}function jl(n){var l=nt(n);if(Ba(l))return n}function Sl(n,l){if(n==="change")return l}var $0=!1;if(jn){var Gn;if(jn){var Li="oninput"in document;if(!Li){var W0=document.createElement("div");W0.setAttribute("oninput","return;"),Li=typeof W0.oninput=="function"}Gn=Li}else Gn=!1;$0=Gn&&(!document.documentMode||9<document.documentMode)}function So(){Vn&&(Vn.detachEvent("onpropertychange",V0),kl=Vn=null)}function V0(n){if(n.propertyName==="value"&&jl(kl)){var l=[];H0(l,kl,n,xl(n)),Wc(Nl,l)}}function cs(n,l,u){n==="focusin"?(So(),Vn=l,kl=u,Vn.attachEvent("onpropertychange",V0)):n==="focusout"&&So()}function jh(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return jl(kl)}function Di(n,l){if(n==="click")return jl(l)}function Sh(n,l){if(n==="input"||n==="change")return jl(l)}function ds(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var xr=typeof Object.is=="function"?Object.is:ds;function Pi(n,l){if(xr(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 _=u[m];if(!we.call(l,_)||!xr(n[_],l[_]))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=Ni(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=Ni(n.document)}return l}function As(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=jn&&"documentMode"in document&&11>=document.documentMode,Os=null,Ao=null,Cl=null,Ri=!1;function G0(n,l,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Ri||Os==null||Os!==Ni(m)||(m=Os,"selectionStart"in m&&As(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&&Pi(Cl,m)||(Cl=m,m=Mu(Ao,"onSelect"),0<m.length&&(l=new _o("onSelect","select",null,l,u),n.push({event:l,listeners:m}),l.target=Os)))}function Ms(n,l){var u={};return u[n.toLowerCase()]=l.toLowerCase(),u["Webkit"+n]="webkit"+l,u["Moz"+n]="moz"+l,u}var Fi={animationend:Ms("Animation","AnimationEnd"),animationiteration:Ms("Animation","AnimationIteration"),animationstart:Ms("Animation","AnimationStart"),transitionrun:Ms("Transition","TransitionRun"),transitionstart:Ms("Transition","TransitionStart"),transitioncancel:Ms("Transition","TransitionCancel"),transitionend:Ms("Transition","TransitionEnd")},Oo={},Z0={};jn&&(Z0=document.createElement("div").style,"AnimationEvent"in window||(delete Fi.animationend.animation,delete Fi.animationiteration.animation,delete Fi.animationstart.animation),"TransitionEvent"in window||delete Fi.transitionend.transition);function yr(n){if(Oo[n])return Oo[n];if(!Fi[n])return n;var l=Fi[n],u;for(u in l)if(l.hasOwnProperty(u)&&u in Z0)return Oo[n]=l[u];return n}var Al=yr("animationend"),q0=yr("animationiteration"),Ol=yr("animationstart"),Th=yr("transitionrun"),Y0=yr("transitionstart"),Eh=yr("transitioncancel"),Ii=yr("transitionend"),X0=new Map,Ls="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(" ");Ls.push("scrollEnd");function ln(n,l){X0.set(n,l),Ra(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)},on=[],zr=0,Mo=0;function Ll(){for(var n=zr,l=Mo=zr=0;l<n;){var u=on[l];on[l++]=null;var m=on[l];on[l++]=null;var _=on[l];on[l++]=null;var w=on[l];if(on[l++]=null,m!==null&&_!==null){var R=m.pending;R===null?_.next=_:(_.next=R.next,R.next=_),m.pending=_}w!==0&&zi(u,_,w)}}function Ds(n,l,u,m){on[zr++]=n,on[zr++]=l,on[zr++]=u,on[zr++]=m,Mo|=m,n.lanes|=m,n=n.alternate,n!==null&&(n.lanes|=m)}function ed(n,l,u,m){return Ds(n,l,u,m),Dl(n)}function Zn(n,l){return Ds(n,null,null,l),Dl(n)}function zi(n,l,u){n.lanes|=u;var m=n.alternate;m!==null&&(m.lanes|=u);for(var _=!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||(_=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,_&&l!==null&&(_=31-Nt(u),n=w.hiddenUpdates,m=n[_],m===null?n[_]=[l]:m.push(l),l.lane=u|536870912),w):null}function Dl(n){if(50<jd)throw jd=0,Am=null,Error(s(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var Ks={};function Ch(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 Ch(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,_,w){var R=0;if(m=n,typeof n=="function")Lo(n)&&(R=1);else if(typeof n=="string")R=_k(n,u,Z.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case J:return n=Br(31,u,l,_),n.elementType=J,n.lanes=w,n;case N:return Qs(u.children,_,w,l);case S:R=8,_|=24;break;case A:return n=Br(12,u,l,_|2),n.elementType=A,n.lanes=w,n;case B:return n=Br(13,u,l,_),n.elementType=B,n.lanes=w,n;case V:return n=Br(19,u,l,_),n.elementType=V,n.lanes=w,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case O:R=10;break e;case C:R=9;break e;case P:R=11;break e;case z:R=14;break e;case U: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,_),l.elementType=n,l.type=m,l.lanes=w,l}function Qs(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:oe(l)},o.set(n,l),l)}return{value:n,source:l,stack:oe(l)}}var b=[],E=0,M=null,G=0,ge=[],Ae=0,Pe=null,Je=1,yt="";function Lt(n,l){b[E++]=G,b[E++]=M,M=n,G=l}function Yt(n,l,u){ge[Ae++]=Je,ge[Ae++]=yt,ge[Ae++]=Pe,Pe=n;var m=Je;n=yt;var _=32-Nt(m)-1;m&=~(1<<_),u+=1;var w=32-Nt(l)+_;if(30<w){var R=_-_%5;w=(m&(1<<R)-1).toString(32),m>>=R,_-=R,Je=1<<32-Nt(l)+_|u<<_|m,yt=w+n}else Je=1<<w|u<<_|m,yt=n}function fr(n){n.return!==null&&(Lt(n,1),Yt(n,1,0))}function Za(n){for(;n===M;)M=b[--E],b[E]=null,G=b[--E],b[E]=null;for(;n===Pe;)Pe=ge[--Ae],ge[Ae]=null,yt=ge[--Ae],ge[Ae]=null,Je=ge[--Ae],ge[Ae]=null}function qr(n,l){ge[Ae++]=Je,ge[Ae++]=yt,ge[Ae++]=Pe,Je=l.id,yt=l.overflow,Pe=n}var oa=null,ca=null,Kt=!1,Ps=null,cn=!1,Po=Error(s(519));function Rs(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[Y]=n,l[te]=m,u){case"dialog":ea("cancel",l),ea("close",l);break;case"iframe":case"object":case"embed":ea("load",l);break;case"video":case"audio":for(u=0;u<Td.length;u++)ea(Td[u],l);break;case"source":ea("error",l);break;case"img":case"image":case"link":ea("error",l),ea("load",l);break;case"details":ea("toggle",l);break;case"input":ea("invalid",l),gl(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":ea("invalid",l);break;case"textarea":ea("invalid",l),ji(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||hb(l.textContent,u)?(m.popover!=null&&(ea("beforetoggle",l),ea("toggle",l)),m.onScroll!=null&&ea("scroll",l),m.onScrollEnd!=null&&ea("scrollend",l),m.onClick!=null&&(l.onclick=nn),l=!0):l=!1,l||Rs(n,!0)}function Wa(n){for(oa=n.return;oa;)switch(oa.tag){case 5:case 31:case 13:cn=!1;return;case 27:case 3:cn=!0;return;default:oa=oa.return}}function us(n){if(n!==oa)return!1;if(!Kt)return Wa(n),Kt=!0,!1;var l=n.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=n.type,u=!(u!=="form"&&u!=="button")||Vm(n.type,n.memoizedProps)),u=!u),u&&ca&&Rs(n),Wa(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ca=wb(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ca=wb(n)}else l===27?(l=ca,Qi(n.type)?(n=Xm,Xm=null,ca=n):ca=l):ca=oa?Xn(n.stateNode.nextSibling):null;return!0}function ei(){ca=oa=null,Kt=!1}function sd(){var n=Ps;return n!==null&&(hn===null?hn=n:hn.push.apply(hn,n),Ps=null),n}function Rl(n){Ps===null?Ps=[n]:Ps.push(n)}var Fl=F(null),Fs=null,fs=null;function Bi(n,l,u){H(Fl,l._currentValue),l._currentValue=u}function ti(n){n._currentValue=Fl.current,D(Fl)}function Ah(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 Oh(n,l,u,m){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var w=_.dependencies;if(w!==null){var R=_.child;w=w.firstContext;e:for(;w!==null;){var X=w;w=_;for(var be=0;be<l.length;be++)if(X.context===l[be]){w.lanes|=u,X=w.alternate,X!==null&&(X.lanes|=u),Ah(w.return,u,n),m||(R=null);break e}w=X.next}}else if(_.tag===18){if(R=_.return,R===null)throw Error(s(341));R.lanes|=u,w=R.alternate,w!==null&&(w.lanes|=u),Ah(R,u,n),R=null}else R=_.child;if(R!==null)R.return=_;else for(R=_;R!==null;){if(R===n){R=null;break}if(_=R.sibling,_!==null){_.return=R.return,R=_;break}R=R.return}_=R}}function Ro(n,l,u,m){n=null;for(var _=l,w=!1;_!==null;){if(!w){if((_.flags&524288)!==0)w=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var R=_.alternate;if(R===null)throw Error(s(387));if(R=R.memoizedProps,R!==null){var X=_.type;xr(_.pendingProps.value,R.value)||(n!==null?n.push(X):n=[X])}}else if(_===Le.current){if(R=_.alternate,R===null)throw Error(s(387));R.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Md):n=[Md])}_=_.return}n!==null&&Oh(l,n,u,m),l.flags|=262144}function J0(n){for(n=n.firstContext;n!==null;){if(!xr(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Il(n){Fs=n,fs=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Er(n){return Kp(Fs,n)}function K0(n,l){return Fs===null&&Il(n),Kp(n,l)}function Kp(n,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},fs===null){if(n===null)throw Error(s(308));fs=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else fs=fs.next=l;return u}var x4=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()})}},y4=e.unstable_scheduleCallback,b4=e.unstable_NormalPriority,nr={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mh(){return{controller:new x4,data:new Map,refCount:0}}function id(n){n.refCount--,n.refCount===0&&y4(b4,function(){n.controller.abort()})}var ld=null,Lh=0,Fo=0,Io=null;function v4(n,l){if(ld===null){var u=ld=[];Lh=0,Fo=Rm(),Io={status:"pending",value:void 0,then:function(m){u.push(m)}}}return Lh++,l.then(Qp,Qp),l}function Qp(){if(--Lh===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 _4(n,l){var u=[],m={status:"pending",value:null,reason:null,then:function(_){u.push(_)}};return n.then(function(){m.status="fulfilled",m.value=l;for(var _=0;_<u.length;_++)(0,u[_])(l)},function(_){for(m.status="rejected",m.reason=_,_=0;_<u.length;_++)(0,u[_])(void 0)}),m}var ex=ee.S;ee.S=function(n,l){Fy=Ue(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&v4(n,l),ex!==null&&ex(n,l)};var zl=F(null);function Dh(){var n=zl.current;return n!==null?n:Pa.pooledCache}function Q0(n,l){l===null?H(zl,zl.current):H(zl,l.pool)}function tx(){var n=Dh();return n===null?null:{parent:nr._currentValue,pool:n}}var zo=Error(s(460)),Ph=Error(s(474)),eu=Error(s(542)),tu={then:function(){}};function ax(n){return n=n.status,n==="fulfilled"||n==="rejected"}function rx(n,l,u){switch(u=n[u],u===void 0?n.push(l):u!==l&&(l.then(nn,nn),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,sx(n),n;default:if(typeof l.status=="string")l.then(nn,nn);else{if(n=Pa,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=l,n.status="pending",n.then(function(m){if(l.status==="pending"){var _=l;_.status="fulfilled",_.value=m}},function(m){if(l.status==="pending"){var _=l;_.status="rejected",_.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,sx(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 nx(){if(Ul===null)throw Error(s(459));var n=Ul;return Ul=null,n}function sx(n){if(n===zo||n===eu)throw Error(s(483))}var Bo=null,od=0;function au(n){var l=od;return od+=1,Bo===null&&(Bo=[]),rx(Bo,n,l)}function cd(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function ru(n,l){throw l.$$typeof===v?Error(s(525)):(n=Object.prototype.toString.call(l),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function ix(n){function l(Te,_e){if(n){var Oe=Te.deletions;Oe===null?(Te.deletions=[_e],Te.flags|=16):Oe.push(_e)}}function u(Te,_e){if(!n)return null;for(;_e!==null;)l(Te,_e),_e=_e.sibling;return null}function m(Te){for(var _e=new Map;Te!==null;)Te.key!==null?_e.set(Te.key,Te):_e.set(Te.index,Te),Te=Te.sibling;return _e}function _(Te,_e){return Te=qn(Te,_e),Te.index=0,Te.sibling=null,Te}function w(Te,_e,Oe){return Te.index=Oe,n?(Oe=Te.alternate,Oe!==null?(Oe=Oe.index,Oe<_e?(Te.flags|=67108866,_e):Oe):(Te.flags|=67108866,_e)):(Te.flags|=1048576,_e)}function R(Te){return n&&Te.alternate===null&&(Te.flags|=67108866),Te}function X(Te,_e,Oe,Xe){return _e===null||_e.tag!==6?(_e=Do(Oe,Te.mode,Xe),_e.return=Te,_e):(_e=_(_e,Oe),_e.return=Te,_e)}function be(Te,_e,Oe,Xe){var Pt=Oe.type;return Pt===N?Ze(Te,_e,Oe.props.children,Xe,Oe.key):_e!==null&&(_e.elementType===Pt||typeof Pt=="object"&&Pt!==null&&Pt.$$typeof===U&&Bl(Pt)===_e.type)?(_e=_(_e,Oe.props),cd(_e,Oe),_e.return=Te,_e):(_e=Pl(Oe.type,Oe.key,Oe.props,null,Te.mode,Xe),cd(_e,Oe),_e.return=Te,_e)}function Me(Te,_e,Oe,Xe){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==Oe.containerInfo||_e.stateNode.implementation!==Oe.implementation?(_e=rd(Oe,Te.mode,Xe),_e.return=Te,_e):(_e=_(_e,Oe.children||[]),_e.return=Te,_e)}function Ze(Te,_e,Oe,Xe,Pt){return _e===null||_e.tag!==7?(_e=Qs(Oe,Te.mode,Xe,Pt),_e.return=Te,_e):(_e=_(_e,Oe),_e.return=Te,_e)}function Ke(Te,_e,Oe){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return _e=Do(""+_e,Te.mode,Oe),_e.return=Te,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case k:return Oe=Pl(_e.type,_e.key,_e.props,null,Te.mode,Oe),cd(Oe,_e),Oe.return=Te,Oe;case T:return _e=rd(_e,Te.mode,Oe),_e.return=Te,_e;case U:return _e=Bl(_e),Ke(Te,_e,Oe)}if(me(_e)||ie(_e))return _e=Qs(_e,Te.mode,Oe,null),_e.return=Te,_e;if(typeof _e.then=="function")return Ke(Te,au(_e),Oe);if(_e.$$typeof===O)return Ke(Te,K0(Te,_e),Oe);ru(Te,_e)}return null}function Re(Te,_e,Oe,Xe){var Pt=_e!==null?_e.key:null;if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return Pt!==null?null:X(Te,_e,""+Oe,Xe);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case k:return Oe.key===Pt?be(Te,_e,Oe,Xe):null;case T:return Oe.key===Pt?Me(Te,_e,Oe,Xe):null;case U:return Oe=Bl(Oe),Re(Te,_e,Oe,Xe)}if(me(Oe)||ie(Oe))return Pt!==null?null:Ze(Te,_e,Oe,Xe,null);if(typeof Oe.then=="function")return Re(Te,_e,au(Oe),Xe);if(Oe.$$typeof===O)return Re(Te,_e,K0(Te,Oe),Xe);ru(Te,Oe)}return null}function $e(Te,_e,Oe,Xe,Pt){if(typeof Xe=="string"&&Xe!==""||typeof Xe=="number"||typeof Xe=="bigint")return Te=Te.get(Oe)||null,X(_e,Te,""+Xe,Pt);if(typeof Xe=="object"&&Xe!==null){switch(Xe.$$typeof){case k:return Te=Te.get(Xe.key===null?Oe:Xe.key)||null,be(_e,Te,Xe,Pt);case T:return Te=Te.get(Xe.key===null?Oe:Xe.key)||null,Me(_e,Te,Xe,Pt);case U:return Xe=Bl(Xe),$e(Te,_e,Oe,Xe,Pt)}if(me(Xe)||ie(Xe))return Te=Te.get(Oe)||null,Ze(_e,Te,Xe,Pt,null);if(typeof Xe.then=="function")return $e(Te,_e,Oe,au(Xe),Pt);if(Xe.$$typeof===O)return $e(Te,_e,Oe,K0(_e,Xe),Pt);ru(_e,Xe)}return null}function Ct(Te,_e,Oe,Xe){for(var Pt=null,da=null,Ot=_e,Xt=_e=0,na=null;Ot!==null&&Xt<Oe.length;Xt++){Ot.index>Xt?(na=Ot,Ot=null):na=Ot.sibling;var ua=Re(Te,Ot,Oe[Xt],Xe);if(ua===null){Ot===null&&(Ot=na);break}n&&Ot&&ua.alternate===null&&l(Te,Ot),_e=w(ua,_e,Xt),da===null?Pt=ua:da.sibling=ua,da=ua,Ot=na}if(Xt===Oe.length)return u(Te,Ot),Kt&&Lt(Te,Xt),Pt;if(Ot===null){for(;Xt<Oe.length;Xt++)Ot=Ke(Te,Oe[Xt],Xe),Ot!==null&&(_e=w(Ot,_e,Xt),da===null?Pt=Ot:da.sibling=Ot,da=Ot);return Kt&&Lt(Te,Xt),Pt}for(Ot=m(Ot);Xt<Oe.length;Xt++)na=$e(Ot,Te,Xt,Oe[Xt],Xe),na!==null&&(n&&na.alternate!==null&&Ot.delete(na.key===null?Xt:na.key),_e=w(na,_e,Xt),da===null?Pt=na:da.sibling=na,da=na);return n&&Ot.forEach(function(nl){return l(Te,nl)}),Kt&&Lt(Te,Xt),Pt}function It(Te,_e,Oe,Xe){if(Oe==null)throw Error(s(151));for(var Pt=null,da=null,Ot=_e,Xt=_e=0,na=null,ua=Oe.next();Ot!==null&&!ua.done;Xt++,ua=Oe.next()){Ot.index>Xt?(na=Ot,Ot=null):na=Ot.sibling;var nl=Re(Te,Ot,ua.value,Xe);if(nl===null){Ot===null&&(Ot=na);break}n&&Ot&&nl.alternate===null&&l(Te,Ot),_e=w(nl,_e,Xt),da===null?Pt=nl:da.sibling=nl,da=nl,Ot=na}if(ua.done)return u(Te,Ot),Kt&&Lt(Te,Xt),Pt;if(Ot===null){for(;!ua.done;Xt++,ua=Oe.next())ua=Ke(Te,ua.value,Xe),ua!==null&&(_e=w(ua,_e,Xt),da===null?Pt=ua:da.sibling=ua,da=ua);return Kt&&Lt(Te,Xt),Pt}for(Ot=m(Ot);!ua.done;Xt++,ua=Oe.next())ua=$e(Ot,Te,Xt,ua.value,Xe),ua!==null&&(n&&ua.alternate!==null&&Ot.delete(ua.key===null?Xt:ua.key),_e=w(ua,_e,Xt),da===null?Pt=ua:da.sibling=ua,da=ua);return n&&Ot.forEach(function(Mk){return l(Te,Mk)}),Kt&&Lt(Te,Xt),Pt}function Aa(Te,_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 Pt=Oe.key;_e!==null;){if(_e.key===Pt){if(Pt=Oe.type,Pt===N){if(_e.tag===7){u(Te,_e.sibling),Xe=_(_e,Oe.props.children),Xe.return=Te,Te=Xe;break e}}else if(_e.elementType===Pt||typeof Pt=="object"&&Pt!==null&&Pt.$$typeof===U&&Bl(Pt)===_e.type){u(Te,_e.sibling),Xe=_(_e,Oe.props),cd(Xe,Oe),Xe.return=Te,Te=Xe;break e}u(Te,_e);break}else l(Te,_e);_e=_e.sibling}Oe.type===N?(Xe=Qs(Oe.props.children,Te.mode,Xe,Oe.key),Xe.return=Te,Te=Xe):(Xe=Pl(Oe.type,Oe.key,Oe.props,null,Te.mode,Xe),cd(Xe,Oe),Xe.return=Te,Te=Xe)}return R(Te);case T:e:{for(Pt=Oe.key;_e!==null;){if(_e.key===Pt)if(_e.tag===4&&_e.stateNode.containerInfo===Oe.containerInfo&&_e.stateNode.implementation===Oe.implementation){u(Te,_e.sibling),Xe=_(_e,Oe.children||[]),Xe.return=Te,Te=Xe;break e}else{u(Te,_e);break}else l(Te,_e);_e=_e.sibling}Xe=rd(Oe,Te.mode,Xe),Xe.return=Te,Te=Xe}return R(Te);case U:return Oe=Bl(Oe),Aa(Te,_e,Oe,Xe)}if(me(Oe))return Ct(Te,_e,Oe,Xe);if(ie(Oe)){if(Pt=ie(Oe),typeof Pt!="function")throw Error(s(150));return Oe=Pt.call(Oe),It(Te,_e,Oe,Xe)}if(typeof Oe.then=="function")return Aa(Te,_e,au(Oe),Xe);if(Oe.$$typeof===O)return Aa(Te,_e,K0(Te,Oe),Xe);ru(Te,Oe)}return typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint"?(Oe=""+Oe,_e!==null&&_e.tag===6?(u(Te,_e.sibling),Xe=_(_e,Oe),Xe.return=Te,Te=Xe):(u(Te,_e),Xe=Do(Oe,Te.mode,Xe),Xe.return=Te,Te=Xe),R(Te)):u(Te,_e)}return function(Te,_e,Oe,Xe){try{od=0;var Pt=Aa(Te,_e,Oe,Xe);return Bo=null,Pt}catch(Ot){if(Ot===zo||Ot===eu)throw Ot;var da=Br(29,Ot,null,Te.mode);return da.lanes=Xe,da.return=Te,da}finally{}}}var Hl=ix(!0),lx=ix(!1),Ui=!1;function Rh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fh(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 Hi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function $i(n,l,u){var m=n.updateQueue;if(m===null)return null;if(m=m.shared,(ga&2)!==0){var _=m.pending;return _===null?l.next=l:(l.next=_.next,_.next=l),m.pending=l,l=Dl(n),zi(n,null,u),l}return Ds(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,an(n,u)}}function Ih(n,l){var u=n.updateQueue,m=n.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var _=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?_=w=R:w=w.next=R,u=u.next}while(u!==null);w===null?_=w=l:w=w.next=l}else _=w=l;u={baseState:m.baseState,firstBaseUpdate:_,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 zh=!1;function ud(){if(zh){var n=Io;if(n!==null)throw n}}function fd(n,l,u,m){zh=!1;var _=n.updateQueue;Ui=!1;var w=_.firstBaseUpdate,R=_.lastBaseUpdate,X=_.shared.pending;if(X!==null){_.shared.pending=null;var be=X,Me=be.next;be.next=null,R===null?w=Me:R.next=Me,R=be;var Ze=n.alternate;Ze!==null&&(Ze=Ze.updateQueue,X=Ze.lastBaseUpdate,X!==R&&(X===null?Ze.firstBaseUpdate=Me:X.next=Me,Ze.lastBaseUpdate=be))}if(w!==null){var Ke=_.baseState;R=0,Ze=Me=be=null,X=w;do{var Re=X.lane&-536870913,$e=Re!==X.lane;if($e?(ra&Re)===Re:(m&Re)===Re){Re!==0&&Re===Fo&&(zh=!0),Ze!==null&&(Ze=Ze.next={lane:0,tag:X.tag,payload:X.payload,callback:null,next:null});e:{var Ct=n,It=X;Re=l;var Aa=u;switch(It.tag){case 1:if(Ct=It.payload,typeof Ct=="function"){Ke=Ct.call(Aa,Ke,Re);break e}Ke=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=It.payload,Re=typeof Ct=="function"?Ct.call(Aa,Ke,Re):Ct,Re==null)break e;Ke=y({},Ke,Re);break e;case 2:Ui=!0}}Re=X.callback,Re!==null&&(n.flags|=64,$e&&(n.flags|=8192),$e=_.callbacks,$e===null?_.callbacks=[Re]:$e.push(Re))}else $e={lane:Re,tag:X.tag,payload:X.payload,callback:X.callback,next:null},Ze===null?(Me=Ze=$e,be=Ke):Ze=Ze.next=$e,R|=Re;if(X=X.next,X===null){if(X=_.shared.pending,X===null)break;$e=X,X=$e.next,$e.next=null,_.lastBaseUpdate=$e,_.shared.pending=null}}while(!0);Ze===null&&(be=Ke),_.baseState=be,_.firstBaseUpdate=Me,_.lastBaseUpdate=Ze,w===null&&(_.shared.lanes=0),qi|=R,n.lanes=R,n.memoizedState=Ke}}function ox(n,l){if(typeof n!="function")throw Error(s(191,n));n.call(l)}function cx(n,l){var u=n.callbacks;if(u!==null)for(n.callbacks=null,n=0;n<u.length;n++)ox(u[n],l)}var Uo=F(null),nu=F(0);function dx(n,l){n=di,H(nu,n),H(Uo,l),di=n|l.baseLanes}function Bh(){H(nu,di),H(Uo,Uo.current)}function Uh(){di=nu.current,D(Uo),D(nu)}var En=F(null),Yn=null;function Wi(n){var l=n.alternate;H(Qa,Qa.current&1),H(En,n),Yn===null&&(l===null||Uo.current!==null||l.memoizedState!==null)&&(Yn=n)}function Hh(n){H(Qa,Qa.current),H(En,n),Yn===null&&(Yn=n)}function ux(n){n.tag===22?(H(Qa,Qa.current),H(En,n),Yn===null&&(Yn=n)):Vi()}function Vi(){H(Qa,Qa.current),H(En,En.current)}function Cn(n){D(En),Yn===n&&(Yn=null),D(Qa)}var Qa=F(0);function su(n){for(var l=n;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||qm(u)||Ym(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 ai=0,Zt=null,Ea=null,sr=null,iu=!1,Ho=!1,$l=!1,lu=0,hd=0,$o=null,w4=0;function qa(){throw Error(s(321))}function $h(n,l){if(l===null)return!1;for(var u=0;u<l.length&&u<n.length;u++)if(!xr(n[u],l[u]))return!1;return!0}function Wh(n,l,u,m,_,w){return ai=w,Zt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,ee.H=n===null||n.memoizedState===null?qx:sm,$l=!1,w=u(m,_),$l=!1,Ho&&(w=hx(l,u,m,_)),fx(n),w}function fx(n){ee.H=pd;var l=Ea!==null&&Ea.next!==null;if(ai=0,sr=Ea=Zt=null,iu=!1,hd=0,$o=null,l)throw Error(s(300));n===null||ir||(n=n.dependencies,n!==null&&J0(n)&&(ir=!0))}function hx(n,l,u,m){Zt=n;var _=0;do{if(Ho&&($o=null),hd=0,Ho=!1,25<=_)throw Error(s(301));if(_+=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)}ee.H=Yx,w=l(u,m)}while(Ho);return w}function k4(){var n=ee.H,l=n.useState()[0];return l=typeof l.then=="function"?md(l):l,n=n.useState()[0],(Ea!==null?Ea.memoizedState:null)!==n&&(Zt.flags|=1024),l}function Vh(){var n=lu!==0;return lu=0,n}function Gh(n,l,u){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~u}function Zh(n){if(iu){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}iu=!1}ai=0,sr=Ea=Zt=null,Ho=!1,hd=lu=0,$o=null}function Yr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sr===null?Zt.memoizedState=sr=n:sr=sr.next=n,sr}function er(){if(Ea===null){var n=Zt.alternate;n=n!==null?n.memoizedState:null}else n=Ea.next;var l=sr===null?Zt.memoizedState:sr.next;if(l!==null)sr=l,Ea=n;else{if(n===null)throw Zt.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?Zt.memoizedState=sr=n:sr=sr.next=n}return sr}function ou(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function md(n){var l=hd;return hd+=1,$o===null&&($o=[]),n=rx($o,n,l),l=Zt,(sr===null?l.memoizedState:sr.next)===null&&(l=l.alternate,ee.H=l===null||l.memoizedState===null?qx:sm),n}function cu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return md(n);if(n.$$typeof===O)return Er(n)}throw Error(s(438,String(n)))}function qh(n){var l=null,u=Zt.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var m=Zt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(_){return _.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=ou(),Zt.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]=de;return l.index++,u}function ri(n,l){return typeof l=="function"?l(n):l}function du(n){var l=er();return Yh(l,Ea,n)}function Yh(n,l,u){var m=n.queue;if(m===null)throw Error(s(311));m.lastRenderedReducer=u;var _=n.baseQueue,w=m.pending;if(w!==null){if(_!==null){var R=_.next;_.next=w.next,w.next=R}l.baseQueue=_=w,m.pending=null}if(w=n.baseState,_===null)n.memoizedState=w;else{l=_.next;var X=R=null,be=null,Me=l,Ze=!1;do{var Ke=Me.lane&-536870913;if(Ke!==Me.lane?(ra&Ke)===Ke:(ai&Ke)===Ke){var Re=Me.revertLane;if(Re===0)be!==null&&(be=be.next={lane:0,revertLane:0,gesture:null,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null}),Ke===Fo&&(Ze=!0);else if((ai&Re)===Re){Me=Me.next,Re===Fo&&(Ze=!0);continue}else Ke={lane:0,revertLane:Me.revertLane,gesture:null,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null},be===null?(X=be=Ke,R=w):be=be.next=Ke,Zt.lanes|=Re,qi|=Re;Ke=Me.action,$l&&u(w,Ke),w=Me.hasEagerState?Me.eagerState:u(w,Ke)}else Re={lane:Ke,revertLane:Me.revertLane,gesture:Me.gesture,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null},be===null?(X=be=Re,R=w):be=be.next=Re,Zt.lanes|=Ke,qi|=Ke;Me=Me.next}while(Me!==null&&Me!==l);if(be===null?R=w:be.next=X,!xr(w,n.memoizedState)&&(ir=!0,Ze&&(u=Io,u!==null)))throw u;n.memoizedState=w,n.baseState=R,n.baseQueue=be,m.lastRenderedState=w}return _===null&&(m.lanes=0),[n.memoizedState,m.dispatch]}function Xh(n){var l=er(),u=l.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=n;var m=u.dispatch,_=u.pending,w=l.memoizedState;if(_!==null){u.pending=null;var R=_=_.next;do w=n(w,R.action),R=R.next;while(R!==_);xr(w,l.memoizedState)||(ir=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),u.lastRenderedState=w}return[w,m]}function mx(n,l,u){var m=Zt,_=er(),w=Kt;if(w){if(u===void 0)throw Error(s(407));u=u()}else u=l();var R=!xr((Ea||_).memoizedState,u);if(R&&(_.memoizedState=u,ir=!0),_=_.queue,Qh(xx.bind(null,m,_,n),[n]),_.getSnapshot!==l||R||sr!==null&&sr.memoizedState.tag&1){if(m.flags|=2048,Wo(9,{destroy:void 0},px.bind(null,m,_,u,l),null),Pa===null)throw Error(s(349));w||(ai&127)!==0||gx(m,l,u)}return u}function gx(n,l,u){n.flags|=16384,n={getSnapshot:l,value:u},l=Zt.updateQueue,l===null?(l=ou(),Zt.updateQueue=l,l.stores=[n]):(u=l.stores,u===null?l.stores=[n]:u.push(n))}function px(n,l,u,m){l.value=u,l.getSnapshot=m,yx(l)&&bx(n)}function xx(n,l,u){return u(function(){yx(l)&&bx(n)})}function yx(n){var l=n.getSnapshot;n=n.value;try{var u=l();return!xr(n,u)}catch(m){return!0}}function bx(n){var l=Zn(n,2);l!==null&&mn(l,n,2)}function Jh(n){var l=Yr();if(typeof n=="function"){var u=n;if(n=u(),$l){ut(!0);try{u()}finally{ut(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:n},l}function vx(n,l,u,m){return n.baseState=u,Yh(n,Ea,typeof m=="function"?m:ri)}function N4(n,l,u,m,_){if(hu(n))throw Error(s(485));if(n=l.action,n!==null){var w={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){w.listeners.push(R)}};ee.T!==null?u(!0):w.isTransition=!1,m(w),u=l.pending,u===null?(w.next=l.pending=w,_x(l,w)):(w.next=u.next,l.pending=u.next=w)}}function _x(n,l){var u=l.action,m=l.payload,_=n.state;if(l.isTransition){var w=ee.T,R={};ee.T=R;try{var X=u(_,m),be=ee.S;be!==null&&be(R,X),wx(n,l,X)}catch(Me){Kh(n,l,Me)}finally{w!==null&&R.types!==null&&(w.types=R.types),ee.T=w}}else try{w=u(_,m),wx(n,l,w)}catch(Me){Kh(n,l,Me)}}function wx(n,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){kx(n,l,m)},function(m){return Kh(n,l,m)}):kx(n,l,u)}function kx(n,l,u){l.status="fulfilled",l.value=u,Nx(l),n.state=u,l=n.pending,l!==null&&(u=l.next,u===l?n.pending=null:(u=u.next,l.next=u,_x(n,u)))}function Kh(n,l,u){var m=n.pending;if(n.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=u,Nx(l),l=l.next;while(l!==m)}n.action=null}function Nx(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function jx(n,l){return l}function Sx(n,l){if(Kt){var u=Pa.formState;if(u!==null){e:{var m=Zt;if(Kt){if(ca){t:{for(var _=ca,w=cn;_.nodeType!==8;){if(!w){_=null;break t}if(_=Xn(_.nextSibling),_===null){_=null;break t}}w=_.data,_=w==="F!"||w==="F"?_:null}if(_){ca=Xn(_.nextSibling),m=_.data==="F!";break e}}Rs(m)}m=!1}m&&(l=u[0])}}return u=Yr(),u.memoizedState=u.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jx,lastRenderedState:l},u.queue=m,u=Vx.bind(null,Zt,m),m.dispatch=u,m=Jh(!1),w=nm.bind(null,Zt,!1,m.queue),m=Yr(),_={state:l,dispatch:null,action:n,pending:null},m.queue=_,u=N4.bind(null,Zt,_,w,u),_.dispatch=u,m.memoizedState=n,[l,u,!1]}function Tx(n){var l=er();return Ex(l,Ea,n)}function Ex(n,l,u){if(l=Yh(n,l,jx)[0],n=du(ri)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=md(l)}catch(R){throw R===zo?eu:R}else m=l;l=er();var _=l.queue,w=_.dispatch;return u!==l.memoizedState&&(Zt.flags|=2048,Wo(9,{destroy:void 0},j4.bind(null,_,u),null)),[m,w,n]}function j4(n,l){n.action=l}function Cx(n){var l=er(),u=Ea;if(u!==null)return Ex(l,u,n);er(),l=l.memoizedState,u=er();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=Zt.updateQueue,l===null&&(l=ou(),Zt.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 Ax(){return er().memoizedState}function uu(n,l,u,m){var _=Yr();Zt.flags|=n,_.memoizedState=Wo(1|l,{destroy:void 0},u,m===void 0?null:m)}function fu(n,l,u,m){var _=er();m=m===void 0?null:m;var w=_.memoizedState.inst;Ea!==null&&m!==null&&$h(m,Ea.memoizedState.deps)?_.memoizedState=Wo(l,w,u,m):(Zt.flags|=n,_.memoizedState=Wo(1|l,w,u,m))}function Ox(n,l){uu(8390656,8,n,l)}function Qh(n,l){fu(2048,8,n,l)}function S4(n){Zt.flags|=4;var l=Zt.updateQueue;if(l===null)l=ou(),Zt.updateQueue=l,l.events=[n];else{var u=l.events;u===null?l.events=[n]:u.push(n)}}function Mx(n){var l=er().memoizedState;return S4({ref:l,nextImpl:n}),function(){if((ga&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}function Lx(n,l){return fu(4,2,n,l)}function Dx(n,l){return fu(4,4,n,l)}function Px(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 Rx(n,l,u){u=u!=null?u.concat([n]):null,fu(4,4,Px.bind(null,l,n),u)}function em(){}function Fx(n,l){var u=er();l=l===void 0?null:l;var m=u.memoizedState;return l!==null&&$h(l,m[1])?m[0]:(u.memoizedState=[n,l],n)}function Ix(n,l){var u=er();l=l===void 0?null:l;var m=u.memoizedState;if(l!==null&&$h(l,m[1]))return m[0];if(m=n(),$l){ut(!0);try{n()}finally{ut(!1)}}return u.memoizedState=[m,l],m}function tm(n,l,u){return u===void 0||(ai&1073741824)!==0&&(ra&261930)===0?n.memoizedState=l:(n.memoizedState=u,n=zy(),Zt.lanes|=n,qi|=n,u)}function zx(n,l,u,m){return xr(u,l)?u:Uo.current!==null?(n=tm(n,u,m),xr(n,l)||(ir=!0),n):(ai&42)===0||(ai&1073741824)!==0&&(ra&261930)===0?(ir=!0,n.memoizedState=u):(n=zy(),Zt.lanes|=n,qi|=n,l)}function Bx(n,l,u,m,_){var w=q.p;q.p=w!==0&&8>w?w:8;var R=ee.T,X={};ee.T=X,nm(n,!1,l,u);try{var be=_(),Me=ee.S;if(Me!==null&&Me(X,be),be!==null&&typeof be=="object"&&typeof be.then=="function"){var Ze=_4(be,m);gd(n,l,Ze,Mn(n))}else gd(n,l,m,Mn(n))}catch(Ke){gd(n,l,{then:function(){},status:"rejected",reason:Ke},Mn())}finally{q.p=w,R!==null&&X.types!==null&&(R.types=X.types),ee.T=R}}function T4(){}function am(n,l,u,m){if(n.tag!==5)throw Error(s(476));var _=Ux(n).queue;Bx(n,_,l,Q,u===null?T4:function(){return Hx(n),u(m)})}function Ux(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:Q},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:u},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function Hx(n){var l=Ux(n);l.next===null&&(l=n.alternate.memoizedState),gd(n,l.next.queue,{},Mn())}function rm(){return Er(Md)}function $x(){return er().memoizedState}function Wx(){return er().memoizedState}function E4(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var u=Mn();n=Hi(u);var m=$i(l,n,u);m!==null&&(mn(m,l,u),dd(m,l,u)),l={cache:Mh()},n.payload=l;return}l=l.return}}function C4(n,l,u){var m=Mn();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},hu(n)?Gx(l,u):(u=ed(n,l,u,m),u!==null&&(mn(u,n,m),Zx(u,l,m)))}function Vx(n,l,u){var m=Mn();gd(n,l,u,m)}function gd(n,l,u,m){var _={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(hu(n))Gx(l,_);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var R=l.lastRenderedState,X=w(R,u);if(_.hasEagerState=!0,_.eagerState=X,xr(X,R))return Ds(n,l,_,0),Pa===null&&Ll(),!1}catch(be){}finally{}if(u=ed(n,l,_,m),u!==null)return mn(u,n,m),Zx(u,l,m),!0}return!1}function nm(n,l,u,m){if(m={lane:2,revertLane:Rm(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},hu(n)){if(l)throw Error(s(479))}else l=ed(n,u,m,2),l!==null&&mn(l,n,2)}function hu(n){var l=n.alternate;return n===Zt||l!==null&&l===Zt}function Gx(n,l){Ho=iu=!0;var u=n.pending;u===null?l.next=l:(l.next=u.next,u.next=l),n.pending=l}function Zx(n,l,u){if((u&4194048)!==0){var m=l.lanes;m&=n.pendingLanes,u|=m,l.lanes=u,an(n,u)}}var pd={readContext:Er,use:cu,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 qx={readContext:Er,use:cu,useCallback:function(n,l){return Yr().memoizedState=[n,l===void 0?null:l],n},useContext:Er,useEffect:Ox,useImperativeHandle:function(n,l,u){u=u!=null?u.concat([n]):null,uu(4194308,4,Px.bind(null,l,n),u)},useLayoutEffect:function(n,l){return uu(4194308,4,n,l)},useInsertionEffect:function(n,l){uu(4,2,n,l)},useMemo:function(n,l){var u=Yr();l=l===void 0?null:l;var m=n();if($l){ut(!0);try{n()}finally{ut(!1)}}return u.memoizedState=[m,l],m},useReducer:function(n,l,u){var m=Yr();if(u!==void 0){var _=u(l);if($l){ut(!0);try{u(l)}finally{ut(!1)}}}else _=l;return m.memoizedState=m.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},m.queue=n,n=n.dispatch=C4.bind(null,Zt,n),[m.memoizedState,n]},useRef:function(n){var l=Yr();return n={current:n},l.memoizedState=n},useState:function(n){n=Jh(n);var l=n.queue,u=Vx.bind(null,Zt,l);return l.dispatch=u,[n.memoizedState,u]},useDebugValue:em,useDeferredValue:function(n,l){var u=Yr();return tm(u,n,l)},useTransition:function(){var n=Jh(!1);return n=Bx.bind(null,Zt,n.queue,!0,!1),Yr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,u){var m=Zt,_=Yr();if(Kt){if(u===void 0)throw Error(s(407));u=u()}else{if(u=l(),Pa===null)throw Error(s(349));(ra&127)!==0||gx(m,l,u)}_.memoizedState=u;var w={value:u,getSnapshot:l};return _.queue=w,Ox(xx.bind(null,m,w,n),[n]),m.flags|=2048,Wo(9,{destroy:void 0},px.bind(null,m,w,u,l),null),u},useId:function(){var n=Yr(),l=Pa.identifierPrefix;if(Kt){var u=yt,m=Je;u=(m&~(1<<32-Nt(m)-1)).toString(32)+u,l="_"+l+"R_"+u,u=lu++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=w4++,l="_"+l+"r_"+u.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:rm,useFormState:Sx,useActionState:Sx,useOptimistic:function(n){var l=Yr();l.memoizedState=l.baseState=n;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=nm.bind(null,Zt,!0,u),u.dispatch=l,[n,l]},useMemoCache:qh,useCacheRefresh:function(){return Yr().memoizedState=E4.bind(null,Zt)},useEffectEvent:function(n){var l=Yr(),u={impl:n};return l.memoizedState=u,function(){if((ga&2)!==0)throw Error(s(440));return u.impl.apply(void 0,arguments)}}},sm={readContext:Er,use:cu,useCallback:Fx,useContext:Er,useEffect:Qh,useImperativeHandle:Rx,useInsertionEffect:Lx,useLayoutEffect:Dx,useMemo:Ix,useReducer:du,useRef:Ax,useState:function(){return du(ri)},useDebugValue:em,useDeferredValue:function(n,l){var u=er();return zx(u,Ea.memoizedState,n,l)},useTransition:function(){var n=du(ri)[0],l=er().memoizedState;return[typeof n=="boolean"?n:md(n),l]},useSyncExternalStore:mx,useId:$x,useHostTransitionStatus:rm,useFormState:Tx,useActionState:Tx,useOptimistic:function(n,l){var u=er();return vx(u,Ea,n,l)},useMemoCache:qh,useCacheRefresh:Wx};sm.useEffectEvent=Mx;var Yx={readContext:Er,use:cu,useCallback:Fx,useContext:Er,useEffect:Qh,useImperativeHandle:Rx,useInsertionEffect:Lx,useLayoutEffect:Dx,useMemo:Ix,useReducer:Xh,useRef:Ax,useState:function(){return Xh(ri)},useDebugValue:em,useDeferredValue:function(n,l){var u=er();return Ea===null?tm(u,n,l):zx(u,Ea.memoizedState,n,l)},useTransition:function(){var n=Xh(ri)[0],l=er().memoizedState;return[typeof n=="boolean"?n:md(n),l]},useSyncExternalStore:mx,useId:$x,useHostTransitionStatus:rm,useFormState:Cx,useActionState:Cx,useOptimistic:function(n,l){var u=er();return Ea!==null?vx(u,Ea,n,l):(u.baseState=n,[n,u.queue.dispatch])},useMemoCache:qh,useCacheRefresh:Wx};Yx.useEffectEvent=Mx;function im(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 lm={enqueueSetState:function(n,l,u){n=n._reactInternals;var m=Mn(),_=Hi(m);_.payload=l,u!=null&&(_.callback=u),l=$i(n,_,m),l!==null&&(mn(l,n,m),dd(l,n,m))},enqueueReplaceState:function(n,l,u){n=n._reactInternals;var m=Mn(),_=Hi(m);_.tag=1,_.payload=l,u!=null&&(_.callback=u),l=$i(n,_,m),l!==null&&(mn(l,n,m),dd(l,n,m))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var u=Mn(),m=Hi(u);m.tag=2,l!=null&&(m.callback=l),l=$i(n,m,u),l!==null&&(mn(l,n,u),dd(l,n,u))}};function Xx(n,l,u,m,_,w,R){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(m,w,R):l.prototype&&l.prototype.isPureReactComponent?!Pi(u,m)||!Pi(_,w):!0}function Jx(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&&lm.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 _ in n)u[_]===void 0&&(u[_]=n[_])}return u}function Kx(n){Ml(n)}function Qx(n){console.error(n)}function ey(n){Ml(n)}function mu(n,l){try{var u=n.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function ty(n,l,u){try{var m=n.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function om(n,l,u){return u=Hi(u),u.tag=3,u.payload={element:null},u.callback=function(){mu(n,l)},u}function ay(n){return n=Hi(n),n.tag=3,n}function ry(n,l,u,m){var _=u.type.getDerivedStateFromError;if(typeof _=="function"){var w=m.value;n.payload=function(){return _(w)},n.callback=function(){ty(l,u,m)}}var R=u.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(n.callback=function(){ty(l,u,m),typeof _!="function"&&(Yi===null?Yi=new Set([this]):Yi.add(this));var X=m.stack;this.componentDidCatch(m.value,{componentStack:X!==null?X:""})})}function A4(n,l,u,m,_){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=u.alternate,l!==null&&Ro(l,u,_,!0),u=En.current,u!==null){switch(u.tag){case 31:case 13:return Yn===null?Su():u.alternate===null&&Ya===0&&(Ya=3),u.flags&=-257,u.flags|=65536,u.lanes=_,m===tu?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([m]):l.add(m),Lm(n,m,_)),!1;case 22:return u.flags|=65536,m===tu?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)),Lm(n,m,_)),!1}throw Error(s(435,u.tag))}return Lm(n,m,_),Su(),!1}if(Kt)return l=En.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=_,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,_&=-_,n.lanes|=_,m=h(m,u),_=om(n.stateNode,m,_),Ih(n,_),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=_&-_,u.lanes|=n,n=om(u.stateNode,m,n),Ih(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"&&(Yi===null||!Yi.has(w))))return u.flags|=65536,_&=-_,u.lanes|=_,_=ay(_),ry(_,n,u,m),Ih(u,_),!1}u=u.return}while(u!==null);return!1}var cm=Error(s(461)),ir=!1;function Cr(n,l,u,m){l.child=n===null?lx(l,null,u,m):Hl(l,n.child,u,m)}function ny(n,l,u,m,_){u=u.render;var w=l.ref;if("ref"in m){var R={};for(var X in m)X!=="ref"&&(R[X]=m[X])}else R=m;return Il(l),m=Wh(n,l,u,R,w,_),X=Vh(),n!==null&&!ir?(Gh(n,l,_),ni(n,l,_)):(Kt&&X&&fr(l),l.flags|=1,Cr(n,l,m,_),l.child)}function sy(n,l,u,m,_){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,iy(n,l,w,m,_)):(n=Pl(u.type,null,m,l,l.mode,_),n.ref=l.ref,n.return=l,l.child=n)}if(w=n.child,!xm(n,_)){var R=w.memoizedProps;if(u=u.compare,u=u!==null?u:Pi,u(R,m)&&n.ref===l.ref)return ni(n,l,_)}return l.flags|=1,n=qn(w,m),n.ref=l.ref,n.return=l,l.child=n}function iy(n,l,u,m,_){if(n!==null){var w=n.memoizedProps;if(Pi(w,m)&&n.ref===l.ref)if(ir=!1,l.pendingProps=m=w,xm(n,_))(n.flags&131072)!==0&&(ir=!0);else return l.lanes=n.lanes,ni(n,l,_)}return dm(n,l,u,m,_)}function ly(n,l,u,m){var _=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,_=0;m!==null;)_=_|m.lanes|m.childLanes,m=m.sibling;m=_&~w}else m=0,l.child=null;return oy(n,l,w,u,m)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&Q0(l,w!==null?w.cachePool:null),w!==null?dx(l,w):Bh(),ux(l);else return m=l.lanes=536870912,oy(n,l,w!==null?w.baseLanes|u:u,u,m)}else w!==null?(Q0(l,w.cachePool),dx(l,w),Vi(),l.memoizedState=null):(n!==null&&Q0(l,null),Bh(),Vi());return Cr(n,l,_,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 oy(n,l,u,m,_){var w=Dh();return w=w===null?null:{parent:nr._currentValue,pool:w},l.memoizedState={baseLanes:u,cachePool:w},n!==null&&Q0(l,null),Bh(),ux(l),n!==null&&Ro(n,l,m,!0),l.childLanes=_,null}function gu(n,l){return l=xu({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function cy(n,l,u){return Hl(l,n.child,null,u),n=gu(l,l.pendingProps),n.flags|=2,Cn(l),l.memoizedState=null,n}function O4(n,l,u){var m=l.pendingProps,_=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(Kt){if(m.mode==="hidden")return n=gu(l,m),l.lanes=536870912,xd(null,n);if(Hh(l),(n=ca)?(n=_b(n,cn),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:Pe!==null?{id:Je,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 Rs(l);return l.lanes=536870912,null}return gu(l,m)}var w=n.memoizedState;if(w!==null){var R=w.dehydrated;if(Hh(l),_)if(l.flags&256)l.flags&=-257,l=cy(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),_=(u&n.childLanes)!==0,ir||_){if(m=Pa,m!==null&&(R=_n(m,u),R!==0&&R!==w.retryLane))throw w.retryLane=R,Zn(n,R),mn(m,n,R),cm;Su(),l=cy(n,l,u)}else n=w.treeContext,ca=Xn(R.nextSibling),oa=l,Kt=!0,Ps=null,cn=!1,n!==null&&qr(l,n),l=gu(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 pu(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 dm(n,l,u,m,_){return Il(l),u=Wh(n,l,u,m,void 0,_),m=Vh(),n!==null&&!ir?(Gh(n,l,_),ni(n,l,_)):(Kt&&m&&fr(l),l.flags|=1,Cr(n,l,u,_),l.child)}function dy(n,l,u,m,_,w){return Il(l),l.updateQueue=null,u=hx(l,m,u,_),fx(n),m=Vh(),n!==null&&!ir?(Gh(n,l,w),ni(n,l,w)):(Kt&&m&&fr(l),l.flags|=1,Cr(n,l,u,w),l.child)}function uy(n,l,u,m,_){if(Il(l),l.stateNode===null){var w=Ks,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=lm,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=m,w.state=l.memoizedState,w.refs={},Rh(l),R=u.contextType,w.context=typeof R=="object"&&R!==null?Er(R):Ks,w.state=l.memoizedState,R=u.getDerivedStateFromProps,typeof R=="function"&&(im(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&&lm.enqueueReplaceState(w,w.state,null),fd(l,m,w,_),ud(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(n===null){w=l.stateNode;var X=l.memoizedProps,be=Wl(u,X);w.props=be;var Me=w.context,Ze=u.contextType;R=Ks,typeof Ze=="object"&&Ze!==null&&(R=Er(Ze));var Ke=u.getDerivedStateFromProps;Ze=typeof Ke=="function"||typeof w.getSnapshotBeforeUpdate=="function",X=l.pendingProps!==X,Ze||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(X||Me!==R)&&Jx(l,w,m,R),Ui=!1;var Re=l.memoizedState;w.state=Re,fd(l,m,w,_),ud(),Me=l.memoizedState,X||Re!==Me||Ui?(typeof Ke=="function"&&(im(l,u,Ke,m),Me=l.memoizedState),(be=Ui||Xx(l,u,be,m,Re,Me,R))?(Ze||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=Me),w.props=m,w.state=Me,w.context=R,m=be):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{w=l.stateNode,Fh(n,l),R=l.memoizedProps,Ze=Wl(u,R),w.props=Ze,Ke=l.pendingProps,Re=w.context,Me=u.contextType,be=Ks,typeof Me=="object"&&Me!==null&&(be=Er(Me)),X=u.getDerivedStateFromProps,(Me=typeof X=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(R!==Ke||Re!==be)&&Jx(l,w,m,be),Ui=!1,Re=l.memoizedState,w.state=Re,fd(l,m,w,_),ud();var $e=l.memoizedState;R!==Ke||Re!==$e||Ui||n!==null&&n.dependencies!==null&&J0(n.dependencies)?(typeof X=="function"&&(im(l,u,X,m),$e=l.memoizedState),(Ze=Ui||Xx(l,u,Ze,m,Re,$e,be)||n!==null&&n.dependencies!==null&&J0(n.dependencies))?(Me||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(m,$e,be),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(m,$e,be)),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=$e),w.props=m,w.state=$e,w.context=be,m=Ze):(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,pu(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,_),l.child=Hl(l,null,u,_)):Cr(n,l,u,_),l.memoizedState=w.state,n=l.child):n=ni(n,l,_),n}function fy(n,l,u,m){return ei(),l.flags|=256,Cr(n,l,u,m),l.child}var um={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fm(n){return{baseLanes:n,cachePool:tx()}}function hm(n,l,u){return n=n!==null?n.childLanes&~u:0,l&&(n|=On),n}function hy(n,l,u){var m=l.pendingProps,_=!1,w=(l.flags&128)!==0,R;if((R=w)||(R=n!==null&&n.memoizedState===null?!1:(Qa.current&2)!==0),R&&(_=!0,l.flags&=-129),R=(l.flags&32)!==0,l.flags&=-33,n===null){if(Kt){if(_?Wi(l):Vi(),(n=ca)?(n=_b(n,cn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:Pe!==null?{id:Je,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 Rs(l);return Ym(n)?l.lanes=32:l.lanes=536870912,null}var X=m.children;return m=m.fallback,_?(Vi(),_=l.mode,X=xu({mode:"hidden",children:X},_),m=Qs(m,_,u,null),X.return=l,m.return=l,X.sibling=m,l.child=X,m=l.child,m.memoizedState=fm(u),m.childLanes=hm(n,R,u),l.memoizedState=um,xd(null,m)):(Wi(l),mm(l,X))}var be=n.memoizedState;if(be!==null&&(X=be.dehydrated,X!==null)){if(w)l.flags&256?(Wi(l),l.flags&=-257,l=gm(n,l,u)):l.memoizedState!==null?(Vi(),l.child=n.child,l.flags|=128,l=null):(Vi(),X=m.fallback,_=l.mode,m=xu({mode:"visible",children:m.children},_),X=Qs(X,_,u,null),X.flags|=2,m.return=l,X.return=l,m.sibling=X,l.child=m,Hl(l,n.child,null,u),m=l.child,m.memoizedState=fm(u),m.childLanes=hm(n,R,u),l.memoizedState=um,l=xd(null,m));else if(Wi(l),Ym(X)){if(R=X.nextSibling&&X.nextSibling.dataset,R)var Me=R.dgst;R=Me,m=Error(s(419)),m.stack="",m.digest=R,Rl({value:m,source:null,stack:null}),l=gm(n,l,u)}else if(ir||Ro(n,l,u,!1),R=(u&n.childLanes)!==0,ir||R){if(R=Pa,R!==null&&(m=_n(R,u),m!==0&&m!==be.retryLane))throw be.retryLane=m,Zn(n,m),mn(R,n,m),cm;qm(X)||Su(),l=gm(n,l,u)}else qm(X)?(l.flags|=192,l.child=n.child,l=null):(n=be.treeContext,ca=Xn(X.nextSibling),oa=l,Kt=!0,Ps=null,cn=!1,n!==null&&qr(l,n),l=mm(l,m.children),l.flags|=4096);return l}return _?(Vi(),X=m.fallback,_=l.mode,be=n.child,Me=be.sibling,m=qn(be,{mode:"hidden",children:m.children}),m.subtreeFlags=be.subtreeFlags&65011712,Me!==null?X=qn(Me,X):(X=Qs(X,_,u,null),X.flags|=2),X.return=l,m.return=l,m.sibling=X,l.child=m,xd(null,m),m=l.child,X=n.child.memoizedState,X===null?X=fm(u):(_=X.cachePool,_!==null?(be=nr._currentValue,_=_.parent!==be?{parent:be,pool:be}:_):_=tx(),X={baseLanes:X.baseLanes|u,cachePool:_}),m.memoizedState=X,m.childLanes=hm(n,R,u),l.memoizedState=um,xd(n.child,m)):(Wi(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 mm(n,l){return l=xu({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function xu(n,l){return n=Br(22,n,null,l),n.lanes=0,n}function gm(n,l,u){return Hl(l,n.child,null,u),n=mm(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function my(n,l,u){n.lanes|=l;var m=n.alternate;m!==null&&(m.lanes|=l),Ah(n.return,l,u)}function pm(n,l,u,m,_,w){var R=n.memoizedState;R===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:_,treeForkCount:w}:(R.isBackwards=l,R.rendering=null,R.renderingStartTime=0,R.last=m,R.tail=u,R.tailMode=_,R.treeForkCount=w)}function gy(n,l,u){var m=l.pendingProps,_=m.revealOrder,w=m.tail;m=m.children;var R=Qa.current,X=(R&2)!==0;if(X?(R=R&1|2,l.flags|=128):R&=1,H(Qa,R),Cr(n,l,m,u),m=Kt?G:0,!X&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&my(n,u,l);else if(n.tag===19)my(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(_){case"forwards":for(u=l.child,_=null;u!==null;)n=u.alternate,n!==null&&su(n)===null&&(_=u),u=u.sibling;u=_,u===null?(_=l.child,l.child=null):(_=u.sibling,u.sibling=null),pm(l,!1,_,u,w,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,_=l.child,l.child=null;_!==null;){if(n=_.alternate,n!==null&&su(n)===null){l.child=_;break}n=_.sibling,_.sibling=u,u=_,_=n}pm(l,!0,u,null,w,m);break;case"together":pm(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function ni(n,l,u){if(n!==null&&(l.dependencies=n.dependencies),qi|=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 xm(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&J0(n)))}function M4(n,l,u){switch(l.tag){case 3:Ne(l,l.stateNode.containerInfo),Bi(l,nr,n.memoizedState.cache),ei();break;case 27:case 5:Fe(l);break;case 4:Ne(l,l.stateNode.containerInfo);break;case 10:Bi(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Hh(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(Wi(l),l.flags|=128,null):(u&l.child.childLanes)!==0?hy(n,l,u):(Wi(l),n=ni(n,l,u),n!==null?n.sibling:null);Wi(l);break;case 19:var _=(n.flags&128)!==0;if(m=(u&l.childLanes)!==0,m||(Ro(n,l,u,!1),m=(u&l.childLanes)!==0),_){if(m)return gy(n,l,u);l.flags|=128}if(_=l.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),H(Qa,Qa.current),m)break;return null;case 22:return l.lanes=0,ly(n,l,u,l.pendingProps);case 24:Bi(l,nr,n.memoizedState.cache)}return ni(n,l,u)}function py(n,l,u){if(n!==null)if(n.memoizedProps!==l.pendingProps)ir=!0;else{if(!xm(n,u)&&(l.flags&128)===0)return ir=!1,M4(n,l,u);ir=(n.flags&131072)!==0}else ir=!1,Kt&&(l.flags&1048576)!==0&&Yt(l,G,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=uy(null,l,n,m,u)):(l.tag=0,l=dm(null,l,n,m,u));else{if(n!=null){var _=n.$$typeof;if(_===P){l.tag=11,l=ny(null,l,n,m,u);break e}else if(_===z){l.tag=14,l=sy(null,l,n,m,u);break e}}throw l=ve(n)||n,Error(s(306,l,""))}}return l;case 0:return dm(n,l,l.type,l.pendingProps,u);case 1:return m=l.type,_=Wl(m,l.pendingProps),uy(n,l,m,_,u);case 3:e:{if(Ne(l,l.stateNode.containerInfo),n===null)throw Error(s(387));m=l.pendingProps;var w=l.memoizedState;_=w.element,Fh(n,l),fd(l,m,null,u);var R=l.memoizedState;if(m=R.cache,Bi(l,nr,m),m!==w.cache&&Oh(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=fy(n,l,m,u);break e}else if(m!==_){_=h(Error(s(424)),l),Rl(_),l=fy(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,Kt=!0,Ps=null,cn=!0,u=lx(l,null,m,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(ei(),m===_){l=ni(n,l,u);break e}Cr(n,l,m,u)}l=l.child}return l;case 26:return pu(n,l),n===null?(u=Tb(l.type,null,l.pendingProps,null))?l.memoizedState=u:Kt||(u=l.type,n=l.pendingProps,m=Lu(ue.current).createElement(u),m[Y]=l,m[te]=n,Ar(m,u,n),St(m),l.stateNode=m):l.memoizedState=Tb(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return Fe(l),n===null&&Kt&&(m=l.stateNode=Nb(l.type,l.pendingProps,ue.current),oa=l,cn=!0,_=ca,Qi(l.type)?(Xm=_,ca=Xn(m.firstChild)):ca=_),Cr(n,l,l.pendingProps.children,u),pu(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&Kt&&((_=m=ca)&&(m=ok(m,l.type,l.pendingProps,cn),m!==null?(l.stateNode=m,oa=l,ca=Xn(m.firstChild),cn=!1,_=!0):_=!1),_||Rs(l)),Fe(l),_=l.type,w=l.pendingProps,R=n!==null?n.memoizedProps:null,m=w.children,Vm(_,w)?m=null:R!==null&&Vm(_,R)&&(l.flags|=32),l.memoizedState!==null&&(_=Wh(n,l,k4,null,null,u),Md._currentValue=_),pu(n,l),Cr(n,l,m,u),l.child;case 6:return n===null&&Kt&&((n=u=ca)&&(u=ck(u,l.pendingProps,cn),u!==null?(l.stateNode=u,oa=l,ca=null,n=!0):n=!1),n||Rs(l)),null;case 13:return hy(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 ny(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,Bi(l,l.type,m.value),Cr(n,l,m.children,u),l.child;case 9:return _=l.type._context,m=l.pendingProps.children,Il(l),_=Er(_),m=m(_),l.flags|=1,Cr(n,l,m,u),l.child;case 14:return sy(n,l,l.type,l.pendingProps,u);case 15:return iy(n,l,l.type,l.pendingProps,u);case 19:return gy(n,l,u);case 31:return O4(n,l,u);case 22:return ly(n,l,u,l.pendingProps);case 24:return Il(l),m=Er(nr),n===null?(_=Dh(),_===null&&(_=Pa,w=Mh(),_.pooledCache=w,w.refCount++,w!==null&&(_.pooledCacheLanes|=u),_=w),l.memoizedState={parent:m,cache:_},Rh(l),Bi(l,nr,_)):((n.lanes&u)!==0&&(Fh(n,l),fd(l,null,null,u),ud()),_=n.memoizedState,w=l.memoizedState,_.parent!==m?(_={parent:m,cache:m},l.memoizedState=_,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=_),Bi(l,nr,m)):(m=w.cache,Bi(l,nr,m),m!==_.cache&&Oh(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 si(n){n.flags|=4}function ym(n,l,u,m,_){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if($y())n.flags|=8192;else throw Ul=tu,Ph}else n.flags&=-16777217}function xy(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Mb(l))if($y())n.flags|=8192;else throw Ul=tu,Ph}function yu(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?tn():536870912,n.lanes|=l,qo|=l)}function yd(n,l){if(!Kt)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 Ia(n){var l=n.alternate!==null&&n.alternate.child===n.child,u=0,m=0;if(l)for(var _=n.child;_!==null;)u|=_.lanes|_.childLanes,m|=_.subtreeFlags&65011712,m|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)u|=_.lanes|_.childLanes,m|=_.subtreeFlags,m|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=m,n.childLanes=u,l}function L4(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 Ia(l),null;case 1:return Ia(l),null;case 3:return u=l.stateNode,m=null,n!==null&&(m=n.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),ti(nr),We(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(n===null||n.child===null)&&(us(l)?si(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,sd())),Ia(l),null;case 26:var _=l.type,w=l.memoizedState;return n===null?(si(l),w!==null?(Ia(l),xy(l,w)):(Ia(l),ym(l,_,null,m,u))):w?w!==n.memoizedState?(si(l),Ia(l),xy(l,w)):(Ia(l),l.flags&=-16777217):(n=n.memoizedProps,n!==m&&si(l),Ia(l),ym(l,_,n,m,u)),null;case 27:if(tt(l),u=ue.current,_=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==m&&si(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return Ia(l),null}n=Z.current,us(l)?nd(l):(n=Nb(_,m,u),l.stateNode=n,si(l))}return Ia(l),null;case 5:if(tt(l),_=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==m&&si(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return Ia(l),null}if(w=Z.current,us(l))nd(l);else{var R=Lu(ue.current);switch(w){case 1:w=R.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:w=R.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":w=R.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":w=R.createElementNS("http://www.w3.org/1998/Math/MathML",_);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(_,{is:m.is}):R.createElement(_)}}w[Y]=l,w[te]=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,_,m),_){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&si(l)}}return Ia(l),ym(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,u),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==m&&si(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(s(166));if(n=ue.current,us(l)){if(n=l.stateNode,u=l.memoizedProps,m=null,_=oa,_!==null)switch(_.tag){case 27:case 5:m=_.memoizedProps}n[Y]=l,n=!!(n.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||hb(n.nodeValue,u)),n||Rs(l,!0)}else n=Lu(n).createTextNode(m),n[Y]=l,l.stateNode=n}return Ia(l),null;case 31:if(u=l.memoizedState,n===null||n.memoizedState!==null){if(m=us(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[Y]=l}else ei(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ia(l),n=!1}else u=sd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=u),n=!0;if(!n)return l.flags&256?(Cn(l),l):(Cn(l),null);if((l.flags&128)!==0)throw Error(s(558))}return Ia(l),null;case 13:if(m=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=us(l),m!==null&&m.dehydrated!==null){if(n===null){if(!_)throw Error(s(318));if(_=l.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(s(317));_[Y]=l}else ei(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ia(l),_=!1}else _=sd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return l.flags&256?(Cn(l),l):(Cn(l),null)}return Cn(l),(l.flags&128)!==0?(l.lanes=u,l):(u=m!==null,n=n!==null&&n.memoizedState!==null,u&&(m=l.child,_=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(_=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==_&&(m.flags|=2048)),u!==n&&u&&(l.child.flags|=8192),yu(l,l.updateQueue),Ia(l),null);case 4:return We(),n===null&&Bm(l.stateNode.containerInfo),Ia(l),null;case 10:return ti(l.type),Ia(l),null;case 19:if(D(Qa),m=l.memoizedState,m===null)return Ia(l),null;if(_=(l.flags&128)!==0,w=m.rendering,w===null)if(_)yd(m,!1);else{if(Ya!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(w=su(n),w!==null){for(l.flags|=128,yd(m,!1),n=w.updateQueue,l.updateQueue=n,yu(l,n),l.subtreeFlags=0,n=u,u=l.child;u!==null;)td(u,n),u=u.sibling;return H(Qa,Qa.current&1|2),Kt&&Lt(l,m.treeForkCount),l.child}n=n.sibling}m.tail!==null&&Ue()>ku&&(l.flags|=128,_=!0,yd(m,!1),l.lanes=4194304)}else{if(!_)if(n=su(w),n!==null){if(l.flags|=128,_=!0,n=n.updateQueue,l.updateQueue=n,yu(l,n),yd(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!Kt)return Ia(l),null}else 2*Ue()-m.renderingStartTime>ku&&u!==536870912&&(l.flags|=128,_=!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=Ue(),n.sibling=null,u=Qa.current,H(Qa,_?u&1|2:u&1),Kt&&Lt(l,m.treeForkCount),n):(Ia(l),null);case 22:case 23:return Cn(l),Uh(),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&&(Ia(l),l.subtreeFlags&6&&(l.flags|=8192)):Ia(l),u=l.updateQueue,u!==null&&yu(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),ti(nr),Ia(l),null;case 25:return null;case 30:return null}throw Error(s(156,l.tag))}function D4(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 ti(nr),We(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return tt(l),null;case 31:if(l.memoizedState!==null){if(Cn(l),l.alternate===null)throw Error(s(340));ei()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Cn(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(s(340));ei()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return D(Qa),null;case 4:return We(),null;case 10:return ti(l.type),null;case 22:case 23:return Cn(l),Uh(),n!==null&&D(zl),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return ti(nr),null;case 25:return null;default:return null}}function yy(n,l){switch(Za(l),l.tag){case 3:ti(nr),We();break;case 26:case 27:case 5:tt(l);break;case 4:We();break;case 31:l.memoizedState!==null&&Cn(l);break;case 13:Cn(l);break;case 19:D(Qa);break;case 10:ti(l.type);break;case 22:case 23:Cn(l),Uh(),n!==null&&D(zl);break;case 24:ti(nr)}}function bd(n,l){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var _=m.next;u=_;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!==_)}}catch(X){wa(l,l.return,X)}}function Gi(n,l,u){try{var m=l.updateQueue,_=m!==null?m.lastEffect:null;if(_!==null){var w=_.next;m=w;do{if((m.tag&n)===n){var R=m.inst,X=R.destroy;if(X!==void 0){R.destroy=void 0,_=l;var be=u,Me=X;try{Me()}catch(Ze){wa(_,be,Ze)}}}m=m.next}while(m!==w)}}catch(Ze){wa(l,l.return,Ze)}}function by(n){var l=n.updateQueue;if(l!==null){var u=n.stateNode;try{cx(l,u)}catch(m){wa(n,n.return,m)}}}function vy(n,l,u){u.props=Wl(n.type,n.memoizedProps),u.state=n.memoizedState;try{u.componentWillUnmount()}catch(m){wa(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(_){wa(n,l,_)}}function Is(n,l){var u=n.ref,m=n.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(_){wa(n,l,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(_){wa(n,l,_)}else u.current=null}function _y(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(_){wa(n,n.return,_)}}function bm(n,l,u){try{var m=n.stateNode;ak(m,n.type,u,l),m[te]=l}catch(_){wa(n,n.return,_)}}function wy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Qi(n.type)||n.tag===4}function vm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||wy(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&&Qi(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 _m(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=nn));else if(m!==4&&(m===27&&Qi(n.type)&&(u=n.stateNode,l=null),n=n.child,n!==null))for(_m(n,l,u),n=n.sibling;n!==null;)_m(n,l,u),n=n.sibling}function bu(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&&Qi(n.type)&&(u=n.stateNode),n=n.child,n!==null))for(bu(n,l,u),n=n.sibling;n!==null;)bu(n,l,u),n=n.sibling}function ky(n){var l=n.stateNode,u=n.memoizedProps;try{for(var m=n.type,_=l.attributes;_.length;)l.removeAttributeNode(_[0]);Ar(l,m,u),l[Y]=n,l[te]=u}catch(w){wa(n,n.return,w)}}var ii=!1,lr=!1,wm=!1,Ny=typeof WeakSet=="function"?WeakSet:Set,br=null;function P4(n,l){if(n=n.containerInfo,$m=Bu,n=El(n),As(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 _=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{u.nodeType,w.nodeType}catch(It){u=null;break e}var R=0,X=-1,be=-1,Me=0,Ze=0,Ke=n,Re=null;t:for(;;){for(var $e;Ke!==u||_!==0&&Ke.nodeType!==3||(X=R+_),Ke!==w||m!==0&&Ke.nodeType!==3||(be=R+m),Ke.nodeType===3&&(R+=Ke.nodeValue.length),($e=Ke.firstChild)!==null;)Re=Ke,Ke=$e;for(;;){if(Ke===n)break t;if(Re===u&&++Me===_&&(X=R),Re===w&&++Ze===m&&(be=R),($e=Ke.nextSibling)!==null)break;Ke=Re,Re=Ke.parentNode}Ke=$e}u=X===-1||be===-1?null:{start:X,end:be}}else u=null}u=u||{start:0,end:0}}else u=null;for(Wm={focusedElem:n,selectionRange:u},Bu=!1,br=l;br!==null;)if(l=br,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,br=n;else for(;br!==null;){switch(l=br,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++)_=n[u],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,u=l,_=w.memoizedProps,w=w.memoizedState,m=u.stateNode;try{var Ct=Wl(u.type,_);n=m.getSnapshotBeforeUpdate(Ct,w),m.__reactInternalSnapshotBeforeUpdate=n}catch(It){wa(u,u.return,It)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,u=n.nodeType,u===9)Zm(n);else if(u===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Zm(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,br=n;break}br=l.return}}function jy(n,l,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:oi(n,u),m&4&&bd(5,u);break;case 1:if(oi(n,u),m&4)if(n=u.stateNode,l===null)try{n.componentDidMount()}catch(R){wa(u,u.return,R)}else{var _=Wl(u.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(_,l,n.__reactInternalSnapshotBeforeUpdate)}catch(R){wa(u,u.return,R)}}m&64&&by(u),m&512&&vd(u,u.return);break;case 3:if(oi(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{cx(n,l)}catch(R){wa(u,u.return,R)}}break;case 27:l===null&&m&4&&ky(u);case 26:case 5:oi(n,u),l===null&&m&4&&_y(u),m&512&&vd(u,u.return);break;case 12:oi(n,u);break;case 31:oi(n,u),m&4&&Ey(n,u);break;case 13:oi(n,u),m&4&&Cy(n,u),m&64&&(n=u.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(u=W4.bind(null,u),dk(n,u))));break;case 22:if(m=u.memoizedState!==null||ii,!m){l=l!==null&&l.memoizedState!==null||lr,_=ii;var w=lr;ii=m,(lr=l)&&!w?ci(n,u,(u.subtreeFlags&8772)!==0):oi(n,u),ii=_,lr=w}break;case 30:break;default:oi(n,u)}}function Sy(n){var l=n.alternate;l!==null&&(n.alternate=null,Sy(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&Qe(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 Ua=null,dn=!1;function li(n,l,u){for(u=u.child;u!==null;)Ty(n,l,u),u=u.sibling}function Ty(n,l,u){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(De,u)}catch(w){}switch(u.tag){case 26:lr||Is(u,l),li(n,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:lr||Is(u,l);var m=Ua,_=dn;Qi(u.type)&&(Ua=u.stateNode,dn=!1),li(n,l,u),Cd(u.stateNode),Ua=m,dn=_;break;case 5:lr||Is(u,l);case 6:if(m=Ua,_=dn,Ua=null,li(n,l,u),Ua=m,dn=_,Ua!==null)if(dn)try{(Ua.nodeType===9?Ua.body:Ua.nodeName==="HTML"?Ua.ownerDocument.body:Ua).removeChild(u.stateNode)}catch(w){wa(u,l,w)}else try{Ua.removeChild(u.stateNode)}catch(w){wa(u,l,w)}break;case 18:Ua!==null&&(dn?(n=Ua,bb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,u.stateNode),ac(n)):bb(Ua,u.stateNode));break;case 4:m=Ua,_=dn,Ua=u.stateNode.containerInfo,dn=!0,li(n,l,u),Ua=m,dn=_;break;case 0:case 11:case 14:case 15:Gi(2,u,l),lr||Gi(4,u,l),li(n,l,u);break;case 1:lr||(Is(u,l),m=u.stateNode,typeof m.componentWillUnmount=="function"&&vy(u,l,m)),li(n,l,u);break;case 21:li(n,l,u);break;case 22:lr=(m=lr)||u.memoizedState!==null,li(n,l,u),lr=m;break;default:li(n,l,u)}}function Ey(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ac(n)}catch(u){wa(l,l.return,u)}}}function Cy(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){wa(l,l.return,u)}}function R4(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new Ny),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new Ny),l;default:throw Error(s(435,n.tag))}}function vu(n,l){var u=R4(n);l.forEach(function(m){if(!u.has(m)){u.add(m);var _=V4.bind(null,n,m);m.then(_,_)}})}function un(n,l){var u=l.deletions;if(u!==null)for(var m=0;m<u.length;m++){var _=u[m],w=n,R=l,X=R;e:for(;X!==null;){switch(X.tag){case 27:if(Qi(X.type)){Ua=X.stateNode,dn=!1;break e}break;case 5:Ua=X.stateNode,dn=!1;break e;case 3:case 4:Ua=X.stateNode.containerInfo,dn=!0;break e}X=X.return}if(Ua===null)throw Error(s(160));Ty(w,R,_),Ua=null,dn=!1,w=_.alternate,w!==null&&(w.return=null),_.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Ay(l,n),l=l.sibling}var hs=null;function Ay(n,l){var u=n.alternate,m=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:un(l,n),fn(n),m&4&&(Gi(3,n,n.return),bd(3,n),Gi(5,n,n.return));break;case 1:un(l,n),fn(n),m&512&&(lr||u===null||Is(u,u.return)),m&64&&ii&&(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 _=hs;if(un(l,n),fn(n),m&512&&(lr||u===null||Is(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,_=_.ownerDocument||_;t:switch(m){case"title":w=_.getElementsByTagName("title")[0],(!w||w[Ce]||w[Y]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=_.createElement(m),_.head.insertBefore(w,_.querySelector("head > title"))),Ar(w,m,u),w[Y]=n,St(w),m=w;break e;case"link":var R=Ab("link","href",_).get(m+(u.href||""));if(R){for(var X=0;X<R.length;X++)if(w=R[X],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(X,1);break t}}w=_.createElement(m),Ar(w,m,u),_.head.appendChild(w);break;case"meta":if(R=Ab("meta","content",_).get(m+(u.content||""))){for(X=0;X<R.length;X++)if(w=R[X],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(X,1);break t}}w=_.createElement(m),Ar(w,m,u),_.head.appendChild(w);break;default:throw Error(s(468,m))}w[Y]=n,St(w),m=w}n.stateNode=m}else Ob(_,n.type,n.stateNode);else n.stateNode=Cb(_,m,n.memoizedProps);else w!==m?(w===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):w.count--,m===null?Ob(_,n.type,n.stateNode):Cb(_,m,n.memoizedProps)):m===null&&n.stateNode!==null&&bm(n,n.memoizedProps,u.memoizedProps)}break;case 27:un(l,n),fn(n),m&512&&(lr||u===null||Is(u,u.return)),u!==null&&m&4&&bm(n,n.memoizedProps,u.memoizedProps);break;case 5:if(un(l,n),fn(n),m&512&&(lr||u===null||Is(u,u.return)),n.flags&32){_=n.stateNode;try{Un(_,"")}catch(Ct){wa(n,n.return,Ct)}}m&4&&n.stateNode!=null&&(_=n.memoizedProps,bm(n,_,u!==null?u.memoizedProps:_)),m&1024&&(wm=!0);break;case 6:if(un(l,n),fn(n),m&4){if(n.stateNode===null)throw Error(s(162));m=n.memoizedProps,u=n.stateNode;try{u.nodeValue=m}catch(Ct){wa(n,n.return,Ct)}}break;case 3:if(Ru=null,_=hs,hs=Du(l.containerInfo),un(l,n),hs=_,fn(n),m&4&&u!==null&&u.memoizedState.isDehydrated)try{ac(l.containerInfo)}catch(Ct){wa(n,n.return,Ct)}wm&&(wm=!1,Oy(n));break;case 4:m=hs,hs=Du(n.stateNode.containerInfo),un(l,n),fn(n),hs=m;break;case 12:un(l,n),fn(n);break;case 31:un(l,n),fn(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,vu(n,m)));break;case 13:un(l,n),fn(n),n.child.flags&8192&&n.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(wu=Ue()),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,vu(n,m)));break;case 22:_=n.memoizedState!==null;var be=u!==null&&u.memoizedState!==null,Me=ii,Ze=lr;if(ii=Me||_,lr=Ze||be,un(l,n),lr=Ze,ii=Me,fn(n),m&8192)e:for(l=n.stateNode,l._visibility=_?l._visibility&-2:l._visibility|1,_&&(u===null||be||ii||lr||Vl(n)),u=null,l=n;;){if(l.tag===5||l.tag===26){if(u===null){be=u=l;try{if(w=be.stateNode,_)R=w.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{X=be.stateNode;var Ke=be.memoizedProps.style,Re=Ke!=null&&Ke.hasOwnProperty("display")?Ke.display:null;X.style.display=Re==null||typeof Re=="boolean"?"":(""+Re).trim()}}catch(Ct){wa(be,be.return,Ct)}}}else if(l.tag===6){if(u===null){be=l;try{be.stateNode.nodeValue=_?"":be.memoizedProps}catch(Ct){wa(be,be.return,Ct)}}}else if(l.tag===18){if(u===null){be=l;try{var $e=be.stateNode;_?vb($e,!0):vb(be.stateNode,!1)}catch(Ct){wa(be,be.return,Ct)}}}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,vu(n,u))));break;case 19:un(l,n),fn(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,vu(n,m)));break;case 30:break;case 21:break;default:un(l,n),fn(n)}}function fn(n){var l=n.flags;if(l&2){try{for(var u,m=n.return;m!==null;){if(wy(m)){u=m;break}m=m.return}if(u==null)throw Error(s(160));switch(u.tag){case 27:var _=u.stateNode,w=vm(n);bu(n,w,_);break;case 5:var R=u.stateNode;u.flags&32&&(Un(R,""),u.flags&=-33);var X=vm(n);bu(n,X,R);break;case 3:case 4:var be=u.stateNode.containerInfo,Me=vm(n);_m(n,Me,be);break;default:throw Error(s(161))}}catch(Ze){wa(n,n.return,Ze)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function Oy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;Oy(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function oi(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)jy(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:Gi(4,l,l.return),Vl(l);break;case 1:Is(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&vy(l,l.return,u),Vl(l);break;case 27:Cd(l.stateNode);case 26:case 5:Is(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 ci(n,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,_=n,w=l,R=w.flags;switch(w.tag){case 0:case 11:case 15:ci(_,w,u),bd(4,w);break;case 1:if(ci(_,w,u),m=w,_=m.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(Me){wa(m,m.return,Me)}if(m=w,_=m.updateQueue,_!==null){var X=m.stateNode;try{var be=_.shared.hiddenCallbacks;if(be!==null)for(_.shared.hiddenCallbacks=null,_=0;_<be.length;_++)ox(be[_],X)}catch(Me){wa(m,m.return,Me)}}u&&R&64&&by(w),vd(w,w.return);break;case 27:ky(w);case 26:case 5:ci(_,w,u),u&&m===null&&R&4&&_y(w),vd(w,w.return);break;case 12:ci(_,w,u);break;case 31:ci(_,w,u),u&&R&4&&Ey(_,w);break;case 13:ci(_,w,u),u&&R&4&&Cy(_,w);break;case 22:w.memoizedState===null&&ci(_,w,u),vd(w,w.return);break;case 30:break;default:ci(_,w,u)}l=l.sibling}}function km(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 Nm(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 ms(n,l,u,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)My(n,l,u,m),l=l.sibling}function My(n,l,u,m){var _=l.flags;switch(l.tag){case 0:case 11:case 15:ms(n,l,u,m),_&2048&&bd(9,l);break;case 1:ms(n,l,u,m);break;case 3:ms(n,l,u,m),_&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(_&2048){ms(n,l,u,m),n=l.stateNode;try{var w=l.memoizedProps,R=w.id,X=w.onPostCommit;typeof X=="function"&&X(R,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(be){wa(l,l.return,be)}}else ms(n,l,u,m);break;case 31:ms(n,l,u,m);break;case 13:ms(n,l,u,m);break;case 23:break;case 22:w=l.stateNode,R=l.alternate,l.memoizedState!==null?w._visibility&2?ms(n,l,u,m):_d(n,l):w._visibility&2?ms(n,l,u,m):(w._visibility|=2,Vo(n,l,u,m,(l.subtreeFlags&10256)!==0||!1)),_&2048&&km(R,l);break;case 24:ms(n,l,u,m),_&2048&&Nm(l.alternate,l);break;default:ms(n,l,u,m)}}function Vo(n,l,u,m,_){for(_=_&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=n,R=l,X=u,be=m,Me=R.flags;switch(R.tag){case 0:case 11:case 15:Vo(w,R,X,be,_),bd(8,R);break;case 23:break;case 22:var Ze=R.stateNode;R.memoizedState!==null?Ze._visibility&2?Vo(w,R,X,be,_):_d(w,R):(Ze._visibility|=2,Vo(w,R,X,be,_)),_&&Me&2048&&km(R.alternate,R);break;case 24:Vo(w,R,X,be,_),_&&Me&2048&&Nm(R.alternate,R);break;default:Vo(w,R,X,be,_)}l=l.sibling}}function _d(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=n,m=l,_=m.flags;switch(m.tag){case 22:_d(u,m),_&2048&&km(m.alternate,m);break;case 24:_d(u,m),_&2048&&Nm(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;)Ly(n,l,u),n=n.sibling}function Ly(n,l,u){switch(n.tag){case 26:Go(n,l,u),n.flags&wd&&n.memoizedState!==null&&wk(u,hs,n.memoizedState,n.memoizedProps);break;case 5:Go(n,l,u);break;case 3:case 4:var m=hs;hs=Du(n.stateNode.containerInfo),Go(n,l,u),hs=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 Dy(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];br=m,Ry(m,n)}Dy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Py(n),n=n.sibling}function Py(n){switch(n.tag){case 0:case 11:case 15:kd(n),n.flags&2048&&Gi(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,_u(n)):kd(n);break;default:kd(n)}}function _u(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];br=m,Ry(m,n)}Dy(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:Gi(8,l,l.return),_u(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,_u(l));break;default:_u(l)}n=n.sibling}}function Ry(n,l){for(;br!==null;){var u=br;switch(u.tag){case 0:case 11:case 15:Gi(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,br=m;else e:for(u=n;br!==null;){m=br;var _=m.sibling,w=m.return;if(Sy(m),m===u){br=null;break e}if(_!==null){_.return=w,br=_;break e}br=w}}}var F4={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}},I4=typeof WeakMap=="function"?WeakMap:Map,ga=0,Pa=null,Qt=null,ra=0,_a=0,An=null,Zi=!1,Zo=!1,jm=!1,di=0,Ya=0,qi=0,Gl=0,Sm=0,On=0,qo=0,Nd=null,hn=null,Tm=!1,wu=0,Fy=0,ku=1/0,Nu=null,Yi=null,hr=0,Xi=null,Yo=null,ui=0,Em=0,Cm=null,Iy=null,jd=0,Am=null;function Mn(){return(ga&2)!==0&&ra!==0?ra&-ra:ee.T!==null?Rm():W()}function zy(){if(On===0)if((ra&536870912)===0||Kt){var n=ze;ze<<=1,(ze&3932160)===0&&(ze=262144),On=n}else On=536870912;return n=En.current,n!==null&&(n.flags|=32),On}function mn(n,l,u){(n===Pa&&(_a===2||_a===9)||n.cancelPendingCommit!==null)&&(Xo(n,0),Ji(n,ra,On,!1)),Gr(n,u),((ga&2)===0||n!==Pa)&&(n===Pa&&((ga&2)===0&&(Gl|=u),Ya===4&&Ji(n,ra,On,!1)),zs(n))}function By(n,l,u){if((ga&6)!==0)throw Error(s(327));var m=!u&&(l&127)===0&&(l&n.expiredLanes)===0||va(n,l),_=m?U4(n,l):Mm(n,l,!0),w=m;do{if(_===0){Zo&&!m&&Ji(n,l,0,!1);break}else{if(u=n.current.alternate,w&&!z4(u)){_=Mm(n,l,!1),w=!1;continue}if(_===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 X=n;_=Nd;var be=X.current.memoizedState.isDehydrated;if(be&&(Xo(X,R).flags|=256),R=Mm(X,R,!1),R!==2){if(jm&&!be){X.errorRecoveryDisabledLanes|=w,Gl|=w,_=4;break e}w=hn,hn=_,w!==null&&(hn===null?hn=w:hn.push.apply(hn,w))}_=R}if(w=!1,_!==2)continue}}if(_===1){Xo(n,0),Ji(n,l,0,!0);break}e:{switch(m=n,w=_,w){case 0:case 1:throw Error(s(345));case 4:if((l&4194048)!==l)break;case 6:Ji(m,l,On,!Zi);break e;case 2:hn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((l&62914560)===l&&(_=wu+300-Ue(),10<_)){if(Ji(m,l,On,!Zi),la(m,0,!0)!==0)break e;ui=l,m.timeoutHandle=xb(Uy.bind(null,m,u,hn,Nu,Tm,l,On,Gl,qo,Zi,w,"Throttled",-0,0),_);break e}Uy(m,u,hn,Nu,Tm,l,On,Gl,qo,Zi,w,null,-0,0)}}break}while(!0);zs(n)}function Uy(n,l,u,m,_,w,R,X,be,Me,Ze,Ke,Re,$e){if(n.timeoutHandle=-1,Ke=l.subtreeFlags,Ke&8192||(Ke&16785408)===16785408){Ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:nn},Ly(l,w,Ke);var Ct=(w&62914560)===w?wu-Ue():(w&4194048)===w?Fy-Ue():0;if(Ct=kk(Ke,Ct),Ct!==null){ui=w,n.cancelPendingCommit=Ct(Yy.bind(null,n,l,w,u,m,_,R,X,be,Ze,Ke,null,Re,$e)),Ji(n,w,R,!Me);return}}Yy(n,l,w,u,m,_,R,X,be)}function z4(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 _=u[m],w=_.getSnapshot;_=_.value;try{if(!xr(w(),_))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 Ji(n,l,u,m){l&=~Sm,l&=~Gl,n.suspendedLanes|=l,n.pingedLanes&=~l,m&&(n.warmLanes|=l),m=n.expirationTimes;for(var _=l;0<_;){var w=31-Nt(_),R=1<<w;m[w]=-1,_&=~R}u!==0&&Ss(n,u,l)}function ju(){return(ga&6)===0?(Sd(0),!1):!0}function Om(){if(Qt!==null){if(_a===0)var n=Qt.return;else n=Qt,fs=Fs=null,Zh(n),Bo=null,od=0,n=Qt;for(;n!==null;)yy(n.alternate,n),n=n.return;Qt=null}}function Xo(n,l){var u=n.timeoutHandle;u!==-1&&(n.timeoutHandle=-1,sk(u)),u=n.cancelPendingCommit,u!==null&&(n.cancelPendingCommit=null,u()),ui=0,Om(),Pa=n,Qt=u=qn(n.current,null),ra=l,_a=0,An=null,Zi=!1,Zo=va(n,l),jm=!1,qo=On=Sm=Gl=qi=Ya=0,hn=Nd=null,Tm=!1,(l&8)!==0&&(l|=l&32);var m=n.entangledLanes;if(m!==0)for(n=n.entanglements,m&=l;0<m;){var _=31-Nt(m),w=1<<_;l|=n[_],m&=~w}return di=l,Ll(),u}function Hy(n,l){Zt=null,ee.H=pd,l===zo||l===eu?(l=nx(),_a=3):l===Ph?(l=nx(),_a=4):_a=l===cm?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,An=l,Qt===null&&(Ya=1,mu(n,h(l,n.current)))}function $y(){var n=En.current;return n===null?!0:(ra&4194048)===ra?Yn===null:(ra&62914560)===ra||(ra&536870912)!==0?n===Yn:!1}function Wy(){var n=ee.H;return ee.H=pd,n===null?pd:n}function Vy(){var n=ee.A;return ee.A=F4,n}function Su(){Ya=4,Zi||(ra&4194048)!==ra&&En.current!==null||(Zo=!0),(qi&134217727)===0&&(Gl&134217727)===0||Pa===null||Ji(Pa,ra,On,!1)}function Mm(n,l,u){var m=ga;ga|=2;var _=Wy(),w=Vy();(Pa!==n||ra!==l)&&(Nu=null,Xo(n,l)),l=!1;var R=Ya;e:do try{if(_a!==0&&Qt!==null){var X=Qt,be=An;switch(_a){case 8:Om(),R=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(l=!0);var Me=_a;if(_a=0,An=null,Jo(n,X,be,Me),u&&Zo){R=0;break e}break;default:Me=_a,_a=0,An=null,Jo(n,X,be,Me)}}B4(),R=Ya;break}catch(Ze){Hy(n,Ze)}while(!0);return l&&n.shellSuspendCounter++,fs=Fs=null,ga=m,ee.H=_,ee.A=w,Qt===null&&(Pa=null,ra=0,Ll()),R}function B4(){for(;Qt!==null;)Gy(Qt)}function U4(n,l){var u=ga;ga|=2;var m=Wy(),_=Vy();Pa!==n||ra!==l?(Nu=null,ku=Ue()+500,Xo(n,l)):Zo=va(n,l);e:do try{if(_a!==0&&Qt!==null){l=Qt;var w=An;t:switch(_a){case 1:_a=0,An=null,Jo(n,l,w,1);break;case 2:case 9:if(ax(w)){_a=0,An=null,Zy(l);break}l=function(){_a!==2&&_a!==9||Pa!==n||(_a=7),zs(n)},w.then(l,l);break e;case 3:_a=7;break e;case 4:_a=5;break e;case 7:ax(w)?(_a=0,An=null,Zy(l)):(_a=0,An=null,Jo(n,l,w,7));break;case 5:var R=null;switch(Qt.tag){case 26:R=Qt.memoizedState;case 5:case 27:var X=Qt;if(R?Mb(R):X.stateNode.complete){_a=0,An=null;var be=X.sibling;if(be!==null)Qt=be;else{var Me=X.return;Me!==null?(Qt=Me,Tu(Me)):Qt=null}break t}}_a=0,An=null,Jo(n,l,w,5);break;case 6:_a=0,An=null,Jo(n,l,w,6);break;case 8:Om(),Ya=6;break e;default:throw Error(s(462))}}H4();break}catch(Ze){Hy(n,Ze)}while(!0);return fs=Fs=null,ee.H=m,ee.A=_,ga=u,Qt!==null?0:(Pa=null,ra=0,Ll(),Ya)}function H4(){for(;Qt!==null&&!bt();)Gy(Qt)}function Gy(n){var l=py(n.alternate,n,di);n.memoizedProps=n.pendingProps,l===null?Tu(n):Qt=l}function Zy(n){var l=n,u=l.alternate;switch(l.tag){case 15:case 0:l=dy(u,l,l.pendingProps,l.type,void 0,ra);break;case 11:l=dy(u,l,l.pendingProps,l.type.render,l.ref,ra);break;case 5:Zh(l);default:yy(u,l),l=Qt=td(l,di),l=py(u,l,di)}n.memoizedProps=n.pendingProps,l===null?Tu(n):Qt=l}function Jo(n,l,u,m){fs=Fs=null,Zh(l),Bo=null,od=0;var _=l.return;try{if(A4(n,_,l,u,ra)){Ya=1,mu(n,h(u,n.current)),Qt=null;return}}catch(w){if(_!==null)throw Qt=_,w;Ya=1,mu(n,h(u,n.current)),Qt=null;return}l.flags&32768?(Kt||m===1?n=!0:Zo||(ra&536870912)!==0?n=!1:(Zi=n=!0,(m===2||m===9||m===3||m===6)&&(m=En.current,m!==null&&m.tag===13&&(m.flags|=16384))),qy(l,n)):Tu(l)}function Tu(n){var l=n;do{if((l.flags&32768)!==0){qy(l,Zi);return}n=l.return;var u=L4(l.alternate,l,di);if(u!==null){Qt=u;return}if(l=l.sibling,l!==null){Qt=l;return}Qt=l=n}while(l!==null);Ya===0&&(Ya=5)}function qy(n,l){do{var u=D4(n.alternate,n);if(u!==null){u.flags&=32767,Qt=u;return}if(u=n.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(n=n.sibling,n!==null)){Qt=n;return}Qt=n=u}while(n!==null);Ya=6,Qt=null}function Yy(n,l,u,m,_,w,R,X,be){n.cancelPendingCommit=null;do Eu();while(hr!==0);if((ga&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,Zs(n,u,w,R,X,be),n===Pa&&(Qt=Pa=null,ra=0),Yo=l,Xi=n,ui=u,Em=w,Cm=_,Iy=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,G4(Ft,function(){return eb(),null})):(n.callbackNode=null,n.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=ee.T,ee.T=null,_=q.p,q.p=2,R=ga,ga|=4;try{P4(n,l,u)}finally{ga=R,q.p=_,ee.T=m}}hr=1,Xy(),Jy(),Ky()}}function Xy(){if(hr===1){hr=0;var n=Xi,l=Yo,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=ee.T,ee.T=null;var m=q.p;q.p=2;var _=ga;ga|=4;try{Ay(l,n);var w=Wm,R=El(n.containerInfo),X=w.focusedElem,be=w.selectionRange;if(R!==X&&X&&X.ownerDocument&&Eo(X.ownerDocument.documentElement,X)){if(be!==null&&As(X)){var Me=be.start,Ze=be.end;if(Ze===void 0&&(Ze=Me),"selectionStart"in X)X.selectionStart=Me,X.selectionEnd=Math.min(Ze,X.value.length);else{var Ke=X.ownerDocument||document,Re=Ke&&Ke.defaultView||window;if(Re.getSelection){var $e=Re.getSelection(),Ct=X.textContent.length,It=Math.min(be.start,Ct),Aa=be.end===void 0?It:Math.min(be.end,Ct);!$e.extend&&It>Aa&&(R=Aa,Aa=It,It=R);var Te=Tl(X,It),_e=Tl(X,Aa);if(Te&&_e&&($e.rangeCount!==1||$e.anchorNode!==Te.node||$e.anchorOffset!==Te.offset||$e.focusNode!==_e.node||$e.focusOffset!==_e.offset)){var Oe=Ke.createRange();Oe.setStart(Te.node,Te.offset),$e.removeAllRanges(),It>Aa?($e.addRange(Oe),$e.extend(_e.node,_e.offset)):(Oe.setEnd(_e.node,_e.offset),$e.addRange(Oe))}}}}for(Ke=[],$e=X;$e=$e.parentNode;)$e.nodeType===1&&Ke.push({element:$e,left:$e.scrollLeft,top:$e.scrollTop});for(typeof X.focus=="function"&&X.focus(),X=0;X<Ke.length;X++){var Xe=Ke[X];Xe.element.scrollLeft=Xe.left,Xe.element.scrollTop=Xe.top}}Bu=!!$m,Wm=$m=null}finally{ga=_,q.p=m,ee.T=u}}n.current=l,hr=2}}function Jy(){if(hr===2){hr=0;var n=Xi,l=Yo,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=ee.T,ee.T=null;var m=q.p;q.p=2;var _=ga;ga|=4;try{jy(n,l.alternate,l)}finally{ga=_,q.p=m,ee.T=u}}hr=3}}function Ky(){if(hr===4||hr===3){hr=0,qe();var n=Xi,l=Yo,u=ui,m=Iy;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?hr=5:(hr=0,Yo=Xi=null,Qy(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(Yi=null),Et(u),l=l.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(De,l,void 0,(l.current.flags&128)===128)}catch(be){}if(m!==null){l=ee.T,_=q.p,q.p=2,ee.T=null;try{for(var w=n.onRecoverableError,R=0;R<m.length;R++){var X=m[R];w(X.value,{componentStack:X.stack})}}finally{ee.T=l,q.p=_}}(ui&3)!==0&&Eu(),zs(n),_=n.pendingLanes,(u&261930)!==0&&(_&42)!==0?n===Am?jd++:(jd=0,Am=n):jd=0,Sd(0)}}function Qy(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,id(l)))}function Eu(){return Xy(),Jy(),Ky(),eb()}function eb(){if(hr!==5)return!1;var n=Xi,l=Em;Em=0;var u=Et(ui),m=ee.T,_=q.p;try{q.p=32>u?32:u,ee.T=null,u=Cm,Cm=null;var w=Xi,R=ui;if(hr=0,Yo=Xi=null,ui=0,(ga&6)!==0)throw Error(s(331));var X=ga;if(ga|=4,Py(w.current),My(w,w.current,R,u),ga=X,Sd(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(De,w)}catch(be){}return!0}finally{q.p=_,ee.T=m,Qy(n,l)}}function tb(n,l,u){l=h(u,l),l=om(n.stateNode,l,2),n=$i(n,l,2),n!==null&&(Gr(n,2),zs(n))}function wa(n,l,u){if(n.tag===3)tb(n,n,u);else for(;l!==null;){if(l.tag===3){tb(l,n,u);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Yi===null||!Yi.has(m))){n=h(u,n),u=ay(2),m=$i(l,u,2),m!==null&&(ry(u,m,l,n),Gr(m,2),zs(m));break}}l=l.return}}function Lm(n,l,u){var m=n.pingCache;if(m===null){m=n.pingCache=new I4;var _=new Set;m.set(l,_)}else _=m.get(l),_===void 0&&(_=new Set,m.set(l,_));_.has(u)||(jm=!0,_.add(u),n=$4.bind(null,n,l,u),l.then(n,n))}function $4(n,l,u){var m=n.pingCache;m!==null&&m.delete(l),n.pingedLanes|=n.suspendedLanes&u,n.warmLanes&=~u,Pa===n&&(ra&u)===u&&(Ya===4||Ya===3&&(ra&62914560)===ra&&300>Ue()-wu?(ga&2)===0&&Xo(n,0):Sm|=u,qo===ra&&(qo=0)),zs(n)}function ab(n,l){l===0&&(l=tn()),n=Zn(n,l),n!==null&&(Gr(n,l),zs(n))}function W4(n){var l=n.memoizedState,u=0;l!==null&&(u=l.retryLane),ab(n,u)}function V4(n,l){var u=0;switch(n.tag){case 31:case 13:var m=n.stateNode,_=n.memoizedState;_!==null&&(u=_.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),ab(n,u)}function G4(n,l){return Ie(n,l)}var Cu=null,Ko=null,Dm=!1,Au=!1,Pm=!1,Ki=0;function zs(n){n!==Ko&&n.next===null&&(Ko===null?Cu=Ko=n:Ko=Ko.next=n),Au=!0,Dm||(Dm=!0,q4())}function Sd(n,l){if(!Pm&&Au){Pm=!0;do for(var u=!1,m=Cu;m!==null;){if(n!==0){var _=m.pendingLanes;if(_===0)var w=0;else{var R=m.suspendedLanes,X=m.pingedLanes;w=(1<<31-Nt(42|n)+1)-1,w&=_&~(R&~X),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(u=!0,ib(m,w))}else w=ra,w=la(m,m===Pa?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||va(m,w)||(u=!0,ib(m,w));m=m.next}while(u);Pm=!1}}function Z4(){rb()}function rb(){Au=Dm=!1;var n=0;Ki!==0&&nk()&&(n=Ki);for(var l=Ue(),u=null,m=Cu;m!==null;){var _=m.next,w=nb(m,l);w===0?(m.next=null,u===null?Cu=_:u.next=_,_===null&&(Ko=u)):(u=m,(n!==0||(w&3)!==0)&&(Au=!0)),m=_}hr!==0&&hr!==5||Sd(n),Ki!==0&&(Ki=0)}function nb(n,l){for(var u=n.suspendedLanes,m=n.pingedLanes,_=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var R=31-Nt(w),X=1<<R,be=_[R];be===-1?((X&u)===0||(X&m)!==0)&&(_[R]=ar(X,l)):be<=l&&(n.expiredLanes|=X),w&=~X}if(l=Pa,u=ra,u=la(n,n===l?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m=n.callbackNode,u===0||n===l&&(_a===2||_a===9)||n.cancelPendingCommit!==null)return m!==null&&m!==null&&ot(m),n.callbackNode=null,n.callbackPriority=0;if((u&3)===0||va(n,u)){if(l=u&-u,l===n.callbackPriority)return l;switch(m!==null&&ot(m),Et(u)){case 2:case 8:u=Mt;break;case 32:u=Ft;break;case 268435456:u=it;break;default:u=Ft}return m=sb.bind(null,n),u=Ie(u,m),n.callbackPriority=l,n.callbackNode=u,l}return m!==null&&m!==null&&ot(m),n.callbackPriority=2,n.callbackNode=null,2}function sb(n,l){if(hr!==0&&hr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var u=n.callbackNode;if(Eu()&&n.callbackNode!==u)return null;var m=ra;return m=la(n,n===Pa?m:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m===0?null:(By(n,m,l),nb(n,Ue()),n.callbackNode!=null&&n.callbackNode===u?sb.bind(null,n):null)}function ib(n,l){if(Eu())return null;By(n,l,!0)}function q4(){ik(function(){(ga&6)!==0?Ie(wt,Z4):rb()})}function Rm(){if(Ki===0){var n=Fo;n===0&&(n=pe,pe<<=1,(pe&261888)===0&&(pe=256)),Ki=n}return Ki}function lb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Ti(""+n)}function ob(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 Y4(n,l,u,m,_){if(l==="submit"&&u&&u.stateNode===_){var w=lb((_[te]||null).action),R=m.submitter;R&&(l=(l=R[te]||null)?lb(l.formAction):R.getAttribute("formAction"),l!==null&&(w=l,R=null));var X=new _o("action","action",null,m,_);n.push({event:X,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Ki!==0){var be=R?ob(_,R):new FormData(_);am(u,{pending:!0,data:be,method:_.method,action:w},null,be)}}else typeof w=="function"&&(X.preventDefault(),be=R?ob(_,R):new FormData(_),am(u,{pending:!0,data:be,method:_.method,action:w},w,be))},currentTarget:_}]})}}for(var Fm=0;Fm<Ls.length;Fm++){var Im=Ls[Fm],X4=Im.toLowerCase(),J4=Im[0].toUpperCase()+Im.slice(1);ln(X4,"on"+J4)}ln(Al,"onAnimationEnd"),ln(q0,"onAnimationIteration"),ln(Ol,"onAnimationStart"),ln("dblclick","onDoubleClick"),ln("focusin","onFocus"),ln("focusout","onBlur"),ln(Th,"onTransitionRun"),ln(Y0,"onTransitionStart"),ln(Eh,"onTransitionCancel"),ln(Ii,"onTransitionEnd"),Ir("onMouseEnter",["mouseout","mouseover"]),Ir("onMouseLeave",["mouseout","mouseover"]),Ir("onPointerEnter",["pointerout","pointerover"]),Ir("onPointerLeave",["pointerout","pointerover"]),Ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ra("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(" "),K4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Td));function cb(n,l){l=(l&4)!==0;for(var u=0;u<n.length;u++){var m=n[u],_=m.event;m=m.listeners;e:{var w=void 0;if(l)for(var R=m.length-1;0<=R;R--){var X=m[R],be=X.instance,Me=X.currentTarget;if(X=X.listener,be!==w&&_.isPropagationStopped())break e;w=X,_.currentTarget=Me;try{w(_)}catch(Ze){Ml(Ze)}_.currentTarget=null,w=be}else for(R=0;R<m.length;R++){if(X=m[R],be=X.instance,Me=X.currentTarget,X=X.listener,be!==w&&_.isPropagationStopped())break e;w=X,_.currentTarget=Me;try{w(_)}catch(Ze){Ml(Ze)}_.currentTarget=null,w=be}}}}function ea(n,l){var u=l[Ee];u===void 0&&(u=l[Ee]=new Set);var m=n+"__bubble";u.has(m)||(db(l,n,2,!1),u.add(m))}function zm(n,l,u){var m=0;l&&(m|=4),db(u,n,m,l)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function Bm(n){if(!n[Ou]){n[Ou]=!0,ya.forEach(function(u){u!=="selectionchange"&&(K4.has(u)||zm(u,!1,n),zm(u,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Ou]||(l[Ou]=!0,zm("selectionchange",!1,l))}}function db(n,l,u,m){switch(zb(l)){case 2:var _=Sk;break;case 8:_=Tk;break;default:_=tg}u=_.bind(null,l,u,n),_=void 0,!yl||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(_=!0),m?_!==void 0?n.addEventListener(l,u,{capture:!0,passive:_}):n.addEventListener(l,u,!0):_!==void 0?n.addEventListener(l,u,{passive:_}):n.addEventListener(l,u,!1)}function Um(n,l,u,m,_){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 X=m.stateNode.containerInfo;if(X===_)break;if(R===4)for(R=m.return;R!==null;){var be=R.tag;if((be===3||be===4)&&R.stateNode.containerInfo===_)return;R=R.return}for(;X!==null;){if(R=lt(X),R===null)return;if(be=R.tag,be===5||be===6||be===26||be===27){m=w=R;continue e}X=X.parentNode}}m=m.return}Wc(function(){var Me=w,Ze=xl(u),Ke=[];e:{var Re=X0.get(n);if(Re!==void 0){var $e=_o,Ct=n;switch(n){case"keypress":if(bl(u)===0)break e;case"keydown":case"keyup":$e=R0;break;case"focusin":Ct="focus",$e=Zc;break;case"focusout":Ct="blur",$e=Zc;break;case"beforeblur":case"afterblur":$e=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":$e=O0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=ph;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=_h;break;case Al:case q0:case Ol:$e=qc;break;case Ii:$e=z0;break;case"scroll":case"scrollend":$e=aa;break;case"wheel":$e=Js;break;case"copy":case"cut":case"paste":$e=$n;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=F0;break;case"toggle":case"beforetoggle":$e=wl}var It=(l&4)!==0,Aa=!It&&(n==="scroll"||n==="scrollend"),Te=It?Re!==null?Re+"Capture":null:Re;It=[];for(var _e=Me,Oe;_e!==null;){var Xe=_e;if(Oe=Xe.stateNode,Xe=Xe.tag,Xe!==5&&Xe!==26&&Xe!==27||Oe===null||Te===null||(Xe=Ys(_e,Te),Xe!=null&&It.push(Ed(_e,Xe,Oe))),Aa)break;_e=_e.return}0<It.length&&(Re=new $e(Re,Ct,null,u,Ze),Ke.push({event:Re,listeners:It}))}}if((l&7)===0){e:{if(Re=n==="mouseover"||n==="pointerover",$e=n==="mouseout"||n==="pointerout",Re&&u!==vo&&(Ct=u.relatedTarget||u.fromElement)&&(lt(Ct)||Ct[se]))break e;if(($e||Re)&&(Re=Ze.window===Ze?Ze:(Re=Ze.ownerDocument)?Re.defaultView||Re.parentWindow:window,$e?(Ct=u.relatedTarget||u.toElement,$e=Me,Ct=Ct?lt(Ct):null,Ct!==null&&(Aa=d(Ct),It=Ct.tag,Ct!==Aa||It!==5&&It!==27&&It!==6)&&(Ct=null)):($e=null,Ct=Me),$e!==Ct)){if(It=O0,Xe="onMouseLeave",Te="onMouseEnter",_e="mouse",(n==="pointerout"||n==="pointerover")&&(It=F0,Xe="onPointerLeave",Te="onPointerEnter",_e="pointer"),Aa=$e==null?Re:nt($e),Oe=Ct==null?Re:nt(Ct),Re=new It(Xe,_e+"leave",$e,u,Ze),Re.target=Aa,Re.relatedTarget=Oe,Xe=null,lt(Ze)===Me&&(It=new It(Te,_e+"enter",Ct,u,Ze),It.target=Oe,It.relatedTarget=Aa,Xe=It),Aa=Xe,$e&&Ct)t:{for(It=Q4,Te=$e,_e=Ct,Oe=0,Xe=Te;Xe;Xe=It(Xe))Oe++;Xe=0;for(var Pt=_e;Pt;Pt=It(Pt))Xe++;for(;0<Oe-Xe;)Te=It(Te),Oe--;for(;0<Xe-Oe;)_e=It(_e),Xe--;for(;Oe--;){if(Te===_e||_e!==null&&Te===_e.alternate){It=Te;break t}Te=It(Te),_e=It(_e)}It=null}else It=null;$e!==null&&ub(Ke,Re,$e,It,!1),Ct!==null&&Aa!==null&&ub(Ke,Aa,Ct,It,!0)}}e:{if(Re=Me?nt(Me):window,$e=Re.nodeName&&Re.nodeName.toLowerCase(),$e==="select"||$e==="input"&&Re.type==="file")var da=Sl;else if(Wn(Re))if($0)da=Sh;else{da=jh;var Ot=cs}else $e=Re.nodeName,!$e||$e.toLowerCase()!=="input"||Re.type!=="checkbox"&&Re.type!=="radio"?Me&&pl(Me.elementType)&&(da=Sl):da=Di;if(da&&(da=da(n,Me))){H0(Ke,da,u,Ze);break e}Ot&&Ot(n,Re,Me),n==="focusout"&&Me&&Re.type==="number"&&Me.memoizedProps.value!=null&&is(Re,"number",Re.value)}switch(Ot=Me?nt(Me):window,n){case"focusin":(Wn(Ot)||Ot.contentEditable==="true")&&(Os=Ot,Ao=Me,Cl=null);break;case"focusout":Cl=Ao=Os=null;break;case"mousedown":Ri=!0;break;case"contextmenu":case"mouseup":case"dragend":Ri=!1,G0(Ke,u,Ze);break;case"selectionchange":if(Co)break;case"keydown":case"keyup":G0(Ke,u,Ze)}var Xt;if(ko)e:{switch(n){case"compositionstart":var na="onCompositionStart";break e;case"compositionend":na="onCompositionEnd";break e;case"compositionupdate":na="onCompositionUpdate";break e}na=void 0}else Oi?U0(n,u)&&(na="onCompositionEnd"):n==="keydown"&&u.keyCode===229&&(na="onCompositionStart");na&&(No&&u.locale!=="ko"&&(Oi||na!=="onCompositionStart"?na==="onCompositionEnd"&&Oi&&(Xt=Es()):(Hn=Ze,Xs="value"in Hn?Hn.value:Hn.textContent,Oi=!0)),Ot=Mu(Me,na),0<Ot.length&&(na=new Yc(na,n,null,u,Ze),Ke.push({event:na,listeners:Ot}),Xt?na.data=Xt:(Xt=Qc(u),Xt!==null&&(na.data=Xt)))),(Xt=kh?Tn(n,u):Mi(n,u))&&(na=Mu(Me,"onBeforeInput"),0<na.length&&(Ot=new Yc("onBeforeInput","beforeinput",null,u,Ze),Ke.push({event:Ot,listeners:na}),Ot.data=Xt)),Y4(Ke,n,Me,u,Ze)}cb(Ke,l)})}function Ed(n,l,u){return{instance:n,listener:l,currentTarget:u}}function Mu(n,l){for(var u=l+"Capture",m=[];n!==null;){var _=n,w=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||w===null||(_=Ys(n,u),_!=null&&m.unshift(Ed(n,_,w)),_=Ys(n,l),_!=null&&m.push(Ed(n,_,w))),n.tag===3)return m;n=n.return}return[]}function Q4(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function ub(n,l,u,m,_){for(var w=l._reactName,R=[];u!==null&&u!==m;){var X=u,be=X.alternate,Me=X.stateNode;if(X=X.tag,be!==null&&be===m)break;X!==5&&X!==26&&X!==27||Me===null||(be=Me,_?(Me=Ys(u,w),Me!=null&&R.unshift(Ed(u,Me,be))):_||(Me=Ys(u,w),Me!=null&&R.push(Ed(u,Me,be)))),u=u.return}R.length!==0&&n.push({event:l,listeners:R})}var ek=/\r\n?/g,tk=/\u0000|\uFFFD/g;function fb(n){return(typeof n=="string"?n:""+n).replace(ek,`
`).replace(tk,"")}function hb(n,l){return l=fb(l),fb(n)===l}function Ca(n,l,u,m,_,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=Ti(""+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",_.name,_,null),Ca(n,l,"formEncType",_.formEncType,_,null),Ca(n,l,"formMethod",_.formMethod,_,null),Ca(n,l,"formTarget",_.formTarget,_,null)):(Ca(n,l,"encType",_.encType,_,null),Ca(n,l,"method",_.method,_,null),Ca(n,l,"target",_.target,_,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){n.removeAttribute(u);break}m=Ti(""+m),n.setAttribute(u,m);break;case"onClick":m!=null&&(n.onclick=nn);break;case"onScroll":m!=null&&ea("scroll",n);break;case"onScrollEnd":m!=null&&ea("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(_.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=Ti(""+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":ea("beforetoggle",n),ea("toggle",n),$t(n,"popover",m);break;case"xlinkActuate":rn(n,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":rn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":rn(n,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":rn(n,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":rn(n,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":rn(n,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":rn(n,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":rn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":rn(n,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":$t(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,$t(n,u,m))}}function Hm(n,l,u,m,_,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(_.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&&ea("scroll",n);break;case"onScrollEnd":m!=null&&ea("scrollend",n);break;case"onClick":m!=null&&(n.onclick=nn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ta.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(_=u.endsWith("Capture"),l=u.slice(2,_?u.length-7:void 0),w=n[te]||null,w=w!=null?w[u]:null,typeof w=="function"&&n.removeEventListener(l,w,_),typeof m=="function")){typeof w!="function"&&w!==null&&(u in n?n[u]=null:n.hasAttribute(u)&&n.removeAttribute(u)),n.addEventListener(l,m,_);break e}u in n?n[u]=m:m===!0?n.setAttribute(u,""):$t(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":ea("error",n),ea("load",n);var m=!1,_=!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":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:Ca(n,l,w,R,u,null)}}_&&Ca(n,l,"srcSet",u.srcSet,u,null),m&&Ca(n,l,"src",u.src,u,null);return;case"input":ea("invalid",n);var X=w=R=_=null,be=null,Me=null;for(m in u)if(u.hasOwnProperty(m)){var Ze=u[m];if(Ze!=null)switch(m){case"name":_=Ze;break;case"type":R=Ze;break;case"checked":be=Ze;break;case"defaultChecked":Me=Ze;break;case"value":w=Ze;break;case"defaultValue":X=Ze;break;case"children":case"dangerouslySetInnerHTML":if(Ze!=null)throw Error(s(137,l));break;default:Ca(n,l,m,Ze,u,null)}}gl(n,w,X,be,Me,R,_,!1);return;case"select":ea("invalid",n),m=R=w=null;for(_ in u)if(u.hasOwnProperty(_)&&(X=u[_],X!=null))switch(_){case"value":w=X;break;case"defaultValue":R=X;break;case"multiple":m=X;default:Ca(n,l,_,X,u,null)}l=w,u=R,n.multiple=!!m,l!=null?Da(n,!!m,l,!1):u!=null&&Da(n,!!m,u,!0);return;case"textarea":ea("invalid",n),w=_=m=null;for(R in u)if(u.hasOwnProperty(R)&&(X=u[R],X!=null))switch(R){case"value":m=X;break;case"defaultValue":_=X;break;case"children":w=X;break;case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(91));break;default:Ca(n,l,R,X,u,null)}ji(n,m,_,w);return;case"option":for(be in u)if(u.hasOwnProperty(be)&&(m=u[be],m!=null))switch(be){case"selected":n.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Ca(n,l,be,m,u,null)}return;case"dialog":ea("beforetoggle",n),ea("toggle",n),ea("cancel",n),ea("close",n);break;case"iframe":case"object":ea("load",n);break;case"video":case"audio":for(m=0;m<Td.length;m++)ea(Td[m],n);break;case"image":ea("error",n),ea("load",n);break;case"details":ea("toggle",n);break;case"embed":case"source":case"link":ea("error",n),ea("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(Me in u)if(u.hasOwnProperty(Me)&&(m=u[Me],m!=null))switch(Me){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:Ca(n,l,Me,m,u,null)}return;default:if(pl(l)){for(Ze in u)u.hasOwnProperty(Ze)&&(m=u[Ze],m!==void 0&&Hm(n,l,Ze,m,u,void 0));return}}for(X in u)u.hasOwnProperty(X)&&(m=u[X],m!=null&&Ca(n,l,X,m,u,null))}function ak(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 _=null,w=null,R=null,X=null,be=null,Me=null,Ze=null;for($e in u){var Ke=u[$e];if(u.hasOwnProperty($e)&&Ke!=null)switch($e){case"checked":break;case"value":break;case"defaultValue":be=Ke;default:m.hasOwnProperty($e)||Ca(n,l,$e,null,m,Ke)}}for(var Re in m){var $e=m[Re];if(Ke=u[Re],m.hasOwnProperty(Re)&&($e!=null||Ke!=null))switch(Re){case"type":w=$e;break;case"name":_=$e;break;case"checked":Me=$e;break;case"defaultChecked":Ze=$e;break;case"value":R=$e;break;case"defaultValue":X=$e;break;case"children":case"dangerouslySetInnerHTML":if($e!=null)throw Error(s(137,l));break;default:$e!==Ke&&Ca(n,l,Re,$e,m,Ke)}}Uc(n,R,X,be,Me,Ze,w,_);return;case"select":$e=R=X=Re=null;for(w in u)if(be=u[w],u.hasOwnProperty(w)&&be!=null)switch(w){case"value":break;case"multiple":$e=be;default:m.hasOwnProperty(w)||Ca(n,l,w,null,m,be)}for(_ in m)if(w=m[_],be=u[_],m.hasOwnProperty(_)&&(w!=null||be!=null))switch(_){case"value":Re=w;break;case"defaultValue":X=w;break;case"multiple":R=w;default:w!==be&&Ca(n,l,_,w,m,be)}l=X,u=R,m=$e,Re!=null?Da(n,!!u,Re,!1):!!m!=!!u&&(l!=null?Da(n,!!u,l,!0):Da(n,!!u,u?[]:"",!1));return;case"textarea":$e=Re=null;for(X in u)if(_=u[X],u.hasOwnProperty(X)&&_!=null&&!m.hasOwnProperty(X))switch(X){case"value":break;case"children":break;default:Ca(n,l,X,null,m,_)}for(R in m)if(_=m[R],w=u[R],m.hasOwnProperty(R)&&(_!=null||w!=null))switch(R){case"value":Re=_;break;case"defaultValue":$e=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:_!==w&&Ca(n,l,R,_,m,w)}Ts(n,Re,$e);return;case"option":for(var Ct in u)if(Re=u[Ct],u.hasOwnProperty(Ct)&&Re!=null&&!m.hasOwnProperty(Ct))switch(Ct){case"selected":n.selected=!1;break;default:Ca(n,l,Ct,null,m,Re)}for(be in m)if(Re=m[be],$e=u[be],m.hasOwnProperty(be)&&Re!==$e&&(Re!=null||$e!=null))switch(be){case"selected":n.selected=Re&&typeof Re!="function"&&typeof Re!="symbol";break;default:Ca(n,l,be,Re,m,$e)}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(Me in m)if(Re=m[Me],$e=u[Me],m.hasOwnProperty(Me)&&Re!==$e&&(Re!=null||$e!=null))switch(Me){case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(s(137,l));break;default:Ca(n,l,Me,Re,m,$e)}return;default:if(pl(l)){for(var Aa in u)Re=u[Aa],u.hasOwnProperty(Aa)&&Re!==void 0&&!m.hasOwnProperty(Aa)&&Hm(n,l,Aa,void 0,m,Re);for(Ze in m)Re=m[Ze],$e=u[Ze],!m.hasOwnProperty(Ze)||Re===$e||Re===void 0&&$e===void 0||Hm(n,l,Ze,Re,m,$e);return}}for(var Te in u)Re=u[Te],u.hasOwnProperty(Te)&&Re!=null&&!m.hasOwnProperty(Te)&&Ca(n,l,Te,null,m,Re);for(Ke in m)Re=m[Ke],$e=u[Ke],!m.hasOwnProperty(Ke)||Re===$e||Re==null&&$e==null||Ca(n,l,Ke,Re,m,$e)}function mb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rk(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var _=u[m],w=_.transferSize,R=_.initiatorType,X=_.duration;if(w&&X&&mb(R)){for(R=0,X=_.responseEnd,m+=1;m<u.length;m++){var be=u[m],Me=be.startTime;if(Me>X)break;var Ze=be.transferSize,Ke=be.initiatorType;Ze&&mb(Ke)&&(be=be.responseEnd,R+=Ze*(be<X?1:(X-Me)/(be-Me)))}if(--m,l+=8*(w+R)/(_.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 $m=null,Wm=null;function Lu(n){return n.nodeType===9?n:n.ownerDocument}function gb(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 pb(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 Vm(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 Gm=null;function nk(){var n=window.event;return n&&n.type==="popstate"?n===Gm?!1:(Gm=n,!0):(Gm=null,!1)}var xb=typeof setTimeout=="function"?setTimeout:void 0,sk=typeof clearTimeout=="function"?clearTimeout:void 0,yb=typeof Promise=="function"?Promise:void 0,ik=typeof queueMicrotask=="function"?queueMicrotask:typeof yb!="undefined"?function(n){return yb.resolve(null).then(n).catch(lk)}:xb;function lk(n){setTimeout(function(){throw n})}function Qi(n){return n==="head"}function bb(n,l){var u=l,m=0;do{var _=u.nextSibling;if(n.removeChild(u),_&&_.nodeType===8)if(u=_.data,u==="/$"||u==="/&"){if(m===0){n.removeChild(_),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,X=w.nodeName;w[Ce]||X==="SCRIPT"||X==="STYLE"||X==="LINK"&&w.rel.toLowerCase()==="stylesheet"||u.removeChild(w),w=R}}else u==="body"&&Cd(n.ownerDocument.body);u=_}while(u);ac(l)}function vb(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 Zm(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":Zm(u),Qe(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}n.removeChild(u)}}function ok(n,l,u,m){for(;n.nodeType===1;){var _=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!==_.rel||n.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||n.getAttribute("title")!==(_.title==null?null:_.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var w=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Xn(n.nextSibling),n===null)break}return null}function ck(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 _b(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 qm(n){return n.data==="$?"||n.data==="$~"}function Ym(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function dk(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 Xm=null;function wb(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 kb(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 Nb(n,l,u){switch(l=Lu(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]);Qe(n)}var Jn=new Map,jb=new Set;function Du(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var fi=q.d;q.d={f:uk,r:fk,D:hk,C:mk,L:gk,m:pk,X:yk,S:xk,M:bk};function uk(){var n=fi.f(),l=ju();return n||l}function fk(n){var l=dt(n);l!==null&&l.tag===5&&l.type==="form"?Hx(l):fi.r(n)}var Qo=typeof document=="undefined"?null:document;function Sb(n,l,u){var m=Qo;if(m&&typeof l=="string"&&l){var _=Fa(l);_='link[rel="'+n+'"][href="'+_+'"]',typeof u=="string"&&(_+='[crossorigin="'+u+'"]'),jb.has(_)||(jb.add(_),n={rel:n,crossOrigin:u,href:l},m.querySelector(_)===null&&(l=m.createElement("link"),Ar(l,"link",n),St(l),m.head.appendChild(l)))}}function hk(n){fi.D(n),Sb("dns-prefetch",n,null)}function mk(n,l){fi.C(n,l),Sb("preconnect",n,l)}function gk(n,l,u){fi.L(n,l,u);var m=Qo;if(m&&n&&l){var _='link[rel="preload"][as="'+Fa(l)+'"]';l==="image"&&u&&u.imageSrcSet?(_+='[imagesrcset="'+Fa(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(_+='[imagesizes="'+Fa(u.imageSizes)+'"]')):_+='[href="'+Fa(n)+'"]';var w=_;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(_)!==null||l==="style"&&m.querySelector(Ad(w))||l==="script"&&m.querySelector(Od(w))||(l=m.createElement("link"),Ar(l,"link",n),St(l),m.head.appendChild(l)))}}function pk(n,l){fi.m(n,l);var u=Qo;if(u&&n){var m=l&&typeof l.as=="string"?l.as:"script",_='link[rel="modulepreload"][as="'+Fa(m)+'"][href="'+Fa(n)+'"]',w=_;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(_)===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),St(m),u.head.appendChild(m)}}}function xk(n,l,u){fi.S(n,l,u);var m=Qo;if(m&&n){var _=mt(m).hoistableStyles,w=ec(n);l=l||"default";var R=_.get(w);if(!R){var X={loading:0,preload:null};if(R=m.querySelector(Ad(w)))X.loading=5;else{n=y({rel:"stylesheet",href:n,"data-precedence":l},u),(u=Jn.get(w))&&Jm(n,u);var be=R=m.createElement("link");St(be),Ar(be,"link",n),be._p=new Promise(function(Me,Ze){be.onload=Me,be.onerror=Ze}),be.addEventListener("load",function(){X.loading|=1}),be.addEventListener("error",function(){X.loading|=2}),X.loading|=4,Pu(R,l,m)}R={type:"stylesheet",instance:R,count:1,state:X},_.set(w,R)}}}function yk(n,l){fi.X(n,l);var u=Qo;if(u&&n){var m=mt(u).hoistableScripts,_=tc(n),w=m.get(_);w||(w=u.querySelector(Od(_)),w||(n=y({src:n,async:!0},l),(l=Jn.get(_))&&Km(n,l),w=u.createElement("script"),St(w),Ar(w,"link",n),u.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(_,w))}}function bk(n,l){fi.M(n,l);var u=Qo;if(u&&n){var m=mt(u).hoistableScripts,_=tc(n),w=m.get(_);w||(w=u.querySelector(Od(_)),w||(n=y({src:n,async:!0,type:"module"},l),(l=Jn.get(_))&&Km(n,l),w=u.createElement("script"),St(w),Ar(w,"link",n),u.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(_,w))}}function Tb(n,l,u,m){var _=(_=ue.current)?Du(_):null;if(!_)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=mt(_).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=mt(_).hoistableStyles,R=w.get(n);if(R||(_=_.ownerDocument||_,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,R),(w=_.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||vk(_,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=mt(_).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="'+Fa(n)+'"'}function Ad(n){return'link[rel="stylesheet"]['+n+"]"}function Eb(n){return y({},n,{"data-precedence":n.precedence,precedence:null})}function vk(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),St(l),n.head.appendChild(l))}function tc(n){return'[src="'+Fa(n)+'"]'}function Od(n){return"script[async]"+n}function Cb(n,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var m=n.querySelector('style[data-href~="'+Fa(u.href)+'"]');if(m)return l.instance=m,St(m),m;var _=y({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(n.ownerDocument||n).createElement("style"),St(m),Ar(m,"style",_),Pu(m,u.precedence,n),l.instance=m;case"stylesheet":_=ec(u.href);var w=n.querySelector(Ad(_));if(w)return l.state.loading|=4,l.instance=w,St(w),w;m=Eb(u),(_=Jn.get(_))&&Jm(m,_),w=(n.ownerDocument||n).createElement("link"),St(w);var R=w;return R._p=new Promise(function(X,be){R.onload=X,R.onerror=be}),Ar(w,"link",m),l.state.loading|=4,Pu(w,u.precedence,n),l.instance=w;case"script":return w=tc(u.src),(_=n.querySelector(Od(w)))?(l.instance=_,St(_),_):(m=u,(_=Jn.get(w))&&(m=y({},u),Km(m,_)),n=n.ownerDocument||n,_=n.createElement("script"),St(_),Ar(_,"link",m),n.head.appendChild(_),l.instance=_);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,Pu(m,u.precedence,n));return l.instance}function Pu(n,l,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=m.length?m[m.length-1]:null,w=_,R=0;R<m.length;R++){var X=m[R];if(X.dataset.precedence===l)w=X;else if(w!==_)break}w?w.parentNode.insertBefore(n,w.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(n,l.firstChild))}function Jm(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function Km(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var Ru=null;function Ab(n,l,u){if(Ru===null){var m=new Map,_=Ru=new Map;_.set(u,m)}else _=Ru,m=_.get(u),m||(m=new Map,_.set(u,m));if(m.has(n))return m;for(m.set(n,null),u=u.getElementsByTagName(n),_=0;_<u.length;_++){var w=u[_];if(!(w[Ce]||w[Y]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var R=w.getAttribute(l)||"";R=n+R;var X=m.get(R);X?X.push(w):m.set(R,[w])}}return m}function Ob(n,l,u){n=n.ownerDocument||n,n.head.insertBefore(u,l==="title"?n.querySelector("head > title"):null)}function _k(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 Mb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function wk(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 _=ec(m.href),w=l.querySelector(Ad(_));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Fu.bind(n),l.then(n,n)),u.state.loading|=4,u.instance=w,St(w);return}w=l.ownerDocument||l,m=Eb(m),(_=Jn.get(_))&&Jm(m,_),w=w.createElement("link"),St(w);var R=w;R._p=new Promise(function(X,be){R.onload=X,R.onerror=be}),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=Fu.bind(n),l.addEventListener("load",u),l.addEventListener("error",u))}}var Qm=0;function kk(n,l){return n.stylesheets&&n.count===0&&zu(n,n.stylesheets),0<n.count||0<n.imgCount?function(u){var m=setTimeout(function(){if(n.stylesheets&&zu(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+l);0<n.imgBytes&&Qm===0&&(Qm=62500*rk());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&zu(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>Qm?50:800)+l);return n.unsuspend=u,function(){n.unsuspend=null,clearTimeout(m),clearTimeout(_)}}:null}function Fu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Iu=null;function zu(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Iu=new Map,l.forEach(Nk,n),Iu=null,Fu.call(n))}function Nk(n,l){if(!(l.state.loading&4)){var u=Iu.get(n);if(u)var m=u.get(null);else{u=new Map,Iu.set(n,u);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<_.length;w++){var R=_[w];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(u.set(R.dataset.precedence,R),m=R)}m&&u.set(null,m)}_=l.instance,R=_.getAttribute("data-precedence"),w=u.get(R)||m,w===m&&u.set(null,_),u.set(R,_),this.count++,m=Fu.bind(this),_.addEventListener("load",m),_.addEventListener("error",m),w?w.parentNode.insertBefore(_,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),l.state.loading|=4}}var Md={$$typeof:O,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function jk(n,l,u,m,_,w,R,X,be){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=Bn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bn(0),this.hiddenUpdates=Bn(null),this.identifierPrefix=m,this.onUncaughtError=_,this.onCaughtError=w,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=be,this.incompleteTransitions=new Map}function Lb(n,l,u,m,_,w,R,X,be,Me,Ze,Ke){return n=new jk(n,l,u,R,be,Me,Ze,Ke,X),l=1,w===!0&&(l|=24),w=Br(3,null,null,l),n.current=w,w.stateNode=n,l=Mh(),l.refCount++,n.pooledCache=l,l.refCount++,w.memoizedState={element:m,isDehydrated:u,cache:l},Rh(w),n}function Db(n){return n?(n=Ks,n):Ks}function Pb(n,l,u,m,_,w){_=Db(_),m.context===null?m.context=_:m.pendingContext=_,m=Hi(l),m.payload={element:u},w=w===void 0?null:w,w!==null&&(m.callback=w),u=$i(n,m,l),u!==null&&(mn(u,n,l),dd(u,n,l))}function Rb(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var u=n.retryLane;n.retryLane=u!==0&&u<l?u:l}}function eg(n,l){Rb(n,l),(n=n.alternate)&&Rb(n,l)}function Fb(n){if(n.tag===13||n.tag===31){var l=Zn(n,67108864);l!==null&&mn(l,n,67108864),eg(n,67108864)}}function Ib(n){if(n.tag===13||n.tag===31){var l=Mn();l=rr(l);var u=Zn(n,l);u!==null&&mn(u,n,l),eg(n,l)}}var Bu=!0;function Sk(n,l,u,m){var _=ee.T;ee.T=null;var w=q.p;try{q.p=2,tg(n,l,u,m)}finally{q.p=w,ee.T=_}}function Tk(n,l,u,m){var _=ee.T;ee.T=null;var w=q.p;try{q.p=8,tg(n,l,u,m)}finally{q.p=w,ee.T=_}}function tg(n,l,u,m){if(Bu){var _=ag(m);if(_===null)Um(n,l,m,Uu,u),Bb(n,m);else if(Ck(_,n,l,u,m))m.stopPropagation();else if(Bb(n,m),l&4&&-1<Ek.indexOf(n)){for(;_!==null;){var w=dt(_);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var R=Ut(w.pendingLanes);if(R!==0){var X=w;for(X.pendingLanes|=2,X.entangledLanes|=2;R;){var be=1<<31-Nt(R);X.entanglements[1]|=be,R&=~be}zs(w),(ga&6)===0&&(ku=Ue()+500,Sd(0))}}break;case 31:case 13:X=Zn(w,2),X!==null&&mn(X,w,2),ju(),eg(w,2)}if(w=ag(m),w===null&&Um(n,l,m,Uu,u),w===_)break;_=w}_!==null&&m.stopPropagation()}else Um(n,l,m,null,u)}}function ag(n){return n=xl(n),rg(n)}var Uu=null;function rg(n){if(Uu=null,n=lt(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 Uu=n,null}function zb(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(ht()){case wt:return 2;case Mt:return 8;case Ft:case je:return 32;case it:return 268435456;default:return 32}default:return 32}}var ng=!1,el=null,tl=null,al=null,Ld=new Map,Dd=new Map,rl=[],Ek="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 Bb(n,l){switch(n){case"focusin":case"focusout":el=null;break;case"dragenter":case"dragleave":tl=null;break;case"mouseover":case"mouseout":al=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,_,w){return n===null||n.nativeEvent!==w?(n={blockedOn:l,domEventName:u,eventSystemFlags:m,nativeEvent:w,targetContainers:[_]},l!==null&&(l=dt(l),l!==null&&Fb(l)),n):(n.eventSystemFlags|=m,l=n.targetContainers,_!==null&&l.indexOf(_)===-1&&l.push(_),n)}function Ck(n,l,u,m,_){switch(l){case"focusin":return el=Pd(el,n,l,u,m,_),!0;case"dragenter":return tl=Pd(tl,n,l,u,m,_),!0;case"mouseover":return al=Pd(al,n,l,u,m,_),!0;case"pointerover":var w=_.pointerId;return Ld.set(w,Pd(Ld.get(w)||null,n,l,u,m,_)),!0;case"gotpointercapture":return w=_.pointerId,Dd.set(w,Pd(Dd.get(w)||null,n,l,u,m,_)),!0}return!1}function Ub(n){var l=lt(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,ce(n.priority,function(){Ib(u)});return}}else if(l===31){if(l=f(u),l!==null){n.blockedOn=l,ce(n.priority,function(){Ib(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 Hu(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var u=ag(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=dt(u),l!==null&&Fb(l),n.blockedOn=u,!1;l.shift()}return!0}function Hb(n,l,u){Hu(n)&&u.delete(l)}function Ak(){ng=!1,el!==null&&Hu(el)&&(el=null),tl!==null&&Hu(tl)&&(tl=null),al!==null&&Hu(al)&&(al=null),Ld.forEach(Hb),Dd.forEach(Hb)}function $u(n,l){n.blockedOn===l&&(n.blockedOn=null,ng||(ng=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ak)))}var Wu=null;function $b(n){Wu!==n&&(Wu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Wu===n&&(Wu=null);for(var l=0;l<n.length;l+=3){var u=n[l],m=n[l+1],_=n[l+2];if(typeof m!="function"){if(rg(m||u)===null)continue;break}var w=dt(u);w!==null&&(n.splice(l,3),l-=3,am(w,{pending:!0,data:_,method:u.method,action:m},m,_))}}))}function ac(n){function l(be){return $u(be,n)}el!==null&&$u(el,n),tl!==null&&$u(tl,n),al!==null&&$u(al,n),Ld.forEach(l),Dd.forEach(l);for(var u=0;u<rl.length;u++){var m=rl[u];m.blockedOn===n&&(m.blockedOn=null)}for(;0<rl.length&&(u=rl[0],u.blockedOn===null);)Ub(u),u.blockedOn===null&&rl.shift();if(u=(n.ownerDocument||n).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var _=u[m],w=u[m+1],R=_[te]||null;if(typeof w=="function")R||$b(u);else if(R){var X=null;if(w&&w.hasAttribute("formAction")){if(_=w,R=w[te]||null)X=R.formAction;else if(rg(_)!==null)continue}else X=R.action;typeof X=="function"?u[m+1]=X:(u.splice(m,3),m-=3),$b(u)}}}function Wb(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(R){return _=R})},focusReset:"manual",scroll:"manual"})}function l(){_!==null&&(_(),_=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,_=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),_!==null&&(_(),_=null)}}}function sg(n){this._internalRoot=n}Vu.prototype.render=sg.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(s(409));var u=l.current,m=Mn();Pb(u,m,n,l,null,null)},Vu.prototype.unmount=sg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;Pb(n.current,2,null,n,null,null),ju(),l[se]=null}};function Vu(n){this._internalRoot=n}Vu.prototype.unstable_scheduleHydration=function(n){if(n){var l=W();n={blockedOn:null,target:n,priority:l};for(var u=0;u<rl.length&&l!==0&&l<rl[u].priority;u++);rl.splice(u,0,n),u===0&&Ub(n)}};var Vb=t.version;if(Vb!=="19.2.1")throw Error(s(527,Vb,"19.2.1"));q.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=g(l),n=n!==null?x(n):null,n=n===null?null:n.stateNode,n};var Ok={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:ee,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Gu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gu.isDisabled&&Gu.supportsFiber)try{De=Gu.inject(Ok),ct=Gu}catch(n){}}return Fd.createRoot=function(n,l){if(!i(n))throw Error(s(299));var u=!1,m="",_=Kx,w=Qx,R=ey;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(_=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError)),l=Lb(n,1,!1,null,null,u,m,null,_,w,R,Wb),n[se]=l.current,Bm(n),new sg(l)},Fd.hydrateRoot=function(n,l,u){if(!i(n))throw Error(s(299));var m=!1,_="",w=Kx,R=Qx,X=ey,be=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(_=u.identifierPrefix),u.onUncaughtError!==void 0&&(w=u.onUncaughtError),u.onCaughtError!==void 0&&(R=u.onCaughtError),u.onRecoverableError!==void 0&&(X=u.onRecoverableError),u.formState!==void 0&&(be=u.formState)),l=Lb(n,1,!0,l,u!=null?u:null,m,_,be,w,R,X,Wb),l.context=Db(null),u=l.current,m=Mn(),m=rr(m),_=Hi(m),_.callback=null,$i(u,_,m),u=m,l.current.lanes=u,Gr(l,u),zs(l),n[se]=l.current,Bm(n),new Vu(l)},Fd.version="19.2.1",Fd}var n1;function Vk(){if(n1)return ug.exports;n1=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(),ug.exports=Wk(),ug.exports}var Gk=Vk();const Wt=e=>typeof e=="string",Id=()=>{let e,t;const r=new Promise((s,i)=>{e=s,t=i});return r.resolve=e,r.reject=t,r},s1=e=>e==null?"":""+e,Zk=(e,t,r)=>{e.forEach(s=>{t[s]&&(r[s]=t[s])})},qk=/###/g,i1=e=>e&&e.indexOf("###")>-1?e.replace(qk,"."):e,l1=e=>!e||Wt(e),Vd=(e,t,r)=>{const s=Wt(t)?t.split("."):t;let i=0;for(;i<s.length-1;){if(l1(e))return{};const d=i1(s[i]);!e[d]&&r&&(e[d]=new r),Object.prototype.hasOwnProperty.call(e,d)?e=e[d]:e={},++i}return l1(e)?{}:{obj:e,k:i1(s[i])}},o1=(e,t,r)=>{const{obj:s,k:i}=Vd(e,t,Object);if(s!==void 0||t.length===1){s[i]=r;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}`]=r},Yk=(e,t,r,s)=>{const{obj:i,k:d}=Vd(e,t,Object);i[d]=i[d]||[],i[d].push(r)},xf=(e,t)=>{const{obj:r,k:s}=Vd(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,s))return r[s]},Xk=(e,t,r)=>{const s=xf(e,r);return s!==void 0?s:xf(t,r)},r_=(e,t,r)=>{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?r&&(e[s]=t[s]):r_(e[s],t[s],r):e[s]=t[s]);return e},nc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Jk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Kk=e=>Wt(e)?e.replace(/[&<>"'\/]/g,t=>Jk[t]):e;class Qk{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const r=this.regExpMap.get(t);if(r!==void 0)return r;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 e3=[" ",",","?","!",";"],t3=new Qk(20),a3=(e,t,r)=>{t=t||"",r=r||"";const s=e3.filter(c=>t.indexOf(c)<0&&r.indexOf(c)<0);if(s.length===0)return!0;const i=t3.getRegExp(`(${s.map(c=>c==="?"?"\\?":c).join("|")})`);let d=!i.test(e);if(!d){const c=e.indexOf(r);c>0&&!i.test(e.substring(0,c))&&(d=!0)}return d},zg=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const s=t.split(r);let i=e;for(let d=0;d<s.length;){if(!i||typeof i!="object")return;let c,f="";for(let p=d;p<s.length;++p)if(p!==d&&(f+=r),f+=s[p],c=i[f],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&p<s.length-1)continue;d+=p-d+1;break}i=c}return i},t0=e=>e==null?void 0:e.replace("_","-"),r3={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var r,s;(s=(r=console==null?void 0:console[e])==null?void 0:r.apply)==null||s.call(r,console,t)}};class yf{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||r3,this.options=r,this.debug=r.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,r,s,i){return i&&!this.debug?null:(Wt(t[0])&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new yf(this.logger,ne({prefix:`${this.prefix}:${t}:`},this.options))}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new yf(this.logger,t)}}var $s=new yf;class $f{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(r)||0;this.observers[s].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,d])=>{for(let c=0;c<d;c++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,d])=>{for(let c=0;c<d;c++)i.apply(i,[t,...r])})}}class c1 extends $f{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,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 r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,s,i={}){var g,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,r],s&&(Array.isArray(s)?f.push(...s):Wt(s)&&d?f.push(...s.split(d)):f.push(s)));const p=xf(this.data,f);return!p&&!r&&!s&&t.indexOf(".")>-1&&(t=f[0],r=f[1],s=f.slice(2).join(".")),p||!c||!Wt(s)?p:zg((x=(g=this.data)==null?void 0:g[t])==null?void 0:x[r],s,d)}addResource(t,r,s,i,d={silent:!1}){const c=d.keySeparator!==void 0?d.keySeparator:this.options.keySeparator;let f=[t,r];s&&(f=f.concat(c?s.split(c):s)),t.indexOf(".")>-1&&(f=t.split("."),i=r,r=f[1]),this.addNamespaces(r),o1(this.data,f,i),d.silent||this.emit("added",t,r,s,i)}addResources(t,r,s,i={silent:!1}){for(const d in s)(Wt(s[d])||Array.isArray(s[d]))&&this.addResource(t,r,d,s[d],{silent:!0});i.silent||this.emit("added",t,r,s)}addResourceBundle(t,r,s,i,d,c={silent:!1,skipCopy:!1}){let f=[t,r];t.indexOf(".")>-1&&(f=t.split("."),i=s,s=r,r=f[1]),this.addNamespaces(r);let p=xf(this.data,f)||{};c.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?r_(p,s,d):p=ne(ne({},p),s),o1(this.data,f,p),c.silent||this.emit("added",t,r,s)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}}var n_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,s,i){return e.forEach(d=>{var c,f;t=(f=(c=this.processors[d])==null?void 0:c.process(t,r,s,i))!=null?f:t}),t}};const s_=Symbol("i18next/PATH_KEY");function n3(){const e=[],t=Object.create(null);let r;return t.get=(s,i)=>{var d;return(d=r==null?void 0:r.revoke)==null||d.call(r),i===s_?e:(e.push(i),r=Proxy.revocable(s,t),r.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Bg(e,t){var s;const{[s_]:r}=e(n3());return r.join((s=t==null?void 0:t.keySeparator)!=null?s:".")}const d1={},gg=e=>!Wt(e)&&typeof e!="boolean"&&typeof e!="number";class bf extends $f{constructor(t,r={}){super(),Zk(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$s.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){const s=ne({},r);if(t==null)return!1;const i=this.resolve(t,s);if((i==null?void 0:i.res)===void 0)return!1;const d=gg(i.res);return!(s.returnObjects===!1&&d)}extractFromKey(t,r){let s=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let d=r.ns||this.options.defaultNS||[];const c=s&&t.indexOf(s)>-1,f=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!a3(t,s,i);if(c&&!f){const p=t.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:t,namespaces:Wt(d)?[d]:d};const g=t.split(s);(s!==i||s===i&&this.options.ns.indexOf(g[0])>-1)&&(d=g.shift()),t=g.join(i)}return{key:t,namespaces:Wt(d)?[d]:d}}translate(t,r,s){let i=typeof r=="object"?ne({},r):r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i=ne({},i)),i||(i={}),t==null)return"";typeof t=="function"&&(t=Bg(t,ne(ne({},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:p}=this.extractFromKey(t[t.length-1],i),g=p[p.length-1];let x=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;x===void 0&&(x=":");const y=i.lng||this.language,v=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((y==null?void 0:y.toLowerCase())==="cimode")return v?d?{res:`${g}${x}${f}`,usedKey:f,exactUsedKey:f,usedLng:y,usedNS:g,usedParams:this.getUsedParamsDetails(i)}:`${g}${x}${f}`:d?{res:f,usedKey:f,exactUsedKey:f,usedLng:y,usedNS:g,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,A=["[object Number]","[object Function]","[object RegExp]"],C=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,P=i.count!==void 0&&!Wt(i.count),B=bf.hasDefaultValue(i),V=P?this.pluralResolver.getSuffix(y,i.count,i):"",z=i.ordinal&&P?this.pluralResolver.getSuffix(y,i.count,{ordinal:!1}):"",U=P&&!i.ordinal&&i.count===0,J=U&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${V}`]||i[`defaultValue${z}`]||i.defaultValue;let de=T;O&&!T&&B&&(de=J);const ye=gg(de),ie=Object.prototype.toString.apply(de);if(O&&de&&ye&&A.indexOf(ie)<0&&!(Wt(C)&&Array.isArray(de))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const he=this.options.returnedObjectHandler?this.options.returnedObjectHandler(N,de,Se(ne({},i),{ns:p})):`key '${f} (${this.language})' returned an object instead of string.`;return d?(k.res=he,k.usedParams=this.getUsedParamsDetails(i),k):he}if(c){const he=Array.isArray(de),ve=he?[]:{},me=he?S:N;for(const ee in de)if(Object.prototype.hasOwnProperty.call(de,ee)){const q=`${me}${c}${ee}`;B&&!T?ve[ee]=this.translate(q,Se(ne({},i),{defaultValue:gg(J)?J[ee]:void 0,joinArrays:!1,ns:p})):ve[ee]=this.translate(q,Se(ne({},i),{joinArrays:!1,ns:p})),ve[ee]===q&&(ve[ee]=de[ee])}T=ve}}else if(O&&Wt(C)&&Array.isArray(T))T=T.join(C),T&&(T=this.extendTranslation(T,t,i,s));else{let he=!1,ve=!1;!this.isValidLookup(T)&&B&&(he=!0,T=J),this.isValidLookup(T)||(ve=!0,T=f);const ee=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ve?void 0:T,q=B&&J!==T&&this.options.updateMissing;if(ve||he||q){if(this.logger.log(q?"updateKey":"missingKey",y,g,f,q?J:T),c){const F=this.resolve(f,Se(ne({},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 Q=[];const fe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&fe&&fe[0])for(let F=0;F<fe.length;F++)Q.push(fe[F]);else this.options.saveMissingTo==="all"?Q=this.languageUtils.toResolveHierarchy(i.lng||this.language):Q.push(i.lng||this.language);const ae=(F,D,H)=>{var K;const Z=B&&H!==T?H:ee;this.options.missingKeyHandler?this.options.missingKeyHandler(F,g,D,Z,q,i):(K=this.backendConnector)!=null&&K.saveMissing&&this.backendConnector.saveMissing(F,g,D,Z,q,i),this.emit("missingKey",F,g,D,T)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?Q.forEach(F=>{const D=this.pluralResolver.getSuffixes(F,i);U&&i[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(H=>{ae([F],f+H,i[`defaultValue${H}`]||J)})}):ae(Q,f,J))}T=this.extendTranslation(T,t,i,k,s),ve&&T===f&&this.options.appendNamespaceToMissingKey&&(T=`${g}${x}${f}`),(ve||he)&&this.options.parseMissingKeyHandler&&(T=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}${x}${f}`:f,he?T:void 0,i))}return d?(k.res=T,k.usedParams=this.getUsedParamsDetails(i),k):T}extendTranslation(t,r,s,i,d){var p,g;if((p=this.i18nFormat)!=null&&p.parse)t=this.i18nFormat.parse(t,ne(ne({},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(Se(ne({},s),{interpolation:ne(ne({},this.options.interpolation),s.interpolation)}));const x=Wt(t)&&(((g=s==null?void 0:s.interpolation)==null?void 0:g.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 v=s.replace&&!Wt(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(v=ne(ne({},this.options.interpolation.defaultVariables),v)),t=this.interpolator.interpolate(t,v,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: ${r[0]}`),null):this.translate(...k,r),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=n_.handle(f,t,r,this.options&&this.options.postProcessPassResolved?ne({i18nResolved:Se(ne({},i),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),t}resolve(t,r={}){let s,i,d,c,f;return Wt(t)&&(t=[t]),t.forEach(p=>{if(this.isValidLookup(s))return;const g=this.extractFromKey(p,r),x=g.key;i=x;let y=g.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const v=r.count!==void 0&&!Wt(r.count),k=v&&!r.ordinal&&r.count===0,T=r.context!==void 0&&(Wt(r.context)||typeof r.context=="number")&&r.context!=="",N=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);y.forEach(S=>{var A,C;this.isValidLookup(s)||(f=S,!d1[`${N[0]}-${S}`]&&((A=this.utils)!=null&&A.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(f))&&(d1[`${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(O=>{var V;if(this.isValidLookup(s))return;c=O;const P=[x];if((V=this.i18nFormat)!=null&&V.addLookupKeys)this.i18nFormat.addLookupKeys(P,x,O,S,r);else{let z;v&&(z=this.pluralResolver.getSuffix(O,r.count,r));const U=`${this.options.pluralSeparator}zero`,J=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(r.ordinal&&z.indexOf(J)===0&&P.push(x+z.replace(J,this.options.pluralSeparator)),P.push(x+z),k&&P.push(x+U)),T){const de=`${x}${this.options.contextSeparator||"_"}${r.context}`;P.push(de),v&&(r.ordinal&&z.indexOf(J)===0&&P.push(de+z.replace(J,this.options.pluralSeparator)),P.push(de+z),k&&P.push(de+U))}}let B;for(;B=P.pop();)this.isValidLookup(s)||(d=B,s=this.getResource(O,S,B,r))}))})}),{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,r,s,i={}){var d;return(d=this.i18nFormat)!=null&&d.getResource?this.i18nFormat.getResource(t,r,s,i):this.resourceStore.getResource(t,r,s,i)}getUsedParamsDetails(t={}){const r=["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=ne(ne({},this.options.interpolation.defaultVariables),i)),!s){i=ne({},i);for(const d of r)delete i[d]}return i}static hasDefaultValue(t){const r="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&r===s.substring(0,r.length)&&t[s]!==void 0)return!0;return!1}}class u1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$s.create("languageUtils")}getScriptPartFromCode(t){if(t=t0(t),!t||t.indexOf("-")<0)return null;const r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=t0(t),!t||t.indexOf("-")<0)return t;const r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(Wt(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch(s){}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(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 r;return t.forEach(s=>{if(r)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(s=>{if(r)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return r=i;const d=this.getLanguagePartFromCode(s);if(this.isSupportedCode(d))return r=d;r=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})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),Wt(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let s=t[r];return s||(s=t[this.getScriptPartFromCode(r)]),s||(s=t[this.formatLanguageCode(r)]),s||(s=t[this.getLanguagePartFromCode(r)]),s||(s=t.default),s||[]}toResolveHierarchy(t,r){const s=this.getFallbackCodes((r===!1?[]:r)||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 f1={zero:0,one:1,two:2,few:3,many:4,other:5},h1={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class s3{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=$s.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,r){this.rules[t]=r}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){const s=t0(t==="dev"?"en":t),i=r.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!"),h1;if(!t.match(/-|_/))return h1;const p=this.languageUtils.getLanguagePartFromCode(t);c=this.getRule(p,r)}return this.pluralRulesCache[d]=c,c}needsPlural(t,r={}){let s=this.getRule(t,r);return s||(s=this.getRule("dev",r)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,r,s={}){return this.getSuffixes(t,s).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let s=this.getRule(t,r);return s||(s=this.getRule("dev",r)),s?s.resolvedOptions().pluralCategories.sort((i,d)=>f1[i]-f1[d]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,s={}){const i=this.getRule(t,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,s))}}const m1=(e,t,r,s=".",i=!0)=>{let d=Xk(e,t,r);return!d&&i&&Wt(r)&&(d=zg(e,r,s),d===void 0&&(d=zg(t,r,s))),d},pg=e=>e.replace(/\$/g,"$$$$");class g1{constructor(t={}){var r;this.logger=$s.create("interpolator"),this.options=t,this.format=((r=t==null?void 0:t.interpolation)==null?void 0:r.format)||(s=>s),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:r,escapeValue:s,useRawValueToEscape:i,prefix:d,prefixEscaped:c,suffix:f,suffixEscaped:p,formatSeparator:g,unescapeSuffix:x,unescapePrefix:y,nestingPrefix:v,nestingPrefixEscaped:k,nestingSuffix:T,nestingSuffixEscaped:N,nestingOptionsSeparator:S,maxReplaces:A,alwaysFormat:C}=t.interpolation;this.escape=r!==void 0?r:Kk,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):p||"}}",this.formatSeparator=g||",",this.unescapePrefix=x?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":x||"",this.nestingPrefix=v?nc(v):k||nc("$t("),this.nestingSuffix=T?nc(T):N||nc(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=A||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(r,s)=>(r==null?void 0:r.source)===s?(r.lastIndex=0,r):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,r,s,i){var k;let d,c,f;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},g=T=>{if(T.indexOf(this.formatSeparator)<0){const C=m1(r,p,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,s,Se(ne(ne({},i),r),{interpolationkey:T})):C}const N=T.split(this.formatSeparator),S=N.shift().trim(),A=N.join(this.formatSeparator).trim();return this.format(m1(r,p,S,this.options.keySeparator,this.options.ignoreJSONStructure),A,s,Se(ne(ne({},i),r),{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=>pg(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?pg(this.escape(T)):pg(T)}].forEach(T=>{for(f=0;d=T.regex.exec(t);){const N=d[1].trim();if(c=g(N),c===void 0)if(typeof x=="function"){const A=x(t,d,i);c=Wt(A)?A:""}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=s1(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,r,s={}){let i,d,c;const f=(p,g)=>{var N;const x=this.nestingOptionsSeparator;if(p.indexOf(x)<0)return p;const y=p.split(new RegExp(`${x}[ ]*{`));let v=`{${y[1]}`;p=y[0],v=this.interpolate(v,c);const k=v.match(/'/g),T=v.match(/"/g);(((N=k==null?void 0:k.length)!=null?N:0)%2===0&&!T||T.length%2!==0)&&(v=v.replace(/'/g,'"'));try{c=JSON.parse(v),g&&(c=ne(ne({},g),c))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,S),`${p}${x}${v}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,p};for(;i=this.nestingRegexp.exec(t);){let p=[];c=ne({},s),c=c.replace&&!Wt(c.replace)?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;const g=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(g!==-1&&(p=i[1].slice(g).split(this.formatSeparator).map(x=>x.trim()).filter(Boolean),i[1]=i[1].slice(0,g)),d=r(f.call(this,i[1].trim(),c),c),d&&i[0]===t&&!Wt(d))return d;Wt(d)||(d=s1(d)),d||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),d=""),p.length&&(d=p.reduce((x,y)=>this.format(x,y,s.lng,Se(ne({},s),{interpolationkey:i[1].trim()})),d.trim())),t=t.replace(i[0],d),this.regexp.lastIndex=0}return t}}const i3=e=>{let t=e.toLowerCase().trim();const r={};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?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(c=>{if(c){const[f,...p]=c.split(":"),g=p.join(":").trim().replace(/^'+|'+$/g,""),x=f.trim();r[x]||(r[x]=g),g==="false"&&(r[x]=!1),g==="true"&&(r[x]=!0),isNaN(g)||(r[x]=parseInt(g,10))}})}return{formatName:t,formatOptions:r}},p1=e=>{const t={};return(r,s,i)=>{let d=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(d=Se(ne({},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(r)}},l3=e=>(t,r,s)=>e(t0(r),s)(t);class o3{constructor(t={}){this.logger=$s.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const s=r.cacheInBuiltFormats?p1:l3;this.formats={number:s((i,d)=>{const c=new Intl.NumberFormat(i,ne({},d));return f=>c.format(f)}),currency:s((i,d)=>{const c=new Intl.NumberFormat(i,Se(ne({},d),{style:"currency"}));return f=>c.format(f)}),datetime:s((i,d)=>{const c=new Intl.DateTimeFormat(i,ne({},d));return f=>c.format(f)}),relativetime:s((i,d)=>{const c=new Intl.RelativeTimeFormat(i,ne({},d));return f=>c.format(f,d.range||"day")}),list:s((i,d)=>{const c=new Intl.ListFormat(i,ne({},d));return f=>c.format(f)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=p1(r)}format(t,r,s,i={}){const d=r.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(p=>p.indexOf(")")>-1);d[0]=[d[0],...d.splice(1,f)].join(this.formatSeparator)}return d.reduce((f,p)=>{var y;const{formatName:g,formatOptions:x}=i3(p);if(this.formats[g]){let v=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;v=this.formats[g](f,T,ne(ne(ne({},x),i),k))}catch(k){this.logger.warn(k)}return v}else this.logger.warn(`there was no format function for ${g}`);return f},t)}}const c3=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class d3 extends $f{constructor(t,r,s,i={}){var d,c;super(),this.backend=t,this.store=r,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=$s.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,r,s,i){const d={},c={},f={},p={};return t.forEach(g=>{let x=!0;r.forEach(y=>{const v=`${g}|${y}`;!s.reload&&this.store.hasResourceBundle(g,y)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?c[v]===void 0&&(c[v]=!0):(this.state[v]=1,x=!1,c[v]===void 0&&(c[v]=!0),d[v]===void 0&&(d[v]=!0),p[y]===void 0&&(p[y]=!0)))}),x||(f[g]=!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(p)}}loaded(t,r,s){const i=t.split("|"),d=i[0],c=i[1];r&&this.emit("failedLoading",d,c,r),!r&&s&&this.store.addResourceBundle(d,c,s,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&s&&(this.state[t]=0);const f={};this.queue.forEach(p=>{Yk(p.loaded,[d],c),c3(p,t),r&&p.errors.push(r),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(g=>{f[g]||(f[g]={});const x=p.loaded[g];x.length&&x.forEach(y=>{f[g][y]===void 0&&(f[g][y]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(p=>!p.done)}read(t,r,s,i=0,d=this.retryTimeout,c){if(!t.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:s,tried:i,wait:d,callback:c});return}this.readingCalls++;const f=(g,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(g&&x&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,s,i+1,d*2,c)},d);return}c(g,x)},p=this.backend[s].bind(this.backend);if(p.length===2){try{const g=p(t,r);g&&typeof g.then=="function"?g.then(x=>f(null,x)).catch(f):f(null,g)}catch(g){f(g)}return}return p(t,r,f)}prepareLoading(t,r,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(r)&&(r=[r]);const d=this.queueLoad(t,r,s,i);if(!d.toLoad.length)return d.pending.length||i(),null;d.toLoad.forEach(c=>{this.loadOne(c)})}load(t,r,s){this.prepareLoading(t,r,{},s)}reload(t,r,s){this.prepareLoading(t,r,{reload:!0},s)}loadOne(t,r=""){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(`${r}loading namespace ${d} for language ${i} failed`,c),!c&&f&&this.logger.log(`${r}loaded namespace ${d} for language ${i}`,f),this.loaded(t,c,f)})}saveMissing(t,r,s,i,d,c={},f=()=>{}){var p,g,x,y,v;if((g=(p=this.services)==null?void 0:p.utils)!=null&&g.hasLoadedNamespace&&!((y=(x=this.services)==null?void 0:x.utils)!=null&&y.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${s}" as the namespace "${r}" 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((v=this.backend)!=null&&v.create){const k=Se(ne({},c),{isUpdate:d}),T=this.backend.create.bind(this.backend);if(T.length<6)try{let N;T.length===5?N=T(t,r,s,i,k):N=T(t,r,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,r,s,i,f,k)}!t||!t[0]||this.store.addResource(t[0],r,s,i)}}}const x1=()=>({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 r=e[3]||e[2];Object.keys(r).forEach(s=>{t[s]=r[s]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),y1=e=>{var t,r;return Wt(e.ns)&&(e.ns=[e.ns]),Wt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Wt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),((r=(t=e.supportedLngs)==null?void 0:t.indexOf)==null?void 0:r.call(t,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e},qu=()=>{},u3=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})};class Gd extends $f{constructor(t={},r){if(super(),this.options=y1(t),this.services={},this.logger=$s,this.modules={external:[]},u3(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=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=x1();this.options=ne(ne(ne({},s),this.options),y1(t)),this.options.interpolation=ne(ne({},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=g=>g?typeof g=="function"?new g:g:null;if(!this.options.isClone){this.modules.logger?$s.init(i(this.modules.logger),this.options):$s.init(null,this.options);let g;this.modules.formatter?g=this.modules.formatter:g=o3;const x=new u1(this.options);this.store=new c1(this.options.resources,this.options);const y=this.services;y.logger=$s,y.resourceStore=this.store,y.languageUtils=x,y.pluralResolver=new s3(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"),g&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(y.formatter=i(g),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new g1(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new d3(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 bf(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,r||(r=qu),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const g=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);g.length>0&&g[0]!=="dev"&&(this.options.lng=g[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(g=>{this[g]=(...x)=>this.store[g](...x)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(g=>{this[g]=(...x)=>(this.store[g](...x),this)});const f=Id(),p=()=>{const g=(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),r(x,y)};if(this.languages&&!this.isInitialized)return g(null,this.t.bind(this));this.changeLanguage(this.options.lng,g)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),f}loadResources(t,r=qu){var d,c;let s=r;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=[],p=g=>{if(!g||g==="cimode")return;this.services.languageUtils.toResolveHierarchy(g).forEach(y=>{y!=="cimode"&&f.indexOf(y)<0&&f.push(y)})};i?p(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(x=>p(x)),(c=(d=this.options.preload)==null?void 0:d.forEach)==null||c.call(d,g=>p(g)),this.services.backendConnector.load(f,this.options.ns,g=>{!g&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(g)})}else s(null)}reloadResources(t,r,s){const i=Id();return typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),s||(s=qu),this.services.backendConnector.reload(t,r,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"&&n_.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 r=0;r<this.languages.length;r++){const s=this.languages[r];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,r){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,p)=>{p?this.isLanguageChangingTo===t&&(i(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,s.resolve((...g)=>this.t(...g)),r&&r(f,(...g)=>this.t(...g))},c=f=>{var x,y;!t&&!f&&this.services.languageDetector&&(f=[]);const p=Wt(f)?f:f&&f[0],g=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(Wt(f)?[f]:f);g&&(this.language||i(g),this.translator.language||this.translator.changeLanguage(g),(y=(x=this.services.languageDetector)==null?void 0:x.cacheUserLanguage)==null||y.call(x,g)),this.loadResources(g,v=>{d(v,g)})};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,r,s){const i=(d,c,...f)=>{let p;typeof c!="object"?p=this.options.overloadTranslationOptionHandler([d,c].concat(f)):p=ne({},c),p.lng=p.lng||i.lng,p.lngs=p.lngs||i.lngs,p.ns=p.ns||i.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||s||i.keyPrefix);const g=this.options.keySeparator||".";let x;return p.keyPrefix&&Array.isArray(d)?x=d.map(y=>(typeof y=="function"&&(y=Bg(y,ne(ne({},this.options),c))),`${p.keyPrefix}${g}${y}`)):(typeof d=="function"&&(d=Bg(d,ne(ne({},this.options),c))),x=p.keyPrefix?`${p.keyPrefix}${g}${d}`:d),this.t(x,p)};return Wt(t)?i.lng=t:i.lngs=t,i.ns=r,i.keyPrefix=s,i}t(...t){var r;return(r=this.translator)==null?void 0:r.translate(...t)}exists(...t){var r;return(r=this.translator)==null?void 0:r.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){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=r.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,p)=>{const g=this.services.backendConnector.state[`${f}|${p}`];return g===-1||g===0||g===2};if(r.precheck){const f=r.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,r){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(),r&&r(i)}),s):(r&&r(),Promise.resolve())}loadLanguages(t,r){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(),r&&r(c)}),s):(r&&r(),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 r=["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 u1(x1());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(s.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){const s=new Gd(t,r);return s.createInstance=Gd.createInstance,s}cloneInstance(t={},r=qu){const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i=Se(ne(ne({},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=ne({},this.services),d.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},s){const f=Object.keys(this.store.data).reduce((p,g)=>(p[g]=ne({},this.store.data[g]),p[g]=Object.keys(p[g]).reduce((x,y)=>(x[y]=ne({},p[g][y]),x),p[g]),p),{});d.store=new c1(f,i),d.services.resourceStore=d.store}return t.interpolation&&(d.services.interpolator=new g1(i)),d.translator=new bf(d.services,i),d.translator.on("*",(f,...p)=>{d.emit(f,...p)}),d.init(i,r),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 Sr=Gd.createInstance();Sr.createInstance;Sr.dir;Sr.init;Sr.loadResources;Sr.reloadResources;Sr.use;Sr.changeLanguage;Sr.getFixedT;Sr.t;Sr.exists;Sr.setDefaultNamespace;Sr.hasLoadedNamespace;Sr.loadNamespaces;Sr.loadLanguages;const f3=(e,t,r,s)=>{var d,c,f,p;const i=[r,ne({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]}`),(p=(f=e==null?void 0:e.services)==null?void 0:f.logger)!=null&&p.warn?e.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},b1={},i_=(e,t,r,s)=>{no(r)&&b1[r]||(no(r)&&(b1[r]=new Date),f3(e,t,r,s))},l_=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Ug=(e,t,r)=>{e.loadNamespaces(t,l_(e,r))},v1=(e,t,r,s)=>{if(no(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ug(e,r,s);r.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,l_(e,s))},h3=(e,t,r={})=>!t.languages||!t.languages.length?(i_(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(s,i)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}),no=e=>typeof e=="string",m3=e=>typeof e=="object"&&e!==null,g3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,p3={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},x3=e=>p3[e],y3=e=>e.replace(g3,x3);let Hg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:y3};const b3=(e={})=>{Hg=ne(ne({},Hg),e)},v3=()=>Hg;let o_;const _3=e=>{o_=e},w3=()=>o_,k3={type:"3rdParty",init(e){b3(e.options.react),_3(e)}},N3=j.createContext();class j3{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var xg={exports:{}},yg={};var _1;function S3(){if(_1)return yg;_1=1;var e=Hf();function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,d=e.useLayoutEffect,c=e.useDebugValue;function f(y,v){var k=v(),T=s({inst:{value:k,getSnapshot:v}}),N=T[0].inst,S=T[1];return d(function(){N.value=k,N.getSnapshot=v,p(N)&&S({inst:N})},[y,k,v]),i(function(){return p(N)&&S({inst:N}),y(function(){p(N)&&S({inst:N})})},[y]),c(k),k}function p(y){var v=y.getSnapshot;y=y.value;try{var k=v();return!r(y,k)}catch(T){return!0}}function g(y,v){return v()}var x=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?g:f;return yg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,yg}var w1;function T3(){return w1||(w1=1,xg.exports=S3()),xg.exports}var E3=T3();const C3=(e,t)=>no(t)?t:m3(t)&&no(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,A3={t:C3,ready:!1},O3=()=>()=>{},Va=(e,t={})=>{var J,de,ye;const{i18n:r}=t,{i18n:s,defaultNS:i}=j.useContext(N3)||{},d=r||s||w3();d&&!d.reportNamespaces&&(d.reportNamespaces=new j3),d||i_(d,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const c=j.useMemo(()=>{var ie;return ne(ne(ne({},v3()),(ie=d==null?void 0:d.options)==null?void 0:ie.react),t)},[d,t]),{useSuspense:f,keyPrefix:p}=c,g=i||((J=d==null?void 0:d.options)==null?void 0:J.defaultNS),x=no(g)?[g]:g||["translation"],y=j.useMemo(()=>x,x);(ye=(de=d==null?void 0:d.reportNamespaces)==null?void 0:de.addUsedNamespaces)==null||ye.call(de,y);const v=j.useRef(0),k=j.useCallback(ie=>{if(!d)return O3;const{bindI18n:he,bindI18nStore:ve}=c,me=()=>{v.current+=1,ie()};return he&&d.on(he,me),ve&&d.store.on(ve,me),()=>{he&&he.split(" ").forEach(ee=>d.off(ee,me)),ve&&ve.split(" ").forEach(ee=>d.store.off(ee,me))}},[d,c]),T=j.useRef(),N=j.useCallback(()=>{if(!d)return A3;const ie=!!(d.isInitialized||d.initializedStoreOnce)&&y.every(Q=>h3(Q,d,c)),he=t.lng||d.language,ve=v.current,me=T.current;if(me&&me.ready===ie&&me.lng===he&&me.keyPrefix===p&&me.revision===ve)return me;const q={t:d.getFixedT(he,c.nsMode==="fallback"?y:y[0],p),ready:ie,lng:he,keyPrefix:p,revision:ve};return T.current=q,q},[d,y,p,c,t.lng]),[S,A]=j.useState(0),{t:C,ready:O}=E3.useSyncExternalStore(k,N,N);j.useEffect(()=>{if(d&&!O&&!f){const ie=()=>A(he=>he+1);t.lng?v1(d,t.lng,y,ie):Ug(d,y,ie)}},[d,t.lng,y,O,f,S]);const P=d||{},B=j.useRef(null),V=j.useRef(),z=ie=>{const he=Object.getOwnPropertyDescriptors(ie);he.__original&&delete he.__original;const ve=Object.create(Object.getPrototypeOf(ie),he);if(!Object.prototype.hasOwnProperty.call(ve,"__original"))try{Object.defineProperty(ve,"__original",{value:ie,writable:!1,enumerable:!1,configurable:!1})}catch(me){}return ve},U=j.useMemo(()=>{const ie=P,he=ie==null?void 0:ie.language;let ve=ie;ie&&(B.current&&B.current.__original===ie?V.current!==he?(ve=z(ie),B.current=ve,V.current=he):ve=B.current:(ve=z(ie),B.current=ve,V.current=he));const me=[C,ve,O];return me.t=C,me.i18n=ve,me.ready=O,me},[C,P,O,P.resolvedLanguage,P.language,P.languages]);if(d&&f&&!O)throw new Promise(ie=>{const he=()=>ie();t.lng?v1(d,t.lng,y,he):Ug(d,y,he)});return U},{slice:M3,forEach:L3}=[];function D3(e){return L3.call(M3.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function P3(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(r=>r.test(e))}const k1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,R3=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(!k1.test(s.domain))throw new TypeError("option domain is invalid");d+=`; Domain=${s.domain}`}if(s.path){if(!k1.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},N1={create(e,t,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=R3(e,t,i)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let s=0;s<r.length;s++){let i=r[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 F3={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document!="undefined")return N1.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:s,cookieDomain:i,cookieOptions:d}=t;r&&typeof document!="undefined"&&N1.create(r,e,s,i,d)}},I3={name:"querystring",lookup(e){var s;let{lookupQuerystring:t}=e,r;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 p=c[f].indexOf("=");p>0&&c[f].substring(0,p)===t&&(r=c[f].substring(p+1))}}return r}},z3={name:"hash",lookup(e){var i;let{lookupHash:t,lookupFromHashIndex:r}=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 p=0;p<f.length;p++){const g=f[p].indexOf("=");g>0&&f[p].substring(0,g)===t&&(s=f[p].substring(g+1))}}if(s)return s;if(!s&&r>-1){const f=d.match(/\/([a-zA-Z-]*)/g);return Array.isArray(f)?(i=f[typeof r=="number"?r:0])==null?void 0:i.replace("/",""):void 0}}}return s}};let sc=null;const j1=()=>{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 B3={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&j1())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&j1()&&window.localStorage.setItem(r,e)}};let ic=null;const S1=()=>{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 U3={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&S1())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&S1()&&window.sessionStorage.setItem(r,e)}},H3={name:"navigator",lookup(e){const t=[];if(typeof navigator!="undefined"){const{languages:r,userLanguage:s,language:i}=navigator;if(r)for(let d=0;d<r.length;d++)t.push(r[d]);s&&t.push(s),i&&t.push(i)}return t.length>0?t:void 0}},$3={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const s=t||(typeof document!="undefined"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(r=s.getAttribute("lang")),r}},W3={name:"path",lookup(e){var i;let{lookupFromPathIndex:t}=e;if(typeof window=="undefined")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(i=r[typeof t=="number"?t:0])==null?void 0:i.replace("/",""):void 0}},V3={name:"subdomain",lookup(e){var i,d;let{lookupFromSubdomainIndex:t}=e;const r=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[r]}};let c_=!1;try{document.cookie,c_=!0}catch(e){}const d_=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];c_||d_.splice(1,1);const G3=()=>({order:d_,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class u_{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=D3(r,this.options||{},G3()),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(F3),this.addDetector(I3),this.addDetector(B3),this.addDetector(U3),this.addDetector(H3),this.addDetector($3),this.addDetector(W3),this.addDetector(V3),this.addDetector(z3)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(s=>{if(this.detectors[s]){let i=this.detectors[s].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(r=r.concat(i))}}),r=r.filter(s=>s!=null&&!P3(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(t,this.options)}))}}u_.type="languageDetector";const Z3={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"},q3={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"},Y3={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"},X3={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"},J3={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"},K3={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"},Q3={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"},eN={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"},tN={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"},aN={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"},rN={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"},nN={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"},sN={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)"},iN={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"},lN={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"},oN={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"},cN={common:Z3,sidebar:q3,login:Y3,dashboard:X3,commonFields:J3,filters:K3,listPages:Q3,assets:eN,workOrders:tN,maintenance:aN,ppm:rN,exportModal:nN,items:sN,issues:iN,users:lN,events:oN},dN={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:"العربية"},uN={title:"أصول سيرا",loggedInAs:"تم تسجيل الدخول كـ:",version:"أصول سيرا نظام إدارة الأصول الإصدار 1.0"},fN={title:"أصول سيرا",subtitle:"نظام إدارة الأصول",signIn:"قم بتسجيل الدخول للمتابعة",emailPlaceholder:"أدخل بريدك الإلكتروني",passwordPlaceholder:"أدخل كلمة المرور",loginFailed:"فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك.",demoLogin:"تسجيل دخول تجريبي"},hN={title:"لوحة التحكم",loading:"جاري تحميل لوحة التحكم...",totalAssets:"إجمالي عدد الأصول",openWorkOrders:"أوامر العمل المفتوحة",workOrdersInProgress:"أوامر العمل قيد التنفيذ",completedWorkOrders:"أوامر العمل المكتملة",totalWorkOrders:"إجمالي أوامر العمل",overdueWorkOrders:"أوامر العمل المتأخرة",upTime:"وقت التشغيل",downTime:"وقت التوقف",workOrderStatus:"حالة أمر العمل",workOrderByType:"أمر العمل حسب النوع",maintenanceByAsset:"الصيانة حسب الأصل",assigneesStatus:"حالة المكلفين",maintenanceFrequency:"تكرار الصيانة",maintenanceLogs:"سجلات الصيانة",assetUptime:"وقت تشغيل الأصل",avgResponseTime:"متوسط وقت الاستجابة",maintenanceEfficiency:"كفاءة الصيانة",overdueMaintenance:"صيانة متأخرة",upDownTimeChart:"مخطط وقت التشغيل والتوقف",ppmStatus:"حالة الصيانة الوقائية"},mN={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:"تاريخ الإكمال"},gN={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:"تحديث"},pN={title:"الأصول",addAsset:"إضافة أصل جديد",assetDetails:"تفاصيل الأصل"},xN={title:"أوامر العمل",addWorkOrder:"إضافة أمر عمل جديد",workOrderDetails:"تفاصيل أمر العمل",newWorkOrder:"أمر عمل جديد",duplicateWorkOrder:"نسخ أمر العمل",createFromAsset:"إنشاء أمر عمل من الأصل"},yN={title:"صيانة الأصول",maintenanceLogs:"سجلات الصيانة",maintenanceDetails:"تفاصيل الصيانة",addMaintenance:"إضافة صيانة جديدة"},bN={title:"الصيانة الوقائية",ppmDetails:"تفاصيل الصيانة الوقائية",addPPM:"إضافة صيانة وقائية جديدة"},vN={title:"تصدير",whatToExport:"ما الذي سيتم تصديره",selectedRows:"الصفوف المحددة",currentPage:"الصفحة الحالية",allWithFilters:"الكل مع المرشحات",exportSelected:"تصدير {count} محدد",exportPage:"تصدير {count} في الصفحة الحالية",exportAll:"تصدير الكل {count}",columnsToExport:"الأعمدة للتصدير",selectAll:"تحديد الكل",selectDefault:"تحديد الافتراضي",exporting:"جاري التصدير...",exportingSelected:"جاري تصدير {count} صف(وف) محدد(ة)",exportingPage:"جاري تصدير {count} صف(وف) من الصفحة الحالية",exportingAll:"جاري تصدير جميع {count} صف(وف)",selected:"محدد",rows:"صفوف"},_N={common:dN,sidebar:uN,login:fN,dashboard:hN,commonFields:mN,listPages:gN,assets:pN,workOrders:xN,maintenance:yN,ppm:bN,exportModal:vN},zt={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 wN{constructor(){Kn(this,"baseURL");Kn(this,"endpoints");Kn(this,"defaultHeaders");Kn(this,"timeout");this.baseURL=zt.BASE_URL,this.endpoints=zt.ENDPOINTS,this.defaultHeaders=zt.DEFAULT_HEADERS,this.timeout=zt.TIMEOUT}getCSRFToken(){return le(this,null,function*(){try{if(typeof window!="undefined"&&window.csrf_token)return window.csrf_token;if(!localStorage.getItem("user"))return null;const r=yield fetch(`${this.baseURL}${this.endpoints.CSRF_TOKEN}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"});return r.ok&&(yield r.json()).message||null}catch(t){return null}})}apiCall(s){return le(this,arguments,function*(t,r={}){const i=`${this.baseURL}${t}`,d=ne({method:"GET",headers:ne(ne({},this.defaultHeaders),r.headers)},r),c=yield this.getCSRFToken();c&&(d.headers["X-Frappe-CSRF-Token"]=c);try{const f=new AbortController,p=setTimeout(()=>f.abort(),this.timeout),g=yield fetch(i,Se(ne({},d),{signal:f.signal}));if(clearTimeout(p),!g.ok){const y=yield g.json().catch(()=>({}));throw new Kl(y.error||`HTTP error! status: ${g.status}`,g.status)}const x=yield g.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 le(this,null,function*(){const r=new FormData;r.append("usr",t.email),r.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:r,credentials:"include",signal:i.signal});if(clearTimeout(d),!c.ok){const p=yield c.json().catch(()=>({})),g="Invalid credentials. Please try again.";throw new Kl(g,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 le(this,null,function*(){yield this.apiCall(this.endpoints.LOGOUT,{method:"POST"})})}getUserDetails(t){return le(this,null,function*(){const r=t?`?user_id=${t}`:"";return this.apiCall(`${this.endpoints.USER_DETAILS}${r}`)})}getDoctypeRecords(t,r,s,i=20,d=0){return le(this,null,function*(){const c=new URLSearchParams({doctype:t,limit:i.toString(),offset:d.toString()});return r&&c.append("filters",JSON.stringify(r)),s&&c.append("fields",JSON.stringify(s)),this.apiCall(`${this.endpoints.DOCTYPE_RECORDS}?${c}`)})}getDashboardStats(){return le(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_STATS)})}getNumberCards(){return le(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_NUMBER_CARDS)})}listDashboardCharts(t=!0){return le(this,null,function*(){const r=new URLSearchParams({public_only:t?"1":"0"});return this.apiCall(`${this.endpoints.DASHBOARD_LIST_CHARTS}?${r}`)})}getDashboardChartData(t,r){return le(this,null,function*(){const s=new URLSearchParams({chart_name:t});return r&&s.append("report_filters",JSON.stringify(r)),this.apiCall(`${this.endpoints.DASHBOARD_CHART_DATA}?${s}`)})}getKycDetails(){return le(this,null,function*(){return this.apiCall(this.endpoints.KYC_DETAILS)})}uploadFile(t){return le(this,null,function*(){const r=new FormData;return r.append("file",t.file),r.append("doctype",t.doctype),r.append("docname",t.docname),r.append("fieldname",t.fieldname),this.apiCall(this.endpoints.UPLOAD_FILE,{method:"POST",headers:{},body:r})})}getUserPermissions(t){return le(this,null,function*(){const r=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_PERMISSIONS}${r}`)})}getPermissionFilters(t,r){return le(this,null,function*(){const s=new URLSearchParams({target_doctype:t});return r&&s.append("user",r),this.apiCall(`${this.endpoints.GET_PERMISSION_FILTERS}?${s}`)})}getAllowedValues(t,r){return le(this,null,function*(){const s=new URLSearchParams({allow_doctype:t});return r&&s.append("user",r),this.apiCall(`${this.endpoints.GET_ALLOWED_VALUES}?${s}`)})}checkDocumentAccess(t,r,s){return le(this,null,function*(){const i=new URLSearchParams({doctype:t,docname:r});return s&&i.append("user",s),this.apiCall(`${this.endpoints.CHECK_DOCUMENT_ACCESS}?${i}`)})}getConfiguredDoctypes(){return le(this,null,function*(){return this.apiCall(this.endpoints.GET_CONFIGURED_DOCTYPES)})}getUserDefaults(t){return le(this,null,function*(){const r=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_DEFAULTS}${r}`)})}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(r,s,i){super(r);Kn(this,"status");Kn(this,"code");this.name="ApiError",this.status=s,this.code=i}}const rt=new wN,kN=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Kl,default:rt},Symbol.toStringTag,{value:"Module"}));function NN(e){return le(this,null,function*(){try{const t=yield rt.getDoctypeRecords("Translation",{language:e},["source_text","translated_text","context"],1e4,0),r={};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}`;r[c]=d}else i.includes("."),r[i]=d}),r}catch(t){return console.error("Error fetching translations from Frappe:",t),{}}})}function jN(e){const t={};return Object.keys(e).forEach(r=>{if(r.includes(".")){const s=r.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[r]}else t[r]=e[r]}),t}function T1(e){return le(this,null,function*(){const t=yield NN(e);return jN(t)})}Sr.use(u_).use(k3).init({resources:{en:{translation:cN},ar:{translation:_N}},fallbackLng:"en",defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});function vf(){return le(this,null,function*(){try{if(!localStorage.getItem("user"))return;const t=yield T1("en");Object.keys(t).length>0&&Sr.addResourceBundle("en","translation",t,!0,!0);const r=yield T1("ar");Object.keys(r).length>0&&Sr.addResourceBundle("ar","translation",r,!0,!0),console.log("✓ Translations loaded from Frappe")}catch(e){console.warn("⚠ Could not load translations from Frappe, using static translations:",e)}})}Sr.on("initialized",()=>{vf()});var E1="popstate";function SN(e={}){function t(s,i){let{pathname:d,search:c,hash:f}=s.location;return $g("",{pathname:d,search:c,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(s,i){return typeof i=="string"?i:a0(i)}return EN(t,r,null,e)}function $a(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function Fn(e,t){if(!e){typeof console!="undefined"&&console.warn(t);try{throw new Error(t)}catch(r){}}}function TN(){return Math.random().toString(36).substring(2,10)}function C1(e,t){return{usr:e.state,key:e.key,idx:t}}function $g(e,t,r=null,s){return Se(ne({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?jc(t):t),{state:r,key:t&&t.key||s||TN()})}function a0({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function jc(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function EN(e,t,r,s={}){let{window:i=document.defaultView,v5Compat:d=!1}=s,c=i.history,f="POP",p=null,g=x();g==null&&(g=0,c.replaceState(Se(ne({},c.state),{idx:g}),""));function x(){return(c.state||{idx:null}).idx}function y(){f="POP";let S=x(),A=S==null?null:S-g;g=S,p&&p({action:f,location:N.location,delta:A})}function v(S,A){f="PUSH";let C=$g(N.location,S,A);g=x()+1;let O=C1(C,g),P=N.createHref(C);try{c.pushState(O,"",P)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(P)}d&&p&&p({action:f,location:N.location,delta:1})}function k(S,A){f="REPLACE";let C=$g(N.location,S,A);g=x();let O=C1(C,g),P=N.createHref(C);c.replaceState(O,"",P),d&&p&&p({action:f,location:N.location,delta:0})}function T(S){return CN(S)}let N={get action(){return f},get location(){return e(i,c)},listen(S){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(E1,y),p=S,()=>{i.removeEventListener(E1,y),p=null}},createHref(S){return t(i,S)},createURL:T,encodeLocation(S){let A=T(S);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:v,replace:k,go(S){return c.go(S)}};return N}function CN(e,t=!1){let r="http://localhost";typeof window!="undefined"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),$a(r,"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=r+s),new URL(s,r)}function f_(e,t,r="/"){return AN(e,t,r,!1)}function AN(e,t,r,s){let i=typeof t=="string"?jc(t):t,d=xi(i.pathname||"/",r);if(d==null)return null;let c=h_(e);ON(c);let f=null;for(let p=0;f==null&&p<c.length;++p){let g=HN(d);f=BN(c[p],g,s)}return f}function h_(e,t=[],r=[],s="",i=!1){let d=(c,f,p=i,g)=>{let x={relativePath:g===void 0?c.path||"":g,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(s)&&p)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=hi([s,x.relativePath]),v=r.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}".`),h_(c.children,t,v,y,p)),!(c.path==null&&!c.index)&&t.push({path:y,score:IN(y,c.index),routesMeta:v})};return e.forEach((c,f)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))d(c,f);else for(let g of m_(c.path))d(c,f,!0,g)}),t}function m_(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,i=r.endsWith("?"),d=r.replace(/\?$/,"");if(s.length===0)return i?[d,""]:[d];let c=m_(s.join("/")),f=[];return f.push(...c.map(p=>p===""?d:[d,p].join("/"))),i&&f.push(...c),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function ON(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:zN(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var MN=/^:[\w-]+$/,LN=3,DN=2,PN=1,RN=10,FN=-2,A1=e=>e==="*";function IN(e,t){let r=e.split("/"),s=r.length;return r.some(A1)&&(s+=FN),t&&(s+=DN),r.filter(i=>!A1(i)).reduce((i,d)=>i+(MN.test(d)?LN:d===""?PN:RN),s)}function zN(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 BN(e,t,r=!1){let{routesMeta:s}=e,i={},d="/",c=[];for(let f=0;f<s.length;++f){let p=s[f],g=f===s.length-1,x=d==="/"?t:t.slice(d.length)||"/",y=_f({path:p.relativePath,caseSensitive:p.caseSensitive,end:g},x),v=p.route;if(!y&&g&&r&&!s[s.length-1].route.index&&(y=_f({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},x)),!y)return null;Object.assign(i,y.params),c.push({params:i,pathname:hi([d,y.pathname]),pathnameBase:ZN(hi([d,y.pathnameBase])),route:v}),y.pathnameBase!=="/"&&(d=hi([d,y.pathnameBase]))}return c}function _f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=UN(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let d=i[0],c=d.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:s.reduce((g,{paramName:x,isOptional:y},v)=>{if(x==="*"){let T=f[v]||"";c=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const k=f[v];return y&&!k?g[x]=void 0:g[x]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:c,pattern:e}}function UN(e,t=!1,r=!0){Fn(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,p)=>(s.push({paramName:f,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function HN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fn(!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 xi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var $N=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,WN=e=>$N.test(e);function VN(e,t="/"){let{pathname:r,search:s="",hash:i=""}=typeof e=="string"?jc(e):e,d;if(r)if(WN(r))d=r;else{if(r.includes("//")){let c=r;r=r.replace(/\/\/+/g,"/"),Fn(!1,`Pathnames cannot have embedded double slashes - normalizing ${c} -> ${r}`)}r.startsWith("/")?d=O1(r.substring(1),"/"):d=O1(r,t)}else d=t;return{pathname:d,search:qN(s),hash:YN(i)}}function O1(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function bg(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function GN(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function lp(e){let t=GN(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function op(e,t,r,s=!1){let i;typeof e=="string"?i=jc(e):(i=ne({},e),$a(!i.pathname||!i.pathname.includes("?"),bg("?","pathname","search",i)),$a(!i.pathname||!i.pathname.includes("#"),bg("#","pathname","hash",i)),$a(!i.search||!i.search.includes("#"),bg("#","search","hash",i)));let d=e===""||i.pathname==="",c=d?"/":i.pathname,f;if(c==null)f=r;else{let y=t.length-1;if(!s&&c.startsWith("..")){let v=c.split("/");for(;v[0]==="..";)v.shift(),y-=1;i.pathname=v.join("/")}f=y>=0?t[y]:"/"}let p=VN(i,f),g=c&&c!=="/"&&c.endsWith("/"),x=(d||c===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(g||x)&&(p.pathname+="/"),p}var hi=e=>e.join("/").replace(/\/\/+/g,"/"),ZN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),qN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function XN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function JN(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var g_=["POST","PUT","PATCH","DELETE"];new Set(g_);var KN=["GET",...g_];new Set(KN);var Sc=j.createContext(null);Sc.displayName="DataRouter";var Wf=j.createContext(null);Wf.displayName="DataRouterState";j.createContext(!1);var p_=j.createContext({isTransitioning:!1});p_.displayName="ViewTransition";var QN=j.createContext(new Map);QN.displayName="Fetchers";var ej=j.createContext(null);ej.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 cp=j.createContext(null);cp.displayName="RouteError";function tj(e,{relative:t}={}){$a(Tc(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=j.useContext(as),{hash:i,pathname:d,search:c}=f0(e,{relative:t}),f=d;return r!=="/"&&(f=d==="/"?r:hi([r,d])),s.createHref({pathname:f,search:c,hash:i})}function Tc(){return j.useContext(u0)!=null}function Gs(){return $a(Tc(),"useLocation() may be used only in the context of a <Router> component."),j.useContext(u0).location}var x_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function y_(e){j.useContext(as).static||j.useLayoutEffect(e)}function xa(){let{isDataRoute:e}=j.useContext(ks);return e?mj():aj()}function aj(){$a(Tc(),"useNavigate() may be used only in the context of a <Router> component.");let e=j.useContext(Sc),{basename:t,navigator:r}=j.useContext(as),{matches:s}=j.useContext(ks),{pathname:i}=Gs(),d=JSON.stringify(lp(s)),c=j.useRef(!1);return y_(()=>{c.current=!0}),j.useCallback((p,g={})=>{if(Fn(c.current,x_),!c.current)return;if(typeof p=="number"){r.go(p);return}let x=op(p,JSON.parse(d),i,g.relative==="path");e==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:hi([t,x.pathname])),(g.replace?r.replace:r.push)(x,g.state,g)},[t,r,d,i,e])}j.createContext(null);function fl(){let{matches:e}=j.useContext(ks),t=e[e.length-1];return t?t.params:{}}function f0(e,{relative:t}={}){let{matches:r}=j.useContext(ks),{pathname:s}=Gs(),i=JSON.stringify(lp(r));return j.useMemo(()=>op(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function rj(e,t){return b_(e,t)}function b_(e,t,r,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],p=f?f.params:{},g=f?f.pathname:"/",x=f?f.pathnameBase:"/",y=f&&f.route;{let O=y&&y.path||"";v_(g,!y||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${O}">) 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="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let v=Gs(),k;if(t){let O=typeof t=="string"?jc(t):t;$a(x==="/"||((C=O.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 "${O.pathname}" was given in the \`location\` prop.`),k=O}else k=v;let T=k.pathname||"/",N=T;if(x!=="/"){let O=x.replace(/^\//,"").split("/");N="/"+T.replace(/^\//,"").split("/").slice(O.length).join("/")}let S=f_(e,{pathname:N});Fn(y||S!=null,`No routes matched location "${k.pathname}${k.search}${k.hash}" `),Fn(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 A=oj(S&&S.map(O=>Object.assign({},O,{params:Object.assign({},p,O.params),pathname:hi([x,d.encodeLocation?d.encodeLocation(O.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?x:hi([x,d.encodeLocation?d.encodeLocation(O.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),c,r,s,i);return t&&A?j.createElement(u0.Provider,{value:{location:ne({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:"POP"}},A):A}function nj(){let e=hj(),t=XN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=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),r?j.createElement("pre",{style:i},r):null,c)}var sj=j.createElement(nj,null),ij=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(cp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function lj({routeContext:e,match:t,children:r}){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},r)}function oj(e,t=[],r=null,s=null,i=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let d=e,c=r==null?void 0:r.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,p=-1;if(r)for(let x=0;x<d.length;x++){let y=d[x];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(p=x),y.route.id){let{loaderData:v,errors:k}=r,T=y.route.loader&&!v.hasOwnProperty(y.route.id)&&(!k||k[y.route.id]===void 0);if(y.route.lazy||T){f=!0,p>=0?d=d.slice(0,p+1):d=[d[0]];break}}}let g=r&&s?(x,y)=>{var v,k,T;s(x,{location:r.location,params:(T=(k=(v=r.matches)==null?void 0:v[0])==null?void 0:k.params)!=null?T:{},unstable_pattern:JN(r.matches),errorInfo:y})}:void 0;return d.reduceRight((x,y,v)=>{let k,T=!1,N=null,S=null;r&&(k=c&&y.route.id?c[y.route.id]:void 0,N=y.route.errorElement||sj,f&&(p<0&&v===0?(v_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,S=null):p===v&&(T=!0,S=y.route.hydrateFallbackElement||null)));let A=t.concat(d.slice(0,v+1)),C=()=>{let O;return k?O=N:T?O=S:y.route.Component?O=j.createElement(y.route.Component,null):y.route.element?O=y.route.element:O=x,j.createElement(lj,{match:y,routeContext:{outlet:x,matches:A,isDataRoute:r!=null},children:O})};return r&&(y.route.ErrorBoundary||y.route.errorElement||v===0)?j.createElement(ij,{location:r.location,revalidation:r.revalidation,component:N,error:k,children:C(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:g}):C()},null)}function dp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cj(e){let t=j.useContext(Sc);return $a(t,dp(e)),t}function dj(e){let t=j.useContext(Wf);return $a(t,dp(e)),t}function uj(e){let t=j.useContext(ks);return $a(t,dp(e)),t}function up(e){let t=uj(e),r=t.matches[t.matches.length-1];return $a(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function fj(){return up("useRouteId")}function hj(){var s;let e=j.useContext(cp),t=dj("useRouteError"),r=up("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function mj(){let{router:e}=cj("useNavigate"),t=up("useNavigate"),r=j.useRef(!1);return y_(()=>{r.current=!0}),j.useCallback((c,...f)=>le(null,[c,...f],function*(i,d={}){Fn(r.current,x_),r.current&&(typeof i=="number"?yield e.navigate(i):yield e.navigate(i,ne({fromRouteId:t},d)))}),[e,t])}var M1={};function v_(e,t,r){!t&&!M1[e]&&(M1[e]=!0,Fn(!1,r))}j.memo(gj);function gj({routes:e,future:t,state:r,unstable_onError:s}){return b_(e,void 0,r,s,t)}function Wg({to:e,replace:t,state:r,relative:s}){$a(Tc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=j.useContext(as);Fn(!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}=Gs(),f=xa(),p=op(e,lp(d),c,s==="path"),g=JSON.stringify(p);return j.useEffect(()=>{f(JSON.parse(g),{replace:t,state:r,relative:s})},[f,g,s,t,r]),null}function fa(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 pj({basename:e="/",children:t=null,location:r,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(/^\/*/,"/"),p=j.useMemo(()=>({basename:f,navigator:i,static:d,unstable_useTransitions:c,future:{}}),[f,i,d,c]);typeof r=="string"&&(r=jc(r));let{pathname:g="/",search:x="",hash:y="",state:v=null,key:k="default"}=r,T=j.useMemo(()=>{let N=xi(g,f);return N==null?null:{location:{pathname:N,search:x,hash:y,state:v,key:k},navigationType:s}},[f,g,x,y,v,k,s]);return Fn(T!=null,`<Router basename="${f}"> is not able to match the URL "${g}${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:p},j.createElement(u0.Provider,{children:t,value:T}))}function xj({children:e,location:t}){return rj(Vg(e),t)}function Vg(e,t=[]){let r=[];return j.Children.forEach(e,(s,i)=>{if(!j.isValidElement(s))return;let d=[...t,i];if(s.type===j.Fragment){r.push.apply(r,Vg(s.props.children,d));return}$a(s.type===fa,`[${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=Vg(s.props.children,d)),r.push(c)}),r}var uf="get",ff="application/x-www-form-urlencoded";function Vf(e){return typeof HTMLElement!="undefined"&&e instanceof HTMLElement}function yj(e){return Vf(e)&&e.tagName.toLowerCase()==="button"}function bj(e){return Vf(e)&&e.tagName.toLowerCase()==="form"}function vj(e){return Vf(e)&&e.tagName.toLowerCase()==="input"}function _j(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function wj(e,t){return e.button===0&&(!t||t==="_self")&&!_j(e)}function Gg(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let s=e[r];return t.concat(Array.isArray(s)?s.map(i=>[r,i]):[[r,s]])},[]))}function kj(e,t){let r=Gg(e);return t&&t.forEach((s,i)=>{r.has(i)||t.getAll(i).forEach(d=>{r.append(i,d)})}),r}var Yu=null;function Nj(){if(Yu===null)try{new FormData(document.createElement("form"),0),Yu=!1}catch(e){Yu=!0}return Yu}var jj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vg(e){return e!=null&&!jj.has(e)?(Fn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ff}"`),null):e}function Sj(e,t){let r,s,i,d,c;if(bj(e)){let f=e.getAttribute("action");s=f?xi(f,t):null,r=e.getAttribute("method")||uf,i=vg(e.getAttribute("enctype"))||ff,d=new FormData(e)}else if(yj(e)||vj(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 p=e.getAttribute("formaction")||f.getAttribute("action");if(s=p?xi(p,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||uf,i=vg(e.getAttribute("formenctype"))||vg(f.getAttribute("enctype"))||ff,d=new FormData(f,e),!Nj()){let{name:g,type:x,value:y}=e;if(x==="image"){let v=g?`${g}.`:"";d.append(`${v}x`,"0"),d.append(`${v}y`,"0")}else g&&d.append(g,y)}}else{if(Vf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=uf,s=null,i=ff,c=e}return d&&i==="text/plain"&&(c=d,d=void 0),{action:s,method:r.toLowerCase(),encType:i,formData:d,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fp(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function Tj(e,t,r){let s=typeof e=="string"?new URL(e,typeof window=="undefined"?"server://singlefetch/":window.location.origin):e;return s.pathname==="/"?s.pathname=`_root.${r}`:t&&xi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}function Ej(e,t){return le(this,null,function*(){if(e.id in t)return t[e.id];try{let r=yield import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}})}function Cj(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 Aj(e,t,r){return le(this,null,function*(){let s=yield Promise.all(e.map(i=>le(null,null,function*(){let d=t.routes[i.route.id];if(d){let c=yield Ej(d,r);return c.links?c.links():[]}return[]})));return Dj(s.flat(1).filter(Cj).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?Se(ne({},i),{rel:"prefetch",as:"style"}):Se(ne({},i),{rel:"prefetch"})))})}function L1(e,t,r,s,i,d){let c=(p,g)=>r[g]?p.route.id!==r[g].route.id:!0,f=(p,g)=>{var x;return r[g].pathname!==p.pathname||((x=r[g].route.path)==null?void 0:x.endsWith("*"))&&r[g].params["*"]!==p.params["*"]};return d==="assets"?t.filter((p,g)=>c(p,g)||f(p,g)):d==="data"?t.filter((p,g)=>{var y;let x=s.routes[p.route.id];if(!x||!x.hasLoader)return!1;if(c(p,g)||f(p,g))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((y=r[0])==null?void 0:y.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function Oj(e,t,{includeHydrateFallback:r}={}){return Mj(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)),r&&i.hydrateFallbackModule&&(d=d.concat(i.hydrateFallbackModule)),i.imports&&(d=d.concat(i.imports)),d}).flat(1))}function Mj(e){return[...new Set(e)]}function Lj(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function Dj(e,t){let r=new Set;return new Set(t),e.reduce((s,i)=>{let d=JSON.stringify(Lj(i));return r.has(d)||(r.add(d),s.push({key:d,link:i})),s},[])}function __(){let e=j.useContext(Sc);return fp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Pj(){let e=j.useContext(Wf);return fp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hp=j.createContext(void 0);hp.displayName="FrameworkContext";function w_(){let e=j.useContext(hp);return fp(e,"You must render this element inside a <HydratedRouter> element"),e}function Rj(e,t){let r=j.useContext(hp),[s,i]=j.useState(!1),[d,c]=j.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:g,onMouseLeave:x,onTouchStart:y}=t,v=j.useRef(null);j.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let N=A=>{A.forEach(C=>{c(C.isIntersecting)})},S=new IntersectionObserver(N,{threshold:.5});return v.current&&S.observe(v.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 r?e!=="intent"?[d,v,{}]:[d,v,{onFocus:zd(f,k),onBlur:zd(p,T),onMouseEnter:zd(g,k),onMouseLeave:zd(x,T),onTouchStart:zd(y,k)}]:[!1,v,{}]}function zd(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Fj(r){var s=r,{page:e}=s,t=gn(s,["page"]);let{router:i}=__(),d=j.useMemo(()=>f_(i.routes,e,i.basename),[i.routes,e,i.basename]);return d?j.createElement(zj,ne({page:e,matches:d},t)):null}function Ij(e){let{manifest:t,routeModules:r}=w_(),[s,i]=j.useState([]);return j.useEffect(()=>{let d=!1;return Aj(e,t,r).then(c=>{d||i(c)}),()=>{d=!0}},[e,t,r]),s}function zj(s){var i=s,{page:e,matches:t}=i,r=gn(i,["page","matches"]);let d=Gs(),{manifest:c,routeModules:f}=w_(),{basename:p}=__(),{loaderData:g,matches:x}=Pj(),y=j.useMemo(()=>L1(e,t,x,c,d,"data"),[e,t,x,c,d]),v=j.useMemo(()=>L1(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,A=!1;if(t.forEach(O=>{var B;let P=c.routes[O.route.id];!P||!P.hasLoader||(!y.some(V=>V.route.id===O.route.id)&&O.route.id in g&&((B=f[O.route.id])!=null&&B.shouldRevalidate)||P.hasClientLoader?A=!0:S.add(O.route.id))}),S.size===0)return[];let C=Tj(e,p,"data");return A&&S.size>0&&C.searchParams.set("_routes",t.filter(O=>S.has(O.route.id)).map(O=>O.route.id).join(",")),[C.pathname+C.search]},[p,g,d,c,y,t,e,f]),T=j.useMemo(()=>Oj(v,c),[v,c]),N=Ij(v);return j.createElement(j.Fragment,null,k.map(S=>j.createElement("link",ne({key:S,rel:"prefetch",as:"fetch",href:S},r))),T.map(S=>j.createElement("link",ne({key:S,rel:"modulepreload",href:S},r))),N.map(({key:S,link:A})=>j.createElement("link",ne({key:S,nonce:r.nonce},A))))}function Bj(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var k_=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";try{k_&&(window.__reactRouterVersion="7.10.0")}catch(e){}function Uj({basename:e,children:t,unstable_useTransitions:r,window:s}){let i=j.useRef();i.current==null&&(i.current=SN({window:s,v5Compat:!0}));let d=i.current,[c,f]=j.useState({action:d.action,location:d.location}),p=j.useCallback(g=>{r===!1?f(g):j.startTransition(()=>f(g))},[r]);return j.useLayoutEffect(()=>d.listen(p),[d,p]),j.createElement(pj,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:d,unstable_useTransitions:r===!0})}var N_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mp=j.forwardRef(function(T,k){var N=T,{onClick:t,discover:r="render",prefetch:s="none",relative:i,reloadDocument:d,replace:c,state:f,target:p,to:g,preventScrollReset:x,viewTransition:y}=N,v=gn(N,["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"]);let{basename:S,unstable_useTransitions:A}=j.useContext(as),C=typeof g=="string"&&N_.test(g),O,P=!1;if(typeof g=="string"&&C&&(O=g,k_))try{let ie=new URL(window.location.href),he=g.startsWith("//")?new URL(ie.protocol+g):new URL(g),ve=xi(he.pathname,S);he.origin===ie.origin&&ve!=null?g=ve+he.search+he.hash:P=!0}catch(ie){Fn(!1,`<Link to="${g}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let B=tj(g,{relative:i}),[V,z,U]=Rj(s,v),J=Vj(g,{replace:c,state:f,target:p,preventScrollReset:x,relative:i,viewTransition:y,unstable_useTransitions:A});function de(ie){t&&t(ie),ie.defaultPrevented||J(ie)}let ye=j.createElement("a",Se(ne(ne({},v),U),{href:O||B,onClick:P||d?t:de,ref:Bj(k,z),target:p,"data-discover":!C&&r==="render"?"true":void 0}));return V&&!C?j.createElement(j.Fragment,null,ye,j.createElement(Fj,{page:B})):ye});mp.displayName="Link";var Hj=j.forwardRef(function(y,x){var v=y,{"aria-current":t="page",caseSensitive:r=!1,className:s="",end:i=!1,style:d,to:c,viewTransition:f,children:p}=v,g=gn(v,["aria-current","caseSensitive","className","end","style","to","viewTransition","children"]);let k=f0(c,{relative:g.relative}),T=Gs(),N=j.useContext(Wf),{navigator:S,basename:A}=j.useContext(as),C=N!=null&&Xj(k)&&f===!0,O=S.encodeLocation?S.encodeLocation(k).pathname:k.pathname,P=T.pathname,B=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;r||(P=P.toLowerCase(),B=B?B.toLowerCase():null,O=O.toLowerCase()),B&&A&&(B=xi(B,A)||B);const V=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let z=P===O||!i&&P.startsWith(O)&&P.charAt(V)==="/",U=B!=null&&(B===O||!i&&B.startsWith(O)&&B.charAt(O.length)==="/"),J={isActive:z,isPending:U,isTransitioning:C},de=z?t:void 0,ye;typeof s=="function"?ye=s(J):ye=[s,z?"active":null,U?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ie=typeof d=="function"?d(J):d;return j.createElement(mp,Se(ne({},g),{"aria-current":de,className:ye,ref:x,style:ie,to:c,viewTransition:f}),typeof p=="function"?p(J):p)});Hj.displayName="NavLink";var $j=j.forwardRef((T,k)=>{var N=T,{discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:i,state:d,method:c=uf,action:f,onSubmit:p,relative:g,preventScrollReset:x,viewTransition:y}=N,v=gn(N,["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"]);let{unstable_useTransitions:S}=j.useContext(as),A=qj(),C=Yj(f,{relative:g}),O=c.toLowerCase()==="get"?"get":"post",P=typeof f=="string"&&N_.test(f),B=V=>{if(p&&p(V),V.defaultPrevented)return;V.preventDefault();let z=V.nativeEvent.submitter,U=(z==null?void 0:z.getAttribute("formmethod"))||c,J=()=>A(z||V.currentTarget,{fetcherKey:t,method:U,navigate:r,replace:i,state:d,relative:g,preventScrollReset:x,viewTransition:y});S&&r!==!1?j.startTransition(()=>J()):J()};return j.createElement("form",Se(ne({ref:k,method:O,action:C,onSubmit:s?p:B},v),{"data-discover":!P&&e==="render"?"true":void 0}))});$j.displayName="Form";function Wj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j_(e){let t=j.useContext(Sc);return $a(t,Wj(e)),t}function Vj(e,{target:t,replace:r,state:s,preventScrollReset:i,relative:d,viewTransition:c,unstable_useTransitions:f}={}){let p=xa(),g=Gs(),x=f0(e,{relative:d});return j.useCallback(y=>{if(wj(y,t)){y.preventDefault();let v=r!==void 0?r:a0(g)===a0(x),k=()=>p(e,{replace:v,state:s,preventScrollReset:i,relative:d,viewTransition:c});f?j.startTransition(()=>k()):k()}},[g,p,x,r,s,t,e,i,d,c,f])}function hl(e){Fn(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(Gg(e)),r=j.useRef(!1),s=Gs(),i=j.useMemo(()=>kj(s.search,r.current?null:t.current),[s.search]),d=xa(),c=j.useCallback((f,p)=>{const g=Gg(typeof f=="function"?f(new URLSearchParams(i)):f);r.current=!0,d("?"+g,p)},[d,i]);return[i,c]}var Gj=0,Zj=()=>`__${String(++Gj)}__`;function qj(){let{router:e}=j_("useSubmit"),{basename:t}=j.useContext(as),r=fj(),s=e.fetch,i=e.navigate;return j.useCallback((f,...p)=>le(null,[f,...p],function*(d,c={}){let{action:g,method:x,encType:y,formData:v,body:k}=Sj(d,t);if(c.navigate===!1){let T=c.fetcherKey||Zj();yield s(T,r,c.action||g,{preventScrollReset:c.preventScrollReset,formData:v,body:k,formMethod:c.method||x,formEncType:c.encType||y,flushSync:c.flushSync})}else yield i(c.action||g,{preventScrollReset:c.preventScrollReset,formData:v,body:k,formMethod:c.method||x,formEncType:c.encType||y,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})}),[s,i,t,r])}function Yj(e,{relative:t}={}){let{basename:r}=j.useContext(as),s=j.useContext(ks);$a(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),d=ne({},f0(e||".",{relative:t})),c=Gs();if(e==null){d.search=c.search;let f=new URLSearchParams(d.search),p=f.getAll("index");if(p.some(x=>x==="")){f.delete("index"),p.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"),r!=="/"&&(d.pathname=d.pathname==="/"?r:hi([r,d.pathname])),a0(d)}function Xj(e,{relative:t}={}){let r=j.useContext(p_);$a(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=j_("useViewTransitionState"),i=f0(e,{relative:t});if(!r.isTransitioning)return!1;let d=xi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=xi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return _f(i.pathname,c)!=null||_f(i.pathname,d)!=null}var S_=a_();const Jj="modulepreload",Kj=function(e){return"/assets/asm_ui_app/asm_app/"+e},D1={},P1=function(t,r,s){let i=Promise.resolve();if(r&&r.length>0){let g=function(x){return Promise.all(x.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};var c=g;document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),p=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=g(r.map(x=>{if(x=Kj(x),x in D1)return;D1[x]=!0;const y=x.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${v}`))return;const k=document.createElement("link");if(k.rel=y?"stylesheet":Jj,y||(k.as="script"),k.crossOrigin="",k.href=x,p&&k.setAttribute("nonce",p),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 p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f}return i.then(f=>{for(const p of f||[])p.status==="rejected"&&d(p.reason);return t().catch(d)})},T_=j.createContext(void 0),Qj=({children:e})=>{const{i18n:t}=Va(),[r,s]=j.useState(()=>localStorage.getItem("i18nextLng")==="ar"?"ar":"en"),i=r==="ar";j.useEffect(()=>{const c=document.documentElement,f=document.documentElement;t.changeLanguage(r),f.setAttribute("lang",r),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"))},[r,t,i]);const d=c=>le(null,null,function*(){s(c),localStorage.setItem("i18nextLng",c),yield vf()});return a.jsx(T_.Provider,{value:{language:r,changeLanguage:d,isRTL:i},children:e})},gp=()=>{const e=j.useContext(T_);if(!e)throw new Error("useLanguage must be used within LanguageProvider");return e},eS=()=>{const[e,t]=j.useState({email:"",password:""}),[r,s]=j.useState(!1),[i,d]=j.useState(null),c=xa(),{t:f}=Va(),{isRTL:p}=gp(),g="/assets/asm_ui_app/asm_app/",x="?v=1765198405",y=T=>{const{name:N,value:S}=T.target;t(A=>Se(ne({},A),{[N]:S})),d(null)},v=T=>le(null,null,function*(){T.preventDefault(),s(!0),d(null);try{const{useAuth:N}=yield P1(()=>le(null,null,function*(){const{useAuth:C}=yield Promise.resolve().then(()=>tS);return{useAuth:C}}),[]),S=(yield P1(()=>le(null,null,function*(){const{default:C}=yield Promise.resolve().then(()=>kN);return{default:C}}),void 0)).default,A=yield S.login(e);if(A&&A.message){const C=Se(ne({},A.message),{email:e.email});localStorage.setItem("user",JSON.stringify(C)),A.message.sid&&S.setSessionId(A.message.sid);try{yield vf()}catch(O){console.warn("Could not load translations after login:",O)}c("/dashboard")}else d(f("login.loginFailed"))}catch(N){console.error("Login error:",N),d(N.message||f("login.loginFailed"))}finally{s(!1)}}),k=()=>le(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 vf()}catch(N){console.warn("Could not load translations after demo login:",N)}c("/dashboard")});return a.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:a.jsxs("div",{className:"max-w-md w-full space-y-8",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-center mb-6",children:a.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:[a.jsx("img",{src:`${g}${g.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")}}),a.jsxs("svg",{className:"w-20 h-20 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"white",fillOpacity:"0.9"}),a.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"white",fillOpacity:"0.7"}),a.jsx("path",{d:"M12 12V17",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]})]})}),a.jsx("h2",{className:"text-center text-3xl font-semibold text-gray-900 dark:text-white",children:f("login.title")}),a.jsx("p",{className:"mt-2 text-center text-sm font-medium text-indigo-600 dark:text-indigo-400",children:f("login.subtitle")}),a.jsx("p",{className:"mt-1 text-center text-xs text-gray-600 dark:text-gray-400",children:f("login.signIn")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:v,children:[a.jsxs("div",{className:"rounded-md shadow-sm -space-y-px",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"email",className:"sr-only",children:f("common.email")}),a.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})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"sr-only",children:f("common.password")}),a.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&&a.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:a.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("button",{type:"submit",disabled:r,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:r?a.jsxs("div",{className:"flex items-center",children:[a.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:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.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")}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-300 dark:border-gray-600"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"px-2 bg-gray-50 dark:bg-gray-900 text-gray-500 dark:text-gray-400",children:"or"})})]}),a.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[r,s]=j.useState(null),[i,d]=j.useState(!0),[c,f]=j.useState(null),p=j.useCallback(()=>le(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(()=>{p()},[p]);const g=j.useCallback(()=>{p()},[p]);return{data:r,loading:i,error:c,refetch:g}}function E_(e){return h0(()=>rt.getUserDetails(e),[e])}function C_(){return h0(()=>rt.getDashboardStats())}function pp(){return h0(()=>rt.getNumberCards())}function Yl(e,t){return h0(()=>rt.getDashboardChartData(e,t),[e,JSON.stringify(t||{})])}function A_(){const[e,t]=j.useState(rt.isAuthenticated());return{isAuthenticated:e,login:i=>le(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:()=>le(null,null,function*(){try{yield rt.logout()}finally{rt.setSessionId(""),t(!1)}})}}const tS=Object.freeze(Object.defineProperty({__proto__:null,useApi:h0,useAuth:A_,useDashboardChart:Yl,useDashboardStats:C_,useNumberCards:pp,useUserDetails:E_},Symbol.toStringTag,{value:"Module"})),aS=()=>{const[e,t]=j.useState({}),[r,s]=j.useState(!1),i=()=>le(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 a.jsxs("div",{style:{padding:"20px",border:"1px solid #ccc",margin:"20px"},children:[a.jsx("h2",{children:"API Connection Test"}),a.jsx("button",{onClick:i,disabled:r,style:{padding:"10px 20px",marginBottom:"20px",backgroundColor:r?"#ccc":"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:r?"not-allowed":"pointer"},children:r?"Testing...":"Test API Connection"}),a.jsxs("div",{children:[a.jsx("h3",{children:"Test Results:"}),a.jsxs("div",{style:{background:"#f5f5f5",padding:"15px",borderRadius:"5px",fontSize:"14px"},children:[a.jsxs("div",{children:[a.jsx("strong",{children:"1. Basic Connectivity:"})," ",e.csrfToken||"Not tested"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"2. Frappe System API:"})," ",e.dashboardStats||"Not tested"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"3. Custom User API:"})," ",e.userDetails||"Not tested"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"4. Custom Stats API:"})," ",e.doctypeRecords||"Not tested"]}),e.error&&a.jsxs("div",{style:{color:"red"},children:[a.jsx("strong",{children:"Error:"})," ",e.error]})]}),a.jsxs("div",{style:{marginTop:"10px",fontSize:"12px",color:"#666"},children:[a.jsx("p",{children:a.jsx("strong",{children:"Expected Results:"})}),a.jsxs("ul",{children:[a.jsx("li",{children:"✅ Basic Connectivity should succeed (tests proxy connection)"}),a.jsx("li",{children:"✅ Frappe System API should succeed (tests Frappe API)"}),a.jsx("li",{children:"❌ Custom APIs will fail until you deploy the API file to your server"})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"If Basic Connectivity fails:"})," Check your Frappe server is running and accessible"]})]})]})]})},_g=e=>Number.isFinite(e)?Math.max(0,e):0;function rS({type:e,labels:t,datasets:r,height:s=220}){if(!(t!=null&&t.length)||!(r!=null&&r.length))return a.jsx("div",{className:"text-sm text-gray-500",children:"No data"});if(e.toLowerCase()==="pie"){const g=r[0].values.map(_g),x=g.reduce((S,A)=>S+A,0)||1,y=Math.min(100,s/2-10),v=y+10,k=y+10;let T=0;const N=r[0].values.map((S,A)=>r[0].color||R1(A));return a.jsx("svg",{width:v*2,height:k*2,viewBox:`0 0 ${v*2} ${k*2}`,children:g.map((S,A)=>{const C=T/x*2*Math.PI;T+=S;const O=T/x*2*Math.PI,P=O-C>Math.PI?1:0,B=v+y*Math.cos(C),V=k+y*Math.sin(C),z=v+y*Math.cos(O),U=k+y*Math.sin(O),J=`M ${v} ${k} L ${B} ${V} A ${y} ${y} 0 ${P} 1 ${z} ${U} Z`;return a.jsx("path",{d:J,fill:N[A]},A)})})}const i=r,d=Math.max(...i.flatMap(g=>g.values.map(_g)),1),c=Math.max(t.length*60,300),f=s-40,p=Math.max(20,(c-40)/t.length-10);return a.jsxs("svg",{width:c,height:s,viewBox:`0 0 ${c} ${s}`,children:[a.jsx("line",{x1:30,y1:10,x2:30,y2:f,stroke:"#e5e7eb"}),a.jsx("line",{x1:30,y1:f,x2:c-10,y2:f,stroke:"#e5e7eb"}),t.map((g,x)=>{const y=40+x*(p+10);let v=0;return a.jsxs("g",{children:[i.map((k,T)=>{const S=_g(k.values[x]||0)/d*(f-20),A=f-S-v,C=k.color||R1(T);return v+=S,a.jsx("rect",{x:y,y:A,width:p,height:S,fill:C,rx:2},T)}),a.jsx("text",{x:y+p/2,y:s-5,textAnchor:"middle",fontSize:"10",fill:"#6b7280",children:nS(g,8)})]},x)})]})}function R1(e){const t=["#4F46E5","#10B981","#F59E0B","#EF4444","#6366F1","#22C55E","#E11D48"];return t[e%t.length]}function nS(e,t){return e.length>t?e.slice(0,t-1)+"…":e}const sS=({chartName:e,filters:t})=>{const{data:r,loading:s,error:i}=Yl(e,t);return a.jsxs("div",{className:"bg-white rounded-lg shadow p-4 overflow-auto",children:[a.jsx("div",{className:"flex items-center justify-between mb-3",children:a.jsx("h4",{className:"text-sm font-semibold text-gray-800",children:e})}),s&&a.jsx("div",{className:"text-sm text-gray-500",children:"Loading…"}),i&&a.jsx("div",{className:"text-sm text-red-600",children:i}),!s&&!i&&r&&a.jsx(rS,{type:r.type,labels:r.labels,datasets:r.datasets})]})},iS=()=>{var k,T,N,S;const[e,t]=j.useState(null),[r,s]=j.useState([]),i=xa(),{logout:d}=A_(),{loading:c,error:f}=C_(),{data:p}=pp(),{data:g,loading:x,error:y}=E_();j.useEffect(()=>{const A=localStorage.getItem("user");A?t(JSON.parse(A)):g&&t(g);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)},[g]);const v=()=>le(null,null,function*(){try{yield d(),localStorage.removeItem("user"),i("/login")}catch(A){console.error("Logout error:",A),localStorage.removeItem("user"),i("/login")}});return c||x?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:a.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[a.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex justify-between items-center py-6",children:[a.jsx("div",{className:"flex items-center",children:a.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Dashboard"})}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Welcome, ",(e==null?void 0:e.full_name)||"User"]}),a.jsx("button",{onClick:v,className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Logout"})]})]})})}),a.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[(f||y)&&a.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:a.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:f||y||"Failed to load dashboard data"})}),a.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4 mb-8",children:[a.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:a.jsx("div",{className:"p-5",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-indigo-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})})}),a.jsx("div",{className:"ml-5 w-0 flex-1",children:a.jsxs("dl",{children:[a.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Total Assets"}),a.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(k=p==null?void 0:p.total_assets)!=null?k:"-"})]})})]})})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:a.jsx("div",{className:"p-5",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsx("div",{className:"ml-5 w-0 flex-1",children:a.jsxs("dl",{children:[a.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Open Work Orders"}),a.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(T=p==null?void 0:p.work_orders_open)!=null?T:"-"})]})})]})})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:a.jsx("div",{className:"p-5",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-yellow-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsx("div",{className:"ml-5 w-0 flex-1",children:a.jsxs("dl",{children:[a.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"In Progress"}),a.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(N=p==null?void 0:p.work_orders_in_progress)!=null?N:"-"})]})})]})})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:a.jsx("div",{className:"p-5",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsx("div",{className:"ml-5 w-0 flex-1",children:a.jsxs("dl",{children:[a.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Completed Work Orders"}),a.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(S=p==null?void 0:p.work_orders_completed)!=null?S:"-"})]})})]})})})]}),a.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(A=>a.jsx(sS,{chartName:A},A))}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[a.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[a.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:"Recent Records"}),a.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Latest entries from your Frappe backend"})]}),a.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:r.map(A=>{var C;return a.jsx("li",{children:a.jsxs("div",{className:"px-4 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center",children:a.jsx("span",{className:"text-sm font-medium text-indigo-600",children:((C=A.full_name)==null?void 0:C.charAt(0))||A.name.charAt(0)})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:A.full_name||A.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:A.email||"No email"})]})]}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(A.creation).toLocaleDateString()})]})},A.name)})})]}),a.jsxs("div",{className:"mt-8",children:[a.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white mb-4",children:"Quick Actions"}),a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[a.jsx("button",{onClick:()=>i("/users"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"View Users"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Manage user accounts"})]})]})}),a.jsx("button",{onClick:()=>i("/settings"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-gray-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Settings"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Configure your preferences"})]})]})}),a.jsx("button",{onClick:()=>i("/events"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Events"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View calendar events"})]})]})}),a.jsx("button",{onClick:()=>i("/reports"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Reports"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View analytics and reports"})]})]})})]})]}),a.jsx("div",{className:"mt-8",children:a.jsx(aS,{})})]})]})};class lS{getWorkOrders(t,r,s=20,i=0,d){return le(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),r&&r.length>0&&c.append("fields",JSON.stringify(r)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${zt.ENDPOINTS.GET_WORK_ORDERS}?${c.toString()}`;return rt.apiCall(f)})}getWorkOrderDetails(t){return le(this,null,function*(){const r=`${zt.ENDPOINTS.GET_WORK_ORDER_DETAILS}?work_order_name=${encodeURIComponent(t)}`;return rt.apiCall(r)})}createWorkOrder(t){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.CREATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_data:t})})})}updateWorkOrder(t,r){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.UPDATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,work_order_data:r})})})}deleteWorkOrder(t){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.DELETE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t})})})}updateWorkOrderStatus(t,r,s){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.UPDATE_WORK_ORDER_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,repair_status:r,workflow_state:s})})})}getWorkOrderFilters(){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.GET_WORK_ORDER_FILTERS)})}getWorkOrderStats(){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.GET_WORK_ORDER_STATS)})}searchWorkOrders(t,r=10){return le(this,null,function*(){const s=`${zt.ENDPOINTS.SEARCH_WORK_ORDERS}?search_term=${encodeURIComponent(t)}&limit=${r}`;return rt.apiCall(s)})}submitWorkOrder(t){return le(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 le(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,r=50){return le(this,null,function*(){const s={asset:t};return(yield this.getWorkOrders(s,void 0,r,0,"creation desc")).work_orders})}getOpenWorkOrders(t=50){return le(this,null,function*(){const r={repair_status:["not in",["Completed","Cancelled"]]};return(yield this.getWorkOrders(r,void 0,t,0,"creation desc")).work_orders})}getWorkOrdersByPriority(t,r=50){return le(this,null,function*(){const s={custom_priority_:t};return(yield this.getWorkOrders(s,void 0,r,0,"creation desc")).work_orders})}}const Xl=new lS,oS=(e,t)=>{const r=ne({},e||{});for(const[s,i]of Object.entries(t))if(!r[s])r[s]=i;else if(Array.isArray(i)&&i[0]==="in"){const d=i[1],c=r[s];if(typeof c=="string")d.includes(c)||(r[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const p=c[1].filter(g=>d.includes(g));r[s]=["in",p]}else r[s]=i}return r};function O_(e,t=20,r=0,s,i={}){const[d,c]=j.useState([]),[f,p]=j.useState(0),[g,x]=j.useState(!1),[y,v]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),A=j.useRef(!1),C=JSON.stringify(e),O=JSON.stringify(i);j.useEffect(()=>{if(A.current&&k)return;let B=!1;return A.current=!0,le(null,null,function*(){try{v(!0);const z=oS(e,i);console.log("[useWorkOrders] User filters:",e),console.log("[useWorkOrders] Permission filters:",i),console.log("[useWorkOrders] Merged filters:",z);const U=yield Xl.getWorkOrders(z,void 0,t,r,s);B||(c(U.work_orders),p(U.total_count),x(U.has_more),T(null))}catch(z){if(!B){const U=z instanceof Error?z.message:"Failed to fetch work orders";U.includes("417")||U.includes("Expectation Failed")||U.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(U),c([]),p(0),x(!1)}}finally{B||v(!1)}}),()=>{B=!0}},[C,O,t,r,s,N]);const P=j.useCallback(()=>{A.current=!1,S(B=>B+1)},[]);return{workOrders:d,totalCount:f,hasMore:g,loading:y,error:k,refetch:P}}function cS(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}try{i(!0),c(null);const g=yield Xl.getWorkOrderDetails(e);r(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch work order details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const p=j.useCallback(()=>{f()},[f]);return{workOrder:t,loading:s,error:d,refetch:p}}function M_(){const[e,t]=j.useState(!1),[r,s]=j.useState(null);return{createWorkOrder:g=>le(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Creating work order with data:",g);const x=yield Xl.createWorkOrder(g);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:(g,x)=>le(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Updating work order:",g,"with data:",x);const y=yield Xl.updateWorkOrder(g,x);if(console.log("[useWorkOrderMutations] Update work order response:",y),y.success)return y.work_order;{const v=y.error||"Failed to update work order";throw new Error(v)}}catch(y){console.error("[useWorkOrderMutations] Update work order error:",y);const v=y instanceof Error?y.message:"Failed to update work order";throw s(v),y}finally{t(!1)}}),deleteWorkOrder:g=>le(null,null,function*(){try{t(!0),s(null);const x=yield Xl.deleteWorkOrder(g);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:g=>le(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Submitting work order:",g);const x=yield Xl.submitWorkOrder(g);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:(g,x,y)=>le(null,null,function*(){try{t(!0),s(null);const v=yield Xl.updateWorkOrderStatus(g,x,y);if(v.success)return v.work_order;throw new Error("Failed to update work order status")}catch(v){const k=v instanceof Error?v.message:"Failed to update status";throw s(k),v}finally{t(!1)}}),loading:e,error:r}}const gs=rt;class dS{getMaintenanceLogs(t,r,s=20,i=0,d){return le(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),r&&r.length>0&&c.append("fields",JSON.stringify(r)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d),c.append("include_child_tables","true");const f=`${zt.ENDPOINTS.GET_ASSET_MAINTENANCE_LOGS}?${c.toString()}`;return gs.apiCall(f)})}getMaintenanceLogDetails(t){return le(this,null,function*(){const r=new URLSearchParams;r.append("log_name",t),r.append("include_child_tables","true");const s=`${zt.ENDPOINTS.GET_ASSET_MAINTENANCE_LOG_DETAILS}?${r.toString()}`;return gs.apiCall(s)})}createMaintenanceLog(t){return le(this,null,function*(){const r=this.prepareLogData(t);return gs.apiCall(zt.ENDPOINTS.CREATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_data:r})})})}updateMaintenanceLog(t,r){return le(this,null,function*(){const s=this.prepareLogData(r);return gs.apiCall(zt.ENDPOINTS.UPDATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,log_data:s})})})}deleteMaintenanceLog(t){return le(this,null,function*(){return gs.apiCall(zt.ENDPOINTS.DELETE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t})})})}updateMaintenanceStatus(t,r,s){return le(this,null,function*(){return gs.apiCall(zt.ENDPOINTS.UPDATE_MAINTENANCE_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,maintenance_status:r,workflow_state:s})})})}getMaintenanceLogsByAsset(t,r,s=20,i=0){return le(this,null,function*(){const d=new URLSearchParams;d.append("asset_name",t),r&&d.append("filters",JSON.stringify(r)),d.append("limit",s.toString()),d.append("offset",i.toString()),d.append("include_child_tables","true");const c=`${zt.ENDPOINTS.GET_MAINTENANCE_LOGS_BY_ASSET}?${d.toString()}`;return gs.apiCall(c)})}getOverdueMaintenanceLogs(t,r=20,s=0){return le(this,null,function*(){const i=new URLSearchParams;t&&i.append("filters",JSON.stringify(t)),i.append("limit",r.toString()),i.append("offset",s.toString()),i.append("include_child_tables","true");const d=`${zt.ENDPOINTS.GET_OVERDUE_MAINTENANCE_LOGS}?${i.toString()}`;return gs.apiCall(d)})}addPPMTableRow(t,r){return le(this,null,function*(){return gs.apiCall(zt.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(r)})})})}removePPMTableRow(t,r){return le(this,null,function*(){return gs.apiCall(zt.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:r})})})}updatePPMTableRow(t,r,s){return le(this,null,function*(){return gs.apiCall(zt.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:r,row_data:this.cleanPPMRow(s)})})})}cleanPPMRow(t){return Se(ne({},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 r={},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]!==""&&(r[i]=t[i]);return typeof r.has_certificate=="boolean"&&(r.has_certificate=r.has_certificate?1:0),typeof r.custom_accepted_by_moh=="boolean"&&(r.custom_accepted_by_moh=r.custom_accepted_by_moh?1:0),typeof r.custom_accepted_by_moh_=="boolean"&&(r.custom_accepted_by_moh_=r.custom_accepted_by_moh_?1:0),r.custom_table&&Array.isArray(r.custom_table)&&(r.custom_table=r.custom_table.map(i=>this.cleanPPMRow(i))),r}}const fc=new dS;function Gf(e,t=20,r=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[p,g]=j.useState(!1),[x,y]=j.useState(!0),[v,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),A=JSON.stringify(e);j.useEffect(()=>{if(S.current&&v)return;let O=!1;return S.current=!0,le(null,null,function*(){try{y(!0);const B=yield fc.getMaintenanceLogs(e,void 0,t,r,s);O||(d(B.asset_maintenance_logs),f(B.total_count),g(B.has_more),k(null))}catch(B){if(!O){const V=B instanceof Error?B.message:"Failed to fetch maintenance logs";V.includes("417")||V.includes("Expectation Failed")||V.includes("has no attribute")?k("API endpoint not deployed. Please deploy asset_maintenance_api.py to your Frappe server."):k(V),d([]),f(0),g(!1)}}finally{O||y(!1)}}),()=>{O=!0}},[A,t,r,s,T]);const C=j.useCallback(()=>{S.current=!1,N(O=>O+1)},[]);return{logs:i,totalCount:c,hasMore:p,loading:x,error:v,refetch:C}}function uS(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}try{i(!0),c(null);const g=yield fc.getMaintenanceLogDetails(e);r(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch maintenance log details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const p=j.useCallback(()=>{f()},[f]);return{log:t,loading:s,error:d,refetch:p}}function L_(){const[e,t]=j.useState(!1),[r,s]=j.useState(null);return{createLog:p=>le(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Creating maintenance log:",p);const g=yield fc.createMaintenanceLog(p);if(console.log("[useMaintenanceMutations] Create response:",g),g.success)return g.asset_maintenance_log;{const x=g.error||"Failed to create maintenance log";throw new Error(x)}}catch(g){console.error("[useMaintenanceMutations] Create error:",g);const x=g instanceof Error?g.message:"Failed to create maintenance log";throw s(x),g}finally{t(!1)}}),updateLog:(p,g)=>le(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Updating maintenance log:",p,g);const x=yield fc.updateMaintenanceLog(p,g);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:p=>le(null,null,function*(){try{t(!0),s(null);const g=yield fc.deleteMaintenanceLog(p);if(!g.success)throw new Error("Failed to delete maintenance log");return g}catch(g){const x=g instanceof Error?g.message:"Failed to delete maintenance log";throw s(x),g}finally{t(!1)}}),updateStatus:(p,g,x)=>le(null,null,function*(){try{t(!0),s(null);const y=yield fc.updateMaintenanceStatus(p,g,x);if(y.success)return y.asset_maintenance_log;throw new Error("Failed to update maintenance status")}catch(y){const v=y instanceof Error?y.message:"Failed to update status";throw s(v),y}finally{t(!1)}}),loading:e,error:r}}class fS{getAssets(t,r,s=20,i=0,d){return le(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),r&&r.length>0&&c.append("fields",JSON.stringify(r)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${zt.ENDPOINTS.GET_ASSETS}?${c.toString()}`;return rt.apiCall(f)})}getAssetDetails(t){return le(this,null,function*(){const r=`${zt.ENDPOINTS.GET_ASSET_DETAILS}?asset_name=${encodeURIComponent(t)}`;return rt.apiCall(r)})}createAsset(t){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.CREATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_data:t})})})}updateAsset(t,r){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.UPDATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t,asset_data:r})})})}deleteAsset(t){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.DELETE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t})})})}getAssetFilters(){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.GET_ASSET_FILTERS)})}getAssetStats(){return le(this,null,function*(){return rt.apiCall(zt.ENDPOINTS.GET_ASSET_STATS)})}searchAssets(t,r=10){return le(this,null,function*(){const s=`${zt.ENDPOINTS.SEARCH_ASSETS}?search_term=${encodeURIComponent(t)}&limit=${r}`;return rt.apiCall(s)})}submitAsset(t){return le(this,null,function*(){return rt.apiCall(zt.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 fS,hS=(e,t)=>{const r=ne({},e||{});for(const[s,i]of Object.entries(t))if(!r[s])r[s]=i;else if(Array.isArray(i)&&i[0]==="in"){const d=i[1],c=r[s];if(typeof c=="string")d.includes(c)||(r[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const p=c[1].filter(g=>d.includes(g));r[s]=["in",p]}else r[s]=i}return r};function D_(e,t=20,r=0,s,i={}){const[d,c]=j.useState([]),[f,p]=j.useState(0),[g,x]=j.useState(!1),[y,v]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),A=j.useRef(!1),C=JSON.stringify(e),O=JSON.stringify(i);j.useEffect(()=>{if(A.current&&k)return;let B=!1;return A.current=!0,le(null,null,function*(){try{v(!0);const z=hS(e,i);console.log("[useAssets] User filters:",e),console.log("[useAssets] Permission filters:",i),console.log("[useAssets] Merged filters:",z);const U=yield hc.getAssets(z,void 0,t,r,s);B||(c(U.assets),p(U.total_count),x(U.has_more),T(null))}catch(z){if(!B){const U=z instanceof Error?z.message:"Failed to fetch assets";U.includes("417")||U.includes("Expectation Failed")||U.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(U),c([]),p(0),x(!1)}}finally{B||v(!1)}}),()=>{B=!0}},[C,O,t,r,s,N]);const P=j.useCallback(()=>{A.current=!1,S(B=>B+1)},[]);return{assets:d,totalCount:f,hasMore:g,loading:y,error:k,refetch:P}}function mS(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}try{i(!0),c(null);const g=yield hc.getAssetDetails(e);r(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch asset details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const p=j.useCallback(()=>{f()},[f]);return{asset:t,loading:s,error:d,refetch:p}}function P_(){const[e,t]=j.useState(!1),[r,s]=j.useState(null);return{createAsset:p=>le(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Creating asset with data:",p);const g=yield hc.createAsset(p);if(console.log("[useAssetMutations] Create asset response:",g),g.success)return g.asset;{const x=g.error||"Failed to create asset";throw new Error(x)}}catch(g){console.error("[useAssetMutations] Create asset error:",g);const x=g instanceof Error?g.message:"Failed to create asset";throw s(x),g}finally{t(!1)}}),updateAsset:(p,g)=>le(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Updating asset:",p,"with data:",g);const x=yield hc.updateAsset(p,g);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:p=>le(null,null,function*(){try{t(!0),s(null);const g=yield hc.deleteAsset(p);if(!g.success)throw new Error("Failed to delete asset");return g}catch(g){const x=g instanceof Error?g.message:"Failed to delete asset";throw s(x),g}finally{t(!1)}}),submitAsset:p=>le(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Submitting asset:",p);const g=yield hc.submitAsset(p);return console.log("[useAssetMutations] Submit asset response:",g),g}catch(g){console.error("[useAssetMutations] Submit asset error:",g);const x=g instanceof Error?g.message:"Failed to submit asset";throw s(x),g}finally{t(!1)}}),loading:e,error:r}}var R_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},F1=sa.createContext&&sa.createContext(R_),gS=["attr","size","title"];function pS(e,t){if(e==null)return{};var r=xS(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)&&(r[s]=e[s])}return r}function xS(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function wf(){return wf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},wf.apply(this,arguments)}function I1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function kf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I1(Object(r),!0).forEach(function(s){yS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I1(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function yS(e,t,r){return t=bS(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bS(e){var t=vS(e,"string");return typeof t=="symbol"?t:t+""}function vS(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.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 F_(e){return e&&e.map((t,r)=>sa.createElement(t.tag,kf({key:r},t.attr),F_(t.child)))}function Tt(e){return t=>sa.createElement(_S,wf({attr:kf({},e.attr)},t),F_(e.child))}function _S(e){var t=r=>{var{attr:s,size:i,title:d}=e,c=pS(e,gS),f=i||r.size||"1em",p;return r.className&&(p=r.className),e.className&&(p=(p?p+" ":"")+e.className),sa.createElement("svg",wf({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,s,c,{className:p,style:kf(kf({color:e.color||r.color},r.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),d&&sa.createElement("title",null,d),e.children)};return F1!==void 0?sa.createElement(F1.Consumer,null,r=>t(r)):t(R_)}function wS(e){return Tt({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 Ns(e){return Tt({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 kS(e){return Tt({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 z1(e){return Tt({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 NS(e){return Tt({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 jS(e){return Tt({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 xp(e){return Tt({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 yi(e){return Tt({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 I_(e){return Tt({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 hf(e){return Tt({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 SS(e){return Tt({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 Ha(e){return Tt({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 In(e){return Tt({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 z_(e){return Tt({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 Tt({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 Zf(e){return Tt({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 qf(e){return Tt({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 Tt({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 Xu(e){return Tt({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 B1(e){return Tt({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 ol(e){return Tt({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 TS(e){return Tt({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 Tt({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 wi(e){return Tt({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 Tt({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 Tt({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 B_(e){return Tt({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 ES(e){return Tt({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 Xa(e){return Tt({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 wg(e){return Tt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"},child:[]}]})(e)}function vs(e){return Tt({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 CS(e){return Tt({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 Tt({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 Tt({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 en(e){return Tt({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 Tt({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 U1(e){return Tt({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 Zg(e){return Tt({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 AS(e){return Tt({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M336 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM144 32h96c8.8 0 16 7.2 16 16s-7.2 16-16 16h-96c-8.8 0-16-7.2-16-16s7.2-16 16-16zm48 128c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H102.4C90 416 80 407.4 80 396.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z"},child:[]}]})(e)}function Hd(e){return Tt({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 kg(e){return Tt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M512 176.001C512 273.203 433.202 352 336 352c-11.22 0-22.19-1.062-32.827-3.069l-24.012 27.014A23.999 23.999 0 0 1 261.223 384H224v40c0 13.255-10.745 24-24 24h-40v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24v-78.059c0-6.365 2.529-12.47 7.029-16.971l161.802-161.802C163.108 213.814 160 195.271 160 176 160 78.798 238.797.001 335.999 0 433.488-.001 512 78.511 512 176.001zM336 128c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z"},child:[]}]})(e)}function Ng(e){return Tt({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 OS(e){return Tt({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 MS(e){return Tt({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 Tt({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 Tt({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 Ju(e){return Tt({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 gr(e){return Tt({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 Ws(e){return Tt({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 LS(e){return Tt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M466.5 83.7l-192-80a48.15 48.15 0 0 0-36.9 0l-192 80C27.7 91.1 16 108.6 16 128c0 198.5 114.5 335.7 221.5 380.3 11.8 4.9 25.1 4.9 36.9 0C360.1 472.6 496 349.3 496 128c0-19.4-11.7-36.9-29.5-44.3zM256.1 446.3l-.1-381 175.9 73.3c-3.3 151.4-82.1 261.1-175.8 307.7z"},child:[]}]})(e)}function DS(e){return Tt({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 $r(e){return Tt({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 Nr(e){return Tt({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 Tt({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 yp(e){return Tt({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 PS(e){return Tt({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 Ku(e){return Tt({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 vr(e){return Tt({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 xt(e){return Tt({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 qg(e){return Tt({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 RS(e){return Tt({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 ma(e){return Tt({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 FS(e){return Tt({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 IS(e){return Tt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M630.6 364.9l-90.3-90.2c-12-12-28.3-18.7-45.3-18.7h-79.3c-17.7 0-32 14.3-32 32v79.2c0 17 6.7 33.2 18.7 45.2l90.3 90.2c12.5 12.5 32.8 12.5 45.3 0l92.5-92.5c12.6-12.5 12.6-32.7.1-45.2zm-182.8-21c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24c0 13.2-10.7 24-24 24zm-223.8-88c70.7 0 128-57.3 128-128C352 57.3 294.7 0 224 0S96 57.3 96 128c0 70.6 57.3 127.9 128 127.9zm127.8 111.2V294c-12.2-3.6-24.9-6.2-38.2-6.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 287.9 0 348.1 0 422.3v41.6c0 26.5 21.5 48 48 48h352c15.5 0 29.1-7.5 37.9-18.9l-58-58c-18.1-18.1-28.1-42.2-28.1-67.9z"},child:[]}]})(e)}function zS(e){return Tt({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 Nf(e){return Tt({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 Tt({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 H1(e){return Tt({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 BS=()=>{var ye,ie,he,ve;const{t:e}=Va(),{data:t,loading:r}=pp(),{workOrders:s}=O_({},1e3,0),{logs:i}=Gf({},1e3,0),{assets:d}=D_({},1e3,0),[c,f]=j.useState(null),[p,g]=j.useState(null),[x,y]=j.useState(null),[v,k]=j.useState(null),[T,N]=j.useState(null),[S,A]=j.useState(null),[C,O]=j.useState({open:0,inProgress:0,completed:0,total:0}),[P,B]=j.useState({assetUptime:0,avgResponseTime:0,maintenanceEfficiency:0,overdueTasks:0,plannedMaintenance:0}),{data:V}=Yl("Up & Down Time Chart"),{data:z}=Yl("Work Order Status Chart"),{data:U}=Yl("Maintenance - Asset wise Count"),{data:J}=Yl("Asset Maintenance Assignees Status Count"),{data:de}=Yl("Asset Maintenance Frequency Chart");return j.useEffect(()=>{if(d&&d.length>0){let me=0,ee=0;d.forEach(fe=>{const ae=fe.custom_up_time||0,F=fe.custom_down_time||0;me+=typeof ae=="number"?ae:0,ee+=typeof F=="number"?F:0});const q=[],Q=[];if(me>0&&(q.push(e("dashboard.upTime")),Q.push(me)),ee>0&&(q.push(e("dashboard.downTime")),Q.push(ee)),q.length>0&&Q.length>0){const fe=[];me>0&&fe.push("#6366F1"),ee>0&&fe.push("#8B5CF6"),k({labels:q,datasets:[{name:"Time",values:Q,colors:fe}],type:"Pie"})}else k(null)}else k(null)},[d]),j.useEffect(()=>{if(s&&s.length>0){const me={};let ee=0,q=0,Q=0;s.forEach(Fe=>{const tt=Fe.repair_status||"Unknown";me[tt]=(me[tt]||0)+1,tt.toLowerCase()==="open"&&ee++,tt.toLowerCase()==="in progress"&&q++,tt.toLowerCase()==="completed"&&Q++});const fe=Object.keys(me),ae=Object.values(me),F={Open:"#F59E0B","In Progress":"#3B82F6",Pending:"#8B5CF6",Completed:"#10B981",Cancelled:"#EC4899",Unknown:"#6B7280"},D=fe.map(Fe=>F[Fe]||"#6366F1");f({labels:fe,datasets:[{name:"Work Orders",values:ae,colors:D}],type:"bar"}),O({open:ee,inProgress:q,completed:Q,total:s.length});const H={},Z=new Set,K=Fe=>{const tt=Fe.toLowerCase().trim();return tt.includes("open")?"Open":tt.includes("work in progress")||tt.includes("in progress")||tt.includes("wip")?"Work In Progress":tt.includes("pending review")||tt.includes("pending")?"Pending Review":tt.includes("completed")||tt.includes("complete")?"Completed":tt.includes("closed")?"Closed":Fe};s.forEach(Fe=>{const tt=Fe.work_order_type||"null",ft=K(Fe.repair_status||"Unknown");Z.add(ft),H[tt]||(H[tt]={}),H[tt][ft]||(H[tt][ft]=0),H[tt][ft]++});const ue=Object.keys(H),Le=["Open","Work In Progress","Pending Review","Completed","Closed"],We=Array.from(Z).sort((Fe,tt)=>{const ft=Le.indexOf(Fe),Dt=Le.indexOf(tt);return ft!==-1&&Dt!==-1?ft-Dt:ft!==-1?-1:Dt!==-1?1:Fe.localeCompare(tt)}).map(Fe=>{const tt=ue.map(ft=>H[ft][Fe]||0);return{name:Fe,values:tt}});g({labels:ue,datasets:We,type:"Bar"})}else g(null)},[s]),j.useEffect(()=>{if(i&&i.length>0){const me={};let ee=0,q=0,Q=0;const fe=new Date;i.forEach(He=>{var we,Ie;const oe=He.asset_name||"Unknown";me[oe]=(me[oe]||0)+1,((we=He.maintenance_status)==null?void 0:we.toLowerCase())==="completed"&&ee++,((Ie=He.maintenance_status)==null?void 0:Ie.toLowerCase())==="planned"&&q++,He.due_date&&new Date(He.due_date)<fe&&He.maintenance_status!=="Completed"&&Q++});const ae=Object.entries(me).sort(([,He],[,oe])=>oe-He).slice(0,10),F=ae.map(([He])=>He),D=ae.map(([,He])=>He),H=jf(F.length);y({labels:F,datasets:[{name:"Maintenance Count",values:D,colors:H}],type:"bar"});const Z=i.length>0?ee/i.length*100:0;B(He=>Se(ne({},He),{maintenanceEfficiency:Z,overdueTasks:Q,plannedMaintenance:q}));const K={},ue=new Set,Le=(He,oe)=>{const we=He.toLowerCase().trim(),Ie=new Date,ot=oe.due_date?new Date(oe.due_date):null;return ot&&ot<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":He};i.forEach(He=>{const oe=He.assign_to_name||"null",we=He.maintenance_status||"Unknown",Ie=Le(we,He);ue.add(Ie),K[oe]||(K[oe]={}),K[oe][Ie]||(K[oe][Ie]=0),K[oe][Ie]++});const Ne=Object.keys(K),We=["Completed On Time","Completed Within SLA","Delay In Completion","Pending","Overdue","Cancelled"],tt=Array.from(ue).sort((He,oe)=>{const we=We.indexOf(He),Ie=We.indexOf(oe);return we!==-1&&Ie!==-1?we-Ie:we!==-1?-1:Ie!==-1?1:He.localeCompare(oe)}).map(He=>{const oe=Ne.map(we=>K[we][He]||0);return{name:He,values:oe}});N({labels:Ne,datasets:tt,type:"Bar"});const ft={};i.forEach(He=>{const oe=He.periodicity||He.maintenance_type||"Other";ft[oe]=(ft[oe]||0)+1});const Dt=Object.entries(ft).sort(([,He],[,oe])=>oe-He),Ve=Dt.map(([He])=>He),At=Dt.map(([,He])=>He),jt=jf(Ve.length);A({labels:Ve,datasets:[{name:"Frequency",values:At,colors:jt}],type:"bar"})}else N(null),A(null)},[i]),j.useEffect(()=>{if(s&&s.length>0){let me=0,ee=0;s.forEach(ae=>{if(ae.creation&&ae.first_responded_on){const F=new Date(ae.creation),H=(new Date(ae.first_responded_on).getTime()-F.getTime())/(1e3*60*60);H>=0&&(me+=H,ee++)}});const q=ee>0?me/ee:0,Q=s.filter(ae=>{var F;return((F=ae.repair_status)==null?void 0:F.toLowerCase())==="completed"}).length,fe=s.length>0?Q/s.length*100:0;B(ae=>Se(ne({},ae),{assetUptime:fe,avgResponseTime:q}))}},[s]),r?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto mb-4"}),a.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:e("dashboard.loading")})]})}):a.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:a.jsxs("div",{className:"max-w-[1600px] mx-auto",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-3 mb-6",children:[a.jsxs("div",{className:"lg:col-span-7 space-y-2",children:[a.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:a.jsxs("div",{className:"grid grid-cols-12 gap-0 w-full",children:[a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(jS,{className:"text-indigo-600"}),value:(ye=t==null?void 0:t.total_assets)!=null?ye:0,label:e("dashboard.totalAssets"),bgColor:"bg-indigo-50 dark:bg-indigo-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(DS,{className:"text-purple-600"}),value:C.open||((ie=t==null?void 0:t.work_orders_open)!=null?ie:0),label:e("dashboard.openWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(ol,{className:"text-blue-600"}),value:C.inProgress||((he=t==null?void 0:t.work_orders_in_progress)!=null?he:0),label:e("dashboard.workOrdersInProgress"),bgColor:"bg-blue-50 dark:bg-blue-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(Ha,{className:"text-pink-600"}),value:C.completed||((ve=t==null?void 0:t.work_orders_completed)!=null?ve:0),label:e("dashboard.completedWorkOrders"),bgColor:"bg-pink-50 dark:bg-pink-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(qg,{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"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(lc,{icon:a.jsx(SS,{className:"text-purple-600"}),value:C.total,label:e("dashboard.totalWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})})]})}),a.jsx(US,{totalWorkOrders:C.total,completedWorkOrders:C.completed,inProgressWorkOrders:C.inProgress})]}),a.jsx("div",{className:"lg:col-span-5",children:a.jsx($1,{title:e("dashboard.assigneesStatus"),data:T||J})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[a.jsx(Qu,{icon:a.jsx(Ha,{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"}),a.jsx(Qu,{icon:a.jsx(ol,{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"}),a.jsx(Qu,{icon:a.jsx(qg,{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"}),a.jsx(Qu,{icon:a.jsx(Xa,{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"})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 mb-6",children:[a.jsx("div",{className:"w-full",children:a.jsx($S,{data:v||V,title:e("dashboard.upDownTimeChart"),description:"Asset uptime and downtime distribution for tracking availability."})}),a.jsx("div",{className:"md:col-span-2"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 ",children:[a.jsx(W1,{title:e("dashboard.maintenanceByAsset"),data:x||U,type:"bar"}),a.jsx(W1,{title:e("dashboard.maintenanceFrequency"),data:S||de,type:"bar"}),a.jsx(HS,{data:c||z,totalWorkOrders:C.total,completedWorkOrders:C.completed}),a.jsx($1,{title:e("dashboard.workOrderStatus"),data:p||z})]})]})})},lc=({icon:e,value:t,label:r,bgColor:s})=>a.jsxs("div",{className:"text-center py-2 px-1 border-r border-gray-200 dark:border-gray-700 last:border-r-0",children:[a.jsx("div",{className:`w-10 h-10 ${s} rounded-lg flex items-center justify-center text-base mx-auto mb-1.5`,children:e}),a.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-white leading-none mb-1",children:t}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide leading-tight px-1",children:r})]}),Qu=({icon:e,title:t,value:r,trend:s,trendUp:i,bgColor:d})=>a.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:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsx("div",{className:`w-10 h-10 ${d} rounded-lg flex items-center justify-center text-lg`,children:e}),a.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?a.jsx(kS,{className:"text-[10px]"}):a.jsx(wS,{className:"text-[10px]"}),s]})]}),a.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-1",children:r}),a.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:t})]}),US=({totalWorkOrders:e,completedWorkOrders:t,inProgressWorkOrders:r})=>{const s=e>0?(t/e*100).toFixed(2):"0.00";return a.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:[a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-2",children:[s,"%"]}),a.jsx("div",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-400 mb-1",children:"Completion Rate"})]}),a.jsx("div",{className:"mt-1",children:a.jsx(WS,{})}),a.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:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-indigo-600 dark:text-indigo-400",children:e}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Total"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600 dark:text-blue-400",children:r}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"In Progress"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600 dark:text-green-400",children:t}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Completed"})]})]})]})},HS=({data:e,totalWorkOrders:t,completedWorkOrders:r})=>a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Work Order Status Distribution"}),a.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[a.jsxs("div",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:[t," Total"]}),a.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:[a.jsxs("span",{className:"font-medium",children:[r," Completed"]}),a.jsxs("span",{className:"ml-1",children:["(",t>0?(r/t*100).toFixed(1):0,"%)"]})]})]})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:a.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})})})]}),a.jsx("div",{className:"flex-1",children:a.jsx(U_,{data:e})})]}),$S=({data:e,title:t,description:r})=>a.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:[a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white mb-1",children:t}),a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-4",children:r}),e?a.jsx(H_,{data:e}):a.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:"No data available"})]}),WS=()=>{const e=[10,15,13,17,14,18,16],t=Math.max(...e),r=400,s=80,i=e.map((c,f)=>{const p=f/(e.length-1)*r,g=s-c/t*s;return`${p},${g}`}).join(" "),d=`0,${s} ${i} ${r},${s}`;return a.jsxs("svg",{width:"100%",height:s,viewBox:`0 0 ${r} ${s}`,className:"w-full",children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"areaGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.3}}),a.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.05}})]})}),a.jsx("polygon",{points:d,fill:"url(#areaGradient)"}),a.jsx("polyline",{points:i,fill:"none",stroke:"#8B5CF6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},VS=({data:e})=>{const t=(e==null?void 0:e.labels)||[],r=(e==null?void 0:e.datasets)||[];if(!r.length)return a.jsx("div",{className:"text-center text-gray-400 py-4 text-sm",children:"No data available"});const s=r.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),p=4,g=r.length,x=Math.max(12,(f-p*(g+1))/g),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"},v=(k,T)=>{for(const[N,S]of Object.entries(y))if(k.toLowerCase().includes(N.toLowerCase()))return S;return jf(g)[T]};return a.jsxs("div",{className:"relative w-full overflow-x-auto",children:[a.jsxs("svg",{width:"100%",height:d+40,viewBox:`0 0 ${c} ${d+40}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[a.jsx("defs",{children:r.map((k,T)=>{const N=v(k.name||"",T);return a.jsxs("linearGradient",{id:`groupedBarGradient${T}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:N,stopOpacity:.9}}),a.jsx("stop",{offset:"100%",style:{stopColor:N,stopOpacity:.7}})]},T)})}),[0,.25,.5,.75,1].map((k,T)=>a.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)=>a.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)),a.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 a.jsxs("g",{children:[r.map((S,A)=>{var z;const O=(((z=S.values)==null?void 0:z[T])||0)/i*d,P=N+p+A*(x+p),B=d-O,V=v(S.name||"",A);return a.jsx("g",{children:a.jsx("rect",{x:P,y:B,width:x,height:O,fill:V,rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity"})},A)}),a.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)})]}),a.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:r.map((k,T)=>{const N=v(k.name||"",T);return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded",style:{backgroundColor:N}}),a.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)})})]})},U_=({data:e})=>{var x;const t=(e==null?void 0:e.labels)||[],r=(e==null?void 0:e.datasets)||[];if(!r.length)return a.jsx("div",{className:"text-center text-gray-400 py-8",children:"No data available"});const s=r.flatMap(y=>y.values||[]),i=Math.max(...s,1),d=250,p=Math.max(800,t.length*60+100),g=((x=r[0])==null?void 0:x.values)||[];return a.jsxs("div",{className:"relative w-full overflow-x-auto",children:[a.jsxs("svg",{width:"100%",height:"320",viewBox:`0 0 ${p} ${d+70}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"barGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.8}}),a.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.6}})]})}),[0,.25,.5,.75,1].map((y,v)=>a.jsx("line",{x1:"60",y1:d-y*d,x2:p-20,y2:d-y*d,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},v)),[0,.25,.5,.75,1].map((y,v)=>a.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)},v)),t.map((y,v)=>{var A,C;const T=(((C=(A=r[0])==null?void 0:A.values)==null?void 0:C[v])||0)/i*d,N=Math.min(40,(p-100)/t.length-10),S=80+v*((p-100)/t.length);return a.jsx("g",{children:a.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"})},v)}),g.length>0&&a.jsx("polyline",{points:g.map((y,v)=>{const k=80+v*((p-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"}),g.map((y,v)=>{const k=80+v*((p-100)/t.length)+20,T=d-y/i*d;return a.jsx("circle",{cx:k,cy:T,r:"4",fill:"#3B82F6",className:"hover:r-6 cursor-pointer transition-all"},v)}),t.map((y,v)=>{const k=(p-100)/t.length,T=80+v*k+k/2,N=y&&y.length>15?y.substring(0,13)+"...":y||"null";return a.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},v)})]}),a.jsxs("div",{className:"flex items-center justify-center gap-3 mt-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-3 h-3 rounded",style:{background:"#8B5CF6"}}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Total Sales"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Average"})]})]})]})},H_=({data:e})=>{var y,v,k,T;const t=(e==null?void 0:e.labels)||[],r=((v=(y=e==null?void 0:e.datasets)==null?void 0:y[0])==null?void 0:v.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===r.length?N:jf(r.length)}const d=r.reduce((N,S)=>N+S,0),c=100,f=c+10,p=c+10;let g=0;const x=r.map((N,S)=>{const A=g/d*2*Math.PI-Math.PI/2;g+=N;const C=g/d*2*Math.PI-Math.PI/2,O=C-A>Math.PI?1:0,P=f+c*Math.cos(A),B=p+c*Math.sin(A),V=f+c*Math.cos(C),z=p+c*Math.sin(C);return{path:`M ${f} ${p} L ${P} ${B} A ${c} ${c} 0 ${O} 1 ${V} ${z} Z`,color:i[S],label:t[S],value:N,percentage:(N/d*100).toFixed(1)}});return a.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-around",children:[a.jsx("svg",{width:f*2,height:p*2,viewBox:`0 0 ${f*2} ${p*2}`,className:"max-w-xs",children:x.map((N,S)=>a.jsx("path",{d:N.path,fill:N.color,className:"hover:opacity-80 transition-opacity cursor-pointer drop-shadow-lg"},S))}),a.jsx("div",{className:"flex flex-col gap-3 mt-4 md:mt-0",children:x.map((N,S)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:N.label}),a.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-white",children:N.value})]},S))})]})},$1=({title:e,data:t})=>a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-white",children:e}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:a.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})}),a.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:a.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:a.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?a.jsx("div",{className:"h-48 flex items-center justify-center text-gray-400",children:a.jsx("div",{className:"text-center",children:a.jsx("div",{className:"text-xs",children:"No chart data available"})})}):a.jsx(VS,{data:t})]}),W1=({title:e,data:t,type:r})=>a.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:[a.jsx("h3",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4",children:e}),!t||!t.datasets||!t.datasets.length?a.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:a.jsx("div",{className:"text-center",children:a.jsx("div",{className:"text-sm",children:"No chart data available"})})}):r==="pie"?a.jsx(H_,{data:t}):a.jsx(U_,{data:t})]});function jf(e){const t=["#8B5CF6","#6366F1","#3B82F6","#06B6D4","#14B8A6","#EC4899","#A855F7","#0EA5E9","#10B981","#F472B6","#7C3AED","#2DD4BF"];return Array.from({length:e},(r,s)=>t[s%t.length])}function $_(e,t){return function(){return e.apply(t,arguments)}}const{toString:GS}=Object.prototype,{getPrototypeOf:bp}=Object,{iterator:Yf,toStringTag:W_}=Symbol,Xf=(e=>t=>{const r=GS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),js=e=>(e=e.toLowerCase(),t=>Xf(t)===e),Jf=e=>t=>typeof t===e,{isArray:Mc}=Array,kc=Jf("undefined");function x0(e){return e!==null&&!kc(e)&&e.constructor!==null&&!kc(e.constructor)&&pn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const V_=js("ArrayBuffer");function ZS(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&V_(e.buffer),t}const qS=Jf("string"),pn=Jf("function"),G_=Jf("number"),y0=e=>e!==null&&typeof e=="object",YS=e=>e===!0||e===!1,mf=e=>{if(Xf(e)!=="object")return!1;const t=bp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(W_ in e)&&!(Yf in e)},XS=e=>{if(!y0(e)||x0(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},JS=js("Date"),KS=js("File"),QS=js("Blob"),e6=js("FileList"),t6=e=>y0(e)&&pn(e.pipe),a6=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||pn(e.append)&&((t=Xf(e))==="formdata"||t==="object"&&pn(e.toString)&&e.toString()==="[object FormData]"))},r6=js("URLSearchParams"),[n6,s6,i6,l6]=["ReadableStream","Request","Response","Headers"].map(js),o6=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function b0(e,t,{allOwnKeys:r=!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=r?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 Z_(e,t){if(x0(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,i;for(;s-- >0;)if(i=r[s],t===i.toLowerCase())return i;return null}const Ql=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,q_=e=>!kc(e)&&e!==Ql;function Yg(){const{caseless:e,skipUndefined:t}=q_(this)&&this||{},r={},s=(i,d)=>{const c=e&&Z_(r,d)||d;mf(r[c])&&mf(i)?r[c]=Yg(r[c],i):mf(i)?r[c]=Yg({},i):Mc(i)?r[c]=i.slice():(!t||!kc(i))&&(r[c]=i)};for(let i=0,d=arguments.length;i<d;i++)arguments[i]&&b0(arguments[i],s);return r}const c6=(e,t,r,{allOwnKeys:s}={})=>(b0(t,(i,d)=>{r&&pn(i)?e[d]=$_(i,r):e[d]=i},{allOwnKeys:s}),e),d6=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),u6=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},f6=(e,t,r,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=r!==!1&&bp(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},h6=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},m6=e=>{if(!e)return null;if(Mc(e))return e;let t=e.length;if(!G_(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},g6=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&bp(Uint8Array)),p6=(e,t)=>{const s=(e&&e[Yf]).call(e);let i;for(;(i=s.next())&&!i.done;){const d=i.value;t.call(e,d[0],d[1])}},x6=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},y6=js("HTMLFormElement"),b6=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,i){return s.toUpperCase()+i}),V1=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),v6=js("RegExp"),Y_=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};b0(r,(i,d)=>{let c;(c=t(i,d,e))!==!1&&(s[d]=c||i)}),Object.defineProperties(e,s)},_6=e=>{Y_(e,(t,r)=>{if(pn(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(pn(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},w6=(e,t)=>{const r={},s=i=>{i.forEach(d=>{r[d]=!0})};return Mc(e)?s(e):s(String(e).split(t)),r},k6=()=>{},N6=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function j6(e){return!!(e&&pn(e.append)&&e[W_]==="FormData"&&e[Yf])}const S6=e=>{const t=new Array(10),r=(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 p=r(c,i+1);!kc(p)&&(d[f]=p)}),t[i]=void 0,d}}return s};return r(e,0)},T6=js("AsyncFunction"),E6=e=>e&&(y0(e)||pn(e))&&pn(e.then)&&pn(e.catch),X_=((e,t)=>e?setImmediate:t?((r,s)=>(Ql.addEventListener("message",({source:i,data:d})=>{i===Ql&&d===r&&s.length&&s.shift()()},!1),i=>{s.push(i),Ql.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",pn(Ql.postMessage)),C6=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Ql):typeof process!="undefined"&&process.nextTick||X_,A6=e=>e!=null&&pn(e[Yf]),Be={isArray:Mc,isArrayBuffer:V_,isBuffer:x0,isFormData:a6,isArrayBufferView:ZS,isString:qS,isNumber:G_,isBoolean:YS,isObject:y0,isPlainObject:mf,isEmptyObject:XS,isReadableStream:n6,isRequest:s6,isResponse:i6,isHeaders:l6,isUndefined:kc,isDate:JS,isFile:KS,isBlob:QS,isRegExp:v6,isFunction:pn,isStream:t6,isURLSearchParams:r6,isTypedArray:g6,isFileList:e6,forEach:b0,merge:Yg,extend:c6,trim:o6,stripBOM:d6,inherits:u6,toFlatObject:f6,kindOf:Xf,kindOfTest:js,endsWith:h6,toArray:m6,forEachEntry:p6,matchAll:x6,isHTMLForm:y6,hasOwnProperty:V1,hasOwnProp:V1,reduceDescriptors:Y_,freezeMethods:_6,toObjectSet:w6,toCamelCase:b6,noop:k6,toFiniteNumber:N6,findKey:Z_,global:Ql,isContextDefined:q_,isSpecCompliantForm:j6,toJSONObject:S6,isAsyncFn:T6,isThenable:E6,setImmediate:X_,asap:C6,isIterable:A6};function qt(e,t,r,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),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}Be.inherits(qt,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 J_=qt.prototype,K_={};["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=>{K_[e]={value:e}});Object.defineProperties(qt,K_);Object.defineProperty(J_,"isAxiosError",{value:!0});qt.from=(e,t,r,s,i,d)=>{const c=Object.create(J_);Be.toFlatObject(e,c,function(x){return x!==Error.prototype},g=>g!=="isAxiosError");const f=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return qt.call(c,f,p,r,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 O6=null;function Xg(e){return Be.isPlainObject(e)||Be.isArray(e)}function Q_(e){return Be.endsWith(e,"[]")?e.slice(0,-2):e}function G1(e,t,r){return e?e.concat(t).map(function(i,d){return i=Q_(i),!r&&d?"["+i+"]":i}).join(r?".":""):t}function M6(e){return Be.isArray(e)&&!e.some(Xg)}const L6=Be.toFlatObject(Be,{},null,function(t){return/^is[A-Z]/.test(t)});function Kf(e,t,r){if(!Be.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=Be.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,S){return!Be.isUndefined(S[N])});const s=r.metaTokens,i=r.visitor||x,d=r.dots,c=r.indexes,p=(r.Blob||typeof Blob!="undefined"&&Blob)&&Be.isSpecCompliantForm(t);if(!Be.isFunction(i))throw new TypeError("visitor must be a function");function g(T){if(T===null)return"";if(Be.isDate(T))return T.toISOString();if(Be.isBoolean(T))return T.toString();if(!p&&Be.isBlob(T))throw new qt("Blob is not supported. Use a Buffer instead.");return Be.isArrayBuffer(T)||Be.isTypedArray(T)?p&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function x(T,N,S){let A=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)&&M6(T)||(Be.isFileList(T)||Be.endsWith(N,"[]"))&&(A=Be.toArray(T)))return N=Q_(N),A.forEach(function(O,P){!(Be.isUndefined(O)||O===null)&&t.append(c===!0?G1([N],P,d):c===null?N:N+"[]",g(O))}),!1}return Xg(T)?!0:(t.append(G1(S,N,d),g(T)),!1)}const y=[],v=Object.assign(L6,{defaultVisitor:x,convertValue:g,isVisitable:Xg});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(A,C){(!(Be.isUndefined(A)||A===null)&&i.call(t,A,Be.isString(C)?C.trim():C,N,v))===!0&&k(A,N?N.concat(C):[C])}),y.pop()}}if(!Be.isObject(e))throw new TypeError("data must be an object");return k(e),t}function Z1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function vp(e,t){this._pairs=[],e&&Kf(e,this,t)}const e2=vp.prototype;e2.append=function(t,r){this._pairs.push([t,r])};e2.toString=function(t){const r=t?function(s){return t.call(this,s,Z1)}:Z1;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function D6(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t2(e,t,r){if(!t)return e;const s=r&&r.encode||D6;Be.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let d;if(i?d=i(t,r):d=Be.isURLSearchParams(t)?t.toString():new vp(t,r).toString(s),d){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+d}return e}class q1{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,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 a2={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},P6=typeof URLSearchParams!="undefined"?URLSearchParams:vp,R6=typeof FormData!="undefined"?FormData:null,F6=typeof Blob!="undefined"?Blob:null,I6={isBrowser:!0,classes:{URLSearchParams:P6,FormData:R6,Blob:F6},protocols:["http","https","file","blob","url","data"]},_p=typeof window!="undefined"&&typeof document!="undefined",Jg=typeof navigator=="object"&&navigator||void 0,z6=_p&&(!Jg||["ReactNative","NativeScript","NS"].indexOf(Jg.product)<0),B6=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",U6=_p&&window.location.href||"http://localhost",H6=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_p,hasStandardBrowserEnv:z6,hasStandardBrowserWebWorkerEnv:B6,navigator:Jg,origin:U6},Symbol.toStringTag,{value:"Module"})),Hr=ne(ne({},H6),I6);function $6(e,t){return Kf(e,new Hr.classes.URLSearchParams,ne({visitor:function(r,s,i,d){return Hr.isNode&&Be.isBuffer(r)?(this.append(s,r.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},t))}function W6(e){return Be.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function V6(e){const t={},r=Object.keys(e);let s;const i=r.length;let d;for(s=0;s<i;s++)d=r[s],t[d]=e[d];return t}function r2(e){function t(r,s,i,d){let c=r[d++];if(c==="__proto__")return!0;const f=Number.isFinite(+c),p=d>=r.length;return c=!c&&Be.isArray(i)?i.length:c,p?(Be.hasOwnProp(i,c)?i[c]=[i[c],s]:i[c]=s,!f):((!i[c]||!Be.isObject(i[c]))&&(i[c]=[]),t(r,s,i[c],d)&&Be.isArray(i[c])&&(i[c]=V6(i[c])),!f)}if(Be.isFormData(e)&&Be.isFunction(e.entries)){const r={};return Be.forEachEntry(e,(s,i)=>{t(W6(s),i,r,0)}),r}return null}function G6(e,t,r){if(Be.isString(e))try{return(t||JSON.parse)(e),Be.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const v0={transitional:a2,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.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(r2(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 r.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 $6(t,this.formSerializer).toString();if((f=Be.isFileList(t))||s.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return Kf(f?{"files[]":t}:t,p&&new p,this.formSerializer)}}return d||i?(r.setContentType("application/json",!1),G6(t)):t}],transformResponse:[function(t){const r=this.transitional||v0.transitional,s=r&&r.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=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(f){if(c)throw f.name==="SyntaxError"?qt.from(f,qt.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 Z6=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"]),q6=e=>{const t={};let r,s,i;return e&&e.split(`
`).forEach(function(c){i=c.indexOf(":"),r=c.substring(0,i).trim().toLowerCase(),s=c.substring(i+1).trim(),!(!r||t[r]&&Z6[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},Y1=Symbol("internals");function Bd(e){return e&&String(e).trim().toLowerCase()}function gf(e){return e===!1||e==null?e:Be.isArray(e)?e.map(gf):String(e)}function Y6(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}const X6=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function jg(e,t,r,s,i){if(Be.isFunction(s))return s.call(this,t,r);if(i&&(t=r),!!Be.isString(t)){if(Be.isString(s))return t.indexOf(s)!==-1;if(Be.isRegExp(s))return s.test(t)}}function J6(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function K6(e,t){const r=Be.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(i,d,c){return this[s].call(this,t,i,d,c)},configurable:!0})})}let xn=class{constructor(t){t&&this.set(t)}set(t,r,s){const i=this;function d(f,p,g){const x=Bd(p);if(!x)throw new Error("header name must be a non-empty string");const y=Be.findKey(i,x);(!y||i[y]===void 0||g===!0||g===void 0&&i[y]!==!1)&&(i[y||p]=gf(f))}const c=(f,p)=>Be.forEach(f,(g,x)=>d(g,x,p));if(Be.isPlainObject(t)||t instanceof this.constructor)c(t,r);else if(Be.isString(t)&&(t=t.trim())&&!X6(t))c(q6(t),r);else if(Be.isObject(t)&&Be.isIterable(t)){let f={},p,g;for(const x of t){if(!Be.isArray(x))throw TypeError("Object iterator must return a key-value pair");f[g=x[0]]=(p=f[g])?Be.isArray(p)?[...p,x[1]]:[p,x[1]]:x[1]}c(f,r)}else t!=null&&d(r,t,s);return this}get(t,r){if(t=Bd(t),t){const s=Be.findKey(this,t);if(s){const i=this[s];if(!r)return i;if(r===!0)return Y6(i);if(Be.isFunction(r))return r.call(this,i,s);if(Be.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Bd(t),t){const s=Be.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||jg(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let i=!1;function d(c){if(c=Bd(c),c){const f=Be.findKey(s,c);f&&(!r||jg(s,s[f],f,r))&&(delete s[f],i=!0)}}return Be.isArray(t)?t.forEach(d):d(t),i}clear(t){const r=Object.keys(this);let s=r.length,i=!1;for(;s--;){const d=r[s];(!t||jg(this,this[d],d,t,!0))&&(delete this[d],i=!0)}return i}normalize(t){const r=this,s={};return Be.forEach(this,(i,d)=>{const c=Be.findKey(s,d);if(c){r[c]=gf(i),delete r[d];return}const f=t?J6(d):String(d).trim();f!==d&&delete r[d],r[f]=gf(i),s[f]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return Be.forEach(this,(s,i)=>{s!=null&&s!==!1&&(r[i]=t&&Be.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).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,...r){const s=new this(t);return r.forEach(i=>s.set(i)),s}static accessor(t){const s=(this[Y1]=this[Y1]={accessors:{}}).accessors,i=this.prototype;function d(c){const f=Bd(c);s[f]||(K6(i,c),s[f]=!0)}return Be.isArray(t)?t.forEach(d):d(t),this}};xn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Be.reduceDescriptors(xn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}});Be.freezeMethods(xn);function Sg(e,t){const r=this||v0,s=t||r,i=xn.from(s.headers);let d=s.data;return Be.forEach(e,function(f){d=f.call(r,d,i.normalize(),t?t.status:void 0)}),i.normalize(),d}function n2(e){return!!(e&&e.__CANCEL__)}function Lc(e,t,r){qt.call(this,e==null?"canceled":e,qt.ERR_CANCELED,t,r),this.name="CanceledError"}Be.inherits(Lc,qt,{__CANCEL__:!0});function s2(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new qt("Request failed with status code "+r.status,[qt.ERR_BAD_REQUEST,qt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Q6(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function e5(e,t){e=e||10;const r=new Array(e),s=new Array(e);let i=0,d=0,c;return t=t!==void 0?t:1e3,function(p){const g=Date.now(),x=s[d];c||(c=g),r[i]=p,s[i]=g;let y=d,v=0;for(;y!==i;)v+=r[y++],y=y%e;if(i=(i+1)%e,i===d&&(d=(d+1)%e),g-c<t)return;const k=x&&g-x;return k?Math.round(v*1e3/k):void 0}}function t5(e,t){let r=0,s=1e3/t,i,d;const c=(g,x=Date.now())=>{r=x,i=null,d&&(clearTimeout(d),d=null),e(...g)};return[(...g)=>{const x=Date.now(),y=x-r;y>=s?c(g,x):(i=g,d||(d=setTimeout(()=>{d=null,c(i)},s-y)))},()=>i&&c(i)]}const Sf=(e,t,r=3)=>{let s=0;const i=e5(50,250);return t5(d=>{const c=d.loaded,f=d.lengthComputable?d.total:void 0,p=c-s,g=i(p),x=c<=f;s=c;const y={loaded:c,total:f,progress:f?c/f:void 0,bytes:p,rate:g||void 0,estimated:g&&f&&x?(f-c)/g:void 0,event:d,lengthComputable:f!=null,[t?"download":"upload"]:!0};e(y)},r)},X1=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},J1=e=>(...t)=>Be.asap(()=>e(...t)),a5=Hr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Hr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Hr.origin),Hr.navigator&&/(msie|trident)/i.test(Hr.navigator.userAgent)):()=>!0,r5=Hr.hasStandardBrowserEnv?{write(e,t,r,s,i,d,c){if(typeof document=="undefined")return;const f=[`${e}=${encodeURIComponent(t)}`];Be.isNumber(r)&&f.push(`expires=${new Date(r).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 n5(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function s5(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function i2(e,t,r){let s=!n5(t);return e&&(s||r==!1)?s5(e,t):t}const K1=e=>e instanceof xn?ne({},e):e;function io(e,t){t=t||{};const r={};function s(g,x,y,v){return Be.isPlainObject(g)&&Be.isPlainObject(x)?Be.merge.call({caseless:v},g,x):Be.isPlainObject(x)?Be.merge({},x):Be.isArray(x)?x.slice():x}function i(g,x,y,v){if(Be.isUndefined(x)){if(!Be.isUndefined(g))return s(void 0,g,y,v)}else return s(g,x,y,v)}function d(g,x){if(!Be.isUndefined(x))return s(void 0,x)}function c(g,x){if(Be.isUndefined(x)){if(!Be.isUndefined(g))return s(void 0,g)}else return s(void 0,x)}function f(g,x,y){if(y in t)return s(g,x);if(y in e)return s(void 0,g)}const p={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:(g,x,y)=>i(K1(g),K1(x),y,!0)};return Be.forEach(Object.keys(ne(ne({},e),t)),function(x){const y=p[x]||i,v=y(e[x],t[x],x);Be.isUndefined(v)&&y!==f||(r[x]=v)}),r}const l2=e=>{const t=io({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:d,headers:c,auth:f}=t;if(t.headers=c=xn.from(c),t.url=t2(i2(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(r)){if(Hr.hasStandardBrowserEnv||Hr.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(Be.isFunction(r.getHeaders)){const p=r.getHeaders(),g=["content-type","content-length"];Object.entries(p).forEach(([x,y])=>{g.includes(x.toLowerCase())&&c.set(x,y)})}}if(Hr.hasStandardBrowserEnv&&(s&&Be.isFunction(s)&&(s=s(t)),s||s!==!1&&a5(t.url))){const p=i&&d&&r5.read(d);p&&c.set(i,p)}return t},i5=typeof XMLHttpRequest!="undefined",l5=i5&&function(e){return new Promise(function(r,s){const i=l2(e);let d=i.data;const c=xn.from(i.headers).normalize();let{responseType:f,onUploadProgress:p,onDownloadProgress:g}=i,x,y,v,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 A(){if(!S)return;const O=xn.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),B={data:!f||f==="text"||f==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:O,config:e,request:S};s2(function(z){r(z),N()},function(z){s(z),N()},B),S=null}"onloadend"in S?S.onloadend=A:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(A)},S.onabort=function(){S&&(s(new qt("Request aborted",qt.ECONNABORTED,e,S)),S=null)},S.onerror=function(P){const B=P&&P.message?P.message:"Network Error",V=new qt(B,qt.ERR_NETWORK,e,S);V.event=P||null,s(V),S=null},S.ontimeout=function(){let P=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const B=i.transitional||a2;i.timeoutErrorMessage&&(P=i.timeoutErrorMessage),s(new qt(P,B.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,e,S)),S=null},d===void 0&&c.setContentType(null),"setRequestHeader"in S&&Be.forEach(c.toJSON(),function(P,B){S.setRequestHeader(B,P)}),Be.isUndefined(i.withCredentials)||(S.withCredentials=!!i.withCredentials),f&&f!=="json"&&(S.responseType=i.responseType),g&&([v,T]=Sf(g,!0),S.addEventListener("progress",v)),p&&S.upload&&([y,k]=Sf(p),S.upload.addEventListener("progress",y),S.upload.addEventListener("loadend",k)),(i.cancelToken||i.signal)&&(x=O=>{S&&(s(!O||O.type?new Lc(null,e,S):O),S.abort(),S=null)},i.cancelToken&&i.cancelToken.subscribe(x),i.signal&&(i.signal.aborted?x():i.signal.addEventListener("abort",x)));const C=Q6(i.url);if(C&&Hr.protocols.indexOf(C)===-1){s(new qt("Unsupported protocol "+C+":",qt.ERR_BAD_REQUEST,e));return}S.send(d||null)})},o5=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,i;const d=function(g){if(!i){i=!0,f();const x=g instanceof Error?g:this.reason;s.abort(x instanceof qt?x:new Lc(x instanceof Error?x.message:x))}};let c=t&&setTimeout(()=>{c=null,d(new qt(`timeout ${t} of ms exceeded`,qt.ETIMEDOUT))},t);const f=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(g=>{g.unsubscribe?g.unsubscribe(d):g.removeEventListener("abort",d)}),e=null)};e.forEach(g=>g.addEventListener("abort",d));const{signal:p}=s;return p.unsubscribe=()=>Be.asap(f),p}},c5=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,i;for(;s<r;)i=s+t,yield e.slice(s,i),s=i},d5=function(e,t){return lg(this,null,function*(){try{for(var r=qb(u5(e)),s,i,d;s=!(i=yield new Zl(r.next())).done;s=!1){const c=i.value;yield*og(c5(c,t))}}catch(i){d=[i]}finally{try{s&&(i=r.return)&&(yield new Zl(i.call(r)))}finally{if(d)throw d[0]}}})},u5=function(e){return lg(this,null,function*(){if(e[Symbol.asyncIterator]){yield*og(e);return}const t=e.getReader();try{for(;;){const{done:r,value:s}=yield new Zl(t.read());if(r)break;yield s}}finally{yield new Zl(t.cancel())}})},Q1=(e,t,r,s)=>{const i=d5(e,t);let d=0,c,f=g=>{c||(c=!0,s&&s(g))};return new ReadableStream({pull(g){return le(this,null,function*(){try{const{done:x,value:y}=yield i.next();if(x){f(),g.close();return}let v=y.byteLength;if(r){let k=d+=v;r(k)}g.enqueue(new Uint8Array(y))}catch(x){throw f(x),x}})},cancel(g){return f(g),i.return()}},{highWaterMark:2})},ev=64*1024,{isFunction:ef}=Be,f5=(({Request:e,Response:t})=>({Request:e,Response:t}))(Be.global),{ReadableStream:tv,TextEncoder:av}=Be.global,rv=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},h5=e=>{e=Be.merge.call({skipUndefined:!0},f5,e);const{fetch:t,Request:r,Response:s}=e,i=t?ef(t):typeof fetch=="function",d=ef(r),c=ef(s);if(!i)return!1;const f=i&&ef(tv),p=i&&(typeof av=="function"?(T=>N=>T.encode(N))(new av):T=>le(null,null,function*(){return new Uint8Array(yield new r(T).arrayBuffer())})),g=d&&f&&rv(()=>{let T=!1;const N=new r(Hr.origin,{body:new tv,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!N}),x=c&&f&&rv(()=>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 A=N&&N[T];if(A)return A.call(N);throw new qt(`Response type '${T}' is not supported`,qt.ERR_NOT_SUPPORT,S)})});const v=T=>le(null,null,function*(){if(T==null)return 0;if(Be.isBlob(T))return T.size;if(Be.isSpecCompliantForm(T))return(yield new r(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 p(T)).byteLength}),k=(T,N)=>le(null,null,function*(){const S=Be.toFiniteNumber(T.getContentLength());return S==null?v(N):S});return T=>le(null,null,function*(){let{url:N,method:S,data:A,signal:C,cancelToken:O,timeout:P,onDownloadProgress:B,onUploadProgress:V,responseType:z,headers:U,withCredentials:J="same-origin",fetchOptions:de}=l2(T),ye=t||fetch;z=z?(z+"").toLowerCase():"text";let ie=o5([C,O&&O.toAbortSignal()],P),he=null;const ve=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let me;try{if(V&&g&&S!=="get"&&S!=="head"&&(me=yield k(U,A))!==0){let F=new r(N,{method:"POST",body:A,duplex:"half"}),D;if(Be.isFormData(A)&&(D=F.headers.get("content-type"))&&U.setContentType(D),F.body){const[H,Z]=X1(me,Sf(J1(V)));A=Q1(F.body,ev,H,Z)}}Be.isString(J)||(J=J?"include":"omit");const ee=d&&"credentials"in r.prototype,q=Se(ne({},de),{signal:ie,method:S.toUpperCase(),headers:U.normalize().toJSON(),body:A,duplex:"half",credentials:ee?J:void 0});he=d&&new r(N,q);let Q=yield d?ye(he,de):ye(N,q);const fe=x&&(z==="stream"||z==="response");if(x&&(B||fe&&ve)){const F={};["status","statusText","headers"].forEach(K=>{F[K]=Q[K]});const D=Be.toFiniteNumber(Q.headers.get("content-length")),[H,Z]=B&&X1(D,Sf(J1(B),!0))||[];Q=new s(Q1(Q.body,ev,H,()=>{Z&&Z(),ve&&ve()}),F)}z=z||"text";let ae=yield y[Be.findKey(y,z)||"text"](Q,T);return!fe&&ve&&ve(),yield new Promise((F,D)=>{s2(F,D,{data:ae,headers:xn.from(Q.headers),status:Q.status,statusText:Q.statusText,config:T,request:he})})}catch(ee){throw ve&&ve(),ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,T,he),{cause:ee.cause||ee}):qt.from(ee,ee&&ee.code,T,he)}})},m5=new Map,o2=e=>{let t=e&&e.env||{};const{fetch:r,Request:s,Response:i}=t,d=[s,i,r];let c=d.length,f=c,p,g,x=m5;for(;f--;)p=d[f],g=x.get(p),g===void 0&&x.set(p,g=f?new Map:h5(t)),x=g;return g};o2();const wp={http:O6,xhr:l5,fetch:{get:o2}};Be.forEach(wp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});const nv=e=>`- ${e}`,g5=e=>Be.isFunction(e)||e===null||e===!1;function p5(e,t){e=Be.isArray(e)?e:[e];const{length:r}=e;let s,i;const d={};for(let c=0;c<r;c++){s=e[c];let f;if(i=s,!g5(s)&&(i=wp[(f=String(s)).toLowerCase()],i===void 0))throw new qt(`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(([p,g])=>`adapter ${p} `+(g===!1?"is not supported by the environment":"is not available in the build"));let f=r?c.length>1?`since :
`+c.map(nv).join(`
`):" "+nv(c[0]):"as no adapter specified";throw new qt("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return i}const c2={getAdapter:p5,adapters:wp};function Tg(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lc(null,e)}function sv(e){return Tg(e),e.headers=xn.from(e.headers),e.data=Sg.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),c2.getAdapter(e.adapter||v0.adapter,e)(e).then(function(s){return Tg(e),s.data=Sg.call(e,e.transformResponse,s),s.headers=xn.from(s.headers),s},function(s){return n2(s)||(Tg(e),s&&s.response&&(s.response.data=Sg.call(e,e.transformResponse,s.response),s.response.headers=xn.from(s.response.headers))),Promise.reject(s)})}const d2="1.13.2",Qf={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qf[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const iv={};Qf.transitional=function(t,r,s){function i(d,c){return"[Axios v"+d2+"] Transitional option '"+d+"'"+c+(s?". "+s:"")}return(d,c,f)=>{if(t===!1)throw new qt(i(c," has been removed"+(r?" in "+r:"")),qt.ERR_DEPRECATED);return r&&!iv[c]&&(iv[c]=!0,console.warn(i(c," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(d,c,f):!0}};Qf.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function x5(e,t,r){if(typeof e!="object")throw new qt("options must be an object",qt.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],p=f===void 0||c(f,d,e);if(p!==!0)throw new qt("option "+d+" must be "+p,qt.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new qt("Unknown option "+d,qt.ERR_BAD_OPTION)}}const pf={assertOptions:x5,validators:Qf},Bs=pf.validators;let to=class{constructor(t){this.defaults=t||{},this.interceptors={request:new q1,response:new q1}}request(t,r){return le(this,null,function*(){try{return yield this._request(t,r)}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,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=io(this.defaults,r);const{transitional:s,paramsSerializer:i,headers:d}=r;s!==void 0&&pf.assertOptions(s,{silentJSONParsing:Bs.transitional(Bs.boolean),forcedJSONParsing:Bs.transitional(Bs.boolean),clarifyTimeoutError:Bs.transitional(Bs.boolean)},!1),i!=null&&(Be.isFunction(i)?r.paramsSerializer={serialize:i}:pf.assertOptions(i,{encode:Bs.function,serialize:Bs.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),pf.assertOptions(r,{baseUrl:Bs.spelling("baseURL"),withXsrfToken:Bs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=d&&Be.merge(d.common,d[r.method]);d&&Be.forEach(["delete","get","head","post","put","patch","common"],T=>{delete d[T]}),r.headers=xn.concat(c,d);const f=[];let p=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(p=p&&N.synchronous,f.unshift(N.fulfilled,N.rejected))});const g=[];this.interceptors.response.forEach(function(N){g.push(N.fulfilled,N.rejected)});let x,y=0,v;if(!p){const T=[sv.bind(this),void 0];for(T.unshift(...f),T.push(...g),v=T.length,x=Promise.resolve(r);y<v;)x=x.then(T[y++],T[y++]);return x}v=f.length;let k=r;for(;y<v;){const T=f[y++],N=f[y++];try{k=T(k)}catch(S){N.call(this,S);break}}try{x=sv.call(this,k)}catch(T){return Promise.reject(T)}for(y=0,v=g.length;y<v;)x=x.then(g[y++],g[y++]);return x}getUri(t){t=io(this.defaults,t);const r=i2(t.baseURL,t.url,t.allowAbsoluteUrls);return t2(r,t.params,t.paramsSerializer)}};Be.forEach(["delete","get","head","options"],function(t){to.prototype[t]=function(r,s){return this.request(io(s||{},{method:t,url:r,data:(s||{}).data}))}});Be.forEach(["post","put","patch"],function(t){function r(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]=r(),to.prototype[t+"Form"]=r(!0)});let y5=class u2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(d){r=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),r(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 r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new u2(function(i){t=i}),cancel:t}}};function b5(e){return function(r){return e.apply(null,r)}}function v5(e){return Be.isObject(e)&&e.isAxiosError===!0}const Kg={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(Kg).forEach(([e,t])=>{Kg[t]=e});function f2(e){const t=new to(e),r=$_(to.prototype.request,t);return Be.extend(r,to.prototype,t,{allOwnKeys:!0}),Be.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return f2(io(e,i))},r}const tr=f2(v0);tr.Axios=to;tr.CanceledError=Lc;tr.CancelToken=y5;tr.isCancel=n2;tr.VERSION=d2;tr.toFormData=Kf;tr.AxiosError=qt;tr.Cancel=tr.CanceledError;tr.all=function(t){return Promise.all(t)};tr.spread=b5;tr.isAxiosError=v5;tr.mergeConfig=io;tr.AxiosHeaders=xn;tr.formToJSON=e=>r2(Be.isHTMLForm(e)?new FormData(e):e);tr.getAdapter=c2.getAdapter;tr.HttpStatusCode=Kg;tr.default=tr;const{Axios:SD,AxiosError:TD,CanceledError:ED,isCancel:CD,CancelToken:AD,VERSION:OD,all:MD,Cancel:LD,isAxiosError:DD,spread:PD,toFormData:RD,AxiosHeaders:FD,HttpStatusCode:ID,formToJSON:zD,getAdapter:BD,mergeConfig:UD}=tr;class _5{constructor(){Kn(this,"client");Kn(this,"baseURL");Kn(this,"siteName");this.baseURL="http://localhost:8000",this.siteName="seeraasm-med.seeraarabia.com",this.client=tr.create({baseURL:this.baseURL,timeout:parseInt("10000"),withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}}),this.client.interceptors.request.use(t=>{var r;return(r=t.url)!=null&&r.includes("/api/")&&(t.url=`/${this.siteName}${t.url}`),t}),this.client.interceptors.response.use(t=>t,t=>{var r;return((r=t.response)==null?void 0:r.status)===401&&(window.location.href="/login"),Promise.reject(t)})}login(t){return le(this,null,function*(){return(yield this.client.post("/api/method/login",t)).data})}logout(){return le(this,null,function*(){return(yield this.client.post("/api/method/logout")).data})}getCurrentUser(){return le(this,null,function*(){return(yield this.client.get("/api/method/frappe.auth.get_logged_user")).data})}callMethod(s){return le(this,arguments,function*(t,r={}){return(yield this.client.post(`/api/method/${t}`,r)).data})}frappeGet(s){return le(this,arguments,function*(t,r={}){return this.callMethod(t,r)})}getDocTypeRecords(i){return le(this,arguments,function*(t,r={},s=[]){const d=new URLSearchParams;return Object.keys(r).length>0&&d.append("filters",JSON.stringify(r)),s.length>0&&d.append("fields",JSON.stringify(s)),(yield this.client.get(`/api/resource/${t}?${d.toString()}`)).data})}getDocTypeRecord(t,r){return le(this,null,function*(){return(yield this.client.get(`/api/resource/${t}/${r}`)).data})}createDocTypeRecord(t,r){return le(this,null,function*(){return(yield this.client.post(`/api/resource/${t}`,r)).data})}updateDocTypeRecord(t,r,s){return le(this,null,function*(){return(yield this.client.put(`/api/resource/${t}/${r}`,s)).data})}deleteDocTypeRecord(t,r){return le(this,null,function*(){return(yield this.client.delete(`/api/resource/${t}/${r}`)).data})}uploadFile(t,r="Home"){return le(this,null,function*(){const s=new FormData;return s.append("file",t),s.append("folder",r),s.append("is_private","0"),(yield this.client.post("/api/method/upload_file",s,{headers:{"Content-Type":"multipart/form-data"}})).data})}}const h2=new _5,w5=()=>{const[e,t]=j.useState([]),[r,s]=j.useState(!0),[i,d]=j.useState(null),[c,f]=j.useState(""),p=xa();j.useEffect(()=>{g()},[]);const g=()=>le(null,null,function*(){var v,k;try{s(!0);const T=yield h2.getDocTypeRecords("User",{},["name","full_name","email","enabled","creation","modified"]);t(T.message||[])}catch(T){d(((k=(v=T.response)==null?void 0:v.data)==null?void 0:k.message)||"Failed to load users")}finally{s(!1)}}),x=e.filter(v=>{var k,T,N;return((k=v.full_name)==null?void 0:k.toLowerCase().includes(c.toLowerCase()))||((T=v.email)==null?void 0:T.toLowerCase().includes(c.toLowerCase()))||((N=v.name)==null?void 0:N.toLowerCase().includes(c.toLowerCase()))}),y=v=>{p(`/users/${v.name}`)};return r?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:a.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[a.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex justify-between items-center py-6",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("button",{onClick:()=>p("/dashboard"),className:"mr-4 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:a.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),a.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Users"})]}),a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("button",{onClick:()=>p("/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"})})]})})}),a.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[i&&a.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:a.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),a.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between",children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx("svg",{className:"h-5 w-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),a.jsx("input",{type:"text",placeholder:"Search users...",value:c,onChange:v=>f(v.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"})]})}),a.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-4",children:a.jsxs("button",{onClick:g,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:[a.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"]})})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[a.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[a.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Users (",x.length,")"]}),a.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?a.jsxs("div",{className:"text-center py-12",children:[a.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:a.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"})}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No users found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:c?"Try adjusting your search terms.":"No users available."})]}):a.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:x.map(v=>{var k;return a.jsx("li",{children:a.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(v),children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 dark:bg-indigo-900 flex items-center justify-center",children:a.jsx("span",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-300",children:((k=v.full_name)==null?void 0:k.charAt(0))||v.name.charAt(0)})})}),a.jsxs("div",{className:"ml-4",children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:v.full_name||v.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:v.email||"No email"})]})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${v.enabled?"bg-green-400":"bg-red-400"}`}),v.enabled?"Active":"Inactive"]})}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Created: ",new Date(v.creation).toLocaleDateString()]}),a.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})},v.name)})})]})]})]})},k5=()=>{const[e,t]=j.useState([]),[r,s]=j.useState(!0),[i,d]=j.useState(null);j.useEffect(()=>{c()},[]);const c=()=>le(null,null,function*(){try{s(!0);const x=yield h2.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(),p=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"}},g=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 r?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:a.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[a.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex justify-between items-center py-6",children:[a.jsx("div",{className:"flex items-center",children:a.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Events"})}),a.jsx("div",{className:"flex items-center space-x-4",children:a.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"})})]})})}),a.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[i&&a.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:a.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[a.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[a.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Upcoming Events (",e.length,")"]}),a.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?a.jsxs("div",{className:"text-center py-12",children:[a.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:a.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"})}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No events found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"No events are currently scheduled."})]}):a.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.map(x=>a.jsx("li",{children:a.jsx("div",{className:"px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700",children:a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white",children:x.subject}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${p(x.status)}`,children:x.status}),a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${g(x.event_type)}`,children:x.event_type})]})]}),x.description&&a.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:x.description}),a.jsxs("div",{className:"mt-2 flex items-center text-sm text-gray-500 dark:text-gray-400",children:[a.jsx("svg",{className:"flex-shrink-0 mr-1.5 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsxs("span",{children:[f(x.starts_on)," - ",f(x.ends_on)]})]})]})})})},x.name))})]}),a.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:a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("svg",{className:"h-5 w-5 text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.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"})})}),a.jsxs("div",{className:"ml-3",children:[a.jsx("h3",{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:"API Endpoint Information"}),a.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-400",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Endpoint:"})," ",a.jsx("code",{children:"frappe.desk.doctype.event.event.get_events"})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Full URL:"})," ",a.jsx("code",{children:"https://seeraasm-med.seeraarabia.com/api/method/frappe.desk.doctype.event.event.get_events"})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Method:"})," POST (Frappe API standard)"]})]})]})]})})]})]})};var Tf={};Tf.version="0.18.5";var m2=1252,N5=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],g2=function(e){N5.indexOf(e)!=-1&&(m2=e)};function j5(){g2(1252)}var r0=function(e){g2(e)};function S5(){r0(1200),j5()}var tf=function(t){return String.fromCharCode(t)},lv=function(t){return String.fromCharCode(t)},Ef,il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n0(e){for(var t="",r=0,s=0,i=0,d=0,c=0,f=0,p=0,g=0;g<e.length;)r=e.charCodeAt(g++),d=r>>2,s=e.charCodeAt(g++),c=(r&3)<<4|s>>4,i=e.charCodeAt(g++),f=(s&15)<<2|i>>6,p=i&63,isNaN(s)?f=p=64:isNaN(i)&&(p=64),t+=il.charAt(d)+il.charAt(c)+il.charAt(f)+il.charAt(p);return t}function bi(e){var t="",r=0,s=0,i=0,d=0,c=0,f=0,p=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var g=0;g<e.length;)d=il.indexOf(e.charAt(g++)),c=il.indexOf(e.charAt(g++)),r=d<<2|c>>4,t+=String.fromCharCode(r),f=il.indexOf(e.charAt(g++)),s=(c&15)<<4|f>>2,f!==64&&(t+=String.fromCharCode(s)),p=il.indexOf(e.charAt(g++)),i=(f&3)<<6|p,p!==64&&(t+=String.fromCharCode(i));return t}var pa=(function(){return typeof Buffer!="undefined"&&typeof process!="undefined"&&typeof process.versions!="undefined"&&!!process.versions.node})(),ki=(function(){if(typeof Buffer!="undefined"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(t){e=!0}return e?function(t,r){return r?new Buffer(t,r):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 ov(e){return pa?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}var ys=function(t){return pa?ki(t,"binary"):t.split("").map(function(r){return r.charCodeAt(0)&255})};function eh(e){if(typeof ArrayBuffer=="undefined")return ys(e);for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),s=0;s!=e.length;++s)r[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=[],r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}function T5(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:ki(t)}))}:function(e){if(typeof Uint8Array!="undefined"){var t=0,r=0;for(t=0;t<e.length;++t)r+=e[t].length;var s=new Uint8Array(r),i=0;for(t=0,r=0;t<e.length;r+=i,++t)if(i=e[t].length,e[t]instanceof Uint8Array)s.set(e[t],r);else{if(typeof e[t]=="string")throw"wtf";s.set(new Uint8Array(e[t]),r)}return s}return[].concat.apply([],e.map(function(d){return Array.isArray(d)?d:[].slice.call(d)}))};function E5(e){for(var t=[],r=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[r++]=c;else if(c<2048)i[r++]=192|c>>6&31,i[r++]=128|c&63;else if(c>=55296&&c<57344){c=(c&1023)+64;var f=e.charCodeAt(++d)&1023;i[r++]=240|c>>8&7,i[r++]=128|c>>2&63,i[r++]=128|f>>6&15|(c&3)<<4,i[r++]=128|f&63}else i[r++]=224|c>>12&15,i[r++]=128|c>>6&63,i[r++]=128|c&63;r>s&&(t.push(i.slice(0,r)),r=0,i=lo(65535),s=65530)}return t.push(i.slice(0,r)),Lr(t)}var qd=/\u0000/g,af=/[\u0001-\u0006]/g;function yc(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function bs(e,t){var r=""+e;return r.length>=t?r:Ja("0",t-r.length)+r}function kp(e,t){var r=""+e;return r.length>=t?r:Ja(" ",t-r.length)+r}function Cf(e,t){var r=""+e;return r.length>=t?r:r+Ja(" ",t-r.length)}function C5(e,t){var r=""+Math.round(e);return r.length>=t?r:Ja("0",t-r.length)+r}function A5(e,t){var r=""+e;return r.length>=t?r:Ja("0",t-r.length)+r}var cv=Math.pow(2,32);function oc(e,t){if(e>cv||e<-cv)return C5(e,t);var r=Math.round(e);return A5(r,t)}function Af(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 dv=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],Eg=[["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 O5(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"秒 "'},uv={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},M5={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 Of(e,t,r){for(var s=e<0?-1:1,i=e*s,d=0,c=1,f=0,p=1,g=0,x=0,y=Math.floor(i);g<t&&(y=Math.floor(i),f=y*c+d,x=y*g+p,!(i-y<5e-8));)i=1/(i-y),d=c,c=f,p=g,g=x;if(x>t&&(g>t?(x=p,f=d):(x=g,f=c)),!r)return[0,s*f,x];var v=Math.floor(s*f/x);return[v,s*f-v*x,x]}function rf(e,t,r){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=r?[1317,10,29]:[1900,2,29],d=3;else if(s===0)c=r?[1317,8,29]:[1900,1,0],d=6;else{s>60&&--s;var p=new Date(1900,0,1);p.setDate(p.getDate()+s-1),c=[p.getFullYear(),p.getMonth()+1,p.getDate()],d=p.getDay(),s<60&&(d=(d+6)%7),r&&(d=z5(p,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 p2=new Date(1899,11,31,0,0,0),L5=p2.getTime(),D5=new Date(1900,2,1,0,0,0);function x2(e,t){var r=e.getTime();return t?r-=1461*24*60*60*1e3:e>=D5&&(r+=1440*60*1e3),(r-(L5+(e.getTimezoneOffset()-p2.getTimezoneOffset())*6e4))/(1440*60*1e3)}function Np(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function P5(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function R5(e){var t=e<0?12:11,r=Np(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10),r.length<=t)?r:e.toExponential(5)}function F5(e){var t=Np(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function I5(e){var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),r;return t>=-4&&t<=-1?r=e.toPrecision(10+t):Math.abs(t)<=9?r=R5(e):t===10?r=e.toFixed(10).substr(0,12):r=F5(e),Np(P5(r.toUpperCase()))}function Qg(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):I5(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return cl(14,x2(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function z5(e,t){t[0]-=581;var r=e.getDay();return e<60&&(r=(r+6)%7),r}function B5(e,t,r,s){var i="",d=0,c=0,f=r.y,p,g=0;switch(e){case 98:f=r.y+543;case 121:switch(t.length){case 1:case 2:p=f%100,g=2;break;default:p=f%1e4,g=4;break}break;case 109:switch(t.length){case 1:case 2:p=r.m,g=t.length;break;case 3:return Eg[r.m-1][1];case 5:return Eg[r.m-1][0];default:return Eg[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:p=r.d,g=t.length;break;case 3:return dv[r.q][0];default:return dv[r.q][1]}break;case 104:switch(t.length){case 1:case 2:p=1+(r.H+11)%12,g=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:p=r.H,g=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:p=r.M,g=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 r.u===0&&(t=="s"||t=="ss")?bs(r.S,t.length):(s>=2?c=s===3?1e3:100:c=s===1?10:1,d=Math.round(c*(r.S+r.u)),d>=60*c&&(d=0),t==="s"?d===0?"0":""+d/c:(i=bs(d,2+s),t==="ss"?i.substr(0,2):"."+i.substr(2,t.length-1)));case 90:switch(t){case"[h]":case"[hh]":p=r.D*24+r.H;break;case"[m]":case"[mm]":p=(r.D*24+r.H)*60+r.M;break;case"[s]":case"[ss]":p=((r.D*24+r.H)*60+r.M)*60+Math.round(r.S+r.u);break;default:throw"bad abstime format: "+t}g=t.length===3?1:2;break;case 101:p=f,g=1;break}var x=g>0?bs(p,g):"";return x}function ll(e){var t=3;if(e.length<=t)return e;for(var r=e.length%t,s=e.substr(0,r);r!=e.length;r+=t)s+=(s.length>0?",":"")+e.substr(r,t);return s}var y2=/%/g;function U5(e,t,r){var s=t.replace(y2,""),i=t.length-s.length;return mi(e,s,r*Math.pow(10,2*i))+Ja("%",i)}function H5(e,t,r){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return mi(e,t.substr(0,s),r/Math.pow(10,3*(t.length-s)))}function b2(e,t){var r,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+b2(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),r=(t/Math.pow(10,d)).toPrecision(s+1+(i+d)%i),r.indexOf("e")===-1){var c=Math.floor(Math.log(t)*Math.LOG10E);for(r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(c-r.length+d):r+="E+"+(c-d);r.substr(0,2)==="0.";)r=r.charAt(0)+r.substr(2,i)+"."+r.substr(2+i),r=r.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,p,g,x){return p+g+x.substr(0,(i+d)%i)+"."+x.substr(d)+"E"})}else r=t.toExponential(s);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var v2=/# (\?+)( ?)\/( ?)(\d+)/;function $5(e,t,r){var s=parseInt(e[4],10),i=Math.round(t*s),d=Math.floor(i/s),c=i-d*s,f=s;return r+(d===0?"":""+d)+" "+(c===0?Ja(" ",e[1].length+1+e[4].length):kp(c,e[1].length)+e[2]+"/"+e[3]+bs(f,e[4].length))}function W5(e,t,r){return r+(t===0?"":""+t)+Ja(" ",e[1].length+2+e[4].length)}var _2=/^#*0*\.([0#]+)/,w2=/\).*[0#]/,k2=/\(###\) ###\\?-####/;function Xr(e){for(var t="",r,s=0;s!=e.length;++s)switch(r=e.charCodeAt(s)){case 35:break;case 63:t+=" ";break;case 48:t+="0";break;default:t+=String.fromCharCode(r)}return t}function fv(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function hv(e,t){var r=e-Math.floor(e),s=Math.pow(10,t);return t<(""+Math.round(r*s)).length?0:Math.round(r*s)}function V5(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function G5(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Qn(e,t,r){if(e.charCodeAt(0)===40&&!t.match(w2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Qn("n",s,r):"("+Qn("n",s,-r)+")"}if(t.charCodeAt(t.length-1)===44)return H5(e,t,r);if(t.indexOf("%")!==-1)return U5(e,t,r);if(t.indexOf("E")!==-1)return b2(t,r);if(t.charCodeAt(0)===36)return"$"+Qn(e,t.substr(t.charAt(1)==" "?2:1),r);var i,d,c,f,p=Math.abs(r),g=r<0?"-":"";if(t.match(/^00+$/))return g+oc(p,t.length);if(t.match(/^[#?]+$/))return i=oc(r,0),i==="0"&&(i=""),i.length>t.length?i:Xr(t.substr(0,t.length-i.length))+i;if(d=t.match(v2))return $5(d,p,g);if(t.match(/^#+0+$/))return g+oc(p,t.length-t.indexOf("0"));if(d=t.match(_2))return i=fv(r,d[1].length).replace(/^([^\.]+)$/,"$1."+Xr(d[1])).replace(/\.$/,"."+Xr(d[1])).replace(/\.(\d*)$/,function(T,N){return"."+N+Ja("0",Xr(d[1]).length-N.length)}),t.indexOf("0.")!==-1?i:i.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),d=t.match(/^(0*)\.(#*)$/))return g+fv(p,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 g+ll(oc(p,0));if(d=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Qn(e,t,-r):ll(""+(Math.floor(r)+V5(r,d[1].length)))+"."+bs(hv(r,d[1].length),d[1].length);if(d=t.match(/^#,#*,#0/))return Qn(e,t.replace(/^#,#*,/,""),r);if(d=t.match(/^([0#]+)(\\?-([0#]+))+$/))return i=yc(Qn(e,t.replace(/[\\-]/g,""),r)),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(k2))return i=Qn(e,"##########",r),"("+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=Of(p,Math.pow(10,c)-1,!1),i=""+g,x=mi("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=Cf(f[2],c),x.length<d[4].length&&(x=Xr(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=Of(p,Math.pow(10,c)-1,!0),g+(f[0]||(f[1]?"":"0"))+" "+(f[1]?kp(f[1],c)+d[2]+"/"+d[3]+Cf(f[2],c):Ja(" ",2*c+1+d[2].length+d[3].length));if(d=t.match(/^[#0?]+$/))return i=oc(r,0),t.length<=i.length?i:Xr(t.substr(0,t.length-i.length))+i;if(d=t.match(/^([#0?]+)\.([#0]+)$/)){i=""+r.toFixed(Math.min(d[2].length,10)).replace(/([^0])0+$/,"$1"),c=i.indexOf(".");var y=t.indexOf(".")-c,v=t.length-i.length-y;return Xr(t.substr(0,y)+i+t.substr(t.length-v))}if(d=t.match(/^00,000\.([#0]*0)$/))return c=hv(r,d[1].length),r<0?"-"+Qn(e,t,-r):ll(G5(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?bs(0,3-T.length):"")+T})+"."+bs(c,d[1].length);switch(t){case"###,##0.00":return Qn(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var k=ll(oc(p,0));return k!=="0"?g+k:"";case"###,###.00":return Qn(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return Qn(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function Z5(e,t,r){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return mi(e,t.substr(0,s),r/Math.pow(10,3*(t.length-s)))}function q5(e,t,r){var s=t.replace(y2,""),i=t.length-s.length;return mi(e,s,r*Math.pow(10,2*i))+Ja("%",i)}function N2(e,t){var r,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+N2(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),r=(t/Math.pow(10,d)).toPrecision(s+1+(i+d)%i),!r.match(/[Ee]/)){var c=Math.floor(Math.log(t)*Math.LOG10E);r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(c-r.length+d):r+="E+"+(c-d),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,p,g,x){return p+g+x.substr(0,(i+d)%i)+"."+x.substr(d)+"E"})}else r=t.toExponential(s);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function Us(e,t,r){if(e.charCodeAt(0)===40&&!t.match(w2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Us("n",s,r):"("+Us("n",s,-r)+")"}if(t.charCodeAt(t.length-1)===44)return Z5(e,t,r);if(t.indexOf("%")!==-1)return q5(e,t,r);if(t.indexOf("E")!==-1)return N2(t,r);if(t.charCodeAt(0)===36)return"$"+Us(e,t.substr(t.charAt(1)==" "?2:1),r);var i,d,c,f,p=Math.abs(r),g=r<0?"-":"";if(t.match(/^00+$/))return g+bs(p,t.length);if(t.match(/^[#?]+$/))return i=""+r,r===0&&(i=""),i.length>t.length?i:Xr(t.substr(0,t.length-i.length))+i;if(d=t.match(v2))return W5(d,p,g);if(t.match(/^#+0+$/))return g+bs(p,t.length-t.indexOf("0"));if(d=t.match(_2))return i=(""+r).replace(/^([^\.]+)$/,"$1."+Xr(d[1])).replace(/\.$/,"."+Xr(d[1])),i=i.replace(/\.(\d*)$/,function(T,N){return"."+N+Ja("0",Xr(d[1]).length-N.length)}),t.indexOf("0.")!==-1?i:i.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),d=t.match(/^(0*)\.(#*)$/))return g+(""+p).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,d[1].length?"0.":".");if(d=t.match(/^#{1,3},##0(\.?)$/))return g+ll(""+p);if(d=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Us(e,t,-r):ll(""+r)+"."+Ja("0",d[1].length);if(d=t.match(/^#,#*,#0/))return Us(e,t.replace(/^#,#*,/,""),r);if(d=t.match(/^([0#]+)(\\?-([0#]+))+$/))return i=yc(Us(e,t.replace(/[\\-]/g,""),r)),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(k2))return i=Us(e,"##########",r),"("+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=Of(p,Math.pow(10,c)-1,!1),i=""+g,x=mi("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=Cf(f[2],c),x.length<d[4].length&&(x=Xr(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=Of(p,Math.pow(10,c)-1,!0),g+(f[0]||(f[1]?"":"0"))+" "+(f[1]?kp(f[1],c)+d[2]+"/"+d[3]+Cf(f[2],c):Ja(" ",2*c+1+d[2].length+d[3].length));if(d=t.match(/^[#0?]+$/))return i=""+r,t.length<=i.length?i:Xr(t.substr(0,t.length-i.length))+i;if(d=t.match(/^([#0]+)\.([#0]+)$/)){i=""+r.toFixed(Math.min(d[2].length,10)).replace(/([^0])0+$/,"$1"),c=i.indexOf(".");var y=t.indexOf(".")-c,v=t.length-i.length-y;return Xr(t.substr(0,y)+i+t.substr(t.length-v))}if(d=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+Us(e,t,-r):ll(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?bs(0,3-T.length):"")+T})+"."+bs(0,d[1].length);switch(t){case"###,###":case"##,###":case"#,###":var k=ll(""+p);return k!=="0"?g+k:"";default:if(t.match(/\.[0#?]*$/))return Us(e,t.slice(0,t.lastIndexOf(".")),r)+Xr(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function mi(e,t,r){return(r|0)===r?Us(e,t,r):Qn(e,t,r)}function Y5(e){for(var t=[],r=!1,s=0,i=0;s<e.length;++s)switch(e.charCodeAt(s)){case 34:r=!r;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),r===!0)throw new Error("Format |"+e+"| unterminated string ");return t}var j2=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function S2(e){for(var t=0,r="",s="";t<e.length;)switch(r=e.charAt(t)){case"G":Af(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=r;e.charAt(t++)!=="]"&&t<e.length;)s+=e.charAt(t);if(s.match(j2))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(r=e.charAt(++t))>-1||r=="\\"&&e.charAt(t+1)=="-"&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===r;);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 X5(e,t,r,s){for(var i=[],d="",c=0,f="",p="t",g,x,y,v="H";c<e.length;)switch(f=e.charAt(c)){case"G":if(!Af(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(g==null&&(g=rf(t,r,e.charAt(c+1)==="2"),g==null))return"";i[i.length]={t:"X",v:e.substr(c,2)},p=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||g==null&&(g=rf(t,r),g==null))return"";for(d=f;++c<e.length&&e.charAt(c).toLowerCase()===f;)d+=f;f==="m"&&p.toLowerCase()==="h"&&(f="M"),f==="h"&&(f=v),i[i.length]={t:f,v:d},p=f;break;case"A":case"a":case"上":var N={t:f,v:f};if(g==null&&(g=rf(t,r)),e.substr(c,3).toUpperCase()==="A/P"?(g!=null&&(N.v=g.H>=12?"P":"A"),N.t="T",v="h",c+=3):e.substr(c,5).toUpperCase()==="AM/PM"?(g!=null&&(N.v=g.H>=12?"PM":"AM"),N.t="T",c+=5,v="h"):e.substr(c,5).toUpperCase()==="上午/下午"?(g!=null&&(N.v=g.H>=12?"下午":"上午"),N.t="T",c+=5,v="h"):(N.t="t",++c),g==null&&N.t==="T")return"";i[i.length]=N,p=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(j2)){if(g==null&&(g=rf(t,r),g==null))return"";i[i.length]={t:"Z",v:d.toLowerCase()},p=d.charAt(1)}else d.indexOf("$")>-1&&(d=(d.match(/\$([^-\[\]]*)/)||[])[1]||"$",S2(e)||(i[i.length]={t:"t",v:d}));break;case".":if(g!=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},p=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,A=0,C;for(c=i.length-1,p="t";c>=0;--c)switch(i[c].t){case"h":case"H":i[c].t=v,p="h",S<1&&(S=1);break;case"s":(C=i[c].v.match(/\.0+$/))&&(A=Math.max(A,C[0].length-1)),S<3&&(S=3);case"d":case"y":case"M":case"e":p=i[c].t;break;case"m":p==="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:g.u>=.5&&(g.u=0,++g.S),g.S>=60&&(g.S=0,++g.M),g.M>=60&&(g.M=0,++g.H);break;case 2:g.u>=.5&&(g.u=0,++g.S),g.S>=60&&(g.S=0,++g.M);break}var O="",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=B5(i[c].t.charCodeAt(0),i[c].v,g,A),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;O+=i[c].v,c=P-1;break;case"G":i[c].t="t",i[c].v=Qg(t,r);break}var B="",V,z;if(O.length>0){O.charCodeAt(0)==40?(V=t<0&&O.charCodeAt(0)===45?-t:t,z=mi("n",O,V)):(V=t<0&&s>1?-t:t,z=mi("n",O,V),V<0&&i[0]&&i[0].t=="t"&&(z=z.substr(1),i[0].v="-"+i[0].v)),P=z.length-1;var U=i.length;for(c=0;c<i.length;++c)if(i[c]!=null&&i[c].t!="t"&&i[c].v.indexOf(".")>-1){U=c;break}var J=i.length;if(U===i.length&&z.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=z.substr(P+1,i[c].v.length)):P<0?i[c].v="":(i[c].v=z.substr(0,P+1),P=-1),i[c].t="t",J=c);P>=0&&J<i.length&&(i[J].v=z.substr(0,P+1)+i[J].v)}else if(U!==i.length&&z.indexOf("E")===-1){for(P=z.indexOf(".")-1,c=U;c>=0;--c)if(!(i[c]==null||"n?".indexOf(i[c].t)===-1)){for(x=i[c].v.indexOf(".")>-1&&c===U?i[c].v.indexOf(".")-1:i[c].v.length-1,B=i[c].v.substr(x+1);x>=0;--x)P>=0&&(i[c].v.charAt(x)==="0"||i[c].v.charAt(x)==="#")&&(B=z.charAt(P--)+B);i[c].v=B,i[c].t="t",J=c}for(P>=0&&J<i.length&&(i[J].v=z.substr(0,P+1)+i[J].v),P=z.indexOf(".")+1,c=U;c<i.length;++c)if(!(i[c]==null||"n?(".indexOf(i[c].t)===-1&&c!==U)){for(x=i[c].v.indexOf(".")>-1&&c===U?i[c].v.indexOf(".")+1:0,B=i[c].v.substr(0,x);x<i[c].v.length;++x)P<z.length&&(B+=z.charAt(P++));i[c].v=B,i[c].t="t",J=c}}}for(c=0;c<i.length;++c)i[c]!=null&&"n?".indexOf(i[c].t)>-1&&(V=s>1&&t<0&&c>0&&i[c-1].v==="-"?-t:t,i[c].v=mi(i[c].t,i[c].v,V),i[c].t="t");var de="";for(c=0;c!==i.length;++c)i[c]!=null&&(de+=i[c].v);return de}var mv=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function gv(e,t){if(t==null)return!1;var r=parseFloat(t[2]);switch(t[1]){case"=":if(e==r)return!0;break;case">":if(e>r)return!0;break;case"<":if(e<r)return!0;break;case"<>":if(e!=r)return!0;break;case">=":if(e>=r)return!0;break;case"<=":if(e<=r)return!0;break}return!1}function J5(e,t){var r=Y5(e),s=r.length,i=r[s-1].indexOf("@");if(s<4&&i>-1&&--s,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if(typeof t!="number")return[4,r.length===4||i>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=i>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=i>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=i>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"];break}var d=t>0?r[0]:t<0?r[1]:r[2];if(r[0].indexOf("[")===-1&&r[1].indexOf("[")===-1)return[s,d];if(r[0].match(/\[[=<>]/)!=null||r[1].match(/\[[=<>]/)!=null){var c=r[0].match(mv),f=r[1].match(mv);return gv(t,c)?[s,r[0]]:gv(t,f)?[s,r[1]]:[s,r[c!=null&&f!=null?2:1]]}return[s,d]}function cl(e,t,r){r==null&&(r={});var s="";switch(typeof e){case"string":e=="m/d/yy"&&r.dateNF?s=r.dateNF:s=e;break;case"number":e==14&&r.dateNF?s=r.dateNF:s=(r.table!=null?r.table:Ka)[e],s==null&&(s=r.table&&r.table[uv[e]]||Ka[uv[e]]),s==null&&(s=M5[e]||"General");break}if(Af(s,0))return Qg(t,r);t instanceof Date&&(t=x2(t,r.date1904));var i=J5(s,t);if(Af(i[1]))return Qg(t,r);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return X5(i[1],t,r,i[0])}function T2(e,t){if(typeof t!="number"){t=+t||-1;for(var r=0;r<392;++r){if(Ka[r]==null){t<0&&(t=r);continue}if(Ka[r]==e){t=r;break}}t<0&&(t=391)}return Ka[t]=e,t}function th(e){for(var t=0;t!=392;++t)e[t]!==void 0&&T2(e[t],t)}function ah(){Ka=O5()}var E2=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function K5(e){var t=typeof e=="number"?Ka[e]:e;return t=t.replace(E2,"(\\d+)"),new RegExp("^"+t+"$")}function Q5(e,t,r){var s=-1,i=-1,d=-1,c=-1,f=-1,p=-1;(t.match(E2)||[]).forEach(function(y,v){var k=parseInt(r[v+1],10);switch(y.toLowerCase().charAt(0)){case"y":s=k;break;case"d":d=k;break;case"h":c=k;break;case"s":p=k;break;case"m":c>=0?f=k:i=k;break}}),p>=0&&f==-1&&i>=0&&(f=i,i=-1);var g=(""+(s>=0?s:new Date().getFullYear())).slice(-4)+"-"+("00"+(i>=1?i:1)).slice(-2)+"-"+("00"+(d>=1?d:1)).slice(-2);g.length==7&&(g="0"+g),g.length==8&&(g="20"+g);var x=("00"+(c>=0?c:0)).slice(-2)+":"+("00"+(f>=0?f:0)).slice(-2)+":"+("00"+(p>=0?p:0)).slice(-2);return c==-1&&f==-1&&p==-1?g:s==-1&&i==-1&&d==-1?x:g+"T"+x}var eT=(function(){var e={};e.version="1.2.0";function t(){for(var z=0,U=new Array(256),J=0;J!=256;++J)z=J,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,U[J]=z;return typeof Int32Array!="undefined"?new Int32Array(U):U}var r=t();function s(z){var U=0,J=0,de=0,ye=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(de=0;de!=256;++de)ye[de]=z[de];for(de=0;de!=256;++de)for(J=z[de],U=256+de;U<4096;U+=256)J=ye[U]=J>>>8^z[J&255];var ie=[];for(de=1;de!=16;++de)ie[de-1]=typeof Int32Array!="undefined"?ye.subarray(de*256,de*256+256):ye.slice(de*256,de*256+256);return ie}var i=s(r),d=i[0],c=i[1],f=i[2],p=i[3],g=i[4],x=i[5],y=i[6],v=i[7],k=i[8],T=i[9],N=i[10],S=i[11],A=i[12],C=i[13],O=i[14];function P(z,U){for(var J=U^-1,de=0,ye=z.length;de<ye;)J=J>>>8^r[(J^z.charCodeAt(de++))&255];return~J}function B(z,U){for(var J=U^-1,de=z.length-15,ye=0;ye<de;)J=O[z[ye++]^J&255]^C[z[ye++]^J>>8&255]^A[z[ye++]^J>>16&255]^S[z[ye++]^J>>>24]^N[z[ye++]]^T[z[ye++]]^k[z[ye++]]^v[z[ye++]]^y[z[ye++]]^x[z[ye++]]^g[z[ye++]]^p[z[ye++]]^f[z[ye++]]^c[z[ye++]]^d[z[ye++]]^r[z[ye++]];for(de+=15;ye<de;)J=J>>>8^r[(J^z[ye++])&255];return~J}function V(z,U){for(var J=U^-1,de=0,ye=z.length,ie=0,he=0;de<ye;)ie=z.charCodeAt(de++),ie<128?J=J>>>8^r[(J^ie)&255]:ie<2048?(J=J>>>8^r[(J^(192|ie>>6&31))&255],J=J>>>8^r[(J^(128|ie&63))&255]):ie>=55296&&ie<57344?(ie=(ie&1023)+64,he=z.charCodeAt(de++)&1023,J=J>>>8^r[(J^(240|ie>>8&7))&255],J=J>>>8^r[(J^(128|ie>>2&63))&255],J=J>>>8^r[(J^(128|he>>6&15|(ie&3)<<4))&255],J=J>>>8^r[(J^(128|he&63))&255]):(J=J>>>8^r[(J^(224|ie>>12&15))&255],J=J>>>8^r[(J^(128|ie>>6&63))&255],J=J>>>8^r[(J^(128|ie&63))&255]);return~J}return e.table=r,e.bstr=P,e.buf=B,e.str=V,e})(),La=(function(){var t={};t.version="1.2.1";function r(W,ce){for(var I=W.split("/"),Y=ce.split("/"),te=0,se=0,Ee=Math.min(I.length,Y.length);te<Ee;++te){if(se=I[te].length-Y[te].length)return se;if(I[te]!=Y[te])return I[te]<Y[te]?-1:1}return I.length-Y.length}function s(W){if(W.charAt(W.length-1)=="/")return W.slice(0,-1).indexOf("/")===-1?W:s(W.slice(0,-1));var ce=W.lastIndexOf("/");return ce===-1?W:W.slice(0,ce+1)}function i(W){if(W.charAt(W.length-1)=="/")return i(W.slice(0,-1));var ce=W.lastIndexOf("/");return ce===-1?W:W.slice(ce+1)}function d(W,ce){typeof ce=="string"&&(ce=new Date(ce));var I=ce.getHours();I=I<<6|ce.getMinutes(),I=I<<5|ce.getSeconds()>>>1,W.write_shift(2,I);var Y=ce.getFullYear()-1980;Y=Y<<4|ce.getMonth()+1,Y=Y<<5|ce.getDate(),W.write_shift(2,Y)}function c(W){var ce=W.read_shift(2)&65535,I=W.read_shift(2)&65535,Y=new Date,te=I&31;I>>>=5;var se=I&15;I>>>=4,Y.setMilliseconds(0),Y.setFullYear(I+1980),Y.setMonth(se-1),Y.setDate(te);var Ee=ce&31;ce>>>=5;var re=ce&63;return ce>>>=6,Y.setHours(ce),Y.setMinutes(re),Y.setSeconds(Ee<<1),Y}function f(W){Dn(W,0);for(var ce={},I=0;W.l<=W.length-4;){var Y=W.read_shift(2),te=W.read_shift(2),se=W.l+te,Ee={};switch(Y){case 21589:I=W.read_shift(1),I&1&&(Ee.mtime=W.read_shift(4)),te>5&&(I&2&&(Ee.atime=W.read_shift(4)),I&4&&(Ee.ctime=W.read_shift(4))),Ee.mtime&&(Ee.mt=new Date(Ee.mtime*1e3));break}W.l=se,ce[Y]=Ee}return ce}var p;function g(){return p||(p={})}function x(W,ce){if(W[0]==80&&W[1]==75)return pe(W,ce);if((W[0]|32)==109&&(W[1]|32)==105)return Gr(W,ce);if(W.length<512)throw new Error("CFB file size "+W.length+" < 512");var I=3,Y=512,te=0,se=0,Ee=0,re=0,xe=0,ke=[],Ce=W.slice(0,512);Dn(Ce,0);var Qe=y(Ce);switch(I=Qe[0],I){case 3:Y=512;break;case 4:Y=4096;break;case 0:if(Qe[1]==0)return pe(W,ce);default:throw new Error("Major Version: Expected 3 or 4 saw "+I)}Y!==512&&(Ce=W.slice(0,Y),Dn(Ce,28));var lt=W.slice(0,Y);v(Ce,I);var dt=Ce.read_shift(4,"i");if(I===3&&dt!==0)throw new Error("# Directory Sectors: Expected 0 saw "+dt);Ce.l+=4,Ee=Ce.read_shift(4,"i"),Ce.l+=4,Ce.chk("00100000","Mini Stream Cutoff Size: "),re=Ce.read_shift(4,"i"),te=Ce.read_shift(4,"i"),xe=Ce.read_shift(4,"i"),se=Ce.read_shift(4,"i");for(var nt=-1,mt=0;mt<109&&(nt=Ce.read_shift(4,"i"),!(nt<0));++mt)ke[mt]=nt;var St=k(W,Y);S(xe,se,St,Y,ke);var ya=C(St,Ee,ke,Y);ya[Ee].name="!Directory",te>0&&re!==he&&(ya[re].name="!MiniFAT"),ya[ke[0]].name="!FAT",ya.fat_addrs=ke,ya.ssz=Y;var ta={},Ra=[],Ir=[],wn=[];O(Ee,ya,St,Ra,te,ta,Ir,re),T(Ir,wn,Ra),Ra.shift();var ns={FileIndex:Ir,FullPaths:wn};return ce&&ce.raw&&(ns.raw={header:lt,sectors:St}),ns}function y(W){if(W[W.l]==80&&W[W.l+1]==75)return[0,0];W.chk(ve,"Header Signature: "),W.l+=16;var ce=W.read_shift(2,"u");return[W.read_shift(2,"u"),ce]}function v(W,ce){var I=9;switch(W.l+=2,I=W.read_shift(2)){case 9:if(ce!=3)throw new Error("Sector Shift: Expected 9 saw "+I);break;case 12:if(ce!=4)throw new Error("Sector Shift: Expected 12 saw "+I);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+I)}W.chk("0600","Mini Sector Shift: "),W.chk("000000000000","Reserved: ")}function k(W,ce){for(var I=Math.ceil(W.length/ce)-1,Y=[],te=1;te<I;++te)Y[te-1]=W.slice(te*ce,(te+1)*ce);return Y[I-1]=W.slice(I*ce),Y}function T(W,ce,I){for(var Y=0,te=0,se=0,Ee=0,re=0,xe=I.length,ke=[],Ce=[];Y<xe;++Y)ke[Y]=Ce[Y]=Y,ce[Y]=I[Y];for(;re<Ce.length;++re)Y=Ce[re],te=W[Y].L,se=W[Y].R,Ee=W[Y].C,ke[Y]===Y&&(te!==-1&&ke[te]!==te&&(ke[Y]=ke[te]),se!==-1&&ke[se]!==se&&(ke[Y]=ke[se])),Ee!==-1&&(ke[Ee]=Y),te!==-1&&Y!=ke[Y]&&(ke[te]=ke[Y],Ce.lastIndexOf(te)<re&&Ce.push(te)),se!==-1&&Y!=ke[Y]&&(ke[se]=ke[Y],Ce.lastIndexOf(se)<re&&Ce.push(se));for(Y=1;Y<xe;++Y)ke[Y]===Y&&(se!==-1&&ke[se]!==se?ke[Y]=ke[se]:te!==-1&&ke[te]!==te&&(ke[Y]=ke[te]));for(Y=1;Y<xe;++Y)if(W[Y].type!==0){if(re=Y,re!=ke[re])do re=ke[re],ce[Y]=ce[re]+"/"+ce[Y];while(re!==0&&ke[re]!==-1&&re!=ke[re]);ke[Y]=-1}for(ce[0]+="/",Y=1;Y<xe;++Y)W[Y].type!==2&&(ce[Y]+="/")}function N(W,ce,I){for(var Y=W.start,te=W.size,se=[],Ee=Y;I&&te>0&&Ee>=0;)se.push(ce.slice(Ee*ie,Ee*ie+ie)),te-=ie,Ee=Jl(I,Ee*4);return se.length===0?Ge(0):Lr(se).slice(0,W.size)}function S(W,ce,I,Y,te){var se=he;if(W===he){if(ce!==0)throw new Error("DIFAT chain shorter than expected")}else if(W!==-1){var Ee=I[W],re=(Y>>>2)-1;if(!Ee)return;for(var xe=0;xe<re&&(se=Jl(Ee,xe*4))!==he;++xe)te.push(se);S(Jl(Ee,Y-4),ce-1,I,Y,te)}}function A(W,ce,I,Y,te){var se=[],Ee=[];te||(te=[]);var re=Y-1,xe=0,ke=0;for(xe=ce;xe>=0;){te[xe]=!0,se[se.length]=xe,Ee.push(W[xe]);var Ce=I[Math.floor(xe*4/Y)];if(ke=xe*4&re,Y<4+ke)throw new Error("FAT boundary crossed: "+xe+" 4 "+Y);if(!W[Ce])break;xe=Jl(W[Ce],ke)}return{nodes:se,data:kv([Ee])}}function C(W,ce,I,Y){var te=W.length,se=[],Ee=[],re=[],xe=[],ke=Y-1,Ce=0,Qe=0,lt=0,dt=0;for(Ce=0;Ce<te;++Ce)if(re=[],lt=Ce+ce,lt>=te&&(lt-=te),!Ee[lt]){xe=[];var nt=[];for(Qe=lt;Qe>=0;){nt[Qe]=!0,Ee[Qe]=!0,re[re.length]=Qe,xe.push(W[Qe]);var mt=I[Math.floor(Qe*4/Y)];if(dt=Qe*4&ke,Y<4+dt)throw new Error("FAT boundary crossed: "+Qe+" 4 "+Y);if(!W[mt]||(Qe=Jl(W[mt],dt),nt[Qe]))break}se[lt]={nodes:re,data:kv([xe])}}return se}function O(W,ce,I,Y,te,se,Ee,re){for(var xe=0,ke=Y.length?2:0,Ce=ce[W].data,Qe=0,lt=0,dt;Qe<Ce.length;Qe+=128){var nt=Ce.slice(Qe,Qe+128);Dn(nt,64),lt=nt.read_shift(2),dt=Cp(nt,0,lt-ke),Y.push(dt);var mt={name:dt,type:nt.read_shift(1),color:nt.read_shift(1),L:nt.read_shift(4,"i"),R:nt.read_shift(4,"i"),C:nt.read_shift(4,"i"),clsid:nt.read_shift(16),state:nt.read_shift(4,"i"),start:0,size:0},St=nt.read_shift(2)+nt.read_shift(2)+nt.read_shift(2)+nt.read_shift(2);St!==0&&(mt.ct=P(nt,nt.l-8));var ya=nt.read_shift(2)+nt.read_shift(2)+nt.read_shift(2)+nt.read_shift(2);ya!==0&&(mt.mt=P(nt,nt.l-8)),mt.start=nt.read_shift(4,"i"),mt.size=nt.read_shift(4,"i"),mt.size<0&&mt.start<0&&(mt.size=mt.type=0,mt.start=he,mt.name=""),mt.type===5?(xe=mt.start,te>0&&xe!==he&&(ce[xe].name="!StreamData")):mt.size>=4096?(mt.storage="fat",ce[mt.start]===void 0&&(ce[mt.start]=A(I,mt.start,ce.fat_addrs,ce.ssz)),ce[mt.start].name=mt.name,mt.content=ce[mt.start].data.slice(0,mt.size)):(mt.storage="minifat",mt.size<0?mt.size=0:xe!==he&&mt.start!==he&&ce[xe]&&(mt.content=N(mt,ce[xe].data,(ce[re]||{}).data))),mt.content&&Dn(mt.content,0),se[dt]=mt,Ee.push(mt)}}function P(W,ce){return new Date((Rn(W,ce+4)/1e7*Math.pow(2,32)+Rn(W,ce)/1e7-11644473600)*1e3)}function B(W,ce){return g(),x(p.readFileSync(W),ce)}function V(W,ce){var I=ce&&ce.type;switch(I||pa&&Buffer.isBuffer(W)&&(I="buffer"),I||"base64"){case"file":return B(W,ce);case"base64":return x(ys(bi(W)),ce);case"binary":return x(ys(W),ce)}return x(W,ce)}function z(W,ce){var I=ce||{},Y=I.root||"Root Entry";if(W.FullPaths||(W.FullPaths=[]),W.FileIndex||(W.FileIndex=[]),W.FullPaths.length!==W.FileIndex.length)throw new Error("inconsistent CFB structure");W.FullPaths.length===0&&(W.FullPaths[0]=Y+"/",W.FileIndex[0]={name:Y,type:5}),I.CLSID&&(W.FileIndex[0].clsid=I.CLSID),U(W)}function U(W){var ce="Sh33tJ5";if(!La.find(W,"/"+ce)){var I=Ge(4);I[0]=55,I[1]=I[3]=50,I[2]=54,W.FileIndex.push({name:ce,type:2,content:I,size:4,L:69,R:69,C:69}),W.FullPaths.push(W.FullPaths[0]+ce),J(W)}}function J(W,ce){z(W);for(var I=!1,Y=!1,te=W.FullPaths.length-1;te>=0;--te){var se=W.FileIndex[te];switch(se.type){case 0:Y?I=!0:(W.FileIndex.pop(),W.FullPaths.pop());break;case 1:case 2:case 5:Y=!0,isNaN(se.R*se.L*se.C)&&(I=!0),se.R>-1&&se.L>-1&&se.R==se.L&&(I=!0);break;default:I=!0;break}}if(!(!I&&!ce)){var Ee=new Date(1987,1,19),re=0,xe=Object.create?Object.create(null):{},ke=[];for(te=0;te<W.FullPaths.length;++te)xe[W.FullPaths[te]]=!0,W.FileIndex[te].type!==0&&ke.push([W.FullPaths[te],W.FileIndex[te]]);for(te=0;te<ke.length;++te){var Ce=s(ke[te][0]);Y=xe[Ce],Y||(ke.push([Ce,{name:i(Ce).replace("/",""),type:1,clsid:ee,ct:Ee,mt:Ee,content:null}]),xe[Ce]=!0)}for(ke.sort(function(dt,nt){return r(dt[0],nt[0])}),W.FullPaths=[],W.FileIndex=[],te=0;te<ke.length;++te)W.FullPaths[te]=ke[te][0],W.FileIndex[te]=ke[te][1];for(te=0;te<ke.length;++te){var Qe=W.FileIndex[te],lt=W.FullPaths[te];if(Qe.name=i(lt).replace("/",""),Qe.L=Qe.R=Qe.C=-(Qe.color=1),Qe.size=Qe.content?Qe.content.length:0,Qe.start=0,Qe.clsid=Qe.clsid||ee,te===0)Qe.C=ke.length>1?1:-1,Qe.size=0,Qe.type=5;else if(lt.slice(-1)=="/"){for(re=te+1;re<ke.length&&s(W.FullPaths[re])!=lt;++re);for(Qe.C=re>=ke.length?-1:re,re=te+1;re<ke.length&&s(W.FullPaths[re])!=s(lt);++re);Qe.R=re>=ke.length?-1:re,Qe.type=1}else s(W.FullPaths[te+1]||"")==s(lt)&&(Qe.R=te+1),Qe.type=2}}}function de(W,ce){var I=ce||{};if(I.fileType=="mad")return Zs(W,I);switch(J(W),I.fileType){case"zip":return st(W,I)}var Y=(function(dt){for(var nt=0,mt=0,St=0;St<dt.FileIndex.length;++St){var ya=dt.FileIndex[St];if(ya.content){var ta=ya.content.length;ta>0&&(ta<4096?nt+=ta+63>>6:mt+=ta+511>>9)}}for(var Ra=dt.FullPaths.length+3>>2,Ir=nt+7>>3,wn=nt+127>>7,ns=Ir+mt+Ra+wn,kn=ns+127>>7,ss=kn<=109?0:Math.ceil((kn-109)/127);ns+kn+ss+127>>7>kn;)ss=++kn<=109?0:Math.ceil((kn-109)/127);var $t=[1,ss,kn,wn,Ra,mt,nt,0];return dt.FileIndex[0].size=nt<<6,$t[7]=(dt.FileIndex[0].start=$t[0]+$t[1]+$t[2]+$t[3]+$t[4]+$t[5])+($t[6]+7>>3),$t})(W),te=Ge(Y[7]<<9),se=0,Ee=0;{for(se=0;se<8;++se)te.write_shift(1,me[se]);for(se=0;se<8;++se)te.write_shift(2,0);for(te.write_shift(2,62),te.write_shift(2,3),te.write_shift(2,65534),te.write_shift(2,9),te.write_shift(2,6),se=0;se<3;++se)te.write_shift(2,0);for(te.write_shift(4,0),te.write_shift(4,Y[2]),te.write_shift(4,Y[0]+Y[1]+Y[2]+Y[3]-1),te.write_shift(4,0),te.write_shift(4,4096),te.write_shift(4,Y[3]?Y[0]+Y[1]+Y[2]-1:he),te.write_shift(4,Y[3]),te.write_shift(-4,Y[1]?Y[0]-1:he),te.write_shift(4,Y[1]),se=0;se<109;++se)te.write_shift(-4,se<Y[2]?Y[1]+se:-1)}if(Y[1])for(Ee=0;Ee<Y[1];++Ee){for(;se<236+Ee*127;++se)te.write_shift(-4,se<Y[2]?Y[1]+se:-1);te.write_shift(-4,Ee===Y[1]-1?he:Ee+1)}var re=function(dt){for(Ee+=dt;se<Ee-1;++se)te.write_shift(-4,se+1);dt&&(++se,te.write_shift(-4,he))};for(Ee=se=0,Ee+=Y[1];se<Ee;++se)te.write_shift(-4,q.DIFSECT);for(Ee+=Y[2];se<Ee;++se)te.write_shift(-4,q.FATSECT);re(Y[3]),re(Y[4]);for(var xe=0,ke=0,Ce=W.FileIndex[0];xe<W.FileIndex.length;++xe)Ce=W.FileIndex[xe],Ce.content&&(ke=Ce.content.length,!(ke<4096)&&(Ce.start=Ee,re(ke+511>>9)));for(re(Y[6]+7>>3);te.l&511;)te.write_shift(-4,q.ENDOFCHAIN);for(Ee=se=0,xe=0;xe<W.FileIndex.length;++xe)Ce=W.FileIndex[xe],Ce.content&&(ke=Ce.content.length,!(!ke||ke>=4096)&&(Ce.start=Ee,re(ke+63>>6)));for(;te.l&511;)te.write_shift(-4,q.ENDOFCHAIN);for(se=0;se<Y[4]<<2;++se){var Qe=W.FullPaths[se];if(!Qe||Qe.length===0){for(xe=0;xe<17;++xe)te.write_shift(4,0);for(xe=0;xe<3;++xe)te.write_shift(4,-1);for(xe=0;xe<12;++xe)te.write_shift(4,0);continue}Ce=W.FileIndex[se],se===0&&(Ce.start=Ce.size?Ce.start-1:he);var lt=se===0&&I.root||Ce.name;if(ke=2*(lt.length+1),te.write_shift(64,lt,"utf16le"),te.write_shift(2,ke),te.write_shift(1,Ce.type),te.write_shift(1,Ce.color),te.write_shift(-4,Ce.L),te.write_shift(-4,Ce.R),te.write_shift(-4,Ce.C),Ce.clsid)te.write_shift(16,Ce.clsid,"hex");else for(xe=0;xe<4;++xe)te.write_shift(4,0);te.write_shift(4,Ce.state||0),te.write_shift(4,0),te.write_shift(4,0),te.write_shift(4,0),te.write_shift(4,0),te.write_shift(4,Ce.start),te.write_shift(4,Ce.size),te.write_shift(4,0)}for(se=1;se<W.FileIndex.length;++se)if(Ce=W.FileIndex[se],Ce.size>=4096)if(te.l=Ce.start+1<<9,pa&&Buffer.isBuffer(Ce.content))Ce.content.copy(te,te.l,0,Ce.size),te.l+=Ce.size+511&-512;else{for(xe=0;xe<Ce.size;++xe)te.write_shift(1,Ce.content[xe]);for(;xe&511;++xe)te.write_shift(1,0)}for(se=1;se<W.FileIndex.length;++se)if(Ce=W.FileIndex[se],Ce.size>0&&Ce.size<4096)if(pa&&Buffer.isBuffer(Ce.content))Ce.content.copy(te,te.l,0,Ce.size),te.l+=Ce.size+63&-64;else{for(xe=0;xe<Ce.size;++xe)te.write_shift(1,Ce.content[xe]);for(;xe&63;++xe)te.write_shift(1,0)}if(pa)te.l=te.length;else for(;te.l<te.length;)te.write_shift(1,0);return te}function ye(W,ce){var I=W.FullPaths.map(function(xe){return xe.toUpperCase()}),Y=I.map(function(xe){var ke=xe.split("/");return ke[ke.length-(xe.slice(-1)=="/"?2:1)]}),te=!1;ce.charCodeAt(0)===47?(te=!0,ce=I[0].slice(0,-1)+ce):te=ce.indexOf("/")!==-1;var se=ce.toUpperCase(),Ee=te===!0?I.indexOf(se):Y.indexOf(se);if(Ee!==-1)return W.FileIndex[Ee];var re=!se.match(af);for(se=se.replace(qd,""),re&&(se=se.replace(af,"!")),Ee=0;Ee<I.length;++Ee)if((re?I[Ee].replace(af,"!"):I[Ee]).replace(qd,"")==se||(re?Y[Ee].replace(af,"!"):Y[Ee]).replace(qd,"")==se)return W.FileIndex[Ee];return null}var ie=64,he=-2,ve="d0cf11e0a1b11ae1",me=[208,207,17,224,161,177,26,225],ee="00000000000000000000000000000000",q={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:he,FREESECT:-1,HEADER_SIGNATURE:ve,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:ee,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function Q(W,ce,I){g();var Y=de(W,I);p.writeFileSync(ce,Y)}function fe(W){for(var ce=new Array(W.length),I=0;I<W.length;++I)ce[I]=String.fromCharCode(W[I]);return ce.join("")}function ae(W,ce){var I=de(W,ce);switch(ce&&ce.type||"buffer"){case"file":return g(),p.writeFileSync(ce.filename,I),I;case"binary":return typeof I=="string"?I:fe(I);case"base64":return n0(typeof I=="string"?I:fe(I));case"buffer":if(pa)return Buffer.isBuffer(I)?I:ki(I);case"array":return typeof I=="string"?ys(I):I}return I}var F;function D(W){try{var ce=W.InflateRaw,I=new ce;if(I._processChunk(new Uint8Array([3,0]),I._finishFlushFlag),I.bytesRead)F=W;else throw new Error("zlib does not expose bytesRead")}catch(Y){console.error("cannot use native zlib: "+(Y.message||Y))}}function H(W,ce){if(!F)return ia(W,ce);var I=F.InflateRaw,Y=new I,te=Y._processChunk(W.slice(W.l),Y._finishFlushFlag);return W.l+=Y.bytesRead,te}function Z(W){return F?F.deflateRawSync(W):it(W)}var K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ue=[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],Le=[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(W){var ce=(W<<1|W<<11)&139536|(W<<5|W<<15)&558144;return(ce>>16|ce>>8|ce)&255}for(var We=typeof Uint8Array!="undefined",Fe=We?new Uint8Array(256):[],tt=0;tt<256;++tt)Fe[tt]=Ne(tt);function ft(W,ce){var I=Fe[W&255];return ce<=8?I>>>8-ce:(I=I<<8|Fe[W>>8&255],ce<=16?I>>>16-ce:(I=I<<8|Fe[W>>16&255],I>>>24-ce))}function Dt(W,ce){var I=ce&7,Y=ce>>>3;return(W[Y]|(I<=6?0:W[Y+1]<<8))>>>I&3}function Ve(W,ce){var I=ce&7,Y=ce>>>3;return(W[Y]|(I<=5?0:W[Y+1]<<8))>>>I&7}function At(W,ce){var I=ce&7,Y=ce>>>3;return(W[Y]|(I<=4?0:W[Y+1]<<8))>>>I&15}function jt(W,ce){var I=ce&7,Y=ce>>>3;return(W[Y]|(I<=3?0:W[Y+1]<<8))>>>I&31}function He(W,ce){var I=ce&7,Y=ce>>>3;return(W[Y]|(I<=1?0:W[Y+1]<<8))>>>I&127}function oe(W,ce,I){var Y=ce&7,te=ce>>>3,se=(1<<I)-1,Ee=W[te]>>>Y;return I<8-Y||(Ee|=W[te+1]<<8-Y,I<16-Y)||(Ee|=W[te+2]<<16-Y,I<24-Y)||(Ee|=W[te+3]<<24-Y),Ee&se}function we(W,ce,I){var Y=ce&7,te=ce>>>3;return Y<=5?W[te]|=(I&7)<<Y:(W[te]|=I<<Y&255,W[te+1]=(I&7)>>8-Y),ce+3}function Ie(W,ce,I){var Y=ce&7,te=ce>>>3;return I=(I&1)<<Y,W[te]|=I,ce+1}function ot(W,ce,I){var Y=ce&7,te=ce>>>3;return I<<=Y,W[te]|=I&255,I>>>=8,W[te+1]=I,ce+8}function bt(W,ce,I){var Y=ce&7,te=ce>>>3;return I<<=Y,W[te]|=I&255,I>>>=8,W[te+1]=I&255,W[te+2]=I>>>8,ce+16}function qe(W,ce){var I=W.length,Y=2*I>ce?2*I:ce+5,te=0;if(I>=ce)return W;if(pa){var se=ov(Y);if(W.copy)W.copy(se);else for(;te<W.length;++te)se[te]=W[te];return se}else if(We){var Ee=new Uint8Array(Y);if(Ee.set)Ee.set(W);else for(;te<I;++te)Ee[te]=W[te];return Ee}return W.length=Y,W}function Ue(W){for(var ce=new Array(W),I=0;I<W;++I)ce[I]=0;return ce}function ht(W,ce,I){var Y=1,te=0,se=0,Ee=0,re=0,xe=W.length,ke=We?new Uint16Array(32):Ue(32);for(se=0;se<32;++se)ke[se]=0;for(se=xe;se<I;++se)W[se]=0;xe=W.length;var Ce=We?new Uint16Array(xe):Ue(xe);for(se=0;se<xe;++se)ke[te=W[se]]++,Y<te&&(Y=te),Ce[se]=0;for(ke[0]=0,se=1;se<=Y;++se)ke[se+16]=re=re+ke[se-1]<<1;for(se=0;se<xe;++se)re=W[se],re!=0&&(Ce[se]=ke[re+16]++);var Qe=0;for(se=0;se<xe;++se)if(Qe=W[se],Qe!=0)for(re=ft(Ce[se],Y)>>Y-Qe,Ee=(1<<Y+4-Qe)-1;Ee>=0;--Ee)ce[re|Ee<<Qe]=Qe&15|se<<4;return Y}var wt=We?new Uint16Array(512):Ue(512),Mt=We?new Uint16Array(32):Ue(32);if(!We){for(var Ft=0;Ft<512;++Ft)wt[Ft]=0;for(Ft=0;Ft<32;++Ft)Mt[Ft]=0}(function(){for(var W=[],ce=0;ce<32;ce++)W.push(5);ht(W,Mt,32);var I=[];for(ce=0;ce<=143;ce++)I.push(8);for(;ce<=255;ce++)I.push(9);for(;ce<=279;ce++)I.push(7);for(;ce<=287;ce++)I.push(8);ht(I,wt,288)})();var je=(function(){for(var ce=We?new Uint8Array(32768):[],I=0,Y=0;I<Le.length-1;++I)for(;Y<Le[I+1];++Y)ce[Y]=I;for(;Y<32768;++Y)ce[Y]=29;var te=We?new Uint8Array(259):[];for(I=0,Y=0;I<ue.length-1;++I)for(;Y<ue[I+1];++Y)te[Y]=I;function se(re,xe){for(var ke=0;ke<re.length;){var Ce=Math.min(65535,re.length-ke),Qe=ke+Ce==re.length;for(xe.write_shift(1,+Qe),xe.write_shift(2,Ce),xe.write_shift(2,~Ce&65535);Ce-- >0;)xe[xe.l++]=re[ke++]}return xe.l}function Ee(re,xe){for(var ke=0,Ce=0,Qe=We?new Uint16Array(32768):[];Ce<re.length;){var lt=Math.min(65535,re.length-Ce);if(lt<10){for(ke=we(xe,ke,+(Ce+lt==re.length)),ke&7&&(ke+=8-(ke&7)),xe.l=ke/8|0,xe.write_shift(2,lt),xe.write_shift(2,~lt&65535);lt-- >0;)xe[xe.l++]=re[Ce++];ke=xe.l*8;continue}ke=we(xe,ke,+(Ce+lt==re.length)+2);for(var dt=0;lt-- >0;){var nt=re[Ce];dt=(dt<<5^nt)&32767;var mt=-1,St=0;if((mt=Qe[dt])&&(mt|=Ce&-32768,mt>Ce&&(mt-=32768),mt<Ce))for(;re[mt+St]==re[Ce+St]&&St<250;)++St;if(St>2){nt=te[St],nt<=22?ke=ot(xe,ke,Fe[nt+1]>>1)-1:(ot(xe,ke,3),ke+=5,ot(xe,ke,Fe[nt-23]>>5),ke+=3);var ya=nt<8?0:nt-4>>2;ya>0&&(bt(xe,ke,St-ue[nt]),ke+=ya),nt=ce[Ce-mt],ke=ot(xe,ke,Fe[nt]>>3),ke-=3;var ta=nt<4?0:nt-2>>1;ta>0&&(bt(xe,ke,Ce-mt-Le[nt]),ke+=ta);for(var Ra=0;Ra<St;++Ra)Qe[dt]=Ce&32767,dt=(dt<<5^re[Ce])&32767,++Ce;lt-=St-1}else nt<=143?nt=nt+48:ke=Ie(xe,ke,1),ke=ot(xe,ke,Fe[nt]),Qe[dt]=Ce&32767,++Ce}ke=ot(xe,ke,0)-1}return xe.l=(ke+7)/8|0,xe.l}return function(xe,ke){return xe.length<8?se(xe,ke):Ee(xe,ke)}})();function it(W){var ce=Ge(50+Math.floor(W.length*1.1)),I=je(W,ce);return ce.slice(0,I)}var vt=We?new Uint16Array(32768):Ue(32768),Bt=We?new Uint16Array(32768):Ue(32768),De=We?new Uint16Array(128):Ue(128),ct=1,ut=1;function Nt(W,ce){var I=jt(W,ce)+257;ce+=5;var Y=jt(W,ce)+1;ce+=5;var te=At(W,ce)+4;ce+=4;for(var se=0,Ee=We?new Uint8Array(19):Ue(19),re=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],xe=1,ke=We?new Uint8Array(8):Ue(8),Ce=We?new Uint8Array(8):Ue(8),Qe=Ee.length,lt=0;lt<te;++lt)Ee[K[lt]]=se=Ve(W,ce),xe<se&&(xe=se),ke[se]++,ce+=3;var dt=0;for(ke[0]=0,lt=1;lt<=xe;++lt)Ce[lt]=dt=dt+ke[lt-1]<<1;for(lt=0;lt<Qe;++lt)(dt=Ee[lt])!=0&&(re[lt]=Ce[dt]++);var nt=0;for(lt=0;lt<Qe;++lt)if(nt=Ee[lt],nt!=0){dt=Fe[re[lt]]>>8-nt;for(var mt=(1<<7-nt)-1;mt>=0;--mt)De[dt|mt<<nt]=nt&7|lt<<3}var St=[];for(xe=1;St.length<I+Y;)switch(dt=De[He(W,ce)],ce+=dt&7,dt>>>=3){case 16:for(se=3+Dt(W,ce),ce+=2,dt=St[St.length-1];se-- >0;)St.push(dt);break;case 17:for(se=3+Ve(W,ce),ce+=3;se-- >0;)St.push(0);break;case 18:for(se=11+He(W,ce),ce+=7;se-- >0;)St.push(0);break;default:St.push(dt),xe<dt&&(xe=dt);break}var ya=St.slice(0,I),ta=St.slice(I);for(lt=I;lt<286;++lt)ya[lt]=0;for(lt=Y;lt<30;++lt)ta[lt]=0;return ct=ht(ya,vt,286),ut=ht(ta,Bt,30),ce}function Rt(W,ce){if(W[0]==3&&!(W[1]&3))return[lo(ce),2];for(var I=0,Y=0,te=ov(ce||1<<18),se=0,Ee=te.length>>>0,re=0,xe=0;(Y&1)==0;){if(Y=Ve(W,I),I+=3,Y>>>1)Y>>1==1?(re=9,xe=5):(I=Nt(W,I),re=ct,xe=ut);else{I&7&&(I+=8-(I&7));var ke=W[I>>>3]|W[(I>>>3)+1]<<8;if(I+=32,ke>0)for(!ce&&Ee<se+ke&&(te=qe(te,se+ke),Ee=te.length);ke-- >0;)te[se++]=W[I>>>3],I+=8;continue}for(;;){!ce&&Ee<se+32767&&(te=qe(te,se+32767),Ee=te.length);var Ce=oe(W,I,re),Qe=Y>>>1==1?wt[Ce]:vt[Ce];if(I+=Qe&15,Qe>>>=4,(Qe>>>8&255)===0)te[se++]=Qe;else{if(Qe==256)break;Qe-=257;var lt=Qe<8?0:Qe-4>>2;lt>5&&(lt=0);var dt=se+ue[Qe];lt>0&&(dt+=oe(W,I,lt),I+=lt),Ce=oe(W,I,xe),Qe=Y>>>1==1?Mt[Ce]:Bt[Ce],I+=Qe&15,Qe>>>=4;var nt=Qe<4?0:Qe-2>>1,mt=Le[Qe];for(nt>0&&(mt+=oe(W,I,nt),I+=nt),!ce&&Ee<dt&&(te=qe(te,dt+100),Ee=te.length);se<dt;)te[se]=te[se-mt],++se}}}return ce?[te,I+7>>>3]:[te.slice(0,se),I+7>>>3]}function ia(W,ce){var I=W.slice(W.l||0),Y=Rt(I,ce);return W.l+=Y[1],Y[0]}function et(W,ce){if(W)typeof console!="undefined"&&console.error(ce);else throw new Error(ce)}function pe(W,ce){var I=W;Dn(I,0);var Y=[],te=[],se={FileIndex:Y,FullPaths:te};z(se,{root:ce.root});for(var Ee=I.length-4;(I[Ee]!=80||I[Ee+1]!=75||I[Ee+2]!=5||I[Ee+3]!=6)&&Ee>=0;)--Ee;I.l=Ee+4,I.l+=4;var re=I.read_shift(2);I.l+=6;var xe=I.read_shift(4);for(I.l=xe,Ee=0;Ee<re;++Ee){I.l+=20;var ke=I.read_shift(4),Ce=I.read_shift(4),Qe=I.read_shift(2),lt=I.read_shift(2),dt=I.read_shift(2);I.l+=8;var nt=I.read_shift(4),mt=f(I.slice(I.l+Qe,I.l+Qe+lt));I.l+=Qe+lt+dt;var St=I.l;I.l=nt+4,ze(I,ke,Ce,se,mt),I.l=St}return se}function ze(W,ce,I,Y,te){W.l+=2;var se=W.read_shift(2),Ee=W.read_shift(2),re=c(W);if(se&8257)throw new Error("Unsupported ZIP encryption");for(var xe=W.read_shift(4),ke=W.read_shift(4),Ce=W.read_shift(4),Qe=W.read_shift(2),lt=W.read_shift(2),dt="",nt=0;nt<Qe;++nt)dt+=String.fromCharCode(W[W.l++]);if(lt){var mt=f(W.slice(W.l,W.l+lt));(mt[21589]||{}).mt&&(re=mt[21589].mt),((te||{})[21589]||{}).mt&&(re=te[21589].mt)}W.l+=lt;var St=W.slice(W.l,W.l+ke);switch(Ee){case 8:St=H(W,Ce);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+Ee)}var ya=!1;se&8&&(xe=W.read_shift(4),xe==134695760&&(xe=W.read_shift(4),ya=!0),ke=W.read_shift(4),Ce=W.read_shift(4)),ke!=ce&&et(ya,"Bad compressed size: "+ce+" != "+ke),Ce!=I&&et(ya,"Bad uncompressed size: "+I+" != "+Ce),an(Y,dt,St,{unsafe:!0,mt:re})}function st(W,ce){var I=ce||{},Y=[],te=[],se=Ge(1),Ee=I.compression?8:0,re=0,xe=0,ke=0,Ce=0,Qe=0,lt=W.FullPaths[0],dt=lt,nt=W.FileIndex[0],mt=[],St=0;for(xe=1;xe<W.FullPaths.length;++xe)if(dt=W.FullPaths[xe].slice(lt.length),nt=W.FileIndex[xe],!(!nt.size||!nt.content||dt=="Sh33tJ5")){var ya=Ce,ta=Ge(dt.length);for(ke=0;ke<dt.length;++ke)ta.write_shift(1,dt.charCodeAt(ke)&127);ta=ta.slice(0,ta.l),mt[Qe]=eT.buf(nt.content,0);var Ra=nt.content;Ee==8&&(Ra=Z(Ra)),se=Ge(30),se.write_shift(4,67324752),se.write_shift(2,20),se.write_shift(2,re),se.write_shift(2,Ee),nt.mt?d(se,nt.mt):se.write_shift(4,0),se.write_shift(-4,mt[Qe]),se.write_shift(4,Ra.length),se.write_shift(4,nt.content.length),se.write_shift(2,ta.length),se.write_shift(2,0),Ce+=se.length,Y.push(se),Ce+=ta.length,Y.push(ta),Ce+=Ra.length,Y.push(Ra),se=Ge(46),se.write_shift(4,33639248),se.write_shift(2,0),se.write_shift(2,20),se.write_shift(2,re),se.write_shift(2,Ee),se.write_shift(4,0),se.write_shift(-4,mt[Qe]),se.write_shift(4,Ra.length),se.write_shift(4,nt.content.length),se.write_shift(2,ta.length),se.write_shift(2,0),se.write_shift(2,0),se.write_shift(2,0),se.write_shift(2,0),se.write_shift(4,0),se.write_shift(4,ya),St+=se.l,te.push(se),St+=ta.length,te.push(ta),++Qe}return se=Ge(22),se.write_shift(4,101010256),se.write_shift(2,0),se.write_shift(2,0),se.write_shift(2,Qe),se.write_shift(2,Qe),se.write_shift(4,St),se.write_shift(4,Ce),se.write_shift(2,0),Lr([Lr(Y),Lr(te),se])}var Ut={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 la(W,ce){if(W.ctype)return W.ctype;var I=W.name||"",Y=I.match(/\.([^\.]+)$/);return Y&&Ut[Y[1]]||ce&&(Y=(I=ce).match(/[\.\\]([^\.\\])+$/),Y&&Ut[Y[1]])?Ut[Y[1]]:"application/octet-stream"}function va(W){for(var ce=n0(W),I=[],Y=0;Y<ce.length;Y+=76)I.push(ce.slice(Y,Y+76));return I.join(`\r
`)+`\r
`}function ar(W){var ce=W.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(ke){var Ce=ke.charCodeAt(0).toString(16).toUpperCase();return"="+(Ce.length==1?"0"+Ce:Ce)});ce=ce.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),ce.charAt(0)==`
`&&(ce="=0D"+ce.slice(1)),ce=ce.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var I=[],Y=ce.split(`\r
`),te=0;te<Y.length;++te){var se=Y[te];if(se.length==0){I.push("");continue}for(var Ee=0;Ee<se.length;){var re=76,xe=se.slice(Ee,Ee+re);xe.charAt(re-1)=="="?re--:xe.charAt(re-2)=="="?re-=2:xe.charAt(re-3)=="="&&(re-=3),xe=se.slice(Ee,Ee+re),Ee+=re,Ee<se.length&&(xe+="="),I.push(xe)}}return I.join(`\r
`)}function tn(W){for(var ce=[],I=0;I<W.length;++I){for(var Y=W[I];I<=W.length&&Y.charAt(Y.length-1)=="=";)Y=Y.slice(0,Y.length-1)+W[++I];ce.push(Y)}for(var te=0;te<ce.length;++te)ce[te]=ce[te].replace(/[=][0-9A-Fa-f]{2}/g,function(se){return String.fromCharCode(parseInt(se.slice(1),16))});return ys(ce.join(`\r
`))}function Bn(W,ce,I){for(var Y="",te="",se="",Ee,re=0;re<10;++re){var xe=ce[re];if(!xe||xe.match(/^\s*$/))break;var ke=xe.match(/^(.*?):\s*([^\s].*)$/);if(ke)switch(ke[1].toLowerCase()){case"content-location":Y=ke[2].trim();break;case"content-type":se=ke[2].trim();break;case"content-transfer-encoding":te=ke[2].trim();break}}switch(++re,te.toLowerCase()){case"base64":Ee=ys(bi(ce.slice(re).join("")));break;case"quoted-printable":Ee=tn(ce.slice(re));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+te)}var Ce=an(W,Y.slice(I.length),Ee,{unsafe:!0});se&&(Ce.ctype=se)}function Gr(W,ce){if(fe(W.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var I=ce&&ce.root||"",Y=(pa&&Buffer.isBuffer(W)?W.toString("binary"):fe(W)).split(`\r
`),te=0,se="";for(te=0;te<Y.length;++te)if(se=Y[te],!!/^Content-Location:/i.test(se)&&(se=se.slice(se.indexOf("file")),I||(I=se.slice(0,se.lastIndexOf("/")+1)),se.slice(0,I.length)!=I))for(;I.length>0&&(I=I.slice(0,I.length-1),I=I.slice(0,I.lastIndexOf("/")+1),se.slice(0,I.length)!=I););var Ee=(Y[1]||"").match(/boundary="(.*?)"/);if(!Ee)throw new Error("MAD cannot find boundary");var re="--"+(Ee[1]||""),xe=[],ke=[],Ce={FileIndex:xe,FullPaths:ke};z(Ce);var Qe,lt=0;for(te=0;te<Y.length;++te){var dt=Y[te];dt!==re&&dt!==re+"--"||(lt++&&Bn(Ce,Y.slice(Qe,te),I),Qe=te)}return Ce}function Zs(W,ce){var I=ce||{},Y=I.boundary||"SheetJS";Y="------="+Y;for(var te=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+Y.slice(2)+'"',"","",""],se=W.FullPaths[0],Ee=se,re=W.FileIndex[0],xe=1;xe<W.FullPaths.length;++xe)if(Ee=W.FullPaths[xe].slice(se.length),re=W.FileIndex[xe],!(!re.size||!re.content||Ee=="Sh33tJ5")){Ee=Ee.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(St){return"_x"+St.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(St){return"_u"+St.charCodeAt(0).toString(16)+"_"});for(var ke=re.content,Ce=pa&&Buffer.isBuffer(ke)?ke.toString("binary"):fe(ke),Qe=0,lt=Math.min(1024,Ce.length),dt=0,nt=0;nt<=lt;++nt)(dt=Ce.charCodeAt(nt))>=32&&dt<128&&++Qe;var mt=Qe>=lt*4/5;te.push(Y),te.push("Content-Location: "+(I.root||"file:///C:/SheetJS/")+Ee),te.push("Content-Transfer-Encoding: "+(mt?"quoted-printable":"base64")),te.push("Content-Type: "+la(re,Ee)),te.push(""),te.push(mt?ar(Ce):va(Ce))}return te.push(Y+`--\r
`),te.join(`\r
`)}function Ss(W){var ce={};return z(ce,W),ce}function an(W,ce,I,Y){var te=Y&&Y.unsafe;te||z(W);var se=!te&&La.find(W,ce);if(!se){var Ee=W.FullPaths[0];ce.slice(0,Ee.length)==Ee?Ee=ce:(Ee.slice(-1)!="/"&&(Ee+="/"),Ee=(Ee+ce).replace("//","/")),se={name:i(ce),type:2},W.FileIndex.push(se),W.FullPaths.push(Ee),te||La.utils.cfb_gc(W)}return se.content=I,se.size=I?I.length:0,Y&&(Y.CLSID&&(se.clsid=Y.CLSID),Y.mt&&(se.mt=Y.mt),Y.ct&&(se.ct=Y.ct)),se}function _n(W,ce){z(W);var I=La.find(W,ce);if(I){for(var Y=0;Y<W.FileIndex.length;++Y)if(W.FileIndex[Y]==I)return W.FileIndex.splice(Y,1),W.FullPaths.splice(Y,1),!0}return!1}function rr(W,ce,I){z(W);var Y=La.find(W,ce);if(Y){for(var te=0;te<W.FileIndex.length;++te)if(W.FileIndex[te]==Y)return W.FileIndex[te].name=i(I),W.FullPaths[te]=I,!0}return!1}function Et(W){J(W,!0)}return t.find=ye,t.read=V,t.parse=x,t.write=ae,t.writeFile=Q,t.utils={cfb_new:Ss,cfb_add:an,cfb_del:_n,cfb_mov:rr,cfb_gc:Et,ReadShift:Xd,CheckField:G2,prep_blob:Dn,bconcat:Lr,use_zlib:D,_deflateRaw:it,_inflateRaw:ia,consts:q},t})();function tT(e){return typeof e=="string"?eh(e):Array.isArray(e)?T5(e):e}function w0(e,t,r){if(typeof Deno!="undefined"){if(r&&typeof t=="string")switch(r){case"utf8":t=new TextEncoder(r).encode(t);break;case"binary":t=eh(t);break;default:throw new Error("Unsupported encoding "+r)}return Deno.writeFileSync(e,t)}var s=r=="utf8"?i0(t):t;if(typeof IE_SaveFile!="undefined")return IE_SaveFile(s,e);if(typeof Blob!="undefined"){var i=new Blob([tT(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(p){if(!p.message||!p.message.match(/onstruct/))throw p}throw new Error("cannot save file "+e)}function Fr(e){for(var t=Object.keys(e),r=[],s=0;s<t.length;++s)Object.prototype.hasOwnProperty.call(e,t[s])&&r.push(t[s]);return r}function pv(e,t){for(var r=[],s=Fr(e),i=0;i!==s.length;++i)r[e[s[i]][t]]==null&&(r[e[s[i]][t]]=s[i]);return r}function jp(e){for(var t=[],r=Fr(e),s=0;s!==r.length;++s)t[e[r[s]]]=r[s];return t}function rh(e){for(var t=[],r=Fr(e),s=0;s!==r.length;++s)t[e[r[s]]]=parseInt(r[s],10);return t}function aT(e){for(var t=[],r=Fr(e),s=0;s!==r.length;++s)t[e[r[s]]]==null&&(t[e[r[s]]]=[]),t[e[r[s]]].push(r[s]);return t}var Mf=new Date(1899,11,30,0,0,0);function bn(e,t){var r=e.getTime(),s=Mf.getTime()+(e.getTimezoneOffset()-Mf.getTimezoneOffset())*6e4;return(r-s)/(1440*60*1e3)}var C2=new Date,rT=Mf.getTime()+(C2.getTimezoneOffset()-Mf.getTimezoneOffset())*6e4,xv=C2.getTimezoneOffset();function A2(e){var t=new Date;return t.setTime(e*24*60*60*1e3+rT),t.getTimezoneOffset()!==xv&&t.setTime(t.getTime()+(t.getTimezoneOffset()-xv)*6e4),t}var yv=new Date("2017-02-19T19:06:09.000Z"),O2=isNaN(yv.getFullYear())?new Date("2/19/17"):yv,nT=O2.getFullYear()==2017;function Qr(e,t){var r=new Date(e);if(nT)return t>0?r.setTime(r.getTime()+r.getTimezoneOffset()*60*1e3):t<0&&r.setTime(r.getTime()-r.getTimezoneOffset()*60*1e3),r;if(e instanceof Date)return e;if(O2.getFullYear()==1917&&!isNaN(r.getFullYear())){var s=r.getFullYear();return e.indexOf(""+s)>-1||r.setFullYear(r.getFullYear()+100),r}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 nh(e,t){if(pa&&Buffer.isBuffer(e))return e.toString("binary");if(typeof TextDecoder!="undefined")try{var r={"€":"€","":"‚",ƒ:"ƒ","„":"„","…":"…","†":"†","‡":"‡","ˆ":"ˆ","‰":"‰",Š:"Š","":"‹",Œ:"Œ",Ž:"Ž","":"‘","":"’","“":"“","”":"”","•":"•","":"–","—":"—","˜":"˜","™":"™",š:"š","":"›",œ:"œ",ž:"ž",Ÿ:"Ÿ"};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(d){return r[d]||d})}catch(d){}for(var s=[],i=0;i!=e.length;++i)s.push(String.fromCharCode(e[i]));return s.join("")}function vn(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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=vn(e[r]));return t}function Ja(e,t){for(var r="";r.length<t;)r+=e;return r}function gi(e){var t=Number(e);if(!isNaN(t))return isFinite(t)?t:NaN;if(!/\d/.test(e))return t;var r=1,s=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return r*=100,""});return!isNaN(t=Number(s))||(s=s.replace(/[(](.*)[)]/,function(i,d){return r=-r,d}),!isNaN(t=Number(s)))?t/r:t}var sT=["january","february","march","april","may","june","july","august","september","october","november","december"];function s0(e){var t=new Date(e),r=new Date(NaN),s=t.getYear(),i=t.getMonth(),d=t.getDate();if(isNaN(d))return r;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&&sT.indexOf(c)==-1)return r}else if(c.match(/[a-z]/))return r;return s<0||s>8099?r:(i>0||d>1)&&s!=101?t:e.match(/[^-0-9:,\/\\]/)?r:t}function Jt(e,t,r){if(e.FullPaths){if(typeof r=="string"){var s;return pa?s=ki(r):s=E5(r),La.utils.cfb_add(e,t,s)}La.utils.cfb_add(e,t,r)}else e.file(t,r)}function Sp(){return La.utils.cfb_new()}var dr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,iT={"&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<","&amp;":"&"},Tp=jp(iT),Ep=/[&<>'"]/g,lT=/[\u0000-\u0008\u000b-\u001f]/g;function ja(e){var t=e+"";return t.replace(Ep,function(r){return Tp[r]}).replace(lT,function(r){return"_x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+"_"})}function bv(e){return ja(e).replace(/ /g,"_x0020_")}var M2=/[\u0000-\u001f]/g;function oT(e){var t=e+"";return t.replace(Ep,function(r){return Tp[r]}).replace(/\n/g,"<br/>").replace(M2,function(r){return"&#x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+";"})}function cT(e){var t=e+"";return t.replace(Ep,function(r){return Tp[r]}).replace(M2,function(r){return"&#x"+r.charCodeAt(0).toString(16).toUpperCase()+";"})}function dT(e){return e.replace(/(\r\n|[\r\n])/g,"&#10;")}function uT(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function Cg(e){for(var t="",r=0,s=0,i=0,d=0,c=0,f=0;r<e.length;){if(s=e.charCodeAt(r++),s<128){t+=String.fromCharCode(s);continue}if(i=e.charCodeAt(r++),s>191&&s<224){c=(s&31)<<6,c|=i&63,t+=String.fromCharCode(c);continue}if(d=e.charCodeAt(r++),s<240){t+=String.fromCharCode((s&15)<<12|(i&63)<<6|d&63);continue}c=e.charCodeAt(r++),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 vv(e){var t=lo(2*e.length),r,s,i=1,d=0,c=0,f;for(s=0;s<e.length;s+=i)i=1,(f=e.charCodeAt(s))<128?r=f:f<224?(r=(f&31)*64+(e.charCodeAt(s+1)&63),i=2):f<240?(r=(f&15)*4096+(e.charCodeAt(s+1)&63)*64+(e.charCodeAt(s+2)&63),i=3):(i=4,r=(f&7)*262144+(e.charCodeAt(s+1)&63)*4096+(e.charCodeAt(s+2)&63)*64+(e.charCodeAt(s+3)&63),r-=65536,c=55296+(r>>>10&1023),r=56320+(r&1023)),c!==0&&(t[d++]=c&255,t[d++]=c>>>8,c=0),t[d++]=r%256,t[d++]=r>>>8;return t.slice(0,d).toString("ucs2")}function _v(e){return ki(e,"binary").toString("utf8")}var nf="foo bar baz☃🍣",Yd=pa&&(_v(nf)==Cg(nf)&&_v||vv(nf)==Cg(nf)&&vv)||Cg,i0=pa?function(e){return ki(e,"utf8").toString("binary")}:function(e){for(var t=[],r=0,s=0,i=0;r<e.length;)switch(s=e.charCodeAt(r++),!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(r++)-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("")},fT=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(t){return[new RegExp("&"+t[0]+";","ig"),t[1]]});return function(r){for(var s=r.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}})(),L2=/(^\s|\s$|\n)/;function Dr(e,t){return"<"+e+(t.match(L2)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function l0(e){return Fr(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function gt(e,t,r){return"<"+e+(r!=null?l0(r):"")+(t!=null?(t.match(L2)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function ep(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(r){if(t)throw r}return""}function hT(e,t){switch(typeof e){case"string":var r=gt("vt:lpwstr",ja(e));return r=r.replace(/&quot;/g,"_x0022_"),r;case"number":return gt((e|0)==e?"vt:i4":"vt:r8",ja(String(e)));case"boolean":return gt("vt:bool",e?"true":"false")}if(e instanceof Date)return gt("vt:filetime",ep(e));throw new Error("Unable to serialize "+e)}var _r={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"],Pn={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 mT(e,t){for(var r=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?r*(1/0):NaN:(s==0?s=-1022:(s-=1023,i+=Math.pow(2,52)),r*Math.pow(2,s-52)*i)}function gT(e,t,r){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[r+f]=d&255;e[r+6]=(i&15)<<4|d&15,e[r+7]=i>>4|s}var wv=function(e){for(var t=[],r=10240,s=0;s<e[0].length;++s)if(e[0][s])for(var i=0,d=e[0][s].length;i<d;i+=r)t.push.apply(t,e[0][s].slice(i,i+r));return t},kv=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:ki(t)})):wv(e)}:wv,Nv=function(e,t,r){for(var s=[],i=t;i<r;i+=2)s.push(String.fromCharCode($d(e,i)));return s.join("").replace(qd,"")},Cp=pa?function(e,t,r){return Buffer.isBuffer(e)?e.toString("utf16le",t,r).replace(qd,""):Nv(e,t,r)}:Nv,jv=function(e,t,r){for(var s=[],i=t;i<t+r;++i)s.push(("0"+e[i].toString(16)).slice(-2));return s.join("")},D2=pa?function(e,t,r){return Buffer.isBuffer(e)?e.toString("hex",t,t+r):jv(e,t,r)}:jv,Sv=function(e,t,r){for(var s=[],i=t;i<r;i++)s.push(String.fromCharCode(uc(e,i)));return s.join("")},k0=pa?function(t,r,s){return Buffer.isBuffer(t)?t.toString("utf8",r,s):Sv(t,r,s)}:Sv,P2=function(e,t){var r=Rn(e,t);return r>0?k0(e,t+4,t+4+r-1):""},R2=P2,F2=function(e,t){var r=Rn(e,t);return r>0?k0(e,t+4,t+4+r-1):""},I2=F2,z2=function(e,t){var r=2*Rn(e,t);return r>0?k0(e,t+4,t+4+r-1):""},B2=z2,U2=function(t,r){var s=Rn(t,r);return s>0?Cp(t,r+4,r+4+s):""},H2=U2,$2=function(e,t){var r=Rn(e,t);return r>0?k0(e,t+4,t+4+r):""},W2=$2,V2=function(e,t){return mT(e,t)},Lf=V2,Ap=function(t){return Array.isArray(t)||typeof Uint8Array!="undefined"&&t instanceof Uint8Array};pa&&(R2=function(t,r){if(!Buffer.isBuffer(t))return P2(t,r);var s=t.readUInt32LE(r);return s>0?t.toString("utf8",r+4,r+4+s-1):""},I2=function(t,r){if(!Buffer.isBuffer(t))return F2(t,r);var s=t.readUInt32LE(r);return s>0?t.toString("utf8",r+4,r+4+s-1):""},B2=function(t,r){if(!Buffer.isBuffer(t))return z2(t,r);var s=2*t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+s-1)},H2=function(t,r){if(!Buffer.isBuffer(t))return U2(t,r);var s=t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+s)},W2=function(t,r){if(!Buffer.isBuffer(t))return $2(t,r);var s=t.readUInt32LE(r);return t.toString("utf8",r+4,r+4+s)},Lf=function(t,r){return Buffer.isBuffer(t)?t.readDoubleLE(r):V2(t,r)},Ap=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]},pT=function(e,t){var r=e[t+1]*256+e[t];return r<32768?r:(65535-r+1)*-1},Rn=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]},xT=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function Xd(e,t){var r="",s,i,d=[],c,f,p,g;switch(t){case"dbcs":if(g=this.l,pa&&Buffer.isBuffer(this))r=this.slice(this.l,this.l+2*e).toString("utf16le");else for(p=0;p<e;++p)r+=String.fromCharCode($d(this,g)),g+=2;e*=2;break;case"utf8":r=k0(this,this.l,this.l+e);break;case"utf16le":e*=2,r=Cp(this,this.l,this.l+e);break;case"wstr":return Xd.call(this,e,"dbcs");case"lpstr-ansi":r=R2(this,this.l),e=4+Rn(this,this.l);break;case"lpstr-cp":r=I2(this,this.l),e=4+Rn(this,this.l);break;case"lpwstr":r=B2(this,this.l),e=4+2*Rn(this,this.l);break;case"lpp4":e=4+Rn(this,this.l),r=H2(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+Rn(this,this.l),r=W2(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,r="";(c=uc(this,this.l+e++))!==0;)d.push(tf(c));r=d.join("");break;case"_wstr":for(e=0,r="";(c=$d(this,this.l+e))!==0;)d.push(tf(c)),e+=2;e+=2,r=d.join("");break;case"dbcs-cont":for(r="",g=this.l,p=0;p<e;++p){if(this.lens&&this.lens.indexOf(g)!==-1)return c=uc(this,g),this.l=g+1,f=Xd.call(this,e-p,c?"dbcs-cont":"sbcs-cont"),d.join("")+f;d.push(tf($d(this,g))),g+=2}r=d.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(r="",g=this.l,p=0;p!=e;++p){if(this.lens&&this.lens.indexOf(g)!==-1)return c=uc(this,g),this.l=g+1,f=Xd.call(this,e-p,c?"dbcs-cont":"sbcs-cont"),d.join("")+f;d.push(tf(uc(this,g))),g+=1}r=d.join("");break;default:switch(e){case 1:return s=uc(this,this.l),this.l++,s;case 2:return s=(t==="i"?pT:$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:xT)(this,this.l),this.l+=4,s):(i=Rn(this,this.l),this.l+=4,i);case 8:case-8:if(t==="f")return e==8?i=Lf(this,this.l):i=Lf([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:r=D2(this,this.l,e);break}}return this.l+=e,r}var yT=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24&255},bT=function(e,t,r){e[r]=t&255,e[r+1]=t>>8&255,e[r+2]=t>>16&255,e[r+3]=t>>24&255},vT=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255};function _T(e,t,r){var s=0,i=0;if(r==="dbcs"){for(i=0;i!=t.length;++i)vT(this,t.charCodeAt(i),this.l+2*i);s=2*t.length}else if(r==="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(r==="hex"){for(;i<e;++i)this[this.l++]=parseInt(t.slice(2*i,2*i+2),16)||0;return this}else if(r==="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,yT(this,t,this.l);break;case 8:if(s=8,r==="f"){gT(this,t,this.l);break}case 16:break;case-4:s=4,bT(this,t,this.l);break}return this.l+=s,this}function G2(e,t){var r=D2(this,this.l,e.length>>1);if(r!==e)throw new Error(t+"Expected "+e+" saw "+r);this.l+=e.length>>1}function Dn(e,t){e.l=t,e.read_shift=Xd,e.chk=G2,e.write_shift=_T}function Vs(e,t){e.l+=t}function Ge(e){var t=lo(e);return Dn(t,0),t}function yn(){var e=[],t=pa?256:2048,r=function(g){var x=Ge(g);return Dn(x,0),x},s=r(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(g){return s&&g<s.length-s.l?s:(i(),s=r(Math.max(g+1,t)))},c=function(){return i(),Lr(e)},f=function(g){i(),s=g,s.l==null&&(s.l=s.length),d(t)};return{next:d,push:f,end:c,_bufs:e}}function at(e,t,r,s){var i=+t,d;if(!isNaN(i)){s||(s=m9[i].p||(r||[]).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&&Ap(r)&&e.push(r)}}function Jd(e,t,r){var s=vn(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)),!r||r.biff<12){for(;s.c>=256;)s.c-=256;for(;s.r>=65536;)s.r-=65536}return s}function Tv(e,t,r){var s=vn(e);return s.s=Jd(s.s,t.s,r),s.e=Jd(s.e,t.s,r),s}function Kd(e,t){if(e.cRel&&e.c<0)for(e=vn(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=vn(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var r=Sa(e);return!e.cRel&&e.cRel!=null&&(r=NT(r)),!e.rRel&&e.rRel!=null&&(r=wT(r)),r}function Ag(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?"":"$")+Wr(e.s.c)+":"+(e.e.cRel?"":"$")+Wr(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 Op(e){return parseInt(kT(e),10)-1}function Pr(e){return""+(e+1)}function wT(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function kT(e){return e.replace(/\$(\d+)$/,"$1")}function Mp(e){for(var t=jT(e),r=0,s=0;s!==t.length;++s)r=26*r+t.charCodeAt(s)-64;return r-1}function Wr(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 NT(e){return e.replace(/^([A-Z])/,"$$$1")}function jT(e){return e.replace(/^\$([A-Z])/,"$1")}function ST(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function wr(e){for(var t=0,r=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&&(r=26*r+(i-64))}return{c:r-1,r:t-1}}function Sa(e){for(var t=e.c+1,r="";t;t=(t-1)/26|0)r=String.fromCharCode((t-1)%26+65)+r;return r+(e.r+1)}function zn(e){var t=e.indexOf(":");return t==-1?{s:wr(e),e:wr(e)}:{s:wr(e.slice(0,t)),e:wr(e.slice(t+1))}}function cr(e,t){return typeof t=="undefined"||typeof t=="number"?cr(e.s,e.e):(typeof e!="string"&&(e=Sa(e)),typeof t!="string"&&(t=Sa(t)),e==t?e:e+":"+t)}function za(e){var t={s:{c:0,r:0},e:{c:0,r:0}},r=0,s=0,i=0,d=e.length;for(r=0;s<d&&!((i=e.charCodeAt(s)-64)<1||i>26);++s)r=26*r+i;for(t.s.c=--r,r=0;s<d&&!((i=e.charCodeAt(s)-48)<0||i>9);++s)r=10*r+i;if(t.s.r=--r,s===d||i!=10)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++s,r=0;s!=d&&!((i=e.charCodeAt(s)-64)<1||i>26);++s)r=26*r+i;for(t.e.c=--r,r=0;s!=d&&!((i=e.charCodeAt(s)-48)<0||i>9);++s)r=10*r+i;return t.e.r=--r,t}function Ev(e,t){var r=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=cl(e.z,r?bn(t):t)}catch(s){}try{return e.w=cl((e.XF||{}).numFmtId||(r?14:0),r?bn(t):t)}catch(s){return""+t}}function vi(e,t,r){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&r&&r.dateNF&&(e.z=r.dateNF),e.t=="e"?N0[e.v]||e.v:t==null?Ev(e,e.v):Ev(e,t))}function fo(e,t){var r=t&&t.sheet?t.sheet:"Sheet1",s={};return s[r]=e,{SheetNames:[r],Sheets:s}}function Z2(e,t,r){var s=r||{},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 p=typeof s.origin=="string"?wr(s.origin):s.origin;c=p.r,f=p.c}d["!ref"]||(d["!ref"]="A1:A1")}var g={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(d["!ref"]){var x=za(d["!ref"]);g.s.c=x.s.c,g.s.r=x.s.r,g.e.c=Math.max(g.e.c,x.e.c),g.e.r=Math.max(g.e.r,x.e.r),c==-1&&(g.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 v=0;v!=t[y].length;++v)if(typeof t[y][v]!="undefined"){var k={v:t[y][v]},T=c+y,N=f+v;if(g.s.r>T&&(g.s.r=T),g.s.c>N&&(g.s.c=N),g.e.r<T&&(g.e.r=T),g.e.c<N&&(g.e.c=N),t[y][v]&&typeof t[y][v]=="object"&&!Array.isArray(t[y][v])&&!(t[y][v]instanceof Date))k=t[y][v];else if(Array.isArray(k.v)&&(k.f=t[y][v][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=cl(k.z,bn(k.v))):(k.t="n",k.v=bn(k.v),k.w=cl(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=Sa({c:N,r:T});d[S]&&d[S].z&&(k.z=d[S].z),d[S]=k}}}return g.s.c<1e7&&(d["!ref"]=cr(g)),d}function Pc(e,t){return Z2(null,e,t)}function TT(e){return e.read_shift(4,"i")}function _s(e,t){return t||(t=Ge(4)),t.write_shift(4,e),t}function Vr(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function kr(e,t){var r=!1;return t==null&&(r=!0,t=Ge(4+2*e.length)),t.write_shift(4,e.length),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}function ET(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function CT(e,t){return t||(t=Ge(4)),t.write_shift(2,0),t.write_shift(2,0),t}function Lp(e,t){var r=e.l,s=e.read_shift(1),i=Vr(e),d=[],c={t:i,h:i};if((s&1)!==0){for(var f=e.read_shift(4),p=0;p!=f;++p)d.push(ET(e));c.r=d}else c.r=[{ich:0,ifnt:0}];return e.l=r+t,c}function AT(e,t){var r=!1;return t==null&&(r=!0,t=Ge(15+4*e.t.length)),t.write_shift(1,0),kr(e.t,t),r?t.slice(0,t.l):t}var OT=Lp;function MT(e,t){var r=!1;return t==null&&(r=!0,t=Ge(23+4*e.t.length)),t.write_shift(1,1),kr(e.t,t),t.write_shift(4,1),CT({},t),r?t.slice(0,t.l):t}function rs(e){var t=e.read_shift(4),r=e.read_shift(2);return r+=e.read_shift(1)<<16,e.l++,{c:t,iStyleRef:r}}function ho(e,t){return t==null&&(t=Ge(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=Ge(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var LT=Vr,q2=kr;function Dp(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function Df(e,t){var r=!1;return t==null&&(r=!0,t=Ge(127)),t.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}var DT=Vr,tp=Dp,Pp=Df;function Y2(e){var t=e.slice(e.l,e.l+4),r=t[0]&1,s=t[0]&2;e.l+=4;var i=s===0?Lf([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):Jl(t,0)>>2;return r?i/100:i}function X2(e,t){t==null&&(t=Ge(4));var r=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,r=1),s)t.write_shift(-4,((r?i:e)<<2)+(r+2));else throw new Error("unsupported RkNumber "+e)}function J2(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 PT(e,t){return t||(t=Ge(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=J2,Rc=PT;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||Ge(8)).write_shift(8,e,"f")}function RT(e){var t={},r=e.read_shift(1),s=r>>>1,i=e.read_shift(1),d=e.read_shift(2,"i"),c=e.read_shift(1),f=e.read_shift(1),p=e.read_shift(1);switch(e.l++,s){case 0:t.auto=1;break;case 1:t.index=i;var g=VT[i];g&&(t.rgb=zv(g));break;case 2:t.rgb=zv([c,f,p]);break;case 3:t.theme=i;break}return d!=0&&(t.tint=d>0?d/32767:d/32768),t}function Pf(e,t){if(t||(t=Ge(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 r=e.tint||0;if(r>0?r*=32767:r<0&&(r*=32768),t.write_shift(2,r),!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 FT(e){var t=e.read_shift(1);e.l++;var r={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 r}function IT(e,t){t||(t=Ge(2));var r=(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,r),t.write_shift(1,0),t}var K2=2,Ln=3,sf=11,Rf=19,lf=64,zT=65,BT=71,UT=4108,HT=4126,Mr=80,Cv={1:{n:"CodePage",t:K2},2:{n:"Category",t:Mr},3:{n:"PresentationFormat",t:Mr},4:{n:"ByteCount",t:Ln},5:{n:"LineCount",t:Ln},6:{n:"ParagraphCount",t:Ln},7:{n:"SlideCount",t:Ln},8:{n:"NoteCount",t:Ln},9:{n:"HiddenCount",t:Ln},10:{n:"MultimediaClipCount",t:Ln},11:{n:"ScaleCrop",t:sf},12:{n:"HeadingPairs",t:UT},13:{n:"TitlesOfParts",t:HT},14:{n:"Manager",t:Mr},15:{n:"Company",t:Mr},16:{n:"LinksUpToDate",t:sf},17:{n:"CharacterCount",t:Ln},19:{n:"SharedDoc",t:sf},22:{n:"HyperlinksChanged",t:sf},23:{n:"AppVersion",t:Ln,p:"version"},24:{n:"DigSig",t:zT},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:Rf},2147483651:{n:"Behavior",t:Rf},1919054434:{}},Av={1:{n:"CodePage",t:K2},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:lf},11:{n:"LastPrinted",t:lf},12:{n:"CreatedDate",t:lf},13:{n:"ModifiedDate",t:lf},14:{n:"PageCount",t:Ln},15:{n:"WordCount",t:Ln},16:{n:"CharCount",t:Ln},17:{n:"Thumbnail",t:BT},18:{n:"Application",t:Mr},19:{n:"DocSecurity",t:Ln},255:{},2147483648:{n:"Locale",t:Rf},2147483651:{n:"Behavior",t:Rf},1919054434:{}};function $T(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var WT=$T([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]),VT=vn(WT),N0={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},GT={"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"},of={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 Q2(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function ew(e,t){var r=aT(GT),s=[],i;s[s.length]=dr,s[s.length]=gt("Types",null,{xmlns:_r.CT,"xmlns:xsd":_r.xsd,"xmlns:xsi":_r.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(p){return gt("Default",null,{Extension:p[0],ContentType:p[1]})}));var d=function(p){e[p]&&e[p].length>0&&(i=e[p][0],s[s.length]=gt("Override",null,{PartName:(i[0]=="/"?"":"/")+i,ContentType:of[p][t.bookType]||of[p].xlsx}))},c=function(p){(e[p]||[]).forEach(function(g){s[s.length]=gt("Override",null,{PartName:(g[0]=="/"?"":"/")+g,ContentType:of[p][t.bookType]||of[p].xlsx})})},f=function(p){(e[p]||[]).forEach(function(g){s[s.length]=gt("Override",null,{PartName:(g[0]=="/"?"":"/")+g,ContentType:r[p][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 ha={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 tw(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function bc(e){var t=[dr,gt("Relationships",null,{xmlns:_r.RELS})];return Fr(e["!id"]).forEach(function(r){t[t.length]=gt("Relationship",null,e["!id"][r])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function Na(e,t,r,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=r,[ha.HLINK,ha.XPATH,ha.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 ZT(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 r=0;r<e.length;++r)t.push(' <manifest:file-entry manifest:full-path="'+e[r][0]+'" manifest:media-type="'+e[r][1]+`"/>
`);return t.push("</manifest:manifest>"),t.join("")}function Ov(e,t,r){return[' <rdf:Description rdf:about="'+e+`">
`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(r||"odf")+"#"+t+`"/>
`,` </rdf:Description>
`].join("")}function qT(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 YT(e){var t=[dr];t.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
`);for(var r=0;r!=e.length;++r)t.push(Ov(e[r][0],e[r][1])),t.push(qT("",e[r][0]));return t.push(Ov("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function aw(){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 '+Tf.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 Og(e,t,r,s,i){i[e]!=null||t==null||t===""||(i[e]=t,t=ja(t),s[s.length]=r?gt(e,t,r):Dr(e,t))}function rw(e,t){var r=t||{},s=[dr,gt("cp:coreProperties",null,{"xmlns:cp":_r.CORE_PROPS,"xmlns:dc":_r.dc,"xmlns:dcterms":_r.dcterms,"xmlns:dcmitype":_r.dcmitype,"xmlns:xsi":_r.xsi})],i={};if(!e&&!r.Props)return s.join("");e&&(e.CreatedDate!=null&&Og("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:ep(e.CreatedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},s,i),e.ModifiedDate!=null&&Og("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:ep(e.ModifiedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},s,i));for(var d=0;d!=ao.length;++d){var c=ao[d],f=r.Props&&r.Props[c[1]]!=null?r.Props[c[1]]:e?e[c[1]]:null;f===!0?f="1":f===!1?f="0":typeof f=="number"&&(f=String(f)),f!=null&&Og(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"]],nw=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function sw(e){var t=[],r=gt;return e||(e={}),e.Application="SheetJS",t[t.length]=dr,t[t.length]=gt("Properties",null,{xmlns:_r.EXT_PROPS,"xmlns:vt":_r.vt}),vc.forEach(function(s){if(e[s[1]]!==void 0){var i;switch(s[2]){case"string":i=ja(String(e[s[1]]));break;case"bool":i=e[s[1]]?"true":"false";break}i!==void 0&&(t[t.length]=r(s[0],i))}}),t[t.length]=r("HeadingPairs",r("vt:vector",r("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+r("vt:variant",r("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),t[t.length]=r("TitlesOfParts",r("vt:vector",e.SheetNames.map(function(s){return"<vt:lpstr>"+ja(s)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}function iw(e){var t=[dr,gt("Properties",null,{xmlns:_r.CUST_PROPS,"xmlns:vt":_r.vt})];if(!e)return t.join("");var r=1;return Fr(e).forEach(function(i){++r,t[t.length]=gt("property",hT(e[i]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:r,name:ja(i)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var Mv={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 XT(e,t){var r=[];return Fr(Mv).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/,"")),r.push(Dr(Mv[s[1]]||s[1],i))}}),gt("DocumentProperties",r.join(""),{xmlns:Pn.o})}function JT(e,t){var r=["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<r.length;++c)if(d==r[c])return;var f=e[d],p="string";typeof f=="number"?(p="float",f=String(f)):f===!0||f===!1?(p="boolean",f=f?"1":"0"):f=String(f),i.push(gt(bv(d),f,{"dt:dt":p}))}}),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(gt(bv(d),c,{"dt:dt":f}))}}),"<"+s+' xmlns="'+Pn.o+'">'+i.join("")+"</"+s+">"}function KT(e){var t=typeof e=="string"?new Date(Date.parse(e)):e,r=t.getTime()/1e3+11644473600,s=r%Math.pow(2,32),i=(r-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=Ge(8);return c.write_shift(4,s),c.write_shift(4,i),c}function Lv(e,t){var r=Ge(4),s=Ge(4);switch(r.write_shift(4,e==80?31:e),e){case 3:s.write_shift(-4,t);break;case 5:s=Ge(8),s.write_shift(8,t,"f");break;case 11:s.write_shift(4,t?1:0);break;case 64:s=KT(t);break;case 31:case 80:for(s=Ge(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([r,s])}var lw=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function QT(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 Dv(e,t,r){var s=Ge(8),i=[],d=[],c=8,f=0,p=Ge(8),g=Ge(8);if(p.write_shift(4,2),p.write_shift(4,1200),g.write_shift(4,1),d.push(p),i.push(g),c+=8+p.length,!t){g=Ge(8),g.write_shift(4,0),i.unshift(g);var x=[Ge(4)];for(x[0].write_shift(4,e.length),f=0;f<e.length;++f){var y=e[f][0];for(p=Ge(8+2*(y.length+1)+(y.length%2?0:2)),p.write_shift(4,f+2),p.write_shift(4,y.length+1),p.write_shift(0,y,"dbcs");p.l!=p.length;)p.write_shift(1,0);x.push(p)}p=Lr(x),d.unshift(p),c+=8+p.length}for(f=0;f<e.length;++f)if(!(t&&!t[e[f][0]])&&!(lw.indexOf(e[f][0])>-1||nw.indexOf(e[f][0])>-1)&&e[f][1]!=null){var v=e[f][1],k=0;if(t){k=+t[e[f][0]];var T=r[k];if(T.p=="version"&&typeof v=="string"){var N=v.split(".");v=(+N[0]<<16)+(+N[1]||0)}p=Lv(T.t,v)}else{var S=QT(v);S==-1&&(S=31,v=String(v)),p=Lv(S,v)}d.push(p),g=Ge(8),g.write_shift(4,t?k:2+f),i.push(g),c+=8+p.length}var A=8*(d.length+1);for(f=0;f<d.length;++f)i[f].write_shift(4,A),A+=d[f].length;return s.write_shift(4,c),s.write_shift(4,d.length),Lr([s].concat(i).concat(d))}function Pv(e,t,r,s,i,d){var c=Ge(i?68:48),f=[c];c.write_shift(2,65534),c.write_shift(2,0),c.write_shift(4,842412599),c.write_shift(16,La.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 p=Dv(e,r,s);if(f.push(p),i){var g=Dv(i,null,null);c.write_shift(16,d,"hex"),c.write_shift(4,68+p.length),f.push(g)}return Lr(f)}function eE(e,t){t||(t=Ge(e));for(var r=0;r<e;++r)t.write_shift(1,0);return t}function tE(e,t){return e.read_shift(t)===1}function Jr(e,t){return t||(t=Ge(2)),t.write_shift(2,+!!e),t}function ow(e){return e.read_shift(2,"u")}function es(e,t){return t||(t=Ge(2)),t.write_shift(2,e),t}function cw(e,t,r){return r||(r=Ge(2)),r.write_shift(1,t=="e"?+e:+!!e),r.write_shift(1,t=="e"?1:0),r}function dw(e,t,r){var s=e.read_shift(r&&r.biff>=12?2:1),i="sbcs-cont";if(r&&r.biff>=8,!r||r.biff==8){var d=e.read_shift(1);d&&(i="dbcs-cont")}else r.biff==12&&(i="wstr");r.biff>=2&&r.biff<=5&&(i="cpstr");var c=s?e.read_shift(s,i):"";return c}function aE(e){var t=e.t||"",r=Ge(3);r.write_shift(2,t.length),r.write_shift(1,1);var s=Ge(2*t.length);s.write_shift(2*t.length,t,"utf16le");var i=[r,s];return Lr(i)}function rE(e,t,r){var s;if(r){if(r.biff>=2&&r.biff<=5)return e.read_shift(t,"cpstr");if(r.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 nE(e,t,r){var s=e.read_shift(r&&r.biff==2?1:2);return s===0?(e.l++,""):rE(e,s,r)}function sE(e,t,r){if(r.biff>5)return nE(e,t,r);var s=e.read_shift(1);return s===0?(e.l++,""):e.read_shift(s,r.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function uw(e,t,r){return r||(r=Ge(3+2*e.length)),r.write_shift(2,e.length),r.write_shift(1,1),r.write_shift(31,e,"utf16le"),r}function Rv(e,t){t||(t=Ge(6+e.length*2)),t.write_shift(4,1+e.length);for(var r=0;r<e.length;++r)t.write_shift(2,e.charCodeAt(r));return t.write_shift(2,0),t}function iE(e){var t=Ge(512),r=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(r=0;r<c.length;++r)t.write_shift(4,c[r]);if(d==28)s=s.slice(1),Rv(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(" "),r=0;r<c.length;++r)t.write_shift(1,parseInt(c[r],16));var f=i>-1?s.slice(0,i):s;for(t.write_shift(4,2*(f.length+1)),r=0;r<f.length;++r)t.write_shift(2,f.charCodeAt(r));t.write_shift(2,0),d&8&&Rv(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(" "),r=0;r<c.length;++r)t.write_shift(1,parseInt(c[r],16));for(var p=0;s.slice(p*3,p*3+3)=="../"||s.slice(p*3,p*3+3)=="..\\";)++p;for(t.write_shift(2,p),t.write_shift(4,s.length-3*p+1),r=0;r<s.length-3*p;++r)t.write_shift(1,s.charCodeAt(r+3*p)&255);for(t.write_shift(1,0),t.write_shift(2,65535),t.write_shift(2,57005),r=0;r<6;++r)t.write_shift(4,0)}return t.slice(0,t.l)}function co(e,t,r,s){return s||(s=Ge(6)),s.write_shift(2,e),s.write_shift(2,t),s.write_shift(2,r||0),s}function lE(e,t,r){var s=r.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 oE(e){var t=e.read_shift(2),r=e.read_shift(2),s=e.read_shift(2),i=e.read_shift(2);return{s:{c:s,r:t},e:{c:i,r}}}function fw(e,t){return t||(t=Ge(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 Rp(e,t,r){var s=1536,i=16;switch(r.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=Ge(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 cE(e,t){var r=!t||t.biff==8,s=Ge(r?112:54);for(s.write_shift(t.biff==8?2:1,7),r&&s.write_shift(1,0),s.write_shift(4,859007059),s.write_shift(4,5458548|(r?0:536870912));s.l<s.length;)s.write_shift(1,r?0:32);return s}function dE(e,t){var r=!t||t.biff>=8?2:1,s=Ge(8+r*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(r*e.name.length,e.name,t.biff<8?"sbcs":"utf16le");var i=s.slice(0,s.l);return i.l=s.l,i}function uE(e,t){var r=Ge(8);r.write_shift(4,e.Count),r.write_shift(4,e.Unique);for(var s=[],i=0;i<e.length;++i)s[i]=aE(e[i]);var d=Lr([r].concat(s));return d.parts=[r.length].concat(s.map(function(c){return c.length})),d}function fE(){var e=Ge(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 hE(e){var t=Ge(18),r=1718;return e&&e.RTL&&(r|=64),t.write_shift(2,r),t.write_shift(4,0),t.write_shift(4,64),t.write_shift(4,0),t.write_shift(4,0),t}function mE(e,t){var r=e.name||"Arial",s=t&&t.biff==5,i=s?15+r.length:16+2*r.length,d=Ge(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,r.length),s||d.write_shift(1,1),d.write_shift((s?1:2)*r.length,r,s?"sbcs":"utf16le"),d}function gE(e,t,r,s){var i=Ge(10);return co(e,t,s,i),i.write_shift(4,r),i}function pE(e,t,r,s,i){var d=!i||i.biff==8,c=Ge(8+ +d+(1+d)*r.length);return co(e,t,s,c),c.write_shift(2,r.length),d&&c.write_shift(1,1),c.write_shift((1+d)*r.length,r,d?"utf16le":"sbcs"),c}function xE(e,t,r,s){var i=r&&r.biff==5;s||(s=Ge(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 yE(e,t){var r=t.biff==8||!t.biff?4:2,s=Ge(2*r+6);return s.write_shift(r,e.s.r),s.write_shift(r,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 Fv(e,t,r,s){var i=r&&r.biff==5;s||(s=Ge(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 bE(e){var t=Ge(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function vE(e,t,r,s,i,d){var c=Ge(8);return co(e,t,s,c),cw(r,d,c),c}function _E(e,t,r,s){var i=Ge(14);return co(e,t,s,i),oo(r,i),i}function wE(e,t,r){if(r.biff<8)return kE(e,t,r);for(var s=[],i=e.l+t,d=e.read_shift(r.biff>8?4:2);d--!==0;)s.push(lE(e,r.biff>8?12:6,r));if(e.l!=i)throw new Error("Bad ExternSheet: "+e.l+" != "+i);return s}function kE(e,t,r){e[e.l+1]==3&&e[e.l]++;var s=dw(e,t,r);return s.charCodeAt(0)==3?s.slice(1):s}function NE(e){var t=Ge(2+e.length*8);t.write_shift(2,e.length);for(var r=0;r<e.length;++r)fw(e[r],t);return t}function jE(e){var t=Ge(24),r=wr(e[0]);t.write_shift(2,r.r),t.write_shift(2,r.r),t.write_shift(2,r.c),t.write_shift(2,r.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,iE(e[1])])}function SE(e){var t=e[1].Tooltip,r=Ge(10+2*(t.length+1));r.write_shift(2,2048);var s=wr(e[0]);r.write_shift(2,s.r),r.write_shift(2,s.r),r.write_shift(2,s.c),r.write_shift(2,s.c);for(var i=0;i<t.length;++i)r.write_shift(2,t.charCodeAt(i));return r.write_shift(2,0),r}function TE(e){return e||(e=Ge(4)),e.write_shift(2,1),e.write_shift(2,1),e}function EE(e,t,r){if(!r.cellStyles)return Vs(e,t);var s=r&&r.biff>=12?4:2,i=e.read_shift(s),d=e.read_shift(s),c=e.read_shift(s),f=e.read_shift(s),p=e.read_shift(2);s==2&&(e.l+=2);var g={s:i,e:d,w:c,ixfe:f,flags:p};return(r.biff>=5||!r.biff)&&(g.level=p>>8&7),g}function CE(e,t){var r=Ge(12);r.write_shift(2,t),r.write_shift(2,t),r.write_shift(2,e.width*256),r.write_shift(2,0);var s=0;return e.hidden&&(s|=1),r.write_shift(1,s),s=e.level||0,r.write_shift(1,s),r.write_shift(2,0),r}function AE(e){for(var t=Ge(2*e),r=0;r<e;++r)t.write_shift(2,r+1);return t}function OE(e,t,r){var s=Ge(15);return S0(s,e,t),s.write_shift(8,r,"f"),s}function ME(e,t,r){var s=Ge(9);return S0(s,e,t),s.write_shift(2,r),s}var LE=(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=jp({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 r(f,p){var g=[],x=lo(1);switch(p.type){case"base64":x=ys(bi(f));break;case"binary":x=ys(f);break;case"buffer":case"array":x=f;break}Dn(x,0);var y=x.read_shift(1),v=!!(y&136),k=!1,T=!1;switch(y){case 2:break;case 3:break;case 48:k=!0,v=!0;break;case 49:k=!0,v=!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 A=x.read_shift(2),C=p.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 O=[],P={},B=Math.min(x.length,y==2?521:S-10-(k?264:0)),V=T?32:11;x.l<B&&x[x.l]!=13;)switch(P={},P.name=Ef.utils.decode(C,x.slice(x.l,x.l+V)).replace(/[\u0000\r\n].*$/g,""),x.l+=V,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&&O.push(P),y!=2&&(x.l+=T?13:14),P.type){case"B":(!k||P.len!=8)&&p.WTF&&console.log("Skipping "+P.name+":"+P.type);break;case"G":case"P":p.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 z=0,U=0;for(g[0]=[],U=0;U!=O.length;++U)g[0][U]=O[U].name;for(;N-- >0;){if(x[x.l]===42){x.l+=A;continue}for(++x.l,g[++z]=[],U=0,U=0;U!=O.length;++U){var J=x.slice(x.l,x.l+O[U].len);x.l+=O[U].len,Dn(J,0);var de=Ef.utils.decode(C,J);switch(O[U].type){case"C":de.trim().length&&(g[z][U]=de.replace(/\s+$/,""));break;case"D":de.length===8?g[z][U]=new Date(+de.slice(0,4),+de.slice(4,6)-1,+de.slice(6,8)):g[z][U]=de;break;case"F":g[z][U]=parseFloat(de.trim());break;case"+":case"I":g[z][U]=T?J.read_shift(-4,"i")^2147483648:J.read_shift(4,"i");break;case"L":switch(de.trim().toUpperCase()){case"Y":case"T":g[z][U]=!0;break;case"N":case"F":g[z][U]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+de+"|")}break;case"M":if(!v)throw new Error("DBF Unexpected MEMO for type "+y.toString(16));g[z][U]="##MEMO##"+(T?parseInt(de.trim(),10):J.read_shift(4));break;case"N":de=de.replace(/\u0000/g,"").trim(),de&&de!="."&&(g[z][U]=+de||0);break;case"@":g[z][U]=new Date(J.read_shift(-8,"f")-621356832e5);break;case"T":g[z][U]=new Date((J.read_shift(4)-2440588)*864e5+J.read_shift(4));break;case"Y":g[z][U]=J.read_shift(4,"i")/1e4+J.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":g[z][U]=-J.read_shift(-8,"f");break;case"B":if(k&&O[U].len==8){g[z][U]=J.read_shift(8,"f");break}case"G":case"P":J.l+=O[U].len;break;case"0":if(O[U].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+O[U].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 p&&p.sheetRows&&(g=g.slice(0,p.sheetRows)),p.DBF=O,g}function s(f,p){var g=p||{};g.dateNF||(g.dateNF="yyyymmdd");var x=Pc(r(f,g),g);return x["!cols"]=g.DBF.map(function(y){return{wch:y.len,DBF:y}}),delete g.DBF,x}function i(f,p){try{return fo(s(f,p),p)}catch(g){if(p&&p.WTF)throw g}return{SheetNames:[],Sheets:{}}}var d={B:8,C:250,L:1,D:8,"?":0,"":0};function c(f,p){var g=p||{};if(+g.codepage>=0&&r0(+g.codepage),g.type=="string")throw new Error("Cannot write DBF to JS string");var x=yn(),y=Uf(f,{header:1,raw:!0,cellDates:!0}),v=y[0],k=y.slice(1),T=f["!cols"]||[],N=0,S=0,A=0,C=1;for(N=0;N<v.length;++N){if(((T[N]||{}).DBF||{}).name){v[N]=T[N].DBF.name,++A;continue}if(v[N]!=null){if(++A,typeof v[N]=="number"&&(v[N]=v[N].toString(10)),typeof v[N]!="string")throw new Error("DBF Invalid column name "+v[N]+" |"+typeof v[N]+"|");if(v.indexOf(v[N])!==N){for(S=0;S<1024;++S)if(v.indexOf(v[N]+"_"+S)==-1){v[N]+="_"+S;break}}}}var O=za(f["!ref"]),P=[],B=[],V=[];for(N=0;N<=O.e.c-O.s.c;++N){var z="",U="",J=0,de=[];for(S=0;S<k.length;++S)k[S][N]!=null&&de.push(k[S][N]);if(de.length==0||v[N]==null){P[N]="?";continue}for(S=0;S<de.length;++S){switch(typeof de[S]){case"number":U="B";break;case"string":U="C";break;case"boolean":U="L";break;case"object":U=de[S]instanceof Date?"D":"C";break;default:U="C"}J=Math.max(J,String(de[S]).length),z=z&&z!=U?"C":U}J>250&&(J=250),U=((T[N]||{}).DBF||{}).type,U=="C"&&T[N].DBF.len>J&&(J=T[N].DBF.len),z=="B"&&U=="N"&&(z="N",V[N]=T[N].DBF.dec,J=T[N].DBF.len),B[N]=z=="C"||U=="N"?J:d[z]||0,C+=B[N],P[N]=z}var ye=x.next(32);for(ye.write_shift(4,318902576),ye.write_shift(4,k.length),ye.write_shift(2,296+32*A),ye.write_shift(2,C),N=0;N<4;++N)ye.write_shift(4,0);for(ye.write_shift(4,0|(+t[m2]||3)<<8),N=0,S=0;N<v.length;++N)if(v[N]!=null){var ie=x.next(32),he=(v[N].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);ie.write_shift(1,he,"sbcs"),ie.write_shift(1,P[N]=="?"?"C":P[N],"sbcs"),ie.write_shift(4,S),ie.write_shift(1,B[N]||d[P[N]]||0),ie.write_shift(1,V[N]||0),ie.write_shift(1,2),ie.write_shift(4,0),ie.write_shift(1,0),ie.write_shift(4,0),ie.write_shift(4,0),S+=B[N]||d[P[N]]||0}var ve=x.next(264);for(ve.write_shift(4,13),N=0;N<65;++N)ve.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<v.length;++S)if(v[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 ee="0";for(typeof k[N][S]=="number"&&(ee=k[N][S].toFixed(V[S]||0)),A=0;A<B[S]-ee.length;++A)me.write_shift(1,32);me.write_shift(1,ee,"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 q=String(k[N][S]!=null?k[N][S]:"").slice(0,B[S]);for(me.write_shift(1,q,"sbcs"),A=0;A<B[S]-q.length;++A)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}})(),DE=(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"),r=function(v,k){var T=e[k];return typeof T=="number"?lv(T):T},s=function(v,k,T){var N=k.charCodeAt(0)-32<<4|T.charCodeAt(0)-48;return N==59?v:lv(N)};e["|"]=254;function i(v,k){switch(k.type){case"base64":return d(bi(v),k);case"binary":return d(v,k);case"buffer":return d(pa&&Buffer.isBuffer(v)?v.toString("binary"):_0(v),k);case"array":return d(nh(v),k)}throw new Error("Unrecognized type "+k.type)}function d(v,k){var T=v.split(/[\n\r]+/),N=-1,S=-1,A=0,C=0,O=[],P=[],B=null,V={},z=[],U=[],J=[],de=0,ye;for(+k.codepage>=0&&r0(+k.codepage);A!==T.length;++A){de=0;var ie=T[A].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,s).replace(t,r),he=ie.replace(/;;/g,"\0").split(";").map(function(K){return K.replace(/\u0000/g,";")}),ve=he[0],me;if(ie.length>0)switch(ve){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":he[1].charAt(0)=="P"&&P.push(ie.slice(3).replace(/;;/g,";"));break;case"C":var ee=!1,q=!1,Q=!1,fe=!1,ae=-1,F=-1;for(C=1;C<he.length;++C)switch(he[C].charAt(0)){case"A":break;case"X":S=parseInt(he[C].slice(1))-1,q=!0;break;case"Y":for(N=parseInt(he[C].slice(1))-1,q||(S=0),ye=O.length;ye<=N;++ye)O[ye]=[];break;case"K":me=he[C].slice(1),me.charAt(0)==='"'?me=me.slice(1,me.length-1):me==="TRUE"?me=!0:me==="FALSE"?me=!1:isNaN(gi(me))?isNaN(s0(me).getDate())||(me=Qr(me)):(me=gi(me),B!==null&&S2(B)&&(me=A2(me))),ee=!0;break;case"E":fe=!0;var D=MC(he[C].slice(1),{r:N,c:S});O[N][S]=[O[N][S],D];break;case"S":Q=!0,O[N][S]=[O[N][S],"S5S"];break;case"G":break;case"R":ae=parseInt(he[C].slice(1))-1;break;case"C":F=parseInt(he[C].slice(1))-1;break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+ie)}if(ee&&(O[N][S]&&O[N][S].length==2?O[N][S][0]=me:O[N][S]=me,B=null),Q){if(fe)throw new Error("SYLK shared formula cannot have own formula");var H=ae>-1&&O[ae][F];if(!H||!H[1])throw new Error("SYLK shared formula cannot find base");O[N][S][1]=LC(H[1],{r:N-ae,c:S-F})}break;case"F":var Z=0;for(C=1;C<he.length;++C)switch(he[C].charAt(0)){case"X":S=parseInt(he[C].slice(1))-1,++Z;break;case"Y":for(N=parseInt(he[C].slice(1))-1,ye=O.length;ye<=N;++ye)O[ye]=[];break;case"M":de=parseInt(he[C].slice(1))/20;break;case"F":break;case"G":break;case"P":B=P[parseInt(he[C].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(J=he[C].slice(1).split(" "),ye=parseInt(J[0],10);ye<=parseInt(J[1],10);++ye)de=parseInt(J[2],10),U[ye-1]=de===0?{hidden:!0}:{wch:de},Fp(U[ye-1]);break;case"C":S=parseInt(he[C].slice(1))-1,U[S]||(U[S]={});break;case"R":N=parseInt(he[C].slice(1))-1,z[N]||(z[N]={}),de>0?(z[N].hpt=de,z[N].hpx=xw(de)):de===0&&(z[N].hidden=!0);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+ie)}Z<1&&(B=null);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+ie)}}return z.length>0&&(V["!rows"]=z),U.length>0&&(V["!cols"]=U),k&&k.sheetRows&&(O=O.slice(0,k.sheetRows)),[O,V]}function c(v,k){var T=i(v,k),N=T[0],S=T[1],A=Pc(N,k);return Fr(S).forEach(function(C){A[C]=S[C]}),A}function f(v,k){return fo(c(v,k),k)}function p(v,k,T,N){var S="C;Y"+(T+1)+";X"+(N+1)+";K";switch(v.t){case"n":S+=v.v||0,v.f&&!v.F&&(S+=";E"+zp(v.f,{r:T,c:N}));break;case"b":S+=v.v?"TRUE":"FALSE";break;case"e":S+=v.w||v.v;break;case"d":S+='"'+(v.w||v.v)+'"';break;case"s":S+='"'+v.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return S}function g(v,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=Ff(T.width)),typeof T.wpx=="number"&&!T.wch&&(T.wch=If(T.wpx)),typeof T.wch=="number"&&(S+=Math.round(T.wch))),S.charAt(S.length-1)!=" "&&v.push(S)})}function x(v,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*zf(T.hpx)+";"),S.length>2&&v.push(S+"R"+(N+1))})}function y(v,k){var T=["ID;PWXL;N;E"],N=[],S=za(v["!ref"]),A,C=Array.isArray(v),O=`\r
`;T.push("P;PGeneral"),T.push("F;P0;DG0G8;M255"),v["!cols"]&&g(T,v["!cols"]),v["!rows"]&&x(T,v["!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 B=S.s.c;B<=S.e.c;++B){var V=Sa({r:P,c:B});A=C?(v[P]||[])[B]:v[V],!(!A||A.v==null&&(!A.f||A.F))&&N.push(p(A,v,P,B))}return T.join(O)+O+N.join(O)+O+"E"+O}return{to_workbook:f,to_sheet:c,from_sheet:y}})(),PE=(function(){function e(d,c){switch(c.type){case"base64":return t(bi(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(nh(d),c)}throw new Error("Unrecognized type "+c.type)}function t(d,c){for(var f=d.split(`
`),p=-1,g=-1,x=0,y=[];x!==f.length;++x){if(f[x].trim()==="BOT"){y[++p]=[],g=0;continue}if(!(p<0)){var v=f[x].trim().split(","),k=v[0],T=v[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[++p]=[],g=0;continue}else if(N!=="EOD")throw new Error("Unrecognized DIF special command "+N);break;case 0:N==="TRUE"?y[p][g]=!0:N==="FALSE"?y[p][g]=!1:isNaN(gi(T))?isNaN(s0(T).getDate())?y[p][g]=T:y[p][g]=Qr(T):y[p][g]=gi(T),++g;break;case 1:N=N.slice(1,N.length-1),N=N.replace(/""/g,'"'),N&&N.match(/^=".*"$/)&&(N=N.slice(2,-1)),y[p][g++]=N!==""?N:null;break}if(N==="EOD")break}}return c&&c.sheetRows&&(y=y.slice(0,c.sheetRows)),y}function r(d,c){return Pc(e(d,c),c)}function s(d,c){return fo(r(d,c),c)}var i=(function(){var d=function(p,g,x,y,v){p.push(g),p.push(x+","+y),p.push('"'+v.replace(/"/g,'""')+'"')},c=function(p,g,x,y){p.push(g+","+x),p.push(g==1?'"'+y.replace(/"/g,'""')+'"':y)};return function(p){var g=[],x=za(p["!ref"]),y,v=Array.isArray(p);d(g,"TABLE",0,1,"sheetjs"),d(g,"VECTORS",0,x.e.r-x.s.r+1,""),d(g,"TUPLES",0,x.e.c-x.s.c+1,""),d(g,"DATA",0,0,"");for(var k=x.s.r;k<=x.e.r;++k){c(g,-1,0,"BOT");for(var T=x.s.c;T<=x.e.c;++T){var N=Sa({r:k,c:T});if(y=v?(p[k]||[])[T]:p[N],!y){c(g,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(g,1,0,"="+y.f):c(g,1,0,""):c(g,0,S,"V");break;case"b":c(g,0,y.v?1:0,y.v?"TRUE":"FALSE");break;case"s":c(g,1,0,isNaN(y.v)?y.v:'="'+y.v+'"');break;case"d":y.w||(y.w=cl(y.z||Ka[14],bn(Qr(y.v)))),c(g,0,y.w,"V");break;default:c(g,1,0,"")}}}c(g,-1,0,"EOD");var A=`\r
`,C=g.join(A);return C}})();return{to_workbook:s,to_sheet:r,from_sheet:i}})(),hw=(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 r(y,v){for(var k=y.split(`
`),T=-1,N=-1,S=0,A=[];S!==k.length;++S){var C=k[S].trim().split(":");if(C[0]==="cell"){var O=wr(C[1]);if(A.length<=O.r)for(T=A.length;T<=O.r;++T)A[T]||(A[T]=[]);switch(T=O.r,N=O.c,C[2]){case"t":A[T][N]=e(C[3]);break;case"v":A[T][N]=+C[3];break;case"vtf":var P=C[C.length-1];case"vtc":switch(C[3]){case"nl":A[T][N]=!!+C[4];break;default:A[T][N]=+C[4];break}C[2]=="vtf"&&(A[T][N]=[A[T][N],P])}}}return v&&v.sheetRows&&(A=A.slice(0,v.sheetRows)),A}function s(y,v){return Pc(r(y,v),v)}function i(y,v){return fo(s(y,v),v)}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(`
`),p="--SocialCalcSpreadsheetControlSave--";function g(y){if(!y||!y["!ref"])return"";for(var v=[],k=[],T,N="",S=zn(y["!ref"]),A=Array.isArray(y),C=S.s.r;C<=S.e.r;++C)for(var O=S.s.c;O<=S.e.c;++O)if(N=Sa({r:C,c:O}),T=A?(y[C]||[])[O]: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=bn(Qr(T.v));k[2]="vtc",k[3]="nd",k[4]=""+P,k[5]=T.w||cl(T.z||Ka[14],P);break;case"e":continue}v.push(k.join(":"))}return v.push("sheet:c:"+(S.e.c-S.s.c+1)+":r:"+(S.e.r-S.s.r+1)+":tvf:1"),v.push("valueformat:1:text-wiki"),v.join(`
`)}function x(y){return[d,c,f,c,g(y),p].join(`
`)}return{to_workbook:i,to_sheet:s,from_sheet:x}})(),RE=(function(){function e(x,y,v,k,T){T.raw?y[v][k]=x:x===""||(x==="TRUE"?y[v][k]=!0:x==="FALSE"?y[v][k]=!1:isNaN(gi(x))?isNaN(s0(x).getDate())?y[v][k]=x:y[v][k]=Qr(x):y[v][k]=gi(x))}function t(x,y){var v=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,A=0,C=0;C<=N;++C)A=T[C].indexOf(" "),A==-1?A=T[C].length:A++,S=Math.max(S,A);for(C=0;C<=N;++C){k[C]=[];var O=0;for(e(T[C].slice(0,S).trim(),k,C,O,v),O=1;O<=(T[C].length-S)/10+1;++O)e(T[C].slice(S+(O-1)*10,S+O*10).trim(),k,C,O,v)}return v.sheetRows&&(k=k.slice(0,v.sheetRows)),k}var r={44:",",9:" ",59:";",124:"|"},s={44:3,9:2,59:1,124:0};function i(x){for(var y={},v=!1,k=0,T=0;k<x.length;++k)(T=x.charCodeAt(k))==34?v=!v:!v&&T in r&&(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]]}),r[T.pop()[1]]||44}function d(x,y){var v=y||{},k="",T=v.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)):v&&v.FS?k=v.FS:k=i(x.slice(0,1024));var S=0,A=0,C=0,O=0,P=0,B=k.charCodeAt(0),V=!1,z=0,U=x.charCodeAt(0);x=x.replace(/\r\n/mg,`
`);var J=v.dateNF!=null?K5(v.dateNF):null;function de(){var ye=x.slice(O,P),ie={};if(ye.charAt(0)=='"'&&ye.charAt(ye.length-1)=='"'&&(ye=ye.slice(1,-1).replace(/""/g,'"')),ye.length===0)ie.t="z";else if(v.raw)ie.t="s",ie.v=ye;else if(ye.trim().length===0)ie.t="s",ie.v=ye;else if(ye.charCodeAt(0)==61)ye.charCodeAt(1)==34&&ye.charCodeAt(ye.length-1)==34?(ie.t="s",ie.v=ye.slice(2,-1).replace(/""/g,'"')):DC(ye)?(ie.t="n",ie.f=ye.slice(1)):(ie.t="s",ie.v=ye);else if(ye=="TRUE")ie.t="b",ie.v=!0;else if(ye=="FALSE")ie.t="b",ie.v=!1;else if(!isNaN(C=gi(ye)))ie.t="n",v.cellText!==!1&&(ie.w=ye),ie.v=C;else if(!isNaN(s0(ye).getDate())||J&&ye.match(J)){ie.z=v.dateNF||Ka[14];var he=0;J&&ye.match(J)&&(ye=Q5(ye,v.dateNF,ye.match(J)||[]),he=1),v.cellDates?(ie.t="d",ie.v=Qr(ye,he)):(ie.t="n",ie.v=bn(Qr(ye,he))),v.cellText!==!1&&(ie.w=cl(ie.z,ie.v instanceof Date?bn(ie.v):ie.v)),v.cellNF||delete ie.z}else ie.t="s",ie.v=ye;if(ie.t=="z"||(v.dense?(T[S]||(T[S]=[]),T[S][A]=ie):T[Sa({c:A,r:S})]=ie),O=P+1,U=x.charCodeAt(O),N.e.c<A&&(N.e.c=A),N.e.r<S&&(N.e.r=S),z==B)++A;else if(A=0,++S,v.sheetRows&&v.sheetRows<=S)return!0}e:for(;P<x.length;++P)switch(z=x.charCodeAt(P)){case 34:U===34&&(V=!V);break;case B:case 10:case 13:if(!V&&de())break e;break}return P-O>0&&de(),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 v="",k=y.type=="string"?[0,0,0,0]:q9(x,y);switch(y.type){case"base64":v=bi(x);break;case"binary":v=x;break;case"buffer":y.codepage==65001?v=x.toString("utf8"):y.codepage&&typeof Ef!="undefined"||(v=pa&&Buffer.isBuffer(x)?x.toString("binary"):_0(x));break;case"array":v=nh(x);break;case"string":v=x;break;default:throw new Error("Unrecognized type "+y.type)}return k[0]==239&&k[1]==187&&k[2]==191?v=Yd(v.slice(3)):y.type!="string"&&y.type!="buffer"&&y.codepage==65001?v=Yd(v):y.type=="binary",v.slice(0,19)=="socialcalc:version:"?hw.to_sheet(y.type=="string"?v:Yd(v),y):c(v,y)}function p(x,y){return fo(f(x,y),y)}function g(x){for(var y=[],v=za(x["!ref"]),k,T=Array.isArray(x),N=v.s.r;N<=v.e.r;++N){for(var S=[],A=v.s.c;A<=v.e.c;++A){var C=Sa({r:N,c:A});if(k=T?(x[N]||[])[A]:x[C],!k||k.v==null){S.push(" ");continue}for(var O=(k.w||(vi(k),k.w)||"").slice(0,10);O.length<10;)O+=" ";S.push(O+(A===0?" ":""))}y.push(S.join(""))}return y.join(`
`)}return{to_workbook:p,to_sheet:f,from_sheet:g}})(),Iv=(function(){function e(D,H,Z){if(D){Dn(D,D.l||0);for(var K=Z.Enum||ae;D.l<D.length;){var ue=D.read_shift(2),Le=K[ue]||K[65535],Ne=D.read_shift(2),We=D.l+Ne,Fe=Le.f&&Le.f(D,Ne,Z);if(D.l=We,H(Fe,Le,ue))return}}}function t(D,H){switch(H.type){case"base64":return r(ys(bi(D)),H);case"binary":return r(ys(D),H);case"buffer":case"array":return r(D,H)}throw"Unsupported type "+H.type}function r(D,H){if(!D)return D;var Z=H||{},K=Z.dense?[]:{},ue="Sheet1",Le="",Ne=0,We={},Fe=[],tt=[],ft={s:{r:0,c:0},e:{r:0,c:0}},Dt=Z.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)Z.Enum=ae,e(D,function(He,oe,we){switch(we){case 0:Z.vers=He,He>=4096&&(Z.qpro=!0);break;case 6:ft=He;break;case 204:He&&(Le=He);break;case 222:Le=He;break;case 15:case 51:Z.qpro||(He[1].v=He[1].v.slice(1));case 13:case 14:case 16:we==14&&(He[2]&112)==112&&(He[2]&15)>1&&(He[2]&15)<15&&(He[1].z=Z.dateNF||Ka[14],Z.cellDates&&(He[1].t="d",He[1].v=A2(He[1].v))),Z.qpro&&He[3]>Ne&&(K["!ref"]=cr(ft),We[ue]=K,Fe.push(ue),K=Z.dense?[]:{},ft={s:{r:0,c:0},e:{r:0,c:0}},Ne=He[3],ue=Le||"Sheet"+(Ne+1),Le="");var Ie=Z.dense?(K[He[0].r]||[])[He[0].c]:K[Sa(He[0])];if(Ie){Ie.t=He[1].t,Ie.v=He[1].v,He[1].z!=null&&(Ie.z=He[1].z),He[1].f!=null&&(Ie.f=He[1].f);break}Z.dense?(K[He[0].r]||(K[He[0].r]=[]),K[He[0].r][He[0].c]=He[1]):K[Sa(He[0])]=He[1];break}},Z);else if(D[2]==26||D[2]==14)Z.Enum=F,D[2]==14&&(Z.qpro=!0,D.l=0),e(D,function(He,oe,we){switch(we){case 204:ue=He;break;case 22:He[1].v=He[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(He[3]>Ne&&(K["!ref"]=cr(ft),We[ue]=K,Fe.push(ue),K=Z.dense?[]:{},ft={s:{r:0,c:0},e:{r:0,c:0}},Ne=He[3],ue="Sheet"+(Ne+1)),Dt>0&&He[0].r>=Dt)break;Z.dense?(K[He[0].r]||(K[He[0].r]=[]),K[He[0].r][He[0].c]=He[1]):K[Sa(He[0])]=He[1],ft.e.c<He[0].c&&(ft.e.c=He[0].c),ft.e.r<He[0].r&&(ft.e.r=He[0].r);break;case 27:He[14e3]&&(tt[He[14e3][0]]=He[14e3][1]);break;case 1537:tt[He[0]]=He[1],He[0]==Ne&&(ue=He[1]);break}},Z);else throw new Error("Unrecognized LOTUS BOF "+D[2]);if(K["!ref"]=cr(ft),We[Le||ue]=K,Fe.push(Le||ue),!tt.length)return{SheetNames:Fe,Sheets:We};for(var Ve={},At=[],jt=0;jt<tt.length;++jt)We[Fe[jt]]?(At.push(tt[jt]||Fe[jt]),Ve[tt[jt]]=We[tt[jt]]||We[Fe[jt]]):(At.push(tt[jt]),Ve[tt[jt]]={"!ref":"A1"});return{SheetNames:At,Sheets:Ve}}function s(D,H){var Z=H||{};if(+Z.codepage>=0&&r0(+Z.codepage),Z.type=="string")throw new Error("Cannot write WK1 to JS string");var K=yn(),ue=za(D["!ref"]),Le=Array.isArray(D),Ne=[];pt(K,0,d(1030)),pt(K,6,p(ue));for(var We=Math.min(ue.e.r,8191),Fe=ue.s.r;Fe<=We;++Fe)for(var tt=Pr(Fe),ft=ue.s.c;ft<=ue.e.c;++ft){Fe===ue.s.r&&(Ne[ft]=Wr(ft));var Dt=Ne[ft]+tt,Ve=Le?(D[Fe]||[])[ft]:D[Dt];if(!(!Ve||Ve.t=="z"))if(Ve.t=="n")(Ve.v|0)==Ve.v&&Ve.v>=-32768&&Ve.v<=32767?pt(K,13,k(Fe,ft,Ve.v)):pt(K,14,N(Fe,ft,Ve.v));else{var At=vi(Ve);pt(K,15,y(Fe,ft,At.slice(0,239)))}}return pt(K,1),K.end()}function i(D,H){var Z=H||{};if(+Z.codepage>=0&&r0(+Z.codepage),Z.type=="string")throw new Error("Cannot write WK3 to JS string");var K=yn();pt(K,0,c(D));for(var ue=0,Le=0;ue<D.SheetNames.length;++ue)(D.Sheets[D.SheetNames[ue]]||{})["!ref"]&&pt(K,27,fe(D.SheetNames[ue],Le++));var Ne=0;for(ue=0;ue<D.SheetNames.length;++ue){var We=D.Sheets[D.SheetNames[ue]];if(!(!We||!We["!ref"])){for(var Fe=za(We["!ref"]),tt=Array.isArray(We),ft=[],Dt=Math.min(Fe.e.r,8191),Ve=Fe.s.r;Ve<=Dt;++Ve)for(var At=Pr(Ve),jt=Fe.s.c;jt<=Fe.e.c;++jt){Ve===Fe.s.r&&(ft[jt]=Wr(jt));var He=ft[jt]+At,oe=tt?(We[Ve]||[])[jt]:We[He];if(!(!oe||oe.t=="z"))if(oe.t=="n")pt(K,23,de(Ve,jt,Ne,oe.v));else{var we=vi(oe);pt(K,22,z(Ve,jt,Ne,we.slice(0,239)))}}++Ne}}return pt(K,1),K.end()}function d(D){var H=Ge(2);return H.write_shift(2,D),H}function c(D){var H=Ge(26);H.write_shift(2,4096),H.write_shift(2,4),H.write_shift(4,0);for(var Z=0,K=0,ue=0,Le=0;Le<D.SheetNames.length;++Le){var Ne=D.SheetNames[Le],We=D.Sheets[Ne];if(!(!We||!We["!ref"])){++ue;var Fe=zn(We["!ref"]);Z<Fe.e.r&&(Z=Fe.e.r),K<Fe.e.c&&(K=Fe.e.c)}}return Z>8191&&(Z=8191),H.write_shift(2,Z),H.write_shift(1,ue),H.write_shift(1,K),H.write_shift(2,0),H.write_shift(2,0),H.write_shift(1,1),H.write_shift(1,2),H.write_shift(4,0),H.write_shift(4,0),H}function f(D,H,Z){var K={s:{c:0,r:0},e:{c:0,r:0}};return H==8&&Z.qpro?(K.s.c=D.read_shift(1),D.l++,K.s.r=D.read_shift(2),K.e.c=D.read_shift(1),D.l++,K.e.r=D.read_shift(2),K):(K.s.c=D.read_shift(2),K.s.r=D.read_shift(2),H==12&&Z.qpro&&(D.l+=2),K.e.c=D.read_shift(2),K.e.r=D.read_shift(2),H==12&&Z.qpro&&(D.l+=2),K.s.c==65535&&(K.s.c=K.e.c=K.s.r=K.e.r=0),K)}function p(D){var H=Ge(8);return H.write_shift(2,D.s.c),H.write_shift(2,D.s.r),H.write_shift(2,D.e.c),H.write_shift(2,D.e.r),H}function g(D,H,Z){var K=[{c:0,r:0},{t:"n",v:0},0,0];return Z.qpro&&Z.vers!=20768?(K[0].c=D.read_shift(1),K[3]=D.read_shift(1),K[0].r=D.read_shift(2),D.l+=2):(K[2]=D.read_shift(1),K[0].c=D.read_shift(2),K[0].r=D.read_shift(2)),K}function x(D,H,Z){var K=D.l+H,ue=g(D,H,Z);if(ue[1].t="s",Z.vers==20768){D.l++;var Le=D.read_shift(1);return ue[1].v=D.read_shift(Le,"utf8"),ue}return Z.qpro&&D.l++,ue[1].v=D.read_shift(K-D.l,"cstr"),ue}function y(D,H,Z){var K=Ge(7+Z.length);K.write_shift(1,255),K.write_shift(2,H),K.write_shift(2,D),K.write_shift(1,39);for(var ue=0;ue<K.length;++ue){var Le=Z.charCodeAt(ue);K.write_shift(1,Le>=128?95:Le)}return K.write_shift(1,0),K}function v(D,H,Z){var K=g(D,H,Z);return K[1].v=D.read_shift(2,"i"),K}function k(D,H,Z){var K=Ge(7);return K.write_shift(1,255),K.write_shift(2,H),K.write_shift(2,D),K.write_shift(2,Z,"i"),K}function T(D,H,Z){var K=g(D,H,Z);return K[1].v=D.read_shift(8,"f"),K}function N(D,H,Z){var K=Ge(13);return K.write_shift(1,255),K.write_shift(2,H),K.write_shift(2,D),K.write_shift(8,Z,"f"),K}function S(D,H,Z){var K=D.l+H,ue=g(D,H,Z);if(ue[1].v=D.read_shift(8,"f"),Z.qpro)D.l=K;else{var Le=D.read_shift(2);P(D.slice(D.l,D.l+Le),ue),D.l+=Le}return ue}function A(D,H,Z){var K=H&32768;return H&=-32769,H=(K?D:0)+(H>=8192?H-16384:H),(K?"":"$")+(Z?Wr(H):Pr(H))}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]},O=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function P(D,H){Dn(D,0);for(var Z=[],K=0,ue="",Le="",Ne="",We="";D.l<D.length;){var Fe=D[D.l++];switch(Fe){case 0:Z.push(D.read_shift(8,"f"));break;case 1:Le=A(H[0].c,D.read_shift(2),!0),ue=A(H[0].r,D.read_shift(2),!1),Z.push(Le+ue);break;case 2:{var tt=A(H[0].c,D.read_shift(2),!0),ft=A(H[0].r,D.read_shift(2),!1);Le=A(H[0].c,D.read_shift(2),!0),ue=A(H[0].r,D.read_shift(2),!1),Z.push(tt+ft+":"+Le+ue)}break;case 3:if(D.l<D.length){console.error("WK1 premature formula end");return}break;case 4:Z.push("("+Z.pop()+")");break;case 5:Z.push(D.read_shift(2));break;case 6:{for(var Dt="";Fe=D[D.l++];)Dt+=String.fromCharCode(Fe);Z.push('"'+Dt.replace(/"/g,'""')+'"')}break;case 8:Z.push("-"+Z.pop());break;case 23:Z.push("+"+Z.pop());break;case 22:Z.push("NOT("+Z.pop()+")");break;case 20:case 21:We=Z.pop(),Ne=Z.pop(),Z.push(["AND","OR"][Fe-20]+"("+Ne+","+We+")");break;default:if(Fe<32&&O[Fe])We=Z.pop(),Ne=Z.pop(),Z.push(Ne+O[Fe]+We);else if(C[Fe]){if(K=C[Fe][1],K==69&&(K=D[D.l++]),K>Z.length){console.error("WK1 bad formula parse 0x"+Fe.toString(16)+":|"+Z.join("|")+"|");return}var Ve=Z.slice(-K);Z.length-=K,Z.push(C[Fe][0]+"("+Ve.join(",")+")")}else return Fe<=7?console.error("WK1 invalid opcode "+Fe.toString(16)):Fe<=24?console.error("WK1 unsupported op "+Fe.toString(16)):Fe<=30?console.error("WK1 invalid opcode "+Fe.toString(16)):Fe<=115?console.error("WK1 unsupported function opcode "+Fe.toString(16)):console.error("WK1 unrecognized opcode "+Fe.toString(16))}}Z.length==1?H[1].f=""+Z[0]:console.error("WK1 bad formula parse |"+Z.join("|")+"|")}function B(D){var H=[{c:0,r:0},{t:"n",v:0},0];return H[0].r=D.read_shift(2),H[3]=D[D.l++],H[0].c=D[D.l++],H}function V(D,H){var Z=B(D);return Z[1].t="s",Z[1].v=D.read_shift(H-4,"cstr"),Z}function z(D,H,Z,K){var ue=Ge(6+K.length);ue.write_shift(2,D),ue.write_shift(1,Z),ue.write_shift(1,H),ue.write_shift(1,39);for(var Le=0;Le<K.length;++Le){var Ne=K.charCodeAt(Le);ue.write_shift(1,Ne>=128?95:Ne)}return ue.write_shift(1,0),ue}function U(D,H){var Z=B(D);Z[1].v=D.read_shift(2);var K=Z[1].v>>1;if(Z[1].v&1)switch(K&7){case 0:K=(K>>3)*5e3;break;case 1:K=(K>>3)*500;break;case 2:K=(K>>3)/20;break;case 3:K=(K>>3)/200;break;case 4:K=(K>>3)/2e3;break;case 5:K=(K>>3)/2e4;break;case 6:K=(K>>3)/16;break;case 7:K=(K>>3)/64;break}return Z[1].v=K,Z}function J(D,H){var Z=B(D),K=D.read_shift(4),ue=D.read_shift(4),Le=D.read_shift(2);if(Le==65535)return K===0&&ue===3221225472?(Z[1].t="e",Z[1].v=15):K===0&&ue===3489660928?(Z[1].t="e",Z[1].v=42):Z[1].v=0,Z;var Ne=Le&32768;return Le=(Le&32767)-16446,Z[1].v=(1-Ne*2)*(ue*Math.pow(2,Le+32)+K*Math.pow(2,Le)),Z}function de(D,H,Z,K){var ue=Ge(14);if(ue.write_shift(2,D),ue.write_shift(1,Z),ue.write_shift(1,H),K==0)return ue.write_shift(4,0),ue.write_shift(4,0),ue.write_shift(2,65535),ue;var Le=0,Ne=0,We=0,Fe=0;return K<0&&(Le=1,K=-K),Ne=Math.log2(K)|0,K/=Math.pow(2,Ne-31),Fe=K>>>0,(Fe&2147483648)==0&&(K/=2,++Ne,Fe=K>>>0),K-=Fe,Fe|=2147483648,Fe>>>=0,K*=Math.pow(2,32),We=K>>>0,ue.write_shift(4,We),ue.write_shift(4,Fe),Ne+=16383+(Le?32768:0),ue.write_shift(2,Ne),ue}function ye(D,H){var Z=J(D);return D.l+=H-14,Z}function ie(D,H){var Z=B(D),K=D.read_shift(4);return Z[1].v=K>>6,Z}function he(D,H){var Z=B(D),K=D.read_shift(8,"f");return Z[1].v=K,Z}function ve(D,H){var Z=he(D);return D.l+=H-10,Z}function me(D,H){return D[D.l+H-1]==0?D.read_shift(H,"cstr"):""}function ee(D,H){var Z=D[D.l++];Z>H-1&&(Z=H-1);for(var K="";K.length<Z;)K+=String.fromCharCode(D[D.l++]);return K}function q(D,H,Z){if(!(!Z.qpro||H<21)){var K=D.read_shift(1);D.l+=17,D.l+=1,D.l+=2;var ue=D.read_shift(H-21,"cstr");return[K,ue]}}function Q(D,H){for(var Z={},K=D.l+H;D.l<K;){var ue=D.read_shift(2);if(ue==14e3){for(Z[ue]=[0,""],Z[ue][0]=D.read_shift(2);D[D.l];)Z[ue][1]+=String.fromCharCode(D[D.l]),D.l++;D.l++}}return Z}function fe(D,H){var Z=Ge(5+D.length);Z.write_shift(2,14e3),Z.write_shift(2,H);for(var K=0;K<D.length;++K){var ue=D.charCodeAt(K);Z[Z.l++]=ue>127?95:ue}return Z[Z.l++]=0,Z}var ae={0:{n:"BOF",f:ow},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:v},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:ee},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:V},23:{n:"NUMBER17",f:J},24:{n:"NUMBER18",f:U},25:{n:"FORMULA19",f:ye},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:Q},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:ie},38:{n:"??"},39:{n:"NUMBER27",f:he},40:{n:"FORMULA28",f:ve},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:q},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}})(),FE=/^\s|\s$|[\t\n\r]/;function mw(e,t){if(!t.bookSST)return"";var r=[dr];r[r.length]=gt("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(FE)&&(d+=' xml:space="preserve"'),d+=">"+ja(i.t)+"</t>"),d+="</si>",r[r.length]=d}return r.length>2&&(r[r.length]="</sst>",r[1]=r[1].replace("/>",">")),r.join("")}function IE(e){return[e.read_shift(4),e.read_shift(4)]}function zE(e,t){return t||(t=Ge(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var BE=AT;function UE(e){var t=yn();at(t,159,zE(e));for(var r=0;r<e.length;++r)at(t,19,BE(e[r]));return at(t,160),t.end()}function HE(e){for(var t=[],r=e.split(""),s=0;s<r.length;++s)t[s]=r[s].charCodeAt(0);return t}function gw(e){var t=0,r,s=HE(e),i=s.length+1,d,c,f,p,g;for(r=lo(i),r[0]=s.length,d=1;d!=i;++d)r[d]=s[d-1];for(d=i-1;d>=0;--d)c=r[d],f=(t&16384)===0?0:1,p=t<<1&32767,g=f|p,t=g^c;return t^52811}var $E=(function(){function e(i,d){switch(d.type){case"base64":return t(bi(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(nh(i),d)}throw new Error("Unrecognized type "+d.type)}function t(i,d){var c=d||{},f=c.dense?[]:{},p=i.match(/\\trowd.*?\\row\b/g);if(!p.length)throw new Error("RTF missing table");var g={s:{c:0,r:0},e:{c:0,r:p.length-1}};return p.forEach(function(x,y){Array.isArray(f)&&(f[y]=[]);for(var v=/\\\w+\b/g,k=0,T,N=-1;T=v.exec(x);){switch(T[0]){case"\\cell":var S=x.slice(k,v.lastIndex-T[0].length);if(S[0]==" "&&(S=S.slice(1)),++N,S.length){var A={v:S,t:"s"};Array.isArray(f)?f[y][N]=A:f[Sa({r:y,c:N})]=A}break}k=v.lastIndex}N>g.e.c&&(g.e.c=N)}),f["!ref"]=cr(g),f}function r(i,d){return fo(e(i,d),d)}function s(i){for(var d=["{\\rtf1\\ansi"],c=za(i["!ref"]),f,p=Array.isArray(i),g=c.s.r;g<=c.e.r;++g){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=Sa({r:g,c:x});f=p?(i[g]||[])[x]:i[y],!(!f||f.v==null&&(!f.f||f.F))&&(d.push(" "+(f.w||(vi(f),f.w))),d.push("\\cell"))}d.push("\\pard\\intbl\\row")}return d.join("")+"}"}return{to_workbook:r,to_sheet:e,from_sheet:s}})();function zv(e){for(var t=0,r=1;t!=3;++t)r=r*256+(e[t]>255?255:e[t]<0?0:e[t]);return r.toString(16).toUpperCase().slice(1)}var WE=6,pi=WE;function Ff(e){return Math.floor((e+Math.round(128/pi)/256)*pi)}function If(e){return Math.floor((e-5)/pi*100+.5)/100}function ap(e){return Math.round((e*pi+5)/pi*256)/256}function Fp(e){e.width?(e.wpx=Ff(e.width),e.wch=If(e.wpx),e.MDW=pi):e.wpx?(e.wch=If(e.wpx),e.width=ap(e.wch),e.MDW=pi):typeof e.wch=="number"&&(e.width=ap(e.wch),e.wpx=Ff(e.width),e.MDW=pi),e.customWidth&&delete e.customWidth}var VE=96,pw=VE;function zf(e){return e*96/pw}function xw(e){return e*pw/96}function GE(e){var t=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(r){for(var s=r[0];s<=r[1];++s)e[s]!=null&&(t[t.length]=gt("numFmt",null,{numFmtId:s,formatCode:ja(e[s])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=gt("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function ZE(e){var t=[];return t[t.length]=gt("cellXfs",null),e.forEach(function(r){t[t.length]=gt("xf",null,r)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=gt("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function yw(e,t){var r=[dr,gt("styleSheet",null,{xmlns:Dc[0],"xmlns:vt":_r.vt})],s;return e.SSF&&(s=GE(e.SSF))!=null&&(r[r.length]=s),r[r.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',r[r.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',r[r.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',r[r.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(s=ZE(t.cellXfs))&&(r[r.length]=s),r[r.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',r[r.length]='<dxfs count="0"/>',r[r.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',r.length>2&&(r[r.length]="</styleSheet>",r[1]=r[1].replace("/>",">")),r.join("")}function qE(e,t){var r=e.read_shift(2),s=Vr(e);return[r,s]}function YE(e,t,r){r||(r=Ge(6+4*t.length)),r.write_shift(2,e),kr(t,r);var s=r.length>r.l?r.slice(0,r.l):r;return r.l==null&&(r.l=r.length),s}function XE(e,t,r){var s={};s.sz=e.read_shift(2)/20;var i=FT(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 p=e.read_shift(1);switch(p>0&&(s.charset=p),e.l++,s.color=RT(e),e.read_shift(1)){case 1:s.scheme="major";break;case 2:s.scheme="minor";break}return s.name=Vr(e),s}function JE(e,t){t||(t=Ge(153)),t.write_shift(2,e.sz*20),IT(e,t),t.write_shift(2,e.bold?700:400);var r=0;e.vertAlign=="superscript"?r=1:e.vertAlign=="subscript"&&(r=2),t.write_shift(2,r),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),Pf(e.color,t);var s=0;return s=2,t.write_shift(1,s),kr(e.name,t),t.length>t.l?t.slice(0,t.l):t}var KE=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],Mg,QE=Vs;function Bv(e,t){t||(t=Ge(84)),Mg||(Mg=jp(KE));var r=Mg[e.patternType];r==null&&(r=40),t.write_shift(4,r);var s=0;if(r!=40)for(Pf({auto:1},t),Pf({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 eC(e,t){var r=e.l+t,s=e.read_shift(2),i=e.read_shift(2);return e.l=r,{ixfe:s,numFmtId:i}}function bw(e,t,r){r||(r=Ge(16)),r.write_shift(2,t||0),r.write_shift(2,e.numFmtId||0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(1,0),r.write_shift(1,0);var s=0;return r.write_shift(1,s),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(1,0),r}function Ud(e,t){return t||(t=Ge(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var tC=Vs;function aC(e,t){return t||(t=Ge(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 rC(e,t){return t||(t=Ge(52)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),Df(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function nC(e,t,r){var s=Ge(2052);return s.write_shift(4,e),Df(t,s),Df(r,s),s.length>s.l?s.slice(0,s.l):s}function sC(e,t){if(t){var r=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&++r}),r!=0&&(at(e,615,_s(r)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&at(e,44,YE(i,t[i]))}),at(e,616))}}function iC(e){var t=1;at(e,611,_s(t)),at(e,43,JE({sz:12,color:{theme:1},name:"Calibri",family:2})),at(e,612)}function lC(e){var t=2;at(e,603,_s(t)),at(e,45,Bv({patternType:"none"})),at(e,45,Bv({patternType:"gray125"})),at(e,604)}function oC(e){var t=1;at(e,613,_s(t)),at(e,46,aC()),at(e,614)}function cC(e){var t=1;at(e,626,_s(t)),at(e,47,bw({numFmtId:0},65535)),at(e,627)}function dC(e,t){at(e,617,_s(t.length)),t.forEach(function(r){at(e,47,bw(r,0))}),at(e,618)}function uC(e){var t=1;at(e,619,_s(t)),at(e,48,rC({xfId:0,name:"Normal"})),at(e,620)}function fC(e){var t=0;at(e,505,_s(t)),at(e,506)}function hC(e){var t=0;at(e,508,nC(t,"TableStyleMedium9","PivotStyleMedium4")),at(e,509)}function mC(e,t){var r=yn();return at(r,278),sC(r,e.SSF),iC(r),lC(r),oC(r),cC(r),dC(r,t.cellXfs),uC(r),fC(r),hC(r),at(r,279),r.end()}function vw(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var r=[dr];return r[r.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',r[r.length]="<a:themeElements>",r[r.length]='<a:clrScheme name="Office">',r[r.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',r[r.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',r[r.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',r[r.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',r[r.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',r[r.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',r[r.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',r[r.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',r[r.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',r[r.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',r[r.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',r[r.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',r[r.length]="</a:clrScheme>",r[r.length]='<a:fontScheme name="Office">',r[r.length]="<a:majorFont>",r[r.length]='<a:latin typeface="Cambria"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Times New Roman"/>',r[r.length]='<a:font script="Hebr" typeface="Times New Roman"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="MoolBoran"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Times New Roman"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:majorFont>",r[r.length]="<a:minorFont>",r[r.length]='<a:latin typeface="Calibri"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Arial"/>',r[r.length]='<a:font script="Hebr" typeface="Arial"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="DaunPenh"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Arial"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:minorFont>",r[r.length]="</a:fontScheme>",r[r.length]='<a:fmtScheme name="Office">',r[r.length]="<a:fillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="1"/>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.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>',r[r.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>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="0"/>',r[r.length]="</a:gradFill>",r[r.length]="</a:fillStyleLst>",r[r.length]="<a:lnStyleLst>",r[r.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>',r[r.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>',r[r.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>',r[r.length]="</a:lnStyleLst>",r[r.length]="<a:effectStyleLst>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.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>',r[r.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',r[r.length]="</a:effectStyle>",r[r.length]="</a:effectStyleLst>",r[r.length]="<a:bgFillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.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>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]="</a:bgFillStyleLst>",r[r.length]="</a:fmtScheme>",r[r.length]="</a:themeElements>",r[r.length]="<a:objectDefaults>",r[r.length]="<a:spDef>",r[r.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>',r[r.length]="</a:spDef>",r[r.length]="<a:lnDef>",r[r.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>',r[r.length]="</a:lnDef>",r[r.length]="</a:objectDefaults>",r[r.length]="<a:extraClrSchemeLst/>",r[r.length]="</a:theme>",r.join("")}function gC(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:Vr(e)}}function pC(e){var t=Ge(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),kr(e.name,t),t.slice(0,t.l)}function xC(e){for(var t=[],r=e.read_shift(4);r-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function yC(e){var t=Ge(4+8*e.length);t.write_shift(4,e.length);for(var r=0;r<e.length;++r)t.write_shift(4,e[r][0]),t.write_shift(4,e[r][1]);return t}function bC(e,t){var r=Ge(8+2*t.length);return r.write_shift(4,e),kr(t,r),r.slice(0,r.l)}function vC(e){return e.l+=4,e.read_shift(4)!=0}function _C(e,t){var r=Ge(8);return r.write_shift(4,e),r.write_shift(4,1),r}function wC(){var e=yn();return at(e,332),at(e,334,_s(1)),at(e,335,pC({name:"XLDAPR",version:12e4,flags:3496657072})),at(e,336),at(e,339,bC(1,"XLDAPR")),at(e,52),at(e,35,_s(514)),at(e,4096,_s(0)),at(e,4097,es(1)),at(e,36),at(e,53),at(e,340),at(e,337,_C(1)),at(e,51,yC([[1,0]])),at(e,338),at(e,333),e.end()}function _w(){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 kC(e){var t={};t.i=e.read_shift(4);var r={};r.r=e.read_shift(4),r.c=e.read_shift(4),t.r=Sa(r);var s=e.read_shift(1);return s&2&&(t.l="1"),s&8&&(t.a="1"),t}var mc=1024;function ww(e,t){for(var r=[21600,21600],s=["m0,0l0",r[1],r[0],r[1],r[0],"0xe"].join(","),i=[gt("xml",null,{"xmlns:v":Pn.v,"xmlns:o":Pn.o,"xmlns:x":Pn.x,"xmlns:mv":Pn.mv}).replace(/\/>/,">"),gt("o:shapelayout",gt("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),gt("v:shapetype",[gt("v:stroke",null,{joinstyle:"miter"}),gt("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:r.join(","),path:s})];mc<e*1e3;)mc+=1e3;return t.forEach(function(d){var c=wr(d[0]),f={color2:"#BEFF82",type:"gradient"};f.type=="gradient"&&(f.angle="-180");var p=f.type=="gradient"?gt("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,g=gt("v:fill",p,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"})+">",g,gt("v:shadow",null,x),gt("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 kw(e){var t=[dr,gt("comments",null,{xmlns:Dc[0]})],r=[];return t.push("<authors>"),e.forEach(function(s){s[1].forEach(function(i){var d=ja(i.a);r.indexOf(d)==-1&&(r.push(d),t.push("<author>"+d+"</author>")),i.T&&i.ID&&r.indexOf("tc="+i.ID)==-1&&(r.push("tc="+i.ID),t.push("<author>tc="+i.ID+"</author>"))})}),r.length==0&&(r.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=r.indexOf("tc="+s[1][0].ID):s[1].forEach(function(p){p.a&&(i=r.indexOf(ja(p.a))),d.push(p.t||"")}),t.push('<comment ref="'+s[0]+'" authorId="'+i+'"><text>'),d.length<=1)t.push(Dr("t",ja(d[0]||"")));else{for(var c=`Comment:
`+d[0]+`
`,f=1;f<d.length;++f)c+=`Reply:
`+d[f]+`
`;t.push(Dr("t",ja(c)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function NC(e,t,r){var s=[dr,gt("ThreadedComments",null,{xmlns:_r.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 p={ref:i[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+r.tcid++).slice(-12)+"}"};f==0?d=p.id:p.parentId=d,c.ID=p.id,c.a&&(p.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(c.a)).slice(-12)+"}"),s.push(gt("threadedComment",Dr("text",c.t||""),p))})}),s.push("</ThreadedComments>"),s.join("")}function jC(e){var t=[dr,gt("personList",null,{xmlns:_r.TCMNT,"xmlns:x":Dc[0]}).replace(/[\/]>/,">")];return e.forEach(function(r,s){t.push(gt("person",null,{displayName:r,id:"{54EE7950-7262-4200-6969-"+("000000000000"+s).slice(-12)+"}",userId:r,providerId:"None"}))}),t.push("</personList>"),t.join("")}function SC(e){var t={};t.iauthor=e.read_shift(4);var r=po(e);return t.rfx=r.s,t.ref=Sa(r.s),e.l+=16,t}function TC(e,t){return t==null&&(t=Ge(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 EC=Vr;function CC(e){return kr(e.slice(0,54))}function AC(e){var t=yn(),r=[];return at(t,628),at(t,630),e.forEach(function(s){s[1].forEach(function(i){r.indexOf(i.a)>-1||(r.push(i.a.slice(0,54)),at(t,632,CC(i.a)))})}),at(t,631),at(t,633),e.forEach(function(s){s[1].forEach(function(i){i.iauthor=r.indexOf(i.a);var d={s:wr(s[0]),e:wr(s[0])};at(t,635,TC([d,i])),i.t&&i.t.length>0&&at(t,637,MT(i)),at(t,636),delete i.iauthor})}),at(t,634),at(t,629),t.end()}function OC(e,t){t.FullPaths.forEach(function(r,s){if(s!=0){var i=r.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");i.slice(-1)!=="/"&&La.utils.cfb_add(e,i,t.FileIndex[s].content)}})}var Nw=["xlsb","xlsm","xlam","biff8","xla"],MC=(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 r(s,i,d,c){var f=!1,p=!1;d.length==0?p=!0:d.charAt(0)=="["&&(p=!0,d=d.slice(1,-1)),c.length==0?f=!0:c.charAt(0)=="["&&(f=!0,c=c.slice(1,-1));var g=d.length>0?parseInt(d,10)|0:0,x=c.length>0?parseInt(c,10)|0:0;return f?x+=t.c:--x,p?g+=t.r:--g,i+(f?"":"$")+Wr(x)+(p?"":"$")+Pr(g)}return function(i,d){return t=d,i.replace(e,r)}})(),Ip=/(^|[^._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,zp=(function(){return function(t,r){return t.replace(Ip,function(s,i,d,c,f,p){var g=Mp(c)-(d?0:r.c),x=Op(p)-(f?0:r.r),y=x==0?"":f?x+1:"["+x+"]",v=g==0?"":d?g+1:"["+g+"]";return i+"R"+y+"C"+v})}})();function LC(e,t){return e.replace(Ip,function(r,s,i,d,c,f){return s+(i=="$"?i+d:Wr(Mp(d)+t.c))+(c=="$"?c+f:Pr(Op(f)+t.r))})}function DC(e){return e.length!=1}function or(e){e.l+=1}function dl(e,t){var r=e.read_shift(2);return[r&16383,r>>14&1,r>>15&1]}function jw(e,t,r){var s=2;if(r){if(r.biff>=2&&r.biff<=5)return Sw(e);r.biff==12&&(s=4)}var i=e.read_shift(s),d=e.read_shift(s),c=dl(e),f=dl(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 Sw(e){var t=dl(e),r=dl(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:r[0],c:i,cRel:r[1],rRel:r[2]}}}function PC(e,t,r){if(r.biff<8)return Sw(e);var s=e.read_shift(r.biff==12?4:2),i=e.read_shift(r.biff==12?4:2),d=dl(e),c=dl(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 Tw(e,t,r){if(r&&r.biff>=2&&r.biff<=5)return RC(e);var s=e.read_shift(r&&r.biff==12?4:2),i=dl(e);return{r:s,c:i[0],cRel:i[1],rRel:i[2]}}function RC(e){var t=dl(e),r=e.read_shift(1);return{r:t[0],c:r,cRel:t[1],rRel:t[2]}}function FC(e){var t=e.read_shift(2),r=e.read_shift(2);return{r:t,c:r&255,fQuoted:!!(r&16384),cRel:r>>15,rRel:r>>15}}function IC(e,t,r){var s=r&&r.biff?r.biff:8;if(s>=2&&s<=5)return zC(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 zC(e){var t=e.read_shift(2),r=e.read_shift(1),s=(t&32768)>>15,i=(t&16384)>>14;return t&=16383,s==1&&t>=8192&&(t=t-16384),i==1&&r>=128&&(r=r-256),{r:t,c:r,cRel:i,rRel:s}}function BC(e,t,r){var s=(e[e.l++]&96)>>5,i=jw(e,r.biff>=2&&r.biff<=5?6:8,r);return[s,i]}function UC(e,t,r){var s=(e[e.l++]&96)>>5,i=e.read_shift(2,"i"),d=8;if(r)switch(r.biff){case 5:e.l+=12,d=6;break;case 12:d=12;break}var c=jw(e,d,r);return[s,i,c]}function HC(e,t,r){var s=(e[e.l++]&96)>>5;return e.l+=r&&r.biff>8?12:r.biff<8?6:8,[s]}function $C(e,t,r){var s=(e[e.l++]&96)>>5,i=e.read_shift(2),d=8;if(r)switch(r.biff){case 5:e.l+=12,d=6;break;case 12:d=12;break}return e.l+=d,[s,i]}function WC(e,t,r){var s=(e[e.l++]&96)>>5,i=PC(e,t-1,r);return[s,i]}function VC(e,t,r){var s=(e[e.l++]&96)>>5;return e.l+=r.biff==2?6:r.biff==12?14:7,[s]}function Uv(e){var t=e[e.l+1]&1,r=1;return e.l+=4,[t,r]}function GC(e,t,r){e.l+=2;for(var s=e.read_shift(r&&r.biff==2?1:2),i=[],d=0;d<=s;++d)i.push(e.read_shift(r&&r.biff==2?1:2));return i}function ZC(e,t,r){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(r&&r.biff==2?1:2)]}function qC(e,t,r){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(r&&r.biff==2?1:2)]}function YC(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function XC(e,t,r){var s=e[e.l+1]&255?1:0;return e.l+=r&&r.biff==2?3:4,[s]}function Ew(e){var t=e.read_shift(1),r=e.read_shift(1);return[t,r]}function JC(e){return e.read_shift(2),Ew(e)}function KC(e){return e.read_shift(2),Ew(e)}function QC(e,t,r){var s=(e[e.l]&96)>>5;e.l+=1;var i=Tw(e,0,r);return[s,i]}function e8(e,t,r){var s=(e[e.l]&96)>>5;e.l+=1;var i=IC(e,0,r);return[s,i]}function t8(e,t,r){var s=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(2);r&&r.biff==5&&(e.l+=12);var d=Tw(e,0,r);return[s,i,d]}function a8(e,t,r){var s=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(r&&r.biff<=3?1:2);return[a7[i],Ow[i],s]}function r8(e,t,r){var s=e[e.l++],i=e.read_shift(1),d=r&&r.biff<=3?[s==88?-1:0,e.read_shift(1)]:n8(e);return[i,(d[0]===0?Ow:t7)[d[1]]]}function n8(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function s8(e,t,r){e.l+=r&&r.biff==2?3:4}function i8(e,t,r){if(e.l++,r&&r.biff==12)return[e.read_shift(4,"i"),0];var s=e.read_shift(2),i=e.read_shift(r&&r.biff==2?1:2);return[s,i]}function l8(e){return e.l++,N0[e.read_shift(1)]}function o8(e){return e.l++,e.read_shift(2)}function c8(e){return e.l++,e.read_shift(1)!==0}function d8(e){return e.l++,Fc(e)}function u8(e,t,r){return e.l++,dw(e,t-1,r)}function f8(e,t){var r=[e.read_shift(1)];if(t==12)switch(r[0]){case 2:r[0]=4;break;case 4:r[0]=16;break;case 0:r[0]=1;break;case 1:r[0]=2;break}switch(r[0]){case 4:r[1]=tE(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:r[1]=N0[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:r[1]=Fc(e);break;case 2:r[1]=sE(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+r[0])}return r}function h8(e,t,r){for(var s=e.read_shift(r.biff==12?4:2),i=[],d=0;d!=s;++d)i.push((r.biff==12?po:oE)(e));return i}function m8(e,t,r){var s=0,i=0;r.biff==12?(s=e.read_shift(4),i=e.read_shift(4)):(i=1+e.read_shift(1),s=1+e.read_shift(2)),r.biff>=2&&r.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]=f8(e,r.biff);return c}function g8(e,t,r){var s=e.read_shift(1)>>>5&3,i=!r||r.biff>=8?4:2,d=e.read_shift(i);switch(r.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 p8(e,t,r){if(r.biff==5)return x8(e);var s=e.read_shift(1)>>>5&3,i=e.read_shift(2),d=e.read_shift(4);return[s,i,d]}function x8(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2,"i");e.l+=8;var s=e.read_shift(2);return e.l+=12,[t,r,s]}function y8(e,t,r){var s=e.read_shift(1)>>>5&3;e.l+=r&&r.biff==2?3:4;var i=e.read_shift(r&&r.biff==2?1:2);return[s,i]}function b8(e,t,r){var s=e.read_shift(1)>>>5&3,i=e.read_shift(r&&r.biff==2?1:2);return[s,i]}function v8(e,t,r){var s=e.read_shift(1)>>>5&3;return e.l+=4,r.biff<8&&e.l--,r.biff==12&&(e.l+=2),[s]}function _8(e,t,r){var s=(e[e.l++]&96)>>5,i=e.read_shift(2),d=4;if(r)switch(r.biff){case 5:d=15;break;case 12:d=6;break}return e.l+=d,[s,i]}var w8=Vs,k8=Vs,N8=Vs;function j0(e,t,r){return e.l+=2,[FC(e)]}function Bp(e){return e.l+=6,[]}var j8=j0,S8=Bp,T8=Bp,E8=j0;function Cw(e){return e.l+=2,[ow(e),e.read_shift(2)&1]}var C8=j0,A8=Cw,O8=Bp,M8=j0,L8=j0,D8=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function P8(e){e.l+=2;var t=e.read_shift(2),r=e.read_shift(2),s=e.read_shift(4),i=e.read_shift(2),d=e.read_shift(2),c=D8[r>>2&31];return{ixti:t,coltype:r&3,rt:c,idx:s,c:i,C:d}}function R8(e){return e.l+=2,[e.read_shift(4)]}function F8(e,t,r){return e.l+=5,e.l+=2,e.l+=r.biff==2?1:4,["PTGSHEET"]}function I8(e,t,r){return e.l+=r.biff==2?4:5,["PTGENDSHEET"]}function z8(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function B8(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function U8(e){return e.l+=4,[0,0]}var Hv={1:{n:"PtgExp",f:i8},2:{n:"PtgTbl",f:N8},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:u8},26:{n:"PtgSheet",f:F8},27:{n:"PtgEndSheet",f:I8},28:{n:"PtgErr",f:l8},29:{n:"PtgBool",f:c8},30:{n:"PtgInt",f:o8},31:{n:"PtgNum",f:d8},32:{n:"PtgArray",f:VC},33:{n:"PtgFunc",f:a8},34:{n:"PtgFuncVar",f:r8},35:{n:"PtgName",f:g8},36:{n:"PtgRef",f:QC},37:{n:"PtgArea",f:BC},38:{n:"PtgMemArea",f:y8},39:{n:"PtgMemErr",f:w8},40:{n:"PtgMemNoMem",f:k8},41:{n:"PtgMemFunc",f:b8},42:{n:"PtgRefErr",f:v8},43:{n:"PtgAreaErr",f:HC},44:{n:"PtgRefN",f:e8},45:{n:"PtgAreaN",f:WC},46:{n:"PtgMemAreaN",f:z8},47:{n:"PtgMemNoMemN",f:B8},57:{n:"PtgNameX",f:p8},58:{n:"PtgRef3d",f:t8},59:{n:"PtgArea3d",f:UC},60:{n:"PtgRefErr3d",f:_8},61:{n:"PtgAreaErr3d",f:$C},255:{}},H8={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},$8={1:{n:"PtgElfLel",f:Cw},2:{n:"PtgElfRw",f:M8},3:{n:"PtgElfCol",f:j8},6:{n:"PtgElfRwV",f:L8},7:{n:"PtgElfColV",f:E8},10:{n:"PtgElfRadical",f:C8},11:{n:"PtgElfRadicalS",f:O8},13:{n:"PtgElfColS",f:S8},15:{n:"PtgElfColSV",f:T8},16:{n:"PtgElfRadicalLel",f:A8},25:{n:"PtgList",f:P8},29:{n:"PtgSxName",f:R8},255:{}},W8={0:{n:"PtgAttrNoop",f:U8},1:{n:"PtgAttrSemi",f:XC},2:{n:"PtgAttrIf",f:qC},4:{n:"PtgAttrChoose",f:GC},8:{n:"PtgAttrGoto",f:ZC},16:{n:"PtgAttrSum",f:s8},32:{n:"PtgAttrBaxcel",f:Uv},33:{n:"PtgAttrBaxcel",f:Uv},64:{n:"PtgAttrSpace",f:JC},65:{n:"PtgAttrSpaceSemi",f:KC},128:{n:"PtgAttrIfError",f:YC},255:{}};function V8(e,t,r,s){if(s.biff<8)return Vs(e,t);for(var i=e.l+t,d=[],c=0;c!==r.length;++c)switch(r[c][0]){case"PtgArray":r[c][1]=m8(e,0,s),d.push(r[c][1]);break;case"PtgMemArea":r[c][2]=h8(e,r[c][1],s),d.push(r[c][2]);break;case"PtgExp":s&&s.biff==12&&(r[c][1][1]=e.read_shift(4),d.push(r[c][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+r[c][0]}return t=i-e.l,t!==0&&d.push(Vs(e,t)),d}function G8(e,t,r){for(var s=e.l+t,i,d,c=[];s!=e.l;)t=s-e.l,d=e[e.l],i=Hv[d]||Hv[H8[d]],(d===24||d===25)&&(i=(d===24?$8:W8)[e[e.l+1]]),!i||!i.f?Vs(e,t):c.push([i.n,i.f(e,t,r)]);return c}function Z8(e){for(var t=[],r=0;r<e.length;++r){for(var s=e[r],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 q8={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function Y8(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 Aw(e,t,r){if(!e)return"SH33TJSERR0";if(r.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var s=e.XTI[t];if(r.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!s)return"SH33TJSERR1";var i="";if(r.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 r.SID!=null?e.SheetNames[r.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 $v(e,t,r){var s=Aw(e,t,r);return s=="#REF"?s:Y8(s,r)}function Nc(e,t,r,s,i){var d=i&&i.biff||8,c={s:{c:0,r:0}},f=[],p,g,x,y=0,v=0,k,T="";if(!e[0]||!e[0][0])return"";for(var N=-1,S="",A=0,C=e[0].length;A<C;++A){var O=e[0][A];switch(O[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(p=f.pop(),g=f.pop(),N>=0){switch(e[0][N][1][0]){case 0:S=Ja(" ",e[0][N][1][1]);break;case 1:S=Ja("\r",e[0][N][1][1]);break;default:if(S="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}g=g+S,N=-1}f.push(g+q8[O[0]]+p);break;case"PtgIsect":p=f.pop(),g=f.pop(),f.push(g+" "+p);break;case"PtgUnion":p=f.pop(),g=f.pop(),f.push(g+","+p);break;case"PtgRange":p=f.pop(),g=f.pop(),f.push(g+":"+p);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":x=Jd(O[1][1],c,i),f.push(Kd(x,d));break;case"PtgRefN":x=r?Jd(O[1][1],r,i):O[1][1],f.push(Kd(x,d));break;case"PtgRef3d":y=O[1][1],x=Jd(O[1][2],c,i),T=$v(s,y,i),f.push(T+"!"+Kd(x,d));break;case"PtgFunc":case"PtgFuncVar":var P=O[1][0],B=O[1][1];P||(P=0),P&=127;var V=P==0?[]:f.slice(-P);f.length-=P,B==="User"&&(B=V.shift()),f.push(B+"("+V.join(",")+")");break;case"PtgBool":f.push(O[1]?"TRUE":"FALSE");break;case"PtgInt":f.push(O[1]);break;case"PtgNum":f.push(String(O[1]));break;case"PtgStr":f.push('"'+O[1].replace(/"/g,'""')+'"');break;case"PtgErr":f.push(O[1]);break;case"PtgAreaN":k=Tv(O[1][1],r?{s:r}:c,i),f.push(Ag(k,i));break;case"PtgArea":k=Tv(O[1][1],c,i),f.push(Ag(k,i));break;case"PtgArea3d":y=O[1][1],k=O[1][2],T=$v(s,y,i),f.push(T+"!"+Ag(k,i));break;case"PtgAttrSum":f.push("SUM("+f.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":v=O[1][2];var z=(s.names||[])[v-1]||(s[0]||[])[v],U=z?z.Name:"SH33TJSNAME"+String(v);U&&U.slice(0,6)=="_xlfn."&&!i.xlfn&&(U=U.slice(6)),f.push(U);break;case"PtgNameX":var J=O[1][1];v=O[1][2];var de;if(i.biff<=5)J<0&&(J=-J),s[J]&&(de=s[J][v]);else{var ye="";if(((s[J]||[])[0]||[])[0]==14849||(((s[J]||[])[0]||[])[0]==1025?s[J][v]&&s[J][v].itab>0&&(ye=s.SheetNames[s[J][v].itab-1]+"!"):ye=s.SheetNames[v-1]+"!"),s[J]&&s[J][v])ye+=s[J][v].Name;else if(s[0]&&s[0][v])ye+=s[0][v].Name;else{var ie=(Aw(s,J,i)||"").split(";;");ie[v-1]?ye=ie[v-1]:ye+="SH33TJSERRX"}f.push(ye);break}de||(de={Name:"SH33TJSERRY"}),f.push(de.Name);break;case"PtgParen":var he="(",ve=")";if(N>=0){switch(S="",e[0][N][1][0]){case 2:he=Ja(" ",e[0][N][1][1])+he;break;case 3:he=Ja("\r",e[0][N][1][1])+he;break;case 4:ve=Ja(" ",e[0][N][1][1])+ve;break;case 5:ve=Ja("\r",e[0][N][1][1])+ve;break;default:if(i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}N=-1}f.push(he+f.pop()+ve);break;case"PtgRefErr":f.push("#REF!");break;case"PtgRefErr3d":f.push("#REF!");break;case"PtgExp":x={c:O[1][1],r:O[1][0]};var me={c:r.c,r:r.r};if(s.sharedf[Sa(x)]){var ee=s.sharedf[Sa(x)];f.push(Nc(ee,c,me,s,i))}else{var q=!1;for(p=0;p!=s.arrayf.length;++p)if(g=s.arrayf[p],!(x.c<g[0].s.c||x.c>g[0].e.c)&&!(x.r<g[0].s.r||x.r>g[0].e.r)){f.push(Nc(g[1],c,me,s,i)),q=!0;break}q||f.push(O[1])}break;case"PtgArray":f.push("{"+Z8(O[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":N=A;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"+O[1].idx+"[#"+O[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(O));default:throw new Error("Unrecognized Formula Token: "+String(O))}var Q=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(i.biff!=3&&N>=0&&Q.indexOf(e[0][A][0])==-1){O=e[0][N];var fe=!0;switch(O[1][0]){case 4:fe=!1;case 0:S=Ja(" ",O[1][1]);break;case 5:fe=!1;case 1:S=Ja("\r",O[1][1]);break;default:if(S="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+O[1][0])}f.push((fe?S:"")+f.pop()+(fe?"":S)),N=-1}}if(f.length>1&&i.WTF)throw new Error("bad formula stack");return f[0]}function X8(e){if(e==null){var t=Ge(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 J8(e,t,r,s,i){var d=co(t,r,i),c=X8(e.v),f=Ge(6),p=33;f.write_shift(2,p),f.write_shift(4,0);for(var g=Ge(e.bf.length),x=0;x<e.bf.length;++x)g[x]=e.bf[x];var y=Lr([d,c,f,g]);return y}function sh(e,t,r){var s=e.read_shift(4),i=G8(e,s,r),d=e.read_shift(4),c=d>0?V8(e,d,i,r):null;return[i,c]}var K8=sh,ih=sh,Q8=sh,e7=sh,t7={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"},Ow={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"},a7={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 r7(e){var t="of:="+e.replace(Ip,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function n7(e){return e.replace(/\./,"!")}var Qd=typeof Map!="undefined";function Up(e,t,r){var s=0,i=e.length;if(r){if(Qd?r.has(t):Object.prototype.hasOwnProperty.call(r,t)){for(var d=Qd?r.get(t):r[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++,r&&(Qd?(r.has(t)||r.set(t,[]),r.get(t).push(i)):(Object.prototype.hasOwnProperty.call(r,t)||(r[t]=[]),r[t].push(i))),i}function lh(e,t){var r={min:e+1,max:e+1},s=-1;return t.MDW&&(pi=t.MDW),t.width!=null?r.customWidth=1:t.wpx!=null?s=If(t.wpx):t.wch!=null&&(s=t.wch),s>-1?(r.width=ap(s),r.customWidth=1):t.width!=null&&(r.width=t.width),t.hidden&&(r.hidden=!0),t.level!=null&&(r.outlineLevel=r.level=t.level),r}function Mw(e,t){if(e){var r=[.7,.7,.75,.75,.3,.3];e.left==null&&(e.left=r[0]),e.right==null&&(e.right=r[1]),e.top==null&&(e.top=r[2]),e.bottom==null&&(e.bottom=r[3]),e.header==null&&(e.header=r[4]),e.footer==null&&(e.footer=r[5])}}function ml(e,t,r){var s=r.revssf[t.z!=null?t.z:"General"],i=60,d=e.length;if(s==null&&r.ssf){for(;i<392;++i)if(r.ssf[i]==null){T2(t.z,i),r.ssf[i]=t.z,r.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 s7(e,t,r){if(e&&e["!ref"]){var s=za(e["!ref"]);if(s.e.c<s.s.c||s.e.r<s.s.r)throw new Error("Bad range ("+r+"): "+e["!ref"])}}function i7(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',r=0;r!=e.length;++r)t+='<mergeCell ref="'+cr(e[r])+'"/>';return t+"</mergeCells>"}function l7(e,t,r,s,i){var d=!1,c={},f=null;if(s.bookType!=="xlsx"&&t.vbaraw){var p=t.SheetNames[r];try{t.Workbook&&(p=t.Workbook.Sheets[r].CodeName||p)}catch(x){}d=!0,c.codeName=i0(ja(p))}if(e&&e["!outline"]){var g={summaryBelow:1,summaryRight:1};e["!outline"].above&&(g.summaryBelow=0),e["!outline"].left&&(g.summaryRight=0),f=(f||"")+gt("outlinePr",null,g)}!d&&!f||(i[i.length]=gt("sheetPr",f,c))}var o7=["objects","scenarios","selectLockedCells","selectUnlockedCells"],c7=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function d7(e){var t={sheet:1};return o7.forEach(function(r){e[r]!=null&&e[r]&&(t[r]="1")}),c7.forEach(function(r){e[r]!=null&&!e[r]&&(t[r]="0")}),e.password&&(t.password=gw(e.password).toString(16).toUpperCase()),gt("sheetProtection",null,t)}function u7(e){return Mw(e),gt("pageMargins",null,e)}function f7(e,t){for(var r=["<cols>"],s,i=0;i!=t.length;++i)(s=t[i])&&(r[r.length]=gt("col",null,lh(i,s)));return r[r.length]="</cols>",r.join("")}function h7(e,t,r,s){var i=typeof e.ref=="string"?e.ref:cr(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var d=r.Workbook.Names,c=zn(i);c.s.r==c.e.r&&(c.e.r=zn(t["!ref"]).e.r,i=cr(c));for(var f=0;f<d.length;++f){var p=d[f];if(p.Name=="_xlnm._FilterDatabase"&&p.Sheet==s){p.Ref="'"+r.SheetNames[s]+"'!"+i;break}}return f==d.length&&d.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+r.SheetNames[s]+"'!"+i}),gt("autoFilter",null,{ref:i})}function m7(e,t,r,s){var i={workbookViewId:"0"};return(((s||{}).Workbook||{}).Views||[])[0]&&(i.rightToLeft=s.Workbook.Views[0].RTL?"1":"0"),gt("sheetViews",gt("sheetView",null,i),{})}function g7(e,t,r,s){if(e.c&&r["!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=Qr(e.v,-1).toISOString():(e=vn(e),e.t="n",i=""+(e.v=bn(Qr(e.v)))),typeof e.z=="undefined"&&(e.z=Ka[14]);break;default:i=e.v;break}var f=Dr("v",ja(i)),p={r:t},g=ml(s.cellXfs,e,s);switch(g!==0&&(p.s=g),e.t){case"n":break;case"d":p.t="d";break;case"b":p.t="b";break;case"e":p.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",""+Up(s.Strings,e.v,s.revStrings)),p.t="s";break}p.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=gt("f",ja(e.f),x)+(e.v!=null?f:"")}return e.l&&r["!links"].push([t,e.l]),e.D&&(p.cm=1),gt("c",f,p)}function p7(e,t,r,s){var i=[],d=[],c=za(e["!ref"]),f="",p,g="",x=[],y=0,v=0,k=e["!rows"],T=Array.isArray(e),N={r:g},S,A=-1;for(v=c.s.c;v<=c.e.c;++v)x[v]=Wr(v);for(y=c.s.r;y<=c.e.r;++y){for(d=[],g=Pr(y),v=c.s.c;v<=c.e.c;++v){p=x[v]+g;var C=T?(e[y]||[])[v]:e[p];C!==void 0&&(f=g7(C,p,e,t))!=null&&d.push(f)}(d.length>0||k&&k[y])&&(N={r:g},k&&k[y]&&(S=k[y],S.hidden&&(N.hidden=1),A=-1,S.hpx?A=zf(S.hpx):S.hpt&&(A=S.hpt),A>-1&&(N.ht=A,N.customHeight=1),S.level&&(N.outlineLevel=S.level)),i[i.length]=gt("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),A=-1,S.hpx?A=zf(S.hpx):S.hpt&&(A=S.hpt),A>-1&&(N.ht=A,N.customHeight=1),S.level&&(N.outlineLevel=S.level),i[i.length]=gt("row","",N));return i.join("")}function Lw(e,t,r,s){var i=[dr,gt("worksheet",null,{xmlns:Dc[0],"xmlns:r":_r.r})],d=r.SheetNames[e],c=0,f="",p=r.Sheets[d];p==null&&(p={});var g=p["!ref"]||"A1",x=za(g);if(x.e.c>16383||x.e.r>1048575){if(t.WTF)throw new Error("Range "+g+" exceeds format limit A1:XFD1048576");x.e.c=Math.min(x.e.c,16383),x.e.r=Math.min(x.e.c,1048575),g=cr(x)}s||(s={}),p["!comments"]=[];var y=[];l7(p,r,e,t,i),i[i.length]=gt("dimension",null,{ref:g}),i[i.length]=m7(p,t,e,r),t.sheetFormat&&(i[i.length]=gt("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),p["!cols"]!=null&&p["!cols"].length>0&&(i[i.length]=f7(p,p["!cols"])),i[c=i.length]="<sheetData/>",p["!links"]=[],p["!ref"]!=null&&(f=p7(p,t),f.length>0&&(i[i.length]=f)),i.length>c+1&&(i[i.length]="</sheetData>",i[c]=i[c].replace("/>",">")),p["!protect"]&&(i[i.length]=d7(p["!protect"])),p["!autofilter"]!=null&&(i[i.length]=h7(p["!autofilter"],p,r,e)),p["!merges"]!=null&&p["!merges"].length>0&&(i[i.length]=i7(p["!merges"]));var v=-1,k,T=-1;return p["!links"].length>0&&(i[i.length]="<hyperlinks>",p["!links"].forEach(function(N){N[1].Target&&(k={ref:N[0]},N[1].Target.charAt(0)!="#"&&(T=Na(s,-1,ja(N[1].Target).replace(/#.*$/,""),ha.HLINK),k["r:id"]="rId"+T),(v=N[1].Target.indexOf("#"))>-1&&(k.location=ja(N[1].Target.slice(v+1))),N[1].Tooltip&&(k.tooltip=ja(N[1].Tooltip)),i[i.length]=gt("hyperlink",null,k))}),i[i.length]="</hyperlinks>"),delete p["!links"],p["!margins"]!=null&&(i[i.length]=u7(p["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(i[i.length]=Dr("ignoredErrors",gt("ignoredError",null,{numberStoredAsText:1,sqref:g}))),y.length>0&&(T=Na(s,-1,"../drawings/drawing"+(e+1)+".xml",ha.DRAW),i[i.length]=gt("drawing",null,{"r:id":"rId"+T}),p["!drawing"]=y),p["!comments"].length>0&&(T=Na(s,-1,"../drawings/vmlDrawing"+(e+1)+".vml",ha.VML),i[i.length]=gt("legacyDrawing",null,{"r:id":"rId"+T}),p["!legacy"]=T),i.length>1&&(i[i.length]="</worksheet>",i[1]=i[1].replace("/>",">")),i.join("")}function x7(e,t){var r={},s=e.l+t;r.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&&(r.level=d&7),d&16&&(r.hidden=!0),d&32&&(r.hpt=i/20),r}function y7(e,t,r){var s=Ge(145),i=(r["!rows"]||[])[e]||{};s.write_shift(4,e),s.write_shift(4,0);var d=320;i.hpx?d=zf(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,p=s.l;s.l+=4;for(var g={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,v=-1,k=x<<10;k<x+1<<10;++k){g.c=k;var T=Array.isArray(r)?(r[g.r]||[])[g.c]:r[Sa(g)];T&&(y<0&&(y=k),v=k)}y<0||(++f,s.write_shift(4,y),s.write_shift(4,v))}var N=s.l;return s.l=p,s.write_shift(4,f),s.l=N,s.length>s.l?s.slice(0,s.l):s}function b7(e,t,r,s){var i=y7(s,r,t);(i.length>17||(t["!rows"]||[])[s])&&at(e,0,i)}var v7=po,_7=Rc;function w7(){}function k7(e,t){var r={},s=e[e.l];return++e.l,r.above=!(s&64),r.left=!(s&128),e.l+=18,r.name=LT(e),r}function N7(e,t,r){r==null&&(r=Ge(84+4*e.length));var s=192;t&&(t.above&&(s&=-65),t.left&&(s&=-129)),r.write_shift(1,s);for(var i=1;i<3;++i)r.write_shift(1,0);return Pf({auto:1},r),r.write_shift(-4,-1),r.write_shift(-4,-1),q2(e,r),r.slice(0,r.l)}function j7(e){var t=rs(e);return[t]}function S7(e,t,r){return r==null&&(r=Ge(8)),ho(t,r)}function T7(e){var t=mo(e);return[t]}function E7(e,t,r){return r==null&&(r=Ge(4)),go(t,r)}function C7(e){var t=rs(e),r=e.read_shift(1);return[t,r,"b"]}function A7(e,t,r){return r==null&&(r=Ge(9)),ho(t,r),r.write_shift(1,e.v?1:0),r}function O7(e){var t=mo(e),r=e.read_shift(1);return[t,r,"b"]}function M7(e,t,r){return r==null&&(r=Ge(5)),go(t,r),r.write_shift(1,e.v?1:0),r}function L7(e){var t=rs(e),r=e.read_shift(1);return[t,r,"e"]}function D7(e,t,r){return r==null&&(r=Ge(9)),ho(t,r),r.write_shift(1,e.v),r}function P7(e){var t=mo(e),r=e.read_shift(1);return[t,r,"e"]}function R7(e,t,r){return r==null&&(r=Ge(8)),go(t,r),r.write_shift(1,e.v),r.write_shift(2,0),r.write_shift(1,0),r}function F7(e){var t=rs(e),r=e.read_shift(4);return[t,r,"s"]}function I7(e,t,r){return r==null&&(r=Ge(12)),ho(t,r),r.write_shift(4,t.v),r}function z7(e){var t=mo(e),r=e.read_shift(4);return[t,r,"s"]}function B7(e,t,r){return r==null&&(r=Ge(8)),go(t,r),r.write_shift(4,t.v),r}function U7(e){var t=rs(e),r=Fc(e);return[t,r,"n"]}function H7(e,t,r){return r==null&&(r=Ge(16)),ho(t,r),oo(e.v,r),r}function $7(e){var t=mo(e),r=Fc(e);return[t,r,"n"]}function W7(e,t,r){return r==null&&(r=Ge(12)),go(t,r),oo(e.v,r),r}function V7(e){var t=rs(e),r=Y2(e);return[t,r,"n"]}function G7(e,t,r){return r==null&&(r=Ge(12)),ho(t,r),X2(e.v,r),r}function Z7(e){var t=mo(e),r=Y2(e);return[t,r,"n"]}function q7(e,t,r){return r==null&&(r=Ge(8)),go(t,r),X2(e.v,r),r}function Y7(e){var t=rs(e),r=Lp(e);return[t,r,"is"]}function X7(e){var t=rs(e),r=Vr(e);return[t,r,"str"]}function J7(e,t,r){return r==null&&(r=Ge(12+4*e.v.length)),ho(t,r),kr(e.v,r),r.length>r.l?r.slice(0,r.l):r}function K7(e){var t=mo(e),r=Vr(e);return[t,r,"str"]}function Q7(e,t,r){return r==null&&(r=Ge(8+4*e.v.length)),go(t,r),kr(e.v,r),r.length>r.l?r.slice(0,r.l):r}function eA(e,t,r){var s=e.l+t,i=rs(e);i.r=r["!row"];var d=e.read_shift(1),c=[i,d,"b"];if(r.cellFormula){e.l+=2;var f=ih(e,s-e.l,r);c[3]=Nc(f,null,i,r.supbooks,r)}else e.l=s;return c}function tA(e,t,r){var s=e.l+t,i=rs(e);i.r=r["!row"];var d=e.read_shift(1),c=[i,d,"e"];if(r.cellFormula){e.l+=2;var f=ih(e,s-e.l,r);c[3]=Nc(f,null,i,r.supbooks,r)}else e.l=s;return c}function aA(e,t,r){var s=e.l+t,i=rs(e);i.r=r["!row"];var d=Fc(e),c=[i,d,"n"];if(r.cellFormula){e.l+=2;var f=ih(e,s-e.l,r);c[3]=Nc(f,null,i,r.supbooks,r)}else e.l=s;return c}function rA(e,t,r){var s=e.l+t,i=rs(e);i.r=r["!row"];var d=Vr(e),c=[i,d,"str"];if(r.cellFormula){e.l+=2;var f=ih(e,s-e.l,r);c[3]=Nc(f,null,i,r.supbooks,r)}else e.l=s;return c}var nA=po,sA=Rc;function iA(e,t){return t==null&&(t=Ge(4)),t.write_shift(4,e),t}function lA(e,t){var r=e.l+t,s=po(e),i=Dp(e),d=Vr(e),c=Vr(e),f=Vr(e);e.l=r;var p={rfx:s,relId:i,loc:d,display:f};return c&&(p.Tooltip=c),p}function oA(e,t){var r=Ge(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));Rc({s:wr(e[0]),e:wr(e[0])},r),Pp("rId"+t,r);var s=e[1].Target.indexOf("#"),i=s==-1?"":e[1].Target.slice(s+1);return kr(i||"",r),kr(e[1].Tooltip||"",r),kr("",r),r.slice(0,r.l)}function cA(){}function dA(e,t,r){var s=e.l+t,i=J2(e),d=e.read_shift(1),c=[i];if(c[2]=d,r.cellFormula){var f=K8(e,s-e.l,r);c[1]=f}else e.l=s;return c}function uA(e,t,r){var s=e.l+t,i=po(e),d=[i];if(r.cellFormula){var c=e7(e,s-e.l,r);d[1]=c,e.l=s}else e.l=s;return d}function fA(e,t,r){r==null&&(r=Ge(18));var s=lh(e,t);r.write_shift(-4,e),r.write_shift(-4,e),r.write_shift(4,(s.width||10)*256),r.write_shift(4,0);var i=0;return t.hidden&&(i|=1),typeof s.width=="number"&&(i|=2),t.level&&(i|=t.level<<8),r.write_shift(2,i),r}var Dw=["left","right","top","bottom","header","footer"];function hA(e){var t={};return Dw.forEach(function(r){t[r]=Fc(e)}),t}function mA(e,t){return t==null&&(t=Ge(48)),Mw(e),Dw.forEach(function(r){oo(e[r],t)}),t}function gA(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function pA(e,t,r){r==null&&(r=Ge(30));var s=924;return(((t||{}).Views||[])[0]||{}).RTL&&(s|=32),r.write_shift(2,s),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,100),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(4,0),r}function xA(e){var t=Ge(24);return t.write_shift(4,4),t.write_shift(4,1),Rc(e,t),t}function yA(e,t){return t==null&&(t=Ge(66)),t.write_shift(2,e.password?gw(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(r){r[1]?t.write_shift(4,e[r[0]]!=null&&!e[r[0]]?1:0):t.write_shift(4,e[r[0]]!=null&&e[r[0]]?0:1)}),t}function bA(){}function vA(){}function _A(e,t,r,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=vn(t),t.z=t.z||Ka[14],t.v=bn(Qr(t.v)),t.t="n";break;case"n":case"e":f=""+t.v;break;default:f=t.v;break}var p={r,c:s};switch(p.s=ml(i.cellXfs,t,i),t.l&&d["!links"].push([Sa(p),t.l]),t.c&&d["!comments"].push([Sa(p),t.c]),t.t){case"s":case"str":return i.bookSST?(f=Up(i.Strings,t.v,i.revStrings),p.t="s",p.v=f,c?at(e,18,B7(t,p)):at(e,7,I7(t,p))):(p.t="str",c?at(e,17,Q7(t,p)):at(e,6,J7(t,p))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?c?at(e,13,q7(t,p)):at(e,2,G7(t,p)):c?at(e,16,W7(t,p)):at(e,5,H7(t,p)),!0;case"b":return p.t="b",c?at(e,15,M7(t,p)):at(e,4,A7(t,p)),!0;case"e":return p.t="e",c?at(e,14,R7(t,p)):at(e,3,D7(t,p)),!0}return c?at(e,12,E7(t,p)):at(e,1,S7(t,p)),!0}function wA(e,t,r,s){var i=za(t["!ref"]||"A1"),d,c="",f=[];at(e,145);var p=Array.isArray(t),g=i.e.r;t["!rows"]&&(g=Math.max(i.e.r,t["!rows"].length-1));for(var x=i.s.r;x<=g;++x){c=Pr(x),b7(e,t,i,x);var y=!1;if(x<=i.e.r)for(var v=i.s.c;v<=i.e.c;++v){x===i.s.r&&(f[v]=Wr(v)),d=f[v]+c;var k=p?(t[x]||[])[v]:t[d];if(!k){y=!1;continue}y=_A(e,k,x,v,s,t,y)}}at(e,146)}function kA(e,t){!t||!t["!merges"]||(at(e,177,iA(t["!merges"].length)),t["!merges"].forEach(function(r){at(e,176,sA(r))}),at(e,178))}function NA(e,t){!t||!t["!cols"]||(at(e,390),t["!cols"].forEach(function(r,s){r&&at(e,60,fA(s,r))}),at(e,391))}function jA(e,t){!t||!t["!ref"]||(at(e,648),at(e,649,xA(za(t["!ref"]))),at(e,650))}function SA(e,t,r){t["!links"].forEach(function(s){if(s[1].Target){var i=Na(r,-1,s[1].Target.replace(/#.*$/,""),ha.HLINK);at(e,494,oA(s,i))}}),delete t["!links"]}function TA(e,t,r,s){if(t["!comments"].length>0){var i=Na(s,-1,"../drawings/vmlDrawing"+(r+1)+".vml",ha.VML);at(e,551,Pp("rId"+i)),t["!legacy"]=i}}function EA(e,t,r,s){if(t["!autofilter"]){var i=t["!autofilter"],d=typeof i.ref=="string"?i.ref:cr(i.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var c=r.Workbook.Names,f=zn(d);f.s.r==f.e.r&&(f.e.r=zn(t["!ref"]).e.r,d=cr(f));for(var p=0;p<c.length;++p){var g=c[p];if(g.Name=="_xlnm._FilterDatabase"&&g.Sheet==s){g.Ref="'"+r.SheetNames[s]+"'!"+d;break}}p==c.length&&c.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+r.SheetNames[s]+"'!"+d}),at(e,161,Rc(za(d))),at(e,162)}}function CA(e,t,r){at(e,133),at(e,137,pA(t,r)),at(e,138),at(e,134)}function AA(e,t){t["!protect"]&&at(e,535,yA(t["!protect"]))}function OA(e,t,r,s){var i=yn(),d=r.SheetNames[e],c=r.Sheets[d]||{},f=d;try{r&&r.Workbook&&(f=r.Workbook.Sheets[e].CodeName||f)}catch(g){}var p=za(c["!ref"]||"A1");if(p.e.c>16383||p.e.r>1048575){if(t.WTF)throw new Error("Range "+(c["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");p.e.c=Math.min(p.e.c,16383),p.e.r=Math.min(p.e.c,1048575)}return c["!links"]=[],c["!comments"]=[],at(i,129),(r.vbaraw||c["!outline"])&&at(i,147,N7(f,c["!outline"])),at(i,148,_7(p)),CA(i,c,r.Workbook),NA(i,c),wA(i,c,e,t),AA(i,c),EA(i,c,r,e),kA(i,c),SA(i,c,s),c["!margins"]&&at(i,476,mA(c["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&jA(i,c),TA(i,c,e,s),at(i,130),i.end()}function MA(e,t){e.l+=10;var r=Vr(e);return{name:r}}var LA=[["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 DA(e){return!e.Workbook||!e.Workbook.WBProps?"false":uT(e.Workbook.WBProps.date1904)?"true":"false"}var PA="][*?/\\".split("");function Pw(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var r=!0;return PA.forEach(function(s){if(e.indexOf(s)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),r}function RA(e,t,r){e.forEach(function(s,i){Pw(s);for(var d=0;d<i;++d)if(s==e[d])throw new Error("Duplicate Sheet Name: "+s);if(r){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 FA(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||[];RA(e.SheetNames,t,!!e.vbaraw);for(var r=0;r<e.SheetNames.length;++r)s7(e.Sheets[e.SheetNames[r]],e.SheetNames[r],r)}function Rw(e){var t=[dr];t[t.length]=gt("workbook",null,{xmlns:Dc[0],"xmlns:r":_r.r});var r=e.Workbook&&(e.Workbook.Names||[]).length>0,s={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(LA.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]=gt("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:ja(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]=gt("sheet",null,c)}return t[t.length]="</sheets>",r&&(t[t.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(f){var p={name:f.Name};f.Comment&&(p.comment=f.Comment),f.Sheet!=null&&(p.localSheetId=""+f.Sheet),f.Hidden&&(p.hidden="1"),f.Ref&&(t[t.length]=gt("definedName",ja(f.Ref),p))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function IA(e,t){var r={};return r.Hidden=e.read_shift(4),r.iTabID=e.read_shift(4),r.strRelID=tp(e),r.name=Vr(e),r}function zA(e,t){return t||(t=Ge(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),Pp(e.strRelID,t),kr(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function BA(e,t){var r={},s=e.read_shift(4);r.defaultThemeVersion=e.read_shift(4);var i=t>8?Vr(e):"";return i.length>0&&(r.CodeName=i),r.autoCompressPictures=!!(s&65536),r.backupFile=!!(s&64),r.checkCompatibility=!!(s&4096),r.date1904=!!(s&1),r.filterPrivacy=!!(s&8),r.hidePivotFieldList=!!(s&1024),r.promptedSolutions=!!(s&16),r.publishItems=!!(s&2048),r.refreshAllConnections=!!(s&262144),r.saveExternalLinkValues=!!(s&128),r.showBorderUnselectedTables=!!(s&4),r.showInkAnnotation=!!(s&32),r.showObjects=["all","placeholders","none"][s>>13&3],r.showPivotChartFilter=!!(s&32768),r.updateLinks=["userSet","never","always"][s>>8&3],r}function UA(e,t){t||(t=Ge(72));var r=0;return e&&e.filterPrivacy&&(r|=8),t.write_shift(4,r),t.write_shift(4,0),q2(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function HA(e,t,r){var s=e.l+t;e.l+=4,e.l+=1;var i=e.read_shift(4),d=DT(e),c=Q8(e,0,r),f=Dp(e);e.l=s;var p={Name:d,Ptg:c};return i<268435455&&(p.Sheet=i),f&&(p.Comment=f),p}function $A(e,t){at(e,143);for(var r=0;r!=t.SheetNames.length;++r){var s=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[r]&&t.Workbook.Sheets[r].Hidden||0,i={Hidden:s,iTabID:r+1,strRelID:"rId"+(r+1),name:t.SheetNames[r]};at(e,156,zA(i))}at(e,144)}function WA(e,t){t||(t=Ge(127));for(var r=0;r!=4;++r)t.write_shift(4,0);return kr("SheetJS",t),kr(Tf.version,t),kr(Tf.version,t),kr("7262",t),t.length>t.l?t.slice(0,t.l):t}function VA(e,t){t||(t=Ge(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 r=120;return t.write_shift(1,r),t.length>t.l?t.slice(0,t.l):t}function GA(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var r=t.Workbook.Sheets,s=0,i=-1,d=-1;s<r.length;++s)!r[s]||!r[s].Hidden&&i==-1?i=s:r[s].Hidden==1&&d==-1&&(d=s);d>i||(at(e,135),at(e,158,VA(i)),at(e,136))}}function ZA(e,t){var r=yn();return at(r,131),at(r,128,WA()),at(r,153,UA(e.Workbook&&e.Workbook.WBProps||null)),GA(r,e),$A(r,e),at(r,132),r.end()}function qA(e,t,r){return(t.slice(-4)===".bin"?ZA:Rw)(e)}function YA(e,t,r,s,i){return(t.slice(-4)===".bin"?OA:Lw)(e,r,s,i)}function XA(e,t,r){return(t.slice(-4)===".bin"?mC:yw)(e,r)}function JA(e,t,r){return(t.slice(-4)===".bin"?UE:mw)(e,r)}function KA(e,t,r){return(t.slice(-4)===".bin"?AC:kw)(e)}function QA(e){return(e.slice(-4)===".bin"?wC:_w)()}function e9(e,t){var r=[];return e.Props&&r.push(XT(e.Props,t)),e.Custprops&&r.push(JT(e.Props,e.Custprops)),r.join("")}function t9(){return""}function a9(e,t){var r=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(s,i){var d=[];d.push(gt("NumberFormat",null,{"ss:Format":ja(Ka[s.numFmtId])}));var c={"ss:ID":"s"+(21+i)};r.push(gt("Style",d.join(""),c))}),gt("Styles",r.join(""))}function Fw(e){return gt("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+zp(e.Ref,{r:0,c:0})})}function r9(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,r=[],s=0;s<t.length;++s){var i=t[s];i.Sheet==null&&(i.Name.match(/^_xlfn\./)||r.push(Fw(i)))}return gt("Names",r.join(""))}function n9(e,t,r,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==r&&(f.Name.match(/^_xlfn\./)||d.push(Fw(f)))}return d.join("")}function s9(e,t,r,s){if(!e)return"";var i=[];if(e["!margins"]&&(i.push("<PageSetup>"),e["!margins"].header&&i.push(gt("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&i.push(gt("Footer",null,{"x:Margin":e["!margins"].footer})),i.push(gt("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[r])if(s.Workbook.Sheets[r].Hidden)i.push(gt("Visible",s.Workbook.Sheets[r].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var d=0;d<r&&!(s.Workbook.Sheets[d]&&!s.Workbook.Sheets[d].Hidden);++d);d==r&&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?"":gt("WorksheetOptions",i.join(""),{xmlns:Pn.x})}function i9(e){return e.map(function(t){var r=dT(t.t||""),s=gt("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return gt("Comment",s,{"ss:Author":t.a})}).join("")}function l9(e,t,r,s,i,d,c){if(!e||e.v==null&&e.f==null)return"";var f={};if(e.f&&(f["ss:Formula"]="="+ja(zp(e.f,c))),e.F&&e.F.slice(0,t.length)==t){var p=wr(e.F.slice(t.length+1));f["ss:ArrayRange"]="RC:R"+(p.r==c.r?"":"["+(p.r-c.r)+"]")+"C"+(p.c==c.c?"":"["+(p.c-c.c)+"]")}if(e.l&&e.l.Target&&(f["ss:HRef"]=ja(e.l.Target),e.l.Tooltip&&(f["x:HRefScreenTip"]=ja(e.l.Tooltip))),r["!merges"])for(var g=r["!merges"],x=0;x!=g.length;++x)g[x].s.c!=c.c||g[x].s.r!=c.r||(g[x].e.c>g[x].s.c&&(f["ss:MergeAcross"]=g[x].e.c-g[x].s.c),g[x].e.r>g[x].s.r&&(f["ss:MergeDown"]=g[x].e.r-g[x].s.r));var y="",v="";switch(e.t){case"z":if(!s.sheetStubs)return"";break;case"n":y="Number",v=String(e.v);break;case"b":y="Boolean",v=e.v?"1":"0";break;case"e":y="Error",v=N0[e.v];break;case"d":y="DateTime",v=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Ka[14]);break;case"s":y="String",v=cT(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?v:"",N=e.t=="z"?"":'<Data ss:Type="'+y+'">'+T+"</Data>";return(e.c||[]).length>0&&(N+=i9(e.c)),gt("Cell",N,f)}function o9(e,t){var r='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=xw(t.hpt)),t.hpx&&(r+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(r+=' ss:Hidden="1"')),r+">"}function c9(e,t,r,s){if(!e["!ref"])return"";var i=za(e["!ref"]),d=e["!merges"]||[],c=0,f=[];e["!cols"]&&e["!cols"].forEach(function(S,A){Fp(S);var C=!!S.width,O=lh(A,S),P={"ss:Index":A+1};C&&(P["ss:Width"]=Ff(O.width)),S.hidden&&(P["ss:Hidden"]="1"),f.push(gt("Column",null,P))});for(var p=Array.isArray(e),g=i.s.r;g<=i.e.r;++g){for(var x=[o9(g,(e["!rows"]||[])[g])],y=i.s.c;y<=i.e.c;++y){var v=!1;for(c=0;c!=d.length;++c)if(!(d[c].s.c>y)&&!(d[c].s.r>g)&&!(d[c].e.c<y)&&!(d[c].e.r<g)){(d[c].s.c!=y||d[c].s.r!=g)&&(v=!0);break}if(!v){var k={r:g,c:y},T=Sa(k),N=p?(e[g]||[])[y]:e[T];x.push(l9(N,T,e,t,r,s,k))}}x.push("</Row>"),x.length>2&&f.push(x.join(""))}return f.join("")}function d9(e,t,r){var s=[],i=r.SheetNames[e],d=r.Sheets[i],c=d?n9(d,t,e,r):"";return c.length>0&&s.push("<Names>"+c+"</Names>"),c=d?c9(d,t,e,r):"",c.length>0&&s.push("<Table>"+c+"</Table>"),s.push(s9(d,t,e,r)),s.join("")}function u9(e,t){t||(t={}),e.SSF||(e.SSF=vn(Ka)),e.SSF&&(ah(),th(e.SSF),t.revssf=rh(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(e9(e,t)),r.push(t9()),r.push(""),r.push("");for(var s=0;s<e.SheetNames.length;++s)r.push(gt("Worksheet",d9(s,t,e),{"ss:Name":ja(e.SheetNames[s])}));return r[2]=a9(e,t),r[3]=r9(e),dr+gt("Workbook",r.join(""),{xmlns:Pn.ss,"xmlns:o":Pn.o,"xmlns:x":Pn.x,"xmlns:ss":Pn.ss,"xmlns:dt":Pn.dt,"xmlns:html":Pn.html})}var Lg={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function f9(e,t){var r=[],s=[],i=[],d=0,c,f=pv(Cv,"n"),p=pv(Av,"n");if(e.Props)for(c=Fr(e.Props),d=0;d<c.length;++d)(Object.prototype.hasOwnProperty.call(f,c[d])?r:Object.prototype.hasOwnProperty.call(p,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])?r:Object.prototype.hasOwnProperty.call(p,c[d])?s:i).push([c[d],e.Custprops[c[d]]]);var g=[];for(d=0;d<i.length;++d)lw.indexOf(i[d][0])>-1||nw.indexOf(i[d][0])>-1||i[d][1]!=null&&g.push(i[d]);s.length&&La.utils.cfb_add(t,"/SummaryInformation",Pv(s,Lg.SI,p,Av)),(r.length||g.length)&&La.utils.cfb_add(t,"/DocumentSummaryInformation",Pv(r,Lg.DSI,f,Cv,g.length?g:null,Lg.UDI))}function h9(e,t){var r=t||{},s=La.utils.cfb_new({root:"R"}),i="/Workbook";switch(r.bookType||"xls"){case"xls":r.bookType="biff8";case"xla":r.bookType||(r.bookType="xla");case"biff8":i="/Workbook",r.biff=8;break;case"biff5":i="/Book",r.biff=5;break;default:throw new Error("invalid type "+r.bookType+" for XLS CFB")}return La.utils.cfb_add(s,i,Iw(e,r)),r.biff==8&&(e.Props||e.Custprops)&&f9(e,s),r.biff==8&&e.vbaraw&&OC(s,La.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),s}var m9={0:{f:x7},1:{f:j7},2:{f:V7},3:{f:L7},4:{f:C7},5:{f:U7},6:{f:X7},7:{f:F7},8:{f:rA},9:{f:aA},10:{f:eA},11:{f:tA},12:{f:T7},13:{f:Z7},14:{f:P7},15:{f:O7},16:{f:$7},17:{f:K7},18:{f:z7},19:{f:Lp},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:HA},40:{},42:{},43:{f:XE},44:{f:qE},45:{f:QE},46:{f:tC},47:{f:eC},48:{},49:{f:TT},50:{},51:{f:xC},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:EE},62:{f:Y7},63:{f:kC},64:{f:bA},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:Vs,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:gA},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:k7},148:{f:v7,p:16},151:{f:cA},152:{},153:{f:BA},154:{},155:{},156:{f:IA},157:{},158:{},159:{T:1,f:IE},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:nA},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:gC},336:{T:-1},337:{f:vC,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:tp},357:{},358:{},359:{},360:{T:1},361:{},362:{f:wE},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:dA},427:{f:uA},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:hA},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:w7},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:lA},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:tp},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:EC},633:{T:1},634:{T:-1},635:{T:1,f:SC},636:{T:-1},637:{f:OT},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:MA},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:vA},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 pt(e,t,r,s){var i=t;if(!isNaN(i)){var d=s||(r||[]).length||0,c=e.next(4);c.write_shift(2,i),c.write_shift(2,d),d>0&&Ap(r)&&e.push(r)}}function g9(e,t,r,s){var i=(r||[]).length||0;if(i<=8224)return pt(e,t,r,i);var d=t;if(!isNaN(d)){for(var c=r.parts||[],f=0,p=0,g=0;g+(c[f]||8224)<=8224;)g+=c[f]||8224,f++;var x=e.next(4);for(x.write_shift(2,d),x.write_shift(2,g),e.push(r.slice(p,p+g)),p+=g;p<i;){for(x=e.next(4),x.write_shift(2,60),g=0;g+(c[f]||8224)<=8224;)g+=c[f]||8224,f++;x.write_shift(2,g),e.push(r.slice(p,p+g)),p+=g}}}function S0(e,t,r){return e||(e=Ge(7)),e.write_shift(2,t),e.write_shift(2,r),e.write_shift(2,0),e.write_shift(1,0),e}function p9(e,t,r,s){var i=Ge(9);return S0(i,e,t),cw(r,s||"b",i),i}function x9(e,t,r){var s=Ge(8+2*r.length);return S0(s,e,t),s.write_shift(1,r.length),s.write_shift(r.length,r,"sbcs"),s.l<s.length?s.slice(0,s.l):s}function y9(e,t,r,s){if(t.v!=null)switch(t.t){case"d":case"n":var i=t.t=="d"?bn(Qr(t.v)):t.v;i==(i|0)&&i>=0&&i<65536?pt(e,2,ME(r,s,i)):pt(e,3,OE(r,s,i));return;case"b":case"e":pt(e,5,p9(r,s,t.v,t.t));return;case"s":case"str":pt(e,4,x9(r,s,(t.v||"").slice(0,255)));return}pt(e,1,S0(null,r,s))}function b9(e,t,r,s){var i=Array.isArray(t),d=za(t["!ref"]||"A1"),c,f="",p=[];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 g=d.s.r;g<=d.e.r;++g){f=Pr(g);for(var x=d.s.c;x<=d.e.c;++x){g===d.s.r&&(p[x]=Wr(x)),c=p[x]+f;var y=i?(t[g]||[])[x]:t[c];y&&y9(e,y,g,x)}}}function v9(e,t){for(var r=t||{},s=yn(),i=0,d=0;d<e.SheetNames.length;++d)e.SheetNames[d]==r.sheet&&(i=d);if(i==0&&r.sheet&&e.SheetNames[0]!=r.sheet)throw new Error("Sheet not found: "+r.sheet);return pt(s,r.biff==4?1033:r.biff==3?521:9,Rp(e,16,r)),b9(s,e.Sheets[e.SheetNames[i]],i,r),pt(s,10),s.end()}function _9(e,t,r){pt(e,49,mE({sz:12,name:"Arial"},r))}function w9(e,t,r){t&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&pt(e,1054,xE(i,t[i],r))})}function k9(e,t){var r=Ge(19);r.write_shift(4,2151),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,1),r.write_shift(4,0),pt(e,2151,r),r=Ge(39),r.write_shift(4,2152),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,0),r.write_shift(4,0),r.write_shift(2,1),r.write_shift(4,4),r.write_shift(2,0),fw(za(t["!ref"]||"A1"),r),r.write_shift(4,4),pt(e,2152,r)}function N9(e,t){for(var r=0;r<16;++r)pt(e,224,Fv({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(s){pt(e,224,Fv(s,0,t))})}function j9(e,t){for(var r=0;r<t["!links"].length;++r){var s=t["!links"][r];pt(e,440,jE(s)),s[1].Tooltip&&pt(e,2048,SE(s))}delete t["!links"]}function S9(e,t){if(t){var r=0;t.forEach(function(s,i){++r<=256&&s&&pt(e,125,CE(lh(i,s),i))})}}function T9(e,t,r,s,i){var d=16+ml(i.cellXfs,t,i);if(t.v==null&&!t.bf){pt(e,513,co(r,s,d));return}if(t.bf)pt(e,6,J8(t,r,s,i,d));else switch(t.t){case"d":case"n":var c=t.t=="d"?bn(Qr(t.v)):t.v;pt(e,515,_E(r,s,c,d));break;case"b":case"e":pt(e,517,vE(r,s,t.v,d,i,t.t));break;case"s":case"str":if(i.bookSST){var f=Up(i.Strings,t.v,i.revStrings);pt(e,253,gE(r,s,f,d))}else pt(e,516,pE(r,s,(t.v||"").slice(0,255),d,i));break;default:pt(e,513,co(r,s,d))}}function E9(e,t,r){var s=yn(),i=r.SheetNames[e],d=r.Sheets[i]||{},c=(r||{}).Workbook||{},f=(c.Sheets||[])[e]||{},p=Array.isArray(d),g=t.biff==8,x,y="",v=[],k=za(d["!ref"]||"A1"),T=g?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)}pt(s,2057,Rp(r,16,t)),pt(s,13,es(1)),pt(s,12,es(100)),pt(s,15,Jr(!0)),pt(s,17,Jr(!1)),pt(s,16,oo(.001)),pt(s,95,Jr(!0)),pt(s,42,Jr(!1)),pt(s,43,Jr(!1)),pt(s,130,es(1)),pt(s,128,bE()),pt(s,131,Jr(!1)),pt(s,132,Jr(!1)),g&&S9(s,d["!cols"]),pt(s,512,yE(k,t)),g&&(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&&(v[S]=Wr(S)),x=v[S]+y;var A=p?(d[N]||[])[S]:d[x];A&&(T9(s,A,N,S,t),g&&A.l&&d["!links"].push([x,A.l]))}}var C=f.CodeName||f.name||i;return g&&pt(s,574,hE((c.Views||[])[0])),g&&(d["!merges"]||[]).length&&pt(s,229,NE(d["!merges"])),g&&j9(s,d),pt(s,442,uw(C)),g&&k9(s,d),pt(s,10),s.end()}function C9(e,t,r){var s=yn(),i=(e||{}).Workbook||{},d=i.Sheets||[],c=i.WBProps||{},f=r.biff==8,p=r.biff==5;if(pt(s,2057,Rp(e,5,r)),r.bookType=="xla"&&pt(s,135),pt(s,225,f?es(1200):null),pt(s,193,eE(2)),p&&pt(s,191),p&&pt(s,192),pt(s,226),pt(s,92,cE("SheetJS",r)),pt(s,66,es(f?1200:1252)),f&&pt(s,353,es(0)),f&&pt(s,448),pt(s,317,AE(e.SheetNames.length)),f&&e.vbaraw&&pt(s,211),f&&e.vbaraw){var g=c.CodeName||"ThisWorkbook";pt(s,442,uw(g))}pt(s,156,es(17)),pt(s,25,Jr(!1)),pt(s,18,Jr(!1)),pt(s,19,es(0)),f&&pt(s,431,Jr(!1)),f&&pt(s,444,es(0)),pt(s,61,fE()),pt(s,64,Jr(!1)),pt(s,141,es(0)),pt(s,34,Jr(DA(e)=="true")),pt(s,14,Jr(!0)),f&&pt(s,439,Jr(!1)),pt(s,218,es(0)),_9(s,e,r),w9(s,e.SSF,r),N9(s,r),f&&pt(s,352,Jr(!1));var x=s.end(),y=yn();f&&pt(y,140,TE()),f&&r.Strings&&g9(y,252,uE(r.Strings)),pt(y,10);var v=y.end(),k=yn(),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+v.length;for(N=0;N<e.SheetNames.length;++N){var A=d[N]||{};pt(k,133,dE({pos:S,hs:A.Hidden||0,dt:0,name:e.SheetNames[N]},r)),S+=t[N].length}var C=k.end();if(T!=C.length)throw new Error("BS8 "+T+" != "+C.length);var O=[];return x.length&&O.push(x),C.length&&O.push(C),v.length&&O.push(v),Lr(O)}function A9(e,t){var r=t||{},s=[];e&&!e.SSF&&(e.SSF=vn(Ka)),e&&e.SSF&&(ah(),th(e.SSF),r.revssf=rh(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,Hp(r),r.cellXfs=[],ml(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var i=0;i<e.SheetNames.length;++i)s[s.length]=E9(i,r,e);return s.unshift(C9(e,s,r)),Lr(s)}function Iw(e,t){for(var r=0;r<=e.SheetNames.length;++r){var s=e.Sheets[e.SheetNames[r]];if(!(!s||!s["!ref"])){var i=zn(s["!ref"]);i.e.c>255&&typeof console!="undefined"&&console.error&&console.error("Worksheet '"+e.SheetNames[r]+"' extends beyond column IV (255). Data may be lost.")}}var d=t||{};switch(d.biff||2){case 8:case 5:return A9(e,t);case 4:case 3:case 2:return v9(e,t)}throw new Error("invalid type "+d.bookType+" for BIFF")}function O9(e,t,r,s){for(var i=e["!merges"]||[],d=[],c=t.s.c;c<=t.e.c;++c){for(var f=0,p=0,g=0;g<i.length;++g)if(!(i[g].s.r>r||i[g].s.c>c)&&!(i[g].e.r<r||i[g].e.c<c)){if(i[g].s.r<r||i[g].s.c<c){f=-1;break}f=i[g].e.r-i[g].s.r+1,p=i[g].e.c-i[g].s.c+1;break}if(!(f<0)){var x=Sa({r,c}),y=s.dense?(e[r]||[])[c]:e[x],v=y&&y.v!=null&&(y.h||oT(y.w||(vi(y),y.w)||""))||"",k={};f>1&&(k.rowspan=f),p>1&&(k.colspan=p),s.editable?v='<span contenteditable="true">'+v+"</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)!="#"&&(v='<a href="'+y.l.Target+'">'+v+"</a>")),k.id=(s.id||"sjs")+"-"+x,d.push(gt("td",v,k))}}var T="<tr>";return T+d.join("")+"</tr>"}var M9='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',L9="</body></html>";function D9(e,t,r){var s=[];return s.join("")+"<table"+(r&&r.id?' id="'+r.id+'"':"")+">"}function zw(e,t){var r=t||{},s=r.header!=null?r.header:M9,i=r.footer!=null?r.footer:L9,d=[s],c=zn(e["!ref"]);r.dense=Array.isArray(e),d.push(D9(e,c,r));for(var f=c.s.r;f<=c.e.r;++f)d.push(O9(e,c,f,r));return d.push("</table>"+i),d.join("")}function Bw(e,t,r){var s=r||{},i=0,d=0;if(s.origin!=null)if(typeof s.origin=="number")i=s.origin;else{var c=typeof s.origin=="string"?wr(s.origin):s.origin;i=c.r,d=c.c}var f=t.getElementsByTagName("tr"),p=Math.min(s.sheetRows||1e7,f.length),g={s:{r:0,c:0},e:{r:i,c:d}};if(e["!ref"]){var x=zn(e["!ref"]);g.s.r=Math.min(g.s.r,x.s.r),g.s.c=Math.min(g.s.c,x.s.c),g.e.r=Math.max(g.e.r,x.e.r),g.e.c=Math.max(g.e.c,x.e.c),i==-1&&(g.e.r=i=x.e.r+1)}var y=[],v=0,k=e["!rows"]||(e["!rows"]=[]),T=0,N=0,S=0,A=0,C=0,O=0;for(e["!cols"]||(e["!cols"]=[]);T<f.length&&N<p;++T){var P=f[T];if(Wv(P)){if(s.display)continue;k[N]={hidden:!0}}var B=P.children;for(S=A=0;S<B.length;++S){var V=B[S];if(!(s.display&&Wv(V))){var z=V.hasAttribute("data-v")?V.getAttribute("data-v"):V.hasAttribute("v")?V.getAttribute("v"):fT(V.innerHTML),U=V.getAttribute("data-z")||V.getAttribute("z");for(v=0;v<y.length;++v){var J=y[v];J.s.c==A+d&&J.s.r<N+i&&N+i<=J.e.r&&(A=J.e.c+1-d,v=-1)}O=+V.getAttribute("colspan")||1,((C=+V.getAttribute("rowspan")||1)>1||O>1)&&y.push({s:{r:N+i,c:A+d},e:{r:N+i+(C||1)-1,c:A+d+(O||1)-1}});var de={t:"s",v:z},ye=V.getAttribute("data-t")||V.getAttribute("t")||"";z!=null&&(z.length==0?de.t=ye||"z":s.raw||z.trim().length==0||ye=="s"||(z==="TRUE"?de={t:"b",v:!0}:z==="FALSE"?de={t:"b",v:!1}:isNaN(gi(z))?isNaN(s0(z).getDate())||(de={t:"d",v:Qr(z)},s.cellDates||(de={t:"n",v:bn(de.v)}),de.z=s.dateNF||Ka[14]):de={t:"n",v:gi(z)})),de.z===void 0&&U!=null&&(de.z=U);var ie="",he=V.getElementsByTagName("A");if(he&&he.length)for(var ve=0;ve<he.length&&!(he[ve].hasAttribute("href")&&(ie=he[ve].getAttribute("href"),ie.charAt(0)!="#"));++ve);ie&&ie.charAt(0)!="#"&&(de.l={Target:ie}),s.dense?(e[N+i]||(e[N+i]=[]),e[N+i][A+d]=de):e[Sa({c:A+d,r:N+i})]=de,g.e.c<A+d&&(g.e.c=A+d),A+=O}}++N}return y.length&&(e["!merges"]=(e["!merges"]||[]).concat(y)),g.e.r=Math.max(g.e.r,N-1+i),e["!ref"]=cr(g),N>=p&&(e["!fullref"]=cr((g.e.r=f.length-T+N-1+i,g))),e}function Uw(e,t){var r=t||{},s=r.dense?[]:{};return Bw(s,e,t)}function P9(e,t){return fo(Uw(e,t),t)}function Wv(e){var t="",r=R9(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function R9(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var F9=(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}})(),Vv=(function(){var e=function(d){return ja(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 />
`,r=` <table:covered-table-cell/>
`,s=function(d,c,f){var p=[];p.push(' <table:table table:name="'+ja(c.SheetNames[f])+`" table:style-name="ta1">
`);var g=0,x=0,y=zn(d["!ref"]||"A1"),v=d["!merges"]||[],k=0,T=Array.isArray(d);if(d["!cols"])for(x=0;x<=y.e.c;++x)p.push(" <table:table-column"+(d["!cols"][x]?' table:style-name="co'+d["!cols"][x].ods+'"':"")+`></table:table-column>
`);var N="",S=d["!rows"]||[];for(g=0;g<y.s.r;++g)N=S[g]?' table:style-name="ro'+S[g].ods+'"':"",p.push(" <table:table-row"+N+`></table:table-row>
`);for(;g<=y.e.r;++g){for(N=S[g]?' table:style-name="ro'+S[g].ods+'"':"",p.push(" <table:table-row"+N+`>
`),x=0;x<y.s.c;++x)p.push(t);for(;x<=y.e.c;++x){var A=!1,C={},O="";for(k=0;k!=v.length;++k)if(!(v[k].s.c>x)&&!(v[k].s.r>g)&&!(v[k].e.c<x)&&!(v[k].e.r<g)){(v[k].s.c!=x||v[k].s.r!=g)&&(A=!0),C["table:number-columns-spanned"]=v[k].e.c-v[k].s.c+1,C["table:number-rows-spanned"]=v[k].e.r-v[k].s.r+1;break}if(A){p.push(r);continue}var P=Sa({r:g,c:x}),B=T?(d[g]||[])[x]:d[P];if(B&&B.f&&(C["table:formula"]=ja(r7(B.f)),B.F&&B.F.slice(0,P.length)==P)){var V=zn(B.F);C["table:number-matrix-columns-spanned"]=V.e.c-V.s.c+1,C["table:number-matrix-rows-spanned"]=V.e.r-V.s.r+1}if(!B){p.push(t);continue}switch(B.t){case"b":O=B.v?"TRUE":"FALSE",C["office:value-type"]="boolean",C["office:boolean-value"]=B.v?"true":"false";break;case"n":O=B.w||String(B.v||0),C["office:value-type"]="float",C["office:value"]=B.v||0;break;case"s":case"str":O=B.v==null?"":B.v,C["office:value-type"]="string";break;case"d":O=B.w||Qr(B.v).toISOString(),C["office:value-type"]="date",C["office:date-value"]=Qr(B.v).toISOString(),C["table:style-name"]="ce1";break;default:p.push(t);continue}var z=e(O);if(B.l&&B.l.Target){var U=B.l.Target;U=U.charAt(0)=="#"?"#"+n7(U.slice(1)):U,U.charAt(0)!="#"&&!U.match(/^\w+:/)&&(U="../"+U),z=gt("text:a",z,{"xlink:href":U.replace(/&/g,"&amp;")})}p.push(" "+gt("table:table-cell",gt("text:p",z,{}),C)+`
`)}p.push(` </table:table-row>
`)}return p.push(` </table:table>
`),p.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(g){return c.Sheets[g]}).forEach(function(g){if(g&&g["!cols"]){for(var x=0;x<g["!cols"].length;++x)if(g["!cols"][x]){var y=g["!cols"][x];if(y.width==null&&y.wpx==null&&y.wch==null)continue;Fp(y),y.ods=f;var v=g["!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="'+v+`"/>
`),d.push(` </style:style>
`),++f}}});var p=0;c.SheetNames.map(function(g){return c.Sheets[g]}).forEach(function(g){if(g&&g["!rows"]){for(var x=0;x<g["!rows"].length;++x)if(g["!rows"][x]){g["!rows"][x].ods=p;var y=g["!rows"][x].hpx+"px";d.push(' <style:style style:name="ro'+p+`" style:family="table-row">
`),d.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+y+`"/>
`),d.push(` </style:style>
`),++p}}}),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 p=[dr],g=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"?(p.push("<office:document"+g+x+`>
`),p.push(aw().replace(/office:document-meta/g,"office:meta"))):p.push("<office:document-content"+g+`>
`),i(p,c),p.push(` <office:body>
`),p.push(` <office:spreadsheet>
`);for(var y=0;y!=c.SheetNames.length;++y)p.push(s(c.Sheets[c.SheetNames[y]],c,y));return p.push(` </office:spreadsheet>
`),p.push(` </office:body>
`),f.bookType=="fods"?p.push("</office:document>"):p.push("</office:document-content>"),p.join("")}})();function Hw(e,t){if(t.bookType=="fods")return Vv(e,t);var r=Sp(),s="",i=[],d=[];return s="mimetype",Jt(r,s,"application/vnd.oasis.opendocument.spreadsheet"),s="content.xml",Jt(r,s,Vv(e,t)),i.push([s,"text/xml"]),d.push([s,"ContentFile"]),s="styles.xml",Jt(r,s,F9(e,t)),i.push([s,"text/xml"]),d.push([s,"StylesFile"]),s="meta.xml",Jt(r,s,dr+aw()),i.push([s,"text/xml"]),d.push([s,"MetadataFile"]),s="manifest.rdf",Jt(r,s,YT(d)),i.push([s,"application/rdf+xml"]),s="META-INF/manifest.xml",Jt(r,s,ZT(i)),r}function Bf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function I9(e){return typeof TextEncoder!="undefined"?new TextEncoder().encode(e):ys(i0(e))}function z9(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var s=0;s<t.length;++s)if(e[r+s]!=t[s])continue e;return!0}return!1}function ul(e){var t=e.reduce(function(i,d){return i+d.length},0),r=new Uint8Array(t),s=0;return e.forEach(function(i){r.set(i,s),s+=i.length}),r}function B9(e,t,r){var s=Math.floor(r==0?0:Math.LOG10E*Math.log(Math.abs(r)))+6176-20,i=r/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]|=r>=0?0:128}function o0(e,t){var r=t?t[0]:0,s=e[r]&127;e:if(e[r++]>=128&&(s|=(e[r]&127)<<7,e[r++]<128||(s|=(e[r]&127)<<14,e[r++]<128)||(s|=(e[r]&127)<<21,e[r++]<128)||(s+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(s+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(s+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),s}function ka(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function _c(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function mr(e){for(var t=[],r=[0];r[0]<e.length;){var s=r[0],i=o0(e,r),d=i&7;i=Math.floor(i/8);var c=0,f;if(i==0)break;switch(d){case 0:{for(var p=r[0];e[r[0]++]>=128;);f=e.slice(p,r[0])}break;case 5:c=4,f=e.slice(r[0],r[0]+c),r[0]+=c;break;case 1:c=8,f=e.slice(r[0],r[0]+c),r[0]+=c;break;case 2:c=o0(e,r),f=e.slice(r[0],r[0]+c),r[0]+=c;break;case 3:case 4:default:throw new Error("PB Type ".concat(d," for Field ").concat(i," at offset ").concat(s))}var g={data:f,type:d};t[i]==null?t[i]=[g]:t[i].push(g)}return t}function Or(e){var t=[];return e.forEach(function(r,s){r.forEach(function(i){i.data&&(t.push(ka(s*8+i.type)),i.type==2&&t.push(ka(i.data.length)),t.push(i.data))})}),ul(t)}function ps(e){for(var t,r=[],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 p=mr(f.data),g=_c(p[3][0].data);c.messages.push({meta:p,data:e.slice(s[0],s[0]+g)}),s[0]+=g}),(t=d[3])!=null&&t[0]&&(c.merge=_c(d[3][0].data)>>>0>0),r.push(c)}return r}function cc(e){var t=[];return e.forEach(function(r){var s=[];s[1]=[{data:ka(r.id),type:0}],s[2]=[],r.merge!=null&&(s[3]=[{data:ka(+!!r.merge),type:0}]);var i=[];r.messages.forEach(function(c){i.push(c.data),c.meta[3]=[{type:0,data:ka(c.data.length)}],s[2].push({data:Or(c.meta),type:2})});var d=Or(s);t.push(ka(d.length)),t.push(d),i.forEach(function(c){return t.push(c)})}),ul(t)}function U9(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],s=o0(t,r),i=[];r[0]<t.length;){var d=t[r[0]]&3;if(d==0){var c=t[r[0]++]>>2;if(c<60)++c;else{var f=c-59;c=t[r[0]],f>1&&(c|=t[r[0]+1]<<8),f>2&&(c|=t[r[0]+2]<<16),f>3&&(c|=t[r[0]+3]<<24),c>>>=0,c++,r[0]+=f}i.push(t.slice(r[0],r[0]+c)),r[0]+=c;continue}else{var p=0,g=0;if(d==1?(g=(t[r[0]]>>2&7)+4,p=(t[r[0]++]&224)<<3,p|=t[r[0]++]):(g=(t[r[0]++]>>2)+1,d==2?(p=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(p=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),i=[ul(i)],p==0)throw new Error("Invalid offset 0");if(p>i[0].length)throw new Error("Invalid offset beyond length");if(g>=p)for(i.push(i[0].slice(-p)),g-=p;g>=i[i.length-1].length;)i.push(i[i.length-1]),g-=i[i.length-1].length;i.push(i[0].slice(-p,-p+g))}}var x=ul(i);if(x.length!=s)throw new Error("Unexpected length: ".concat(x.length," != ").concat(s));return x}function xs(e){for(var t=[],r=0;r<e.length;){var s=e[r++],i=e[r]|e[r+1]<<8|e[r+2]<<16;r+=3,t.push(U9(s,e.slice(r,r+i))),r+=i}if(r!==e.length)throw new Error("data is not a valid framed stream!");return ul(t)}function dc(e){for(var t=[],r=0;r<e.length;){var s=Math.min(e.length-r,268435455),i=new Uint8Array(4);t.push(i);var d=ka(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(r,r+s)),c+=s,i[0]=0,i[1]=c&255,i[2]=c>>8&255,i[3]=c>>16&255,r+=s}return ul(t)}function Dg(e,t){var r=new Uint8Array(32),s=Bf(r),i=12,d=0;switch(r[0]=5,e.t){case"n":r[1]=2,B9(r,i,e.v),d|=1,i+=16;break;case"b":r[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!"));r[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),r.slice(0,i)}function Pg(e,t){var r=new Uint8Array(32),s=Bf(r),i=12,d=0;switch(r[0]=3,e.t){case"n":r[2]=2,s.setFloat64(i,e.v,!0),d|=32,i+=8;break;case"b":r[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!"));r[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),r.slice(0,i)}function sl(e){var t=mr(e);return o0(t[1][0].data)}function H9(e,t,r){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 p=0,g=Bf(e[7][0].data),x=0,y=[],v=Bf(e[4][0].data),k=0,T=[],N=0;N<t.length;++N){if(t[N]==null){g.setUint16(N*2,65535,!0),v.setUint16(N*2,65535);continue}g.setUint16(N*2,x,!0),v.setUint16(N*2,k,!0);var S,A;switch(typeof t[N]){case"string":S=Dg({t:"s",v:t[N]},r),A=Pg({t:"s",v:t[N]},r);break;case"number":S=Dg({t:"n",v:t[N]},r),A=Pg({t:"n",v:t[N]},r);break;case"boolean":S=Dg({t:"b",v:t[N]},r),A=Pg({t:"b",v:t[N]},r);break;default:throw new Error("Unsupported value "+t[N])}y.push(S),x+=S.length,T.push(A),k+=A.length,++p}for(e[2][0].data=ka(p);N<e[7][0].data.length/2;++N)g.setUint16(N*2,65535,!0),v.setUint16(N*2,65535,!0);return e[6][0].data=ul(y),e[3][0].data=ul(T),p}function $9(e,t){if(!t||!t.numbers)throw new Error("Must pass a `numbers` option -- check the README");var r=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var s=zn(r["!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=Uf(r,{range:s,header:1}),c=["~Sh33tJ5~"];d.forEach(function(H){return H.forEach(function(Z){typeof Z=="string"&&c.push(Z)})});var f={},p=[],g=La.read(t.numbers,{type:"base64"});g.FileIndex.map(function(H,Z){return[H,g.FullPaths[Z]]}).forEach(function(H){var Z=H[0],K=H[1];if(Z.type==2&&Z.name.match(/\.iwa/)){var ue=Z.content,Le=xs(ue),Ne=ps(Le);Ne.forEach(function(We){p.push(We.id),f[We.id]={deps:[],location:K,type:_c(We.messages[0].meta[1][0].data)}})}}),p.sort(function(H,Z){return H-Z});var x=p.filter(function(H){return H>1}).map(function(H){return[H,ka(H)]});g.FileIndex.map(function(H,Z){return[H,g.FullPaths[Z]]}).forEach(function(H){var Z=H[0];if(H[1],!!Z.name.match(/\.iwa/)){var K=ps(xs(Z.content));K.forEach(function(ue){ue.messages.forEach(function(Le){x.forEach(function(Ne){ue.messages.some(function(We){return _c(We.meta[1][0].data)!=11006&&z9(We.data,Ne[1])})&&f[Ne[0]].deps.push(ue.id)})})})}});for(var y=La.find(g,f[1].location),v=ps(xs(y.content)),k,T=0;T<v.length;++T){var N=v[T];N.id==1&&(k=N)}var S=sl(mr(k.messages[0].data)[1][0].data);for(y=La.find(g,f[S].location),v=ps(xs(y.content)),T=0;T<v.length;++T)N=v[T],N.id==S&&(k=N);for(S=sl(mr(k.messages[0].data)[2][0].data),y=La.find(g,f[S].location),v=ps(xs(y.content)),T=0;T<v.length;++T)N=v[T],N.id==S&&(k=N);for(S=sl(mr(k.messages[0].data)[2][0].data),y=La.find(g,f[S].location),v=ps(xs(y.content)),T=0;T<v.length;++T)N=v[T],N.id==S&&(k=N);var A=mr(k.messages[0].data);{A[6][0].data=ka(s.e.r+1),A[7][0].data=ka(s.e.c+1);var C=sl(A[46][0].data),O=La.find(g,f[C].location),P=ps(xs(O.content));{for(var B=0;B<P.length&&P[B].id!=C;++B);if(P[B].id!=C)throw"Bad ColumnRowUIDMapArchive";var V=mr(P[B].messages[0].data);V[1]=[],V[2]=[],V[3]=[];for(var z=0;z<=s.e.c;++z){var U=[];U[1]=U[2]=[{type:0,data:ka(z+420690)}],V[1].push({type:2,data:Or(U)}),V[2].push({type:0,data:ka(z)}),V[3].push({type:0,data:ka(z)})}V[4]=[],V[5]=[],V[6]=[];for(var J=0;J<=s.e.r;++J)U=[],U[1]=U[2]=[{type:0,data:ka(J+726270)}],V[4].push({type:2,data:Or(U)}),V[5].push({type:0,data:ka(J)}),V[6].push({type:0,data:ka(J)});P[B].messages[0].data=Or(V)}O.content=dc(cc(P)),O.size=O.content.length,delete A[46];var de=mr(A[4][0].data);{de[7][0].data=ka(s.e.r+1);var ye=mr(de[1][0].data),ie=sl(ye[2][0].data);O=La.find(g,f[ie].location),P=ps(xs(O.content));{if(P[0].id!=ie)throw"Bad HeaderStorageBucket";var he=mr(P[0].messages[0].data);for(J=0;J<d.length;++J){var ve=mr(he[2][0].data);ve[1][0].data=ka(J),ve[4][0].data=ka(d[J].length),he[2][J]={type:he[2][0].type,data:Or(ve)}}P[0].messages[0].data=Or(he)}O.content=dc(cc(P)),O.size=O.content.length;var me=sl(de[2][0].data);O=La.find(g,f[me].location),P=ps(xs(O.content));{if(P[0].id!=me)throw"Bad HeaderStorageBucket";for(he=mr(P[0].messages[0].data),z=0;z<=s.e.c;++z)ve=mr(he[2][0].data),ve[1][0].data=ka(z),ve[4][0].data=ka(s.e.r+1),he[2][z]={type:he[2][0].type,data:Or(ve)};P[0].messages[0].data=Or(he)}O.content=dc(cc(P)),O.size=O.content.length;var ee=sl(de[4][0].data);(function(){for(var H=La.find(g,f[ee].location),Z=ps(xs(H.content)),K,ue=0;ue<Z.length;++ue){var Le=Z[ue];Le.id==ee&&(K=Le)}var Ne=mr(K.messages[0].data);{Ne[3]=[];var We=[];c.forEach(function(ft,Dt){We[1]=[{type:0,data:ka(Dt)}],We[2]=[{type:0,data:ka(1)}],We[3]=[{type:2,data:I9(ft)}],Ne[3].push({type:2,data:Or(We)})})}K.messages[0].data=Or(Ne);var Fe=cc(Z),tt=dc(Fe);H.content=tt,H.size=H.content.length})();var q=mr(de[3][0].data);{var Q=q[1][0];delete q[2];var fe=mr(Q.data);{var ae=sl(fe[2][0].data);(function(){for(var H=La.find(g,f[ae].location),Z=ps(xs(H.content)),K,ue=0;ue<Z.length;++ue){var Le=Z[ue];Le.id==ae&&(K=Le)}var Ne=mr(K.messages[0].data);{delete Ne[6],delete q[7];var We=new Uint8Array(Ne[5][0].data);Ne[5]=[];for(var Fe=0,tt=0;tt<=s.e.r;++tt){var ft=mr(We);Fe+=H9(ft,d[tt],c),ft[1][0].data=ka(tt),Ne[5].push({data:Or(ft),type:2})}Ne[1]=[{type:0,data:ka(s.e.c+1)}],Ne[2]=[{type:0,data:ka(s.e.r+1)}],Ne[3]=[{type:0,data:ka(Fe)}],Ne[4]=[{type:0,data:ka(s.e.r+1)}]}K.messages[0].data=Or(Ne);var Dt=cc(Z),Ve=dc(Dt);H.content=Ve,H.size=H.content.length})()}Q.data=Or(fe)}de[3][0].data=Or(q)}A[4][0].data=Or(de)}k.messages[0].data=Or(A);var F=cc(v),D=dc(F);return y.content=D,y.size=y.content.length,g}function W9(e){return function(r){for(var s=0;s!=e.length;++s){var i=e[s];r[i[0]]===void 0&&(r[i[0]]=i[1]),i[2]==="n"&&(r[i[0]]=Number(r[i[0]]))}}}function Hp(e){W9([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function V9(e,t){return t.bookType=="ods"?Hw(e,t):t.bookType=="numbers"?$9(e,t):t.bookType=="xlsb"?G9(e,t):Z9(e,t)}function G9(e,t){mc=1024,e&&!e.SSF&&(e.SSF=vn(Ka)),e&&e.SSF&&(ah(),th(e.SSF),t.revssf=rh(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 r=t.bookType=="xlsb"?"bin":"xml",s=Nw.indexOf(t.bookType)>-1,i=Q2();Hp(t=t||{});var d=Sp(),c="",f=0;if(t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Jt(d,c,rw(e.Props,t)),i.coreprops.push(c),Na(t.rels,2,c,ha.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 p=[],g=0;g<e.SheetNames.length;++g)(e.Workbook.Sheets[g]||{}).Hidden!=2&&p.push(e.SheetNames[g]);e.Props.SheetNames=p}for(e.Props.Worksheets=e.Props.SheetNames.length,Jt(d,c,sw(e.Props)),i.extprops.push(c),Na(t.rels,3,c,ha.EXT_PROPS),e.Custprops!==e.Props&&Fr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Jt(d,c,iw(e.Custprops)),i.custprops.push(c),Na(t.rels,4,c,ha.CUST_PROPS)),f=1;f<=e.SheetNames.length;++f){var x={"!id":{}},y=e.Sheets[e.SheetNames[f-1]],v=(y||{})["!type"]||"sheet";switch(v){case"chart":default:c="xl/worksheets/sheet"+f+"."+r,Jt(d,c,YA(f-1,c,t,e,x)),i.sheets.push(c),Na(t.wbrels,-1,"worksheets/sheet"+f+"."+r,ha.WS[0])}if(y){var k=y["!comments"],T=!1,N="";k&&k.length>0&&(N="xl/comments"+f+"."+r,Jt(d,N,KA(k,N)),i.comments.push(N),Na(x,-1,"../comments"+f+"."+r,ha.CMNT),T=!0),y["!legacy"]&&T&&Jt(d,"xl/drawings/vmlDrawing"+f+".vml",ww(f,y["!comments"])),delete y["!comments"],delete y["!legacy"]}x["!id"].rId1&&Jt(d,tw(c),bc(x))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+r,Jt(d,c,JA(t.Strings,c,t)),i.strs.push(c),Na(t.wbrels,-1,"sharedStrings."+r,ha.SST)),c="xl/workbook."+r,Jt(d,c,qA(e,c)),i.workbooks.push(c),Na(t.rels,1,c,ha.WB),c="xl/theme/theme1.xml",Jt(d,c,vw(e.Themes,t)),i.themes.push(c),Na(t.wbrels,-1,"theme/theme1.xml",ha.THEME),c="xl/styles."+r,Jt(d,c,XA(e,c,t)),i.styles.push(c),Na(t.wbrels,-1,"styles."+r,ha.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Jt(d,c,e.vbaraw),i.vba.push(c),Na(t.wbrels,-1,"vbaProject.bin",ha.VBA)),c="xl/metadata."+r,Jt(d,c,QA(c)),i.metadata.push(c),Na(t.wbrels,-1,"metadata."+r,ha.XLMETA),Jt(d,"[Content_Types].xml",ew(i,t)),Jt(d,"_rels/.rels",bc(t.rels)),Jt(d,"xl/_rels/workbook."+r+".rels",bc(t.wbrels)),delete t.revssf,delete t.ssf,d}function Z9(e,t){mc=1024,e&&!e.SSF&&(e.SSF=vn(Ka)),e&&e.SSF&&(ah(),th(e.SSF),t.revssf=rh(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 r="xml",s=Nw.indexOf(t.bookType)>-1,i=Q2();Hp(t=t||{});var d=Sp(),c="",f=0;if(t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Jt(d,c,rw(e.Props,t)),i.coreprops.push(c),Na(t.rels,2,c,ha.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 p=[],g=0;g<e.SheetNames.length;++g)(e.Workbook.Sheets[g]||{}).Hidden!=2&&p.push(e.SheetNames[g]);e.Props.SheetNames=p}e.Props.Worksheets=e.Props.SheetNames.length,Jt(d,c,sw(e.Props)),i.extprops.push(c),Na(t.rels,3,c,ha.EXT_PROPS),e.Custprops!==e.Props&&Fr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Jt(d,c,iw(e.Custprops)),i.custprops.push(c),Na(t.rels,4,c,ha.CUST_PROPS));var x=["SheetJ5"];for(t.tcid=0,f=1;f<=e.SheetNames.length;++f){var y={"!id":{}},v=e.Sheets[e.SheetNames[f-1]],k=(v||{})["!type"]||"sheet";switch(k){case"chart":default:c="xl/worksheets/sheet"+f+"."+r,Jt(d,c,Lw(f-1,t,e,y)),i.sheets.push(c),Na(t.wbrels,-1,"worksheets/sheet"+f+"."+r,ha.WS[0])}if(v){var T=v["!comments"],N=!1,S="";if(T&&T.length>0){var A=!1;T.forEach(function(C){C[1].forEach(function(O){O.T==!0&&(A=!0)})}),A&&(S="xl/threadedComments/threadedComment"+f+"."+r,Jt(d,S,NC(T,x,t)),i.threadedcomments.push(S),Na(y,-1,"../threadedComments/threadedComment"+f+"."+r,ha.TCMNT)),S="xl/comments"+f+"."+r,Jt(d,S,kw(T)),i.comments.push(S),Na(y,-1,"../comments"+f+"."+r,ha.CMNT),N=!0}v["!legacy"]&&N&&Jt(d,"xl/drawings/vmlDrawing"+f+".vml",ww(f,v["!comments"])),delete v["!comments"],delete v["!legacy"]}y["!id"].rId1&&Jt(d,tw(c),bc(y))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+r,Jt(d,c,mw(t.Strings,t)),i.strs.push(c),Na(t.wbrels,-1,"sharedStrings."+r,ha.SST)),c="xl/workbook."+r,Jt(d,c,Rw(e)),i.workbooks.push(c),Na(t.rels,1,c,ha.WB),c="xl/theme/theme1.xml",Jt(d,c,vw(e.Themes,t)),i.themes.push(c),Na(t.wbrels,-1,"theme/theme1.xml",ha.THEME),c="xl/styles."+r,Jt(d,c,yw(e,t)),i.styles.push(c),Na(t.wbrels,-1,"styles."+r,ha.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Jt(d,c,e.vbaraw),i.vba.push(c),Na(t.wbrels,-1,"vbaProject.bin",ha.VBA)),c="xl/metadata."+r,Jt(d,c,_w()),i.metadata.push(c),Na(t.wbrels,-1,"metadata."+r,ha.XLMETA),x.length>1&&(c="xl/persons/person.xml",Jt(d,c,jC(x)),i.people.push(c),Na(t.wbrels,-1,"persons/person.xml",ha.PEOPLE)),Jt(d,"[Content_Types].xml",ew(i,t)),Jt(d,"_rels/.rels",bc(t.rels)),Jt(d,"xl/_rels/workbook."+r+".rels",bc(t.wbrels)),delete t.revssf,delete t.ssf,d}function q9(e,t){var r="";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":r=bi(e.slice(0,12));break;case"binary":r=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[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function $w(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return w0(t.file,La.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 La.write(e,t)}function Y9(e,t){var r=vn(t||{}),s=V9(e,r);return X9(s,r)}function X9(e,t){var r={},s=pa?"nodebuffer":typeof Uint8Array!="undefined"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=s;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=s;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?La.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno!="undefined"&&typeof i=="string"){if(t.type=="binary"||t.type=="base64")return i;i=new Uint8Array(eh(i))}return t.password&&typeof encrypt_agile!="undefined"?$w(encrypt_agile(i,t.password),t):t.type==="file"?w0(t.file,i):t.type=="string"?Yd(i):i}function J9(e,t){var r=t||{},s=h9(e,r);return $w(s,r)}function Hs(e,t,r){r||(r="");var s=r+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?ki(s,"utf8"):typeof TextEncoder!="undefined"?new TextEncoder().encode(s):Hs(s,{type:"binary"}).split("").map(function(i){return i.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function K9(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?ki(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function cf(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",s=0;s<e.length;++s)r+=String.fromCharCode(e[s]);return t.type=="base64"?n0(r):t.type=="string"?Yd(r):r;case"file":return w0(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function Ww(e,t){S5(),FA(e);var r=vn(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var s=Ww(e,r);return r.type="array",eh(s)}var i=0;if(r.sheet&&(typeof r.sheet=="number"?i=r.sheet:i=e.SheetNames.indexOf(r.sheet),!e.SheetNames[i]))throw new Error("Sheet not found: "+r.sheet+" : "+typeof r.sheet);switch(r.bookType||"xlsb"){case"xml":case"xlml":return Hs(u9(e,r),r);case"slk":case"sylk":return Hs(DE.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"htm":case"html":return Hs(zw(e.Sheets[e.SheetNames[i]],r),r);case"txt":return K9(Vw(e.Sheets[e.SheetNames[i]],r),r);case"csv":return Hs($p(e.Sheets[e.SheetNames[i]],r),r,"\uFEFF");case"dif":return Hs(PE.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"dbf":return cf(LE.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"prn":return Hs(RE.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"rtf":return Hs($E.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"eth":return Hs(hw.from_sheet(e.Sheets[e.SheetNames[i]],r),r);case"fods":return Hs(Hw(e,r),r);case"wk1":return cf(Iv.sheet_to_wk1(e.Sheets[e.SheetNames[i]],r),r);case"wk3":return cf(Iv.book_to_wk3(e,r),r);case"biff2":r.biff||(r.biff=2);case"biff3":r.biff||(r.biff=3);case"biff4":return r.biff||(r.biff=4),cf(Iw(e,r),r);case"biff5":r.biff||(r.biff=5);case"biff8":case"xla":case"xls":return r.biff||(r.biff=8),J9(e,r);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return Y9(e,r);default:throw new Error("Unrecognized bookType |"+r.bookType+"|")}}function Q9(e){if(!e.bookType){var t={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},r=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();r.match(/^\.[a-z]+$/)&&(e.bookType=r.slice(1)),e.bookType=t[e.bookType]||e.bookType}}function Ic(e,t,r){var s={};return s.type="file",s.file=t,Q9(s),Ww(e,s)}function eO(e,t,r,s,i,d,c,f){var p=Pr(r),g=f.defval,x=f.raw||!Object.prototype.hasOwnProperty.call(f,"raw"),y=!0,v=i===1?[]:{};if(i!==1)if(Object.defineProperty)try{Object.defineProperty(v,"__rowNum__",{value:r,enumerable:!1})}catch(S){v.__rowNum__=r}else v.__rowNum__=r;if(!c||e[r])for(var k=t.s.c;k<=t.e.c;++k){var T=c?e[r][k]:e[s[k]+p];if(T===void 0||T.t===void 0){if(g===void 0)continue;d[k]!=null&&(v[d[k]]=g);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)v[d[k]]=null;else if(g!==void 0)v[d[k]]=g;else if(x&&N===null)v[d[k]]=null;else continue;else v[d[k]]=x&&(T.t!=="n"||T.t==="n"&&f.rawNumbers!==!1)?N:vi(T,N,f);N!=null&&(y=!1)}}return{row:v,isempty:y}}function Uf(e,t){if(e==null||e["!ref"]==null)return[];var r={t:"n",v:0},s=0,i=1,d=[],c=0,f="",p={s:{r:0,c:0},e:{r:0,c:0}},g=t||{},x=g.range!=null?g.range:e["!ref"];switch(g.header===1?s=1:g.header==="A"?s=2:Array.isArray(g.header)?s=3:g.header==null&&(s=0),typeof x){case"string":p=za(x);break;case"number":p=za(e["!ref"]),p.s.r=x;break;default:p=x}s>0&&(i=0);var y=Pr(p.s.r),v=[],k=[],T=0,N=0,S=Array.isArray(e),A=p.s.r,C=0,O={};S&&!e[A]&&(e[A]=[]);var P=g.skipHidden&&e["!cols"]||[],B=g.skipHidden&&e["!rows"]||[];for(C=p.s.c;C<=p.e.c;++C)if(!(P[C]||{}).hidden)switch(v[C]=Wr(C),r=S?e[A][C]:e[v[C]+y],s){case 1:d[C]=C-p.s.c;break;case 2:d[C]=v[C];break;case 3:d[C]=g.header[C-p.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),f=c=vi(r,null,g),N=O[c]||0,!N)O[c]=1;else{do f=c+"_"+N++;while(O[f]);O[c]=N,O[f]=1}d[C]=f}for(A=p.s.r+i;A<=p.e.r;++A)if(!(B[A]||{}).hidden){var V=eO(e,p,A,v,s,d,S,g);(V.isempty===!1||(s===1?g.blankrows!==!1:g.blankrows))&&(k[T++]=V.row)}return k.length=T,k}var Gv=/"/g;function tO(e,t,r,s,i,d,c,f){for(var p=!0,g=[],x="",y=Pr(r),v=t.s.c;v<=t.e.c;++v)if(s[v]){var k=f.dense?(e[r]||[])[v]:e[s[v]+y];if(k==null)x="";else if(k.v!=null){p=!1,x=""+(f.rawNumbers&&k.t=="n"?k.v:vi(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(Gv,'""')+'"';break}x=="ID"&&(x='"ID"')}else k.f!=null&&!k.F?(p=!1,x="="+k.f,x.indexOf(",")>=0&&(x='"'+x.replace(Gv,'""')+'"')):x="";g.push(x)}return f.blankrows===!1&&p?null:g.join(c)}function $p(e,t){var r=[],s=t==null?{}:t;if(e==null||e["!ref"]==null)return"";var i=za(e["!ref"]),d=s.FS!==void 0?s.FS:",",c=d.charCodeAt(0),f=s.RS!==void 0?s.RS:`
`,p=f.charCodeAt(0),g=new RegExp((d=="|"?"\\|":d)+"+$"),x="",y=[];s.dense=Array.isArray(e);for(var v=s.skipHidden&&e["!cols"]||[],k=s.skipHidden&&e["!rows"]||[],T=i.s.c;T<=i.e.c;++T)(v[T]||{}).hidden||(y[T]=Wr(T));for(var N=0,S=i.s.r;S<=i.e.r;++S)(k[S]||{}).hidden||(x=tO(e,i,S,y,c,p,d,s),x!=null&&(s.strip&&(x=x.replace(g,"")),(x||s.blankrows!==!1)&&r.push((N++?f:"")+x)));return delete s.dense,r.join("")}function Vw(e,t){t||(t={}),t.FS=" ",t.RS=`
`;var r=$p(e,t);return r}function aO(e){var t="",r,s="";if(e==null||e["!ref"]==null)return[];var i=za(e["!ref"]),d="",c=[],f,p=[],g=Array.isArray(e);for(f=i.s.c;f<=i.e.c;++f)c[f]=Wr(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,r=g?(e[x]||[])[f]:e[t],s="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;s=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)s=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)s=""+r.v;else if(r.t=="b")s=r.v?"TRUE":"FALSE";else if(r.w!==void 0)s="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?s="'"+r.v:s=""+r.v}}p[p.length]=t+"="+s}return p}function Gw(e,t,r){var s=r||{},i=+!s.skipHeader,d=e||{},c=0,f=0;if(d&&s.origin!=null)if(typeof s.origin=="number")c=s.origin;else{var p=typeof s.origin=="string"?wr(s.origin):s.origin;c=p.r,f=p.c}var g,x={s:{c:0,r:0},e:{c:f,r:c+t.length-1+i}};if(d["!ref"]){var y=za(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 v=s.header||[],k=0;t.forEach(function(N,S){Fr(N).forEach(function(A){(k=v.indexOf(A))==-1&&(v[k=v.length]=A);var C=N[A],O="z",P="",B=Sa({c:f+k,r:c+S+i});g=c0(d,B),C&&typeof C=="object"&&!(C instanceof Date)?d[B]=C:(typeof C=="number"?O="n":typeof C=="boolean"?O="b":typeof C=="string"?O="s":C instanceof Date?(O="d",s.cellDates||(O="n",C=bn(C)),P=s.dateNF||Ka[14]):C===null&&s.nullError&&(O="e",C=0),g?(g.t=O,g.v=C,delete g.w,delete g.R,P&&(g.z=P)):d[B]=g={t:O,v:C},P&&(g.z=P))})}),x.e.c=Math.max(x.e.c,f+v.length-1);var T=Pr(c);if(i)for(k=0;k<v.length;++k)d[Wr(k+f)+T]={t:"s",v:v[k]};return d["!ref"]=cr(x),d}function rO(e,t){return Gw(null,e,t)}function c0(e,t,r){if(typeof t=="string"){if(Array.isArray(e)){var s=wr(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,Sa(t)):c0(e,Sa({r:t,c:r||0}))}function nO(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 r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function sO(){return{SheetNames:[],Sheets:{}}}function iO(e,t,r,s){var i=1;if(!r)for(;i<=65535&&e.SheetNames.indexOf(r="Sheet"+i)!=-1;++i,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(s&&e.SheetNames.indexOf(r)>=0){var d=r.match(/(^.*?)(\d+)$/);i=d&&+d[2]||0;var c=d&&d[1]||r;for(++i;i<=65535&&e.SheetNames.indexOf(r=c+i)!=-1;++i);}if(Pw(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function lO(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var s=nO(e,t);switch(e.Workbook.Sheets[s]||(e.Workbook.Sheets[s]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[s].Hidden=r}function oO(e,t){return e.z=t,e}function Zw(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function cO(e,t,r){return Zw(e,"#"+t,r)}function dO(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function uO(e,t,r,s){for(var i=typeof t!="string"?t:za(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 p=c0(e,c,f);p.t="n",p.F=d,delete p.v,c==i.s.r&&f==i.s.c&&(p.f=r,s&&(p.D=!0))}return e}var jr={encode_col:Wr,encode_row:Pr,encode_cell:Sa,encode_range:cr,decode_col:Mp,decode_row:Op,split_cell:ST,decode_cell:wr,decode_range:zn,format_cell:vi,sheet_add_aoa:Z2,sheet_add_json:Gw,sheet_add_dom:Bw,aoa_to_sheet:Pc,json_to_sheet:rO,table_to_sheet:Uw,table_to_book:P9,sheet_to_csv:$p,sheet_to_txt:Vw,sheet_to_json:Uf,sheet_to_html:zw,sheet_to_formulae:aO,sheet_to_row_object_array:Uf,sheet_get_cell:c0,book_new:sO,book_append_sheet:iO,book_set_sheet_visibility:lO,cell_set_number_format:oO,cell_set_hyperlink:Zw,cell_set_internal_link:cO,cell_add_comment:dO,sheet_set_array_formula:uO,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const fO={},_t=({label:e,doctype:t,value:r,onChange:s,placeholder:i,disabled:d=!1,filters:c,compact:f=!1,usePortal:p=!1})=>{const[g,x]=j.useState([]),[y,v]=j.useState(""),[k,T]=j.useState(!1),[N,S]=j.useState(!1),[A,C]=j.useState({top:0,left:0,width:0}),O=j.useRef(null),P=j.useRef(null),B=j.useRef(null),V=j.useRef(null),z=j.useRef(""),U=j.useRef(!1),J=c||fO,de=j.useMemo(()=>JSON.stringify(J),[J]),ye=j.useCallback((q="",Q=!1)=>le(null,null,function*(){const fe=`${q}-${de}`;if(!(!Q&&z.current===fe)){z.current=fe,S(!0);try{const ae=new URLSearchParams({doctype:t,txt:q});J&&Object.keys(J).length>0&&ae.append("filters",JSON.stringify(J));const F=yield rt.apiCall(`/api/method/frappe.desk.search.search_link?${ae.toString()}`);x(F||[])}catch(ae){console.error(`Error fetching ${t} links:`,ae),x([])}finally{S(!1)}}}),[t,de,J]),ie=j.useCallback(q=>{V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{ye(q)},300)},[ye]);j.useEffect(()=>{k&&!U.current&&(U.current=!0,ye(y||"",!0)),k||(U.current=!1,z.current="")},[k]),j.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]);const he=j.useCallback(()=>{if(p&&P.current){const q=P.current.getBoundingClientRect();C({top:q.bottom+window.scrollY,left:q.left+window.scrollX,width:q.width})}},[p]);j.useEffect(()=>{if(k&&p){he();const q=()=>he();return window.addEventListener("scroll",q,!0),window.addEventListener("resize",q),()=>{window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q)}}},[k,p,he]),j.useEffect(()=>{const q=Q=>{const fe=Q.target,ae=O.current&&!O.current.contains(fe),F=p&&B.current&&!B.current.contains(fe);p?ae&&F&&(T(!1),v("")):ae&&(T(!1),v(""))};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[p]);const ve=q=>{s(q),v(""),T(!1)},me=()=>{s(""),v(""),T(!1)},ee=()=>{const q=`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"}`,Q=p?{position:"fixed",top:`${A.top}px`,left:`${A.left}px`,width:`${A.width}px`,zIndex:1050,marginTop:f?"2px":"4px"}:{};if(!k||d)return null;const fe=a.jsxs("div",{ref:B,children:[N&&a.jsxs("div",{className:`${p?"":"absolute z-[1050]"} ${q} text-center text-gray-500 dark:text-gray-400
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:Q,children:[a.jsx("span",{className:"inline-block animate-spin mr-2",children:"⏳"}),"Loading..."]}),!N&&g.length>0&&a.jsx("ul",{className:`${p?"":"absolute z-[1050]"} ${q} overflow-auto
${f?"max-h-36":"max-h-48"}`,style:Q,children:g.map((ae,F)=>a.jsxs("li",{onClick:()=>ve(ae.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"}
${r===ae.value?"bg-blue-50 dark:bg-blue-700 font-semibold":""}`,children:[ae.value,ae.description&&a.jsx("span",{className:`text-gray-600 dark:text-gray-300 ml-2
${f?"text-[9px] ml-1":"text-xs ml-2"}`,children:ae.description})]},F))}),!N&&g.length===0&&a.jsx("div",{className:`${p?"":"absolute z-[1050]"} ${q} text-center text-gray-500 dark:text-gray-400
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:Q,children:"No results found"})]});return p?S_.createPortal(fe,document.body):fe};return a.jsxs("div",{ref:O,className:`relative w-full ${f?"mb-2":"mb-4"}`,children:[a.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}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{ref:P,type:"text",value:k?y:r,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"}
${r?f?"pr-5":"pr-8":""}`,onFocus:()=>{d||(T(!0),v(""),p&&he())},onChange:q=>{const Q=q.target.value;v(Q),ie(Q)}}),r&&!d&&!k&&a.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:"✕"})]}),ee()]})},qw=(e="Asset")=>{const[t,r]=j.useState({isAdmin:!1,restrictions:{},permissionFilters:{},targetDoctype:e,loading:!0,error:null}),s=j.useCallback(g=>le(null,null,function*(){const x=g||e;try{r(v=>Se(ne({},v),{loading:!0,error:null,targetDoctype:x}));const y=yield rt.getPermissionFilters(x);return r({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),r(v=>Se(ne({},v),{loading:!1,error:y instanceof Error?y.message:"Failed to fetch permissions"})),null}}),[e]);j.useEffect(()=>{s()},[s]);const i=j.useCallback(g=>{var x;return((x=t.restrictions[g])==null?void 0:x.values)||[]},[t.restrictions]),d=j.useCallback(g=>t.isAdmin?!1:!!t.restrictions[g],[t.isAdmin,t.restrictions]),c=j.useMemo(()=>!t.isAdmin&&Object.keys(t.restrictions).length>0,[t.isAdmin,t.restrictions]),f=j.useCallback(g=>{if(t.isAdmin)return g;const x=ne({},g);for(const[y,v]of Object.entries(t.permissionFilters))if(!x[y])x[y]=v;else if(Array.isArray(v)&&v[0]==="in"){const k=v[1];typeof x[y]=="string"&&!k.includes(x[y])&&(x[y]=["in",[]])}return x},[t.isAdmin,t.permissionFilters]),p=j.useMemo(()=>Object.entries(t.restrictions).map(([g,x])=>({type:g,field:x.field,values:x.values,count:x.count})),[t.restrictions]);return Se(ne({},t),{refetch:s,switchDoctype:s,getAllowedValues:i,hasRestriction:d,hasAnyRestrictions:c,mergeFilters:f,restrictionsList:p})},hO=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:p}=Va(),[g,x]=j.useState(r>0?"selected":"all_with_filters"),[y,v]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{r>0?x("selected"):x("all_with_filters")},[r]);const N=C=>{T(O=>O.includes(C)?O.filter(P=>P!==C):[...O,C])},S=()=>{T(f.map(C=>C.key))},A=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," ",p("assets.title")]})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:p("listPages.exportFormat")}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected asset",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," asset",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," asset",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:p("listPages.exportFormat")}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>v("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.csv")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>v("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.excel")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:A,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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=>a.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:[a.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(g,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},mO=()=>{const{t:e}=Va(),t=xa(),[r,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(null),[p,g]=j.useState(null),x=j.useRef(null),y=20,v=[{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:"custom_site",label:"Site Name",default:!1},{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),[A,C]=j.useState(!1),[O,P]=j.useState(!1),{permissionFilters:B,loading:V,error:z,hasAnyRestrictions:U}=qw("Asset"),[J,de]=j.useState(!1),ye=["Maintenance Manager","Maintenance User","System Manager"];j.useEffect(()=>{le(null,null,function*(){try{console.log("🔍 [Role Check] Starting role check...");const ke=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:ye.join(",")})})).json();console.log("🔍 [Role Check] API Response:",ke),ke.message?(console.log("🔍 [Role Check] User roles:",ke.message.user_roles),console.log("🔍 [Role Check] Matching roles:",ke.message.matching_roles),console.log("✅ [Role Check] Has allowed role:",ke.message.has_role),de(ke.message.has_role)):(console.error("❌ [Role Check] Invalid response:",ke),de(!1))}catch(xe){console.error("❌ [Role Check] Error:",xe),de(!1)}})},[]);const[ie,he]=j.useState(""),[ve,me]=j.useState(""),[ee,q]=j.useState(""),[Q,fe]=j.useState(""),[ae,F]=j.useState(""),[D,H]=j.useState(""),[Z,K]=j.useState(""),[ue,Le]=j.useState(""),[Ne,We]=j.useState(""),[Fe,tt]=j.useState(""),[ft,Dt]=j.useState(""),[Ve,At]=j.useState(!0),[jt,He]=j.useState(0),[oe,we]=j.useState([]),[Ie,ot]=j.useState(!1),[bt,qe]=j.useState(""),[Ue,ht]=j.useState(""),[wt,Mt]=j.useState(""),Ft=j.useRef(null),je=j.useRef(null);j.useEffect(()=>{const re=localStorage.getItem("assetFilterPresets");re&&we(JSON.parse(re))},[]),j.useEffect(()=>{const re=[ie,ve,ee,D,Z,ue,Q,ae,Ne,Fe,ft,i].filter(Boolean).length;He(re)},[ie,ve,ee,D,Z,ue,Q,ae,Ne,Fe,ft,i]);const it={};ie&&(it.name=ie),ve&&(it.company=ve),ee&&(it.custom_site=ee),Q&&(it.custom_manufacturer=Q),ae&&(it.supplier=ae),D&&(it.location=D),Z&&(it.department=Z),ue&&(it.custom_modality=ue),Ne&&(it.custom_device_status=Ne),Fe&&(it.asset_name=["like",`%${Fe}%`]),ft&&(it.custom_serial_number=["like",`%${ft}%`]),i&&(it.asset_name=["like",`%${i}%`]);const{assets:vt,totalCount:Bt,hasMore:De,loading:ct,error:ut,refetch:Nt}=D_(it,y,r*y,"creation desc",B),{deleteAsset:Rt,loading:ia}=P_();j.useEffect(()=>{!ct&&!k&&!V&&T(!0)},[ct,k,V]),j.useEffect(()=>{r!==0&&s(0)},[ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe,ft,i]),j.useEffect(()=>{S(new Set)},[ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe,ft,i,r]);const et=re=>{ht(re),Ft.current&&clearTimeout(Ft.current),Ft.current=window.setTimeout(()=>{tt(re)},800)},pe=re=>{Mt(re),je.current&&clearTimeout(je.current),je.current=window.setTimeout(()=>{Dt(re)},800)},ze=(re,xe)=>{re.key==="Enter"&&(re.preventDefault(),xe==="assetName"?(Ft.current&&clearTimeout(Ft.current),tt(Ue)):xe==="serialNumber"&&(je.current&&clearTimeout(je.current),Dt(wt)))},st=()=>{if(!bt.trim()){alert("Please enter a filter name");return}const re={id:Date.now(),name:bt,filters:{filterAssetId:ie,filterCompany:ve,filterSite:ee,filterLocation:D,filterDepartment:Z,filterModality:ue,filterManufacturer:Q,filterSupplier:ae,filterDeviceStatus:Ne,filterAssetName:Fe,filterSerialNumber:ft,searchTerm:i}},xe=[...oe,re];we(xe),qe(""),ot(!1),localStorage.setItem("assetFilterPresets",JSON.stringify(xe))},Ut=re=>{const xe=re.filters;he(xe.filterAssetId||""),me(xe.filterCompany||""),q(xe.filterSite||""),H(xe.filterLocation||""),K(xe.filterDepartment||""),Le(xe.filterModality||""),fe(xe.filterManufacturer||""),F(xe.filterSupplier||""),We(xe.filterDeviceStatus||""),tt(xe.filterAssetName||""),ht(xe.filterAssetName||""),Dt(xe.filterSerialNumber||""),Mt(xe.filterSerialNumber||""),d(xe.searchTerm||"")},la=re=>{const xe=oe.filter(ke=>ke.id!==re);we(xe),localStorage.setItem("assetFilterPresets",JSON.stringify(xe))};j.useEffect(()=>()=>{Ft.current&&clearTimeout(Ft.current),je.current&&clearTimeout(je.current)},[]);const va=re=>re?new Date(re).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-";j.useEffect(()=>{const re=xe=>{x.current&&!x.current.contains(xe.target)&&g(null)};return p&&document.addEventListener("mousedown",re),()=>{document.removeEventListener("mousedown",re)}},[p]);const ar=re=>{S(xe=>{const ke=new Set(xe);return ke.has(re)?ke.delete(re):ke.add(re),ke})},tn=()=>{N.size===vt.length?S(new Set):S(new Set(vt.map(re=>re.name)))},Bn=vt.length>0&&N.size===vt.length,Gr=N.size>0&&N.size<vt.length,Zs=j.useCallback(()=>le(null,null,function*(){const re=[];let xe=0;const ke=100;let Ce=!0;for(;Ce;)try{const dt=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset",filters:ne(ne({},it),B),fields:["*"],limit_start:xe*ke,limit_page_length:ke,order_by:"creation desc"})})).json()).message||[];re.push(...dt),dt.length<ke?Ce=!1:xe++,xe>100&&(console.warn("Export safety limit reached"),Ce=!1)}catch(Qe){throw console.error("Error fetching assets for export:",Qe),Qe}return re}),[it,B]),Ss=(re,xe,ke)=>le(null,null,function*(){P(!0);try{let Ce=[];switch(re){case"selected":Ce=vt.filter(lt=>N.has(lt.name));break;case"all_on_page":Ce=vt;break;case"all_with_filters":Ce=yield Zs();break}if(Ce.length===0){alert("No data to export");return}const Qe=ke.map(lt=>{const dt=v.find(nt=>nt.key===lt);return(dt==null?void 0:dt.label)||lt});if(xe==="csv"){const lt=[Qe.join(","),...Ce.map(St=>ke.map(ya=>{let ta=St[ya]||"";return typeof ta=="string"&&(ta.includes(",")||ta.includes('"')||ta.includes(`
`))&&(ta=`"${ta.replace(/"/g,'""')}"`),ta}).join(","))].join(`
`),dt=new Blob(["\uFEFF"+lt],{type:"text/csv;charset=utf-8;"}),nt=URL.createObjectURL(dt),mt=document.createElement("a");mt.href=nt,mt.download=`assets_export_${new Date().toISOString().split("T")[0]}.csv`,mt.click(),URL.revokeObjectURL(nt)}else if(xe==="excel"){const lt=[Qe,...Ce.map(mt=>ke.map(St=>mt[St]||""))],dt=jr.aoa_to_sheet(lt),nt=jr.book_new();jr.book_append_sheet(nt,dt,"Assets"),Ic(nt,`assets_export_${new Date().toISOString().split("T")[0]}.xlsx`)}C(!1),S(new Set)}catch(Ce){console.error("Export failed:",Ce),alert(`Export failed: ${Ce instanceof Error?Ce.message:"Unknown error"}`)}finally{P(!1)}}),an=()=>t("/assets/new"),_n=re=>t(`/assets/${re}`),rr=re=>t(`/assets/${re}`),Et=re=>t(`/assets/new?duplicate=${re}`),W=re=>{const xe=new URLSearchParams;re.name&&xe.append("asset",re.name),re.asset_name&&xe.append("asset_name",re.asset_name),re.custom_asset_type&&xe.append("asset_type",re.custom_asset_type),re.custom_manufacturer&&xe.append("manufacturer",re.custom_manufacturer),re.custom_serial_number&&xe.append("serial_number",re.custom_serial_number),re.department&&xe.append("department",re.department),re.custom_site_contractor&&xe.append("site_contractor",re.custom_site_contractor),re.custom_subcontractor&&xe.append("subcontractor",re.custom_subcontractor),re.company&&xe.append("company",re.company),re.custom_service_agreement&&xe.append("custom_service_agreement",re.custom_service_agreement),re.custom_service_coverage&&xe.append("custom_service_coverage",re.custom_service_coverage),re.custom_site&&xe.append("site_name",re.custom_site),t(`/work-orders/new?${xe.toString()}`)},ce=re=>{t(`/work-orders?asset=${encodeURIComponent(re)}`)},I=re=>le(null,null,function*(){try{yield Rt(re),f(null),Nt(),alert("Asset deleted successfully!")}catch(xe){alert(`Failed to delete asset: ${xe instanceof Error?xe.message:"Unknown error"}`)}}),Y=re=>{const xe=JSON.stringify(re,null,2),ke=new Blob([xe],{type:"application/json"}),Ce=URL.createObjectURL(ke),Qe=document.createElement("a");Qe.href=Ce,Qe.download=`asset_${re.name}.json`,Qe.click(),URL.revokeObjectURL(Ce)},te=re=>{window.open(`/assets/${re}?print=true`,"_blank")},se=()=>{he(""),me(""),q(""),fe(""),F(""),H(""),K(""),Le(""),We(""),tt(""),Dt(""),ht(""),Mt(""),d(""),Ft.current&&clearTimeout(Ft.current),je.current&&clearTimeout(je.current)},Ee=ie||ve||ee||Q||ae||D||Z||ue||Ne||Fe||ft||i;return V&&!k?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):z?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),a.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"Unable to load user permissions."})}),a.jsx("p",{children:z}),a.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"})]})]})}):ct&&!k?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})}):ut?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Asset API Not Available"}),a.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"The Asset API endpoint is not deployed yet."})}),a.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)"}),a.jsx("button",{onClick:Nt,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("assets.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",Bt," asset",Bt!==1?"s":"",N.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",N.size," selected"]}),ct&&k&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[a.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.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:Bt===0,children:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),N.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:N.size})]}),J&&a.jsxs("button",{onClick:an,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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:e("assets.addAsset")})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsx("button",{onClick:()=>At(!Ve),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:Ve?a.jsx(m0,{size:14}):a.jsx(Ec,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ws,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),jt>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:jt})]}),Ee&&a.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[ie&&a.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:[a.jsx("span",{className:"font-semibold",children:"Asset ID:"})," ",ie,a.jsx("button",{onClick:re=>{re.stopPropagation(),he("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ve&&a.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:[a.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",ve,a.jsx("button",{onClick:re=>{re.stopPropagation(),me("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ee&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-emerald-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[a.jsx("span",{className:"font-semibold",children:"Site:"})," ",ee,a.jsx("button",{onClick:re=>{re.stopPropagation(),q("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Fe&&a.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:[a.jsx("span",{className:"font-semibold",children:"Name:"})," ",Fe,a.jsx("button",{onClick:re=>{re.stopPropagation(),tt(""),ht("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ft&&a.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:[a.jsx("span",{className:"font-semibold",children:"Serial:"})," ",ft,a.jsx("button",{onClick:re=>{re.stopPropagation(),Dt(""),Mt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Ne&&a.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:[a.jsx("span",{className:"font-semibold",children:"Status:"})," ",Ne,a.jsx("button",{onClick:re=>{re.stopPropagation(),We("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),D&&a.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:[a.jsx("span",{className:"font-semibold",children:"Location:"})," ",D,a.jsx("button",{onClick:re=>{re.stopPropagation(),H("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Z&&a.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:[a.jsx("span",{className:"font-semibold",children:"Dept:"})," ",Z,a.jsx("button",{onClick:re=>{re.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ue&&a.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:[a.jsx("span",{className:"font-semibold",children:"Modality:"})," ",ue,a.jsx("button",{onClick:re=>{re.stopPropagation(),Le("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Q&&a.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:[a.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",Q,a.jsx("button",{onClick:re=>{re.stopPropagation(),fe("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ae&&a.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:[a.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",ae,a.jsx("button",{onClick:re=>{re.stopPropagation(),F("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[jt>0&&a.jsxs("button",{onClick:()=>ot(!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:[a.jsx(gr,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Ee&&a.jsxs("button",{onClick:se,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:[a.jsx(xt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),Ve&&a.jsxs("div",{className:"p-4",children:[oe.length>0&&a.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[a.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:oe.map(re=>a.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:[a.jsx("button",{onClick:()=>Ut(re),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:re.name}),a.jsx("button",{onClick:()=>la(re.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(ma,{size:10})})]},re.id))})]}),a.jsx("div",{className:"space-y-5",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Asset ID",doctype:"Asset",value:ie,onChange:re=>he(re),placeholder:"Select Asset ID",disabled:!1,compact:!0}),ie&&a.jsx("button",{onClick:()=>he(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Asset Name"}),a.jsx("input",{type:"text",value:Ue,onChange:re=>et(re.target.value),onKeyDown:re=>ze(re,"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"}),Ue&&Ue!==Fe&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),Fe&&a.jsx("button",{onClick:()=>{tt(""),ht("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),a.jsx("input",{type:"text",value:wt,onChange:re=>pe(re.target.value),onKeyDown:re=>ze(re,"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"}),wt&&wt!==ft&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),ft&&a.jsx("button",{onClick:()=>{Dt(""),Mt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:ve,onChange:re=>me(re),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),ve&&a.jsx("button",{onClick:()=>me(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(_t,{label:"PHCC Site",doctype:"Mobile Team Site",value:ee,onChange:re=>q(re),placeholder:"Select Site",disabled:!1,compact:!0}),ee&&a.jsx("button",{onClick:()=>q(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Device Status"}),a.jsxs("select",{value:Ne,onChange:re=>We(re.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:[a.jsx("option",{value:"",children:"All Status"}),a.jsx("option",{value:"Up",children:"✓ Up"}),a.jsx("option",{value:"Down",children:"⚠ Down"})]}),Ne&&a.jsx("button",{onClick:()=>We(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[57]",children:[a.jsx(_t,{label:"Location",doctype:"Location",value:D,onChange:re=>H(re),placeholder:"Select Location",disabled:!1,compact:!0}),D&&a.jsx("button",{onClick:()=>H(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[56]",children:[a.jsx(_t,{label:"Department",doctype:"Department",value:Z,onChange:re=>K(re),placeholder:"Select Department",disabled:!1,compact:!0}),Z&&a.jsx("button",{onClick:()=>K(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(_t,{label:"Modality",doctype:"Modality",value:ue,onChange:re=>Le(re),placeholder:"Select Modality",disabled:!1,compact:!0}),ue&&a.jsx("button",{onClick:()=>Le(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[54]",children:[a.jsx(_t,{label:"Manufacturer",doctype:"Manufacturer",value:Q,onChange:re=>fe(re),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),Q&&a.jsx("button",{onClick:()=>fe(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[53]",children:[a.jsx(_t,{label:"Supplier",doctype:"Supplier",value:ae,onChange:re=>F(re),placeholder:"Select Supplier",disabled:!1,compact:!0}),ae&&a.jsx("button",{onClick:()=>F(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]})]})})})]})]}),Ie&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),a.jsx("input",{type:"text",value:bt,onChange:re=>qe(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),st())},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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:()=>{ot(!1),qe("")},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"}),a.jsxs("button",{onClick:st,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:[a.jsx(gr,{size:12}),"Save Filter"]})]})]})}),a.jsx(hO,{isOpen:A,onClose:()=>C(!1),selectedCount:N.size,totalCount:Bt,pageCount:vt.length,onExport:Ss,isExporting:O,exportColumns:v}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[ct&&k&&a.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:a.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[a.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.jsx("button",{onClick:tn,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Bn?"Deselect all":"Select all",children:Bn?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):Gr?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:vt.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Ws,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No assets found"}),Ee?a.jsx("button",{onClick:se,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):J?a.jsx("button",{onClick:an,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]})})}):vt.map(re=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${N.has(re.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>_n(re.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:xe=>xe.stopPropagation(),children:a.jsx("button",{onClick:()=>ar(re.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:N.has(re.name)?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:re.asset_name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:re.name})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:re.custom_serial_number||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:re.company||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:re.location||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:re.custom_device_status||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:va(re.modified)}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:xe=>xe.stopPropagation(),children:[a.jsx("button",{onClick:()=>_n(re.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:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>rr(re.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:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>Et(re.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:a.jsx(Cc,{})}),a.jsx("button",{onClick:()=>W(re),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:a.jsx(H1,{})}),a.jsx("button",{onClick:()=>ce(re.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:a.jsx(B1,{})}),a.jsx("button",{onClick:()=>f(re.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:ia,children:a.jsx(ma,{})}),a.jsxs("div",{className:"relative",ref:p===re.name?x:null,children:[a.jsx("button",{onClick:()=>g(p===re.name?null:re.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:a.jsx(g0,{})}),p===re.name&&a.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:[a.jsxs("button",{onClick:()=>{W(re),g(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:[a.jsx(H1,{className:"text-orange-500"}),"Create Work Order"]}),a.jsxs("button",{onClick:()=>{ce(re.name),g(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:[a.jsx(B1,{className:"text-cyan-500"}),"View Linked WOs"]}),a.jsxs("button",{onClick:()=>{Y(re),g(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:[a.jsx(wi,{className:"text-blue-500"}),"Export as JSON"]}),a.jsxs("button",{onClick:()=>{te(re.name),g(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:[a.jsx(so,{className:"text-purple-500"}),"Print Asset"]})]})]})]})})]},re.name))})]})}),vt.length>0&&a.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:[a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a.jsx("span",{className:"font-medium",children:r*y+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((r+1)*y,Bt)})," ","of ",a.jsx("span",{className:"font-medium",children:Bt})," results",U&&a.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{disabled:r===0,onClick:()=>s(r-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"}),a.jsx("button",{disabled:!De,onClick:()=>s(r+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&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Asset"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Asset ID:"})," ",c]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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:ia,children:"Cancel"}),a.jsx("button",{onClick:()=>I(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:ia,children:ia?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ma,{}),"Delete Asset"]})})]})]})]})})}),a.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;
}
`})]})},gO=e=>{const[t,r]=j.useState([]),[s,i]=j.useState(new Set),[d,c]=j.useState(!0),[f,p]=j.useState(null);return j.useEffect(()=>{le(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)}),r(k),i(T),p(null)}catch(y){console.error(`[DocTypeMeta] Error fetching DocType meta for ${e}:`,y),p(y instanceof Error?y.message:"Unknown error"),r([]),i(new Set)}finally{c(!1)}})},[e]),{fields:t,allowOnSubmitFields:s,isAllowedOnSubmit:x=>s.has(x),loading:d,error:f}};function Rg(e,t){if(!e||(e=e.trim(),!e))return!1;if(!e.startsWith("eval:"))return!!t[e];const r=e.substring(5).trim();try{return new Function("doc",`
try {
return Boolean(${r});
} catch (e) {
console.warn('Expression evaluation error:', e);
return false;
}
`)(t)}catch(s){return console.warn(`Failed to evaluate expression: ${e}`,s),!1}}function pO(e){if(!e)return null;const t=e.split(".");return t.length!==2?null:{linkField:t[0],targetField:t[1]}}const Fg={};function Yw(e,t){const[r,s]=j.useState([]),[i,d]=j.useState(!0),[c,f]=j.useState(null);j.useEffect(()=>{if(!e){d(!1);return}if(Fg[e]){s(Fg[e]),d(!1);return}le(null,null,function*(){var C;d(!0);try{const O=yield rt.apiCall(`/api/method/frappe.client.get_doc?doctype=DocType&name=${encodeURIComponent(e)}`,{credentials:"include"});if((C=O==null?void 0:O.message)!=null&&C.fields){const P=O.message.fields.map(B=>({fieldname:B.fieldname,label:B.label,fieldtype:B.fieldtype,options:B.options,reqd:B.reqd,hidden:B.hidden,read_only:B.read_only,depends_on:B.depends_on,mandatory_depends_on:B.mandatory_depends_on,read_only_depends_on:B.read_only_depends_on,fetch_from:B.fetch_from,fetch_if_empty:B.fetch_if_empty,default:B.default,description:B.description,in_list_view:B.in_list_view,permlevel:B.permlevel,allow_on_submit:B.allow_on_submit}));Fg[e]=P,s(P)}}catch(O){console.warn(`Could not fetch DocType meta for ${e}:`,O.message),f(O.message)}finally{d(!1)}})},[e]);const p=j.useMemo(()=>{const A={};return r.forEach(C=>{A[C.fieldname]=C}),A},[r]),g=j.useCallback(A=>{const C=p[A];if(!C)return{isVisible:!0,isReadOnly:!1,isMandatory:!1};let O=!(C.hidden===1||C.hidden===!0);C.depends_on&&O&&(O=Rg(C.depends_on,t));let P=C.read_only===1||C.read_only===!0;C.read_only_depends_on&&(P=P||Rg(C.read_only_depends_on,t));let B=C.reqd===1||C.reqd===!0;return C.mandatory_depends_on&&(B=B||Rg(C.mandatory_depends_on,t)),{isVisible:O,isReadOnly:P,isMandatory:B}},[p,t]),x=j.useCallback(A=>g(A).isVisible,[g]),y=j.useCallback(A=>{const C=g(A);return C.isVisible&&C.isMandatory},[g]),v=j.useCallback(A=>g(A).isReadOnly,[g]),k=j.useCallback(A=>{const C=p[A];return(C==null?void 0:C.label)||A},[p]),T=j.useCallback(A=>{const C=p[A];return C!=null&&C.options?C.fieldtype==="Select"?C.options.split(`
`).filter(O=>O.trim()!==""):[]:[]},[p]),N=j.useCallback((A,C)=>{const O=p[A];if(!(O!=null&&O.fetch_from)||!C)return;const P=pO(O.fetch_from);if(P)return C[P.targetField]},[p]),S=j.useCallback(()=>{const A={};return r.forEach(C=>{const O=g(C.fieldname);if(O.isVisible&&O.isMandatory){const P=t[C.fieldname];(P==null||P==="")&&(A[C.fieldname]=`${C.label||C.fieldname} is required`)}}),{valid:Object.keys(A).length===0,errors:A}},[r,t,g]);return{loading:i,error:c,fields:r,getFieldState:g,shouldShowField:x,isMandatory:y,isReadOnly:v,getFieldLabel:k,getFieldOptions:T,getFetchFromValue:N,validateMandatory:S}}const xO=()=>{var He;const{assetName:e}=fl(),t=xa(),[r]=hl(),s=r.get("duplicate"),i=e==="new",d=i&&!!s,{isAllowedOnSubmit:c}=gO("Asset"),[f,p]=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,custom_moh_supervisor:"",custom_team_leader:"",is_existing_asset:!0,__islocal:!1}),{shouldShowField:g,isMandatory:x,isReadOnly:y}=Yw("Asset",f),{asset:v,loading:k,error:T,refetch:N}=mS(d?s:i?null:e||null),{createAsset:S,updateAsset:A,submitAsset:C,loading:O}=P_(),[P,B]=j.useState(i),V=(He=v==null?void 0:v.docstatus)!=null?He:0,z=V===1,U=V===2,J=V===0,[de,ye]=j.useState(!1),ie=j.useRef(null);j.useEffect(()=>{const oe=we=>{ie.current&&!ie.current.contains(we.target)&&ye(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]),j.useEffect(()=>{},[v,V,J,z,U,P]);const he=j.useCallback(oe=>!P||U||y(oe)?!0:z?!c(oe):!J,[P,U,z,J,c,y]),ve=j.useCallback(oe=>g(oe),[g]);j.useCallback(oe=>x(oe),[x]);const[me,ee]=j.useState(""),[q,Q]=j.useState({});j.useEffect(()=>{i&&!f.available_for_use_date&&p(oe=>Se(ne({},oe),{available_for_use_date:new Date().toISOString().split("T")[0],__islocal:!0}))},[i]),j.useEffect(()=>{function oe(){return le(this,null,function*(){try{const we=yield rt.getUserDetails();ee(we.custom_site_name||""),p(Ie=>{const ot={};return(i||!Ie.company)&&we.custom_site_name&&(ot.company=we.custom_site_name,ot.asset_owner_company=we.custom_site_name),!Ie.custom_site&&we.custom_phcc_site_name&&(ot.custom_site=we.custom_phcc_site_name),ne(ne({},Ie),ot)})}catch(we){console.error("Error loading user details",we)}})}oe()},[i]);const fe=()=>{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]};p(Ie=>Se(ne({},Ie),{finance_books:[...Ie.finance_books||[],we]}))},ae=oe=>{p(we=>{const Ie=[...we.finance_books||[]];return Ie.splice(oe,1),Se(ne({},we),{finance_books:Ie})})},F=(oe,we)=>{p(Ie=>{const ot=[...Ie.finance_books||[]];return ot[oe]=ne(ne({},ot[oe]||{}),we),Se(ne({},Ie),{finance_books:ot})})};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]};p(Ie=>Se(ne({},Ie),{finance_books:[we]}))}},[f.calculate_depreciation]);const D=(oe,we,Ie)=>{p(ot=>{const bt=[...ot.custom_spare_parts||[]],qe=ne({},bt[oe]);we==="qty"||we==="rate"?(qe[we]=Ie,qe.amount=(qe.qty||0)*(qe.rate||0)):qe[we]=Ie,bt[oe]=qe;const Ue=bt.reduce((ht,wt)=>ht+(wt.amount||0),0);return Se(ne({},ot),{custom_spare_parts:bt,custom_total_spare_parts_amount:Ue})})},H=()=>{p(oe=>Se(ne({},oe),{custom_spare_parts:[...oe.custom_spare_parts||[],{qty:0,rate:0,amount:0}]}))},Z=oe=>{p(we=>{const Ie=[...we.custom_spare_parts||[]];Ie.splice(oe,1);const ot=Ie.reduce((bt,qe)=>bt+(qe.amount||0),0);return Se(ne({},we),{custom_spare_parts:Ie,custom_total_spare_parts_amount:ot})})};j.useEffect(()=>{if(f.available_for_use_date){const oe=new Date(f.available_for_use_date),Ie=new Date().getTime()-oe.getTime(),bt=Math.floor(Ie/(1e3*60*60*24))*24,qe=bt-(f.custom_down_time||0);p(Ue=>Se(ne({},Ue),{custom_total_hours:bt,custom_up_time:qe}))}},[f.available_for_use_date,f.custom_down_time]);const K=j.useRef("");j.useEffect(()=>{if(!P){K.current=f.custom_asset_type||"";return}const oe=(f.custom_asset_type||"").toString().trim().toLowerCase(),we=(K.current||"").toString().trim().toLowerCase();oe!==we&&(K.current=f.custom_asset_type||"",oe==="biomedical"?f.custom_site_contractor!=="SAMAMA"&&p(Ie=>Se(ne({},Ie),{custom_site_contractor:"SAMAMA"})):we==="biomedical"&&f.custom_site_contractor==="SAMAMA"&&p(Ie=>Se(ne({},Ie),{custom_site_contractor:""})))},[f.custom_asset_type,P]),j.useEffect(()=>{const oe={};f.company&&(oe.company=f.company);const we=me&&me.startsWith("Mobile")||f.company&&f.company.startsWith("Mobile");(me||f.company)&&(we?oe.department_name=["not like","Non Bio%"]:oe.department_name=["not like","Non Bio%"]),Q(oe)},[f.company,me]),j.useEffect(()=>{v&&(K.current=v.custom_asset_type||"",p({asset_name:d?`${v.asset_name} (Copy)`:v.asset_name||"",company:v.company||"",custom_serial_number:d?"":v.custom_serial_number||"",location:v.location||"",custom_manufacturer:v.custom_manufacturer||"",department:v.department||"",custom_moh_supervisor:v.custom_moh_supervisor||"",custom_team_leader:v.custom_team_leader||"",custom_asset_type:v.custom_asset_type||"",custom_manufacturing_year:v.custom_manufacturing_year||"",custom_model:v.custom_model||"",custom_class:v.custom_class||"",custom_device_status:v.custom_device_status||"",custom_down_time:v.custom_down_time||0,asset_owner_company:v.asset_owner_company||"",custom_up_time:v.custom_up_time||0,custom_total_hours:v.custom_total_hours||0,custom_modality:v.custom_modality||"",custom_attach_image:v.custom_attach_image||"",custom_site_contractor:v.custom_site_contractor||"",custom_site:v.custom_site||"",custom_total_amount:v.custom_total_amount||0,gross_purchase_amount:v.gross_purchase_amount||0,available_for_use_date:v.available_for_use_date||"",calculate_depreciation:v.calculate_depreciation||!1,finance_books:v.finance_books||[],custom_service_agreement:v.custom_service_agreement||"",custom_service_coverage:v.custom_service_coverage||"",custom_start_date:v.custom_start_date?v.custom_start_date.split(" ")[0]:"",custom_end_date:v.custom_end_date?v.custom_end_date.split(" ")[0]:"",custom_warranty:v.custom_warranty||!1,custom_extended_warranty:v.custom_extended_warranty||!1,custom__service_contract:v.custom__service_contract||!1,custom_covering_spare_parts:v.custom_covering_spare_parts||!1,custom_spare_parts_labour:v.custom_spare_parts_labour||!1,custom_covering_labour:v.custom_covering_labour||!1,custom_ppm_only:v.custom_ppm_only||!1,custom_support_plan:v.custom_support_plan||"",custom_spare_parts:v.custom_spare_parts||[],custom_total_spare_parts_amount:v.custom_total_spare_parts_amount||0}))},[v,d]);const[ue,Le]=j.useState(null);j.useEffect(()=>{if(!e||e==="new")return;le(null,null,function*(){var we;try{const Ie=`/files/${e}-qr.png`;if((yield fetch(Ie,{method:"HEAD"})).ok){Le(Ie);return}const bt=yield rt.apiCall(`/api/resource/File?filters=[["File","attached_to_name","=","${e}"]]`);((we=bt==null?void 0:bt.data)==null?void 0:we.length)>0&&Le(bt.data[0].file_url)}catch(Ie){console.error("Error loading QR code:",Ie)}})},[e,v]);const Ne=oe=>{const{name:we,value:Ie}=oe.target;p(ot=>Se(ne({},ot),{[we]:Ie}))},We=oe=>le(null,null,function*(){if(oe.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 ot=`/files/${we.name}-qr.png`;Le(ot)}alert(d?"Asset duplicated successfully!":"Asset created successfully!"),t(`/assets/${we.name}`)}else e&&(yield A(e,f),alert("Asset updated successfully!"),B(!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)}}),Fe=()=>le(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(),B(!1)}catch(oe){console.error("Asset submit error:",oe);const we=oe instanceof Error?oe.message:"Unknown error";alert(`Failed to submit asset:
`+we)}});if(k)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading asset details..."})]})});if(T&&!i&&!d)return a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",T]}),a.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 a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-yellow-800 dark:text-yellow-300 mb-2",children:"Source Asset Not Found"}),a.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:"The asset you're trying to duplicate could not be found."}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.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"}),a.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 tt=()=>{if(!ue||!v)return;const oe=window.open("","_blank");oe&&(oe.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>Print QR Code - ${v.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> ${v.name}<br/>
<strong>Asset Name:</strong> ${v.asset_name||"N/A"}
</div>
<img src="${ue}" alt="QR Code" class="qr-image" onload="window.print();" />
</div>
</body>
</html>
`),oe.document.close())},ft=()=>{const oe=window.open("","_blank");oe&&(oe.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>
`),oe.document.close())},Dt=()=>le(null,null,function*(){if(!e||i){alert("Please save the asset first to view PPM Plan");return}try{const oe=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=(oe==null?void 0:oe.data)||[],Ie=(je,it)=>{const vt=new Date(je);return vt.setDate(vt.getDate()+it),vt},ot=(je,it)=>{const vt=new Date(je);return vt.setMonth(vt.getMonth()+it),vt},bt=(je,it)=>{const vt=new Date(je);return vt.setFullYear(vt.getFullYear()+it),vt},qe=(je,it)=>{switch(it){case"Daily":return Ie(je,1);case"Weekly":return Ie(je,7);case"Monthly":return ot(je,1);case"Quarterly":return ot(je,3);case"Half-yearly":return ot(je,6);case"Yearly":return bt(je,1);case"2 Yearly":return bt(je,2);case"3 Yearly":return bt(je,3);default:return ot(je,1)}},Ue=je=>je.toISOString().split("T")[0],ht=bt(new Date,5),wt=[];for(const je of we){let it=new Date(je.due_date);const vt=je.periodicity||"Monthly";for(let Bt=0;Bt<60&&(wt.push({asset_name:je.asset_name||"",custom_asset_names:je.custom_asset_names||"",serial_number:f.custom_serial_number||"N/A",due_date:Ue(it),periodicity:vt,maintenance_type:je.maintenance_type||"",assign_to_name:je.assign_to_name||"",status:"Planned"}),it=qe(it,vt),!(it>ht));Bt++);}wt.sort((je,it)=>new Date(je.due_date).getTime()-new Date(it.due_date).getTime());const Mt=window.open("","_blank");if(!Mt)return;const Ft=wt.length>0?wt.map((je,it)=>`
<tr class="${it%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>';Mt.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>
${Ft}
</tbody>
</table>
</div>
<div class="summary">
<strong>Summary:</strong> ${wt.length} planned maintenance entries for the next 5 years
</div>
</div>
</body>
</html>
`),Mt.document.close()}catch(oe){console.error("Error fetching PPM Plan:",oe),alert("Failed to load PPM Plan. Please try again.")}}),Ve=()=>le(null,null,function*(){if(!e||i){alert("Please save the asset first to view Asset History");return}try{const oe=yield rt.apiCall(`/api/resource/Asset/${e}`),we=(oe==null?void 0:oe.data)||{},Ie=yield rt.apiCall(`/api/resource/Work_Order?filters=[["asset","=","${e}"]]&fields=["name","work_order_type","repair_status","creation","total_repair_cost"]`),ot=(Ie==null?void 0:Ie.data)||[],bt=yield rt.apiCall(`/api/resource/Asset Maintenance?filters=[["asset_name","=","${e}"]]&fields=["name","maintenance_team","custom_type_of_maintenance"]`),qe=(bt==null?void 0:bt.data)||[];let Ue=[],ht=[];for(const et of qe){const pe=yield rt.apiCall(`/api/resource/Asset Maintenance/${et.name}`),ze=(pe==null?void 0:pe.data)||{};ze.asset_maintenance_tasks&&(ht=[...ht,...ze.asset_maintenance_tasks.map(Ut=>Se(ne({},Ut),{maintenance_id:et.name}))]);const st=yield rt.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_maintenance","=","${et.name}"]]&fields=["name","maintenance_status","assign_to_name","maintenance_type","due_date","completion_date","periodicity","actions_performed"]&order_by=completion_date desc`);Ue=[...Ue,...(st==null?void 0:st.data)||[]]}const wt=Ue.filter(et=>et.maintenance_status==="Completed"),Mt=Ue.filter(et=>et.maintenance_status!=="Completed"),Ft={};Ue.forEach(et=>{Ft[et.maintenance_status]=(Ft[et.maintenance_status]||0)+1});const je=we.custom_spare_parts||[],it={};je.forEach(et=>{const pe=et.work_order||"Unassigned";it[pe]||(it[pe]=[]),it[pe].push(et)});const vt=window.open("","_blank");if(!vt)return;const Bt=ot.length>0?ot.map((et,pe)=>{const ze=et.repair_status==="Completed"?"bg-green-100 text-green-800":et.repair_status==="Work In Progress"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800";return`
<tr class="${pe%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3 font-medium text-blue-600">${et.name}</td>
<td class="px-4 py-3">${et.work_order_type||"-"}</td>
<td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs font-medium ${ze}">${et.repair_status||"-"}</span></td>
<td class="px-4 py-3 font-semibold">${parseFloat(et.total_repair_cost||0).toFixed(2)} ر.س</td>
<td class="px-4 py-3 text-gray-500">${et.creation?new Date(et.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 De="";Object.keys(it).length>0?Object.keys(it).forEach(et=>{De+=`
<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">${et}</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>
${it[et].map((pe,ze)=>`
<tr class="${ze%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-2">${pe.item_code||"-"}</td>
<td class="px-4 py-2">${pe.qty||0}</td>
<td class="px-4 py-2">${pe.rate||0} ر.س</td>
<td class="px-4 py-2 font-medium">${pe.amount||0} ر.س</td>
</tr>
`).join("")}
</tbody>
</table>
</div>
`}):De='<p class="text-gray-500 text-center py-8">No Spare Parts Used</p>';const ct=qe.length>0?qe.map(et=>`
<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">${et.name}</p>
</div>
<div class="text-right">
<p class="text-sm text-gray-500">Type</p>
<p class="font-medium">${et.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">${et.maintenance_team||"-"}</p>
</div>
</div>
`).join(""):'<p class="text-gray-500 text-center py-8">No Maintenance Records Found</p>',ut=ht.length>0?ht.map((et,pe)=>`
<tr class="${pe%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3">${et.assign_to_name||"-"}</td>
<td class="px-4 py-3">${et.periodicity||"-"}</td>
<td class="px-4 py-3">${et.next_due_date||"-"}</td>
<td class="px-4 py-3 text-blue-600 text-sm">${et.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>',Nt=Object.keys(Ft).length>0?Object.entries(Ft).map(([et,pe])=>`
<div class="flex items-center justify-between p-3 rounded-lg border ${et==="Completed"?"bg-green-100 text-green-800 border-green-200":et==="Planned"?"bg-blue-100 text-blue-800 border-blue-200":"bg-yellow-100 text-yellow-800 border-yellow-200"}">
<span class="font-medium">${et}</span>
<span class="text-2xl font-bold">${pe}</span>
</div>
`).join(""):'<p class="text-gray-500 text-center">No Data</p>',Rt=wt.length>0?wt.map((et,pe)=>`
<tr class="${pe%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${et.name}</td>
<td class="px-3 py-2">${et.assign_to_name||"-"}</td>
<td class="px-3 py-2">${et.maintenance_type||"-"}</td>
<td class="px-3 py-2">${et.due_date||"-"}</td>
<td class="px-3 py-2 text-green-600 font-medium">${et.completion_date||"-"}</td>
<td class="px-3 py-2">${et.periodicity||"-"}</td>
<td class="px-3 py-2 text-sm text-gray-600">${et.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>',ia=Mt.length>0?Mt.map((et,pe)=>{const ze=et.maintenance_status==="Planned"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800";return`
<tr class="${pe%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${et.name}</td>
<td class="px-3 py-2">${et.assign_to_name||"-"}</td>
<td class="px-3 py-2">${et.maintenance_type||"-"}</td>
<td class="px-3 py-2">${et.due_date||"-"}</td>
<td class="px-3 py-2">${et.periodicity||"-"}</td>
<td class="px-3 py-2"><span class="px-2 py-1 rounded-full text-xs font-medium ${ze}">${et.maintenance_status||"-"}</span></td>
<td class="px-3 py-2 text-sm text-gray-600">${et.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>';vt.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>
${Bt}
</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">
${De}
</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">
${ct}
</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>
${ut}
</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">
${Nt}
</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>
${Rt}
</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>
${ia}
</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>
`),vt.document.close()}catch(oe){console.error("Error fetching Asset History:",oe),alert("Failed to load Asset History. Please try again.")}}),At=()=>{if(!e||i){alert("Please save the asset first to view Installation Report");return}const oe=window.open("","_blank");if(!oe)return;const we=new Date,Ie=Ue=>{const ht=String(Ue.getDate()).padStart(2,"0"),wt=String(Ue.getMonth()+1).padStart(2,"0"),Mt=Ue.getFullYear();return`${ht}/${wt}/${Mt}`},ot=(v==null?void 0:v.custom_spare_parts)||[];let bt="";const qe=3;if(ot.length>0){ot.forEach((Ue,ht)=>{bt+=`
<tr>
<td>${ht+1}</td>
<td>${Ue.item_name||""}</td>
<td>${Ue.item_code||""}</td>
<td>${Ue.uom||""}</td>
<td>${Ue.qty||""}</td>
</tr>
`});for(let Ue=ot.length;Ue<qe;Ue++)bt+=`
<tr>
<td>${Ue+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`}else for(let Ue=0;Ue<qe;Ue++)bt+=`
<tr>
<td>${Ue+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`;oe.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>
${bt}
</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">المسئول في القسم &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">مدير شركة سمامة &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">مهندس/ فني التركيب &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">مشرف الوزارة بالمستشفى &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">مدير المستشفى/ المركز &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>
`),oe.document.close()},jt=()=>{if(!e||i){alert("Please save the asset first to view Dismantling Report");return}const oe=window.open("","_blank");if(!oe)return;const we=new Date,Ie=qe=>{const Ue=String(qe.getDate()).padStart(2,"0"),ht=String(qe.getMonth()+1).padStart(2,"0"),wt=qe.getFullYear();return`${Ue}/${ht}/${wt}`},ot=v!=null&&v.creation?new Date(v.creation):null;let bt="";if(ot){const qe=Math.floor((we.getTime()-ot.getTime())/31536e6),Ue=Math.floor((we.getTime()-ot.getTime())%(1e3*60*60*24*365)/(1e3*60*60*24*30));bt=`${qe} سنة و ${Ue} شهر`}oe.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>${ot?Ie(ot):""}</td>
</tr>
<tr>
<td>الطراز/الموديل</td>
<td>${f.custom_model||""}</td>
<td>مدة استخدام الجهاز</td>
<td>${bt}</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>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</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>
`),oe.document.close()};return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.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:[a.jsx(Ns,{}),a.jsx("span",{className:"text-gray-900 dark:text-white font-medium",children:d?"Duplicate Asset":i?"New Asset Details":"Asset Details"})]}),v&&a.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${V===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300":V===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:V===0?"Draft":V===1?"Submitted":"Cancelled"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!i&&!P&&!U&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:ie,children:[a.jsxs("button",{onClick:()=>ye(!de),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:["Actions",a.jsx(Ec,{size:12,className:`transition-transform ${de?"rotate-180":""}`})]}),de&&a.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:a.jsxs("div",{className:"py-1",children:[ue&&a.jsxs("button",{onClick:()=>{tt(),ye(!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:[a.jsx(Ju,{size:14}),"Print QR"]}),a.jsxs("button",{onClick:()=>{ft(),ye(!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:[a.jsx(Ju,{size:14}),"Stay Plugged"]}),a.jsxs("button",{onClick:()=>{Dt(),ye(!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:[a.jsx(yi,{size:14}),"PPM Plan"]}),a.jsxs("button",{onClick:()=>{Ve(),ye(!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:[a.jsx(Zg,{size:14}),"Asset History"]}),a.jsxs("button",{onClick:()=>{At(),ye(!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:[a.jsx(CS,{size:14}),"Installation Report"]}),(v==null?void 0:v.status)==="Scrapped"&&a.jsxs("button",{onClick:()=>{jt(),ye(!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:[a.jsx(RS,{size:14}),"Dismantling Report"]})]})})]}),a.jsxs("button",{onClick:()=>B(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:[a.jsx(Rr,{}),"Edit"]}),J&&a.jsxs("button",{onClick:Fe,disabled:O,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:[a.jsx(z_,{}),O?"Submitting...":"Submit"]})]}),U&&a.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 italic",children:"Cancelled documents cannot be edited"}),P&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{i?t("/assets"):B(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 dark:text-gray-800 px-2 py-1 rounded-lg",disabled:O,children:"Cancel"}),a.jsxs("button",{onClick:We,disabled:O,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:[a.jsx(gr,{}),O?"Saving...":"Save Changes"]})]})]})]}),a.jsxs("form",{onSubmit:We,children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"asset_name",value:f.asset_name,onChange:Ne,placeholder:"e.g. Laptop Model X",required:!0,disabled:he("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"})]}),a.jsx(_t,{label:"Category",doctype:"Asset Type",value:f.custom_asset_type||"",onChange:oe=>p(Se(ne({},f),{custom_asset_type:oe})),disabled:he("custom_asset_type")}),a.jsx(_t,{label:"Modality",doctype:"Modality",value:f.custom_modality||"",onChange:oe=>p(Se(ne({},f),{custom_modality:oe})),disabled:he("custom_modality")}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Class"}),a.jsxs("select",{name:"custom_class",value:f.custom_class,onChange:Ne,disabled:he("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:[a.jsx("option",{value:"",children:"Select class"}),a.jsx("option",{value:"Class A",children:"Class A"}),a.jsx("option",{value:"Class B",children:"Class B"}),a.jsx("option",{value:"Class C",children:"Class C"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset ID"}),a.jsx("input",{type:"text",value:i||d?"Auto-generated":v==null?void 0:v.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&&a.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",s]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Device Status ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.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:[a.jsx("option",{value:"Up",children:"Up"}),a.jsx("option",{value:"Down",children:"Down"})]})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Code"}),a.jsx("input",{type:"text",name:"custom_serial_number",value:f.custom_serial_number,onChange:Ne,placeholder:"e.g. SN-12345",disabled:he("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"})]}),a.jsx(_t,{label:"Manufacturer",doctype:"Manufacturer",value:f.custom_manufacturer||"",onChange:oe=>p(Se(ne({},f),{custom_manufacturer:oe})),disabled:he("custom_manufacturer")}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),a.jsx("input",{type:"text",name:"custom_model",value:f.custom_model,onChange:Ne,placeholder:"Model number",disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours"}),a.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"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated from Available For Use Date"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Down Time (Hours)"}),a.jsx("input",{type:"number",name:"custom_down_time",value:f.custom_down_time||0,onChange:Ne,placeholder:"0",disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Up Time (Hours)"}),a.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"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated: Total Hours - Down Time"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:f.company||"",onChange:oe=>{p(Se(ne({},f),{company:oe,asset_owner_company:oe,department:""}))},disabled:he("company"),filters:{domain:"Healthcare"}}),ve("custom_site")&&a.jsx("div",{children:a.jsx(_t,{label:"Site name",doctype:"Mobile Team Site",value:f.custom_site||"",onChange:oe=>p(Se(ne({},f),{custom_site:oe})),disabled:he("custom_site"),placeholder:"Select Site"})}),a.jsx(_t,{label:"Department",doctype:"Department",value:f.department||"",onChange:oe=>p(Se(ne({},f),{department:oe})),disabled:he("department"),filters:q}),a.jsx(_t,{label:"Location",doctype:"Location",value:f.location||"",onChange:oe=>p(Se(ne({},f),{location:oe})),disabled:he("location")}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Building"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Room Number"}),a.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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-col items-center my-4",children:[a.jsx("div",{className:"border-2 border-gray-300 dark:border-gray-600 p-3 rounded-lg bg-white dark:bg-gray-700",children:ue?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:ue,alt:`QR Code for ${(v==null?void 0:v.name)||"Asset"}`,className:"w-[120px] h-[120px] object-contain",onError:oe=>{const we=oe.target;we.style.display="none";const Ie=we.nextElementSibling;Ie&&(Ie.style.display="flex")}}),a.jsx("div",{className:"w-[120px] h-[120px] hidden items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:a.jsx(Ju,{size:80,className:"text-gray-400 dark:text-gray-500"})})]}):a.jsx("div",{className:"w-[120px] h-[120px] flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:a.jsx(Ju,{size:80,className:"text-gray-400 dark:text-gray-500"})})}),(v==null?void 0:v.name)&&a.jsxs("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-center",children:["Asset ID: ",v.name]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),a.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"})]})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),a.jsx("input",{type:"text",name:"custom_site_contractor",value:f.custom_site_contractor,onChange:Ne,disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Contract Number"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),a.jsxs("select",{name:"custom_service_agreement",value:f.custom_service_agreement||"",onChange:Ne,disabled:he("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:[a.jsx("option",{value:"",children:"Select Service Agreement"}),a.jsx("option",{value:"Warranty",children:"Warranty"}),a.jsx("option",{value:"Contract",children:"Contract"}),a.jsx("option",{value:"Frame Work",children:"Frame Work"}),a.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),a.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),a.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),a.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),a.jsxs("select",{name:"custom_service_coverage",value:f.custom_service_coverage||"",onChange:Ne,disabled:he("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:[a.jsx("option",{value:"",children:"Select Service Coverage"}),a.jsx("option",{value:"PM Only",children:"PM Only"}),a.jsx("option",{value:"Labour",children:"Labour"}),a.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),a.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),a.jsx("input",{type:"date",name:"custom_start_date",value:f.custom_start_date||"",onChange:Ne,disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),a.jsx("input",{type:"date",name:"custom_end_date",value:f.custom_end_date||"",onChange:Ne,disabled:he("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"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),a.jsx("input",{type:"number",name:"custom_total_amount",value:f.custom_total_amount,onChange:Ne,disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Comments"}),a.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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Order Number"}),a.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"})]}),a.jsx(_t,{label:"MOH Supervisor",doctype:"User",value:f.custom_moh_supervisor||"",onChange:oe=>p(Se(ne({},f),{custom_moh_supervisor:oe})),disabled:he("custom_moh_supervisor")}),a.jsx(_t,{label:"Team Leader",doctype:"User",value:f.custom_team_leader||"",onChange:oe=>p(Se(ne({},f),{custom_team_leader:oe})),disabled:he("custom_team_leader")}),a.jsx(_t,{label:"Supplier/Vendor",doctype:"Supplier",value:f.supplier||"",onChange:oe=>p(Se(ne({},f),{supplier:oe})),disabled:he("supplier")}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Gross Purchase Amount"}),a.jsx("input",{type:"number",name:"gross_purchase_amount",value:f.gross_purchase_amount||0,onChange:Ne,disabled:he("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Date"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Installation Date"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Available For Use Date"}),a.jsx("input",{type:"date",name:"available_for_use_date",value:f.available_for_use_date||"",onChange:oe=>p(we=>Se(ne({},we),{available_for_use_date:oe.target.value})),disabled:he("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"})]})]})]})]}),a.jsx("div",{className:"mt-6",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Financial Details"}),a.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."}),a.jsxs("div",{className:"flex items-center mb-6",children:[a.jsx("input",{id:"calculate_depreciation",type:"checkbox",checked:f.calculate_depreciation,onChange:oe=>p(Se(ne({},f),{calculate_depreciation:oe.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"}),a.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&&a.jsxs("div",{className:"border-t pt-4",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"text-md font-semibold text-gray-800 dark:text-white",children:"Asset Finance Books"}),P&&a.jsxs("button",{type:"button",onClick:fe,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2",children:[a.jsx("span",{children:"+"})," Add Row"]})]}),(!f.finance_books||f.finance_books.length===0)&&a.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&&a.jsx("div",{className:"overflow-visible",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[a.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"}),a.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*"}),a.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*"}),a.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)*"}),a.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&&a.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"})]})}),a.jsx("tbody",{children:f.finance_books.map((oe,we)=>{var Ie,ot;return a.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 relative",style:{overflow:"visible"},children:a.jsx("div",{className:"relative z-20",children:a.jsx(_t,{label:"",doctype:"Finance Book",value:oe.finance_book||"",onChange:bt=>F(we,{finance_book:bt}),disabled:!P})})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("select",{value:oe.depreciation_method||"",onChange:bt=>F(we,{depreciation_method:bt.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:[a.jsx("option",{value:"",children:"Select Method"}),a.jsx("option",{value:"Straight Line",children:"Straight Line"}),a.jsx("option",{value:"Double Declining Balance",children:"Double Declining Balance"}),a.jsx("option",{value:"Written Down Value",children:"Written Down Value"}),a.jsx("option",{value:"Manual",children:"Manual"})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"number",value:(Ie=oe.total_number_of_depreciations)!=null?Ie:"",onChange:bt=>F(we,{total_number_of_depreciations:Number(bt.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"number",value:(ot=oe.frequency_of_depreciation)!=null?ot:"",onChange:bt=>F(we,{frequency_of_depreciation:Number(bt.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"date",value:oe.depreciation_start_date||"",onChange:bt=>F(we,{depreciation_start_date:bt.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&&a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>ae(we),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors",children:"Remove"})})]},we)})})]})})})]})]})}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 mt-6",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Expected End-of-Life Date"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Disposal Method"}),a.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:[a.jsx("option",{value:"",children:"Recycling"}),a.jsx("option",{value:"Donation",children:"Donation"}),a.jsx("option",{value:"Sale",children:"Sale"})]})]})]})]})}),a.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_warranty",type:"checkbox",checked:f.custom_warranty||!1,onChange:oe=>{p(Se(ne({},f),{custom_warranty:oe.target.checked}))},disabled:he("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"}`}),a.jsx("label",{htmlFor:"custom_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Warranty"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_extended_warranty",type:"checkbox",checked:f.custom_extended_warranty||!1,onChange:oe=>{p(Se(ne({},f),{custom_extended_warranty:oe.target.checked}))},disabled:he("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"}`}),a.jsx("label",{htmlFor:"custom_extended_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Extended Warranty"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom__service_contract",type:"checkbox",checked:f.custom__service_contract||!1,onChange:oe=>{p(Se(ne({},f),{custom__service_contract:oe.target.checked}))},disabled:he("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"}`}),a.jsx("label",{htmlFor:"custom__service_contract",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Service Contract"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_covering_spare_parts",type:"checkbox",checked:f.custom_covering_spare_parts||!1,onChange:oe=>{p(Se(ne({},f),{custom_covering_spare_parts:oe.target.checked}))},disabled:he("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"}`}),a.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"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_spare_parts_labour",type:"checkbox",checked:f.custom_spare_parts_labour||!1,onChange:oe=>{p(Se(ne({},f),{custom_spare_parts_labour:oe.target.checked}))},disabled:he("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"}`}),a.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"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_covering_labour",type:"checkbox",checked:f.custom_covering_labour||!1,onChange:oe=>{p(Se(ne({},f),{custom_covering_labour:oe.target.checked}))},disabled:he("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"}`}),a.jsx("label",{htmlFor:"custom_covering_labour",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Covering Labour"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{id:"custom_ppm_only",type:"checkbox",checked:f.custom_ppm_only||!1,onChange:oe=>{p(Se(ne({},f),{custom_ppm_only:oe.target.checked}))},disabled:he("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"}`}),a.jsx("label",{htmlFor:"custom_ppm_only",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"PPM Only"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Support Plan"}),a.jsx("input",{type:"text",name:"custom_support_plan",value:f.custom_support_plan||"",onChange:Ne,disabled:he("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"})]})]}),a.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Spare Parts"}),P&&a.jsxs("button",{type:"button",onClick:H,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2 text-sm",children:[a.jsx("span",{children:"+"})," Add Row"]})]}),(!f.custom_spare_parts||f.custom_spare_parts.length===0)&&a.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&&a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Code"}),a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Name"}),a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Qty"}),a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Rate"}),a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Amount"}),a.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"UOM"}),P&&a.jsx("th",{className:"text-center px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Action"})]})}),a.jsx("tbody",{children:f.custom_spare_parts.map((oe,we)=>a.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"text",value:oe.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"text",value:oe.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"number",value:oe.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"number",value:oe.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"number",value:oe.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"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"text",value:oe.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&&a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>Z(we),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors text-sm",children:"Remove"})})]},we))}),a.jsx("tfoot",{children:a.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 font-semibold",children:[a.jsx("td",{colSpan:4,className:"px-4 py-3 text-right text-sm text-gray-700 dark:text-gray-300",children:"Total Amount:"}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-white",children:f.custom_total_spare_parts_amount||0}),a.jsx("td",{colSpan:P?2:1})]})})]})})]})]})]})},yO=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:p}=Va(),[g,x]=j.useState(r>0?"selected":"all_with_filters"),[y,v]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{r>0?x("selected"):x("all_with_filters")},[r]);const N=C=>{T(O=>O.includes(C)?O.filter(P=>P!==C):[...O,C])},S=()=>{T(f.map(C=>C.key))},A=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," ",p("workOrders.title")]})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What to Export"}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected work order",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," work order",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," work order",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>v("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>v("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:A,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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=>a.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:[a.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(g,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},bO=()=>{const{t:e}=Va(),t=xa(),[r,s]=hl(),[i,d]=j.useState(0),[c,f]=j.useState(null),[p,g]=j.useState(null),x=j.useRef(null),y=20,v=[{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:"site_name",label:e("commonFields.siteName")||"Site Name",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=r.get("asset"),[T,N]=j.useState(!1),[S,A]=j.useState(new Set),[C,O]=j.useState(!1),[P,B]=j.useState(!1),{permissionFilters:V,loading:z,error:U,hasAnyRestrictions:J}=qw("Work_Order"),[de,ye]=j.useState(""),[ie,he]=j.useState(""),[ve,me]=j.useState(""),[ee,q]=j.useState(""),[Q,fe]=j.useState(""),[ae,F]=j.useState(""),[D,H]=j.useState(""),[Z,K]=j.useState(""),[ue,Le]=j.useState(""),[Ne,We]=j.useState(""),[Fe,tt]=j.useState(""),[ft,Dt]=j.useState(!0),[Ve,At]=j.useState(0),[jt,He]=j.useState([]),[oe,we]=j.useState(!1),[Ie,ot]=j.useState(""),[bt,qe]=j.useState(""),Ue=j.useRef(null);j.useEffect(()=>{const I=r.get("company"),Y=r.get("priority"),te=r.get("status"),se=r.get("site_name");I&&q(I),Y&&tt(Y),te&&F(te),se&&fe(se)},[r]),j.useEffect(()=>{k&&he(k)},[k]),j.useEffect(()=>{const I=localStorage.getItem("workOrderFilterPresets");I&&He(JSON.parse(I))},[]),j.useEffect(()=>{const I=[de,ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe].filter(Boolean).length;At(I)},[de,ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe]);const ht={};de&&(ht.name=de),ie&&(ht.asset=ie),ve&&(ht.work_order_type=ve),ee&&(ht.company=ee),Q&&(ht.site_name=Q),ae&&(ht.repair_status=ae),D&&(ht.custom_serial_number=["like",`%${D}%`]),Z&&(ht.custom_manufacturer=Z),ue&&(ht.supplier=ue),Ne&&(ht.department=Ne),Fe&&(ht.custom_priority_=Fe);const{workOrders:wt,totalCount:Mt,hasMore:Ft,loading:je,error:it,refetch:vt}=O_(ht,y,i*y,"modified desc",V),{deleteWorkOrder:Bt,loading:De}=M_();j.useEffect(()=>{!je&&!T&&!z&&N(!0)},[je,T,z]),j.useEffect(()=>{i!==0&&d(0)},[de,ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe]),j.useEffect(()=>{A(new Set)},[de,ie,ve,ee,Q,ae,D,Z,ue,Ne,Fe,i]);const ct=I=>{qe(I),Ue.current&&clearTimeout(Ue.current),Ue.current=window.setTimeout(()=>{H(I)},800)},ut=I=>{I.key==="Enter"&&(I.preventDefault(),Ue.current&&clearTimeout(Ue.current),H(bt))},Nt=()=>{if(!Ie.trim()){alert("Please enter a filter name");return}const I={id:Date.now(),name:Ie,filters:{filterWorkOrderId:de,filterAsset:ie,filterType:ve,filterCompany:ee,filterSiteName:Q,filterStatus:ae,filterSerialNumber:D,filterManufacturer:Z,filterSupplier:ue,filterDepartment:Ne,filterPriority:Fe}},Y=[...jt,I];He(Y),ot(""),we(!1),localStorage.setItem("workOrderFilterPresets",JSON.stringify(Y))},Rt=I=>{const Y=I.filters;ye(Y.filterWorkOrderId||""),he(Y.filterAsset||""),me(Y.filterType||""),q(Y.filterCompany||""),fe(Y.filterSiteName||""),F(Y.filterStatus||""),H(Y.filterSerialNumber||""),qe(Y.filterSerialNumber||""),K(Y.filterManufacturer||""),Le(Y.filterSupplier||""),We(Y.filterDepartment||""),tt(Y.filterPriority||"")},ia=I=>{const Y=jt.filter(te=>te.id!==I);He(Y),localStorage.setItem("workOrderFilterPresets",JSON.stringify(Y))};j.useEffect(()=>()=>{Ue.current&&clearTimeout(Ue.current)},[]),j.useEffect(()=>{const I=Y=>{x.current&&!x.current.contains(Y.target)&&g(null)};return p&&document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[p]);const et=I=>{A(Y=>{const te=new Set(Y);return te.has(I)?te.delete(I):te.add(I),te})},pe=()=>{S.size===wt.length?A(new Set):A(new Set(wt.map(I=>I.name)))},ze=wt.length>0&&S.size===wt.length,st=S.size>0&&S.size<wt.length,Ut=j.useCallback(()=>le(null,null,function*(){const I=[];let Y=0;const te=100;let se=!0;for(;se;)try{const xe=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Work_Order",filters:ne(ne({},ht),V),fields:["*"],limit_start:Y*te,limit_page_length:te,order_by:"creation desc"})})).json()).message||[];I.push(...xe),xe.length<te?se=!1:Y++,Y>100&&(console.warn("Export safety limit reached"),se=!1)}catch(Ee){throw console.error("Error fetching work orders for export:",Ee),Ee}return I}),[ht,V]),la=(I,Y,te)=>le(null,null,function*(){B(!0);try{let se=[];switch(I){case"selected":se=wt.filter(re=>S.has(re.name));break;case"all_on_page":se=wt;break;case"all_with_filters":se=yield Ut();break}if(se.length===0){alert("No data to export");return}const Ee=te.map(re=>{const xe=v.find(ke=>ke.key===re);return(xe==null?void 0:xe.label)||re});if(Y==="csv"){const re=[Ee.join(","),...se.map(Qe=>te.map(lt=>{let dt=Qe[lt]||"";return typeof dt=="string"&&(dt.includes(",")||dt.includes('"')||dt.includes(`
`))&&(dt=`"${dt.replace(/"/g,'""')}"`),dt}).join(","))].join(`
`),xe=new Blob(["\uFEFF"+re],{type:"text/csv;charset=utf-8;"}),ke=URL.createObjectURL(xe),Ce=document.createElement("a");Ce.href=ke,Ce.download=`work_orders_export_${new Date().toISOString().split("T")[0]}.csv`,Ce.click(),URL.revokeObjectURL(ke)}else if(Y==="excel"){const re=[Ee,...se.map(Ce=>te.map(Qe=>Ce[Qe]||""))],xe=jr.aoa_to_sheet(re),ke=jr.book_new();jr.book_append_sheet(ke,xe,"Work Orders"),Ic(ke,`work_orders_export_${new Date().toISOString().split("T")[0]}.xlsx`)}O(!1),A(new Set)}catch(se){console.error("Export failed:",se),alert(`Export failed: ${se instanceof Error?se.message:"Unknown error"}`)}finally{B(!1)}}),va=()=>t("/work-orders/new"),ar=I=>t(`/work-orders/${I}`),tn=I=>t(`/work-orders/${I}`),Bn=I=>t(`/work-orders/new?duplicate=${I}`),Gr=I=>le(null,null,function*(){try{yield Bt(I),f(null),vt(),alert("Work order deleted successfully!")}catch(Y){alert(`Failed to delete work order: ${Y instanceof Error?Y.message:"Unknown error"}`)}}),Zs=I=>{const Y=JSON.stringify(I,null,2),te=new Blob([Y],{type:"application/json"}),se=URL.createObjectURL(te),Ee=document.createElement("a");Ee.href=se,Ee.download=`work_order_${I.name}.json`,Ee.click(),URL.revokeObjectURL(se)},Ss=I=>{window.open(`/work-orders/${I}?print=true`,"_blank")},an=()=>{ye(""),he(""),me(""),q(""),fe(""),F(""),H(""),qe(""),K(""),Le(""),We(""),tt(""),(r.has("asset")||r.has("site_name"))&&(r.delete("asset"),r.delete("site_name"),s(r)),Ue.current&&clearTimeout(Ue.current)},_n=de||ie||ve||ee||Q||ae||D||Z||ue||Ne||Fe,rr=I=>I?new Date(I).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",Et=I=>{switch(I==null?void 0:I.toLowerCase()){case"completed":return a.jsx(Ha,{className:"text-green-500"});case"in progress":return a.jsx(ol,{className:"text-blue-500"});case"pending":return a.jsx(Xa,{className:"text-yellow-500"});default:return a.jsx(ol,{className:"text-gray-400"})}},W=I=>{switch(I==null?void 0:I.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"}},ce=I=>{switch(I==null?void 0:I.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 z&&!T?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):U?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),a.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"Unable to load user permissions."})}),a.jsx("p",{children:U}),a.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"})]})]})}):je&&!T?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work orders..."})]})}):it?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Work Order API Not Available"}),a.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"The Work Order API endpoint is not deployed yet."})}),a.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)"}),a.jsx("button",{onClick:vt,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("workOrders.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",Mt," work order",Mt!==1?"s":"",S.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",S.size," selected"]}),je&&T&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[a.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>O(!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:Mt===0,children:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),S.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:S.size})]}),a.jsxs("button",{onClick:va,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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:e("workOrders.addWorkOrder")})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsx("button",{onClick:()=>Dt(!ft),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:ft?a.jsx(m0,{size:14}):a.jsx(Ec,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ws,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"})]}),Ve>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:Ve})]}),_n&&a.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[de&&a.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:[a.jsx("span",{className:"font-semibold",children:"WO ID:"})," ",de,a.jsx("button",{onClick:I=>{I.stopPropagation(),ye("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ie&&a.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:[a.jsx("span",{className:"font-semibold",children:"Asset:"})," ",ie,a.jsx("button",{onClick:I=>{I.stopPropagation(),he(""),r.delete("asset"),s(r)},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ve&&a.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:[a.jsx("span",{className:"font-semibold",children:"Type:"})," ",ve,a.jsx("button",{onClick:I=>{I.stopPropagation(),me("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ee&&a.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:[a.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",ee,a.jsx("button",{onClick:I=>{I.stopPropagation(),q("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Q&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-emerald-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[a.jsx("span",{className:"font-semibold",children:"Site:"})," ",Q,a.jsx("button",{onClick:I=>{I.stopPropagation(),fe(""),r.delete("site_name"),s(r)},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ae&&a.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:[a.jsx("span",{className:"font-semibold",children:"Status:"})," ",ae,a.jsx("button",{onClick:I=>{I.stopPropagation(),F("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),D&&a.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:[a.jsx("span",{className:"font-semibold",children:"Serial:"})," ",D,a.jsx("button",{onClick:I=>{I.stopPropagation(),H(""),qe("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Z&&a.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:[a.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",Z,a.jsx("button",{onClick:I=>{I.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),ue&&a.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:[a.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",ue,a.jsx("button",{onClick:I=>{I.stopPropagation(),Le("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Ne&&a.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:[a.jsx("span",{className:"font-semibold",children:"Dept:"})," ",Ne,a.jsx("button",{onClick:I=>{I.stopPropagation(),We("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),Fe&&a.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:[a.jsx("span",{className:"font-semibold",children:"Priority:"})," ",Fe,a.jsx("button",{onClick:I=>{I.stopPropagation(),tt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Ve>0&&a.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:[a.jsx(gr,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),_n&&a.jsxs("button",{onClick:an,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:[a.jsx(xt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),ft&&a.jsxs("div",{className:"p-4",children:[jt.length>0&&a.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[a.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:jt.map(I=>a.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:[a.jsx("button",{onClick:()=>Rt(I),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:I.name}),a.jsx("button",{onClick:()=>ia(I.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(ma,{size:10})})]},I.id))})]}),a.jsx("div",{className:"space-y-5",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Work Order ID",doctype:"Work_Order",value:de,onChange:I=>ye(I),placeholder:"Select WO ID",disabled:!1,compact:!0}),de&&a.jsx("button",{onClick:()=>ye(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(_t,{label:"Asset",doctype:"Asset",value:ie,onChange:I=>he(I),placeholder:"Select Asset",disabled:!1,compact:!0}),ie&&a.jsx("button",{onClick:()=>{he(""),r.delete("asset"),s(r)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(_t,{label:"Type",doctype:"Issue Type",value:ve,onChange:I=>me(I),placeholder:"Select Type",disabled:!1,compact:!0}),ve&&a.jsx("button",{onClick:()=>me(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[57]",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:ee,onChange:I=>q(I),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),ee&&a.jsx("button",{onClick:()=>q(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[56]",children:[a.jsx(_t,{label:"PHCC Site",doctype:"Mobile Team Site",value:Q,onChange:I=>fe(I),placeholder:"Select Site",disabled:!1,compact:!0}),Q&&a.jsx("button",{onClick:()=>{fe(""),r.delete("site_name"),s(r)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Status"}),a.jsxs("select",{value:ae,onChange:I=>F(I.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:[a.jsx("option",{value:"",children:"All Status"}),a.jsx("option",{value:"Open",children:"Open"}),a.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),a.jsx("option",{value:"Pending Review",children:"Pending Review"}),a.jsx("option",{value:"Completed",children:"Completed"}),a.jsx("option",{value:"Cancelled",children:"Cancelled"}),a.jsx("option",{value:"Closed",children:"Closed"})]}),ae&&a.jsx("button",{onClick:()=>F(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),a.jsx("input",{type:"text",value:bt,onChange:I=>ct(I.target.value),onKeyDown:ut,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"}),bt&&bt!==D&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),D&&a.jsx("button",{onClick:()=>{H(""),qe("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(_t,{label:"Manufacturer",doctype:"Manufacturer",value:Z,onChange:I=>K(I),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),Z&&a.jsx("button",{onClick:()=>K(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[54]",children:[a.jsx(_t,{label:"Supplier",doctype:"Supplier",value:ue,onChange:I=>Le(I),placeholder:"Select Supplier",disabled:!1,compact:!0}),ue&&a.jsx("button",{onClick:()=>Le(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[53]",children:[a.jsx(_t,{label:"Department",doctype:"Department",value:Ne,onChange:I=>We(I),placeholder:"Select Department",disabled:!1,compact:!0}),Ne&&a.jsx("button",{onClick:()=>We(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Priority"}),a.jsxs("select",{value:Fe,onChange:I=>tt(I.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:[a.jsx("option",{value:"",children:"All Priorities"}),a.jsx("option",{value:"Normal",children:"Normal"}),a.jsx("option",{value:"Urgent",children:"Urgent"})]}),Fe&&a.jsx("button",{onClick:()=>tt(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]})]})})})]})]}),oe&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),a.jsx("input",{type:"text",value:Ie,onChange:I=>ot(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),Nt())},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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:()=>{we(!1),ot("")},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"}),a.jsxs("button",{onClick:Nt,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:[a.jsx(gr,{size:12}),"Save Filter"]})]})]})}),a.jsx(yO,{isOpen:C,onClose:()=>O(!1),selectedCount:S.size,totalCount:Mt,pageCount:wt.length,onExport:la,isExporting:P,exportColumns:v}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[je&&T&&a.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:a.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[a.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.jsx("button",{onClick:pe,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:ze?"Deselect all":"Select all",children:ze?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):st?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:wt.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Ws,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No work orders found"}),_n?a.jsx("button",{onClick:an,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):a.jsx("button",{onClick:va,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"})]})})}):wt.map(I=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${S.has(I.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>ar(I.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:Y=>Y.stopPropagation(),children:a.jsx("button",{onClick:()=>et(I.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:S.has(I.name)?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:I.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:rr(I.modified)})]}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:I.asset_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:I.asset||""})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:I.work_order_type||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:I.department||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[Et(I.repair_status||""),a.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${W(I.repair_status||"")}`,children:I.repair_status||"Unknown"})]})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${ce(I.custom_priority_||"")}`,children:I.custom_priority_||"Normal"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:Y=>Y.stopPropagation(),children:[a.jsx("button",{onClick:()=>ar(I.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:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>tn(I.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:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>Bn(I.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:a.jsx(Cc,{})}),a.jsx("button",{onClick:()=>f(I.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:De,children:a.jsx(ma,{})}),a.jsxs("div",{className:"relative",ref:p===I.name?x:null,children:[a.jsx("button",{onClick:()=>g(p===I.name?null:I.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:a.jsx(g0,{})}),p===I.name&&a.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:[a.jsxs("button",{onClick:()=>{Zs(I),g(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:[a.jsx(wi,{className:"text-blue-500"}),"Export as JSON"]}),a.jsxs("button",{onClick:()=>{Ss(I.name),g(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:[a.jsx(so,{className:"text-purple-500"}),"Print Work Order"]})]})]})]})})]},I.name))})]})}),wt.length>0&&a.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:[a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a.jsx("span",{className:"font-medium",children:i*y+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((i+1)*y,Mt)})," ","of ",a.jsx("span",{className:"font-medium",children:Mt})," results",J&&a.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.jsx("button",{disabled:!Ft,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&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Work Order"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Work Order ID:"})," ",c]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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:De,children:"Cancel"}),a.jsx("button",{onClick:()=>Gr(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:De,children:De?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ma,{}),"Delete Work Order"]})})]})]})]})})}),a.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 vO=(e,t)=>{gc=e,t&&(pc=t),console.log("[Workflow] User set manually:",e,"Roles:",t)},_O=()=>{gc=null,pc=null},Wp=()=>le(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,r=e.roles||[];return gc=t,pc=r,console.log("[Workflow] User from getUserDetails():",t),console.log("[Workflow] Roles from getUserDetails():",r),{user:t,roles:r}}return console.warn("[Workflow] getUserDetails() returned no user"),{user:"",roles:[]}}catch(e){return console.error("[Workflow] Error getting user details:",e),{user:"",roles:[]}}}),wO=()=>le(null,null,function*(){const{user:e}=yield Wp();return e}),oh=()=>le(null,null,function*(){const{roles:e}=yield Wp();return e}),ch=()=>le(null,null,function*(){try{const e=yield oh(),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}}),Vp=(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 r=e;r=r.replace(/\band\b/g,"&&"),r=r.replace(/\bor\b/g,"||"),r=r.replace(/\bnot\s+/g,"!"),r=r.replace(/\bTrue\b/g,"true"),r=r.replace(/\bFalse\b/g,"false"),r=r.replace(/\bNone\b/g,"null"),r=r.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)}),r=r.replace(/== 1/g,"=== 1"),r=r.replace(/== 0/g,"=== 0"),r=r.replace(/!= 1/g,"!== 1"),r=r.replace(/!= 0/g,"!== 0"),console.log("[Workflow] Transformed condition:",r);const s=new Function(`return (${r})`)();return console.log("[Workflow] Condition result:",s),!!s}catch(r){return console.error("[Workflow] Error evaluating condition:",e,r),!1}},dh=e=>le(null,null,function*(){var t,r,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:",(r=(t=f==null?void 0:f.data)==null?void 0:t.transitions)==null?void 0:r.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}}),Xw=(e,t,r)=>le(null,null,function*(){try{console.log("[Workflow] Getting all transitions for state:",t);const s=yield dh(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),r&&(i=i.filter(f=>{const p=Vp(f.condition,r);return console.log(`[Workflow] Transition "${f.action}" (allowed: ${f.allowed}) condition "${f.condition||"none"}" = ${p}`),p}),console.log("[Workflow] Transitions after condition evaluation:",i.length));const d=new Set,c=[];for(const f of i){const p=`${f.action}::${f.next_state}`;d.has(p)?console.log(`[Workflow] Skipping duplicate: ${f.action} → ${f.next_state} (allowed: ${f.allowed})`):(d.add(p),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),[]}}),kO=(e,t,r,s)=>le(null,null,function*(){var i;try{console.log("[Workflow] getWorkflowTransitions called with:",{doctype:e,docname:t,currentState:r});const d=yield ch(),c=yield oh();if(console.log("[Workflow] User is System Manager:",d),console.log("[Workflow] User roles:",c),d&&r){console.log("[Workflow] System Manager detected, getting all transitions for state:",r);const g=yield Xw(e,r,s);return console.log("[Workflow] Final transitions for System Manager:",g.map(x=>`${x.action} → ${x.next_state}`)),g}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 p=[];if(Array.isArray(f)?p=f:f!=null&&f.message&&Array.isArray(f.message)?p=f.message:f!=null&&f.data&&Array.isArray(f.data)?p=f.data:(i=f==null?void 0:f.data)!=null&&i.message&&Array.isArray(f.data.message)&&(p=f.data.message),console.log("[Workflow] Parsed transitions:",p),console.log("[Workflow] Transitions count:",p.length),p.length===0&&r&&s){console.log("[Workflow] Frappe API returned no transitions, trying local filtering");const g=yield dh(e);if(g){const x=g.transitions.filter(k=>!(k.state!==r||!c.includes(k.allowed)||!Vp(k.condition,s))),y=new Set,v=[];for(const k of x){const T=`${k.action}::${k.next_state}`;y.has(T)||(y.add(T),v.push(k))}return console.log("[Workflow] Local filtered transitions:",v),v}}return p}catch(d){return console.error("[Workflow] Error fetching workflow transitions:",d),[]}}),NO=(e,t,r,s)=>le(null,null,function*(){try{if(console.log("[Workflow] Applying action:",{doctype:e,docname:t,action:r,nextState:s}),(yield ch())&&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:r})});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:r})});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}}),jO=(e,t,r)=>le(null,null,function*(){try{if(yield ch())return console.log("[Workflow] System Manager can always edit"),!0;const i=yield dh(e);if(!i)return!0;const d=yield oh(),c=i.states.filter(p=>p.state===r);if(c.length===0)return!0;const f=c.some(p=>d.includes(p.allow_edit));return console.log("[Workflow] Can user edit:",f,"User roles:",d,"Allowed roles:",c.map(p=>p.allow_edit)),f}catch(s){return console.error("[Workflow] Error checking edit permission:",s),!1}}),Jw=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},Kw=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",Qw=e=>({Apply:"📤","Send For Repair":"🔧","Send For Approval":"📋","Material Request":"📦",Accept:"✅",Reject:"❌",Close:"🔒","Re-Open":"🔓",Cancel:"🚫",Approve:"✅"})[e]||"▶️",ql={getWorkflowTransitions:kO,applyWorkflowAction:NO,getWorkflowInfo:dh,getCurrentUserRoles:oh,getCurrentUser:wO,getCurrentUserAndRoles:Wp,setCurrentUser:vO,clearCurrentUser:_O,canUserEditDocument:jO,getWorkflowStateStyle:Jw,getActionButtonStyle:Kw,getActionIcon:Qw,isSystemManager:ch,getAllTransitionsForState:Xw,evaluateCondition:Vp},e4=({doctype:e,docname:t,workflowState:r,enabled:s=!0,docData:i})=>{const[d,c]=j.useState([]),[f,p]=j.useState(null),[g,x]=j.useState([]),[y,v]=j.useState(""),[k,T]=j.useState(!1),[N,S]=j.useState(!1),[A,C]=j.useState(!1),[O,P]=j.useState(null),[B,V]=j.useState(!0);j.useEffect(()=>{if(!s)return;le(null,null,function*(){try{const de=yield ql.getWorkflowInfo(e);p(de)}catch(de){console.error("Error fetching workflow info:",de)}})},[e,s]),j.useEffect(()=>{if(!s)return;le(null,null,function*(){try{const[de,ye,ie]=yield Promise.all([ql.getCurrentUserRoles(),ql.getCurrentUser(),ql.isSystemManager()]);x(de),v(ye),T(ie),ie&&V(!0)}catch(de){console.error("Error fetching user info:",de)}})},[s]);const z=j.useCallback(()=>le(null,null,function*(){if(!t||!s){c([]);return}S(!0),P(null);try{const J=yield ql.getWorkflowTransitions(e,t,r,i);if(console.log("[useWorkflow] Available transitions:",J),c(J),r){const de=yield ql.canUserEditDocument(e,t,r);V(de)}}catch(J){console.error("Error fetching transitions:",J),P("Failed to load workflow actions"),c([])}finally{S(!1)}}),[e,t,r,s,i]);j.useEffect(()=>{z()},[z]);const U=j.useCallback((J,de)=>le(null,null,function*(){if(!t)return P("Document not saved yet"),!1;C(!0),P(null);try{return yield ql.applyWorkflowAction(e,t,J,de),yield z(),!0}catch(ye){console.error("Error applying workflow action:",ye);let ie="Failed to apply action";if(ye.message)ie=ye.message;else if(ye._server_messages)try{ie=JSON.parse(ye._server_messages).map(ve=>{try{return JSON.parse(ve).message}catch(me){return ve}}).join(`
`)}catch(he){ie=ye._server_messages}return P(ie),!1}finally{C(!1)}}),[e,t,z]);return{transitions:d,workflowInfo:f,userRoles:g,currentUser:y,isSystemManager:k,loading:N,actionLoading:A,error:O,canEdit:B,applyAction:U,refreshTransitions:z,getStateStyle:Jw,getButtonStyle:Kw,getIcon:Qw}};function t4(e){var t,r,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]&&(r=t4(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function ro(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=t4(e))&&(s&&(s+=" "),s+=t);return s}function SO(e){if(typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}SO(`: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",_i=e=>typeof e=="function",TO=e=>uo(e)||T0(e),rp=e=>uo(e)||_i(e)?e:null,EO=(e,t)=>e===!1||T0(e)&&e>0?e:t,np=e=>j.isValidElement(e)||uo(e)||_i(e)||T0(e);function CO(e,t,r=300){let{scrollHeight:s,style:i}=e;requestAnimationFrame(()=>{i.minHeight="initial",i.height=s+"px",i.transition=`all ${r}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(t,r)})})}function AO({enter:e,exit:t,appendPosition:r=!1,collapse:s=!0,collapseDuration:i=300}){return function({children:d,position:c,preventExitTransition:f,done:p,nodeRef:g,isIn:x,playToast:y}){let v=r?`${e}--${c}`:e,k=r?`${t}--${c}`:t,T=j.useRef(0);return j.useLayoutEffect(()=>{let N=g.current,S=v.split(" "),A=C=>{C.target===g.current&&(y(),N.removeEventListener("animationend",A),N.removeEventListener("animationcancel",A),T.current===0&&C.type!=="animationcancel"&&N.classList.remove(...S))};N.classList.add(...S),N.addEventListener("animationend",A),N.addEventListener("animationcancel",A)},[]),j.useEffect(()=>{let N=g.current,S=()=>{N.removeEventListener("animationend",S),s?CO(N,p,i):p()};x||(f?S():(T.current=1,N.className+=` ${k}`,N.addEventListener("animationend",S)))},[x]),sa.createElement(sa.Fragment,null,d)}}function Zv(e,t){return{content:a4(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 a4(e,t,r=!1){return j.isValidElement(e)&&!uo(e.type)?j.cloneElement(e,{closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:r}):_i(e)?e({closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:r}):e}function OO({closeToast:e,theme:t,ariaLabel:r="close"}){return sa.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:s=>{s.stopPropagation(),e(!0)},"aria-label":r},sa.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},sa.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 MO({delay:e,isRunning:t,closeToast:r,type:s="default",hide:i,className:d,controlledProgress:c,progress:f,rtl:p,isIn:g,theme:x}){let y=i||c&&f===0,v={animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};c&&(v.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":p}),T=_i(d)?d({rtl:p,type:s,defaultClassName:k}):ro(k,d),N={[c&&f>=1?"onTransitionEnd":"onAnimationEnd"]:c&&f<1?null:()=>{g&&r()}};return sa.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":y},sa.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${x} Toastify__progress-bar--${s}`}),sa.createElement("div",ne({role:"progressbar","aria-hidden":y?"true":"false","aria-label":"notification timer",className:T,style:v},N)))}var LO=1,r4=()=>`${LO++}`;function DO(e,t,r){let s=1,i=0,d=[],c=[],f=t,p=new Map,g=new Set,x=C=>(g.add(C),()=>g.delete(C)),y=()=>{c=Array.from(p.values()),g.forEach(C=>C())},v=({containerId:C,toastId:O,updateId:P})=>{let B=C?C!==e:e!==1,V=p.has(O)&&P==null;return B||V},k=(C,O)=>{p.forEach(P=>{var B;(O==null||O===P.props.toastId)&&((B=P.toggle)==null||B.call(P,C))})},T=C=>{var O,P;(P=(O=C.props)==null?void 0:O.onClose)==null||P.call(O,C.removalReason),C.isActive=!1},N=C=>{if(C==null)p.forEach(T);else{let O=p.get(C);O&&T(O)}y()},S=()=>{i-=d.length,d=[]},A=C=>{var O,P;let{toastId:B,updateId:V}=C.props,z=V==null;C.staleId&&p.delete(C.staleId),C.isActive=!0,p.set(B,C),y(),r(Zv(C,z?"added":"updated")),z&&((P=(O=C.props).onOpen)==null||P.call(O))};return{id:e,props:f,observe:x,toggle:k,removeToast:N,toasts:p,clearQueue:S,buildToast:(C,O)=>{if(v(O))return;let{toastId:P,updateId:B,data:V,staleId:z,delay:U}=O,J=B==null;J&&i++;let de=Se(ne(Se(ne({},f),{style:f.toastStyle,key:s++}),Object.fromEntries(Object.entries(O).filter(([ie,he])=>he!=null))),{toastId:P,updateId:B,data:V,isIn:!1,className:rp(O.className||f.toastClassName),progressClassName:rp(O.progressClassName||f.progressClassName),autoClose:O.isLoading?!1:EO(O.autoClose,f.autoClose),closeToast(ie){p.get(P).removalReason=ie,N(P)},deleteToast(){let ie=p.get(P);if(ie!=null){if(r(Zv(ie,"removed")),p.delete(P),i--,i<0&&(i=0),d.length>0){A(d.shift());return}y()}}});de.closeButton=f.closeButton,O.closeButton===!1||np(O.closeButton)?de.closeButton=O.closeButton:O.closeButton===!0&&(de.closeButton=np(f.closeButton)?f.closeButton:!0);let ye={content:C,props:de,staleId:z};f.limit&&f.limit>0&&i>f.limit&&J?d.push(ye):T0(U)?setTimeout(()=>{A(ye)},U):A(ye)},setProps(C){f=C},setToggle:(C,O)=>{let P=p.get(C);P&&(P.toggle=O)},isToastActive:C=>{var O;return(O=p.get(C))==null?void 0:O.isActive},getSnapshot:()=>c}}var Kr=new Map,d0=[],sp=new Set,PO=e=>sp.forEach(t=>t(e)),n4=()=>Kr.size>0;function RO(){d0.forEach(e=>i4(e.content,e.options)),d0=[]}var FO=(e,{containerId:t})=>{var r;return(r=Kr.get(t||1))==null?void 0:r.toasts.get(e)};function s4(e,t){var r;if(t)return!!((r=Kr.get(t))!=null&&r.isToastActive(e));let s=!1;return Kr.forEach(i=>{i.isToastActive(e)&&(s=!0)}),s}function IO(e){if(!n4()){d0=d0.filter(t=>e!=null&&t.options.toastId!==e);return}if(e==null||TO(e))Kr.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=Kr.get(e.containerId);t?t.removeToast(e.id):Kr.forEach(r=>{r.removeToast(e.id)})}}var zO=(e={})=>{Kr.forEach(t=>{t.props.limit&&(!e.containerId||t.id===e.containerId)&&t.clearQueue()})};function i4(e,t){np(e)&&(n4()||d0.push({content:e,options:t}),Kr.forEach(r=>{r.buildToast(e,t)}))}function BO(e){var t;(t=Kr.get(e.containerId||1))==null||t.setToggle(e.id,e.fn)}function l4(e,t){Kr.forEach(r=>{(t==null||!(t!=null&&t.containerId)||(t==null?void 0:t.containerId)===r.id)&&r.toggle(e,t==null?void 0:t.id)})}function UO(e){let t=e.containerId||1;return{subscribe(r){let s=DO(t,e,PO);Kr.set(t,s);let i=s.observe(r);return RO(),()=>{i(),Kr.delete(t)}},setProps(r){var s;(s=Kr.get(t))==null||s.setProps(r)},getSnapshot(){var r;return(r=Kr.get(t))==null?void 0:r.getSnapshot()}}}function HO(e){return sp.add(e),()=>{sp.delete(e)}}function $O(e){return e&&(uo(e.toastId)||T0(e.toastId))?e.toastId:r4()}function E0(e,t){return i4(e,t),t.toastId}function uh(e,t){return Se(ne({},t),{type:t&&t.type||e,toastId:$O(t)})}function fh(e){return(t,r)=>E0(t,uh(e,r))}function kt(e,t){return E0(e,uh("default",t))}kt.loading=(e,t)=>E0(e,uh("default",ne({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)));function WO(e,{pending:t,error:r,success:s},i){let d;t&&(d=uo(t)?kt.loading(t,i):kt.loading(t.render,ne(ne({},i),t)));let c={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},f=(g,x,y)=>{if(x==null){kt.dismiss(d);return}let v=Se(ne(ne({type:g},c),i),{data:y}),k=uo(x)?{render:x}:x;return d?kt.update(d,ne(ne({},v),k)):kt(k.render,ne(ne({},v),k)),y},p=_i(e)?e():e;return p.then(g=>f("success",s,g)).catch(g=>f("error",r,g)),p}kt.promise=WO;kt.success=fh("success");kt.info=fh("info");kt.error=fh("error");kt.warning=fh("warning");kt.warn=kt.warning;kt.dark=(e,t)=>E0(e,uh("default",ne({theme:"dark"},t)));function VO(e){IO(e)}kt.dismiss=VO;kt.clearWaitingQueue=zO;kt.isActive=s4;kt.update=(e,t={})=>{let r=FO(e,t);if(r){let{props:s,content:i}=r,d=Se(ne(ne({delay:100},s),t),{toastId:t.toastId||e,updateId:r4()});d.toastId!==e&&(d.staleId=e);let c=d.render||i;delete d.render,E0(c,d)}};kt.done=e=>{kt.update(e,{progress:1})};kt.onChange=HO;kt.play=e=>l4(!0,e);kt.pause=e=>l4(!1,e);function GO(e){var t;let{subscribe:r,getSnapshot:s,setProps:i}=j.useRef(UO(e)).current;i(e);let d=(t=j.useSyncExternalStore(r,s,s))==null?void 0:t.slice();function c(f){if(!d)return[];let p=new Map;return e.newestOnTop&&d.reverse(),d.forEach(g=>{let{position:x}=g.props;p.has(x)||p.set(x,[]),p.get(x).push(g)}),Array.from(p,g=>f(g[0],g[1]))}return{getToastToRender:c,isToastActive:s4,count:d==null?void 0:d.length}}function ZO(e){let[t,r]=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:p,closeToast:g,onClick:x,closeOnClick:y}=e;BO({id:e.toastId,containerId:e.containerId,fn:r}),j.useEffect(()=>{if(e.pauseOnFocusLoss)return v(),()=>{k()}},[e.pauseOnFocusLoss]);function v(){document.hasFocus()||A(),window.addEventListener("focus",S),window.addEventListener("blur",A)}function k(){window.removeEventListener("focus",S),window.removeEventListener("blur",A)}function T(z){if(e.draggable===!0||e.draggable===z.pointerType){C();let U=d.current;c.canCloseOnClick=!0,c.canDrag=!0,U.style.transition="none",e.draggableDirection==="x"?(c.start=z.clientX,c.removalDistance=U.offsetWidth*(e.draggablePercent/100)):(c.start=z.clientY,c.removalDistance=U.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function N(z){let{top:U,bottom:J,left:de,right:ye}=d.current.getBoundingClientRect();z.nativeEvent.type!=="touchend"&&e.pauseOnHover&&z.clientX>=de&&z.clientX<=ye&&z.clientY>=U&&z.clientY<=J?A():S()}function S(){r(!0)}function A(){r(!1)}function C(){c.didMove=!1,document.addEventListener("pointermove",P),document.addEventListener("pointerup",B)}function O(){document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",B)}function P(z){let U=d.current;if(c.canDrag&&U){c.didMove=!0,t&&A(),e.draggableDirection==="x"?c.delta=z.clientX-c.start:c.delta=z.clientY-c.start,c.start!==z.clientX&&(c.canCloseOnClick=!1);let J=e.draggableDirection==="x"?`${c.delta}px, var(--y)`:`0, calc(${c.delta}px + var(--y))`;U.style.transform=`translate3d(${J},0)`,U.style.opacity=`${1-Math.abs(c.delta/c.removalDistance)}`}}function B(){O();let z=d.current;if(c.canDrag&&c.didMove&&z){if(c.canDrag=!1,Math.abs(c.delta)>c.removalDistance){i(!0),e.closeToast(!0),e.collapseAll();return}z.style.transition="transform 0.2s, opacity 0.2s",z.style.removeProperty("transform"),z.style.removeProperty("opacity")}}let V={onPointerDown:T,onPointerUp:N};return f&&p&&(V.onMouseEnter=A,e.stacked||(V.onMouseLeave=S)),y&&(V.onClick=z=>{x&&x(z),c.canCloseOnClick&&g(!0)}),{playToast:S,pauseToast:A,isRunning:t,preventExitTransition:s,toastRef:d,eventHandlers:V}}var qO=typeof window!="undefined"?j.useLayoutEffect:j.useEffect,hh=i=>{var d=i,{theme:e,type:t,isLoading:r}=d,s=gn(d,["theme","type","isLoading"]);return sa.createElement("svg",ne({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`},s))};function YO(e){return sa.createElement(hh,ne({},e),sa.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 XO(e){return sa.createElement(hh,ne({},e),sa.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 JO(e){return sa.createElement(hh,ne({},e),sa.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 KO(e){return sa.createElement(hh,ne({},e),sa.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 QO(){return sa.createElement("div",{className:"Toastify__spinner"})}var ip={info:XO,warning:YO,success:JO,error:KO,spinner:QO},eM=e=>e in ip;function tM({theme:e,type:t,isLoading:r,icon:s}){let i=null,d={theme:e,type:t};return s===!1||(_i(s)?i=s(Se(ne({},d),{isLoading:r})):j.isValidElement(s)?i=j.cloneElement(s,d):r?i=ip.spinner():eM(t)&&(i=ip[t](d))),i}var aM=e=>{let{isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:i,playToast:d}=ZO(e),{closeButton:c,children:f,autoClose:p,onClick:g,type:x,hideProgressBar:y,closeToast:v,transition:k,position:T,className:N,style:S,progressClassName:A,updateId:C,role:O,progress:P,rtl:B,toastId:V,deleteToast:z,isIn:U,isLoading:J,closeOnClick:de,theme:ye,ariaLabel:ie}=e,he=ro("Toastify__toast",`Toastify__toast-theme--${ye}`,`Toastify__toast--${x}`,{"Toastify__toast--rtl":B},{"Toastify__toast--close-on-click":de}),ve=_i(N)?N({rtl:B,position:T,type:x,defaultClassName:he}):ro(he,N),me=tM(e),ee=!!P||!p,q={closeToast:v,type:x,theme:ye},Q=null;return c===!1||(_i(c)?Q=c(q):j.isValidElement(c)?Q=j.cloneElement(c,q):Q=OO(q)),sa.createElement(k,{isIn:U,done:z,position:T,preventExitTransition:r,nodeRef:s,playToast:d},sa.createElement("div",ne(Se(ne({id:V,tabIndex:0,onClick:g,"data-in":U,className:ve},i),{style:S,ref:s}),U&&{role:O,"aria-label":ie}),me!=null&&sa.createElement("div",{className:ro("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!J})},me),a4(f,e,!t),Q,!e.customProgressBar&&sa.createElement(MO,Se(ne({},C&&!ee?{key:`p-${C}`}:{}),{rtl:B,theme:ye,delay:p,isRunning:t,isIn:U,closeToast:v,hide:y,type:x,className:A,controlledProgress:ee,progress:P||0}))))},rM=(e,t=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}),C0=AO(rM("bounce",!0)),nM={position:"top-right",transition:C0,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 mh(e){let t=ne(ne({},nM),e),r=e.stacked,[s,i]=j.useState(!0),d=j.useRef(null),{getToastToRender:c,isToastActive:f,count:p}=GO(t),{className:g,style:x,rtl:y,containerId:v,hotKeys:k}=t;function T(S){let A=ro("Toastify__toast-container",`Toastify__toast-container--${S}`,{"Toastify__toast-container--rtl":y});return _i(g)?g({position:S,rtl:y,defaultClassName:A}):ro(A,rp(g))}function N(){r&&(i(!0),kt.play())}return qO(()=>{var S;if(r){let A=d.current.querySelectorAll('[data-in="true"]'),C=12,O=(S=t.position)==null?void 0:S.includes("top"),P=0,B=0;Array.from(A).reverse().forEach((V,z)=>{let U=V;U.classList.add("Toastify__toast--stacked"),z>0&&(U.dataset.collapsed=`${s}`),U.dataset.pos||(U.dataset.pos=O?"top":"bot");let J=P*(s?.2:1)+(s?0:C*z);U.style.setProperty("--y",`${O?J:J*-1}px`),U.style.setProperty("--g",`${C}`),U.style.setProperty("--s",`${1-(s?B:0)}`),P+=U.offsetHeight,B+=.025})}},[s,p,r]),j.useEffect(()=>{function S(A){var C;let O=d.current;k(A)&&((C=O.querySelector('[tabIndex="0"]'))==null||C.focus(),i(!1),kt.pause()),A.key==="Escape"&&(document.activeElement===O||O!=null&&O.contains(document.activeElement))&&(i(!0),kt.play())}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[k]),sa.createElement("section",{ref:d,className:"Toastify",id:v,onMouseEnter:()=>{r&&(i(!1),kt.pause())},onMouseLeave:N,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":t["aria-label"]},c((S,A)=>{let C=A.length?ne({},x):Se(ne({},x),{pointerEvents:"none"});return sa.createElement("div",{tabIndex:-1,className:T(S),"data-stacked":r,style:C,key:`c-${S}`},A.map(({content:O,props:P})=>sa.createElement(aM,Se(ne({},P),{stacked:r,collapseAll:N,isIn:f(P.toastId,P.containerId),key:`t-${P.key}`}),O)))}))}const sM=({doctype:e,docname:t,workflowState:r,onActionComplete:s,onStateChange:i,showStateInfo:d=!0,className:c=""})=>{const{transitions:f,loading:p,actionLoading:g,error:x,applyAction:y,getStateStyle:v,getButtonStyle:k,getIcon:T}=e4({doctype:e,docname:t,workflowState:r,enabled:!!t}),[N,S]=j.useState(null),A=["Reject","Cancel","Close"],C=B=>le(null,null,function*(){if(A.includes(B)&&N!==B){S(B);return}S(null);const V=yield y(B);s&&s(B,V),V&&i&&i()}),O=()=>{S(null)};if(!t)return null;const P=v(r||"Draft");return a.jsxs("div",{className:`space-y-4 ${c}`,children:[d&&r&&a.jsx("div",{className:`p-4 rounded-lg border ${P.bg} ${P.border}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),a.jsx("p",{className:`text-lg font-semibold ${P.text}`,children:r})]}),a.jsx("div",{className:`w-3 h-3 rounded-full ${P.bg.replace("100","500").replace("900/30","500")}`})]})}),p&&a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsx($r,{className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading workflow actions..."})]}),x&&a.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Xa,{className:"text-red-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:x})]})}),N&&a.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:[a.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[a.jsx(Xa,{className:"text-yellow-500 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),a.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",a.jsx("strong",{children:N})," this work order?"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>C(N),disabled:g,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:g?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx($r,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${N}`}),a.jsx("button",{onClick:O,disabled:g,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"})]})]}),!p&&f.length>0&&!N&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[a.jsx(Hd,{size:12}),"Available Actions"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((B,V)=>a.jsxs("button",{onClick:()=>C(B.action),disabled:g,className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center gap-2 ${k(B.action)}`,title:`Move to: ${B.next_state}`,children:[g?a.jsx($r,{className:"animate-spin",size:14}):a.jsx("span",{children:T(B.action)}),B.action]},`${B.action}-${V}`))}),a.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:f.map((B,V)=>a.jsxs("span",{className:"inline-block mr-3",children:[B.action," → ",a.jsx("span",{className:"font-medium",children:B.next_state})]},V))})]}),!p&&f.length===0&&t&&a.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available for your role"})})]})},iM="Service Report",qv=()=>new Date().toISOString().split("T")[0],lM=(e,t)=>{if(!e)return"";const r=new Date(e);return r.setDate(r.getDate()+t),r.toISOString().split("T")[0]},oM=()=>{var Rt,ia,et;const{workOrderName:e}=fl(),t=xa(),[r]=hl(),s=r.get("duplicate"),i=r.get("asset"),d=!!i,c=e==="new",f=c&&!!s,p=()=>{if(!e||c)return;const ze=`${zt.BASE_URL}/printview?doctype=Work_Order&name=${encodeURIComponent(e)}&format=${encodeURIComponent(iM)}&trigger_print=1`;window.open(ze,"_blank")||kt.warning("Please allow popups for this site to print the Service Report.",{position:"top-right",autoClose:5e3,icon:a.jsx(Xa,{})})},[g,x]=j.useState(!1),{workOrder:y,loading:v,error:k,refetch:T}=cS(f?s:c?null:e||null),{createWorkOrder:N,updateWorkOrder:S,loading:A}=M_(),[C,O]=j.useState(c),[P,B]=j.useState(!1),[V,z]=j.useState(null),[U,J]=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?qv():"",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}),de=U.asset_type==="Non Biomedical",ye=j.useCallback((pe,ze,st)=>{if(!pe)return"";let Ut=0;const la=st===1;return ze==="Normal"?Ut=la?30:5:ze==="Urgent"&&(Ut=la?30:1),lM(pe,Ut)},[]);j.useEffect(()=>{if(!C)return;const pe=ye(U.failure_date,U.custom_priority_||"Normal",U.need_procurement||0);pe&&pe!==U.custom_deadline_date&&J(ze=>Se(ne({},ze),{custom_deadline_date:pe}))},[U.failure_date,U.custom_priority_,U.need_procurement,C,ye]),j.useEffect(()=>{de&&C&&J(pe=>Se(ne({},pe),{asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}))},[de,C]);const{shouldShowField:ie,isMandatory:he,isReadOnly:ve}=Yw("Work_Order",U);j.useCallback(pe=>ie(pe),[ie]),j.useCallback(pe=>he(pe),[he]);const me=j.useCallback(pe=>ve(pe),[ve]);j.useCallback(pe=>C?me(pe):!0,[C,me]);const ee=j.useMemo(()=>{if(!c)return{asset_type:(y==null?void 0:y.asset_type)||U.asset_type||"",site_name:(y==null?void 0:y.site_name)||U.site_name||"",need_procurement:(y==null?void 0:y.need_procurement)||U.need_procurement||0,custom_assign_to_contractor:(y==null?void 0:y.custom_assign_to_contractor)||U.custom_assign_to_contractor||"",docstatus:(y==null?void 0:y.docstatus)||U.docstatus||0,company:(y==null?void 0:y.company)||U.company||"",department:(y==null?void 0:y.department)||U.department||"",repair_status:(y==null?void 0:y.repair_status)||U.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,U.asset_type,U.site_name,U.need_procurement,U.custom_assign_to_contractor,U.docstatus,U.company,U.department,U.repair_status]),{transitions:q,loading:Q,actionLoading:fe,error:ae,isSystemManager:F,applyAction:D,getStateStyle:H,getButtonStyle:Z,getIcon:K}=e4({doctype:"Work_Order",docname:c?null:e||null,workflowState:y==null?void 0:y.workflow_state,enabled:!c,docData:ee}),ue="Al Jouf Central Warehouse - AJH",[Le,Ne]=j.useState({}),We=(pe,ze)=>le(null,null,function*(){if(!pe||!ze)return 0;try{const st=yield rt.apiCall(`/api/resource/Bin?filters=[["item_code","=","${pe}"],["warehouse","=","${ze}"]]&fields=["actual_qty"]&limit=1`);return st!=null&&st.data&&st.data.length>0&&st.data[0].actual_qty||0}catch(st){return console.error("Error fetching available stock:",st),0}}),Fe=pe=>le(null,null,function*(){var ze;if(!pe)return 0;try{const st=yield rt.apiCall(`/api/resource/Item/${pe}?fields=["valuation_rate"]`);return((ze=st==null?void 0:st.data)==null?void 0:ze.valuation_rate)||0}catch(st){return console.error("Error fetching valuation rate:",st),0}}),tt=(pe,ze)=>le(null,null,function*(){const st=[...U.stock_items||[]];if(st[pe]=Se(ne({},st[pe]),{item_code:ze}),ze){const Ut=yield Fe(ze);if(st[pe].valuation_rate=Ut,st[pe].total_value=Ut*(st[pe].consumed_quantity||1),st[pe].warehouse){const la=yield We(ze,st[pe].warehouse);st[pe].custom_available_stock=la,Dt(pe,st[pe].consumed_quantity,la,ze,st[pe].warehouse)}}J(Se(ne({},U),{stock_items:st}))}),ft=(pe,ze)=>le(null,null,function*(){const st=[...U.stock_items||[]];if(st[pe]=Se(ne({},st[pe]),{warehouse:ze}),ze&&st[pe].item_code){const Ut=yield We(st[pe].item_code,ze);st[pe].custom_available_stock=Ut,Dt(pe,st[pe].consumed_quantity,Ut,st[pe].item_code,ze)}J(Se(ne({},U),{stock_items:st}))}),Dt=(pe,ze,st,Ut,la)=>{ze>st?(Ne(va=>Se(ne({},va),{[pe]:`Insufficient stock for ${Ut} in ${la}. Available: ${st}, Required: ${ze}`})),kt.warning(`Insufficient stock for ${Ut}. Available: ${st}, Required: ${ze}`,{position:"top-right",autoClose:5e3,icon:a.jsx(Xa,{}),toastId:`stock-warning-${pe}`})):Ne(va=>{const ar=ne({},va);return delete ar[pe],ar})},Ve=(pe,ze)=>{const st=[...U.stock_items||[]],Ut=st[pe].valuation_rate||0,la=st[pe].custom_available_stock||0;st[pe]=Se(ne({},st[pe]),{consumed_quantity:ze,total_value:Ut*ze}),st[pe].item_code&&st[pe].warehouse&&Dt(pe,ze,la,st[pe].item_code,st[pe].warehouse),J(Se(ne({},U),{stock_items:st}))},[At,jt]=j.useState({});j.useEffect(()=>{const pe={};U.company&&(pe.company=U.company),jt(pe)},[U.company]);const He=pe=>le(null,null,function*(){if(!pe)return null;try{B(!0);const ze=yield rt.apiCall(`/api/resource/Asset/${pe}`);return(ze==null?void 0:ze.data)||null}catch(ze){return console.error("Error fetching asset details:",ze),null}finally{B(!1)}}),oe=pe=>le(null,null,function*(){if(!pe)return null;try{B(!0);const ze=yield rt.apiCall(`/api/resource/Asset?filters=[["custom_serial_number","=","${pe}"]]&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","custom_team_leader","custom_moh_supervisor"]&limit=1`);return ze!=null&&ze.data&&ze.data.length>0?ze.data[0]:null}catch(ze){return console.error("Error fetching asset by serial number:",ze),null}finally{B(!1)}}),we=pe=>pe?pe.split(" ")[0]:"",Ie=pe=>{pe&&J(ze=>Se(ne({},ze),{asset:pe.name||ze.asset,asset_name:pe.asset_name||"",company:pe.company||"",department:pe.department||"",serial_number:pe.custom_serial_number||"",asset_type:pe.custom_asset_type||"",manufacturer:pe.custom_manufacturer||"",supplier:pe.supplier||"",custom_site_contractor:pe.custom_site_contractor||"",custom_subcontractor:pe.custom_subcontractor||"",model:pe.custom_model||"",site_name:pe.custom_site||"",custom_service_agreement:pe.custom_service_agreement||"",custom_service_coverage:pe.custom_service_coverage||"",custom_start_date:we(pe.custom_start_date)||"",custom_end_date:we(pe.custom_end_date)||"",custom_total_amount:pe.custom_total_amount||0,custom_assigned_supervisor:pe.custom_team_leader||"",custom_moh_supervisor:pe.custom_moh_supervisor||""}))},ot=pe=>le(null,null,function*(){if(J(ze=>Se(ne({},ze),{asset:pe})),pe){const ze=yield He(pe);ze&&Ie(ze)}else J(ze=>Se(ne({},ze),{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}))}),bt=()=>le(null,null,function*(){if(!U.serial_number){kt.warning("Please enter a serial number to search",{position:"top-right",autoClose:3e3,icon:a.jsx(Xa,{})});return}const pe=yield oe(U.serial_number);pe?(Ie(pe),kt.success(`Asset found: ${pe.asset_name||pe.name}`,{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})})):kt.error("No asset found with this serial number",{position:"top-right",autoClose:4e3,icon:a.jsx(vr,{})})}),qe=()=>le(null,null,function*(){if(U.serial_number&&!U.asset){const pe=yield oe(U.serial_number);pe&&Ie(pe)}});j.useEffect(()=>{if(c&&d&&!f){const pe={asset:r.get("asset")||"",asset_name:r.get("asset_name")||"",asset_type:r.get("asset_type")||"",manufacturer:r.get("manufacturer")||"",supplier:r.get("supplier")||"",serial_number:r.get("serial_number")||"",department:r.get("department")||"",custom_site_contractor:r.get("site_contractor")||"",custom_subcontractor:r.get("subcontractor")||"",company:r.get("company")||"",site_name:r.get("site_name")||"",custom_assigned_supervisor:r.get("team_leader")||"",custom_moh_supervisor:r.get("moh_supervisor")||""};J(ze=>Se(ne(ne({},ze),pe),{repair_status:"Open",workflow_state:"Draft",custom_priority_:"Normal",failure_date:qv()}))}},[c,d,f,r]),j.useEffect(()=>{y&&J({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 Ue=pe=>{const{name:ze,value:st}=pe.target;J(Ut=>Se(ne({},Ut),{[ze]:st}))},ht=pe=>{const ze=pe.target.value;J(st=>Se(ne({},st),{custom_priority_:ze}))},wt=pe=>{const ze=pe.target.value;J(st=>Se(ne({},st),{failure_date:ze}))},Mt=pe=>{const ze=pe.target.checked?1:0;J(st=>Se(ne({},st),{need_procurement:ze}))},Ft=pe=>{J(pe==="Non Biomedical"?ze=>Se(ne({},ze),{asset_type:pe,asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}):ze=>Se(ne({},ze),{asset_type:pe}))},je=pe=>le(null,null,function*(){if(pe.preventDefault(),!U.work_order_type){kt.error("Please select a Work Order Type",{position:"top-right",autoClose:4e3,icon:a.jsx(vr,{})});return}try{if(c||f){const ze=yield N(U),st=f?"Work order duplicated successfully!":d?"Work order created from asset successfully!":"Work order created successfully!";kt.success(st,{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),t(`/work-orders/${ze.name}`)}else e&&(yield S(e,U),kt.success("Work order updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),O(!1),T())}catch(ze){console.error("Work order save error:",ze);const st=ze instanceof Error?ze.message:"Unknown error",Ut=JSON.stringify(ze);st.includes("TimestampMismatchError")||st.includes("Document has been modified")||st.includes("Please refresh")||Ut.includes("TimestampMismatchError")?(kt.error("Document was modified by another user. Refreshing...",{position:"top-right",autoClose:4e3,icon:a.jsx(Xa,{})}),yield T(),kt.info("Please review the latest changes and try saving again.",{position:"top-right",autoClose:5e3,icon:a.jsx(Hd,{})})):kt.error(`Failed to save work order: ${st}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}});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(pe=>pe.json()).then(pe=>{var ze;(ze=pe.message)!=null&&ze.has_role&&x(!0)}).catch(pe=>console.error("Role check error:",pe))},[c]);const it=(pe,ze)=>le(null,null,function*(){if(["Reject","Cancel","Close"].includes(pe)&&(V==null?void 0:V.action)!==pe){z({action:pe,nextState:ze||""});return}z(null);const Ut=kt.loading(`Applying action "${pe}"...`,{position:"top-right"}),la=yield D(pe,ze);if(kt.dismiss(Ut),la)kt.success(`Action "${pe}" completed successfully!`,{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),T();else{const va=ae||"Please try again.";va.includes("TimestampMismatchError")||va.includes("Document has been modified")||va.includes("Please refresh")?(kt.error("Document was modified. Refreshing...",{position:"top-right",autoClose:4e3,icon:a.jsx(Xa,{})}),yield T(),kt.info("Please try the action again after reviewing the latest changes.",{position:"top-right",autoClose:5e3,icon:a.jsx(Hd,{})})):kt.error(`Failed to apply action "${pe}". ${va}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}});if(v)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work order details..."})]})});if(k&&!c&&!f)return a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",k]}),a.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 vt=()=>f?"Duplicate Work Order":d?"Create Work Order from Asset":c?"New Work Order":"Work Order Details",Bt=(y==null?void 0:y.workflow_state)||U.workflow_state||"Draft",De=H(Bt),ct=(ia=(Rt=y==null?void 0:y.docstatus)!=null?Rt:U.docstatus)!=null?ia:0,ut=(y==null?void 0:y.workflow_state)||U.workflow_state||"Draft",Nt=c||F&&ct===0||g&&ut==="Sent to Team Leader"||!Q&&q.length>0;return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsx(mh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:C0}),a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.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:[a.jsx(Ns,{}),a.jsx("span",{className:"text-gray-900 dark:text-white",children:vt()})]}),!c&&a.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${De.bg} ${De.text} ${De.border} border`,children:Bt}),d&&a.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:[a.jsx(Ng,{size:10}),"Linked from Asset: ",i]}),P&&a.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:[a.jsx($r,{className:"animate-spin",size:12}),"Loading asset details..."]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!c&&a.jsxs("button",{onClick:p,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:[a.jsx(so,{}),"Service Report"]}),!c&&!C&&Nt&&a.jsxs("button",{onClick:()=>{O(!0),kt.info("Edit mode enabled",{position:"top-right",autoClose:2e3,icon:a.jsx(Rr,{})})},className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[a.jsx(Rr,{}),"Edit"]}),C&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{c?t("/work-orders"):(O(!1),kt.info("Edit cancelled - changes discarded",{position:"top-right",autoClose:2e3,icon:a.jsx(vr,{})}))},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:A,children:"Cancel"}),a.jsxs("button",{onClick:je,disabled:A||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:[a.jsx(gr,{}),A?"Saving...":"Save Changes"]})]})]})]}),d&&c&&a.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:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ng,{className:"text-orange-500 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-orange-800 dark:text-orange-300",children:"Creating Work Order from Asset"}),a.jsxs("p",{className:"text-xs text-orange-700 dark:text-orange-400 mt-1",children:["Asset information has been pre-filled from ",a.jsx("strong",{children:U.asset_name||i}),". Please select a Work Order Type and add any additional details."]})]})]})}),a.jsx("form",{onSubmit:je,className:"space-y-6",style:{overflow:"visible"},children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",style:{overflow:"visible"},children:[a.jsxs("div",{className:"lg:col-span-3 space-y-6",style:{overflow:"visible"},children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Asset Information"}),d&&a.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:[a.jsx(Ng,{size:8}),"From Asset"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsx("div",{children:a.jsx(_t,{label:"Hospital",doctype:"Company",value:U.company||"",onChange:pe=>J(Se(ne({},U),{company:pe,department:""})),disabled:!C,filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(_t,{label:"Asset Type",doctype:"Asset Type",value:U.asset_type||"",onChange:Ft,disabled:!C})}),(de||((et=U.company)==null?void 0:et.startsWith("Mobile")))&&a.jsx("div",{children:a.jsx(_t,{label:"Site Name",doctype:"Mobile Team Site",value:U.site_name||"",onChange:pe=>J(Se(ne({},U),{site_name:pe})),disabled:!C})}),!de&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-[50]",children:[a.jsx(_t,{label:"Asset ID",doctype:"Asset",value:U.asset||"",onChange:ot,disabled:!C||P,filters:U.company?{company:U.company}:{}}),U.asset&&a.jsx("p",{className:"mt-1 text-xs text-green-600 dark:text-green-400",children:"✓ Asset details auto-populated"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Number"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",name:"serial_number",value:U.serial_number,onChange:Ue,onBlur:qe,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&&a.jsx("button",{type:"button",onClick:bt,disabled:P||!U.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:a.jsx(Ws,{size:14})})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Name"}),a.jsx("input",{type:"text",name:"asset_name",value:U.asset_name,onChange:Ue,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"})]}),a.jsx("div",{children:a.jsx(_t,{label:"Manufacturer",doctype:"Manufacturer",value:U.manufacturer||"",onChange:pe=>J(Se(ne({},U),{manufacturer:pe})),disabled:!C})}),a.jsx("div",{children:a.jsx(_t,{label:"Supplier",doctype:"Supplier",value:U.supplier||"",onChange:pe=>J(Se(ne({},U),{supplier:pe})),disabled:!C})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),a.jsx("input",{type:"text",name:"model",value:U.model,onChange:Ue,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"})]})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Order ID"}),a.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"})]}),a.jsx("div",{className:"relative z-[50]",children:a.jsx(_t,{label:"Work Order Type",doctype:"Issue Type",value:U.work_order_type||"",onChange:pe=>J(Se(ne({},U),{work_order_type:pe})),disabled:!C})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),a.jsxs("select",{name:"custom_priority_",value:U.custom_priority_,onChange:ht,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:[a.jsx("option",{value:"Normal",children:"Normal"}),a.jsx("option",{value:"Urgent",children:"Urgent"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),a.jsx("input",{type:"text",value:U.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Pending Reason"}),a.jsxs("select",{name:"custom_pending_reason",value:U.custom_pending_reason||"",onChange:Ue,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:[a.jsx("option",{value:"",children:"Select Pending Reason"}),a.jsx("option",{value:"Need Part",children:"Need Part"}),a.jsx("option",{value:"Waiting For Quotation",children:"Waiting For Quotation"}),a.jsx("option",{value:"Waiting For PO",children:"Waiting For PO"}),a.jsx("option",{value:"Waiting For Part Delivery",children:"Waiting For Part Delivery"})]})]}),a.jsx("div",{className:"flex items-center",children:a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:U.need_procurement===1,onChange:Mt,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"}),a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Need Procurement"})]})})]})]}),!de&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),a.jsx("input",{type:"text",name:"custom_site_contractor",value:U.custom_site_contractor,onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subcontractor"}),a.jsx("input",{type:"text",name:"custom_subcontractor",value:U.custom_subcontractor,onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),a.jsxs("select",{name:"custom_service_agreement",value:U.custom_service_agreement||"",onChange:Ue,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:[a.jsx("option",{value:"",children:"Select Service Agreement"}),a.jsx("option",{value:"Warranty",children:"Warranty"}),a.jsx("option",{value:"Contract",children:"Contract"}),a.jsx("option",{value:"Frame Work",children:"Frame Work"}),a.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),a.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),a.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),a.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),a.jsxs("select",{name:"custom_service_coverage",value:U.custom_service_coverage||"",onChange:Ue,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:[a.jsx("option",{value:"",children:"Select Service Coverage"}),a.jsx("option",{value:"PM Only",children:"PM Only"}),a.jsx("option",{value:"Labour",children:"Labour"}),a.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),a.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),a.jsx("input",{type:"date",name:"custom_start_date",value:U.custom_start_date||"",onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),a.jsx("input",{type:"date",name:"custom_end_date",value:U.custom_end_date||"",onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),a.jsx("input",{type:"number",name:"custom_total_amount",min:"0",step:"0.01",value:U.custom_total_amount||0,onChange:Ue,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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Nature of Complaint"}),a.jsx("textarea",{name:"description",value:U.description,onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Performed"}),a.jsx("textarea",{name:"actions_performed",value:U.actions_performed,onChange:Ue,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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsx("div",{children:a.jsx(_t,{label:"MOH Supervisor",doctype:"User",value:U.custom_moh_supervisor||"",onChange:pe=>J(Se(ne({},U),{custom_moh_supervisor:pe})),disabled:!C})}),a.jsx("div",{children:a.jsx(_t,{label:"Team Leader",doctype:"User",value:U.custom_assigned_supervisor||"",onChange:pe=>J(Se(ne({},U),{custom_assigned_supervisor:pe})),disabled:!C})}),a.jsx("div",{children:a.jsx(_t,{label:"Assigned Technician",doctype:"User",value:U.custom_assign_to_contractor||"",onChange:pe=>J(Se(ne({},U),{custom_assign_to_contractor:pe})),disabled:!C})}),a.jsx("div",{children:a.jsx(_t,{label:"Department",doctype:"Department",value:U.department||"",onChange:pe=>J(Se(ne({},U),{department:pe})),disabled:!C,filters:At})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Failure Date"}),a.jsx("input",{type:"date",name:"failure_date",value:U.failure_date,onChange:wt,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"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Deadline Date",a.jsx("span",{className:"ml-1 text-xs text-gray-400",children:"(Auto-calculated)"})]}),a.jsx("input",{type:"date",name:"custom_deadline_date",value:U.custom_deadline_date,onChange:Ue,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&&U.failure_date&&a.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[U.custom_priority_==="Urgent"?"Urgent":"Normal"," priority",U.need_procurement===1?" + Procurement":"",":"," ","+",U.need_procurement===1?30:U.custom_priority_==="Urgent"?1:5," days"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours Spent"}),a.jsx("input",{type:"number",name:"total_hours_spent",min:"0",step:"0.5",value:U.total_hours_spent||0,onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"First Responded On"}),a.jsx("input",{type:"date",name:"first_responded_on",value:U.first_responded_on,onChange:Ue,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),a.jsx("input",{type:"date",name:"completion_date",value:U.completion_date,onChange:Ue,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"})]})]})]}),a.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:[a.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"}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:U.stock_consumption===1,onChange:pe=>{var ze;J(Se(ne({},U),{stock_consumption:pe.target.checked?1:0,stock_items:pe.target.checked?(ze=U.stock_items)!=null&&ze.length?U.stock_items:[{item_code:"",warehouse:ue,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"}),a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Parts Consumed"})]}),a.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"})]}),U.stock_consumption===1&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Stock Items"}),C&&a.jsxs("button",{type:"button",onClick:()=>{J(Se(ne({},U),{stock_items:[...U.stock_items||[],{item_code:"",warehouse:ue,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]})),kt.info("New stock item row added",{position:"top-right",autoClose:2e3,icon:a.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:[a.jsx(ts,{size:10}),"Add Item"]})]}),a.jsx("div",{className:"stock-items-table-wrapper",children:a.jsx("div",{className:"stock-items-scroll-container",children:a.jsxs("table",{className:"w-full text-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:[a.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:a.jsxs("tr",{children:[a.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:"#"}),a.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 ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.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"}),a.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 ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.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"}),a.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"}),a.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&&a.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"})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(U.stock_items||[]).length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:C?8:7,className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:[a.jsx("p",{children:"No items added yet"}),C&&a.jsx("button",{type:"button",onClick:()=>{J(Se(ne({},U),{stock_items:[{item_code:"",warehouse:ue,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"})]})}):(U.stock_items||[]).map((pe,ze)=>a.jsxs(sa.Fragment,{children:[a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${Le[ze]?"bg-red-50 dark:bg-red-900/20":""}`,children:[a.jsx("td",{className:"px-3 py-3 text-gray-500 dark:text-gray-400",children:ze+1}),a.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-ze},children:a.jsx("div",{className:"relative",children:a.jsx(_t,{label:"",doctype:"Item",value:pe.item_code,onChange:st=>tt(ze,st),disabled:!C,placeholder:"Select Item",compact:!0,usePortal:!0,filters:ne({is_stock_item:1},U.company?{custom_hospital_name:U.company}:{})})})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"0",step:"0.01",value:pe.valuation_rate||0,onChange:st=>{const Ut=[...U.stock_items||[]],la=parseFloat(st.target.value)||0,va=Ut[ze].consumed_quantity||0;Ut[ze]=Se(ne({},Ut[ze]),{valuation_rate:la,total_value:la*va}),J(Se(ne({},U),{stock_items:Ut}))},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"})}),a.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-ze},children:a.jsx("div",{className:"relative",children:a.jsx(_t,{label:"",doctype:"Warehouse",value:pe.warehouse,onChange:st=>ft(ze,st),disabled:!C,placeholder:"Select Warehouse",compact:!0,usePortal:!0})})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"1",value:pe.consumed_quantity||1,onChange:st=>Ve(ze,parseInt(st.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 ${Le[ze]?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"}`})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"0",value:pe.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"})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"0",step:"0.01",value:pe.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&&a.jsx("td",{className:"px-3 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>{var la;const st=(la=U.stock_items)==null?void 0:la[ze],Ut=(U.stock_items||[]).filter((va,ar)=>ar!==ze);J(Se(ne({},U),{stock_items:Ut})),Ne(va=>{const ar=ne({},va);return delete ar[ze],ar}),kt.warning(`Stock item ${(st==null?void 0:st.item_code)||"row"} removed`,{position:"top-right",autoClose:2e3,icon:a.jsx(ma,{})})},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:a.jsx(ma,{size:14})})})]}),Le[ze]&&a.jsx("tr",{className:"bg-red-50 dark:bg-red-900/30",children:a.jsx("td",{colSpan:C?8:7,className:"px-4 py-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs",children:[a.jsx(Xa,{}),a.jsx("span",{children:Le[ze]})]})})})]},ze))})]})})}),(U.stock_items||[]).length>0&&a.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:[a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Items: ",a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(U.stock_items||[]).length})]}),a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Qty: ",a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(U.stock_items||[]).reduce((pe,ze)=>pe+(ze.consumed_quantity||0),0)})]}),a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Value: ",a.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:(U.stock_items||[]).reduce((pe,ze)=>pe+(ze.total_value||0),0).toFixed(2)})]})]})]}),a.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Repair Cost"}),a.jsx("input",{type:"number",name:"total_repair_cost",min:"0",step:"0.01",value:U.total_repair_cost||0,onChange:Ue,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"})]})})})]})]}),a.jsxs("div",{className:"space-y-6",children:[!c&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.jsx("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:a.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Workflow Actions"})}),a.jsxs("div",{className:`p-4 rounded-lg border mb-4 ${De.bg} ${De.border}`,children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current State"}),a.jsx("p",{className:`text-lg font-semibold ${De.text}`,children:Bt})]}),Q&&a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-4",children:[a.jsx($r,{className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading actions..."})]}),ae&&a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Xa,{className:"text-red-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:ae})]})}),V&&a.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:[a.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[a.jsx(Xa,{className:"text-yellow-500 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),a.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",a.jsx("strong",{children:V.action})," this work order?"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>it(V.action,V.nextState),disabled:fe,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:fe?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx($r,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${V.action}`}),a.jsx("button",{onClick:()=>z(null),disabled:fe,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"})]})]}),!Q&&q.length>0&&!V&&a.jsxs("div",{className:"space-y-3",children:[F&&a.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:a.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[a.jsx("strong",{children:"System Manager:"})," Showing all valid actions for this state (conditions evaluated)."]})}),a.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[a.jsx(Hd,{size:12}),"Available Actions (",q.length,")"]}),a.jsx("div",{className:"flex flex-col gap-2",children:q.map((pe,ze)=>a.jsxs("button",{onClick:()=>it(pe.action,pe.next_state),disabled:fe,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 ${Z(pe.action)}`,children:[fe?a.jsx($r,{className:"animate-spin",size:14}):a.jsx("span",{children:K(pe.action)}),pe.action]},`${pe.action}-${pe.next_state}-${ze}`))}),a.jsxs("div",{className:"mt-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Action Results:"}),q.map((pe,ze)=>a.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:[pe.action," → ",a.jsx("span",{className:"font-medium",children:pe.next_state})]},ze))]})]}),!Q&&q.length===0&&a.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available"}),a.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)"})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Repair Status"}),a.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:y.repair_status||"Open"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Priority"}),a.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:y.custom_priority_||"Normal"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:y.creation?new Date(y.creation).toLocaleString():"-"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:y.modified?new Date(y.modified).toLocaleString():"-"})]})]}),c&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Hd,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]})]})]})}),a.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;
}
`})]})},cM=()=>{const{t:e}=Va(),t=xa(),[r,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(""),[p,g]=j.useState(null),[x,y]=j.useState(null),v=j.useRef(null),k=20,T=c?{maintenance_status:c}:{},{logs:N,totalCount:S,hasMore:A,loading:C,error:O,refetch:P}=Gf(T,k,r*k,"due_date asc"),{deleteLog:B,loading:V}=L_();j.useEffect(()=>{const fe=ae=>{v.current&&!v.current.contains(ae.target)&&y(null)};return x&&document.addEventListener("mousedown",fe),()=>{document.removeEventListener("mousedown",fe)}},[x]);const z=()=>{t("/maintenance/new")},U=fe=>{t(`/maintenance/${fe}`)},J=fe=>{t(`/maintenance/${fe}`)},de=fe=>le(null,null,function*(){try{yield B(fe),g(null),P(),alert("Maintenance log deleted successfully!")}catch(ae){alert(`Failed to delete: ${ae instanceof Error?ae.message:"Unknown error"}`)}}),ye=fe=>{t(`/maintenance/new?duplicate=${fe}`)},ie=fe=>{const ae=JSON.stringify(fe,null,2),F=new Blob([ae],{type:"application/json"}),D=URL.createObjectURL(F),H=document.createElement("a");H.href=D,H.download=`maintenance_${fe.name}.json`,H.click(),URL.revokeObjectURL(D)},he=fe=>{window.open(`/maintenance/${fe}?print=true`,"_blank")},ve=()=>{const ae=[["Log ID","Asset","Type","Status","Due Date","Assigned To"].join(","),...N.map(Z=>[Z.name,Z.asset_name||"",Z.maintenance_type||"",Z.maintenance_status||"",Z.due_date||"",Z.assign_to_name||""].join(","))].join(`
`),F=new Blob([ae],{type:"text/csv"}),D=URL.createObjectURL(F),H=document.createElement("a");H.href=D,H.download=`maintenance_logs_${new Date().toISOString().split("T")[0]}.csv`,H.click(),URL.revokeObjectURL(D)},me=fe=>{switch(fe==null?void 0:fe.toLowerCase()){case"completed":return a.jsx(Ha,{className:"text-green-500"});case"planned":return a.jsx(I_,{className:"text-blue-500"});case"overdue":return a.jsx(Xa,{className:"text-red-500"});default:return a.jsx(ol,{className:"text-gray-400"})}},ee=fe=>{switch(fe==null?void 0:fe.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"}},q=(fe,ae)=>!fe||(ae==null?void 0:ae.toLowerCase())==="completed"?!1:new Date(fe)<new Date;if(C&&r===0)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})});if(O)return a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Maintenance API Not Available"}),a.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"The Asset Maintenance API endpoint is not deployed yet."})}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.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)"}),a.jsx("button",{onClick:P,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),a.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"Technical Error:"})," ",O]})})]})});const Q=N.filter(fe=>{var ae,F,D;return((ae=fe.name)==null?void 0:ae.toLowerCase().includes(i.toLowerCase()))||((F=fe.asset_name)==null?void 0:F.toLowerCase().includes(i.toLowerCase()))||((D=fe.task_name)==null?void 0:D.toLowerCase().includes(i.toLowerCase()))});return a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("maintenance.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[e("listPages.total"),": ",S," ",e("maintenance.maintenanceLogs")]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:ve,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:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:e("listPages.exportAllOnPage")})]}),a.jsxs("button",{onClick:z,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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:e("maintenance.addMaintenance")})]})]})]}),a.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:a.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:[a.jsx(Ws,{className:"text-gray-400 dark:text-gray-500"}),a.jsx("input",{type:"text",placeholder:e("listPages.searchPlaceholder"),value:i,onChange:fe=>d(fe.target.value),className:"flex-1 outline-none text-gray-700 dark:text-gray-200 bg-transparent"})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:a.jsxs("select",{value:c,onChange:fe=>{f(fe.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:[a.jsx("option",{value:"",children:e("listPages.allStatuses")}),a.jsx("option",{value:"Planned",children:"Planned"}),a.jsx("option",{value:"Completed",children:"Completed"}),a.jsx("option",{value:"Overdue",children:"Overdue"}),a.jsx("option",{value:"Cancelled",children:"Cancelled"})]})})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("maintenance.logId")}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.assetShort")}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.typeShort")}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("ppm.dueDate")}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.status")}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("listPages.actions")})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:Q.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Ws,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:e("listPages.noMaintenanceLogsFound")}),a.jsx("button",{onClick:z,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:e("listPages.createFirstMaintenanceLog")})]})})}):Q.map(fe=>{const ae=q(fe.due_date||"",fe.maintenance_status||"");return a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${ae?"bg-red-50 dark:bg-red-900/10":""}`,onClick:()=>U(fe.name),children:[a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:fe.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:fe.creation?new Date(fe.creation).toLocaleDateString():""})]}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:fe.asset_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:fe.custom_asset_type||""})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:fe.maintenance_type||"-"}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[a.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:fe.due_date?new Date(fe.due_date).toLocaleDateString():"-"}),ae&&a.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 font-semibold",children:"Overdue"})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[me(fe.maintenance_status||""),a.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${ee(fe.maintenance_status||"")}`,children:fe.maintenance_status||"Unknown"})]})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:F=>F.stopPropagation(),children:[a.jsx("button",{onClick:()=>U(fe.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:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>J(fe.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:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>ye(fe.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:a.jsx(Cc,{})}),a.jsx("button",{onClick:()=>g(fe.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:V,children:a.jsx(ma,{})}),a.jsxs("div",{className:"relative",ref:x===fe.name?v:null,children:[a.jsx("button",{onClick:()=>y(x===fe.name?null:fe.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:a.jsx(g0,{})}),x===fe.name&&a.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:[a.jsxs("button",{onClick:()=>{ie(fe),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:[a.jsx(wi,{className:"text-blue-500"}),"Export as JSON"]}),a.jsxs("button",{onClick:()=>{he(fe.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:[a.jsx(so,{className:"text-purple-500"}),"Print Log"]})]})]})]})})]},fe.name)})})]})}),Q.length>0&&a.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:[a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a.jsx("span",{className:"font-medium",children:r*k+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((r+1)*k,S)})," ","of ",a.jsx("span",{className:"font-medium",children:S})," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{disabled:r===0,onClick:()=>s(r-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"}),a.jsx("button",{disabled:!A,onClick:()=>s(r+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"})]})]})]}),p&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Maintenance Log"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Log ID:"})," ",p]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>g(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:V,children:"Cancel"}),a.jsx("button",{onClick:()=>de(p),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:V,children:V?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ma,{}),"Delete Log"]})})]})]})]})})})]})},dM=rt,uM=({message:e,type:t,onClose:r})=>{j.useEffect(()=>{const i=setTimeout(r,1e4);return()=>clearTimeout(i)},[r]);const s=t==="warning"?"bg-yellow-500":t==="success"?"bg-green-500":"bg-red-500";return a.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:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Xa,{className:"mt-0.5 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:e}),a.jsx("button",{onClick:r,className:"ml-2 text-white hover:text-gray-200",children:a.jsx(xt,{})})]})})},fM=()=>{const{t:e}=Va(),{logName:t}=fl(),r=xa(),[s]=hl(),i=s.get("duplicate"),d=t==="new",c=d&&!!i,{log:f,loading:p,error:g}=uS(c?i:d?null:t||null),{createLog:x,updateLog:y,loading:v}=L_(),k=(f==null?void 0:f.workflow_state)==="Approved",[T,N]=j.useState(d),[S,A]=j.useState([]),[C,O]=j.useState(null),[P,B]=j.useState(!1),[V,z]=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:""}),U=j.useCallback((ae,F,D)=>{if(D!=="Completed"){z(ue=>Se(ne({},ue),{custom_early_completion:""}));return}if(!ae||!F)return;const H=new Date(ae),Z=new Date(F),K=new Date(H.getFullYear(),H.getMonth(),1);if(Z<K){z(Ne=>Se(ne({},Ne),{custom_early_completion:"Yes"}));const ue=Z.toLocaleDateString(),Le=H.toLocaleDateString();O({message:`⚠️ Warning: Completion Date (${ue}) is before the Due Date Month (${Le}). Please verify.`,type:"warning"})}},[]),J=j.useCallback(ae=>le(null,null,function*(){var F;if(ae){B(!0);try{const D=yield dM.apiCall(`/api/resource/PPM Templates/${encodeURIComponent(ae)}`,"GET");if((F=D==null?void 0:D.data)!=null&&F.ppm_template_table&&Array.isArray(D.data.ppm_template_table)){const H=D.data.ppm_template_table.map((Z,K)=>({idx:K+1,maintenance_name:Z.maintenance_name||"",working:0,defect_found:0,not_working:0}));A(H)}}catch(D){console.error("Error loading PPM template:",D),O({message:"Failed to load PPM template. Please add items manually.",type:"error"})}finally{B(!1)}}}),[]);j.useEffect(()=>{f&&(f.workflow_state==="Approved"&&N(!1),z({asset_name:f.asset_name||"",custom_asset_type:f.custom_asset_type||"",item_code:f.item_code||"",item_name:f.item_name||"",custom_asset_names:f.custom_asset_names||"",custom_hospital_name:f.custom_hospital_name||"",task:f.task||"",task_name:f.task_name||"",maintenance_type:f.maintenance_type||"Preventive Maintenance",periodicity:f.periodicity||"",has_certificate:f.has_certificate||0,custom_early_completion:c?"":f.custom_early_completion||"",maintenance_status:c?"Planned":f.maintenance_status||"Planned",custom_accepted_by_moh:f.custom_accepted_by_moh||0,assign_to_name:f.assign_to_name||"",due_date:f.due_date||"",completion_date:c?"":f.completion_date||"",custom_early_completion_reason:c?"":f.custom_early_completion_reason||"",custom_accepted_by_moh_:f.custom_accepted_by_moh_||0,custom_template:f.custom_template||"",custom_table:f.custom_table||[],description:f.description||""}),f.custom_table&&Array.isArray(f.custom_table)&&f.custom_table.length>0?A(f.custom_table.map((ae,F)=>({name:ae.name,idx:ae.idx||F+1,maintenance_name:ae.maintenance_name||"",working:ae.working||0,defect_found:ae.defect_found||0,not_working:ae.not_working||0}))):f.custom_template&&(!f.custom_table||f.custom_table.length===0)&&J(f.custom_template))},[f,c,J]),j.useEffect(()=>{V.completion_date&&V.due_date&&U(V.due_date,V.completion_date,V.maintenance_status)},[V.completion_date,V.due_date,V.maintenance_status,U]);const de=ae=>{const{name:F,value:D,type:H}=ae.target,Z=ae.target.checked;z(K=>Se(ne({},K),{[F]:H==="checkbox"?Z?1:0:D}))},ye=ae=>{const F=ae.target.value;z(D=>Se(ne({},D),{maintenance_status:F})),F==="Completed"?U(V.due_date||"",V.completion_date||"",F):z(D=>Se(ne({},D),{custom_early_completion:""}))},ie=ae=>{const F=ae.target.value;z(D=>Se(ne({},D),{completion_date:F})),V.maintenance_status==="Completed"&&U(V.due_date||"",F,V.maintenance_status)},he=ae=>le(null,null,function*(){const F=ae.target.value;z(D=>Se(ne({},D),{custom_template:F})),(F&&S.length===0||F&&S.length>0&&window.confirm("Loading a template will replace existing checklist items. Continue?"))&&J(F)}),ve=()=>{const ae={idx:S.length+1,maintenance_name:"",working:0,defect_found:0,not_working:0};A([...S,ae])},me=ae=>{const F=S.filter((D,H)=>H!==ae).map((D,H)=>Se(ne({},D),{idx:H+1}));A(F)},ee=(ae,F,D)=>{const H=[...S];H[ae]=Se(ne({},H[ae]),{[F]:D}),A(H)},q=ae=>le(null,null,function*(){if(ae.preventDefault(),!V.asset_name){alert("Please enter Asset Name");return}if(!V.maintenance_type){alert("Please select Maintenance Type");return}const F=S.map((H,Z)=>{const K={idx:H.idx||Z+1,maintenance_name:H.maintenance_name||"",working:H.working?1:0,defect_found:H.defect_found?1:0,not_working:H.not_working?1:0};return H.name&&typeof H.name=="string"&&H.name.trim()!==""&&(K.name=H.name),K}),D=Se(ne({},V),{custom_table:F});console.log("Submitting maintenance log data:",D);try{if(d||c){const H=yield x(D);alert(c?"Maintenance log duplicated successfully!":"Maintenance log created successfully!"),r(`/maintenance/${H.name}`)}else t&&(yield y(t,D),alert("Maintenance log updated successfully!"),N(!1))}catch(H){console.error("Maintenance log save error:",H),alert("Failed to save: "+(H instanceof Error?H.message:"Unknown error"))}}),Q=ae=>({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"})[ae]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",fe=ae=>({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"})[ae]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";return p?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance log..."})]})}):g&&!d&&!c?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",g]}),a.jsx("button",{onClick:()=>r("/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"})]})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[C&&a.jsx(uM,{message:C.message,type:C.type,onClose:()=>O(null)}),a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("button",{onClick:()=>r("/maintenance"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[a.jsx(Ns,{}),a.jsx("span",{className:"text-gray-900 dark:text-white font-semibold",children:c?"Duplicate Maintenance Log":d?"New Maintenance Log":"Maintenance Log Details"})]}),!d&&(f==null?void 0:f.workflow_state)&&a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${Q(f.workflow_state)}`,children:f.workflow_state})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!d&&!T&&!k&&a.jsxs("button",{onClick:()=>N(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[a.jsx(Rr,{}),"Edit"]}),T&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{d?r("/maintenance"):N(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:v,children:"Cancel"}),a.jsxs("button",{onClick:q,disabled:v,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:[a.jsx(gr,{}),v?"Saving...":"Save Changes"]})]})]})]}),a.jsx("form",{onSubmit:q,className:"space-y-6",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Log ID"}),a.jsx("input",{type:"text",value:d||c?"Auto-generated":(f==null?void 0:f.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"}),c&&a.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",i]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Hospital"}),a.jsx("input",{type:"text",name:"custom_hospital_name",value:V.custom_hospital_name||"",onChange:de,disabled:!T,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"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"asset_name",value:V.asset_name,onChange:de,required:!0,disabled:!T,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Display Name"}),a.jsx("input",{type:"text",name:"custom_asset_names",value:V.custom_asset_names||"",onChange:de,disabled:!T,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Type"}),a.jsx("input",{type:"text",name:"custom_asset_type",value:V.custom_asset_type||"",onChange:de,disabled:!T,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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Maintenance Type ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("select",{name:"maintenance_type",value:V.maintenance_type,onChange:de,required:!0,disabled:!T,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:[a.jsx("option",{value:"Preventive Maintenance",children:"Preventive Maintenance"}),a.jsx("option",{value:"Corrective Maintenance",children:"Corrective Maintenance"}),a.jsx("option",{value:"Calibration",children:"Calibration"}),a.jsx("option",{value:"Inspection",children:"Inspection"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Periodicity"}),a.jsxs("select",{name:"periodicity",value:V.periodicity||"",onChange:de,disabled:!T,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:[a.jsx("option",{value:"",children:"Select periodicity"}),a.jsx("option",{value:"Daily",children:"Daily"}),a.jsx("option",{value:"Weekly",children:"Weekly"}),a.jsx("option",{value:"Monthly",children:"Monthly"}),a.jsx("option",{value:"Quarterly",children:"Quarterly"}),a.jsx("option",{value:"Half Yearly",children:"Half Yearly"}),a.jsx("option",{value:"Yearly",children:"Yearly"}),a.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),a.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Template",P&&a.jsx("span",{className:"ml-2 text-blue-500",children:"(Loading...)"})]}),a.jsx("input",{type:"text",name:"custom_template",value:V.custom_template||"",onChange:he,disabled:!T,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"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Enter template name to auto-load checklist items"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),a.jsxs("select",{name:"maintenance_status",value:V.maintenance_status,onChange:ye,disabled:!T,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:[a.jsx("option",{value:"Planned",children:"Planned"}),a.jsx("option",{value:"Completed",children:"Completed"}),a.jsx("option",{value:"Overdue",children:"Overdue"}),a.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Assigned To"}),a.jsx("input",{type:"text",name:"assign_to_name",value:V.assign_to_name||"",onChange:de,disabled:!T,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Due Date"}),a.jsx("input",{type:"date",name:"due_date",value:V.due_date||"",onChange:de,disabled:!T,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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),a.jsx("input",{type:"date",name:"completion_date",value:V.completion_date||"",onChange:ie,disabled:!T,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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion",V.custom_early_completion==="Yes"&&a.jsx("span",{className:"ml-2 text-yellow-500",children:"⚠️ Auto-detected"})]}),a.jsx("input",{type:"text",value:V.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"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Auto-set based on completion date vs due date"})]}),V.custom_early_completion==="Yes"&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion Reason ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"custom_early_completion_reason",value:V.custom_early_completion_reason||"",onChange:de,disabled:!T,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"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"checkbox",name:"custom_accepted_by_moh",checked:!!V.custom_accepted_by_moh,onChange:de,disabled:!T,className:"w-4 h-4 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),a.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:"Accepted by MOH"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h2",{className:"text-base font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[a.jsx(OS,{}),"PPM Checklist Table",P&&a.jsx("span",{className:"text-sm text-blue-500 font-normal",children:"(Loading template...)"})]}),T&&a.jsxs("button",{type:"button",onClick:ve,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:[a.jsx(ts,{className:"text-xs"}),"Add Row"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-50 dark:bg-gray-700",children:[a.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-12",children:"#"}),a.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300",children:"Maintenance Task"}),a.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-green-600 dark:text-green-400 w-24",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(z_,{})," Working"]})}),a.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-yellow-600 dark:text-yellow-400 w-28",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Xa,{})," Defect"]})}),a.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-red-600 dark:text-red-400 w-28",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(xt,{})," Not Working"]})}),T&&a.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-16",children:"Action"})]})}),a.jsx("tbody",{children:S.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:T?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:["No checklist items. ",T&&'Enter a template name above or click "Add Row" to add items.']})}):S.map((ae,F)=>a.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[a.jsx("td",{className:"py-3 px-3 text-sm text-gray-600 dark:text-gray-400",children:ae.idx||F+1}),a.jsx("td",{className:"py-3 px-3",children:T?a.jsx("input",{type:"text",value:ae.maintenance_name,onChange:D=>ee(F,"maintenance_name",D.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"}):a.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:ae.maintenance_name})}),a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("input",{type:"checkbox",checked:!!ae.working,onChange:D=>ee(F,"working",D.target.checked?1:0),disabled:!T,className:"w-5 h-5 text-green-600 rounded focus:ring-2 focus:ring-green-500 cursor-pointer disabled:cursor-default"})}),a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("input",{type:"checkbox",checked:!!ae.defect_found,onChange:D=>ee(F,"defect_found",D.target.checked?1:0),disabled:!T,className:"w-5 h-5 text-yellow-600 rounded focus:ring-2 focus:ring-yellow-500 cursor-pointer disabled:cursor-default"})}),a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("input",{type:"checkbox",checked:!!ae.not_working,onChange:D=>ee(F,"not_working",D.target.checked?1:0),disabled:!T,className:"w-5 h-5 text-red-600 rounded focus:ring-2 focus:ring-red-500 cursor-pointer disabled:cursor-default"})}),T&&a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>me(F),className:"text-red-500 hover:text-red-700 p-1",title:"Remove row",children:a.jsx(ma,{})})})]},ae.name||F))})]})})]})]}),a.jsxs("div",{className:"space-y-6",children:[!d&&f&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsx(sM,{doctype:"Asset Maintenance Log",docname:f.name||null,workflowState:f.workflow_state,showStateInfo:!1,onActionComplete:(ae,F)=>{F&&console.log(`Action "${ae}" completed successfully`)},onStateChange:()=>{window.location.reload()}})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),!d&&f?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current Status"}),a.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${fe(V.maintenance_status)}`,children:V.maintenance_status||"Planned"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),a.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${Q(f.workflow_state||"Draft")}`,children:f.workflow_state||"Draft"})]}),V.custom_early_completion==="Yes"&&a.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[a.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mb-1",children:"⚠️ Early Completion"}),a.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 font-medium",children:"Completion date is before the due month"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Due Date"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:V.due_date?new Date(V.due_date).toLocaleDateString():"Not set"}),V.due_date&&new Date(V.due_date)<new Date&&V.maintenance_status!=="Completed"&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 font-semibold mt-1",children:"⚠️ Overdue"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Completion Date"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:V.completion_date?new Date(V.completion_date).toLocaleDateString():"Not completed"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Assigned To"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:V.assign_to_name||"Unassigned"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM Checklist"}),a.jsxs("p",{className:"text-sm text-gray-900 dark:text-white",children:[S.length," item(s)"]}),S.length>0&&a.jsxs("div",{className:"mt-2 text-xs space-y-1",children:[a.jsxs("p",{className:"text-green-600 dark:text-green-400",children:["✓ Working: ",S.filter(ae=>ae.working).length]}),a.jsxs("p",{className:"text-yellow-600 dark:text-yellow-400",children:["⚠ Defects: ",S.filter(ae=>ae.defect_found).length]}),a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["✗ Not Working: ",S.filter(ae=>ae.not_working).length]})]})]})]}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx(ol,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]}),!d&&f&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created By"}),a.jsx("p",{className:"text-gray-900 dark:text-white",children:f.owner||"-"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created On"}),a.jsx("p",{className:"text-gray-900 dark:text-white",children:f.creation?new Date(f.creation).toLocaleString():"-"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified By"}),a.jsx("p",{className:"text-gray-900 dark:text-white",children:f.modified_by||"-"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified On"}),a.jsx("p",{className:"text-gray-900 dark:text-white",children:f.modified?new Date(f.modified).toLocaleString():"-"})]})]})]})]})]})})]})};class hM{getAssetMaintenances(t,r,s=20,i=0,d){return le(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),r&&r.length>0&&c.append("fields",JSON.stringify(r)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${zt.ENDPOINTS.GET_ASSET_MAINTENANCES}?${c.toString()}`;return rt.apiCall(f)})}getAssetMaintenanceDetails(t){return le(this,null,function*(){const r=new URLSearchParams;r.append("maintenance_name",t);const s=`${zt.ENDPOINTS.GET_ASSET_MAINTENANCE_DETAILS}?${r.toString()}`;return rt.apiCall(s)})}createAssetMaintenance(t){return le(this,null,function*(){const r=`${zt.ENDPOINTS.CREATE_ASSET_MAINTENANCE}`;return rt.apiCall(r,{method:"POST",body:JSON.stringify({maintenance_data:JSON.stringify(t)})})})}updateAssetMaintenance(t,r){return le(this,null,function*(){const s=`${zt.ENDPOINTS.UPDATE_ASSET_MAINTENANCE}`;return rt.apiCall(s,{method:"POST",body:JSON.stringify({maintenance_name:t,maintenance_data:JSON.stringify(r)})})})}deleteAssetMaintenance(t){return le(this,null,function*(){const r=`${zt.ENDPOINTS.DELETE_ASSET_MAINTENANCE}`;return rt.apiCall(r,{method:"POST",body:JSON.stringify({maintenance_name:t})})})}getMaintenanceTasks(t){return le(this,null,function*(){const r=new URLSearchParams;r.append("maintenance_name",t);const s=`${zt.ENDPOINTS.GET_MAINTENANCE_TASKS}?${r.toString()}`;return rt.apiCall(s)})}getServiceCoverage(t){return le(this,null,function*(){const r=new URLSearchParams;r.append("maintenance_name",t);const s=`${zt.ENDPOINTS.GET_SERVICE_COVERAGE}?${r.toString()}`;return rt.apiCall(s)})}getMaintenancesByAsset(t,r,s=20,i=0){return le(this,null,function*(){const d=new URLSearchParams;d.append("asset_name",t),r&&d.append("filters",JSON.stringify(r)),d.append("limit",s.toString()),d.append("offset",i.toString());const c=`${zt.ENDPOINTS.GET_MAINTENANCES_BY_ASSET}?${d.toString()}`;return rt.apiCall(c)})}getActiveServiceContracts(t,r=20,s=0){return le(this,null,function*(){const i=new URLSearchParams;t&&i.append("filters",JSON.stringify(t)),i.append("limit",r.toString()),i.append("offset",s.toString());const d=`${zt.ENDPOINTS.GET_ACTIVE_SERVICE_CONTRACTS}?${i.toString()}`;return rt.apiCall(d)})}}const e0=new hM;function mM(e,t=20,r=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[p,g]=j.useState(!1),[x,y]=j.useState(!0),[v,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),A=JSON.stringify(e);j.useEffect(()=>{if(S.current&&v)return;let O=!1;return S.current=!0,le(null,null,function*(){try{y(!0);const B=yield e0.getAssetMaintenances(e,void 0,t,r,s);O||(d(B.asset_maintenances),f(B.total_count),g(B.has_more),k(null))}catch(B){if(!O){const V=B instanceof Error?B.message:"Failed to fetch PPM schedules";V.includes("417")||V.includes("Expectation Failed")||V.includes("has no attribute")?k("API endpoint not deployed. Please deploy ppm_api.py to your Frappe server."):k(V),d([]),f(0),g(!1)}}finally{O||y(!1)}}),()=>{O=!0}},[A,t,r,s,T]);const C=j.useCallback(()=>{S.current=!1,N(O=>O+1)},[]);return{ppms:i,totalCount:c,hasMore:p,loading:x,error:v,refetch:C}}function gM(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}try{i(!0),c(null);const g=yield e0.getAssetMaintenanceDetails(e);r(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch PPM details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const p=j.useCallback(()=>{f()},[f]);return{ppm:t,loading:s,error:d,refetch:p}}function o4(){const[e,t]=j.useState(!1),[r,s]=j.useState(null),i=j.useCallback(f=>le(null,null,function*(){try{return t(!0),s(null),yield e0.createAssetMaintenance(f)}catch(p){const g=p instanceof Error?p.message:"Failed to create PPM schedule";throw s(g),p}finally{t(!1)}}),[]),d=j.useCallback((f,p)=>le(null,null,function*(){try{return t(!0),s(null),yield e0.updateAssetMaintenance(f,p)}catch(g){const x=g instanceof Error?g.message:"Failed to update PPM schedule";throw s(x),g}finally{t(!1)}}),[]),c=j.useCallback(f=>le(null,null,function*(){try{return t(!0),s(null),yield e0.deleteAssetMaintenance(f)}catch(p){const g=p instanceof Error?p.message:"Failed to delete PPM schedule";throw s(g),p}finally{t(!1)}}),[]);return{createPPM:i,updatePPM:d,deletePPM:c,loading:e,error:r}}const pM=()=>{const{t:e}=Va(),t=xa(),[r,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(""),[p,g]=j.useState(null),[x,y]=j.useState(null),v=j.useRef(null),k=20,T=c?{company:c}:{},{ppms:N,totalCount:S,hasMore:A,loading:C,error:O,refetch:P}=mM(T,k,r*k,"creation desc"),{deletePPM:B,loading:V}=o4();j.useEffect(()=>{const me=ee=>{v.current&&!v.current.contains(ee.target)&&y(null)};return x&&document.addEventListener("mousedown",me),()=>{document.removeEventListener("mousedown",me)}},[x]);const z=()=>{t("/ppm/new")},U=me=>{t(`/ppm/${me}`)},J=me=>{t(`/ppm/${me}`)},de=me=>le(null,null,function*(){try{yield B(me),g(null),P(),alert("PPM schedule deleted successfully!")}catch(ee){alert(`Failed to delete: ${ee instanceof Error?ee.message:"Unknown error"}`)}}),ye=me=>{t(`/ppm/new?duplicate=${me}`)},ie=me=>{const ee=JSON.stringify(me,null,2),q=new Blob([ee],{type:"application/json"}),Q=URL.createObjectURL(q),fe=document.createElement("a");fe.href=Q,fe.download=`ppm_${me.name}.json`,fe.click(),URL.revokeObjectURL(Q)},he=()=>{const ee=[["PPM ID","Company","Asset","Asset Type","Frequency","No. of PMs","Total Amount"].join(","),...N.map(ae=>[ae.name,ae.company||"",ae.asset_name||"",ae.custom_asset_type||"",ae.custom_frequency||"",ae.custom_no_of_pms||"",ae.custom_total_amount||""].join(","))].join(`
`),q=new Blob([ee],{type:"text/csv"}),Q=URL.createObjectURL(q),fe=document.createElement("a");fe.href=Q,fe.download=`ppm_schedules_${new Date().toISOString().split("T")[0]}.csv`,fe.click(),URL.revokeObjectURL(Q)};if(C&&r===0)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})});if(O)return a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ PPM API Not Available"}),a.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"The PPM API endpoint is not deployed yet."})}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.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)"}),a.jsx("button",{onClick:P,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),a.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"Technical Error:"})," ",O]})})]})});const ve=N.filter(me=>{var ee,q,Q,fe;return((ee=me.name)==null?void 0:ee.toLowerCase().includes(i.toLowerCase()))||((q=me.asset_name)==null?void 0:q.toLowerCase().includes(i.toLowerCase()))||((Q=me.company)==null?void 0:Q.toLowerCase().includes(i.toLowerCase()))||((fe=me.custom_asset_type)==null?void 0:fe.toLowerCase().includes(i.toLowerCase()))});return a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("ppm.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",S," PPM schedule",S!==1?"s":""]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:he,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:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")})]}),a.jsxs("button",{onClick:z,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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:e("ppm.addPPM")})]})]})]}),a.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:a.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:[a.jsx(Ws,{className:"text-gray-400 dark:text-gray-500"}),a.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"})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:a.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"})})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ve.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Ws,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No PPM schedules found"}),a.jsx("button",{onClick:z,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"})]})})}):ve.map(me=>a.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>U(me.name),children:[a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:me.name})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xp,{className:"text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.company||"-"})]})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.asset_name||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_asset_type||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(I_,{className:"text-blue-500"}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_frequency||"-"})]})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_no_of_pms||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:me.custom_total_amount?`$${me.custom_total_amount.toLocaleString()}`:"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:a.jsxs("div",{className:"relative",onClick:ee=>ee.stopPropagation(),children:[a.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:a.jsx(g0,{})}),x===me.name&&a.jsxs("div",{ref:v,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:[a.jsxs("button",{onClick:()=>{U(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:[a.jsx(vs,{}),"View"]}),a.jsxs("button",{onClick:()=>{J(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:[a.jsx(Rr,{}),"Edit"]}),a.jsxs("button",{onClick:()=>{ye(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:[a.jsx(Cc,{}),"Duplicate"]}),a.jsxs("button",{onClick:()=>{ie(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:[a.jsx(en,{}),"Export"]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700"}),a.jsxs("button",{onClick:()=>{g(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:[a.jsx(ma,{}),"Delete"]})]})]})})]},me.name))})]})}),(A||r>0)&&a.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r*k+1," to ",Math.min((r+1)*k,S)," of ",S," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>s(Math.max(0,r-1)),disabled:r===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"}),a.jsx("button",{onClick:()=>s(r+1),disabled:!A,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"})]})]})]}),p&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4",children:[a.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white mb-4",children:"Confirm Delete"}),a.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."}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>g(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"}),a.jsx("button",{onClick:()=>de(p),disabled:V,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50",children:V?"Deleting...":"Delete"})]})]})})]})},xM=()=>{const{ppmName:e}=fl(),t=xa(),[r]=hl(),s=r.get("duplicate"),i=e==="new",d=i&&!!s,{ppm:c,loading:f,error:p,refetch:g}=gM(d?s:i?null:e||null),{createPPM:x,updatePPM:y,loading:v}=o4(),[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 A=O=>{const{name:P,value:B}=O.target;S(V=>Se(ne({},V),{[P]:P.includes("amount")||P.includes("pms")||P.includes("price")?parseFloat(B)||0:B}))},C=O=>le(null,null,function*(){var P;if(O.preventDefault(),!N.asset_name){alert("Please enter Asset Name");return}try{if(i||d){const B=yield x(N);alert(d?"PPM schedule duplicated successfully!":"PPM schedule created successfully!"),(P=B.asset_maintenance)!=null&&P.name?t(`/ppm/${B.asset_maintenance.name}`):(g(),t("/ppm"))}else e&&(yield y(e,N),alert("PPM schedule updated successfully!"),T(!1),g())}catch(B){console.error("PPM save error:",B),alert("Failed to save: "+(B instanceof Error?B.message:"Unknown error"))}});return f?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading PPM schedule..."})]})}):p&&!i&&!d?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",p]}),a.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"})]})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsx("div",{className:"flex items-center gap-4",children:a.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:[a.jsx(Ns,{}),a.jsx("span",{className:"text-gray-900 dark:text-white",children:d?"Duplicate PPM Schedule":i?"New PPM Schedule":"PPM Schedule Details"})]})}),a.jsx("div",{className:"flex items-center gap-3",children:!i&&!k&&a.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:[a.jsx(Rr,{}),"Edit"]})})]}),a.jsxs("form",{onSubmit:C,children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Basic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Company *"}),k?a.jsx("input",{type:"text",name:"company",value:N.company,onChange:A,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}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.company)||"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name *"}),k?a.jsx("input",{type:"text",name:"asset_name",value:N.asset_name,onChange:A,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}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.asset_name)||"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Type"}),k?a.jsx("input",{type:"text",name:"custom_asset_type",value:N.custom_asset_type,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_asset_type)||"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),k?a.jsx("input",{type:"text",name:"maintenance_team",value:N.maintenance_team,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.maintenance_team)||"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Frequency"}),k?a.jsx("input",{type:"text",name:"custom_frequency",value:N.custom_frequency,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_frequency)||"-"})})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Financial Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Number of PMs"}),k?a.jsx("input",{type:"number",name:"custom_no_of_pms",value:N.custom_no_of_pms,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_no_of_pms)||"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Price per PM"}),k?a.jsx("input",{type:"number",name:"custom_price_per_pm",value:N.custom_price_per_pm,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white",children:c!=null&&c.custom_price_per_pm?`$${c.custom_price_per_pm.toLocaleString()}`:"-"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Total Amount"}),k?a.jsx("input",{type:"number",name:"custom_total_amount",value:N.custom_total_amount,onChange:A,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"}):a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-gray-900 dark:text-white font-semibold",children:c!=null&&c.custom_total_amount?`$${c.custom_total_amount.toLocaleString()}`:"-"})})]})]})]})]}),a.jsx("div",{className:"lg:col-span-1",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Schedule Information"}),!i&&c&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM ID"}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.name})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white",children:c.creation?new Date(c.creation).toLocaleString():"-"})]})]}),i&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(qg,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Schedule information will appear after creation"})]})]})})]}),k&&a.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[a.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"}),a.jsxs("button",{type:"submit",disabled:v,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:[a.jsx(gr,{}),v?"Saving...":i?"Create":"Save Changes"]})]})]})]})};class yM{submitDocument(t,r){return le(this,null,function*(){try{const s=yield this.fetchWithTimeout(`${zt.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(`${zt.BASE_URL}/api/method/frappe.client.submit`,{method:"POST",headers:r,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,r,s=12e4){return le(this,null,function*(){var c,f;const i=new AbortController,d=setTimeout(()=>i.abort(),s);try{const p=yield fetch(t,Se(ne({},r),{signal:i.signal}));return clearTimeout(d),p}catch(p){throw clearTimeout(d),p.name==="AbortError"?new Error(`Request timeout after ${s}ms. The server may be slow or the request is too large.`):(c=p.message)!=null&&c.includes("Failed to fetch")||(f=p.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`):p}})}getFilteredAssets(t){return le(this,null,function*(){const r=[];t.modality&&r.push(["custom_modality","=",t.modality]),t.asset_type&&r.push(["custom_asset_type","=",t.asset_type]),t.department&&r.push(["department","=",t.department]),t.location&&r.push(["location","=",t.location]),t.manufacturer&&r.push(["custom_manufacturer","=",t.manufacturer]),t.model&&r.push(["custom_model","=",t.model]);const s=JSON.stringify(r),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 le(this,null,function*(){var d,f,p,g,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 r={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(v=>({doctype:"PM Entry Line",asset:v.name,start_date:t.start_date,end_date:t.end_date,manufacturer:v.custom_manufacturer||null,model:v.custom_model||null}))};console.log("Creating PM Schedule Generator with document:",JSON.stringify(r,null,2));const s=yield rt.getCSRFToken(),i={"Content-Type":"application/json",Accept:"application/json"};s&&(i["X-Frappe-CSRF-Token"]=s);try{const v=yield this.fetchWithTimeout(`${zt.BASE_URL}/api/method/frappe.client.insert`,{method:"POST",headers:i,credentials:"include",body:JSON.stringify({doc:r})},12e4),k=yield v.text();if(console.log("frappe.client.insert response:",k),!v.ok)throw new Error(`HTTP ${v.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(v){console.warn("Method 1 (frappe.client.insert) failed:",v.message);try{const c=r,{doctype:k,maintenance_entries:T}=c,N=gn(c,["doctype","maintenance_entries"]),S=Se(ne({},N),{maintenance_entries:T.map(z=>{var U=z,{doctype:B}=U,V=gn(U,["doctype"]);return V})});console.log("Trying Resource API with:",JSON.stringify(S,null,2));const A=yield this.fetchWithTimeout(`${zt.BASE_URL}/api/resource/PM%20Schedule%20Generator`,{method:"POST",headers:i,credentials:"include",body:JSON.stringify(S)},12e4),C=yield A.text();if(console.log("Resource API response:",C),!A.ok)throw new Error(`HTTP ${A.status}: ${C}`);const O=JSON.parse(C),P=(f=O==null?void 0:O.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(((p=v==null?void 0:v.message)==null?void 0:p.includes("timeout"))||((g=v==null?void 0:v.message)==null?void 0:g.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:"),v!=null&&v.message&&T.push(`• frappe.client.insert: ${v.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 le(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`),r=(t==null?void 0:t.data)||[];return{modalities:[...new Set(r.map(i=>i.custom_modality).filter(Boolean))],assetTypes:[...new Set(r.map(i=>i.custom_asset_type).filter(Boolean))],departments:[...new Set(r.map(i=>i.department).filter(Boolean))],locations:[...new Set(r.map(i=>i.location).filter(Boolean))],manufacturers:[...new Set(r.map(i=>i.custom_manufacturer).filter(Boolean))],models:[...new Set(r.map(i=>i.custom_model).filter(Boolean))],company:[...new Set(r.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 le(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(r=>({name:r.name,maintenance_team_name:r.name})):[]}catch(t){return console.warn("Could not fetch maintenance teams:",(t==null?void 0:t.message)||"Unknown error"),[]}})}getMaintenanceTeamDetails(t){return le(this,null,function*(){try{const r=yield rt.apiCall(`/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`);if(r!=null&&r.data){const s=r.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(r){return console.warn("Could not fetch maintenance team details:",(r==null?void 0:r.message)||"Unknown error"),null}})}}const df=new yM,bM=()=>{const{t:e}=Va(),t=xa(),[r,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:""}),[p,g]=j.useState(!1),[x,y]=j.useState(!1),[v,k]=j.useState([]),[T,N]=j.useState({modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}),[S,A]=j.useState([]),[C,O]=j.useState(""),[P,B]=j.useState(null);j.useEffect(()=>{z(),U()},[]);const V=(q,Q,fe)=>{if(!q||!Q||!fe)return null;const ae=parseInt(fe,10);if(isNaN(ae)||ae<1)return null;const F=ae-1;if(F<0)return null;const D=new Date(q),H=new Date(D);switch(Q){case"Daily":H.setDate(H.getDate()+F);break;case"Weekly":H.setDate(H.getDate()+F*7);break;case"Monthly":H.setMonth(H.getMonth()+F);break;case"Quarterly":H.setMonth(H.getMonth()+F*3);break;case"Half-yearly":H.setMonth(H.getMonth()+F*6);break;case"Yearly":H.setFullYear(H.getFullYear()+F);break;case"2 Yearly":H.setFullYear(H.getFullYear()+F*2);break;case"3 Yearly":H.setFullYear(H.getFullYear()+F*3);break;default:return null}const Z=H.getFullYear(),K=String(H.getMonth()+1).padStart(2,"0"),ue=String(H.getDate()).padStart(2,"0");return`${Z}-${K}-${ue}`};j.useEffect(()=>{le(null,null,function*(){if(c.maintenance_team){const Q=yield df.getMaintenanceTeamDetails(c.maintenance_team);Q&&f(fe=>Se(ne({},fe),{maintenance_manager:Q.maintenance_manager||"",assign_to:Q.team_members&&Q.team_members.length===1?Q.team_members[0]:fe.assign_to}))}else f(Q=>Se(ne({},Q),{maintenance_manager:"",assign_to:""}))})},[c.maintenance_team]),j.useEffect(()=>{if(c.start_date&&c.periodicity&&c.no_of_pms){const q=V(c.start_date,c.periodicity,c.no_of_pms);q&&f(Q=>Se(ne({},Q),{end_date:q}))}},[c.start_date,c.periodicity,c.no_of_pms]);const z=()=>le(null,null,function*(){const q=yield df.getFilterOptions();N(q)}),U=()=>le(null,null,function*(){const q=yield df.getMaintenanceTeams();A(q)}),J=()=>le(null,null,function*(){y(!0);try{const q=new URLSearchParams;r.company&&q.append("company",r.company),r.custom_modality&&q.append("custom_modality",r.custom_modality),r.custom_manufacturer&&q.append("custom_manufacturer",r.custom_manufacturer),r.custom_device_status&&q.append("custom_device_status",r.custom_device_status),r.custom_model&&q.append("custom_model",r.custom_model),r.department&&q.append("department",r.department);const Q=yield fetch(`/api/method/get_assets?${q.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);const ae=(yield Q.json()).message||[];k(ae),d([])}catch(q){console.error("Error fetching assets:",q),alert("Failed to fetch assets: "+(q instanceof Error?q.message:"Unknown error"))}finally{y(!1)}}),de=(q,Q)=>{s(fe=>Se(ne({},fe),{[q]:Q||void 0}))},ye=q=>{d(Q=>Q.includes(q)?Q.filter(fe=>fe!==q):[...Q,q])},ie=()=>{const q=he();i.length===q.length&&q.length>0?d([]):d(q.map(Q=>Q.name))},he=()=>{if(!C)return v;const q=C.toLowerCase();return v.filter(Q=>{var fe,ae,F,D,H,Z;return((fe=Q.asset_name)==null?void 0:fe.toLowerCase().includes(q))||((ae=Q.custom_modality)==null?void 0:ae.toLowerCase().includes(q))||((F=Q.company)==null?void 0:F.toLowerCase().includes(q))||((D=Q.custom_manufacturer)==null?void 0:D.toLowerCase().includes(q))||((H=Q.custom_model)==null?void 0:H.toLowerCase().includes(q))||((Z=Q.custom_device_status)==null?void 0:Z.toLowerCase().includes(q))})},ve=()=>le(null,null,function*(){if(i.length===0){alert("Please select at least one asset");return}if(!r.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)?`)){g(!0);try{const Q=v.filter(F=>i.includes(F.name)).map(F=>({name:F.name,custom_manufacturer:F.custom_manufacturer,custom_model:F.custom_model})),fe={assets:Q,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:r.company,modality:r.custom_modality,manufacturer:r.custom_manufacturer,model:r.custom_model,department:c.department||r.department||void 0};console.log("=== DEBUG: Selected Asset Details ===",Q),console.log("=== DEBUG: bulkData ===",fe);const ae=yield df.createBulkMaintenanceSchedules(fe);B({show:!0,document:ae.document,count:ae.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(Q){console.error("Error creating schedules:",Q);const fe=Q instanceof Error?Q.message:"Unknown error";alert(`Failed to create maintenance schedules:
${fe}`)}finally{g(!1)}}}),me=he(),ee=Object.values(r).some(q=>q);return a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[a.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:[a.jsx(Ns,{}),a.jsx("span",{children:"Back to PPM Planner"})]}),a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"PPM Planner - Bulk Schedule Generator"})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[a.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[a.jsx(ws,{})," Filter Assets"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[a.jsx("div",{children:a.jsx(_t,{label:"Hospital/Company *",doctype:"Company",value:r.company||"",onChange:q=>de("company",q),placeholder:"Select a hospital/company"})}),a.jsx("div",{children:a.jsx(_t,{label:"Modality",doctype:"Modality",value:r.custom_modality||"",onChange:q=>de("custom_modality",q),placeholder:"Leave empty for all modalities"})}),a.jsx("div",{children:a.jsx(_t,{label:"Manufacturer",doctype:"Manufacturer",value:r.custom_manufacturer||"",onChange:q=>de("custom_manufacturer",q),placeholder:"Leave empty for all manufacturers"})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Device Status"}),a.jsxs("select",{value:r.custom_device_status||"",onChange:q=>de("custom_device_status",q.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:[a.jsx("option",{value:"",children:"All Statuses"}),a.jsx("option",{value:"Active",children:"Active"}),a.jsx("option",{value:"Inactive",children:"Inactive"}),a.jsx("option",{value:"Under Maintenance",children:"Under Maintenance"}),a.jsx("option",{value:"Decommissioned",children:"Decommissioned"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Model"}),a.jsxs("select",{value:r.custom_model||"",onChange:q=>de("custom_model",q.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:[a.jsx("option",{value:"",children:"Select Model (optional)"}),T.models.map(q=>a.jsx("option",{value:q,children:q},q))]})]}),a.jsx("div",{children:a.jsx(_t,{label:"Department",doctype:"Department",value:r.department||"",onChange:q=>de("department",q),placeholder:"Select department (optional)"})})]}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.jsx("button",{onClick:J,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?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Loading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ws,{}),"Fetch Assets"]})}),ee&&a.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"})]})]}),v.length>0&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:["Select Assets (",i.length," of ",v.length," selected)"]}),a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ws,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Search assets...",value:C,onChange:q=>O(q.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"})]}),a.jsx("button",{onClick:ie,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"})]})]}),a.jsx("div",{className:"max-h-96 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:a.jsx("input",{type:"checkbox",checked:i.length===me.length&&me.length>0,onChange:ie,className:"rounded"})}),a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Asset Name"}),a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Modality"}),a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Manufacturer"}),a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Model"}),a.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:me.length===0?a.jsx("tr",{children:a.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(q=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${i.includes(q.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[a.jsx("td",{className:"p-3",children:a.jsx("input",{type:"checkbox",checked:i.includes(q.name),onChange:()=>ye(q.name),className:"rounded"})}),a.jsx("td",{className:"p-3 text-sm text-gray-900 dark:text-white font-medium",children:q.asset_name}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:q.custom_modality||"-"}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:q.custom_manufacturer||"-"}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:q.custom_model||"-"}),a.jsx("td",{className:"p-3 text-sm",children:a.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${q.custom_device_status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":q.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:q.custom_device_status||"-"})})]},q.name))})]})})]}),i.length>0&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[a.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[a.jsx(hf,{})," Schedule Configuration"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"PPM Name *"}),a.jsx("input",{type:"text",value:c.pm_for,onChange:q=>f(Q=>Se(ne({},Q),{pm_for:q.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})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"First PPM Date *"}),a.jsx("input",{type:"date",value:c.start_date,onChange:q=>f(Q=>Se(ne({},Q),{start_date:q.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})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Periodicity *"}),a.jsxs("select",{value:c.periodicity,onChange:q=>f(Q=>Se(ne({},Q),{periodicity:q.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:[a.jsx("option",{value:"Daily",children:"Daily"}),a.jsx("option",{value:"Weekly",children:"Weekly"}),a.jsx("option",{value:"Monthly",children:"Monthly"}),a.jsx("option",{value:"Quarterly",children:"Quarterly"}),a.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),a.jsx("option",{value:"Yearly",children:"Yearly"}),a.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),a.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Maintenance Type"}),a.jsxs("select",{value:c.maintenance_type,onChange:q=>f(Q=>Se(ne({},Q),{maintenance_type:q.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:[a.jsx("option",{value:"Preventive",children:"Preventive"}),a.jsx("option",{value:"Corrective",children:"Corrective"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"No. of PMs"}),a.jsx("input",{type:"number",value:c.no_of_pms,onChange:q=>f(Q=>Se(ne({},Q),{no_of_pms:q.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"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"End date will be auto-calculated"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Last PPM Date *"}),a.jsx("input",{type:"date",value:c.end_date,onChange:q=>f(Q=>Se(ne({},Q),{end_date:q.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})]}),a.jsxs("div",{children:[a.jsx(_t,{label:"Maintenance Team",doctype:"Asset Maintenance Team",value:c.maintenance_team,onChange:q=>f(Q=>Se(ne({},Q),{maintenance_team:q}))}),c.maintenance_manager&&a.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:[a.jsx("span",{className:"font-medium",children:"Maintenance Manager:"})," ",c.maintenance_manager]})]}),a.jsxs("div",{children:[a.jsx(_t,{label:"Assign To *",doctype:"User",value:c.assign_to,onChange:q=>f(Q=>Se(ne({},Q),{assign_to:q})),placeholder:c.maintenance_team?"Select user (auto-selected if only one team member)":"Select user to assign tasks"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Required for Asset Maintenance creation"}),c.assign_to&&a.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:[a.jsx("span",{className:"font-medium",children:"Assigned To:"})," ",c.assign_to]})]}),a.jsx("div",{children:a.jsx(_t,{label:"Department",doctype:"Department",value:c.department,onChange:q=>f(Q=>Se(ne({},Q),{department:q})),placeholder:"Select department (optional)"})})]}),a.jsx("button",{onClick:ve,disabled:p||!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:p?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Creating Schedules..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ha,{}),"Generate Maintenance Schedules (",i.length," asset",i.length!==1?"s":"",")"]})})]}),v.length===0&&!x&&!(P!=null&&P.show)&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-12 text-center",children:[a.jsx(ws,{className:"mx-auto text-4xl text-gray-400 dark:text-gray-600 mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"No Assets Loaded"}),a.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.'}),a.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)&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-lg w-full p-6",children:[a.jsxs("div",{className:"text-center mb-6",children:[a.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:a.jsx(Ha,{className:"text-green-600 dark:text-green-400 text-3xl"})}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Schedules Created Successfully!"}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400",children:[P.count," maintenance schedule",P.count!==1?"s":""," have been created."]})]}),a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 mb-6",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What was created:"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Document:"}),a.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:P.document})]}),a.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."]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3",children:[P.document&&a.jsxs("button",{onClick:()=>{t(`/ppm-planner/${P.document}`),B(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:[a.jsx(hf,{}),"View PPM Planner"]}),a.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:[a.jsx(hf,{}),"View Calendar"]}),a.jsx("button",{onClick:()=>B(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 Gp(e={},t=20,r=0,s="creation desc",i={}){const[d,c]=j.useState([]),[f,p]=j.useState(0),[g,x]=j.useState(!1),[y,v]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),A=JSON.stringify(e),C=JSON.stringify(i);j.useEffect(()=>{let P=!1;const B=A,V=C,z=t,U=r,J=s;return le(null,null,function*(){try{v(!0),T(null);let ye={},ie={};try{ye=B?JSON.parse(B):{}}catch(me){ye={}}try{ie=V?JSON.parse(V):{}}catch(me){ie={}}const he=ne(ne({},ye),ie),ve=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(he),limit:z,offset:U,order_by:J,include_child_tables:!0,fields:JSON.stringify(["name","pm_for","hospital","modality","periodicity","start_date","end_date","due_date"])})});if(!P){const me=(ve==null?void 0:ve.message)||ve;if(me&&me.pm_schedules){const ee=me.pm_schedules||[];if(console.log("[usePMSchedules] Loaded",ee.length,"PM Schedules"),ee.length>0){const q=ee[0];console.log("[usePMSchedules] 🔍 FIRST SCHEDULE FIELDS:",{name:q.name,pm_for:q.pm_for,"pm_for (bracket)":q.pm_for,allKeys:Object.keys(q),allKeysList:Object.keys(q).join(", "),fullObject:q})}c(ee),p(me.total_count||0),x(me.has_more||!1)}else console.warn("[usePMSchedules] No pm_schedules in response:",ve),c([]),p(0),x(!1)}}catch(ye){P||(console.error("Error fetching PM Schedules:",ye),T(ye instanceof Error?ye.message:"Failed to fetch PM Schedules"),c([]),p(0))}finally{P||v(!1)}}),()=>{P=!0}},[A,C,t,r,s,N]);const O=j.useCallback(()=>{S(P=>P+1)},[]);return{pmSchedules:d,totalCount:f,hasMore:g,loading:y,error:k,refetch:O}}function vM(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}i(!0),c(null);try{const p=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:",p),p&&p.name&&!p.error)console.log("[usePMScheduleDetails] Setting PM Schedule:",p),r(p);else{const g=(p==null?void 0:p.error)||"PM Schedule not found";console.warn("[usePMScheduleDetails] Error or not found:",g),c(g),r(null)}}catch(p){console.error("Error fetching PM Schedule details:",p),c(p instanceof Error?p.message:"Failed to fetch PM Schedule"),r(null)}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{pmSchedule:t,loading:s,error:d,refetch:f}}function c4(){const[e,t]=j.useState(!1);return{createPMSchedule:x=>le(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)=>le(null,null,function*(){t(!0);try{const v=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(v!=null&&v.success)return v.pm_schedule;throw new Error((v==null?void 0:v.error)||"Failed to update PM Schedule")}finally{t(!1)}}),deletePMSchedule:x=>le(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=>le(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=>le(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)=>le(null,null,function*(){t(!0);try{const v=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(v!=null&&v.success)return v.maintenance_entries;throw new Error((v==null?void 0:v.error)||"Failed to add maintenance entry")}finally{t(!1)}}),removeMaintenanceEntry:(x,y)=>le(null,null,function*(){t(!0);try{const v=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(v!=null&&v.success)return v.maintenance_entries;throw new Error((v==null?void 0:v.error)||"Failed to remove maintenance entry")}finally{t(!1)}}),updateMaintenanceEntry:(x,y,v)=>le(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(v)})});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 _M=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:p}=Va(),[g,x]=j.useState(r>0?"selected":"all_with_filters"),[y,v]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{r>0?x("selected"):x("all_with_filters")},[r]);const N=C=>{T(O=>O.includes(C)?O.filter(P=>P!==C):[...O,C])},S=()=>{T(f.map(C=>C.key))},A=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," PPM Schedules"]})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Scope"}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected schedule",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," schedule",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," schedule",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:p("listPages.exportFormat")}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>v("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.csv")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>v("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:p("listPages.excel")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:A,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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=>a.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:[a.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(g,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},wM=({isOpen:e,onClose:t,selectedItems:r,onPrint:s,isPrinting:i})=>{const{t:d}=Va(),[c,f]=j.useState(""),[p,g]=j.useState(!0),[x,y]=j.useState(""),[v,k]=j.useState("A4"),[T,N]=j.useState([]),[S,A]=j.useState([]),[C,O]=j.useState(!1);j.useEffect(()=>{e&&(P(),B())},[e]);const P=()=>le(null,null,function*(){O(!0);try{const J=((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(de=>de.name);N(J),J.length>0&&!c&&f(J[0])}catch(z){console.error("Error fetching print formats:",z)}finally{O(!1)}}),B=()=>le(null,null,function*(){try{const J=((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(de=>de.name);A(J),J.length>0&&!x&&y(J[0])}catch(z){console.error("Error fetching letterheads:",z)}}),V=()=>{if(!c){alert("Please select a print format");return}s(c,x,!p,v)};return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-purple-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(so,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Print PM Schedules"})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:i,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6",children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(In,{className:"text-purple-600 dark:text-purple-400"}),a.jsxs("span",{className:"font-medium text-purple-800 dark:text-purple-300",children:[r.length," schedule",r.length!==1?"s":""," selected for printing"]})]}),a.jsxs("div",{className:"mt-2 text-sm text-purple-600 dark:text-purple-400 max-h-20 overflow-y-auto",children:[r.slice(0,5).join(", "),r.length>5&&` and ${r.length-5} more...`]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["Print Format ",a.jsx("span",{className:"text-red-500",children:"*"})]}),C?a.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-purple-500"}),"Loading formats..."]}):T.length===0?a.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."}):a.jsxs("select",{value:c,onChange:z=>f(z.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:[a.jsx("option",{value:"",children:"Select Print Format"}),T.map(z=>a.jsx("option",{value:z,children:z},z))]})]}),a.jsx("div",{className:"mb-4",children:a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:p,onChange:z=>g(z.target.checked),className:"rounded text-purple-600 focus:ring-purple-500"}),a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Use Letterhead"})]})}),p&&a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Letterhead"}),a.jsxs("select",{value:x,onChange:z=>y(z.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:[a.jsx("option",{value:"",children:"Default Letterhead"}),S.map(z=>a.jsx("option",{value:z,children:z},z))]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Page Size"}),a.jsxs("select",{value:v,onChange:z=>k(z.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:[a.jsx("option",{value:"A4",children:"A4"}),a.jsx("option",{value:"Letter",children:"Letter"}),a.jsx("option",{value:"A3",children:"A3"}),a.jsx("option",{value:"A5",children:"A5"}),a.jsx("option",{value:"Legal",children:"Legal"})]})]})]}),a.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:[a.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"}),a.jsx("button",{onClick:V,disabled:!c||i||r.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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Preparing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(so,{}),"Print ",r.length," Schedule",r.length!==1?"s":""]})})]})]})}):null},kM=()=>{const{t:e}=Va(),t=xa(),[r,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(null),[p,g]=j.useState(null),x=j.useRef(null),[y,v]=j.useState(!1),[k,T]=j.useState(""),[N,S]=j.useState(""),[A,C]=j.useState(""),[O,P]=j.useState(""),[B,V]=j.useState(new Set),[z,U]=j.useState(!1),[J,de]=j.useState(!1),[ye,ie]=j.useState(!1),[he,ve]=j.useState(!1),me=20,ee=[{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}],q={};k&&(q.hospital=k),N&&(q.modality=N),A&&(q.manufacturer=A),O&&(q.periodicity=O);const{pmSchedules:Q,totalCount:fe,hasMore:ae,loading:F,error:D,refetch:H}=Gp(q,me,r*me,"creation desc"),{deletePMSchedule:Z,loading:K}=c4();j.useEffect(()=>{const qe=Ue=>{x.current&&!x.current.contains(Ue.target)&&g(null)};return p&&document.addEventListener("mousedown",qe),()=>{document.removeEventListener("mousedown",qe)}},[p]),j.useEffect(()=>{V(new Set)},[k,N,A,O,i,r]);const ue=Q.filter(qe=>{var ht,wt,Mt,Ft,je,it;if(!i)return!0;const Ue=i.toLowerCase();return((ht=qe.name)==null?void 0:ht.toLowerCase().includes(Ue))||((wt=qe.pm_for)==null?void 0:wt.toLowerCase().includes(Ue))||((Mt=qe.hospital)==null?void 0:Mt.toLowerCase().includes(Ue))||((Ft=qe.modality)==null?void 0:Ft.toLowerCase().includes(Ue))||((je=qe.manufacturer)==null?void 0:je.toLowerCase().includes(Ue))||((it=qe.maintenance_team)==null?void 0:it.toLowerCase().includes(Ue))}),Le=()=>{B.size===ue.length?V(new Set):V(new Set(ue.map(qe=>qe.name)))},Ne=ue.length>0&&B.size===ue.length,We=B.size>0&&B.size<ue.length,Fe=qe=>{V(Ue=>{const ht=new Set(Ue);return ht.has(qe)?ht.delete(qe):ht.add(qe),ht})},tt=j.useCallback(()=>le(null,null,function*(){const qe=[];let Ue=0;const ht=100;let wt=!0;for(;wt;)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:q,fields:["*"],limit_start:Ue*ht,limit_page_length:ht,order_by:"creation desc"})})).json()).message||[];qe.push(...je),je.length<ht?wt=!1:Ue++,Ue>100&&(console.warn("Export safety limit reached"),wt=!1)}catch(Mt){throw console.error("Error fetching schedules for export:",Mt),Mt}return qe}),[q]),ft=(qe,Ue,ht)=>le(null,null,function*(){de(!0);try{let wt=[];switch(qe){case"selected":wt=ue.filter(je=>B.has(je.name));break;case"all_on_page":wt=ue;break;case"all_with_filters":wt=yield tt();break}if(wt.length===0){alert("No data to export");return}const Mt=wt.map(je=>{const it=ne({},je);if(ht.includes("docstatus")){const vt=we(je);it.docstatus=vt===1?"Submitted":vt===2?"Cancelled":"Draft"}return it}),Ft=ht.map(je=>{const it=ee.find(vt=>vt.key===je);return(it==null?void 0:it.label)||je});if(Ue==="csv"){const je=[Ft.join(","),...Mt.map(De=>ht.map(ct=>{let ut=De[ct]||"";return typeof ut=="string"&&(ut.includes(",")||ut.includes('"')||ut.includes(`
`))&&(ut=`"${ut.replace(/"/g,'""')}"`),ut}).join(","))].join(`
`),it=new Blob(["\uFEFF"+je],{type:"text/csv;charset=utf-8;"}),vt=URL.createObjectURL(it),Bt=document.createElement("a");Bt.href=vt,Bt.download=`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.csv`,Bt.click(),URL.revokeObjectURL(vt)}else if(Ue==="excel"){const je=[Ft,...Mt.map(Bt=>ht.map(De=>Bt[De]||""))],it=jr.aoa_to_sheet(je),vt=jr.book_new();jr.book_append_sheet(vt,it,"PPM Schedules"),Ic(vt,`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.xlsx`)}U(!1),V(new Set)}catch(wt){console.error("Export failed:",wt),alert(`Export failed: ${wt instanceof Error?wt.message:"Unknown error"}`)}finally{de(!1)}}),Dt=(qe,Ue,ht,wt)=>{ve(!0);try{const Mt=Array.from(B);if(Mt.length===0){alert("No schedules selected for printing");return}const Ft=window.location.origin,je=new URLSearchParams;je.append("doctype","PM Schedule Generator"),je.append("name",JSON.stringify(Mt)),je.append("format",qe),je.append("no_letterhead",ht?"1":"0"),Ue&&!ht&&je.append("letterhead",Ue),je.append("options",JSON.stringify({"page-size":wt}));const it=`${Ft}/api/method/frappe.utils.print_format.download_multi_pdf?${je.toString()}`;window.open(it,"_blank"),ie(!1)}catch(Mt){console.error("Print failed:",Mt),alert(`Print failed: ${Mt instanceof Error?Mt.message:"Unknown error"}`)}finally{ve(!1)}},Ve=()=>{t("/ppm-planner/new")},At=qe=>{t(`/ppm-planner/${qe}`)},jt=qe=>{t(`/ppm-planner/${qe}`)},He=qe=>le(null,null,function*(){try{yield Z(qe),H(),f(null)}catch(Ue){console.error("Error deleting PM Schedule:",Ue),alert("Failed to delete PM Schedule")}}),oe=()=>{T(""),S(""),C(""),P(""),s(0)},we=qe=>{var Ue;return qe.docstatus!==void 0?Number(qe.docstatus):((Ue=qe.maintenance_entries)==null?void 0:Ue.length)>0?Number(qe.maintenance_entries[0].docstatus):0},Ie=k||N||A||O,ot=[k,N,A,O].filter(Boolean).length,bt=Math.ceil(fe/me);return a.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[a.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:[a.jsxs("div",{className:"flex justify-between items-center mb-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(yi,{className:"text-blue-600 dark:text-blue-400",size:24}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:e("sidebar.ppmPlanner")}),a.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[e("ppm.manageSchedules"),B.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",B.size," selected"]})]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>U(!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:fe===0,children:[a.jsx(en,{}),a.jsx("span",{children:e("listPages.export")}),B.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:B.size})]}),a.jsxs("button",{onClick:()=>ie(!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:B.size===0,title:B.size===0?"Select schedules to print":`Print ${B.size} selected`,children:[a.jsx(so,{}),a.jsx("span",{children:"Print"}),B.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:B.size})]}),a.jsxs("button",{onClick:Ve,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:[a.jsx(ts,{}),a.jsx("span",{children:e("ppm.addPPM")})]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ws,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:14}),a.jsx("input",{type:"text",placeholder:e("listPages.searchPlaceholder"),value:i,onChange:qe=>d(qe.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"})]}),a.jsxs("button",{onClick:()=>v(!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:[a.jsx(ws,{}),a.jsx("span",{children:e("listPages.filters")}),ot>0&&a.jsx("span",{className:"bg-blue-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:ot}),y?a.jsx(m0,{}):a.jsx(Ec,{})]})]}),y&&a.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:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.hospital"),doctype:"Company",value:k,onChange:T,placeholder:e("filters.allHospitals"),filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.modality"),doctype:"Modality",value:N,onChange:S,placeholder:e("filters.allModalities"),filters:{}})}),a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.manufacturer"),doctype:"Manufacturer",value:A,onChange:C,placeholder:e("filters.allManufacturers"),filters:{}})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e("ppm.periodicity")}),a.jsxs("select",{value:O,onChange:qe=>P(qe.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:[a.jsx("option",{value:"",children:e("listPages.all")}),a.jsx("option",{value:"Daily",children:"Daily"}),a.jsx("option",{value:"Weekly",children:"Weekly"}),a.jsx("option",{value:"Monthly",children:"Monthly"}),a.jsx("option",{value:"Quarterly",children:"Quarterly"}),a.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),a.jsx("option",{value:"Yearly",children:"Yearly"})]})]})]}),Ie&&a.jsx("div",{className:"mt-4 flex justify-end",children:a.jsxs("button",{onClick:oe,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:[a.jsx(xt,{}),e("listPages.clearFilters")]})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 lg:p-5",children:F&&r===0?a.jsxs("div",{className:"flex items-center justify-center h-full",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),a.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]}):D?a.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:a.jsx("p",{className:"text-red-600 dark:text-red-400",children:D})}):ue.length===0?a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center",children:[a.jsx(yi,{className:"mx-auto text-gray-400 mb-4",size:48}),a.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:e("listPages.noResults")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:e(i||Ie?"listPages.tryAdjustingFilters":"listPages.getStartedCreateFirst")}),!i&&!Ie&&a.jsx("button",{onClick:Ve,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:e("ppm.addPPM")})]}):a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[a.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[a.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.jsx("button",{onClick:Le,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?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):We?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ue.map(qe=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${B.has(qe.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[a.jsx("td",{className:"px-4 py-4",children:a.jsx("button",{onClick:()=>Fe(qe.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:B.has(qe.name)?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("button",{onClick:()=>At(qe.name),className:"text-blue-600 dark:text-blue-400 hover:underline font-medium",children:qe.name})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:qe.pm_for||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:qe.hospital||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:qe.modality||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:qe.manufacturer||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:qe.periodicity||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:(()=>{const Ue=we(qe);return a.jsx("span",{className:`px-2 py-1 text-xs font-semibold rounded-full ${Ue===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":Ue===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:Ue===1?"Submitted":Ue===2?"Cancelled":"Draft"})})()}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:a.jsxs("div",{className:"relative inline-block",ref:p===qe.name?x:null,children:[a.jsx("button",{onClick:()=>g(p===qe.name?null:qe.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2",children:a.jsx(g0,{})}),p===qe.name&&a.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:[a.jsxs("button",{onClick:()=>{At(qe.name),g(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:[a.jsx(vs,{})," ",e("listPages.view")]}),a.jsxs("button",{onClick:()=>{jt(qe.name),g(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:[a.jsx(Rr,{})," ",e("listPages.edit")]}),a.jsxs("button",{onClick:()=>{f(qe.name),g(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:[a.jsx(ma,{})," ",e("listPages.delete")]})]})]})})]},qe.name))})]}),bt>1&&a.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[e("listPages.showing")," ",r*me+1," ",e("listPages.to")," ",Math.min((r+1)*me,fe)," ",e("listPages.of")," ",fe," ",e("listPages.results")]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>s(Math.max(0,r-1)),disabled:r===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"}),a.jsx("button",{onClick:()=>s(r+1),disabled:!ae,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"})]})]})]})}),a.jsx(_M,{isOpen:z,onClose:()=>U(!1),selectedCount:B.size,totalCount:fe,pageCount:ue.length,onExport:ft,isExporting:J,exportColumns:ee}),a.jsx(wM,{isOpen:ye,onClose:()=>ie(!1),selectedItems:Array.from(B),onPrint:Dt,isPrinting:he}),c&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:e("confirmations.confirmDelete")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("confirmations.cannotUndo")}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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:K,children:e("common.cancel")}),a.jsx("button",{onClick:()=>He(c),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:K,children:e(K?"common.deleting":"common.delete")})]})]})}),a.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;
}
`})]})},NM=()=>{const{t:e}=Va(),{scheduleName:t}=fl(),r=xa(),{pmSchedule:s,loading:i,error:d,refetch:c}=vM(t||null),{updatePMSchedule:f,deletePMSchedule:p,submitPMSchedule:g,cancelPMSchedule:x,loading:y}=c4(),{logs:v,refetch:k}=Gf({},1e4,0),[T,N]=j.useState(!1),[S,A]=j.useState(!1),[C,O]=j.useState(!1),[P,B]=j.useState(""),[V,z]=j.useState(""),[U,J]=j.useState(!1),[de,ye]=j.useState(!1),[ie,he]=j.useState(new Set),[ve,me]=j.useState(!1),[ee,q]=j.useState(!1),[Q,fe]=j.useState(new Set),[ae,F]=j.useState([]),[D,H]=j.useState([]),[Z,K]=j.useState([]),[ue,Le]=j.useState(""),[Ne,We]=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(()=>{le(null,null,function*(){try{const ut=yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",credentials:"include"})).json();ut.message&&Le(ut.message)}catch(ct){console.error("Error fetching current user:",ct)}})},[]),j.useEffect(()=>{if(t){const De=localStorage.getItem(`ppm_activity_${t}`);De&&K(JSON.parse(De))}},[t]),j.useEffect(()=>{if(s!=null&&s.maintenance_entries&&v.length>0){const De=[],ct=[];s.maintenance_entries.forEach(ut=>{v.filter(Rt=>Rt.asset_name===ut.asset).forEach(Rt=>{Rt.workflow_state==="Applied"?ct.push(Se(ne({},Rt),{asset_display_name:ut.asset_name||ut.asset})):Rt.maintenance_status==="Planned"&&(!Rt.workflow_state||Rt.workflow_state==="Draft")&&De.push(Se(ne({},Rt),{asset_display_name:ut.asset_name||ut.asset}))})}),F(De),H(ct)}},[s,v]),j.useEffect(()=>{if(v.length>0&&(s!=null&&s.maintenance_entries)){const De=[];if(s.maintenance_entries.forEach(ct=>{v.filter(Nt=>Nt.asset_name===ct.asset).forEach(Nt=>{const Rt=Nt.maintenance_status==="Planned"&&(!Nt.workflow_state||Nt.workflow_state==="Draft"),ia=Nt.workflow_state==="Applied";(Rt||ia)&&Nt.due_date&&De.push(Nt.due_date)})}),De.length>0){const ct=De.sort((ut,Nt)=>new Date(ut).getTime()-new Date(Nt).getTime())[0];console.log("📅 Pending due dates:",De),console.log("📅 Earliest (Next PM Date):",ct),We(ut=>ut.next_pm_date!==ct?Se(ne({},ut),{next_pm_date:ct}):ut)}else console.log("📅 No pending entries found - all completed"),We(ct=>Se(ne({},ct),{next_pm_date:""}))}},[s,v]),j.useEffect(()=>{s&&We({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 De=new Date(P),ct=new Date(Ne.next_pm_date);J(De<ct)}else J(!1)},[P,Ne.next_pm_date]);const Fe=(De,ct,ut)=>{if(!De||!ct||!ut)return null;const Nt=parseInt(ut,10);if(isNaN(Nt)||Nt<1)return null;const Rt=Nt-1;if(Rt<0)return null;const ia=new Date(De),et=new Date(ia);switch(ct){case"Daily":et.setDate(et.getDate()+Rt);break;case"Weekly":et.setDate(et.getDate()+Rt*7);break;case"Monthly":et.setMonth(et.getMonth()+Rt);break;case"Quarterly":et.setMonth(et.getMonth()+Rt*3);break;case"Half-yearly":et.setMonth(et.getMonth()+Rt*6);break;case"Yearly":et.setFullYear(et.getFullYear()+Rt);break;case"2 Yearly":et.setFullYear(et.getFullYear()+Rt*2);break;case"3 Yearly":et.setFullYear(et.getFullYear()+Rt*3);break;default:return null}const pe=et.getFullYear(),ze=String(et.getMonth()+1).padStart(2,"0"),st=String(et.getDate()).padStart(2,"0");return`${pe}-${ze}-${st}`},tt=De=>{const{name:ct,value:ut}=De.target;We(Nt=>{const Rt=Se(ne({},Nt),{[ct]:ut});if(ct==="start_date"||ct==="periodicity"||ct==="no_of_pms"){const ia=Fe(ct==="start_date"?ut:Nt.start_date,ct==="periodicity"?ut:Nt.periodicity,ct==="no_of_pms"?ut:Nt.no_of_pms);ia&&(Rt.end_date=ia)}return Rt})},ft=()=>le(null,null,function*(){if(t)try{yield f(t,Ne),N(!1),c(),alert("PPM Planner updated successfully")}catch(De){console.error("Error updating PPM Planner:",De),alert("Failed to update PPM Planner")}}),Dt=()=>le(null,null,function*(){if(t)try{yield p(t),r("/ppm-planner")}catch(De){console.error("Error deleting PPM Planner:",De),alert("Failed to delete PPM Planner")}}),Ve=()=>le(null,null,function*(){if(t)try{yield g(t),c(),alert("PPM Planner submitted successfully")}catch(De){console.error("Error submitting PPM Planner:",De),alert("Failed to submit PPM Planner")}}),At=()=>le(null,null,function*(){if(t)try{yield x(t),c(),alert("PPM Planner cancelled successfully")}catch(De){console.error("Error cancelling PPM Planner:",De),alert("Failed to cancel PPM Planner")}}),jt=()=>{if(ae.length===0){alert("No planned maintenance entries found to apply.");return}const De=new Date().toISOString().split("T")[0];B(De),z(""),he(new Set(ae.map(ct=>ct.name))),O(!0)},He=De=>{he(ct=>{const ut=new Set(ct);return ut.has(De)?ut.delete(De):ut.add(De),ut})},oe=()=>{he(new Set(ae.map(De=>De.name)))},we=()=>{he(new Set)},Ie=()=>le(null,null,function*(){if(!P){alert("Please enter a completion date.");return}if(U&&!V.trim()){alert("Please provide a reason for early completion.");return}if(ie.size===0){alert("Please select at least one entry to complete.");return}ye(!0);try{let De=0,ct=0;const ut=[],Nt=ae.filter(et=>ie.has(et.name));for(const et of Nt)try{const pe={maintenance_status:"Completed",workflow_state:"Applied",completion_date:P};U&&V&&(pe.custom_early_completion_reason=V,pe.custom_early_completion="Yes");const st=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:et.name,fieldname:pe})})).json();st.message?(De++,ut.push(et.name)):(ct++,console.error(`Failed to apply ${et.name}:`,st))}catch(pe){ct++,console.error(`Error applying ${et.name}:`,pe)}const ia=[{id:Date.now().toString(),user:ue||"Unknown User",timestamp:new Date().toISOString(),action:"Applied",entriesCount:De,completionDate:P,earlyReason:U?V:void 0,entries:ut},...Z];K(ia),t&&localStorage.setItem(`ppm_activity_${t}`,JSON.stringify(ia)),O(!1),B(""),z(""),he(new Set),k(),c(),alert(ct===0?`Successfully applied ${De} maintenance entries. They are now pending approval.`:`Applied ${De} entries. Failed to apply ${ct} entries.`)}catch(De){console.error("Error applying entries:",De),alert("Failed to apply entries.")}finally{ye(!1)}}),ot=()=>{if(D.length===0){alert("No entries pending approval.");return}fe(new Set(D.map(De=>De.name))),me(!0)},bt=De=>{fe(ct=>{const ut=new Set(ct);return ut.has(De)?ut.delete(De):ut.add(De),ut})},qe=()=>{fe(new Set(D.map(De=>De.name)))},Ue=()=>{fe(new Set)},ht=()=>le(null,null,function*(){if(Q.size===0){alert("Please select at least one entry to approve.");return}q(!0);try{let De=0,ct=0;const ut=[],Nt=D.filter(et=>Q.has(et.name));for(const et of Nt)try{const ze=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(et.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(!ze.data){console.error(`Failed to get document ${et.name}`),ct++;continue}const st=Se(ne({},ze.data),{workflow_state:"Approved",docstatus:1}),la=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(et.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(st)})).json();if(la.data&&la.data.docstatus===1)De++,ut.push(et.name),console.log(`✅ Successfully approved and submitted: ${et.name}`);else{console.log(`Trying alternative submit method for ${et.name}...`);const va=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:et.name,workflow_action:"Approve"})}),tn=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:et.name,method:"submit"})})).json();tn.message||!tn.exc?(De++,ut.push(et.name),console.log(`✅ Successfully submitted via run_doc_method: ${et.name}`)):(ct++,console.error(`Failed to submit ${et.name}:`,tn))}}catch(pe){ct++,console.error(`Error approving ${et.name}:`,pe)}const ia=[{id:Date.now().toString(),user:ue||"Unknown User",timestamp:new Date().toISOString(),action:"Approved",entriesCount:De,entries:ut},...Z];K(ia),t&&localStorage.setItem(`ppm_activity_${t}`,JSON.stringify(ia)),me(!1),fe(new Set),setTimeout(()=>{k(),c()},1e3),alert(ct===0?`Successfully approved and submitted ${De} maintenance entries. New planned entries should be created automatically.`:`Approved ${De} entries. Failed to approve ${ct} entries.`)}catch(De){console.error("Error approving entries:",De),alert("Failed to approve entries.")}finally{q(!1)}}),wt=De=>{switch(De){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"}},Mt=De=>v.filter(ut=>ut.asset_name===De).filter(ut=>{const Nt=ut.maintenance_status==="Planned"&&(!ut.workflow_state||ut.workflow_state==="Draft"),Rt=ut.workflow_state==="Applied";return Nt||Rt}),Ft=De=>Mt(De).length>0,je=()=>s!=null&&s.maintenance_entries?s.maintenance_entries.filter(De=>Ft(De.asset)):[];if(i)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx($r,{className:"animate-spin text-blue-600",size:24}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Loading PPM Planner..."})]})});if(d)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[a.jsx("p",{className:"text-red-600 dark:text-red-400",children:d}),a.jsx("button",{onClick:()=>r("/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 a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[a.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"PPM Planner not found"}),a.jsx("button",{onClick:()=>r("/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 it=s.docstatus===0,vt=s.docstatus===1;s.docstatus;const Bt=je();return a.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[a.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:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>r("/ppm-planner"),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a.jsx(Ns,{className:"text-gray-600 dark:text-gray-400"})}),a.jsx(yi,{className:"text-blue-600 dark:text-blue-400",size:28}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:s.name}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"PPM Planner Details"})]}),a.jsx("span",{className:`ml-4 px-3 py-1 text-sm font-semibold rounded-full ${vt?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":it?"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:vt?"Submitted":it?"Draft":"Cancelled"})]}),a.jsxs("div",{className:"flex gap-2",children:[vt&&a.jsxs("div",{className:"flex gap-2 mr-4 pr-4 border-r border-gray-300 dark:border-gray-600",children:[ae.length>0&&a.jsxs("button",{onClick:jt,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[a.jsx(Xu,{}),"Bulk Complete(",ae.length,")"]}),D.length>0&&a.jsxs("button",{onClick:ot,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[a.jsx(Ku,{}),"Approve (",D.length,")"]})]}),it&&!T&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx(Rr,{}),"Edit"]}),a.jsxs("button",{onClick:Ve,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:[a.jsx(Ha,{}),"Submit"]}),a.jsxs("button",{onClick:()=>A(!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:[a.jsx(ma,{}),"Delete"]})]}),T&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:ft,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?a.jsx($r,{className:"animate-spin"}):a.jsx(gr,{}),"Save"]}),a.jsx("button",{onClick:()=>{N(!1),We({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"})]}),vt&&a.jsx("button",{onClick:At,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"})]})]}),vt&&a.jsxs("div",{className:"flex items-center gap-4 mt-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Workflow Status:"}),ae.length>0&&a.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:[ae.length," Planned"]}),D.length>0&&a.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"]}),ae.length===0&&D.length===0&&a.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 ✓"})]})]}),a.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[a.jsx("div",{className:"flex-1 overflow-auto p-6",children:a.jsx("div",{className:"max-w-4xl mx-auto bg-white dark:bg-gray-800 rounded-lg shadow",children:a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("div",{children:T?a.jsx(_t,{label:"Hospital *",doctype:"Company",value:Ne.hospital,onChange:De=>We(ct=>Se(ne({},ct),{hospital:De})),placeholder:"Select Hospital",filters:{}}):a.jsxs(a.Fragment,{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Hospital"}),a.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||"-"})]})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Modality"}),T?a.jsx("input",{type:"text",name:"modality",value:Ne.modality,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Device Status"}),T?a.jsx("input",{type:"text",name:"device_status",value:Ne.device_status,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Periodicity *"}),T?a.jsxs("select",{name:"periodicity",value:Ne.periodicity,onChange:tt,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:[a.jsx("option",{value:"Daily",children:"Daily"}),a.jsx("option",{value:"Weekly",children:"Weekly"}),a.jsx("option",{value:"Monthly",children:"Monthly"}),a.jsx("option",{value:"Quarterly",children:"Quarterly"}),a.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),a.jsx("option",{value:"Yearly",children:"Yearly"})]}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Manufacturer"}),T?a.jsx("input",{type:"text",name:"manufacturer",value:Ne.manufacturer,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Model"}),T?a.jsx("input",{type:"text",name:"model",value:Ne.model,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"PM Name"}),T?a.jsx("input",{type:"text",name:"pm_for",value:Ne.pm_for,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name"}),T?a.jsx("input",{type:"text",name:"asset_name",value:Ne.asset_name,onChange:tt,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"}):a.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||"-"})]})]})]}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Schedule Dates"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Start Date *"}),T?a.jsx("input",{type:"date",name:"start_date",value:Ne.start_date,onChange:tt,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"}):a.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():"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"End Date *"}),T?a.jsx("input",{type:"date",name:"end_date",value:Ne.end_date,onChange:tt,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"}):a.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():"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"First PM Date"}),T?a.jsx("input",{type:"date",name:"due_date",value:Ne.due_date,onChange:tt,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"}):a.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():"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Next PM Date"}),T?a.jsx("input",{type:"date",name:"next_pm_date",value:Ne.next_pm_date,onChange:tt,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"}):a.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():"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"No. of PMs"}),T?a.jsx("input",{type:"number",name:"no_of_pms",value:Ne.no_of_pms,onChange:tt,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"}):a.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||"-"})]})]})]}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),T?a.jsx("input",{type:"text",name:"maintenance_team",value:Ne.maintenance_team,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Manager"}),T?a.jsx("input",{type:"text",name:"maintenance_manager",value:Ne.maintenance_manager,onChange:tt,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"}):a.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||"-"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Assign To"}),T?a.jsx("input",{type:"text",name:"assign_to",value:Ne.assign_to,onChange:tt,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"}):a.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||"-"})]})]})]}),Bt.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:["Pending Maintenance Entries",a.jsx("span",{className:"ml-2 text-sm font-normal text-gray-500 dark:text-gray-400",children:"(Showing Planned & Applied only)"})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-gray-300 dark:border-gray-600",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700",children:[a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]})}),a.jsx("tbody",{children:Bt.map((De,ct)=>{const ut=Mt(De.asset);return ut.map((Nt,Rt)=>a.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[Rt===0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:ut.length,children:De.asset?a.jsx("button",{onClick:()=>r(`/assets/${De.asset}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:De.asset}):"-"}),a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:ut.length,children:De.asset_name||"-"}),a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:ut.length,children:De.manufacturer||"-"})]}),a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:a.jsx("button",{onClick:()=>r(`/maintenance/${Nt.name}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:Nt.name})}),a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm",children:a.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${Nt.workflow_state==="Applied"?wt("Applied"):wt("Planned")}`,children:Nt.workflow_state==="Applied"?"Applied (Pending Approval)":"Planned"})}),a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:Nt.due_date?new Date(Nt.due_date).toLocaleDateString():"-"})]},`${De.name}-${Nt.name}`))})})]})})]}),vt&&Bt.length===0&&a.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:[a.jsx(Ha,{className:"mx-auto text-green-600 dark:text-green-400 text-3xl mb-2"}),a.jsx("h3",{className:"text-lg font-semibold text-green-800 dark:text-green-300 mb-1",children:"All Maintenance Entries Completed"}),a.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."})]}),a.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-600 dark:text-gray-400 mb-3",children:"Metadata"}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created:"}),a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.creation?new Date(s.creation).toLocaleString():"-"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created By:"}),a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.owner||"-"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified:"}),a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.modified?new Date(s.modified).toLocaleString():"-"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified By:"}),a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.modified_by||"-"})]})]})]})]})})}),a.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:a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Zg,{className:"text-blue-600 dark:text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Activity Log"})]}),Z.length===0?a.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[a.jsx(Zg,{className:"mx-auto text-3xl mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No activity recorded yet"})]}):a.jsx("div",{className:"space-y-3",children:Z.map(De=>a.jsx("div",{className:`rounded-lg p-3 border ${De.action==="Approved"?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":De.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:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center ${De.action==="Approved"?"bg-green-100 dark:bg-green-900/30":De.action==="Applied"?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-600"}`,children:De.action==="Approved"?a.jsx(Ku,{className:"text-green-600 dark:text-green-400 text-sm"}):a.jsx(Xu,{className:"text-blue-600 dark:text-blue-400 text-sm"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-medium ${De.action==="Approved"?"text-green-800 dark:text-green-300":De.action==="Applied"?"text-blue-800 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:De.action}),a.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx(Nf,{className:"text-[10px]"}),a.jsx("span",{className:"truncate",children:De.user})]}),a.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx(ol,{className:"text-[10px]"}),a.jsx("span",{children:new Date(De.timestamp).toLocaleString()})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-600",children:a.jsxs("div",{className:"text-xs space-y-1",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Entries:"}),a.jsx("span",{className:`font-medium ${De.action==="Approved"?"text-green-600 dark:text-green-400":"text-blue-600 dark:text-blue-400"}`,children:De.entriesCount})]}),De.completionDate&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Completion Date:"}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:new Date(De.completionDate).toLocaleDateString()})]})]})})]})]})},De.id))})]})})]}),C&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-lg w-full mx-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:a.jsx(Xu,{className:"text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Apply for Approval"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[ie.size," of ",ae.length," ",ae.length===1?"entry":"entries"," selected"]})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Select Entries to Complete:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:oe,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{type:"button",onClick:we,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Deselect All"})]})]}),a.jsx("div",{className:"max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-700 rounded-lg p-3 space-y-2",children:ae.map((De,ct)=>a.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${ie.has(De.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:[a.jsx("input",{type:"checkbox",checked:ie.has(De.name),onChange:()=>He(De.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.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:ct+1}),a.jsxs("div",{className:"truncate",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:De.asset_display_name||De.asset_name||"Unknown Asset"}),a.jsx("span",{className:"text-gray-400 dark:text-gray-500 mx-1",children:"-"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:De.name})]})]}),De.due_date&&a.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Due: ",new Date(De.due_date).toLocaleDateString()]})]})]},De.name))}),a.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[ie.size," selected"]}),ie.size===0&&a.jsx("span",{className:"text-red-500 dark:text-red-400",children:"Please select at least one entry"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Completion Date *"}),a.jsx("input",{type:"date",value:P,onChange:De=>B(De.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&&a.jsx("div",{className:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(yi,{className:"text-blue-600 dark:text-blue-400"}),a.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:["Next PM Date: ",a.jsx("strong",{className:"text-blue-600 dark:text-blue-400",children:new Date(Ne.next_pm_date).toLocaleDateString()})]})]})}),U&&a.jsxs("div",{className:"mb-4",children:[a.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:a.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-400 flex items-center gap-2",children:[a.jsx("span",{className:"text-lg",children:"⚠️"}),"Completion date is before the Next PM Date. Please provide a reason."]})}),a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Early Completion Reason *"}),a.jsx("textarea",{value:V,onChange:De=>z(De.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"})]}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>{O(!1),B(""),z(""),he(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:de,children:"Cancel"}),a.jsx("button",{onClick:Ie,disabled:de||!P||ie.size===0||U&&!V.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:de?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Xu,{}),"Complete (",ie.size,")"]})})]})]})}),ve&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-lg w-full mx-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:a.jsx(Ku,{className:"text-green-600 dark:text-green-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Approve Entries"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[Q.size," of ",D.length," ",D.length===1?"entry":"entries"," selected"]})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Select Entries to Approve:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:qe,className:"text-xs text-green-600 dark:text-green-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{type:"button",onClick:Ue,className:"text-xs text-green-600 dark:text-green-400 hover:underline",children:"Deselect All"})]})]}),a.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((De,ct)=>a.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${Q.has(De.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:[a.jsx("input",{type:"checkbox",checked:Q.has(De.name),onChange:()=>bt(De.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.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:ct+1}),a.jsxs("div",{className:"truncate",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:De.asset_display_name||De.asset_name||"Unknown Asset"}),a.jsx("span",{className:"text-gray-400 dark:text-gray-500 mx-1",children:"-"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:De.name})]})]}),De.completion_date&&a.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Completed: ",new Date(De.completion_date).toLocaleDateString()]})]})]},De.name))}),a.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[Q.size," selected"]}),Q.size===0&&a.jsx("span",{className:"text-red-500 dark:text-red-400",children:"Please select at least one entry"})]})]}),a.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:a.jsxs("p",{className:"text-sm text-green-700 dark:text-green-400",children:["✓ Approving will ",a.jsx("strong",{children:"submit"})," the documents (docstatus = 1) and trigger auto-creation of next planned entries."]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>{me(!1),fe(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:ee,children:"Cancel"}),a.jsx("button",{onClick:ht,disabled:ee||Q.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:ee?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Approving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ku,{}),"Approve (",Q.size,")"]})})]})]})}),S&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Confirm Delete"}),a.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."}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>A(!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"}),a.jsx("button",{onClick:Dt,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:y,children:y?"Deleting...":"Delete"})]})]})})]})},jM=({month:e,year:t,filters:r={},viewType:s="maintenance-log",timeView:i="day-month"})=>{const d=xa(),c=new Date,[f,p]=j.useState(e!=null?e:c.getMonth()),[g,x]=j.useState(t!=null?t:c.getFullYear()),y=new Date(g,f,1).toISOString().split("T")[0],v=new Date(g,f+1,0).toISOString().split("T")[0],k=JSON.stringify(r),T=j.useMemo(()=>r,[k]),N=j.useMemo(()=>ne({due_date:["between",[y,v]]},T),[y,v,T]),S=j.useMemo(()=>({}),[]),A=j.useMemo(()=>({}),[]),{logs:C,loading:O}=Gf(s==="maintenance-log"?N:S,s==="maintenance-log"?1e3:0,0,"due_date asc"),{pmSchedules:P,loading:B}=Gp(s==="ppm-planner"?T:S,1e3,0,"creation desc",A),V=s==="maintenance-log"?O:B,z=j.useMemo(()=>s==="maintenance-log"?C.filter(q=>{if(!q.due_date)return!1;const Q=new Date(q.due_date);return Q.getMonth()===f&&Q.getFullYear()===g}):P.filter(Q=>{const fe=Q.due_date||Q.start_date;if(!fe)return!1;const[ae,F,D]=fe.split("-").map(Number),H=new Date(ae,F-1,D);return H.getMonth()===f&&H.getFullYear()===g}),[C,P,f,g,s]);j.useEffect(()=>{s==="ppm-planner"&&!B&&(console.log("=== PPM PLANNER DEBUG ==="),console.log("[MaintenanceCalendar] Viewing Month:",f+1,"Year:",g),console.log("[MaintenanceCalendar] Total PM Schedules fetched:",P.length),console.log("[MaintenanceCalendar] Filtered for current month:",z.length),z.length>0?(console.log("[MaintenanceCalendar] Schedules showing in this month:"),z.forEach(q=>{console.log(` - ${q.name}: due_date=${q.due_date}, start_date=${q.start_date}`)})):(console.log("[MaintenanceCalendar] No schedules match this month."),console.log("[MaintenanceCalendar] Due dates in fetched data:"),P.slice(0,5).forEach(q=>{const Q=q.due_date||q.start_date;console.log(` - ${q.name}: due_date=${q.due_date}, start_date=${q.start_date}, will show in: ${Q?(()=>{const[fe,ae]=Q.split("-").map(Number);return`${ae}/${fe}`})():"unknown"}`)}),console.log("[MaintenanceCalendar] TIP: Navigate to the month where due_dates match to see schedules.")),console.log("========================="))},[s,P,B,z.length,f,g]);const U=(q,Q)=>{const fe=new Date(Q)<new Date&&q!=="Completed";switch(q){case"Completed":return"bg-green-500 text-white border-green-600";case"Planned":return fe?"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"}},J=new Date(g,f,1).getDay(),de=new Date(g,f+1,0).getDate(),ye=Array.from({length:de},(q,Q)=>Q+1),ie=q=>{q>0?f===11?(p(0),x(g+1)):p(f+1):f===0?(p(11),x(g-1)):p(f-1)},he=q=>s==="maintenance-log"?z.filter(Q=>Q.due_date?new Date(Q.due_date).getDate()===q:!1):z.filter(fe=>{const ae=fe.due_date||fe.start_date;if(!ae)return!1;const[F,D,H]=ae.split("-").map(Number),Z=new Date(F,D-1,H);return Z.getDate()===q&&Z.getMonth()===f&&Z.getFullYear()===g}),ve=()=>{p(c.getMonth()),x(c.getFullYear())},me=["January","February","March","April","May","June","July","August","September","October","November","December"],ee=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow h-full flex flex-col overflow-hidden",children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2 lg:gap-3",children:[a.jsx(yi,{className:"text-blue-600 dark:text-blue-400",size:20}),a.jsxs("h2",{className:"text-xl lg:text-2xl font-bold text-gray-800 dark:text-white",children:[me[f]," ",g]})]}),a.jsxs("div",{className:"flex gap-1 lg:gap-2",children:[a.jsx("button",{onClick:()=>ie(-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:a.jsx(Zf,{})}),a.jsx("button",{onClick:ve,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"}),a.jsx("button",{onClick:()=>ie(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:a.jsx(qf,{})})]})]}),V?a.jsxs("div",{className:"flex items-center justify-center flex-1",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),a.jsxs("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:["Loading ",s==="maintenance-log"?"maintenance logs":"PPM Planners","..."]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex-1 overflow-auto p-4 lg:p-6",children:[a.jsx("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 mb-2",children:ee.map(q=>a.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:q},q))}),a.jsxs("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 auto-rows-fr",children:[Array.from({length:J}).map((q,Q)=>a.jsx("div",{className:"p-1 lg:p-2"},`empty-${Q}`)),ye.map(q=>{const Q=he(q),fe=q===c.getDate()&&f===c.getMonth()&&g===c.getFullYear();return a.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 ${fe?"border-blue-500 border-2 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700"}`,children:[a.jsx("div",{className:`font-semibold mb-1 text-xs lg:text-sm flex-shrink-0 ${fe?"text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300"}`,children:q}),a.jsxs("div",{className:"space-y-1 flex-1 overflow-hidden",children:[Q.slice(0,2).map(ae=>{if(s==="maintenance-log"){const F=ae,D=new Date(F.due_date||"")<new Date&&F.maintenance_status!=="Completed";return a.jsx("div",{onClick:()=>d(`/maintenance/${F.name}`),className:`text-xs p-1 rounded border ${U(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:a.jsx("div",{className:"truncate font-medium text-xs",children:F.asset_name||F.name})},F.name)}else{const F=ae,H=F.pm_for||F.pm_for||F["PM Name"]||null||F.name||"PPM Planner",Z=F.name?`${F.name}${F.modality?` - ${F.modality}`:""}${F.hospital?` - ${F.hospital}`:""} - Click to view PPM Planner`:"Click to view PPM Planner";return a.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:Z,children:a.jsx("div",{className:"truncate font-medium text-xs",children:H})},F.name)}}),Q.length>2&&a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["+",Q.length-2]})]})]},q)})]})]}),a.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:a.jsxs("div",{className:"flex flex-col lg:flex-row justify-between items-center gap-3 lg:gap-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-3 lg:gap-4 items-center justify-center lg:justify-start",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 bg-green-500 rounded border border-green-600"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded border border-yellow-600"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 bg-red-500 rounded border border-red-600"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 border-2 border-blue-500 rounded bg-blue-50 dark:bg-blue-900/20"}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Today"})]})]}),a.jsx("div",{className:"flex gap-4 lg:gap-6 text-center",children:s==="maintenance-log"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-lg lg:text-xl font-bold text-green-600 dark:text-green-400",children:z.filter(q=>q.maintenance_status==="Completed").length}),a.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg lg:text-xl font-bold text-yellow-600 dark:text-yellow-400",children:z.filter(q=>q.maintenance_status==="Planned"&&new Date(q.due_date||"")>=new Date).length}),a.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg lg:text-xl font-bold text-red-600 dark:text-red-400",children:z.filter(q=>new Date(q.due_date||"")<new Date&&q.maintenance_status!=="Completed").length}),a.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]})]}):a.jsxs("div",{children:[a.jsx("div",{className:"text-lg lg:text-xl font-bold text-purple-600 dark:text-purple-400",children:z.length}),a.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"PPM Planners"})]})})]})})]})]})},SM=()=>{const e=xa(),[t]=hl(),[r,s]=j.useState(""),[i,d]=j.useState(""),[c,f]=j.useState(""),[p,g]=j.useState("");j.useEffect(()=>{const O=t.get("hospital"),P=t.get("status");O&&s(O),P&&f(P)},[t]);const[x,y]=j.useState("maintenance-log"),[v,k]=j.useState(!1),[T,N]=j.useState(0);j.useEffect(()=>{const O=[r,i,c,p].filter(Boolean).length;N(O)},[r,i,c,p]);const S=()=>{s(""),d(""),f(""),g("")},A=r||i||c||p,C=j.useMemo(()=>{const O={};return r&&(O.company=r),i&&(O.department=i),c&&(O.maintenance_status=c),p&&(O.assign_to_name=p),O},[r,i,c,p]);return a.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[a.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:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-3 md:gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[a.jsx(yi,{className:"text-blue-600 dark:text-blue-400 flex-shrink-0",size:22}),a.jsx("div",{className:"min-w-0",children:a.jsx("h1",{className:"text-lg md:text-xl font-bold text-gray-800 dark:text-white whitespace-nowrap",children:"Maintenance Calendar"})})]}),a.jsxs("div",{className:"flex items-end gap-2 md:gap-3 flex-wrap md:flex-nowrap",children:[a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"View Type"}),a.jsxs("select",{value:x,onChange:O=>y(O.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:[a.jsx("option",{value:"maintenance-log",children:"Maintenance Log"}),a.jsx("option",{value:"ppm-planner",children:"PPM Planner"})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Filters"}),a.jsxs("button",{onClick:()=>k(!v),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 ${A?"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:[a.jsx(ws,{size:14}),a.jsx("span",{className:"hidden sm:inline",children:"Filters"}),T>0&&a.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}),v?a.jsx(m0,{size:12}):a.jsx(Ec,{size:12})]})]}),x==="ppm-planner"&&a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Yearly Map"}),a.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:[a.jsx(MS,{size:14}),a.jsx("span",{className:"hidden sm:inline",children:"Yearly Map"}),a.jsx("span",{className:"sm:hidden",children:"Map"})]})]})]})]}),v&&a.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:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:r,onChange:O=>s(O),placeholder:"Select Hospital",compact:!0}),r&&a.jsx("button",{onClick:()=>s(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(_t,{label:"Department",doctype:"Department",value:i,onChange:O=>d(O),placeholder:"All Departments",compact:!0}),i&&a.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),a.jsxs("select",{value:c,onChange:O=>f(O.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:[a.jsx("option",{value:"",children:"All Statuses"}),a.jsx("option",{value:"Planned",children:"Planned"}),a.jsx("option",{value:"Completed",children:"Completed"}),a.jsx("option",{value:"Overdue",children:"Overdue"}),a.jsx("option",{value:"Cancelled",children:"Cancelled"})]}),c&&a.jsx("button",{onClick:()=>f(""),className:"absolute right-8 top-7 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[50]",children:[a.jsx(_t,{label:"Assigned To",doctype:"User",value:p,onChange:O=>g(O),placeholder:"All Technicians",compact:!0}),p&&a.jsx("button",{onClick:()=>g(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]})]}),A&&a.jsx("div",{className:"mt-3 flex justify-end",children:a.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:[a.jsx(xt,{}),"Clear Filters"]})})]})]}),a.jsx("div",{className:"flex-1 overflow-hidden px-3 pb-3 lg:px-4 lg:pb-4",children:a.jsx(jM,{filters:C,viewType:x,timeView:"day-month"})})]})},Yv=()=>{const e=xa(),[t,r]=j.useState(2025),[s,i]=j.useState(2030),d=j.useMemo(()=>({}),[]),c=j.useMemo(()=>({}),[]),{pmSchedules:f,loading:p,error:g}=Gp(d,1e3,0,"creation desc",c),x=(N,S,A,C,O)=>{const P=N.toLowerCase().trim(),B=S.getFullYear(),V=S.getMonth(),z=new Date(C,O,1),U=new Date(C,O+1,0,23,59,59,999);if(z>A||U<S)return!1;const J=(C-B)*12+(O-V);switch(P){case"daily":return z<=A&&U>=S;case"weekly":return z<=A&&U>=S;case"monthly":return J>=0&&z<=A;case"quarterly":return J>=0&&J%3===0&&z<=A;case"half-yearly":case"half yearly":return J>=0&&J%6===0&&z<=A;case"yearly":case"annually":return O===V&&z<=A&&z>=S;case"2 yearly":case"2-yearly":return J>=0&&J%24===0&&z<=A;case"3 yearly":case"3-yearly":return J>=0&&J%36===0&&z<=A;default:return z<=A&&U>=S}},y=j.useMemo(()=>{const N={};for(let S=t;S<=s;S++){N[S]={};for(let A=0;A<12;A++)N[S][A]=[]}return f.forEach(S=>{let A=null,C=null;if(S.start_date){const[B,V,z]=S.start_date.split("-").map(Number)}if(S.end_date){const[B,V,z]=S.end_date.split("-").map(Number);A=new Date(B,V-1,z)}if(S.due_date){const[B,V,z]=S.due_date.split("-").map(Number);C=new Date(B,V-1,z)}if(!C)return;const O=A||C,P=S.periodicity||"monthly";for(let B=t;B<=s;B++)for(let V=0;V<12;V++)x(P,C,O,B,V)&&(N[B][V].some(U=>U.name===S.name)||N[B][V].push(S))}),N},[f,t,s]);j.useEffect(()=>{p||(console.log("[YearlyPPMPlannerPage] PM Schedules count:",f.length),console.log("[YearlyPPMPlannerPage] Matrix years:",t,"to",s))},[f,p,t,s]);const v=N=>{r(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 a.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[a.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:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx(Ns,{className:"text-gray-600 dark:text-gray-400",size:18})}),a.jsx(yi,{className:"text-blue-600 dark:text-blue-400",size:24}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:"Site or Cluster PPM Calendar"}),a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"View PM Schedule Generators across multiple years"})]})]}),a.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:[a.jsx(hf,{size:14}),"Month"]})]})}),a.jsx("div",{className:"flex-shrink-0 px-3 lg:px-4 py-2",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 p-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("button",{onClick:()=>v(-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:a.jsx(Zf,{})}),a.jsxs("h2",{className:"text-lg font-bold text-gray-800 dark:text-white",children:[t," - ",s]}),a.jsx("button",{onClick:()=>v(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:a.jsx(qf,{})})]})})}),a.jsx("div",{className:"flex-1 overflow-auto px-3 pb-3 lg:px-4 lg:pb-4",children:p?a.jsxs("div",{className:"flex items-center justify-center h-full",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),a.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:"Loading PPM Planners..."})]}):g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error loading PPM Planners: ",g]})})}):a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0 z-10",children:a.jsxs("tr",{children:[a.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)=>a.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))]})}),a.jsx("tbody",{children:T.map(N=>a.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[a.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,A)=>{var O;const C=((O=y[N])==null?void 0:O[A])||[];return a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-2 py-2 align-top min-h-[60px]",children:C.length>0?a.jsx("div",{className:"space-y-1",children:C.map(P=>{const B=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:B});const V=B||P.name||"PPM Planner",z=[];P.name&&z.push(P.name),P.modality&&z.push(P.modality),P.hospital&&z.push(P.hospital);const U=z.length>0?`${z.join(" - ")} - Click to view details`:"Click to view details";return a.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:U,children:a.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-300 leading-tight group-hover:underline break-words",children:V})},P.name)})}):a.jsx("div",{className:"text-xs text-gray-300 dark:text-gray-700 text-center py-1",children:"-"})},A)})]},N))})]})})})})]})};function d4(e,t){const r=j.useRef(t);j.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}const TM=1;function EM(e){return Object.freeze({__version:TM,map:e})}function CM(e,t){return Object.freeze(ne(ne({},e),t))}const Zp=j.createContext(null);function qp(){const e=j.use(Zp);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function AM(e){function t(r,s){const{instance:i,context:d}=e(r).current;j.useImperativeHandle(s,()=>i);const{children:c}=r;return c==null?null:sa.createElement(Zp,{value:d},c)}return j.forwardRef(t)}function OM(e){function t(r,s){const[i,d]=j.useState(!1),{instance:c}=e(r,d).current;j.useImperativeHandle(s,()=>c),j.useEffect(function(){i&&c.update()},[c,i,r.children]);const f=c._contentNode;return f?S_.createPortal(r.children,f):null}return j.forwardRef(t)}function MM(e){function t(r,s){const{instance:i}=e(r).current;return j.useImperativeHandle(s,()=>i),null}return j.forwardRef(t)}function u4(e,t){const r=j.useRef(void 0);j.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function Yp(e,t){var s;const r=(s=e.pane)!=null?s:t.pane;return r?Se(ne({},e),{pane:r}):e}function LM(e,t){return function(s,i){const d=qp(),c=e(Yp(s,d),d);return d4(d.map,s.attribution),u4(c.current,s.eventHandlers),t(c.current,d,s,i),c}}var Wd={exports:{}};var DM=Wd.exports,Xv;function PM(){return Xv||(Xv=1,(function(e,t){(function(r,s){s(t)})(DM,(function(r){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 p(o){return"_leaflet_id"in o||(o._leaflet_id=++f),o._leaflet_id}function g(o,h,b){var E,M,G,ge;return ge=function(){E=!1,M&&(G.apply(b,M),M=!1)},G=function(){E?M=arguments:(o.apply(b,arguments),setTimeout(ge,h),E=!0)},G}function x(o,h,b){var E=h[1],M=h[0],G=E-M;return o===E&&b?o:((o-M)%G+G)%G+M}function y(){return!1}function v(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 A=/\{ *([\w_ -]+) *\}/g;function C(o,h){return o.replace(A,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 O=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 B="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function V(o){return window["webkit"+o]||window["moz"+o]||window["ms"+o]}var z=0;function U(o){var h=+new Date,b=Math.max(0,16-(h-z));return z=h+b,window.setTimeout(o,b)}var J=window.requestAnimationFrame||V("RequestAnimationFrame")||U,de=window.cancelAnimationFrame||V("CancelAnimationFrame")||V("CancelRequestAnimationFrame")||function(o){window.clearTimeout(o)};function ye(o,h,b){if(b&&J===U)o.call(h);else return J.call(window,c(o,h))}function ie(o){o&&de.call(window,o)}var he={__proto__:null,extend:i,create:d,bind:c,get lastId(){return f},stamp:p,throttle:g,wrapNum:x,falseFn:y,formatNum:v,trim:k,splitWords:T,setOptions:N,getParamString:S,template:C,isArray:O,indexOf:P,emptyImageUrl:B,requestFn:J,cancelFn:de,requestAnimFrame:ye,cancelAnimFrame:ie};function ve(){}ve.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 G=0,ge=E._initHooks.length;G<ge;G++)E._initHooks[G].call(this)}},h},ve.include=function(o){var h=this.prototype.options;return i(this.prototype,o),o.options&&(this.prototype.options=h,this.mergeOptions(o.options)),this},ve.mergeOptions=function(o){return i(this.prototype.options,o),this},ve.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=O(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 ee={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,G=o.length;M<G;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,G=0,ge=o.length;G<ge;G++)M?this._off(o[G]):this._off(o[G],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,G;if(this._events&&(E=this._events[o],!!E)){if(arguments.length===1){if(this._firingCount)for(M=0,G=E.length;M<G;M++)E[M].fn=y;delete this._events[o];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var ge=this._listens(o,h,b);if(ge!==!1){var Ae=E[ge];this._firingCount&&(Ae.fn=y,this._events[o]=E=E.slice()),E.splice(ge,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 G=0,ge=M.length;G<ge;G++){var Ae=M[G],Pe=Ae.fn;Ae.once&&this.off(o,Pe,Ae.ctx),Pe.call(Ae.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 G=this._events&&this._events[o];if(G&&G.length&&this._listens(o,M,b)!==!1)return!0;if(E){for(var ge in this._eventParents)if(this._eventParents[ge].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,G=E.length;M<G;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,G=o.length;M<G;M++)this._on(o[M],h,b,!0)}return this},addEventParent:function(o){return this._eventParents=this._eventParents||{},this._eventParents[p(o)]=o,this},removeEventParent:function(o){return this._eventParents&&delete this._eventParents[p(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)}};ee.addEventListener=ee.on,ee.removeEventListener=ee.clearAllEventListeners=ee.off,ee.addOneTimeEventListener=ee.once,ee.fireEvent=ee.fire,ee.hasEventListeners=ee.listens;var q=ve.extend(ee);function Q(o,h,b){this.x=b?Math.round(o):o,this.y=b?Math.round(h):h}var fe=Math.trunc||function(o){return o>0?Math.floor(o):Math.ceil(o)};Q.prototype={clone:function(){return new Q(this.x,this.y)},add:function(o){return this.clone()._add(ae(o))},_add:function(o){return this.x+=o.x,this.y+=o.y,this},subtract:function(o){return this.clone()._subtract(ae(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 Q(this.x*o.x,this.y*o.y)},unscaleBy:function(o){return new Q(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=fe(this.x),this.y=fe(this.y),this},distanceTo:function(o){o=ae(o);var h=o.x-this.x,b=o.y-this.y;return Math.sqrt(h*h+b*b)},equals:function(o){return o=ae(o),o.x===this.x&&o.y===this.y},contains:function(o){return o=ae(o),Math.abs(o.x)<=Math.abs(this.x)&&Math.abs(o.y)<=Math.abs(this.y)},toString:function(){return"Point("+v(this.x)+", "+v(this.y)+")"}};function ae(o,h,b){return o instanceof Q?o:O(o)?new Q(o[0],o[1]):o==null?o:typeof o=="object"&&"x"in o&&"y"in o?new Q(o.x,o.y):new Q(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 Q||typeof o[0]=="number"||"x"in o)h=b=ae(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 ae((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,o)},getBottomLeft:function(){return ae(this.min.x,this.max.y)},getTopRight:function(){return ae(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 Q?o=ae(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,G=M.x>=h.x&&E.x<=b.x,ge=M.y>=h.y&&E.y<=b.y;return G&&ge},overlaps:function(o){o=D(o);var h=this.min,b=this.max,E=o.min,M=o.max,G=M.x>h.x&&E.x<b.x,ge=M.y>h.y&&E.y<b.y;return G&&ge},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(ae(h.x-E,h.y-M),ae(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 H(o,h){if(o)for(var b=h?[o,h]:o,E=0,M=b.length;E<M;E++)this.extend(b[E])}H.prototype={extend:function(o){var h=this._southWest,b=this._northEast,E,M;if(o instanceof K)E=o,M=o;else if(o instanceof H){if(E=o._southWest,M=o._northEast,!E||!M)return this}else return o?this.extend(ue(o)||Z(o)):this;return!h&&!b?(this._southWest=new K(E.lat,E.lng),this._northEast=new K(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 H(new K(h.lat-E,h.lng-M),new K(b.lat+E,b.lng+M))},getCenter:function(){return new K((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 K(this.getNorth(),this.getWest())},getSouthEast:function(){return new K(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 K||"lat"in o?o=ue(o):o=Z(o);var h=this._southWest,b=this._northEast,E,M;return o instanceof H?(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=Z(o);var h=this._southWest,b=this._northEast,E=o.getSouthWest(),M=o.getNorthEast(),G=M.lat>=h.lat&&E.lat<=b.lat,ge=M.lng>=h.lng&&E.lng<=b.lng;return G&&ge},overlaps:function(o){o=Z(o);var h=this._southWest,b=this._northEast,E=o.getSouthWest(),M=o.getNorthEast(),G=M.lat>h.lat&&E.lat<b.lat,ge=M.lng>h.lng&&E.lng<b.lng;return G&&ge},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(o,h){return o?(o=Z(o),this._southWest.equals(o.getSouthWest(),h)&&this._northEast.equals(o.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Z(o,h){return o instanceof H?o:new H(o,h)}function K(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)}K.prototype={equals:function(o,h){if(!o)return!1;o=ue(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("+v(this.lat,o)+", "+v(this.lng,o)+")"},distanceTo:function(o){return Ne.distance(this,ue(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 Z([this.lat-h,this.lng-b],[this.lat+h,this.lng+b])},clone:function(){return new K(this.lat,this.lng,this.alt)}};function ue(o,h,b){return o instanceof K?o:O(o)&&typeof o[0]!="object"?o.length===3?new K(o[0],o[1],o[2]):o.length===2?new K(o[0],o[1]):null:o==null?o:typeof o=="object"&&"lat"in o?new K(o.lat,"lng"in o?o.lng:o.lon,o.alt):h===void 0?null:new K(o,h,b)}var Le={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 K(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 G=o.getSouthWest(),ge=o.getNorthEast(),Ae=new K(G.lat-E,G.lng-M),Pe=new K(ge.lat-E,ge.lng-M);return new H(Ae,Pe)}},Ne=i({},Le,{wrapLng:[-180,180],R:6371e3,distance:function(o,h){var b=Math.PI/180,E=o.lat*b,M=h.lat*b,G=Math.sin((h.lat-o.lat)*b/2),ge=Math.sin((h.lng-o.lng)*b/2),Ae=G*G+Math.cos(E)*Math.cos(M)*ge*ge,Pe=2*Math.atan2(Math.sqrt(Ae),Math.sqrt(1-Ae));return this.R*Pe}}),We=6378137,Fe={R:We,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 Q(this.R*o.lng*h,this.R*Math.log((1+M)/(1-M))/2)},unproject:function(o){var h=180/Math.PI;return new K((2*Math.atan(Math.exp(o.y/this.R))-Math.PI/2)*h,o.x*h/this.R)},bounds:(function(){var o=We*Math.PI;return new F([-o,-o],[o,o])})()};function tt(o,h,b,E){if(O(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}tt.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 Q((o.x/h-this._b)/this._a,(o.y/h-this._d)/this._c)}};function ft(o,h,b,E){return new tt(o,h,b,E)}var Dt=i({},Ne,{code:"EPSG:3857",projection:Fe,transformation:(function(){var o=.5/(Math.PI*Fe.R);return ft(o,.5,-o,.5)})()}),Ve=i({},Dt,{code:"EPSG:900913"});function At(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function jt(o,h){var b="",E,M,G,ge,Ae,Pe;for(E=0,G=o.length;E<G;E++){for(Ae=o[E],M=0,ge=Ae.length;M<ge;M++)Pe=Ae[M],b+=(M?"L":"M")+Pe.x+" "+Pe.y;b+=h?Et.svg?"z":"x":""}return b||"M0 0"}var He=document.documentElement.style,oe="ActiveXObject"in window,we=oe&&!document.addEventListener,Ie="msLaunchUri"in navigator&&!("documentMode"in document),ot=rr("webkit"),bt=rr("android"),qe=rr("android 2")||rr("android 3"),Ue=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ht=bt&&rr("Google")&&Ue<537&&!("AudioNode"in window),wt=!!window.opera,Mt=!Ie&&rr("chrome"),Ft=rr("gecko")&&!ot&&!wt&&!oe,je=!Mt&&rr("safari"),it=rr("phantom"),vt="OTransition"in He,Bt=navigator.platform.indexOf("Win")===0,De=oe&&"transition"in He,ct="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!qe,ut="MozPerspective"in He,Nt=!window.L_DISABLE_3D&&(De||ct||ut)&&!vt&&!it,Rt=typeof orientation!="undefined"||rr("mobile"),ia=Rt&&ot,et=Rt&&ct,pe=!window.PointerEvent&&window.MSPointerEvent,ze=!!(window.PointerEvent||pe),st="ontouchstart"in window||!!window.TouchEvent,Ut=!window.L_NO_TOUCH&&(st||ze),la=Rt&&wt,va=Rt&&Ft,ar=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,tn=(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})(),Bn=(function(){return!!document.createElement("canvas").getContext})(),Gr=!!(document.createElementNS&&At("svg").createSVGRect),Zs=!!Gr&&(function(){var o=document.createElement("div");return o.innerHTML="<svg/>",(o.firstChild&&o.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Ss=!Gr&&(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}})(),an=navigator.platform.indexOf("Mac")===0,_n=navigator.platform.indexOf("Linux")===0;function rr(o){return navigator.userAgent.toLowerCase().indexOf(o)>=0}var Et={ie:oe,ielt9:we,edge:Ie,webkit:ot,android:bt,android23:qe,androidStock:ht,opera:wt,chrome:Mt,gecko:Ft,safari:je,phantom:it,opera12:vt,win:Bt,ie3d:De,webkit3d:ct,gecko3d:ut,any3d:Nt,mobile:Rt,mobileWebkit:ia,mobileWebkit3d:et,msPointer:pe,pointer:ze,touch:Ut,touchNative:st,mobileOpera:la,mobileGecko:va,retina:ar,passiveEvents:tn,canvas:Bn,svg:Gr,vml:Ss,inlineSvg:Zs,mac:an,linux:_n},W=Et.msPointer?"MSPointerDown":"pointerdown",ce=Et.msPointer?"MSPointerMove":"pointermove",I=Et.msPointer?"MSPointerUp":"pointerup",Y=Et.msPointer?"MSPointerCancel":"pointercancel",te={touchstart:W,touchmove:ce,touchend:I,touchcancel:Y},se={touchstart:mt,touchmove:nt,touchend:nt,touchcancel:nt},Ee={},re=!1;function xe(o,h,b){return h==="touchstart"&&dt(),se[h]?(b=se[h].bind(this,b),o.addEventListener(te[h],b,!1),b):(console.warn("wrong event specified:",h),y)}function ke(o,h,b){if(!te[h]){console.warn("wrong event specified:",h);return}o.removeEventListener(te[h],b,!1)}function Ce(o){Ee[o.pointerId]=o}function Qe(o){Ee[o.pointerId]&&(Ee[o.pointerId]=o)}function lt(o){delete Ee[o.pointerId]}function dt(){re||(document.addEventListener(W,Ce,!0),document.addEventListener(ce,Qe,!0),document.addEventListener(I,lt,!0),document.addEventListener(Y,lt,!0),re=!0)}function nt(o,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var b in Ee)h.touches.push(Ee[b]);h.changedTouches=[h],o(h)}}function mt(o,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Ga(h),nt(o,h)}function St(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 ya=200;function ta(o,h){o.addEventListener("dblclick",h);var b=0,E;function M(G){if(G.detail!==1){E=G.detail;return}if(!(G.pointerType==="mouse"||G.sourceCapabilities&&!G.sourceCapabilities.firesTouchEvents)){var ge=bl(G);if(!(ge.some(function(Pe){return Pe instanceof HTMLLabelElement&&Pe.attributes.for})&&!ge.some(function(Pe){return Pe instanceof HTMLInputElement||Pe instanceof HTMLSelectElement}))){var Ae=Date.now();Ae-b<=ya?(E++,E===2&&h(St(G))):E=1,b=Ae}}}return o.addEventListener("click",M),{dblclick:h,simDblclick:M}}function Ra(o,h){o.removeEventListener("dblclick",h.dblclick),o.removeEventListener("click",h.simDblclick)}var Ir=gl(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),wn=gl(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ns=wn==="webkitTransition"||wn==="OTransition"?wn+"End":"transitionend";function kn(o){return typeof o=="string"?document.getElementById(o):o}function ss(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 $t(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 rn(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function ur(o){var h=o.parentNode;h&&h.lastChild!==o&&h.appendChild(o)}function qs(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 Vt(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 G=xo(o);Ni(o,(G?G+" ":"")+h)}}function Ba(o,h){o.classList!==void 0?o.classList.remove(h):Ni(o,k((" "+xo(o)+" ").replace(" "+h+" "," ")))}function Ni(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 Fa(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 is(o,h,b){var E=h||new Q(0,0);o.style[Ir]=(Et.ie3d?"translate("+E.x+"px,"+E.y+"px)":"translate3d("+E.x+"px,"+E.y+"px,0)")+(b?" scale("+b+")":"")}function Da(o,h){o._leaflet_pos=h,Et.any3d?is(o,h):(o.style.left=h.x+"px",o.style.top=h.y+"px")}function Ts(o){return o._leaflet_pos||new Q(0,0)}var ji,Un,Hc;if("onselectstart"in document)ji=function(){Ht(window,"selectstart",Ga)},Un=function(){ba(window,"selectstart",Ga)};else{var Si=gl(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ji=function(){if(Si){var o=document.documentElement.style;Hc=o[Si],o[Si]="none"}},Un=function(){Si&&(document.documentElement.style[Si]=Hc,Hc=void 0)}}function yo(){Ht(window,"dragstart",Ga)}function pl(){ba(window,"dragstart",Ga)}var bo,$c;function Ti(o){for(;o.tabIndex===-1;)o=o.parentNode;o.style&&(nn(),bo=o,$c=o.style.outlineStyle,o.style.outlineStyle="none",Ht(window,"keydown",nn))}function nn(){bo&&(bo.style.outlineStyle=$c,bo=void 0,$c=void 0,ba(window,"keydown",nn))}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 Ei={__proto__:null,TRANSFORM:Ir,TRANSITION:wn,TRANSITION_END:ns,get:kn,getStyle:ss,create:$t,remove:Ta,empty:rn,toFront:ur,toBack:qs,hasClass:Bc,addClass:Vt,removeClass:Ba,setClass:Ni,getClass:xo,setOpacity:Fa,testProp:gl,setTransform:is,setPosition:Da,getPosition:Ts,get disableTextSelection(){return ji},get enableTextSelection(){return Un},disableImageDrag:yo,enableImageDrag:pl,preventOutline:Ti,restoreOutline:nn,getSizedParentNode:vo,getScale:xl};function Ht(o,h,b,E){if(h&&typeof h=="object")for(var M in h)jn(o,M,h[M],b);else{h=T(h);for(var G=0,ge=h.length;G<ge;G++)jn(o,h[G],b,E)}return this}var Nn="_leaflet_events";function ba(o,h,b,E){if(arguments.length===1)Wc(o),delete o[Nn];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(Ae){return P(h,Ae)!==-1});else for(var G=0,ge=h.length;G<ge;G++)yl(o,h[G],b,E);return this}function Wc(o,h){for(var b in o[Nn]){var E=b.split(/\d/)[0];(!h||h(E))&&yl(o,E,null,null,b)}}var Ys={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function jn(o,h,b,E){var M=h+p(b)+(E?"_"+p(E):"");if(o[Nn]&&o[Nn][M])return this;var G=function(Ae){return b.call(E||o,Ae||window.event)},ge=G;!Et.touchNative&&Et.pointer&&h.indexOf("touch")===0?G=xe(o,h,G):Et.touch&&h==="dblclick"?G=ta(o,G):"addEventListener"in o?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?o.addEventListener(Ys[h]||h,G,Et.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(G=function(Ae){Ae=Ae||window.event,ls(o,Ae)&&ge(Ae)},o.addEventListener(Ys[h],G,!1)):o.addEventListener(h,ge,!1):o.attachEvent("on"+h,G),o[Nn]=o[Nn]||{},o[Nn][M]=G}function yl(o,h,b,E,M){M=M||h+p(b)+(E?"_"+p(E):"");var G=o[Nn]&&o[Nn][M];if(!G)return this;!Et.touchNative&&Et.pointer&&h.indexOf("touch")===0?ke(o,h,G):Et.touch&&h==="dblclick"?Ra(o,G):"removeEventListener"in o?o.removeEventListener(Ys[h]||h,G,!1):o.detachEvent("on"+h,G),o[Nn][M]=null}function Sn(o){return o.stopPropagation?o.stopPropagation():o.originalEvent?o.originalEvent._stopped=!0:o.cancelBubble=!0,this}function Hn(o){return jn(o,"wheel",Sn),this}function Xs(o){return Ht(o,"mousedown touchstart dblclick contextmenu",Sn),o._leaflet_disable_click=!0,this}function Ga(o){return o.preventDefault?o.preventDefault():o.returnValue=!1,this}function Es(o){return Ga(o),Sn(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 Q(o.clientX,o.clientY);var b=xl(h),E=b.boundingClientRect;return new Q((o.clientX-E.left)/b.x-h.clientLeft,(o.clientY-E.top)/b.y-h.clientTop)}var A0=Et.linux&&Et.chrome?window.devicePixelRatio:Et.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Tr(o){return Et.edge?o.wheelDeltaY/2:o.deltaY&&o.deltaMode===0?-o.deltaY/A0: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 ls(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:Ht,off:ba,stopPropagation:Sn,disableScrollPropagation:Hn,disableClickPropagation:Xs,preventDefault:Ga,stop:Es,getPropagationPath:bl,getMousePosition:vl,getWheelDelta:Tr,isExternalTarget:ls,addListener:Ht,removeListener:ba},Ci=q.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=Ts(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=ye(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(),Da(this._el,b),this.fire("step")},_complete:function(){ie(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(o){return 1-Math.pow(1-o,this._easeOutPower)}}),aa=q.extend({options:{crs:Dt,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(ue(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=wn&&Et.any3d&&!Et.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ht(this._proxy,ns,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(ue(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||(Et.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+o,h)},zoomOut:function(o,h){return o=o||(Et.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),G=o instanceof Q?o:this.latLngToContainerPoint(o),ge=G.subtract(M).multiplyBy(1-1/E),Ae=this.containerPointToLatLng(M.add(ge));return this.setView(Ae,h,{zoom:b})},_getBoundsCenterZoom:function(o,h){h=h||{},o=o.getBounds?o.getBounds():Z(o);var b=ae(h.paddingTopLeft||h.padding||[0,0]),E=ae(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 G=E.subtract(b).divideBy(2),ge=this.project(o.getSouthWest(),M),Ae=this.project(o.getNorthEast(),M),Pe=this.unproject(ge.add(Ae).divideBy(2).add(G),M);return{center:Pe,zoom:M}},fitBounds:function(o,h){if(o=Z(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=ae(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 Ci,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Vt(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||!Et.any3d)return this.setView(o,h,b);this._stop();var E=this.project(this.getCenter()),M=this.project(o),G=this.getSize(),ge=this._zoom;o=ue(o),h=h===void 0?ge:h;var Ae=Math.max(G.x,G.y),Pe=Ae*this.getZoomScale(ge,h),Je=M.distanceTo(E)||1,yt=1.42,Lt=yt*yt;function Yt(Wa){var us=Wa?-1:1,ei=Wa?Pe:Ae,sd=Pe*Pe-Ae*Ae+us*Lt*Lt*Je*Je,Rl=2*ei*Lt*Je,Fl=sd/Rl,Fs=Math.sqrt(Fl*Fl+1)-Fl,fs=Fs<1e-9?-18:Math.log(Fs);return fs}function fr(Wa){return(Math.exp(Wa)-Math.exp(-Wa))/2}function Za(Wa){return(Math.exp(Wa)+Math.exp(-Wa))/2}function qr(Wa){return fr(Wa)/Za(Wa)}var oa=Yt(0);function ca(Wa){return Ae*(Za(oa)/Za(oa+yt*Wa))}function Kt(Wa){return Ae*(Za(oa)*qr(oa+yt*Wa)-fr(oa))/Lt}function Ps(Wa){return 1-Math.pow(1-Wa,1.5)}var cn=Date.now(),Po=(Yt(1)-oa)/yt,Rs=b.duration?1e3*b.duration:1e3*Po*.8;function nd(){var Wa=(Date.now()-cn)/Rs,us=Ps(Wa)*Po;Wa<=1?(this._flyToFrame=ye(nd,this),this._move(this.unproject(E.add(M.subtract(E).multiplyBy(Kt(us)/Je)),ge),this.getScaleZoom(Ae/ca(us),ge),{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=Z(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,Z(o));return b.equals(E)||this.panTo(E,h),this._enforcingBounds=!1,this},panInside:function(o,h){h=h||{};var b=ae(h.paddingTopLeft||h.padding||[0,0]),E=ae(h.paddingBottomRight||h.padding||[0,0]),M=this.project(this.getCenter()),G=this.project(o),ge=this.getPixelBounds(),Ae=D([ge.min.add(b),ge.max.subtract(E)]),Pe=Ae.getSize();if(!Ae.contains(G)){this._enforcingBounds=!0;var Je=G.subtract(Ae.getCenter()),yt=Ae.extend(G).getSize().subtract(Pe);M.x+=Je.x<0?-yt.x:yt.x,M.y+=Je.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(),G=E.subtract(M);return!G.x&&!G.y?this:(o.animate&&o.pan?this.panBy(G):(o.pan&&this._rawPanBy(G),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 K(h,b),M=E.toBounds(o.coords.accuracy*2),G=this._locateOptions;if(G.setView){var ge=this.getBoundsZoom(M);this.setView(E,G.maxZoom?Math.min(ge,G.maxZoom):ge)}var Ae={latlng:E,bounds:M,timestamp:o.timestamp};for(var Pe in o.coords)typeof o.coords[Pe]=="number"&&(Ae[Pe]=o.coords[Pe]);this.fire("locationfound",Ae)}},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&&(ie(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=$t("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 H(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=Z(o),b=ae(b||[0,0]);var E=this.getZoom()||0,M=this.getMinZoom(),G=this.getMaxZoom(),ge=o.getNorthWest(),Ae=o.getSouthEast(),Pe=this.getSize().subtract(b),Je=D(this.project(Ae,E),this.project(ge,E)).getSize(),yt=Et.any3d?this.options.zoomSnap:1,Lt=Pe.x/Je.x,Yt=Pe.y/Je.y,fr=h?Math.max(Lt,Yt):Math.min(Lt,Yt);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(G,E))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new Q(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(ue(o),h)},unproject:function(o,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(ae(o),h)},layerPointToLatLng:function(o){var h=ae(o).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(o){var h=this.project(ue(o))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(o){return this.options.crs.wrapLatLng(ue(o))},wrapLatLngBounds:function(o){return this.options.crs.wrapLatLngBounds(Z(o))},distance:function(o,h){return this.options.crs.distance(ue(o),ue(h))},containerPointToLayerPoint:function(o){return ae(o).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(o){return ae(o).add(this._getMapPanePos())},containerPointToLatLng:function(o){var h=this.containerPointToLayerPoint(ae(o));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(o){return this.layerPointToContainerPoint(this.latLngToLayerPoint(ue(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=kn(o);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ht(h,"scroll",this._onScroll,this),this._containerId=p(h)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&&Et.any3d,Vt(o,"leaflet-container"+(Et.touch?" leaflet-touch":"")+(Et.retina?" leaflet-retina":"")+(Et.ielt9?" leaflet-oldie":"")+(Et.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=ss(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),Da(this._mapPane,new Q(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Vt(o.markerPane,"leaflet-zoom-hide"),Vt(o.shadowPane,"leaflet-zoom-hide"))},_resetView:function(o,h,b){Da(this._mapPane,new Q(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 ie(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(o){Da(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[p(this._container)]=this;var h=o?ba:Ht;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),Et.any3d&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ie(this._resizeRequest),this._resizeRequest=ye(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",G=o.target||o.srcElement,ge=!1;G;){if(E=this._targets[p(G)],E&&(h==="click"||h==="preclick")&&this._draggableMoved(E)){ge=!0;break}if(E&&E.listens(h,!0)&&(M&&!ls(G,o)||(b.push(E),M))||G===this._container)break;G=G.parentNode}return!b.length&&!ge&&!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"&&Ti(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 G=[],ge=0;ge<b.length;ge++)b[ge].listens(h,!0)&&G.push(b[ge]);M=G.concat(M)}if(M.length){h==="contextmenu"&&Ga(o);var Ae=M[0],Pe={originalEvent:o};if(o.type!=="keypress"&&o.type!=="keydown"&&o.type!=="keyup"){var Je=Ae.getLatLng&&(!Ae._radius||Ae._radius<=10);Pe.containerPoint=Je?this.latLngToContainerPoint(Ae.getLatLng()):this.mouseEventToContainerPoint(o),Pe.layerPoint=this.containerPointToLayerPoint(Pe.containerPoint),Pe.latlng=Je?Ae.getLatLng():this.layerPointToLatLng(Pe.layerPoint)}for(ge=0;ge<M.length;ge++)if(M[ge].fire(h,Pe,!0),Pe.originalEvent._stopped||M[ge].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 Ts(this._mapPane)||new Q(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),G=new F(E.subtract(M),E.add(M)),ge=this._getBoundsOffset(G,b,h);return Math.abs(ge.x)<=1&&Math.abs(ge.y)<=1?o:this.unproject(E.add(ge),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),G=E.max.subtract(o.max),ge=this._rebound(M.x,-G.x),Ae=this._rebound(M.y,-G.y);return new Q(ge,Ae)},_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=Et.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(){Ba(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=$t("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(o),this.on("zoomanim",function(h){var b=Ir,E=this._proxy.style[b];is(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();is(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:(ye(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,Vt(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&&Ba(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 aa(o,h)}var Zr=ve.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 Vt(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()}}),os=function(o){return new Zr(o)};aa.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=$t("div",h+"control-container",this._container);function E(M,G){var ge=h+M+" "+h+G;o[M+G]=$t("div",ge,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=Zr.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 Zr.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(p(o));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){Vt(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?(Vt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=o+"px"):Ba(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ba(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var o="leaflet-control-layers",h=this._container=$t("div",o),b=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Xs(h),Hn(h);var E=this._section=$t("section",o+"-list");b&&(this._map.on("click",this.collapse,this),Ht(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var M=this._layersLink=$t("a",o+"-toggle",h);M.href="#",M.title="Layers",M.setAttribute("role","button"),Ht(M,{keydown:function(G){G.keyCode===13&&this._expandSafely()},click:function(G){Ga(G),this._expandSafely()}},this),b||this.expand(),this._baseLayersList=$t("div",o+"-base",E),this._separator=$t("div",o+"-separator",E),this._overlaysList=$t("div",o+"-overlays",E),h.appendChild(E)},_getLayer:function(o){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&p(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;rn(this._baseLayersList),rn(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(p(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_"+p(this),b),this._layerControlInputs.push(E),E.layerId=p(o.layer),Ht(E,"click",this._onInputClick,this);var M=document.createElement("span");M.innerHTML=" "+o.name;var G=document.createElement("span");h.appendChild(G),G.appendChild(E),G.appendChild(M);var ge=o.overlay?this._overlaysList:this._baseLayersList;return ge.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var o=this._layerControlInputs,h,b,E=[],M=[];this._handlingClick=!0;for(var G=o.length-1;G>=0;G--)h=o[G],b=this._getLayer(h.layerId).layer,h.checked?E.push(b):h.checked||M.push(b);for(G=0;G<M.length;G++)this._map.hasLayer(M[G])&&this._map.removeLayer(M[G]);for(G=0;G<E.length;G++)this._map.hasLayer(E[G])||this._map.addLayer(E[G]);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,Ht(o,"click",Ga),this.expand();var h=this;setTimeout(function(){ba(o,"click",Ga),h._preventClick=!1})}}),O0=function(o,h,b){return new _l(o,h,b)},Gc=Zr.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(o){var h="leaflet-control-zoom",b=$t("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 G=$t("a",b,E);return G.innerHTML=o,G.href="#",G.title=h,G.setAttribute("role","button"),G.setAttribute("aria-label",h),Xs(G),Ht(G,"click",Es),Ht(G,"click",M,this),Ht(G,"click",this._refocusOnMap,this),G},_updateDisabled:function(){var o=this._map,h="leaflet-disabled";Ba(this._zoomInButton,h),Ba(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||o._zoom===o.getMinZoom())&&(Vt(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||o._zoom===o.getMaxZoom())&&(Vt(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});aa.mergeOptions({zoomControl:!0}),aa.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Gc,this.addControl(this.zoomControl))});var ph=function(o){return new Gc(o)},M0=Zr.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(o){var h="leaflet-control-scale",b=$t("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=$t("div",h,b)),o.imperial&&(this._iScale=$t("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 M0(o)},xh='<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=Zr.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Et.inlineSvg?xh+" ":"")+"Leaflet</a>"},initialize:function(o){N(this,o),this._attributions={}},onAdd:function(o){o.attributionControl=this,this._container=$t("div","leaflet-control-attribution"),Xs(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> ')}}});aa.mergeOptions({attributionControl:!0}),aa.addInitHook(function(){this.options.attributionControl&&new qc().addTo(this)});var yh=function(o){return new qc(o)};Zr.Layers=_l,Zr.Zoom=Gc,Zr.Scale=M0,Zr.Attribution=qc,os.layers=O0,os.zoom=ph,os.scale=Zc,os.attribution=yh;var $n=ve.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 bh={Events:ee},Yc=Et.touch?"touchstart mousedown":"mousedown",Cs=q.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||(Ht(this._dragStartTarget,Yc,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Cs._dragging===this&&this.finishDrag(!0),ba(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){Cs._dragging===this&&this.finishDrag();return}if(!(Cs._dragging||o.shiftKey||o.which!==1&&o.button!==1&&!o.touches)&&(Cs._dragging=this,this._preventOutline&&Ti(this._element),yo(),ji(),!this._moving)){this.fire("down");var h=o.touches?o.touches[0]:o,b=vo(this._element);this._startPoint=new Q(h.clientX,h.clientY),this._startPos=Ts(this._element),this._parentScale=xl(b);var E=o.type==="mousedown";Ht(document,E?"mousemove":"touchmove",this._onMove,this),Ht(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 Q(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,Vt(document.body,"leaflet-dragging"),this._lastTarget=o.target||o.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Vt(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),Da(this._element,this._newPos),this.fire("drag",o)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(o){Ba(document.body,"leaflet-dragging"),this._lastTarget&&(Ba(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),ba(document,"mousemove touchmove",this._onMove,this),ba(document,"mouseup touchend touchcancel",this._onUp,this),pl(),Un();var h=this._moved&&this._moving;this._moving=!1,Cs._dragging=!1,h&&this.fire("dragend",{noInertia:o,distance:this._newPos.distanceTo(this._startPos)})}});function L0(o,h,b){var E,M=[1,4,2,8],G,ge,Ae,Pe,Je,yt,Lt,Yt;for(G=0,yt=o.length;G<yt;G++)o[G]._code=Js(o[G],h);for(Ae=0;Ae<4;Ae++){for(Lt=M[Ae],E=[],G=0,yt=o.length,ge=yt-1;G<yt;ge=G++)Pe=o[G],Je=o[ge],Pe._code&Lt?Je._code&Lt||(Yt=wo(Je,Pe,Lt,h,b),Yt._code=Js(Yt,h),E.push(Yt)):(Je._code&Lt&&(Yt=wo(Je,Pe,Lt,h,b),Yt._code=Js(Yt,h),E.push(Yt)),E.push(Pe));o=E}return o}function D0(o,h){var b,E,M,G,ge,Ae,Pe,Je,yt;if(!o||o.length===0)throw new Error("latlngs not passed");sn(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var Lt=ue([0,0]),Yt=Z(o),fr=Yt.getNorthWest().distanceTo(Yt.getSouthWest())*Yt.getNorthEast().distanceTo(Yt.getNorthWest());fr<1700&&(Lt=Xc(o));var Za=o.length,qr=[];for(b=0;b<Za;b++){var oa=ue(o[b]);qr.push(h.project(ue([oa.lat-Lt.lat,oa.lng-Lt.lng])))}for(Ae=Pe=Je=0,b=0,E=Za-1;b<Za;E=b++)M=qr[b],G=qr[E],ge=M.y*G.x-G.y*M.x,Pe+=(M.x+G.x)*ge,Je+=(M.y+G.y)*ge,Ae+=ge*3;Ae===0?yt=qr[0]:yt=[Pe/Ae,Je/Ae];var ca=h.unproject(ae(yt));return ue([ca.lat+Lt.lat,ca.lng+Lt.lng])}function Xc(o){for(var h=0,b=0,E=0,M=0;M<o.length;M++){var G=ue(o[M]);h+=G.lat,b+=G.lng,E++}return ue([h/E,b/E])}var Jc={__proto__:null,clipPolygon:L0,polygonCenter:D0,centroid:Xc};function P0(o,h){if(!h||!o.length)return o.slice();var b=h*h;return o=_h(o,b),o=F0(o,b),o}function R0(o,h,b){return Math.sqrt(wl(o,h,b,!0))}function vh(o,h,b){return wl(o,h,b)}function F0(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 G,ge=[];for(G=0;G<b;G++)M[G]&&ge.push(o[G]);return ge}function Kc(o,h,b,E,M){var G=0,ge,Ae,Pe;for(Ae=E+1;Ae<=M-1;Ae++)Pe=wl(o[Ae],o[E],o[M],!0),Pe>G&&(ge=Ae,G=Pe);G>b&&(h[ge]=1,Kc(o,h,b,E,ge),Kc(o,h,b,ge,M))}function _h(o,h){for(var b=[o[0]],E=1,M=0,G=o.length;E<G;E++)wh(o[E],o[M])>h&&(b.push(o[E]),M=E);return M<G-1&&b.push(o[G-1]),b}var I0;function z0(o,h,b,E,M){var G=E?I0:Js(o,b),ge=Js(h,b),Ae,Pe,Je;for(I0=ge;;){if(!(G|ge))return[o,h];if(G&ge)return!1;Ae=G||ge,Pe=wo(o,h,Ae,b,M),Je=Js(Pe,b),Ae===G?(o=Pe,G=Je):(h=Pe,ge=Je)}}function wo(o,h,b,E,M){var G=h.x-o.x,ge=h.y-o.y,Ae=E.min,Pe=E.max,Je,yt;return b&8?(Je=o.x+G*(Pe.y-o.y)/ge,yt=Pe.y):b&4?(Je=o.x+G*(Ae.y-o.y)/ge,yt=Ae.y):b&2?(Je=Pe.x,yt=o.y+ge*(Pe.x-o.x)/G):b&1&&(Je=Ae.x,yt=o.y+ge*(Ae.x-o.x)/G),new Q(Je,yt,M)}function Js(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 wh(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,G=h.y,ge=b.x-M,Ae=b.y-G,Pe=ge*ge+Ae*Ae,Je;return Pe>0&&(Je=((o.x-M)*ge+(o.y-G)*Ae)/Pe,Je>1?(M=b.x,G=b.y):Je>0&&(M+=ge*Je,G+=Ae*Je)),ge=o.x-M,Ae=o.y-G,E?ge*ge+Ae*Ae:new Q(M,G)}function sn(o){return!O(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."),sn(o)}function Ai(o,h){var b,E,M,G,ge,Ae,Pe,Je;if(!o||o.length===0)throw new Error("latlngs not passed");sn(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var yt=ue([0,0]),Lt=Z(o),Yt=Lt.getNorthWest().distanceTo(Lt.getSouthWest())*Lt.getNorthEast().distanceTo(Lt.getNorthWest());Yt<1700&&(yt=Xc(o));var fr=o.length,Za=[];for(b=0;b<fr;b++){var qr=ue(o[b]);Za.push(h.project(ue([qr.lat-yt.lat,qr.lng-yt.lng])))}for(b=0,E=0;b<fr-1;b++)E+=Za[b].distanceTo(Za[b+1])/2;if(E===0)Je=Za[0];else for(b=0,G=0;b<fr-1;b++)if(ge=Za[b],Ae=Za[b+1],M=ge.distanceTo(Ae),G+=M,G>E){Pe=(G-E)/M,Je=[Ae.x-Pe*(Ae.x-ge.x),Ae.y-Pe*(Ae.y-ge.y)];break}var oa=h.unproject(ae(Je));return ue([oa.lat+yt.lat,oa.lng+yt.lng])}var kh={__proto__:null,simplify:P0,pointToSegmentDistance:R0,closestPointOnSegment:vh,clipSegment:z0,_getEdgeIntersection:wo,_getBitCode:Js,_sqClosestPointOnSegment:wl,isFlat:sn,_flat:ko,polylineCenter:Ai},No={project:function(o){return new Q(o.lng,o.lat)},unproject:function(o){return new K(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,G=Math.sqrt(1-M*M),ge=G*Math.sin(E),Ae=Math.tan(Math.PI/4-E/2)/Math.pow((1-ge)/(1+ge),G/2);return E=-b*Math.log(Math.max(Ae,1e-10)),new Q(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),G=Math.exp(-o.y/b),ge=Math.PI/2-2*Math.atan(G),Ae=0,Pe=.1,Je;Ae<15&&Math.abs(Pe)>1e-7;Ae++)Je=M*Math.sin(ge),Je=Math.pow((1-Je)/(1+Je),M/2),Pe=Math.PI/2-2*Math.atan(G*Je)-ge,ge+=Pe;return new K(ge*h,o.x*h/b)}},B0={__proto__:null,LonLat:No,Mercator:jo,SphericalMercator:Fe},U0=i({},Ne,{code:"EPSG:3395",projection:jo,transformation:(function(){var o=.5/(Math.PI*jo.R);return ft(o,.5,-o,.5)})()}),Qc=i({},Ne,{code:"EPSG:4326",projection:No,transformation:ft(1/180,1,-1/180,.5)}),Oi=i({},Le,{projection:No,transformation:ft(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});Le.Earth=Ne,Le.EPSG3395=U0,Le.EPSG3857=Dt,Le.EPSG900913=Ve,Le.EPSG4326=Qc,Le.Simple=Oi;var Tn=q.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[p(o)]=this,this},removeInteractiveTarget:function(o){return delete this._map._targets[p(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})}}});aa.include({addLayer:function(o){if(!o._layerAdd)throw new Error("The provided object is not a Layer.");var h=p(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=p(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 p(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?O(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[p(o)]=o,this._updateZoomLevels())},_removeZoomLimit:function(o){var h=p(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 Mi=Tn.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 p(o)}}),Nh=function(o,h){return new Mi(o,h)},Wn=Mi.extend({addLayer:function(o){return this.hasLayer(o)?this:(o.addEventParent(this),Mi.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),Mi.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 H;for(var h in this._layers){var b=this._layers[h];o.extend(b.getBounds?b.getBounds():b.getLatLng())}return o}}),H0=function(o,h){return new Wn(o,h)},Vn=ve.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=ae(E),G=ae(h==="shadow"&&b.shadowAnchor||b.iconAnchor||M&&M.divideBy(2,!0));o.className="leaflet-marker-"+h+" "+(b.className||""),G&&(o.style.marginLeft=-G.x+"px",o.style.marginTop=-G.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 Et.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 G=E.exec(b);return G&&G[M]};return o=h(o,/^url\((['"])?(.+)\1\)$/,2),o&&h(o,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var o=$t("div","leaflet-default-icon-path",document.body),h=ss(o,"background-image")||ss(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 Cs(o,o,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Vt(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&&Ba(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,G=Ts(h._icon),ge=b.getPixelBounds(),Ae=b.getPixelOrigin(),Pe=D(ge.min._subtract(Ae).add(M),ge.max._subtract(Ae).subtract(M));if(!Pe.contains(G)){var Je=ae((Math.max(Pe.max.x,G.x)-Pe.max.x)/(ge.max.x-Pe.max.x)-(Math.min(Pe.min.x,G.x)-Pe.min.x)/(ge.min.x-Pe.min.x),(Math.max(Pe.max.y,G.y)-Pe.max.y)/(ge.max.y-Pe.max.y)-(Math.min(Pe.min.y,G.y)-Pe.min.y)/(ge.min.y-Pe.min.y)).multiplyBy(E);b.panBy(Je,{animate:!1}),this._draggable._newPos._add(Je),this._draggable._startPos._add(Je),Da(h._icon,this._draggable._newPos),this._onDrag(o),this._panRequest=ye(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&&(ie(this._panRequest),this._panRequest=ye(this._adjustPan.bind(this,o)))},_onDrag:function(o){var h=this._marker,b=h._shadow,E=Ts(h._icon),M=h._map.layerPointToLatLng(E);b&&Da(b,E),h._latlng=M,o.latlng=M,o.oldLatLng=this._oldLatLng,h.fire("move",o).fire("drag",o)},_onDragEnd:function(o){ie(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",o)}}),Sl=Tn.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=ue(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=ue(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||"")),Vt(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&&Ht(b,"focus",this._panOnFocus,this);var M=o.icon.createShadow(this._shadow),G=!1;M!==this._shadow&&(this._removeShadow(),G=!0),M&&(Vt(M,h),M.alt=""),this._shadow=M,o.opacity<1&&this._updateOpacity(),E&&this.getPane().appendChild(this._icon),this._initInteraction(),M&&G&&this.getPane(o.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&ba(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&&Da(this._icon,o),this._shadow&&Da(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&&(Vt(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&&Fa(this._icon,o),this._shadow&&Fa(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?ae(h.iconSize):ae(0,0),E=h.iconAnchor?ae(h.iconAnchor):ae(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 $0(o,h){return new Sl(o,h)}var Gn=Tn.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)}}),Li=Gn.extend({options:{fill:!0,radius:10},initialize:function(o,h){N(this,h),this._latlng=ue(o),this._radius=this.options.radius},setLatLng:function(o){var h=this._latlng;return this._latlng=ue(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 W0(o,h){return new Li(o,h)}var So=Li.extend({initialize:function(o,h,b){if(typeof h=="number"&&(h=i({},b,{radius:h})),N(this,h),this._latlng=ue(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 H(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,G=this._mRadius/Ne.R/M,ge=b.project([h+G,o]),Ae=b.project([h-G,o]),Pe=ge.add(Ae).divideBy(2),Je=b.unproject(Pe).lat,yt=Math.acos((Math.cos(G*M)-Math.sin(h*M)*Math.sin(Je*M))/(Math.cos(h*M)*Math.cos(Je*M)))/M;(isNaN(yt)||yt===0)&&(yt=G/Math.cos(Math.PI/180*h)),this._point=Pe.subtract(b.getPixelOrigin()),this._radius=isNaN(yt)?0:Pe.x-b.project([Je,o-yt]).x,this._radiusY=Pe.y-ge.y}else{var Lt=E.unproject(E.project(this._latlng).subtract([this._mRadius,0]));this._point=b.latLngToLayerPoint(this._latlng),this._radius=this._point.x-b.latLngToLayerPoint(Lt).x}this._updateBounds()}});function V0(o,h,b){return new So(o,h,b)}var cs=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,G,ge=0,Ae=this._parts.length;ge<Ae;ge++)for(var Pe=this._parts[ge],Je=1,yt=Pe.length;Je<yt;Je++){M=Pe[Je-1],G=Pe[Je];var Lt=E(o,M,G,!0);Lt<h&&(h=Lt,b=E(o,M,G))}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 Ai(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(o,h){return h=h||this._defaultShape(),o=ue(o),h.push(o),this._bounds.extend(o),this.redraw()},_setLatLngs:function(o){this._bounds=new H,this._latlngs=this._convertLatLngs(o)},_defaultShape:function(){return sn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(o){for(var h=[],b=sn(o),E=0,M=o.length;E<M;E++)b?(h[E]=ue(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 Q(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 K,M=o.length,G,ge;if(E){for(ge=[],G=0;G<M;G++)ge[G]=this._map.latLngToLayerPoint(o[G]),b.extend(ge[G]);h.push(ge)}else for(G=0;G<M;G++)this._projectLatlngs(o[G],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,G,ge,Ae,Pe;for(b=0,M=0,G=this._rings.length;b<G;b++)for(Pe=this._rings[b],E=0,ge=Pe.length;E<ge-1;E++)Ae=z0(Pe[E],Pe[E+1],o,E,!0),Ae&&(h[M]=h[M]||[],h[M].push(Ae[0]),(Ae[1]!==Pe[E+1]||E===ge-2)&&(h[M].push(Ae[1]),M++))}},_simplifyPoints:function(){for(var o=this._parts,h=this.options.smoothFactor,b=0,E=o.length;b<E;b++)o[b]=P0(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,G,ge,Ae,Pe=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(b=0,G=this._parts.length;b<G;b++)for(Ae=this._parts[b],E=0,ge=Ae.length,M=ge-1;E<ge;M=E++)if(!(!h&&E===0)&&R0(o,Ae[M],Ae[E])<=Pe)return!0;return!1}});function jh(o,h){return new cs(o,h)}cs._flat=ko;var Di=cs.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 D0(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(o){var h=cs.prototype._convertLatLngs.call(this,o),b=h.length;return b>=2&&h[0]instanceof K&&h[0].equals(h[b-1])&&h.pop(),h},_setLatLngs:function(o){cs.prototype._setLatLngs.call(this,o),sn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return sn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var o=this._renderer._bounds,h=this.options.weight,b=new Q(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,G;E<M;E++)G=L0(this._rings[E],o,!0),G.length&&this._parts.push(G)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(o){var h=!1,b,E,M,G,ge,Ae,Pe,Je;if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(G=0,Pe=this._parts.length;G<Pe;G++)for(b=this._parts[G],ge=0,Je=b.length,Ae=Je-1;ge<Je;Ae=ge++)E=b[ge],M=b[Ae],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||cs.prototype._containsPoint.call(this,o,!0)}});function Sh(o,h){return new Di(o,h)}var ds=Wn.extend({initialize:function(o,h){N(this,h),this._layers={},o&&this.addData(o)},addData:function(o){var h=O(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 G=this.options;if(G.filter&&!G.filter(o))return this;var ge=xr(o,G);return ge?(ge.feature=Co(o),ge.defaultOptions=ge.options,this.resetStyle(ge),G.onEachFeature&&G.onEachFeature(o,ge),this.addLayer(ge)):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 xr(o,h){var b=o.type==="Feature"?o.geometry:o,E=b?b.coordinates:null,M=[],G=h&&h.pointToLayer,ge=h&&h.coordsToLatLng||To,Ae,Pe,Je,yt;if(!E&&!b)return null;switch(b.type){case"Point":return Ae=ge(E),Pi(G,o,Ae,h);case"MultiPoint":for(Je=0,yt=E.length;Je<yt;Je++)Ae=ge(E[Je]),M.push(Pi(G,o,Ae,h));return new Wn(M);case"LineString":case"MultiLineString":return Pe=Tl(E,b.type==="LineString"?0:1,ge),new cs(Pe,h);case"Polygon":case"MultiPolygon":return Pe=Tl(E,b.type==="Polygon"?1:2,ge),new Di(Pe,h);case"GeometryCollection":for(Je=0,yt=b.geometries.length;Je<yt;Je++){var Lt=xr({geometry:b.geometries[Je],type:"Feature",properties:o.properties},h);Lt&&M.push(Lt)}return new Wn(M);case"FeatureCollection":for(Je=0,yt=b.features.length;Je<yt;Je++){var Yt=xr(b.features[Je],h);Yt&&M.push(Yt)}return new Wn(M);default:throw new Error("Invalid GeoJSON object.")}}function Pi(o,h,b,E){return o?o(h,b):new Sl(b,E&&E.markersInheritOptions&&E)}function To(o){return new K(o[1],o[0],o[2])}function Tl(o,h,b){for(var E=[],M=0,G=o.length,ge;M<G;M++)ge=h?Tl(o[M],h-1,b):(b||To)(o[M]),E.push(ge);return E}function Eo(o,h){return o=ue(o),o.alt!==void 0?[v(o.lng,h),v(o.lat,h),v(o.alt,h)]:[v(o.lng,h),v(o.lat,h)]}function El(o,h,b,E){for(var M=[],G=0,ge=o.length;G<ge;G++)M.push(h?El(o[G],sn(o[G])?0:h-1,b,E):Eo(o[G],E));return!h&&b&&M.length>0&&M.push(M[0].slice()),M}function As(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 Os={toGeoJSON:function(o){return As(this,{type:"Point",coordinates:Eo(this.getLatLng(),o)})}};Sl.include(Os),So.include(Os),Li.include(Os),cs.include({toGeoJSON:function(o){var h=!sn(this._latlngs),b=El(this._latlngs,h?1:0,!1,o);return As(this,{type:(h?"Multi":"")+"LineString",coordinates:b})}}),Di.include({toGeoJSON:function(o){var h=!sn(this._latlngs),b=h&&!sn(this._latlngs[0]),E=El(this._latlngs,b?2:h?1:0,!0,o);return h||(E=[E]),As(this,{type:(b?"Multi":"")+"Polygon",coordinates:E})}}),Mi.include({toMultiPoint:function(o){var h=[];return this.eachLayer(function(b){h.push(b.toGeoJSON(o).geometry.coordinates)}),As(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 G=M.toGeoJSON(o);if(b)E.push(G.geometry);else{var ge=Co(G);ge.type==="FeatureCollection"?E.push.apply(E,ge.features):E.push(ge)}}}),b?As(this,{geometries:E,type:"GeometryCollection"}):{type:"FeatureCollection",features:E}}});function Ao(o,h){return new ds(o,h)}var Cl=Ao,Ri=Tn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(o,h,b){this._url=o,this._bounds=Z(h),N(this,b)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Vt(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&&qs(this._image),this},setUrl:function(o){return this._url=o,this._image&&(this._image.src=o),this},setBounds:function(o){return this._bounds=Z(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:$t("img");if(Vt(h,"leaflet-image-layer"),this._zoomAnimated&&Vt(h,"leaflet-zoom-animated"),this.options.className&&Vt(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;is(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();Da(o,h.min),o.style.width=b.x+"px",o.style.height=b.y+"px"},_updateOpacity:function(){Fa(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()}}),G0=function(o,h,b){return new Ri(o,h,b)},Ms=Ri.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:$t("video");if(Vt(h,"leaflet-image-layer"),this._zoomAnimated&&Vt(h,"leaflet-zoom-animated"),this.options.className&&Vt(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}O(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 G=0;G<this._url.length;G++){var ge=$t("source");ge.src=this._url[G],h.appendChild(ge)}}});function Fi(o,h,b){return new Ms(o,h,b)}var Oo=Ri.extend({_initImage:function(){var o=this._image=this._url;Vt(o,"leaflet-image-layer"),this._zoomAnimated&&Vt(o,"leaflet-zoom-animated"),this.options.className&&Vt(o,this.options.className),o.onselectstart=y,o.onmousemove=y}});function Z0(o,h,b){return new Oo(o,h,b)}var yr=Tn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(o,h){o&&(o instanceof K||O(o))?(this._latlng=ue(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&&Fa(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),o._fadeAnimated&&Fa(this._container,1),this.bringToFront(),this.options.interactive&&(Vt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(o){o._fadeAnimated?(Fa(this._container,0),this._removeTimeout=setTimeout(c(Ta,void 0,this._container),200)):Ta(this._container),this.options.interactive&&(Ba(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(o){return this._latlng=ue(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&&qs(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=ae(this.options.offset),b=this._getAnchor();this._zoomAnimated?Da(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]}});aa.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}}),Tn.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=yr.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,yr.prototype.openOn.call(this,o)},onAdd:function(o){yr.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",Sn))},onRemove:function(o){yr.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",Sn))},getEvents:function(){var o=yr.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=$t("div",o+" "+(this.options.className||"")+" leaflet-zoom-animated"),b=this._wrapper=$t("div",o+"-content-wrapper",h);if(this._contentNode=$t("div",o+"-content",b),Xs(h),Hn(this._contentNode),Ht(h,"contextmenu",Sn),this._tipContainer=$t("div",o+"-tip-container",h),this._tip=$t("div",o+"-tip",this._tipContainer),this.options.closeButton){var E=this._closeButton=$t("a",o+"-close-button",h);E.setAttribute("role","button"),E.setAttribute("aria-label","Close popup"),E.href="#close",E.innerHTML='<span aria-hidden="true">&#215;</span>',Ht(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,G="leaflet-popup-scrolled";M&&E>M?(h.height=M+"px",Vt(o,G)):Ba(o,G),this._containerWidth=this._container.offsetWidth},_animateZoom:function(o){var h=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center),b=this._getAnchor();Da(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(ss(this._container,"marginBottom"),10)||0,b=this._container.offsetHeight+h,E=this._containerWidth,M=new Q(this._containerLeft,-b-this._containerBottom);M._add(Ts(this._container));var G=o.layerPointToContainerPoint(M),ge=ae(this.options.autoPanPadding),Ae=ae(this.options.autoPanPaddingTopLeft||ge),Pe=ae(this.options.autoPanPaddingBottomRight||ge),Je=o.getSize(),yt=0,Lt=0;G.x+E+Pe.x>Je.x&&(yt=G.x+E-Je.x+Pe.x),G.x-yt-Ae.x<0&&(yt=G.x-Ae.x),G.y+b+Pe.y>Je.y&&(Lt=G.y+b-Je.y+Pe.y),G.y-Lt-Ae.y<0&&(Lt=G.y-Ae.y),(yt||Lt)&&(this.options.keepInView&&(this._autopanning=!0),o.fire("autopanstart").panBy([yt,Lt]))}},_getAnchor:function(){return ae(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),q0=function(o,h){return new Al(o,h)};aa.mergeOptions({closePopupOnClick:!0}),aa.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}}),Tn.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)){Es(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=yr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(o){yr.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){yr.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=yr.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=$t("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+p(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(o){var h,b,E=this._map,M=this._container,G=E.latLngToContainerPoint(E.getCenter()),ge=E.layerPointToContainerPoint(o),Ae=this.options.direction,Pe=M.offsetWidth,Je=M.offsetHeight,yt=ae(this.options.offset),Lt=this._getAnchor();Ae==="top"?(h=Pe/2,b=Je):Ae==="bottom"?(h=Pe/2,b=0):Ae==="center"?(h=Pe/2,b=Je/2):Ae==="right"?(h=0,b=Je/2):Ae==="left"?(h=Pe,b=Je/2):ge.x<G.x?(Ae="right",h=0,b=Je/2):(Ae="left",h=Pe+(yt.x+Lt.x)*2,b=Je/2),o=o.subtract(ae(h,b,!0)).add(yt).add(Lt),Ba(M,"leaflet-tooltip-right"),Ba(M,"leaflet-tooltip-left"),Ba(M,"leaflet-tooltip-top"),Ba(M,"leaflet-tooltip-bottom"),Vt(M,"leaflet-tooltip-"+Ae),Da(M,o)},_updatePosition:function(){var o=this._map.latLngToLayerPoint(this._latlng);this._setPosition(o)},setOpacity:function(o){this.options.opacity=o,this._container&&Fa(this._container,o)},_animateZoom:function(o){var h=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center);this._setPosition(h)},_getAnchor:function(){return ae(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Th=function(o,h){return new Ol(o,h)};aa.include({openTooltip:function(o,h,b){return this._initOverlay(Ol,o,h,b).openOn(this),this},closeTooltip:function(o){return o.close(),this}}),Tn.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&&(Ht(h,"focus",function(){this._tooltip._source=o,this.openTooltip()},this),Ht(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 Y0=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?(rn(h),h.appendChild(b.html)):h.innerHTML=b.html!==!1?b.html:"",b.bgPos){var E=ae(b.bgPos);h.style.backgroundPosition=-E.x+"px "+-E.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function Eh(o){return new Y0(o)}Vn.Default=Nl;var Ii=Tn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Et.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&&(qs(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=g(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 Q?o:new Q(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,G;E<M;E++)G=h[E].style.zIndex,h[E]!==this._container&&G&&(b=o(b,+G));isFinite(b)&&(this.options.zIndex=b+o(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Et.ielt9){Fa(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 G=Math.min(1,(o-M.loaded)/200);Fa(M.el,G),G<1?h=!0:(M.active?b=!0:this._onOpaqueTile(M),M.active=!0)}}b&&!this._noPrune&&this._pruneTiles(),h&&(ie(this._fadeFrame),this._fadeFrame=ye(this._updateOpacity,this))}},_onOpaqueTile:y,_initContainer:function(){this._container||(this._container=$t("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=$t("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),G=Math.floor(h/2),ge=b-1,Ae=new Q(+M,+G);Ae.z=+ge;var Pe=this._tileCoordsToKey(Ae),Je=this._tiles[Pe];return Je&&Je.active?(Je.retain=!0,!0):(Je&&Je.loaded&&(Je.retain=!0),ge>E?this._retainParent(M,G,ge,E):!1)},_retainChildren:function(o,h,b,E){for(var M=2*o;M<2*o+2;M++)for(var G=2*h;G<2*h+2;G++){var ge=new Q(M,G);ge.z=b+1;var Ae=this._tileCoordsToKey(ge),Pe=this._tiles[Ae];if(Pe&&Pe.active){Pe.retain=!0;continue}else Pe&&Pe.loaded&&(Pe.retain=!0);b+1<E&&this._retainChildren(M,G,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 G=this.options.updateWhenZooming&&M!==this._tileZoom;(!E||G)&&(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();Et.any3d?is(o.el,M,E):Da(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(),G=h.getSize().divideBy(E*2);return new F(M.subtract(G),M.add(G))},_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),G=M.getCenter(),ge=[],Ae=this.options.keepBuffer,Pe=new F(M.getBottomLeft().subtract([Ae,-Ae]),M.getTopRight().add([Ae,-Ae]));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 Je in this._tiles){var yt=this._tiles[Je].coords;(yt.z!==this._tileZoom||!Pe.contains(new Q(yt.x,yt.y)))&&(this._tiles[Je].current=!1)}if(Math.abs(b-this._tileZoom)>1){this._setView(o,b);return}for(var Lt=M.min.y;Lt<=M.max.y;Lt++)for(var Yt=M.min.x;Yt<=M.max.x;Yt++){var fr=new Q(Yt,Lt);if(fr.z=this._tileZoom,!!this._isValidTile(fr)){var Za=this._tiles[this._tileCoordsToKey(fr)];Za?Za.current=!0:ge.push(fr)}}if(ge.sort(function(oa,ca){return oa.distanceTo(G)-ca.distanceTo(G)}),ge.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var qr=document.createDocumentFragment();for(Yt=0;Yt<ge.length;Yt++)this._addTile(ge[Yt],qr);this._level.el.appendChild(qr)}}}},_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 Z(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),G=h.unproject(E,o.z),ge=h.unproject(M,o.z);return[G,ge]},_tileCoordsToBounds:function(o){var h=this._tileCoordsToNwSe(o),b=new H(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 Q(+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){Vt(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,Et.ielt9&&this.options.opacity<1&&Fa(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&&ye(c(this._tileReady,this,o,null,M)),Da(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?(Fa(b.el,0),ie(this._fadeFrame),this._fadeFrame=ye(this._updateOpacity,this)):(b.active=!0,this._pruneTiles()),h||(Vt(b.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:b.el,coords:o})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Et.ielt9||!this._map._fadeAnimated?ye(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 Q(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 X0(o){return new Ii(o)}var Ls=Ii.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&&Et.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 Ht(b,"load",c(this._tileOnLoad,this,h,b)),Ht(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:Et.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){Et.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=B;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",B),Ii.prototype._removeTile.call(this,o)},_tileReady:function(o,h,b){if(!(!this._map||b&&b.getAttribute("src")===B))return Ii.prototype._tileReady.call(this,o,h,b)}});function ln(o,h){return new Ls(o,h)}var Ml=Ls.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&&Et.retina?2:1,G=this.getTileSize();b.width=G.x*M,b.height=G.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,Ls.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,G=E.max,ge=(this._wmsVersion>=1.3&&this._crs===Qc?[M.y,M.x,G.y,G.x]:[M.x,M.y,G.x,G.y]).join(","),Ae=Ls.prototype.getTileUrl.call(this,o);return Ae+S(this.wmsParams,Ae,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+ge},setParams:function(o,h){return i(this.wmsParams,o),h||this.redraw(),this}});function on(o,h){return new Ml(o,h)}Ls.WMS=Ml,ln.wms=on;var zr=Tn.extend({options:{padding:.1},initialize:function(o){N(this,o),p(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Vt(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),G=E.multiplyBy(-b).add(M).subtract(this._map._getNewPixelOrigin(o,h));Et.any3d?is(this._container,G,b):Da(this._container,G)},_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");Ht(o,"mousemove",this._onMouseMove,this),Ht(o,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ht(o,"mouseout",this._handleMouseOut,this),o._leaflet_disable_events=!0,this._ctx=o.getContext("2d")},_destroyContainer:function(){ie(this._redrawRequest),delete this._ctx,Ta(this._container),ba(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=Et.retina?2:1;Da(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",Et.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[p(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[p(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||ye(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,G,ge=o._parts,Ae=ge.length,Pe=this._ctx;if(Ae){for(Pe.beginPath(),b=0;b<Ae;b++){for(E=0,M=ge[b].length;E<M;E++)G=ge[b][E],Pe[E?"lineTo":"moveTo"](G.x,G.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&&(Ba(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&&(Vt(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 Et.canvas?new Mo(o):null}var Ds=(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=$t("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(zr.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var h=o._container=Ds("shape");Vt(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",o._path=Ds("path"),h.appendChild(o._path),this._updateStyle(o),this._layers[p(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[p(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=Ds("stroke")),M.appendChild(h),h.weight=E.weight+"px",h.color=E.color,h.opacity=E.opacity,E.dashArray?h.dashStyle=O(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=Ds("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){qs(o._container)}},Zn=Et.vml?Ds:At,zi=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),ba(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)),Da(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&&Vt(h,o.options.className),o.options.interactive&&Vt(h,"leaflet-interactive"),this._updateStyle(o),this._layers[p(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[p(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,jt(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 ",G=o._empty()?"M0 0":"M"+(h.x-b)+","+h.y+M+b*2+",0 "+M+-b*2+",0 ";this._setPath(o,G)},_setPath:function(o,h){o._path.setAttribute("d",h)},_bringToFront:function(o){ur(o._path)},_bringToBack:function(o){qs(o._path)}});Et.vml&&zi.include(ed);function Dl(o){return Et.svg||Et.vml?new zi(o):null}aa.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 Ks=Di.extend({initialize:function(o,h){Di.prototype.initialize.call(this,this._boundsToLatLngs(o),h)},setBounds:function(o){return this.setLatLngs(this._boundsToLatLngs(o))},_boundsToLatLngs:function(o){return o=Z(o),[o.getSouthWest(),o.getNorthWest(),o.getNorthEast(),o.getSouthEast()]}});function Ch(o,h){return new Ks(o,h)}zi.create=Zn,zi.pointsToPath=jt,ds.geometryToLayer=xr,ds.coordsToLatLng=To,ds.coordsToLatLngs=Tl,ds.latLngToCoords=Eo,ds.latLngsToCoords=El,ds.getFeature=As,ds.asFeature=Co,aa.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(){Ht(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ba(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(),ji(),yo(),this._startPoint=this._map.mouseEventToContainerPoint(o),Ht(document,{contextmenu:Es,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(o){this._moved||(this._moved=!0,this._box=$t("div","leaflet-zoom-box",this._container),Vt(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();Da(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),Ba(this._container,"leaflet-crosshair")),Un(),pl(),ba(document,{contextmenu:Es,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 H(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())}});aa.addInitHook("addHandler","boxZoom",Br),aa.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)}});aa.addInitHook("addHandler","doubleClickZoom",Lo),aa.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 Cs(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))}Vt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ba(this._map._container,"leaflet-grab"),Ba(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=Z(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,G=(E+h+b)%o-h-b,ge=Math.abs(M+b)<Math.abs(G+b)?M:G;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=ge},_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]),G=(this._lastTime-this._times[0])/1e3,ge=b.easeLinearity,Ae=M.multiplyBy(ge/G),Pe=Ae.distanceTo([0,0]),Je=Math.min(b.inertiaMaxSpeed,Pe),yt=Ae.multiplyBy(Je/Pe),Lt=Je/(b.inertiaDeceleration*ge),Yt=yt.multiplyBy(-Lt/2).round();!Yt.x&&!Yt.y?h.fire("moveend"):(Yt=h._limitOffset(Yt,h.options.maxBounds),ye(function(){h.panBy(Yt,{duration:Lt,easeLinearity:ge,noMoveStart:!0,animate:!0})}))}}});aa.addInitHook("addHandler","dragging",qn),aa.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"),Ht(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(),ba(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(){Ht(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ba(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=ae(E).multiplyBy(3)),b.options.maxBounds&&(E=b._limitOffset(ae(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;Es(o)}}});aa.addInitHook("addHandler","keyboard",td),aa.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Pl=$n.extend({addHooks:function(){Ht(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ba(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),Es(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,G=b?Math.ceil(M/b)*b:M,ge=o._limitZoom(h+(this._delta>0?G:-G))-h;this._delta=0,this._startTime=null,ge&&(o.options.scrollWheelZoom==="center"?o.setZoom(h+ge):o.setZoomAround(this._lastMousePos,h+ge))}});aa.addInitHook("addHandler","scrollWheelZoom",Pl);var Qs=600;aa.mergeOptions({tapHold:Et.touchNative&&Et.safari&&Et.mobile,tapTolerance:15});var Do=$n.extend({addHooks:function(){Ht(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ba(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 Q(h.clientX,h.clientY),this._holdTimeout=setTimeout(c(function(){this._cancel(),this._isTapValid()&&(Ht(document,"touchend",Ga),Ht(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),Qs),Ht(document,"touchend touchcancel contextmenu",this._cancel,this),Ht(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function o(){ba(document,"touchend",Ga),ba(document,"touchend touchcancel",o)},_cancel:function(){clearTimeout(this._holdTimeout),ba(document,"touchend touchcancel contextmenu",this._cancel,this),ba(document,"touchmove",this._onMove,this)},_onMove:function(o){var h=o.touches[0];this._newPos=new Q(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)}});aa.addInitHook("addHandler","tapHold",Do),aa.mergeOptions({touchZoom:Et.touch,bounceAtZoomLimits:!0});var ad=$n.extend({addHooks:function(){Vt(this._map._container,"leaflet-touch-zoom"),Ht(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ba(this._map._container,"leaflet-touch-zoom"),ba(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(),Ht(document,"touchmove",this._onTouchMove,this),Ht(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 G=b._add(E)._divideBy(2)._subtract(this._centerPoint);if(M===1&&G.x===0&&G.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(G),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),ie(this._animRequest);var ge=c(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=ye(ge,this,!0),Ga(o)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ie(this._animRequest),ba(document,"touchmove",this._onTouchMove,this),ba(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))}});aa.addInitHook("addHandler","touchZoom",ad),aa.BoxZoom=Br,aa.DoubleClickZoom=Lo,aa.Drag=qn,aa.Keyboard=td,aa.ScrollWheelZoom=Pl,aa.TapHold=Do,aa.TouchZoom=ad,r.Bounds=F,r.Browser=Et,r.CRS=Le,r.Canvas=Mo,r.Circle=So,r.CircleMarker=Li,r.Class=ve,r.Control=Zr,r.DivIcon=Y0,r.DivOverlay=yr,r.DomEvent=_o,r.DomUtil=Ei,r.Draggable=Cs,r.Evented=q,r.FeatureGroup=Wn,r.GeoJSON=ds,r.GridLayer=Ii,r.Handler=$n,r.Icon=Vn,r.ImageOverlay=Ri,r.LatLng=K,r.LatLngBounds=H,r.Layer=Tn,r.LayerGroup=Mi,r.LineUtil=kh,r.Map=aa,r.Marker=Sl,r.Mixin=bh,r.Path=Gn,r.Point=Q,r.PolyUtil=Jc,r.Polygon=Di,r.Polyline=cs,r.Popup=Al,r.PosAnimation=Ci,r.Projection=B0,r.Rectangle=Ks,r.Renderer=zr,r.SVG=zi,r.SVGOverlay=Oo,r.TileLayer=Ls,r.Tooltip=Ol,r.Transformation=tt,r.Util=he,r.VideoOverlay=Ms,r.bind=c,r.bounds=D,r.canvas=Ll,r.circle=V0,r.circleMarker=W0,r.control=os,r.divIcon=Eh,r.extend=i,r.featureGroup=H0,r.geoJSON=Ao,r.geoJson=Cl,r.gridLayer=X0,r.icon=kl,r.imageOverlay=G0,r.latLng=ue,r.latLngBounds=Z,r.layerGroup=Nh,r.map=Vc,r.marker=$0,r.point=ae,r.polygon=Sh,r.polyline=jh,r.popup=q0,r.rectangle=Ch,r.setOptions=N,r.stamp=p,r.svg=Dl,r.svgOverlay=Z0,r.tileLayer=ln,r.tooltip=Th,r.transformation=ft,r.version=s,r.videoOverlay=Fi;var rd=window.L;r.noConflict=function(){return window.L=rd,this},window.L=r}))})(Wd,Wd.exports)),Wd.exports}var zc=PM();const Xp=t_(zc);function gh(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function Jp(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 RM(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 f4(e){return function(r){const s=qp(),i=e(Yp(r,s),s);return d4(s.map,r.attribution),u4(i.current,r.eventHandlers),RM(i.current,s),i}}function FM(e,t){const r=Jp(e,t),s=f4(r);return AM(s)}function h4(e,t){const r=Jp(e),s=LM(r,t);return OM(s)}function IM(e,t){const r=Jp(e,t),s=f4(r);return MM(s)}function zM(e,t,r){const{opacity:s,zIndex:i}=t;s!=null&&s!==r.opacity&&e.setOpacity(s),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function BM(){return qp().map}function UM(v,y){var k=v,{bounds:e,boundsOptions:t,center:r,children:s,className:i,id:d,placeholder:c,style:f,whenReady:p,zoom:g}=k,x=gn(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),A=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&&!A.current){const B=new zc.Map(P,x);A.current=B,r!=null&&g!=null?B.setView(r,g):e!=null&&B.fitBounds(e,t),p!=null&&B.whenReady(p),S(EM(B))}},[]);j.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const O=N?sa.createElement(Zp,{value:N},s):c!=null?c:null;return sa.createElement("div",Se(ne({},T),{ref:C}),O)}const HM=j.forwardRef(UM),$M=FM(function(i,s){var d=i,{position:t}=d,r=gn(d,["position"]);const c=new zc.Marker(t,r);return gh(c,CM(s,{overlayContainer:c}))},function(t,r,s){r.position!==s.position&&t.setLatLng(r.position),r.icon!=null&&r.icon!==s.icon&&t.setIcon(r.icon),r.zIndexOffset!=null&&r.zIndexOffset!==s.zIndexOffset&&t.setZIndexOffset(r.zIndexOffset),r.opacity!=null&&r.opacity!==s.opacity&&t.setOpacity(r.opacity),t.dragging!=null&&r.draggable!==s.draggable&&(r.draggable===!0?t.dragging.enable():t.dragging.disable())}),WM=h4(function(t,r){const s=new zc.Popup(t,r.overlayContainer);return gh(s,r)},function(t,r,{position:s},i){j.useEffect(function(){const{instance:c}=t;function f(g){g.popup===c&&(c.update(),i(!0))}function p(g){g.popup===c&&i(!1)}return r.map.on({popupopen:f,popupclose:p}),r.overlayContainer==null?(s!=null&&c.setLatLng(s),c.openOn(r.map)):r.overlayContainer.bindPopup(c),function(){var x;r.map.off({popupopen:f,popupclose:p}),(x=r.overlayContainer)==null||x.unbindPopup(),r.map.removeLayer(c)}},[t,r,i,s])}),VM=IM(function(i,s){var d=i,{url:t}=d,r=gn(d,["url"]);const c=new zc.TileLayer(t,Yp(r,s));return gh(c,s)},function(t,r,s){zM(t,r,s);const{url:i}=r;i!=null&&i!==s.url&&t.setUrl(i)}),GM=h4(function(t,r){const s=new zc.Tooltip(t,r.overlayContainer);return gh(s,r)},function(t,r,{position:s},i){j.useEffect(function(){const c=r.overlayContainer;if(c==null)return;const{instance:f}=t,p=x=>{x.tooltip===f&&(s!=null&&f.setLatLng(s),f.update(),i(!0))},g=x=>{x.tooltip===f&&i(!1)};return c.on({tooltipopen:p,tooltipclose:g}),c.bindTooltip(f),function(){c.off({tooltipopen:p,tooltipclose:g}),c._map!=null&&c.unbindTooltip()}},[t,r,i,s])}),ZM="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=",qM="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",YM=Xp.icon({iconUrl:ZM,shadowUrl:qM,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]});Xp.Marker.prototype.options.icon=YM;const XM=({locations:e})=>{const t=BM();return j.useEffect(()=>{if(e.length>0&&e.some(r=>r.latitude&&r.longitude)){const r=Xp.latLngBounds(e.filter(s=>s.latitude&&s.longitude).map(s=>[s.latitude,s.longitude]));t.fitBounds(r,{padding:[30,30],maxZoom:8})}else t.setView([24.8,45.5],6)},[e,t]),null},JM=()=>{const e=xa(),[t,r]=j.useState(""),[s,i]=j.useState(""),[d,c]=j.useState([]),[f,p]=j.useState(!0),g=j.useRef({}),x=(S,A)=>le(null,null,function*(){var V,z,U,J,de,ye,ie,he,ve,me,ee,q;const C=A==="phcc",O=C?"custom_site":"company",P=C?"site_name":"company",B={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 Q=yield rt.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(JSON.stringify({[O]:S.name}))}&fields=["name"]&limit_page_length=0`),fe=(Q==null?void 0:Q.data)||[];B.assets=fe.length,C&&(B.phcc_asset_names=fe.map(ue=>ue.name));const ae=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"]`);B.normal_work_orders=((V=ae==null?void 0:ae.data)==null?void 0:V.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"]`);B.urgent_work_orders=((z=F==null?void 0:F.data)==null?void 0:z.length)||0;const[D,H,Z,K]=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(B.wo_open=((U=D==null?void 0:D.data)==null?void 0:U.length)||0,B.wo_progress=((J=H==null?void 0:H.data)==null?void 0:J.length)||0,B.wo_review=((de=Z==null?void 0:Z.data)==null?void 0:de.length)||0,B.wo_completed=((ye=K==null?void 0:K.data)==null?void 0:ye.length)||0,C&&B.phcc_asset_names&&B.phcc_asset_names.length>0){const[ue,Le,Ne]=yield Promise.all([rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",B.phcc_asset_names],maintenance_status:"Planned"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",B.phcc_asset_names],maintenance_status:"Completed"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",B.phcc_asset_names],maintenance_status:"Overdue"}))}&fields=["name"]`)]);B.planned_maintenance=((ie=ue==null?void 0:ue.data)==null?void 0:ie.length)||0,B.completed_maintenance=((he=Le==null?void 0:Le.data)==null?void 0:he.length)||0,B.overdue_maintenance=((ve=Ne==null?void 0:Ne.data)==null?void 0:ve.length)||0}else if(!C){const[ue,Le,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"]`)]);B.planned_maintenance=((me=ue==null?void 0:ue.data)==null?void 0:me.length)||0,B.completed_maintenance=((ee=Le==null?void 0:Le.data)==null?void 0:ee.length)||0,B.overdue_maintenance=((q=Ne==null?void 0:Ne.data)==null?void 0:q.length)||0}}catch(Q){console.error(`Error fetching counts for ${S.name}:`,Q)}return ne({name:S.name,latitude:parseFloat(S.latitude),longitude:parseFloat(S.longitude),location_type:A},B)}),y=()=>le(null,null,function*(){p(!0);try{let S=[];const A=[];if(!s||t){const O={latitude:["!=",""],longitude:["!=",""],custom_is_hospital:1};t&&(O.name=t),A.push(le(null,null,function*(){const P=yield rt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(O))}&fields=["name","latitude","longitude"]&limit_page_length=0`),V=((P==null?void 0:P.data)||[]).map(z=>x(z,"hospital"));return Promise.all(V)}))}if(!t||s){const O={latitude:["!=",""],longitude:["!=",""],custom_is_phcc:1};s&&(O.name=s),A.push(le(null,null,function*(){const P=yield rt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(O))}&fields=["name","latitude","longitude"]&limit_page_length=0`),V=((P==null?void 0:P.data)||[]).map(z=>x(z,"phcc"));return Promise.all(V)}))}S=(yield Promise.all(A)).flat().filter(O=>!isNaN(O.latitude)&&!isNaN(O.longitude)),c(S)}catch(S){console.error("Error fetching map data:",S)}finally{p(!1)}});j.useEffect(()=>{y()},[t,s]);const v=(S,A,C)=>{const O=new URLSearchParams,P=S.location_type==="phcc"?"site_name":"company";O.set(P,S.name),A&&O.set("priority",A),C&&O.set("status",C),e(`/work-orders?${O.toString()}`)},k=S=>{const A=new URLSearchParams,C=S.location_type==="phcc"?"custom_site":"company";A.set(C,S.name),e(`/assets?${A.toString()}`)},T=(S,A)=>{const C=new URLSearchParams;S.location_type==="phcc"?C.set("phcc",S.name):C.set("hospital",S.name),A&&C.set("status",A),e(`/maintenance-calendar?${C.toString()}`)},N=S=>{const C=S.location_type==="phcc"?a.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"}):a.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 a.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[280px] max-w-[320px]",children:[a.jsxs("div",{className:"mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h3",{className:"text-lg font-bold text-gray-900 dark:text-white flex items-center flex-wrap",children:[S.name,C]}),a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:["Total Assets: ",a.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:S.assets})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Work Order Status"}),a.jsxs("div",{className:"flex gap-2 mb-3",children:[a.jsxs("button",{onClick:()=>v(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]}),a.jsxs("button",{onClick:()=>v(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]})]}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Status"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Count"})]})}),a.jsxs("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:[a.jsxs("tr",{className:"bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors",children:[a.jsx("td",{className:"px-3 py-2 text-red-800 dark:text-red-300 font-medium",children:"Open"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:()=>v(S,void 0,"Open"),className:"text-red-700 dark:text-red-400 font-bold hover:underline cursor-pointer",children:S.wo_open})})]}),a.jsxs("tr",{className:"bg-yellow-50 dark:bg-yellow-900/20 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors",children:[a.jsx("td",{className:"px-3 py-2 text-yellow-800 dark:text-yellow-300 font-medium",children:"Work In Progress"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:()=>v(S,void 0,"Work In Progress"),className:"text-yellow-700 dark:text-yellow-400 font-bold hover:underline cursor-pointer",children:S.wo_progress})})]}),a.jsxs("tr",{className:"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors",children:[a.jsx("td",{className:"px-3 py-2 text-blue-800 dark:text-blue-300 font-medium",children:"Pending Review"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:()=>v(S,void 0,"Pending Review"),className:"text-blue-700 dark:text-blue-400 font-bold hover:underline cursor-pointer",children:S.wo_review})})]}),a.jsxs("tr",{className:"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30 transition-colors",children:[a.jsx("td",{className:"px-3 py-2 text-green-800 dark:text-green-300 font-medium",children:"Completed"}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:()=>v(S,void 0,"Completed"),className:"text-green-700 dark:text-green-400 font-bold hover:underline cursor-pointer",children:S.wo_completed})})]})]})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Preventive Maintenance"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.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]}),a.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]}),a.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]})]})]}),a.jsxs("div",{className:"flex gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[a.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"}),a.jsx("button",{onClick:()=>v(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 a.jsxs("div",{className:"h-screen flex flex-col bg-gray-50 dark:bg-gray-900",children:[a.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:a.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:"Active Map"})}),a.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:a.jsxs("div",{className:"flex flex-wrap gap-4 relative z-[1000]",children:[a.jsx("div",{className:"w-64 relative z-[1000]",children:a.jsx(_t,{label:"Hospital",doctype:"Location",value:t,onChange:r,filters:{custom_is_hospital:1},placeholder:"Select hospital"})}),a.jsx("div",{className:"w-64 relative z-[1000]",children:a.jsx(_t,{label:"PHCC",doctype:"Location",value:s,onChange:i,filters:{custom_is_phcc:1},placeholder:"Select PHCC"})})]})}),a.jsxs("div",{className:"flex-1 relative",style:{zIndex:1},children:[f&&a.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:a.jsx("div",{className:"text-gray-600 dark:text-gray-300",children:"Loading map data..."})}),a.jsxs(HM,{center:[24.8,45.5],zoom:6,style:{height:"100%",width:"100%"},zoomControl:!0,children:[a.jsx(VM,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),a.jsx(XM,{locations:d}),d.map(S=>{const A=S.urgent_work_orders>0?"🚨 URGENT! ":"",C=S.location_type==="phcc",O=C?"🏥 PHCC":"🏨 Hospital",P=`${S.name}-${S.latitude}-${S.longitude}`;return a.jsxs($M,{position:[S.latitude,S.longitude],ref:B=>{B&&(g.current[P]=B,setTimeout(()=>{const V=B.getElement();V&&(V.classList.remove("urgent-marker","red-marker","phcc-marker"),S.urgent_work_orders>0?V.classList.add("urgent-marker","red-marker"):C&&V.classList.add("phcc-marker"))},100))},children:[a.jsx(GM,{permanent:!1,direction:"right",className:"hospital-tooltip-modern",children:a.jsxs("div",{className:"p-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[200px]",children:[a.jsxs("div",{className:"mb-2 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:[A,S.name]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:O}),a.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5",children:["Assets: ",a.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:S.assets})]})]}),a.jsxs("div",{className:"space-y-1 text-xs",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Normal WOs:"}),a.jsx("span",{className:"font-semibold text-blue-700 dark:text-blue-300",children:S.normal_work_orders})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Urgent WOs:"}),a.jsx("span",{className:"font-semibold text-red-700 dark:text-red-300",children:S.urgent_work_orders})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Planned PMs:"}),a.jsx("span",{className:"font-semibold text-orange-700 dark:text-orange-300",children:S.planned_maintenance})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Completed PMs:"}),a.jsx("span",{className:"font-semibold text-green-700 dark:text-green-300",children:S.completed_maintenance})]})]})]})}),a.jsx(WM,{className:C?"phcc-popup-container":"hospital-popup-container",maxWidth:320,maxHeight:450,autoPan:!0,keepInView:!0,closeButton:!0,autoClose:!1,children:N(S)})]},P)})]})]}),a.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 KM{getItems(t,r,s=20,i=0){return le(this,null,function*(){var d;try{const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),r&&c.append("fields",JSON.stringify(r)),c.append("limit_page_length",s.toString()),c.append("limit_start",i.toString());const f=yield rt.apiCall(`/api/resource/Item?${c.toString()}`),p=((d=f.data)==null?void 0:d.length)||0;return{data:f.data||[],total:p}}catch(c){throw console.error("Error fetching items:",c),c}})}getItem(t){return le(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}`)).data}catch(r){throw console.error("Error fetching item:",r),r}})}createItem(t){return le(this,null,function*(){try{return(yield rt.apiCall("/api/resource/Item",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).data}catch(r){throw console.error("Error creating item:",r),r}})}updateItem(t,r){return le(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).data}catch(s){throw console.error("Error updating item:",s),s}})}deleteItem(t){return le(this,null,function*(){try{yield rt.apiCall(`/api/resource/Item/${t}`,{method:"DELETE"})}catch(r){throw console.error("Error deleting item:",r),r}})}submitItem(t){return le(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}/submit`,{method:"POST"})).data}catch(r){throw console.error("Error submitting item:",r),r}})}cancelItem(t){return le(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}/cancel`,{method:"POST"})).data}catch(r){throw console.error("Error cancelling item:",r),r}})}}const xc=new KM;function QM(e,t=20,r=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[p,g]=j.useState(!1),[x,y]=j.useState(!0),[v,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),A=JSON.stringify(e);j.useEffect(()=>{if(S.current&&v)return;let O=!1;return S.current=!0,le(null,null,function*(){try{y(!0);const B=["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"],V=yield xc.getItems(e,B,t,r);O||(d(V.data),f(V.total),g(V.data.length===t),k(null))}catch(B){if(!O){const V=B instanceof Error?B.message:"Failed to fetch items";k(V),d([]),f(0),g(!1)}}finally{O||y(!1)}}),()=>{O=!0}},[A,t,r,s,T]);const C=j.useCallback(()=>{S.current=!1,N(O=>O+1)},[]);return{items:i,totalCount:c,hasMore:p,loading:x,error:v,refetch:C}}function eL(e){const[t,r]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null),i(!1);return}try{i(!0),c(null);const g=yield xc.getItem(e);r(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch item details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const p=j.useCallback(()=>{f()},[f]);return{item:t,loading:s,error:d,refetch:p}}function m4(){const[e,t]=j.useState(!1),[r,s]=j.useState(null),i=j.useCallback(p=>le(null,null,function*(){try{return t(!0),s(null),yield xc.createItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to create item";throw s(x),g}finally{t(!1)}}),[]),d=j.useCallback((p,g)=>le(null,null,function*(){try{return t(!0),s(null),yield xc.updateItem(p,g)}catch(x){const y=x instanceof Error?x.message:"Failed to update item";throw s(y),x}finally{t(!1)}}),[]),c=j.useCallback(p=>le(null,null,function*(){try{t(!0),s(null),yield xc.deleteItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to delete item";throw s(x),g}finally{t(!1)}}),[]),f=j.useCallback(p=>le(null,null,function*(){try{return t(!0),s(null),yield xc.submitItem(p)}catch(g){const x=g instanceof Error?g.message:"Failed to submit item";throw s(x),g}finally{t(!1)}}),[]);return{createItem:i,updateItem:d,deleteItem:c,submitItem:f,loading:e,error:r}}const tL=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:p}=Va(),[g,x]=j.useState(r>0?"selected":"all_with_filters"),[y,v]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{r>0?x("selected"):x("all_with_filters")},[r]);const N=C=>{T(O=>O.includes(C)?O.filter(P=>P!==C):[...O,C])},S=()=>{T(f.map(C=>C.key))},A=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[p("listPages.export")," Items"]})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>x("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected item",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," item",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," item",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>v("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>v("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:A,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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=>a.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:[a.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(g,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},aL=()=>{const{t:e}=Va(),t=xa(),[r,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}],[p,g]=j.useState(!1),[x,y]=j.useState(new Set),[v,k]=j.useState(!1),[T,N]=j.useState(!1),[S,A]=j.useState(""),[C,O]=j.useState(""),[P,B]=j.useState(""),[V,z]=j.useState(""),[U,J]=j.useState(!0),[de,ye]=j.useState(0),[ie,he]=j.useState([]),[ve,me]=j.useState(!1),[ee,q]=j.useState(""),[Q,fe]=j.useState(""),ae=j.useRef(null);j.useEffect(()=>{const je=localStorage.getItem("itemFilterPresets");je&&he(JSON.parse(je))},[]),j.useEffect(()=>{const je=[S,C,P,V].filter(Boolean).length;ye(je)},[S,C,P,V]);const F={};S&&(F.name=S),C&&(F.item_group=C),P&&(F.custom_hospital_name=P),V&&(F.item_name=["like",`%${V}%`]);const{items:D,totalCount:H,hasMore:Z,loading:K,error:ue,refetch:Le}=QM(Object.keys(F).length>0?F:void 0,c,r*c,"creation desc"),{deleteItem:Ne,loading:We}=m4();j.useEffect(()=>{!K&&!p&&g(!0)},[K,p]),j.useEffect(()=>{r!==0&&s(0)},[S,C,P,V]),j.useEffect(()=>{y(new Set)},[S,C,P,V,r]);const Fe=je=>{fe(je),ae.current&&clearTimeout(ae.current),ae.current=window.setTimeout(()=>{z(je)},800)},tt=je=>{je.key==="Enter"&&(je.preventDefault(),ae.current&&clearTimeout(ae.current),z(Q))},ft=()=>{if(!ee.trim()){alert("Please enter a filter name");return}const je={id:Date.now(),name:ee,filters:{filterItemId:S,filterItemGroup:C,filterCompany:P,filterItemName:V}},it=[...ie,je];he(it),q(""),me(!1),localStorage.setItem("itemFilterPresets",JSON.stringify(it))},Dt=je=>{const it=je.filters;A(it.filterItemId||""),O(it.filterItemGroup||""),B(it.filterCompany||""),z(it.filterItemName||""),fe(it.filterItemName||"")},Ve=je=>{const it=ie.filter(vt=>vt.id!==je);he(it),localStorage.setItem("itemFilterPresets",JSON.stringify(it))};j.useEffect(()=>()=>{ae.current&&clearTimeout(ae.current)},[]);const At=()=>{A(""),O(""),B(""),z(""),fe(""),ae.current&&clearTimeout(ae.current)},jt=S||C||P||V,He=je=>je?new Date(je).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",oe=je=>{y(it=>{const vt=new Set(it);return vt.has(je)?vt.delete(je):vt.add(je),vt})},we=()=>{x.size===D.length?y(new Set):y(new Set(D.map(je=>je.name)))},Ie=D.length>0&&x.size===D.length,ot=x.size>0&&x.size<D.length,bt=j.useCallback(()=>le(null,null,function*(){const je=[];let it=0;const vt=100;let Bt=!0;for(;Bt;)try{const ut=(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:it*vt,limit_page_length:vt,order_by:"creation desc"})})).json()).message||[];je.push(...ut),ut.length<vt?Bt=!1:it++,it>100&&(console.warn("Export safety limit reached"),Bt=!1)}catch(De){throw console.error("Error fetching items for export:",De),De}return je}),[F]),qe=(je,it,vt)=>le(null,null,function*(){N(!0);try{let Bt=[];switch(je){case"selected":Bt=D.filter(ct=>x.has(ct.name));break;case"all_on_page":Bt=D;break;case"all_with_filters":Bt=yield bt();break}if(Bt.length===0){alert("No data to export");return}const De=vt.map(ct=>{const ut=f.find(Nt=>Nt.key===ct);return(ut==null?void 0:ut.label)||ct});if(it==="csv"){const ct=[De.join(","),...Bt.map(ia=>vt.map(et=>{let pe=ia[et]||"";return typeof pe=="string"&&(pe.includes(",")||pe.includes('"')||pe.includes(`
`))&&(pe=`"${pe.replace(/"/g,'""')}"`),pe}).join(","))].join(`
`),ut=new Blob(["\uFEFF"+ct],{type:"text/csv;charset=utf-8;"}),Nt=URL.createObjectURL(ut),Rt=document.createElement("a");Rt.href=Nt,Rt.download=`items_export_${new Date().toISOString().split("T")[0]}.csv`,Rt.click(),URL.revokeObjectURL(Nt)}else if(it==="excel"){const ct=[De,...Bt.map(Rt=>vt.map(ia=>Rt[ia]||""))],ut=jr.aoa_to_sheet(ct),Nt=jr.book_new();jr.book_append_sheet(Nt,ut,"Items"),Ic(Nt,`items_export_${new Date().toISOString().split("T")[0]}.xlsx`)}k(!1),y(new Set)}catch(Bt){console.error("Export failed:",Bt),alert(`Export failed: ${Bt instanceof Error?Bt.message:"Unknown error"}`)}finally{N(!1)}}),Ue=()=>{t("/inventory/new")},ht=je=>{t(`/inventory/${je}`)},wt=je=>{t(`/inventory/${je}`)},Mt=je=>le(null,null,function*(){try{yield Ne(je),d(null),Le(),alert("Item deleted successfully!")}catch(it){alert(`Failed to delete: ${it instanceof Error?it.message:"Unknown error"}`)}}),Ft=je=>{t(`/inventory/new?duplicate=${je}`)};return K&&!p?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading items..."})]})}):ue?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Error Loading Items"}),a.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[a.jsx("p",{children:a.jsx("strong",{children:"Failed to load items."})}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.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"}),a.jsx("button",{onClick:Le,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),a.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-red-300 dark:border-red-700",children:a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"Technical Error:"})," ",ue]})})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"Inventory"}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",H," item",H!==1?"s":"",x.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",x.size," selected"]}),K&&p&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[a.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.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:H===0,children:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),x.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:x.size})]}),a.jsxs("button",{onClick:Ue,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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:"Add Item"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsx("button",{onClick:()=>J(!U),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:U?a.jsx(m0,{size:14}):a.jsx(Ec,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ws,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),de>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:de})]}),jt&&a.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[S&&a.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:[a.jsx("span",{className:"font-semibold",children:"Item ID:"})," ",S,a.jsx("button",{onClick:je=>{je.stopPropagation(),A("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),V&&a.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:[a.jsx("span",{className:"font-semibold",children:"Name:"})," ",V,a.jsx("button",{onClick:je=>{je.stopPropagation(),z(""),fe("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),P&&a.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:[a.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",P,a.jsx("button",{onClick:je=>{je.stopPropagation(),B("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]}),C&&a.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:[a.jsx("span",{className:"font-semibold",children:"Item Group:"})," ",C,a.jsx("button",{onClick:je=>{je.stopPropagation(),O("")},className:"hover:text-red-500 transition-colors",children:a.jsx(xt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[de>0&&a.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:[a.jsx(gr,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),jt&&a.jsxs("button",{onClick:At,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:[a.jsx(xt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),U&&a.jsxs("div",{className:"p-4",children:[ie.length>0&&a.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[a.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ie.map(je=>a.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:[a.jsx("button",{onClick:()=>Dt(je),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:je.name}),a.jsx("button",{onClick:()=>Ve(je.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(ma,{size:10})})]},je.id))})]}),a.jsx("div",{className:"space-y-5",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Item",doctype:"Item",value:S,onChange:je=>A(je),placeholder:"Select Item",disabled:!1,compact:!0}),S&&a.jsx("button",{onClick:()=>A(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Item Name"}),a.jsx("input",{type:"text",value:Q,onChange:je=>Fe(je.target.value),onKeyDown:tt,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"}),Q&&Q!==V&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),V&&a.jsx("button",{onClick:()=>{z(""),fe("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:P,onChange:je=>B(je),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),P&&a.jsx("button",{onClick:()=>B(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(_t,{label:"Item Group",doctype:"Item Group",value:C,onChange:je=>O(je),placeholder:"Select Item Group",disabled:!1,compact:!0}),C&&a.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]})]})})})]})]}),ve&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),a.jsx("input",{type:"text",value:ee,onChange:je=>q(je.target.value),onKeyDown:je=>{je.key==="Enter"&&(je.preventDefault(),ft())},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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:()=>{me(!1),q("")},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"}),a.jsxs("button",{onClick:ft,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:[a.jsx(gr,{size:12}),"Save Filter"]})]})]})}),a.jsx(tL,{isOpen:v,onClose:()=>k(!1),selectedCount:x.size,totalCount:H,pageCount:D.length,onExport:qe,isExporting:T,exportColumns:f}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[K&&p&&a.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:a.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[a.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.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?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):ot?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:D.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(NS,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No items found"}),jt?a.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:"Clear filters"}):a.jsx("button",{onClick:Ue,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=>a.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:()=>ht(je.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:it=>it.stopPropagation(),children:a.jsx("button",{onClick:()=>oe(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)?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:je.item_code||je.name})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.item_name||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.item_group||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.custom_hospital_name||"-"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:He(je.modified)})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:it=>it.stopPropagation(),children:[a.jsx("button",{onClick:()=>ht(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:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>wt(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:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>Ft(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:a.jsx(Cc,{})}),a.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:We,children:a.jsx(ma,{})})]})})]},je.name))})]})}),(Z||r>0)&&a.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r*c+1," to ",Math.min((r+1)*c,H)," of ",H," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>s(Math.max(0,r-1)),disabled:r===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"}),a.jsx("button",{onClick:()=>s(r+1),disabled:!Z,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&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Item"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Item ID:"})," ",i]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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:We,children:"Cancel"}),a.jsx("button",{onClick:()=>Mt(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:We,children:We?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ma,{}),"Delete Item"]})})]})]})]})})}),a.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;
}
`})]})},rL=()=>{var he;const{itemName:e}=fl(),t=xa(),[r]=hl(),s=r.get("duplicate"),i=e==="new",d=i&&!!s,[c,f]=j.useState(0),[p,g]=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:v,loading:k,error:T,refetch:N}=eL(d?s:i?null:e||null),{createItem:S,updateItem:A,loading:C}=m4(),[O,P]=j.useState(i),B=(he=v==null?void 0:v.docstatus)!=null?he:0,V=B===1,z=B===2,U=B===0,J=x.item_group==="Tools",de=j.useCallback(ve=>le(null,null,function*(){var me;if(ve){g(!0);try{let ee=null;typeof window!="undefined"&&window.csrf_token&&(ee=window.csrf_token);const q=JSON.stringify([["item_code","=",ve]]),Q=JSON.stringify(["actual_qty","warehouse"]),fe=`${zt.BASE_URL}/api/resource/Bin?filters=${encodeURIComponent(q)}&fields=${encodeURIComponent(Q)}&limit_page_length=0`,ae={Accept:"application/json","Content-Type":"application/json"};ee&&(ae["X-Frappe-CSRF-Token"]=ee);const F=yield fetch(fe,{method:"GET",headers:ae,credentials:"include"});if(!F.ok)throw new Error(`HTTP error! status: ${F.status}`);const H=((me=(yield F.json()).data)==null?void 0:me.reduce((Z,K)=>Z+(K.actual_qty||0),0))||0;f(H)}catch(ee){console.error("Failed to fetch balance qty:",ee),f(0)}finally{g(!1)}}}),[]);j.useEffect(()=>{!i&&(v!=null&&v.item_code)&&de(v.item_code)},[i,v==null?void 0:v.item_code,de]),j.useEffect(()=>{var ve,me,ee,q,Q,fe;v&&!d?(y({item_code:v.item_code||"",item_name:v.item_name||"",item_group:v.item_group||"",custom_hospital_name:v.custom_hospital_name||"",custom_part_description:v.custom_part_description||"",stock_uom:v.stock_uom||"Nos",custom_item_cost_per_unit:v.custom_item_cost_per_unit||0,disabled:v.disabled||0,is_stock_item:(ve=v.is_stock_item)!=null?ve:1,opening_stock:v.opening_stock||0,valuation_rate:v.valuation_rate||0,standard_rate:v.standard_rate||0,custom_last_calibration_date:v.custom_last_calibration_date||"",custom_next_due_calibration_date:v.custom_next_due_calibration_date||"",description:v.description||"",brand:v.brand||"",custom_warranty_in_months:v.custom_warranty_in_months||"",valuation_method:v.valuation_method||"",has_batch_no:v.has_batch_no||0,has_serial_no:v.has_serial_no||0,is_purchase_item:(me=v.is_purchase_item)!=null?me:1,is_sales_item:(ee=v.is_sales_item)!=null?ee:1,country_of_origin:v.country_of_origin||"Saudi Arabia",uoms:v.uoms||[],item_defaults:v.item_defaults||[]}),P(!1)):d&&v&&y({item_code:"",item_name:v.item_name||"",item_group:v.item_group||"",custom_hospital_name:v.custom_hospital_name||"",custom_part_description:v.custom_part_description||"",stock_uom:v.stock_uom||"Nos",custom_item_cost_per_unit:v.custom_item_cost_per_unit||0,disabled:0,is_stock_item:(q=v.is_stock_item)!=null?q:1,opening_stock:v.opening_stock||0,valuation_rate:v.valuation_rate||0,standard_rate:v.standard_rate||0,custom_last_calibration_date:v.custom_last_calibration_date||"",custom_next_due_calibration_date:v.custom_next_due_calibration_date||"",description:v.description||"",brand:v.brand||"",custom_warranty_in_months:v.custom_warranty_in_months||"",valuation_method:v.valuation_method||"",has_batch_no:v.has_batch_no||0,has_serial_no:v.has_serial_no||0,is_purchase_item:(Q=v.is_purchase_item)!=null?Q:1,is_sales_item:(fe=v.is_sales_item)!=null?fe:1,country_of_origin:v.country_of_origin||"Saudi Arabia",uoms:v.uoms||[],item_defaults:v.item_defaults||[]})},[v,d]);const ye=()=>le(null,null,function*(){try{if(i){const ve=yield S(x);t(`/inventory/${ve.name}`)}else yield A(e,x),yield N(),x.item_code&&de(x.item_code),P(!1),alert("Item updated successfully!")}catch(ve){alert(`Failed to save: ${ve instanceof Error?ve.message:"Unknown error"}`)}}),ie=j.useCallback(ve=>!!(!O||z||V),[O,z,V]);return k?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading item..."})]})}):T&&!i?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Item"}),a.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:T}),a.jsx("button",{onClick:()=>t("/inventory"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Inventory"})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>t("/inventory"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ns,{size:20})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:i?"New Item":(v==null?void 0:v.item_name)||(v==null?void 0:v.item_code)||"Item"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:i?"Create a new item":`Item Code: ${(v==null?void 0:v.item_code)||e}`})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!i&&!O&&U&&a.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:[a.jsx(Rr,{}),"Edit"]}),O&&a.jsxs(a.Fragment,{children:[a.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"}),a.jsxs("button",{onClick:ye,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:[a.jsx(gr,{}),C?"Saving...":"Save"]})]})]})]}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"md:col-span-2",children:a.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"})}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Item Code ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:x.item_code,onChange:ve=>y(Se(ne({},x),{item_code:ve.target.value})),disabled:ie("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})]}),a.jsx("div",{children:a.jsx(_t,{label:"Hospital",doctype:"Company",value:x.custom_hospital_name||"",onChange:ve=>y(Se(ne({},x),{custom_hospital_name:ve})),disabled:ie("custom_hospital_name"),placeholder:"Select Hospital",filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(_t,{label:"Item Group",doctype:"Item Group",value:x.item_group||"",onChange:ve=>y(Se(ne({},x),{item_group:ve})),disabled:ie("item_group"),placeholder:"Select item group"})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Stock UOM"}),a.jsx("input",{type:"text",value:x.stock_uom,onChange:ve=>y(Se(ne({},x),{stock_uom:ve.target.value})),disabled:ie("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Part Description"}),a.jsx("input",{type:"text",value:x.custom_part_description,onChange:ve=>y(Se(ne({},x),{custom_part_description:ve.target.value})),disabled:ie("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"})]}),a.jsx("div",{className:"md:col-span-2 mt-6",children:a.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Stock Information"})}),a.jsx("div",{className:"md:col-span-2",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-end",children:[a.jsxs("div",{className:"flex items-center gap-2 h-[42px]",children:[a.jsx("input",{type:"checkbox",id:"is_stock_item",checked:x.is_stock_item===1,onChange:ve=>y(Se(ne({},x),{is_stock_item:ve.target.checked?1:0})),disabled:ie("is_stock_item"),className:"w-4 h-4"}),a.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&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Opening Stock"}),a.jsx("input",{type:"number",value:x.opening_stock,onChange:ve=>y(Se(ne({},x),{opening_stock:parseFloat(ve.target.value)||0})),disabled:ie("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&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Valuation Rate"}),a.jsx("input",{type:"number",step:"0.01",value:x.valuation_rate,onChange:ve=>y(Se(ne({},x),{valuation_rate:parseFloat(ve.target.value)||0})),disabled:ie("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&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Balance Qty"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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"}),a.jsx("button",{type:"button",onClick:()=>x.item_code&&de(x.item_code),disabled:p,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:a.jsx(yp,{className:p?"animate-spin":""})})]})]})]})}),J&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"md:col-span-2 mt-6",children:a.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Calibration Information"})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Last Calibration Date"}),a.jsx("input",{type:"date",value:x.custom_last_calibration_date,onChange:ve=>y(Se(ne({},x),{custom_last_calibration_date:ve.target.value})),disabled:ie("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Next Due Calibration Date"}),a.jsx("input",{type:"date",value:x.custom_next_due_calibration_date,onChange:ve=>y(Se(ne({},x),{custom_next_due_calibration_date:ve.target.value})),disabled:ie("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"})]})]}),a.jsx("div",{className:"md:col-span-2 mt-6",children:a.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Additional Information"})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),a.jsx("textarea",{value:x.description,onChange:ve=>y(Se(ne({},x),{description:ve.target.value})),disabled:ie("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Warranty (Months)"}),a.jsx("input",{type:"text",value:x.custom_warranty_in_months,onChange:ve=>y(Se(ne({},x),{custom_warranty_in_months:ve.target.value})),disabled:ie("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 nL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sL=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase()),Jv=e=>{const t=sL(e);return t.charAt(0).toUpperCase()+t.slice(1)},g4=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim(),iL=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var lL={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 oL=j.forwardRef((g,p)=>{var x=g,{color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:d,iconNode:c}=x,f=gn(x,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return j.createElement("svg",ne(ne(Se(ne({ref:p},lL),{width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:g4("lucide",i)}),!d&&!iL(f)&&{"aria-hidden":"true"}),f),[...c.map(([y,v])=>j.createElement(y,v)),...Array.isArray(d)?d:[d]])});const pr=(e,t)=>{const r=j.forwardRef((c,d)=>{var f=c,{className:s}=f,i=gn(f,["className"]);return j.createElement(oL,ne({ref:d,iconNode:t,className:g4(`lucide-${nL(Jv(e))}`,`lucide-${e}`,s)},i))});return r.displayName=Jv(e),r};const cL=[["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"}]],dL=pr("bell",cL);const uL=[["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"}]],fL=pr("calendar-check",uL);const hL=[["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"}]],mL=pr("calendar",hL);const gL=[["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"}]],pL=pr("circle-question-mark",gL);const xL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Kv=pr("circle-user",xL);const yL=[["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"}]],bL=pr("clipboard-list",yL);const vL=[["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"}]],_L=pr("construction",vL);const wL=[["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"}]],kL=pr("file-text",wL);const NL=[["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"}]],jL=pr("languages",NL);const SL=[["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"}]],TL=pr("layout-dashboard",SL);const EL=[["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"}]],CL=pr("log-out",EL);const AL=[["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"}]],OL=pr("map",AL);const ML=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],LL=pr("menu",ML);const DL=[["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"}]],PL=pr("moon",DL);const RL=[["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"}]],Qv=pr("package",RL);const FL=[["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"}]],IL=pr("shopping-cart",FL);const zL=[["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"}]],BL=pr("sun",zL);const UL=[["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"}]],HL=pr("users",UL);const $L=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],WL=pr("x",$L),e_=({title:e="Coming Soon"})=>a.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 p-4",children:a.jsxs("div",{className:"text-center max-w-md",children:[a.jsx("div",{className:"mb-6 flex justify-center",children:a.jsx("div",{className:"bg-blue-100 dark:bg-blue-900/30 p-6 rounded-full",children:a.jsx(_L,{size:64,className:"text-blue-600 dark:text-blue-400"})})}),a.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-4",children:e}),a.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."}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 shadow-lg",children:a.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!"})})]})}),VL=({userEmail:e})=>{const[t,r]=j.useState(!1),s=Gs(),i=xa(),{isRTL:d}=gp(),{t:c}=Va(),[f,p]=j.useState(""),g="/assets/asm_ui_app/asm_app/",x="?v=1765196376",y="?v=1765198405",v=g.endsWith("/")?`${g}sidebar-background.jpg${x}`:`${g}/sidebar-background.jpg${x}`;j.useEffect(()=>{le(null,null,function*(){var z;try{const de=(yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json()).message;if(de){const ie=yield(yield fetch(`/api/resource/User/${encodeURIComponent(de)}?fields=["full_name"]`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json();(z=ie.data)!=null&&z.full_name?p(ie.data.full_name):p(de)}}catch(U){console.error("Error fetching user full name:",U),e&&p(e)}})},[e]);const k=e==="financemanager@gmail.com",T=e&&(e.startsWith("enduser1-kash")||e.startsWith("enduser1-dajh")||e.startsWith("enduser1-th")),N=!k&&!T,S=!k&&!T,A=!k&&!T,O=[{id:"dashboard",title:c("common.dashboard"),icon:a.jsx(TL,{size:20}),path:"/dashboard",visible:!0},{id:"assets",title:c("common.assets"),icon:a.jsx(Qv,{size:20}),path:"/assets",visible:N},{id:"inventory",title:"Inventory",icon:a.jsx(Qv,{size:20}),path:"/inventory",visible:!0},{id:"work-orders",title:c("common.workOrders"),icon:a.jsx(bL,{size:20}),path:"/work-orders",visible:A},{id:"ppm-planner",title:"PPM Planner",icon:a.jsx(fL,{size:20}),path:"/ppm-planner",visible:S},{id:"maintenance-calendar",title:"Maintenance Calendar",icon:a.jsx(mL,{size:20}),path:"/maintenance-calendar",visible:S},{id:"active-map",title:"Active Map",icon:a.jsx(OL,{size:20}),path:"/active-map",visible:!0},{id:"maintenance-teams",title:"Maintenance Team",icon:a.jsx(HL,{size:20}),path:"/maintenance-teams",visible:!0},{id:"procurement",title:"Procurement",icon:a.jsx(IL,{size:20}),path:"/procurement",visible:!0},{id:"sla",title:"Service Level Agreement (SLA)",icon:a.jsx(kL,{size:20}),path:"/sla",visible:!0},{id:"support",title:"Support",icon:a.jsx(pL,{size:20}),path:"/support",visible:!0}].filter(V=>V.visible),P=V=>s.pathname===V,B=()=>{i("/user-profile")};return a.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(${v})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 dark:bg-black/70 z-0"}),a.jsxs("div",{className:"relative z-10 flex flex-col h-full bg-white/0 dark:bg-white/0",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200/30 dark:border-gray-700/30",children:[!t&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.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:[a.jsx("img",{src:`${g}${g.endsWith("/")?"":"/"}seera-logo.png${y}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:V=>{var z;V.currentTarget.style.display="none",(z=V.currentTarget.nextElementSibling)==null||z.classList.remove("hidden")}}),a.jsxs("svg",{className:"w-6 h-6 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),a.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),a.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),a.jsx("h1",{className:"text-white dark:text-white text-lg font-semibold drop-shadow-lg",children:c("sidebar.title")})]}),t&&a.jsxs("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-gray-700 rounded-lg p-1",children:[a.jsx("img",{src:`${g}${g.endsWith("/")?"":"/"}seera-logo.png?v=1765198405${y}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:V=>{var z;V.currentTarget.style.display="none",(z=V.currentTarget.nextElementSibling)==null||z.classList.remove("hidden")}}),a.jsxs("svg",{className:"w-5 h-5 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),a.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),a.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),a.jsx("button",{onClick:()=>r(!t),className:"text-white dark:text-white hover:bg-white/20 dark:hover:bg-white/20 p-2 rounded-lg transition-colors",children:t?a.jsx(LL,{size:20}):a.jsx(WL,{size:20})})]}),a.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:O.map(V=>a.jsxs(mp,{to:V.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
${P(V.path)?"bg-white/30 dark:bg-white/30 text-white dark:text-white border-l-4 border-white":""}
${t?"justify-center":""}
`,title:t?V.title:"",children:[a.jsx("span",{children:V.icon}),!t&&a.jsx("span",{className:`${d?"mr-4":"ml-4"} font-medium`,children:V.title})]},V.id))}),a.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&&(f||e)&&a.jsxs("div",{children:[a.jsx("div",{className:"text-white/80 dark:text-white/80 text-xs truncate",children:c("sidebar.loggedInAs")}),a.jsx("div",{className:"text-white dark:text-white text-sm font-medium truncate",children:f||e}),a.jsxs("button",{onClick:B,className:`
mt-3 w-full flex items-center justify-center gap-2
px-3 py-2
bg-white/20 hover:bg-white/30
text-white
rounded-lg
transition-all duration-200
text-sm font-medium
${P("/user-profile")?"bg-white/40 border border-white/50":""}
`,children:[a.jsx(Kv,{size:18}),a.jsx("span",{children:"User Profile"})]})]}),t&&a.jsx("button",{onClick:B,className:`
w-full flex items-center justify-center
p-2
bg-white/20 hover:bg-white/30
text-white
rounded-lg
transition-all duration-200
${P("/user-profile")?"bg-white/40 border border-white/50":""}
`,title:"User Profile",children:a.jsx(Kv,{size:20})}),!t&&a.jsx("div",{className:"text-xs text-white/70 dark:text-white/70 text-center",children:c("sidebar.version")})]})]})]})},p4=j.createContext(void 0),GL=({children:e})=>{const[t,r]=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=()=>{r(i=>i==="light"?"dark":"light")};return a.jsx(p4.Provider,{value:{theme:t,toggleTheme:s},children:e})},ZL=()=>{const e=j.useContext(p4);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e};class qL{getNotifications(t=50,r=0){return le(this,null,function*(){var d,c,f,p;const s=localStorage.getItem("user"),i=s?JSON.parse(s).email:"";if(!i)return[];try{const g=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(g)}&fields=${encodeURIComponent(x)}&order_by=creation desc&limit=${t}&offset=${r}`);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(g){return(c=g==null?void 0:g.message)!=null&&c.includes("417")||(f=g==null?void 0:g.message)!=null&&f.includes("EXPECTATION FAILED")?[]:((p=g==null?void 0:g.message)!=null&&p.includes("417")||console.warn("Notifications API not available:",(g==null?void 0:g.message)||"Unknown error"),[])}})}markAsRead(t){return le(this,null,function*(){var r,s,i,d;try{return yield rt.apiCall(`/api/resource/Notification Log/${t}`,{method:"PUT",body:JSON.stringify({read:1})})}catch(c){if((r=c==null?void 0:c.message)!=null&&r.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 le(this,null,function*(){try{const r=(yield this.getNotifications(1e3)).filter(i=>!i.read);let s=0;for(const i of r)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:r.length}}catch(t){return console.error("Error marking all notifications as read:",t),{success:!1,marked:0,total:0}}})}getUnreadCount(){return le(this,null,function*(){try{return(yield this.getNotifications(1e3)).filter(r=>!r.read).length}catch(t){return console.error("Error getting unread count:",t),0}})}}const Ig=new qL;function YL(){const[e,t]=j.useState([]),[r,s]=j.useState(0),[i,d]=j.useState(!0),[c,f]=j.useState(null),p=j.useCallback(()=>le(null,null,function*(){var y,v;try{d(!0),f(null);const k=yield Ig.getNotifications();t(k),s(k.filter(T=>!T.read).length)}catch(k){if((y=k==null?void 0:k.message)!=null&&y.includes("417")||(v=k==null?void 0:k.message)!=null&&v.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(()=>{p();const y=setInterval(p,3e4);return()=>clearInterval(y)},[p]);const g=j.useCallback(y=>le(null,null,function*(){try{yield Ig.markAsRead(y),t(v=>v.map(k=>k.name===y?Se(ne({},k),{read:1}):k)),s(v=>Math.max(0,v-1))}catch(v){throw console.error("Error marking notification as read:",v),v}}),[]),x=j.useCallback(()=>le(null,null,function*(){try{yield Ig.markAllAsRead(),t(y=>y.map(v=>Se(ne({},v),{read:1}))),s(0)}catch(y){throw console.error("Error marking all notifications as read:",y),y}}),[]);return{notifications:e,unreadCount:r,loading:i,error:c,markAsRead:g,markAllAsRead:x,refetch:p}}const XL=()=>{const{notifications:e,unreadCount:t,markAsRead:r,markAllAsRead:s}=YL(),[i,d]=j.useState(!1),c=j.useRef(null),f=xa();j.useEffect(()=>{const v=k=>{c.current&&!c.current.contains(k.target)&&d(!1)};return i&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[i]);const p=v=>le(null,null,function*(){if(console.log("[NotificationBell] Clicked notification:",v),console.log("[NotificationBell] document_type:",v.document_type),console.log("[NotificationBell] document_name:",v.document_name),!v.read)try{yield r(v.name)}catch(k){console.warn("[NotificationBell] Could not mark as read (permission issue):",k)}if(v.document_type&&v.document_name){const k=v.document_type,T=v.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:v.document_type,document_name:v.document_name,notification:v});d(!1)}),g=v=>{const k=new Date(v),N=new Date().getTime()-k.getTime(),S=Math.floor(N/6e4),A=Math.floor(N/36e5),C=Math.floor(N/864e5);return S<1?"Just now":S<60?`${S}m ago`:A<24?`${A}h ago`:C<7?`${C}d ago`:k.toLocaleDateString()},x=e.filter(v=>!v.read),y=e.filter(v=>v.read).slice(0,10);return a.jsxs("div",{className:"relative",ref:c,children:[a.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:[a.jsx(dL,{size:20}),t>0&&a.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&&a.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:[a.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.jsxs("h3",{className:"font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[a.jsx(z1,{}),"Notifications",t>0&&a.jsxs("span",{className:"text-xs bg-red-500 text-white px-2 py-0.5 rounded-full",children:[t," new"]})]}),t>0&&a.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"})]}),a.jsx("div",{className:"overflow-y-auto flex-1",children:e.length===0?a.jsxs("div",{className:"p-8 text-center text-gray-500 dark:text-gray-400",children:[a.jsx(z1,{className:"mx-auto text-3xl mb-2 opacity-50"}),a.jsx("p",{children:"No notifications"})]}):a.jsxs(a.Fragment,{children:[x.length>0&&a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"NEW"}),x.map(v=>a.jsx("div",{onClick:()=>p(v),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:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:v.subject||v.document_type||"Notification"}),v.email_content&&a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 line-clamp-2",children:v.email_content}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:g(v.creation)})]}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0 mt-1"})]})},v.name))]}),y.length>0&&a.jsxs("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700",children:[x.length>0&&a.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"EARLIER"}),y.map(v=>a.jsx("div",{onClick:()=>p(v),className:"p-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer",children:a.jsx("div",{className:"flex items-start justify-between gap-2",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 truncate",children:v.subject||v.document_type||"Notification"}),v.email_content&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-2",children:v.email_content}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:g(v.creation)})]})})},v.name))]})]})})]})]})},JL=({userEmail:e})=>{xa();const{theme:t,toggleTheme:r}=ZL(),{language:s,changeLanguage:i}=gp(),{t:d}=Va(),c=()=>le(null,null,function*(){var f;localStorage.removeItem("user"),localStorage.removeItem("sid");try{const p=((f=document.cookie.split("; ").find(g=>g.startsWith("X-Frappe-CSRF-Token=")))==null?void 0:f.split("=")[1])||"";yield fetch("/api/method/frappe.auth.logout",{method:"POST",headers:{"Content-Type":"application/json","X-Frappe-CSRF-Token":p},credentials:"include"}),yield fetch("/?cmd=web_logout",{credentials:"include"})}catch(p){console.error("Logout error:",p)}finally{window.location.href="/asm_app/login"}});return a.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:[a.jsx("div",{className:"relative",children:a.jsx(XL,{})}),a.jsx("button",{onClick:()=>i(s==="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:d("common.language"),children:a.jsx(jL,{size:20})}),a.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:d(t==="light"?"common.darkMode":"common.lightMode"),children:t==="light"?a.jsx(PL,{size:20}):a.jsx(BL,{size:20})}),a.jsx("button",{onClick:c,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:d("common.logout"),children:a.jsx(CL,{size:20})})]})};class KL{constructor(){Kn(this,"baseURL");this.baseURL=zt.BASE_URL}getCSRFToken(){return le(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(t){return null}})}getHeaders(){return le(this,null,function*(){const t={Accept:"application/json","Content-Type":"application/json"},r=yield this.getCSRFToken();return r&&(t["X-Frappe-CSRF-Token"]=r),t})}getIssues(){return le(this,arguments,function*(t={}){const{filters:r={},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(r).length>0){const x=Object.entries(r).map(([y,v])=>[y,"=",v]);f.append("filters",JSON.stringify(x))}const p=yield fetch(`${this.baseURL}/api/resource/Issue?${f.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return{data:(yield p.json()).data||[]}})}getIssue(t){return le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(t)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return(yield r.json()).data})}createIssue(t){return le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Issue`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!r.ok){const i=yield r.json().catch(()=>({}));throw new Error(i.message||`HTTP error! status: ${r.status}`)}return(yield r.json()).data})}updateIssue(t,r){return le(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(r)});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 le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(t)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`)})}getIssueCount(){return le(this,arguments,function*(t={}){var d,c;const r=new URLSearchParams;if(r.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(t).length>0){const f=Object.entries(t).map(([p,g])=>[p,"=",g]);r.append("filters",JSON.stringify(f))}const s=yield fetch(`${this.baseURL}/api/resource/Issue?${r.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 KL,QL=(e={})=>{const[t,r]=j.useState([]),[s,i]=j.useState(!0),[d,c]=j.useState(null),[f,p]=j.useState(0),g=j.useCallback(()=>le(null,null,function*(){try{i(!0),c(null);const x=yield wc.getIssues(e);r(x.data);const y=yield wc.getIssueCount(e.filters);p(y)}catch(x){c(x instanceof Error?x.message:"Failed to fetch issues")}finally{i(!1)}}),[JSON.stringify(e)]);return j.useEffect(()=>{g()},[g]),{issues:t,loading:s,error:d,totalCount:f,refetch:g}},eD=e=>{const[t,r]=j.useState(null),[s,i]=j.useState(!1),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null);return}try{i(!0),c(null);const p=yield wc.getIssue(e);r(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch issue details")}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{issue:t,loading:s,error:d,refetch:f}},tD=()=>{const[e,t]=j.useState(!1),[r,s]=j.useState(null);return{createIssue:f=>le(null,null,function*(){try{return t(!0),s(null),yield wc.createIssue(f)}catch(p){const g=p instanceof Error?p.message:"Failed to create issue";throw s(g),p}finally{t(!1)}}),updateIssue:(f,p)=>le(null,null,function*(){try{return t(!0),s(null),yield wc.updateIssue(f,p)}catch(g){const x=g instanceof Error?g.message:"Failed to update issue";throw s(x),g}finally{t(!1)}}),deleteIssue:f=>le(null,null,function*(){try{t(!0),s(null),yield wc.deleteIssue(f)}catch(p){const g=p instanceof Error?p.message:"Failed to delete issue";throw s(g),p}finally{t(!1)}}),loading:e,error:r}},aD=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const[p,g]=j.useState(r>0?"selected":"all_with_filters"),[x,y]=j.useState("csv"),[v,k]=j.useState(f.filter(A=>A.default).map(A=>A.key));j.useEffect(()=>{r>0?g("selected"):g("all_with_filters")},[r]);const T=A=>{k(C=>C.includes(A)?C.filter(O=>O!==A):[...C,A])},N=()=>k(f.map(A=>A.key)),S=()=>k(f.filter(A=>A.default).map(A=>A.key));return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Issues"})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>g("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected issue",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>g("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," issue",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>g("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," issue",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:x==="csv",onChange:()=>y("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:x==="excel",onChange:()=>y("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:N,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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(A=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${v.includes(A.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:[a.jsx("input",{type:"checkbox",checked:v.includes(A.key),onChange:()=>T(A.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:A.label})]},A.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[v.length," column",v.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(p,x,v),disabled:v.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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},rD=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"}},nD=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"}},sD=()=>{const{t:e}=Va(),t=xa(),r=[{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),[p,g]=j.useState(new Set),[x,y]=j.useState(!1),[v,k]=j.useState(!1),[T,N]=j.useState(null),[S,A]=j.useState(""),[C,O]=j.useState(""),[P,B]=j.useState(""),[V,z]=j.useState(""),[U,J]=j.useState(!1),[de,ye]=j.useState(0),[ie,he]=j.useState([]),[ve,me]=j.useState(!1),[ee,q]=j.useState("");j.useEffect(()=>{const oe=localStorage.getItem("issueFilterPresets");oe&&he(JSON.parse(oe))},[]),j.useEffect(()=>{const oe=[S,C,P,V].filter(Boolean).length;ye(oe)},[S,C,P,V]);const Q=j.useMemo(()=>{const oe={};return S&&(oe.status=S),C&&(oe.priority=C),P&&(oe.company=P),V&&(oe.name=V),oe},[S,C,P,V]),{issues:fe,loading:ae,error:F,totalCount:D,refetch:H}=QL({filters:Q,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,P,V]),j.useEffect(()=>{g(new Set)},[S,C,P,V,s]);const Z=Math.ceil(D/d),K=oe=>oe?new Date(oe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",ue=()=>{A(""),O(""),B(""),z(""),i(1)},Le=S||C||P||V,Ne=()=>{if(!ee.trim()){alert("Please enter a filter name");return}const oe={id:Date.now(),name:ee,filters:{statusFilter:S,priorityFilter:C,companyFilter:P,issueIdFilter:V}},we=[...ie,oe];he(we),q(""),me(!1),localStorage.setItem("issueFilterPresets",JSON.stringify(we))},We=oe=>{const we=oe.filters;A(we.statusFilter||""),O(we.priorityFilter||""),B(we.companyFilter||""),z(we.issueIdFilter||"")},Fe=oe=>{const we=ie.filter(Ie=>Ie.id!==oe);he(we),localStorage.setItem("issueFilterPresets",JSON.stringify(we))},tt=oe=>{g(we=>{const Ie=new Set(we);return Ie.has(oe)?Ie.delete(oe):Ie.add(oe),Ie})},ft=()=>{p.size===fe.length?g(new Set):g(new Set(fe.map(oe=>oe.name)))},Dt=fe.length>0&&p.size===fe.length,Ve=p.size>0&&p.size<fe.length,At=j.useCallback(()=>le(null,null,function*(){const oe=[];let we=0;const Ie=100;let ot=!0;for(;ot;)try{const Ue=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Issue",filters:Q,fields:["*"],limit_start:we*Ie,limit_page_length:Ie,order_by:"creation desc"})})).json()).message||[];oe.push(...Ue),Ue.length<Ie?ot=!1:we++,we>100&&(console.warn("Export safety limit reached"),ot=!1)}catch(bt){throw console.error("Error fetching issues for export:",bt),bt}return oe}),[Q]),jt=(oe,we,Ie)=>le(null,null,function*(){k(!0);try{let ot=[];switch(oe){case"selected":ot=fe.filter(qe=>p.has(qe.name));break;case"all_on_page":ot=fe;break;case"all_with_filters":ot=yield At();break}if(ot.length===0){alert("No data to export");return}const bt=Ie.map(qe=>{var Ue;return((Ue=r.find(ht=>ht.key===qe))==null?void 0:Ue.label)||qe});if(we==="csv"){const qe=[bt.join(","),...ot.map(Mt=>Ie.map(Ft=>{let je=Mt[Ft]||"";return typeof je=="string"&&(je.includes(",")||je.includes('"')||je.includes(`
`))&&(je=`"${je.replace(/"/g,'""')}"`),je}).join(","))].join(`
`),Ue=new Blob(["\uFEFF"+qe],{type:"text/csv;charset=utf-8;"}),ht=URL.createObjectURL(Ue),wt=document.createElement("a");wt.href=ht,wt.download=`issues_export_${new Date().toISOString().split("T")[0]}.csv`,wt.click(),URL.revokeObjectURL(ht)}else if(we==="excel"){const qe=[bt,...ot.map(wt=>Ie.map(Mt=>wt[Mt]||""))],Ue=jr.aoa_to_sheet(qe),ht=jr.book_new();jr.book_append_sheet(ht,Ue,"Issues"),Ic(ht,`issues_export_${new Date().toISOString().split("T")[0]}.xlsx`)}y(!1),g(new Set)}catch(ot){console.error("Export failed:",ot),alert(`Export failed: ${ot instanceof Error?ot.message:"Unknown error"}`)}finally{k(!1)}}),He=oe=>le(null,null,function*(){try{if(!(yield fetch(`/api/resource/Issue/${oe}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");N(null),H(),alert("Issue deleted successfully!")}catch(we){alert(`Failed to delete: ${we instanceof Error?we.message:"Unknown error"}`)}});return ae&&!c?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading issues..."})]})}):F?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Issues"}),a.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:F}),a.jsx("button",{onClick:H,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(U1,{className:"text-3xl text-blue-600 dark:text-blue-400"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:"Support Issues"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Total: ",D," issue",D!==1?"s":"",p.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",p.size," selected"]}),ae&&c&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[a.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]})]})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>J(!U),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${U||Le?"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:[a.jsx(ws,{}),"Filters",de>0&&a.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:de})]}),a.jsxs("button",{onClick:H,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:[a.jsx(yp,{className:ae?"animate-spin":""}),"Refresh"]}),a.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:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:"Export"}),p.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:p.size})]}),a.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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:"New Issue"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-4",children:[a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Total Issues"}),a.jsx("p",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:D})]}),a.jsx(ES,{className:"text-3xl text-blue-500"})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Open"}),a.jsx("p",{className:"text-2xl font-bold text-blue-600",children:fe.filter(oe=>oe.status==="Open").length})]}),a.jsx(ol,{className:"text-3xl text-blue-500"})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Resolved"}),a.jsx("p",{className:"text-2xl font-bold text-green-600",children:fe.filter(oe=>oe.status==="Resolved").length})]}),a.jsx(Ha,{className:"text-3xl text-green-500"})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Closed"}),a.jsx("p",{className:"text-2xl font-bold text-gray-600 dark:text-gray-300",children:fe.filter(oe=>oe.status==="Closed").length})]}),a.jsx(vr,{className:"text-3xl text-gray-500"})]})})]}),U&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ws,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),de>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:de})]}),Le&&a.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[V&&a.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:[a.jsx("span",{className:"font-semibold",children:"Issue:"})," ",V,a.jsx("button",{onClick:()=>z(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]}),S&&a.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:[a.jsx("span",{className:"font-semibold",children:"Status:"})," ",S,a.jsx("button",{onClick:()=>A(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]}),C&&a.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:[a.jsx("span",{className:"font-semibold",children:"Priority:"})," ",C,a.jsx("button",{onClick:()=>O(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]}),P&&a.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:[a.jsx("span",{className:"font-semibold",children:"Company:"})," ",P,a.jsx("button",{onClick:()=>B(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[de>0&&a.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:[a.jsx(gr,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Le&&a.jsxs("button",{onClick:ue,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:[a.jsx(xt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),a.jsxs("div",{className:"p-4",children:[ie.length>0&&a.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[a.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ie.map(oe=>a.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:[a.jsx("button",{onClick:()=>We(oe),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:oe.name}),a.jsx("button",{onClick:()=>Fe(oe.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(ma,{size:10})})]},oe.id))})]}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Issue",doctype:"Issue",value:V,onChange:oe=>{z(oe),i(1)},placeholder:"Select Issue",disabled:!1,compact:!0}),V&&a.jsx("button",{onClick:()=>z(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Status"}),a.jsxs("select",{value:S,onChange:oe=>{A(oe.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:[a.jsx("option",{value:"",children:"All Statuses"}),a.jsx("option",{value:"Open",children:"Open"}),a.jsx("option",{value:"Replied",children:"Replied"}),a.jsx("option",{value:"On Hold",children:"On Hold"}),a.jsx("option",{value:"Resolved",children:"Resolved"}),a.jsx("option",{value:"Closed",children:"Closed"})]})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(_t,{label:e("commonFields.priority"),doctype:"Issue Priority",value:C,onChange:oe=>{O(oe),i(1)},placeholder:e("issues.allPriorities"),disabled:!1,compact:!0}),C&&a.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(_t,{label:e("commonFields.company"),doctype:"Company",value:P,onChange:oe=>{B(oe),i(1)},placeholder:e("issues.allCompanies"),disabled:!1,compact:!0}),P&&a.jsx("button",{onClick:()=>B(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]})]})})]})]}),ve&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),a.jsx("input",{type:"text",value:ee,onChange:oe=>q(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&(oe.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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:()=>{me(!1),q("")},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"}),a.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:[a.jsx(gr,{size:12}),"Save Filter"]})]})]})}),a.jsx(aD,{isOpen:x,onClose:()=>y(!1),selectedCount:p.size,totalCount:D,pageCount:fe.length,onExport:jt,isExporting:v,exportColumns:r}),a.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&&a.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:a.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[a.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.jsx("button",{onClick:ft,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:e(Dt?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:Dt?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):Ve?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:fe.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(U1,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No issues found"}),Le?a.jsx("button",{onClick:ue,className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Clear filters"}):a.jsx("button",{onClick:()=>t("/support/new"),className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Create your first issue"})]})})}):fe.map(oe=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${p.has(oe.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>t(`/support/${oe.name}`),children:[a.jsx("td",{className:"px-4 py-3",onClick:we=>we.stopPropagation(),children:a.jsx("button",{onClick:()=>tt(oe.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:p.has(oe.name)?a.jsx(In,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:oe.name})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-900 dark:text-white line-clamp-1",children:oe.subject||"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-medium rounded-full ${rD(oe.status)}`,children:oe.status||"-"})}),a.jsx("td",{className:"px-4 py-3",children:oe.priority?a.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-medium rounded-full ${nD(oe.priority)}`,children:oe.priority}):a.jsx("span",{className:"text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 line-clamp-1",children:oe.company||"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:K(oe.opening_date)})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:we=>we.stopPropagation(),children:[a.jsx("button",{onClick:()=>t(`/support/${oe.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:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>t(`/support/${oe.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:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>N(oe.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:a.jsx(ma,{})})]})})]},oe.name))})]})}),Z>1&&a.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.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"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>i(oe=>Math.max(1,oe-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:a.jsx(Zf,{})}),a.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",s," of ",Z]}),a.jsx("button",{onClick:()=>i(oe=>Math.min(Z,oe+1)),disabled:s===Z,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:a.jsx(qf,{})})]})]})]}),T&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Issue"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Issue ID:"})," ",T]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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"}),a.jsxs("button",{onClick:()=>He(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:[a.jsx(ma,{}),"Delete Issue"]})]})]})]})})}),a.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; }
`})]})},iD=()=>new Date().toISOString().split("T")[0],lD=()=>new Date().toTimeString().split(" ")[0],oD=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"}}},cD=()=>{const{t:e}=Va(),{issueName:t}=fl(),r=xa(),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?iD():"",opening_time:s?lD():"",first_responded_on:"",resolution_date:"",resolution_by:""}),{issue:c,loading:f,error:p,refetch:g}=eD(s?null:t||null),{createIssue:x,updateIssue:y,deleteIssue:v,loading:k}=tD(),[T,N]=j.useState(s),[S,A]=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=J=>{const{name:de,value:ye}=J.target;d(ie=>Se(ne({},ie),{[de]:ye}))},O=()=>le(null,null,function*(){if(!i.subject){kt.error("Please enter a subject",{position:"top-right",autoClose:4e3,icon:a.jsx(vr,{})});return}try{if(s){const J=yield x(i);kt.success("Issue created successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),r(`/support/${J.name}`)}else yield y(t,i),kt.success("Issue updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),N(!1),g()}catch(J){const de=J instanceof Error?J.message:"Unknown error";kt.error(`Failed to save: ${de}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}}),P=()=>le(null,null,function*(){try{yield v(t),kt.success("Issue deleted successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),r("/support")}catch(J){const de=J instanceof Error?J.message:"Unknown error";kt.error(`Failed to delete: ${de}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}}),B=j.useCallback(J=>!!(!T||["opening_date","opening_time"].includes(J)&&!s),[T,s]),V=J=>J?new Date(J).toLocaleString():"-";if(f)return a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading issue details..."})]})});if(p&&!s)return a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Issue"}),a.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:p}),a.jsx("button",{onClick:()=>r("/support"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Issues"})]})});const z=(c==null?void 0:c.status)||i.status||"Open",U=oD(z);return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsx(mh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:C0}),a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>r("/support"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ns,{size:20})}),a.jsxs("div",{children:[a.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&&a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${U.bg} ${U.text} ${U.border} border`,children:z})]}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:s?e("issues.createNewIssue"):i.subject})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!s&&!T&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx(Rr,{}),e("common.edit")]}),a.jsxs("button",{onClick:()=>A(!0),className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[a.jsx(ma,{}),e("common.delete")]})]}),T&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{s?r("/support"):(N(!1),g())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:e("common.cancel")}),a.jsxs("button",{onClick:O,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:[a.jsx(gr,{}),e(k?"common.saving":"common.save")]})]})]})]}),S&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx(Xa,{className:"text-red-500 text-xl mt-0.5"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Delete Issue"}),a.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."})]})]}),a.jsxs("div",{className:"flex justify-end gap-3",children:[a.jsx("button",{onClick:()=>A(!1),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),a.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"})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(TS,{className:"text-blue-500"}),e("issues.issueDetails")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e("issues.subject")," ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"subject",value:i.subject,onChange:C,disabled:B("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"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("commonFields.status")}),a.jsxs("select",{name:"status",value:i.status,onChange:C,disabled:B("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:[a.jsx("option",{value:"Open",children:"Open"}),a.jsx("option",{value:"Replied",children:"Replied"}),a.jsx("option",{value:"On Hold",children:"On Hold"}),a.jsx("option",{value:"Resolved",children:"Resolved"}),a.jsx("option",{value:"Closed",children:"Closed"})]})]}),a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.priority"),doctype:"Issue Priority",value:i.priority||"",onChange:J=>d(Se(ne({},i),{priority:J})),disabled:B("priority"),placeholder:e("issues.selectPriority")})})]}),a.jsx("div",{children:a.jsx(_t,{label:e("issues.issueType"),doctype:"Issue Type",value:i.issue_type||"",onChange:J=>d(Se(ne({},i),{issue_type:J})),disabled:B("issue_type"),placeholder:e("issues.selectIssueType")})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("commonFields.description")}),a.jsx("textarea",{name:"description",value:i.description,onChange:C,disabled:B("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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(Nf,{className:"text-green-500"}),e("issues.contactInformation")]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.raisedBy")}),a.jsxs("div",{className:"relative",children:[a.jsx(B_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),a.jsx("input",{type:"email",name:"raised_by",value:i.raised_by,onChange:C,disabled:B("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"})]})]}),a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.company"),doctype:"Company",value:i.company||"",onChange:J=>d(Se(ne({},i),{company:J})),disabled:B("company"),placeholder:e("issues.selectCompany")})})]})]}),!s&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(Ha,{className:"text-purple-500"}),e("issues.resolution")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.firstRespondedOn")}),a.jsx("input",{type:"date",name:"first_responded_on",value:i.first_responded_on||"",onChange:C,disabled:B("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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.resolutionDate")}),a.jsx("input",{type:"date",name:"resolution_date",value:i.resolution_date||"",onChange:C,disabled:B("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"})]})]}),a.jsx("div",{children:a.jsx(_t,{label:e("issues.resolvedBy"),doctype:"User",value:i.resolution_by||"",onChange:J=>d(Se(ne({},i),{resolution_by:J})),disabled:B("resolution_by"),placeholder:e("maintenance.selectUser")})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.resolutionDetails")}),a.jsx("textarea",{name:"resolution_details",value:i.resolution_details,onChange:C,disabled:B("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"})]})]})]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(PS,{className:"text-orange-500"}),e("issues.statusInformation")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`p-4 rounded-lg border ${U.bg} ${U.border}`,children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.currentStatus")}),a.jsx("p",{className:`text-xl font-semibold ${U.text}`,children:z})]}),i.priority&&a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("commonFields.priority")}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.priority})]}),i.issue_type&&a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.issueType")}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.issue_type})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(yi,{className:"text-teal-500"}),e("issues.timeline")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.openingDate")}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:i.opening_date||"-"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Opening Time"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:i.opening_time||"-"})]}),!s&&c&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:V(c.creation)})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:V(c.modified)})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Modified By"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:c.modified_by||"-"})]})]})]})]}),i.company&&!s&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(xp,{className:"text-indigo-500"}),"Company"]}),a.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.company})})]})]})]})]})};class dD{constructor(){Kn(this,"baseURL");this.baseURL=zt.BASE_URL}getCSRFToken(){return le(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(t){return null}})}getHeaders(){return le(this,null,function*(){const t={Accept:"application/json","Content-Type":"application/json"},r=yield this.getCSRFToken();return r&&(t["X-Frappe-CSRF-Token"]=r),t})}getMaintenanceTeams(){return le(this,arguments,function*(t={}){const{filters:r={},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(r).length>0){const x=Object.entries(r).map(([y,v])=>[y,"=",v]);f.append("filters",JSON.stringify(x))}const p=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${f.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return{data:(yield p.json()).data||[]}})}getMaintenanceTeam(t){return le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return(yield r.json()).data})}createMaintenanceTeam(t){return le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!r.ok){const i=yield r.json().catch(()=>({}));throw new Error(i.message||`HTTP error! status: ${r.status}`)}return(yield r.json()).data})}updateMaintenanceTeam(t,r){return le(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(r)});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 le(this,null,function*(){const r=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`)})}getMaintenanceTeamCount(){return le(this,arguments,function*(t={}){var d,c;const r=new URLSearchParams;if(r.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(t).length>0){const f=Object.entries(t).map(([p,g])=>[p,"=",g]);r.append("filters",JSON.stringify(f))}const s=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${r.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 le(this,null,function*(){var r;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&&((r=(yield s.json()).data)==null?void 0:r.full_name)||""}catch(s){return""}})}}const eo=new dD,uD=(e={})=>{const[t,r]=j.useState([]),[s,i]=j.useState(!0),[d,c]=j.useState(null),[f,p]=j.useState(0),g=j.useCallback(()=>le(null,null,function*(){try{i(!0),c(null);const x=yield eo.getMaintenanceTeams(e);r(x.data);const y=yield eo.getMaintenanceTeamCount(e.filters);p(y)}catch(x){c(x instanceof Error?x.message:"Failed to fetch maintenance teams")}finally{i(!1)}}),[JSON.stringify(e)]);return j.useEffect(()=>{g()},[g]),{teams:t,loading:s,error:d,totalCount:f,refetch:g}},fD=e=>{const[t,r]=j.useState(null),[s,i]=j.useState(!1),[d,c]=j.useState(null),f=j.useCallback(()=>le(null,null,function*(){if(!e){r(null);return}try{i(!0),c(null);const p=yield eo.getMaintenanceTeam(e);r(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch maintenance team details")}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{team:t,loading:s,error:d,refetch:f}},hD=()=>{const[e,t]=j.useState(!1),[r,s]=j.useState(null);return{createTeam:p=>le(null,null,function*(){try{return t(!0),s(null),yield eo.createMaintenanceTeam(p)}catch(g){const x=g instanceof Error?g.message:"Failed to create maintenance team";throw s(x),g}finally{t(!1)}}),updateTeam:(p,g)=>le(null,null,function*(){try{return t(!0),s(null),yield eo.updateMaintenanceTeam(p,g)}catch(x){const y=x instanceof Error?x.message:"Failed to update maintenance team";throw s(y),x}finally{t(!1)}}),deleteTeam:p=>le(null,null,function*(){try{t(!0),s(null),yield eo.deleteMaintenanceTeam(p)}catch(g){const x=g instanceof Error?g.message:"Failed to delete maintenance team";throw s(x),g}finally{t(!1)}}),getUserFullName:p=>le(null,null,function*(){return yield eo.getUserFullName(p)}),loading:e,error:r}},mD=({isOpen:e,onClose:t,selectedCount:r,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const[p,g]=j.useState(r>0?"selected":"all_with_filters"),[x,y]=j.useState("csv"),[v,k]=j.useState(f.filter(A=>A.default).map(A=>A.key));j.useEffect(()=>{g(r>0?"selected":"all_with_filters")},[r]);const T=A=>k(C=>C.includes(A)?C.filter(O=>O!==A):[...C,A]),N=()=>k(f.map(A=>A.key)),S=()=>k(f.filter(A=>A.default).map(A=>A.key));return e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:a.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:[a.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(en,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Maintenance Teams"})]}),a.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:a.jsx(xt,{size:20})})]})}),a.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),a.jsxs("div",{className:"space-y-2",children:[a.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"} ${r===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>g("selected"),disabled:r===0,className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",r," selected team",r!==1?"s":""]})]}),r>0&&a.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:[r," selected"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>g("all_on_page"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," team",i!==1?"s":""," on current page"]})]}),a.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"]})]}),a.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:[a.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>g("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," team",s!==1?"s":""," matching current filters"]})]}),a.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"]})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),a.jsxs("div",{className:"flex gap-3",children:[a.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:[a.jsx("input",{type:"radio",name:"format",value:"csv",checked:x==="csv",onChange:()=>y("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Ac,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),a.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:[a.jsx("input",{type:"radio",name:"format",value:"excel",checked:x==="excel",onChange:()=>y("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Oc,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:N,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),a.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(A=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${v.includes(A.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:[a.jsx("input",{type:"checkbox",checked:v.includes(A.key),onChange:()=>T(A.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:A.label})]},A.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[v.length," column",v.length!==1?"s":""," selected"]})]})]}),a.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:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${r} selected row${r!==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":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.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"}),a.jsx("button",{onClick:()=>d(p,x,v),disabled:v.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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{}),"Export"]})})]})]})]})}):null},gD=()=>{const{t:e}=Va(),t=xa(),r=[{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),[p,g]=j.useState(new Set),[x,y]=j.useState(!1),[v,k]=j.useState(!1),[T,N]=j.useState(null),[S,A]=j.useState(""),[C,O]=j.useState(""),[P,B]=j.useState(!1),[V,z]=j.useState(0),[U,J]=j.useState([]),[de,ye]=j.useState(!1),[ie,he]=j.useState("");j.useEffect(()=>{const Ve=localStorage.getItem("maintenanceTeamFilterPresets");Ve&&J(JSON.parse(Ve))},[]),j.useEffect(()=>{const Ve=[S,C].filter(Boolean).length;z(Ve)},[S,C]);const ve=j.useMemo(()=>{const Ve={};return S&&(Ve.company=S),C&&(Ve.name=C),Ve},[S,C]),{teams:me,loading:ee,error:q,totalCount:Q,refetch:fe}=uD({filters:ve,limit_start:(s-1)*d,limit_page_length:d,order_by:"creation desc"});j.useEffect(()=>{!ee&&!c&&f(!0)},[ee,c]),j.useEffect(()=>{s!==1&&i(1)},[S,C]),j.useEffect(()=>{g(new Set)},[S,C,s]);const ae=Math.ceil(Q/d),F=Ve=>Ve?new Date(Ve).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",D=()=>{A(""),O(""),i(1)},H=S||C,Z=()=>{if(!ie.trim()){alert("Please enter a filter name");return}const Ve={id:Date.now(),name:ie,filters:{companyFilter:S,teamNameFilter:C}},At=[...U,Ve];J(At),he(""),ye(!1),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(At))},K=Ve=>{const At=Ve.filters;A(At.companyFilter||""),O(At.teamNameFilter||"")},ue=Ve=>{const At=U.filter(jt=>jt.id!==Ve);J(At),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(At))},Le=Ve=>{g(At=>{const jt=new Set(At);return jt.has(Ve)?jt.delete(Ve):jt.add(Ve),jt})},Ne=()=>{p.size===me.length?g(new Set):g(new Set(me.map(Ve=>Ve.name)))},We=me.length>0&&p.size===me.length,Fe=p.size>0&&p.size<me.length,tt=j.useCallback(()=>le(null,null,function*(){const Ve=[];let At=0;const jt=100;let He=!0;for(;He;)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:ve,fields:["*"],limit_start:At*jt,limit_page_length:jt,order_by:"creation desc"})})).json()).message||[];Ve.push(...Ie),Ie.length<jt?He=!1:At++,At>100&&(console.warn("Export safety limit reached"),He=!1)}catch(oe){throw console.error("Error fetching teams for export:",oe),oe}return Ve}),[ve]),ft=(Ve,At,jt)=>le(null,null,function*(){k(!0);try{let He=[];switch(Ve){case"selected":He=me.filter(we=>p.has(we.name));break;case"all_on_page":He=me;break;case"all_with_filters":He=yield tt();break}if(He.length===0){alert("No data to export");return}const oe=jt.map(we=>{var Ie;return((Ie=r.find(ot=>ot.key===we))==null?void 0:Ie.label)||we});if(At==="csv"){const we=[oe.join(","),...He.map(qe=>jt.map(Ue=>{let ht=qe[Ue]||"";return typeof ht=="string"&&(ht.includes(",")||ht.includes('"')||ht.includes(`
`))&&(ht=`"${ht.replace(/"/g,'""')}"`),ht}).join(","))].join(`
`),Ie=new Blob(["\uFEFF"+we],{type:"text/csv;charset=utf-8;"}),ot=URL.createObjectURL(Ie),bt=document.createElement("a");bt.href=ot,bt.download=`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.csv`,bt.click(),URL.revokeObjectURL(ot)}else if(At==="excel"){const we=[oe,...He.map(bt=>jt.map(qe=>bt[qe]||""))],Ie=jr.aoa_to_sheet(we),ot=jr.book_new();jr.book_append_sheet(ot,Ie,"Maintenance Teams"),Ic(ot,`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.xlsx`)}y(!1),g(new Set)}catch(He){console.error("Export failed:",He),alert(`Export failed: ${He instanceof Error?He.message:"Unknown error"}`)}finally{k(!1)}}),Dt=Ve=>le(null,null,function*(){try{if(!(yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(Ve)}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");N(null),fe(),alert("Maintenance Team deleted successfully!")}catch(At){alert(`Failed to delete: ${At instanceof Error?At.message:"Unknown error"}`)}});return ee&&!c?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance teams..."})]})}):q?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Maintenance Teams"}),a.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:q}),a.jsx("button",{onClick:fe,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):a.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Zd,{className:"text-3xl text-indigo-600 dark:text-indigo-400"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:"Maintenance Teams"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Total: ",Q," team",Q!==1?"s":"",p.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",p.size," selected"]}),ee&&c&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[a.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]})]})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>B(!P),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${P||H?"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:[a.jsx(ws,{}),"Filters",V>0&&a.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:V})]}),a.jsxs("button",{onClick:fe,disabled:ee,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:[a.jsx(yp,{className:ee?"animate-spin":""}),"Refresh"]}),a.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:Q===0,children:[a.jsx(en,{}),a.jsx("span",{className:"font-medium",children:"Export"}),p.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:p.size})]}),a.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:[a.jsx(ts,{}),a.jsx("span",{className:"font-medium",children:"New Team"})]})]})]}),P&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ws,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),V>0&&a.jsx("span",{className:"bg-white text-indigo-600 px-2 py-0.5 rounded-full text-xs font-bold",children:V})]}),H&&a.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[S&&a.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:[a.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",S,a.jsx("button",{onClick:()=>A(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]}),C&&a.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:[a.jsx("span",{className:"font-semibold",children:"Team:"})," ",C,a.jsx("button",{onClick:()=>O(""),className:"hover:text-red-500",children:a.jsx(xt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[V>0&&a.jsxs("button",{onClick:()=>ye(!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:[a.jsx(gr,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),H&&a.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:[a.jsx(xt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),a.jsxs("div",{className:"p-4",children:[U.length>0&&a.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[a.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:U.map(Ve=>a.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:[a.jsx("button",{onClick:()=>K(Ve),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:Ve.name}),a.jsx("button",{onClick:()=>ue(Ve.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(ma,{size:10})})]},Ve.id))})]}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(_t,{label:"Hospital",doctype:"Company",value:S,onChange:Ve=>{A(Ve),i(1)},placeholder:"Select Hospital",disabled:!1,compact:!0}),S&&a.jsx("button",{onClick:()=>A(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(_t,{label:e("maintenance.teamName"),doctype:"Asset Maintenance Team",value:C,onChange:Ve=>{O(Ve),i(1)},placeholder:e("maintenance.selectTeam"),disabled:!1,compact:!0}),C&&a.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(xt,{size:10})})]})]})})]})]}),de&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:e("listPages.saveFilterPreset")}),a.jsx("input",{type:"text",value:ie,onChange:Ve=>he(Ve.target.value),onKeyDown:Ve=>{Ve.key==="Enter"&&(Ve.preventDefault(),Z())},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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:()=>{ye(!1),he("")},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")}),a.jsxs("button",{onClick:Z,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:[a.jsx(gr,{size:12}),e("listPages.saveFilter")]})]})]})}),a.jsx(mD,{isOpen:x,onClose:()=>y(!1),selectedCount:p.size,totalCount:Q,pageCount:me.length,onExport:ft,isExporting:v,exportColumns:r}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 overflow-hidden relative",children:[ee&&c&&a.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:a.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[a.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-indigo-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:e("listPages.filtering")})]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:a.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(We?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:We?a.jsx(In,{className:"text-indigo-600 dark:text-indigo-400",size:18}):Fe?a.jsxs("div",{className:"relative",children:[a.jsx(Nr,{size:18}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):a.jsx(Nr,{size:18})})}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")}),a.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")})]})}),a.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:me.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-12 text-center text-gray-500 dark:text-gray-400",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Zd,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:e("listPages.noMaintenanceTeamsFound")}),H?a.jsx("button",{onClick:D,className:"mt-4 text-indigo-600 dark:text-indigo-400 hover:underline",children:e("listPages.clearFilters")}):a.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(Ve=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${p.has(Ve.name)?"bg-indigo-50 dark:bg-indigo-900/20":""}`,onClick:()=>t(`/maintenance-teams/${Ve.name}`),children:[a.jsx("td",{className:"px-4 py-3",onClick:At=>At.stopPropagation(),children:a.jsx("button",{onClick:()=>Le(Ve.name),className:"text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",children:p.has(Ve.name)?a.jsx(In,{className:"text-indigo-600 dark:text-indigo-400",size:18}):a.jsx(Nr,{size:18})})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ve.maintenance_team_name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ve.name})]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:Ve.maintenance_manager_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ve.maintenance_manager||"-"})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:Ve.company||"-"})}),a.jsx("td",{className:"px-4 py-3",children:Ve.custom_expertise?a.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:Ve.custom_expertise}):a.jsx("span",{className:"text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:F(Ve.creation)})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:At=>At.stopPropagation(),children:[a.jsx("button",{onClick:()=>t(`/maintenance-teams/${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:e("maintenance.viewDetails"),children:a.jsx(vs,{})}),a.jsx("button",{onClick:()=>t(`/maintenance-teams/${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:e("maintenance.editTeam"),children:a.jsx(Rr,{})}),a.jsx("button",{onClick:()=>t(`/maintenance-teams/new?duplicate=${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:e("maintenance.duplicateTeam"),children:a.jsx(Cc,{})}),a.jsx("button",{onClick:()=>N(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:e("maintenance.deleteTeam"),children:a.jsx(ma,{})})]})})]},Ve.name))})]})}),ae>1&&a.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Showing ",(s-1)*d+1," to ",Math.min(s*d,Q)," of ",Q," teams"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>i(Ve=>Math.max(1,Ve-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:a.jsx(Zf,{})}),a.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",s," of ",ae]}),a.jsx("button",{onClick:()=>i(Ve=>Math.min(ae,Ve+1)),disabled:s===ae,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:a.jsx(qf,{})})]})]})]}),T&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.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:a.jsx(ma,{className:"text-red-600 dark:text-red-400 text-xl"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Maintenance Team"}),a.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."}),a.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:a.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[a.jsx("strong",{children:"Team:"})," ",T]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.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"}),a.jsxs("button",{onClick:()=>Dt(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:[a.jsx(ma,{}),"Delete Team"]})]})]})]})})}),a.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; }
`})]})},pD=()=>{var ae;const{t:e}=Va(),{teamName:t}=fl(),[r]=hl(),s=xa(),i=t==="new",d=r.get("duplicate"),[c,f]=j.useState({maintenance_team_name:"",maintenance_manager:"",maintenance_manager_name:"",company:"",custom_expertise:"",maintenance_team_members:[]}),{team:p,loading:g,error:x,refetch:y}=fD(i?d||null:t||null),{createTeam:v,updateTeam:k,deleteTeam:T,getUserFullName:N,loading:S}=hD(),[A,C]=j.useState(i),[O,P]=j.useState(!1),[B,V]=j.useState(null),[z,U]=j.useState(null),J=F=>le(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 de(F);const Z=(yield D.json()).message||[];for(const K of Z)if(!(K.name===t||K.name===(p==null?void 0:p.name))&&K["maintenance_team_members.team_member"]===F)return{exists:!0,teamName:K.maintenance_team_name||K.name};return yield de(F)}catch(D){return console.error("Error checking member in other teams:",D),yield de(F)}}),de=F=>le(null,null,function*(){var D,H;try{const Z=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(!Z.ok)return{exists:!1};const ue=(yield Z.json()).data||[];for(const Le of ue){if(Le.name===t||Le.name===(p==null?void 0:p.name))continue;const Ne=yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(Le.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!Ne.ok)continue;const We=yield Ne.json();if((((D=We.data)==null?void 0:D.maintenance_team_members)||[]).some(ft=>ft.team_member===F))return{exists:!0,teamName:((H=We.data)==null?void 0:H.maintenance_team_name)||Le.name}}return{exists:!1}}catch(Z){return console.error("Fallback check failed:",Z),{exists:!1}}});j.useEffect(()=>{var F;p&&(f({maintenance_team_name:i&&d?`${p.maintenance_team_name} (Copy)`:p.maintenance_team_name||"",maintenance_manager:p.maintenance_manager||"",maintenance_manager_name:p.maintenance_manager_name||"",company:p.company||"",custom_expertise:p.custom_expertise||"",maintenance_team_members:((F=p.maintenance_team_members)==null?void 0:F.map((D,H)=>Se(ne({},D),{idx:H+1,name:i?void 0:D.name})))||[]}),i||C(!1))},[p,i,d]);const ye=F=>{const{name:D,value:H}=F.target;f(Z=>Se(ne({},Z),{[D]:H}))},ie=F=>le(null,null,function*(){if(f(D=>Se(ne({},D),{maintenance_manager:F})),F){const D=yield N(F);f(H=>Se(ne({},H),{maintenance_manager_name:D}))}else f(D=>Se(ne({},D),{maintenance_manager_name:""}))}),he=(F,D,H)=>le(null,null,function*(){var Z;if(D==="team_member"&&H){if((Z=c.maintenance_team_members)==null?void 0:Z.some((Fe,tt)=>tt!==F&&Fe.team_member===H)){kt.error("This member is already added to this team!",{position:"top-right",autoClose:4e3,icon:a.jsx(vr,{})});return}U(F),kt.info("Checking member availability...",{position:"top-right",autoClose:2e3,icon:()=>a.jsx("span",{children:"🔍"})});const{exists:ue,teamName:Le}=yield J(H);if(U(null),ue){kt.error(a.jsxs("div",{children:[a.jsx("strong",{children:"Cannot add member!"}),a.jsx("br",{}),a.jsxs("span",{className:"text-sm",children:["This member is already assigned to: ",a.jsx("b",{children:Le})]})]}),{position:"top-right",autoClose:5e3,icon:a.jsx(vr,{})});return}const Ne=yield N(H),We=[...c.maintenance_team_members||[]];We[F]=Se(ne({},We[F]),{team_member:H,full_name:Ne}),f(Fe=>Se(ne({},Fe),{maintenance_team_members:We})),kt.success("Member added successfully!",{position:"top-right",autoClose:2e3,icon:a.jsx(Ha,{})})}else{const K=[...c.maintenance_team_members||[]];K[F]=Se(ne({},K[F]),{[D]:H}),f(ue=>Se(ne({},ue),{maintenance_team_members:K}))}}),ve=()=>{var D;const F={team_member:"",full_name:"",maintenance_role:"",idx:(((D=c.maintenance_team_members)==null?void 0:D.length)||0)+1};f(H=>Se(ne({},H),{maintenance_team_members:[...H.maintenance_team_members||[],F]}))},me=F=>{var H;const D=((H=c.maintenance_team_members)==null?void 0:H.filter((Z,K)=>K!==F))||[];D.forEach((Z,K)=>{Z.idx=K+1}),f(Z=>Se(ne({},Z),{maintenance_team_members:D})),V(null)},ee=()=>le(null,null,function*(){var F;if(!c.maintenance_team_name){kt.error("Please enter a team name",{position:"top-right",autoClose:4e3,icon:a.jsx(vr,{})});return}try{const D=Se(ne({},c),{maintenance_team_members:(F=c.maintenance_team_members)==null?void 0:F.map(H=>({team_member:H.team_member,full_name:H.full_name,maintenance_role:H.maintenance_role})).filter(H=>H.team_member)});if(i){const H=yield v(D);kt.success("Maintenance Team created successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),s(`/maintenance-teams/${H.name}`)}else yield k(t,D),kt.success("Maintenance Team updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),C(!1),y()}catch(D){const H=D instanceof Error?D.message:"Unknown error";kt.error(`Failed to save: ${H}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}}),q=()=>le(null,null,function*(){try{yield T(t),kt.success("Maintenance Team deleted successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),s("/maintenance-teams")}catch(F){const D=F instanceof Error?F.message:"Unknown error";kt.error(`Failed to delete: ${D}`,{position:"top-right",autoClose:6e3,icon:a.jsx(vr,{})})}}),Q=j.useCallback(F=>!A,[A]),fe=F=>F?new Date(F).toLocaleString():"-";return g?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance team..."})]})}):x&&!i?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:e("maintenance.errorLoadingTeam")}),a.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:x}),a.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")})]})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsx(mh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:C0}),a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s("/maintenance-teams"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ns,{size:20})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white flex items-center gap-3",children:[a.jsx(Zd,{className:"text-indigo-500"}),i?"New Maintenance Team":(p==null?void 0:p.maintenance_team_name)||"Maintenance Team"]}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:i?"Create a new maintenance team":p==null?void 0:p.name})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!i&&!A&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx(Rr,{}),e("common.edit")]}),a.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:[a.jsx(ma,{}),e("common.delete")]})]}),A&&a.jsxs(a.Fragment,{children:[a.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")}),a.jsxs("button",{onClick:ee,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:[a.jsx(gr,{}),e(S?"common.saving":"common.save")]})]})]})]}),O&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx(Xa,{className:"text-red-500 text-xl mt-0.5"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:e("maintenance.deleteTeam")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:e("confirmations.cannotUndo")})]})]}),a.jsxs("div",{className:"flex justify-end gap-3",children:[a.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")}),a.jsx("button",{onClick:q,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")})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(Zd,{className:"text-indigo-500"}),e("maintenance.teamInformation")]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e("maintenance.teamName")," ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"maintenance_team_name",value:c.maintenance_team_name,onChange:ye,disabled:Q("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"})]}),a.jsx("div",{children:a.jsx(_t,{label:e("commonFields.hospital"),doctype:"Company",value:c.company||"",onChange:F=>f(Se(ne({},c),{company:F})),disabled:Q("company"),placeholder:e("maintenance.selectHospital")})}),a.jsx("div",{children:a.jsx(_t,{label:e("maintenance.expertise"),doctype:"Issue Type",value:c.custom_expertise||"",onChange:F=>f(Se(ne({},c),{custom_expertise:F})),disabled:Q("custom_expertise"),placeholder:e("maintenance.selectExpertise")})}),a.jsx("div",{children:a.jsx(_t,{label:e("maintenance.manager"),doctype:"User",value:c.maintenance_manager||"",onChange:ie,disabled:Q("maintenance_manager"),placeholder:e("maintenance.selectManager")})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("maintenance.managerName")}),a.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"})]})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[a.jsx(FS,{className:"text-green-500"}),"Team Members"]}),A&&a.jsxs("button",{onClick:ve,disabled:z!==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:[a.jsx(ts,{size:12}),"Add Member"]})]}),c.maintenance_team_members&&c.maintenance_team_members.length>0?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"#"}),a.jsxs("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:["Team Member",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Full Name"}),a.jsxs("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:["Role",a.jsx("span",{className:"text-red-500",children:"*"})]}),A&&a.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Action"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:c.maintenance_team_members.map((F,D)=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${z===D?"opacity-70":""}`,children:[a.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400",children:D+1}),a.jsx("td",{className:"px-3 py-2",children:A?a.jsxs("div",{className:"relative",children:[a.jsx(_t,{label:"",doctype:"User",value:F.team_member||"",onChange:H=>he(D,"team_member",H),disabled:z!==null,placeholder:e("maintenance.selectUser"),compact:!0}),z===D&&a.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-500"})})]}):a.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:F.team_member||"-"})}),a.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-300",children:F.full_name||"-"}),a.jsx("td",{className:"px-3 py-2",children:A?a.jsx(_t,{label:"",doctype:"Role",value:F.maintenance_role||"",onChange:H=>he(D,"maintenance_role",H),disabled:z!==null,placeholder:e("maintenance.selectRole"),compact:!0}):a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:F.maintenance_role||"-"})}),A&&a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("button",{onClick:()=>V(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:a.jsx(ma,{size:14})})})]},D))})]})}):a.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[a.jsx(Zd,{className:"text-4xl mx-auto mb-2 text-gray-300 dark:text-gray-600"}),a.jsx("p",{children:e("maintenance.noTeamMembersYet")}),A&&a.jsxs("button",{onClick:ve,className:"mt-3 text-indigo-600 dark:text-indigo-400 hover:underline",children:["+ ",e("maintenance.addFirstMember")]})]})]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(zS,{className:"text-blue-500"}),e("maintenance.teamSummary")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-indigo-50 dark:bg-indigo-900/30 rounded-lg border border-indigo-200 dark:border-indigo-800",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("maintenance.totalMembers")}),a.jsx("p",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-300",children:((ae=c.maintenance_team_members)==null?void 0:ae.filter(F=>F.team_member).length)||0})]}),c.maintenance_manager_name&&a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("maintenance.manager")}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.maintenance_manager_name})]}),c.company&&a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Hospital"}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.company})]}),c.custom_expertise&&a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Expertise"}),a.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&&p&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[a.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:[a.jsx(xp,{className:"text-teal-500"}),"Details"]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:fe(p.creation)})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:fe(p.modified)})]}),a.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Modified By"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:p.modified_by||"-"})]})]})]})]})]}),B!==null&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-sm w-full mx-4 shadow-xl",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx(Xa,{className:"text-orange-500 text-xl mt-0.5"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Remove Team Member"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Are you sure you want to remove this team member?"})]})]}),a.jsxs("div",{className:"flex justify-end gap-3",children:[a.jsx("button",{onClick:()=>V(null),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),a.jsx("button",{onClick:()=>me(B),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg",children:"Remove"})]})]})})]})},xD=()=>le(null,null,function*(){var e;try{const s=(yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json()).message;if(!s)throw new Error("No user logged in");const d=yield(yield fetch("/api/method/frappe.client.get",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({doctype:"User",name:s})})).json();if(console.log("frappe.client.get response:",d),console.log("role_profile_name:",(e=d.message)==null?void 0:e.role_profile_name),d.message){const c=d.message;return c.roles||(c.roles=[]),c}throw new Error("Failed to fetch user profile")}catch(t){throw console.error("Error fetching user profile:",t),t}}),yD=(e,t)=>le(null,null,function*(){try{const r=yield fetch(`/api/resource/User/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}),s=yield r.json();if(!r.ok)throw new Error(s.exc||s.message||"Failed to update profile");return s.data}catch(r){throw console.error("Error updating user profile:",r),r}}),bD=(e,t)=>le(null,null,function*(){try{const r=yield fetch("/api/method/frappe.core.doctype.user.user.update_password",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_password:e,old_password:t})}),s=yield r.json();if(!r.ok){let i="Failed to change password";if(s.exc){if(s.exc.includes("Incorrect Old Password"))i="Incorrect old password";else if(s.exc.includes("Password cannot be same"))i="New password cannot be the same as old password";else if(s._server_messages)try{const d=JSON.parse(s._server_messages);i=JSON.parse(d[0]).message||i}catch(d){}}throw new Error(i)}return{message:"Password changed successfully"}}catch(r){throw console.error("Error changing password:",r),r}}),vD=()=>{const e=xa(),[t,r]=j.useState(!0),[s,i]=j.useState(!1),[d,c]=j.useState(!1),[f,p]=j.useState(!1),[g,x]=j.useState(null),[y,v]=j.useState(null),[k,T]=j.useState({first_name:"",middle_name:"",last_name:"",role_profile_name:"",custom_user_id:""}),[N,S]=j.useState(!1),[A,C]=j.useState({old_password:"",new_password:"",confirm_password:""}),[O,P]=j.useState(!1),[B,V]=j.useState(!1),[z,U]=j.useState(!1);j.useEffect(()=>{le(null,null,function*(){var ve;try{r(!0);const q=((ve=(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:"System Manager"})})).json()).message)==null?void 0:ve.has_role)||!1;c(q),console.log("Is System Manager:",q);const Q=yield xD();console.log("Full profile data:",JSON.stringify(Q,null,2)),console.log("role_profile_name:",Q.role_profile_name),console.log("All keys:",Object.keys(Q)),x(Q),T({first_name:Q.first_name||"",middle_name:Q.middle_name||"",last_name:Q.last_name||"",role_profile_name:Q.role_profile_name||"",custom_user_id:Q.custom_user_id||""}),console.log("FormData role_profile_name:",Q.role_profile_name||"")}catch(me){const ee=me instanceof Error?me.message:"Failed to load profile";v(ee),kt.error(ee,{position:"top-right",autoClose:5e3,icon:a.jsx(vr,{})})}finally{r(!1)}})},[]);const J=he=>{const{name:ve,value:me}=he.target;T(ee=>Se(ne({},ee),{[ve]:me}))},de=he=>{const{name:ve,value:me}=he.target;C(ee=>Se(ne({},ee),{[ve]:me}))},ye=()=>le(null,null,function*(){if(g!=null&&g.email)try{i(!0);const he={first_name:k.first_name,middle_name:k.middle_name,last_name:k.last_name,role_profile_name:k.role_profile_name},ve=yield yD(g.email,he);x(me=>me?ne(ne({},me),ve):ve),kt.success("Profile updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})})}catch(he){const ve=he instanceof Error?he.message:"Failed to update profile";kt.error(ve,{position:"top-right",autoClose:5e3,icon:a.jsx(vr,{})})}finally{i(!1)}}),ie=()=>le(null,null,function*(){if(!A.old_password){kt.error("Please enter your current password",{position:"top-right",autoClose:3e3,icon:a.jsx(Xa,{})});return}if(!A.new_password){kt.error("Please enter a new password",{position:"top-right",autoClose:3e3,icon:a.jsx(Xa,{})});return}if(A.new_password.length<8){kt.error("Password must be at least 8 characters long",{position:"top-right",autoClose:3e3,icon:a.jsx(Xa,{})});return}if(A.new_password!==A.confirm_password){kt.error("New passwords do not match",{position:"top-right",autoClose:3e3,icon:a.jsx(Xa,{})});return}try{p(!0),yield bD(A.new_password,A.old_password),kt.success("Password changed successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ha,{})}),C({old_password:"",new_password:"",confirm_password:""}),S(!1)}catch(he){const ve=he instanceof Error?he.message:"Failed to change password";kt.error(ve,{position:"top-right",autoClose:5e3,icon:a.jsx(vr,{})})}finally{p(!1)}});return t?a.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx($r,{className:"animate-spin text-blue-500 text-4xl mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading profile..."})]})}):y&&!g?a.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[a.jsxs("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:[a.jsx(vr,{className:"inline mr-2"}),"Error Loading Profile"]}),a.jsx("p",{className:"text-red-700 dark:text-red-400",children:y}),a.jsx("button",{onClick:()=>e(-1),className:"mt-4 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded",children:"Go Back"})]})}):a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[a.jsx(mh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:C0}),a.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[a.jsx("div",{className:"flex items-center gap-4",children:a.jsxs("button",{onClick:()=>e(-1),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[a.jsx(Ns,{}),a.jsx("span",{className:"text-gray-900 dark:text-white text-xl font-semibold",children:"User Profile"})]})}),a.jsx("button",{onClick:ye,disabled:s,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50 shadow-lg transition-all",children:s?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(gr,{}),"Save Changes"]})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden",children:[a.jsxs("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 p-6 text-center",children:[a.jsx("div",{className:"w-24 h-24 bg-white/20 rounded-full mx-auto flex items-center justify-center mb-4",children:g!=null&&g.user_image?a.jsx("img",{src:g.user_image,alt:"Profile",className:"w-20 h-20 rounded-full object-cover"}):a.jsx(Nf,{className:"text-white text-4xl"})}),a.jsx("h2",{className:"text-xl font-bold text-white",children:(g==null?void 0:g.full_name)||"User"}),a.jsx("p",{className:"text-white/80 text-sm mt-1",children:g==null?void 0:g.email})]}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx(AS,{className:"text-blue-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Username"}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(g==null?void 0:g.username)||"-"})]})]}),a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx(IS,{className:"text-green-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Role Profile"}),a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(g==null?void 0:g.role_profile_name)||"-"})]})]}),a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx(LS,{className:"text-purple-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Status"}),a.jsx("p",{className:`text-sm font-medium ${g!=null&&g.enabled?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:g!=null&&g.enabled?"Active":"Inactive"})]})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md border border-gray-200 dark:border-gray-700 p-6",children:[a.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:[a.jsx(Nf,{className:"text-blue-500"}),"Basic Information"]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Email",a.jsx("span",{className:"ml-1 text-gray-400",children:"(Read-only)"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(B_,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:14}),a.jsx("input",{type:"email",value:(g==null?void 0:g.email)||"",disabled:!0,className:"w-full pl-10 pr-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Full Name",a.jsx("span",{className:"ml-1 text-gray-400",children:"(Auto-generated)"})]}),a.jsx("input",{type:"text",value:(g==null?void 0:g.full_name)||"",disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["First Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",name:"first_name",value:k.first_name,onChange:J,placeholder:"Enter first name",className:"w-full px-3 py-2 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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Middle Name"}),a.jsx("input",{type:"text",name:"middle_name",value:k.middle_name,onChange:J,placeholder:"Enter middle name",className:"w-full px-3 py-2 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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Last Name"}),a.jsx("input",{type:"text",name:"last_name",value:k.last_name,onChange:J,placeholder:"Enter last name",className:"w-full px-3 py-2 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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"User ID No"}),a.jsx("input",{type:"text",name:"custom_user_id",value:k.custom_user_id,onChange:J,placeholder:"Enter User No",className:"w-full px-3 py-2 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"})]}),a.jsx("div",{children:a.jsx(_t,{label:"Role Profile",doctype:"Role Profile",value:k.role_profile_name,onChange:he=>T(ve=>Se(ne({},ve),{role_profile_name:he})),placeholder:"Select Role Profile",disabled:!d})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md border border-gray-200 dark:border-gray-700 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[a.jsx(kg,{className:"text-orange-500"}),"Change Password"]}),a.jsx("button",{onClick:()=>S(!N),className:"text-sm text-blue-600 dark:text-blue-400 hover:underline",children:N?"Cancel":"Change Password"})]}),N?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Current Password ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:O?"text":"password",name:"old_password",value:A.old_password,onChange:de,placeholder:"Enter current password",className:"w-full px-3 py-2 pr-10 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"}),a.jsx("button",{type:"button",onClick:()=>P(!O),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:O?a.jsx(wg,{size:14}):a.jsx(vs,{size:14})})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["New Password ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:B?"text":"password",name:"new_password",value:A.new_password,onChange:de,placeholder:"Enter new password (min 8 characters)",className:"w-full px-3 py-2 pr-10 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"}),a.jsx("button",{type:"button",onClick:()=>V(!B),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:B?a.jsx(wg,{size:14}):a.jsx(vs,{size:14})})]}),A.new_password&&A.new_password.length<8&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:"Password must be at least 8 characters"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Confirm New Password ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:z?"text":"password",name:"confirm_password",value:A.confirm_password,onChange:de,placeholder:"Confirm new password",className:"w-full px-3 py-2 pr-10 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"}),a.jsx("button",{type:"button",onClick:()=>U(!z),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:z?a.jsx(wg,{size:14}):a.jsx(vs,{size:14})})]}),A.confirm_password&&A.new_password!==A.confirm_password&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:"Passwords do not match"}),A.confirm_password&&A.new_password===A.confirm_password&&A.new_password.length>=8&&a.jsxs("p",{className:"mt-1 text-xs text-green-500 flex items-center gap-1",children:[a.jsx(Ha,{size:10})," Passwords match"]})]}),a.jsx("div",{className:"pt-2",children:a.jsx("button",{onClick:ie,disabled:f,className:"w-full bg-orange-600 hover:bg-orange-700 text-white px-4 py-2.5 rounded-lg flex items-center justify-center gap-2 disabled:opacity-50 transition-colors",children:f?a.jsxs(a.Fragment,{children:[a.jsx($r,{className:"animate-spin"}),"Changing Password..."]}):a.jsxs(a.Fragment,{children:[a.jsx(kg,{}),"Change Password"]})})})]}):a.jsxs("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:[a.jsx(kg,{className:"mx-auto text-3xl mb-2 text-gray-300 dark:text-gray-600"}),a.jsx("p",{className:"text-sm",children:'Click "Change Password" to update your password'})]})]})]})]})]})},Oa=({children:e})=>{const t=localStorage.getItem("user"),r=t?JSON.parse(t).email:"";return a.jsxs("div",{className:"flex h-screen overflow-hidden bg-gray-50 dark:bg-gray-900",children:[a.jsx(VL,{userEmail:r}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx(JL,{userEmail:r}),a.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:e})]})]})},Ma=({children:e})=>localStorage.getItem("user")?a.jsx(a.Fragment,{children:e}):a.jsx(Wg,{to:"/login",replace:!0}),_D=()=>a.jsx(Uj,{basename:"/asm_app",children:a.jsxs(xj,{children:[a.jsx(fa,{path:"/login",element:a.jsx(eS,{})}),a.jsx(fa,{path:"/dashboard",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(BS,{})})})}),a.jsx(fa,{path:"/assets",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(mO,{})})})}),a.jsx(fa,{path:"/assets/:assetName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(xO,{})})})}),a.jsx(fa,{path:"/work-orders",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(bO,{})})})}),a.jsx(fa,{path:"/work-orders/:workOrderName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(oM,{})})})}),a.jsx(fa,{path:"/maintenance",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(cM,{})})})}),a.jsx(fa,{path:"/maintenance/:logName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(fM,{})})})}),a.jsx(fa,{path:"/ppm",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(pM,{})})})}),a.jsx(fa,{path:"/ppm/:ppmName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(xM,{})})})}),a.jsx(fa,{path:"/ppm-planner",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(kM,{})})})}),a.jsx(fa,{path:"/ppm-planner/new",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(bM,{})})})}),a.jsx(fa,{path:"/ppm-planner/:scheduleName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(NM,{})})})}),a.jsx(fa,{path:"/maintenance-calendar",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(Yv,{})})})}),a.jsx(fa,{path:"/maintenance-calendar/month-view",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(SM,{})})})}),a.jsx(fa,{path:"/yearly-ppm-planner",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(Yv,{})})})}),a.jsx(fa,{path:"/active-map",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(JM,{})})})}),a.jsx(fa,{path:"/inventory",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(aL,{})})})}),a.jsx(fa,{path:"/inventory/:itemName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(rL,{})})})}),a.jsx(fa,{path:"/users",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(w5,{})})})}),a.jsx(fa,{path:"/events",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(k5,{})})})}),a.jsx(fa,{path:"/old-dashboard",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(iS,{})})})}),a.jsx(fa,{path:"/maintenance-teams",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(gD,{})})})}),a.jsx(fa,{path:"/maintenance-teams/:teamName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(pD,{})})})}),a.jsx(fa,{path:"/procurement",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(e_,{title:"Procurement"})})})}),a.jsx(fa,{path:"/sla",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(e_,{title:"Service Level Agreement (SLA)"})})})}),a.jsx(fa,{path:"/support",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(sD,{})})})}),a.jsx(fa,{path:"/support/:issueName",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(cD,{})})})}),a.jsx(fa,{path:"/user-profile",element:a.jsx(Ma,{children:a.jsx(Oa,{children:a.jsx(vD,{})})})}),a.jsx(fa,{path:"/",element:a.jsx(Wg,{to:"/login",replace:!0})}),a.jsx(fa,{path:"*",element:a.jsx(Wg,{to:"/login",replace:!0})})]})});Gk.createRoot(document.getElementById("root")).render(a.jsx(j.StrictMode,{children:a.jsx(Qj,{children:a.jsx(GL,{children:a.jsx(_D,{})})})}))});export default wD();