1741 lines
1.9 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 ck=Object.defineProperty,dk=Object.defineProperties;var uk=Object.getOwnPropertyDescriptors;var gf=Object.getOwnPropertySymbols;var h2=Object.prototype.hasOwnProperty,m2=Object.prototype.propertyIsEnumerable;var td=(e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),fk=e=>{throw TypeError(e)};var yg=(e,r,t)=>r in e?ck(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ke=(e,r)=>{for(var t in r||(r={}))h2.call(r,t)&&yg(e,t,r[t]);if(gf)for(var t of gf(r))m2.call(r,t)&&yg(e,t,r[t]);return e},Ve=(e,r)=>dk(e,uk(r));var Us=(e,r)=>{var t={};for(var n in e)h2.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&gf)for(var n of gf(e))r.indexOf(n)<0&&m2.call(e,n)&&(t[n]=e[n]);return t};var hk=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ki=(e,r,t)=>yg(e,typeof r!="symbol"?r+"":r,t);var Ne=(e,r,t)=>new Promise((n,o)=>{var u=v=>{try{g(t.next(v))}catch(p){o(p)}},f=v=>{try{g(t.throw(v))}catch(p){o(p)}},g=v=>v.done?n(v.value):Promise.resolve(v.value).then(u,f);g((t=t.apply(e,r)).next())}),rc=function(e,r){this[0]=e,this[1]=r},bg=(e,r,t)=>{var n=(f,g,v,p)=>{try{var k=t[f](g),N=(g=k.value)instanceof rc,C=k.done;Promise.resolve(N?g[0]:g).then(O=>N?n(f==="return"?f:"next",g[1]?{done:O.done,value:O.value}:O,v,p):v({value:O,done:C})).catch(O=>n("throw",O,v,p))}catch(O){p(O)}},o=f=>u[f]=g=>new Promise((v,p)=>n(f,g,v,p)),u={};return t=t.apply(e,r),u[td("asyncIterator")]=()=>u,o("next"),o("throw"),o("return"),u},vg=e=>{var r=e[td("asyncIterator")],t=!1,n,o={};return r==null?(r=e[td("iterator")](),n=u=>o[u]=f=>r[u](f)):(r=r.call(e),n=u=>o[u]=f=>{if(t){if(t=!1,u==="throw")throw f;return f}return t=!0,{done:!1,value:new rc(new Promise(g=>{var v=r[u](f);v instanceof Object||fk("Object expected"),g(v)}),1)}}),o[td("iterator")]=()=>o,n("next"),"throw"in r?n("throw"):o.throw=u=>{throw u},"return"in r&&n("return"),o},g2=(e,r,t)=>(r=e[td("asyncIterator")])?r.call(e):(e=e[td("iterator")](),r={},t=(n,o)=>(o=e[n])&&(r[n]=u=>new Promise((f,g,v)=>(u=o.call(e,u),v=u.done,Promise.resolve(u.value).then(p=>f({value:p,done:v}),g)))),t("next"),t("return"),r);var II=hk(bt=>{function mk(e,r){for(var t=0;t<r.length;t++){const n=r[t];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in e)){const u=Object.getOwnPropertyDescriptor(n,o);u&&Object.defineProperty(e,o,u.get?u:{enumerable:!0,get:()=>n[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).observe(document,{childList:!0,subtree:!0});function t(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function n(o){if(o.ep)return;o.ep=!0;const u=t(o);fetch(o.href,u)}})();var xf=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Sx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _g={exports:{}},k0={};var x2;function gk(){if(x2)return k0;x2=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function t(n,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var g in o)g!=="key"&&(u[g]=o[g])}else u=o;return o=u.ref,{$$typeof:e,type:n,key:f,ref:o!==void 0?o:null,props:u}}return k0.Fragment=r,k0.jsx=t,k0.jsxs=t,k0}var p2;function xk(){return p2||(p2=1,_g.exports=gk()),_g.exports}var a=xk(),wg={exports:{}},Ar={};var y2;function pk(){if(y2)return Ar;y2=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),C=Symbol.iterator;function O(K){return K===null||typeof K!="object"?null:(K=C&&K[C]||K["@@iterator"],typeof K=="function"?K:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,D={};function z(K,W,ae){this.props=K,this.context=W,this.refs=D,this.updater=ae||I}z.prototype.isReactComponent={},z.prototype.setState=function(K,W){if(typeof K!="object"&&typeof K!="function"&&K!=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,K,W,"setState")},z.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function B(){}B.prototype=z.prototype;function U(K,W,ae){this.props=K,this.context=W,this.refs=D,this.updater=ae||I}var H=U.prototype=new B;H.constructor=U,M(H,z.prototype),H.isPureReactComponent=!0;var q=Array.isArray;function ne(){}var V={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function Q(K,W,ae){var se=ae.ref;return{$$typeof:e,type:K,key:W,ref:se!==void 0?se:null,props:ae}}function Te(K,W){return Q(K.type,W,K.props)}function je(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function me(K){var W={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(ae){return W[ae]})}var Se=/\/+/g;function Oe(K,W){return typeof K=="object"&&K!==null&&K.key!=null?me(""+K.key):W.toString(36)}function ue(K){switch(K.status){case"fulfilled":return K.value;case"rejected":throw K.reason;default:switch(typeof K.status=="string"?K.then(ne,ne):(K.status="pending",K.then(function(W){K.status==="pending"&&(K.status="fulfilled",K.value=W)},function(W){K.status==="pending"&&(K.status="rejected",K.reason=W)})),K.status){case"fulfilled":return K.value;case"rejected":throw K.reason}}throw K}function be(K,W,ae,se,he){var pe=typeof K;(pe==="undefined"||pe==="boolean")&&(K=null);var Je=!1;if(K===null)Je=!0;else switch(pe){case"bigint":case"string":case"number":Je=!0;break;case"object":switch(K.$$typeof){case e:case r:Je=!0;break;case k:return Je=K._init,be(Je(K._payload),W,ae,se,he)}}if(Je)return he=he(K),Je=se===""?"."+Oe(K,0):se,q(he)?(ae="",Je!=null&&(ae=Je.replace(Se,"$&/")+"/"),be(he,W,ae,"",function(ot){return ot})):he!=null&&(je(he)&&(he=Te(he,ae+(he.key==null||K&&K.key===he.key?"":(""+he.key).replace(Se,"$&/")+"/")+Je)),W.push(he)),1;Je=0;var Fe=se===""?".":se+":";if(q(K))for(var ft=0;ft<K.length;ft++)se=K[ft],pe=Fe+Oe(se,ft),Je+=be(se,W,ae,pe,he);else if(ft=O(K),typeof ft=="function")for(K=ft.call(K),ft=0;!(se=K.next()).done;)se=se.value,pe=Fe+Oe(se,ft++),Je+=be(se,W,ae,pe,he);else if(pe==="object"){if(typeof K.then=="function")return be(ue(K),W,ae,se,he);throw W=String(K),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(K).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Je}function re(K,W,ae){if(K==null)return K;var se=[],he=0;return be(K,se,"","",function(pe){return W.call(ae,pe,he++)}),se}function de(K){if(K._status===-1){var W=K._result;W=W(),W.then(function(ae){(K._status===0||K._status===-1)&&(K._status=1,K._result=ae)},function(ae){(K._status===0||K._status===-1)&&(K._status=2,K._result=ae)}),K._status===-1&&(K._status=0,K._result=W)}if(K._status===1)return K._result.default;throw K._result}var Ae=typeof reportError=="function"?reportError:function(K){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof K=="object"&&K!==null&&typeof K.message=="string"?String(K.message):String(K),error:K});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",K);return}console.error(K)},_e={map:re,forEach:function(K,W,ae){re(K,function(){W.apply(this,arguments)},ae)},count:function(K){var W=0;return re(K,function(){W++}),W},toArray:function(K){return re(K,function(W){return W})||[]},only:function(K){if(!je(K))throw Error("React.Children.only expected to receive a single React element child.");return K}};return Ar.Activity=N,Ar.Children=_e,Ar.Component=z,Ar.Fragment=t,Ar.Profiler=o,Ar.PureComponent=U,Ar.StrictMode=n,Ar.Suspense=v,Ar.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Ar.__COMPILER_RUNTIME={__proto__:null,c:function(K){return V.H.useMemoCache(K)}},Ar.cache=function(K){return function(){return K.apply(null,arguments)}},Ar.cacheSignal=function(){return null},Ar.cloneElement=function(K,W,ae){if(K==null)throw Error("The argument must be a React element, but you passed "+K+".");var se=M({},K.props),he=K.key;if(W!=null)for(pe in W.key!==void 0&&(he=""+W.key),W)!J.call(W,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&W.ref===void 0||(se[pe]=W[pe]);var pe=arguments.length-2;if(pe===1)se.children=ae;else if(1<pe){for(var Je=Array(pe),Fe=0;Fe<pe;Fe++)Je[Fe]=arguments[Fe+2];se.children=Je}return Q(K.type,he,se)},Ar.createContext=function(K){return K={$$typeof:f,_currentValue:K,_currentValue2:K,_threadCount:0,Provider:null,Consumer:null},K.Provider=K,K.Consumer={$$typeof:u,_context:K},K},Ar.createElement=function(K,W,ae){var se,he={},pe=null;if(W!=null)for(se in W.key!==void 0&&(pe=""+W.key),W)J.call(W,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(he[se]=W[se]);var Je=arguments.length-2;if(Je===1)he.children=ae;else if(1<Je){for(var Fe=Array(Je),ft=0;ft<Je;ft++)Fe[ft]=arguments[ft+2];he.children=Fe}if(K&&K.defaultProps)for(se in Je=K.defaultProps,Je)he[se]===void 0&&(he[se]=Je[se]);return Q(K,pe,he)},Ar.createRef=function(){return{current:null}},Ar.forwardRef=function(K){return{$$typeof:g,render:K}},Ar.isValidElement=je,Ar.lazy=function(K){return{$$typeof:k,_payload:{_status:-1,_result:K},_init:de}},Ar.memo=function(K,W){return{$$typeof:p,type:K,compare:W===void 0?null:W}},Ar.startTransition=function(K){var W=V.T,ae={};V.T=ae;try{var se=K(),he=V.S;he!==null&&he(ae,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(ne,Ae)}catch(pe){Ae(pe)}finally{W!==null&&ae.types!==null&&(W.types=ae.types),V.T=W}},Ar.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Ar.use=function(K){return V.H.use(K)},Ar.useActionState=function(K,W,ae){return V.H.useActionState(K,W,ae)},Ar.useCallback=function(K,W){return V.H.useCallback(K,W)},Ar.useContext=function(K){return V.H.useContext(K)},Ar.useDebugValue=function(){},Ar.useDeferredValue=function(K,W){return V.H.useDeferredValue(K,W)},Ar.useEffect=function(K,W){return V.H.useEffect(K,W)},Ar.useEffectEvent=function(K){return V.H.useEffectEvent(K)},Ar.useId=function(){return V.H.useId()},Ar.useImperativeHandle=function(K,W,ae){return V.H.useImperativeHandle(K,W,ae)},Ar.useInsertionEffect=function(K,W){return V.H.useInsertionEffect(K,W)},Ar.useLayoutEffect=function(K,W){return V.H.useLayoutEffect(K,W)},Ar.useMemo=function(K,W){return V.H.useMemo(K,W)},Ar.useOptimistic=function(K,W){return V.H.useOptimistic(K,W)},Ar.useReducer=function(K,W,ae){return V.H.useReducer(K,W,ae)},Ar.useRef=function(K){return V.H.useRef(K)},Ar.useState=function(K){return V.H.useState(K)},Ar.useSyncExternalStore=function(K,W,ae){return V.H.useSyncExternalStore(K,W,ae)},Ar.useTransition=function(){return V.H.useTransition()},Ar.version="19.2.1",Ar}var b2;function fh(){return b2||(b2=1,wg.exports=pk()),wg.exports}var R=fh();const Zr=Sx(R);var kg={exports:{}},N0={},Ng={exports:{}},Sg={};var v2;function yk(){return v2||(v2=1,(function(e){function r(be,re){var de=be.length;be.push(re);e:for(;0<de;){var Ae=de-1>>>1,_e=be[Ae];if(0<o(_e,re))be[Ae]=re,be[de]=_e,de=Ae;else break e}}function t(be){return be.length===0?null:be[0]}function n(be){if(be.length===0)return null;var re=be[0],de=be.pop();if(de!==re){be[0]=de;e:for(var Ae=0,_e=be.length,K=_e>>>1;Ae<K;){var W=2*(Ae+1)-1,ae=be[W],se=W+1,he=be[se];if(0>o(ae,de))se<_e&&0>o(he,ae)?(be[Ae]=he,be[se]=de,Ae=se):(be[Ae]=ae,be[W]=de,Ae=W);else if(se<_e&&0>o(he,de))be[Ae]=he,be[se]=de,Ae=se;else break e}}return re}function o(be,re){var de=be.sortIndex-re.sortIndex;return de!==0?de:be.id-re.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,g=f.now();e.unstable_now=function(){return f.now()-g}}var v=[],p=[],k=1,N=null,C=3,O=!1,I=!1,M=!1,D=!1,z=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate!="undefined"?setImmediate:null;function H(be){for(var re=t(p);re!==null;){if(re.callback===null)n(p);else if(re.startTime<=be)n(p),re.sortIndex=re.expirationTime,r(v,re);else break;re=t(p)}}function q(be){if(M=!1,H(be),!I)if(t(v)!==null)I=!0,ne||(ne=!0,me());else{var re=t(p);re!==null&&ue(q,re.startTime-be)}}var ne=!1,V=-1,J=5,Q=-1;function Te(){return D?!0:!(e.unstable_now()-Q<J)}function je(){if(D=!1,ne){var be=e.unstable_now();Q=be;var re=!0;try{e:{I=!1,M&&(M=!1,B(V),V=-1),O=!0;var de=C;try{t:{for(H(be),N=t(v);N!==null&&!(N.expirationTime>be&&Te());){var Ae=N.callback;if(typeof Ae=="function"){N.callback=null,C=N.priorityLevel;var _e=Ae(N.expirationTime<=be);if(be=e.unstable_now(),typeof _e=="function"){N.callback=_e,H(be),re=!0;break t}N===t(v)&&n(v),H(be)}else n(v);N=t(v)}if(N!==null)re=!0;else{var K=t(p);K!==null&&ue(q,K.startTime-be),re=!1}}break e}finally{N=null,C=de,O=!1}re=void 0}}finally{re?me():ne=!1}}}var me;if(typeof U=="function")me=function(){U(je)};else if(typeof MessageChannel!="undefined"){var Se=new MessageChannel,Oe=Se.port2;Se.port1.onmessage=je,me=function(){Oe.postMessage(null)}}else me=function(){z(je,0)};function ue(be,re){V=z(function(){be(e.unstable_now())},re)}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(be){be.callback=null},e.unstable_forceFrameRate=function(be){0>be||125<be?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<be?Math.floor(1e3/be):5},e.unstable_getCurrentPriorityLevel=function(){return C},e.unstable_next=function(be){switch(C){case 1:case 2:case 3:var re=3;break;default:re=C}var de=C;C=re;try{return be()}finally{C=de}},e.unstable_requestPaint=function(){D=!0},e.unstable_runWithPriority=function(be,re){switch(be){case 1:case 2:case 3:case 4:case 5:break;default:be=3}var de=C;C=be;try{return re()}finally{C=de}},e.unstable_scheduleCallback=function(be,re,de){var Ae=e.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Ae+de:Ae):de=Ae,be){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=de+_e,be={id:k++,callback:re,priorityLevel:be,startTime:de,expirationTime:_e,sortIndex:-1},de>Ae?(be.sortIndex=de,r(p,be),t(v)===null&&be===t(p)&&(M?(B(V),V=-1):M=!0,ue(q,de-Ae))):(be.sortIndex=_e,r(v,be),I||O||(I=!0,ne||(ne=!0,me()))),be},e.unstable_shouldYield=Te,e.unstable_wrapCallback=function(be){var re=C;return function(){var de=C;C=re;try{return be.apply(this,arguments)}finally{C=de}}}})(Sg)),Sg}var _2;function bk(){return _2||(_2=1,Ng.exports=yk()),Ng.exports}var Eg={exports:{}},cs={};var w2;function vk(){if(w2)return cs;w2=1;var e=fh();function r(v){var p="https://react.dev/errors/"+v;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var k=2;k<arguments.length;k++)p+="&args[]="+encodeURIComponent(arguments[k])}return"Minified React error #"+v+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var n={d:{f:t,r:function(){throw Error(r(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(v,p,k){var N=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:N==null?null:""+N,children:v,containerInfo:p,implementation:k}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,p){if(v==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return cs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,cs.createPortal=function(v,p){var k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return u(v,p,null,k)},cs.flushSync=function(v){var p=f.T,k=n.p;try{if(f.T=null,n.p=2,v)return v()}finally{f.T=p,n.p=k,n.d.f()}},cs.preconnect=function(v,p){typeof v=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,n.d.C(v,p))},cs.prefetchDNS=function(v){typeof v=="string"&&n.d.D(v)},cs.preinit=function(v,p){if(typeof v=="string"&&p&&typeof p.as=="string"){var k=p.as,N=g(k,p.crossOrigin),C=typeof p.integrity=="string"?p.integrity:void 0,O=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;k==="style"?n.d.S(v,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:N,integrity:C,fetchPriority:O}):k==="script"&&n.d.X(v,{crossOrigin:N,integrity:C,fetchPriority:O,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},cs.preinitModule=function(v,p){if(typeof v=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var k=g(p.as,p.crossOrigin);n.d.M(v,{crossOrigin:k,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&n.d.M(v)},cs.preload=function(v,p){if(typeof v=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var k=p.as,N=g(k,p.crossOrigin);n.d.L(v,k,{crossOrigin:N,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},cs.preloadModule=function(v,p){if(typeof v=="string")if(p){var k=g(p.as,p.crossOrigin);n.d.m(v,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:k,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else n.d.m(v)},cs.requestFormReset=function(v){n.d.r(v)},cs.unstable_batchedUpdates=function(v,p){return v(p)},cs.useFormState=function(v,p,k){return f.H.useFormState(v,p,k)},cs.useFormStatus=function(){return f.H.useHostTransitionStatus()},cs.version="19.2.1",cs}var k2;function jv(){if(k2)return Eg.exports;k2=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(r){console.error(r)}}return e(),Eg.exports=vk(),Eg.exports}var N2;function _k(){if(N2)return N0;N2=1;var e=bk(),r=fh(),t=jv();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)l+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function u(s){var l=s,m=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(m=l.return),s=l.return;while(s)}return l.tag===3?m:null}function f(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function g(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function v(s){if(u(s)!==s)throw Error(n(188))}function p(s){var l=s.alternate;if(!l){if(l=u(s),l===null)throw Error(n(188));return l!==s?null:s}for(var m=s,_=l;;){var T=m.return;if(T===null)break;var j=T.alternate;if(j===null){if(_=T.return,_!==null){m=_;continue}break}if(T.child===j.child){for(j=T.child;j;){if(j===m)return v(T),s;if(j===_)return v(T),l;j=j.sibling}throw Error(n(188))}if(m.return!==_.return)m=T,_=j;else{for(var Y=!1,fe=T.child;fe;){if(fe===m){Y=!0,m=T,_=j;break}if(fe===_){Y=!0,_=T,m=j;break}fe=fe.sibling}if(!Y){for(fe=j.child;fe;){if(fe===m){Y=!0,m=j,_=T;break}if(fe===_){Y=!0,_=j,m=T;break}fe=fe.sibling}if(!Y)throw Error(n(189))}}if(m.alternate!==_)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?s:l}function k(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=k(s),l!==null)return l;s=s.sibling}return null}var N=Object.assign,C=Symbol.for("react.element"),O=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),U=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),Te=Symbol.for("react.memo_cache_sentinel"),je=Symbol.iterator;function me(s){return s===null||typeof s!="object"?null:(s=je&&s[je]||s["@@iterator"],typeof s=="function"?s:null)}var Se=Symbol.for("react.client.reference");function Oe(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Se?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case M:return"Fragment";case z:return"Profiler";case D:return"StrictMode";case q:return"Suspense";case ne:return"SuspenseList";case Q:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case I:return"Portal";case U:return s.displayName||"Context";case B:return(s._context.displayName||"Context")+".Consumer";case H:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case V:return l=s.displayName||null,l!==null?l:Oe(s.type)||"Memo";case J:l=s._payload,s=s._init;try{return Oe(s(l))}catch(m){}}return null}var ue=Array.isArray,be=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Ae=[],_e=-1;function K(s){return{current:s}}function W(s){0>_e||(s.current=Ae[_e],Ae[_e]=null,_e--)}function ae(s,l){_e++,Ae[_e]=s.current,s.current=l}var se=K(null),he=K(null),pe=K(null),Je=K(null);function Fe(s,l){switch(ae(pe,l),ae(he,s),ae(se,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?Ly(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=Ly(l),s=Py(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}W(se),ae(se,s)}function ft(){W(se),W(he),W(pe)}function ot(s){s.memoizedState!==null&&ae(Je,s);var l=se.current,m=Py(l,s.type);l!==m&&(ae(he,s),ae(se,m))}function Lt(s){he.current===s&&(W(se),W(he)),Je.current===s&&(W(Je),b0._currentValue=de)}var zt,Ht;function ht(s){if(zt===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);zt=l&&l[1]||"",Ht=-1<m.stack.indexOf(`
at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
`+zt+s+Ht}var tr=!1;function Kt(s,l){if(!s||tr)return"";tr=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var _={DetermineComponentFrameRoot:function(){try{if(l){var Et=function(){throw Error()};if(Object.defineProperty(Et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Et,[])}catch(mt){var st=mt}Reflect.construct(s,[],Et)}else{try{Et.call()}catch(mt){st=mt}s.call(Et.prototype)}}else{try{throw Error()}catch(mt){st=mt}(Et=s())&&typeof Et.catch=="function"&&Et.catch(function(){})}}catch(mt){if(mt&&st&&typeof mt.stack=="string")return[mt.stack,st.stack]}return[null,null]}};_.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var T=Object.getOwnPropertyDescriptor(_.DetermineComponentFrameRoot,"name");T&&T.configurable&&Object.defineProperty(_.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=_.DetermineComponentFrameRoot(),Y=j[0],fe=j[1];if(Y&&fe){var De=Y.split(`
`),at=fe.split(`
`);for(T=_=0;_<De.length&&!De[_].includes("DetermineComponentFrameRoot");)_++;for(;T<at.length&&!at[T].includes("DetermineComponentFrameRoot");)T++;if(_===De.length||T===at.length)for(_=De.length-1,T=at.length-1;1<=_&&0<=T&&De[_]!==at[T];)T--;for(;1<=_&&0<=T;_--,T--)if(De[_]!==at[T]){if(_!==1||T!==1)do if(_--,T--,0>T||De[_]!==at[T]){var yt=`
`+De[_].replace(" at new "," at ");return s.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",s.displayName)),yt}while(1<=_&&0<=T);break}}}finally{tr=!1,Error.prepareStackTrace=m}return(m=s?s.displayName||s.name:"")?ht(m):""}function gt(s,l){switch(s.tag){case 26:case 27:case 5:return ht(s.type);case 16:return ht("Lazy");case 13:return s.child!==l&&l!==null?ht("Suspense Fallback"):ht("Suspense");case 19:return ht("SuspenseList");case 0:case 15:return Kt(s.type,!1);case 11:return Kt(s.type.render,!1);case 1:return Kt(s.type,!0);case 31:return ht("Activity");default:return""}}function ve(s){try{var l="",m=null;do l+=gt(s,m),m=s,s=s.return;while(s);return l}catch(_){return`
Error generating stack: `+_.message+`
`+_.stack}}var Le=Object.prototype.hasOwnProperty,ut=e.unstable_scheduleCallback,tt=e.unstable_cancelCallback,Wt=e.unstable_shouldYield,pt=e.unstable_requestPaint,We=e.unstable_now,Nt=e.unstable_getCurrentPriorityLevel,At=e.unstable_ImmediatePriority,Qt=e.unstable_UserBlockingPriority,cr=e.unstable_NormalPriority,He=e.unstable_LowPriority,It=e.unstable_IdlePriority,Zt=e.log,yr=e.unstable_setDisableYieldValue,Ye=null,Ge=null;function Ct(s){if(typeof Zt=="function"&&yr(s),Ge&&typeof Ge.setStrictMode=="function")try{Ge.setStrictMode(Ye,s)}catch(l){}}var Ft=Math.clz32?Math.clz32:kt,Jt=Math.log,Dr=Math.LN2;function kt(s){return s>>>=0,s===0?32:31-(Jt(s)/Dr|0)|0}var Re=256,qe=262144,Tt=4194304;function xr(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Hr(s,l,m){var _=s.pendingLanes;if(_===0)return 0;var T=0,j=s.suspendedLanes,Y=s.pingedLanes;s=s.warmLanes;var fe=_&134217727;return fe!==0?(_=fe&~j,_!==0?T=xr(_):(Y&=fe,Y!==0?T=xr(Y):m||(m=fe&~s,m!==0&&(T=xr(m))))):(fe=_&~j,fe!==0?T=xr(fe):Y!==0?T=xr(Y):m||(m=_&~s,m!==0&&(T=xr(m)))),T===0?0:l!==0&&l!==T&&(l&j)===0&&(j=T&-T,m=l&-l,j>=m||j===32&&(m&4194048)!==0)?l:T}function Ir(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function Pa(s,l){switch(s){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 ca(){var s=Tt;return Tt<<=1,(Tt&62914560)===0&&(Tt=4194304),s}function _n(s){for(var l=[],m=0;31>m;m++)l.push(s);return l}function fn(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function hn(s,l,m,_,T,j){var Y=s.pendingLanes;s.pendingLanes=m,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=m,s.entangledLanes&=m,s.errorRecoveryDisabledLanes&=m,s.shellSuspendCounter=0;var fe=s.entanglements,De=s.expirationTimes,at=s.hiddenUpdates;for(m=Y&~m;0<m;){var yt=31-Ft(m),Et=1<<yt;fe[yt]=0,De[yt]=-1;var st=at[yt];if(st!==null)for(at[yt]=null,yt=0;yt<st.length;yt++){var mt=st[yt];mt!==null&&(mt.lane&=-536870913)}m&=~Et}_!==0&&Xs(s,_,0),j!==0&&T===0&&s.tag!==0&&(s.suspendedLanes|=j&~(Y&~l))}function Xs(s,l,m){s.pendingLanes|=l,s.suspendedLanes&=~l;var _=31-Ft(l);s.entangledLanes|=l,s.entanglements[_]=s.entanglements[_]|1073741824|m&261930}function Ha(s,l){var m=s.entangledLanes|=l;for(s=s.entanglements;m;){var _=31-Ft(m),T=1<<_;T&l|s[_]&l&&(s[_]|=l),m&=~T}}function gs(s,l){var m=l&-l;return m=(m&42)!==0?1:$r(m),(m&(s.suspendedLanes|l))!==0?0:m}function $r(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function rr(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ie(){var s=re.p;return s!==0?s:(s=window.event,s===void 0?32:i2(s.type))}function Z(s,l){var m=re.p;try{return re.p=s,l()}finally{re.p=m}}var ce=Math.random().toString(36).slice(2),xe="__reactFiber$"+ce,ye="__reactProps$"+ce,Ee="__reactContainer$"+ce,ge="__reactEvents$"+ce,Be="__reactListeners$"+ce,ze="__reactHandles$"+ce,Ze="__reactResources$"+ce,et="__reactMarker$"+ce;function _t(s){delete s[xe],delete s[ye],delete s[ge],delete s[Be],delete s[ze]}function vt(s){var l=s[xe];if(l)return l;for(var m=s.parentNode;m;){if(l=m[Ee]||m[xe]){if(m=l.alternate,l.child!==null||m!==null&&m.child!==null)for(s=Vy(s);s!==null;){if(m=s[xe])return m;s=Vy(s)}return l}s=m,m=s.parentNode}return null}function Ot(s){if(s=s[xe]||s[Ee]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Rt(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Ut(s){var l=s[Ze];return l||(l=s[Ze]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function nr(s){s[et]=!0}var ct=new Set,ga={};function kr(s,l){Wa(s,l),Wa(s+"Capture",l)}function Wa(s,l){for(ga[s]=l,s=0;s<l.length;s++)ct.add(l[s])}var xs=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]*$"),Or={},Cr={};function Nr(s){return Le.call(Cr,s)?!0:Le.call(Or,s)?!1:xs.test(s)?Cr[s]=!0:(Or[s]=!0,!1)}function br(s,l,m){if(Nr(l))if(m===null)s.removeAttribute(l);else{switch(typeof m){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var _=l.toLowerCase().slice(0,5);if(_!=="data-"&&_!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+m)}}function ea(s,l,m){if(m===null)s.removeAttribute(l);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+m)}}function jn(s,l,m,_){if(_===null)s.removeAttribute(m);else{switch(typeof _){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(m);return}s.setAttributeNS(l,m,""+_)}}function Br(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function On(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Il(s,l,m){var _=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof _!="undefined"&&typeof _.get=="function"&&typeof _.set=="function"){var T=_.get,j=_.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return T.call(this)},set:function(Y){m=""+Y,j.call(this,Y)}}),Object.defineProperty(s,l,{enumerable:_.enumerable}),{getValue:function(){return m},setValue:function(Y){m=""+Y},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function or(s){if(!s._valueTracker){var l=On(s)?"checked":"value";s._valueTracker=Il(s,l,""+s[l])}}function Kr(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var m=l.getValue(),_="";return s&&(_=On(s)?s.checked?"true":"false":s.value),s=_,s!==m?(l.setValue(s),!0):!1}function Qi(s){if(s=s||(typeof document!="undefined"?document:void 0),typeof s=="undefined")return null;try{return s.activeElement||s.body}catch(l){return s.body}}var Ys=/[\n"\\]/g;function pr(s){return s.replace(Ys,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Ya(s,l,m,_,T,j,Y,fe){s.name="",Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?s.type=Y:s.removeAttribute("type"),l!=null?Y==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Br(l)):s.value!==""+Br(l)&&(s.value=""+Br(l)):Y!=="submit"&&Y!=="reset"||s.removeAttribute("value"),l!=null?we(s,Y,Br(l)):m!=null?we(s,Y,Br(m)):_!=null&&s.removeAttribute("value"),T==null&&j!=null&&(s.defaultChecked=!!j),T!=null&&(s.checked=T&&typeof T!="function"&&typeof T!="symbol"),fe!=null&&typeof fe!="function"&&typeof fe!="symbol"&&typeof fe!="boolean"?s.name=""+Br(fe):s.removeAttribute("name")}function Qe(s,l,m,_,T,j,Y,fe){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.type=j),l!=null||m!=null){if(!(j!=="submit"&&j!=="reset"||l!=null)){or(s);return}m=m!=null?""+Br(m):"",l=l!=null?""+Br(l):m,fe||l===s.value||(s.value=l),s.defaultValue=l}_=_!=null?_:T,_=typeof _!="function"&&typeof _!="symbol"&&!!_,s.checked=fe?s.checked:!!_,s.defaultChecked=!!_,Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"&&(s.name=Y),or(s)}function we(s,l,m){l==="number"&&Qi(s.ownerDocument)===s||s.defaultValue===""+m||(s.defaultValue=""+m)}function Gt(s,l,m,_){if(s=s.options,l){l={};for(var T=0;T<m.length;T++)l["$"+m[T]]=!0;for(m=0;m<s.length;m++)T=l.hasOwnProperty("$"+s[m].value),s[m].selected!==T&&(s[m].selected=T),T&&_&&(s[m].defaultSelected=!0)}else{for(m=""+Br(m),l=null,T=0;T<s.length;T++){if(s[T].value===m){s[T].selected=!0,_&&(s[T].defaultSelected=!0);return}l!==null||s[T].disabled||(l=s[T])}l!==null&&(l.selected=!0)}}function pa(s,l,m){if(l!=null&&(l=""+Br(l),l!==s.value&&(s.value=l),m==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=m!=null?""+Br(m):""}function an(s,l,m,_){if(l==null){if(_!=null){if(m!=null)throw Error(n(92));if(ue(_)){if(1<_.length)throw Error(n(93));_=_[0]}m=_}m==null&&(m=""),l=m}m=Br(l),s.defaultValue=m,_=s.textContent,_===m&&_!==""&&_!==null&&(s.value=_),or(s)}function Ts(s,l){if(l){var m=s.firstChild;if(m&&m===s.lastChild&&m.nodeType===3){m.nodeValue=l;return}}s.textContent=l}var yo=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 nn(s,l,m){var _=l.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?_?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":_?s.setProperty(l,m):typeof m!="number"||m===0||yo.has(l)?l==="float"?s.cssFloat=m:s[l]=(""+m).trim():s[l]=m+"px"}function ur(s,l,m){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,m!=null){for(var _ in m)!m.hasOwnProperty(_)||l!=null&&l.hasOwnProperty(_)||(_.indexOf("--")===0?s.setProperty(_,""):_==="float"?s.cssFloat="":s[_]="");for(var T in l)_=l[T],l.hasOwnProperty(T)&&m[T]!==_&&nn(s,T,_)}else for(var j in l)l.hasOwnProperty(j)&&nn(s,j,l[j])}function da(s){if(s.indexOf("-")===-1)return!1;switch(s){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"]]),Ll=/^[\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 mi(s){return Ll.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function wn(){}var eo=null;function vo(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ja=null,mr=null;function Za(s){var l=Ot(s);if(l&&(s=l.stateNode)){var m=s[ye]||null;e:switch(s=l.stateNode,l.type){case"input":if(Ya(s,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),l=m.name,m.type==="radio"&&l!=null){for(m=s;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+pr(""+l)+'"][type="radio"]'),l=0;l<m.length;l++){var _=m[l];if(_!==s&&_.form===s.form){var T=_[ye]||null;if(!T)throw Error(n(90));Ya(_,T.value,T.defaultValue,T.defaultValue,T.checked,T.defaultChecked,T.type,T.name)}}for(l=0;l<m.length;l++)_=m[l],_.form===s.form&&Kr(_)}break e;case"textarea":pa(s,m.value,m.defaultValue);break e;case"select":l=m.value,l!=null&&Gt(s,!!m.multiple,l,!1)}}}var qt=!1;function Pl(s,l,m){if(qt)return s(l,m);qt=!0;try{var _=s(l);return _}finally{if(qt=!1,(ja!==null||mr!==null)&&(Xu(),ja&&(l=ja,s=mr,mr=ja=null,Za(l),s)))for(l=0;l<s.length;l++)Za(s[l])}}function _r(s,l){var m=s.stateNode;if(m===null)return null;var _=m[ye]||null;if(_===null)return null;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":(_=!_.disabled)||(s=s.type,_=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!_;break e;default:s=!1}if(s)return null;if(m&&typeof m!="function")throw Error(n(231,l,typeof m));return m}var ua=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),_o=!1;if(ua)try{var Hn={};Object.defineProperty(Hn,"passive",{get:function(){_o=!0}}),window.addEventListener("test",Hn,Hn),window.removeEventListener("test",Hn,Hn)}catch(s){_o=!1}var ps=null,Wn=null,Fa=null;function ns(){if(Fa)return Fa;var s,l=Wn,m=l.length,_,T="value"in ps?ps.value:ps.textContent,j=T.length;for(s=0;s<m&&l[s]===T[s];s++);var Y=m-s;for(_=1;_<=Y&&l[m-_]===T[j-_];_++);return Fa=T.slice(s,1<_?1-_:void 0)}function Zs(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function $s(){return!0}function Fl(){return!1}function Va(s){function l(m,_,T,j,Y){this._reactName=m,this._targetInst=T,this.type=_,this.nativeEvent=j,this.target=Y,this.currentTarget=null;for(var fe in s)s.hasOwnProperty(fe)&&(m=s[fe],this[fe]=m?m(j):j[fe]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?$s:Fl,this.isPropagationStopped=Fl,this}return N(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=$s)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=$s)},persist:function(){},isPersistent:$s}),l}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sn=Va(Vn),ji=N({},Vn,{view:0,detail:0}),Ur=Va(ji),Qo,Gn,qs,wo=N({},ji,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ko,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==qs&&(qs&&s.type==="mousemove"?(Qo=s.screenX-qs.screenX,Gn=s.screenY-qs.screenY):Gn=Qo=0,qs=s),Qo)},movementY:function(s){return"movementY"in s?s.movementY:Gn}}),Jr=Va(wo),el=N({},wo,{dataTransfer:0}),tl=Va(el),Ks=N({},ji,{relatedTarget:0}),Bl=Va(Ks),lt=N({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Tr=Va(lt),on=N({},Vn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Xn=Va(on),Nc=N({},Vn,{data:0}),Ul=Va(Nc),gi={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sc={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"},rl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ra(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=rl[s])?!!l[s]:!1}function ko(){return Ra}var Oa=N({},ji,{key:function(s){if(s.key){var l=gi[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Zs(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Sc[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ko,charCode:function(s){return s.type==="keypress"?Zs(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Zs(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),No=Va(Oa),Oi=N({},wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ta=Va(Oi),hr=N({},ji,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ko}),Ud=Va(hr),xa=N({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),xi=Va(xa),Js=N({},wo,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Mi=Va(Js),As=N({},Vn,{newState:0,oldState:0}),Ri=Va(As),Yn=[9,13,27,32],to=ua&&"CompositionEvent"in window,Di=null;ua&&"documentMode"in document&&(Di=document.documentMode);var Ec=ua&&"TextEvent"in window&&!Di,al=ua&&(!to||Di&&8<Di&&11>=Di),Qs=" ",nl=!1;function Cc(s,l){switch(s){case"keyup":return Yn.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ii(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ro=!1;function $a(s,l){switch(s){case"compositionend":return Ii(l);case"keypress":return l.which!==32?null:(nl=!0,Qs);case"textInput":return s=l.data,s===Qs&&nl?null:s;default:return null}}function ei(s,l){if(ro)return s==="compositionend"||!to&&Cc(s,l)?(s=ns(),Fa=Wn=ps=null,ro=!1,s):null;switch(s){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 al&&l.locale!=="ko"?null:l.data;default:return null}}var ss={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 ys(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!ss[s.type]:l==="textarea"}function bs(s,l,m,_){ja?mr?mr.push(_):mr=[_]:ja=_,l=Qu(l,"onChange"),0<l.length&&(m=new sn("onChange","change",null,m,_),s.push({event:m,listeners:l}))}var js=null,Li=null;function So(s){jy(s,0)}function ao(s){var l=Rt(s);if(Kr(l))return s}function Mn(s,l){if(s==="change")return l}var Tc=!1;if(ua){var is;if(ua){var Os="oninput"in document;if(!Os){var zr=document.createElement("div");zr.setAttribute("oninput","return;"),Os=typeof zr.oninput=="function"}is=Os}else is=!1;Tc=is&&(!document.documentMode||9<document.documentMode)}function Pi(){js&&(js.detachEvent("onpropertychange",ee),Li=js=null)}function ee(s){if(s.propertyName==="value"&&ao(Li)){var l=[];bs(l,Li,s,vo(s)),Pl(So,l)}}function i(s,l,m){s==="focusin"?(Pi(),js=l,Li=m,js.attachEvent("onpropertychange",ee)):s==="focusout"&&Pi()}function c(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ao(Li)}function h(s,l){if(s==="click")return ao(l)}function x(s,l){if(s==="input"||s==="change")return ao(l)}function y(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var w=typeof Object.is=="function"?Object.is:y;function S(s,l){if(w(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var m=Object.keys(s),_=Object.keys(l);if(m.length!==_.length)return!1;for(_=0;_<m.length;_++){var T=m[_];if(!Le.call(l,T)||!w(s[T],l[T]))return!1}return!0}function A(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function P(s,l){var m=A(s);s=0;for(var _;m;){if(m.nodeType===3){if(_=s+m.textContent.length,s<=l&&_>=l)return{node:m,offset:l-s};s=_}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=A(m)}}function G(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?G(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function te(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=Qi(s.document);l instanceof s.HTMLIFrameElement;){try{var m=typeof l.contentWindow.location.href=="string"}catch(_){m=!1}if(m)s=l.contentWindow;else break;l=Qi(s.document)}return l}function oe(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var Ce=ua&&"documentMode"in document&&11>=document.documentMode,Ie=null,Pe=null,Ke=null,it=!1;function Bt(s,l,m){var _=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;it||Ie==null||Ie!==Qi(_)||(_=Ie,"selectionStart"in _&&oe(_)?_={start:_.selectionStart,end:_.selectionEnd}:(_=(_.ownerDocument&&_.ownerDocument.defaultView||window).getSelection(),_={anchorNode:_.anchorNode,anchorOffset:_.anchorOffset,focusNode:_.focusNode,focusOffset:_.focusOffset}),Ke&&S(Ke,_)||(Ke=_,_=Qu(Pe,"onSelect"),0<_.length&&(l=new sn("onSelect","select",null,l,m),s.push({event:l,listeners:_}),l.target=Ie)))}function Pt(s,l){var m={};return m[s.toLowerCase()]=l.toLowerCase(),m["Webkit"+s]="webkit"+l,m["Moz"+s]="moz"+l,m}var Mt={animationend:Pt("Animation","AnimationEnd"),animationiteration:Pt("Animation","AnimationIteration"),animationstart:Pt("Animation","AnimationStart"),transitionrun:Pt("Transition","TransitionRun"),transitionstart:Pt("Transition","TransitionStart"),transitioncancel:Pt("Transition","TransitionCancel"),transitionend:Pt("Transition","TransitionEnd")},jr={},Sr={};ua&&(Sr=document.createElement("div").style,"AnimationEvent"in window||(delete Mt.animationend.animation,delete Mt.animationiteration.animation,delete Mt.animationstart.animation),"TransitionEvent"in window||delete Mt.transitionend.transition);function Qr(s){if(jr[s])return jr[s];if(!Mt[s])return s;var l=Mt[s],m;for(m in l)if(l.hasOwnProperty(m)&&m in Sr)return jr[s]=l[m];return s}var kn=Qr("animationend"),Nn=Qr("animationiteration"),qr=Qr("animationstart"),ln=Qr("transitionrun"),Rn=Qr("transitionstart"),no=Qr("transitioncancel"),vs=Qr("transitionend"),Ac=new Map,pi="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(" ");pi.push("scrollEnd");function Ms(s,l){Ac.set(s,l),kr(l,[s])}var zl=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Rs=[],os=0,jc=0;function Hl(){for(var s=os,l=jc=os=0;l<s;){var m=Rs[l];Rs[l++]=null;var _=Rs[l];Rs[l++]=null;var T=Rs[l];Rs[l++]=null;var j=Rs[l];if(Rs[l++]=null,_!==null&&T!==null){var Y=_.pending;Y===null?T.next=T:(T.next=Y.next,Y.next=T),_.pending=T}j!==0&&sl(m,T,j)}}function so(s,l,m,_){Rs[os++]=s,Rs[os++]=l,Rs[os++]=m,Rs[os++]=_,jc|=_,s.lanes|=_,s=s.alternate,s!==null&&(s.lanes|=_)}function zd(s,l,m,_){return so(s,l,m,_),Wl(s)}function yi(s,l){return so(s,null,null,l),Wl(s)}function sl(s,l,m){s.lanes|=m;var _=s.alternate;_!==null&&(_.lanes|=m);for(var T=!1,j=s.return;j!==null;)j.childLanes|=m,_=j.alternate,_!==null&&(_.childLanes|=m),j.tag===22&&(s=j.stateNode,s===null||s._visibility&1||(T=!0)),s=j,j=j.return;return s.tag===3?(j=s.stateNode,T&&l!==null&&(T=31-Ft(m),s=j.hiddenUpdates,_=s[T],_===null?s[T]=[l]:_.push(l),l.lane=m|536870912),j):null}function Wl(s){if(50<f0)throw f0=0,Hm=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Eo={};function zh(s,l,m,_){this.tag=s,this.key=m,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=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ls(s,l,m,_){return new zh(s,l,m,_)}function Oc(s){return s=s.prototype,!(!s||!s.isReactComponent)}function bi(s,l){var m=s.alternate;return m===null?(m=ls(s.tag,l,s.key,s.mode),m.elementType=s.elementType,m.type=s.type,m.stateNode=s.stateNode,m.alternate=s,s.alternate=m):(m.pendingProps=l,m.type=s.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=s.flags&65011712,m.childLanes=s.childLanes,m.lanes=s.lanes,m.child=s.child,m.memoizedProps=s.memoizedProps,m.memoizedState=s.memoizedState,m.updateQueue=s.updateQueue,l=s.dependencies,m.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},m.sibling=s.sibling,m.index=s.index,m.ref=s.ref,m.refCleanup=s.refCleanup,m}function Hd(s,l){s.flags&=65011714;var m=s.alternate;return m===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=m.childLanes,s.lanes=m.lanes,s.child=m.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=m.memoizedProps,s.memoizedState=m.memoizedState,s.updateQueue=m.updateQueue,s.type=m.type,l=m.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function Vl(s,l,m,_,T,j){var Y=0;if(_=s,typeof s=="function")Oc(s)&&(Y=1);else if(typeof s=="string")Y=K3(s,m,se.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Q:return s=ls(31,m,l,T),s.elementType=Q,s.lanes=j,s;case M:return Co(m.children,T,j,l);case D:Y=8,T|=24;break;case z:return s=ls(12,m,l,T|2),s.elementType=z,s.lanes=j,s;case q:return s=ls(13,m,l,T),s.elementType=q,s.lanes=j,s;case ne:return s=ls(19,m,l,T),s.elementType=ne,s.lanes=j,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case U:Y=10;break e;case B:Y=9;break e;case H:Y=11;break e;case V:Y=14;break e;case J:Y=16,_=null;break e}Y=29,m=Error(n(130,s===null?"null":typeof s,"")),_=null}return l=ls(Y,m,l,T),l.elementType=s,l.type=_,l.lanes=j,l}function Co(s,l,m,_){return s=ls(7,s,_,l),s.lanes=m,s}function Mc(s,l,m){return s=ls(6,s,null,l),s.lanes=m,s}function Wd(s){var l=ls(18,null,null,0);return l.stateNode=s,l}function Vd(s,l,m){return l=ls(4,s.children!==null?s.children:[],s.key,l),l.lanes=m,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var d=new WeakMap;function b(s,l){if(typeof s=="object"&&s!==null){var m=d.get(s);return m!==void 0?m:(l={value:s,source:l,stack:ve(l)},d.set(s,l),l)}return{value:s,source:l,stack:ve(l)}}var E=[],F=0,X=null,le=0,Me=[],$e=0,nt=null,St=1,$t="";function fr(s,l){E[F++]=le,E[F++]=X,X=s,le=l}function Lr(s,l,m){Me[$e++]=St,Me[$e++]=$t,Me[$e++]=nt,nt=s;var _=St;s=$t;var T=32-Ft(_)-1;_&=~(1<<T),m+=1;var j=32-Ft(l)+T;if(30<j){var Y=T-T%5;j=(_&(1<<Y)-1).toString(32),_>>=Y,T-=Y,St=1<<32-Ft(l)+T|m<<T|_,$t=j+s}else St=1<<j|m<<T|_,$t=s}function Sn(s){s.return!==null&&(fr(s,1),Lr(s,1,0))}function qa(s){for(;s===X;)X=E[--F],E[F]=null,le=E[--F],E[F]=null;for(;s===nt;)nt=Me[--$e],Me[$e]=null,$t=Me[--$e],Me[$e]=null,St=Me[--$e],Me[$e]=null}function _s(s,l){Me[$e++]=St,Me[$e++]=$t,Me[$e++]=nt,St=l.id,$t=l.overflow,nt=s}var ra=null,aa=null,Wr=!1,io=null,Ds=!1,Rc=Error(n(519));function oo(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gl(b(l,s)),Rc}function Gd(s){var l=s.stateNode,m=s.type,_=s.memoizedProps;switch(l[xe]=s,l[ye]=_,m){case"dialog":Gr("cancel",l),Gr("close",l);break;case"iframe":case"object":case"embed":Gr("load",l);break;case"video":case"audio":for(m=0;m<m0.length;m++)Gr(m0[m],l);break;case"source":Gr("error",l);break;case"img":case"image":case"link":Gr("error",l),Gr("load",l);break;case"details":Gr("toggle",l);break;case"input":Gr("invalid",l),Qe(l,_.value,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name,!0);break;case"select":Gr("invalid",l);break;case"textarea":Gr("invalid",l),an(l,_.value,_.defaultValue,_.children)}m=_.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||l.textContent===""+m||_.suppressHydrationWarning===!0||Dy(l.textContent,m)?(_.popover!=null&&(Gr("beforetoggle",l),Gr("toggle",l)),_.onScroll!=null&&Gr("scroll",l),_.onScrollEnd!=null&&Gr("scrollend",l),_.onClick!=null&&(l.onclick=wn),l=!0):l=!1,l||oo(s,!0)}function Ga(s){for(ra=s.return;ra;)switch(ra.tag){case 5:case 31:case 13:Ds=!1;return;case 27:case 3:Ds=!0;return;default:ra=ra.return}}function Fi(s){if(s!==ra)return!1;if(!Wr)return Ga(s),Wr=!0,!1;var l=s.tag,m;if((m=l!==3&&l!==27)&&((m=l===5)&&(m=s.type,m=!(m!=="form"&&m!=="button")||ag(s.type,s.memoizedProps)),m=!m),m&&aa&&oo(s),Ga(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));aa=Wy(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));aa=Wy(s)}else l===27?(l=aa,bl(s.type)?(s=lg,lg=null,aa=s):aa=l):aa=ra?_i(s.stateNode.nextSibling):null;return!0}function To(){aa=ra=null,Wr=!1}function Xd(){var s=io;return s!==null&&(Fs===null?Fs=s:Fs.push.apply(Fs,s),io=null),s}function Gl(s){io===null?io=[s]:io.push(s)}var Xl=K(null),lo=null,Bi=null;function il(s,l,m){ae(Xl,l._currentValue),l._currentValue=m}function Ao(s){s._currentValue=Xl.current,W(Xl)}function Hh(s,l,m){for(;s!==null;){var _=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,_!==null&&(_.childLanes|=l)):_!==null&&(_.childLanes&l)!==l&&(_.childLanes|=l),s===m)break;s=s.return}}function Wh(s,l,m,_){var T=s.child;for(T!==null&&(T.return=s);T!==null;){var j=T.dependencies;if(j!==null){var Y=T.child;j=j.firstContext;e:for(;j!==null;){var fe=j;j=T;for(var De=0;De<l.length;De++)if(fe.context===l[De]){j.lanes|=m,fe=j.alternate,fe!==null&&(fe.lanes|=m),Hh(j.return,m,s),_||(Y=null);break e}j=fe.next}}else if(T.tag===18){if(Y=T.return,Y===null)throw Error(n(341));Y.lanes|=m,j=Y.alternate,j!==null&&(j.lanes|=m),Hh(Y,m,s),Y=null}else Y=T.child;if(Y!==null)Y.return=T;else for(Y=T;Y!==null;){if(Y===s){Y=null;break}if(T=Y.sibling,T!==null){T.return=Y.return,Y=T;break}Y=Y.return}T=Y}}function Dc(s,l,m,_){s=null;for(var T=l,j=!1;T!==null;){if(!j){if((T.flags&524288)!==0)j=!0;else if((T.flags&262144)!==0)break}if(T.tag===10){var Y=T.alternate;if(Y===null)throw Error(n(387));if(Y=Y.memoizedProps,Y!==null){var fe=T.type;w(T.pendingProps.value,Y.value)||(s!==null?s.push(fe):s=[fe])}}else if(T===Je.current){if(Y=T.alternate,Y===null)throw Error(n(387));Y.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(s!==null?s.push(b0):s=[b0])}T=T.return}s!==null&&Wh(l,s,m,_),l.flags|=262144}function yu(s){for(s=s.firstContext;s!==null;){if(!w(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Yl(s){lo=s,Bi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Zn(s){return bp(lo,s)}function bu(s,l){return lo===null&&Yl(s),bp(s,l)}function bp(s,l){var m=l._currentValue;if(l={context:l,memoizedValue:m,next:null},Bi===null){if(s===null)throw Error(n(308));Bi=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else Bi=Bi.next=l;return m}var Y4=typeof AbortController!="undefined"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(m,_){s.push(_)}};this.abort=function(){l.aborted=!0,s.forEach(function(m){return m()})}},Z4=e.unstable_scheduleCallback,$4=e.unstable_NormalPriority,mn={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vh(){return{controller:new Y4,data:new Map,refCount:0}}function Yd(s){s.refCount--,s.refCount===0&&Z4($4,function(){s.controller.abort()})}var Zd=null,Gh=0,Ic=0,Lc=null;function q4(s,l){if(Zd===null){var m=Zd=[];Gh=0,Ic=Zm(),Lc={status:"pending",value:void 0,then:function(_){m.push(_)}}}return Gh++,l.then(vp,vp),l}function vp(){if(--Gh===0&&Zd!==null){Lc!==null&&(Lc.status="fulfilled");var s=Zd;Zd=null,Ic=0,Lc=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function K4(s,l){var m=[],_={status:"pending",value:null,reason:null,then:function(T){m.push(T)}};return s.then(function(){_.status="fulfilled",_.value=l;for(var T=0;T<m.length;T++)(0,m[T])(l)},function(T){for(_.status="rejected",_.reason=T,T=0;T<m.length;T++)(0,m[T])(void 0)}),_}var _p=be.S;be.S=function(s,l){ny=We(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&q4(s,l),_p!==null&&_p(s,l)};var Zl=K(null);function Xh(){var s=Zl.current;return s!==null?s:Ma.pooledCache}function vu(s,l){l===null?ae(Zl,Zl.current):ae(Zl,l.pool)}function wp(){var s=Xh();return s===null?null:{parent:mn._currentValue,pool:s}}var Pc=Error(n(460)),Yh=Error(n(474)),_u=Error(n(542)),wu={then:function(){}};function kp(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Np(s,l,m){switch(m=s[m],m===void 0?s.push(l):m!==l&&(l.then(wn,wn),l=m),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,Ep(s),s;default:if(typeof l.status=="string")l.then(wn,wn);else{if(s=Ma,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(_){if(l.status==="pending"){var T=l;T.status="fulfilled",T.value=_}},function(_){if(l.status==="pending"){var T=l;T.status="rejected",T.reason=_}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,Ep(s),s}throw ql=l,Pc}}function $l(s){try{var l=s._init;return l(s._payload)}catch(m){throw m!==null&&typeof m=="object"&&typeof m.then=="function"?(ql=m,Pc):m}}var ql=null;function Sp(){if(ql===null)throw Error(n(459));var s=ql;return ql=null,s}function Ep(s){if(s===Pc||s===_u)throw Error(n(483))}var Fc=null,$d=0;function ku(s){var l=$d;return $d+=1,Fc===null&&(Fc=[]),Np(Fc,s,l)}function qd(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function Nu(s,l){throw l.$$typeof===C?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function Cp(s){function l(Xe,Ue){if(s){var rt=Xe.deletions;rt===null?(Xe.deletions=[Ue],Xe.flags|=16):rt.push(Ue)}}function m(Xe,Ue){if(!s)return null;for(;Ue!==null;)l(Xe,Ue),Ue=Ue.sibling;return null}function _(Xe){for(var Ue=new Map;Xe!==null;)Xe.key!==null?Ue.set(Xe.key,Xe):Ue.set(Xe.index,Xe),Xe=Xe.sibling;return Ue}function T(Xe,Ue){return Xe=bi(Xe,Ue),Xe.index=0,Xe.sibling=null,Xe}function j(Xe,Ue,rt){return Xe.index=rt,s?(rt=Xe.alternate,rt!==null?(rt=rt.index,rt<Ue?(Xe.flags|=67108866,Ue):rt):(Xe.flags|=67108866,Ue)):(Xe.flags|=1048576,Ue)}function Y(Xe){return s&&Xe.alternate===null&&(Xe.flags|=67108866),Xe}function fe(Xe,Ue,rt,wt){return Ue===null||Ue.tag!==6?(Ue=Mc(rt,Xe.mode,wt),Ue.return=Xe,Ue):(Ue=T(Ue,rt),Ue.return=Xe,Ue)}function De(Xe,Ue,rt,wt){var gr=rt.type;return gr===M?yt(Xe,Ue,rt.props.children,wt,rt.key):Ue!==null&&(Ue.elementType===gr||typeof gr=="object"&&gr!==null&&gr.$$typeof===J&&$l(gr)===Ue.type)?(Ue=T(Ue,rt.props),qd(Ue,rt),Ue.return=Xe,Ue):(Ue=Vl(rt.type,rt.key,rt.props,null,Xe.mode,wt),qd(Ue,rt),Ue.return=Xe,Ue)}function at(Xe,Ue,rt,wt){return Ue===null||Ue.tag!==4||Ue.stateNode.containerInfo!==rt.containerInfo||Ue.stateNode.implementation!==rt.implementation?(Ue=Vd(rt,Xe.mode,wt),Ue.return=Xe,Ue):(Ue=T(Ue,rt.children||[]),Ue.return=Xe,Ue)}function yt(Xe,Ue,rt,wt,gr){return Ue===null||Ue.tag!==7?(Ue=Co(rt,Xe.mode,wt,gr),Ue.return=Xe,Ue):(Ue=T(Ue,rt),Ue.return=Xe,Ue)}function Et(Xe,Ue,rt){if(typeof Ue=="string"&&Ue!==""||typeof Ue=="number"||typeof Ue=="bigint")return Ue=Mc(""+Ue,Xe.mode,rt),Ue.return=Xe,Ue;if(typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case O:return rt=Vl(Ue.type,Ue.key,Ue.props,null,Xe.mode,rt),qd(rt,Ue),rt.return=Xe,rt;case I:return Ue=Vd(Ue,Xe.mode,rt),Ue.return=Xe,Ue;case J:return Ue=$l(Ue),Et(Xe,Ue,rt)}if(ue(Ue)||me(Ue))return Ue=Co(Ue,Xe.mode,rt,null),Ue.return=Xe,Ue;if(typeof Ue.then=="function")return Et(Xe,ku(Ue),rt);if(Ue.$$typeof===U)return Et(Xe,bu(Xe,Ue),rt);Nu(Xe,Ue)}return null}function st(Xe,Ue,rt,wt){var gr=Ue!==null?Ue.key:null;if(typeof rt=="string"&&rt!==""||typeof rt=="number"||typeof rt=="bigint")return gr!==null?null:fe(Xe,Ue,""+rt,wt);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case O:return rt.key===gr?De(Xe,Ue,rt,wt):null;case I:return rt.key===gr?at(Xe,Ue,rt,wt):null;case J:return rt=$l(rt),st(Xe,Ue,rt,wt)}if(ue(rt)||me(rt))return gr!==null?null:yt(Xe,Ue,rt,wt,null);if(typeof rt.then=="function")return st(Xe,Ue,ku(rt),wt);if(rt.$$typeof===U)return st(Xe,Ue,bu(Xe,rt),wt);Nu(Xe,rt)}return null}function mt(Xe,Ue,rt,wt,gr){if(typeof wt=="string"&&wt!==""||typeof wt=="number"||typeof wt=="bigint")return Xe=Xe.get(rt)||null,fe(Ue,Xe,""+wt,gr);if(typeof wt=="object"&&wt!==null){switch(wt.$$typeof){case O:return Xe=Xe.get(wt.key===null?rt:wt.key)||null,De(Ue,Xe,wt,gr);case I:return Xe=Xe.get(wt.key===null?rt:wt.key)||null,at(Ue,Xe,wt,gr);case J:return wt=$l(wt),mt(Xe,Ue,rt,wt,gr)}if(ue(wt)||me(wt))return Xe=Xe.get(rt)||null,yt(Ue,Xe,wt,gr,null);if(typeof wt.then=="function")return mt(Xe,Ue,rt,ku(wt),gr);if(wt.$$typeof===U)return mt(Xe,Ue,rt,bu(Ue,wt),gr);Nu(Ue,wt)}return null}function lr(Xe,Ue,rt,wt){for(var gr=null,na=null,dr=Ue,Pr=Ue=0,Yr=null;dr!==null&&Pr<rt.length;Pr++){dr.index>Pr?(Yr=dr,dr=null):Yr=dr.sibling;var sa=st(Xe,dr,rt[Pr],wt);if(sa===null){dr===null&&(dr=Yr);break}s&&dr&&sa.alternate===null&&l(Xe,dr),Ue=j(sa,Ue,Pr),na===null?gr=sa:na.sibling=sa,na=sa,dr=Yr}if(Pr===rt.length)return m(Xe,dr),Wr&&fr(Xe,Pr),gr;if(dr===null){for(;Pr<rt.length;Pr++)dr=Et(Xe,rt[Pr],wt),dr!==null&&(Ue=j(dr,Ue,Pr),na===null?gr=dr:na.sibling=dr,na=dr);return Wr&&fr(Xe,Pr),gr}for(dr=_(dr);Pr<rt.length;Pr++)Yr=mt(dr,Xe,Pr,rt[Pr],wt),Yr!==null&&(s&&Yr.alternate!==null&&dr.delete(Yr.key===null?Pr:Yr.key),Ue=j(Yr,Ue,Pr),na===null?gr=Yr:na.sibling=Yr,na=Yr);return s&&dr.forEach(function(Nl){return l(Xe,Nl)}),Wr&&fr(Xe,Pr),gr}function vr(Xe,Ue,rt,wt){if(rt==null)throw Error(n(151));for(var gr=null,na=null,dr=Ue,Pr=Ue=0,Yr=null,sa=rt.next();dr!==null&&!sa.done;Pr++,sa=rt.next()){dr.index>Pr?(Yr=dr,dr=null):Yr=dr.sibling;var Nl=st(Xe,dr,sa.value,wt);if(Nl===null){dr===null&&(dr=Yr);break}s&&dr&&Nl.alternate===null&&l(Xe,dr),Ue=j(Nl,Ue,Pr),na===null?gr=Nl:na.sibling=Nl,na=Nl,dr=Yr}if(sa.done)return m(Xe,dr),Wr&&fr(Xe,Pr),gr;if(dr===null){for(;!sa.done;Pr++,sa=rt.next())sa=Et(Xe,sa.value,wt),sa!==null&&(Ue=j(sa,Ue,Pr),na===null?gr=sa:na.sibling=sa,na=sa);return Wr&&fr(Xe,Pr),gr}for(dr=_(dr);!sa.done;Pr++,sa=rt.next())sa=mt(dr,Xe,Pr,sa.value,wt),sa!==null&&(s&&sa.alternate!==null&&dr.delete(sa.key===null?Pr:sa.key),Ue=j(sa,Ue,Pr),na===null?gr=sa:na.sibling=sa,na=sa);return s&&dr.forEach(function(lk){return l(Xe,lk)}),Wr&&fr(Xe,Pr),gr}function Ea(Xe,Ue,rt,wt){if(typeof rt=="object"&&rt!==null&&rt.type===M&&rt.key===null&&(rt=rt.props.children),typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case O:e:{for(var gr=rt.key;Ue!==null;){if(Ue.key===gr){if(gr=rt.type,gr===M){if(Ue.tag===7){m(Xe,Ue.sibling),wt=T(Ue,rt.props.children),wt.return=Xe,Xe=wt;break e}}else if(Ue.elementType===gr||typeof gr=="object"&&gr!==null&&gr.$$typeof===J&&$l(gr)===Ue.type){m(Xe,Ue.sibling),wt=T(Ue,rt.props),qd(wt,rt),wt.return=Xe,Xe=wt;break e}m(Xe,Ue);break}else l(Xe,Ue);Ue=Ue.sibling}rt.type===M?(wt=Co(rt.props.children,Xe.mode,wt,rt.key),wt.return=Xe,Xe=wt):(wt=Vl(rt.type,rt.key,rt.props,null,Xe.mode,wt),qd(wt,rt),wt.return=Xe,Xe=wt)}return Y(Xe);case I:e:{for(gr=rt.key;Ue!==null;){if(Ue.key===gr)if(Ue.tag===4&&Ue.stateNode.containerInfo===rt.containerInfo&&Ue.stateNode.implementation===rt.implementation){m(Xe,Ue.sibling),wt=T(Ue,rt.children||[]),wt.return=Xe,Xe=wt;break e}else{m(Xe,Ue);break}else l(Xe,Ue);Ue=Ue.sibling}wt=Vd(rt,Xe.mode,wt),wt.return=Xe,Xe=wt}return Y(Xe);case J:return rt=$l(rt),Ea(Xe,Ue,rt,wt)}if(ue(rt))return lr(Xe,Ue,rt,wt);if(me(rt)){if(gr=me(rt),typeof gr!="function")throw Error(n(150));return rt=gr.call(rt),vr(Xe,Ue,rt,wt)}if(typeof rt.then=="function")return Ea(Xe,Ue,ku(rt),wt);if(rt.$$typeof===U)return Ea(Xe,Ue,bu(Xe,rt),wt);Nu(Xe,rt)}return typeof rt=="string"&&rt!==""||typeof rt=="number"||typeof rt=="bigint"?(rt=""+rt,Ue!==null&&Ue.tag===6?(m(Xe,Ue.sibling),wt=T(Ue,rt),wt.return=Xe,Xe=wt):(m(Xe,Ue),wt=Mc(rt,Xe.mode,wt),wt.return=Xe,Xe=wt),Y(Xe)):m(Xe,Ue)}return function(Xe,Ue,rt,wt){try{$d=0;var gr=Ea(Xe,Ue,rt,wt);return Fc=null,gr}catch(dr){if(dr===Pc||dr===_u)throw dr;var na=ls(29,dr,null,Xe.mode);return na.lanes=wt,na.return=Xe,na}finally{}}}var Kl=Cp(!0),Tp=Cp(!1),ol=!1;function Zh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $h(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ll(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function cl(s,l,m){var _=s.updateQueue;if(_===null)return null;if(_=_.shared,(fa&2)!==0){var T=_.pending;return T===null?l.next=l:(l.next=T.next,T.next=l),_.pending=l,l=Wl(s),sl(s,null,m),l}return so(s,_,l,m),Wl(s)}function Kd(s,l,m){if(l=l.updateQueue,l!==null&&(l=l.shared,(m&4194048)!==0)){var _=l.lanes;_&=s.pendingLanes,m|=_,l.lanes=m,Ha(s,m)}}function qh(s,l){var m=s.updateQueue,_=s.alternate;if(_!==null&&(_=_.updateQueue,m===_)){var T=null,j=null;if(m=m.firstBaseUpdate,m!==null){do{var Y={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};j===null?T=j=Y:j=j.next=Y,m=m.next}while(m!==null);j===null?T=j=l:j=j.next=l}else T=j=l;m={baseState:_.baseState,firstBaseUpdate:T,lastBaseUpdate:j,shared:_.shared,callbacks:_.callbacks},s.updateQueue=m;return}s=m.lastBaseUpdate,s===null?m.firstBaseUpdate=l:s.next=l,m.lastBaseUpdate=l}var Kh=!1;function Jd(){if(Kh){var s=Lc;if(s!==null)throw s}}function Qd(s,l,m,_){Kh=!1;var T=s.updateQueue;ol=!1;var j=T.firstBaseUpdate,Y=T.lastBaseUpdate,fe=T.shared.pending;if(fe!==null){T.shared.pending=null;var De=fe,at=De.next;De.next=null,Y===null?j=at:Y.next=at,Y=De;var yt=s.alternate;yt!==null&&(yt=yt.updateQueue,fe=yt.lastBaseUpdate,fe!==Y&&(fe===null?yt.firstBaseUpdate=at:fe.next=at,yt.lastBaseUpdate=De))}if(j!==null){var Et=T.baseState;Y=0,yt=at=De=null,fe=j;do{var st=fe.lane&-536870913,mt=st!==fe.lane;if(mt?(Xr&st)===st:(_&st)===st){st!==0&&st===Ic&&(Kh=!0),yt!==null&&(yt=yt.next={lane:0,tag:fe.tag,payload:fe.payload,callback:null,next:null});e:{var lr=s,vr=fe;st=l;var Ea=m;switch(vr.tag){case 1:if(lr=vr.payload,typeof lr=="function"){Et=lr.call(Ea,Et,st);break e}Et=lr;break e;case 3:lr.flags=lr.flags&-65537|128;case 0:if(lr=vr.payload,st=typeof lr=="function"?lr.call(Ea,Et,st):lr,st==null)break e;Et=N({},Et,st);break e;case 2:ol=!0}}st=fe.callback,st!==null&&(s.flags|=64,mt&&(s.flags|=8192),mt=T.callbacks,mt===null?T.callbacks=[st]:mt.push(st))}else mt={lane:st,tag:fe.tag,payload:fe.payload,callback:fe.callback,next:null},yt===null?(at=yt=mt,De=Et):yt=yt.next=mt,Y|=st;if(fe=fe.next,fe===null){if(fe=T.shared.pending,fe===null)break;mt=fe,fe=mt.next,mt.next=null,T.lastBaseUpdate=mt,T.shared.pending=null}}while(!0);yt===null&&(De=Et),T.baseState=De,T.firstBaseUpdate=at,T.lastBaseUpdate=yt,j===null&&(T.shared.lanes=0),ml|=Y,s.lanes=Y,s.memoizedState=Et}}function Ap(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function jp(s,l){var m=s.callbacks;if(m!==null)for(s.callbacks=null,s=0;s<m.length;s++)Ap(m[s],l)}var Bc=K(null),Su=K(0);function Op(s,l){s=Fo,ae(Su,s),ae(Bc,l),Fo=s|l.baseLanes}function Jh(){ae(Su,Fo),ae(Bc,Bc.current)}function Qh(){Fo=Su.current,W(Bc),W(Su)}var ti=K(null),vi=null;function dl(s){var l=s.alternate;ae(cn,cn.current&1),ae(ti,s),vi===null&&(l===null||Bc.current!==null||l.memoizedState!==null)&&(vi=s)}function em(s){ae(cn,cn.current),ae(ti,s),vi===null&&(vi=s)}function Mp(s){s.tag===22?(ae(cn,cn.current),ae(ti,s),vi===null&&(vi=s)):ul()}function ul(){ae(cn,cn.current),ae(ti,ti.current)}function ri(s){W(ti),vi===s&&(vi=null),W(cn)}var cn=K(0);function Eu(s){for(var l=s;l!==null;){if(l.tag===13){var m=l.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||ig(m)||og(m)))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===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var jo=0,Mr=null,Na=null,gn=null,Cu=!1,Uc=!1,Jl=!1,Tu=0,e0=0,zc=null,J4=0;function Ka(){throw Error(n(321))}function tm(s,l){if(l===null)return!1;for(var m=0;m<l.length&&m<s.length;m++)if(!w(s[m],l[m]))return!1;return!0}function rm(s,l,m,_,T,j){return jo=j,Mr=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,be.H=s===null||s.memoizedState===null?g1:pm,Jl=!1,j=m(_,T),Jl=!1,Uc&&(j=Dp(l,m,_,T)),Rp(s),j}function Rp(s){be.H=a0;var l=Na!==null&&Na.next!==null;if(jo=0,gn=Na=Mr=null,Cu=!1,e0=0,zc=null,l)throw Error(n(300));s===null||xn||(s=s.dependencies,s!==null&&yu(s)&&(xn=!0))}function Dp(s,l,m,_){Mr=s;var T=0;do{if(Uc&&(zc=null),e0=0,Uc=!1,25<=T)throw Error(n(301));if(T+=1,gn=Na=null,s.updateQueue!=null){var j=s.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}be.H=x1,j=l(m,_)}while(Uc);return j}function Q4(){var s=be.H,l=s.useState()[0];return l=typeof l.then=="function"?t0(l):l,s=s.useState()[0],(Na!==null?Na.memoizedState:null)!==s&&(Mr.flags|=1024),l}function am(){var s=Tu!==0;return Tu=0,s}function nm(s,l,m){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~m}function sm(s){if(Cu){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Cu=!1}jo=0,gn=Na=Mr=null,Uc=!1,e0=Tu=0,zc=null}function ws(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gn===null?Mr.memoizedState=gn=s:gn=gn.next=s,gn}function dn(){if(Na===null){var s=Mr.alternate;s=s!==null?s.memoizedState:null}else s=Na.next;var l=gn===null?Mr.memoizedState:gn.next;if(l!==null)gn=l,Na=s;else{if(s===null)throw Mr.alternate===null?Error(n(467)):Error(n(310));Na=s,s={memoizedState:Na.memoizedState,baseState:Na.baseState,baseQueue:Na.baseQueue,queue:Na.queue,next:null},gn===null?Mr.memoizedState=gn=s:gn=gn.next=s}return gn}function Au(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function t0(s){var l=e0;return e0+=1,zc===null&&(zc=[]),s=Np(zc,s,l),l=Mr,(gn===null?l.memoizedState:gn.next)===null&&(l=l.alternate,be.H=l===null||l.memoizedState===null?g1:pm),s}function ju(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return t0(s);if(s.$$typeof===U)return Zn(s)}throw Error(n(438,String(s)))}function im(s){var l=null,m=Mr.updateQueue;if(m!==null&&(l=m.memoCache),l==null){var _=Mr.alternate;_!==null&&(_=_.updateQueue,_!==null&&(_=_.memoCache,_!=null&&(l={data:_.data.map(function(T){return T.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),m===null&&(m=Au(),Mr.updateQueue=m),m.memoCache=l,m=l.data[l.index],m===void 0)for(m=l.data[l.index]=Array(s),_=0;_<s;_++)m[_]=Te;return l.index++,m}function Oo(s,l){return typeof l=="function"?l(s):l}function Ou(s){var l=dn();return om(l,Na,s)}function om(s,l,m){var _=s.queue;if(_===null)throw Error(n(311));_.lastRenderedReducer=m;var T=s.baseQueue,j=_.pending;if(j!==null){if(T!==null){var Y=T.next;T.next=j.next,j.next=Y}l.baseQueue=T=j,_.pending=null}if(j=s.baseState,T===null)s.memoizedState=j;else{l=T.next;var fe=Y=null,De=null,at=l,yt=!1;do{var Et=at.lane&-536870913;if(Et!==at.lane?(Xr&Et)===Et:(jo&Et)===Et){var st=at.revertLane;if(st===0)De!==null&&(De=De.next={lane:0,revertLane:0,gesture:null,action:at.action,hasEagerState:at.hasEagerState,eagerState:at.eagerState,next:null}),Et===Ic&&(yt=!0);else if((jo&st)===st){at=at.next,st===Ic&&(yt=!0);continue}else Et={lane:0,revertLane:at.revertLane,gesture:null,action:at.action,hasEagerState:at.hasEagerState,eagerState:at.eagerState,next:null},De===null?(fe=De=Et,Y=j):De=De.next=Et,Mr.lanes|=st,ml|=st;Et=at.action,Jl&&m(j,Et),j=at.hasEagerState?at.eagerState:m(j,Et)}else st={lane:Et,revertLane:at.revertLane,gesture:at.gesture,action:at.action,hasEagerState:at.hasEagerState,eagerState:at.eagerState,next:null},De===null?(fe=De=st,Y=j):De=De.next=st,Mr.lanes|=Et,ml|=Et;at=at.next}while(at!==null&&at!==l);if(De===null?Y=j:De.next=fe,!w(j,s.memoizedState)&&(xn=!0,yt&&(m=Lc,m!==null)))throw m;s.memoizedState=j,s.baseState=Y,s.baseQueue=De,_.lastRenderedState=j}return T===null&&(_.lanes=0),[s.memoizedState,_.dispatch]}function lm(s){var l=dn(),m=l.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=s;var _=m.dispatch,T=m.pending,j=l.memoizedState;if(T!==null){m.pending=null;var Y=T=T.next;do j=s(j,Y.action),Y=Y.next;while(Y!==T);w(j,l.memoizedState)||(xn=!0),l.memoizedState=j,l.baseQueue===null&&(l.baseState=j),m.lastRenderedState=j}return[j,_]}function Ip(s,l,m){var _=Mr,T=dn(),j=Wr;if(j){if(m===void 0)throw Error(n(407));m=m()}else m=l();var Y=!w((Na||T).memoizedState,m);if(Y&&(T.memoizedState=m,xn=!0),T=T.queue,um(Fp.bind(null,_,T,s),[s]),T.getSnapshot!==l||Y||gn!==null&&gn.memoizedState.tag&1){if(_.flags|=2048,Hc(9,{destroy:void 0},Pp.bind(null,_,T,m,l),null),Ma===null)throw Error(n(349));j||(jo&127)!==0||Lp(_,l,m)}return m}function Lp(s,l,m){s.flags|=16384,s={getSnapshot:l,value:m},l=Mr.updateQueue,l===null?(l=Au(),Mr.updateQueue=l,l.stores=[s]):(m=l.stores,m===null?l.stores=[s]:m.push(s))}function Pp(s,l,m,_){l.value=m,l.getSnapshot=_,Bp(l)&&Up(s)}function Fp(s,l,m){return m(function(){Bp(l)&&Up(s)})}function Bp(s){var l=s.getSnapshot;s=s.value;try{var m=l();return!w(s,m)}catch(_){return!0}}function Up(s){var l=yi(s,2);l!==null&&Bs(l,s,2)}function cm(s){var l=ws();if(typeof s=="function"){var m=s;if(s=m(),Jl){Ct(!0);try{m()}finally{Ct(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:s},l}function zp(s,l,m,_){return s.baseState=m,om(s,Na,typeof _=="function"?_:Oo)}function e3(s,l,m,_,T){if(Du(s))throw Error(n(485));if(s=l.action,s!==null){var j={payload:T,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Y){j.listeners.push(Y)}};be.T!==null?m(!0):j.isTransition=!1,_(j),m=l.pending,m===null?(j.next=l.pending=j,Hp(l,j)):(j.next=m.next,l.pending=m.next=j)}}function Hp(s,l){var m=l.action,_=l.payload,T=s.state;if(l.isTransition){var j=be.T,Y={};be.T=Y;try{var fe=m(T,_),De=be.S;De!==null&&De(Y,fe),Wp(s,l,fe)}catch(at){dm(s,l,at)}finally{j!==null&&Y.types!==null&&(j.types=Y.types),be.T=j}}else try{j=m(T,_),Wp(s,l,j)}catch(at){dm(s,l,at)}}function Wp(s,l,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(_){Vp(s,l,_)},function(_){return dm(s,l,_)}):Vp(s,l,m)}function Vp(s,l,m){l.status="fulfilled",l.value=m,Gp(l),s.state=m,l=s.pending,l!==null&&(m=l.next,m===l?s.pending=null:(m=m.next,l.next=m,Hp(s,m)))}function dm(s,l,m){var _=s.pending;if(s.pending=null,_!==null){_=_.next;do l.status="rejected",l.reason=m,Gp(l),l=l.next;while(l!==_)}s.action=null}function Gp(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function Xp(s,l){return l}function Yp(s,l){if(Wr){var m=Ma.formState;if(m!==null){e:{var _=Mr;if(Wr){if(aa){t:{for(var T=aa,j=Ds;T.nodeType!==8;){if(!j){T=null;break t}if(T=_i(T.nextSibling),T===null){T=null;break t}}j=T.data,T=j==="F!"||j==="F"?T:null}if(T){aa=_i(T.nextSibling),_=T.data==="F!";break e}}oo(_)}_=!1}_&&(l=m[0])}}return m=ws(),m.memoizedState=m.baseState=l,_={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xp,lastRenderedState:l},m.queue=_,m=f1.bind(null,Mr,_),_.dispatch=m,_=cm(!1),j=xm.bind(null,Mr,!1,_.queue),_=ws(),T={state:l,dispatch:null,action:s,pending:null},_.queue=T,m=e3.bind(null,Mr,T,j,m),T.dispatch=m,_.memoizedState=s,[l,m,!1]}function Zp(s){var l=dn();return $p(l,Na,s)}function $p(s,l,m){if(l=om(s,l,Xp)[0],s=Ou(Oo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var _=t0(l)}catch(Y){throw Y===Pc?_u:Y}else _=l;l=dn();var T=l.queue,j=T.dispatch;return m!==l.memoizedState&&(Mr.flags|=2048,Hc(9,{destroy:void 0},t3.bind(null,T,m),null)),[_,j,s]}function t3(s,l){s.action=l}function qp(s){var l=dn(),m=Na;if(m!==null)return $p(l,m,s);dn(),l=l.memoizedState,m=dn();var _=m.queue.dispatch;return m.memoizedState=s,[l,_,!1]}function Hc(s,l,m,_){return s={tag:s,create:m,deps:_,inst:l,next:null},l=Mr.updateQueue,l===null&&(l=Au(),Mr.updateQueue=l),m=l.lastEffect,m===null?l.lastEffect=s.next=s:(_=m.next,m.next=s,s.next=_,l.lastEffect=s),s}function Kp(){return dn().memoizedState}function Mu(s,l,m,_){var T=ws();Mr.flags|=s,T.memoizedState=Hc(1|l,{destroy:void 0},m,_===void 0?null:_)}function Ru(s,l,m,_){var T=dn();_=_===void 0?null:_;var j=T.memoizedState.inst;Na!==null&&_!==null&&tm(_,Na.memoizedState.deps)?T.memoizedState=Hc(l,j,m,_):(Mr.flags|=s,T.memoizedState=Hc(1|l,j,m,_))}function Jp(s,l){Mu(8390656,8,s,l)}function um(s,l){Ru(2048,8,s,l)}function r3(s){Mr.flags|=4;var l=Mr.updateQueue;if(l===null)l=Au(),Mr.updateQueue=l,l.events=[s];else{var m=l.events;m===null?l.events=[s]:m.push(s)}}function Qp(s){var l=dn().memoizedState;return r3({ref:l,nextImpl:s}),function(){if((fa&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function e1(s,l){return Ru(4,2,s,l)}function t1(s,l){return Ru(4,4,s,l)}function r1(s,l){if(typeof l=="function"){s=s();var m=l(s);return function(){typeof m=="function"?m():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function a1(s,l,m){m=m!=null?m.concat([s]):null,Ru(4,4,r1.bind(null,l,s),m)}function fm(){}function n1(s,l){var m=dn();l=l===void 0?null:l;var _=m.memoizedState;return l!==null&&tm(l,_[1])?_[0]:(m.memoizedState=[s,l],s)}function s1(s,l){var m=dn();l=l===void 0?null:l;var _=m.memoizedState;if(l!==null&&tm(l,_[1]))return _[0];if(_=s(),Jl){Ct(!0);try{s()}finally{Ct(!1)}}return m.memoizedState=[_,l],_}function hm(s,l,m){return m===void 0||(jo&1073741824)!==0&&(Xr&261930)===0?s.memoizedState=l:(s.memoizedState=m,s=iy(),Mr.lanes|=s,ml|=s,m)}function i1(s,l,m,_){return w(m,l)?m:Bc.current!==null?(s=hm(s,m,_),w(s,l)||(xn=!0),s):(jo&42)===0||(jo&1073741824)!==0&&(Xr&261930)===0?(xn=!0,s.memoizedState=m):(s=iy(),Mr.lanes|=s,ml|=s,l)}function o1(s,l,m,_,T){var j=re.p;re.p=j!==0&&8>j?j:8;var Y=be.T,fe={};be.T=fe,xm(s,!1,l,m);try{var De=T(),at=be.S;if(at!==null&&at(fe,De),De!==null&&typeof De=="object"&&typeof De.then=="function"){var yt=K4(De,_);r0(s,l,yt,si(s))}else r0(s,l,_,si(s))}catch(Et){r0(s,l,{then:function(){},status:"rejected",reason:Et},si())}finally{re.p=j,Y!==null&&fe.types!==null&&(Y.types=fe.types),be.T=Y}}function a3(){}function mm(s,l,m,_){if(s.tag!==5)throw Error(n(476));var T=l1(s).queue;o1(s,T,l,de,m===null?a3:function(){return c1(s),m(_)})}function l1(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:de},next:null};var m={};return l.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:m},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function c1(s){var l=l1(s);l.next===null&&(l=s.alternate.memoizedState),r0(s,l.next.queue,{},si())}function gm(){return Zn(b0)}function d1(){return dn().memoizedState}function u1(){return dn().memoizedState}function n3(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var m=si();s=ll(m);var _=cl(l,s,m);_!==null&&(Bs(_,l,m),Kd(_,l,m)),l={cache:Vh()},s.payload=l;return}l=l.return}}function s3(s,l,m){var _=si();m={lane:_,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Du(s)?h1(l,m):(m=zd(s,l,m,_),m!==null&&(Bs(m,s,_),m1(m,l,_)))}function f1(s,l,m){var _=si();r0(s,l,m,_)}function r0(s,l,m,_){var T={lane:_,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(Du(s))h1(l,T);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=l.lastRenderedReducer,j!==null))try{var Y=l.lastRenderedState,fe=j(Y,m);if(T.hasEagerState=!0,T.eagerState=fe,w(fe,Y))return so(s,l,T,0),Ma===null&&Hl(),!1}catch(De){}finally{}if(m=zd(s,l,T,_),m!==null)return Bs(m,s,_),m1(m,l,_),!0}return!1}function xm(s,l,m,_){if(_={lane:2,revertLane:Zm(),gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null},Du(s)){if(l)throw Error(n(479))}else l=zd(s,m,_,2),l!==null&&Bs(l,s,2)}function Du(s){var l=s.alternate;return s===Mr||l!==null&&l===Mr}function h1(s,l){Uc=Cu=!0;var m=s.pending;m===null?l.next=l:(l.next=m.next,m.next=l),s.pending=l}function m1(s,l,m){if((m&4194048)!==0){var _=l.lanes;_&=s.pendingLanes,m|=_,l.lanes=m,Ha(s,m)}}var a0={readContext:Zn,use:ju,useCallback:Ka,useContext:Ka,useEffect:Ka,useImperativeHandle:Ka,useLayoutEffect:Ka,useInsertionEffect:Ka,useMemo:Ka,useReducer:Ka,useRef:Ka,useState:Ka,useDebugValue:Ka,useDeferredValue:Ka,useTransition:Ka,useSyncExternalStore:Ka,useId:Ka,useHostTransitionStatus:Ka,useFormState:Ka,useActionState:Ka,useOptimistic:Ka,useMemoCache:Ka,useCacheRefresh:Ka};a0.useEffectEvent=Ka;var g1={readContext:Zn,use:ju,useCallback:function(s,l){return ws().memoizedState=[s,l===void 0?null:l],s},useContext:Zn,useEffect:Jp,useImperativeHandle:function(s,l,m){m=m!=null?m.concat([s]):null,Mu(4194308,4,r1.bind(null,l,s),m)},useLayoutEffect:function(s,l){return Mu(4194308,4,s,l)},useInsertionEffect:function(s,l){Mu(4,2,s,l)},useMemo:function(s,l){var m=ws();l=l===void 0?null:l;var _=s();if(Jl){Ct(!0);try{s()}finally{Ct(!1)}}return m.memoizedState=[_,l],_},useReducer:function(s,l,m){var _=ws();if(m!==void 0){var T=m(l);if(Jl){Ct(!0);try{m(l)}finally{Ct(!1)}}}else T=l;return _.memoizedState=_.baseState=T,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:T},_.queue=s,s=s.dispatch=s3.bind(null,Mr,s),[_.memoizedState,s]},useRef:function(s){var l=ws();return s={current:s},l.memoizedState=s},useState:function(s){s=cm(s);var l=s.queue,m=f1.bind(null,Mr,l);return l.dispatch=m,[s.memoizedState,m]},useDebugValue:fm,useDeferredValue:function(s,l){var m=ws();return hm(m,s,l)},useTransition:function(){var s=cm(!1);return s=o1.bind(null,Mr,s.queue,!0,!1),ws().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,m){var _=Mr,T=ws();if(Wr){if(m===void 0)throw Error(n(407));m=m()}else{if(m=l(),Ma===null)throw Error(n(349));(Xr&127)!==0||Lp(_,l,m)}T.memoizedState=m;var j={value:m,getSnapshot:l};return T.queue=j,Jp(Fp.bind(null,_,j,s),[s]),_.flags|=2048,Hc(9,{destroy:void 0},Pp.bind(null,_,j,m,l),null),m},useId:function(){var s=ws(),l=Ma.identifierPrefix;if(Wr){var m=$t,_=St;m=(_&~(1<<32-Ft(_)-1)).toString(32)+m,l="_"+l+"R_"+m,m=Tu++,0<m&&(l+="H"+m.toString(32)),l+="_"}else m=J4++,l="_"+l+"r_"+m.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:gm,useFormState:Yp,useActionState:Yp,useOptimistic:function(s){var l=ws();l.memoizedState=l.baseState=s;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=m,l=xm.bind(null,Mr,!0,m),m.dispatch=l,[s,l]},useMemoCache:im,useCacheRefresh:function(){return ws().memoizedState=n3.bind(null,Mr)},useEffectEvent:function(s){var l=ws(),m={impl:s};return l.memoizedState=m,function(){if((fa&2)!==0)throw Error(n(440));return m.impl.apply(void 0,arguments)}}},pm={readContext:Zn,use:ju,useCallback:n1,useContext:Zn,useEffect:um,useImperativeHandle:a1,useInsertionEffect:e1,useLayoutEffect:t1,useMemo:s1,useReducer:Ou,useRef:Kp,useState:function(){return Ou(Oo)},useDebugValue:fm,useDeferredValue:function(s,l){var m=dn();return i1(m,Na.memoizedState,s,l)},useTransition:function(){var s=Ou(Oo)[0],l=dn().memoizedState;return[typeof s=="boolean"?s:t0(s),l]},useSyncExternalStore:Ip,useId:d1,useHostTransitionStatus:gm,useFormState:Zp,useActionState:Zp,useOptimistic:function(s,l){var m=dn();return zp(m,Na,s,l)},useMemoCache:im,useCacheRefresh:u1};pm.useEffectEvent=Qp;var x1={readContext:Zn,use:ju,useCallback:n1,useContext:Zn,useEffect:um,useImperativeHandle:a1,useInsertionEffect:e1,useLayoutEffect:t1,useMemo:s1,useReducer:lm,useRef:Kp,useState:function(){return lm(Oo)},useDebugValue:fm,useDeferredValue:function(s,l){var m=dn();return Na===null?hm(m,s,l):i1(m,Na.memoizedState,s,l)},useTransition:function(){var s=lm(Oo)[0],l=dn().memoizedState;return[typeof s=="boolean"?s:t0(s),l]},useSyncExternalStore:Ip,useId:d1,useHostTransitionStatus:gm,useFormState:qp,useActionState:qp,useOptimistic:function(s,l){var m=dn();return Na!==null?zp(m,Na,s,l):(m.baseState=s,[s,m.queue.dispatch])},useMemoCache:im,useCacheRefresh:u1};x1.useEffectEvent=Qp;function ym(s,l,m,_){l=s.memoizedState,m=m(_,l),m=m==null?l:N({},l,m),s.memoizedState=m,s.lanes===0&&(s.updateQueue.baseState=m)}var bm={enqueueSetState:function(s,l,m){s=s._reactInternals;var _=si(),T=ll(_);T.payload=l,m!=null&&(T.callback=m),l=cl(s,T,_),l!==null&&(Bs(l,s,_),Kd(l,s,_))},enqueueReplaceState:function(s,l,m){s=s._reactInternals;var _=si(),T=ll(_);T.tag=1,T.payload=l,m!=null&&(T.callback=m),l=cl(s,T,_),l!==null&&(Bs(l,s,_),Kd(l,s,_))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var m=si(),_=ll(m);_.tag=2,l!=null&&(_.callback=l),l=cl(s,_,m),l!==null&&(Bs(l,s,m),Kd(l,s,m))}};function p1(s,l,m,_,T,j,Y){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(_,j,Y):l.prototype&&l.prototype.isPureReactComponent?!S(m,_)||!S(T,j):!0}function y1(s,l,m,_){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(m,_),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(m,_),l.state!==s&&bm.enqueueReplaceState(l,l.state,null)}function Ql(s,l){var m=l;if("ref"in l){m={};for(var _ in l)_!=="ref"&&(m[_]=l[_])}if(s=s.defaultProps){m===l&&(m=N({},m));for(var T in s)m[T]===void 0&&(m[T]=s[T])}return m}function b1(s){zl(s)}function v1(s){console.error(s)}function _1(s){zl(s)}function Iu(s,l){try{var m=s.onUncaughtError;m(l.value,{componentStack:l.stack})}catch(_){setTimeout(function(){throw _})}}function w1(s,l,m){try{var _=s.onCaughtError;_(m.value,{componentStack:m.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function vm(s,l,m){return m=ll(m),m.tag=3,m.payload={element:null},m.callback=function(){Iu(s,l)},m}function k1(s){return s=ll(s),s.tag=3,s}function N1(s,l,m,_){var T=m.type.getDerivedStateFromError;if(typeof T=="function"){var j=_.value;s.payload=function(){return T(j)},s.callback=function(){w1(l,m,_)}}var Y=m.stateNode;Y!==null&&typeof Y.componentDidCatch=="function"&&(s.callback=function(){w1(l,m,_),typeof T!="function"&&(gl===null?gl=new Set([this]):gl.add(this));var fe=_.stack;this.componentDidCatch(_.value,{componentStack:fe!==null?fe:""})})}function i3(s,l,m,_,T){if(m.flags|=32768,_!==null&&typeof _=="object"&&typeof _.then=="function"){if(l=m.alternate,l!==null&&Dc(l,m,T,!0),m=ti.current,m!==null){switch(m.tag){case 31:case 13:return vi===null?Yu():m.alternate===null&&Ja===0&&(Ja=3),m.flags&=-257,m.flags|=65536,m.lanes=T,_===wu?m.flags|=16384:(l=m.updateQueue,l===null?m.updateQueue=new Set([_]):l.add(_),Gm(s,_,T)),!1;case 22:return m.flags|=65536,_===wu?m.flags|=16384:(l=m.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([_])},m.updateQueue=l):(m=l.retryQueue,m===null?l.retryQueue=new Set([_]):m.add(_)),Gm(s,_,T)),!1}throw Error(n(435,m.tag))}return Gm(s,_,T),Yu(),!1}if(Wr)return l=ti.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=T,_!==Rc&&(s=Error(n(422),{cause:_}),Gl(b(s,m)))):(_!==Rc&&(l=Error(n(423),{cause:_}),Gl(b(l,m))),s=s.current.alternate,s.flags|=65536,T&=-T,s.lanes|=T,_=b(_,m),T=vm(s.stateNode,_,T),qh(s,T),Ja!==4&&(Ja=2)),!1;var j=Error(n(520),{cause:_});if(j=b(j,m),u0===null?u0=[j]:u0.push(j),Ja!==4&&(Ja=2),l===null)return!0;_=b(_,m),m=l;do{switch(m.tag){case 3:return m.flags|=65536,s=T&-T,m.lanes|=s,s=vm(m.stateNode,_,s),qh(m,s),!1;case 1:if(l=m.type,j=m.stateNode,(m.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(gl===null||!gl.has(j))))return m.flags|=65536,T&=-T,m.lanes|=T,T=k1(T),N1(T,s,m,_),qh(m,T),!1}m=m.return}while(m!==null);return!1}var _m=Error(n(461)),xn=!1;function $n(s,l,m,_){l.child=s===null?Tp(l,null,m,_):Kl(l,s.child,m,_)}function S1(s,l,m,_,T){m=m.render;var j=l.ref;if("ref"in _){var Y={};for(var fe in _)fe!=="ref"&&(Y[fe]=_[fe])}else Y=_;return Yl(l),_=rm(s,l,m,Y,j,T),fe=am(),s!==null&&!xn?(nm(s,l,T),Mo(s,l,T)):(Wr&&fe&&Sn(l),l.flags|=1,$n(s,l,_,T),l.child)}function E1(s,l,m,_,T){if(s===null){var j=m.type;return typeof j=="function"&&!Oc(j)&&j.defaultProps===void 0&&m.compare===null?(l.tag=15,l.type=j,C1(s,l,j,_,T)):(s=Vl(m.type,null,_,l,l.mode,T),s.ref=l.ref,s.return=l,l.child=s)}if(j=s.child,!Am(s,T)){var Y=j.memoizedProps;if(m=m.compare,m=m!==null?m:S,m(Y,_)&&s.ref===l.ref)return Mo(s,l,T)}return l.flags|=1,s=bi(j,_),s.ref=l.ref,s.return=l,l.child=s}function C1(s,l,m,_,T){if(s!==null){var j=s.memoizedProps;if(S(j,_)&&s.ref===l.ref)if(xn=!1,l.pendingProps=_=j,Am(s,T))(s.flags&131072)!==0&&(xn=!0);else return l.lanes=s.lanes,Mo(s,l,T)}return wm(s,l,m,_,T)}function T1(s,l,m,_){var T=_.children,j=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),_.mode==="hidden"){if((l.flags&128)!==0){if(j=j!==null?j.baseLanes|m:m,s!==null){for(_=l.child=s.child,T=0;_!==null;)T=T|_.lanes|_.childLanes,_=_.sibling;_=T&~j}else _=0,l.child=null;return A1(s,l,j,m,_)}if((m&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&vu(l,j!==null?j.cachePool:null),j!==null?Op(l,j):Jh(),Mp(l);else return _=l.lanes=536870912,A1(s,l,j!==null?j.baseLanes|m:m,m,_)}else j!==null?(vu(l,j.cachePool),Op(l,j),ul(),l.memoizedState=null):(s!==null&&vu(l,null),Jh(),ul());return $n(s,l,T,m),l.child}function n0(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function A1(s,l,m,_,T){var j=Xh();return j=j===null?null:{parent:mn._currentValue,pool:j},l.memoizedState={baseLanes:m,cachePool:j},s!==null&&vu(l,null),Jh(),Mp(l),s!==null&&Dc(s,l,_,!0),l.childLanes=T,null}function Lu(s,l){return l=Fu({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function j1(s,l,m){return Kl(l,s.child,null,m),s=Lu(l,l.pendingProps),s.flags|=2,ri(l),l.memoizedState=null,s}function o3(s,l,m){var _=l.pendingProps,T=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Wr){if(_.mode==="hidden")return s=Lu(l,_),l.lanes=536870912,n0(null,s);if(em(l),(s=aa)?(s=Hy(s,Ds),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:nt!==null?{id:St,overflow:$t}:null,retryLane:536870912,hydrationErrors:null},m=Wd(s),m.return=l,l.child=m,ra=l,aa=null)):s=null,s===null)throw oo(l);return l.lanes=536870912,null}return Lu(l,_)}var j=s.memoizedState;if(j!==null){var Y=j.dehydrated;if(em(l),T)if(l.flags&256)l.flags&=-257,l=j1(s,l,m);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if(xn||Dc(s,l,m,!1),T=(m&s.childLanes)!==0,xn||T){if(_=Ma,_!==null&&(Y=gs(_,m),Y!==0&&Y!==j.retryLane))throw j.retryLane=Y,yi(s,Y),Bs(_,s,Y),_m;Yu(),l=j1(s,l,m)}else s=j.treeContext,aa=_i(Y.nextSibling),ra=l,Wr=!0,io=null,Ds=!1,s!==null&&_s(l,s),l=Lu(l,_),l.flags|=4096;return l}return s=bi(s.child,{mode:_.mode,children:_.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Pu(s,l){var m=l.ref;if(m===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(n(284));(s===null||s.ref!==m)&&(l.flags|=4194816)}}function wm(s,l,m,_,T){return Yl(l),m=rm(s,l,m,_,void 0,T),_=am(),s!==null&&!xn?(nm(s,l,T),Mo(s,l,T)):(Wr&&_&&Sn(l),l.flags|=1,$n(s,l,m,T),l.child)}function O1(s,l,m,_,T,j){return Yl(l),l.updateQueue=null,m=Dp(l,_,m,T),Rp(s),_=am(),s!==null&&!xn?(nm(s,l,j),Mo(s,l,j)):(Wr&&_&&Sn(l),l.flags|=1,$n(s,l,m,j),l.child)}function M1(s,l,m,_,T){if(Yl(l),l.stateNode===null){var j=Eo,Y=m.contextType;typeof Y=="object"&&Y!==null&&(j=Zn(Y)),j=new m(_,j),l.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=bm,l.stateNode=j,j._reactInternals=l,j=l.stateNode,j.props=_,j.state=l.memoizedState,j.refs={},Zh(l),Y=m.contextType,j.context=typeof Y=="object"&&Y!==null?Zn(Y):Eo,j.state=l.memoizedState,Y=m.getDerivedStateFromProps,typeof Y=="function"&&(ym(l,m,Y,_),j.state=l.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(Y=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),Y!==j.state&&bm.enqueueReplaceState(j,j.state,null),Qd(l,_,j,T),Jd(),j.state=l.memoizedState),typeof j.componentDidMount=="function"&&(l.flags|=4194308),_=!0}else if(s===null){j=l.stateNode;var fe=l.memoizedProps,De=Ql(m,fe);j.props=De;var at=j.context,yt=m.contextType;Y=Eo,typeof yt=="object"&&yt!==null&&(Y=Zn(yt));var Et=m.getDerivedStateFromProps;yt=typeof Et=="function"||typeof j.getSnapshotBeforeUpdate=="function",fe=l.pendingProps!==fe,yt||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(fe||at!==Y)&&y1(l,j,_,Y),ol=!1;var st=l.memoizedState;j.state=st,Qd(l,_,j,T),Jd(),at=l.memoizedState,fe||st!==at||ol?(typeof Et=="function"&&(ym(l,m,Et,_),at=l.memoizedState),(De=ol||p1(l,m,De,_,st,at,Y))?(yt||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(l.flags|=4194308)):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=_,l.memoizedState=at),j.props=_,j.state=at,j.context=Y,_=De):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),_=!1)}else{j=l.stateNode,$h(s,l),Y=l.memoizedProps,yt=Ql(m,Y),j.props=yt,Et=l.pendingProps,st=j.context,at=m.contextType,De=Eo,typeof at=="object"&&at!==null&&(De=Zn(at)),fe=m.getDerivedStateFromProps,(at=typeof fe=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(Y!==Et||st!==De)&&y1(l,j,_,De),ol=!1,st=l.memoizedState,j.state=st,Qd(l,_,j,T),Jd();var mt=l.memoizedState;Y!==Et||st!==mt||ol||s!==null&&s.dependencies!==null&&yu(s.dependencies)?(typeof fe=="function"&&(ym(l,m,fe,_),mt=l.memoizedState),(yt=ol||p1(l,m,yt,_,st,mt,De)||s!==null&&s.dependencies!==null&&yu(s.dependencies))?(at||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(_,mt,De),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(_,mt,De)),typeof j.componentDidUpdate=="function"&&(l.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof j.componentDidUpdate!="function"||Y===s.memoizedProps&&st===s.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&st===s.memoizedState||(l.flags|=1024),l.memoizedProps=_,l.memoizedState=mt),j.props=_,j.state=mt,j.context=De,_=yt):(typeof j.componentDidUpdate!="function"||Y===s.memoizedProps&&st===s.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&st===s.memoizedState||(l.flags|=1024),_=!1)}return j=_,Pu(s,l),_=(l.flags&128)!==0,j||_?(j=l.stateNode,m=_&&typeof m.getDerivedStateFromError!="function"?null:j.render(),l.flags|=1,s!==null&&_?(l.child=Kl(l,s.child,null,T),l.child=Kl(l,null,m,T)):$n(s,l,m,T),l.memoizedState=j.state,s=l.child):s=Mo(s,l,T),s}function R1(s,l,m,_){return To(),l.flags|=256,$n(s,l,m,_),l.child}var km={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nm(s){return{baseLanes:s,cachePool:wp()}}function Sm(s,l,m){return s=s!==null?s.childLanes&~m:0,l&&(s|=ni),s}function D1(s,l,m){var _=l.pendingProps,T=!1,j=(l.flags&128)!==0,Y;if((Y=j)||(Y=s!==null&&s.memoizedState===null?!1:(cn.current&2)!==0),Y&&(T=!0,l.flags&=-129),Y=(l.flags&32)!==0,l.flags&=-33,s===null){if(Wr){if(T?dl(l):ul(),(s=aa)?(s=Hy(s,Ds),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:nt!==null?{id:St,overflow:$t}:null,retryLane:536870912,hydrationErrors:null},m=Wd(s),m.return=l,l.child=m,ra=l,aa=null)):s=null,s===null)throw oo(l);return og(s)?l.lanes=32:l.lanes=536870912,null}var fe=_.children;return _=_.fallback,T?(ul(),T=l.mode,fe=Fu({mode:"hidden",children:fe},T),_=Co(_,T,m,null),fe.return=l,_.return=l,fe.sibling=_,l.child=fe,_=l.child,_.memoizedState=Nm(m),_.childLanes=Sm(s,Y,m),l.memoizedState=km,n0(null,_)):(dl(l),Em(l,fe))}var De=s.memoizedState;if(De!==null&&(fe=De.dehydrated,fe!==null)){if(j)l.flags&256?(dl(l),l.flags&=-257,l=Cm(s,l,m)):l.memoizedState!==null?(ul(),l.child=s.child,l.flags|=128,l=null):(ul(),fe=_.fallback,T=l.mode,_=Fu({mode:"visible",children:_.children},T),fe=Co(fe,T,m,null),fe.flags|=2,_.return=l,fe.return=l,_.sibling=fe,l.child=_,Kl(l,s.child,null,m),_=l.child,_.memoizedState=Nm(m),_.childLanes=Sm(s,Y,m),l.memoizedState=km,l=n0(null,_));else if(dl(l),og(fe)){if(Y=fe.nextSibling&&fe.nextSibling.dataset,Y)var at=Y.dgst;Y=at,_=Error(n(419)),_.stack="",_.digest=Y,Gl({value:_,source:null,stack:null}),l=Cm(s,l,m)}else if(xn||Dc(s,l,m,!1),Y=(m&s.childLanes)!==0,xn||Y){if(Y=Ma,Y!==null&&(_=gs(Y,m),_!==0&&_!==De.retryLane))throw De.retryLane=_,yi(s,_),Bs(Y,s,_),_m;ig(fe)||Yu(),l=Cm(s,l,m)}else ig(fe)?(l.flags|=192,l.child=s.child,l=null):(s=De.treeContext,aa=_i(fe.nextSibling),ra=l,Wr=!0,io=null,Ds=!1,s!==null&&_s(l,s),l=Em(l,_.children),l.flags|=4096);return l}return T?(ul(),fe=_.fallback,T=l.mode,De=s.child,at=De.sibling,_=bi(De,{mode:"hidden",children:_.children}),_.subtreeFlags=De.subtreeFlags&65011712,at!==null?fe=bi(at,fe):(fe=Co(fe,T,m,null),fe.flags|=2),fe.return=l,_.return=l,_.sibling=fe,l.child=_,n0(null,_),_=l.child,fe=s.child.memoizedState,fe===null?fe=Nm(m):(T=fe.cachePool,T!==null?(De=mn._currentValue,T=T.parent!==De?{parent:De,pool:De}:T):T=wp(),fe={baseLanes:fe.baseLanes|m,cachePool:T}),_.memoizedState=fe,_.childLanes=Sm(s,Y,m),l.memoizedState=km,n0(s.child,_)):(dl(l),m=s.child,s=m.sibling,m=bi(m,{mode:"visible",children:_.children}),m.return=l,m.sibling=null,s!==null&&(Y=l.deletions,Y===null?(l.deletions=[s],l.flags|=16):Y.push(s)),l.child=m,l.memoizedState=null,m)}function Em(s,l){return l=Fu({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Fu(s,l){return s=ls(22,s,null,l),s.lanes=0,s}function Cm(s,l,m){return Kl(l,s.child,null,m),s=Em(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function I1(s,l,m){s.lanes|=l;var _=s.alternate;_!==null&&(_.lanes|=l),Hh(s.return,l,m)}function Tm(s,l,m,_,T,j){var Y=s.memoizedState;Y===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:_,tail:m,tailMode:T,treeForkCount:j}:(Y.isBackwards=l,Y.rendering=null,Y.renderingStartTime=0,Y.last=_,Y.tail=m,Y.tailMode=T,Y.treeForkCount=j)}function L1(s,l,m){var _=l.pendingProps,T=_.revealOrder,j=_.tail;_=_.children;var Y=cn.current,fe=(Y&2)!==0;if(fe?(Y=Y&1|2,l.flags|=128):Y&=1,ae(cn,Y),$n(s,l,_,m),_=Wr?le:0,!fe&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&I1(s,m,l);else if(s.tag===19)I1(s,m,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(T){case"forwards":for(m=l.child,T=null;m!==null;)s=m.alternate,s!==null&&Eu(s)===null&&(T=m),m=m.sibling;m=T,m===null?(T=l.child,l.child=null):(T=m.sibling,m.sibling=null),Tm(l,!1,T,m,j,_);break;case"backwards":case"unstable_legacy-backwards":for(m=null,T=l.child,l.child=null;T!==null;){if(s=T.alternate,s!==null&&Eu(s)===null){l.child=T;break}s=T.sibling,T.sibling=m,m=T,T=s}Tm(l,!0,m,null,j,_);break;case"together":Tm(l,!1,null,null,void 0,_);break;default:l.memoizedState=null}return l.child}function Mo(s,l,m){if(s!==null&&(l.dependencies=s.dependencies),ml|=l.lanes,(m&l.childLanes)===0)if(s!==null){if(Dc(s,l,m,!1),(m&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,m=bi(s,s.pendingProps),l.child=m,m.return=l;s.sibling!==null;)s=s.sibling,m=m.sibling=bi(s,s.pendingProps),m.return=l;m.sibling=null}return l.child}function Am(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&yu(s)))}function l3(s,l,m){switch(l.tag){case 3:Fe(l,l.stateNode.containerInfo),il(l,mn,s.memoizedState.cache),To();break;case 27:case 5:ot(l);break;case 4:Fe(l,l.stateNode.containerInfo);break;case 10:il(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,em(l),null;break;case 13:var _=l.memoizedState;if(_!==null)return _.dehydrated!==null?(dl(l),l.flags|=128,null):(m&l.child.childLanes)!==0?D1(s,l,m):(dl(l),s=Mo(s,l,m),s!==null?s.sibling:null);dl(l);break;case 19:var T=(s.flags&128)!==0;if(_=(m&l.childLanes)!==0,_||(Dc(s,l,m,!1),_=(m&l.childLanes)!==0),T){if(_)return L1(s,l,m);l.flags|=128}if(T=l.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),ae(cn,cn.current),_)break;return null;case 22:return l.lanes=0,T1(s,l,m,l.pendingProps);case 24:il(l,mn,s.memoizedState.cache)}return Mo(s,l,m)}function P1(s,l,m){if(s!==null)if(s.memoizedProps!==l.pendingProps)xn=!0;else{if(!Am(s,m)&&(l.flags&128)===0)return xn=!1,l3(s,l,m);xn=(s.flags&131072)!==0}else xn=!1,Wr&&(l.flags&1048576)!==0&&Lr(l,le,l.index);switch(l.lanes=0,l.tag){case 16:e:{var _=l.pendingProps;if(s=$l(l.elementType),l.type=s,typeof s=="function")Oc(s)?(_=Ql(s,_),l.tag=1,l=M1(null,l,s,_,m)):(l.tag=0,l=wm(null,l,s,_,m));else{if(s!=null){var T=s.$$typeof;if(T===H){l.tag=11,l=S1(null,l,s,_,m);break e}else if(T===V){l.tag=14,l=E1(null,l,s,_,m);break e}}throw l=Oe(s)||s,Error(n(306,l,""))}}return l;case 0:return wm(s,l,l.type,l.pendingProps,m);case 1:return _=l.type,T=Ql(_,l.pendingProps),M1(s,l,_,T,m);case 3:e:{if(Fe(l,l.stateNode.containerInfo),s===null)throw Error(n(387));_=l.pendingProps;var j=l.memoizedState;T=j.element,$h(s,l),Qd(l,_,null,m);var Y=l.memoizedState;if(_=Y.cache,il(l,mn,_),_!==j.cache&&Wh(l,[mn],m,!0),Jd(),_=Y.element,j.isDehydrated)if(j={element:_,isDehydrated:!1,cache:Y.cache},l.updateQueue.baseState=j,l.memoizedState=j,l.flags&256){l=R1(s,l,_,m);break e}else if(_!==T){T=b(Error(n(424)),l),Gl(T),l=R1(s,l,_,m);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(aa=_i(s.firstChild),ra=l,Wr=!0,io=null,Ds=!0,m=Tp(l,null,_,m),l.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling}else{if(To(),_===T){l=Mo(s,l,m);break e}$n(s,l,_,m)}l=l.child}return l;case 26:return Pu(s,l),s===null?(m=Zy(l.type,null,l.pendingProps,null))?l.memoizedState=m:Wr||(m=l.type,s=l.pendingProps,_=ef(pe.current).createElement(m),_[xe]=l,_[ye]=s,qn(_,m,s),nr(_),l.stateNode=_):l.memoizedState=Zy(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return ot(l),s===null&&Wr&&(_=l.stateNode=Gy(l.type,l.pendingProps,pe.current),ra=l,Ds=!0,T=aa,bl(l.type)?(lg=T,aa=_i(_.firstChild)):aa=T),$n(s,l,l.pendingProps.children,m),Pu(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Wr&&((T=_=aa)&&(_=F3(_,l.type,l.pendingProps,Ds),_!==null?(l.stateNode=_,ra=l,aa=_i(_.firstChild),Ds=!1,T=!0):T=!1),T||oo(l)),ot(l),T=l.type,j=l.pendingProps,Y=s!==null?s.memoizedProps:null,_=j.children,ag(T,j)?_=null:Y!==null&&ag(T,Y)&&(l.flags|=32),l.memoizedState!==null&&(T=rm(s,l,Q4,null,null,m),b0._currentValue=T),Pu(s,l),$n(s,l,_,m),l.child;case 6:return s===null&&Wr&&((s=m=aa)&&(m=B3(m,l.pendingProps,Ds),m!==null?(l.stateNode=m,ra=l,aa=null,s=!0):s=!1),s||oo(l)),null;case 13:return D1(s,l,m);case 4:return Fe(l,l.stateNode.containerInfo),_=l.pendingProps,s===null?l.child=Kl(l,null,_,m):$n(s,l,_,m),l.child;case 11:return S1(s,l,l.type,l.pendingProps,m);case 7:return $n(s,l,l.pendingProps,m),l.child;case 8:return $n(s,l,l.pendingProps.children,m),l.child;case 12:return $n(s,l,l.pendingProps.children,m),l.child;case 10:return _=l.pendingProps,il(l,l.type,_.value),$n(s,l,_.children,m),l.child;case 9:return T=l.type._context,_=l.pendingProps.children,Yl(l),T=Zn(T),_=_(T),l.flags|=1,$n(s,l,_,m),l.child;case 14:return E1(s,l,l.type,l.pendingProps,m);case 15:return C1(s,l,l.type,l.pendingProps,m);case 19:return L1(s,l,m);case 31:return o3(s,l,m);case 22:return T1(s,l,m,l.pendingProps);case 24:return Yl(l),_=Zn(mn),s===null?(T=Xh(),T===null&&(T=Ma,j=Vh(),T.pooledCache=j,j.refCount++,j!==null&&(T.pooledCacheLanes|=m),T=j),l.memoizedState={parent:_,cache:T},Zh(l),il(l,mn,T)):((s.lanes&m)!==0&&($h(s,l),Qd(l,null,null,m),Jd()),T=s.memoizedState,j=l.memoizedState,T.parent!==_?(T={parent:_,cache:_},l.memoizedState=T,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=T),il(l,mn,_)):(_=j.cache,il(l,mn,_),_!==T.cache&&Wh(l,[mn],m,!0))),$n(s,l,l.pendingProps.children,m),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function Ro(s){s.flags|=4}function jm(s,l,m,_,T){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(T&335544128)===T)if(s.stateNode.complete)s.flags|=8192;else if(dy())s.flags|=8192;else throw ql=wu,Yh}else s.flags&=-16777217}function F1(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Qy(l))if(dy())s.flags|=8192;else throw ql=wu,Yh}function Bu(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?ca():536870912,s.lanes|=l,Xc|=l)}function s0(s,l){if(!Wr)switch(s.tailMode){case"hidden":l=s.tail;for(var m=null;l!==null;)l.alternate!==null&&(m=l),l=l.sibling;m===null?s.tail=null:m.sibling=null;break;case"collapsed":m=s.tail;for(var _=null;m!==null;)m.alternate!==null&&(_=m),m=m.sibling;_===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:_.sibling=null}}function Da(s){var l=s.alternate!==null&&s.alternate.child===s.child,m=0,_=0;if(l)for(var T=s.child;T!==null;)m|=T.lanes|T.childLanes,_|=T.subtreeFlags&65011712,_|=T.flags&65011712,T.return=s,T=T.sibling;else for(T=s.child;T!==null;)m|=T.lanes|T.childLanes,_|=T.subtreeFlags,_|=T.flags,T.return=s,T=T.sibling;return s.subtreeFlags|=_,s.childLanes=m,l}function c3(s,l,m){var _=l.pendingProps;switch(qa(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Da(l),null;case 1:return Da(l),null;case 3:return m=l.stateNode,_=null,s!==null&&(_=s.memoizedState.cache),l.memoizedState.cache!==_&&(l.flags|=2048),Ao(mn),ft(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(s===null||s.child===null)&&(Fi(l)?Ro(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Xd())),Da(l),null;case 26:var T=l.type,j=l.memoizedState;return s===null?(Ro(l),j!==null?(Da(l),F1(l,j)):(Da(l),jm(l,T,null,_,m))):j?j!==s.memoizedState?(Ro(l),Da(l),F1(l,j)):(Da(l),l.flags&=-16777217):(s=s.memoizedProps,s!==_&&Ro(l),Da(l),jm(l,T,s,_,m)),null;case 27:if(Lt(l),m=pe.current,T=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==_&&Ro(l);else{if(!_){if(l.stateNode===null)throw Error(n(166));return Da(l),null}s=se.current,Fi(l)?Gd(l):(s=Gy(T,_,m),l.stateNode=s,Ro(l))}return Da(l),null;case 5:if(Lt(l),T=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==_&&Ro(l);else{if(!_){if(l.stateNode===null)throw Error(n(166));return Da(l),null}if(j=se.current,Fi(l))Gd(l);else{var Y=ef(pe.current);switch(j){case 1:j=Y.createElementNS("http://www.w3.org/2000/svg",T);break;case 2:j=Y.createElementNS("http://www.w3.org/1998/Math/MathML",T);break;default:switch(T){case"svg":j=Y.createElementNS("http://www.w3.org/2000/svg",T);break;case"math":j=Y.createElementNS("http://www.w3.org/1998/Math/MathML",T);break;case"script":j=Y.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof _.is=="string"?Y.createElement("select",{is:_.is}):Y.createElement("select"),_.multiple?j.multiple=!0:_.size&&(j.size=_.size);break;default:j=typeof _.is=="string"?Y.createElement(T,{is:_.is}):Y.createElement(T)}}j[xe]=l,j[ye]=_;e:for(Y=l.child;Y!==null;){if(Y.tag===5||Y.tag===6)j.appendChild(Y.stateNode);else if(Y.tag!==4&&Y.tag!==27&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===l)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===l)break e;Y=Y.return}Y.sibling.return=Y.return,Y=Y.sibling}l.stateNode=j;e:switch(qn(j,T,_),T){case"button":case"input":case"select":case"textarea":_=!!_.autoFocus;break e;case"img":_=!0;break e;default:_=!1}_&&Ro(l)}}return Da(l),jm(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,m),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==_&&Ro(l);else{if(typeof _!="string"&&l.stateNode===null)throw Error(n(166));if(s=pe.current,Fi(l)){if(s=l.stateNode,m=l.memoizedProps,_=null,T=ra,T!==null)switch(T.tag){case 27:case 5:_=T.memoizedProps}s[xe]=l,s=!!(s.nodeValue===m||_!==null&&_.suppressHydrationWarning===!0||Dy(s.nodeValue,m)),s||oo(l,!0)}else s=ef(s).createTextNode(_),s[xe]=l,l.stateNode=s}return Da(l),null;case 31:if(m=l.memoizedState,s===null||s.memoizedState!==null){if(_=Fi(l),m!==null){if(s===null){if(!_)throw Error(n(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[xe]=l}else To(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Da(l),s=!1}else m=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),s=!0;if(!s)return l.flags&256?(ri(l),l):(ri(l),null);if((l.flags&128)!==0)throw Error(n(558))}return Da(l),null;case 13:if(_=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(T=Fi(l),_!==null&&_.dehydrated!==null){if(s===null){if(!T)throw Error(n(318));if(T=l.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(n(317));T[xe]=l}else To(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Da(l),T=!1}else T=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=T),T=!0;if(!T)return l.flags&256?(ri(l),l):(ri(l),null)}return ri(l),(l.flags&128)!==0?(l.lanes=m,l):(m=_!==null,s=s!==null&&s.memoizedState!==null,m&&(_=l.child,T=null,_.alternate!==null&&_.alternate.memoizedState!==null&&_.alternate.memoizedState.cachePool!==null&&(T=_.alternate.memoizedState.cachePool.pool),j=null,_.memoizedState!==null&&_.memoizedState.cachePool!==null&&(j=_.memoizedState.cachePool.pool),j!==T&&(_.flags|=2048)),m!==s&&m&&(l.child.flags|=8192),Bu(l,l.updateQueue),Da(l),null);case 4:return ft(),s===null&&Jm(l.stateNode.containerInfo),Da(l),null;case 10:return Ao(l.type),Da(l),null;case 19:if(W(cn),_=l.memoizedState,_===null)return Da(l),null;if(T=(l.flags&128)!==0,j=_.rendering,j===null)if(T)s0(_,!1);else{if(Ja!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(j=Eu(s),j!==null){for(l.flags|=128,s0(_,!1),s=j.updateQueue,l.updateQueue=s,Bu(l,s),l.subtreeFlags=0,s=m,m=l.child;m!==null;)Hd(m,s),m=m.sibling;return ae(cn,cn.current&1|2),Wr&&fr(l,_.treeForkCount),l.child}s=s.sibling}_.tail!==null&&We()>Vu&&(l.flags|=128,T=!0,s0(_,!1),l.lanes=4194304)}else{if(!T)if(s=Eu(j),s!==null){if(l.flags|=128,T=!0,s=s.updateQueue,l.updateQueue=s,Bu(l,s),s0(_,!0),_.tail===null&&_.tailMode==="hidden"&&!j.alternate&&!Wr)return Da(l),null}else 2*We()-_.renderingStartTime>Vu&&m!==536870912&&(l.flags|=128,T=!0,s0(_,!1),l.lanes=4194304);_.isBackwards?(j.sibling=l.child,l.child=j):(s=_.last,s!==null?s.sibling=j:l.child=j,_.last=j)}return _.tail!==null?(s=_.tail,_.rendering=s,_.tail=s.sibling,_.renderingStartTime=We(),s.sibling=null,m=cn.current,ae(cn,T?m&1|2:m&1),Wr&&fr(l,_.treeForkCount),s):(Da(l),null);case 22:case 23:return ri(l),Qh(),_=l.memoizedState!==null,s!==null?s.memoizedState!==null!==_&&(l.flags|=8192):_&&(l.flags|=8192),_?(m&536870912)!==0&&(l.flags&128)===0&&(Da(l),l.subtreeFlags&6&&(l.flags|=8192)):Da(l),m=l.updateQueue,m!==null&&Bu(l,m.retryQueue),m=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(m=s.memoizedState.cachePool.pool),_=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(_=l.memoizedState.cachePool.pool),_!==m&&(l.flags|=2048),s!==null&&W(Zl),null;case 24:return m=null,s!==null&&(m=s.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),Ao(mn),Da(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function d3(s,l){switch(qa(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Ao(mn),ft(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return Lt(l),null;case 31:if(l.memoizedState!==null){if(ri(l),l.alternate===null)throw Error(n(340));To()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(ri(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));To()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return W(cn),null;case 4:return ft(),null;case 10:return Ao(l.type),null;case 22:case 23:return ri(l),Qh(),s!==null&&W(Zl),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Ao(mn),null;case 25:return null;default:return null}}function B1(s,l){switch(qa(l),l.tag){case 3:Ao(mn),ft();break;case 26:case 27:case 5:Lt(l);break;case 4:ft();break;case 31:l.memoizedState!==null&&ri(l);break;case 13:ri(l);break;case 19:W(cn);break;case 10:Ao(l.type);break;case 22:case 23:ri(l),Qh(),s!==null&&W(Zl);break;case 24:Ao(mn)}}function i0(s,l){try{var m=l.updateQueue,_=m!==null?m.lastEffect:null;if(_!==null){var T=_.next;m=T;do{if((m.tag&s)===s){_=void 0;var j=m.create,Y=m.inst;_=j(),Y.destroy=_}m=m.next}while(m!==T)}}catch(fe){ba(l,l.return,fe)}}function fl(s,l,m){try{var _=l.updateQueue,T=_!==null?_.lastEffect:null;if(T!==null){var j=T.next;_=j;do{if((_.tag&s)===s){var Y=_.inst,fe=Y.destroy;if(fe!==void 0){Y.destroy=void 0,T=l;var De=m,at=fe;try{at()}catch(yt){ba(T,De,yt)}}}_=_.next}while(_!==j)}}catch(yt){ba(l,l.return,yt)}}function U1(s){var l=s.updateQueue;if(l!==null){var m=s.stateNode;try{jp(l,m)}catch(_){ba(s,s.return,_)}}}function z1(s,l,m){m.props=Ql(s.type,s.memoizedProps),m.state=s.memoizedState;try{m.componentWillUnmount()}catch(_){ba(s,l,_)}}function o0(s,l){try{var m=s.ref;if(m!==null){switch(s.tag){case 26:case 27:case 5:var _=s.stateNode;break;case 30:_=s.stateNode;break;default:_=s.stateNode}typeof m=="function"?s.refCleanup=m(_):m.current=_}}catch(T){ba(s,l,T)}}function co(s,l){var m=s.ref,_=s.refCleanup;if(m!==null)if(typeof _=="function")try{_()}catch(T){ba(s,l,T)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(T){ba(s,l,T)}else m.current=null}function H1(s){var l=s.type,m=s.memoizedProps,_=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":m.autoFocus&&_.focus();break e;case"img":m.src?_.src=m.src:m.srcSet&&(_.srcset=m.srcSet)}}catch(T){ba(s,s.return,T)}}function Om(s,l,m){try{var _=s.stateNode;M3(_,s.type,m,l),_[ye]=l}catch(T){ba(s,s.return,T)}}function W1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&bl(s.type)||s.tag===4}function Mm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||W1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&bl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Rm(s,l,m){var _=s.tag;if(_===5||_===6)s=s.stateNode,l?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(s,l):(l=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,l.appendChild(s),m=m._reactRootContainer,m!=null||l.onclick!==null||(l.onclick=wn));else if(_!==4&&(_===27&&bl(s.type)&&(m=s.stateNode,l=null),s=s.child,s!==null))for(Rm(s,l,m),s=s.sibling;s!==null;)Rm(s,l,m),s=s.sibling}function Uu(s,l,m){var _=s.tag;if(_===5||_===6)s=s.stateNode,l?m.insertBefore(s,l):m.appendChild(s);else if(_!==4&&(_===27&&bl(s.type)&&(m=s.stateNode),s=s.child,s!==null))for(Uu(s,l,m),s=s.sibling;s!==null;)Uu(s,l,m),s=s.sibling}function V1(s){var l=s.stateNode,m=s.memoizedProps;try{for(var _=s.type,T=l.attributes;T.length;)l.removeAttributeNode(T[0]);qn(l,_,m),l[xe]=s,l[ye]=m}catch(j){ba(s,s.return,j)}}var Do=!1,pn=!1,Dm=!1,G1=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function u3(s,l){if(s=s.containerInfo,tg=lf,s=te(s),oe(s)){if("selectionStart"in s)var m={start:s.selectionStart,end:s.selectionEnd};else e:{m=(m=s.ownerDocument)&&m.defaultView||window;var _=m.getSelection&&m.getSelection();if(_&&_.rangeCount!==0){m=_.anchorNode;var T=_.anchorOffset,j=_.focusNode;_=_.focusOffset;try{m.nodeType,j.nodeType}catch(vr){m=null;break e}var Y=0,fe=-1,De=-1,at=0,yt=0,Et=s,st=null;t:for(;;){for(var mt;Et!==m||T!==0&&Et.nodeType!==3||(fe=Y+T),Et!==j||_!==0&&Et.nodeType!==3||(De=Y+_),Et.nodeType===3&&(Y+=Et.nodeValue.length),(mt=Et.firstChild)!==null;)st=Et,Et=mt;for(;;){if(Et===s)break t;if(st===m&&++at===T&&(fe=Y),st===j&&++yt===_&&(De=Y),(mt=Et.nextSibling)!==null)break;Et=st,st=Et.parentNode}Et=mt}m=fe===-1||De===-1?null:{start:fe,end:De}}else m=null}m=m||{start:0,end:0}}else m=null;for(rg={focusedElem:s,selectionRange:m},lf=!1,Dn=l;Dn!==null;)if(l=Dn,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Dn=s;else for(;Dn!==null;){switch(l=Dn,j=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(m=0;m<s.length;m++)T=s[m],T.ref.impl=T.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&j!==null){s=void 0,m=l,T=j.memoizedProps,j=j.memoizedState,_=m.stateNode;try{var lr=Ql(m.type,T);s=_.getSnapshotBeforeUpdate(lr,j),_.__reactInternalSnapshotBeforeUpdate=s}catch(vr){ba(m,m.return,vr)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,m=s.nodeType,m===9)sg(s);else if(m===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":sg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=l.sibling,s!==null){s.return=l.return,Dn=s;break}Dn=l.return}}function X1(s,l,m){var _=m.flags;switch(m.tag){case 0:case 11:case 15:Lo(s,m),_&4&&i0(5,m);break;case 1:if(Lo(s,m),_&4)if(s=m.stateNode,l===null)try{s.componentDidMount()}catch(Y){ba(m,m.return,Y)}else{var T=Ql(m.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(T,l,s.__reactInternalSnapshotBeforeUpdate)}catch(Y){ba(m,m.return,Y)}}_&64&&U1(m),_&512&&o0(m,m.return);break;case 3:if(Lo(s,m),_&64&&(s=m.updateQueue,s!==null)){if(l=null,m.child!==null)switch(m.child.tag){case 27:case 5:l=m.child.stateNode;break;case 1:l=m.child.stateNode}try{jp(s,l)}catch(Y){ba(m,m.return,Y)}}break;case 27:l===null&&_&4&&V1(m);case 26:case 5:Lo(s,m),l===null&&_&4&&H1(m),_&512&&o0(m,m.return);break;case 12:Lo(s,m);break;case 31:Lo(s,m),_&4&&$1(s,m);break;case 13:Lo(s,m),_&4&&q1(s,m),_&64&&(s=m.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(m=v3.bind(null,m),U3(s,m))));break;case 22:if(_=m.memoizedState!==null||Do,!_){l=l!==null&&l.memoizedState!==null||pn,T=Do;var j=pn;Do=_,(pn=l)&&!j?Po(s,m,(m.subtreeFlags&8772)!==0):Lo(s,m),Do=T,pn=j}break;case 30:break;default:Lo(s,m)}}function Y1(s){var l=s.alternate;l!==null&&(s.alternate=null,Y1(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&_t(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Ba=null,Is=!1;function Io(s,l,m){for(m=m.child;m!==null;)Z1(s,l,m),m=m.sibling}function Z1(s,l,m){if(Ge&&typeof Ge.onCommitFiberUnmount=="function")try{Ge.onCommitFiberUnmount(Ye,m)}catch(j){}switch(m.tag){case 26:pn||co(m,l),Io(s,l,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:pn||co(m,l);var _=Ba,T=Is;bl(m.type)&&(Ba=m.stateNode,Is=!1),Io(s,l,m),x0(m.stateNode),Ba=_,Is=T;break;case 5:pn||co(m,l);case 6:if(_=Ba,T=Is,Ba=null,Io(s,l,m),Ba=_,Is=T,Ba!==null)if(Is)try{(Ba.nodeType===9?Ba.body:Ba.nodeName==="HTML"?Ba.ownerDocument.body:Ba).removeChild(m.stateNode)}catch(j){ba(m,l,j)}else try{Ba.removeChild(m.stateNode)}catch(j){ba(m,l,j)}break;case 18:Ba!==null&&(Is?(s=Ba,Uy(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,m.stateNode),ed(s)):Uy(Ba,m.stateNode));break;case 4:_=Ba,T=Is,Ba=m.stateNode.containerInfo,Is=!0,Io(s,l,m),Ba=_,Is=T;break;case 0:case 11:case 14:case 15:fl(2,m,l),pn||fl(4,m,l),Io(s,l,m);break;case 1:pn||(co(m,l),_=m.stateNode,typeof _.componentWillUnmount=="function"&&z1(m,l,_)),Io(s,l,m);break;case 21:Io(s,l,m);break;case 22:pn=(_=pn)||m.memoizedState!==null,Io(s,l,m),pn=_;break;default:Io(s,l,m)}}function $1(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ed(s)}catch(m){ba(l,l.return,m)}}}function q1(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ed(s)}catch(m){ba(l,l.return,m)}}function f3(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new G1),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new G1),l;default:throw Error(n(435,s.tag))}}function zu(s,l){var m=f3(s);l.forEach(function(_){if(!m.has(_)){m.add(_);var T=_3.bind(null,s,_);_.then(T,T)}})}function Ls(s,l){var m=l.deletions;if(m!==null)for(var _=0;_<m.length;_++){var T=m[_],j=s,Y=l,fe=Y;e:for(;fe!==null;){switch(fe.tag){case 27:if(bl(fe.type)){Ba=fe.stateNode,Is=!1;break e}break;case 5:Ba=fe.stateNode,Is=!1;break e;case 3:case 4:Ba=fe.stateNode.containerInfo,Is=!0;break e}fe=fe.return}if(Ba===null)throw Error(n(160));Z1(j,Y,T),Ba=null,Is=!1,j=T.alternate,j!==null&&(j.return=null),T.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)K1(l,s),l=l.sibling}var Ui=null;function K1(s,l){var m=s.alternate,_=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ls(l,s),Ps(s),_&4&&(fl(3,s,s.return),i0(3,s),fl(5,s,s.return));break;case 1:Ls(l,s),Ps(s),_&512&&(pn||m===null||co(m,m.return)),_&64&&Do&&(s=s.updateQueue,s!==null&&(_=s.callbacks,_!==null&&(m=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=m===null?_:m.concat(_))));break;case 26:var T=Ui;if(Ls(l,s),Ps(s),_&512&&(pn||m===null||co(m,m.return)),_&4){var j=m!==null?m.memoizedState:null;if(_=s.memoizedState,m===null)if(_===null)if(s.stateNode===null){e:{_=s.type,m=s.memoizedProps,T=T.ownerDocument||T;t:switch(_){case"title":j=T.getElementsByTagName("title")[0],(!j||j[et]||j[xe]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=T.createElement(_),T.head.insertBefore(j,T.querySelector("head > title"))),qn(j,_,m),j[xe]=s,nr(j),_=j;break e;case"link":var Y=Ky("link","href",T).get(_+(m.href||""));if(Y){for(var fe=0;fe<Y.length;fe++)if(j=Y[fe],j.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&j.getAttribute("rel")===(m.rel==null?null:m.rel)&&j.getAttribute("title")===(m.title==null?null:m.title)&&j.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){Y.splice(fe,1);break t}}j=T.createElement(_),qn(j,_,m),T.head.appendChild(j);break;case"meta":if(Y=Ky("meta","content",T).get(_+(m.content||""))){for(fe=0;fe<Y.length;fe++)if(j=Y[fe],j.getAttribute("content")===(m.content==null?null:""+m.content)&&j.getAttribute("name")===(m.name==null?null:m.name)&&j.getAttribute("property")===(m.property==null?null:m.property)&&j.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&j.getAttribute("charset")===(m.charSet==null?null:m.charSet)){Y.splice(fe,1);break t}}j=T.createElement(_),qn(j,_,m),T.head.appendChild(j);break;default:throw Error(n(468,_))}j[xe]=s,nr(j),_=j}s.stateNode=_}else Jy(T,s.type,s.stateNode);else s.stateNode=qy(T,_,s.memoizedProps);else j!==_?(j===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):j.count--,_===null?Jy(T,s.type,s.stateNode):qy(T,_,s.memoizedProps)):_===null&&s.stateNode!==null&&Om(s,s.memoizedProps,m.memoizedProps)}break;case 27:Ls(l,s),Ps(s),_&512&&(pn||m===null||co(m,m.return)),m!==null&&_&4&&Om(s,s.memoizedProps,m.memoizedProps);break;case 5:if(Ls(l,s),Ps(s),_&512&&(pn||m===null||co(m,m.return)),s.flags&32){T=s.stateNode;try{Ts(T,"")}catch(lr){ba(s,s.return,lr)}}_&4&&s.stateNode!=null&&(T=s.memoizedProps,Om(s,T,m!==null?m.memoizedProps:T)),_&1024&&(Dm=!0);break;case 6:if(Ls(l,s),Ps(s),_&4){if(s.stateNode===null)throw Error(n(162));_=s.memoizedProps,m=s.stateNode;try{m.nodeValue=_}catch(lr){ba(s,s.return,lr)}}break;case 3:if(af=null,T=Ui,Ui=tf(l.containerInfo),Ls(l,s),Ui=T,Ps(s),_&4&&m!==null&&m.memoizedState.isDehydrated)try{ed(l.containerInfo)}catch(lr){ba(s,s.return,lr)}Dm&&(Dm=!1,J1(s));break;case 4:_=Ui,Ui=tf(s.stateNode.containerInfo),Ls(l,s),Ps(s),Ui=_;break;case 12:Ls(l,s),Ps(s);break;case 31:Ls(l,s),Ps(s),_&4&&(_=s.updateQueue,_!==null&&(s.updateQueue=null,zu(s,_)));break;case 13:Ls(l,s),Ps(s),s.child.flags&8192&&s.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(Wu=We()),_&4&&(_=s.updateQueue,_!==null&&(s.updateQueue=null,zu(s,_)));break;case 22:T=s.memoizedState!==null;var De=m!==null&&m.memoizedState!==null,at=Do,yt=pn;if(Do=at||T,pn=yt||De,Ls(l,s),pn=yt,Do=at,Ps(s),_&8192)e:for(l=s.stateNode,l._visibility=T?l._visibility&-2:l._visibility|1,T&&(m===null||De||Do||pn||ec(s)),m=null,l=s;;){if(l.tag===5||l.tag===26){if(m===null){De=m=l;try{if(j=De.stateNode,T)Y=j.style,typeof Y.setProperty=="function"?Y.setProperty("display","none","important"):Y.display="none";else{fe=De.stateNode;var Et=De.memoizedProps.style,st=Et!=null&&Et.hasOwnProperty("display")?Et.display:null;fe.style.display=st==null||typeof st=="boolean"?"":(""+st).trim()}}catch(lr){ba(De,De.return,lr)}}}else if(l.tag===6){if(m===null){De=l;try{De.stateNode.nodeValue=T?"":De.memoizedProps}catch(lr){ba(De,De.return,lr)}}}else if(l.tag===18){if(m===null){De=l;try{var mt=De.stateNode;T?zy(mt,!0):zy(De.stateNode,!1)}catch(lr){ba(De,De.return,lr)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;m===l&&(m=null),l=l.return}m===l&&(m=null),l.sibling.return=l.return,l=l.sibling}_&4&&(_=s.updateQueue,_!==null&&(m=_.retryQueue,m!==null&&(_.retryQueue=null,zu(s,m))));break;case 19:Ls(l,s),Ps(s),_&4&&(_=s.updateQueue,_!==null&&(s.updateQueue=null,zu(s,_)));break;case 30:break;case 21:break;default:Ls(l,s),Ps(s)}}function Ps(s){var l=s.flags;if(l&2){try{for(var m,_=s.return;_!==null;){if(W1(_)){m=_;break}_=_.return}if(m==null)throw Error(n(160));switch(m.tag){case 27:var T=m.stateNode,j=Mm(s);Uu(s,j,T);break;case 5:var Y=m.stateNode;m.flags&32&&(Ts(Y,""),m.flags&=-33);var fe=Mm(s);Uu(s,fe,Y);break;case 3:case 4:var De=m.stateNode.containerInfo,at=Mm(s);Rm(s,at,De);break;default:throw Error(n(161))}}catch(yt){ba(s,s.return,yt)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function J1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;J1(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Lo(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)X1(s,l.alternate,l),l=l.sibling}function ec(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:fl(4,l,l.return),ec(l);break;case 1:co(l,l.return);var m=l.stateNode;typeof m.componentWillUnmount=="function"&&z1(l,l.return,m),ec(l);break;case 27:x0(l.stateNode);case 26:case 5:co(l,l.return),ec(l);break;case 22:l.memoizedState===null&&ec(l);break;case 30:ec(l);break;default:ec(l)}s=s.sibling}}function Po(s,l,m){for(m=m&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var _=l.alternate,T=s,j=l,Y=j.flags;switch(j.tag){case 0:case 11:case 15:Po(T,j,m),i0(4,j);break;case 1:if(Po(T,j,m),_=j,T=_.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(at){ba(_,_.return,at)}if(_=j,T=_.updateQueue,T!==null){var fe=_.stateNode;try{var De=T.shared.hiddenCallbacks;if(De!==null)for(T.shared.hiddenCallbacks=null,T=0;T<De.length;T++)Ap(De[T],fe)}catch(at){ba(_,_.return,at)}}m&&Y&64&&U1(j),o0(j,j.return);break;case 27:V1(j);case 26:case 5:Po(T,j,m),m&&_===null&&Y&4&&H1(j),o0(j,j.return);break;case 12:Po(T,j,m);break;case 31:Po(T,j,m),m&&Y&4&&$1(T,j);break;case 13:Po(T,j,m),m&&Y&4&&q1(T,j);break;case 22:j.memoizedState===null&&Po(T,j,m),o0(j,j.return);break;case 30:break;default:Po(T,j,m)}l=l.sibling}}function Im(s,l){var m=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(m=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==m&&(s!=null&&s.refCount++,m!=null&&Yd(m))}function Lm(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Yd(s))}function zi(s,l,m,_){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Q1(s,l,m,_),l=l.sibling}function Q1(s,l,m,_){var T=l.flags;switch(l.tag){case 0:case 11:case 15:zi(s,l,m,_),T&2048&&i0(9,l);break;case 1:zi(s,l,m,_);break;case 3:zi(s,l,m,_),T&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Yd(s)));break;case 12:if(T&2048){zi(s,l,m,_),s=l.stateNode;try{var j=l.memoizedProps,Y=j.id,fe=j.onPostCommit;typeof fe=="function"&&fe(Y,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(De){ba(l,l.return,De)}}else zi(s,l,m,_);break;case 31:zi(s,l,m,_);break;case 13:zi(s,l,m,_);break;case 23:break;case 22:j=l.stateNode,Y=l.alternate,l.memoizedState!==null?j._visibility&2?zi(s,l,m,_):l0(s,l):j._visibility&2?zi(s,l,m,_):(j._visibility|=2,Wc(s,l,m,_,(l.subtreeFlags&10256)!==0||!1)),T&2048&&Im(Y,l);break;case 24:zi(s,l,m,_),T&2048&&Lm(l.alternate,l);break;default:zi(s,l,m,_)}}function Wc(s,l,m,_,T){for(T=T&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var j=s,Y=l,fe=m,De=_,at=Y.flags;switch(Y.tag){case 0:case 11:case 15:Wc(j,Y,fe,De,T),i0(8,Y);break;case 23:break;case 22:var yt=Y.stateNode;Y.memoizedState!==null?yt._visibility&2?Wc(j,Y,fe,De,T):l0(j,Y):(yt._visibility|=2,Wc(j,Y,fe,De,T)),T&&at&2048&&Im(Y.alternate,Y);break;case 24:Wc(j,Y,fe,De,T),T&&at&2048&&Lm(Y.alternate,Y);break;default:Wc(j,Y,fe,De,T)}l=l.sibling}}function l0(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var m=s,_=l,T=_.flags;switch(_.tag){case 22:l0(m,_),T&2048&&Im(_.alternate,_);break;case 24:l0(m,_),T&2048&&Lm(_.alternate,_);break;default:l0(m,_)}l=l.sibling}}var c0=8192;function Vc(s,l,m){if(s.subtreeFlags&c0)for(s=s.child;s!==null;)ey(s,l,m),s=s.sibling}function ey(s,l,m){switch(s.tag){case 26:Vc(s,l,m),s.flags&c0&&s.memoizedState!==null&&J3(m,Ui,s.memoizedState,s.memoizedProps);break;case 5:Vc(s,l,m);break;case 3:case 4:var _=Ui;Ui=tf(s.stateNode.containerInfo),Vc(s,l,m),Ui=_;break;case 22:s.memoizedState===null&&(_=s.alternate,_!==null&&_.memoizedState!==null?(_=c0,c0=16777216,Vc(s,l,m),c0=_):Vc(s,l,m));break;default:Vc(s,l,m)}}function ty(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function d0(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var m=0;m<l.length;m++){var _=l[m];Dn=_,ay(_,s)}ty(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ry(s),s=s.sibling}function ry(s){switch(s.tag){case 0:case 11:case 15:d0(s),s.flags&2048&&fl(9,s,s.return);break;case 3:d0(s);break;case 12:d0(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Hu(s)):d0(s);break;default:d0(s)}}function Hu(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var m=0;m<l.length;m++){var _=l[m];Dn=_,ay(_,s)}ty(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:fl(8,l,l.return),Hu(l);break;case 22:m=l.stateNode,m._visibility&2&&(m._visibility&=-3,Hu(l));break;default:Hu(l)}s=s.sibling}}function ay(s,l){for(;Dn!==null;){var m=Dn;switch(m.tag){case 0:case 11:case 15:fl(8,m,l);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var _=m.memoizedState.cachePool.pool;_!=null&&_.refCount++}break;case 24:Yd(m.memoizedState.cache)}if(_=m.child,_!==null)_.return=m,Dn=_;else e:for(m=s;Dn!==null;){_=Dn;var T=_.sibling,j=_.return;if(Y1(_),_===m){Dn=null;break e}if(T!==null){T.return=j,Dn=T;break e}Dn=j}}}var h3={getCacheForType:function(s){var l=Zn(mn),m=l.data.get(s);return m===void 0&&(m=s(),l.data.set(s,m)),m},cacheSignal:function(){return Zn(mn).controller.signal}},m3=typeof WeakMap=="function"?WeakMap:Map,fa=0,Ma=null,Vr=null,Xr=0,ya=0,ai=null,hl=!1,Gc=!1,Pm=!1,Fo=0,Ja=0,ml=0,tc=0,Fm=0,ni=0,Xc=0,u0=null,Fs=null,Bm=!1,Wu=0,ny=0,Vu=1/0,Gu=null,gl=null,En=0,xl=null,Yc=null,Bo=0,Um=0,zm=null,sy=null,f0=0,Hm=null;function si(){return(fa&2)!==0&&Xr!==0?Xr&-Xr:be.T!==null?Zm():ie()}function iy(){if(ni===0)if((Xr&536870912)===0||Wr){var s=qe;qe<<=1,(qe&3932160)===0&&(qe=262144),ni=s}else ni=536870912;return s=ti.current,s!==null&&(s.flags|=32),ni}function Bs(s,l,m){(s===Ma&&(ya===2||ya===9)||s.cancelPendingCommit!==null)&&(Zc(s,0),pl(s,Xr,ni,!1)),fn(s,m),((fa&2)===0||s!==Ma)&&(s===Ma&&((fa&2)===0&&(tc|=m),Ja===4&&pl(s,Xr,ni,!1)),uo(s))}function oy(s,l,m){if((fa&6)!==0)throw Error(n(327));var _=!m&&(l&127)===0&&(l&s.expiredLanes)===0||Ir(s,l),T=_?p3(s,l):Vm(s,l,!0),j=_;do{if(T===0){Gc&&!_&&pl(s,l,0,!1);break}else{if(m=s.current.alternate,j&&!g3(m)){T=Vm(s,l,!1),j=!1;continue}if(T===2){if(j=l,s.errorRecoveryDisabledLanes&j)var Y=0;else Y=s.pendingLanes&-536870913,Y=Y!==0?Y:Y&536870912?536870912:0;if(Y!==0){l=Y;e:{var fe=s;T=u0;var De=fe.current.memoizedState.isDehydrated;if(De&&(Zc(fe,Y).flags|=256),Y=Vm(fe,Y,!1),Y!==2){if(Pm&&!De){fe.errorRecoveryDisabledLanes|=j,tc|=j,T=4;break e}j=Fs,Fs=T,j!==null&&(Fs===null?Fs=j:Fs.push.apply(Fs,j))}T=Y}if(j=!1,T!==2)continue}}if(T===1){Zc(s,0),pl(s,l,0,!0);break}e:{switch(_=s,j=T,j){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:pl(_,l,ni,!hl);break e;case 2:Fs=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(T=Wu+300-We(),10<T)){if(pl(_,l,ni,!hl),Hr(_,0,!0)!==0)break e;Bo=l,_.timeoutHandle=Fy(ly.bind(null,_,m,Fs,Gu,Bm,l,ni,tc,Xc,hl,j,"Throttled",-0,0),T);break e}ly(_,m,Fs,Gu,Bm,l,ni,tc,Xc,hl,j,null,-0,0)}}break}while(!0);uo(s)}function ly(s,l,m,_,T,j,Y,fe,De,at,yt,Et,st,mt){if(s.timeoutHandle=-1,Et=l.subtreeFlags,Et&8192||(Et&16785408)===16785408){Et={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},ey(l,j,Et);var lr=(j&62914560)===j?Wu-We():(j&4194048)===j?ny-We():0;if(lr=Q3(Et,lr),lr!==null){Bo=j,s.cancelPendingCommit=lr(xy.bind(null,s,l,j,m,_,T,Y,fe,De,yt,Et,null,st,mt)),pl(s,j,Y,!at);return}}xy(s,l,j,m,_,T,Y,fe,De)}function g3(s){for(var l=s;;){var m=l.tag;if((m===0||m===11||m===15)&&l.flags&16384&&(m=l.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var _=0;_<m.length;_++){var T=m[_],j=T.getSnapshot;T=T.value;try{if(!w(j(),T))return!1}catch(Y){return!1}}if(m=l.child,l.subtreeFlags&16384&&m!==null)m.return=l,l=m;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function pl(s,l,m,_){l&=~Fm,l&=~tc,s.suspendedLanes|=l,s.pingedLanes&=~l,_&&(s.warmLanes|=l),_=s.expirationTimes;for(var T=l;0<T;){var j=31-Ft(T),Y=1<<j;_[j]=-1,T&=~Y}m!==0&&Xs(s,m,l)}function Xu(){return(fa&6)===0?(h0(0),!1):!0}function Wm(){if(Vr!==null){if(ya===0)var s=Vr.return;else s=Vr,Bi=lo=null,sm(s),Fc=null,$d=0,s=Vr;for(;s!==null;)B1(s.alternate,s),s=s.return;Vr=null}}function Zc(s,l){var m=s.timeoutHandle;m!==-1&&(s.timeoutHandle=-1,I3(m)),m=s.cancelPendingCommit,m!==null&&(s.cancelPendingCommit=null,m()),Bo=0,Wm(),Ma=s,Vr=m=bi(s.current,null),Xr=l,ya=0,ai=null,hl=!1,Gc=Ir(s,l),Pm=!1,Xc=ni=Fm=tc=ml=Ja=0,Fs=u0=null,Bm=!1,(l&8)!==0&&(l|=l&32);var _=s.entangledLanes;if(_!==0)for(s=s.entanglements,_&=l;0<_;){var T=31-Ft(_),j=1<<T;l|=s[T],_&=~j}return Fo=l,Hl(),m}function cy(s,l){Mr=null,be.H=a0,l===Pc||l===_u?(l=Sp(),ya=3):l===Yh?(l=Sp(),ya=4):ya=l===_m?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,ai=l,Vr===null&&(Ja=1,Iu(s,b(l,s.current)))}function dy(){var s=ti.current;return s===null?!0:(Xr&4194048)===Xr?vi===null:(Xr&62914560)===Xr||(Xr&536870912)!==0?s===vi:!1}function uy(){var s=be.H;return be.H=a0,s===null?a0:s}function fy(){var s=be.A;return be.A=h3,s}function Yu(){Ja=4,hl||(Xr&4194048)!==Xr&&ti.current!==null||(Gc=!0),(ml&134217727)===0&&(tc&134217727)===0||Ma===null||pl(Ma,Xr,ni,!1)}function Vm(s,l,m){var _=fa;fa|=2;var T=uy(),j=fy();(Ma!==s||Xr!==l)&&(Gu=null,Zc(s,l)),l=!1;var Y=Ja;e:do try{if(ya!==0&&Vr!==null){var fe=Vr,De=ai;switch(ya){case 8:Wm(),Y=6;break e;case 3:case 2:case 9:case 6:ti.current===null&&(l=!0);var at=ya;if(ya=0,ai=null,$c(s,fe,De,at),m&&Gc){Y=0;break e}break;default:at=ya,ya=0,ai=null,$c(s,fe,De,at)}}x3(),Y=Ja;break}catch(yt){cy(s,yt)}while(!0);return l&&s.shellSuspendCounter++,Bi=lo=null,fa=_,be.H=T,be.A=j,Vr===null&&(Ma=null,Xr=0,Hl()),Y}function x3(){for(;Vr!==null;)hy(Vr)}function p3(s,l){var m=fa;fa|=2;var _=uy(),T=fy();Ma!==s||Xr!==l?(Gu=null,Vu=We()+500,Zc(s,l)):Gc=Ir(s,l);e:do try{if(ya!==0&&Vr!==null){l=Vr;var j=ai;t:switch(ya){case 1:ya=0,ai=null,$c(s,l,j,1);break;case 2:case 9:if(kp(j)){ya=0,ai=null,my(l);break}l=function(){ya!==2&&ya!==9||Ma!==s||(ya=7),uo(s)},j.then(l,l);break e;case 3:ya=7;break e;case 4:ya=5;break e;case 7:kp(j)?(ya=0,ai=null,my(l)):(ya=0,ai=null,$c(s,l,j,7));break;case 5:var Y=null;switch(Vr.tag){case 26:Y=Vr.memoizedState;case 5:case 27:var fe=Vr;if(Y?Qy(Y):fe.stateNode.complete){ya=0,ai=null;var De=fe.sibling;if(De!==null)Vr=De;else{var at=fe.return;at!==null?(Vr=at,Zu(at)):Vr=null}break t}}ya=0,ai=null,$c(s,l,j,5);break;case 6:ya=0,ai=null,$c(s,l,j,6);break;case 8:Wm(),Ja=6;break e;default:throw Error(n(462))}}y3();break}catch(yt){cy(s,yt)}while(!0);return Bi=lo=null,be.H=_,be.A=T,fa=m,Vr!==null?0:(Ma=null,Xr=0,Hl(),Ja)}function y3(){for(;Vr!==null&&!Wt();)hy(Vr)}function hy(s){var l=P1(s.alternate,s,Fo);s.memoizedProps=s.pendingProps,l===null?Zu(s):Vr=l}function my(s){var l=s,m=l.alternate;switch(l.tag){case 15:case 0:l=O1(m,l,l.pendingProps,l.type,void 0,Xr);break;case 11:l=O1(m,l,l.pendingProps,l.type.render,l.ref,Xr);break;case 5:sm(l);default:B1(m,l),l=Vr=Hd(l,Fo),l=P1(m,l,Fo)}s.memoizedProps=s.pendingProps,l===null?Zu(s):Vr=l}function $c(s,l,m,_){Bi=lo=null,sm(l),Fc=null,$d=0;var T=l.return;try{if(i3(s,T,l,m,Xr)){Ja=1,Iu(s,b(m,s.current)),Vr=null;return}}catch(j){if(T!==null)throw Vr=T,j;Ja=1,Iu(s,b(m,s.current)),Vr=null;return}l.flags&32768?(Wr||_===1?s=!0:Gc||(Xr&536870912)!==0?s=!1:(hl=s=!0,(_===2||_===9||_===3||_===6)&&(_=ti.current,_!==null&&_.tag===13&&(_.flags|=16384))),gy(l,s)):Zu(l)}function Zu(s){var l=s;do{if((l.flags&32768)!==0){gy(l,hl);return}s=l.return;var m=c3(l.alternate,l,Fo);if(m!==null){Vr=m;return}if(l=l.sibling,l!==null){Vr=l;return}Vr=l=s}while(l!==null);Ja===0&&(Ja=5)}function gy(s,l){do{var m=d3(s.alternate,s);if(m!==null){m.flags&=32767,Vr=m;return}if(m=s.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!l&&(s=s.sibling,s!==null)){Vr=s;return}Vr=s=m}while(s!==null);Ja=6,Vr=null}function xy(s,l,m,_,T,j,Y,fe,De){s.cancelPendingCommit=null;do $u();while(En!==0);if((fa&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(j=l.lanes|l.childLanes,j|=jc,hn(s,m,j,Y,fe,De),s===Ma&&(Vr=Ma=null,Xr=0),Yc=l,xl=s,Bo=m,Um=j,zm=T,sy=_,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,w3(cr,function(){return _y(),null})):(s.callbackNode=null,s.callbackPriority=0),_=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||_){_=be.T,be.T=null,T=re.p,re.p=2,Y=fa,fa|=4;try{u3(s,l,m)}finally{fa=Y,re.p=T,be.T=_}}En=1,py(),yy(),by()}}function py(){if(En===1){En=0;var s=xl,l=Yc,m=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||m){m=be.T,be.T=null;var _=re.p;re.p=2;var T=fa;fa|=4;try{K1(l,s);var j=rg,Y=te(s.containerInfo),fe=j.focusedElem,De=j.selectionRange;if(Y!==fe&&fe&&fe.ownerDocument&&G(fe.ownerDocument.documentElement,fe)){if(De!==null&&oe(fe)){var at=De.start,yt=De.end;if(yt===void 0&&(yt=at),"selectionStart"in fe)fe.selectionStart=at,fe.selectionEnd=Math.min(yt,fe.value.length);else{var Et=fe.ownerDocument||document,st=Et&&Et.defaultView||window;if(st.getSelection){var mt=st.getSelection(),lr=fe.textContent.length,vr=Math.min(De.start,lr),Ea=De.end===void 0?vr:Math.min(De.end,lr);!mt.extend&&vr>Ea&&(Y=Ea,Ea=vr,vr=Y);var Xe=P(fe,vr),Ue=P(fe,Ea);if(Xe&&Ue&&(mt.rangeCount!==1||mt.anchorNode!==Xe.node||mt.anchorOffset!==Xe.offset||mt.focusNode!==Ue.node||mt.focusOffset!==Ue.offset)){var rt=Et.createRange();rt.setStart(Xe.node,Xe.offset),mt.removeAllRanges(),vr>Ea?(mt.addRange(rt),mt.extend(Ue.node,Ue.offset)):(rt.setEnd(Ue.node,Ue.offset),mt.addRange(rt))}}}}for(Et=[],mt=fe;mt=mt.parentNode;)mt.nodeType===1&&Et.push({element:mt,left:mt.scrollLeft,top:mt.scrollTop});for(typeof fe.focus=="function"&&fe.focus(),fe=0;fe<Et.length;fe++){var wt=Et[fe];wt.element.scrollLeft=wt.left,wt.element.scrollTop=wt.top}}lf=!!tg,rg=tg=null}finally{fa=T,re.p=_,be.T=m}}s.current=l,En=2}}function yy(){if(En===2){En=0;var s=xl,l=Yc,m=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||m){m=be.T,be.T=null;var _=re.p;re.p=2;var T=fa;fa|=4;try{X1(s,l.alternate,l)}finally{fa=T,re.p=_,be.T=m}}En=3}}function by(){if(En===4||En===3){En=0,pt();var s=xl,l=Yc,m=Bo,_=sy;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?En=5:(En=0,Yc=xl=null,vy(s,s.pendingLanes));var T=s.pendingLanes;if(T===0&&(gl=null),rr(m),l=l.stateNode,Ge&&typeof Ge.onCommitFiberRoot=="function")try{Ge.onCommitFiberRoot(Ye,l,void 0,(l.current.flags&128)===128)}catch(De){}if(_!==null){l=be.T,T=re.p,re.p=2,be.T=null;try{for(var j=s.onRecoverableError,Y=0;Y<_.length;Y++){var fe=_[Y];j(fe.value,{componentStack:fe.stack})}}finally{be.T=l,re.p=T}}(Bo&3)!==0&&$u(),uo(s),T=s.pendingLanes,(m&261930)!==0&&(T&42)!==0?s===Hm?f0++:(f0=0,Hm=s):f0=0,h0(0)}}function vy(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Yd(l)))}function $u(){return py(),yy(),by(),_y()}function _y(){if(En!==5)return!1;var s=xl,l=Um;Um=0;var m=rr(Bo),_=be.T,T=re.p;try{re.p=32>m?32:m,be.T=null,m=zm,zm=null;var j=xl,Y=Bo;if(En=0,Yc=xl=null,Bo=0,(fa&6)!==0)throw Error(n(331));var fe=fa;if(fa|=4,ry(j.current),Q1(j,j.current,Y,m),fa=fe,h0(0,!1),Ge&&typeof Ge.onPostCommitFiberRoot=="function")try{Ge.onPostCommitFiberRoot(Ye,j)}catch(De){}return!0}finally{re.p=T,be.T=_,vy(s,l)}}function wy(s,l,m){l=b(m,l),l=vm(s.stateNode,l,2),s=cl(s,l,2),s!==null&&(fn(s,2),uo(s))}function ba(s,l,m){if(s.tag===3)wy(s,s,m);else for(;l!==null;){if(l.tag===3){wy(l,s,m);break}else if(l.tag===1){var _=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(gl===null||!gl.has(_))){s=b(m,s),m=k1(2),_=cl(l,m,2),_!==null&&(N1(m,_,l,s),fn(_,2),uo(_));break}}l=l.return}}function Gm(s,l,m){var _=s.pingCache;if(_===null){_=s.pingCache=new m3;var T=new Set;_.set(l,T)}else T=_.get(l),T===void 0&&(T=new Set,_.set(l,T));T.has(m)||(Pm=!0,T.add(m),s=b3.bind(null,s,l,m),l.then(s,s))}function b3(s,l,m){var _=s.pingCache;_!==null&&_.delete(l),s.pingedLanes|=s.suspendedLanes&m,s.warmLanes&=~m,Ma===s&&(Xr&m)===m&&(Ja===4||Ja===3&&(Xr&62914560)===Xr&&300>We()-Wu?(fa&2)===0&&Zc(s,0):Fm|=m,Xc===Xr&&(Xc=0)),uo(s)}function ky(s,l){l===0&&(l=ca()),s=yi(s,l),s!==null&&(fn(s,l),uo(s))}function v3(s){var l=s.memoizedState,m=0;l!==null&&(m=l.retryLane),ky(s,m)}function _3(s,l){var m=0;switch(s.tag){case 31:case 13:var _=s.stateNode,T=s.memoizedState;T!==null&&(m=T.retryLane);break;case 19:_=s.stateNode;break;case 22:_=s.stateNode._retryCache;break;default:throw Error(n(314))}_!==null&&_.delete(l),ky(s,m)}function w3(s,l){return ut(s,l)}var qu=null,qc=null,Xm=!1,Ku=!1,Ym=!1,yl=0;function uo(s){s!==qc&&s.next===null&&(qc===null?qu=qc=s:qc=qc.next=s),Ku=!0,Xm||(Xm=!0,N3())}function h0(s,l){if(!Ym&&Ku){Ym=!0;do for(var m=!1,_=qu;_!==null;){if(s!==0){var T=_.pendingLanes;if(T===0)var j=0;else{var Y=_.suspendedLanes,fe=_.pingedLanes;j=(1<<31-Ft(42|s)+1)-1,j&=T&~(Y&~fe),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(m=!0,Cy(_,j))}else j=Xr,j=Hr(_,_===Ma?j:0,_.cancelPendingCommit!==null||_.timeoutHandle!==-1),(j&3)===0||Ir(_,j)||(m=!0,Cy(_,j));_=_.next}while(m);Ym=!1}}function k3(){Ny()}function Ny(){Ku=Xm=!1;var s=0;yl!==0&&D3()&&(s=yl);for(var l=We(),m=null,_=qu;_!==null;){var T=_.next,j=Sy(_,l);j===0?(_.next=null,m===null?qu=T:m.next=T,T===null&&(qc=m)):(m=_,(s!==0||(j&3)!==0)&&(Ku=!0)),_=T}En!==0&&En!==5||h0(s),yl!==0&&(yl=0)}function Sy(s,l){for(var m=s.suspendedLanes,_=s.pingedLanes,T=s.expirationTimes,j=s.pendingLanes&-62914561;0<j;){var Y=31-Ft(j),fe=1<<Y,De=T[Y];De===-1?((fe&m)===0||(fe&_)!==0)&&(T[Y]=Pa(fe,l)):De<=l&&(s.expiredLanes|=fe),j&=~fe}if(l=Ma,m=Xr,m=Hr(s,s===l?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),_=s.callbackNode,m===0||s===l&&(ya===2||ya===9)||s.cancelPendingCommit!==null)return _!==null&&_!==null&&tt(_),s.callbackNode=null,s.callbackPriority=0;if((m&3)===0||Ir(s,m)){if(l=m&-m,l===s.callbackPriority)return l;switch(_!==null&&tt(_),rr(m)){case 2:case 8:m=Qt;break;case 32:m=cr;break;case 268435456:m=It;break;default:m=cr}return _=Ey.bind(null,s),m=ut(m,_),s.callbackPriority=l,s.callbackNode=m,l}return _!==null&&_!==null&&tt(_),s.callbackPriority=2,s.callbackNode=null,2}function Ey(s,l){if(En!==0&&En!==5)return s.callbackNode=null,s.callbackPriority=0,null;var m=s.callbackNode;if($u()&&s.callbackNode!==m)return null;var _=Xr;return _=Hr(s,s===Ma?_:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),_===0?null:(oy(s,_,l),Sy(s,We()),s.callbackNode!=null&&s.callbackNode===m?Ey.bind(null,s):null)}function Cy(s,l){if($u())return null;oy(s,l,!0)}function N3(){L3(function(){(fa&6)!==0?ut(At,k3):Ny()})}function Zm(){if(yl===0){var s=Ic;s===0&&(s=Re,Re<<=1,(Re&261888)===0&&(Re=256)),yl=s}return yl}function Ty(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:mi(""+s)}function Ay(s,l){var m=l.ownerDocument.createElement("input");return m.name=l.name,m.value=l.value,s.id&&m.setAttribute("form",s.id),l.parentNode.insertBefore(m,l),s=new FormData(s),m.parentNode.removeChild(m),s}function S3(s,l,m,_,T){if(l==="submit"&&m&&m.stateNode===T){var j=Ty((T[ye]||null).action),Y=_.submitter;Y&&(l=(l=Y[ye]||null)?Ty(l.formAction):Y.getAttribute("formAction"),l!==null&&(j=l,Y=null));var fe=new sn("action","action",null,_,T);s.push({event:fe,listeners:[{instance:null,listener:function(){if(_.defaultPrevented){if(yl!==0){var De=Y?Ay(T,Y):new FormData(T);mm(m,{pending:!0,data:De,method:T.method,action:j},null,De)}}else typeof j=="function"&&(fe.preventDefault(),De=Y?Ay(T,Y):new FormData(T),mm(m,{pending:!0,data:De,method:T.method,action:j},j,De))},currentTarget:T}]})}}for(var $m=0;$m<pi.length;$m++){var qm=pi[$m],E3=qm.toLowerCase(),C3=qm[0].toUpperCase()+qm.slice(1);Ms(E3,"on"+C3)}Ms(kn,"onAnimationEnd"),Ms(Nn,"onAnimationIteration"),Ms(qr,"onAnimationStart"),Ms("dblclick","onDoubleClick"),Ms("focusin","onFocus"),Ms("focusout","onBlur"),Ms(ln,"onTransitionRun"),Ms(Rn,"onTransitionStart"),Ms(no,"onTransitionCancel"),Ms(vs,"onTransitionEnd"),Wa("onMouseEnter",["mouseout","mouseover"]),Wa("onMouseLeave",["mouseout","mouseover"]),Wa("onPointerEnter",["pointerout","pointerover"]),Wa("onPointerLeave",["pointerout","pointerover"]),kr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),kr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),kr("onBeforeInput",["compositionend","keypress","textInput","paste"]),kr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),kr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),kr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var m0="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(" "),T3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(m0));function jy(s,l){l=(l&4)!==0;for(var m=0;m<s.length;m++){var _=s[m],T=_.event;_=_.listeners;e:{var j=void 0;if(l)for(var Y=_.length-1;0<=Y;Y--){var fe=_[Y],De=fe.instance,at=fe.currentTarget;if(fe=fe.listener,De!==j&&T.isPropagationStopped())break e;j=fe,T.currentTarget=at;try{j(T)}catch(yt){zl(yt)}T.currentTarget=null,j=De}else for(Y=0;Y<_.length;Y++){if(fe=_[Y],De=fe.instance,at=fe.currentTarget,fe=fe.listener,De!==j&&T.isPropagationStopped())break e;j=fe,T.currentTarget=at;try{j(T)}catch(yt){zl(yt)}T.currentTarget=null,j=De}}}}function Gr(s,l){var m=l[ge];m===void 0&&(m=l[ge]=new Set);var _=s+"__bubble";m.has(_)||(Oy(l,s,2,!1),m.add(_))}function Km(s,l,m){var _=0;l&&(_|=4),Oy(m,s,_,l)}var Ju="_reactListening"+Math.random().toString(36).slice(2);function Jm(s){if(!s[Ju]){s[Ju]=!0,ct.forEach(function(m){m!=="selectionchange"&&(T3.has(m)||Km(m,!1,s),Km(m,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Ju]||(l[Ju]=!0,Km("selectionchange",!1,l))}}function Oy(s,l,m,_){switch(i2(l)){case 2:var T=rk;break;case 8:T=ak;break;default:T=hg}m=T.bind(null,l,m,s),T=void 0,!_o||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(T=!0),_?T!==void 0?s.addEventListener(l,m,{capture:!0,passive:T}):s.addEventListener(l,m,!0):T!==void 0?s.addEventListener(l,m,{passive:T}):s.addEventListener(l,m,!1)}function Qm(s,l,m,_,T){var j=_;if((l&1)===0&&(l&2)===0&&_!==null)e:for(;;){if(_===null)return;var Y=_.tag;if(Y===3||Y===4){var fe=_.stateNode.containerInfo;if(fe===T)break;if(Y===4)for(Y=_.return;Y!==null;){var De=Y.tag;if((De===3||De===4)&&Y.stateNode.containerInfo===T)return;Y=Y.return}for(;fe!==null;){if(Y=vt(fe),Y===null)return;if(De=Y.tag,De===5||De===6||De===26||De===27){_=j=Y;continue e}fe=fe.parentNode}}_=_.return}Pl(function(){var at=j,yt=vo(m),Et=[];e:{var st=Ac.get(s);if(st!==void 0){var mt=sn,lr=s;switch(s){case"keypress":if(Zs(m)===0)break e;case"keydown":case"keyup":mt=No;break;case"focusin":lr="focus",mt=Bl;break;case"focusout":lr="blur",mt=Bl;break;case"beforeblur":case"afterblur":mt=Bl;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":mt=Jr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":mt=tl;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":mt=Ud;break;case kn:case Nn:case qr:mt=Tr;break;case vs:mt=xi;break;case"scroll":case"scrollend":mt=Ur;break;case"wheel":mt=Mi;break;case"copy":case"cut":case"paste":mt=Xn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":mt=ta;break;case"toggle":case"beforetoggle":mt=Ri}var vr=(l&4)!==0,Ea=!vr&&(s==="scroll"||s==="scrollend"),Xe=vr?st!==null?st+"Capture":null:st;vr=[];for(var Ue=at,rt;Ue!==null;){var wt=Ue;if(rt=wt.stateNode,wt=wt.tag,wt!==5&&wt!==26&&wt!==27||rt===null||Xe===null||(wt=_r(Ue,Xe),wt!=null&&vr.push(g0(Ue,wt,rt))),Ea)break;Ue=Ue.return}0<vr.length&&(st=new mt(st,lr,null,m,yt),Et.push({event:st,listeners:vr}))}}if((l&7)===0){e:{if(st=s==="mouseover"||s==="pointerover",mt=s==="mouseout"||s==="pointerout",st&&m!==eo&&(lr=m.relatedTarget||m.fromElement)&&(vt(lr)||lr[Ee]))break e;if((mt||st)&&(st=yt.window===yt?yt:(st=yt.ownerDocument)?st.defaultView||st.parentWindow:window,mt?(lr=m.relatedTarget||m.toElement,mt=at,lr=lr?vt(lr):null,lr!==null&&(Ea=u(lr),vr=lr.tag,lr!==Ea||vr!==5&&vr!==27&&vr!==6)&&(lr=null)):(mt=null,lr=at),mt!==lr)){if(vr=Jr,wt="onMouseLeave",Xe="onMouseEnter",Ue="mouse",(s==="pointerout"||s==="pointerover")&&(vr=ta,wt="onPointerLeave",Xe="onPointerEnter",Ue="pointer"),Ea=mt==null?st:Rt(mt),rt=lr==null?st:Rt(lr),st=new vr(wt,Ue+"leave",mt,m,yt),st.target=Ea,st.relatedTarget=rt,wt=null,vt(yt)===at&&(vr=new vr(Xe,Ue+"enter",lr,m,yt),vr.target=rt,vr.relatedTarget=Ea,wt=vr),Ea=wt,mt&&lr)t:{for(vr=A3,Xe=mt,Ue=lr,rt=0,wt=Xe;wt;wt=vr(wt))rt++;wt=0;for(var gr=Ue;gr;gr=vr(gr))wt++;for(;0<rt-wt;)Xe=vr(Xe),rt--;for(;0<wt-rt;)Ue=vr(Ue),wt--;for(;rt--;){if(Xe===Ue||Ue!==null&&Xe===Ue.alternate){vr=Xe;break t}Xe=vr(Xe),Ue=vr(Ue)}vr=null}else vr=null;mt!==null&&My(Et,st,mt,vr,!1),lr!==null&&Ea!==null&&My(Et,Ea,lr,vr,!0)}}e:{if(st=at?Rt(at):window,mt=st.nodeName&&st.nodeName.toLowerCase(),mt==="select"||mt==="input"&&st.type==="file")var na=Mn;else if(ys(st))if(Tc)na=x;else{na=c;var dr=i}else mt=st.nodeName,!mt||mt.toLowerCase()!=="input"||st.type!=="checkbox"&&st.type!=="radio"?at&&da(at.elementType)&&(na=Mn):na=h;if(na&&(na=na(s,at))){bs(Et,na,m,yt);break e}dr&&dr(s,st,at),s==="focusout"&&at&&st.type==="number"&&at.memoizedProps.value!=null&&we(st,"number",st.value)}switch(dr=at?Rt(at):window,s){case"focusin":(ys(dr)||dr.contentEditable==="true")&&(Ie=dr,Pe=at,Ke=null);break;case"focusout":Ke=Pe=Ie=null;break;case"mousedown":it=!0;break;case"contextmenu":case"mouseup":case"dragend":it=!1,Bt(Et,m,yt);break;case"selectionchange":if(Ce)break;case"keydown":case"keyup":Bt(Et,m,yt)}var Pr;if(to)e:{switch(s){case"compositionstart":var Yr="onCompositionStart";break e;case"compositionend":Yr="onCompositionEnd";break e;case"compositionupdate":Yr="onCompositionUpdate";break e}Yr=void 0}else ro?Cc(s,m)&&(Yr="onCompositionEnd"):s==="keydown"&&m.keyCode===229&&(Yr="onCompositionStart");Yr&&(al&&m.locale!=="ko"&&(ro||Yr!=="onCompositionStart"?Yr==="onCompositionEnd"&&ro&&(Pr=ns()):(ps=yt,Wn="value"in ps?ps.value:ps.textContent,ro=!0)),dr=Qu(at,Yr),0<dr.length&&(Yr=new Ul(Yr,s,null,m,yt),Et.push({event:Yr,listeners:dr}),Pr?Yr.data=Pr:(Pr=Ii(m),Pr!==null&&(Yr.data=Pr)))),(Pr=Ec?$a(s,m):ei(s,m))&&(Yr=Qu(at,"onBeforeInput"),0<Yr.length&&(dr=new Ul("onBeforeInput","beforeinput",null,m,yt),Et.push({event:dr,listeners:Yr}),dr.data=Pr)),S3(Et,s,at,m,yt)}jy(Et,l)})}function g0(s,l,m){return{instance:s,listener:l,currentTarget:m}}function Qu(s,l){for(var m=l+"Capture",_=[];s!==null;){var T=s,j=T.stateNode;if(T=T.tag,T!==5&&T!==26&&T!==27||j===null||(T=_r(s,m),T!=null&&_.unshift(g0(s,T,j)),T=_r(s,l),T!=null&&_.push(g0(s,T,j))),s.tag===3)return _;s=s.return}return[]}function A3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function My(s,l,m,_,T){for(var j=l._reactName,Y=[];m!==null&&m!==_;){var fe=m,De=fe.alternate,at=fe.stateNode;if(fe=fe.tag,De!==null&&De===_)break;fe!==5&&fe!==26&&fe!==27||at===null||(De=at,T?(at=_r(m,j),at!=null&&Y.unshift(g0(m,at,De))):T||(at=_r(m,j),at!=null&&Y.push(g0(m,at,De)))),m=m.return}Y.length!==0&&s.push({event:l,listeners:Y})}var j3=/\r\n?/g,O3=/\u0000|\uFFFD/g;function Ry(s){return(typeof s=="string"?s:""+s).replace(j3,`
`).replace(O3,"")}function Dy(s,l){return l=Ry(l),Ry(s)===l}function Sa(s,l,m,_,T,j){switch(m){case"children":typeof _=="string"?l==="body"||l==="textarea"&&_===""||Ts(s,_):(typeof _=="number"||typeof _=="bigint")&&l!=="body"&&Ts(s,""+_);break;case"className":ea(s,"class",_);break;case"tabIndex":ea(s,"tabindex",_);break;case"dir":case"role":case"viewBox":case"width":case"height":ea(s,m,_);break;case"style":ur(s,_,j);break;case"data":if(l!=="object"){ea(s,"data",_);break}case"src":case"href":if(_===""&&(l!=="a"||m!=="href")){s.removeAttribute(m);break}if(_==null||typeof _=="function"||typeof _=="symbol"||typeof _=="boolean"){s.removeAttribute(m);break}_=mi(""+_),s.setAttribute(m,_);break;case"action":case"formAction":if(typeof _=="function"){s.setAttribute(m,"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 j=="function"&&(m==="formAction"?(l!=="input"&&Sa(s,l,"name",T.name,T,null),Sa(s,l,"formEncType",T.formEncType,T,null),Sa(s,l,"formMethod",T.formMethod,T,null),Sa(s,l,"formTarget",T.formTarget,T,null)):(Sa(s,l,"encType",T.encType,T,null),Sa(s,l,"method",T.method,T,null),Sa(s,l,"target",T.target,T,null)));if(_==null||typeof _=="symbol"||typeof _=="boolean"){s.removeAttribute(m);break}_=mi(""+_),s.setAttribute(m,_);break;case"onClick":_!=null&&(s.onclick=wn);break;case"onScroll":_!=null&&Gr("scroll",s);break;case"onScrollEnd":_!=null&&Gr("scrollend",s);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(n(61));if(m=_.__html,m!=null){if(T.children!=null)throw Error(n(60));s.innerHTML=m}}break;case"multiple":s.multiple=_&&typeof _!="function"&&typeof _!="symbol";break;case"muted":s.muted=_&&typeof _!="function"&&typeof _!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(_==null||typeof _=="function"||typeof _=="boolean"||typeof _=="symbol"){s.removeAttribute("xlink:href");break}m=mi(""+_),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":_!=null&&typeof _!="function"&&typeof _!="symbol"?s.setAttribute(m,""+_):s.removeAttribute(m);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":_&&typeof _!="function"&&typeof _!="symbol"?s.setAttribute(m,""):s.removeAttribute(m);break;case"capture":case"download":_===!0?s.setAttribute(m,""):_!==!1&&_!=null&&typeof _!="function"&&typeof _!="symbol"?s.setAttribute(m,_):s.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":_!=null&&typeof _!="function"&&typeof _!="symbol"&&!isNaN(_)&&1<=_?s.setAttribute(m,_):s.removeAttribute(m);break;case"rowSpan":case"start":_==null||typeof _=="function"||typeof _=="symbol"||isNaN(_)?s.removeAttribute(m):s.setAttribute(m,_);break;case"popover":Gr("beforetoggle",s),Gr("toggle",s),br(s,"popover",_);break;case"xlinkActuate":jn(s,"http://www.w3.org/1999/xlink","xlink:actuate",_);break;case"xlinkArcrole":jn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",_);break;case"xlinkRole":jn(s,"http://www.w3.org/1999/xlink","xlink:role",_);break;case"xlinkShow":jn(s,"http://www.w3.org/1999/xlink","xlink:show",_);break;case"xlinkTitle":jn(s,"http://www.w3.org/1999/xlink","xlink:title",_);break;case"xlinkType":jn(s,"http://www.w3.org/1999/xlink","xlink:type",_);break;case"xmlBase":jn(s,"http://www.w3.org/XML/1998/namespace","xml:base",_);break;case"xmlLang":jn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",_);break;case"xmlSpace":jn(s,"http://www.w3.org/XML/1998/namespace","xml:space",_);break;case"is":br(s,"is",_);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=bo.get(m)||m,br(s,m,_))}}function eg(s,l,m,_,T,j){switch(m){case"style":ur(s,_,j);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(n(61));if(m=_.__html,m!=null){if(T.children!=null)throw Error(n(60));s.innerHTML=m}}break;case"children":typeof _=="string"?Ts(s,_):(typeof _=="number"||typeof _=="bigint")&&Ts(s,""+_);break;case"onScroll":_!=null&&Gr("scroll",s);break;case"onScrollEnd":_!=null&&Gr("scrollend",s);break;case"onClick":_!=null&&(s.onclick=wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ga.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(T=m.endsWith("Capture"),l=m.slice(2,T?m.length-7:void 0),j=s[ye]||null,j=j!=null?j[m]:null,typeof j=="function"&&s.removeEventListener(l,j,T),typeof _=="function")){typeof j!="function"&&j!==null&&(m in s?s[m]=null:s.hasAttribute(m)&&s.removeAttribute(m)),s.addEventListener(l,_,T);break e}m in s?s[m]=_:_===!0?s.setAttribute(m,""):br(s,m,_)}}}function qn(s,l,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Gr("error",s),Gr("load",s);var _=!1,T=!1,j;for(j in m)if(m.hasOwnProperty(j)){var Y=m[j];if(Y!=null)switch(j){case"src":_=!0;break;case"srcSet":T=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Sa(s,l,j,Y,m,null)}}T&&Sa(s,l,"srcSet",m.srcSet,m,null),_&&Sa(s,l,"src",m.src,m,null);return;case"input":Gr("invalid",s);var fe=j=Y=T=null,De=null,at=null;for(_ in m)if(m.hasOwnProperty(_)){var yt=m[_];if(yt!=null)switch(_){case"name":T=yt;break;case"type":Y=yt;break;case"checked":De=yt;break;case"defaultChecked":at=yt;break;case"value":j=yt;break;case"defaultValue":fe=yt;break;case"children":case"dangerouslySetInnerHTML":if(yt!=null)throw Error(n(137,l));break;default:Sa(s,l,_,yt,m,null)}}Qe(s,j,fe,De,at,Y,T,!1);return;case"select":Gr("invalid",s),_=Y=j=null;for(T in m)if(m.hasOwnProperty(T)&&(fe=m[T],fe!=null))switch(T){case"value":j=fe;break;case"defaultValue":Y=fe;break;case"multiple":_=fe;default:Sa(s,l,T,fe,m,null)}l=j,m=Y,s.multiple=!!_,l!=null?Gt(s,!!_,l,!1):m!=null&&Gt(s,!!_,m,!0);return;case"textarea":Gr("invalid",s),j=T=_=null;for(Y in m)if(m.hasOwnProperty(Y)&&(fe=m[Y],fe!=null))switch(Y){case"value":_=fe;break;case"defaultValue":T=fe;break;case"children":j=fe;break;case"dangerouslySetInnerHTML":if(fe!=null)throw Error(n(91));break;default:Sa(s,l,Y,fe,m,null)}an(s,_,T,j);return;case"option":for(De in m)if(m.hasOwnProperty(De)&&(_=m[De],_!=null))switch(De){case"selected":s.selected=_&&typeof _!="function"&&typeof _!="symbol";break;default:Sa(s,l,De,_,m,null)}return;case"dialog":Gr("beforetoggle",s),Gr("toggle",s),Gr("cancel",s),Gr("close",s);break;case"iframe":case"object":Gr("load",s);break;case"video":case"audio":for(_=0;_<m0.length;_++)Gr(m0[_],s);break;case"image":Gr("error",s),Gr("load",s);break;case"details":Gr("toggle",s);break;case"embed":case"source":case"link":Gr("error",s),Gr("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(at in m)if(m.hasOwnProperty(at)&&(_=m[at],_!=null))switch(at){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Sa(s,l,at,_,m,null)}return;default:if(da(l)){for(yt in m)m.hasOwnProperty(yt)&&(_=m[yt],_!==void 0&&eg(s,l,yt,_,m,void 0));return}}for(fe in m)m.hasOwnProperty(fe)&&(_=m[fe],_!=null&&Sa(s,l,fe,_,m,null))}function M3(s,l,m,_){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var T=null,j=null,Y=null,fe=null,De=null,at=null,yt=null;for(mt in m){var Et=m[mt];if(m.hasOwnProperty(mt)&&Et!=null)switch(mt){case"checked":break;case"value":break;case"defaultValue":De=Et;default:_.hasOwnProperty(mt)||Sa(s,l,mt,null,_,Et)}}for(var st in _){var mt=_[st];if(Et=m[st],_.hasOwnProperty(st)&&(mt!=null||Et!=null))switch(st){case"type":j=mt;break;case"name":T=mt;break;case"checked":at=mt;break;case"defaultChecked":yt=mt;break;case"value":Y=mt;break;case"defaultValue":fe=mt;break;case"children":case"dangerouslySetInnerHTML":if(mt!=null)throw Error(n(137,l));break;default:mt!==Et&&Sa(s,l,st,mt,_,Et)}}Ya(s,Y,fe,De,at,yt,j,T);return;case"select":mt=Y=fe=st=null;for(j in m)if(De=m[j],m.hasOwnProperty(j)&&De!=null)switch(j){case"value":break;case"multiple":mt=De;default:_.hasOwnProperty(j)||Sa(s,l,j,null,_,De)}for(T in _)if(j=_[T],De=m[T],_.hasOwnProperty(T)&&(j!=null||De!=null))switch(T){case"value":st=j;break;case"defaultValue":fe=j;break;case"multiple":Y=j;default:j!==De&&Sa(s,l,T,j,_,De)}l=fe,m=Y,_=mt,st!=null?Gt(s,!!m,st,!1):!!_!=!!m&&(l!=null?Gt(s,!!m,l,!0):Gt(s,!!m,m?[]:"",!1));return;case"textarea":mt=st=null;for(fe in m)if(T=m[fe],m.hasOwnProperty(fe)&&T!=null&&!_.hasOwnProperty(fe))switch(fe){case"value":break;case"children":break;default:Sa(s,l,fe,null,_,T)}for(Y in _)if(T=_[Y],j=m[Y],_.hasOwnProperty(Y)&&(T!=null||j!=null))switch(Y){case"value":st=T;break;case"defaultValue":mt=T;break;case"children":break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(n(91));break;default:T!==j&&Sa(s,l,Y,T,_,j)}pa(s,st,mt);return;case"option":for(var lr in m)if(st=m[lr],m.hasOwnProperty(lr)&&st!=null&&!_.hasOwnProperty(lr))switch(lr){case"selected":s.selected=!1;break;default:Sa(s,l,lr,null,_,st)}for(De in _)if(st=_[De],mt=m[De],_.hasOwnProperty(De)&&st!==mt&&(st!=null||mt!=null))switch(De){case"selected":s.selected=st&&typeof st!="function"&&typeof st!="symbol";break;default:Sa(s,l,De,st,_,mt)}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 vr in m)st=m[vr],m.hasOwnProperty(vr)&&st!=null&&!_.hasOwnProperty(vr)&&Sa(s,l,vr,null,_,st);for(at in _)if(st=_[at],mt=m[at],_.hasOwnProperty(at)&&st!==mt&&(st!=null||mt!=null))switch(at){case"children":case"dangerouslySetInnerHTML":if(st!=null)throw Error(n(137,l));break;default:Sa(s,l,at,st,_,mt)}return;default:if(da(l)){for(var Ea in m)st=m[Ea],m.hasOwnProperty(Ea)&&st!==void 0&&!_.hasOwnProperty(Ea)&&eg(s,l,Ea,void 0,_,st);for(yt in _)st=_[yt],mt=m[yt],!_.hasOwnProperty(yt)||st===mt||st===void 0&&mt===void 0||eg(s,l,yt,st,_,mt);return}}for(var Xe in m)st=m[Xe],m.hasOwnProperty(Xe)&&st!=null&&!_.hasOwnProperty(Xe)&&Sa(s,l,Xe,null,_,st);for(Et in _)st=_[Et],mt=m[Et],!_.hasOwnProperty(Et)||st===mt||st==null&&mt==null||Sa(s,l,Et,st,_,mt)}function Iy(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function R3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,m=performance.getEntriesByType("resource"),_=0;_<m.length;_++){var T=m[_],j=T.transferSize,Y=T.initiatorType,fe=T.duration;if(j&&fe&&Iy(Y)){for(Y=0,fe=T.responseEnd,_+=1;_<m.length;_++){var De=m[_],at=De.startTime;if(at>fe)break;var yt=De.transferSize,Et=De.initiatorType;yt&&Iy(Et)&&(De=De.responseEnd,Y+=yt*(De<fe?1:(fe-at)/(De-at)))}if(--_,l+=8*(j+Y)/(T.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var tg=null,rg=null;function ef(s){return s.nodeType===9?s:s.ownerDocument}function Ly(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Py(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function ag(s,l){return s==="textarea"||s==="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 ng=null;function D3(){var s=window.event;return s&&s.type==="popstate"?s===ng?!1:(ng=s,!0):(ng=null,!1)}var Fy=typeof setTimeout=="function"?setTimeout:void 0,I3=typeof clearTimeout=="function"?clearTimeout:void 0,By=typeof Promise=="function"?Promise:void 0,L3=typeof queueMicrotask=="function"?queueMicrotask:typeof By!="undefined"?function(s){return By.resolve(null).then(s).catch(P3)}:Fy;function P3(s){setTimeout(function(){throw s})}function bl(s){return s==="head"}function Uy(s,l){var m=l,_=0;do{var T=m.nextSibling;if(s.removeChild(m),T&&T.nodeType===8)if(m=T.data,m==="/$"||m==="/&"){if(_===0){s.removeChild(T),ed(l);return}_--}else if(m==="$"||m==="$?"||m==="$~"||m==="$!"||m==="&")_++;else if(m==="html")x0(s.ownerDocument.documentElement);else if(m==="head"){m=s.ownerDocument.head,x0(m);for(var j=m.firstChild;j;){var Y=j.nextSibling,fe=j.nodeName;j[et]||fe==="SCRIPT"||fe==="STYLE"||fe==="LINK"&&j.rel.toLowerCase()==="stylesheet"||m.removeChild(j),j=Y}}else m==="body"&&x0(s.ownerDocument.body);m=T}while(m);ed(l)}function zy(s,l){var m=s;s=0;do{var _=m.nextSibling;if(m.nodeType===1?l?(m._stashedDisplay=m.style.display,m.style.display="none"):(m.style.display=m._stashedDisplay||"",m.getAttribute("style")===""&&m.removeAttribute("style")):m.nodeType===3&&(l?(m._stashedText=m.nodeValue,m.nodeValue=""):m.nodeValue=m._stashedText||""),_&&_.nodeType===8)if(m=_.data,m==="/$"){if(s===0)break;s--}else m!=="$"&&m!=="$?"&&m!=="$~"&&m!=="$!"||s++;m=_}while(m)}function sg(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var m=l;switch(l=l.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":sg(m),_t(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}s.removeChild(m)}}function F3(s,l,m,_){for(;s.nodeType===1;){var T=m;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!_&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(_){if(!s[et])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(j=s.getAttribute("rel"),j==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(j!==T.rel||s.getAttribute("href")!==(T.href==null||T.href===""?null:T.href)||s.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin)||s.getAttribute("title")!==(T.title==null?null:T.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(j=s.getAttribute("src"),(j!==(T.src==null?null:T.src)||s.getAttribute("type")!==(T.type==null?null:T.type)||s.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin))&&j&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var j=T.name==null?null:""+T.name;if(T.type==="hidden"&&s.getAttribute("name")===j)return s}else return s;if(s=_i(s.nextSibling),s===null)break}return null}function B3(s,l,m){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!m||(s=_i(s.nextSibling),s===null))return null;return s}function Hy(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=_i(s.nextSibling),s===null))return null;return s}function ig(s){return s.data==="$?"||s.data==="$~"}function og(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function U3(s,l){var m=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||m.readyState!=="loading")l();else{var _=function(){l(),m.removeEventListener("DOMContentLoaded",_)};m.addEventListener("DOMContentLoaded",_),s._reactRetry=_}}function _i(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var lg=null;function Wy(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var m=s.data;if(m==="/$"||m==="/&"){if(l===0)return _i(s.nextSibling);l--}else m!=="$"&&m!=="$!"&&m!=="$?"&&m!=="$~"&&m!=="&"||l++}s=s.nextSibling}return null}function Vy(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var m=s.data;if(m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"){if(l===0)return s;l--}else m!=="/$"&&m!=="/&"||l++}s=s.previousSibling}return null}function Gy(s,l,m){switch(l=ef(m),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function x0(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);_t(s)}var wi=new Map,Xy=new Set;function tf(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Uo=re.d;re.d={f:z3,r:H3,D:W3,C:V3,L:G3,m:X3,X:Z3,S:Y3,M:$3};function z3(){var s=Uo.f(),l=Xu();return s||l}function H3(s){var l=Ot(s);l!==null&&l.tag===5&&l.type==="form"?c1(l):Uo.r(s)}var Kc=typeof document=="undefined"?null:document;function Yy(s,l,m){var _=Kc;if(_&&typeof l=="string"&&l){var T=pr(l);T='link[rel="'+s+'"][href="'+T+'"]',typeof m=="string"&&(T+='[crossorigin="'+m+'"]'),Xy.has(T)||(Xy.add(T),s={rel:s,crossOrigin:m,href:l},_.querySelector(T)===null&&(l=_.createElement("link"),qn(l,"link",s),nr(l),_.head.appendChild(l)))}}function W3(s){Uo.D(s),Yy("dns-prefetch",s,null)}function V3(s,l){Uo.C(s,l),Yy("preconnect",s,l)}function G3(s,l,m){Uo.L(s,l,m);var _=Kc;if(_&&s&&l){var T='link[rel="preload"][as="'+pr(l)+'"]';l==="image"&&m&&m.imageSrcSet?(T+='[imagesrcset="'+pr(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(T+='[imagesizes="'+pr(m.imageSizes)+'"]')):T+='[href="'+pr(s)+'"]';var j=T;switch(l){case"style":j=Jc(s);break;case"script":j=Qc(s)}wi.has(j)||(s=N({rel:"preload",href:l==="image"&&m&&m.imageSrcSet?void 0:s,as:l},m),wi.set(j,s),_.querySelector(T)!==null||l==="style"&&_.querySelector(p0(j))||l==="script"&&_.querySelector(y0(j))||(l=_.createElement("link"),qn(l,"link",s),nr(l),_.head.appendChild(l)))}}function X3(s,l){Uo.m(s,l);var m=Kc;if(m&&s){var _=l&&typeof l.as=="string"?l.as:"script",T='link[rel="modulepreload"][as="'+pr(_)+'"][href="'+pr(s)+'"]',j=T;switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Qc(s)}if(!wi.has(j)&&(s=N({rel:"modulepreload",href:s},l),wi.set(j,s),m.querySelector(T)===null)){switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(y0(j)))return}_=m.createElement("link"),qn(_,"link",s),nr(_),m.head.appendChild(_)}}}function Y3(s,l,m){Uo.S(s,l,m);var _=Kc;if(_&&s){var T=Ut(_).hoistableStyles,j=Jc(s);l=l||"default";var Y=T.get(j);if(!Y){var fe={loading:0,preload:null};if(Y=_.querySelector(p0(j)))fe.loading=5;else{s=N({rel:"stylesheet",href:s,"data-precedence":l},m),(m=wi.get(j))&&cg(s,m);var De=Y=_.createElement("link");nr(De),qn(De,"link",s),De._p=new Promise(function(at,yt){De.onload=at,De.onerror=yt}),De.addEventListener("load",function(){fe.loading|=1}),De.addEventListener("error",function(){fe.loading|=2}),fe.loading|=4,rf(Y,l,_)}Y={type:"stylesheet",instance:Y,count:1,state:fe},T.set(j,Y)}}}function Z3(s,l){Uo.X(s,l);var m=Kc;if(m&&s){var _=Ut(m).hoistableScripts,T=Qc(s),j=_.get(T);j||(j=m.querySelector(y0(T)),j||(s=N({src:s,async:!0},l),(l=wi.get(T))&&dg(s,l),j=m.createElement("script"),nr(j),qn(j,"link",s),m.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},_.set(T,j))}}function $3(s,l){Uo.M(s,l);var m=Kc;if(m&&s){var _=Ut(m).hoistableScripts,T=Qc(s),j=_.get(T);j||(j=m.querySelector(y0(T)),j||(s=N({src:s,async:!0,type:"module"},l),(l=wi.get(T))&&dg(s,l),j=m.createElement("script"),nr(j),qn(j,"link",s),m.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},_.set(T,j))}}function Zy(s,l,m,_){var T=(T=pe.current)?tf(T):null;if(!T)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(l=Jc(m.href),m=Ut(T).hoistableStyles,_=m.get(l),_||(_={type:"style",instance:null,count:0,state:null},m.set(l,_)),_):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){s=Jc(m.href);var j=Ut(T).hoistableStyles,Y=j.get(s);if(Y||(T=T.ownerDocument||T,Y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(s,Y),(j=T.querySelector(p0(s)))&&!j._p&&(Y.instance=j,Y.state.loading=5),wi.has(s)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},wi.set(s,m),j||q3(T,s,m,Y.state))),l&&_===null)throw Error(n(528,""));return Y}if(l&&_!==null)throw Error(n(529,""));return null;case"script":return l=m.async,m=m.src,typeof m=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Qc(m),m=Ut(T).hoistableScripts,_=m.get(l),_||(_={type:"script",instance:null,count:0,state:null},m.set(l,_)),_):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Jc(s){return'href="'+pr(s)+'"'}function p0(s){return'link[rel="stylesheet"]['+s+"]"}function $y(s){return N({},s,{"data-precedence":s.precedence,precedence:null})}function q3(s,l,m,_){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?_.loading=1:(l=s.createElement("link"),_.preload=l,l.addEventListener("load",function(){return _.loading|=1}),l.addEventListener("error",function(){return _.loading|=2}),qn(l,"link",m),nr(l),s.head.appendChild(l))}function Qc(s){return'[src="'+pr(s)+'"]'}function y0(s){return"script[async]"+s}function qy(s,l,m){if(l.count++,l.instance===null)switch(l.type){case"style":var _=s.querySelector('style[data-href~="'+pr(m.href)+'"]');if(_)return l.instance=_,nr(_),_;var T=N({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return _=(s.ownerDocument||s).createElement("style"),nr(_),qn(_,"style",T),rf(_,m.precedence,s),l.instance=_;case"stylesheet":T=Jc(m.href);var j=s.querySelector(p0(T));if(j)return l.state.loading|=4,l.instance=j,nr(j),j;_=$y(m),(T=wi.get(T))&&cg(_,T),j=(s.ownerDocument||s).createElement("link"),nr(j);var Y=j;return Y._p=new Promise(function(fe,De){Y.onload=fe,Y.onerror=De}),qn(j,"link",_),l.state.loading|=4,rf(j,m.precedence,s),l.instance=j;case"script":return j=Qc(m.src),(T=s.querySelector(y0(j)))?(l.instance=T,nr(T),T):(_=m,(T=wi.get(j))&&(_=N({},m),dg(_,T)),s=s.ownerDocument||s,T=s.createElement("script"),nr(T),qn(T,"link",_),s.head.appendChild(T),l.instance=T);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(_=l.instance,l.state.loading|=4,rf(_,m.precedence,s));return l.instance}function rf(s,l,m){for(var _=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),T=_.length?_[_.length-1]:null,j=T,Y=0;Y<_.length;Y++){var fe=_[Y];if(fe.dataset.precedence===l)j=fe;else if(j!==T)break}j?j.parentNode.insertBefore(s,j.nextSibling):(l=m.nodeType===9?m.head:m,l.insertBefore(s,l.firstChild))}function cg(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function dg(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var af=null;function Ky(s,l,m){if(af===null){var _=new Map,T=af=new Map;T.set(m,_)}else T=af,_=T.get(m),_||(_=new Map,T.set(m,_));if(_.has(s))return _;for(_.set(s,null),m=m.getElementsByTagName(s),T=0;T<m.length;T++){var j=m[T];if(!(j[et]||j[xe]||s==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var Y=j.getAttribute(l)||"";Y=s+Y;var fe=_.get(Y);fe?fe.push(j):_.set(Y,[j])}}return _}function Jy(s,l,m){s=s.ownerDocument||s,s.head.insertBefore(m,l==="title"?s.querySelector("head > title"):null)}function K3(s,l,m){if(m===1||l.itemProp!=null)return!1;switch(s){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 s=l.disabled,typeof l.precedence=="string"&&s==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 Qy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function J3(s,l,m,_){if(m.type==="stylesheet"&&(typeof _.media!="string"||matchMedia(_.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var T=Jc(_.href),j=l.querySelector(p0(T));if(j){l=j._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=nf.bind(s),l.then(s,s)),m.state.loading|=4,m.instance=j,nr(j);return}j=l.ownerDocument||l,_=$y(_),(T=wi.get(T))&&cg(_,T),j=j.createElement("link"),nr(j);var Y=j;Y._p=new Promise(function(fe,De){Y.onload=fe,Y.onerror=De}),qn(j,"link",_),m.instance=j}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(m,l),(l=m.state.preload)&&(m.state.loading&3)===0&&(s.count++,m=nf.bind(s),l.addEventListener("load",m),l.addEventListener("error",m))}}var ug=0;function Q3(s,l){return s.stylesheets&&s.count===0&&of(s,s.stylesheets),0<s.count||0<s.imgCount?function(m){var _=setTimeout(function(){if(s.stylesheets&&of(s,s.stylesheets),s.unsuspend){var j=s.unsuspend;s.unsuspend=null,j()}},6e4+l);0<s.imgBytes&&ug===0&&(ug=62500*R3());var T=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&of(s,s.stylesheets),s.unsuspend)){var j=s.unsuspend;s.unsuspend=null,j()}},(s.imgBytes>ug?50:800)+l);return s.unsuspend=m,function(){s.unsuspend=null,clearTimeout(_),clearTimeout(T)}}:null}function nf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)of(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var sf=null;function of(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,sf=new Map,l.forEach(ek,s),sf=null,nf.call(s))}function ek(s,l){if(!(l.state.loading&4)){var m=sf.get(s);if(m)var _=m.get(null);else{m=new Map,sf.set(s,m);for(var T=s.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<T.length;j++){var Y=T[j];(Y.nodeName==="LINK"||Y.getAttribute("media")!=="not all")&&(m.set(Y.dataset.precedence,Y),_=Y)}_&&m.set(null,_)}T=l.instance,Y=T.getAttribute("data-precedence"),j=m.get(Y)||_,j===_&&m.set(null,T),m.set(Y,T),this.count++,_=nf.bind(this),T.addEventListener("load",_),T.addEventListener("error",_),j?j.parentNode.insertBefore(T,j.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(T,s.firstChild)),l.state.loading|=4}}var b0={$$typeof:U,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function tk(s,l,m,_,T,j,Y,fe,De){this.tag=1,this.containerInfo=s,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=_n(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_n(0),this.hiddenUpdates=_n(null),this.identifierPrefix=_,this.onUncaughtError=T,this.onCaughtError=j,this.onRecoverableError=Y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=De,this.incompleteTransitions=new Map}function e2(s,l,m,_,T,j,Y,fe,De,at,yt,Et){return s=new tk(s,l,m,Y,De,at,yt,Et,fe),l=1,j===!0&&(l|=24),j=ls(3,null,null,l),s.current=j,j.stateNode=s,l=Vh(),l.refCount++,s.pooledCache=l,l.refCount++,j.memoizedState={element:_,isDehydrated:m,cache:l},Zh(j),s}function t2(s){return s?(s=Eo,s):Eo}function r2(s,l,m,_,T,j){T=t2(T),_.context===null?_.context=T:_.pendingContext=T,_=ll(l),_.payload={element:m},j=j===void 0?null:j,j!==null&&(_.callback=j),m=cl(s,_,l),m!==null&&(Bs(m,s,l),Kd(m,s,l))}function a2(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var m=s.retryLane;s.retryLane=m!==0&&m<l?m:l}}function fg(s,l){a2(s,l),(s=s.alternate)&&a2(s,l)}function n2(s){if(s.tag===13||s.tag===31){var l=yi(s,67108864);l!==null&&Bs(l,s,67108864),fg(s,67108864)}}function s2(s){if(s.tag===13||s.tag===31){var l=si();l=$r(l);var m=yi(s,l);m!==null&&Bs(m,s,l),fg(s,l)}}var lf=!0;function rk(s,l,m,_){var T=be.T;be.T=null;var j=re.p;try{re.p=2,hg(s,l,m,_)}finally{re.p=j,be.T=T}}function ak(s,l,m,_){var T=be.T;be.T=null;var j=re.p;try{re.p=8,hg(s,l,m,_)}finally{re.p=j,be.T=T}}function hg(s,l,m,_){if(lf){var T=mg(_);if(T===null)Qm(s,l,_,cf,m),o2(s,_);else if(sk(T,s,l,m,_))_.stopPropagation();else if(o2(s,_),l&4&&-1<nk.indexOf(s)){for(;T!==null;){var j=Ot(T);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var Y=xr(j.pendingLanes);if(Y!==0){var fe=j;for(fe.pendingLanes|=2,fe.entangledLanes|=2;Y;){var De=1<<31-Ft(Y);fe.entanglements[1]|=De,Y&=~De}uo(j),(fa&6)===0&&(Vu=We()+500,h0(0))}}break;case 31:case 13:fe=yi(j,2),fe!==null&&Bs(fe,j,2),Xu(),fg(j,2)}if(j=mg(_),j===null&&Qm(s,l,_,cf,m),j===T)break;T=j}T!==null&&_.stopPropagation()}else Qm(s,l,_,null,m)}}function mg(s){return s=vo(s),gg(s)}var cf=null;function gg(s){if(cf=null,s=vt(s),s!==null){var l=u(s);if(l===null)s=null;else{var m=l.tag;if(m===13){if(s=f(l),s!==null)return s;s=null}else if(m===31){if(s=g(l),s!==null)return s;s=null}else if(m===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return cf=s,null}function i2(s){switch(s){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(Nt()){case At:return 2;case Qt:return 8;case cr:case He:return 32;case It:return 268435456;default:return 32}default:return 32}}var xg=!1,vl=null,_l=null,wl=null,v0=new Map,_0=new Map,kl=[],nk="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 o2(s,l){switch(s){case"focusin":case"focusout":vl=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":wl=null;break;case"pointerover":case"pointerout":v0.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":_0.delete(l.pointerId)}}function w0(s,l,m,_,T,j){return s===null||s.nativeEvent!==j?(s={blockedOn:l,domEventName:m,eventSystemFlags:_,nativeEvent:j,targetContainers:[T]},l!==null&&(l=Ot(l),l!==null&&n2(l)),s):(s.eventSystemFlags|=_,l=s.targetContainers,T!==null&&l.indexOf(T)===-1&&l.push(T),s)}function sk(s,l,m,_,T){switch(l){case"focusin":return vl=w0(vl,s,l,m,_,T),!0;case"dragenter":return _l=w0(_l,s,l,m,_,T),!0;case"mouseover":return wl=w0(wl,s,l,m,_,T),!0;case"pointerover":var j=T.pointerId;return v0.set(j,w0(v0.get(j)||null,s,l,m,_,T)),!0;case"gotpointercapture":return j=T.pointerId,_0.set(j,w0(_0.get(j)||null,s,l,m,_,T)),!0}return!1}function l2(s){var l=vt(s.target);if(l!==null){var m=u(l);if(m!==null){if(l=m.tag,l===13){if(l=f(m),l!==null){s.blockedOn=l,Z(s.priority,function(){s2(m)});return}}else if(l===31){if(l=g(m),l!==null){s.blockedOn=l,Z(s.priority,function(){s2(m)});return}}else if(l===3&&m.stateNode.current.memoizedState.isDehydrated){s.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}s.blockedOn=null}function df(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var m=mg(s.nativeEvent);if(m===null){m=s.nativeEvent;var _=new m.constructor(m.type,m);eo=_,m.target.dispatchEvent(_),eo=null}else return l=Ot(m),l!==null&&n2(l),s.blockedOn=m,!1;l.shift()}return!0}function c2(s,l,m){df(s)&&m.delete(l)}function ik(){xg=!1,vl!==null&&df(vl)&&(vl=null),_l!==null&&df(_l)&&(_l=null),wl!==null&&df(wl)&&(wl=null),v0.forEach(c2),_0.forEach(c2)}function uf(s,l){s.blockedOn===l&&(s.blockedOn=null,xg||(xg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ik)))}var ff=null;function d2(s){ff!==s&&(ff=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ff===s&&(ff=null);for(var l=0;l<s.length;l+=3){var m=s[l],_=s[l+1],T=s[l+2];if(typeof _!="function"){if(gg(_||m)===null)continue;break}var j=Ot(m);j!==null&&(s.splice(l,3),l-=3,mm(j,{pending:!0,data:T,method:m.method,action:_},_,T))}}))}function ed(s){function l(De){return uf(De,s)}vl!==null&&uf(vl,s),_l!==null&&uf(_l,s),wl!==null&&uf(wl,s),v0.forEach(l),_0.forEach(l);for(var m=0;m<kl.length;m++){var _=kl[m];_.blockedOn===s&&(_.blockedOn=null)}for(;0<kl.length&&(m=kl[0],m.blockedOn===null);)l2(m),m.blockedOn===null&&kl.shift();if(m=(s.ownerDocument||s).$$reactFormReplay,m!=null)for(_=0;_<m.length;_+=3){var T=m[_],j=m[_+1],Y=T[ye]||null;if(typeof j=="function")Y||d2(m);else if(Y){var fe=null;if(j&&j.hasAttribute("formAction")){if(T=j,Y=j[ye]||null)fe=Y.formAction;else if(gg(T)!==null)continue}else fe=Y.action;typeof fe=="function"?m[_+1]=fe:(m.splice(_,3),_-=3),d2(m)}}}function u2(){function s(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(Y){return T=Y})},focusReset:"manual",scroll:"manual"})}function l(){T!==null&&(T(),T=null),_||setTimeout(m,20)}function m(){if(!_&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var _=!1,T=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(m,100),function(){_=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),T!==null&&(T(),T=null)}}}function pg(s){this._internalRoot=s}hf.prototype.render=pg.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var m=l.current,_=si();r2(m,_,s,l,null,null)},hf.prototype.unmount=pg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;r2(s.current,2,null,s,null,null),Xu(),l[Ee]=null}};function hf(s){this._internalRoot=s}hf.prototype.unstable_scheduleHydration=function(s){if(s){var l=ie();s={blockedOn:null,target:s,priority:l};for(var m=0;m<kl.length&&l!==0&&l<kl[m].priority;m++);kl.splice(m,0,s),m===0&&l2(s)}};var f2=r.version;if(f2!=="19.2.1")throw Error(n(527,f2,"19.2.1"));re.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=p(l),s=s!==null?k(s):null,s=s===null?null:s.stateNode,s};var ok={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:be,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var mf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mf.isDisabled&&mf.supportsFiber)try{Ye=mf.inject(ok),Ge=mf}catch(s){}}return N0.createRoot=function(s,l){if(!o(s))throw Error(n(299));var m=!1,_="",T=b1,j=v1,Y=_1;return l!=null&&(l.unstable_strictMode===!0&&(m=!0),l.identifierPrefix!==void 0&&(_=l.identifierPrefix),l.onUncaughtError!==void 0&&(T=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(Y=l.onRecoverableError)),l=e2(s,1,!1,null,null,m,_,null,T,j,Y,u2),s[Ee]=l.current,Jm(s),new pg(l)},N0.hydrateRoot=function(s,l,m){if(!o(s))throw Error(n(299));var _=!1,T="",j=b1,Y=v1,fe=_1,De=null;return m!=null&&(m.unstable_strictMode===!0&&(_=!0),m.identifierPrefix!==void 0&&(T=m.identifierPrefix),m.onUncaughtError!==void 0&&(j=m.onUncaughtError),m.onCaughtError!==void 0&&(Y=m.onCaughtError),m.onRecoverableError!==void 0&&(fe=m.onRecoverableError),m.formState!==void 0&&(De=m.formState)),l=e2(s,1,!0,l,m!=null?m:null,_,T,De,j,Y,fe,u2),l.context=t2(null),m=l.current,_=si(),_=$r(_),T=ll(_),T.callback=null,cl(m,T,_),m=_,l.current.lanes=m,fn(l,m),uo(l),s[Ee]=l.current,Jm(s),new hf(l)},N0.version="19.2.1",N0}var S2;function wk(){if(S2)return kg.exports;S2=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(r){console.error(r)}}return e(),kg.exports=_k(),kg.exports}var kk=wk();const Er=e=>typeof e=="string",S0=()=>{let e,r;const t=new Promise((n,o)=>{e=n,r=o});return t.resolve=e,t.reject=r,t},E2=e=>e==null?"":""+e,Nk=(e,r,t)=>{e.forEach(n=>{r[n]&&(t[n]=r[n])})},Sk=/###/g,C2=e=>e&&e.indexOf("###")>-1?e.replace(Sk,"."):e,T2=e=>!e||Er(e),R0=(e,r,t)=>{const n=Er(r)?r.split("."):r;let o=0;for(;o<n.length-1;){if(T2(e))return{};const u=C2(n[o]);!e[u]&&t&&(e[u]=new t),Object.prototype.hasOwnProperty.call(e,u)?e=e[u]:e={},++o}return T2(e)?{}:{obj:e,k:C2(n[o])}},A2=(e,r,t)=>{const{obj:n,k:o}=R0(e,r,Object);if(n!==void 0||r.length===1){n[o]=t;return}let u=r[r.length-1],f=r.slice(0,r.length-1),g=R0(e,f,Object);for(;g.obj===void 0&&f.length;)u=`${f[f.length-1]}.${u}`,f=f.slice(0,f.length-1),g=R0(e,f,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${u}`]!="undefined"&&(g.obj=void 0);g.obj[`${g.k}.${u}`]=t},Ek=(e,r,t,n)=>{const{obj:o,k:u}=R0(e,r,Object);o[u]=o[u]||[],o[u].push(t)},Bf=(e,r)=>{const{obj:t,k:n}=R0(e,r);if(t&&Object.prototype.hasOwnProperty.call(t,n))return t[n]},Ck=(e,r,t)=>{const n=Bf(e,t);return n!==void 0?n:Bf(r,t)},Ov=(e,r,t)=>{for(const n in r)n!=="__proto__"&&n!=="constructor"&&(n in e?Er(e[n])||e[n]instanceof String||Er(r[n])||r[n]instanceof String?t&&(e[n]=r[n]):Ov(e[n],r[n],t):e[n]=r[n]);return e},rd=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Tk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ak=e=>Er(e)?e.replace(/[&<>"'\/]/g,r=>Tk[r]):e;class jk{constructor(r){this.capacity=r,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(r){const t=this.regExpMap.get(r);if(t!==void 0)return t;const n=new RegExp(r);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(r,n),this.regExpQueue.push(r),n}}const Ok=[" ",",","?","!",";"],Mk=new jk(20),Rk=(e,r,t)=>{r=r||"",t=t||"";const n=Ok.filter(f=>r.indexOf(f)<0&&t.indexOf(f)<0);if(n.length===0)return!0;const o=Mk.getRegExp(`(${n.map(f=>f==="?"?"\\?":f).join("|")})`);let u=!o.test(e);if(!u){const f=e.indexOf(t);f>0&&!o.test(e.substring(0,f))&&(u=!0)}return u},Qg=(e,r,t=".")=>{if(!e)return;if(e[r])return Object.prototype.hasOwnProperty.call(e,r)?e[r]:void 0;const n=r.split(t);let o=e;for(let u=0;u<n.length;){if(!o||typeof o!="object")return;let f,g="";for(let v=u;v<n.length;++v)if(v!==u&&(g+=t),g+=n[v],f=o[g],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&v<n.length-1)continue;u+=v-u+1;break}o=f}return o},V0=e=>e==null?void 0:e.replace("_","-"),Dk={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,r){var t,n;(n=(t=console==null?void 0:console[e])==null?void 0:t.apply)==null||n.call(t,console,r)}};class Uf{constructor(r,t={}){this.init(r,t)}init(r,t={}){this.prefix=t.prefix||"i18next:",this.logger=r||Dk,this.options=t,this.debug=t.debug}log(...r){return this.forward(r,"log","",!0)}warn(...r){return this.forward(r,"warn","",!0)}error(...r){return this.forward(r,"error","")}deprecate(...r){return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}forward(r,t,n,o){return o&&!this.debug?null:(Er(r[0])&&(r[0]=`${n}${this.prefix} ${r[0]}`),this.logger[t](r))}create(r){return new Uf(this.logger,ke({prefix:`${this.prefix}:${r}:`},this.options))}clone(r){return r=r||this.options,r.prefix=r.prefix||this.prefix,new Uf(this.logger,r)}}var go=new Uf;class hh{constructor(){this.observers={}}on(r,t){return r.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const o=this.observers[n].get(t)||0;this.observers[n].set(t,o+1)}),this}off(r,t){if(this.observers[r]){if(!t){delete this.observers[r];return}this.observers[r].delete(t)}}emit(r,...t){this.observers[r]&&Array.from(this.observers[r].entries()).forEach(([o,u])=>{for(let f=0;f<u;f++)o(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,u])=>{for(let f=0;f<u;f++)o.apply(o,[r,...t])})}}class j2 extends hh{constructor(r,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=r||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(r){this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}removeNamespaces(r){const t=this.options.ns.indexOf(r);t>-1&&this.options.ns.splice(t,1)}getResource(r,t,n,o={}){var p,k;const u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;r.indexOf(".")>-1?g=r.split("."):(g=[r,t],n&&(Array.isArray(n)?g.push(...n):Er(n)&&u?g.push(...n.split(u)):g.push(n)));const v=Bf(this.data,g);return!v&&!t&&!n&&r.indexOf(".")>-1&&(r=g[0],t=g[1],n=g.slice(2).join(".")),v||!f||!Er(n)?v:Qg((k=(p=this.data)==null?void 0:p[r])==null?void 0:k[t],n,u)}addResource(r,t,n,o,u={silent:!1}){const f=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator;let g=[r,t];n&&(g=g.concat(f?n.split(f):n)),r.indexOf(".")>-1&&(g=r.split("."),o=t,t=g[1]),this.addNamespaces(t),A2(this.data,g,o),u.silent||this.emit("added",r,t,n,o)}addResources(r,t,n,o={silent:!1}){for(const u in n)(Er(n[u])||Array.isArray(n[u]))&&this.addResource(r,t,u,n[u],{silent:!0});o.silent||this.emit("added",r,t,n)}addResourceBundle(r,t,n,o,u,f={silent:!1,skipCopy:!1}){let g=[r,t];r.indexOf(".")>-1&&(g=r.split("."),o=n,n=t,t=g[1]),this.addNamespaces(t);let v=Bf(this.data,g)||{};f.skipCopy||(n=JSON.parse(JSON.stringify(n))),o?Ov(v,n,u):v=ke(ke({},v),n),A2(this.data,g,v),f.silent||this.emit("added",r,t,n)}removeResourceBundle(r,t){this.hasResourceBundle(r,t)&&delete this.data[r][t],this.removeNamespaces(t),this.emit("removed",r,t)}hasResourceBundle(r,t){return this.getResource(r,t)!==void 0}getResourceBundle(r,t){return t||(t=this.options.defaultNS),this.getResource(r,t)}getDataByLanguage(r){return this.data[r]}hasLanguageSomeTranslations(r){const t=this.getDataByLanguage(r);return!!(t&&Object.keys(t)||[]).find(o=>t[o]&&Object.keys(t[o]).length>0)}toJSON(){return this.data}}var Mv={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,r,t,n,o){return e.forEach(u=>{var f,g;r=(g=(f=this.processors[u])==null?void 0:f.process(r,t,n,o))!=null?g:r}),r}};const Rv=Symbol("i18next/PATH_KEY");function Ik(){const e=[],r=Object.create(null);let t;return r.get=(n,o)=>{var u;return(u=t==null?void 0:t.revoke)==null||u.call(t),o===Rv?e:(e.push(o),t=Proxy.revocable(n,r),t.proxy)},Proxy.revocable(Object.create(null),r).proxy}function ex(e,r){var n;const{[Rv]:t}=e(Ik());return t.join((n=r==null?void 0:r.keySeparator)!=null?n:".")}const O2={},Cg=e=>!Er(e)&&typeof e!="boolean"&&typeof e!="number";class zf extends hh{constructor(r,t={}){super(),Nk(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=go.create("translator")}changeLanguage(r){r&&(this.language=r)}exists(r,t={interpolation:{}}){const n=ke({},t);if(r==null)return!1;const o=this.resolve(r,n);if((o==null?void 0:o.res)===void 0)return!1;const u=Cg(o.res);return!(n.returnObjects===!1&&u)}extractFromKey(r,t){let n=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const o=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let u=t.ns||this.options.defaultNS||[];const f=n&&r.indexOf(n)>-1,g=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Rk(r,n,o);if(f&&!g){const v=r.match(this.interpolator.nestingRegexp);if(v&&v.length>0)return{key:r,namespaces:Er(u)?[u]:u};const p=r.split(n);(n!==o||n===o&&this.options.ns.indexOf(p[0])>-1)&&(u=p.shift()),r=p.join(o)}return{key:r,namespaces:Er(u)?[u]:u}}translate(r,t,n){let o=typeof t=="object"?ke({},t):t;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o=ke({},o)),o||(o={}),r==null)return"";typeof r=="function"&&(r=ex(r,ke(ke({},this.options),o))),Array.isArray(r)||(r=[String(r)]);const u=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:g,namespaces:v}=this.extractFromKey(r[r.length-1],o),p=v[v.length-1];let k=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;k===void 0&&(k=":");const N=o.lng||this.language,C=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((N==null?void 0:N.toLowerCase())==="cimode")return C?u?{res:`${p}${k}${g}`,usedKey:g,exactUsedKey:g,usedLng:N,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${k}${g}`:u?{res:g,usedKey:g,exactUsedKey:g,usedLng:N,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:g;const O=this.resolve(r,o);let I=O==null?void 0:O.res;const M=(O==null?void 0:O.usedKey)||g,D=(O==null?void 0:O.exactUsedKey)||g,z=["[object Number]","[object Function]","[object RegExp]"],B=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,H=o.count!==void 0&&!Er(o.count),q=zf.hasDefaultValue(o),ne=H?this.pluralResolver.getSuffix(N,o.count,o):"",V=o.ordinal&&H?this.pluralResolver.getSuffix(N,o.count,{ordinal:!1}):"",J=H&&!o.ordinal&&o.count===0,Q=J&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${ne}`]||o[`defaultValue${V}`]||o.defaultValue;let Te=I;U&&!I&&q&&(Te=Q);const je=Cg(Te),me=Object.prototype.toString.apply(Te);if(U&&Te&&je&&z.indexOf(me)<0&&!(Er(B)&&Array.isArray(Te))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Se=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,Te,Ve(ke({},o),{ns:v})):`key '${g} (${this.language})' returned an object instead of string.`;return u?(O.res=Se,O.usedParams=this.getUsedParamsDetails(o),O):Se}if(f){const Se=Array.isArray(Te),Oe=Se?[]:{},ue=Se?D:M;for(const be in Te)if(Object.prototype.hasOwnProperty.call(Te,be)){const re=`${ue}${f}${be}`;q&&!I?Oe[be]=this.translate(re,Ve(ke({},o),{defaultValue:Cg(Q)?Q[be]:void 0,joinArrays:!1,ns:v})):Oe[be]=this.translate(re,Ve(ke({},o),{joinArrays:!1,ns:v})),Oe[be]===re&&(Oe[be]=Te[be])}I=Oe}}else if(U&&Er(B)&&Array.isArray(I))I=I.join(B),I&&(I=this.extendTranslation(I,r,o,n));else{let Se=!1,Oe=!1;!this.isValidLookup(I)&&q&&(Se=!0,I=Q),this.isValidLookup(I)||(Oe=!0,I=g);const be=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Oe?void 0:I,re=q&&Q!==I&&this.options.updateMissing;if(Oe||Se||re){if(this.logger.log(re?"updateKey":"missingKey",N,p,g,re?Q:I),f){const K=this.resolve(g,Ve(ke({},o),{keySeparator:!1}));K&&K.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 de=[];const Ae=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ae&&Ae[0])for(let K=0;K<Ae.length;K++)de.push(Ae[K]);else this.options.saveMissingTo==="all"?de=this.languageUtils.toResolveHierarchy(o.lng||this.language):de.push(o.lng||this.language);const _e=(K,W,ae)=>{var he;const se=q&&ae!==I?ae:be;this.options.missingKeyHandler?this.options.missingKeyHandler(K,p,W,se,re,o):(he=this.backendConnector)!=null&&he.saveMissing&&this.backendConnector.saveMissing(K,p,W,se,re,o),this.emit("missingKey",K,p,W,I)};this.options.saveMissing&&(this.options.saveMissingPlurals&&H?de.forEach(K=>{const W=this.pluralResolver.getSuffixes(K,o);J&&o[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(ae=>{_e([K],g+ae,o[`defaultValue${ae}`]||Q)})}):_e(de,g,Q))}I=this.extendTranslation(I,r,o,O,n),Oe&&I===g&&this.options.appendNamespaceToMissingKey&&(I=`${p}${k}${g}`),(Oe||Se)&&this.options.parseMissingKeyHandler&&(I=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${k}${g}`:g,Se?I:void 0,o))}return u?(O.res=I,O.usedParams=this.getUsedParamsDetails(o),O):I}extendTranslation(r,t,n,o,u){var v,p;if((v=this.i18nFormat)!=null&&v.parse)r=this.i18nFormat.parse(r,ke(ke({},this.options.interpolation.defaultVariables),n),n.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(Ve(ke({},n),{interpolation:ke(ke({},this.options.interpolation),n.interpolation)}));const k=Er(r)&&(((p=n==null?void 0:n.interpolation)==null?void 0:p.skipOnVariables)!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let N;if(k){const O=r.match(this.interpolator.nestingRegexp);N=O&&O.length}let C=n.replace&&!Er(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(C=ke(ke({},this.options.interpolation.defaultVariables),C)),r=this.interpolator.interpolate(r,C,n.lng||this.language||o.usedLng,n),k){const O=r.match(this.interpolator.nestingRegexp),I=O&&O.length;N<I&&(n.nest=!1)}!n.lng&&o&&o.res&&(n.lng=this.language||o.usedLng),n.nest!==!1&&(r=this.interpolator.nest(r,(...O)=>(u==null?void 0:u[0])===O[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${O[0]} in key: ${t[0]}`),null):this.translate(...O,t),n)),n.interpolation&&this.interpolator.reset()}const f=n.postProcess||this.options.postProcess,g=Er(f)?[f]:f;return r!=null&&(g!=null&&g.length)&&n.applyPostProcessor!==!1&&(r=Mv.handle(g,r,t,this.options&&this.options.postProcessPassResolved?ke({i18nResolved:Ve(ke({},o),{usedParams:this.getUsedParamsDetails(n)})},n):n,this)),r}resolve(r,t={}){let n,o,u,f,g;return Er(r)&&(r=[r]),r.forEach(v=>{if(this.isValidLookup(n))return;const p=this.extractFromKey(v,t),k=p.key;o=k;let N=p.namespaces;this.options.fallbackNS&&(N=N.concat(this.options.fallbackNS));const C=t.count!==void 0&&!Er(t.count),O=C&&!t.ordinal&&t.count===0,I=t.context!==void 0&&(Er(t.context)||typeof t.context=="number")&&t.context!=="",M=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);N.forEach(D=>{var z,B;this.isValidLookup(n)||(g=D,!O2[`${M[0]}-${D}`]&&((z=this.utils)!=null&&z.hasLoadedNamespace)&&!((B=this.utils)!=null&&B.hasLoadedNamespace(g))&&(O2[`${M[0]}-${D}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${g}" 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!!!")),M.forEach(U=>{var ne;if(this.isValidLookup(n))return;f=U;const H=[k];if((ne=this.i18nFormat)!=null&&ne.addLookupKeys)this.i18nFormat.addLookupKeys(H,k,U,D,t);else{let V;C&&(V=this.pluralResolver.getSuffix(U,t.count,t));const J=`${this.options.pluralSeparator}zero`,Q=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(C&&(t.ordinal&&V.indexOf(Q)===0&&H.push(k+V.replace(Q,this.options.pluralSeparator)),H.push(k+V),O&&H.push(k+J)),I){const Te=`${k}${this.options.contextSeparator||"_"}${t.context}`;H.push(Te),C&&(t.ordinal&&V.indexOf(Q)===0&&H.push(Te+V.replace(Q,this.options.pluralSeparator)),H.push(Te+V),O&&H.push(Te+J))}}let q;for(;q=H.pop();)this.isValidLookup(n)||(u=q,n=this.getResource(U,D,q,t))}))})}),{res:n,usedKey:o,exactUsedKey:u,usedLng:f,usedNS:g}}isValidLookup(r){return r!==void 0&&!(!this.options.returnNull&&r===null)&&!(!this.options.returnEmptyString&&r==="")}getResource(r,t,n,o={}){var u;return(u=this.i18nFormat)!=null&&u.getResource?this.i18nFormat.getResource(r,t,n,o):this.resourceStore.getResource(r,t,n,o)}getUsedParamsDetails(r={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=r.replace&&!Er(r.replace);let o=n?r.replace:r;if(n&&typeof r.count!="undefined"&&(o.count=r.count),this.options.interpolation.defaultVariables&&(o=ke(ke({},this.options.interpolation.defaultVariables),o)),!n){o=ke({},o);for(const u of t)delete o[u]}return o}static hasDefaultValue(r){const t="defaultValue";for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&t===n.substring(0,t.length)&&r[n]!==void 0)return!0;return!1}}class M2{constructor(r){this.options=r,this.supportedLngs=this.options.supportedLngs||!1,this.logger=go.create("languageUtils")}getScriptPartFromCode(r){if(r=V0(r),!r||r.indexOf("-")<0)return null;const t=r.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(r){if(r=V0(r),!r||r.indexOf("-")<0)return r;const t=r.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(r){if(Er(r)&&r.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(r)[0]}catch(n){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?r.toLowerCase():r)}return this.options.cleanCode||this.options.lowerCaseLng?r.toLowerCase():r}isSupportedCode(r){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(r=this.getLanguagePartFromCode(r)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(r)>-1}getBestMatchFromCodes(r){if(!r)return null;let t;return r.forEach(n=>{if(t)return;const o=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(o))&&(t=o)}),!t&&this.options.supportedLngs&&r.forEach(n=>{if(t)return;const o=this.getScriptPartFromCode(n);if(this.isSupportedCode(o))return t=o;const u=this.getLanguagePartFromCode(n);if(this.isSupportedCode(u))return t=u;t=this.options.supportedLngs.find(f=>{if(f===u)return f;if(!(f.indexOf("-")<0&&u.indexOf("-")<0)&&(f.indexOf("-")>0&&u.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===u||f.indexOf(u)===0&&u.length>1))return f})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(r,t){if(!r)return[];if(typeof r=="function"&&(r=r(t)),Er(r)&&(r=[r]),Array.isArray(r))return r;if(!t)return r.default||[];let n=r[t];return n||(n=r[this.getScriptPartFromCode(t)]),n||(n=r[this.formatLanguageCode(t)]),n||(n=r[this.getLanguagePartFromCode(t)]),n||(n=r.default),n||[]}toResolveHierarchy(r,t){const n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],r),o=[],u=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return Er(r)&&(r.indexOf("-")>-1||r.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(r)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(r)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(r))):Er(r)&&u(this.formatLanguageCode(r)),n.forEach(f=>{o.indexOf(f)<0&&u(this.formatLanguageCode(f))}),o}}const R2={zero:0,one:1,two:2,few:3,many:4,other:5},D2={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Lk{constructor(r,t={}){this.languageUtils=r,this.options=t,this.logger=go.create("pluralResolver"),this.pluralRulesCache={}}addRule(r,t){this.rules[r]=t}clearCache(){this.pluralRulesCache={}}getRule(r,t={}){const n=V0(r==="dev"?"en":r),o=t.ordinal?"ordinal":"cardinal",u=JSON.stringify({cleanedCode:n,type:o});if(u in this.pluralRulesCache)return this.pluralRulesCache[u];let f;try{f=new Intl.PluralRules(n,{type:o})}catch(g){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),D2;if(!r.match(/-|_/))return D2;const v=this.languageUtils.getLanguagePartFromCode(r);f=this.getRule(v,t)}return this.pluralRulesCache[u]=f,f}needsPlural(r,t={}){let n=this.getRule(r,t);return n||(n=this.getRule("dev",t)),(n==null?void 0:n.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(r,t,n={}){return this.getSuffixes(r,n).map(o=>`${t}${o}`)}getSuffixes(r,t={}){let n=this.getRule(r,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((o,u)=>R2[o]-R2[u]).map(o=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(r,t,n={}){const o=this.getRule(r,n);return o?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o.select(t)}`:(this.logger.warn(`no plural rule found for: ${r}`),this.getSuffix("dev",t,n))}}const I2=(e,r,t,n=".",o=!0)=>{let u=Ck(e,r,t);return!u&&o&&Er(t)&&(u=Qg(e,t,n),u===void 0&&(u=Qg(r,t,n))),u},Tg=e=>e.replace(/\$/g,"$$$$");class L2{constructor(r={}){var t;this.logger=go.create("interpolator"),this.options=r,this.format=((t=r==null?void 0:r.interpolation)==null?void 0:t.format)||(n=>n),this.init(r)}init(r={}){r.interpolation||(r.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:o,prefix:u,prefixEscaped:f,suffix:g,suffixEscaped:v,formatSeparator:p,unescapeSuffix:k,unescapePrefix:N,nestingPrefix:C,nestingPrefixEscaped:O,nestingSuffix:I,nestingSuffixEscaped:M,nestingOptionsSeparator:D,maxReplaces:z,alwaysFormat:B}=r.interpolation;this.escape=t!==void 0?t:Ak,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=u?rd(u):f||"{{",this.suffix=g?rd(g):v||"}}",this.formatSeparator=p||",",this.unescapePrefix=k?"":N||"-",this.unescapeSuffix=this.unescapePrefix?"":k||"",this.nestingPrefix=C?rd(C):O||rd("$t("),this.nestingSuffix=I?rd(I):M||rd(")"),this.nestingOptionsSeparator=D||",",this.maxReplaces=z||1e3,this.alwaysFormat=B!==void 0?B:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const r=(t,n)=>(t==null?void 0:t.source)===n?(t.lastIndex=0,t):new RegExp(n,"g");this.regexp=r(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=r(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=r(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(r,t,n,o){var O;let u,f,g;const v=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=I=>{if(I.indexOf(this.formatSeparator)<0){const B=I2(t,v,I,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(B,void 0,n,Ve(ke(ke({},o),t),{interpolationkey:I})):B}const M=I.split(this.formatSeparator),D=M.shift().trim(),z=M.join(this.formatSeparator).trim();return this.format(I2(t,v,D,this.options.keySeparator,this.options.ignoreJSONStructure),z,n,Ve(ke(ke({},o),t),{interpolationkey:D}))};this.resetRegExp();const k=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,N=((O=o==null?void 0:o.interpolation)==null?void 0:O.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:I=>Tg(I)},{regex:this.regexp,safeValue:I=>this.escapeValue?Tg(this.escape(I)):Tg(I)}].forEach(I=>{for(g=0;u=I.regex.exec(r);){const M=u[1].trim();if(f=p(M),f===void 0)if(typeof k=="function"){const z=k(r,u,o);f=Er(z)?z:""}else if(o&&Object.prototype.hasOwnProperty.call(o,M))f="";else if(N){f=u[0];continue}else this.logger.warn(`missed to pass in variable ${M} for interpolating ${r}`),f="";else!Er(f)&&!this.useRawValueToEscape&&(f=E2(f));const D=I.safeValue(f);if(r=r.replace(u[0],D),N?(I.regex.lastIndex+=f.length,I.regex.lastIndex-=u[0].length):I.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),r}nest(r,t,n={}){let o,u,f;const g=(v,p)=>{var M;const k=this.nestingOptionsSeparator;if(v.indexOf(k)<0)return v;const N=v.split(new RegExp(`${k}[ ]*{`));let C=`{${N[1]}`;v=N[0],C=this.interpolate(C,f);const O=C.match(/'/g),I=C.match(/"/g);(((M=O==null?void 0:O.length)!=null?M:0)%2===0&&!I||I.length%2!==0)&&(C=C.replace(/'/g,'"'));try{f=JSON.parse(C),p&&(f=ke(ke({},p),f))}catch(D){return this.logger.warn(`failed parsing options string in nesting for key ${v}`,D),`${v}${k}${C}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,v};for(;o=this.nestingRegexp.exec(r);){let v=[];f=ke({},n),f=f.replace&&!Er(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(v=o[1].slice(p).split(this.formatSeparator).map(k=>k.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),u=t(g.call(this,o[1].trim(),f),f),u&&o[0]===r&&!Er(u))return u;Er(u)||(u=E2(u)),u||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${r}`),u=""),v.length&&(u=v.reduce((k,N)=>this.format(k,N,n.lng,Ve(ke({},n),{interpolationkey:o[1].trim()})),u.trim())),r=r.replace(o[0],u),this.regexp.lastIndex=0}return r}}const Pk=e=>{let r=e.toLowerCase().trim();const t={};if(e.indexOf("(")>-1){const n=e.split("(");r=n[0].toLowerCase().trim();const o=n[1].substring(0,n[1].length-1);r==="currency"&&o.indexOf(":")<0?t.currency||(t.currency=o.trim()):r==="relativetime"&&o.indexOf(":")<0?t.range||(t.range=o.trim()):o.split(";").forEach(f=>{if(f){const[g,...v]=f.split(":"),p=v.join(":").trim().replace(/^'+|'+$/g,""),k=g.trim();t[k]||(t[k]=p),p==="false"&&(t[k]=!1),p==="true"&&(t[k]=!0),isNaN(p)||(t[k]=parseInt(p,10))}})}return{formatName:r,formatOptions:t}},P2=e=>{const r={};return(t,n,o)=>{let u=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(u=Ve(ke({},u),{[o.interpolationkey]:void 0}));const f=n+JSON.stringify(u);let g=r[f];return g||(g=e(V0(n),o),r[f]=g),g(t)}},Fk=e=>(r,t,n)=>e(V0(t),n)(r);class Bk{constructor(r={}){this.logger=go.create("formatter"),this.options=r,this.init(r)}init(r,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?P2:Fk;this.formats={number:n((o,u)=>{const f=new Intl.NumberFormat(o,ke({},u));return g=>f.format(g)}),currency:n((o,u)=>{const f=new Intl.NumberFormat(o,Ve(ke({},u),{style:"currency"}));return g=>f.format(g)}),datetime:n((o,u)=>{const f=new Intl.DateTimeFormat(o,ke({},u));return g=>f.format(g)}),relativetime:n((o,u)=>{const f=new Intl.RelativeTimeFormat(o,ke({},u));return g=>f.format(g,u.range||"day")}),list:n((o,u)=>{const f=new Intl.ListFormat(o,ke({},u));return g=>f.format(g)})}}add(r,t){this.formats[r.toLowerCase().trim()]=t}addCached(r,t){this.formats[r.toLowerCase().trim()]=P2(t)}format(r,t,n,o={}){const u=t.split(this.formatSeparator);if(u.length>1&&u[0].indexOf("(")>1&&u[0].indexOf(")")<0&&u.find(g=>g.indexOf(")")>-1)){const g=u.findIndex(v=>v.indexOf(")")>-1);u[0]=[u[0],...u.splice(1,g)].join(this.formatSeparator)}return u.reduce((g,v)=>{var N;const{formatName:p,formatOptions:k}=Pk(v);if(this.formats[p]){let C=g;try{const O=((N=o==null?void 0:o.formatParams)==null?void 0:N[o.interpolationkey])||{},I=O.locale||O.lng||o.locale||o.lng||n;C=this.formats[p](g,I,ke(ke(ke({},k),o),O))}catch(O){this.logger.warn(O)}return C}else this.logger.warn(`there was no format function for ${p}`);return g},r)}}const Uk=(e,r)=>{e.pending[r]!==void 0&&(delete e.pending[r],e.pendingCount--)};class zk extends hh{constructor(r,t,n,o={}){var u,f;super(),this.backend=r,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=o,this.logger=go.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(f=(u=this.backend)==null?void 0:u.init)==null||f.call(u,n,o.backend,o)}queueLoad(r,t,n,o){const u={},f={},g={},v={};return r.forEach(p=>{let k=!0;t.forEach(N=>{const C=`${p}|${N}`;!n.reload&&this.store.hasResourceBundle(p,N)?this.state[C]=2:this.state[C]<0||(this.state[C]===1?f[C]===void 0&&(f[C]=!0):(this.state[C]=1,k=!1,f[C]===void 0&&(f[C]=!0),u[C]===void 0&&(u[C]=!0),v[N]===void 0&&(v[N]=!0)))}),k||(g[p]=!0)}),(Object.keys(u).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(u),pending:Object.keys(f),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(v)}}loaded(r,t,n){const o=r.split("|"),u=o[0],f=o[1];t&&this.emit("failedLoading",u,f,t),!t&&n&&this.store.addResourceBundle(u,f,n,void 0,void 0,{skipCopy:!0}),this.state[r]=t?-1:2,t&&n&&(this.state[r]=0);const g={};this.queue.forEach(v=>{Ek(v.loaded,[u],f),Uk(v,r),t&&v.errors.push(t),v.pendingCount===0&&!v.done&&(Object.keys(v.loaded).forEach(p=>{g[p]||(g[p]={});const k=v.loaded[p];k.length&&k.forEach(N=>{g[p][N]===void 0&&(g[p][N]=!0)})}),v.done=!0,v.errors.length?v.callback(v.errors):v.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(v=>!v.done)}read(r,t,n,o=0,u=this.retryTimeout,f){if(!r.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:r,ns:t,fcName:n,tried:o,wait:u,callback:f});return}this.readingCalls++;const g=(p,k)=>{if(this.readingCalls--,this.waitingReads.length>0){const N=this.waitingReads.shift();this.read(N.lng,N.ns,N.fcName,N.tried,N.wait,N.callback)}if(p&&k&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,r,t,n,o+1,u*2,f)},u);return}f(p,k)},v=this.backend[n].bind(this.backend);if(v.length===2){try{const p=v(r,t);p&&typeof p.then=="function"?p.then(k=>g(null,k)).catch(g):g(null,p)}catch(p){g(p)}return}return v(r,t,g)}prepareLoading(r,t,n={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Er(r)&&(r=this.languageUtils.toResolveHierarchy(r)),Er(t)&&(t=[t]);const u=this.queueLoad(r,t,n,o);if(!u.toLoad.length)return u.pending.length||o(),null;u.toLoad.forEach(f=>{this.loadOne(f)})}load(r,t,n){this.prepareLoading(r,t,{},n)}reload(r,t,n){this.prepareLoading(r,t,{reload:!0},n)}loadOne(r,t=""){const n=r.split("|"),o=n[0],u=n[1];this.read(o,u,"read",void 0,void 0,(f,g)=>{f&&this.logger.warn(`${t}loading namespace ${u} for language ${o} failed`,f),!f&&g&&this.logger.log(`${t}loaded namespace ${u} for language ${o}`,g),this.loaded(r,f,g)})}saveMissing(r,t,n,o,u,f={},g=()=>{}){var v,p,k,N,C;if((p=(v=this.services)==null?void 0:v.utils)!=null&&p.hasLoadedNamespace&&!((N=(k=this.services)==null?void 0:k.utils)!=null&&N.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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(!(n==null||n==="")){if((C=this.backend)!=null&&C.create){const O=Ve(ke({},f),{isUpdate:u}),I=this.backend.create.bind(this.backend);if(I.length<6)try{let M;I.length===5?M=I(r,t,n,o,O):M=I(r,t,n,o),M&&typeof M.then=="function"?M.then(D=>g(null,D)).catch(g):g(null,M)}catch(M){g(M)}else I(r,t,n,o,g,O)}!r||!r[0]||this.store.addResource(r[0],t,n,o)}}}const F2=()=>({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 r={};if(typeof e[1]=="object"&&(r=e[1]),Er(e[1])&&(r.defaultValue=e[1]),Er(e[2])&&(r.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const t=e[3]||e[2];Object.keys(t).forEach(n=>{r[n]=t[n]})}return r},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),B2=e=>{var r,t;return Er(e.ns)&&(e.ns=[e.ns]),Er(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Er(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),((t=(r=e.supportedLngs)==null?void 0:r.indexOf)==null?void 0:t.call(r,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e},pf=()=>{},Hk=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]=="function"&&(e[t]=e[t].bind(e))})};class D0 extends hh{constructor(r={},t){if(super(),this.options=B2(r),this.services={},this.logger=go,this.modules={external:[]},Hk(this),t&&!this.isInitialized&&!r.isClone){if(!this.options.initAsync)return this.init(r,t),this;setTimeout(()=>{this.init(r,t)},0)}}init(r={},t){this.isInitializing=!0,typeof r=="function"&&(t=r,r={}),r.defaultNS==null&&r.ns&&(Er(r.ns)?r.defaultNS=r.ns:r.ns.indexOf("translation")<0&&(r.defaultNS=r.ns[0]));const n=F2();this.options=ke(ke(ke({},n),this.options),B2(r)),this.options.interpolation=ke(ke({},n.interpolation),this.options.interpolation),r.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=r.keySeparator),r.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=r.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?go.init(o(this.modules.logger),this.options):go.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Bk;const k=new M2(this.options);this.store=new j2(this.options.resources,this.options);const N=this.services;N.logger=go,N.resourceStore=this.store,N.languageUtils=k,N.pluralResolver=new Lk(k,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(N.formatter=o(p),N.formatter.init&&N.formatter.init(N,this.options),this.options.interpolation.format=N.formatter.format.bind(N.formatter)),N.interpolator=new L2(this.options),N.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},N.backendConnector=new zk(o(this.modules.backend),N.resourceStore,N,this.options),N.backendConnector.on("*",(O,...I)=>{this.emit(O,...I)}),this.modules.languageDetector&&(N.languageDetector=o(this.modules.languageDetector),N.languageDetector.init&&N.languageDetector.init(N,this.options.detection,this.options)),this.modules.i18nFormat&&(N.i18nFormat=o(this.modules.i18nFormat),N.i18nFormat.init&&N.i18nFormat.init(this)),this.translator=new zf(this.services,this.options),this.translator.on("*",(O,...I)=>{this.emit(O,...I)}),this.modules.external.forEach(O=>{O.init&&O.init(this)})}if(this.format=this.options.interpolation.format,t||(t=pf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...k)=>this.store[p](...k)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...k)=>(this.store[p](...k),this)});const g=S0(),v=()=>{const p=(k,N)=>{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),g.resolve(N),t(k,N)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?v():setTimeout(v,0),g}loadResources(r,t=pf){var u,f;let n=t;const o=Er(r)?r:this.language;if(typeof r=="function"&&(n=r),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const g=[],v=p=>{if(!p||p==="cimode")return;this.services.languageUtils.toResolveHierarchy(p).forEach(N=>{N!=="cimode"&&g.indexOf(N)<0&&g.push(N)})};o?v(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(k=>v(k)),(f=(u=this.options.preload)==null?void 0:u.forEach)==null||f.call(u,p=>v(p)),this.services.backendConnector.load(g,this.options.ns,p=>{!p&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(p)})}else n(null)}reloadResources(r,t,n){const o=S0();return typeof r=="function"&&(n=r,r=void 0),typeof t=="function"&&(n=t,t=void 0),r||(r=this.languages),t||(t=this.options.ns),n||(n=pf),this.services.backendConnector.reload(r,t,u=>{o.resolve(),n(u)}),o}use(r){if(!r)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!r.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return r.type==="backend"&&(this.modules.backend=r),(r.type==="logger"||r.log&&r.warn&&r.error)&&(this.modules.logger=r),r.type==="languageDetector"&&(this.modules.languageDetector=r),r.type==="i18nFormat"&&(this.modules.i18nFormat=r),r.type==="postProcessor"&&Mv.addPostProcessor(r),r.type==="formatter"&&(this.modules.formatter=r),r.type==="3rdParty"&&this.modules.external.push(r),this}setResolvedLanguage(r){if(!(!r||!this.languages)&&!(["cimode","dev"].indexOf(r)>-1)){for(let t=0;t<this.languages.length;t++){const n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(r)<0&&this.store.hasLanguageSomeTranslations(r)&&(this.resolvedLanguage=r,this.languages.unshift(r))}}changeLanguage(r,t){this.isLanguageChangingTo=r;const n=S0();this.emit("languageChanging",r);const o=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},u=(g,v)=>{v?this.isLanguageChangingTo===r&&(o(v),this.translator.changeLanguage(v),this.isLanguageChangingTo=void 0,this.emit("languageChanged",v),this.logger.log("languageChanged",v)):this.isLanguageChangingTo=void 0,n.resolve((...p)=>this.t(...p)),t&&t(g,(...p)=>this.t(...p))},f=g=>{var k,N;!r&&!g&&this.services.languageDetector&&(g=[]);const v=Er(g)?g:g&&g[0],p=this.store.hasLanguageSomeTranslations(v)?v:this.services.languageUtils.getBestMatchFromCodes(Er(g)?[g]:g);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),(N=(k=this.services.languageDetector)==null?void 0:k.cacheUserLanguage)==null||N.call(k,p)),this.loadResources(p,C=>{u(C,p)})};return!r&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!r&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(r),n}getFixedT(r,t,n){const o=(u,f,...g)=>{let v;typeof f!="object"?v=this.options.overloadTranslationOptionHandler([u,f].concat(g)):v=ke({},f),v.lng=v.lng||o.lng,v.lngs=v.lngs||o.lngs,v.ns=v.ns||o.ns,v.keyPrefix!==""&&(v.keyPrefix=v.keyPrefix||n||o.keyPrefix);const p=this.options.keySeparator||".";let k;return v.keyPrefix&&Array.isArray(u)?k=u.map(N=>(typeof N=="function"&&(N=ex(N,ke(ke({},this.options),f))),`${v.keyPrefix}${p}${N}`)):(typeof u=="function"&&(u=ex(u,ke(ke({},this.options),f))),k=v.keyPrefix?`${v.keyPrefix}${p}${u}`:u),this.t(k,v)};return Er(r)?o.lng=r:o.lngs=r,o.ns=t,o.keyPrefix=n,o}t(...r){var t;return(t=this.translator)==null?void 0:t.translate(...r)}exists(...r){var t;return(t=this.translator)==null?void 0:t.exists(...r)}setDefaultNamespace(r){this.options.defaultNS=r}hasLoadedNamespace(r,t={}){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 n=t.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const f=(g,v)=>{const p=this.services.backendConnector.state[`${g}|${v}`];return p===-1||p===0||p===2};if(t.precheck){const g=t.precheck(this,f);if(g!==void 0)return g}return!!(this.hasResourceBundle(n,r)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(n,r)&&(!o||f(u,r)))}loadNamespaces(r,t){const n=S0();return this.options.ns?(Er(r)&&(r=[r]),r.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{n.resolve(),t&&t(o)}),n):(t&&t(),Promise.resolve())}loadLanguages(r,t){const n=S0();Er(r)&&(r=[r]);const o=this.options.preload||[],u=r.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return u.length?(this.options.preload=o.concat(u),this.loadResources(f=>{n.resolve(),t&&t(f)}),n):(t&&t(),Promise.resolve())}dir(r){var o,u;if(r||(r=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!r)return"rtl";try{const f=new Intl.Locale(r);if(f&&f.getTextInfo){const g=f.getTextInfo();if(g&&g.direction)return g.direction}}catch(f){}const t=["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"],n=((u=this.services)==null?void 0:u.languageUtils)||new M2(F2());return r.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(n.getLanguagePartFromCode(r))>-1||r.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(r={},t){const n=new D0(r,t);return n.createInstance=D0.createInstance,n}cloneInstance(r={},t=pf){const n=r.forkResourceStore;n&&delete r.forkResourceStore;const o=Ve(ke(ke({},this.options),r),{isClone:!0}),u=new D0(o);if((r.debug!==void 0||r.prefix!==void 0)&&(u.logger=u.logger.clone(r)),["store","services","language"].forEach(g=>{u[g]=this[g]}),u.services=ke({},this.services),u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},n){const g=Object.keys(this.store.data).reduce((v,p)=>(v[p]=ke({},this.store.data[p]),v[p]=Object.keys(v[p]).reduce((k,N)=>(k[N]=ke({},v[p][N]),k),v[p]),v),{});u.store=new j2(g,o),u.services.resourceStore=u.store}return r.interpolation&&(u.services.interpolator=new L2(o)),u.translator=new zf(u.services,o),u.translator.on("*",(g,...v)=>{u.emit(g,...v)}),u.init(o,t),u.translator.options=o,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const zn=D0.createInstance();zn.createInstance;zn.dir;zn.init;zn.loadResources;zn.reloadResources;zn.use;zn.changeLanguage;zn.getFixedT;zn.t;zn.exists;zn.setDefaultNamespace;zn.hasLoadedNamespace;zn.loadNamespaces;zn.loadLanguages;const Wk=(e,r,t,n)=>{var u,f,g,v;const o=[t,ke({code:r},n||{})];if((f=(u=e==null?void 0:e.services)==null?void 0:u.logger)!=null&&f.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);uc(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(v=(g=e==null?void 0:e.services)==null?void 0:g.logger)!=null&&v.warn?e.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},U2={},Dv=(e,r,t,n)=>{uc(t)&&U2[t]||(uc(t)&&(U2[t]=new Date),Wk(e,r,t,n))},Iv=(e,r)=>()=>{if(e.isInitialized)r();else{const t=()=>{setTimeout(()=>{e.off("initialized",t)},0),r()};e.on("initialized",t)}},tx=(e,r,t)=>{e.loadNamespaces(r,Iv(e,t))},z2=(e,r,t,n)=>{if(uc(t)&&(t=[t]),e.options.preload&&e.options.preload.indexOf(r)>-1)return tx(e,t,n);t.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(r,Iv(e,n))},Vk=(e,r,t={})=>!r.languages||!r.languages.length?(Dv(r,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:r.languages}),!0):r.hasLoadedNamespace(e,{lng:t.lng,precheck:(n,o)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))return!1}}),uc=e=>typeof e=="string",Gk=e=>typeof e=="object"&&e!==null,Xk=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Yk={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Zk=e=>Yk[e],$k=e=>e.replace(Xk,Zk);let rx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$k};const qk=(e={})=>{rx=ke(ke({},rx),e)},Kk=()=>rx;let Lv;const Jk=e=>{Lv=e},Qk=()=>Lv,eN={type:"3rdParty",init(e){qk(e.options.react),Jk(e)}},tN=R.createContext();class rN{constructor(){this.usedNamespaces={}}addUsedNamespaces(r){r.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Ag={exports:{}},jg={};var H2;function aN(){if(H2)return jg;H2=1;var e=fh();function r(N,C){return N===C&&(N!==0||1/N===1/C)||N!==N&&C!==C}var t=typeof Object.is=="function"?Object.is:r,n=e.useState,o=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function g(N,C){var O=C(),I=n({inst:{value:O,getSnapshot:C}}),M=I[0].inst,D=I[1];return u(function(){M.value=O,M.getSnapshot=C,v(M)&&D({inst:M})},[N,O,C]),o(function(){return v(M)&&D({inst:M}),N(function(){v(M)&&D({inst:M})})},[N]),f(O),O}function v(N){var C=N.getSnapshot;N=N.value;try{var O=C();return!t(N,O)}catch(I){return!0}}function p(N,C){return C()}var k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?p:g;return jg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:k,jg}var W2;function nN(){return W2||(W2=1,Ag.exports=aN()),Ag.exports}var sN=nN();const iN=(e,r)=>uc(r)?r:Gk(r)&&uc(r.defaultValue)?r.defaultValue:Array.isArray(e)?e[e.length-1]:e,oN={t:iN,ready:!1},lN=()=>()=>{},Xa=(e,r={})=>{var Q,Te,je;const{i18n:t}=r,{i18n:n,defaultNS:o}=R.useContext(tN)||{},u=t||n||Qk();u&&!u.reportNamespaces&&(u.reportNamespaces=new rN),u||Dv(u,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const f=R.useMemo(()=>{var me;return ke(ke(ke({},Kk()),(me=u==null?void 0:u.options)==null?void 0:me.react),r)},[u,r]),{useSuspense:g,keyPrefix:v}=f,p=o||((Q=u==null?void 0:u.options)==null?void 0:Q.defaultNS),k=uc(p)?[p]:p||["translation"],N=R.useMemo(()=>k,k);(je=(Te=u==null?void 0:u.reportNamespaces)==null?void 0:Te.addUsedNamespaces)==null||je.call(Te,N);const C=R.useRef(0),O=R.useCallback(me=>{if(!u)return lN;const{bindI18n:Se,bindI18nStore:Oe}=f,ue=()=>{C.current+=1,me()};return Se&&u.on(Se,ue),Oe&&u.store.on(Oe,ue),()=>{Se&&Se.split(" ").forEach(be=>u.off(be,ue)),Oe&&Oe.split(" ").forEach(be=>u.store.off(be,ue))}},[u,f]),I=R.useRef(),M=R.useCallback(()=>{if(!u)return oN;const me=!!(u.isInitialized||u.initializedStoreOnce)&&N.every(de=>Vk(de,u,f)),Se=r.lng||u.language,Oe=C.current,ue=I.current;if(ue&&ue.ready===me&&ue.lng===Se&&ue.keyPrefix===v&&ue.revision===Oe)return ue;const re={t:u.getFixedT(Se,f.nsMode==="fallback"?N:N[0],v),ready:me,lng:Se,keyPrefix:v,revision:Oe};return I.current=re,re},[u,N,v,f,r.lng]),[D,z]=R.useState(0),{t:B,ready:U}=sN.useSyncExternalStore(O,M,M);R.useEffect(()=>{if(u&&!U&&!g){const me=()=>z(Se=>Se+1);r.lng?z2(u,r.lng,N,me):tx(u,N,me)}},[u,r.lng,N,U,g,D]);const H=u||{},q=R.useRef(null),ne=R.useRef(),V=me=>{const Se=Object.getOwnPropertyDescriptors(me);Se.__original&&delete Se.__original;const Oe=Object.create(Object.getPrototypeOf(me),Se);if(!Object.prototype.hasOwnProperty.call(Oe,"__original"))try{Object.defineProperty(Oe,"__original",{value:me,writable:!1,enumerable:!1,configurable:!1})}catch(ue){}return Oe},J=R.useMemo(()=>{const me=H,Se=me==null?void 0:me.language;let Oe=me;me&&(q.current&&q.current.__original===me?ne.current!==Se?(Oe=V(me),q.current=Oe,ne.current=Se):Oe=q.current:(Oe=V(me),q.current=Oe,ne.current=Se));const ue=[B,Oe,U];return ue.t=B,ue.i18n=Oe,ue.ready=U,ue},[B,H,U,H.resolvedLanguage,H.language,H.languages]);if(u&&g&&!U)throw new Promise(me=>{const Se=()=>me();r.lng?z2(u,r.lng,N,Se):tx(u,N,Se)});return J},{slice:cN,forEach:dN}=[];function uN(e){return dN.call(cN.call(arguments,1),r=>{if(r)for(const t in r)e[t]===void 0&&(e[t]=r[t])}),e}function fN(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(t=>t.test(e))}const V2=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,hN=function(e,r){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(r);let u=`${e}=${o}`;if(n.maxAge>0){const f=n.maxAge-0;if(Number.isNaN(f))throw new Error("maxAge should be a Number");u+=`; Max-Age=${Math.floor(f)}`}if(n.domain){if(!V2.test(n.domain))throw new TypeError("option domain is invalid");u+=`; Domain=${n.domain}`}if(n.path){if(!V2.test(n.path))throw new TypeError("option path is invalid");u+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");u+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(u+="; HttpOnly"),n.secure&&(u+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(u+="; Partitioned"),u},G2={create(e,r,t,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+t*60*1e3)),n&&(o.domain=n),document.cookie=hN(e,r,o)},read(e){const r=`${e}=`,t=document.cookie.split(";");for(let n=0;n<t.length;n++){let o=t[n];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(r)===0)return o.substring(r.length,o.length)}return null},remove(e,r){this.create(e,"",-1,r)}};var mN={name:"cookie",lookup(e){let{lookupCookie:r}=e;if(r&&typeof document!="undefined")return G2.read(r)||void 0},cacheUserLanguage(e,r){let{lookupCookie:t,cookieMinutes:n,cookieDomain:o,cookieOptions:u}=r;t&&typeof document!="undefined"&&G2.create(t,e,n,o,u)}},gN={name:"querystring",lookup(e){var n;let{lookupQuerystring:r}=e,t;if(typeof window!="undefined"){let{search:o}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const f=o.substring(1).split("&");for(let g=0;g<f.length;g++){const v=f[g].indexOf("=");v>0&&f[g].substring(0,v)===r&&(t=f[g].substring(v+1))}}return t}},xN={name:"hash",lookup(e){var o;let{lookupHash:r,lookupFromHashIndex:t}=e,n;if(typeof window!="undefined"){const{hash:u}=window.location;if(u&&u.length>2){const f=u.substring(1);if(r){const g=f.split("&");for(let v=0;v<g.length;v++){const p=g[v].indexOf("=");p>0&&g[v].substring(0,p)===r&&(n=g[v].substring(p+1))}}if(n)return n;if(!n&&t>-1){const g=u.match(/\/([a-zA-Z-]*)/g);return Array.isArray(g)?(o=g[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}}}return n}};let ad=null;const X2=()=>{if(ad!==null)return ad;try{if(ad=typeof window!="undefined"&&window.localStorage!==null,!ad)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){ad=!1}return ad};var pN={name:"localStorage",lookup(e){let{lookupLocalStorage:r}=e;if(r&&X2())return window.localStorage.getItem(r)||void 0},cacheUserLanguage(e,r){let{lookupLocalStorage:t}=r;t&&X2()&&window.localStorage.setItem(t,e)}};let nd=null;const Y2=()=>{if(nd!==null)return nd;try{if(nd=typeof window!="undefined"&&window.sessionStorage!==null,!nd)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){nd=!1}return nd};var yN={name:"sessionStorage",lookup(e){let{lookupSessionStorage:r}=e;if(r&&Y2())return window.sessionStorage.getItem(r)||void 0},cacheUserLanguage(e,r){let{lookupSessionStorage:t}=r;t&&Y2()&&window.sessionStorage.setItem(t,e)}},bN={name:"navigator",lookup(e){const r=[];if(typeof navigator!="undefined"){const{languages:t,userLanguage:n,language:o}=navigator;if(t)for(let u=0;u<t.length;u++)r.push(t[u]);n&&r.push(n),o&&r.push(o)}return r.length>0?r:void 0}},vN={name:"htmlTag",lookup(e){let{htmlTag:r}=e,t;const n=r||(typeof document!="undefined"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(t=n.getAttribute("lang")),t}},_N={name:"path",lookup(e){var o;let{lookupFromPathIndex:r}=e;if(typeof window=="undefined")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?(o=t[typeof r=="number"?r:0])==null?void 0:o.replace("/",""):void 0}},wN={name:"subdomain",lookup(e){var o,u;let{lookupFromSubdomainIndex:r}=e;const t=typeof r=="number"?r+1:1,n=typeof window!="undefined"&&((u=(o=window.location)==null?void 0:o.hostname)==null?void 0:u.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[t]}};let Pv=!1;try{document.cookie,Pv=!0}catch(e){}const Fv=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Pv||Fv.splice(1,1);const kN=()=>({order:Fv,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class Bv{constructor(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(r,t)}init(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=r,this.options=uN(t,this.options||{},kN()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(mN),this.addDetector(gN),this.addDetector(pN),this.addDetector(yN),this.addDetector(bN),this.addDetector(vN),this.addDetector(_N),this.addDetector(wN),this.addDetector(xN)}addDetector(r){return this.detectors[r.name]=r,this}detect(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return r.forEach(n=>{if(this.detectors[n]){let o=this.detectors[n].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(t=t.concat(o))}}),t=t.filter(n=>n!=null&&!fN(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(r)>-1||t.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(r,this.options)}))}}Bv.type="languageDetector";const NN={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"},SN={title:"Seera-ASM",loggedInAs:"Logged in as:",version:"Seera-ASM v2.26",inventory:"Inventory",ppmPlanner:"PPM Planner",maintenanceCalendar:"Maintenance Calendar",activeMap:"Active Map",maintenanceTeam:"Maintenance Team",procurement:"Procurement",sla:"Service Level Agreement (SLA)",support:"Support"},EN={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",forgotPassword:"Forgot password?",forgotPasswordTitle:"Reset your password",forgotPasswordHint:"Enter your email address or username. We will send you a link to reset your password.",forgotPasswordUserRequired:"Please enter your email or username.",forgotPasswordUserPlaceholder:"Email or username",forgotPasswordSubmit:"Send reset link",forgotPasswordClose:"Close",forgotPasswordSentSuccess:"If an account exists for that user, password reset instructions have been sent by email.",forgotPasswordNotFound:"No account was found with that email or username.",forgotPasswordTimeout:"The request timed out. Please try again.",forgotPasswordCannotReset:"Password reset is not available for this account.",forgotPasswordFailed:"Could not send the reset link. Please try again later.",finishingSignOut:"Finishing sign-out…",afterPasswordResetSignIn:"Your password was updated. Please sign in with your new password."},CN={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"},TN={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"},AN={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"},jN={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"},ON={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"},MN={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"},RN={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"},DN={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"},IN={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"},LN={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)"},PN={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"},FN={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"},BN={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"},UN={common:NN,sidebar:SN,login:EN,dashboard:CN,commonFields:TN,filters:AN,listPages:jN,assets:ON,workOrders:MN,maintenance:RN,ppm:DN,exportModal:IN,items:LN,issues:PN,users:FN,events:BN},zN={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:"العربية"},HN={title:"أصول سيرا",loggedInAs:"تم تسجيل الدخول كـ:",version:"أصول سيرا نظام إدارة الأصول الإصدار 2.26"},WN={title:"أصول سيرا",subtitle:"نظام إدارة الأصول",signIn:"قم بتسجيل الدخول للمتابعة",emailPlaceholder:"أدخل بريدك الإلكتروني",passwordPlaceholder:"أدخل كلمة المرور",loginFailed:"فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك.",demoLogin:"تسجيل دخول تجريبي",forgotPassword:"نسيت كلمة المرور؟",forgotPasswordTitle:"إعادة تعيين كلمة المرور",forgotPasswordHint:"أدخل بريدك الإلكتروني أو اسم المستخدم. سنرسل لك رابطًا لإعادة تعيين كلمة المرور.",forgotPasswordUserRequired:"يرجى إدخال بريدك الإلكتروني أو اسم المستخدم.",forgotPasswordUserPlaceholder:"البريد الإلكتروني أو اسم المستخدم",forgotPasswordSubmit:"إرسال رابط إعادة التعيين",forgotPasswordClose:"إغلاق",forgotPasswordSentSuccess:"إذا كان هناك حساب لهذا المستخدم، فقد أُرسلت تعليمات إعادة تعيين كلمة المرور بالبريد الإلكتروني.",forgotPasswordNotFound:"لم يتم العثور على حساب بهذا البريد الإلكتروني أو اسم المستخدم.",forgotPasswordTimeout:"انتهت مهلة الطلب. يرجى المحاولة مرة أخرى.",forgotPasswordCannotReset:"إعادة تعيين كلمة المرور غير متاحة لهذا الحساب.",forgotPasswordFailed:"تعذر إرسال رابط إعادة التعيين. يرجى المحاولة لاحقًا.",finishingSignOut:"جاري إنهاء تسجيل الخروج…",afterPasswordResetSignIn:"تم تحديث كلمة المرور. يرجى تسجيل الدخول بكلمة المرور الجديدة."},VN={title:"لوحة التحكم",loading:"جاري تحميل لوحة التحكم...",totalAssets:"إجمالي عدد الأصول",openWorkOrders:"أوامر العمل المفتوحة",workOrdersInProgress:"أوامر العمل قيد التنفيذ",completedWorkOrders:"أوامر العمل المكتملة",totalWorkOrders:"إجمالي أوامر العمل",overdueWorkOrders:"أوامر العمل المتأخرة",upTime:"وقت التشغيل",downTime:"وقت التوقف",workOrderStatus:"حالة أمر العمل",workOrderByType:"أمر العمل حسب النوع",maintenanceByAsset:"الصيانة حسب الأصل",assigneesStatus:"حالة المكلفين",maintenanceFrequency:"تكرار الصيانة",maintenanceLogs:"سجلات الصيانة",assetUptime:"وقت تشغيل الأصل",avgResponseTime:"متوسط وقت الاستجابة",maintenanceEfficiency:"كفاءة الصيانة",overdueMaintenance:"صيانة متأخرة",upDownTimeChart:"مخطط وقت التشغيل والتوقف",ppmStatus:"حالة الصيانة الوقائية"},GN={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:"تاريخ الإكمال"},XN={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:"تحديث"},YN={title:"الأصول",addAsset:"إضافة أصل جديد",assetDetails:"تفاصيل الأصل"},ZN={title:"أوامر العمل",addWorkOrder:"إضافة أمر عمل جديد",workOrderDetails:"تفاصيل أمر العمل",newWorkOrder:"أمر عمل جديد",duplicateWorkOrder:"نسخ أمر العمل",createFromAsset:"إنشاء أمر عمل من الأصل"},$N={title:"صيانة الأصول",maintenanceLogs:"سجلات الصيانة",maintenanceDetails:"تفاصيل الصيانة",addMaintenance:"إضافة صيانة جديدة"},qN={title:"الصيانة الوقائية",ppmDetails:"تفاصيل الصيانة الوقائية",addPPM:"إضافة صيانة وقائية جديدة"},KN={title:"تصدير",whatToExport:"ما الذي سيتم تصديره",selectedRows:"الصفوف المحددة",currentPage:"الصفحة الحالية",allWithFilters:"الكل مع المرشحات",exportSelected:"تصدير {count} محدد",exportPage:"تصدير {count} في الصفحة الحالية",exportAll:"تصدير الكل {count}",columnsToExport:"الأعمدة للتصدير",selectAll:"تحديد الكل",selectDefault:"تحديد الافتراضي",exporting:"جاري التصدير...",exportingSelected:"جاري تصدير {count} صف(وف) محدد(ة)",exportingPage:"جاري تصدير {count} صف(وف) من الصفحة الحالية",exportingAll:"جاري تصدير جميع {count} صف(وف)",selected:"محدد",rows:"صفوف"},JN={common:zN,sidebar:HN,login:WN,dashboard:VN,commonFields:GN,listPages:XN,assets:YN,workOrders:ZN,maintenance:$N,ppm:qN,exportModal:KN},wr={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",RESET_PASSWORD:"/api/method/frappe.core.doctype.user.user.reset_password",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 QN{constructor(){ki(this,"baseURL");ki(this,"endpoints");ki(this,"defaultHeaders");ki(this,"timeout");this.baseURL=wr.BASE_URL,this.endpoints=wr.ENDPOINTS,this.defaultHeaders=wr.DEFAULT_HEADERS,this.timeout=wr.TIMEOUT}getCSRFTokenForGuest(){return Ne(this,null,function*(){if(typeof window!="undefined"&&window.csrf_token)return window.csrf_token;try{const r=yield fetch(`${this.baseURL}${this.endpoints.CSRF_TOKEN}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"});if(r.ok)return(yield r.json()).message||null}catch(r){}return null})}requestPasswordReset(r,t){return Ne(this,null,function*(){var p;const n=r.trim();if(!n)throw new ds("User required",void 0,"USER_REQUIRED");const o=yield this.getCSRFTokenForGuest(),u={"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"};o&&(u["X-Frappe-CSRF-Token"]=o);const f=new AbortController,g=setTimeout(()=>f.abort(),45e3),v=()=>f.abort();if(t){if(t.aborted)throw clearTimeout(g),new ds("Aborted",void 0,"TIMEOUT");t.addEventListener("abort",v)}try{const k=yield fetch(`${this.baseURL}${this.endpoints.RESET_PASSWORD}`,{method:"POST",headers:u,body:`user=${encodeURIComponent(n)}`,credentials:"include",signal:f.signal}),N=yield k.json().catch(()=>({})),C=typeof N.message=="string"?N.message:typeof N.message=="object"&&N.message!==null?String((p=N.message.message)!=null?p:""):"";if(k.status===404||C==="not found"||/not found/i.test(C))throw new ds("not found",404,"NOT_FOUND");if(k.status===403)throw new ds("forbidden",403,"FORBIDDEN");if(C==="disabled"||C==="not allowed")throw new ds(C,200,"CANNOT_RESET");if(!k.ok)throw new ds(N.error||`HTTP error! status: ${k.status}`,k.status)}catch(k){throw k instanceof ds?k:k instanceof DOMException&&k.name==="AbortError"?new ds("timeout",void 0,"TIMEOUT"):k instanceof Error&&k.name==="AbortError"?new ds("timeout",void 0,"TIMEOUT"):k}finally{clearTimeout(g),t&&t.removeEventListener("abort",v)}})}getCSRFToken(){return Ne(this,null,function*(){try{if(typeof window!="undefined"&&window.csrf_token)return window.csrf_token;if(!localStorage.getItem("user"))return null;const t=yield fetch(`${this.baseURL}${this.endpoints.CSRF_TOKEN}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"});return t.ok&&(yield t.json()).message||null}catch(r){return null}})}apiCall(n){return Ne(this,arguments,function*(r,t={}){const o=`${this.baseURL}${r}`,u=ke({method:"GET",headers:ke(ke({},this.defaultHeaders),t.headers)},t),f=yield this.getCSRFToken();f&&(u.headers["X-Frappe-CSRF-Token"]=f);try{const g=new AbortController,v=setTimeout(()=>g.abort(),this.timeout),p=yield fetch(o,Ve(ke({},u),{signal:g.signal}));if(clearTimeout(v),!p.ok){const N=yield p.json().catch(()=>({}));throw new ds(N.error||`HTTP error! status: ${p.status}`,p.status)}const k=yield p.json();return k.message!==void 0?k.message:k}catch(g){throw g instanceof Error?(console.error("API call failed:",g),new ds(g.message)):g}})}login(r){return Ne(this,null,function*(){const t=new FormData;t.append("usr",r.email),t.append("pwd",r.password);const n=`${this.baseURL}${this.endpoints.LOGIN}`;try{const o=new AbortController,u=setTimeout(()=>o.abort(),this.timeout),f=yield fetch(n,{method:"POST",headers:{Accept:"application/json"},body:t,credentials:"include",signal:o.signal});if(clearTimeout(u),!f.ok){const v=yield f.json().catch(()=>({})),p="Invalid credentials. Please try again.";throw new ds(p,f.status)}const g=yield f.json();return typeof g.message=="string"&&g.message==="Logged In"?{message:{full_name:g.full_name,user_id:g.user||g.email,home_page:g.home_page,sid:g.sid}}:g.message&&typeof g.message=="object"?{message:g.message}:g.full_name||g.user?{message:g}:{message:g}}catch(o){throw o instanceof Error?new ds("Login failed. Please try again."):o}})}logout(){return Ne(this,null,function*(){yield this.apiCall(this.endpoints.LOGOUT,{method:"POST"})})}getUserDetails(r){return Ne(this,null,function*(){const t=r?`?user_id=${r}`:"";return this.apiCall(`${this.endpoints.USER_DETAILS}${t}`)})}getDoctypeRecords(r,t,n,o=20,u=0){return Ne(this,null,function*(){const f=new URLSearchParams({doctype:r,limit:o.toString(),offset:u.toString()});return t&&f.append("filters",JSON.stringify(t)),n&&f.append("fields",JSON.stringify(n)),this.apiCall(`${this.endpoints.DOCTYPE_RECORDS}?${f}`)})}getDashboardStats(){return Ne(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_STATS)})}getNumberCards(){return Ne(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_NUMBER_CARDS)})}listDashboardCharts(r=!0){return Ne(this,null,function*(){const t=new URLSearchParams({public_only:r?"1":"0"});return this.apiCall(`${this.endpoints.DASHBOARD_LIST_CHARTS}?${t}`)})}getDashboardChartData(r,t){return Ne(this,null,function*(){const n=new URLSearchParams({chart_name:r});return t&&n.append("report_filters",JSON.stringify(t)),this.apiCall(`${this.endpoints.DASHBOARD_CHART_DATA}?${n}`)})}getKycDetails(){return Ne(this,null,function*(){return this.apiCall(this.endpoints.KYC_DETAILS)})}uploadFile(r){return Ne(this,null,function*(){const t=new FormData;return t.append("file",r.file),t.append("doctype",r.doctype),t.append("docname",r.docname),t.append("fieldname",r.fieldname),this.apiCall(this.endpoints.UPLOAD_FILE,{method:"POST",headers:{},body:t})})}getUserPermissions(r){return Ne(this,null,function*(){const t=r?`?user=${encodeURIComponent(r)}`:"";return this.apiCall(`${this.endpoints.GET_USER_PERMISSIONS}${t}`)})}getPermissionFilters(r,t){return Ne(this,null,function*(){const n=new URLSearchParams({target_doctype:r});return t&&n.append("user",t),this.apiCall(`${this.endpoints.GET_PERMISSION_FILTERS}?${n}`)})}getAllowedValues(r,t){return Ne(this,null,function*(){const n=new URLSearchParams({allow_doctype:r});return t&&n.append("user",t),this.apiCall(`${this.endpoints.GET_ALLOWED_VALUES}?${n}`)})}checkDocumentAccess(r,t,n){return Ne(this,null,function*(){const o=new URLSearchParams({doctype:r,docname:t});return n&&o.append("user",n),this.apiCall(`${this.endpoints.CHECK_DOCUMENT_ACCESS}?${o}`)})}getConfiguredDoctypes(){return Ne(this,null,function*(){return this.apiCall(this.endpoints.GET_CONFIGURED_DOCTYPES)})}getUserDefaults(r){return Ne(this,null,function*(){const t=r?`?user=${encodeURIComponent(r)}`:"";return this.apiCall(`${this.endpoints.GET_USER_DEFAULTS}${t}`)})}isAuthenticated(){return!!localStorage.getItem("frappe_session_id")}getSessionId(){return localStorage.getItem("frappe_session_id")}setSessionId(r){localStorage.setItem("frappe_session_id",r)}}class ds extends Error{constructor(t,n,o){super(t);ki(this,"status");ki(this,"code");this.name="ApiError",this.status=n,this.code=o}}const jt=new QN;function e6(e){return Ne(this,null,function*(){try{const r=yield jt.getDoctypeRecords("Translation",{language:e},["source_text","translated_text","context"],1e4,0),t={};return r.records&&r.records.length>0&&r.records.forEach(n=>{const o=n.source_text,u=n.translated_text||o;if(n.context){const f=`${n.context}.${o}`;t[f]=u}else o.includes("."),t[o]=u}),t}catch(r){return console.error("Error fetching translations from Frappe:",r),{}}})}function t6(e){const r={};return Object.keys(e).forEach(t=>{if(t.includes(".")){const n=t.split(".");let o=r;for(let u=0;u<n.length-1;u++){const f=n[u];o[f]||(o[f]={}),o=o[f]}o[n[n.length-1]]=e[t]}else r[t]=e[t]}),r}function Z2(e){return Ne(this,null,function*(){const r=yield e6(e);return t6(r)})}zn.use(Bv).use(eN).init({resources:{en:{translation:UN},ar:{translation:JN}},fallbackLng:"en",defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});function I0(){return Ne(this,null,function*(){try{if(!localStorage.getItem("user"))return;const r=yield Z2("en");Object.keys(r).length>0&&zn.addResourceBundle("en","translation",r,!0,!0);const t=yield Z2("ar");Object.keys(t).length>0&&zn.addResourceBundle("ar","translation",t,!0,!0),console.log("✓ Translations loaded from Frappe")}catch(e){console.warn("⚠ Could not load translations from Frappe, using static translations:",e)}})}zn.on("initialized",()=>{I0()});var $2="popstate";function r6(e={}){function r(n,o){let{pathname:u,search:f,hash:g}=n.location;return ax("",{pathname:u,search:f,hash:g},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function t(n,o){return typeof o=="string"?o:G0(o)}return n6(r,t,null,e)}function za(e,r){if(e===!1||e===null||typeof e=="undefined")throw new Error(r)}function ui(e,r){if(!e){typeof console!="undefined"&&console.warn(r);try{throw new Error(r)}catch(t){}}}function a6(){return Math.random().toString(36).substring(2,10)}function q2(e,r){return{usr:e.state,key:e.key,idx:r}}function ax(e,r,t=null,n){return Ve(ke({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof r=="string"?Sd(r):r),{state:t,key:r&&r.key||n||a6()})}function G0({pathname:e="/",search:r="",hash:t=""}){return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),t&&t!=="#"&&(e+=t.charAt(0)==="#"?t:"#"+t),e}function Sd(e){let r={};if(e){let t=e.indexOf("#");t>=0&&(r.hash=e.substring(t),e=e.substring(0,t));let n=e.indexOf("?");n>=0&&(r.search=e.substring(n),e=e.substring(0,n)),e&&(r.pathname=e)}return r}function n6(e,r,t,n={}){let{window:o=document.defaultView,v5Compat:u=!1}=n,f=o.history,g="POP",v=null,p=k();p==null&&(p=0,f.replaceState(Ve(ke({},f.state),{idx:p}),""));function k(){return(f.state||{idx:null}).idx}function N(){g="POP";let D=k(),z=D==null?null:D-p;p=D,v&&v({action:g,location:M.location,delta:z})}function C(D,z){g="PUSH";let B=ax(M.location,D,z);p=k()+1;let U=q2(B,p),H=M.createHref(B);try{f.pushState(U,"",H)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;o.location.assign(H)}u&&v&&v({action:g,location:M.location,delta:1})}function O(D,z){g="REPLACE";let B=ax(M.location,D,z);p=k();let U=q2(B,p),H=M.createHref(B);f.replaceState(U,"",H),u&&v&&v({action:g,location:M.location,delta:0})}function I(D){return s6(D)}let M={get action(){return g},get location(){return e(o,f)},listen(D){if(v)throw new Error("A history only accepts one active listener");return o.addEventListener($2,N),v=D,()=>{o.removeEventListener($2,N),v=null}},createHref(D){return r(o,D)},createURL:I,encodeLocation(D){let z=I(D);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:C,replace:O,go(D){return f.go(D)}};return M}function s6(e,r=!1){let t="http://localhost";typeof window!="undefined"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),za(t,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:G0(e);return n=n.replace(/ $/,"%20"),!r&&n.startsWith("//")&&(n=t+n),new URL(n,t)}function Uv(e,r,t="/"){return i6(e,r,t,!1)}function i6(e,r,t,n){let o=typeof r=="string"?Sd(r):r,u=Xo(o.pathname||"/",t);if(u==null)return null;let f=zv(e);o6(f);let g=null;for(let v=0;g==null&&v<f.length;++v){let p=y6(u);g=x6(f[v],p,n)}return g}function zv(e,r=[],t=[],n="",o=!1){let u=(f,g,v=o,p)=>{let k={relativePath:p===void 0?f.path||"":p,caseSensitive:f.caseSensitive===!0,childrenIndex:g,route:f};if(k.relativePath.startsWith("/")){if(!k.relativePath.startsWith(n)&&v)return;za(k.relativePath.startsWith(n),`Absolute route path "${k.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),k.relativePath=k.relativePath.slice(n.length)}let N=Ho([n,k.relativePath]),C=t.concat(k);f.children&&f.children.length>0&&(za(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${N}".`),zv(f.children,r,C,N,v)),!(f.path==null&&!f.index)&&r.push({path:N,score:m6(N,f.index),routesMeta:C})};return e.forEach((f,g)=>{var v;if(f.path===""||!((v=f.path)!=null&&v.includes("?")))u(f,g);else for(let p of Hv(f.path))u(f,g,!0,p)}),r}function Hv(e){let r=e.split("/");if(r.length===0)return[];let[t,...n]=r,o=t.endsWith("?"),u=t.replace(/\?$/,"");if(n.length===0)return o?[u,""]:[u];let f=Hv(n.join("/")),g=[];return g.push(...f.map(v=>v===""?u:[u,v].join("/"))),o&&g.push(...f),g.map(v=>e.startsWith("/")&&v===""?"/":v)}function o6(e){e.sort((r,t)=>r.score!==t.score?t.score-r.score:g6(r.routesMeta.map(n=>n.childrenIndex),t.routesMeta.map(n=>n.childrenIndex)))}var l6=/^:[\w-]+$/,c6=3,d6=2,u6=1,f6=10,h6=-2,K2=e=>e==="*";function m6(e,r){let t=e.split("/"),n=t.length;return t.some(K2)&&(n+=h6),r&&(n+=d6),t.filter(o=>!K2(o)).reduce((o,u)=>o+(l6.test(u)?c6:u===""?u6:f6),n)}function g6(e,r){return e.length===r.length&&e.slice(0,-1).every((n,o)=>n===r[o])?e[e.length-1]-r[r.length-1]:0}function x6(e,r,t=!1){let{routesMeta:n}=e,o={},u="/",f=[];for(let g=0;g<n.length;++g){let v=n[g],p=g===n.length-1,k=u==="/"?r:r.slice(u.length)||"/",N=Hf({path:v.relativePath,caseSensitive:v.caseSensitive,end:p},k),C=v.route;if(!N&&p&&t&&!n[n.length-1].route.index&&(N=Hf({path:v.relativePath,caseSensitive:v.caseSensitive,end:!1},k)),!N)return null;Object.assign(o,N.params),f.push({params:o,pathname:Ho([u,N.pathname]),pathnameBase:k6(Ho([u,N.pathnameBase])),route:C}),N.pathnameBase!=="/"&&(u=Ho([u,N.pathnameBase]))}return f}function Hf(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[t,n]=p6(e.path,e.caseSensitive,e.end),o=r.match(t);if(!o)return null;let u=o[0],f=u.replace(/(.)\/+$/,"$1"),g=o.slice(1);return{params:n.reduce((p,{paramName:k,isOptional:N},C)=>{if(k==="*"){let I=g[C]||"";f=u.slice(0,u.length-I.length).replace(/(.)\/+$/,"$1")}const O=g[C];return N&&!O?p[k]=void 0:p[k]=(O||"").replace(/%2F/g,"/"),p},{}),pathname:u,pathnameBase:f,pattern:e}}function p6(e,r=!1,t=!0){ui(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 n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,g,v)=>(n.push({paramName:g,isOptional:v!=null}),v?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,r?void 0:"i"),n]}function y6(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return ui(!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 (${r}).`),e}}function Xo(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let t=r.endsWith("/")?r.length-1:r.length,n=e.charAt(t);return n&&n!=="/"?null:e.slice(t)||"/"}var b6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,v6=e=>b6.test(e);function _6(e,r="/"){let{pathname:t,search:n="",hash:o=""}=typeof e=="string"?Sd(e):e,u;if(t)if(v6(t))u=t;else{if(t.includes("//")){let f=t;t=t.replace(/\/\/+/g,"/"),ui(!1,`Pathnames cannot have embedded double slashes - normalizing ${f} -> ${t}`)}t.startsWith("/")?u=J2(t.substring(1),"/"):u=J2(t,r)}else u=r;return{pathname:u,search:N6(n),hash:S6(o)}}function J2(e,r){let t=r.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?t.length>1&&t.pop():o!=="."&&t.push(o)}),t.length>1?t.join("/"):"/"}function Og(e,r,t,n){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function w6(e){return e.filter((r,t)=>t===0||r.route.path&&r.route.path.length>0)}function Ex(e){let r=w6(e);return r.map((t,n)=>n===r.length-1?t.pathname:t.pathnameBase)}function Cx(e,r,t,n=!1){let o;typeof e=="string"?o=Sd(e):(o=ke({},e),za(!o.pathname||!o.pathname.includes("?"),Og("?","pathname","search",o)),za(!o.pathname||!o.pathname.includes("#"),Og("#","pathname","hash",o)),za(!o.search||!o.search.includes("#"),Og("#","search","hash",o)));let u=e===""||o.pathname==="",f=u?"/":o.pathname,g;if(f==null)g=t;else{let N=r.length-1;if(!n&&f.startsWith("..")){let C=f.split("/");for(;C[0]==="..";)C.shift(),N-=1;o.pathname=C.join("/")}g=N>=0?r[N]:"/"}let v=_6(o,g),p=f&&f!=="/"&&f.endsWith("/"),k=(u||f===".")&&t.endsWith("/");return!v.pathname.endsWith("/")&&(p||k)&&(v.pathname+="/"),v}var Ho=e=>e.join("/").replace(/\/\/+/g,"/"),k6=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),N6=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,S6=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function E6(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function C6(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Wv=["POST","PUT","PATCH","DELETE"];new Set(Wv);var T6=["GET",...Wv];new Set(T6);var Ed=R.createContext(null);Ed.displayName="DataRouter";var mh=R.createContext(null);mh.displayName="DataRouterState";R.createContext(!1);var Vv=R.createContext({isTransitioning:!1});Vv.displayName="ViewTransition";var A6=R.createContext(new Map);A6.displayName="Fetchers";var j6=R.createContext(null);j6.displayName="Await";var Ci=R.createContext(null);Ci.displayName="Navigation";var eu=R.createContext(null);eu.displayName="Location";var qi=R.createContext({outlet:null,matches:[],isDataRoute:!1});qi.displayName="Route";var Tx=R.createContext(null);Tx.displayName="RouteError";function O6(e,{relative:r}={}){za(Cd(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:n}=R.useContext(Ci),{hash:o,pathname:u,search:f}=tu(e,{relative:r}),g=u;return t!=="/"&&(g=u==="/"?t:Ho([t,u])),n.createHref({pathname:g,search:f,hash:o})}function Cd(){return R.useContext(eu)!=null}function Ti(){return za(Cd(),"useLocation() may be used only in the context of a <Router> component."),R.useContext(eu).location}var Gv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Xv(e){R.useContext(Ci).static||R.useLayoutEffect(e)}function ma(){let{isDataRoute:e}=R.useContext(qi);return e?V6():M6()}function M6(){za(Cd(),"useNavigate() may be used only in the context of a <Router> component.");let e=R.useContext(Ed),{basename:r,navigator:t}=R.useContext(Ci),{matches:n}=R.useContext(qi),{pathname:o}=Ti(),u=JSON.stringify(Ex(n)),f=R.useRef(!1);return Xv(()=>{f.current=!0}),R.useCallback((v,p={})=>{if(ui(f.current,Gv),!f.current)return;if(typeof v=="number"){t.go(v);return}let k=Cx(v,JSON.parse(u),o,p.relative==="path");e==null&&r!=="/"&&(k.pathname=k.pathname==="/"?r:Ho([r,k.pathname])),(p.replace?t.replace:t.push)(k,p.state,p)},[r,t,u,o,e])}R.createContext(null);function Ml(){let{matches:e}=R.useContext(qi),r=e[e.length-1];return r?r.params:{}}function tu(e,{relative:r}={}){let{matches:t}=R.useContext(qi),{pathname:n}=Ti(),o=JSON.stringify(Ex(t));return R.useMemo(()=>Cx(e,JSON.parse(o),n,r==="path"),[e,o,n,r])}function R6(e,r){return Yv(e,r)}function Yv(e,r,t,n,o){var B;za(Cd(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=R.useContext(Ci),{matches:f}=R.useContext(qi),g=f[f.length-1],v=g?g.params:{},p=g?g.pathname:"/",k=g?g.pathnameBase:"/",N=g&&g.route;{let U=N&&N.path||"";Zv(p,!N||U.endsWith("*")||U.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${U}">) 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="${U}"> to <Route path="${U==="/"?"*":`${U}/*`}">.`)}let C=Ti(),O;if(r){let U=typeof r=="string"?Sd(r):r;za(k==="/"||((B=U.pathname)==null?void 0:B.startsWith(k)),`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 "${k}" but pathname "${U.pathname}" was given in the \`location\` prop.`),O=U}else O=C;let I=O.pathname||"/",M=I;if(k!=="/"){let U=k.replace(/^\//,"").split("/");M="/"+I.replace(/^\//,"").split("/").slice(U.length).join("/")}let D=Uv(e,{pathname:M});ui(N||D!=null,`No routes matched location "${O.pathname}${O.search}${O.hash}" `),ui(D==null||D[D.length-1].route.element!==void 0||D[D.length-1].route.Component!==void 0||D[D.length-1].route.lazy!==void 0,`Matched leaf route at location "${O.pathname}${O.search}${O.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 z=F6(D&&D.map(U=>Object.assign({},U,{params:Object.assign({},v,U.params),pathname:Ho([k,u.encodeLocation?u.encodeLocation(U.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:U.pathname]),pathnameBase:U.pathnameBase==="/"?k:Ho([k,u.encodeLocation?u.encodeLocation(U.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:U.pathnameBase])})),f,t,n,o);return r&&z?R.createElement(eu.Provider,{value:{location:ke({pathname:"/",search:"",hash:"",state:null,key:"default"},O),navigationType:"POP"}},z):z}function D6(){let e=W6(),r=E6(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},u={padding:"2px 4px",backgroundColor:n},f=null;return console.error("Error handled by React Router default ErrorBoundary:",e),f=R.createElement(R.Fragment,null,R.createElement("p",null,"💿 Hey developer 👋"),R.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",R.createElement("code",{style:u},"ErrorBoundary")," or"," ",R.createElement("code",{style:u},"errorElement")," prop on your route.")),R.createElement(R.Fragment,null,R.createElement("h2",null,"Unexpected Application Error!"),R.createElement("h3",{style:{fontStyle:"italic"}},r),t?R.createElement("pre",{style:o},t):null,f)}var I6=R.createElement(D6,null),L6=class extends R.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,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?R.createElement(qi.Provider,{value:this.props.routeContext},R.createElement(Tx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function P6({routeContext:e,match:r,children:t}){let n=R.useContext(Ed);return n&&n.static&&n.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=r.route.id),R.createElement(qi.Provider,{value:e},t)}function F6(e,r=[],t=null,n=null,o=null){if(e==null){if(!t)return null;if(t.errors)e=t.matches;else if(r.length===0&&!t.initialized&&t.matches.length>0)e=t.matches;else return null}let u=e,f=t==null?void 0:t.errors;if(f!=null){let k=u.findIndex(N=>N.route.id&&(f==null?void 0:f[N.route.id])!==void 0);za(k>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),u=u.slice(0,Math.min(u.length,k+1))}let g=!1,v=-1;if(t)for(let k=0;k<u.length;k++){let N=u[k];if((N.route.HydrateFallback||N.route.hydrateFallbackElement)&&(v=k),N.route.id){let{loaderData:C,errors:O}=t,I=N.route.loader&&!C.hasOwnProperty(N.route.id)&&(!O||O[N.route.id]===void 0);if(N.route.lazy||I){g=!0,v>=0?u=u.slice(0,v+1):u=[u[0]];break}}}let p=t&&n?(k,N)=>{var C,O,I;n(k,{location:t.location,params:(I=(O=(C=t.matches)==null?void 0:C[0])==null?void 0:O.params)!=null?I:{},unstable_pattern:C6(t.matches),errorInfo:N})}:void 0;return u.reduceRight((k,N,C)=>{let O,I=!1,M=null,D=null;t&&(O=f&&N.route.id?f[N.route.id]:void 0,M=N.route.errorElement||I6,g&&(v<0&&C===0?(Zv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),I=!0,D=null):v===C&&(I=!0,D=N.route.hydrateFallbackElement||null)));let z=r.concat(u.slice(0,C+1)),B=()=>{let U;return O?U=M:I?U=D:N.route.Component?U=R.createElement(N.route.Component,null):N.route.element?U=N.route.element:U=k,R.createElement(P6,{match:N,routeContext:{outlet:k,matches:z,isDataRoute:t!=null},children:U})};return t&&(N.route.ErrorBoundary||N.route.errorElement||C===0)?R.createElement(L6,{location:t.location,revalidation:t.revalidation,component:M,error:O,children:B(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:p}):B()},null)}function Ax(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B6(e){let r=R.useContext(Ed);return za(r,Ax(e)),r}function U6(e){let r=R.useContext(mh);return za(r,Ax(e)),r}function z6(e){let r=R.useContext(qi);return za(r,Ax(e)),r}function jx(e){let r=z6(e),t=r.matches[r.matches.length-1];return za(t.route.id,`${e} can only be used on routes that contain a unique "id"`),t.route.id}function H6(){return jx("useRouteId")}function W6(){var n;let e=R.useContext(Tx),r=U6("useRouteError"),t=jx("useRouteError");return e!==void 0?e:(n=r.errors)==null?void 0:n[t]}function V6(){let{router:e}=B6("useNavigate"),r=jx("useNavigate"),t=R.useRef(!1);return Xv(()=>{t.current=!0}),R.useCallback((f,...g)=>Ne(null,[f,...g],function*(o,u={}){ui(t.current,Gv),t.current&&(typeof o=="number"?yield e.navigate(o):yield e.navigate(o,ke({fromRouteId:r},u)))}),[e,r])}var Q2={};function Zv(e,r,t){!r&&!Q2[e]&&(Q2[e]=!0,ui(!1,t))}R.memo(G6);function G6({routes:e,future:r,state:t,unstable_onError:n}){return Yv(e,void 0,t,n,r)}function nx({to:e,replace:r,state:t,relative:n}){za(Cd(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=R.useContext(Ci);ui(!o,"<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:u}=R.useContext(qi),{pathname:f}=Ti(),g=ma(),v=Cx(e,Ex(u),f,n==="path"),p=JSON.stringify(v);return R.useEffect(()=>{g(JSON.parse(p),{replace:r,state:t,relative:n})},[g,p,n,r,t]),null}function ia(e){za(!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 X6({basename:e="/",children:r=null,location:t,navigationType:n="POP",navigator:o,static:u=!1,unstable_useTransitions:f}){za(!Cd(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=e.replace(/^\/*/,"/"),v=R.useMemo(()=>({basename:g,navigator:o,static:u,unstable_useTransitions:f,future:{}}),[g,o,u,f]);typeof t=="string"&&(t=Sd(t));let{pathname:p="/",search:k="",hash:N="",state:C=null,key:O="default"}=t,I=R.useMemo(()=>{let M=Xo(p,g);return M==null?null:{location:{pathname:M,search:k,hash:N,state:C,key:O},navigationType:n}},[g,p,k,N,C,O,n]);return ui(I!=null,`<Router basename="${g}"> is not able to match the URL "${p}${k}${N}" because it does not start with the basename, so the <Router> won't render anything.`),I==null?null:R.createElement(Ci.Provider,{value:v},R.createElement(eu.Provider,{children:r,value:I}))}function Y6({children:e,location:r}){return R6(sx(e),r)}function sx(e,r=[]){let t=[];return R.Children.forEach(e,(n,o)=>{if(!R.isValidElement(n))return;let u=[...r,o];if(n.type===R.Fragment){t.push.apply(t,sx(n.props.children,u));return}za(n.type===ia,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),za(!n.props.index||!n.props.children,"An index route cannot have child routes.");let f={id:n.props.id||u.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(f.children=sx(n.props.children,u)),t.push(f)}),t}var Rf="get",Df="application/x-www-form-urlencoded";function gh(e){return typeof HTMLElement!="undefined"&&e instanceof HTMLElement}function Z6(e){return gh(e)&&e.tagName.toLowerCase()==="button"}function $6(e){return gh(e)&&e.tagName.toLowerCase()==="form"}function q6(e){return gh(e)&&e.tagName.toLowerCase()==="input"}function K6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function J6(e,r){return e.button===0&&(!r||r==="_self")&&!K6(e)}function ix(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((r,t)=>{let n=e[t];return r.concat(Array.isArray(n)?n.map(o=>[t,o]):[[t,n]])},[]))}function Q6(e,r){let t=ix(e);return r&&r.forEach((n,o)=>{t.has(o)||r.getAll(o).forEach(u=>{t.append(o,u)})}),t}var yf=null;function eS(){if(yf===null)try{new FormData(document.createElement("form"),0),yf=!1}catch(e){yf=!0}return yf}var tS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Mg(e){return e!=null&&!tS.has(e)?(ui(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Df}"`),null):e}function rS(e,r){let t,n,o,u,f;if($6(e)){let g=e.getAttribute("action");n=g?Xo(g,r):null,t=e.getAttribute("method")||Rf,o=Mg(e.getAttribute("enctype"))||Df,u=new FormData(e)}else if(Z6(e)||q6(e)&&(e.type==="submit"||e.type==="image")){let g=e.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let v=e.getAttribute("formaction")||g.getAttribute("action");if(n=v?Xo(v,r):null,t=e.getAttribute("formmethod")||g.getAttribute("method")||Rf,o=Mg(e.getAttribute("formenctype"))||Mg(g.getAttribute("enctype"))||Df,u=new FormData(g,e),!eS()){let{name:p,type:k,value:N}=e;if(k==="image"){let C=p?`${p}.`:"";u.append(`${C}x`,"0"),u.append(`${C}y`,"0")}else p&&u.append(p,N)}}else{if(gh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Rf,n=null,o=Df,f=e}return u&&o==="text/plain"&&(f=u,u=void 0),{action:n,method:t.toLowerCase(),encType:o,formData:u,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ox(e,r){if(e===!1||e===null||typeof e=="undefined")throw new Error(r)}function aS(e,r,t){let n=typeof e=="string"?new URL(e,typeof window=="undefined"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname=`_root.${t}`:r&&Xo(n.pathname,r)==="/"?n.pathname=`${r.replace(/\/$/,"")}/_root.${t}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${t}`,n}function nS(e,r){return Ne(this,null,function*(){if(e.id in r)return r[e.id];try{let t=yield import(e.module);return r[e.id]=t,t}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}})}function sS(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 iS(e,r,t){return Ne(this,null,function*(){let n=yield Promise.all(e.map(o=>Ne(null,null,function*(){let u=r.routes[o.route.id];if(u){let f=yield nS(u,t);return f.links?f.links():[]}return[]})));return dS(n.flat(1).filter(sS).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?Ve(ke({},o),{rel:"prefetch",as:"style"}):Ve(ke({},o),{rel:"prefetch"})))})}function eb(e,r,t,n,o,u){let f=(v,p)=>t[p]?v.route.id!==t[p].route.id:!0,g=(v,p)=>{var k;return t[p].pathname!==v.pathname||((k=t[p].route.path)==null?void 0:k.endsWith("*"))&&t[p].params["*"]!==v.params["*"]};return u==="assets"?r.filter((v,p)=>f(v,p)||g(v,p)):u==="data"?r.filter((v,p)=>{var N;let k=n.routes[v.route.id];if(!k||!k.hasLoader)return!1;if(f(v,p)||g(v,p))return!0;if(v.route.shouldRevalidate){let C=v.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((N=t[0])==null?void 0:N.params)||{},nextUrl:new URL(e,window.origin),nextParams:v.params,defaultShouldRevalidate:!0});if(typeof C=="boolean")return C}return!0}):[]}function oS(e,r,{includeHydrateFallback:t}={}){return lS(e.map(n=>{let o=r.routes[n.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),t&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function lS(e){return[...new Set(e)]}function cS(e){let r={},t=Object.keys(e).sort();for(let n of t)r[n]=e[n];return r}function dS(e,r){let t=new Set;return new Set(r),e.reduce((n,o)=>{let u=JSON.stringify(cS(o));return t.has(u)||(t.add(u),n.push({key:u,link:o})),n},[])}function $v(){let e=R.useContext(Ed);return Ox(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function uS(){let e=R.useContext(mh);return Ox(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Mx=R.createContext(void 0);Mx.displayName="FrameworkContext";function qv(){let e=R.useContext(Mx);return Ox(e,"You must render this element inside a <HydratedRouter> element"),e}function fS(e,r){let t=R.useContext(Mx),[n,o]=R.useState(!1),[u,f]=R.useState(!1),{onFocus:g,onBlur:v,onMouseEnter:p,onMouseLeave:k,onTouchStart:N}=r,C=R.useRef(null);R.useEffect(()=>{if(e==="render"&&f(!0),e==="viewport"){let M=z=>{z.forEach(B=>{f(B.isIntersecting)})},D=new IntersectionObserver(M,{threshold:.5});return C.current&&D.observe(C.current),()=>{D.disconnect()}}},[e]),R.useEffect(()=>{if(n){let M=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(M)}}},[n]);let O=()=>{o(!0)},I=()=>{o(!1),f(!1)};return t?e!=="intent"?[u,C,{}]:[u,C,{onFocus:E0(g,O),onBlur:E0(v,I),onMouseEnter:E0(p,O),onMouseLeave:E0(k,I),onTouchStart:E0(N,O)}]:[!1,C,{}]}function E0(e,r){return t=>{e&&e(t),t.defaultPrevented||r(t)}}function hS(t){var n=t,{page:e}=n,r=Us(n,["page"]);let{router:o}=$v(),u=R.useMemo(()=>Uv(o.routes,e,o.basename),[o.routes,e,o.basename]);return u?R.createElement(gS,ke({page:e,matches:u},r)):null}function mS(e){let{manifest:r,routeModules:t}=qv(),[n,o]=R.useState([]);return R.useEffect(()=>{let u=!1;return iS(e,r,t).then(f=>{u||o(f)}),()=>{u=!0}},[e,r,t]),n}function gS(n){var o=n,{page:e,matches:r}=o,t=Us(o,["page","matches"]);let u=Ti(),{manifest:f,routeModules:g}=qv(),{basename:v}=$v(),{loaderData:p,matches:k}=uS(),N=R.useMemo(()=>eb(e,r,k,f,u,"data"),[e,r,k,f,u]),C=R.useMemo(()=>eb(e,r,k,f,u,"assets"),[e,r,k,f,u]),O=R.useMemo(()=>{if(e===u.pathname+u.search+u.hash)return[];let D=new Set,z=!1;if(r.forEach(U=>{var q;let H=f.routes[U.route.id];!H||!H.hasLoader||(!N.some(ne=>ne.route.id===U.route.id)&&U.route.id in p&&((q=g[U.route.id])!=null&&q.shouldRevalidate)||H.hasClientLoader?z=!0:D.add(U.route.id))}),D.size===0)return[];let B=aS(e,v,"data");return z&&D.size>0&&B.searchParams.set("_routes",r.filter(U=>D.has(U.route.id)).map(U=>U.route.id).join(",")),[B.pathname+B.search]},[v,p,u,f,N,r,e,g]),I=R.useMemo(()=>oS(C,f),[C,f]),M=mS(C);return R.createElement(R.Fragment,null,O.map(D=>R.createElement("link",ke({key:D,rel:"prefetch",as:"fetch",href:D},t))),I.map(D=>R.createElement("link",ke({key:D,rel:"modulepreload",href:D},t))),M.map(({key:D,link:z})=>R.createElement("link",ke({key:D,nonce:t.nonce},z))))}function xS(...e){return r=>{e.forEach(t=>{typeof t=="function"?t(r):t!=null&&(t.current=r)})}}var Kv=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";try{Kv&&(window.__reactRouterVersion="7.10.0")}catch(e){}function pS({basename:e,children:r,unstable_useTransitions:t,window:n}){let o=R.useRef();o.current==null&&(o.current=r6({window:n,v5Compat:!0}));let u=o.current,[f,g]=R.useState({action:u.action,location:u.location}),v=R.useCallback(p=>{t===!1?g(p):R.startTransition(()=>g(p))},[t]);return R.useLayoutEffect(()=>u.listen(v),[u,v]),R.createElement(X6,{basename:e,children:r,location:f.location,navigationType:f.action,navigator:u,unstable_useTransitions:t===!0})}var Jv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rx=R.forwardRef(function(I,O){var M=I,{onClick:r,discover:t="render",prefetch:n="none",relative:o,reloadDocument:u,replace:f,state:g,target:v,to:p,preventScrollReset:k,viewTransition:N}=M,C=Us(M,["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"]);let{basename:D,unstable_useTransitions:z}=R.useContext(Ci),B=typeof p=="string"&&Jv.test(p),U,H=!1;if(typeof p=="string"&&B&&(U=p,Kv))try{let me=new URL(window.location.href),Se=p.startsWith("//")?new URL(me.protocol+p):new URL(p),Oe=Xo(Se.pathname,D);Se.origin===me.origin&&Oe!=null?p=Oe+Se.search+Se.hash:H=!0}catch(me){ui(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let q=O6(p,{relative:o}),[ne,V,J]=fS(n,C),Q=_S(p,{replace:f,state:g,target:v,preventScrollReset:k,relative:o,viewTransition:N,unstable_useTransitions:z});function Te(me){r&&r(me),me.defaultPrevented||Q(me)}let je=R.createElement("a",Ve(ke(ke({},C),J),{href:U||q,onClick:H||u?r:Te,ref:xS(O,V),target:v,"data-discover":!B&&t==="render"?"true":void 0}));return ne&&!B?R.createElement(R.Fragment,null,je,R.createElement(hS,{page:q})):je});Rx.displayName="Link";var yS=R.forwardRef(function(N,k){var C=N,{"aria-current":r="page",caseSensitive:t=!1,className:n="",end:o=!1,style:u,to:f,viewTransition:g,children:v}=C,p=Us(C,["aria-current","caseSensitive","className","end","style","to","viewTransition","children"]);let O=tu(f,{relative:p.relative}),I=Ti(),M=R.useContext(mh),{navigator:D,basename:z}=R.useContext(Ci),B=M!=null&&ES(O)&&g===!0,U=D.encodeLocation?D.encodeLocation(O).pathname:O.pathname,H=I.pathname,q=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;t||(H=H.toLowerCase(),q=q?q.toLowerCase():null,U=U.toLowerCase()),q&&z&&(q=Xo(q,z)||q);const ne=U!=="/"&&U.endsWith("/")?U.length-1:U.length;let V=H===U||!o&&H.startsWith(U)&&H.charAt(ne)==="/",J=q!=null&&(q===U||!o&&q.startsWith(U)&&q.charAt(U.length)==="/"),Q={isActive:V,isPending:J,isTransitioning:B},Te=V?r:void 0,je;typeof n=="function"?je=n(Q):je=[n,V?"active":null,J?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let me=typeof u=="function"?u(Q):u;return R.createElement(Rx,Ve(ke({},p),{"aria-current":Te,className:je,ref:k,style:me,to:f,viewTransition:g}),typeof v=="function"?v(Q):v)});yS.displayName="NavLink";var bS=R.forwardRef((I,O)=>{var M=I,{discover:e="render",fetcherKey:r,navigate:t,reloadDocument:n,replace:o,state:u,method:f=Rf,action:g,onSubmit:v,relative:p,preventScrollReset:k,viewTransition:N}=M,C=Us(M,["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"]);let{unstable_useTransitions:D}=R.useContext(Ci),z=NS(),B=SS(g,{relative:p}),U=f.toLowerCase()==="get"?"get":"post",H=typeof g=="string"&&Jv.test(g),q=ne=>{if(v&&v(ne),ne.defaultPrevented)return;ne.preventDefault();let V=ne.nativeEvent.submitter,J=(V==null?void 0:V.getAttribute("formmethod"))||f,Q=()=>z(V||ne.currentTarget,{fetcherKey:r,method:J,navigate:t,replace:o,state:u,relative:p,preventScrollReset:k,viewTransition:N});D&&t!==!1?R.startTransition(()=>Q()):Q()};return R.createElement("form",Ve(ke({ref:O,method:U,action:B,onSubmit:n?v:q},C),{"data-discover":!H&&e==="render"?"true":void 0}))});bS.displayName="Form";function vS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qv(e){let r=R.useContext(Ed);return za(r,vS(e)),r}function _S(e,{target:r,replace:t,state:n,preventScrollReset:o,relative:u,viewTransition:f,unstable_useTransitions:g}={}){let v=ma(),p=Ti(),k=tu(e,{relative:u});return R.useCallback(N=>{if(J6(N,r)){N.preventDefault();let C=t!==void 0?t:G0(p)===G0(k),O=()=>v(e,{replace:C,state:n,preventScrollReset:o,relative:u,viewTransition:f});g?R.startTransition(()=>O()):O()}},[p,v,k,t,n,r,e,o,u,f,g])}function Rl(e){ui(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 r=R.useRef(ix(e)),t=R.useRef(!1),n=Ti(),o=R.useMemo(()=>Q6(n.search,t.current?null:r.current),[n.search]),u=ma(),f=R.useCallback((g,v)=>{const p=ix(typeof g=="function"?g(new URLSearchParams(o)):g);t.current=!0,u("?"+p,v)},[u,o]);return[o,f]}var wS=0,kS=()=>`__${String(++wS)}__`;function NS(){let{router:e}=Qv("useSubmit"),{basename:r}=R.useContext(Ci),t=H6(),n=e.fetch,o=e.navigate;return R.useCallback((g,...v)=>Ne(null,[g,...v],function*(u,f={}){let{action:p,method:k,encType:N,formData:C,body:O}=rS(u,r);if(f.navigate===!1){let I=f.fetcherKey||kS();yield n(I,t,f.action||p,{preventScrollReset:f.preventScrollReset,formData:C,body:O,formMethod:f.method||k,formEncType:f.encType||N,flushSync:f.flushSync})}else yield o(f.action||p,{preventScrollReset:f.preventScrollReset,formData:C,body:O,formMethod:f.method||k,formEncType:f.encType||N,replace:f.replace,state:f.state,fromRouteId:t,flushSync:f.flushSync,viewTransition:f.viewTransition})}),[n,o,r,t])}function SS(e,{relative:r}={}){let{basename:t}=R.useContext(Ci),n=R.useContext(qi);za(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),u=ke({},tu(e||".",{relative:r})),f=Ti();if(e==null){u.search=f.search;let g=new URLSearchParams(u.search),v=g.getAll("index");if(v.some(k=>k==="")){g.delete("index"),v.filter(N=>N).forEach(N=>g.append("index",N));let k=g.toString();u.search=k?`?${k}`:""}}return(!e||e===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(u.pathname=u.pathname==="/"?t:Ho([t,u.pathname])),G0(u)}function ES(e,{relative:r}={}){let t=R.useContext(Vv);za(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Qv("useViewTransitionState"),o=tu(e,{relative:r});if(!t.isTransitioning)return!1;let u=Xo(t.currentLocation.pathname,n)||t.currentLocation.pathname,f=Xo(t.nextLocation.pathname,n)||t.nextLocation.pathname;return Hf(o.pathname,f)!=null||Hf(o.pathname,u)!=null}var Dx=jv();const Rg="asm_show_after_password_reset",CS=()=>{const[e,r]=R.useState({email:"",password:""}),[t,n]=R.useState(!1),[o,u]=R.useState(null),[f,g]=R.useState(!1),[v,p]=R.useState(""),[k,N]=R.useState(!1),[C,O]=R.useState(null),[I,M]=R.useState(null),[D,z]=R.useState(!1),[B,U]=R.useState(!1),H=R.useRef(!1),q=R.useRef(null),ne=ma(),V=Ti(),{t:J}=Xa(),Q="/assets/asm_ui_app/asm_app/",Te="?v=1765198405",je=R.useCallback(()=>{var re;(re=q.current)==null||re.abort(),q.current=null,g(!1),p(""),O(null),M(null),N(!1)},[]),me=()=>{g(!0),O(null),M(null)};R.useEffect(()=>{if(!f)return;const re=de=>{de.key==="Escape"&&je()};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[f,je]),R.useEffect(()=>{if(new URLSearchParams(V.search).get("manual_login")!=="1"||H.current)return;H.current=!0,Ne(null,null,function*(){z(!0);try{localStorage.removeItem("user"),localStorage.removeItem("frappe_session_id");const Ae=yield jt.getCSRFTokenForGuest(),_e={Accept:"application/json"};Ae&&(_e["X-Frappe-CSRF-Token"]=Ae),yield fetch("/api/method/logout",{method:"POST",headers:_e,credentials:"include"}).catch(()=>{}),sessionStorage.setItem(Rg,"1"),ne("/login",{replace:!0})}finally{z(!1)}})},[V.pathname,V.search,ne]),R.useEffect(()=>{sessionStorage.getItem(Rg)==="1"&&(sessionStorage.removeItem(Rg),U(!0))},[V.pathname,V.search]),R.useEffect(()=>{if(D||new URLSearchParams(V.search).get("manual_login")==="1")return;if(localStorage.getItem("user")){ne("/dashboard",{replace:!0});return}I0().catch(()=>{})},[V.pathname,V.search,ne,D]);const Se=re=>{const{name:de,value:Ae}=re.target;r(_e=>Ve(ke({},_e),{[de]:Ae})),u(null)},Oe=re=>Ne(null,null,function*(){re.preventDefault(),n(!0),u(null);try{const de=yield jt.login(e);if(de&&de.message){const Ae=Ve(ke({},de.message),{email:e.email});localStorage.setItem("user",JSON.stringify(Ae)),de.message.sid&&jt.setSessionId(de.message.sid);try{yield I0()}catch(_e){console.warn("Could not load translations after login:",_e)}ne("/dashboard")}else u(J("login.loginFailed"))}catch(de){console.error("Login error:",de);const Ae=de instanceof Error?de.message:J("login.loginFailed");u(Ae||J("login.loginFailed"))}finally{n(!1)}}),ue=()=>Ne(null,null,function*(){const re={full_name:"Demo User",email:"demo@seeraarabia.com",user_image:"",roles:["System Manager","Administrator"]};localStorage.setItem("user",JSON.stringify(re));try{yield I0()}catch(de){console.warn("Could not load translations after demo login:",de)}ne("/dashboard")}),be=re=>Ne(null,null,function*(){var _e;re.preventDefault();const de=v.trim();if(!de){O(J("login.forgotPasswordUserRequired")),M(null);return}(_e=q.current)==null||_e.abort();const Ae=new AbortController;q.current=Ae,N(!0),O(null),M(null);try{yield jt.requestPasswordReset(de,Ae.signal),M(J("login.forgotPasswordSentSuccess"))}catch(K){K instanceof ds?K.code==="NOT_FOUND"?O(J("login.forgotPasswordNotFound")):K.code==="CANNOT_RESET"?O(J("login.forgotPasswordCannotReset")):K.code==="FORBIDDEN"?O(J("login.forgotPasswordFailed")):K.code==="TIMEOUT"?O(J("login.forgotPasswordTimeout")):O(J("login.forgotPasswordFailed")):O(J("login.forgotPasswordFailed"))}finally{N(!1),q.current===Ae&&(q.current=null)}});return D?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-center text-gray-700 dark:text-gray-300",children:[a.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5",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"})]}),J("login.finishingSignOut")]})}):a.jsxs("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:`${Q}${Q.endsWith("/")?"":"/"}seera-logo.png${Te}`,alt:"Seera Arabia",className:"w-full h-full object-contain",onError:re=>{const de=re.currentTarget.parentElement;de&&de.classList.add("bg-gradient-to-br","from-indigo-600","to-purple-600"),re.currentTarget.style.display="none";const Ae=re.currentTarget.nextElementSibling;Ae&&Ae.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:J("login.title")}),a.jsx("p",{className:"mt-2 text-center text-sm font-medium text-indigo-600 dark:text-indigo-400",children:J("login.subtitle")}),a.jsx("p",{className:"mt-1 text-center text-xs text-gray-600 dark:text-gray-400",children:J("login.signIn")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:Oe,children:[B&&a.jsx("div",{className:"rounded-md bg-green-50 dark:bg-green-900/20 p-4 border border-green-200 dark:border-green-800",children:a.jsx("p",{className:"text-sm text-green-800 dark:text-green-300 text-center",children:J("login.afterPasswordResetSignIn")})}),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:J("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:J("login.emailPlaceholder"),value:e.email,onChange:Se})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"sr-only",children:J("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:J("login.passwordPlaceholder"),value:e.password,onChange:Se})]})]}),o&&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:o})}),a.jsx("button",{type:"submit",disabled:t,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:t?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"})]}),J("common.loading")]}):J("common.login")}),a.jsx("p",{className:"text-center -mt-2",children:a.jsx("button",{type:"button",onClick:me,className:"text-sm font-medium text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-300",children:J("login.forgotPassword")})}),a.jsxs("div",{className:"hidden relative pt-2","aria-hidden":"true",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:ue,className:"hidden 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","aria-hidden":"true",tabIndex:-1,children:["🚀 ",J("login.demoLogin")]})]})]}),f&&a.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm",onClick:je,role:"presentation",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-lg p-6",onClick:re=>re.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"forgot-password-title",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[a.jsx("h3",{id:"forgot-password-title",className:"text-xl font-semibold text-gray-900 dark:text-white",children:J("login.forgotPassword")}),a.jsx("button",{type:"button",onClick:je,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-2xl leading-none shrink-0","aria-label":J("login.forgotPasswordClose"),children:"×"})]}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:J("login.forgotPasswordHint")}),a.jsxs("form",{onSubmit:be,children:[a.jsx("input",{type:"text",autoComplete:"username",className:"appearance-none 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-700 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",placeholder:J("login.forgotPasswordUserPlaceholder"),value:v,onChange:re=>{p(re.target.value),O(null),M(null)},disabled:k}),C&&a.jsx("div",{className:"mt-4 rounded-md bg-red-50 dark:bg-red-900/20 p-3",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:C})}),I&&a.jsx("div",{className:"mt-4 rounded-md bg-green-50 dark:bg-green-900/20 p-3",children:a.jsx("p",{className:"text-sm text-green-700 dark:text-green-400",children:I})}),a.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[a.jsx("button",{type:"button",onClick:je,disabled:k,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-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50",children:J("common.cancel")}),a.jsx("button",{type:"submit",disabled:k,className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed",children:J(k?"common.loading":"login.forgotPasswordSubmit")})]})]})]})})]})};function xh(e,r=[]){const[t,n]=R.useState(null),[o,u]=R.useState(!0),[f,g]=R.useState(null),v=R.useCallback(()=>Ne(null,null,function*(){try{u(!0),g(null);const k=yield e();n(k)}catch(k){k instanceof ds?g(k.message):g(k instanceof Error?k.message:"Unknown error")}finally{u(!1)}}),r);R.useEffect(()=>{v()},[v]);const p=R.useCallback(()=>{v()},[v]);return{data:t,loading:o,error:f,refetch:p}}function TS(e){return xh(()=>jt.getUserDetails(e),[e])}function AS(){return xh(()=>jt.getDashboardStats())}function e_(){return xh(()=>jt.getNumberCards())}function cd(e,r){return xh(()=>jt.getDashboardChartData(e,r),[e,JSON.stringify(r||{})])}function jS(){const[e,r]=R.useState(jt.isAuthenticated());return{isAuthenticated:e,login:o=>Ne(null,null,function*(){try{const u=yield jt.login(o);if(u&&u.message)return u.message.sid&&jt.setSessionId(u.message.sid),r(!0),u;throw new Error("Login failed")}catch(u){throw r(!1),u}}),logout:()=>Ne(null,null,function*(){try{yield jt.logout()}finally{jt.setSessionId(""),r(!1)}})}}const OS=()=>{const[e,r]=R.useState({}),[t,n]=R.useState(!1),o=()=>Ne(null,null,function*(){n(!0);const u={};try{console.log("Testing basic connectivity...");try{const f=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)});f.ok?u.csrfToken="✅ Basic Connectivity: SUCCESS":u.csrfToken=`❌ Basic Connectivity: HTTP ${f.status}`}catch(f){u.csrfToken=`❌ Basic Connectivity: ${f instanceof Error?f.message:"Unknown error"}`}console.log("Testing Frappe system endpoint...");try{yield jt.apiCall("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"}}),u.dashboardStats="✅ Frappe System API: SUCCESS"}catch(f){const g=f instanceof Error?f.message:"Unknown";g.includes("403")||g.includes("401")?u.dashboardStats="✅ Frappe System API: SUCCESS (auth required)":u.dashboardStats=`❌ Frappe System API: ${g}`}console.log("Testing Custom User Details...");try{const f=yield jt.getUserDetails();u.userDetails=f?"✅ Custom API: SUCCESS":"❌ Custom API: Failed"}catch(f){u.userDetails=`❌ Custom API (Expected): ${f instanceof Error?f.message:"Unknown"}`}console.log("Testing Custom Dashboard Stats...");try{const f=yield jt.getDashboardStats();u.doctypeRecords=f?"✅ Custom Stats: SUCCESS":"❌ Custom Stats: Failed"}catch(f){u.doctypeRecords=`❌ Custom Stats (Expected): ${f instanceof Error?f.message:"Unknown"}`}}catch(f){console.error("API Test Error:",f),f instanceof ds?u.error=`${f.message} (Status: ${f.status})`:u.error=f instanceof Error?f.message:"Unknown error"}r(u),n(!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:o,disabled:t,style:{padding:"10px 20px",marginBottom:"20px",backgroundColor:t?"#ccc":"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:t?"not-allowed":"pointer"},children:t?"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"]})]})]})]})},Dg=e=>Number.isFinite(e)?Math.max(0,e):0;function MS({type:e,labels:r,datasets:t,height:n=220}){if(!(r!=null&&r.length)||!(t!=null&&t.length))return a.jsx("div",{className:"text-sm text-gray-500",children:"No data"});if(e.toLowerCase()==="pie"){const p=t[0].values.map(Dg),k=p.reduce((D,z)=>D+z,0)||1,N=Math.min(100,n/2-10),C=N+10,O=N+10;let I=0;const M=t[0].values.map((D,z)=>t[0].color||tb(z));return a.jsx("svg",{width:C*2,height:O*2,viewBox:`0 0 ${C*2} ${O*2}`,children:p.map((D,z)=>{const B=I/k*2*Math.PI;I+=D;const U=I/k*2*Math.PI,H=U-B>Math.PI?1:0,q=C+N*Math.cos(B),ne=O+N*Math.sin(B),V=C+N*Math.cos(U),J=O+N*Math.sin(U),Q=`M ${C} ${O} L ${q} ${ne} A ${N} ${N} 0 ${H} 1 ${V} ${J} Z`;return a.jsx("path",{d:Q,fill:M[z]},z)})})}const o=t,u=Math.max(...o.flatMap(p=>p.values.map(Dg)),1),f=Math.max(r.length*60,300),g=n-40,v=Math.max(20,(f-40)/r.length-10);return a.jsxs("svg",{width:f,height:n,viewBox:`0 0 ${f} ${n}`,children:[a.jsx("line",{x1:30,y1:10,x2:30,y2:g,stroke:"#e5e7eb"}),a.jsx("line",{x1:30,y1:g,x2:f-10,y2:g,stroke:"#e5e7eb"}),r.map((p,k)=>{const N=40+k*(v+10);let C=0;return a.jsxs("g",{children:[o.map((O,I)=>{const D=Dg(O.values[k]||0)/u*(g-20),z=g-D-C,B=O.color||tb(I);return C+=D,a.jsx("rect",{x:N,y:z,width:v,height:D,fill:B,rx:2},I)}),a.jsx("text",{x:N+v/2,y:n-5,textAnchor:"middle",fontSize:"10",fill:"#6b7280",children:RS(p,8)})]},k)})]})}function tb(e){const r=["#4F46E5","#10B981","#F59E0B","#EF4444","#6366F1","#22C55E","#E11D48"];return r[e%r.length]}function RS(e,r){return e.length>r?e.slice(0,r-1)+"…":e}const DS=({chartName:e,filters:r})=>{const{data:t,loading:n,error:o}=cd(e,r);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})}),n&&a.jsx("div",{className:"text-sm text-gray-500",children:"Loading…"}),o&&a.jsx("div",{className:"text-sm text-red-600",children:o}),!n&&!o&&t&&a.jsx(MS,{type:t.type,labels:t.labels,datasets:t.datasets})]})},IS=()=>{var O,I,M,D;const[e,r]=R.useState(null),[t,n]=R.useState([]),o=ma(),{logout:u}=jS(),{loading:f,error:g}=AS(),{data:v}=e_(),{data:p,loading:k,error:N}=TS();R.useEffect(()=>{const z=localStorage.getItem("user");z?r(JSON.parse(z)):p&&r(p);const B=[{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}];n(B)},[p]);const C=()=>Ne(null,null,function*(){try{yield u(),localStorage.removeItem("user"),o("/login")}catch(z){console.error("Logout error:",z),localStorage.removeItem("user"),o("/login")}});return f||k?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:C,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:[(g||N)&&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:g||N||"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:(O=v==null?void 0:v.total_assets)!=null?O:"-"})]})})]})})}),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:(I=v==null?void 0:v.work_orders_open)!=null?I:"-"})]})})]})})}),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:(M=v==null?void 0:v.work_orders_in_progress)!=null?M:"-"})]})})]})})}),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:(D=v==null?void 0:v.work_orders_completed)!=null?D:"-"})]})})]})})})]}),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(z=>a.jsx(DS,{chartName:z},z))}),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:t.map(z=>{var B;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:((B=z.full_name)==null?void 0:B.charAt(0))||z.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:z.full_name||z.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:z.email||"No email"})]})]}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(z.creation).toLocaleDateString()})]})},z.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:()=>o("/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:()=>o("/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:()=>o("/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:()=>o("/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(OS,{})})]})]})};class LS{getWorkOrders(r,t,n=20,o=0,u){return Ne(this,null,function*(){const f=new URLSearchParams;r&&f.append("filters",JSON.stringify(r)),t&&t.length>0&&f.append("fields",JSON.stringify(t)),f.append("limit",n.toString()),f.append("offset",o.toString()),u&&f.append("order_by",u);const g=`${wr.ENDPOINTS.GET_WORK_ORDERS}?${f.toString()}`;return jt.apiCall(g)})}getWorkOrderDetails(r){return Ne(this,null,function*(){const t=`${wr.ENDPOINTS.GET_WORK_ORDER_DETAILS}?work_order_name=${encodeURIComponent(r)}`;return jt.apiCall(t)})}createWorkOrder(r){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.CREATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_data:r})})})}updateWorkOrder(r,t){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.UPDATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:r,work_order_data:t})})})}deleteWorkOrder(r){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.DELETE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:r})})})}updateWorkOrderStatus(r,t,n){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.UPDATE_WORK_ORDER_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:r,repair_status:t,workflow_state:n})})})}getWorkOrderFilters(){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.GET_WORK_ORDER_FILTERS)})}getWorkOrderStats(){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.GET_WORK_ORDER_STATS)})}searchWorkOrders(r,t=10){return Ne(this,null,function*(){const n=`${wr.ENDPOINTS.SEARCH_WORK_ORDERS}?search_term=${encodeURIComponent(r)}&limit=${t}`;return jt.apiCall(n)})}submitWorkOrder(r){return Ne(this,null,function*(){return jt.apiCall("/api/method/frappe.client.submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:r}})})})}cancelWorkOrder(r){return Ne(this,null,function*(){return jt.apiCall("/api/method/frappe.client.cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:r}})})})}getWorkOrdersByAsset(r,t=50){return Ne(this,null,function*(){const n={asset:r};return(yield this.getWorkOrders(n,void 0,t,0,"creation desc")).work_orders})}getOpenWorkOrders(r=50){return Ne(this,null,function*(){const t={repair_status:["not in",["Completed","Cancelled"]]};return(yield this.getWorkOrders(t,void 0,r,0,"creation desc")).work_orders})}getWorkOrdersByPriority(r,t=50){return Ne(this,null,function*(){const n={custom_priority_:r};return(yield this.getWorkOrders(n,void 0,t,0,"creation desc")).work_orders})}}const nc=new LS,PS=(e,r)=>{const t=ke({},e||{});for(const[n,o]of Object.entries(r))if(!t[n])t[n]=o;else if(Array.isArray(o)&&o[0]==="in"){const u=o[1],f=t[n];if(typeof f=="string")u.includes(f)||(t[n]=["in",[]]);else if(Array.isArray(f)&&f[0]==="in"){const v=f[1].filter(p=>u.includes(p));t[n]=["in",v]}else t[n]=o}return t};function t_(e,r=20,t=0,n,o={}){const[u,f]=R.useState([]),[g,v]=R.useState(0),[p,k]=R.useState(!1),[N,C]=R.useState(!0),[O,I]=R.useState(null),[M,D]=R.useState(0),z=R.useRef(!1),B=JSON.stringify(e),U=JSON.stringify(o);R.useEffect(()=>{if(z.current&&O)return;let q=!1;return z.current=!0,Ne(null,null,function*(){try{C(!0);const V=PS(e,o);console.log("[useWorkOrders] User filters:",e),console.log("[useWorkOrders] Permission filters:",o),console.log("[useWorkOrders] Merged filters:",V);const J=yield nc.getWorkOrders(V,void 0,r,t,n);q||(f(J.work_orders),v(J.total_count),k(J.has_more),I(null))}catch(V){if(!q){const J=V instanceof Error?V.message:"Failed to fetch work orders";J.includes("417")||J.includes("Expectation Failed")||J.includes("has no attribute")?I("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):I(J),f([]),v(0),k(!1)}}finally{q||C(!1)}}),()=>{q=!0}},[B,U,r,t,n,M]);const H=R.useCallback(()=>{z.current=!1,D(q=>q+1)},[]);return{workOrders:u,totalCount:g,hasMore:p,loading:N,error:O,refetch:H}}function FS(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}try{o(!0),f(null);const p=yield nc.getWorkOrderDetails(e);t(p)}catch(p){f(p instanceof Error?p.message:"Failed to fetch work order details")}finally{o(!1)}}),[e]);R.useEffect(()=>{g()},[g]);const v=R.useCallback(()=>{g()},[g]);return{workOrder:r,loading:n,error:u,refetch:v}}function r_(){const[e,r]=R.useState(!1),[t,n]=R.useState(null);return{createWorkOrder:p=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useWorkOrderMutations] Creating work order with data:",p);const k=yield nc.createWorkOrder(p);if(console.log("[useWorkOrderMutations] Create work order response:",k),k.success)return k.work_order;{const N=k.error||"Failed to create work order";throw new Error(N)}}catch(k){console.error("[useWorkOrderMutations] Create work order error:",k);const N=k instanceof Error?k.message:"Failed to create work order";throw n(N),k}finally{r(!1)}}),updateWorkOrder:(p,k)=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useWorkOrderMutations] Updating work order:",p,"with data:",k);const N=yield nc.updateWorkOrder(p,k);if(console.log("[useWorkOrderMutations] Update work order response:",N),N.success)return N.work_order;{const C=N.error||"Failed to update work order";throw new Error(C)}}catch(N){console.error("[useWorkOrderMutations] Update work order error:",N);const C=N instanceof Error?N.message:"Failed to update work order";throw n(C),N}finally{r(!1)}}),deleteWorkOrder:p=>Ne(null,null,function*(){try{r(!0),n(null);const k=yield nc.deleteWorkOrder(p);if(!k.success)throw new Error("Failed to delete work order");return k}catch(k){const N=k instanceof Error?k.message:"Failed to delete work order";throw n(N),k}finally{r(!1)}}),submitWorkOrder:p=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useWorkOrderMutations] Submitting work order:",p);const k=yield nc.submitWorkOrder(p);return console.log("[useWorkOrderMutations] Submit work order response:",k),k}catch(k){console.error("[useWorkOrderMutations] Submit work order error:",k);const N=k instanceof Error?k.message:"Failed to submit work order";throw n(N),k}finally{r(!1)}}),updateStatus:(p,k,N)=>Ne(null,null,function*(){try{r(!0),n(null);const C=yield nc.updateWorkOrderStatus(p,k,N);if(C.success)return C.work_order;throw new Error("Failed to update work order status")}catch(C){const O=C instanceof Error?C.message:"Failed to update status";throw n(O),C}finally{r(!1)}}),loading:e,error:t}}const Hi=jt;class BS{getMaintenanceLogs(r,t,n=20,o=0,u){return Ne(this,null,function*(){const f=new URLSearchParams;r&&f.append("filters",JSON.stringify(r)),t&&t.length>0&&f.append("fields",JSON.stringify(t)),f.append("limit",n.toString()),f.append("offset",o.toString()),u&&f.append("order_by",u),f.append("include_child_tables","true");const g=`${wr.ENDPOINTS.GET_ASSET_MAINTENANCE_LOGS}?${f.toString()}`;return Hi.apiCall(g)})}getMaintenanceLogDetails(r){return Ne(this,null,function*(){const t=new URLSearchParams;t.append("log_name",r),t.append("include_child_tables","true");const n=`${wr.ENDPOINTS.GET_ASSET_MAINTENANCE_LOG_DETAILS}?${t.toString()}`;return Hi.apiCall(n)})}createMaintenanceLog(r){return Ne(this,null,function*(){const t=this.prepareLogData(r);return Hi.apiCall(wr.ENDPOINTS.CREATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_data:t})})})}updateMaintenanceLog(r,t){return Ne(this,null,function*(){const n=this.prepareLogData(t);return Hi.apiCall(wr.ENDPOINTS.UPDATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:r,log_data:n})})})}deleteMaintenanceLog(r){return Ne(this,null,function*(){return Hi.apiCall(wr.ENDPOINTS.DELETE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:r})})})}updateMaintenanceStatus(r,t,n){return Ne(this,null,function*(){return Hi.apiCall(wr.ENDPOINTS.UPDATE_MAINTENANCE_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:r,maintenance_status:t,workflow_state:n})})})}getMaintenanceLogsByAsset(r,t,n=20,o=0){return Ne(this,null,function*(){const u=new URLSearchParams;u.append("asset_name",r),t&&u.append("filters",JSON.stringify(t)),u.append("limit",n.toString()),u.append("offset",o.toString()),u.append("include_child_tables","true");const f=`${wr.ENDPOINTS.GET_MAINTENANCE_LOGS_BY_ASSET}?${u.toString()}`;return Hi.apiCall(f)})}getOverdueMaintenanceLogs(r,t=20,n=0){return Ne(this,null,function*(){const o=new URLSearchParams;r&&o.append("filters",JSON.stringify(r)),o.append("limit",t.toString()),o.append("offset",n.toString()),o.append("include_child_tables","true");const u=`${wr.ENDPOINTS.GET_OVERDUE_MAINTENANCE_LOGS}?${o.toString()}`;return Hi.apiCall(u)})}addPPMTableRow(r,t){return Ne(this,null,function*(){return Hi.apiCall(wr.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:r,row_data:this.cleanPPMRow(t)})})})}removePPMTableRow(r,t){return Ne(this,null,function*(){return Hi.apiCall(wr.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:r,row_name:t})})})}updatePPMTableRow(r,t,n){return Ne(this,null,function*(){return Hi.apiCall(wr.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:r,row_name:t,row_data:this.cleanPPMRow(n)})})})}cleanPPMRow(r){return Ve(ke({},r.name&&!r.name.startsWith("new-")?{name:r.name}:{}),{maintenance_name:r.maintenance_name||"",working:typeof r.working=="boolean"?r.working?1:0:r.working||0,defect_found:typeof r.defect_found=="boolean"?r.defect_found?1:0:r.defect_found||0,not_working:typeof r.not_working=="boolean"?r.not_working?1:0:r.not_working||0})}prepareLogData(r){const t={},n=["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 o of n)r[o]!==void 0&&r[o]!==null&&r[o]!==""&&(t[o]=r[o]);return typeof t.has_certificate=="boolean"&&(t.has_certificate=t.has_certificate?1:0),typeof t.custom_accepted_by_moh=="boolean"&&(t.custom_accepted_by_moh=t.custom_accepted_by_moh?1:0),typeof t.custom_accepted_by_moh_=="boolean"&&(t.custom_accepted_by_moh_=t.custom_accepted_by_moh_?1:0),t.custom_table&&Array.isArray(t.custom_table)&&(t.custom_table=t.custom_table.map(o=>this.cleanPPMRow(o))),t}}const ud=new BS;function ph(e,r=20,t=0,n){const[o,u]=R.useState([]),[f,g]=R.useState(0),[v,p]=R.useState(!1),[k,N]=R.useState(!0),[C,O]=R.useState(null),[I,M]=R.useState(0),D=R.useRef(!1),z=JSON.stringify(e);R.useEffect(()=>{if(D.current&&C)return;let U=!1;return D.current=!0,Ne(null,null,function*(){try{N(!0);const q=yield ud.getMaintenanceLogs(e,void 0,r,t,n);U||(u(q.asset_maintenance_logs),g(q.total_count),p(q.has_more),O(null))}catch(q){if(!U){const ne=q instanceof Error?q.message:"Failed to fetch maintenance logs";ne.includes("417")||ne.includes("Expectation Failed")||ne.includes("has no attribute")?O("API endpoint not deployed. Please deploy asset_maintenance_api.py to your Frappe server."):O(ne),u([]),g(0),p(!1)}}finally{U||N(!1)}}),()=>{U=!0}},[z,r,t,n,I]);const B=R.useCallback(()=>{D.current=!1,M(U=>U+1)},[]);return{logs:o,totalCount:f,hasMore:v,loading:k,error:C,refetch:B}}function US(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}try{o(!0),f(null);const p=yield ud.getMaintenanceLogDetails(e);t(p)}catch(p){f(p instanceof Error?p.message:"Failed to fetch maintenance log details")}finally{o(!1)}}),[e]);R.useEffect(()=>{g()},[g]);const v=R.useCallback(()=>{g()},[g]);return{log:r,loading:n,error:u,refetch:v}}function a_(){const[e,r]=R.useState(!1),[t,n]=R.useState(null);return{createLog:v=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useMaintenanceMutations] Creating maintenance log:",v);const p=yield ud.createMaintenanceLog(v);if(console.log("[useMaintenanceMutations] Create response:",p),p.success)return p.asset_maintenance_log;{const k=p.error||"Failed to create maintenance log";throw new Error(k)}}catch(p){console.error("[useMaintenanceMutations] Create error:",p);const k=p instanceof Error?p.message:"Failed to create maintenance log";throw n(k),p}finally{r(!1)}}),updateLog:(v,p)=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useMaintenanceMutations] Updating maintenance log:",v,p);const k=yield ud.updateMaintenanceLog(v,p);if(console.log("[useMaintenanceMutations] Update response:",k),k.success)return k.asset_maintenance_log;{const N=k.error||"Failed to update maintenance log";throw new Error(N)}}catch(k){console.error("[useMaintenanceMutations] Update error:",k);const N=k instanceof Error?k.message:"Failed to update maintenance log";throw n(N),k}finally{r(!1)}}),deleteLog:v=>Ne(null,null,function*(){try{r(!0),n(null);const p=yield ud.deleteMaintenanceLog(v);if(!p.success)throw new Error("Failed to delete maintenance log");return p}catch(p){const k=p instanceof Error?p.message:"Failed to delete maintenance log";throw n(k),p}finally{r(!1)}}),updateStatus:(v,p,k)=>Ne(null,null,function*(){try{r(!0),n(null);const N=yield ud.updateMaintenanceStatus(v,p,k);if(N.success)return N.asset_maintenance_log;throw new Error("Failed to update maintenance status")}catch(N){const C=N instanceof Error?N.message:"Failed to update status";throw n(C),N}finally{r(!1)}}),loading:e,error:t}}var n_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},rb=Zr.createContext&&Zr.createContext(n_),zS=["attr","size","title"];function HS(e,r){if(e==null)return{};var t=WS(e,r),n,o;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(o=0;o<u.length;o++)n=u[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function WS(e,r){if(e==null)return{};var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(r.indexOf(n)>=0)continue;t[n]=e[n]}return t}function Wf(){return Wf=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Wf.apply(this,arguments)}function ab(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Vf(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ab(Object(t),!0).forEach(function(n){VS(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ab(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function VS(e,r,t){return r=GS(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function GS(e){var r=XS(e,"string");return typeof r=="symbol"?r:r+""}function XS(e,r){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function s_(e){return e&&e.map((r,t)=>Zr.createElement(r.tag,Vf({key:t},r.attr),s_(r.child)))}function sr(e){return r=>Zr.createElement(YS,Wf({attr:Vf({},e.attr)},r),s_(e.child))}function YS(e){var r=t=>{var{attr:n,size:o,title:u}=e,f=HS(e,zS),g=o||t.size||"1em",v;return t.className&&(v=t.className),e.className&&(v=(v?v+" ":"")+e.className),Zr.createElement("svg",Wf({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,f,{className:v,style:Vf(Vf({color:e.color||t.color},t.style),e.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),u&&Zr.createElement("title",null,u),e.children)};return rb!==void 0?Zr.createElement(rb.Consumer,null,t=>r(t)):r(n_)}function ZS(e){return sr({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 Ki(e){return sr({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 $S(e){return sr({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 nb(e){return sr({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 qS(e){return sr({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 KS(e){return sr({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 Ix(e){return sr({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 Yo(e){return sr({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 sr({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 If(e){return sr({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 o_(e){return sr({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z"},child:[]}]})(e)}function JS(e){return sr({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 Ua(e){return sr({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 fi(e){return sr({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 l_(e){return sr({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 Td(e){return sr({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 yh(e){return sr({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 bh(e){return sr({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 ru(e){return sr({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 bf(e){return sr({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 sb(e){return sr({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 Tl(e){return sr({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 QS(e){return sr({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 Ad(e){return sr({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 yc(e){return sr({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 rs(e){return sr({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 au(e){return sr({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 c_(e){return sr({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 e5(e){return sr({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 en(e){return sr({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 Ig(e){return sr({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 Yi(e){return sr({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 t5(e){return sr({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 jd(e){return sr({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 Od(e){return sr({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 Cs(e){return sr({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 $i(e){return sr({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 ib(e){return sr({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 ox(e){return sr({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 r5(e){return sr({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 A0(e){return sr({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 Lg(e){return sr({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 Pg(e){return sr({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 a5(e){return sr({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 n5(e){return sr({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 Ei(e){return sr({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 fc(e){return sr({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 vf(e){return sr({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 Tn(e){return sr({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 xo(e){return sr({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 s5(e){return sr({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 i5(e){return sr({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 fs(e){return sr({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 Bn(e){return sr({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 nu(e){return sr({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 Lx(e){return sr({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 o5(e){return sr({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 _f(e){return sr({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 In(e){return sr({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 Yt(e){return sr({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 lx(e){return sr({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 l5(e){return sr({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 la(e){return sr({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 c5(e){return sr({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 d5(e){return sr({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 u5(e){return sr({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 Gf(e){return sr({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 L0(e){return sr({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 ob(e){return sr({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 cx="#22C55E",dx="#EF4444",Zo=e=>{if(e==null||e==="")return 0;if(typeof e=="number")return Number.isFinite(e)&&e>=0?e:0;if(typeof e=="string"){if(e.includes(":")){const t=e.split(":").map(n=>Number(n)||0);if(t.length===3)return t[0]+t[1]/60+t[2]/3600;if(t.length===2)return t[0]+t[1]/60}const r=Number(e);return Number.isFinite(r)&&r>=0?r:0}return 0},f5=e=>{const r=Zo(e.custom_down_time);let t=Zo(e.custom_up_time);if(t===0&&e.available_for_use_date){const n=new Date(e.available_for_use_date);if(!Number.isNaN(n.getTime())){const u=Math.floor((Date.now()-n.getTime())/864e5)*24;t=Math.max(0,u-r)}}return{up:t,down:r}},d_=e=>{var n,o;if(!e||typeof e!="object"||"error"in e)return!1;const t=(o=(n=e.datasets)==null?void 0:n[0])==null?void 0:o.values;return!Array.isArray(t)||t.length===0?!1:t.reduce((u,f)=>u+Zo(f),0)>0},ux=(e,r,t,n)=>{const o=[],u=[],f=[];return e>0&&(o.push(t),u.push(e),f.push(cx)),r>0&&(o.push(n),u.push(r),f.push(dx)),o.length===0?null:{labels:o,datasets:[{name:"Assets",values:u,colors:f}],type:"Pie"}},h5=e=>{let r=0,t=0;return e.forEach(n=>{const o=(n.custom_device_status||"").trim().toLowerCase();o==="up"?r+=1:o==="down"&&(t+=1)}),{upCount:r,downCount:t}},m5=e=>{let r=0,t=0;return e.forEach(n=>{const{up:o,down:u}=f5(n);r+=o,t+=u}),{totalUp:r,totalDown:t}},g5=(e,r,t)=>{if(!d_(e))return null;const n=e;let o=0,u=0;return(n.labels||[]).forEach((f,g)=>{var C,O,I;const v=Zo((I=(O=(C=n.datasets)==null?void 0:C[0])==null?void 0:O.values)==null?void 0:I[g]);if(v<=0)return;const p=String(f).toLowerCase().trim(),k=p==="down"||p.includes("down time")||p.includes("downtime"),N=p==="up"||p.includes("up time")||p.includes("uptime");k?u+=v:N&&(o+=v)}),ux(o,u,r,t)},x5=()=>{var de,Ae,_e,K;const{t:e}=Xa(),{data:r,loading:t}=e_(),{workOrders:n}=t_({},1e3,0),{logs:o}=ph({},1e3,0),[u,f]=R.useState([]),[g,v]=R.useState(!0),[p,k]=R.useState(null),[N,C]=R.useState(null),[O,I]=R.useState(null),[M,D]=R.useState(null),[z,B]=R.useState(null),[U,H]=R.useState({open:0,inProgress:0,completed:0,total:0}),[q,ne]=R.useState({assetUptime:0,avgResponseTime:0,maintenanceEfficiency:0,overdueTasks:0,plannedMaintenance:0}),{data:V}=cd("Up & Down Time Chart"),{data:J}=cd("Work Order Status Chart"),{data:Q}=cd("Maintenance - Asset wise Count"),{data:Te}=cd("Asset Maintenance Assignees Status Count"),{data:je}=cd("Asset Maintenance Frequency Chart");R.useEffect(()=>{let W=!1;return Ne(null,null,function*(){v(!0);try{const se=JSON.stringify(["name","custom_device_status","custom_up_time","custom_down_time","available_for_use_date"]),he=yield fetch(`/api/resource/Asset?fields=${encodeURIComponent(se)}&limit_page_length=5000`,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"});if(!he.ok)throw new Error(`Asset fetch failed: ${he.status}`);const pe=yield he.json();W||f(pe.data||[])}catch(se){console.error("Failed to load assets for uptime chart:",se),W||f([])}finally{W||v(!1)}}),()=>{W=!0}},[]);const me=e("dashboard.upTime"),Se=e("dashboard.downTime"),Oe=R.useMemo(()=>{if(!u.length)return null;const{upCount:W,downCount:ae}=h5(u);if(W>0||ae>0)return ux(W,ae,me,Se);const{totalUp:se,totalDown:he}=m5(u);return se>0||he>0?ux(se,he,me,Se):null},[u,me,Se]),ue=R.useMemo(()=>g5(V,me,Se),[V,me,Se]),be=Oe!=null?Oe:ue,re=!be&&g;return R.useEffect(()=>{if(n&&n.length>0){const W={};let ae=0,se=0,he=0;n.forEach(gt=>{const ve=gt.repair_status||"Unknown";W[ve]=(W[ve]||0)+1,ve.toLowerCase()==="open"&&ae++,ve.toLowerCase()==="in progress"&&se++,ve.toLowerCase()==="completed"&&he++});const pe=Object.keys(W),Je=Object.values(W),Fe={Open:"#F59E0B","In Progress":"#3B82F6",Pending:"#8B5CF6",Completed:"#10B981",Cancelled:"#EC4899",Unknown:"#6B7280"},ft=pe.map(gt=>Fe[gt]||"#6366F1");k({labels:pe,datasets:[{name:"Work Orders",values:Je,colors:ft}],type:"bar"}),H({open:ae,inProgress:se,completed:he,total:n.length});const ot={},Lt=new Set,zt=gt=>{const ve=gt.toLowerCase().trim();return ve.includes("open")?"Open":ve.includes("work in progress")||ve.includes("in progress")||ve.includes("wip")?"Work In Progress":ve.includes("pending review")||ve.includes("pending")?"Pending Review":ve.includes("completed")||ve.includes("complete")?"Completed":ve.includes("closed")?"Closed":gt};n.forEach(gt=>{const ve=gt.work_order_type||"null",Le=zt(gt.repair_status||"Unknown");Lt.add(Le),ot[ve]||(ot[ve]={}),ot[ve][Le]||(ot[ve][Le]=0),ot[ve][Le]++});const Ht=Object.keys(ot),ht=["Open","Work In Progress","Pending Review","Completed","Closed"],Kt=Array.from(Lt).sort((gt,ve)=>{const Le=ht.indexOf(gt),ut=ht.indexOf(ve);return Le!==-1&&ut!==-1?Le-ut:Le!==-1?-1:ut!==-1?1:gt.localeCompare(ve)}).map(gt=>{const ve=Ht.map(Le=>ot[Le][gt]||0);return{name:gt,values:ve}});C({labels:Ht,datasets:Kt,type:"Bar"})}else C(null)},[n]),R.useEffect(()=>{if(o&&o.length>0){const W={};let ae=0,se=0,he=0;const pe=new Date;o.forEach(We=>{var At,Qt;const Nt=We.asset_name||"Unknown";W[Nt]=(W[Nt]||0)+1,((At=We.maintenance_status)==null?void 0:At.toLowerCase())==="completed"&&ae++,((Qt=We.maintenance_status)==null?void 0:Qt.toLowerCase())==="planned"&&se++,We.due_date&&new Date(We.due_date)<pe&&We.maintenance_status!=="Completed"&&he++});const Je=Object.entries(W).sort(([,We],[,Nt])=>Nt-We).slice(0,10),Fe=Je.map(([We])=>We),ft=Je.map(([,We])=>We),ot=Xf(Fe.length);I({labels:Fe,datasets:[{name:"Maintenance Count",values:ft,colors:ot}],type:"bar"});const Lt=o.length>0?ae/o.length*100:0;ne(We=>Ve(ke({},We),{maintenanceEfficiency:Lt,overdueTasks:he,plannedMaintenance:se}));const zt={},Ht=new Set,ht=(We,Nt)=>{const At=We.toLowerCase().trim(),Qt=new Date,cr=Nt.due_date?new Date(Nt.due_date):null;return cr&&cr<Qt&&At!=="completed"&&At!=="cancelled"?"Overdue":At.includes("completed on time")||At==="completed on time"?"Completed On Time":At.includes("completed within")||At.includes("within sla")||At==="completed"?"Completed Within SLA":At.includes("delay")||At.includes("late")?"Delay In Completion":At.includes("pending")||At==="planned"?"Pending":At.includes("overdue")?"Overdue":At.includes("cancelled")||At==="cancelled"?"Cancelled":We};o.forEach(We=>{const Nt=We.assign_to_name||"null",At=We.maintenance_status||"Unknown",Qt=ht(At,We);Ht.add(Qt),zt[Nt]||(zt[Nt]={}),zt[Nt][Qt]||(zt[Nt][Qt]=0),zt[Nt][Qt]++});const tr=Object.keys(zt),Kt=["Completed On Time","Completed Within SLA","Delay In Completion","Pending","Overdue","Cancelled"],ve=Array.from(Ht).sort((We,Nt)=>{const At=Kt.indexOf(We),Qt=Kt.indexOf(Nt);return At!==-1&&Qt!==-1?At-Qt:At!==-1?-1:Qt!==-1?1:We.localeCompare(Nt)}).map(We=>{const Nt=tr.map(At=>zt[At][We]||0);return{name:We,values:Nt}});D({labels:tr,datasets:ve,type:"Bar"});const Le={};o.forEach(We=>{const Nt=We.periodicity||We.maintenance_type||"Other";Le[Nt]=(Le[Nt]||0)+1});const ut=Object.entries(Le).sort(([,We],[,Nt])=>Nt-We),tt=ut.map(([We])=>We),Wt=ut.map(([,We])=>We),pt=Xf(tt.length);B({labels:tt,datasets:[{name:"Frequency",values:Wt,colors:pt}],type:"bar"})}else D(null),B(null)},[o]),R.useEffect(()=>{if(n&&n.length>0){let W=0,ae=0;n.forEach(Je=>{if(Je.creation&&Je.first_responded_on){const Fe=new Date(Je.creation),ot=(new Date(Je.first_responded_on).getTime()-Fe.getTime())/(1e3*60*60);ot>=0&&(W+=ot,ae++)}});const se=ae>0?W/ae:0,he=n.filter(Je=>{var Fe;return((Fe=Je.repair_status)==null?void 0:Fe.toLowerCase())==="completed"}).length,pe=n.length>0?he/n.length*100:0;ne(Je=>Ve(ke({},Je),{assetUptime:pe,avgResponseTime:se}))}},[n]),t?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(sd,{icon:a.jsx(KS,{className:"text-indigo-600"}),value:(de=r==null?void 0:r.total_assets)!=null?de:0,label:e("dashboard.totalAssets"),bgColor:"bg-indigo-50 dark:bg-indigo-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(sd,{icon:a.jsx(i5,{className:"text-purple-600"}),value:U.open||((Ae=r==null?void 0:r.work_orders_open)!=null?Ae:0),label:e("dashboard.openWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(sd,{icon:a.jsx(Tl,{className:"text-blue-600"}),value:U.inProgress||((_e=r==null?void 0:r.work_orders_in_progress)!=null?_e:0),label:e("dashboard.workOrdersInProgress"),bgColor:"bg-blue-50 dark:bg-blue-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(sd,{icon:a.jsx(Ua,{className:"text-pink-600"}),value:U.completed||((K=r==null?void 0:r.work_orders_completed)!=null?K:0),label:e("dashboard.completedWorkOrders"),bgColor:"bg-pink-50 dark:bg-pink-900/20"})}),a.jsx("div",{className:"col-span-2",children:a.jsx(sd,{icon:a.jsx(lx,{className:"text-cyan-600"}),value:(o==null?void 0:o.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(sd,{icon:a.jsx(JS,{className:"text-purple-600"}),value:U.total,label:e("dashboard.totalWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})})]})}),a.jsx(p5,{totalWorkOrders:U.total,completedWorkOrders:U.completed,inProgressWorkOrders:U.inProgress})]}),a.jsx("div",{className:"lg:col-span-5",children:a.jsx(lb,{title:e("dashboard.assigneesStatus"),data:M||Te})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[a.jsx(wf,{icon:a.jsx(Ua,{className:"text-green-500"}),title:e("dashboard.assetUptime"),value:`${q.assetUptime.toFixed(1)}%`,trend:q.assetUptime>=90?"Excellent":q.assetUptime>=75?"Good":"Needs Attention",trendUp:q.assetUptime>=75,bgColor:"bg-green-50 dark:bg-green-900/20"}),a.jsx(wf,{icon:a.jsx(Tl,{className:"text-blue-500"}),title:e("dashboard.avgResponseTime"),value:q.avgResponseTime>0?`${q.avgResponseTime.toFixed(1)} hrs`:"N/A",trend:q.avgResponseTime>0&&q.avgResponseTime<4?"Fast Response":"Monitor",trendUp:q.avgResponseTime>0&&q.avgResponseTime<4,bgColor:"bg-blue-50 dark:bg-blue-900/20"}),a.jsx(wf,{icon:a.jsx(lx,{className:"text-orange-500"}),title:e("dashboard.maintenanceEfficiency"),value:`${q.maintenanceEfficiency.toFixed(1)}%`,trend:q.maintenanceEfficiency>=70?"On Track":"Needs Attention",trendUp:q.maintenanceEfficiency>=70,bgColor:"bg-orange-50 dark:bg-orange-900/20"}),a.jsx(wf,{icon:a.jsx(en,{className:"text-red-500"}),title:e("dashboard.overdueMaintenance"),value:q.overdueTasks,trend:q.overdueTasks===0?"All Clear":q.overdueTasks<=3?"Low":"High Priority",trendUp:q.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(b5,{data:be,loading:re,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(cb,{title:e("dashboard.maintenanceByAsset"),data:O||Q,type:"bar"}),a.jsx(cb,{title:e("dashboard.maintenanceFrequency"),data:z||je,type:"bar"}),a.jsx(y5,{data:p||J,totalWorkOrders:U.total,completedWorkOrders:U.completed}),a.jsx(lb,{title:e("dashboard.workOrderStatus"),data:N||J})]})]})})},sd=({icon:e,value:r,label:t,bgColor:n})=>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 ${n} 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:r}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide leading-tight px-1",children:t})]}),wf=({icon:e,title:r,value:t,trend:n,trendUp:o,bgColor:u})=>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 ${u} rounded-lg flex items-center justify-center text-lg`,children:e}),a.jsxs("div",{className:`flex items-center gap-1 text-xs font-medium ${o?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[o?a.jsx($S,{className:"text-[10px]"}):a.jsx(ZS,{className:"text-[10px]"}),n]})]}),a.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-1",children:t}),a.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:r})]}),p5=({totalWorkOrders:e,completedWorkOrders:r,inProgressWorkOrders:t})=>{const n=e>0?(r/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:[n,"%"]}),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(v5,{})}),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:t}),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:r}),a.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Completed"})]})]})]})},y5=({data:e,totalWorkOrders:r,completedWorkOrders:t})=>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:[r," Total"]}),a.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:[a.jsxs("span",{className:"font-medium",children:[t," Completed"]}),a.jsxs("span",{className:"ml-1",children:["(",r>0?(t/r*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})})]}),b5=({data:e,title:r,description:t,loading:n})=>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:r}),a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-4",children:t}),n?a.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400 text-sm",children:"Loading chart data..."}):d_(e)?a.jsx(f_,{data:e}):a.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:"No data available"})]}),v5=()=>{const e=[10,15,13,17,14,18,16],r=Math.max(...e),t=400,n=80,o=e.map((f,g)=>{const v=g/(e.length-1)*t,p=n-f/r*n;return`${v},${p}`}).join(" "),u=`0,${n} ${o} ${t},${n}`;return a.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${t} ${n}`,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:u,fill:"url(#areaGradient)"}),a.jsx("polyline",{points:o,fill:"none",stroke:"#8B5CF6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},_5=(e,r,t)=>{if(t!=null&&t>0){const n=(r/t*100).toFixed(1);return`${e}: ${r} (${n}%)`}return`${e}: ${r}`},Px=()=>{const[e,r]=R.useState(null),t=R.useCallback((o,u,f,g,v)=>{r({x:o,y:u,text:_5(f,g,v)})},[]),n=R.useCallback(()=>r(null),[]);return{tooltip:e,show:t,hide:n}},Fx=({tooltip:e})=>e?a.jsx("div",{className:"fixed z-[9999] pointer-events-none px-2.5 py-1.5 rounded text-xs font-medium text-white bg-gray-900 shadow-lg whitespace-nowrap",style:{left:e.x,top:e.y-8,transform:"translate(-50%, -100%)"},role:"tooltip",children:e.text}):null,w5=({data:e})=>{const{tooltip:r,show:t,hide:n}=Px(),o=(e==null?void 0:e.labels)||[],u=(e==null?void 0:e.datasets)||[];if(!u.length)return a.jsx("div",{className:"text-center text-gray-400 py-4 text-sm",children:"No data available"});const f=u.flatMap(z=>z.values||[]),g=Math.max(...f,1),v=240,p=Math.max(800,o.length*100),k=Math.min(120,(p-100)/o.length),N=4,C=u.length,O=Math.max(12,(k-N*(C+1))/C),I={"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"},M=(z,B)=>{for(const[U,H]of Object.entries(I))if(z.toLowerCase().includes(U.toLowerCase()))return H;return Xf(C)[B]},D=o.map((z,B)=>u.reduce((U,H)=>{var q;return U+Zo((q=H.values)==null?void 0:q[B])},0));return a.jsxs("div",{className:"relative w-full overflow-x-auto",onMouseLeave:n,children:[a.jsx(Fx,{tooltip:r}),a.jsxs("svg",{width:"100%",height:v+40,viewBox:`0 0 ${p} ${v+40}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[a.jsx("defs",{children:u.map((z,B)=>{const U=M(z.name||"",B);return a.jsxs("linearGradient",{id:`groupedBarGradient${B}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:U,stopOpacity:.9}}),a.jsx("stop",{offset:"100%",style:{stopColor:U,stopOpacity:.7}})]},B)})}),[0,.25,.5,.75,1].map((z,B)=>a.jsx("line",{x1:"60",y1:v-z*v,x2:p-20,y2:v-z*v,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},B)),[0,.25,.5,.75,1].map((z,B)=>a.jsx("text",{x:"45",y:v-z*v+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(g*z).toFixed(z===0?0:g<5?1:0)},B)),a.jsx("text",{x:"15",y:v/2,textAnchor:"middle",transform:`rotate(-90, 15, ${v/2})`,className:"text-xs fill-gray-600 dark:fill-gray-400 font-medium",children:"Count"}),o.map((z,B)=>{const U=80+B*k;return a.jsxs("g",{children:[u.map((H,q)=>{var Se;const ne=Zo((Se=H.values)==null?void 0:Se[B]),V=ne/g*v,J=U+N+q*(O+N),Q=v-V,Te=M(H.name||"",q),je=H.name||`Series ${q+1}`,me=o.length>1?`${z} — ${je}`:je;return a.jsx("g",{children:a.jsx("rect",{x:J,y:Q,width:O,height:V,fill:Te,rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity",onMouseEnter:Oe=>t(Oe.clientX,Oe.clientY,me,ne,D[B]),onMouseMove:Oe=>t(Oe.clientX,Oe.clientY,me,ne,D[B]),onMouseLeave:n})},q)}),a.jsx("text",{x:U+k/2,y:v+15,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:z&&z.length>12?z.substring(0,10)+"...":z||"null"})]},B)})]}),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:u.map((z,B)=>{const U=M(z.name||"",B);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:U}}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:z.name&&z.name.length>20?z.name.substring(0,18)+"...":z.name||`Series ${B+1}`})]},B)})})]})},u_=({data:e})=>{var I;const{tooltip:r,show:t,hide:n}=Px(),o=(e==null?void 0:e.labels)||[],u=(e==null?void 0:e.datasets)||[];if(!u.length)return a.jsx("div",{className:"text-center text-gray-400 py-8",children:"No data available"});const f=u.flatMap(M=>M.values||[]),g=Math.max(...f,1),v=250,N=Math.max(800,o.length*60+100),C=(((I=u[0])==null?void 0:I.values)||[]).map(M=>Zo(M)),O=C.reduce((M,D)=>M+D,0);return a.jsxs("div",{className:"relative w-full overflow-x-auto",onMouseLeave:n,children:[a.jsx(Fx,{tooltip:r}),a.jsxs("svg",{width:"100%",height:"320",viewBox:`0 0 ${N} ${v+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((M,D)=>a.jsx("line",{x1:"60",y1:v-M*v,x2:N-20,y2:v-M*v,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},D)),[0,.25,.5,.75,1].map((M,D)=>a.jsx("text",{x:"45",y:v-M*v+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(g*M).toFixed(0)},D)),o.map((M,D)=>{var q,ne;const z=Zo((ne=(q=u[0])==null?void 0:q.values)==null?void 0:ne[D]),B=z/g*v,U=Math.min(40,(N-100)/o.length-10),H=80+D*((N-100)/o.length);return a.jsx("g",{children:a.jsx("rect",{x:H,y:v-B,width:U,height:B,fill:"url(#barGradient)",rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity",onMouseEnter:V=>t(V.clientX,V.clientY,M||"Value",z,O),onMouseMove:V=>t(V.clientX,V.clientY,M||"Value",z,O),onMouseLeave:n})},D)}),C.length>0&&a.jsx("polyline",{points:C.map((M,D)=>{const z=80+D*((N-100)/o.length)+20,B=v-M/g*v;return`${z},${B}`}).join(" "),fill:"none",stroke:"#60A5FA",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"drop-shadow-md"}),C.map((M,D)=>{const z=80+D*((N-100)/o.length)+20,B=v-M/g*v,U=o[D]||"Value";return a.jsx("circle",{cx:z,cy:B,r:"4",fill:"#3B82F6",className:"hover:r-6 cursor-pointer transition-all",onMouseEnter:H=>t(H.clientX,H.clientY,U,M,O),onMouseMove:H=>t(H.clientX,H.clientY,U,M,O),onMouseLeave:n},D)}),o.map((M,D)=>{const z=(N-100)/o.length,B=80+D*z+z/2,U=M&&M.length>15?M.substring(0,13)+"...":M||"null";return a.jsx("text",{x:B,y:v+50,transform:`rotate(-45, ${B}, ${v+50})`,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:U},D)})]}),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"})]})]})]})},f_=({data:e})=>{var M,D,z,B;const{tooltip:r,show:t,hide:n}=Px(),o=(e==null?void 0:e.labels)||[],u=(((D=(M=e==null?void 0:e.datasets)==null?void 0:M[0])==null?void 0:D.values)||[]).map(U=>Zo(U)),f=U=>{const H=U.toLowerCase();return H.includes("up")||H.includes("down")||H.includes("تشغيل")||H.includes("توقف")},g=o.some(f);let v=[];if(g&&o.length>=1)v=o.map(U=>{const H=U.toLowerCase();return H.includes("down")||U.includes("توقف")?dx:H.includes("up")||U.includes("تشغيل")||o.indexOf(U)===0?cx:dx});else{const U=(B=(z=e==null?void 0:e.datasets)==null?void 0:z[0])==null?void 0:B.colors;v=U&&U.length===u.length?U:Xf(u.length)}const p=u.reduce((U,H)=>U+H,0);if(p<=0||o.length===0)return a.jsx("div",{className:"h-48 flex items-center justify-center text-gray-400 text-sm",children:"No data available"});const k=100,N=k+10,C=k+10;let O=0;const I=u.map((U,H)=>{const q=O/p*2*Math.PI-Math.PI/2;O+=U;const ne=O/p*2*Math.PI-Math.PI/2,V=ne-q>Math.PI?1:0,J=N+k*Math.cos(q),Q=C+k*Math.sin(q),Te=N+k*Math.cos(ne),je=C+k*Math.sin(ne);return{path:`M ${N} ${C} L ${J} ${Q} A ${k} ${k} 0 ${V} 1 ${Te} ${je} Z`,color:v[H],label:o[H],value:U,percentage:(U/p*100).toFixed(1)}});return a.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-around",onMouseLeave:n,children:[a.jsx(Fx,{tooltip:r}),a.jsx("svg",{width:N*2,height:C*2,viewBox:`0 0 ${N*2} ${C*2}`,className:"max-w-xs",children:I.map((U,H)=>a.jsx("path",{d:U.path,fill:U.color,className:"hover:opacity-90 transition-opacity cursor-pointer drop-shadow-lg",onMouseEnter:q=>t(q.clientX,q.clientY,U.label,U.value,p),onMouseMove:q=>t(q.clientX,q.clientY,U.label,U.value,p),onMouseLeave:n},H))}),a.jsx("div",{className:"flex flex-col gap-3 mt-4 md:mt-0",children:I.map((U,H)=>a.jsxs("div",{className:"flex items-center gap-3 cursor-pointer rounded px-1 py-0.5 hover:bg-gray-100 dark:hover:bg-gray-700/50",onMouseEnter:q=>t(q.clientX,q.clientY,U.label,U.value,p),onMouseMove:q=>t(q.clientX,q.clientY,U.label,U.value,p),onMouseLeave:n,children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:U.color}}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:U.label}),a.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-white",children:U.value})]},H))})]})},lb=({title:e,data:r})=>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"})})})]})]}),!r||!r.datasets||!r.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(w5,{data:r})]}),cb=({title:e,data:r,type:t})=>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}),!r||!r.datasets||!r.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"})})}):t==="pie"?a.jsx(f_,{data:r}):a.jsx(u_,{data:r})]});function Xf(e){const r=["#8B5CF6","#6366F1","#3B82F6","#06B6D4","#14B8A6","#EC4899","#A855F7","#0EA5E9","#10B981","#F472B6","#7C3AED","#2DD4BF"];return Array.from({length:e},(t,n)=>r[n%r.length])}function h_(e,r){return function(){return e.apply(r,arguments)}}const{toString:k5}=Object.prototype,{getPrototypeOf:Bx}=Object,{iterator:vh,toStringTag:m_}=Symbol,_h=(e=>r=>{const t=k5.call(r);return e[t]||(e[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ji=e=>(e=e.toLowerCase(),r=>_h(r)===e),wh=e=>r=>typeof r===e,{isArray:Md}=Array,kd=wh("undefined");function su(e){return e!==null&&!kd(e)&&e.constructor!==null&&!kd(e.constructor)&&zs(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const g_=Ji("ArrayBuffer");function N5(e){let r;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&g_(e.buffer),r}const S5=wh("string"),zs=wh("function"),x_=wh("number"),iu=e=>e!==null&&typeof e=="object",E5=e=>e===!0||e===!1,Lf=e=>{if(_h(e)!=="object")return!1;const r=Bx(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(m_ in e)&&!(vh in e)},C5=e=>{if(!iu(e)||su(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(r){return!1}},T5=Ji("Date"),A5=Ji("File"),j5=Ji("Blob"),O5=Ji("FileList"),M5=e=>iu(e)&&zs(e.pipe),R5=e=>{let r;return e&&(typeof FormData=="function"&&e instanceof FormData||zs(e.append)&&((r=_h(e))==="formdata"||r==="object"&&zs(e.toString)&&e.toString()==="[object FormData]"))},D5=Ji("URLSearchParams"),[I5,L5,P5,F5]=["ReadableStream","Request","Response","Headers"].map(Ji),B5=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ou(e,r,{allOwnKeys:t=!1}={}){if(e===null||typeof e=="undefined")return;let n,o;if(typeof e!="object"&&(e=[e]),Md(e))for(n=0,o=e.length;n<o;n++)r.call(null,e[n],n,e);else{if(su(e))return;const u=t?Object.getOwnPropertyNames(e):Object.keys(e),f=u.length;let g;for(n=0;n<f;n++)g=u[n],r.call(null,e[g],g,e)}}function p_(e,r){if(su(e))return null;r=r.toLowerCase();const t=Object.keys(e);let n=t.length,o;for(;n-- >0;)if(o=t[n],r===o.toLowerCase())return o;return null}const ic=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,y_=e=>!kd(e)&&e!==ic;function fx(){const{caseless:e,skipUndefined:r}=y_(this)&&this||{},t={},n=(o,u)=>{const f=e&&p_(t,u)||u;Lf(t[f])&&Lf(o)?t[f]=fx(t[f],o):Lf(o)?t[f]=fx({},o):Md(o)?t[f]=o.slice():(!r||!kd(o))&&(t[f]=o)};for(let o=0,u=arguments.length;o<u;o++)arguments[o]&&ou(arguments[o],n);return t}const U5=(e,r,t,{allOwnKeys:n}={})=>(ou(r,(o,u)=>{t&&zs(o)?e[u]=h_(o,t):e[u]=o},{allOwnKeys:n}),e),z5=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),H5=(e,r,t,n)=>{e.prototype=Object.create(r.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:r.prototype}),t&&Object.assign(e.prototype,t)},W5=(e,r,t,n)=>{let o,u,f;const g={};if(r=r||{},e==null)return r;do{for(o=Object.getOwnPropertyNames(e),u=o.length;u-- >0;)f=o[u],(!n||n(f,e,r))&&!g[f]&&(r[f]=e[f],g[f]=!0);e=t!==!1&&Bx(e)}while(e&&(!t||t(e,r))&&e!==Object.prototype);return r},V5=(e,r,t)=>{e=String(e),(t===void 0||t>e.length)&&(t=e.length),t-=r.length;const n=e.indexOf(r,t);return n!==-1&&n===t},G5=e=>{if(!e)return null;if(Md(e))return e;let r=e.length;if(!x_(r))return null;const t=new Array(r);for(;r-- >0;)t[r]=e[r];return t},X5=(e=>r=>e&&r instanceof e)(typeof Uint8Array!="undefined"&&Bx(Uint8Array)),Y5=(e,r)=>{const n=(e&&e[vh]).call(e);let o;for(;(o=n.next())&&!o.done;){const u=o.value;r.call(e,u[0],u[1])}},Z5=(e,r)=>{let t;const n=[];for(;(t=e.exec(r))!==null;)n.push(t);return n},$5=Ji("HTMLFormElement"),q5=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,o){return n.toUpperCase()+o}),db=(({hasOwnProperty:e})=>(r,t)=>e.call(r,t))(Object.prototype),K5=Ji("RegExp"),b_=(e,r)=>{const t=Object.getOwnPropertyDescriptors(e),n={};ou(t,(o,u)=>{let f;(f=r(o,u,e))!==!1&&(n[u]=f||o)}),Object.defineProperties(e,n)},J5=e=>{b_(e,(r,t)=>{if(zs(e)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=e[t];if(zs(n)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Q5=(e,r)=>{const t={},n=o=>{o.forEach(u=>{t[u]=!0})};return Md(e)?n(e):n(String(e).split(r)),t},e8=()=>{},t8=(e,r)=>e!=null&&Number.isFinite(e=+e)?e:r;function r8(e){return!!(e&&zs(e.append)&&e[m_]==="FormData"&&e[vh])}const a8=e=>{const r=new Array(10),t=(n,o)=>{if(iu(n)){if(r.indexOf(n)>=0)return;if(su(n))return n;if(!("toJSON"in n)){r[o]=n;const u=Md(n)?[]:{};return ou(n,(f,g)=>{const v=t(f,o+1);!kd(v)&&(u[g]=v)}),r[o]=void 0,u}}return n};return t(e,0)},n8=Ji("AsyncFunction"),s8=e=>e&&(iu(e)||zs(e))&&zs(e.then)&&zs(e.catch),v_=((e,r)=>e?setImmediate:r?((t,n)=>(ic.addEventListener("message",({source:o,data:u})=>{o===ic&&u===t&&n.length&&n.shift()()},!1),o=>{n.push(o),ic.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",zs(ic.postMessage)),i8=typeof queueMicrotask!="undefined"?queueMicrotask.bind(ic):typeof process!="undefined"&&process.nextTick||v_,o8=e=>e!=null&&zs(e[vh]),dt={isArray:Md,isArrayBuffer:g_,isBuffer:su,isFormData:R5,isArrayBufferView:N5,isString:S5,isNumber:x_,isBoolean:E5,isObject:iu,isPlainObject:Lf,isEmptyObject:C5,isReadableStream:I5,isRequest:L5,isResponse:P5,isHeaders:F5,isUndefined:kd,isDate:T5,isFile:A5,isBlob:j5,isRegExp:K5,isFunction:zs,isStream:M5,isURLSearchParams:D5,isTypedArray:X5,isFileList:O5,forEach:ou,merge:fx,extend:U5,trim:B5,stripBOM:z5,inherits:H5,toFlatObject:W5,kindOf:_h,kindOfTest:Ji,endsWith:V5,toArray:G5,forEachEntry:Y5,matchAll:Z5,isHTMLForm:$5,hasOwnProperty:db,hasOwnProp:db,reduceDescriptors:b_,freezeMethods:J5,toObjectSet:Q5,toCamelCase:q5,noop:e8,toFiniteNumber:t8,findKey:p_,global:ic,isContextDefined:y_,isSpecCompliantForm:r8,toJSONObject:a8,isAsyncFn:n8,isThenable:s8,setImmediate:v_,asap:i8,isIterable:o8};function Rr(e,r,t,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",r&&(this.code=r),t&&(this.config=t),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}dt.inherits(Rr,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:dt.toJSONObject(this.config),code:this.code,status:this.status}}});const __=Rr.prototype,w_={};["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=>{w_[e]={value:e}});Object.defineProperties(Rr,w_);Object.defineProperty(__,"isAxiosError",{value:!0});Rr.from=(e,r,t,n,o,u)=>{const f=Object.create(__);dt.toFlatObject(e,f,function(k){return k!==Error.prototype},p=>p!=="isAxiosError");const g=e&&e.message?e.message:"Error",v=r==null&&e?e.code:r;return Rr.call(f,g,v,t,n,o),e&&f.cause==null&&Object.defineProperty(f,"cause",{value:e,configurable:!0}),f.name=e&&e.name||"Error",u&&Object.assign(f,u),f};const l8=null;function hx(e){return dt.isPlainObject(e)||dt.isArray(e)}function k_(e){return dt.endsWith(e,"[]")?e.slice(0,-2):e}function ub(e,r,t){return e?e.concat(r).map(function(o,u){return o=k_(o),!t&&u?"["+o+"]":o}).join(t?".":""):r}function c8(e){return dt.isArray(e)&&!e.some(hx)}const d8=dt.toFlatObject(dt,{},null,function(r){return/^is[A-Z]/.test(r)});function kh(e,r,t){if(!dt.isObject(e))throw new TypeError("target must be an object");r=r||new FormData,t=dt.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(M,D){return!dt.isUndefined(D[M])});const n=t.metaTokens,o=t.visitor||k,u=t.dots,f=t.indexes,v=(t.Blob||typeof Blob!="undefined"&&Blob)&&dt.isSpecCompliantForm(r);if(!dt.isFunction(o))throw new TypeError("visitor must be a function");function p(I){if(I===null)return"";if(dt.isDate(I))return I.toISOString();if(dt.isBoolean(I))return I.toString();if(!v&&dt.isBlob(I))throw new Rr("Blob is not supported. Use a Buffer instead.");return dt.isArrayBuffer(I)||dt.isTypedArray(I)?v&&typeof Blob=="function"?new Blob([I]):Buffer.from(I):I}function k(I,M,D){let z=I;if(I&&!D&&typeof I=="object"){if(dt.endsWith(M,"{}"))M=n?M:M.slice(0,-2),I=JSON.stringify(I);else if(dt.isArray(I)&&c8(I)||(dt.isFileList(I)||dt.endsWith(M,"[]"))&&(z=dt.toArray(I)))return M=k_(M),z.forEach(function(U,H){!(dt.isUndefined(U)||U===null)&&r.append(f===!0?ub([M],H,u):f===null?M:M+"[]",p(U))}),!1}return hx(I)?!0:(r.append(ub(D,M,u),p(I)),!1)}const N=[],C=Object.assign(d8,{defaultVisitor:k,convertValue:p,isVisitable:hx});function O(I,M){if(!dt.isUndefined(I)){if(N.indexOf(I)!==-1)throw Error("Circular reference detected in "+M.join("."));N.push(I),dt.forEach(I,function(z,B){(!(dt.isUndefined(z)||z===null)&&o.call(r,z,dt.isString(B)?B.trim():B,M,C))===!0&&O(z,M?M.concat(B):[B])}),N.pop()}}if(!dt.isObject(e))throw new TypeError("data must be an object");return O(e),r}function fb(e){const r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return r[n]})}function Ux(e,r){this._pairs=[],e&&kh(e,this,r)}const N_=Ux.prototype;N_.append=function(r,t){this._pairs.push([r,t])};N_.toString=function(r){const t=r?function(n){return r.call(this,n,fb)}:fb;return this._pairs.map(function(o){return t(o[0])+"="+t(o[1])},"").join("&")};function u8(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function S_(e,r,t){if(!r)return e;const n=t&&t.encode||u8;dt.isFunction(t)&&(t={serialize:t});const o=t&&t.serialize;let u;if(o?u=o(r,t):u=dt.isURLSearchParams(r)?r.toString():new Ux(r,t).toString(n),u){const f=e.indexOf("#");f!==-1&&(e=e.slice(0,f)),e+=(e.indexOf("?")===-1?"?":"&")+u}return e}class hb{constructor(){this.handlers=[]}use(r,t,n){return this.handlers.push({fulfilled:r,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){dt.forEach(this.handlers,function(n){n!==null&&r(n)})}}const E_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},f8=typeof URLSearchParams!="undefined"?URLSearchParams:Ux,h8=typeof FormData!="undefined"?FormData:null,m8=typeof Blob!="undefined"?Blob:null,g8={isBrowser:!0,classes:{URLSearchParams:f8,FormData:h8,Blob:m8},protocols:["http","https","file","blob","url","data"]},zx=typeof window!="undefined"&&typeof document!="undefined",mx=typeof navigator=="object"&&navigator||void 0,x8=zx&&(!mx||["ReactNative","NativeScript","NS"].indexOf(mx.product)<0),p8=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",y8=zx&&window.location.href||"http://localhost",b8=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zx,hasStandardBrowserEnv:x8,hasStandardBrowserWebWorkerEnv:p8,navigator:mx,origin:y8},Symbol.toStringTag,{value:"Module"})),us=ke(ke({},b8),g8);function v8(e,r){return kh(e,new us.classes.URLSearchParams,ke({visitor:function(t,n,o,u){return us.isNode&&dt.isBuffer(t)?(this.append(n,t.toString("base64")),!1):u.defaultVisitor.apply(this,arguments)}},r))}function _8(e){return dt.matchAll(/\w+|\[(\w*)]/g,e).map(r=>r[0]==="[]"?"":r[1]||r[0])}function w8(e){const r={},t=Object.keys(e);let n;const o=t.length;let u;for(n=0;n<o;n++)u=t[n],r[u]=e[u];return r}function C_(e){function r(t,n,o,u){let f=t[u++];if(f==="__proto__")return!0;const g=Number.isFinite(+f),v=u>=t.length;return f=!f&&dt.isArray(o)?o.length:f,v?(dt.hasOwnProp(o,f)?o[f]=[o[f],n]:o[f]=n,!g):((!o[f]||!dt.isObject(o[f]))&&(o[f]=[]),r(t,n,o[f],u)&&dt.isArray(o[f])&&(o[f]=w8(o[f])),!g)}if(dt.isFormData(e)&&dt.isFunction(e.entries)){const t={};return dt.forEachEntry(e,(n,o)=>{r(_8(n),o,t,0)}),t}return null}function k8(e,r,t){if(dt.isString(e))try{return(r||JSON.parse)(e),dt.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(e)}const lu={transitional:E_,adapter:["xhr","http","fetch"],transformRequest:[function(r,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,u=dt.isObject(r);if(u&&dt.isHTMLForm(r)&&(r=new FormData(r)),dt.isFormData(r))return o?JSON.stringify(C_(r)):r;if(dt.isArrayBuffer(r)||dt.isBuffer(r)||dt.isStream(r)||dt.isFile(r)||dt.isBlob(r)||dt.isReadableStream(r))return r;if(dt.isArrayBufferView(r))return r.buffer;if(dt.isURLSearchParams(r))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),r.toString();let g;if(u){if(n.indexOf("application/x-www-form-urlencoded")>-1)return v8(r,this.formSerializer).toString();if((g=dt.isFileList(r))||n.indexOf("multipart/form-data")>-1){const v=this.env&&this.env.FormData;return kh(g?{"files[]":r}:r,v&&new v,this.formSerializer)}}return u||o?(t.setContentType("application/json",!1),k8(r)):r}],transformResponse:[function(r){const t=this.transitional||lu.transitional,n=t&&t.forcedJSONParsing,o=this.responseType==="json";if(dt.isResponse(r)||dt.isReadableStream(r))return r;if(r&&dt.isString(r)&&(n&&!this.responseType||o)){const f=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(r,this.parseReviver)}catch(g){if(f)throw g.name==="SyntaxError"?Rr.from(g,Rr.ERR_BAD_RESPONSE,this,null,this.response):g}}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:us.classes.FormData,Blob:us.classes.Blob},validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};dt.forEach(["delete","get","head","post","put","patch"],e=>{lu.headers[e]={}});const N8=dt.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"]),S8=e=>{const r={};let t,n,o;return e&&e.split(`
`).forEach(function(f){o=f.indexOf(":"),t=f.substring(0,o).trim().toLowerCase(),n=f.substring(o+1).trim(),!(!t||r[t]&&N8[t])&&(t==="set-cookie"?r[t]?r[t].push(n):r[t]=[n]:r[t]=r[t]?r[t]+", "+n:n)}),r},mb=Symbol("internals");function C0(e){return e&&String(e).trim().toLowerCase()}function Pf(e){return e===!1||e==null?e:dt.isArray(e)?e.map(Pf):String(e)}function E8(e){const r=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(e);)r[n[1]]=n[2];return r}const C8=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Fg(e,r,t,n,o){if(dt.isFunction(n))return n.call(this,r,t);if(o&&(r=t),!!dt.isString(r)){if(dt.isString(n))return r.indexOf(n)!==-1;if(dt.isRegExp(n))return n.test(r)}}function T8(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(r,t,n)=>t.toUpperCase()+n)}function A8(e,r){const t=dt.toCamelCase(" "+r);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+t,{value:function(o,u,f){return this[n].call(this,r,o,u,f)},configurable:!0})})}let Hs=class{constructor(r){r&&this.set(r)}set(r,t,n){const o=this;function u(g,v,p){const k=C0(v);if(!k)throw new Error("header name must be a non-empty string");const N=dt.findKey(o,k);(!N||o[N]===void 0||p===!0||p===void 0&&o[N]!==!1)&&(o[N||v]=Pf(g))}const f=(g,v)=>dt.forEach(g,(p,k)=>u(p,k,v));if(dt.isPlainObject(r)||r instanceof this.constructor)f(r,t);else if(dt.isString(r)&&(r=r.trim())&&!C8(r))f(S8(r),t);else if(dt.isObject(r)&&dt.isIterable(r)){let g={},v,p;for(const k of r){if(!dt.isArray(k))throw TypeError("Object iterator must return a key-value pair");g[p=k[0]]=(v=g[p])?dt.isArray(v)?[...v,k[1]]:[v,k[1]]:k[1]}f(g,t)}else r!=null&&u(t,r,n);return this}get(r,t){if(r=C0(r),r){const n=dt.findKey(this,r);if(n){const o=this[n];if(!t)return o;if(t===!0)return E8(o);if(dt.isFunction(t))return t.call(this,o,n);if(dt.isRegExp(t))return t.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(r,t){if(r=C0(r),r){const n=dt.findKey(this,r);return!!(n&&this[n]!==void 0&&(!t||Fg(this,this[n],n,t)))}return!1}delete(r,t){const n=this;let o=!1;function u(f){if(f=C0(f),f){const g=dt.findKey(n,f);g&&(!t||Fg(n,n[g],g,t))&&(delete n[g],o=!0)}}return dt.isArray(r)?r.forEach(u):u(r),o}clear(r){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const u=t[n];(!r||Fg(this,this[u],u,r,!0))&&(delete this[u],o=!0)}return o}normalize(r){const t=this,n={};return dt.forEach(this,(o,u)=>{const f=dt.findKey(n,u);if(f){t[f]=Pf(o),delete t[u];return}const g=r?T8(u):String(u).trim();g!==u&&delete t[u],t[g]=Pf(o),n[g]=!0}),this}concat(...r){return this.constructor.concat(this,...r)}toJSON(r){const t=Object.create(null);return dt.forEach(this,(n,o)=>{n!=null&&n!==!1&&(t[o]=r&&dt.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([r,t])=>r+": "+t).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...t){const n=new this(r);return t.forEach(o=>n.set(o)),n}static accessor(r){const n=(this[mb]=this[mb]={accessors:{}}).accessors,o=this.prototype;function u(f){const g=C0(f);n[g]||(A8(o,f),n[g]=!0)}return dt.isArray(r)?r.forEach(u):u(r),this}};Hs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);dt.reduceDescriptors(Hs.prototype,({value:e},r)=>{let t=r[0].toUpperCase()+r.slice(1);return{get:()=>e,set(n){this[t]=n}}});dt.freezeMethods(Hs);function Bg(e,r){const t=this||lu,n=r||t,o=Hs.from(n.headers);let u=n.data;return dt.forEach(e,function(g){u=g.call(t,u,o.normalize(),r?r.status:void 0)}),o.normalize(),u}function T_(e){return!!(e&&e.__CANCEL__)}function Rd(e,r,t){Rr.call(this,e==null?"canceled":e,Rr.ERR_CANCELED,r,t),this.name="CanceledError"}dt.inherits(Rd,Rr,{__CANCEL__:!0});function A_(e,r,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?e(t):r(new Rr("Request failed with status code "+t.status,[Rr.ERR_BAD_REQUEST,Rr.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function j8(e){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return r&&r[1]||""}function O8(e,r){e=e||10;const t=new Array(e),n=new Array(e);let o=0,u=0,f;return r=r!==void 0?r:1e3,function(v){const p=Date.now(),k=n[u];f||(f=p),t[o]=v,n[o]=p;let N=u,C=0;for(;N!==o;)C+=t[N++],N=N%e;if(o=(o+1)%e,o===u&&(u=(u+1)%e),p-f<r)return;const O=k&&p-k;return O?Math.round(C*1e3/O):void 0}}function M8(e,r){let t=0,n=1e3/r,o,u;const f=(p,k=Date.now())=>{t=k,o=null,u&&(clearTimeout(u),u=null),e(...p)};return[(...p)=>{const k=Date.now(),N=k-t;N>=n?f(p,k):(o=p,u||(u=setTimeout(()=>{u=null,f(o)},n-N)))},()=>o&&f(o)]}const Yf=(e,r,t=3)=>{let n=0;const o=O8(50,250);return M8(u=>{const f=u.loaded,g=u.lengthComputable?u.total:void 0,v=f-n,p=o(v),k=f<=g;n=f;const N={loaded:f,total:g,progress:g?f/g:void 0,bytes:v,rate:p||void 0,estimated:p&&g&&k?(g-f)/p:void 0,event:u,lengthComputable:g!=null,[r?"download":"upload"]:!0};e(N)},t)},gb=(e,r)=>{const t=e!=null;return[n=>r[0]({lengthComputable:t,total:e,loaded:n}),r[1]]},xb=e=>(...r)=>dt.asap(()=>e(...r)),R8=us.hasStandardBrowserEnv?((e,r)=>t=>(t=new URL(t,us.origin),e.protocol===t.protocol&&e.host===t.host&&(r||e.port===t.port)))(new URL(us.origin),us.navigator&&/(msie|trident)/i.test(us.navigator.userAgent)):()=>!0,D8=us.hasStandardBrowserEnv?{write(e,r,t,n,o,u,f){if(typeof document=="undefined")return;const g=[`${e}=${encodeURIComponent(r)}`];dt.isNumber(t)&&g.push(`expires=${new Date(t).toUTCString()}`),dt.isString(n)&&g.push(`path=${n}`),dt.isString(o)&&g.push(`domain=${o}`),u===!0&&g.push("secure"),dt.isString(f)&&g.push(`SameSite=${f}`),document.cookie=g.join("; ")},read(e){if(typeof document=="undefined")return null;const r=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return r?decodeURIComponent(r[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function I8(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function L8(e,r){return r?e.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):e}function j_(e,r,t){let n=!I8(r);return e&&(n||t==!1)?L8(e,r):r}const pb=e=>e instanceof Hs?ke({},e):e;function hc(e,r){r=r||{};const t={};function n(p,k,N,C){return dt.isPlainObject(p)&&dt.isPlainObject(k)?dt.merge.call({caseless:C},p,k):dt.isPlainObject(k)?dt.merge({},k):dt.isArray(k)?k.slice():k}function o(p,k,N,C){if(dt.isUndefined(k)){if(!dt.isUndefined(p))return n(void 0,p,N,C)}else return n(p,k,N,C)}function u(p,k){if(!dt.isUndefined(k))return n(void 0,k)}function f(p,k){if(dt.isUndefined(k)){if(!dt.isUndefined(p))return n(void 0,p)}else return n(void 0,k)}function g(p,k,N){if(N in r)return n(p,k);if(N in e)return n(void 0,p)}const v={url:u,method:u,data:u,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,withXSRFToken:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:g,headers:(p,k,N)=>o(pb(p),pb(k),N,!0)};return dt.forEach(Object.keys(ke(ke({},e),r)),function(k){const N=v[k]||o,C=N(e[k],r[k],k);dt.isUndefined(C)&&N!==g||(t[k]=C)}),t}const O_=e=>{const r=hc({},e);let{data:t,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:u,headers:f,auth:g}=r;if(r.headers=f=Hs.from(f),r.url=S_(j_(r.baseURL,r.url,r.allowAbsoluteUrls),e.params,e.paramsSerializer),g&&f.set("Authorization","Basic "+btoa((g.username||"")+":"+(g.password?unescape(encodeURIComponent(g.password)):""))),dt.isFormData(t)){if(us.hasStandardBrowserEnv||us.hasStandardBrowserWebWorkerEnv)f.setContentType(void 0);else if(dt.isFunction(t.getHeaders)){const v=t.getHeaders(),p=["content-type","content-length"];Object.entries(v).forEach(([k,N])=>{p.includes(k.toLowerCase())&&f.set(k,N)})}}if(us.hasStandardBrowserEnv&&(n&&dt.isFunction(n)&&(n=n(r)),n||n!==!1&&R8(r.url))){const v=o&&u&&D8.read(u);v&&f.set(o,v)}return r},P8=typeof XMLHttpRequest!="undefined",F8=P8&&function(e){return new Promise(function(t,n){const o=O_(e);let u=o.data;const f=Hs.from(o.headers).normalize();let{responseType:g,onUploadProgress:v,onDownloadProgress:p}=o,k,N,C,O,I;function M(){O&&O(),I&&I(),o.cancelToken&&o.cancelToken.unsubscribe(k),o.signal&&o.signal.removeEventListener("abort",k)}let D=new XMLHttpRequest;D.open(o.method.toUpperCase(),o.url,!0),D.timeout=o.timeout;function z(){if(!D)return;const U=Hs.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),q={data:!g||g==="text"||g==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:U,config:e,request:D};A_(function(V){t(V),M()},function(V){n(V),M()},q),D=null}"onloadend"in D?D.onloadend=z:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(z)},D.onabort=function(){D&&(n(new Rr("Request aborted",Rr.ECONNABORTED,e,D)),D=null)},D.onerror=function(H){const q=H&&H.message?H.message:"Network Error",ne=new Rr(q,Rr.ERR_NETWORK,e,D);ne.event=H||null,n(ne),D=null},D.ontimeout=function(){let H=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const q=o.transitional||E_;o.timeoutErrorMessage&&(H=o.timeoutErrorMessage),n(new Rr(H,q.clarifyTimeoutError?Rr.ETIMEDOUT:Rr.ECONNABORTED,e,D)),D=null},u===void 0&&f.setContentType(null),"setRequestHeader"in D&&dt.forEach(f.toJSON(),function(H,q){D.setRequestHeader(q,H)}),dt.isUndefined(o.withCredentials)||(D.withCredentials=!!o.withCredentials),g&&g!=="json"&&(D.responseType=o.responseType),p&&([C,I]=Yf(p,!0),D.addEventListener("progress",C)),v&&D.upload&&([N,O]=Yf(v),D.upload.addEventListener("progress",N),D.upload.addEventListener("loadend",O)),(o.cancelToken||o.signal)&&(k=U=>{D&&(n(!U||U.type?new Rd(null,e,D):U),D.abort(),D=null)},o.cancelToken&&o.cancelToken.subscribe(k),o.signal&&(o.signal.aborted?k():o.signal.addEventListener("abort",k)));const B=j8(o.url);if(B&&us.protocols.indexOf(B)===-1){n(new Rr("Unsupported protocol "+B+":",Rr.ERR_BAD_REQUEST,e));return}D.send(u||null)})},B8=(e,r)=>{const{length:t}=e=e?e.filter(Boolean):[];if(r||t){let n=new AbortController,o;const u=function(p){if(!o){o=!0,g();const k=p instanceof Error?p:this.reason;n.abort(k instanceof Rr?k:new Rd(k instanceof Error?k.message:k))}};let f=r&&setTimeout(()=>{f=null,u(new Rr(`timeout ${r} of ms exceeded`,Rr.ETIMEDOUT))},r);const g=()=>{e&&(f&&clearTimeout(f),f=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(u):p.removeEventListener("abort",u)}),e=null)};e.forEach(p=>p.addEventListener("abort",u));const{signal:v}=n;return v.unsubscribe=()=>dt.asap(g),v}},U8=function*(e,r){let t=e.byteLength;if(t<r){yield e;return}let n=0,o;for(;n<t;)o=n+r,yield e.slice(n,o),n=o},z8=function(e,r){return bg(this,null,function*(){try{for(var t=g2(H8(e)),n,o,u;n=!(o=yield new rc(t.next())).done;n=!1){const f=o.value;yield*vg(U8(f,r))}}catch(o){u=[o]}finally{try{n&&(o=t.return)&&(yield new rc(o.call(t)))}finally{if(u)throw u[0]}}})},H8=function(e){return bg(this,null,function*(){if(e[Symbol.asyncIterator]){yield*vg(e);return}const r=e.getReader();try{for(;;){const{done:t,value:n}=yield new rc(r.read());if(t)break;yield n}}finally{yield new rc(r.cancel())}})},yb=(e,r,t,n)=>{const o=z8(e,r);let u=0,f,g=p=>{f||(f=!0,n&&n(p))};return new ReadableStream({pull(p){return Ne(this,null,function*(){try{const{done:k,value:N}=yield o.next();if(k){g(),p.close();return}let C=N.byteLength;if(t){let O=u+=C;t(O)}p.enqueue(new Uint8Array(N))}catch(k){throw g(k),k}})},cancel(p){return g(p),o.return()}},{highWaterMark:2})},bb=64*1024,{isFunction:kf}=dt,W8=(({Request:e,Response:r})=>({Request:e,Response:r}))(dt.global),{ReadableStream:vb,TextEncoder:_b}=dt.global,wb=(e,...r)=>{try{return!!e(...r)}catch(t){return!1}},V8=e=>{e=dt.merge.call({skipUndefined:!0},W8,e);const{fetch:r,Request:t,Response:n}=e,o=r?kf(r):typeof fetch=="function",u=kf(t),f=kf(n);if(!o)return!1;const g=o&&kf(vb),v=o&&(typeof _b=="function"?(I=>M=>I.encode(M))(new _b):I=>Ne(null,null,function*(){return new Uint8Array(yield new t(I).arrayBuffer())})),p=u&&g&&wb(()=>{let I=!1;const M=new t(us.origin,{body:new vb,method:"POST",get duplex(){return I=!0,"half"}}).headers.has("Content-Type");return I&&!M}),k=f&&g&&wb(()=>dt.isReadableStream(new n("").body)),N={stream:k&&(I=>I.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(I=>{!N[I]&&(N[I]=(M,D)=>{let z=M&&M[I];if(z)return z.call(M);throw new Rr(`Response type '${I}' is not supported`,Rr.ERR_NOT_SUPPORT,D)})});const C=I=>Ne(null,null,function*(){if(I==null)return 0;if(dt.isBlob(I))return I.size;if(dt.isSpecCompliantForm(I))return(yield new t(us.origin,{method:"POST",body:I}).arrayBuffer()).byteLength;if(dt.isArrayBufferView(I)||dt.isArrayBuffer(I))return I.byteLength;if(dt.isURLSearchParams(I)&&(I=I+""),dt.isString(I))return(yield v(I)).byteLength}),O=(I,M)=>Ne(null,null,function*(){const D=dt.toFiniteNumber(I.getContentLength());return D==null?C(M):D});return I=>Ne(null,null,function*(){let{url:M,method:D,data:z,signal:B,cancelToken:U,timeout:H,onDownloadProgress:q,onUploadProgress:ne,responseType:V,headers:J,withCredentials:Q="same-origin",fetchOptions:Te}=O_(I),je=r||fetch;V=V?(V+"").toLowerCase():"text";let me=B8([B,U&&U.toAbortSignal()],H),Se=null;const Oe=me&&me.unsubscribe&&(()=>{me.unsubscribe()});let ue;try{if(ne&&p&&D!=="get"&&D!=="head"&&(ue=yield O(J,z))!==0){let K=new t(M,{method:"POST",body:z,duplex:"half"}),W;if(dt.isFormData(z)&&(W=K.headers.get("content-type"))&&J.setContentType(W),K.body){const[ae,se]=gb(ue,Yf(xb(ne)));z=yb(K.body,bb,ae,se)}}dt.isString(Q)||(Q=Q?"include":"omit");const be=u&&"credentials"in t.prototype,re=Ve(ke({},Te),{signal:me,method:D.toUpperCase(),headers:J.normalize().toJSON(),body:z,duplex:"half",credentials:be?Q:void 0});Se=u&&new t(M,re);let de=yield u?je(Se,Te):je(M,re);const Ae=k&&(V==="stream"||V==="response");if(k&&(q||Ae&&Oe)){const K={};["status","statusText","headers"].forEach(he=>{K[he]=de[he]});const W=dt.toFiniteNumber(de.headers.get("content-length")),[ae,se]=q&&gb(W,Yf(xb(q),!0))||[];de=new n(yb(de.body,bb,ae,()=>{se&&se(),Oe&&Oe()}),K)}V=V||"text";let _e=yield N[dt.findKey(N,V)||"text"](de,I);return!Ae&&Oe&&Oe(),yield new Promise((K,W)=>{A_(K,W,{data:_e,headers:Hs.from(de.headers),status:de.status,statusText:de.statusText,config:I,request:Se})})}catch(be){throw Oe&&Oe(),be&&be.name==="TypeError"&&/Load failed|fetch/i.test(be.message)?Object.assign(new Rr("Network Error",Rr.ERR_NETWORK,I,Se),{cause:be.cause||be}):Rr.from(be,be&&be.code,I,Se)}})},G8=new Map,M_=e=>{let r=e&&e.env||{};const{fetch:t,Request:n,Response:o}=r,u=[n,o,t];let f=u.length,g=f,v,p,k=G8;for(;g--;)v=u[g],p=k.get(v),p===void 0&&k.set(v,p=g?new Map:V8(r)),k=p;return p};M_();const Hx={http:l8,xhr:F8,fetch:{get:M_}};dt.forEach(Hx,(e,r)=>{if(e){try{Object.defineProperty(e,"name",{value:r})}catch(t){}Object.defineProperty(e,"adapterName",{value:r})}});const kb=e=>`- ${e}`,X8=e=>dt.isFunction(e)||e===null||e===!1;function Y8(e,r){e=dt.isArray(e)?e:[e];const{length:t}=e;let n,o;const u={};for(let f=0;f<t;f++){n=e[f];let g;if(o=n,!X8(n)&&(o=Hx[(g=String(n)).toLowerCase()],o===void 0))throw new Rr(`Unknown adapter '${g}'`);if(o&&(dt.isFunction(o)||(o=o.get(r))))break;u[g||"#"+f]=o}if(!o){const f=Object.entries(u).map(([v,p])=>`adapter ${v} `+(p===!1?"is not supported by the environment":"is not available in the build"));let g=t?f.length>1?`since :
`+f.map(kb).join(`
`):" "+kb(f[0]):"as no adapter specified";throw new Rr("There is no suitable adapter to dispatch the request "+g,"ERR_NOT_SUPPORT")}return o}const R_={getAdapter:Y8,adapters:Hx};function Ug(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Rd(null,e)}function Nb(e){return Ug(e),e.headers=Hs.from(e.headers),e.data=Bg.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),R_.getAdapter(e.adapter||lu.adapter,e)(e).then(function(n){return Ug(e),n.data=Bg.call(e,e.transformResponse,n),n.headers=Hs.from(n.headers),n},function(n){return T_(n)||(Ug(e),n&&n.response&&(n.response.data=Bg.call(e,e.transformResponse,n.response),n.response.headers=Hs.from(n.response.headers))),Promise.reject(n)})}const D_="1.13.2",Nh={};["object","boolean","number","function","string","symbol"].forEach((e,r)=>{Nh[e]=function(n){return typeof n===e||"a"+(r<1?"n ":" ")+e}});const Sb={};Nh.transitional=function(r,t,n){function o(u,f){return"[Axios v"+D_+"] Transitional option '"+u+"'"+f+(n?". "+n:"")}return(u,f,g)=>{if(r===!1)throw new Rr(o(f," has been removed"+(t?" in "+t:"")),Rr.ERR_DEPRECATED);return t&&!Sb[f]&&(Sb[f]=!0,console.warn(o(f," has been deprecated since v"+t+" and will be removed in the near future"))),r?r(u,f,g):!0}};Nh.spelling=function(r){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${r}`),!0)};function Z8(e,r,t){if(typeof e!="object")throw new Rr("options must be an object",Rr.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const u=n[o],f=r[u];if(f){const g=e[u],v=g===void 0||f(g,u,e);if(v!==!0)throw new Rr("option "+u+" must be "+v,Rr.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Rr("Unknown option "+u,Rr.ERR_BAD_OPTION)}}const Ff={assertOptions:Z8,validators:Nh},fo=Ff.validators;let lc=class{constructor(r){this.defaults=r||{},this.interceptors={request:new hb,response:new hb}}request(r,t){return Ne(this,null,function*(){try{return yield this._request(r,t)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const u=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?u&&!String(n.stack).endsWith(u.replace(/^.+\n.+\n/,""))&&(n.stack+=`
`+u):n.stack=u}catch(f){}}throw n}})}_request(r,t){typeof r=="string"?(t=t||{},t.url=r):t=r||{},t=hc(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:u}=t;n!==void 0&&Ff.assertOptions(n,{silentJSONParsing:fo.transitional(fo.boolean),forcedJSONParsing:fo.transitional(fo.boolean),clarifyTimeoutError:fo.transitional(fo.boolean)},!1),o!=null&&(dt.isFunction(o)?t.paramsSerializer={serialize:o}:Ff.assertOptions(o,{encode:fo.function,serialize:fo.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ff.assertOptions(t,{baseUrl:fo.spelling("baseURL"),withXsrfToken:fo.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let f=u&&dt.merge(u.common,u[t.method]);u&&dt.forEach(["delete","get","head","post","put","patch","common"],I=>{delete u[I]}),t.headers=Hs.concat(f,u);const g=[];let v=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(t)===!1||(v=v&&M.synchronous,g.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let k,N=0,C;if(!v){const I=[Nb.bind(this),void 0];for(I.unshift(...g),I.push(...p),C=I.length,k=Promise.resolve(t);N<C;)k=k.then(I[N++],I[N++]);return k}C=g.length;let O=t;for(;N<C;){const I=g[N++],M=g[N++];try{O=I(O)}catch(D){M.call(this,D);break}}try{k=Nb.call(this,O)}catch(I){return Promise.reject(I)}for(N=0,C=p.length;N<C;)k=k.then(p[N++],p[N++]);return k}getUri(r){r=hc(this.defaults,r);const t=j_(r.baseURL,r.url,r.allowAbsoluteUrls);return S_(t,r.params,r.paramsSerializer)}};dt.forEach(["delete","get","head","options"],function(r){lc.prototype[r]=function(t,n){return this.request(hc(n||{},{method:r,url:t,data:(n||{}).data}))}});dt.forEach(["post","put","patch"],function(r){function t(n){return function(u,f,g){return this.request(hc(g||{},{method:r,headers:n?{"Content-Type":"multipart/form-data"}:{},url:u,data:f}))}}lc.prototype[r]=t(),lc.prototype[r+"Form"]=t(!0)});let $8=class I_{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(u){t=u});const n=this;this.promise.then(o=>{if(!n._listeners)return;let u=n._listeners.length;for(;u-- >0;)n._listeners[u](o);n._listeners=null}),this.promise.then=o=>{let u;const f=new Promise(g=>{n.subscribe(g),u=g}).then(o);return f.cancel=function(){n.unsubscribe(u)},f},r(function(u,f,g){n.reason||(n.reason=new Rd(u,f,g),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const t=this._listeners.indexOf(r);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const r=new AbortController,t=n=>{r.abort(n)};return this.subscribe(t),r.signal.unsubscribe=()=>this.unsubscribe(t),r.signal}static source(){let r;return{token:new I_(function(o){r=o}),cancel:r}}};function q8(e){return function(t){return e.apply(null,t)}}function K8(e){return dt.isObject(e)&&e.isAxiosError===!0}const gx={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(gx).forEach(([e,r])=>{gx[r]=e});function L_(e){const r=new lc(e),t=h_(lc.prototype.request,r);return dt.extend(t,lc.prototype,r,{allOwnKeys:!0}),dt.extend(t,r,null,{allOwnKeys:!0}),t.create=function(o){return L_(hc(e,o))},t}const un=L_(lu);un.Axios=lc;un.CanceledError=Rd;un.CancelToken=$8;un.isCancel=T_;un.VERSION=D_;un.toFormData=kh;un.AxiosError=Rr;un.Cancel=un.CanceledError;un.all=function(r){return Promise.all(r)};un.spread=q8;un.isAxiosError=K8;un.mergeConfig=hc;un.AxiosHeaders=Hs;un.formToJSON=e=>C_(dt.isHTMLForm(e)?new FormData(e):e);un.getAdapter=R_.getAdapter;un.HttpStatusCode=gx;un.default=un;const{Axios:BI,AxiosError:UI,CanceledError:zI,isCancel:HI,CancelToken:WI,VERSION:VI,all:GI,Cancel:XI,isAxiosError:YI,spread:ZI,toFormData:$I,AxiosHeaders:qI,HttpStatusCode:KI,formToJSON:JI,getAdapter:QI,mergeConfig:eL}=un;class J8{constructor(){ki(this,"client");ki(this,"baseURL");ki(this,"siteName");this.baseURL="http://localhost:8000",this.siteName="seeraasm-med.seeraarabia.com",this.client=un.create({baseURL:this.baseURL,timeout:parseInt("10000"),withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}}),this.client.interceptors.request.use(r=>{var t;return(t=r.url)!=null&&t.includes("/api/")&&(r.url=`/${this.siteName}${r.url}`),r}),this.client.interceptors.response.use(r=>r,r=>{var t;return((t=r.response)==null?void 0:t.status)===401&&(window.location.href="/login"),Promise.reject(r)})}login(r){return Ne(this,null,function*(){return(yield this.client.post("/api/method/login",r)).data})}logout(){return Ne(this,null,function*(){return(yield this.client.post("/api/method/logout")).data})}getCurrentUser(){return Ne(this,null,function*(){return(yield this.client.get("/api/method/frappe.auth.get_logged_user")).data})}callMethod(n){return Ne(this,arguments,function*(r,t={}){return(yield this.client.post(`/api/method/${r}`,t)).data})}frappeGet(n){return Ne(this,arguments,function*(r,t={}){return this.callMethod(r,t)})}getDocTypeRecords(o){return Ne(this,arguments,function*(r,t={},n=[]){const u=new URLSearchParams;return Object.keys(t).length>0&&u.append("filters",JSON.stringify(t)),n.length>0&&u.append("fields",JSON.stringify(n)),(yield this.client.get(`/api/resource/${r}?${u.toString()}`)).data})}getDocTypeRecord(r,t){return Ne(this,null,function*(){return(yield this.client.get(`/api/resource/${r}/${t}`)).data})}createDocTypeRecord(r,t){return Ne(this,null,function*(){return(yield this.client.post(`/api/resource/${r}`,t)).data})}updateDocTypeRecord(r,t,n){return Ne(this,null,function*(){return(yield this.client.put(`/api/resource/${r}/${t}`,n)).data})}deleteDocTypeRecord(r,t){return Ne(this,null,function*(){return(yield this.client.delete(`/api/resource/${r}/${t}`)).data})}uploadFile(r,t="Home"){return Ne(this,null,function*(){const n=new FormData;return n.append("file",r),n.append("folder",t),n.append("is_private","0"),(yield this.client.post("/api/method/upload_file",n,{headers:{"Content-Type":"multipart/form-data"}})).data})}}const P_=new J8,Q8=()=>{const[e,r]=R.useState([]),[t,n]=R.useState(!0),[o,u]=R.useState(null),[f,g]=R.useState(""),v=ma();R.useEffect(()=>{p()},[]);const p=()=>Ne(null,null,function*(){var C,O;try{n(!0);const I=yield P_.getDocTypeRecords("User",{},["name","full_name","email","enabled","creation","modified"]);r(I.message||[])}catch(I){u(((O=(C=I.response)==null?void 0:C.data)==null?void 0:O.message)||"Failed to load users")}finally{n(!1)}}),k=e.filter(C=>{var O,I,M;return((O=C.full_name)==null?void 0:O.toLowerCase().includes(f.toLowerCase()))||((I=C.email)==null?void 0:I.toLowerCase().includes(f.toLowerCase()))||((M=C.name)==null?void 0:M.toLowerCase().includes(f.toLowerCase()))}),N=C=>{v(`/users/${C.name}`)};return t?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:()=>v("/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-2xl sm:text-3xl font-bold text-gray-900 dark:text-white break-words",children:"Users"})]}),a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("button",{onClick:()=>v("/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:[o&&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:o})}),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:f,onChange:C=>g(C.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:p,className:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[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 (",k.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"})]}),k.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:f?"Try adjusting your search terms.":"No users available."})]}):a.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:k.map(C=>{var O;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:()=>N(C),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:((O=C.full_name)==null?void 0:O.charAt(0))||C.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:C.full_name||C.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:C.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 ${C.enabled?"bg-green-400":"bg-red-400"}`}),C.enabled?"Active":"Inactive"]})}),a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Created: ",new Date(C.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"})})]})]})},C.name)})})]})]})]})},eE=()=>{const[e,r]=R.useState([]),[t,n]=R.useState(!0),[o,u]=R.useState(null);R.useEffect(()=>{f()},[]);const f=()=>Ne(null,null,function*(){try{n(!0);const k=yield P_.frappeGet("frappe.desk.doctype.event.event.get_events");r(k.message||[])}catch(k){console.log("API call failed, using demo events:",k);const N=[{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"}];r(N),u(null)}finally{n(!1)}}),g=k=>new Date(k).toLocaleString(),v=k=>{switch(k.toLowerCase()){case"open":return"bg-green-100 text-green-800";case"scheduled":return"bg-blue-100 text-blue-800";case"completed":return"bg-gray-100 text-gray-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},p=k=>{switch(k.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 t?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-2xl sm:text-3xl font-bold text-gray-900 dark:text-white break-words",children:"Events"})}),a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("button",{onClick:f,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:[o&&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:o})}),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(k=>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:k.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 ${v(k.status)}`,children:k.status}),a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${p(k.event_type)}`,children:k.event_type})]})]}),k.description&&a.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:k.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:[g(k.starts_on)," - ",g(k.ends_on)]})]})]})})})},k.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)"]})]})]})]})})]})]})};class tE{getAssets(r,t,n=20,o=0,u){return Ne(this,null,function*(){const f=new URLSearchParams;r&&f.append("filters",JSON.stringify(r)),t&&t.length>0&&f.append("fields",JSON.stringify(t)),f.append("limit",n.toString()),f.append("offset",o.toString()),u&&f.append("order_by",u);const g=`${wr.ENDPOINTS.GET_ASSETS}?${f.toString()}`;return jt.apiCall(g)})}getAssetDetails(r){return Ne(this,null,function*(){const t=`${wr.ENDPOINTS.GET_ASSET_DETAILS}?asset_name=${encodeURIComponent(r)}`;return jt.apiCall(t)})}createAsset(r){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.CREATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_data:r})})})}updateAsset(r,t){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.UPDATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:r,asset_data:t})})})}deleteAsset(r){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.DELETE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:r})})})}getAssetFilters(){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.GET_ASSET_FILTERS)})}getAssetStats(){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.GET_ASSET_STATS)})}searchAssets(r,t=10){return Ne(this,null,function*(){const n=`${wr.ENDPOINTS.SEARCH_ASSETS}?search_term=${encodeURIComponent(r)}&limit=${t}`;return jt.apiCall(n)})}submitAsset(r){return Ne(this,null,function*(){return jt.apiCall(wr.ENDPOINTS.SUBMIT_ASSET||"/api/method/asset_lite.api.asset_api.submit_asset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:r})})})}}const fd=new tE,rE=(e,r)=>{const t=ke({},e||{});for(const[n,o]of Object.entries(r))if(!t[n])t[n]=o;else if(Array.isArray(o)&&o[0]==="in"){const u=o[1],f=t[n];if(typeof f=="string")u.includes(f)||(t[n]=["in",[]]);else if(Array.isArray(f)&&f[0]==="in"){const v=f[1].filter(p=>u.includes(p));t[n]=["in",v]}else t[n]=o}return t};function aE(e,r=20,t=0,n,o={}){const[u,f]=R.useState([]),[g,v]=R.useState(0),[p,k]=R.useState(!1),[N,C]=R.useState(!0),[O,I]=R.useState(null),[M,D]=R.useState(0),z=R.useRef(!1),B=JSON.stringify(e),U=JSON.stringify(o);R.useEffect(()=>{if(z.current&&O)return;let q=!1;return z.current=!0,Ne(null,null,function*(){try{C(!0);const V=rE(e,o);console.log("[useAssets] User filters:",e),console.log("[useAssets] Permission filters:",o),console.log("[useAssets] Merged filters:",V);const J=yield fd.getAssets(V,void 0,r,t,n);q||(f(J.assets),v(J.total_count),k(J.has_more),I(null))}catch(V){if(!q){const J=V instanceof Error?V.message:"Failed to fetch assets";J.includes("417")||J.includes("Expectation Failed")||J.includes("has no attribute")?I("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):I(J),f([]),v(0),k(!1)}}finally{q||C(!1)}}),()=>{q=!0}},[B,U,r,t,n,M]);const H=R.useCallback(()=>{z.current=!1,D(q=>q+1)},[]);return{assets:u,totalCount:g,hasMore:p,loading:N,error:O,refetch:H}}function nE(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}try{o(!0),f(null);const p=yield fd.getAssetDetails(e);t(p)}catch(p){f(p instanceof Error?p.message:"Failed to fetch asset details")}finally{o(!1)}}),[e]);R.useEffect(()=>{g()},[g]);const v=R.useCallback(()=>{g()},[g]);return{asset:r,loading:n,error:u,refetch:v}}function F_(){const[e,r]=R.useState(!1),[t,n]=R.useState(null);return{createAsset:v=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useAssetMutations] Creating asset with data:",v);const p=yield fd.createAsset(v);if(console.log("[useAssetMutations] Create asset response:",p),p.success)return p.asset;{const k=p.error||"Failed to create asset";throw new Error(k)}}catch(p){console.error("[useAssetMutations] Create asset error:",p);const k=p instanceof Error?p.message:"Failed to create asset";throw n(k),p}finally{r(!1)}}),updateAsset:(v,p)=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useAssetMutations] Updating asset:",v,"with data:",p);const k=yield fd.updateAsset(v,p);if(console.log("[useAssetMutations] Update asset response:",k),k.success)return k.asset;{const N=k.error||"Failed to update asset";throw new Error(N)}}catch(k){console.error("[useAssetMutations] Update asset error:",k);const N=k instanceof Error?k.message:"Failed to update asset";throw n(N),k}finally{r(!1)}}),deleteAsset:v=>Ne(null,null,function*(){try{r(!0),n(null);const p=yield fd.deleteAsset(v);if(!p.success)throw new Error("Failed to delete asset");return p}catch(p){const k=p instanceof Error?p.message:"Failed to delete asset";throw n(k),p}finally{r(!1)}}),submitAsset:v=>Ne(null,null,function*(){try{r(!0),n(null),console.log("[useAssetMutations] Submitting asset:",v);const p=yield fd.submitAsset(v);return console.log("[useAssetMutations] Submit asset response:",p),p}catch(p){console.error("[useAssetMutations] Submit asset error:",p);const k=p instanceof Error?p.message:"Failed to submit asset";throw n(k),p}finally{r(!1)}}),loading:e,error:t}}var Zf={};Zf.version="0.18.5";var B_=1252,sE=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],U_=function(e){sE.indexOf(e)!=-1&&(B_=e)};function iE(){U_(1252)}var X0=function(e){U_(e)};function oE(){X0(1200),iE()}var Nf=function(r){return String.fromCharCode(r)},Eb=function(r){return String.fromCharCode(r)},$f,El="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Y0(e){for(var r="",t=0,n=0,o=0,u=0,f=0,g=0,v=0,p=0;p<e.length;)t=e.charCodeAt(p++),u=t>>2,n=e.charCodeAt(p++),f=(t&3)<<4|n>>4,o=e.charCodeAt(p++),g=(n&15)<<2|o>>6,v=o&63,isNaN(n)?g=v=64:isNaN(o)&&(v=64),r+=El.charAt(u)+El.charAt(f)+El.charAt(g)+El.charAt(v);return r}function $o(e){var r="",t=0,n=0,o=0,u=0,f=0,g=0,v=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var p=0;p<e.length;)u=El.indexOf(e.charAt(p++)),f=El.indexOf(e.charAt(p++)),t=u<<2|f>>4,r+=String.fromCharCode(t),g=El.indexOf(e.charAt(p++)),n=(f&15)<<4|g>>2,g!==64&&(r+=String.fromCharCode(n)),v=El.indexOf(e.charAt(p++)),o=(g&3)<<6|v,v!==64&&(r+=String.fromCharCode(o));return r}var ha=(function(){return typeof Buffer!="undefined"&&typeof process!="undefined"&&typeof process.versions!="undefined"&&!!process.versions.node})(),Jo=(function(){if(typeof Buffer!="undefined"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(r){e=!0}return e?function(r,t){return t?new Buffer(r,t):new Buffer(r)}:Buffer.from.bind(Buffer)}return function(){}})();function mc(e){return ha?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}function Cb(e){return ha?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}var Gi=function(r){return ha?Jo(r,"binary"):r.split("").map(function(t){return t.charCodeAt(0)&255})};function Sh(e){if(typeof ArrayBuffer=="undefined")return Gi(e);for(var r=new ArrayBuffer(e.length),t=new Uint8Array(r),n=0;n!=e.length;++n)t[n]=e.charCodeAt(n)&255;return r}function cu(e){if(Array.isArray(e))return e.map(function(n){return String.fromCharCode(n)}).join("");for(var r=[],t=0;t<e.length;++t)r[t]=String.fromCharCode(e[t]);return r.join("")}function lE(e){if(typeof Uint8Array=="undefined")throw new Error("Unsupported");return new Uint8Array(e)}var Qn=ha?function(e){return Buffer.concat(e.map(function(r){return Buffer.isBuffer(r)?r:Jo(r)}))}:function(e){if(typeof Uint8Array!="undefined"){var r=0,t=0;for(r=0;r<e.length;++r)t+=e[r].length;var n=new Uint8Array(t),o=0;for(r=0,t=0;r<e.length;t+=o,++r)if(o=e[r].length,e[r]instanceof Uint8Array)n.set(e[r],t);else{if(typeof e[r]=="string")throw"wtf";n.set(new Uint8Array(e[r]),t)}return n}return[].concat.apply([],e.map(function(u){return Array.isArray(u)?u:[].slice.call(u)}))};function cE(e){for(var r=[],t=0,n=e.length+250,o=mc(e.length+255),u=0;u<e.length;++u){var f=e.charCodeAt(u);if(f<128)o[t++]=f;else if(f<2048)o[t++]=192|f>>6&31,o[t++]=128|f&63;else if(f>=55296&&f<57344){f=(f&1023)+64;var g=e.charCodeAt(++u)&1023;o[t++]=240|f>>8&7,o[t++]=128|f>>2&63,o[t++]=128|g>>6&15|(f&3)<<4,o[t++]=128|g&63}else o[t++]=224|f>>12&15,o[t++]=128|f>>6&63,o[t++]=128|f&63;t>n&&(r.push(o.slice(0,t)),t=0,o=mc(65535),n=65530)}return r.push(o.slice(0,t)),Qn(r)}var P0=/\u0000/g,Sf=/[\u0001-\u0006]/g;function yd(e){for(var r="",t=e.length-1;t>=0;)r+=e.charAt(t--);return r}function Xi(e,r){var t=""+e;return t.length>=r?t:tn("0",r-t.length)+t}function Wx(e,r){var t=""+e;return t.length>=r?t:tn(" ",r-t.length)+t}function qf(e,r){var t=""+e;return t.length>=r?t:t+tn(" ",r-t.length)}function dE(e,r){var t=""+Math.round(e);return t.length>=r?t:tn("0",r-t.length)+t}function uE(e,r){var t=""+e;return t.length>=r?t:tn("0",r-t.length)+t}var Tb=Math.pow(2,32);function id(e,r){if(e>Tb||e<-Tb)return dE(e,r);var t=Math.round(e);return uE(t,r)}function Kf(e,r){return r=r||0,e.length>=7+r&&(e.charCodeAt(r)|32)===103&&(e.charCodeAt(r+1)|32)===101&&(e.charCodeAt(r+2)|32)===110&&(e.charCodeAt(r+3)|32)===101&&(e.charCodeAt(r+4)|32)===114&&(e.charCodeAt(r+5)|32)===97&&(e.charCodeAt(r+6)|32)===108}var Ab=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],zg=[["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 fE(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 rn={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"秒 "'},jb={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},hE={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 Jf(e,r,t){for(var n=e<0?-1:1,o=e*n,u=0,f=1,g=0,v=1,p=0,k=0,N=Math.floor(o);p<r&&(N=Math.floor(o),g=N*f+u,k=N*p+v,!(o-N<5e-8));)o=1/(o-N),u=f,f=g,v=p,p=k;if(k>r&&(p>r?(k=v,g=u):(k=p,g=f)),!t)return[0,n*g,k];var C=Math.floor(n*g/k);return[C,n*g-C*k,k]}function Ef(e,r,t){if(e>2958465||e<0)return null;var n=e|0,o=Math.floor(86400*(e-n)),u=0,f=[],g={D:n,T:o,u:86400*(e-n)-o,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(g.u)<1e-6&&(g.u=0),r&&r.date1904&&(n+=1462),g.u>.9999&&(g.u=0,++o==86400&&(g.T=o=0,++n,++g.D)),n===60)f=t?[1317,10,29]:[1900,2,29],u=3;else if(n===0)f=t?[1317,8,29]:[1900,1,0],u=6;else{n>60&&--n;var v=new Date(1900,0,1);v.setDate(v.getDate()+n-1),f=[v.getFullYear(),v.getMonth()+1,v.getDate()],u=v.getDay(),n<60&&(u=(u+6)%7),t&&(u=vE(v,f))}return g.y=f[0],g.m=f[1],g.d=f[2],g.S=o%60,o=Math.floor(o/60),g.M=o%60,o=Math.floor(o/60),g.H=o,g.q=u,g}var z_=new Date(1899,11,31,0,0,0),mE=z_.getTime(),gE=new Date(1900,2,1,0,0,0);function H_(e,r){var t=e.getTime();return r?t-=1461*24*60*60*1e3:e>=gE&&(t+=1440*60*1e3),(t-(mE+(e.getTimezoneOffset()-z_.getTimezoneOffset())*6e4))/(1440*60*1e3)}function Vx(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function xE(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function pE(e){var r=e<0?12:11,t=Vx(e.toFixed(12));return t.length<=r||(t=e.toPrecision(10),t.length<=r)?t:e.toExponential(5)}function yE(e){var r=Vx(e.toFixed(11));return r.length>(e<0?12:11)||r==="0"||r==="-0"?e.toPrecision(6):r}function bE(e){var r=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),t;return r>=-4&&r<=-1?t=e.toPrecision(10+r):Math.abs(r)<=9?t=pE(e):r===10?t=e.toFixed(10).substr(0,12):t=yE(e),Vx(xE(t.toUpperCase()))}function xx(e,r){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):bE(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return Al(14,H_(e,r&&r.date1904),r)}throw new Error("unsupported value in General format: "+e)}function vE(e,r){r[0]-=581;var t=e.getDay();return e<60&&(t=(t+6)%7),t}function _E(e,r,t,n){var o="",u=0,f=0,g=t.y,v,p=0;switch(e){case 98:g=t.y+543;case 121:switch(r.length){case 1:case 2:v=g%100,p=2;break;default:v=g%1e4,p=4;break}break;case 109:switch(r.length){case 1:case 2:v=t.m,p=r.length;break;case 3:return zg[t.m-1][1];case 5:return zg[t.m-1][0];default:return zg[t.m-1][2]}break;case 100:switch(r.length){case 1:case 2:v=t.d,p=r.length;break;case 3:return Ab[t.q][0];default:return Ab[t.q][1]}break;case 104:switch(r.length){case 1:case 2:v=1+(t.H+11)%12,p=r.length;break;default:throw"bad hour format: "+r}break;case 72:switch(r.length){case 1:case 2:v=t.H,p=r.length;break;default:throw"bad hour format: "+r}break;case 77:switch(r.length){case 1:case 2:v=t.M,p=r.length;break;default:throw"bad minute format: "+r}break;case 115:if(r!="s"&&r!="ss"&&r!=".0"&&r!=".00"&&r!=".000")throw"bad second format: "+r;return t.u===0&&(r=="s"||r=="ss")?Xi(t.S,r.length):(n>=2?f=n===3?1e3:100:f=n===1?10:1,u=Math.round(f*(t.S+t.u)),u>=60*f&&(u=0),r==="s"?u===0?"0":""+u/f:(o=Xi(u,2+n),r==="ss"?o.substr(0,2):"."+o.substr(2,r.length-1)));case 90:switch(r){case"[h]":case"[hh]":v=t.D*24+t.H;break;case"[m]":case"[mm]":v=(t.D*24+t.H)*60+t.M;break;case"[s]":case"[ss]":v=((t.D*24+t.H)*60+t.M)*60+Math.round(t.S+t.u);break;default:throw"bad abstime format: "+r}p=r.length===3?1:2;break;case 101:v=g,p=1;break}var k=p>0?Xi(v,p):"";return k}function Cl(e){var r=3;if(e.length<=r)return e;for(var t=e.length%r,n=e.substr(0,t);t!=e.length;t+=r)n+=(n.length>0?",":"")+e.substr(t,r);return n}var W_=/%/g;function wE(e,r,t){var n=r.replace(W_,""),o=r.length-n.length;return Wo(e,n,t*Math.pow(10,2*o))+tn("%",o)}function kE(e,r,t){for(var n=r.length-1;r.charCodeAt(n-1)===44;)--n;return Wo(e,r.substr(0,n),t/Math.pow(10,3*(r.length-n)))}function V_(e,r){var t,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(r==0)return"0.0E+0";if(r<0)return"-"+V_(e,-r);var o=e.indexOf(".");o===-1&&(o=e.indexOf("E"));var u=Math.floor(Math.log(r)*Math.LOG10E)%o;if(u<0&&(u+=o),t=(r/Math.pow(10,u)).toPrecision(n+1+(o+u)%o),t.indexOf("e")===-1){var f=Math.floor(Math.log(r)*Math.LOG10E);for(t.indexOf(".")===-1?t=t.charAt(0)+"."+t.substr(1)+"E+"+(f-t.length+u):t+="E+"+(f-u);t.substr(0,2)==="0.";)t=t.charAt(0)+t.substr(2,o)+"."+t.substr(2+o),t=t.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");t=t.replace(/\+-/,"-")}t=t.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(g,v,p,k){return v+p+k.substr(0,(o+u)%o)+"."+k.substr(u)+"E"})}else t=r.toExponential(n);return e.match(/E\+00$/)&&t.match(/e[+-]\d$/)&&(t=t.substr(0,t.length-1)+"0"+t.charAt(t.length-1)),e.match(/E\-/)&&t.match(/e\+/)&&(t=t.replace(/e\+/,"e")),t.replace("e","E")}var G_=/# (\?+)( ?)\/( ?)(\d+)/;function NE(e,r,t){var n=parseInt(e[4],10),o=Math.round(r*n),u=Math.floor(o/n),f=o-u*n,g=n;return t+(u===0?"":""+u)+" "+(f===0?tn(" ",e[1].length+1+e[4].length):Wx(f,e[1].length)+e[2]+"/"+e[3]+Xi(g,e[4].length))}function SE(e,r,t){return t+(r===0?"":""+r)+tn(" ",e[1].length+2+e[4].length)}var X_=/^#*0*\.([0#]+)/,Y_=/\).*[0#]/,Z_=/\(###\) ###\\?-####/;function ks(e){for(var r="",t,n=0;n!=e.length;++n)switch(t=e.charCodeAt(n)){case 35:break;case 63:r+=" ";break;case 48:r+="0";break;default:r+=String.fromCharCode(t)}return r}function Ob(e,r){var t=Math.pow(10,r);return""+Math.round(e*t)/t}function Mb(e,r){var t=e-Math.floor(e),n=Math.pow(10,r);return r<(""+Math.round(t*n)).length?0:Math.round(t*n)}function EE(e,r){return r<(""+Math.round((e-Math.floor(e))*Math.pow(10,r))).length?1:0}function CE(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Ni(e,r,t){if(e.charCodeAt(0)===40&&!r.match(Y_)){var n=r.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return t>=0?Ni("n",n,t):"("+Ni("n",n,-t)+")"}if(r.charCodeAt(r.length-1)===44)return kE(e,r,t);if(r.indexOf("%")!==-1)return wE(e,r,t);if(r.indexOf("E")!==-1)return V_(r,t);if(r.charCodeAt(0)===36)return"$"+Ni(e,r.substr(r.charAt(1)==" "?2:1),t);var o,u,f,g,v=Math.abs(t),p=t<0?"-":"";if(r.match(/^00+$/))return p+id(v,r.length);if(r.match(/^[#?]+$/))return o=id(t,0),o==="0"&&(o=""),o.length>r.length?o:ks(r.substr(0,r.length-o.length))+o;if(u=r.match(G_))return NE(u,v,p);if(r.match(/^#+0+$/))return p+id(v,r.length-r.indexOf("0"));if(u=r.match(X_))return o=Ob(t,u[1].length).replace(/^([^\.]+)$/,"$1."+ks(u[1])).replace(/\.$/,"."+ks(u[1])).replace(/\.(\d*)$/,function(I,M){return"."+M+tn("0",ks(u[1]).length-M.length)}),r.indexOf("0.")!==-1?o:o.replace(/^0\./,".");if(r=r.replace(/^#+([0.])/,"$1"),u=r.match(/^(0*)\.(#*)$/))return p+Ob(v,u[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,u[1].length?"0.":".");if(u=r.match(/^#{1,3},##0(\.?)$/))return p+Cl(id(v,0));if(u=r.match(/^#,##0\.([#0]*0)$/))return t<0?"-"+Ni(e,r,-t):Cl(""+(Math.floor(t)+EE(t,u[1].length)))+"."+Xi(Mb(t,u[1].length),u[1].length);if(u=r.match(/^#,#*,#0/))return Ni(e,r.replace(/^#,#*,/,""),t);if(u=r.match(/^([0#]+)(\\?-([0#]+))+$/))return o=yd(Ni(e,r.replace(/[\\-]/g,""),t)),f=0,yd(yd(r.replace(/\\/g,"")).replace(/[0#]/g,function(I){return f<o.length?o.charAt(f++):I==="0"?"0":""}));if(r.match(Z_))return o=Ni(e,"##########",t),"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6);var k="";if(u=r.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return f=Math.min(u[4].length,7),g=Jf(v,Math.pow(10,f)-1,!1),o=""+p,k=Wo("n",u[1],g[1]),k.charAt(k.length-1)==" "&&(k=k.substr(0,k.length-1)+"0"),o+=k+u[2]+"/"+u[3],k=qf(g[2],f),k.length<u[4].length&&(k=ks(u[4].substr(u[4].length-k.length))+k),o+=k,o;if(u=r.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return f=Math.min(Math.max(u[1].length,u[4].length),7),g=Jf(v,Math.pow(10,f)-1,!0),p+(g[0]||(g[1]?"":"0"))+" "+(g[1]?Wx(g[1],f)+u[2]+"/"+u[3]+qf(g[2],f):tn(" ",2*f+1+u[2].length+u[3].length));if(u=r.match(/^[#0?]+$/))return o=id(t,0),r.length<=o.length?o:ks(r.substr(0,r.length-o.length))+o;if(u=r.match(/^([#0?]+)\.([#0]+)$/)){o=""+t.toFixed(Math.min(u[2].length,10)).replace(/([^0])0+$/,"$1"),f=o.indexOf(".");var N=r.indexOf(".")-f,C=r.length-o.length-N;return ks(r.substr(0,N)+o+r.substr(r.length-C))}if(u=r.match(/^00,000\.([#0]*0)$/))return f=Mb(t,u[1].length),t<0?"-"+Ni(e,r,-t):Cl(CE(t)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(I){return"00,"+(I.length<3?Xi(0,3-I.length):"")+I})+"."+Xi(f,u[1].length);switch(r){case"###,##0.00":return Ni(e,"#,##0.00",t);case"###,###":case"##,###":case"#,###":var O=Cl(id(v,0));return O!=="0"?p+O:"";case"###,###.00":return Ni(e,"###,##0.00",t).replace(/^0\./,".");case"#,###.00":return Ni(e,"#,##0.00",t).replace(/^0\./,".")}throw new Error("unsupported format |"+r+"|")}function TE(e,r,t){for(var n=r.length-1;r.charCodeAt(n-1)===44;)--n;return Wo(e,r.substr(0,n),t/Math.pow(10,3*(r.length-n)))}function AE(e,r,t){var n=r.replace(W_,""),o=r.length-n.length;return Wo(e,n,t*Math.pow(10,2*o))+tn("%",o)}function $_(e,r){var t,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(r==0)return"0.0E+0";if(r<0)return"-"+$_(e,-r);var o=e.indexOf(".");o===-1&&(o=e.indexOf("E"));var u=Math.floor(Math.log(r)*Math.LOG10E)%o;if(u<0&&(u+=o),t=(r/Math.pow(10,u)).toPrecision(n+1+(o+u)%o),!t.match(/[Ee]/)){var f=Math.floor(Math.log(r)*Math.LOG10E);t.indexOf(".")===-1?t=t.charAt(0)+"."+t.substr(1)+"E+"+(f-t.length+u):t+="E+"+(f-u),t=t.replace(/\+-/,"-")}t=t.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(g,v,p,k){return v+p+k.substr(0,(o+u)%o)+"."+k.substr(u)+"E"})}else t=r.toExponential(n);return e.match(/E\+00$/)&&t.match(/e[+-]\d$/)&&(t=t.substr(0,t.length-1)+"0"+t.charAt(t.length-1)),e.match(/E\-/)&&t.match(/e\+/)&&(t=t.replace(/e\+/,"e")),t.replace("e","E")}function ho(e,r,t){if(e.charCodeAt(0)===40&&!r.match(Y_)){var n=r.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return t>=0?ho("n",n,t):"("+ho("n",n,-t)+")"}if(r.charCodeAt(r.length-1)===44)return TE(e,r,t);if(r.indexOf("%")!==-1)return AE(e,r,t);if(r.indexOf("E")!==-1)return $_(r,t);if(r.charCodeAt(0)===36)return"$"+ho(e,r.substr(r.charAt(1)==" "?2:1),t);var o,u,f,g,v=Math.abs(t),p=t<0?"-":"";if(r.match(/^00+$/))return p+Xi(v,r.length);if(r.match(/^[#?]+$/))return o=""+t,t===0&&(o=""),o.length>r.length?o:ks(r.substr(0,r.length-o.length))+o;if(u=r.match(G_))return SE(u,v,p);if(r.match(/^#+0+$/))return p+Xi(v,r.length-r.indexOf("0"));if(u=r.match(X_))return o=(""+t).replace(/^([^\.]+)$/,"$1."+ks(u[1])).replace(/\.$/,"."+ks(u[1])),o=o.replace(/\.(\d*)$/,function(I,M){return"."+M+tn("0",ks(u[1]).length-M.length)}),r.indexOf("0.")!==-1?o:o.replace(/^0\./,".");if(r=r.replace(/^#+([0.])/,"$1"),u=r.match(/^(0*)\.(#*)$/))return p+(""+v).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,u[1].length?"0.":".");if(u=r.match(/^#{1,3},##0(\.?)$/))return p+Cl(""+v);if(u=r.match(/^#,##0\.([#0]*0)$/))return t<0?"-"+ho(e,r,-t):Cl(""+t)+"."+tn("0",u[1].length);if(u=r.match(/^#,#*,#0/))return ho(e,r.replace(/^#,#*,/,""),t);if(u=r.match(/^([0#]+)(\\?-([0#]+))+$/))return o=yd(ho(e,r.replace(/[\\-]/g,""),t)),f=0,yd(yd(r.replace(/\\/g,"")).replace(/[0#]/g,function(I){return f<o.length?o.charAt(f++):I==="0"?"0":""}));if(r.match(Z_))return o=ho(e,"##########",t),"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6);var k="";if(u=r.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return f=Math.min(u[4].length,7),g=Jf(v,Math.pow(10,f)-1,!1),o=""+p,k=Wo("n",u[1],g[1]),k.charAt(k.length-1)==" "&&(k=k.substr(0,k.length-1)+"0"),o+=k+u[2]+"/"+u[3],k=qf(g[2],f),k.length<u[4].length&&(k=ks(u[4].substr(u[4].length-k.length))+k),o+=k,o;if(u=r.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return f=Math.min(Math.max(u[1].length,u[4].length),7),g=Jf(v,Math.pow(10,f)-1,!0),p+(g[0]||(g[1]?"":"0"))+" "+(g[1]?Wx(g[1],f)+u[2]+"/"+u[3]+qf(g[2],f):tn(" ",2*f+1+u[2].length+u[3].length));if(u=r.match(/^[#0?]+$/))return o=""+t,r.length<=o.length?o:ks(r.substr(0,r.length-o.length))+o;if(u=r.match(/^([#0]+)\.([#0]+)$/)){o=""+t.toFixed(Math.min(u[2].length,10)).replace(/([^0])0+$/,"$1"),f=o.indexOf(".");var N=r.indexOf(".")-f,C=r.length-o.length-N;return ks(r.substr(0,N)+o+r.substr(r.length-C))}if(u=r.match(/^00,000\.([#0]*0)$/))return t<0?"-"+ho(e,r,-t):Cl(""+t).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(I){return"00,"+(I.length<3?Xi(0,3-I.length):"")+I})+"."+Xi(0,u[1].length);switch(r){case"###,###":case"##,###":case"#,###":var O=Cl(""+v);return O!=="0"?p+O:"";default:if(r.match(/\.[0#?]*$/))return ho(e,r.slice(0,r.lastIndexOf(".")),t)+ks(r.slice(r.lastIndexOf(".")))}throw new Error("unsupported format |"+r+"|")}function Wo(e,r,t){return(t|0)===t?ho(e,r,t):Ni(e,r,t)}function jE(e){for(var r=[],t=!1,n=0,o=0;n<e.length;++n)switch(e.charCodeAt(n)){case 34:t=!t;break;case 95:case 42:case 92:++n;break;case 59:r[r.length]=e.substr(o,n-o),o=n+1}if(r[r.length]=e.substr(o),t===!0)throw new Error("Format |"+e+"| unterminated string ");return r}var q_=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function K_(e){for(var r=0,t="",n="";r<e.length;)switch(t=e.charAt(r)){case"G":Kf(e,r)&&(r+=6),r++;break;case'"':for(;e.charCodeAt(++r)!==34&&r<e.length;);++r;break;case"\\":r+=2;break;case"_":r+=2;break;case"@":++r;break;case"B":case"b":if(e.charAt(r+1)==="1"||e.charAt(r+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(r,3).toUpperCase()==="A/P"||e.substr(r,5).toUpperCase()==="AM/PM"||e.substr(r,5).toUpperCase()==="上午/下午")return!0;++r;break;case"[":for(n=t;e.charAt(r++)!=="]"&&r<e.length;)n+=e.charAt(r);if(n.match(q_))return!0;break;case".":case"0":case"#":for(;r<e.length&&("0#?.,E+-%".indexOf(t=e.charAt(++r))>-1||t=="\\"&&e.charAt(r+1)=="-"&&"0#".indexOf(e.charAt(r+2))>-1););break;case"?":for(;e.charAt(++r)===t;);break;case"*":++r,(e.charAt(r)==" "||e.charAt(r)=="*")&&++r;break;case"(":case")":++r;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;r<e.length&&"0123456789".indexOf(e.charAt(++r))>-1;);break;case" ":++r;break;default:++r;break}return!1}function OE(e,r,t,n){for(var o=[],u="",f=0,g="",v="t",p,k,N,C="H";f<e.length;)switch(g=e.charAt(f)){case"G":if(!Kf(e,f))throw new Error("unrecognized character "+g+" in "+e);o[o.length]={t:"G",v:"General"},f+=7;break;case'"':for(u="";(N=e.charCodeAt(++f))!==34&&f<e.length;)u+=String.fromCharCode(N);o[o.length]={t:"t",v:u},++f;break;case"\\":var O=e.charAt(++f),I=O==="("||O===")"?O:"t";o[o.length]={t:I,v:O},++f;break;case"_":o[o.length]={t:"t",v:" "},f+=2;break;case"@":o[o.length]={t:"T",v:r},++f;break;case"B":case"b":if(e.charAt(f+1)==="1"||e.charAt(f+1)==="2"){if(p==null&&(p=Ef(r,t,e.charAt(f+1)==="2"),p==null))return"";o[o.length]={t:"X",v:e.substr(f,2)},v=g,f+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":g=g.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(r<0||p==null&&(p=Ef(r,t),p==null))return"";for(u=g;++f<e.length&&e.charAt(f).toLowerCase()===g;)u+=g;g==="m"&&v.toLowerCase()==="h"&&(g="M"),g==="h"&&(g=C),o[o.length]={t:g,v:u},v=g;break;case"A":case"a":case"上":var M={t:g,v:g};if(p==null&&(p=Ef(r,t)),e.substr(f,3).toUpperCase()==="A/P"?(p!=null&&(M.v=p.H>=12?"P":"A"),M.t="T",C="h",f+=3):e.substr(f,5).toUpperCase()==="AM/PM"?(p!=null&&(M.v=p.H>=12?"PM":"AM"),M.t="T",f+=5,C="h"):e.substr(f,5).toUpperCase()==="上午/下午"?(p!=null&&(M.v=p.H>=12?"下午":"上午"),M.t="T",f+=5,C="h"):(M.t="t",++f),p==null&&M.t==="T")return"";o[o.length]=M,v=g;break;case"[":for(u=g;e.charAt(f++)!=="]"&&f<e.length;)u+=e.charAt(f);if(u.slice(-1)!=="]")throw'unterminated "[" block: |'+u+"|";if(u.match(q_)){if(p==null&&(p=Ef(r,t),p==null))return"";o[o.length]={t:"Z",v:u.toLowerCase()},v=u.charAt(1)}else u.indexOf("$")>-1&&(u=(u.match(/\$([^-\[\]]*)/)||[])[1]||"$",K_(e)||(o[o.length]={t:"t",v:u}));break;case".":if(p!=null){for(u=g;++f<e.length&&(g=e.charAt(f))==="0";)u+=g;o[o.length]={t:"s",v:u};break}case"0":case"#":for(u=g;++f<e.length&&"0#?.,E+-%".indexOf(g=e.charAt(f))>-1;)u+=g;o[o.length]={t:"n",v:u};break;case"?":for(u=g;e.charAt(++f)===g;)u+=g;o[o.length]={t:g,v:u},v=g;break;case"*":++f,(e.charAt(f)==" "||e.charAt(f)=="*")&&++f;break;case"(":case")":o[o.length]={t:n===1?"t":g,v:g},++f;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(u=g;f<e.length&&"0123456789".indexOf(e.charAt(++f))>-1;)u+=e.charAt(f);o[o.length]={t:"D",v:u};break;case" ":o[o.length]={t:g,v:g},++f;break;case"$":o[o.length]={t:"t",v:"$"},++f;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(g)===-1)throw new Error("unrecognized character "+g+" in "+e);o[o.length]={t:"t",v:g},++f;break}var D=0,z=0,B;for(f=o.length-1,v="t";f>=0;--f)switch(o[f].t){case"h":case"H":o[f].t=C,v="h",D<1&&(D=1);break;case"s":(B=o[f].v.match(/\.0+$/))&&(z=Math.max(z,B[0].length-1)),D<3&&(D=3);case"d":case"y":case"M":case"e":v=o[f].t;break;case"m":v==="s"&&(o[f].t="M",D<2&&(D=2));break;case"X":break;case"Z":D<1&&o[f].v.match(/[Hh]/)&&(D=1),D<2&&o[f].v.match(/[Mm]/)&&(D=2),D<3&&o[f].v.match(/[Ss]/)&&(D=3)}switch(D){case 0:break;case 1:p.u>=.5&&(p.u=0,++p.S),p.S>=60&&(p.S=0,++p.M),p.M>=60&&(p.M=0,++p.H);break;case 2:p.u>=.5&&(p.u=0,++p.S),p.S>=60&&(p.S=0,++p.M);break}var U="",H;for(f=0;f<o.length;++f)switch(o[f].t){case"t":case"T":case" ":case"D":break;case"X":o[f].v="",o[f].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":o[f].v=_E(o[f].t.charCodeAt(0),o[f].v,p,z),o[f].t="t";break;case"n":case"?":for(H=f+1;o[H]!=null&&((g=o[H].t)==="?"||g==="D"||(g===" "||g==="t")&&o[H+1]!=null&&(o[H+1].t==="?"||o[H+1].t==="t"&&o[H+1].v==="/")||o[f].t==="("&&(g===" "||g==="n"||g===")")||g==="t"&&(o[H].v==="/"||o[H].v===" "&&o[H+1]!=null&&o[H+1].t=="?"));)o[f].v+=o[H].v,o[H]={v:"",t:";"},++H;U+=o[f].v,f=H-1;break;case"G":o[f].t="t",o[f].v=xx(r,t);break}var q="",ne,V;if(U.length>0){U.charCodeAt(0)==40?(ne=r<0&&U.charCodeAt(0)===45?-r:r,V=Wo("n",U,ne)):(ne=r<0&&n>1?-r:r,V=Wo("n",U,ne),ne<0&&o[0]&&o[0].t=="t"&&(V=V.substr(1),o[0].v="-"+o[0].v)),H=V.length-1;var J=o.length;for(f=0;f<o.length;++f)if(o[f]!=null&&o[f].t!="t"&&o[f].v.indexOf(".")>-1){J=f;break}var Q=o.length;if(J===o.length&&V.indexOf("E")===-1){for(f=o.length-1;f>=0;--f)o[f]==null||"n?".indexOf(o[f].t)===-1||(H>=o[f].v.length-1?(H-=o[f].v.length,o[f].v=V.substr(H+1,o[f].v.length)):H<0?o[f].v="":(o[f].v=V.substr(0,H+1),H=-1),o[f].t="t",Q=f);H>=0&&Q<o.length&&(o[Q].v=V.substr(0,H+1)+o[Q].v)}else if(J!==o.length&&V.indexOf("E")===-1){for(H=V.indexOf(".")-1,f=J;f>=0;--f)if(!(o[f]==null||"n?".indexOf(o[f].t)===-1)){for(k=o[f].v.indexOf(".")>-1&&f===J?o[f].v.indexOf(".")-1:o[f].v.length-1,q=o[f].v.substr(k+1);k>=0;--k)H>=0&&(o[f].v.charAt(k)==="0"||o[f].v.charAt(k)==="#")&&(q=V.charAt(H--)+q);o[f].v=q,o[f].t="t",Q=f}for(H>=0&&Q<o.length&&(o[Q].v=V.substr(0,H+1)+o[Q].v),H=V.indexOf(".")+1,f=J;f<o.length;++f)if(!(o[f]==null||"n?(".indexOf(o[f].t)===-1&&f!==J)){for(k=o[f].v.indexOf(".")>-1&&f===J?o[f].v.indexOf(".")+1:0,q=o[f].v.substr(0,k);k<o[f].v.length;++k)H<V.length&&(q+=V.charAt(H++));o[f].v=q,o[f].t="t",Q=f}}}for(f=0;f<o.length;++f)o[f]!=null&&"n?".indexOf(o[f].t)>-1&&(ne=n>1&&r<0&&f>0&&o[f-1].v==="-"?-r:r,o[f].v=Wo(o[f].t,o[f].v,ne),o[f].t="t");var Te="";for(f=0;f!==o.length;++f)o[f]!=null&&(Te+=o[f].v);return Te}var Rb=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function Db(e,r){if(r==null)return!1;var t=parseFloat(r[2]);switch(r[1]){case"=":if(e==t)return!0;break;case">":if(e>t)return!0;break;case"<":if(e<t)return!0;break;case"<>":if(e!=t)return!0;break;case">=":if(e>=t)return!0;break;case"<=":if(e<=t)return!0;break}return!1}function ME(e,r){var t=jE(e),n=t.length,o=t[n-1].indexOf("@");if(n<4&&o>-1&&--n,t.length>4)throw new Error("cannot find right format for |"+t.join("|")+"|");if(typeof r!="number")return[4,t.length===4||o>-1?t[t.length-1]:"@"];switch(t.length){case 1:t=o>-1?["General","General","General",t[0]]:[t[0],t[0],t[0],"@"];break;case 2:t=o>-1?[t[0],t[0],t[0],t[1]]:[t[0],t[1],t[0],"@"];break;case 3:t=o>-1?[t[0],t[1],t[0],t[2]]:[t[0],t[1],t[2],"@"];break}var u=r>0?t[0]:r<0?t[1]:t[2];if(t[0].indexOf("[")===-1&&t[1].indexOf("[")===-1)return[n,u];if(t[0].match(/\[[=<>]/)!=null||t[1].match(/\[[=<>]/)!=null){var f=t[0].match(Rb),g=t[1].match(Rb);return Db(r,f)?[n,t[0]]:Db(r,g)?[n,t[1]]:[n,t[f!=null&&g!=null?2:1]]}return[n,u]}function Al(e,r,t){t==null&&(t={});var n="";switch(typeof e){case"string":e=="m/d/yy"&&t.dateNF?n=t.dateNF:n=e;break;case"number":e==14&&t.dateNF?n=t.dateNF:n=(t.table!=null?t.table:rn)[e],n==null&&(n=t.table&&t.table[jb[e]]||rn[jb[e]]),n==null&&(n=hE[e]||"General");break}if(Kf(n,0))return xx(r,t);r instanceof Date&&(r=H_(r,t.date1904));var o=ME(n,r);if(Kf(o[1]))return xx(r,t);if(r===!0)r="TRUE";else if(r===!1)r="FALSE";else if(r===""||r==null)return"";return OE(o[1],r,t,o[0])}function J_(e,r){if(typeof r!="number"){r=+r||-1;for(var t=0;t<392;++t){if(rn[t]==null){r<0&&(r=t);continue}if(rn[t]==e){r=t;break}}r<0&&(r=391)}return rn[r]=e,r}function Eh(e){for(var r=0;r!=392;++r)e[r]!==void 0&&J_(e[r],r)}function Ch(){rn=fE()}var Q_=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function RE(e){var r=typeof e=="number"?rn[e]:e;return r=r.replace(Q_,"(\\d+)"),new RegExp("^"+r+"$")}function DE(e,r,t){var n=-1,o=-1,u=-1,f=-1,g=-1,v=-1;(r.match(Q_)||[]).forEach(function(N,C){var O=parseInt(t[C+1],10);switch(N.toLowerCase().charAt(0)){case"y":n=O;break;case"d":u=O;break;case"h":f=O;break;case"s":v=O;break;case"m":f>=0?g=O:o=O;break}}),v>=0&&g==-1&&o>=0&&(g=o,o=-1);var p=(""+(n>=0?n:new Date().getFullYear())).slice(-4)+"-"+("00"+(o>=1?o:1)).slice(-2)+"-"+("00"+(u>=1?u:1)).slice(-2);p.length==7&&(p="0"+p),p.length==8&&(p="20"+p);var k=("00"+(f>=0?f:0)).slice(-2)+":"+("00"+(g>=0?g:0)).slice(-2)+":"+("00"+(v>=0?v:0)).slice(-2);return f==-1&&g==-1&&v==-1?p:n==-1&&o==-1&&u==-1?k:p+"T"+k}var IE=(function(){var e={};e.version="1.2.0";function r(){for(var V=0,J=new Array(256),Q=0;Q!=256;++Q)V=Q,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,V=V&1?-306674912^V>>>1:V>>>1,J[Q]=V;return typeof Int32Array!="undefined"?new Int32Array(J):J}var t=r();function n(V){var J=0,Q=0,Te=0,je=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(Te=0;Te!=256;++Te)je[Te]=V[Te];for(Te=0;Te!=256;++Te)for(Q=V[Te],J=256+Te;J<4096;J+=256)Q=je[J]=Q>>>8^V[Q&255];var me=[];for(Te=1;Te!=16;++Te)me[Te-1]=typeof Int32Array!="undefined"?je.subarray(Te*256,Te*256+256):je.slice(Te*256,Te*256+256);return me}var o=n(t),u=o[0],f=o[1],g=o[2],v=o[3],p=o[4],k=o[5],N=o[6],C=o[7],O=o[8],I=o[9],M=o[10],D=o[11],z=o[12],B=o[13],U=o[14];function H(V,J){for(var Q=J^-1,Te=0,je=V.length;Te<je;)Q=Q>>>8^t[(Q^V.charCodeAt(Te++))&255];return~Q}function q(V,J){for(var Q=J^-1,Te=V.length-15,je=0;je<Te;)Q=U[V[je++]^Q&255]^B[V[je++]^Q>>8&255]^z[V[je++]^Q>>16&255]^D[V[je++]^Q>>>24]^M[V[je++]]^I[V[je++]]^O[V[je++]]^C[V[je++]]^N[V[je++]]^k[V[je++]]^p[V[je++]]^v[V[je++]]^g[V[je++]]^f[V[je++]]^u[V[je++]]^t[V[je++]];for(Te+=15;je<Te;)Q=Q>>>8^t[(Q^V[je++])&255];return~Q}function ne(V,J){for(var Q=J^-1,Te=0,je=V.length,me=0,Se=0;Te<je;)me=V.charCodeAt(Te++),me<128?Q=Q>>>8^t[(Q^me)&255]:me<2048?(Q=Q>>>8^t[(Q^(192|me>>6&31))&255],Q=Q>>>8^t[(Q^(128|me&63))&255]):me>=55296&&me<57344?(me=(me&1023)+64,Se=V.charCodeAt(Te++)&1023,Q=Q>>>8^t[(Q^(240|me>>8&7))&255],Q=Q>>>8^t[(Q^(128|me>>2&63))&255],Q=Q>>>8^t[(Q^(128|Se>>6&15|(me&3)<<4))&255],Q=Q>>>8^t[(Q^(128|Se&63))&255]):(Q=Q>>>8^t[(Q^(224|me>>12&15))&255],Q=Q>>>8^t[(Q^(128|me>>6&63))&255],Q=Q>>>8^t[(Q^(128|me&63))&255]);return~Q}return e.table=t,e.bstr=H,e.buf=q,e.str=ne,e})(),Aa=(function(){var r={};r.version="1.2.1";function t(ie,Z){for(var ce=ie.split("/"),xe=Z.split("/"),ye=0,Ee=0,ge=Math.min(ce.length,xe.length);ye<ge;++ye){if(Ee=ce[ye].length-xe[ye].length)return Ee;if(ce[ye]!=xe[ye])return ce[ye]<xe[ye]?-1:1}return ce.length-xe.length}function n(ie){if(ie.charAt(ie.length-1)=="/")return ie.slice(0,-1).indexOf("/")===-1?ie:n(ie.slice(0,-1));var Z=ie.lastIndexOf("/");return Z===-1?ie:ie.slice(0,Z+1)}function o(ie){if(ie.charAt(ie.length-1)=="/")return o(ie.slice(0,-1));var Z=ie.lastIndexOf("/");return Z===-1?ie:ie.slice(Z+1)}function u(ie,Z){typeof Z=="string"&&(Z=new Date(Z));var ce=Z.getHours();ce=ce<<6|Z.getMinutes(),ce=ce<<5|Z.getSeconds()>>>1,ie.write_shift(2,ce);var xe=Z.getFullYear()-1980;xe=xe<<4|Z.getMonth()+1,xe=xe<<5|Z.getDate(),ie.write_shift(2,xe)}function f(ie){var Z=ie.read_shift(2)&65535,ce=ie.read_shift(2)&65535,xe=new Date,ye=ce&31;ce>>>=5;var Ee=ce&15;ce>>>=4,xe.setMilliseconds(0),xe.setFullYear(ce+1980),xe.setMonth(Ee-1),xe.setDate(ye);var ge=Z&31;Z>>>=5;var Be=Z&63;return Z>>>=6,xe.setHours(Z),xe.setMinutes(Be),xe.setSeconds(ge<<1),xe}function g(ie){li(ie,0);for(var Z={},ce=0;ie.l<=ie.length-4;){var xe=ie.read_shift(2),ye=ie.read_shift(2),Ee=ie.l+ye,ge={};switch(xe){case 21589:ce=ie.read_shift(1),ce&1&&(ge.mtime=ie.read_shift(4)),ye>5&&(ce&2&&(ge.atime=ie.read_shift(4)),ce&4&&(ge.ctime=ie.read_shift(4))),ge.mtime&&(ge.mt=new Date(ge.mtime*1e3));break}ie.l=Ee,Z[xe]=ge}return Z}var v;function p(){return v||(v={})}function k(ie,Z){if(ie[0]==80&&ie[1]==75)return Re(ie,Z);if((ie[0]|32)==109&&(ie[1]|32)==105)return fn(ie,Z);if(ie.length<512)throw new Error("CFB file size "+ie.length+" < 512");var ce=3,xe=512,ye=0,Ee=0,ge=0,Be=0,ze=0,Ze=[],et=ie.slice(0,512);li(et,0);var _t=N(et);switch(ce=_t[0],ce){case 3:xe=512;break;case 4:xe=4096;break;case 0:if(_t[1]==0)return Re(ie,Z);default:throw new Error("Major Version: Expected 3 or 4 saw "+ce)}xe!==512&&(et=ie.slice(0,xe),li(et,28));var vt=ie.slice(0,xe);C(et,ce);var Ot=et.read_shift(4,"i");if(ce===3&&Ot!==0)throw new Error("# Directory Sectors: Expected 0 saw "+Ot);et.l+=4,ge=et.read_shift(4,"i"),et.l+=4,et.chk("00100000","Mini Stream Cutoff Size: "),Be=et.read_shift(4,"i"),ye=et.read_shift(4,"i"),ze=et.read_shift(4,"i"),Ee=et.read_shift(4,"i");for(var Rt=-1,Ut=0;Ut<109&&(Rt=et.read_shift(4,"i"),!(Rt<0));++Ut)Ze[Ut]=Rt;var nr=O(ie,xe);D(ze,Ee,nr,xe,Ze);var ct=B(nr,ge,Ze,xe);ct[ge].name="!Directory",ye>0&&Be!==Se&&(ct[Be].name="!MiniFAT"),ct[Ze[0]].name="!FAT",ct.fat_addrs=Ze,ct.ssz=xe;var ga={},kr=[],Wa=[],xs=[];U(ge,ct,nr,kr,ye,ga,Wa,Be),I(Wa,xs,kr),kr.shift();var Or={FileIndex:Wa,FullPaths:xs};return Z&&Z.raw&&(Or.raw={header:vt,sectors:nr}),Or}function N(ie){if(ie[ie.l]==80&&ie[ie.l+1]==75)return[0,0];ie.chk(Oe,"Header Signature: "),ie.l+=16;var Z=ie.read_shift(2,"u");return[ie.read_shift(2,"u"),Z]}function C(ie,Z){var ce=9;switch(ie.l+=2,ce=ie.read_shift(2)){case 9:if(Z!=3)throw new Error("Sector Shift: Expected 9 saw "+ce);break;case 12:if(Z!=4)throw new Error("Sector Shift: Expected 12 saw "+ce);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+ce)}ie.chk("0600","Mini Sector Shift: "),ie.chk("000000000000","Reserved: ")}function O(ie,Z){for(var ce=Math.ceil(ie.length/Z)-1,xe=[],ye=1;ye<ce;++ye)xe[ye-1]=ie.slice(ye*Z,(ye+1)*Z);return xe[ce-1]=ie.slice(ce*Z),xe}function I(ie,Z,ce){for(var xe=0,ye=0,Ee=0,ge=0,Be=0,ze=ce.length,Ze=[],et=[];xe<ze;++xe)Ze[xe]=et[xe]=xe,Z[xe]=ce[xe];for(;Be<et.length;++Be)xe=et[Be],ye=ie[xe].L,Ee=ie[xe].R,ge=ie[xe].C,Ze[xe]===xe&&(ye!==-1&&Ze[ye]!==ye&&(Ze[xe]=Ze[ye]),Ee!==-1&&Ze[Ee]!==Ee&&(Ze[xe]=Ze[Ee])),ge!==-1&&(Ze[ge]=xe),ye!==-1&&xe!=Ze[xe]&&(Ze[ye]=Ze[xe],et.lastIndexOf(ye)<Be&&et.push(ye)),Ee!==-1&&xe!=Ze[xe]&&(Ze[Ee]=Ze[xe],et.lastIndexOf(Ee)<Be&&et.push(Ee));for(xe=1;xe<ze;++xe)Ze[xe]===xe&&(Ee!==-1&&Ze[Ee]!==Ee?Ze[xe]=Ze[Ee]:ye!==-1&&Ze[ye]!==ye&&(Ze[xe]=Ze[ye]));for(xe=1;xe<ze;++xe)if(ie[xe].type!==0){if(Be=xe,Be!=Ze[Be])do Be=Ze[Be],Z[xe]=Z[Be]+"/"+Z[xe];while(Be!==0&&Ze[Be]!==-1&&Be!=Ze[Be]);Ze[xe]=-1}for(Z[0]+="/",xe=1;xe<ze;++xe)ie[xe].type!==2&&(Z[xe]+="/")}function M(ie,Z,ce){for(var xe=ie.start,ye=ie.size,Ee=[],ge=xe;ce&&ye>0&&ge>=0;)Ee.push(Z.slice(ge*me,ge*me+me)),ye-=me,ge=sc(ce,ge*4);return Ee.length===0?xt(0):Qn(Ee).slice(0,ie.size)}function D(ie,Z,ce,xe,ye){var Ee=Se;if(ie===Se){if(Z!==0)throw new Error("DIFAT chain shorter than expected")}else if(ie!==-1){var ge=ce[ie],Be=(xe>>>2)-1;if(!ge)return;for(var ze=0;ze<Be&&(Ee=sc(ge,ze*4))!==Se;++ze)ye.push(Ee);D(sc(ge,xe-4),Z-1,ce,xe,ye)}}function z(ie,Z,ce,xe,ye){var Ee=[],ge=[];ye||(ye=[]);var Be=xe-1,ze=0,Ze=0;for(ze=Z;ze>=0;){ye[ze]=!0,Ee[Ee.length]=ze,ge.push(ie[ze]);var et=ce[Math.floor(ze*4/xe)];if(Ze=ze*4&Be,xe<4+Ze)throw new Error("FAT boundary crossed: "+ze+" 4 "+xe);if(!ie[et])break;ze=sc(ie[et],Ze)}return{nodes:Ee,data:Hb([ge])}}function B(ie,Z,ce,xe){var ye=ie.length,Ee=[],ge=[],Be=[],ze=[],Ze=xe-1,et=0,_t=0,vt=0,Ot=0;for(et=0;et<ye;++et)if(Be=[],vt=et+Z,vt>=ye&&(vt-=ye),!ge[vt]){ze=[];var Rt=[];for(_t=vt;_t>=0;){Rt[_t]=!0,ge[_t]=!0,Be[Be.length]=_t,ze.push(ie[_t]);var Ut=ce[Math.floor(_t*4/xe)];if(Ot=_t*4&Ze,xe<4+Ot)throw new Error("FAT boundary crossed: "+_t+" 4 "+xe);if(!ie[Ut]||(_t=sc(ie[Ut],Ot),Rt[_t]))break}Ee[vt]={nodes:Be,data:Hb([ze])}}return Ee}function U(ie,Z,ce,xe,ye,Ee,ge,Be){for(var ze=0,Ze=xe.length?2:0,et=Z[ie].data,_t=0,vt=0,Ot;_t<et.length;_t+=128){var Rt=et.slice(_t,_t+128);li(Rt,64),vt=Rt.read_shift(2),Ot=$x(Rt,0,vt-Ze),xe.push(Ot);var Ut={name:Ot,type:Rt.read_shift(1),color:Rt.read_shift(1),L:Rt.read_shift(4,"i"),R:Rt.read_shift(4,"i"),C:Rt.read_shift(4,"i"),clsid:Rt.read_shift(16),state:Rt.read_shift(4,"i"),start:0,size:0},nr=Rt.read_shift(2)+Rt.read_shift(2)+Rt.read_shift(2)+Rt.read_shift(2);nr!==0&&(Ut.ct=H(Rt,Rt.l-8));var ct=Rt.read_shift(2)+Rt.read_shift(2)+Rt.read_shift(2)+Rt.read_shift(2);ct!==0&&(Ut.mt=H(Rt,Rt.l-8)),Ut.start=Rt.read_shift(4,"i"),Ut.size=Rt.read_shift(4,"i"),Ut.size<0&&Ut.start<0&&(Ut.size=Ut.type=0,Ut.start=Se,Ut.name=""),Ut.type===5?(ze=Ut.start,ye>0&&ze!==Se&&(Z[ze].name="!StreamData")):Ut.size>=4096?(Ut.storage="fat",Z[Ut.start]===void 0&&(Z[Ut.start]=z(ce,Ut.start,Z.fat_addrs,Z.ssz)),Z[Ut.start].name=Ut.name,Ut.content=Z[Ut.start].data.slice(0,Ut.size)):(Ut.storage="minifat",Ut.size<0?Ut.size=0:ze!==Se&&Ut.start!==Se&&Z[ze]&&(Ut.content=M(Ut,Z[ze].data,(Z[Be]||{}).data))),Ut.content&&li(Ut.content,0),Ee[Ot]=Ut,ge.push(Ut)}}function H(ie,Z){return new Date((di(ie,Z+4)/1e7*Math.pow(2,32)+di(ie,Z)/1e7-11644473600)*1e3)}function q(ie,Z){return p(),k(v.readFileSync(ie),Z)}function ne(ie,Z){var ce=Z&&Z.type;switch(ce||ha&&Buffer.isBuffer(ie)&&(ce="buffer"),ce||"base64"){case"file":return q(ie,Z);case"base64":return k(Gi($o(ie)),Z);case"binary":return k(Gi(ie),Z)}return k(ie,Z)}function V(ie,Z){var ce=Z||{},xe=ce.root||"Root Entry";if(ie.FullPaths||(ie.FullPaths=[]),ie.FileIndex||(ie.FileIndex=[]),ie.FullPaths.length!==ie.FileIndex.length)throw new Error("inconsistent CFB structure");ie.FullPaths.length===0&&(ie.FullPaths[0]=xe+"/",ie.FileIndex[0]={name:xe,type:5}),ce.CLSID&&(ie.FileIndex[0].clsid=ce.CLSID),J(ie)}function J(ie){var Z="Sh33tJ5";if(!Aa.find(ie,"/"+Z)){var ce=xt(4);ce[0]=55,ce[1]=ce[3]=50,ce[2]=54,ie.FileIndex.push({name:Z,type:2,content:ce,size:4,L:69,R:69,C:69}),ie.FullPaths.push(ie.FullPaths[0]+Z),Q(ie)}}function Q(ie,Z){V(ie);for(var ce=!1,xe=!1,ye=ie.FullPaths.length-1;ye>=0;--ye){var Ee=ie.FileIndex[ye];switch(Ee.type){case 0:xe?ce=!0:(ie.FileIndex.pop(),ie.FullPaths.pop());break;case 1:case 2:case 5:xe=!0,isNaN(Ee.R*Ee.L*Ee.C)&&(ce=!0),Ee.R>-1&&Ee.L>-1&&Ee.R==Ee.L&&(ce=!0);break;default:ce=!0;break}}if(!(!ce&&!Z)){var ge=new Date(1987,1,19),Be=0,ze=Object.create?Object.create(null):{},Ze=[];for(ye=0;ye<ie.FullPaths.length;++ye)ze[ie.FullPaths[ye]]=!0,ie.FileIndex[ye].type!==0&&Ze.push([ie.FullPaths[ye],ie.FileIndex[ye]]);for(ye=0;ye<Ze.length;++ye){var et=n(Ze[ye][0]);xe=ze[et],xe||(Ze.push([et,{name:o(et).replace("/",""),type:1,clsid:be,ct:ge,mt:ge,content:null}]),ze[et]=!0)}for(Ze.sort(function(Ot,Rt){return t(Ot[0],Rt[0])}),ie.FullPaths=[],ie.FileIndex=[],ye=0;ye<Ze.length;++ye)ie.FullPaths[ye]=Ze[ye][0],ie.FileIndex[ye]=Ze[ye][1];for(ye=0;ye<Ze.length;++ye){var _t=ie.FileIndex[ye],vt=ie.FullPaths[ye];if(_t.name=o(vt).replace("/",""),_t.L=_t.R=_t.C=-(_t.color=1),_t.size=_t.content?_t.content.length:0,_t.start=0,_t.clsid=_t.clsid||be,ye===0)_t.C=Ze.length>1?1:-1,_t.size=0,_t.type=5;else if(vt.slice(-1)=="/"){for(Be=ye+1;Be<Ze.length&&n(ie.FullPaths[Be])!=vt;++Be);for(_t.C=Be>=Ze.length?-1:Be,Be=ye+1;Be<Ze.length&&n(ie.FullPaths[Be])!=n(vt);++Be);_t.R=Be>=Ze.length?-1:Be,_t.type=1}else n(ie.FullPaths[ye+1]||"")==n(vt)&&(_t.R=ye+1),_t.type=2}}}function Te(ie,Z){var ce=Z||{};if(ce.fileType=="mad")return hn(ie,ce);switch(Q(ie),ce.fileType){case"zip":return Tt(ie,ce)}var xe=(function(Ot){for(var Rt=0,Ut=0,nr=0;nr<Ot.FileIndex.length;++nr){var ct=Ot.FileIndex[nr];if(ct.content){var ga=ct.content.length;ga>0&&(ga<4096?Rt+=ga+63>>6:Ut+=ga+511>>9)}}for(var kr=Ot.FullPaths.length+3>>2,Wa=Rt+7>>3,xs=Rt+127>>7,Or=Wa+Ut+kr+xs,Cr=Or+127>>7,Nr=Cr<=109?0:Math.ceil((Cr-109)/127);Or+Cr+Nr+127>>7>Cr;)Nr=++Cr<=109?0:Math.ceil((Cr-109)/127);var br=[1,Nr,Cr,xs,kr,Ut,Rt,0];return Ot.FileIndex[0].size=Rt<<6,br[7]=(Ot.FileIndex[0].start=br[0]+br[1]+br[2]+br[3]+br[4]+br[5])+(br[6]+7>>3),br})(ie),ye=xt(xe[7]<<9),Ee=0,ge=0;{for(Ee=0;Ee<8;++Ee)ye.write_shift(1,ue[Ee]);for(Ee=0;Ee<8;++Ee)ye.write_shift(2,0);for(ye.write_shift(2,62),ye.write_shift(2,3),ye.write_shift(2,65534),ye.write_shift(2,9),ye.write_shift(2,6),Ee=0;Ee<3;++Ee)ye.write_shift(2,0);for(ye.write_shift(4,0),ye.write_shift(4,xe[2]),ye.write_shift(4,xe[0]+xe[1]+xe[2]+xe[3]-1),ye.write_shift(4,0),ye.write_shift(4,4096),ye.write_shift(4,xe[3]?xe[0]+xe[1]+xe[2]-1:Se),ye.write_shift(4,xe[3]),ye.write_shift(-4,xe[1]?xe[0]-1:Se),ye.write_shift(4,xe[1]),Ee=0;Ee<109;++Ee)ye.write_shift(-4,Ee<xe[2]?xe[1]+Ee:-1)}if(xe[1])for(ge=0;ge<xe[1];++ge){for(;Ee<236+ge*127;++Ee)ye.write_shift(-4,Ee<xe[2]?xe[1]+Ee:-1);ye.write_shift(-4,ge===xe[1]-1?Se:ge+1)}var Be=function(Ot){for(ge+=Ot;Ee<ge-1;++Ee)ye.write_shift(-4,Ee+1);Ot&&(++Ee,ye.write_shift(-4,Se))};for(ge=Ee=0,ge+=xe[1];Ee<ge;++Ee)ye.write_shift(-4,re.DIFSECT);for(ge+=xe[2];Ee<ge;++Ee)ye.write_shift(-4,re.FATSECT);Be(xe[3]),Be(xe[4]);for(var ze=0,Ze=0,et=ie.FileIndex[0];ze<ie.FileIndex.length;++ze)et=ie.FileIndex[ze],et.content&&(Ze=et.content.length,!(Ze<4096)&&(et.start=ge,Be(Ze+511>>9)));for(Be(xe[6]+7>>3);ye.l&511;)ye.write_shift(-4,re.ENDOFCHAIN);for(ge=Ee=0,ze=0;ze<ie.FileIndex.length;++ze)et=ie.FileIndex[ze],et.content&&(Ze=et.content.length,!(!Ze||Ze>=4096)&&(et.start=ge,Be(Ze+63>>6)));for(;ye.l&511;)ye.write_shift(-4,re.ENDOFCHAIN);for(Ee=0;Ee<xe[4]<<2;++Ee){var _t=ie.FullPaths[Ee];if(!_t||_t.length===0){for(ze=0;ze<17;++ze)ye.write_shift(4,0);for(ze=0;ze<3;++ze)ye.write_shift(4,-1);for(ze=0;ze<12;++ze)ye.write_shift(4,0);continue}et=ie.FileIndex[Ee],Ee===0&&(et.start=et.size?et.start-1:Se);var vt=Ee===0&&ce.root||et.name;if(Ze=2*(vt.length+1),ye.write_shift(64,vt,"utf16le"),ye.write_shift(2,Ze),ye.write_shift(1,et.type),ye.write_shift(1,et.color),ye.write_shift(-4,et.L),ye.write_shift(-4,et.R),ye.write_shift(-4,et.C),et.clsid)ye.write_shift(16,et.clsid,"hex");else for(ze=0;ze<4;++ze)ye.write_shift(4,0);ye.write_shift(4,et.state||0),ye.write_shift(4,0),ye.write_shift(4,0),ye.write_shift(4,0),ye.write_shift(4,0),ye.write_shift(4,et.start),ye.write_shift(4,et.size),ye.write_shift(4,0)}for(Ee=1;Ee<ie.FileIndex.length;++Ee)if(et=ie.FileIndex[Ee],et.size>=4096)if(ye.l=et.start+1<<9,ha&&Buffer.isBuffer(et.content))et.content.copy(ye,ye.l,0,et.size),ye.l+=et.size+511&-512;else{for(ze=0;ze<et.size;++ze)ye.write_shift(1,et.content[ze]);for(;ze&511;++ze)ye.write_shift(1,0)}for(Ee=1;Ee<ie.FileIndex.length;++Ee)if(et=ie.FileIndex[Ee],et.size>0&&et.size<4096)if(ha&&Buffer.isBuffer(et.content))et.content.copy(ye,ye.l,0,et.size),ye.l+=et.size+63&-64;else{for(ze=0;ze<et.size;++ze)ye.write_shift(1,et.content[ze]);for(;ze&63;++ze)ye.write_shift(1,0)}if(ha)ye.l=ye.length;else for(;ye.l<ye.length;)ye.write_shift(1,0);return ye}function je(ie,Z){var ce=ie.FullPaths.map(function(ze){return ze.toUpperCase()}),xe=ce.map(function(ze){var Ze=ze.split("/");return Ze[Ze.length-(ze.slice(-1)=="/"?2:1)]}),ye=!1;Z.charCodeAt(0)===47?(ye=!0,Z=ce[0].slice(0,-1)+Z):ye=Z.indexOf("/")!==-1;var Ee=Z.toUpperCase(),ge=ye===!0?ce.indexOf(Ee):xe.indexOf(Ee);if(ge!==-1)return ie.FileIndex[ge];var Be=!Ee.match(Sf);for(Ee=Ee.replace(P0,""),Be&&(Ee=Ee.replace(Sf,"!")),ge=0;ge<ce.length;++ge)if((Be?ce[ge].replace(Sf,"!"):ce[ge]).replace(P0,"")==Ee||(Be?xe[ge].replace(Sf,"!"):xe[ge]).replace(P0,"")==Ee)return ie.FileIndex[ge];return null}var me=64,Se=-2,Oe="d0cf11e0a1b11ae1",ue=[208,207,17,224,161,177,26,225],be="00000000000000000000000000000000",re={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:Se,FREESECT:-1,HEADER_SIGNATURE:Oe,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:be,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function de(ie,Z,ce){p();var xe=Te(ie,ce);v.writeFileSync(Z,xe)}function Ae(ie){for(var Z=new Array(ie.length),ce=0;ce<ie.length;++ce)Z[ce]=String.fromCharCode(ie[ce]);return Z.join("")}function _e(ie,Z){var ce=Te(ie,Z);switch(Z&&Z.type||"buffer"){case"file":return p(),v.writeFileSync(Z.filename,ce),ce;case"binary":return typeof ce=="string"?ce:Ae(ce);case"base64":return Y0(typeof ce=="string"?ce:Ae(ce));case"buffer":if(ha)return Buffer.isBuffer(ce)?ce:Jo(ce);case"array":return typeof ce=="string"?Gi(ce):ce}return ce}var K;function W(ie){try{var Z=ie.InflateRaw,ce=new Z;if(ce._processChunk(new Uint8Array([3,0]),ce._finishFlushFlag),ce.bytesRead)K=ie;else throw new Error("zlib does not expose bytesRead")}catch(xe){console.error("cannot use native zlib: "+(xe.message||xe))}}function ae(ie,Z){if(!K)return Dr(ie,Z);var ce=K.InflateRaw,xe=new ce,ye=xe._processChunk(ie.slice(ie.l),xe._finishFlushFlag);return ie.l+=xe.bytesRead,ye}function se(ie){return K?K.deflateRawSync(ie):It(ie)}var he=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],pe=[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],Je=[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 Fe(ie){var Z=(ie<<1|ie<<11)&139536|(ie<<5|ie<<15)&558144;return(Z>>16|Z>>8|Z)&255}for(var ft=typeof Uint8Array!="undefined",ot=ft?new Uint8Array(256):[],Lt=0;Lt<256;++Lt)ot[Lt]=Fe(Lt);function zt(ie,Z){var ce=ot[ie&255];return Z<=8?ce>>>8-Z:(ce=ce<<8|ot[ie>>8&255],Z<=16?ce>>>16-Z:(ce=ce<<8|ot[ie>>16&255],ce>>>24-Z))}function Ht(ie,Z){var ce=Z&7,xe=Z>>>3;return(ie[xe]|(ce<=6?0:ie[xe+1]<<8))>>>ce&3}function ht(ie,Z){var ce=Z&7,xe=Z>>>3;return(ie[xe]|(ce<=5?0:ie[xe+1]<<8))>>>ce&7}function tr(ie,Z){var ce=Z&7,xe=Z>>>3;return(ie[xe]|(ce<=4?0:ie[xe+1]<<8))>>>ce&15}function Kt(ie,Z){var ce=Z&7,xe=Z>>>3;return(ie[xe]|(ce<=3?0:ie[xe+1]<<8))>>>ce&31}function gt(ie,Z){var ce=Z&7,xe=Z>>>3;return(ie[xe]|(ce<=1?0:ie[xe+1]<<8))>>>ce&127}function ve(ie,Z,ce){var xe=Z&7,ye=Z>>>3,Ee=(1<<ce)-1,ge=ie[ye]>>>xe;return ce<8-xe||(ge|=ie[ye+1]<<8-xe,ce<16-xe)||(ge|=ie[ye+2]<<16-xe,ce<24-xe)||(ge|=ie[ye+3]<<24-xe),ge&Ee}function Le(ie,Z,ce){var xe=Z&7,ye=Z>>>3;return xe<=5?ie[ye]|=(ce&7)<<xe:(ie[ye]|=ce<<xe&255,ie[ye+1]=(ce&7)>>8-xe),Z+3}function ut(ie,Z,ce){var xe=Z&7,ye=Z>>>3;return ce=(ce&1)<<xe,ie[ye]|=ce,Z+1}function tt(ie,Z,ce){var xe=Z&7,ye=Z>>>3;return ce<<=xe,ie[ye]|=ce&255,ce>>>=8,ie[ye+1]=ce,Z+8}function Wt(ie,Z,ce){var xe=Z&7,ye=Z>>>3;return ce<<=xe,ie[ye]|=ce&255,ce>>>=8,ie[ye+1]=ce&255,ie[ye+2]=ce>>>8,Z+16}function pt(ie,Z){var ce=ie.length,xe=2*ce>Z?2*ce:Z+5,ye=0;if(ce>=Z)return ie;if(ha){var Ee=Cb(xe);if(ie.copy)ie.copy(Ee);else for(;ye<ie.length;++ye)Ee[ye]=ie[ye];return Ee}else if(ft){var ge=new Uint8Array(xe);if(ge.set)ge.set(ie);else for(;ye<ce;++ye)ge[ye]=ie[ye];return ge}return ie.length=xe,ie}function We(ie){for(var Z=new Array(ie),ce=0;ce<ie;++ce)Z[ce]=0;return Z}function Nt(ie,Z,ce){var xe=1,ye=0,Ee=0,ge=0,Be=0,ze=ie.length,Ze=ft?new Uint16Array(32):We(32);for(Ee=0;Ee<32;++Ee)Ze[Ee]=0;for(Ee=ze;Ee<ce;++Ee)ie[Ee]=0;ze=ie.length;var et=ft?new Uint16Array(ze):We(ze);for(Ee=0;Ee<ze;++Ee)Ze[ye=ie[Ee]]++,xe<ye&&(xe=ye),et[Ee]=0;for(Ze[0]=0,Ee=1;Ee<=xe;++Ee)Ze[Ee+16]=Be=Be+Ze[Ee-1]<<1;for(Ee=0;Ee<ze;++Ee)Be=ie[Ee],Be!=0&&(et[Ee]=Ze[Be+16]++);var _t=0;for(Ee=0;Ee<ze;++Ee)if(_t=ie[Ee],_t!=0)for(Be=zt(et[Ee],xe)>>xe-_t,ge=(1<<xe+4-_t)-1;ge>=0;--ge)Z[Be|ge<<_t]=_t&15|Ee<<4;return xe}var At=ft?new Uint16Array(512):We(512),Qt=ft?new Uint16Array(32):We(32);if(!ft){for(var cr=0;cr<512;++cr)At[cr]=0;for(cr=0;cr<32;++cr)Qt[cr]=0}(function(){for(var ie=[],Z=0;Z<32;Z++)ie.push(5);Nt(ie,Qt,32);var ce=[];for(Z=0;Z<=143;Z++)ce.push(8);for(;Z<=255;Z++)ce.push(9);for(;Z<=279;Z++)ce.push(7);for(;Z<=287;Z++)ce.push(8);Nt(ce,At,288)})();var He=(function(){for(var Z=ft?new Uint8Array(32768):[],ce=0,xe=0;ce<Je.length-1;++ce)for(;xe<Je[ce+1];++xe)Z[xe]=ce;for(;xe<32768;++xe)Z[xe]=29;var ye=ft?new Uint8Array(259):[];for(ce=0,xe=0;ce<pe.length-1;++ce)for(;xe<pe[ce+1];++xe)ye[xe]=ce;function Ee(Be,ze){for(var Ze=0;Ze<Be.length;){var et=Math.min(65535,Be.length-Ze),_t=Ze+et==Be.length;for(ze.write_shift(1,+_t),ze.write_shift(2,et),ze.write_shift(2,~et&65535);et-- >0;)ze[ze.l++]=Be[Ze++]}return ze.l}function ge(Be,ze){for(var Ze=0,et=0,_t=ft?new Uint16Array(32768):[];et<Be.length;){var vt=Math.min(65535,Be.length-et);if(vt<10){for(Ze=Le(ze,Ze,+(et+vt==Be.length)),Ze&7&&(Ze+=8-(Ze&7)),ze.l=Ze/8|0,ze.write_shift(2,vt),ze.write_shift(2,~vt&65535);vt-- >0;)ze[ze.l++]=Be[et++];Ze=ze.l*8;continue}Ze=Le(ze,Ze,+(et+vt==Be.length)+2);for(var Ot=0;vt-- >0;){var Rt=Be[et];Ot=(Ot<<5^Rt)&32767;var Ut=-1,nr=0;if((Ut=_t[Ot])&&(Ut|=et&-32768,Ut>et&&(Ut-=32768),Ut<et))for(;Be[Ut+nr]==Be[et+nr]&&nr<250;)++nr;if(nr>2){Rt=ye[nr],Rt<=22?Ze=tt(ze,Ze,ot[Rt+1]>>1)-1:(tt(ze,Ze,3),Ze+=5,tt(ze,Ze,ot[Rt-23]>>5),Ze+=3);var ct=Rt<8?0:Rt-4>>2;ct>0&&(Wt(ze,Ze,nr-pe[Rt]),Ze+=ct),Rt=Z[et-Ut],Ze=tt(ze,Ze,ot[Rt]>>3),Ze-=3;var ga=Rt<4?0:Rt-2>>1;ga>0&&(Wt(ze,Ze,et-Ut-Je[Rt]),Ze+=ga);for(var kr=0;kr<nr;++kr)_t[Ot]=et&32767,Ot=(Ot<<5^Be[et])&32767,++et;vt-=nr-1}else Rt<=143?Rt=Rt+48:Ze=ut(ze,Ze,1),Ze=tt(ze,Ze,ot[Rt]),_t[Ot]=et&32767,++et}Ze=tt(ze,Ze,0)-1}return ze.l=(Ze+7)/8|0,ze.l}return function(ze,Ze){return ze.length<8?Ee(ze,Ze):ge(ze,Ze)}})();function It(ie){var Z=xt(50+Math.floor(ie.length*1.1)),ce=He(ie,Z);return Z.slice(0,ce)}var Zt=ft?new Uint16Array(32768):We(32768),yr=ft?new Uint16Array(32768):We(32768),Ye=ft?new Uint16Array(128):We(128),Ge=1,Ct=1;function Ft(ie,Z){var ce=Kt(ie,Z)+257;Z+=5;var xe=Kt(ie,Z)+1;Z+=5;var ye=tr(ie,Z)+4;Z+=4;for(var Ee=0,ge=ft?new Uint8Array(19):We(19),Be=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ze=1,Ze=ft?new Uint8Array(8):We(8),et=ft?new Uint8Array(8):We(8),_t=ge.length,vt=0;vt<ye;++vt)ge[he[vt]]=Ee=ht(ie,Z),ze<Ee&&(ze=Ee),Ze[Ee]++,Z+=3;var Ot=0;for(Ze[0]=0,vt=1;vt<=ze;++vt)et[vt]=Ot=Ot+Ze[vt-1]<<1;for(vt=0;vt<_t;++vt)(Ot=ge[vt])!=0&&(Be[vt]=et[Ot]++);var Rt=0;for(vt=0;vt<_t;++vt)if(Rt=ge[vt],Rt!=0){Ot=ot[Be[vt]]>>8-Rt;for(var Ut=(1<<7-Rt)-1;Ut>=0;--Ut)Ye[Ot|Ut<<Rt]=Rt&7|vt<<3}var nr=[];for(ze=1;nr.length<ce+xe;)switch(Ot=Ye[gt(ie,Z)],Z+=Ot&7,Ot>>>=3){case 16:for(Ee=3+Ht(ie,Z),Z+=2,Ot=nr[nr.length-1];Ee-- >0;)nr.push(Ot);break;case 17:for(Ee=3+ht(ie,Z),Z+=3;Ee-- >0;)nr.push(0);break;case 18:for(Ee=11+gt(ie,Z),Z+=7;Ee-- >0;)nr.push(0);break;default:nr.push(Ot),ze<Ot&&(ze=Ot);break}var ct=nr.slice(0,ce),ga=nr.slice(ce);for(vt=ce;vt<286;++vt)ct[vt]=0;for(vt=xe;vt<30;++vt)ga[vt]=0;return Ge=Nt(ct,Zt,286),Ct=Nt(ga,yr,30),Z}function Jt(ie,Z){if(ie[0]==3&&!(ie[1]&3))return[mc(Z),2];for(var ce=0,xe=0,ye=Cb(Z||1<<18),Ee=0,ge=ye.length>>>0,Be=0,ze=0;(xe&1)==0;){if(xe=ht(ie,ce),ce+=3,xe>>>1)xe>>1==1?(Be=9,ze=5):(ce=Ft(ie,ce),Be=Ge,ze=Ct);else{ce&7&&(ce+=8-(ce&7));var Ze=ie[ce>>>3]|ie[(ce>>>3)+1]<<8;if(ce+=32,Ze>0)for(!Z&&ge<Ee+Ze&&(ye=pt(ye,Ee+Ze),ge=ye.length);Ze-- >0;)ye[Ee++]=ie[ce>>>3],ce+=8;continue}for(;;){!Z&&ge<Ee+32767&&(ye=pt(ye,Ee+32767),ge=ye.length);var et=ve(ie,ce,Be),_t=xe>>>1==1?At[et]:Zt[et];if(ce+=_t&15,_t>>>=4,(_t>>>8&255)===0)ye[Ee++]=_t;else{if(_t==256)break;_t-=257;var vt=_t<8?0:_t-4>>2;vt>5&&(vt=0);var Ot=Ee+pe[_t];vt>0&&(Ot+=ve(ie,ce,vt),ce+=vt),et=ve(ie,ce,ze),_t=xe>>>1==1?Qt[et]:yr[et],ce+=_t&15,_t>>>=4;var Rt=_t<4?0:_t-2>>1,Ut=Je[_t];for(Rt>0&&(Ut+=ve(ie,ce,Rt),ce+=Rt),!Z&&ge<Ot&&(ye=pt(ye,Ot+100),ge=ye.length);Ee<Ot;)ye[Ee]=ye[Ee-Ut],++Ee}}}return Z?[ye,ce+7>>>3]:[ye.slice(0,Ee),ce+7>>>3]}function Dr(ie,Z){var ce=ie.slice(ie.l||0),xe=Jt(ce,Z);return ie.l+=xe[1],xe[0]}function kt(ie,Z){if(ie)typeof console!="undefined"&&console.error(Z);else throw new Error(Z)}function Re(ie,Z){var ce=ie;li(ce,0);var xe=[],ye=[],Ee={FileIndex:xe,FullPaths:ye};V(Ee,{root:Z.root});for(var ge=ce.length-4;(ce[ge]!=80||ce[ge+1]!=75||ce[ge+2]!=5||ce[ge+3]!=6)&&ge>=0;)--ge;ce.l=ge+4,ce.l+=4;var Be=ce.read_shift(2);ce.l+=6;var ze=ce.read_shift(4);for(ce.l=ze,ge=0;ge<Be;++ge){ce.l+=20;var Ze=ce.read_shift(4),et=ce.read_shift(4),_t=ce.read_shift(2),vt=ce.read_shift(2),Ot=ce.read_shift(2);ce.l+=8;var Rt=ce.read_shift(4),Ut=g(ce.slice(ce.l+_t,ce.l+_t+vt));ce.l+=_t+vt+Ot;var nr=ce.l;ce.l=Rt+4,qe(ce,Ze,et,Ee,Ut),ce.l=nr}return Ee}function qe(ie,Z,ce,xe,ye){ie.l+=2;var Ee=ie.read_shift(2),ge=ie.read_shift(2),Be=f(ie);if(Ee&8257)throw new Error("Unsupported ZIP encryption");for(var ze=ie.read_shift(4),Ze=ie.read_shift(4),et=ie.read_shift(4),_t=ie.read_shift(2),vt=ie.read_shift(2),Ot="",Rt=0;Rt<_t;++Rt)Ot+=String.fromCharCode(ie[ie.l++]);if(vt){var Ut=g(ie.slice(ie.l,ie.l+vt));(Ut[21589]||{}).mt&&(Be=Ut[21589].mt),((ye||{})[21589]||{}).mt&&(Be=ye[21589].mt)}ie.l+=vt;var nr=ie.slice(ie.l,ie.l+Ze);switch(ge){case 8:nr=ae(ie,et);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+ge)}var ct=!1;Ee&8&&(ze=ie.read_shift(4),ze==134695760&&(ze=ie.read_shift(4),ct=!0),Ze=ie.read_shift(4),et=ie.read_shift(4)),Ze!=Z&&kt(ct,"Bad compressed size: "+Z+" != "+Ze),et!=ce&&kt(ct,"Bad uncompressed size: "+ce+" != "+et),Ha(xe,Ot,nr,{unsafe:!0,mt:Be})}function Tt(ie,Z){var ce=Z||{},xe=[],ye=[],Ee=xt(1),ge=ce.compression?8:0,Be=0,ze=0,Ze=0,et=0,_t=0,vt=ie.FullPaths[0],Ot=vt,Rt=ie.FileIndex[0],Ut=[],nr=0;for(ze=1;ze<ie.FullPaths.length;++ze)if(Ot=ie.FullPaths[ze].slice(vt.length),Rt=ie.FileIndex[ze],!(!Rt.size||!Rt.content||Ot=="Sh33tJ5")){var ct=et,ga=xt(Ot.length);for(Ze=0;Ze<Ot.length;++Ze)ga.write_shift(1,Ot.charCodeAt(Ze)&127);ga=ga.slice(0,ga.l),Ut[_t]=IE.buf(Rt.content,0);var kr=Rt.content;ge==8&&(kr=se(kr)),Ee=xt(30),Ee.write_shift(4,67324752),Ee.write_shift(2,20),Ee.write_shift(2,Be),Ee.write_shift(2,ge),Rt.mt?u(Ee,Rt.mt):Ee.write_shift(4,0),Ee.write_shift(-4,Ut[_t]),Ee.write_shift(4,kr.length),Ee.write_shift(4,Rt.content.length),Ee.write_shift(2,ga.length),Ee.write_shift(2,0),et+=Ee.length,xe.push(Ee),et+=ga.length,xe.push(ga),et+=kr.length,xe.push(kr),Ee=xt(46),Ee.write_shift(4,33639248),Ee.write_shift(2,0),Ee.write_shift(2,20),Ee.write_shift(2,Be),Ee.write_shift(2,ge),Ee.write_shift(4,0),Ee.write_shift(-4,Ut[_t]),Ee.write_shift(4,kr.length),Ee.write_shift(4,Rt.content.length),Ee.write_shift(2,ga.length),Ee.write_shift(2,0),Ee.write_shift(2,0),Ee.write_shift(2,0),Ee.write_shift(2,0),Ee.write_shift(4,0),Ee.write_shift(4,ct),nr+=Ee.l,ye.push(Ee),nr+=ga.length,ye.push(ga),++_t}return Ee=xt(22),Ee.write_shift(4,101010256),Ee.write_shift(2,0),Ee.write_shift(2,0),Ee.write_shift(2,_t),Ee.write_shift(2,_t),Ee.write_shift(4,nr),Ee.write_shift(4,et),Ee.write_shift(2,0),Qn([Qn(xe),Qn(ye),Ee])}var xr={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 Hr(ie,Z){if(ie.ctype)return ie.ctype;var ce=ie.name||"",xe=ce.match(/\.([^\.]+)$/);return xe&&xr[xe[1]]||Z&&(xe=(ce=Z).match(/[\.\\]([^\.\\])+$/),xe&&xr[xe[1]])?xr[xe[1]]:"application/octet-stream"}function Ir(ie){for(var Z=Y0(ie),ce=[],xe=0;xe<Z.length;xe+=76)ce.push(Z.slice(xe,xe+76));return ce.join(`\r
`)+`\r
`}function Pa(ie){var Z=ie.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(Ze){var et=Ze.charCodeAt(0).toString(16).toUpperCase();return"="+(et.length==1?"0"+et:et)});Z=Z.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),Z.charAt(0)==`
`&&(Z="=0D"+Z.slice(1)),Z=Z.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var ce=[],xe=Z.split(`\r
`),ye=0;ye<xe.length;++ye){var Ee=xe[ye];if(Ee.length==0){ce.push("");continue}for(var ge=0;ge<Ee.length;){var Be=76,ze=Ee.slice(ge,ge+Be);ze.charAt(Be-1)=="="?Be--:ze.charAt(Be-2)=="="?Be-=2:ze.charAt(Be-3)=="="&&(Be-=3),ze=Ee.slice(ge,ge+Be),ge+=Be,ge<Ee.length&&(ze+="="),ce.push(ze)}}return ce.join(`\r
`)}function ca(ie){for(var Z=[],ce=0;ce<ie.length;++ce){for(var xe=ie[ce];ce<=ie.length&&xe.charAt(xe.length-1)=="=";)xe=xe.slice(0,xe.length-1)+ie[++ce];Z.push(xe)}for(var ye=0;ye<Z.length;++ye)Z[ye]=Z[ye].replace(/[=][0-9A-Fa-f]{2}/g,function(Ee){return String.fromCharCode(parseInt(Ee.slice(1),16))});return Gi(Z.join(`\r
`))}function _n(ie,Z,ce){for(var xe="",ye="",Ee="",ge,Be=0;Be<10;++Be){var ze=Z[Be];if(!ze||ze.match(/^\s*$/))break;var Ze=ze.match(/^(.*?):\s*([^\s].*)$/);if(Ze)switch(Ze[1].toLowerCase()){case"content-location":xe=Ze[2].trim();break;case"content-type":Ee=Ze[2].trim();break;case"content-transfer-encoding":ye=Ze[2].trim();break}}switch(++Be,ye.toLowerCase()){case"base64":ge=Gi($o(Z.slice(Be).join("")));break;case"quoted-printable":ge=ca(Z.slice(Be));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+ye)}var et=Ha(ie,xe.slice(ce.length),ge,{unsafe:!0});Ee&&(et.ctype=Ee)}function fn(ie,Z){if(Ae(ie.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var ce=Z&&Z.root||"",xe=(ha&&Buffer.isBuffer(ie)?ie.toString("binary"):Ae(ie)).split(`\r
`),ye=0,Ee="";for(ye=0;ye<xe.length;++ye)if(Ee=xe[ye],!!/^Content-Location:/i.test(Ee)&&(Ee=Ee.slice(Ee.indexOf("file")),ce||(ce=Ee.slice(0,Ee.lastIndexOf("/")+1)),Ee.slice(0,ce.length)!=ce))for(;ce.length>0&&(ce=ce.slice(0,ce.length-1),ce=ce.slice(0,ce.lastIndexOf("/")+1),Ee.slice(0,ce.length)!=ce););var ge=(xe[1]||"").match(/boundary="(.*?)"/);if(!ge)throw new Error("MAD cannot find boundary");var Be="--"+(ge[1]||""),ze=[],Ze=[],et={FileIndex:ze,FullPaths:Ze};V(et);var _t,vt=0;for(ye=0;ye<xe.length;++ye){var Ot=xe[ye];Ot!==Be&&Ot!==Be+"--"||(vt++&&_n(et,xe.slice(_t,ye),ce),_t=ye)}return et}function hn(ie,Z){var ce=Z||{},xe=ce.boundary||"SheetJS";xe="------="+xe;for(var ye=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+xe.slice(2)+'"',"","",""],Ee=ie.FullPaths[0],ge=Ee,Be=ie.FileIndex[0],ze=1;ze<ie.FullPaths.length;++ze)if(ge=ie.FullPaths[ze].slice(Ee.length),Be=ie.FileIndex[ze],!(!Be.size||!Be.content||ge=="Sh33tJ5")){ge=ge.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(nr){return"_x"+nr.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(nr){return"_u"+nr.charCodeAt(0).toString(16)+"_"});for(var Ze=Be.content,et=ha&&Buffer.isBuffer(Ze)?Ze.toString("binary"):Ae(Ze),_t=0,vt=Math.min(1024,et.length),Ot=0,Rt=0;Rt<=vt;++Rt)(Ot=et.charCodeAt(Rt))>=32&&Ot<128&&++_t;var Ut=_t>=vt*4/5;ye.push(xe),ye.push("Content-Location: "+(ce.root||"file:///C:/SheetJS/")+ge),ye.push("Content-Transfer-Encoding: "+(Ut?"quoted-printable":"base64")),ye.push("Content-Type: "+Hr(Be,ge)),ye.push(""),ye.push(Ut?Pa(et):Ir(et))}return ye.push(xe+`--\r
`),ye.join(`\r
`)}function Xs(ie){var Z={};return V(Z,ie),Z}function Ha(ie,Z,ce,xe){var ye=xe&&xe.unsafe;ye||V(ie);var Ee=!ye&&Aa.find(ie,Z);if(!Ee){var ge=ie.FullPaths[0];Z.slice(0,ge.length)==ge?ge=Z:(ge.slice(-1)!="/"&&(ge+="/"),ge=(ge+Z).replace("//","/")),Ee={name:o(Z),type:2},ie.FileIndex.push(Ee),ie.FullPaths.push(ge),ye||Aa.utils.cfb_gc(ie)}return Ee.content=ce,Ee.size=ce?ce.length:0,xe&&(xe.CLSID&&(Ee.clsid=xe.CLSID),xe.mt&&(Ee.mt=xe.mt),xe.ct&&(Ee.ct=xe.ct)),Ee}function gs(ie,Z){V(ie);var ce=Aa.find(ie,Z);if(ce){for(var xe=0;xe<ie.FileIndex.length;++xe)if(ie.FileIndex[xe]==ce)return ie.FileIndex.splice(xe,1),ie.FullPaths.splice(xe,1),!0}return!1}function $r(ie,Z,ce){V(ie);var xe=Aa.find(ie,Z);if(xe){for(var ye=0;ye<ie.FileIndex.length;++ye)if(ie.FileIndex[ye]==xe)return ie.FileIndex[ye].name=o(ce),ie.FullPaths[ye]=ce,!0}return!1}function rr(ie){Q(ie,!0)}return r.find=je,r.read=ne,r.parse=k,r.write=_e,r.writeFile=de,r.utils={cfb_new:Xs,cfb_add:Ha,cfb_del:gs,cfb_mov:$r,cfb_gc:rr,ReadShift:B0,CheckField:pw,prep_blob:li,bconcat:Qn,use_zlib:W,_deflateRaw:It,_inflateRaw:Dr,consts:re},r})();function LE(e){return typeof e=="string"?Sh(e):Array.isArray(e)?lE(e):e}function du(e,r,t){if(typeof Deno!="undefined"){if(t&&typeof r=="string")switch(t){case"utf8":r=new TextEncoder(t).encode(r);break;case"binary":r=Sh(r);break;default:throw new Error("Unsupported encoding "+t)}return Deno.writeFileSync(e,r)}var n=t=="utf8"?$0(r):r;if(typeof IE_SaveFile!="undefined")return IE_SaveFile(n,e);if(typeof Blob!="undefined"){var o=new Blob([LE(n)],{type:"application/octet-stream"});if(typeof navigator!="undefined"&&navigator.msSaveBlob)return navigator.msSaveBlob(o,e);if(typeof saveAs!="undefined")return saveAs(o,e);if(typeof URL!="undefined"&&typeof document!="undefined"&&document.createElement&&URL.createObjectURL){var u=URL.createObjectURL(o);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(u)},6e4),chrome.downloads.download({url:u,filename:e,saveAs:!0});var f=document.createElement("a");if(f.download!=null)return f.download=e,f.href=u,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(u)},6e4),u}}if(typeof $!="undefined"&&typeof File!="undefined"&&typeof Folder!="undefined")try{var g=File(e);return g.open("w"),g.encoding="binary",Array.isArray(r)&&(r=cu(r)),g.write(r),g.close(),r}catch(v){if(!v.message||!v.message.match(/onstruct/))throw v}throw new Error("cannot save file "+e)}function as(e){for(var r=Object.keys(e),t=[],n=0;n<r.length;++n)Object.prototype.hasOwnProperty.call(e,r[n])&&t.push(r[n]);return t}function Ib(e,r){for(var t=[],n=as(e),o=0;o!==n.length;++o)t[e[n[o]][r]]==null&&(t[e[n[o]][r]]=n[o]);return t}function Gx(e){for(var r=[],t=as(e),n=0;n!==t.length;++n)r[e[t[n]]]=t[n];return r}function Th(e){for(var r=[],t=as(e),n=0;n!==t.length;++n)r[e[t[n]]]=parseInt(t[n],10);return r}function PE(e){for(var r=[],t=as(e),n=0;n!==t.length;++n)r[e[t[n]]]==null&&(r[e[t[n]]]=[]),r[e[t[n]]].push(t[n]);return r}var Qf=new Date(1899,11,30,0,0,0);function Vs(e,r){var t=e.getTime(),n=Qf.getTime()+(e.getTimezoneOffset()-Qf.getTimezoneOffset())*6e4;return(t-n)/(1440*60*1e3)}var ew=new Date,FE=Qf.getTime()+(ew.getTimezoneOffset()-Qf.getTimezoneOffset())*6e4,Lb=ew.getTimezoneOffset();function tw(e){var r=new Date;return r.setTime(e*24*60*60*1e3+FE),r.getTimezoneOffset()!==Lb&&r.setTime(r.getTime()+(r.getTimezoneOffset()-Lb)*6e4),r}var Pb=new Date("2017-02-19T19:06:09.000Z"),rw=isNaN(Pb.getFullYear())?new Date("2/19/17"):Pb,BE=rw.getFullYear()==2017;function Es(e,r){var t=new Date(e);if(BE)return r>0?t.setTime(t.getTime()+t.getTimezoneOffset()*60*1e3):r<0&&t.setTime(t.getTime()-t.getTimezoneOffset()*60*1e3),t;if(e instanceof Date)return e;if(rw.getFullYear()==1917&&!isNaN(t.getFullYear())){var n=t.getFullYear();return e.indexOf(""+n)>-1||t.setFullYear(t.getFullYear()+100),t}var o=e.match(/\d+/g)||["2017","2","19","0","0","0"],u=new Date(+o[0],+o[1]-1,+o[2],+o[3]||0,+o[4]||0,+o[5]||0);return e.indexOf("Z")>-1&&(u=new Date(u.getTime()-u.getTimezoneOffset()*60*1e3)),u}function Ah(e,r){if(ha&&Buffer.isBuffer(e))return e.toString("binary");if(typeof TextDecoder!="undefined")try{var t={"€":"€","":"‚",ƒ:"ƒ","„":"„","…":"…","†":"†","‡":"‡","ˆ":"ˆ","‰":"‰",Š:"Š","":"‹",Œ:"Œ",Ž:"Ž","":"‘","":"’","“":"“","”":"”","•":"•","":"–","—":"—","˜":"˜","™":"™",š:"š","":"›",œ:"œ",ž:"ž",Ÿ:"Ÿ"};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(u){return t[u]||u})}catch(u){}for(var n=[],o=0;o!=e.length;++o)n.push(String.fromCharCode(e[o]));return n.join("")}function Gs(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 r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=Gs(e[t]));return r}function tn(e,r){for(var t="";t.length<r;)t+=e;return t}function Vo(e){var r=Number(e);if(!isNaN(r))return isFinite(r)?r:NaN;if(!/\d/.test(e))return r;var t=1,n=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return t*=100,""});return!isNaN(r=Number(n))||(n=n.replace(/[(](.*)[)]/,function(o,u){return t=-t,u}),!isNaN(r=Number(n)))?r/t:r}var UE=["january","february","march","april","may","june","july","august","september","october","november","december"];function Z0(e){var r=new Date(e),t=new Date(NaN),n=r.getYear(),o=r.getMonth(),u=r.getDate();if(isNaN(u))return t;var f=e.toLowerCase();if(f.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(f=f.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),f.length>3&&UE.indexOf(f)==-1)return t}else if(f.match(/[a-z]/))return t;return n<0||n>8099?t:(o>0||u>1)&&n!=101?r:e.match(/[^-0-9:,\/\\]/)?t:r}function Fr(e,r,t){if(e.FullPaths){if(typeof t=="string"){var n;return ha?n=Jo(t):n=cE(t),Aa.utils.cfb_add(e,r,n)}Aa.utils.cfb_add(e,r,t)}else e.file(r,t)}function Xx(){return Aa.utils.cfb_new()}var vn=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,zE={"&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<","&amp;":"&"},Yx=Gx(zE),Zx=/[&<>'"]/g,HE=/[\u0000-\u0008\u000b-\u001f]/g;function wa(e){var r=e+"";return r.replace(Zx,function(t){return Yx[t]}).replace(HE,function(t){return"_x"+("000"+t.charCodeAt(0).toString(16)).slice(-4)+"_"})}function Fb(e){return wa(e).replace(/ /g,"_x0020_")}var aw=/[\u0000-\u001f]/g;function WE(e){var r=e+"";return r.replace(Zx,function(t){return Yx[t]}).replace(/\n/g,"<br/>").replace(aw,function(t){return"&#x"+("000"+t.charCodeAt(0).toString(16)).slice(-4)+";"})}function VE(e){var r=e+"";return r.replace(Zx,function(t){return Yx[t]}).replace(aw,function(t){return"&#x"+t.charCodeAt(0).toString(16).toUpperCase()+";"})}function GE(e){return e.replace(/(\r\n|[\r\n])/g,"&#10;")}function XE(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function Hg(e){for(var r="",t=0,n=0,o=0,u=0,f=0,g=0;t<e.length;){if(n=e.charCodeAt(t++),n<128){r+=String.fromCharCode(n);continue}if(o=e.charCodeAt(t++),n>191&&n<224){f=(n&31)<<6,f|=o&63,r+=String.fromCharCode(f);continue}if(u=e.charCodeAt(t++),n<240){r+=String.fromCharCode((n&15)<<12|(o&63)<<6|u&63);continue}f=e.charCodeAt(t++),g=((n&7)<<18|(o&63)<<12|(u&63)<<6|f&63)-65536,r+=String.fromCharCode(55296+(g>>>10&1023)),r+=String.fromCharCode(56320+(g&1023))}return r}function Bb(e){var r=mc(2*e.length),t,n,o=1,u=0,f=0,g;for(n=0;n<e.length;n+=o)o=1,(g=e.charCodeAt(n))<128?t=g:g<224?(t=(g&31)*64+(e.charCodeAt(n+1)&63),o=2):g<240?(t=(g&15)*4096+(e.charCodeAt(n+1)&63)*64+(e.charCodeAt(n+2)&63),o=3):(o=4,t=(g&7)*262144+(e.charCodeAt(n+1)&63)*4096+(e.charCodeAt(n+2)&63)*64+(e.charCodeAt(n+3)&63),t-=65536,f=55296+(t>>>10&1023),t=56320+(t&1023)),f!==0&&(r[u++]=f&255,r[u++]=f>>>8,f=0),r[u++]=t%256,r[u++]=t>>>8;return r.slice(0,u).toString("ucs2")}function Ub(e){return Jo(e,"binary").toString("utf8")}var Cf="foo bar baz☃🍣",F0=ha&&(Ub(Cf)==Hg(Cf)&&Ub||Bb(Cf)==Hg(Cf)&&Bb)||Hg,$0=ha?function(e){return Jo(e,"utf8").toString("binary")}:function(e){for(var r=[],t=0,n=0,o=0;t<e.length;)switch(n=e.charCodeAt(t++),!0){case n<128:r.push(String.fromCharCode(n));break;case n<2048:r.push(String.fromCharCode(192+(n>>6))),r.push(String.fromCharCode(128+(n&63)));break;case(n>=55296&&n<57344):n-=55296,o=e.charCodeAt(t++)-56320+(n<<10),r.push(String.fromCharCode(240+(o>>18&7))),r.push(String.fromCharCode(144+(o>>12&63))),r.push(String.fromCharCode(128+(o>>6&63))),r.push(String.fromCharCode(128+(o&63)));break;default:r.push(String.fromCharCode(224+(n>>12))),r.push(String.fromCharCode(128+(n>>6&63))),r.push(String.fromCharCode(128+(n&63)))}return r.join("")},YE=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(r){return[new RegExp("&"+r[0]+";","ig"),r[1]]});return function(t){for(var n=t.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,""),o=0;o<e.length;++o)n=n.replace(e[o][0],e[o][1]);return n}})(),nw=/(^\s|\s$|\n)/;function es(e,r){return"<"+e+(r.match(nw)?' xml:space="preserve"':"")+">"+r+"</"+e+">"}function q0(e){return as(e).map(function(r){return" "+r+'="'+e[r]+'"'}).join("")}function Vt(e,r,t){return"<"+e+(t!=null?q0(t):"")+(r!=null?(r.match(nw)?' xml:space="preserve"':"")+">"+r+"</"+e:"/")+">"}function px(e,r){try{return e.toISOString().replace(/\.\d*/,"")}catch(t){if(r)throw t}return""}function ZE(e,r){switch(typeof e){case"string":var t=Vt("vt:lpwstr",wa(e));return t=t.replace(/&quot;/g,"_x0022_"),t;case"number":return Vt((e|0)==e?"vt:i4":"vt:r8",wa(String(e)));case"boolean":return Vt("vt:bool",e?"true":"false")}if(e instanceof Date)return Vt("vt:filetime",px(e));throw new Error("Unable to serialize "+e)}var Ln={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"},Dd=["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"],ci={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 $E(e,r){for(var t=1-2*(e[r+7]>>>7),n=((e[r+7]&127)<<4)+(e[r+6]>>>4&15),o=e[r+6]&15,u=5;u>=0;--u)o=o*256+e[r+u];return n==2047?o==0?t*(1/0):NaN:(n==0?n=-1022:(n-=1023,o+=Math.pow(2,52)),t*Math.pow(2,n-52)*o)}function qE(e,r,t){var n=(r<0||1/r==-1/0?1:0)<<7,o=0,u=0,f=n?-r:r;isFinite(f)?f==0?o=u=0:(o=Math.floor(Math.log(f)/Math.LN2),u=f*Math.pow(2,52-o),o<=-1023&&(!isFinite(u)||u<Math.pow(2,52))?o=-1022:(u-=Math.pow(2,52),o+=1023)):(o=2047,u=isNaN(r)?26985:0);for(var g=0;g<=5;++g,u/=256)e[t+g]=u&255;e[t+6]=(o&15)<<4|u&15,e[t+7]=o>>4|n}var zb=function(e){for(var r=[],t=10240,n=0;n<e[0].length;++n)if(e[0][n])for(var o=0,u=e[0][n].length;o<u;o+=t)r.push.apply(r,e[0][n].slice(o,o+t));return r},Hb=ha?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(r){return Buffer.isBuffer(r)?r:Jo(r)})):zb(e)}:zb,Wb=function(e,r,t){for(var n=[],o=r;o<t;o+=2)n.push(String.fromCharCode(j0(e,o)));return n.join("").replace(P0,"")},$x=ha?function(e,r,t){return Buffer.isBuffer(e)?e.toString("utf16le",r,t).replace(P0,""):Wb(e,r,t)}:Wb,Vb=function(e,r,t){for(var n=[],o=r;o<r+t;++o)n.push(("0"+e[o].toString(16)).slice(-2));return n.join("")},sw=ha?function(e,r,t){return Buffer.isBuffer(e)?e.toString("hex",r,r+t):Vb(e,r,t)}:Vb,Gb=function(e,r,t){for(var n=[],o=r;o<t;o++)n.push(String.fromCharCode(dd(e,o)));return n.join("")},uu=ha?function(r,t,n){return Buffer.isBuffer(r)?r.toString("utf8",t,n):Gb(r,t,n)}:Gb,iw=function(e,r){var t=di(e,r);return t>0?uu(e,r+4,r+4+t-1):""},ow=iw,lw=function(e,r){var t=di(e,r);return t>0?uu(e,r+4,r+4+t-1):""},cw=lw,dw=function(e,r){var t=2*di(e,r);return t>0?uu(e,r+4,r+4+t-1):""},uw=dw,fw=function(r,t){var n=di(r,t);return n>0?$x(r,t+4,t+4+n):""},hw=fw,mw=function(e,r){var t=di(e,r);return t>0?uu(e,r+4,r+4+t):""},gw=mw,xw=function(e,r){return $E(e,r)},eh=xw,qx=function(r){return Array.isArray(r)||typeof Uint8Array!="undefined"&&r instanceof Uint8Array};ha&&(ow=function(r,t){if(!Buffer.isBuffer(r))return iw(r,t);var n=r.readUInt32LE(t);return n>0?r.toString("utf8",t+4,t+4+n-1):""},cw=function(r,t){if(!Buffer.isBuffer(r))return lw(r,t);var n=r.readUInt32LE(t);return n>0?r.toString("utf8",t+4,t+4+n-1):""},uw=function(r,t){if(!Buffer.isBuffer(r))return dw(r,t);var n=2*r.readUInt32LE(t);return r.toString("utf16le",t+4,t+4+n-1)},hw=function(r,t){if(!Buffer.isBuffer(r))return fw(r,t);var n=r.readUInt32LE(t);return r.toString("utf16le",t+4,t+4+n)},gw=function(r,t){if(!Buffer.isBuffer(r))return mw(r,t);var n=r.readUInt32LE(t);return r.toString("utf8",t+4,t+4+n)},eh=function(r,t){return Buffer.isBuffer(r)?r.readDoubleLE(t):xw(r,t)},qx=function(r){return Buffer.isBuffer(r)||Array.isArray(r)||typeof Uint8Array!="undefined"&&r instanceof Uint8Array});var dd=function(e,r){return e[r]},j0=function(e,r){return e[r+1]*256+e[r]},KE=function(e,r){var t=e[r+1]*256+e[r];return t<32768?t:(65535-t+1)*-1},di=function(e,r){return e[r+3]*(1<<24)+(e[r+2]<<16)+(e[r+1]<<8)+e[r]},sc=function(e,r){return e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]},JE=function(e,r){return e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]};function B0(e,r){var t="",n,o,u=[],f,g,v,p;switch(r){case"dbcs":if(p=this.l,ha&&Buffer.isBuffer(this))t=this.slice(this.l,this.l+2*e).toString("utf16le");else for(v=0;v<e;++v)t+=String.fromCharCode(j0(this,p)),p+=2;e*=2;break;case"utf8":t=uu(this,this.l,this.l+e);break;case"utf16le":e*=2,t=$x(this,this.l,this.l+e);break;case"wstr":return B0.call(this,e,"dbcs");case"lpstr-ansi":t=ow(this,this.l),e=4+di(this,this.l);break;case"lpstr-cp":t=cw(this,this.l),e=4+di(this,this.l);break;case"lpwstr":t=uw(this,this.l),e=4+2*di(this,this.l);break;case"lpp4":e=4+di(this,this.l),t=hw(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+di(this,this.l),t=gw(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,t="";(f=dd(this,this.l+e++))!==0;)u.push(Nf(f));t=u.join("");break;case"_wstr":for(e=0,t="";(f=j0(this,this.l+e))!==0;)u.push(Nf(f)),e+=2;e+=2,t=u.join("");break;case"dbcs-cont":for(t="",p=this.l,v=0;v<e;++v){if(this.lens&&this.lens.indexOf(p)!==-1)return f=dd(this,p),this.l=p+1,g=B0.call(this,e-v,f?"dbcs-cont":"sbcs-cont"),u.join("")+g;u.push(Nf(j0(this,p))),p+=2}t=u.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(t="",p=this.l,v=0;v!=e;++v){if(this.lens&&this.lens.indexOf(p)!==-1)return f=dd(this,p),this.l=p+1,g=B0.call(this,e-v,f?"dbcs-cont":"sbcs-cont"),u.join("")+g;u.push(Nf(dd(this,p))),p+=1}t=u.join("");break;default:switch(e){case 1:return n=dd(this,this.l),this.l++,n;case 2:return n=(r==="i"?KE:j0)(this,this.l),this.l+=2,n;case 4:case-4:return r==="i"||(this[this.l+3]&128)===0?(n=(e>0?sc:JE)(this,this.l),this.l+=4,n):(o=di(this,this.l),this.l+=4,o);case 8:case-8:if(r==="f")return e==8?o=eh(this,this.l):o=eh([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,o;e=8;case 16:t=sw(this,this.l,e);break}}return this.l+=e,t}var QE=function(e,r,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24&255},eC=function(e,r,t){e[t]=r&255,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255},tC=function(e,r,t){e[t]=r&255,e[t+1]=r>>>8&255};function rC(e,r,t){var n=0,o=0;if(t==="dbcs"){for(o=0;o!=r.length;++o)tC(this,r.charCodeAt(o),this.l+2*o);n=2*r.length}else if(t==="sbcs"){for(r=r.replace(/[^\x00-\x7F]/g,"_"),o=0;o!=r.length;++o)this[this.l+o]=r.charCodeAt(o)&255;n=r.length}else if(t==="hex"){for(;o<e;++o)this[this.l++]=parseInt(r.slice(2*o,2*o+2),16)||0;return this}else if(t==="utf16le"){var u=Math.min(this.l+e,this.length);for(o=0;o<Math.min(r.length,e);++o){var f=r.charCodeAt(o);this[this.l++]=f&255,this[this.l++]=f>>8}for(;this.l<u;)this[this.l++]=0;return this}else switch(e){case 1:n=1,this[this.l]=r&255;break;case 2:n=2,this[this.l]=r&255,r>>>=8,this[this.l+1]=r&255;break;case 3:n=3,this[this.l]=r&255,r>>>=8,this[this.l+1]=r&255,r>>>=8,this[this.l+2]=r&255;break;case 4:n=4,QE(this,r,this.l);break;case 8:if(n=8,t==="f"){qE(this,r,this.l);break}case 16:break;case-4:n=4,eC(this,r,this.l);break}return this.l+=n,this}function pw(e,r){var t=sw(this,this.l,e.length>>1);if(t!==e)throw new Error(r+"Expected "+e+" saw "+t);this.l+=e.length>>1}function li(e,r){e.l=r,e.read_shift=B0,e.chk=pw,e.write_shift=rC}function po(e,r){e.l+=r}function xt(e){var r=mc(e);return li(r,0),r}function Ws(){var e=[],r=ha?256:2048,t=function(p){var k=xt(p);return li(k,0),k},n=t(r),o=function(){n&&(n.length>n.l&&(n=n.slice(0,n.l),n.l=n.length),n.length>0&&e.push(n),n=null)},u=function(p){return n&&p<n.length-n.l?n:(o(),n=t(Math.max(p+1,r)))},f=function(){return o(),Qn(e)},g=function(p){o(),n=p,n.l==null&&(n.l=n.length),u(r)};return{next:u,push:g,end:f,_bufs:e}}function Dt(e,r,t,n){var o=+r,u;if(!isNaN(o)){n||(n=$9[o].p||(t||[]).length||0),u=1+(o>=128?1:0)+1,n>=128&&++u,n>=16384&&++u,n>=2097152&&++u;var f=e.next(u);o<=127?f.write_shift(1,o):(f.write_shift(1,(o&127)+128),f.write_shift(1,o>>7));for(var g=0;g!=4;++g)if(n>=128)f.write_shift(1,(n&127)+128),n>>=7;else{f.write_shift(1,n);break}n>0&&qx(t)&&e.push(t)}}function U0(e,r,t){var n=Gs(e);if(r.s?(n.cRel&&(n.c+=r.s.c),n.rRel&&(n.r+=r.s.r)):(n.cRel&&(n.c+=r.c),n.rRel&&(n.r+=r.r)),!t||t.biff<12){for(;n.c>=256;)n.c-=256;for(;n.r>=65536;)n.r-=65536}return n}function Xb(e,r,t){var n=Gs(e);return n.s=U0(n.s,r.s,t),n.e=U0(n.e,r.s,t),n}function z0(e,r){if(e.cRel&&e.c<0)for(e=Gs(e);e.c<0;)e.c+=r>8?16384:256;if(e.rRel&&e.r<0)for(e=Gs(e);e.r<0;)e.r+=r>8?1048576:r>5?65536:16384;var t=ka(e);return!e.cRel&&e.cRel!=null&&(t=sC(t)),!e.rRel&&e.rRel!=null&&(t=aC(t)),t}function Wg(e,r){return e.s.r==0&&!e.s.rRel&&e.e.r==(r.biff>=12?1048575:r.biff>=8?65536:16384)&&!e.e.rRel?(e.s.cRel?"":"$")+hs(e.s.c)+":"+(e.e.cRel?"":"$")+hs(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(r.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+ts(e.s.r)+":"+(e.e.rRel?"":"$")+ts(e.e.r):z0(e.s,r.biff)+":"+z0(e.e,r.biff)}function Kx(e){return parseInt(nC(e),10)-1}function ts(e){return""+(e+1)}function aC(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function nC(e){return e.replace(/\$(\d+)$/,"$1")}function Jx(e){for(var r=iC(e),t=0,n=0;n!==r.length;++n)t=26*t+r.charCodeAt(n)-64;return t-1}function hs(e){if(e<0)throw new Error("invalid column "+e);var r="";for(++e;e;e=Math.floor((e-1)/26))r=String.fromCharCode((e-1)%26+65)+r;return r}function sC(e){return e.replace(/^([A-Z])/,"$$$1")}function iC(e){return e.replace(/^\$([A-Z])/,"$1")}function oC(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function Pn(e){for(var r=0,t=0,n=0;n<e.length;++n){var o=e.charCodeAt(n);o>=48&&o<=57?r=10*r+(o-48):o>=65&&o<=90&&(t=26*t+(o-64))}return{c:t-1,r:r-1}}function ka(e){for(var r=e.c+1,t="";r;r=(r-1)/26|0)t=String.fromCharCode((r-1)%26+65)+t;return t+(e.r+1)}function hi(e){var r=e.indexOf(":");return r==-1?{s:Pn(e),e:Pn(e)}:{s:Pn(e.slice(0,r)),e:Pn(e.slice(r+1))}}function bn(e,r){return typeof r=="undefined"||typeof r=="number"?bn(e.s,e.e):(typeof e!="string"&&(e=ka(e)),typeof r!="string"&&(r=ka(r)),e==r?e:e+":"+r)}function La(e){var r={s:{c:0,r:0},e:{c:0,r:0}},t=0,n=0,o=0,u=e.length;for(t=0;n<u&&!((o=e.charCodeAt(n)-64)<1||o>26);++n)t=26*t+o;for(r.s.c=--t,t=0;n<u&&!((o=e.charCodeAt(n)-48)<0||o>9);++n)t=10*t+o;if(r.s.r=--t,n===u||o!=10)return r.e.c=r.s.c,r.e.r=r.s.r,r;for(++n,t=0;n!=u&&!((o=e.charCodeAt(n)-64)<1||o>26);++n)t=26*t+o;for(r.e.c=--t,t=0;n!=u&&!((o=e.charCodeAt(n)-48)<0||o>9);++n)t=10*t+o;return r.e.r=--t,r}function Yb(e,r){var t=e.t=="d"&&r instanceof Date;if(e.z!=null)try{return e.w=Al(e.z,t?Vs(r):r)}catch(n){}try{return e.w=Al((e.XF||{}).numFmtId||(t?14:0),t?Vs(r):r)}catch(n){return""+r}}function qo(e,r,t){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&t&&t.dateNF&&(e.z=t.dateNF),e.t=="e"?fu[e.v]||e.v:r==null?Yb(e,e.v):Yb(e,r))}function bc(e,r){var t=r&&r.sheet?r.sheet:"Sheet1",n={};return n[t]=e,{SheetNames:[t],Sheets:n}}function yw(e,r,t){var n=t||{},o=e?Array.isArray(e):n.dense,u=e||(o?[]:{}),f=0,g=0;if(u&&n.origin!=null){if(typeof n.origin=="number")f=n.origin;else{var v=typeof n.origin=="string"?Pn(n.origin):n.origin;f=v.r,g=v.c}u["!ref"]||(u["!ref"]="A1:A1")}var p={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(u["!ref"]){var k=La(u["!ref"]);p.s.c=k.s.c,p.s.r=k.s.r,p.e.c=Math.max(p.e.c,k.e.c),p.e.r=Math.max(p.e.r,k.e.r),f==-1&&(p.e.r=f=k.e.r+1)}for(var N=0;N!=r.length;++N)if(r[N]){if(!Array.isArray(r[N]))throw new Error("aoa_to_sheet expects an array of arrays");for(var C=0;C!=r[N].length;++C)if(typeof r[N][C]!="undefined"){var O={v:r[N][C]},I=f+N,M=g+C;if(p.s.r>I&&(p.s.r=I),p.s.c>M&&(p.s.c=M),p.e.r<I&&(p.e.r=I),p.e.c<M&&(p.e.c=M),r[N][C]&&typeof r[N][C]=="object"&&!Array.isArray(r[N][C])&&!(r[N][C]instanceof Date))O=r[N][C];else if(Array.isArray(O.v)&&(O.f=r[N][C][1],O.v=O.v[0]),O.v===null)if(O.f)O.t="n";else if(n.nullError)O.t="e",O.v=0;else if(n.sheetStubs)O.t="z";else continue;else typeof O.v=="number"?O.t="n":typeof O.v=="boolean"?O.t="b":O.v instanceof Date?(O.z=n.dateNF||rn[14],n.cellDates?(O.t="d",O.w=Al(O.z,Vs(O.v))):(O.t="n",O.v=Vs(O.v),O.w=Al(O.z,O.v))):O.t="s";if(o)u[I]||(u[I]=[]),u[I][M]&&u[I][M].z&&(O.z=u[I][M].z),u[I][M]=O;else{var D=ka({c:M,r:I});u[D]&&u[D].z&&(O.z=u[D].z),u[D]=O}}}return p.s.c<1e7&&(u["!ref"]=bn(p)),u}function Id(e,r){return yw(null,e,r)}function lC(e){return e.read_shift(4,"i")}function Zi(e,r){return r||(r=xt(4)),r.write_shift(4,e),r}function ms(e){var r=e.read_shift(4);return r===0?"":e.read_shift(r,"dbcs")}function Fn(e,r){var t=!1;return r==null&&(t=!0,r=xt(4+2*e.length)),r.write_shift(4,e.length),e.length>0&&r.write_shift(0,e,"dbcs"),t?r.slice(0,r.l):r}function cC(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function dC(e,r){return r||(r=xt(4)),r.write_shift(2,0),r.write_shift(2,0),r}function Qx(e,r){var t=e.l,n=e.read_shift(1),o=ms(e),u=[],f={t:o,h:o};if((n&1)!==0){for(var g=e.read_shift(4),v=0;v!=g;++v)u.push(cC(e));f.r=u}else f.r=[{ich:0,ifnt:0}];return e.l=t+r,f}function uC(e,r){var t=!1;return r==null&&(t=!0,r=xt(15+4*e.t.length)),r.write_shift(1,0),Fn(e.t,r),t?r.slice(0,r.l):r}var fC=Qx;function hC(e,r){var t=!1;return r==null&&(t=!0,r=xt(23+4*e.t.length)),r.write_shift(1,1),Fn(e.t,r),r.write_shift(4,1),dC({},r),t?r.slice(0,r.l):r}function Ai(e){var r=e.read_shift(4),t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:r,iStyleRef:t}}function vc(e,r){return r==null&&(r=xt(8)),r.write_shift(-4,e.c),r.write_shift(3,e.iStyleRef||e.s),r.write_shift(1,0),r}function _c(e){var r=e.read_shift(2);return r+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:r}}function wc(e,r){return r==null&&(r=xt(4)),r.write_shift(3,e.iStyleRef||e.s),r.write_shift(1,0),r}var mC=ms,bw=Fn;function ep(e){var r=e.read_shift(4);return r===0||r===4294967295?"":e.read_shift(r,"dbcs")}function th(e,r){var t=!1;return r==null&&(t=!0,r=xt(127)),r.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&r.write_shift(0,e,"dbcs"),t?r.slice(0,r.l):r}var gC=ms,yx=ep,tp=th;function vw(e){var r=e.slice(e.l,e.l+4),t=r[0]&1,n=r[0]&2;e.l+=4;var o=n===0?eh([0,0,0,0,r[0]&252,r[1],r[2],r[3]],0):sc(r,0)>>2;return t?o/100:o}function _w(e,r){r==null&&(r=xt(4));var t=0,n=0,o=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?n=1:o==(o|0)&&o>=-536870912&&o<1<<29&&(n=1,t=1),n)r.write_shift(-4,((t?o:e)<<2)+(t+2));else throw new Error("unsupported RkNumber "+e)}function ww(e){var r={s:{},e:{}};return r.s.r=e.read_shift(4),r.e.r=e.read_shift(4),r.s.c=e.read_shift(4),r.e.c=e.read_shift(4),r}function xC(e,r){return r||(r=xt(16)),r.write_shift(4,e.s.r),r.write_shift(4,e.e.r),r.write_shift(4,e.s.c),r.write_shift(4,e.e.c),r}var kc=ww,Ld=xC;function Pd(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function gc(e,r){return(r||xt(8)).write_shift(8,e,"f")}function pC(e){var r={},t=e.read_shift(1),n=t>>>1,o=e.read_shift(1),u=e.read_shift(2,"i"),f=e.read_shift(1),g=e.read_shift(1),v=e.read_shift(1);switch(e.l++,n){case 0:r.auto=1;break;case 1:r.index=o;var p=EC[o];p&&(r.rgb=nv(p));break;case 2:r.rgb=nv([f,g,v]);break;case 3:r.theme=o;break}return u!=0&&(r.tint=u>0?u/32767:u/32768),r}function rh(e,r){if(r||(r=xt(8)),!e||e.auto)return r.write_shift(4,0),r.write_shift(4,0),r;e.index!=null?(r.write_shift(1,2),r.write_shift(1,e.index)):e.theme!=null?(r.write_shift(1,6),r.write_shift(1,e.theme)):(r.write_shift(1,5),r.write_shift(1,0));var t=e.tint||0;if(t>0?t*=32767:t<0&&(t*=32768),r.write_shift(2,t),!e.rgb||e.theme!=null)r.write_shift(2,0),r.write_shift(1,0),r.write_shift(1,0);else{var n=e.rgb||"FFFFFF";typeof n=="number"&&(n=("000000"+n.toString(16)).slice(-6)),r.write_shift(1,parseInt(n.slice(0,2),16)),r.write_shift(1,parseInt(n.slice(2,4),16)),r.write_shift(1,parseInt(n.slice(4,6),16)),r.write_shift(1,255)}return r}function yC(e){var r=e.read_shift(1);e.l++;var t={fBold:r&1,fItalic:r&2,fUnderline:r&4,fStrikeout:r&8,fOutline:r&16,fShadow:r&32,fCondense:r&64,fExtend:r&128};return t}function bC(e,r){r||(r=xt(2));var t=(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 r.write_shift(1,t),r.write_shift(1,0),r}var kw=2,oi=3,Tf=11,ah=19,Af=64,vC=65,_C=71,wC=4108,kC=4126,Jn=80,Zb={1:{n:"CodePage",t:kw},2:{n:"Category",t:Jn},3:{n:"PresentationFormat",t:Jn},4:{n:"ByteCount",t:oi},5:{n:"LineCount",t:oi},6:{n:"ParagraphCount",t:oi},7:{n:"SlideCount",t:oi},8:{n:"NoteCount",t:oi},9:{n:"HiddenCount",t:oi},10:{n:"MultimediaClipCount",t:oi},11:{n:"ScaleCrop",t:Tf},12:{n:"HeadingPairs",t:wC},13:{n:"TitlesOfParts",t:kC},14:{n:"Manager",t:Jn},15:{n:"Company",t:Jn},16:{n:"LinksUpToDate",t:Tf},17:{n:"CharacterCount",t:oi},19:{n:"SharedDoc",t:Tf},22:{n:"HyperlinksChanged",t:Tf},23:{n:"AppVersion",t:oi,p:"version"},24:{n:"DigSig",t:vC},26:{n:"ContentType",t:Jn},27:{n:"ContentStatus",t:Jn},28:{n:"Language",t:Jn},29:{n:"Version",t:Jn},255:{},2147483648:{n:"Locale",t:ah},2147483651:{n:"Behavior",t:ah},1919054434:{}},$b={1:{n:"CodePage",t:kw},2:{n:"Title",t:Jn},3:{n:"Subject",t:Jn},4:{n:"Author",t:Jn},5:{n:"Keywords",t:Jn},6:{n:"Comments",t:Jn},7:{n:"Template",t:Jn},8:{n:"LastAuthor",t:Jn},9:{n:"RevNumber",t:Jn},10:{n:"EditTime",t:Af},11:{n:"LastPrinted",t:Af},12:{n:"CreatedDate",t:Af},13:{n:"ModifiedDate",t:Af},14:{n:"PageCount",t:oi},15:{n:"WordCount",t:oi},16:{n:"CharCount",t:oi},17:{n:"Thumbnail",t:_C},18:{n:"Application",t:Jn},19:{n:"DocSecurity",t:oi},255:{},2147483648:{n:"Locale",t:ah},2147483651:{n:"Behavior",t:ah},1919054434:{}};function NC(e){return e.map(function(r){return[r>>16&255,r>>8&255,r&255]})}var SC=NC([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]),EC=Gs(SC),fu={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},CC={"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"},jf={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 Nw(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function Sw(e,r){var t=PE(CC),n=[],o;n[n.length]=vn,n[n.length]=Vt("Types",null,{xmlns:Ln.CT,"xmlns:xsd":Ln.xsd,"xmlns:xsi":Ln.xsi}),n=n.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(v){return Vt("Default",null,{Extension:v[0],ContentType:v[1]})}));var u=function(v){e[v]&&e[v].length>0&&(o=e[v][0],n[n.length]=Vt("Override",null,{PartName:(o[0]=="/"?"":"/")+o,ContentType:jf[v][r.bookType]||jf[v].xlsx}))},f=function(v){(e[v]||[]).forEach(function(p){n[n.length]=Vt("Override",null,{PartName:(p[0]=="/"?"":"/")+p,ContentType:jf[v][r.bookType]||jf[v].xlsx})})},g=function(v){(e[v]||[]).forEach(function(p){n[n.length]=Vt("Override",null,{PartName:(p[0]=="/"?"":"/")+p,ContentType:t[v][0]})})};return u("workbooks"),f("sheets"),f("charts"),g("themes"),["strs","styles"].forEach(u),["coreprops","extprops","custprops"].forEach(g),g("vba"),g("comments"),g("threadedcomments"),g("drawings"),f("metadata"),g("people"),n.length>2&&(n[n.length]="</Types>",n[1]=n[1].replace("/>",">")),n.join("")}var oa={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 Ew(e){var r=e.lastIndexOf("/");return e.slice(0,r+1)+"_rels/"+e.slice(r+1)+".rels"}function bd(e){var r=[vn,Vt("Relationships",null,{xmlns:Ln.RELS})];return as(e["!id"]).forEach(function(t){r[r.length]=Vt("Relationship",null,e["!id"][t])}),r.length>2&&(r[r.length]="</Relationships>",r[1]=r[1].replace("/>",">")),r.join("")}function _a(e,r,t,n,o,u){if(o||(o={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),r<0)for(r=e["!idx"];e["!id"]["rId"+r];++r);if(e["!idx"]=r+1,o.Id="rId"+r,o.Type=n,o.Target=t,[oa.HLINK,oa.XPATH,oa.XMISS].indexOf(o.Type)>-1&&(o.TargetMode="External"),e["!id"][o.Id])throw new Error("Cannot rewrite rId "+r);return e["!id"][o.Id]=o,e[("/"+o.Target).replace("//","/")]=o,r}function TC(e){var r=[vn];r.push(`<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
`),r.push(` <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>
`);for(var t=0;t<e.length;++t)r.push(' <manifest:file-entry manifest:full-path="'+e[t][0]+'" manifest:media-type="'+e[t][1]+`"/>
`);return r.push("</manifest:manifest>"),r.join("")}function qb(e,r,t){return[' <rdf:Description rdf:about="'+e+`">
`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(t||"odf")+"#"+r+`"/>
`,` </rdf:Description>
`].join("")}function AC(e,r){return[' <rdf:Description rdf:about="'+e+`">
`,' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+r+`"/>
`,` </rdf:Description>
`].join("")}function jC(e){var r=[vn];r.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
`);for(var t=0;t!=e.length;++t)r.push(qb(e[t][0],e[t][1])),r.push(AC("",e[t][0]));return r.push(qb("","Document","pkg")),r.push("</rdf:RDF>"),r.join("")}function Cw(){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 '+Zf.version+"</meta:generator></office:meta></office:document-meta>"}var cc=[["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 Vg(e,r,t,n,o){o[e]!=null||r==null||r===""||(o[e]=r,r=wa(r),n[n.length]=t?Vt(e,r,t):es(e,r))}function Tw(e,r){var t=r||{},n=[vn,Vt("cp:coreProperties",null,{"xmlns:cp":Ln.CORE_PROPS,"xmlns:dc":Ln.dc,"xmlns:dcterms":Ln.dcterms,"xmlns:dcmitype":Ln.dcmitype,"xmlns:xsi":Ln.xsi})],o={};if(!e&&!t.Props)return n.join("");e&&(e.CreatedDate!=null&&Vg("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:px(e.CreatedDate,t.WTF),{"xsi:type":"dcterms:W3CDTF"},n,o),e.ModifiedDate!=null&&Vg("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:px(e.ModifiedDate,t.WTF),{"xsi:type":"dcterms:W3CDTF"},n,o));for(var u=0;u!=cc.length;++u){var f=cc[u],g=t.Props&&t.Props[f[1]]!=null?t.Props[f[1]]:e?e[f[1]]:null;g===!0?g="1":g===!1?g="0":typeof g=="number"&&(g=String(g)),g!=null&&Vg(f[0],g,null,n,o)}return n.length>2&&(n[n.length]="</cp:coreProperties>",n[1]=n[1].replace("/>",">")),n.join("")}var vd=[["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"]],Aw=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function jw(e){var r=[],t=Vt;return e||(e={}),e.Application="SheetJS",r[r.length]=vn,r[r.length]=Vt("Properties",null,{xmlns:Ln.EXT_PROPS,"xmlns:vt":Ln.vt}),vd.forEach(function(n){if(e[n[1]]!==void 0){var o;switch(n[2]){case"string":o=wa(String(e[n[1]]));break;case"bool":o=e[n[1]]?"true":"false";break}o!==void 0&&(r[r.length]=t(n[0],o))}}),r[r.length]=t("HeadingPairs",t("vt:vector",t("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+t("vt:variant",t("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),r[r.length]=t("TitlesOfParts",t("vt:vector",e.SheetNames.map(function(n){return"<vt:lpstr>"+wa(n)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),r.length>2&&(r[r.length]="</Properties>",r[1]=r[1].replace("/>",">")),r.join("")}function Ow(e){var r=[vn,Vt("Properties",null,{xmlns:Ln.CUST_PROPS,"xmlns:vt":Ln.vt})];if(!e)return r.join("");var t=1;return as(e).forEach(function(o){++t,r[r.length]=Vt("property",ZE(e[o]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:t,name:wa(o)})}),r.length>2&&(r[r.length]="</Properties>",r[1]=r[1].replace("/>",">")),r.join("")}var Kb={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 OC(e,r){var t=[];return as(Kb).map(function(n){for(var o=0;o<cc.length;++o)if(cc[o][1]==n)return cc[o];for(o=0;o<vd.length;++o)if(vd[o][1]==n)return vd[o];throw n}).forEach(function(n){if(e[n[1]]!=null){var o=r&&r.Props&&r.Props[n[1]]!=null?r.Props[n[1]]:e[n[1]];switch(n[2]){case"date":o=new Date(o).toISOString().replace(/\.\d*Z/,"Z");break}typeof o=="number"?o=String(o):o===!0||o===!1?o=o?"1":"0":o instanceof Date&&(o=new Date(o).toISOString().replace(/\.\d*Z/,"")),t.push(es(Kb[n[1]]||n[1],o))}}),Vt("DocumentProperties",t.join(""),{xmlns:ci.o})}function MC(e,r){var t=["Worksheets","SheetNames"],n="CustomDocumentProperties",o=[];return e&&as(e).forEach(function(u){if(Object.prototype.hasOwnProperty.call(e,u)){for(var f=0;f<cc.length;++f)if(u==cc[f][1])return;for(f=0;f<vd.length;++f)if(u==vd[f][1])return;for(f=0;f<t.length;++f)if(u==t[f])return;var g=e[u],v="string";typeof g=="number"?(v="float",g=String(g)):g===!0||g===!1?(v="boolean",g=g?"1":"0"):g=String(g),o.push(Vt(Fb(u),g,{"dt:dt":v}))}}),r&&as(r).forEach(function(u){if(Object.prototype.hasOwnProperty.call(r,u)&&!(e&&Object.prototype.hasOwnProperty.call(e,u))){var f=r[u],g="string";typeof f=="number"?(g="float",f=String(f)):f===!0||f===!1?(g="boolean",f=f?"1":"0"):f instanceof Date?(g="dateTime.tz",f=f.toISOString()):f=String(f),o.push(Vt(Fb(u),f,{"dt:dt":g}))}}),"<"+n+' xmlns="'+ci.o+'">'+o.join("")+"</"+n+">"}function RC(e){var r=typeof e=="string"?new Date(Date.parse(e)):e,t=r.getTime()/1e3+11644473600,n=t%Math.pow(2,32),o=(t-n)/Math.pow(2,32);n*=1e7,o*=1e7;var u=n/Math.pow(2,32)|0;u>0&&(n=n%Math.pow(2,32),o+=u);var f=xt(8);return f.write_shift(4,n),f.write_shift(4,o),f}function Jb(e,r){var t=xt(4),n=xt(4);switch(t.write_shift(4,e==80?31:e),e){case 3:n.write_shift(-4,r);break;case 5:n=xt(8),n.write_shift(8,r,"f");break;case 11:n.write_shift(4,r?1:0);break;case 64:n=RC(r);break;case 31:case 80:for(n=xt(4+2*(r.length+1)+(r.length%2?0:2)),n.write_shift(4,r.length+1),n.write_shift(0,r,"dbcs");n.l!=n.length;)n.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+r)}return Qn([t,n])}var Mw=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function DC(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 Qb(e,r,t){var n=xt(8),o=[],u=[],f=8,g=0,v=xt(8),p=xt(8);if(v.write_shift(4,2),v.write_shift(4,1200),p.write_shift(4,1),u.push(v),o.push(p),f+=8+v.length,!r){p=xt(8),p.write_shift(4,0),o.unshift(p);var k=[xt(4)];for(k[0].write_shift(4,e.length),g=0;g<e.length;++g){var N=e[g][0];for(v=xt(8+2*(N.length+1)+(N.length%2?0:2)),v.write_shift(4,g+2),v.write_shift(4,N.length+1),v.write_shift(0,N,"dbcs");v.l!=v.length;)v.write_shift(1,0);k.push(v)}v=Qn(k),u.unshift(v),f+=8+v.length}for(g=0;g<e.length;++g)if(!(r&&!r[e[g][0]])&&!(Mw.indexOf(e[g][0])>-1||Aw.indexOf(e[g][0])>-1)&&e[g][1]!=null){var C=e[g][1],O=0;if(r){O=+r[e[g][0]];var I=t[O];if(I.p=="version"&&typeof C=="string"){var M=C.split(".");C=(+M[0]<<16)+(+M[1]||0)}v=Jb(I.t,C)}else{var D=DC(C);D==-1&&(D=31,C=String(C)),v=Jb(D,C)}u.push(v),p=xt(8),p.write_shift(4,r?O:2+g),o.push(p),f+=8+v.length}var z=8*(u.length+1);for(g=0;g<u.length;++g)o[g].write_shift(4,z),z+=u[g].length;return n.write_shift(4,f),n.write_shift(4,u.length),Qn([n].concat(o).concat(u))}function ev(e,r,t,n,o,u){var f=xt(o?68:48),g=[f];f.write_shift(2,65534),f.write_shift(2,0),f.write_shift(4,842412599),f.write_shift(16,Aa.utils.consts.HEADER_CLSID,"hex"),f.write_shift(4,o?2:1),f.write_shift(16,r,"hex"),f.write_shift(4,o?68:48);var v=Qb(e,t,n);if(g.push(v),o){var p=Qb(o,null,null);f.write_shift(16,u,"hex"),f.write_shift(4,68+v.length),g.push(p)}return Qn(g)}function IC(e,r){r||(r=xt(e));for(var t=0;t<e;++t)r.write_shift(1,0);return r}function LC(e,r){return e.read_shift(r)===1}function Ns(e,r){return r||(r=xt(2)),r.write_shift(2,+!!e),r}function Rw(e){return e.read_shift(2,"u")}function Si(e,r){return r||(r=xt(2)),r.write_shift(2,e),r}function Dw(e,r,t){return t||(t=xt(2)),t.write_shift(1,r=="e"?+e:+!!e),t.write_shift(1,r=="e"?1:0),t}function Iw(e,r,t){var n=e.read_shift(t&&t.biff>=12?2:1),o="sbcs-cont";if(t&&t.biff>=8,!t||t.biff==8){var u=e.read_shift(1);u&&(o="dbcs-cont")}else t.biff==12&&(o="wstr");t.biff>=2&&t.biff<=5&&(o="cpstr");var f=n?e.read_shift(n,o):"";return f}function PC(e){var r=e.t||"",t=xt(3);t.write_shift(2,r.length),t.write_shift(1,1);var n=xt(2*r.length);n.write_shift(2*r.length,r,"utf16le");var o=[t,n];return Qn(o)}function FC(e,r,t){var n;if(t){if(t.biff>=2&&t.biff<=5)return e.read_shift(r,"cpstr");if(t.biff>=12)return e.read_shift(r,"dbcs-cont")}var o=e.read_shift(1);return o===0?n=e.read_shift(r,"sbcs-cont"):n=e.read_shift(r,"dbcs-cont"),n}function BC(e,r,t){var n=e.read_shift(t&&t.biff==2?1:2);return n===0?(e.l++,""):FC(e,n,t)}function UC(e,r,t){if(t.biff>5)return BC(e,r,t);var n=e.read_shift(1);return n===0?(e.l++,""):e.read_shift(n,t.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function Lw(e,r,t){return t||(t=xt(3+2*e.length)),t.write_shift(2,e.length),t.write_shift(1,1),t.write_shift(31,e,"utf16le"),t}function tv(e,r){r||(r=xt(6+e.length*2)),r.write_shift(4,1+e.length);for(var t=0;t<e.length;++t)r.write_shift(2,e.charCodeAt(t));return r.write_shift(2,0),r}function zC(e){var r=xt(512),t=0,n=e.Target;n.slice(0,7)=="file://"&&(n=n.slice(7));var o=n.indexOf("#"),u=o>-1?31:23;switch(n.charAt(0)){case"#":u=28;break;case".":u&=-3;break}r.write_shift(4,2),r.write_shift(4,u);var f=[8,6815827,6619237,4849780,83];for(t=0;t<f.length;++t)r.write_shift(4,f[t]);if(u==28)n=n.slice(1),tv(n,r);else if(u&2){for(f="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),t=0;t<f.length;++t)r.write_shift(1,parseInt(f[t],16));var g=o>-1?n.slice(0,o):n;for(r.write_shift(4,2*(g.length+1)),t=0;t<g.length;++t)r.write_shift(2,g.charCodeAt(t));r.write_shift(2,0),u&8&&tv(o>-1?n.slice(o+1):"",r)}else{for(f="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),t=0;t<f.length;++t)r.write_shift(1,parseInt(f[t],16));for(var v=0;n.slice(v*3,v*3+3)=="../"||n.slice(v*3,v*3+3)=="..\\";)++v;for(r.write_shift(2,v),r.write_shift(4,n.length-3*v+1),t=0;t<n.length-3*v;++t)r.write_shift(1,n.charCodeAt(t+3*v)&255);for(r.write_shift(1,0),r.write_shift(2,65535),r.write_shift(2,57005),t=0;t<6;++t)r.write_shift(4,0)}return r.slice(0,r.l)}function xc(e,r,t,n){return n||(n=xt(6)),n.write_shift(2,e),n.write_shift(2,r),n.write_shift(2,t||0),n}function HC(e,r,t){var n=t.biff>8?4:2,o=e.read_shift(n),u=e.read_shift(n,"i"),f=e.read_shift(n,"i");return[o,u,f]}function WC(e){var r=e.read_shift(2),t=e.read_shift(2),n=e.read_shift(2),o=e.read_shift(2);return{s:{c:n,r},e:{c:o,r:t}}}function Pw(e,r){return r||(r=xt(8)),r.write_shift(2,e.s.r),r.write_shift(2,e.e.r),r.write_shift(2,e.s.c),r.write_shift(2,e.e.c),r}function rp(e,r,t){var n=1536,o=16;switch(t.bookType){case"biff8":break;case"biff5":n=1280,o=8;break;case"biff4":n=4,o=6;break;case"biff3":n=3,o=6;break;case"biff2":n=2,o=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var u=xt(o);return u.write_shift(2,n),u.write_shift(2,r),o>4&&u.write_shift(2,29282),o>6&&u.write_shift(2,1997),o>8&&(u.write_shift(2,49161),u.write_shift(2,1),u.write_shift(2,1798),u.write_shift(2,0)),u}function VC(e,r){var t=!r||r.biff==8,n=xt(t?112:54);for(n.write_shift(r.biff==8?2:1,7),t&&n.write_shift(1,0),n.write_shift(4,859007059),n.write_shift(4,5458548|(t?0:536870912));n.l<n.length;)n.write_shift(1,t?0:32);return n}function GC(e,r){var t=!r||r.biff>=8?2:1,n=xt(8+t*e.name.length);n.write_shift(4,e.pos),n.write_shift(1,e.hs||0),n.write_shift(1,e.dt),n.write_shift(1,e.name.length),r.biff>=8&&n.write_shift(1,1),n.write_shift(t*e.name.length,e.name,r.biff<8?"sbcs":"utf16le");var o=n.slice(0,n.l);return o.l=n.l,o}function XC(e,r){var t=xt(8);t.write_shift(4,e.Count),t.write_shift(4,e.Unique);for(var n=[],o=0;o<e.length;++o)n[o]=PC(e[o]);var u=Qn([t].concat(n));return u.parts=[t.length].concat(n.map(function(f){return f.length})),u}function YC(){var e=xt(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 ZC(e){var r=xt(18),t=1718;return e&&e.RTL&&(t|=64),r.write_shift(2,t),r.write_shift(4,0),r.write_shift(4,64),r.write_shift(4,0),r.write_shift(4,0),r}function $C(e,r){var t=e.name||"Arial",n=r&&r.biff==5,o=n?15+t.length:16+2*t.length,u=xt(o);return u.write_shift(2,e.sz*20),u.write_shift(4,0),u.write_shift(2,400),u.write_shift(4,0),u.write_shift(2,0),u.write_shift(1,t.length),n||u.write_shift(1,1),u.write_shift((n?1:2)*t.length,t,n?"sbcs":"utf16le"),u}function qC(e,r,t,n){var o=xt(10);return xc(e,r,n,o),o.write_shift(4,t),o}function KC(e,r,t,n,o){var u=!o||o.biff==8,f=xt(8+ +u+(1+u)*t.length);return xc(e,r,n,f),f.write_shift(2,t.length),u&&f.write_shift(1,1),f.write_shift((1+u)*t.length,t,u?"utf16le":"sbcs"),f}function JC(e,r,t,n){var o=t&&t.biff==5;n||(n=xt(o?3+r.length:5+2*r.length)),n.write_shift(2,e),n.write_shift(o?1:2,r.length),o||n.write_shift(1,1),n.write_shift((o?1:2)*r.length,r,o?"sbcs":"utf16le");var u=n.length>n.l?n.slice(0,n.l):n;return u.l==null&&(u.l=u.length),u}function QC(e,r){var t=r.biff==8||!r.biff?4:2,n=xt(2*t+6);return n.write_shift(t,e.s.r),n.write_shift(t,e.e.r+1),n.write_shift(2,e.s.c),n.write_shift(2,e.e.c+1),n.write_shift(2,0),n}function rv(e,r,t,n){var o=t&&t.biff==5;n||(n=xt(o?16:20)),n.write_shift(2,0),e.style?(n.write_shift(2,e.numFmtId||0),n.write_shift(2,65524)):(n.write_shift(2,e.numFmtId||0),n.write_shift(2,r<<4));var u=0;return e.numFmtId>0&&o&&(u|=1024),n.write_shift(4,u),n.write_shift(4,0),o||n.write_shift(4,0),n.write_shift(2,0),n}function eT(e){var r=xt(8);return r.write_shift(4,0),r.write_shift(2,0),r.write_shift(2,0),r}function tT(e,r,t,n,o,u){var f=xt(8);return xc(e,r,n,f),Dw(t,u,f),f}function rT(e,r,t,n){var o=xt(14);return xc(e,r,n,o),gc(t,o),o}function aT(e,r,t){if(t.biff<8)return nT(e,r,t);for(var n=[],o=e.l+r,u=e.read_shift(t.biff>8?4:2);u--!==0;)n.push(HC(e,t.biff>8?12:6,t));if(e.l!=o)throw new Error("Bad ExternSheet: "+e.l+" != "+o);return n}function nT(e,r,t){e[e.l+1]==3&&e[e.l]++;var n=Iw(e,r,t);return n.charCodeAt(0)==3?n.slice(1):n}function sT(e){var r=xt(2+e.length*8);r.write_shift(2,e.length);for(var t=0;t<e.length;++t)Pw(e[t],r);return r}function iT(e){var r=xt(24),t=Pn(e[0]);r.write_shift(2,t.r),r.write_shift(2,t.r),r.write_shift(2,t.c),r.write_shift(2,t.c);for(var n="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),o=0;o<16;++o)r.write_shift(1,parseInt(n[o],16));return Qn([r,zC(e[1])])}function oT(e){var r=e[1].Tooltip,t=xt(10+2*(r.length+1));t.write_shift(2,2048);var n=Pn(e[0]);t.write_shift(2,n.r),t.write_shift(2,n.r),t.write_shift(2,n.c),t.write_shift(2,n.c);for(var o=0;o<r.length;++o)t.write_shift(2,r.charCodeAt(o));return t.write_shift(2,0),t}function lT(e){return e||(e=xt(4)),e.write_shift(2,1),e.write_shift(2,1),e}function cT(e,r,t){if(!t.cellStyles)return po(e,r);var n=t&&t.biff>=12?4:2,o=e.read_shift(n),u=e.read_shift(n),f=e.read_shift(n),g=e.read_shift(n),v=e.read_shift(2);n==2&&(e.l+=2);var p={s:o,e:u,w:f,ixfe:g,flags:v};return(t.biff>=5||!t.biff)&&(p.level=v>>8&7),p}function dT(e,r){var t=xt(12);t.write_shift(2,r),t.write_shift(2,r),t.write_shift(2,e.width*256),t.write_shift(2,0);var n=0;return e.hidden&&(n|=1),t.write_shift(1,n),n=e.level||0,t.write_shift(1,n),t.write_shift(2,0),t}function uT(e){for(var r=xt(2*e),t=0;t<e;++t)r.write_shift(2,t+1);return r}function fT(e,r,t){var n=xt(15);return mu(n,e,r),n.write_shift(8,t,"f"),n}function hT(e,r,t){var n=xt(9);return mu(n,e,r),n.write_shift(2,t),n}var mT=(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},r=Gx({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 t(g,v){var p=[],k=mc(1);switch(v.type){case"base64":k=Gi($o(g));break;case"binary":k=Gi(g);break;case"buffer":case"array":k=g;break}li(k,0);var N=k.read_shift(1),C=!!(N&136),O=!1,I=!1;switch(N){case 2:break;case 3:break;case 48:O=!0,C=!0;break;case 49:O=!0,C=!0;break;case 131:break;case 139:break;case 140:I=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+N.toString(16))}var M=0,D=521;N==2&&(M=k.read_shift(2)),k.l+=3,N!=2&&(M=k.read_shift(4)),M>1048576&&(M=1e6),N!=2&&(D=k.read_shift(2));var z=k.read_shift(2),B=v.codepage||1252;N!=2&&(k.l+=16,k.read_shift(1),k[k.l]!==0&&(B=e[k[k.l]]),k.l+=1,k.l+=2),I&&(k.l+=36);for(var U=[],H={},q=Math.min(k.length,N==2?521:D-10-(O?264:0)),ne=I?32:11;k.l<q&&k[k.l]!=13;)switch(H={},H.name=$f.utils.decode(B,k.slice(k.l,k.l+ne)).replace(/[\u0000\r\n].*$/g,""),k.l+=ne,H.type=String.fromCharCode(k.read_shift(1)),N!=2&&!I&&(H.offset=k.read_shift(4)),H.len=k.read_shift(1),N==2&&(H.offset=k.read_shift(2)),H.dec=k.read_shift(1),H.name.length&&U.push(H),N!=2&&(k.l+=I?13:14),H.type){case"B":(!O||H.len!=8)&&v.WTF&&console.log("Skipping "+H.name+":"+H.type);break;case"G":case"P":v.WTF&&console.log("Skipping "+H.name+":"+H.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: "+H.type)}if(k[k.l]!==13&&(k.l=D-1),k.read_shift(1)!==13)throw new Error("DBF Terminator not found "+k.l+" "+k[k.l]);k.l=D;var V=0,J=0;for(p[0]=[],J=0;J!=U.length;++J)p[0][J]=U[J].name;for(;M-- >0;){if(k[k.l]===42){k.l+=z;continue}for(++k.l,p[++V]=[],J=0,J=0;J!=U.length;++J){var Q=k.slice(k.l,k.l+U[J].len);k.l+=U[J].len,li(Q,0);var Te=$f.utils.decode(B,Q);switch(U[J].type){case"C":Te.trim().length&&(p[V][J]=Te.replace(/\s+$/,""));break;case"D":Te.length===8?p[V][J]=new Date(+Te.slice(0,4),+Te.slice(4,6)-1,+Te.slice(6,8)):p[V][J]=Te;break;case"F":p[V][J]=parseFloat(Te.trim());break;case"+":case"I":p[V][J]=I?Q.read_shift(-4,"i")^2147483648:Q.read_shift(4,"i");break;case"L":switch(Te.trim().toUpperCase()){case"Y":case"T":p[V][J]=!0;break;case"N":case"F":p[V][J]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+Te+"|")}break;case"M":if(!C)throw new Error("DBF Unexpected MEMO for type "+N.toString(16));p[V][J]="##MEMO##"+(I?parseInt(Te.trim(),10):Q.read_shift(4));break;case"N":Te=Te.replace(/\u0000/g,"").trim(),Te&&Te!="."&&(p[V][J]=+Te||0);break;case"@":p[V][J]=new Date(Q.read_shift(-8,"f")-621356832e5);break;case"T":p[V][J]=new Date((Q.read_shift(4)-2440588)*864e5+Q.read_shift(4));break;case"Y":p[V][J]=Q.read_shift(4,"i")/1e4+Q.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":p[V][J]=-Q.read_shift(-8,"f");break;case"B":if(O&&U[J].len==8){p[V][J]=Q.read_shift(8,"f");break}case"G":case"P":Q.l+=U[J].len;break;case"0":if(U[J].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+U[J].type)}}}if(N!=2&&k.l<k.length&&k[k.l++]!=26)throw new Error("DBF EOF Marker missing "+(k.l-1)+" of "+k.length+" "+k[k.l-1].toString(16));return v&&v.sheetRows&&(p=p.slice(0,v.sheetRows)),v.DBF=U,p}function n(g,v){var p=v||{};p.dateNF||(p.dateNF="yyyymmdd");var k=Id(t(g,p),p);return k["!cols"]=p.DBF.map(function(N){return{wch:N.len,DBF:N}}),delete p.DBF,k}function o(g,v){try{return bc(n(g,v),v)}catch(p){if(v&&v.WTF)throw p}return{SheetNames:[],Sheets:{}}}var u={B:8,C:250,L:1,D:8,"?":0,"":0};function f(g,v){var p=v||{};if(+p.codepage>=0&&X0(+p.codepage),p.type=="string")throw new Error("Cannot write DBF to JS string");var k=Ws(),N=lh(g,{header:1,raw:!0,cellDates:!0}),C=N[0],O=N.slice(1),I=g["!cols"]||[],M=0,D=0,z=0,B=1;for(M=0;M<C.length;++M){if(((I[M]||{}).DBF||{}).name){C[M]=I[M].DBF.name,++z;continue}if(C[M]!=null){if(++z,typeof C[M]=="number"&&(C[M]=C[M].toString(10)),typeof C[M]!="string")throw new Error("DBF Invalid column name "+C[M]+" |"+typeof C[M]+"|");if(C.indexOf(C[M])!==M){for(D=0;D<1024;++D)if(C.indexOf(C[M]+"_"+D)==-1){C[M]+="_"+D;break}}}}var U=La(g["!ref"]),H=[],q=[],ne=[];for(M=0;M<=U.e.c-U.s.c;++M){var V="",J="",Q=0,Te=[];for(D=0;D<O.length;++D)O[D][M]!=null&&Te.push(O[D][M]);if(Te.length==0||C[M]==null){H[M]="?";continue}for(D=0;D<Te.length;++D){switch(typeof Te[D]){case"number":J="B";break;case"string":J="C";break;case"boolean":J="L";break;case"object":J=Te[D]instanceof Date?"D":"C";break;default:J="C"}Q=Math.max(Q,String(Te[D]).length),V=V&&V!=J?"C":J}Q>250&&(Q=250),J=((I[M]||{}).DBF||{}).type,J=="C"&&I[M].DBF.len>Q&&(Q=I[M].DBF.len),V=="B"&&J=="N"&&(V="N",ne[M]=I[M].DBF.dec,Q=I[M].DBF.len),q[M]=V=="C"||J=="N"?Q:u[V]||0,B+=q[M],H[M]=V}var je=k.next(32);for(je.write_shift(4,318902576),je.write_shift(4,O.length),je.write_shift(2,296+32*z),je.write_shift(2,B),M=0;M<4;++M)je.write_shift(4,0);for(je.write_shift(4,0|(+r[B_]||3)<<8),M=0,D=0;M<C.length;++M)if(C[M]!=null){var me=k.next(32),Se=(C[M].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);me.write_shift(1,Se,"sbcs"),me.write_shift(1,H[M]=="?"?"C":H[M],"sbcs"),me.write_shift(4,D),me.write_shift(1,q[M]||u[H[M]]||0),me.write_shift(1,ne[M]||0),me.write_shift(1,2),me.write_shift(4,0),me.write_shift(1,0),me.write_shift(4,0),me.write_shift(4,0),D+=q[M]||u[H[M]]||0}var Oe=k.next(264);for(Oe.write_shift(4,13),M=0;M<65;++M)Oe.write_shift(4,0);for(M=0;M<O.length;++M){var ue=k.next(B);for(ue.write_shift(1,0),D=0;D<C.length;++D)if(C[D]!=null)switch(H[D]){case"L":ue.write_shift(1,O[M][D]==null?63:O[M][D]?84:70);break;case"B":ue.write_shift(8,O[M][D]||0,"f");break;case"N":var be="0";for(typeof O[M][D]=="number"&&(be=O[M][D].toFixed(ne[D]||0)),z=0;z<q[D]-be.length;++z)ue.write_shift(1,32);ue.write_shift(1,be,"sbcs");break;case"D":O[M][D]?(ue.write_shift(4,("0000"+O[M][D].getFullYear()).slice(-4),"sbcs"),ue.write_shift(2,("00"+(O[M][D].getMonth()+1)).slice(-2),"sbcs"),ue.write_shift(2,("00"+O[M][D].getDate()).slice(-2),"sbcs")):ue.write_shift(8,"00000000","sbcs");break;case"C":var re=String(O[M][D]!=null?O[M][D]:"").slice(0,q[D]);for(ue.write_shift(1,re,"sbcs"),z=0;z<q[D]-re.length;++z)ue.write_shift(1,32);break}}return k.next(1).write_shift(1,26),k.end()}return{to_workbook:o,to_sheet:n,from_sheet:f}})(),gT=(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},r=new RegExp("\x1BN("+as(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),t=function(C,O){var I=e[O];return typeof I=="number"?Eb(I):I},n=function(C,O,I){var M=O.charCodeAt(0)-32<<4|I.charCodeAt(0)-48;return M==59?C:Eb(M)};e["|"]=254;function o(C,O){switch(O.type){case"base64":return u($o(C),O);case"binary":return u(C,O);case"buffer":return u(ha&&Buffer.isBuffer(C)?C.toString("binary"):cu(C),O);case"array":return u(Ah(C),O)}throw new Error("Unrecognized type "+O.type)}function u(C,O){var I=C.split(/[\n\r]+/),M=-1,D=-1,z=0,B=0,U=[],H=[],q=null,ne={},V=[],J=[],Q=[],Te=0,je;for(+O.codepage>=0&&X0(+O.codepage);z!==I.length;++z){Te=0;var me=I[z].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,n).replace(r,t),Se=me.replace(/;;/g,"\0").split(";").map(function(he){return he.replace(/\u0000/g,";")}),Oe=Se[0],ue;if(me.length>0)switch(Oe){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":Se[1].charAt(0)=="P"&&H.push(me.slice(3).replace(/;;/g,";"));break;case"C":var be=!1,re=!1,de=!1,Ae=!1,_e=-1,K=-1;for(B=1;B<Se.length;++B)switch(Se[B].charAt(0)){case"A":break;case"X":D=parseInt(Se[B].slice(1))-1,re=!0;break;case"Y":for(M=parseInt(Se[B].slice(1))-1,re||(D=0),je=U.length;je<=M;++je)U[je]=[];break;case"K":ue=Se[B].slice(1),ue.charAt(0)==='"'?ue=ue.slice(1,ue.length-1):ue==="TRUE"?ue=!0:ue==="FALSE"?ue=!1:isNaN(Vo(ue))?isNaN(Z0(ue).getDate())||(ue=Es(ue)):(ue=Vo(ue),q!==null&&K_(q)&&(ue=tw(ue))),be=!0;break;case"E":Ae=!0;var W=hA(Se[B].slice(1),{r:M,c:D});U[M][D]=[U[M][D],W];break;case"S":de=!0,U[M][D]=[U[M][D],"S5S"];break;case"G":break;case"R":_e=parseInt(Se[B].slice(1))-1;break;case"C":K=parseInt(Se[B].slice(1))-1;break;default:if(O&&O.WTF)throw new Error("SYLK bad record "+me)}if(be&&(U[M][D]&&U[M][D].length==2?U[M][D][0]=ue:U[M][D]=ue,q=null),de){if(Ae)throw new Error("SYLK shared formula cannot have own formula");var ae=_e>-1&&U[_e][K];if(!ae||!ae[1])throw new Error("SYLK shared formula cannot find base");U[M][D][1]=mA(ae[1],{r:M-_e,c:D-K})}break;case"F":var se=0;for(B=1;B<Se.length;++B)switch(Se[B].charAt(0)){case"X":D=parseInt(Se[B].slice(1))-1,++se;break;case"Y":for(M=parseInt(Se[B].slice(1))-1,je=U.length;je<=M;++je)U[je]=[];break;case"M":Te=parseInt(Se[B].slice(1))/20;break;case"F":break;case"G":break;case"P":q=H[parseInt(Se[B].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(Q=Se[B].slice(1).split(" "),je=parseInt(Q[0],10);je<=parseInt(Q[1],10);++je)Te=parseInt(Q[2],10),J[je-1]=Te===0?{hidden:!0}:{wch:Te},ap(J[je-1]);break;case"C":D=parseInt(Se[B].slice(1))-1,J[D]||(J[D]={});break;case"R":M=parseInt(Se[B].slice(1))-1,V[M]||(V[M]={}),Te>0?(V[M].hpt=Te,V[M].hpx=Hw(Te)):Te===0&&(V[M].hidden=!0);break;default:if(O&&O.WTF)throw new Error("SYLK bad record "+me)}se<1&&(q=null);break;default:if(O&&O.WTF)throw new Error("SYLK bad record "+me)}}return V.length>0&&(ne["!rows"]=V),J.length>0&&(ne["!cols"]=J),O&&O.sheetRows&&(U=U.slice(0,O.sheetRows)),[U,ne]}function f(C,O){var I=o(C,O),M=I[0],D=I[1],z=Id(M,O);return as(D).forEach(function(B){z[B]=D[B]}),z}function g(C,O){return bc(f(C,O),O)}function v(C,O,I,M){var D="C;Y"+(I+1)+";X"+(M+1)+";K";switch(C.t){case"n":D+=C.v||0,C.f&&!C.F&&(D+=";E"+sp(C.f,{r:I,c:M}));break;case"b":D+=C.v?"TRUE":"FALSE";break;case"e":D+=C.w||C.v;break;case"d":D+='"'+(C.w||C.v)+'"';break;case"s":D+='"'+C.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return D}function p(C,O){O.forEach(function(I,M){var D="F;W"+(M+1)+" "+(M+1)+" ";I.hidden?D+="0":(typeof I.width=="number"&&!I.wpx&&(I.wpx=nh(I.width)),typeof I.wpx=="number"&&!I.wch&&(I.wch=sh(I.wpx)),typeof I.wch=="number"&&(D+=Math.round(I.wch))),D.charAt(D.length-1)!=" "&&C.push(D)})}function k(C,O){O.forEach(function(I,M){var D="F;";I.hidden?D+="M0;":I.hpt?D+="M"+20*I.hpt+";":I.hpx&&(D+="M"+20*ih(I.hpx)+";"),D.length>2&&C.push(D+"R"+(M+1))})}function N(C,O){var I=["ID;PWXL;N;E"],M=[],D=La(C["!ref"]),z,B=Array.isArray(C),U=`\r
`;I.push("P;PGeneral"),I.push("F;P0;DG0G8;M255"),C["!cols"]&&p(I,C["!cols"]),C["!rows"]&&k(I,C["!rows"]),I.push("B;Y"+(D.e.r-D.s.r+1)+";X"+(D.e.c-D.s.c+1)+";D"+[D.s.c,D.s.r,D.e.c,D.e.r].join(" "));for(var H=D.s.r;H<=D.e.r;++H)for(var q=D.s.c;q<=D.e.c;++q){var ne=ka({r:H,c:q});z=B?(C[H]||[])[q]:C[ne],!(!z||z.v==null&&(!z.f||z.F))&&M.push(v(z,C,H,q))}return I.join(U)+U+M.join(U)+U+"E"+U}return{to_workbook:g,to_sheet:f,from_sheet:N}})(),xT=(function(){function e(u,f){switch(f.type){case"base64":return r($o(u),f);case"binary":return r(u,f);case"buffer":return r(ha&&Buffer.isBuffer(u)?u.toString("binary"):cu(u),f);case"array":return r(Ah(u),f)}throw new Error("Unrecognized type "+f.type)}function r(u,f){for(var g=u.split(`
`),v=-1,p=-1,k=0,N=[];k!==g.length;++k){if(g[k].trim()==="BOT"){N[++v]=[],p=0;continue}if(!(v<0)){var C=g[k].trim().split(","),O=C[0],I=C[1];++k;for(var M=g[k]||"";(M.match(/["]/g)||[]).length&1&&k<g.length-1;)M+=`
`+g[++k];switch(M=M.trim(),+O){case-1:if(M==="BOT"){N[++v]=[],p=0;continue}else if(M!=="EOD")throw new Error("Unrecognized DIF special command "+M);break;case 0:M==="TRUE"?N[v][p]=!0:M==="FALSE"?N[v][p]=!1:isNaN(Vo(I))?isNaN(Z0(I).getDate())?N[v][p]=I:N[v][p]=Es(I):N[v][p]=Vo(I),++p;break;case 1:M=M.slice(1,M.length-1),M=M.replace(/""/g,'"'),M&&M.match(/^=".*"$/)&&(M=M.slice(2,-1)),N[v][p++]=M!==""?M:null;break}if(M==="EOD")break}}return f&&f.sheetRows&&(N=N.slice(0,f.sheetRows)),N}function t(u,f){return Id(e(u,f),f)}function n(u,f){return bc(t(u,f),f)}var o=(function(){var u=function(v,p,k,N,C){v.push(p),v.push(k+","+N),v.push('"'+C.replace(/"/g,'""')+'"')},f=function(v,p,k,N){v.push(p+","+k),v.push(p==1?'"'+N.replace(/"/g,'""')+'"':N)};return function(v){var p=[],k=La(v["!ref"]),N,C=Array.isArray(v);u(p,"TABLE",0,1,"sheetjs"),u(p,"VECTORS",0,k.e.r-k.s.r+1,""),u(p,"TUPLES",0,k.e.c-k.s.c+1,""),u(p,"DATA",0,0,"");for(var O=k.s.r;O<=k.e.r;++O){f(p,-1,0,"BOT");for(var I=k.s.c;I<=k.e.c;++I){var M=ka({r:O,c:I});if(N=C?(v[O]||[])[I]:v[M],!N){f(p,1,0,"");continue}switch(N.t){case"n":var D=N.w;!D&&N.v!=null&&(D=N.v),D==null?N.f&&!N.F?f(p,1,0,"="+N.f):f(p,1,0,""):f(p,0,D,"V");break;case"b":f(p,0,N.v?1:0,N.v?"TRUE":"FALSE");break;case"s":f(p,1,0,isNaN(N.v)?N.v:'="'+N.v+'"');break;case"d":N.w||(N.w=Al(N.z||rn[14],Vs(Es(N.v)))),f(p,0,N.w,"V");break;default:f(p,1,0,"")}}}f(p,-1,0,"EOD");var z=`\r
`,B=p.join(z);return B}})();return{to_workbook:n,to_sheet:t,from_sheet:o}})(),Fw=(function(){function e(N){return N.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,`
`)}function r(N){return N.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function t(N,C){for(var O=N.split(`
`),I=-1,M=-1,D=0,z=[];D!==O.length;++D){var B=O[D].trim().split(":");if(B[0]==="cell"){var U=Pn(B[1]);if(z.length<=U.r)for(I=z.length;I<=U.r;++I)z[I]||(z[I]=[]);switch(I=U.r,M=U.c,B[2]){case"t":z[I][M]=e(B[3]);break;case"v":z[I][M]=+B[3];break;case"vtf":var H=B[B.length-1];case"vtc":switch(B[3]){case"nl":z[I][M]=!!+B[4];break;default:z[I][M]=+B[4];break}B[2]=="vtf"&&(z[I][M]=[z[I][M],H])}}}return C&&C.sheetRows&&(z=z.slice(0,C.sheetRows)),z}function n(N,C){return Id(t(N,C),C)}function o(N,C){return bc(n(N,C),C)}var u=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
`),f=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(`
`)+`
`,g=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(`
`),v="--SocialCalcSpreadsheetControlSave--";function p(N){if(!N||!N["!ref"])return"";for(var C=[],O=[],I,M="",D=hi(N["!ref"]),z=Array.isArray(N),B=D.s.r;B<=D.e.r;++B)for(var U=D.s.c;U<=D.e.c;++U)if(M=ka({r:B,c:U}),I=z?(N[B]||[])[U]:N[M],!(!I||I.v==null||I.t==="z")){switch(O=["cell",M,"t"],I.t){case"s":case"str":O.push(r(I.v));break;case"n":I.f?(O[2]="vtf",O[3]="n",O[4]=I.v,O[5]=r(I.f)):(O[2]="v",O[3]=I.v);break;case"b":O[2]="vt"+(I.f?"f":"c"),O[3]="nl",O[4]=I.v?"1":"0",O[5]=r(I.f||(I.v?"TRUE":"FALSE"));break;case"d":var H=Vs(Es(I.v));O[2]="vtc",O[3]="nd",O[4]=""+H,O[5]=I.w||Al(I.z||rn[14],H);break;case"e":continue}C.push(O.join(":"))}return C.push("sheet:c:"+(D.e.c-D.s.c+1)+":r:"+(D.e.r-D.s.r+1)+":tvf:1"),C.push("valueformat:1:text-wiki"),C.join(`
`)}function k(N){return[u,f,g,f,p(N),v].join(`
`)}return{to_workbook:o,to_sheet:n,from_sheet:k}})(),pT=(function(){function e(k,N,C,O,I){I.raw?N[C][O]=k:k===""||(k==="TRUE"?N[C][O]=!0:k==="FALSE"?N[C][O]=!1:isNaN(Vo(k))?isNaN(Z0(k).getDate())?N[C][O]=k:N[C][O]=Es(k):N[C][O]=Vo(k))}function r(k,N){var C=N||{},O=[];if(!k||k.length===0)return O;for(var I=k.split(/[\r\n]/),M=I.length-1;M>=0&&I[M].length===0;)--M;for(var D=10,z=0,B=0;B<=M;++B)z=I[B].indexOf(" "),z==-1?z=I[B].length:z++,D=Math.max(D,z);for(B=0;B<=M;++B){O[B]=[];var U=0;for(e(I[B].slice(0,D).trim(),O,B,U,C),U=1;U<=(I[B].length-D)/10+1;++U)e(I[B].slice(D+(U-1)*10,D+U*10).trim(),O,B,U,C)}return C.sheetRows&&(O=O.slice(0,C.sheetRows)),O}var t={44:",",9:" ",59:";",124:"|"},n={44:3,9:2,59:1,124:0};function o(k){for(var N={},C=!1,O=0,I=0;O<k.length;++O)(I=k.charCodeAt(O))==34?C=!C:!C&&I in t&&(N[I]=(N[I]||0)+1);I=[];for(O in N)Object.prototype.hasOwnProperty.call(N,O)&&I.push([N[O],O]);if(!I.length){N=n;for(O in N)Object.prototype.hasOwnProperty.call(N,O)&&I.push([N[O],O])}return I.sort(function(M,D){return M[0]-D[0]||n[M[1]]-n[D[1]]}),t[I.pop()[1]]||44}function u(k,N){var C=N||{},O="",I=C.dense?[]:{},M={s:{c:0,r:0},e:{c:0,r:0}};k.slice(0,4)=="sep="?k.charCodeAt(5)==13&&k.charCodeAt(6)==10?(O=k.charAt(4),k=k.slice(7)):k.charCodeAt(5)==13||k.charCodeAt(5)==10?(O=k.charAt(4),k=k.slice(6)):O=o(k.slice(0,1024)):C&&C.FS?O=C.FS:O=o(k.slice(0,1024));var D=0,z=0,B=0,U=0,H=0,q=O.charCodeAt(0),ne=!1,V=0,J=k.charCodeAt(0);k=k.replace(/\r\n/mg,`
`);var Q=C.dateNF!=null?RE(C.dateNF):null;function Te(){var je=k.slice(U,H),me={};if(je.charAt(0)=='"'&&je.charAt(je.length-1)=='"'&&(je=je.slice(1,-1).replace(/""/g,'"')),je.length===0)me.t="z";else if(C.raw)me.t="s",me.v=je;else if(je.trim().length===0)me.t="s",me.v=je;else if(je.charCodeAt(0)==61)je.charCodeAt(1)==34&&je.charCodeAt(je.length-1)==34?(me.t="s",me.v=je.slice(2,-1).replace(/""/g,'"')):gA(je)?(me.t="n",me.f=je.slice(1)):(me.t="s",me.v=je);else if(je=="TRUE")me.t="b",me.v=!0;else if(je=="FALSE")me.t="b",me.v=!1;else if(!isNaN(B=Vo(je)))me.t="n",C.cellText!==!1&&(me.w=je),me.v=B;else if(!isNaN(Z0(je).getDate())||Q&&je.match(Q)){me.z=C.dateNF||rn[14];var Se=0;Q&&je.match(Q)&&(je=DE(je,C.dateNF,je.match(Q)||[]),Se=1),C.cellDates?(me.t="d",me.v=Es(je,Se)):(me.t="n",me.v=Vs(Es(je,Se))),C.cellText!==!1&&(me.w=Al(me.z,me.v instanceof Date?Vs(me.v):me.v)),C.cellNF||delete me.z}else me.t="s",me.v=je;if(me.t=="z"||(C.dense?(I[D]||(I[D]=[]),I[D][z]=me):I[ka({c:z,r:D})]=me),U=H+1,J=k.charCodeAt(U),M.e.c<z&&(M.e.c=z),M.e.r<D&&(M.e.r=D),V==q)++z;else if(z=0,++D,C.sheetRows&&C.sheetRows<=D)return!0}e:for(;H<k.length;++H)switch(V=k.charCodeAt(H)){case 34:J===34&&(ne=!ne);break;case q:case 10:case 13:if(!ne&&Te())break e;break}return H-U>0&&Te(),I["!ref"]=bn(M),I}function f(k,N){return!(N&&N.PRN)||N.FS||k.slice(0,4)=="sep="||k.indexOf(" ")>=0||k.indexOf(",")>=0||k.indexOf(";")>=0?u(k,N):Id(r(k,N),N)}function g(k,N){var C="",O=N.type=="string"?[0,0,0,0]:AO(k,N);switch(N.type){case"base64":C=$o(k);break;case"binary":C=k;break;case"buffer":N.codepage==65001?C=k.toString("utf8"):N.codepage&&typeof $f!="undefined"||(C=ha&&Buffer.isBuffer(k)?k.toString("binary"):cu(k));break;case"array":C=Ah(k);break;case"string":C=k;break;default:throw new Error("Unrecognized type "+N.type)}return O[0]==239&&O[1]==187&&O[2]==191?C=F0(C.slice(3)):N.type!="string"&&N.type!="buffer"&&N.codepage==65001?C=F0(C):N.type=="binary",C.slice(0,19)=="socialcalc:version:"?Fw.to_sheet(N.type=="string"?C:F0(C),N):f(C,N)}function v(k,N){return bc(g(k,N),N)}function p(k){for(var N=[],C=La(k["!ref"]),O,I=Array.isArray(k),M=C.s.r;M<=C.e.r;++M){for(var D=[],z=C.s.c;z<=C.e.c;++z){var B=ka({r:M,c:z});if(O=I?(k[M]||[])[z]:k[B],!O||O.v==null){D.push(" ");continue}for(var U=(O.w||(qo(O),O.w)||"").slice(0,10);U.length<10;)U+=" ";D.push(U+(z===0?" ":""))}N.push(D.join(""))}return N.join(`
`)}return{to_workbook:v,to_sheet:g,from_sheet:p}})(),av=(function(){function e(W,ae,se){if(W){li(W,W.l||0);for(var he=se.Enum||_e;W.l<W.length;){var pe=W.read_shift(2),Je=he[pe]||he[65535],Fe=W.read_shift(2),ft=W.l+Fe,ot=Je.f&&Je.f(W,Fe,se);if(W.l=ft,ae(ot,Je,pe))return}}}function r(W,ae){switch(ae.type){case"base64":return t(Gi($o(W)),ae);case"binary":return t(Gi(W),ae);case"buffer":case"array":return t(W,ae)}throw"Unsupported type "+ae.type}function t(W,ae){if(!W)return W;var se=ae||{},he=se.dense?[]:{},pe="Sheet1",Je="",Fe=0,ft={},ot=[],Lt=[],zt={s:{r:0,c:0},e:{r:0,c:0}},Ht=se.sheetRows||0;if(W[2]==0&&(W[3]==8||W[3]==9)&&W.length>=16&&W[14]==5&&W[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(W[2]==2)se.Enum=_e,e(W,function(gt,ve,Le){switch(Le){case 0:se.vers=gt,gt>=4096&&(se.qpro=!0);break;case 6:zt=gt;break;case 204:gt&&(Je=gt);break;case 222:Je=gt;break;case 15:case 51:se.qpro||(gt[1].v=gt[1].v.slice(1));case 13:case 14:case 16:Le==14&&(gt[2]&112)==112&&(gt[2]&15)>1&&(gt[2]&15)<15&&(gt[1].z=se.dateNF||rn[14],se.cellDates&&(gt[1].t="d",gt[1].v=tw(gt[1].v))),se.qpro&&gt[3]>Fe&&(he["!ref"]=bn(zt),ft[pe]=he,ot.push(pe),he=se.dense?[]:{},zt={s:{r:0,c:0},e:{r:0,c:0}},Fe=gt[3],pe=Je||"Sheet"+(Fe+1),Je="");var ut=se.dense?(he[gt[0].r]||[])[gt[0].c]:he[ka(gt[0])];if(ut){ut.t=gt[1].t,ut.v=gt[1].v,gt[1].z!=null&&(ut.z=gt[1].z),gt[1].f!=null&&(ut.f=gt[1].f);break}se.dense?(he[gt[0].r]||(he[gt[0].r]=[]),he[gt[0].r][gt[0].c]=gt[1]):he[ka(gt[0])]=gt[1];break}},se);else if(W[2]==26||W[2]==14)se.Enum=K,W[2]==14&&(se.qpro=!0,W.l=0),e(W,function(gt,ve,Le){switch(Le){case 204:pe=gt;break;case 22:gt[1].v=gt[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(gt[3]>Fe&&(he["!ref"]=bn(zt),ft[pe]=he,ot.push(pe),he=se.dense?[]:{},zt={s:{r:0,c:0},e:{r:0,c:0}},Fe=gt[3],pe="Sheet"+(Fe+1)),Ht>0&&gt[0].r>=Ht)break;se.dense?(he[gt[0].r]||(he[gt[0].r]=[]),he[gt[0].r][gt[0].c]=gt[1]):he[ka(gt[0])]=gt[1],zt.e.c<gt[0].c&&(zt.e.c=gt[0].c),zt.e.r<gt[0].r&&(zt.e.r=gt[0].r);break;case 27:gt[14e3]&&(Lt[gt[14e3][0]]=gt[14e3][1]);break;case 1537:Lt[gt[0]]=gt[1],gt[0]==Fe&&(pe=gt[1]);break}},se);else throw new Error("Unrecognized LOTUS BOF "+W[2]);if(he["!ref"]=bn(zt),ft[Je||pe]=he,ot.push(Je||pe),!Lt.length)return{SheetNames:ot,Sheets:ft};for(var ht={},tr=[],Kt=0;Kt<Lt.length;++Kt)ft[ot[Kt]]?(tr.push(Lt[Kt]||ot[Kt]),ht[Lt[Kt]]=ft[Lt[Kt]]||ft[ot[Kt]]):(tr.push(Lt[Kt]),ht[Lt[Kt]]={"!ref":"A1"});return{SheetNames:tr,Sheets:ht}}function n(W,ae){var se=ae||{};if(+se.codepage>=0&&X0(+se.codepage),se.type=="string")throw new Error("Cannot write WK1 to JS string");var he=Ws(),pe=La(W["!ref"]),Je=Array.isArray(W),Fe=[];Xt(he,0,u(1030)),Xt(he,6,v(pe));for(var ft=Math.min(pe.e.r,8191),ot=pe.s.r;ot<=ft;++ot)for(var Lt=ts(ot),zt=pe.s.c;zt<=pe.e.c;++zt){ot===pe.s.r&&(Fe[zt]=hs(zt));var Ht=Fe[zt]+Lt,ht=Je?(W[ot]||[])[zt]:W[Ht];if(!(!ht||ht.t=="z"))if(ht.t=="n")(ht.v|0)==ht.v&&ht.v>=-32768&&ht.v<=32767?Xt(he,13,O(ot,zt,ht.v)):Xt(he,14,M(ot,zt,ht.v));else{var tr=qo(ht);Xt(he,15,N(ot,zt,tr.slice(0,239)))}}return Xt(he,1),he.end()}function o(W,ae){var se=ae||{};if(+se.codepage>=0&&X0(+se.codepage),se.type=="string")throw new Error("Cannot write WK3 to JS string");var he=Ws();Xt(he,0,f(W));for(var pe=0,Je=0;pe<W.SheetNames.length;++pe)(W.Sheets[W.SheetNames[pe]]||{})["!ref"]&&Xt(he,27,Ae(W.SheetNames[pe],Je++));var Fe=0;for(pe=0;pe<W.SheetNames.length;++pe){var ft=W.Sheets[W.SheetNames[pe]];if(!(!ft||!ft["!ref"])){for(var ot=La(ft["!ref"]),Lt=Array.isArray(ft),zt=[],Ht=Math.min(ot.e.r,8191),ht=ot.s.r;ht<=Ht;++ht)for(var tr=ts(ht),Kt=ot.s.c;Kt<=ot.e.c;++Kt){ht===ot.s.r&&(zt[Kt]=hs(Kt));var gt=zt[Kt]+tr,ve=Lt?(ft[ht]||[])[Kt]:ft[gt];if(!(!ve||ve.t=="z"))if(ve.t=="n")Xt(he,23,Te(ht,Kt,Fe,ve.v));else{var Le=qo(ve);Xt(he,22,V(ht,Kt,Fe,Le.slice(0,239)))}}++Fe}}return Xt(he,1),he.end()}function u(W){var ae=xt(2);return ae.write_shift(2,W),ae}function f(W){var ae=xt(26);ae.write_shift(2,4096),ae.write_shift(2,4),ae.write_shift(4,0);for(var se=0,he=0,pe=0,Je=0;Je<W.SheetNames.length;++Je){var Fe=W.SheetNames[Je],ft=W.Sheets[Fe];if(!(!ft||!ft["!ref"])){++pe;var ot=hi(ft["!ref"]);se<ot.e.r&&(se=ot.e.r),he<ot.e.c&&(he=ot.e.c)}}return se>8191&&(se=8191),ae.write_shift(2,se),ae.write_shift(1,pe),ae.write_shift(1,he),ae.write_shift(2,0),ae.write_shift(2,0),ae.write_shift(1,1),ae.write_shift(1,2),ae.write_shift(4,0),ae.write_shift(4,0),ae}function g(W,ae,se){var he={s:{c:0,r:0},e:{c:0,r:0}};return ae==8&&se.qpro?(he.s.c=W.read_shift(1),W.l++,he.s.r=W.read_shift(2),he.e.c=W.read_shift(1),W.l++,he.e.r=W.read_shift(2),he):(he.s.c=W.read_shift(2),he.s.r=W.read_shift(2),ae==12&&se.qpro&&(W.l+=2),he.e.c=W.read_shift(2),he.e.r=W.read_shift(2),ae==12&&se.qpro&&(W.l+=2),he.s.c==65535&&(he.s.c=he.e.c=he.s.r=he.e.r=0),he)}function v(W){var ae=xt(8);return ae.write_shift(2,W.s.c),ae.write_shift(2,W.s.r),ae.write_shift(2,W.e.c),ae.write_shift(2,W.e.r),ae}function p(W,ae,se){var he=[{c:0,r:0},{t:"n",v:0},0,0];return se.qpro&&se.vers!=20768?(he[0].c=W.read_shift(1),he[3]=W.read_shift(1),he[0].r=W.read_shift(2),W.l+=2):(he[2]=W.read_shift(1),he[0].c=W.read_shift(2),he[0].r=W.read_shift(2)),he}function k(W,ae,se){var he=W.l+ae,pe=p(W,ae,se);if(pe[1].t="s",se.vers==20768){W.l++;var Je=W.read_shift(1);return pe[1].v=W.read_shift(Je,"utf8"),pe}return se.qpro&&W.l++,pe[1].v=W.read_shift(he-W.l,"cstr"),pe}function N(W,ae,se){var he=xt(7+se.length);he.write_shift(1,255),he.write_shift(2,ae),he.write_shift(2,W),he.write_shift(1,39);for(var pe=0;pe<he.length;++pe){var Je=se.charCodeAt(pe);he.write_shift(1,Je>=128?95:Je)}return he.write_shift(1,0),he}function C(W,ae,se){var he=p(W,ae,se);return he[1].v=W.read_shift(2,"i"),he}function O(W,ae,se){var he=xt(7);return he.write_shift(1,255),he.write_shift(2,ae),he.write_shift(2,W),he.write_shift(2,se,"i"),he}function I(W,ae,se){var he=p(W,ae,se);return he[1].v=W.read_shift(8,"f"),he}function M(W,ae,se){var he=xt(13);return he.write_shift(1,255),he.write_shift(2,ae),he.write_shift(2,W),he.write_shift(8,se,"f"),he}function D(W,ae,se){var he=W.l+ae,pe=p(W,ae,se);if(pe[1].v=W.read_shift(8,"f"),se.qpro)W.l=he;else{var Je=W.read_shift(2);H(W.slice(W.l,W.l+Je),pe),W.l+=Je}return pe}function z(W,ae,se){var he=ae&32768;return ae&=-32769,ae=(he?W:0)+(ae>=8192?ae-16384:ae),(he?"":"$")+(se?hs(ae):ts(ae))}var B={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]},U=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function H(W,ae){li(W,0);for(var se=[],he=0,pe="",Je="",Fe="",ft="";W.l<W.length;){var ot=W[W.l++];switch(ot){case 0:se.push(W.read_shift(8,"f"));break;case 1:Je=z(ae[0].c,W.read_shift(2),!0),pe=z(ae[0].r,W.read_shift(2),!1),se.push(Je+pe);break;case 2:{var Lt=z(ae[0].c,W.read_shift(2),!0),zt=z(ae[0].r,W.read_shift(2),!1);Je=z(ae[0].c,W.read_shift(2),!0),pe=z(ae[0].r,W.read_shift(2),!1),se.push(Lt+zt+":"+Je+pe)}break;case 3:if(W.l<W.length){console.error("WK1 premature formula end");return}break;case 4:se.push("("+se.pop()+")");break;case 5:se.push(W.read_shift(2));break;case 6:{for(var Ht="";ot=W[W.l++];)Ht+=String.fromCharCode(ot);se.push('"'+Ht.replace(/"/g,'""')+'"')}break;case 8:se.push("-"+se.pop());break;case 23:se.push("+"+se.pop());break;case 22:se.push("NOT("+se.pop()+")");break;case 20:case 21:ft=se.pop(),Fe=se.pop(),se.push(["AND","OR"][ot-20]+"("+Fe+","+ft+")");break;default:if(ot<32&&U[ot])ft=se.pop(),Fe=se.pop(),se.push(Fe+U[ot]+ft);else if(B[ot]){if(he=B[ot][1],he==69&&(he=W[W.l++]),he>se.length){console.error("WK1 bad formula parse 0x"+ot.toString(16)+":|"+se.join("|")+"|");return}var ht=se.slice(-he);se.length-=he,se.push(B[ot][0]+"("+ht.join(",")+")")}else return ot<=7?console.error("WK1 invalid opcode "+ot.toString(16)):ot<=24?console.error("WK1 unsupported op "+ot.toString(16)):ot<=30?console.error("WK1 invalid opcode "+ot.toString(16)):ot<=115?console.error("WK1 unsupported function opcode "+ot.toString(16)):console.error("WK1 unrecognized opcode "+ot.toString(16))}}se.length==1?ae[1].f=""+se[0]:console.error("WK1 bad formula parse |"+se.join("|")+"|")}function q(W){var ae=[{c:0,r:0},{t:"n",v:0},0];return ae[0].r=W.read_shift(2),ae[3]=W[W.l++],ae[0].c=W[W.l++],ae}function ne(W,ae){var se=q(W);return se[1].t="s",se[1].v=W.read_shift(ae-4,"cstr"),se}function V(W,ae,se,he){var pe=xt(6+he.length);pe.write_shift(2,W),pe.write_shift(1,se),pe.write_shift(1,ae),pe.write_shift(1,39);for(var Je=0;Je<he.length;++Je){var Fe=he.charCodeAt(Je);pe.write_shift(1,Fe>=128?95:Fe)}return pe.write_shift(1,0),pe}function J(W,ae){var se=q(W);se[1].v=W.read_shift(2);var he=se[1].v>>1;if(se[1].v&1)switch(he&7){case 0:he=(he>>3)*5e3;break;case 1:he=(he>>3)*500;break;case 2:he=(he>>3)/20;break;case 3:he=(he>>3)/200;break;case 4:he=(he>>3)/2e3;break;case 5:he=(he>>3)/2e4;break;case 6:he=(he>>3)/16;break;case 7:he=(he>>3)/64;break}return se[1].v=he,se}function Q(W,ae){var se=q(W),he=W.read_shift(4),pe=W.read_shift(4),Je=W.read_shift(2);if(Je==65535)return he===0&&pe===3221225472?(se[1].t="e",se[1].v=15):he===0&&pe===3489660928?(se[1].t="e",se[1].v=42):se[1].v=0,se;var Fe=Je&32768;return Je=(Je&32767)-16446,se[1].v=(1-Fe*2)*(pe*Math.pow(2,Je+32)+he*Math.pow(2,Je)),se}function Te(W,ae,se,he){var pe=xt(14);if(pe.write_shift(2,W),pe.write_shift(1,se),pe.write_shift(1,ae),he==0)return pe.write_shift(4,0),pe.write_shift(4,0),pe.write_shift(2,65535),pe;var Je=0,Fe=0,ft=0,ot=0;return he<0&&(Je=1,he=-he),Fe=Math.log2(he)|0,he/=Math.pow(2,Fe-31),ot=he>>>0,(ot&2147483648)==0&&(he/=2,++Fe,ot=he>>>0),he-=ot,ot|=2147483648,ot>>>=0,he*=Math.pow(2,32),ft=he>>>0,pe.write_shift(4,ft),pe.write_shift(4,ot),Fe+=16383+(Je?32768:0),pe.write_shift(2,Fe),pe}function je(W,ae){var se=Q(W);return W.l+=ae-14,se}function me(W,ae){var se=q(W),he=W.read_shift(4);return se[1].v=he>>6,se}function Se(W,ae){var se=q(W),he=W.read_shift(8,"f");return se[1].v=he,se}function Oe(W,ae){var se=Se(W);return W.l+=ae-10,se}function ue(W,ae){return W[W.l+ae-1]==0?W.read_shift(ae,"cstr"):""}function be(W,ae){var se=W[W.l++];se>ae-1&&(se=ae-1);for(var he="";he.length<se;)he+=String.fromCharCode(W[W.l++]);return he}function re(W,ae,se){if(!(!se.qpro||ae<21)){var he=W.read_shift(1);W.l+=17,W.l+=1,W.l+=2;var pe=W.read_shift(ae-21,"cstr");return[he,pe]}}function de(W,ae){for(var se={},he=W.l+ae;W.l<he;){var pe=W.read_shift(2);if(pe==14e3){for(se[pe]=[0,""],se[pe][0]=W.read_shift(2);W[W.l];)se[pe][1]+=String.fromCharCode(W[W.l]),W.l++;W.l++}}return se}function Ae(W,ae){var se=xt(5+W.length);se.write_shift(2,14e3),se.write_shift(2,ae);for(var he=0;he<W.length;++he){var pe=W.charCodeAt(he);se[se.l++]=pe>127?95:pe}return se[se.l++]=0,se}var _e={0:{n:"BOF",f:Rw},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f:g},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:C},14:{n:"NUMBER",f:I},15:{n:"LABEL",f:k},16:{n:"FORMULA",f:D},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:k},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:ue},222:{n:"SHEETNAMELP",f:be},65535:{n:""}},K={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:ne},23:{n:"NUMBER17",f:Q},24:{n:"NUMBER18",f:J},25:{n:"FORMULA19",f:je},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:de},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:me},38:{n:"??"},39:{n:"NUMBER27",f:Se},40:{n:"FORMULA28",f:Oe},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:ue},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:re},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:n,book_to_wk3:o,to_workbook:r}})(),yT=/^\s|\s$|[\t\n\r]/;function Bw(e,r){if(!r.bookSST)return"";var t=[vn];t[t.length]=Vt("sst",null,{xmlns:Dd[0],count:e.Count,uniqueCount:e.Unique});for(var n=0;n!=e.length;++n)if(e[n]!=null){var o=e[n],u="<si>";o.r?u+=o.r:(u+="<t",o.t||(o.t=""),o.t.match(yT)&&(u+=' xml:space="preserve"'),u+=">"+wa(o.t)+"</t>"),u+="</si>",t[t.length]=u}return t.length>2&&(t[t.length]="</sst>",t[1]=t[1].replace("/>",">")),t.join("")}function bT(e){return[e.read_shift(4),e.read_shift(4)]}function vT(e,r){return r||(r=xt(8)),r.write_shift(4,e.Count),r.write_shift(4,e.Unique),r}var _T=uC;function wT(e){var r=Ws();Dt(r,159,vT(e));for(var t=0;t<e.length;++t)Dt(r,19,_T(e[t]));return Dt(r,160),r.end()}function kT(e){for(var r=[],t=e.split(""),n=0;n<t.length;++n)r[n]=t[n].charCodeAt(0);return r}function Uw(e){var r=0,t,n=kT(e),o=n.length+1,u,f,g,v,p;for(t=mc(o),t[0]=n.length,u=1;u!=o;++u)t[u]=n[u-1];for(u=o-1;u>=0;--u)f=t[u],g=(r&16384)===0?0:1,v=r<<1&32767,p=g|v,r=p^f;return r^52811}var NT=(function(){function e(o,u){switch(u.type){case"base64":return r($o(o),u);case"binary":return r(o,u);case"buffer":return r(ha&&Buffer.isBuffer(o)?o.toString("binary"):cu(o),u);case"array":return r(Ah(o),u)}throw new Error("Unrecognized type "+u.type)}function r(o,u){var f=u||{},g=f.dense?[]:{},v=o.match(/\\trowd.*?\\row\b/g);if(!v.length)throw new Error("RTF missing table");var p={s:{c:0,r:0},e:{c:0,r:v.length-1}};return v.forEach(function(k,N){Array.isArray(g)&&(g[N]=[]);for(var C=/\\\w+\b/g,O=0,I,M=-1;I=C.exec(k);){switch(I[0]){case"\\cell":var D=k.slice(O,C.lastIndex-I[0].length);if(D[0]==" "&&(D=D.slice(1)),++M,D.length){var z={v:D,t:"s"};Array.isArray(g)?g[N][M]=z:g[ka({r:N,c:M})]=z}break}O=C.lastIndex}M>p.e.c&&(p.e.c=M)}),g["!ref"]=bn(p),g}function t(o,u){return bc(e(o,u),u)}function n(o){for(var u=["{\\rtf1\\ansi"],f=La(o["!ref"]),g,v=Array.isArray(o),p=f.s.r;p<=f.e.r;++p){u.push("\\trowd\\trautofit1");for(var k=f.s.c;k<=f.e.c;++k)u.push("\\cellx"+(k+1));for(u.push("\\pard\\intbl"),k=f.s.c;k<=f.e.c;++k){var N=ka({r:p,c:k});g=v?(o[p]||[])[k]:o[N],!(!g||g.v==null&&(!g.f||g.F))&&(u.push(" "+(g.w||(qo(g),g.w))),u.push("\\cell"))}u.push("\\pard\\intbl\\row")}return u.join("")+"}"}return{to_workbook:t,to_sheet:e,from_sheet:n}})();function nv(e){for(var r=0,t=1;r!=3;++r)t=t*256+(e[r]>255?255:e[r]<0?0:e[r]);return t.toString(16).toUpperCase().slice(1)}var ST=6,Go=ST;function nh(e){return Math.floor((e+Math.round(128/Go)/256)*Go)}function sh(e){return Math.floor((e-5)/Go*100+.5)/100}function bx(e){return Math.round((e*Go+5)/Go*256)/256}function ap(e){e.width?(e.wpx=nh(e.width),e.wch=sh(e.wpx),e.MDW=Go):e.wpx?(e.wch=sh(e.wpx),e.width=bx(e.wch),e.MDW=Go):typeof e.wch=="number"&&(e.width=bx(e.wch),e.wpx=nh(e.width),e.MDW=Go),e.customWidth&&delete e.customWidth}var ET=96,zw=ET;function ih(e){return e*96/zw}function Hw(e){return e*zw/96}function CT(e){var r=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(t){for(var n=t[0];n<=t[1];++n)e[n]!=null&&(r[r.length]=Vt("numFmt",null,{numFmtId:n,formatCode:wa(e[n])}))}),r.length===1?"":(r[r.length]="</numFmts>",r[0]=Vt("numFmts",null,{count:r.length-2}).replace("/>",">"),r.join(""))}function TT(e){var r=[];return r[r.length]=Vt("cellXfs",null),e.forEach(function(t){r[r.length]=Vt("xf",null,t)}),r[r.length]="</cellXfs>",r.length===2?"":(r[0]=Vt("cellXfs",null,{count:r.length-2}).replace("/>",">"),r.join(""))}function Ww(e,r){var t=[vn,Vt("styleSheet",null,{xmlns:Dd[0],"xmlns:vt":Ln.vt})],n;return e.SSF&&(n=CT(e.SSF))!=null&&(t[t.length]=n),t[t.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',t[t.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',t[t.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',t[t.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(n=TT(r.cellXfs))&&(t[t.length]=n),t[t.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',t[t.length]='<dxfs count="0"/>',t[t.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',t.length>2&&(t[t.length]="</styleSheet>",t[1]=t[1].replace("/>",">")),t.join("")}function AT(e,r){var t=e.read_shift(2),n=ms(e);return[t,n]}function jT(e,r,t){t||(t=xt(6+4*r.length)),t.write_shift(2,e),Fn(r,t);var n=t.length>t.l?t.slice(0,t.l):t;return t.l==null&&(t.l=t.length),n}function OT(e,r,t){var n={};n.sz=e.read_shift(2)/20;var o=yC(e);o.fItalic&&(n.italic=1),o.fCondense&&(n.condense=1),o.fExtend&&(n.extend=1),o.fShadow&&(n.shadow=1),o.fOutline&&(n.outline=1),o.fStrikeout&&(n.strike=1);var u=e.read_shift(2);switch(u===700&&(n.bold=1),e.read_shift(2)){case 1:n.vertAlign="superscript";break;case 2:n.vertAlign="subscript";break}var f=e.read_shift(1);f!=0&&(n.underline=f);var g=e.read_shift(1);g>0&&(n.family=g);var v=e.read_shift(1);switch(v>0&&(n.charset=v),e.l++,n.color=pC(e),e.read_shift(1)){case 1:n.scheme="major";break;case 2:n.scheme="minor";break}return n.name=ms(e),n}function MT(e,r){r||(r=xt(153)),r.write_shift(2,e.sz*20),bC(e,r),r.write_shift(2,e.bold?700:400);var t=0;e.vertAlign=="superscript"?t=1:e.vertAlign=="subscript"&&(t=2),r.write_shift(2,t),r.write_shift(1,e.underline||0),r.write_shift(1,e.family||0),r.write_shift(1,e.charset||0),r.write_shift(1,0),rh(e.color,r);var n=0;return n=2,r.write_shift(1,n),Fn(e.name,r),r.length>r.l?r.slice(0,r.l):r}var RT=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],Gg,DT=po;function sv(e,r){r||(r=xt(84)),Gg||(Gg=Gx(RT));var t=Gg[e.patternType];t==null&&(t=40),r.write_shift(4,t);var n=0;if(t!=40)for(rh({auto:1},r),rh({auto:1},r);n<12;++n)r.write_shift(4,0);else{for(;n<4;++n)r.write_shift(4,0);for(;n<12;++n)r.write_shift(4,0)}return r.length>r.l?r.slice(0,r.l):r}function IT(e,r){var t=e.l+r,n=e.read_shift(2),o=e.read_shift(2);return e.l=t,{ixfe:n,numFmtId:o}}function Vw(e,r,t){t||(t=xt(16)),t.write_shift(2,r||0),t.write_shift(2,e.numFmtId||0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(1,0),t.write_shift(1,0);var n=0;return t.write_shift(1,n),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(1,0),t}function T0(e,r){return r||(r=xt(10)),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(4,0),r.write_shift(4,0),r}var LT=po;function PT(e,r){return r||(r=xt(51)),r.write_shift(1,0),T0(null,r),T0(null,r),T0(null,r),T0(null,r),T0(null,r),r.length>r.l?r.slice(0,r.l):r}function FT(e,r){return r||(r=xt(52)),r.write_shift(4,e.xfId),r.write_shift(2,1),r.write_shift(1,0),r.write_shift(1,0),th(e.name||"",r),r.length>r.l?r.slice(0,r.l):r}function BT(e,r,t){var n=xt(2052);return n.write_shift(4,e),th(r,n),th(t,n),n.length>n.l?n.slice(0,n.l):n}function UT(e,r){if(r){var t=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var o=n[0];o<=n[1];++o)r[o]!=null&&++t}),t!=0&&(Dt(e,615,Zi(t)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var o=n[0];o<=n[1];++o)r[o]!=null&&Dt(e,44,jT(o,r[o]))}),Dt(e,616))}}function zT(e){var r=1;Dt(e,611,Zi(r)),Dt(e,43,MT({sz:12,color:{theme:1},name:"Calibri",family:2})),Dt(e,612)}function HT(e){var r=2;Dt(e,603,Zi(r)),Dt(e,45,sv({patternType:"none"})),Dt(e,45,sv({patternType:"gray125"})),Dt(e,604)}function WT(e){var r=1;Dt(e,613,Zi(r)),Dt(e,46,PT()),Dt(e,614)}function VT(e){var r=1;Dt(e,626,Zi(r)),Dt(e,47,Vw({numFmtId:0},65535)),Dt(e,627)}function GT(e,r){Dt(e,617,Zi(r.length)),r.forEach(function(t){Dt(e,47,Vw(t,0))}),Dt(e,618)}function XT(e){var r=1;Dt(e,619,Zi(r)),Dt(e,48,FT({xfId:0,name:"Normal"})),Dt(e,620)}function YT(e){var r=0;Dt(e,505,Zi(r)),Dt(e,506)}function ZT(e){var r=0;Dt(e,508,BT(r,"TableStyleMedium9","PivotStyleMedium4")),Dt(e,509)}function $T(e,r){var t=Ws();return Dt(t,278),UT(t,e.SSF),zT(t),HT(t),WT(t),VT(t),GT(t,r.cellXfs),XT(t),YT(t),ZT(t),Dt(t,279),t.end()}function Gw(e,r){if(r&&r.themeXLSX)return r.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var t=[vn];return t[t.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',t[t.length]="<a:themeElements>",t[t.length]='<a:clrScheme name="Office">',t[t.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',t[t.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',t[t.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',t[t.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',t[t.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',t[t.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',t[t.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',t[t.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',t[t.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',t[t.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',t[t.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',t[t.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',t[t.length]="</a:clrScheme>",t[t.length]='<a:fontScheme name="Office">',t[t.length]="<a:majorFont>",t[t.length]='<a:latin typeface="Cambria"/>',t[t.length]='<a:ea typeface=""/>',t[t.length]='<a:cs typeface=""/>',t[t.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',t[t.length]='<a:font script="Hang" typeface="맑은 고딕"/>',t[t.length]='<a:font script="Hans" typeface="宋体"/>',t[t.length]='<a:font script="Hant" typeface="新細明體"/>',t[t.length]='<a:font script="Arab" typeface="Times New Roman"/>',t[t.length]='<a:font script="Hebr" typeface="Times New Roman"/>',t[t.length]='<a:font script="Thai" typeface="Tahoma"/>',t[t.length]='<a:font script="Ethi" typeface="Nyala"/>',t[t.length]='<a:font script="Beng" typeface="Vrinda"/>',t[t.length]='<a:font script="Gujr" typeface="Shruti"/>',t[t.length]='<a:font script="Khmr" typeface="MoolBoran"/>',t[t.length]='<a:font script="Knda" typeface="Tunga"/>',t[t.length]='<a:font script="Guru" typeface="Raavi"/>',t[t.length]='<a:font script="Cans" typeface="Euphemia"/>',t[t.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',t[t.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',t[t.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',t[t.length]='<a:font script="Thaa" typeface="MV Boli"/>',t[t.length]='<a:font script="Deva" typeface="Mangal"/>',t[t.length]='<a:font script="Telu" typeface="Gautami"/>',t[t.length]='<a:font script="Taml" typeface="Latha"/>',t[t.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',t[t.length]='<a:font script="Orya" typeface="Kalinga"/>',t[t.length]='<a:font script="Mlym" typeface="Kartika"/>',t[t.length]='<a:font script="Laoo" typeface="DokChampa"/>',t[t.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',t[t.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',t[t.length]='<a:font script="Viet" typeface="Times New Roman"/>',t[t.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',t[t.length]='<a:font script="Geor" typeface="Sylfaen"/>',t[t.length]="</a:majorFont>",t[t.length]="<a:minorFont>",t[t.length]='<a:latin typeface="Calibri"/>',t[t.length]='<a:ea typeface=""/>',t[t.length]='<a:cs typeface=""/>',t[t.length]='<a:font script="Jpan" typeface=" Pゴシック"/>',t[t.length]='<a:font script="Hang" typeface="맑은 고딕"/>',t[t.length]='<a:font script="Hans" typeface="宋体"/>',t[t.length]='<a:font script="Hant" typeface="新細明體"/>',t[t.length]='<a:font script="Arab" typeface="Arial"/>',t[t.length]='<a:font script="Hebr" typeface="Arial"/>',t[t.length]='<a:font script="Thai" typeface="Tahoma"/>',t[t.length]='<a:font script="Ethi" typeface="Nyala"/>',t[t.length]='<a:font script="Beng" typeface="Vrinda"/>',t[t.length]='<a:font script="Gujr" typeface="Shruti"/>',t[t.length]='<a:font script="Khmr" typeface="DaunPenh"/>',t[t.length]='<a:font script="Knda" typeface="Tunga"/>',t[t.length]='<a:font script="Guru" typeface="Raavi"/>',t[t.length]='<a:font script="Cans" typeface="Euphemia"/>',t[t.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',t[t.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',t[t.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',t[t.length]='<a:font script="Thaa" typeface="MV Boli"/>',t[t.length]='<a:font script="Deva" typeface="Mangal"/>',t[t.length]='<a:font script="Telu" typeface="Gautami"/>',t[t.length]='<a:font script="Taml" typeface="Latha"/>',t[t.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',t[t.length]='<a:font script="Orya" typeface="Kalinga"/>',t[t.length]='<a:font script="Mlym" typeface="Kartika"/>',t[t.length]='<a:font script="Laoo" typeface="DokChampa"/>',t[t.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',t[t.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',t[t.length]='<a:font script="Viet" typeface="Arial"/>',t[t.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',t[t.length]='<a:font script="Geor" typeface="Sylfaen"/>',t[t.length]="</a:minorFont>",t[t.length]="</a:fontScheme>",t[t.length]='<a:fmtScheme name="Office">',t[t.length]="<a:fillStyleLst>",t[t.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',t[t.length]='<a:gradFill rotWithShape="1">',t[t.length]="<a:gsLst>",t[t.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',t[t.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',t[t.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',t[t.length]="</a:gsLst>",t[t.length]='<a:lin ang="16200000" scaled="1"/>',t[t.length]="</a:gradFill>",t[t.length]='<a:gradFill rotWithShape="1">',t[t.length]="<a:gsLst>",t[t.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>',t[t.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>',t[t.length]="</a:gsLst>",t[t.length]='<a:lin ang="16200000" scaled="0"/>',t[t.length]="</a:gradFill>",t[t.length]="</a:fillStyleLst>",t[t.length]="<a:lnStyleLst>",t[t.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>',t[t.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>',t[t.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>',t[t.length]="</a:lnStyleLst>",t[t.length]="<a:effectStyleLst>",t[t.length]="<a:effectStyle>",t[t.length]="<a:effectLst>",t[t.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',t[t.length]="</a:effectLst>",t[t.length]="</a:effectStyle>",t[t.length]="<a:effectStyle>",t[t.length]="<a:effectLst>",t[t.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',t[t.length]="</a:effectLst>",t[t.length]="</a:effectStyle>",t[t.length]="<a:effectStyle>",t[t.length]="<a:effectLst>",t[t.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',t[t.length]="</a:effectLst>",t[t.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>',t[t.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',t[t.length]="</a:effectStyle>",t[t.length]="</a:effectStyleLst>",t[t.length]="<a:bgFillStyleLst>",t[t.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',t[t.length]='<a:gradFill rotWithShape="1">',t[t.length]="<a:gsLst>",t[t.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',t[t.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>',t[t.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',t[t.length]="</a:gsLst>",t[t.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',t[t.length]="</a:gradFill>",t[t.length]='<a:gradFill rotWithShape="1">',t[t.length]="<a:gsLst>",t[t.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',t[t.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',t[t.length]="</a:gsLst>",t[t.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',t[t.length]="</a:gradFill>",t[t.length]="</a:bgFillStyleLst>",t[t.length]="</a:fmtScheme>",t[t.length]="</a:themeElements>",t[t.length]="<a:objectDefaults>",t[t.length]="<a:spDef>",t[t.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>',t[t.length]="</a:spDef>",t[t.length]="<a:lnDef>",t[t.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>',t[t.length]="</a:lnDef>",t[t.length]="</a:objectDefaults>",t[t.length]="<a:extraClrSchemeLst/>",t[t.length]="</a:theme>",t.join("")}function qT(e,r){return{flags:e.read_shift(4),version:e.read_shift(4),name:ms(e)}}function KT(e){var r=xt(12+2*e.name.length);return r.write_shift(4,e.flags),r.write_shift(4,e.version),Fn(e.name,r),r.slice(0,r.l)}function JT(e){for(var r=[],t=e.read_shift(4);t-- >0;)r.push([e.read_shift(4),e.read_shift(4)]);return r}function QT(e){var r=xt(4+8*e.length);r.write_shift(4,e.length);for(var t=0;t<e.length;++t)r.write_shift(4,e[t][0]),r.write_shift(4,e[t][1]);return r}function eA(e,r){var t=xt(8+2*r.length);return t.write_shift(4,e),Fn(r,t),t.slice(0,t.l)}function tA(e){return e.l+=4,e.read_shift(4)!=0}function rA(e,r){var t=xt(8);return t.write_shift(4,e),t.write_shift(4,1),t}function aA(){var e=Ws();return Dt(e,332),Dt(e,334,Zi(1)),Dt(e,335,KT({name:"XLDAPR",version:12e4,flags:3496657072})),Dt(e,336),Dt(e,339,eA(1,"XLDAPR")),Dt(e,52),Dt(e,35,Zi(514)),Dt(e,4096,Zi(0)),Dt(e,4097,Si(1)),Dt(e,36),Dt(e,53),Dt(e,340),Dt(e,337,rA(1)),Dt(e,51,QT([[1,0]])),Dt(e,338),Dt(e,333),e.end()}function Xw(){var e=[vn];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 nA(e){var r={};r.i=e.read_shift(4);var t={};t.r=e.read_shift(4),t.c=e.read_shift(4),r.r=ka(t);var n=e.read_shift(1);return n&2&&(r.l="1"),n&8&&(r.a="1"),r}var hd=1024;function Yw(e,r){for(var t=[21600,21600],n=["m0,0l0",t[1],t[0],t[1],t[0],"0xe"].join(","),o=[Vt("xml",null,{"xmlns:v":ci.v,"xmlns:o":ci.o,"xmlns:x":ci.x,"xmlns:mv":ci.mv}).replace(/\/>/,">"),Vt("o:shapelayout",Vt("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),Vt("v:shapetype",[Vt("v:stroke",null,{joinstyle:"miter"}),Vt("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:t.join(","),path:n})];hd<e*1e3;)hd+=1e3;return r.forEach(function(u){var f=Pn(u[0]),g={color2:"#BEFF82",type:"gradient"};g.type=="gradient"&&(g.angle="-180");var v=g.type=="gradient"?Vt("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,p=Vt("v:fill",v,g),k={on:"t",obscured:"t"};++hd,o=o.concat(["<v:shape"+q0({id:"_x0000_s"+hd,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(u[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",p,Vt("v:shadow",null,k),Vt("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",es("x:Anchor",[f.c+1,0,f.r+1,0,f.c+3,20,f.r+5,20].join(",")),es("x:AutoFill","False"),es("x:Row",String(f.r)),es("x:Column",String(f.c)),u[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),o.push("</xml>"),o.join("")}function Zw(e){var r=[vn,Vt("comments",null,{xmlns:Dd[0]})],t=[];return r.push("<authors>"),e.forEach(function(n){n[1].forEach(function(o){var u=wa(o.a);t.indexOf(u)==-1&&(t.push(u),r.push("<author>"+u+"</author>")),o.T&&o.ID&&t.indexOf("tc="+o.ID)==-1&&(t.push("tc="+o.ID),r.push("<author>tc="+o.ID+"</author>"))})}),t.length==0&&(t.push("SheetJ5"),r.push("<author>SheetJ5</author>")),r.push("</authors>"),r.push("<commentList>"),e.forEach(function(n){var o=0,u=[];if(n[1][0]&&n[1][0].T&&n[1][0].ID?o=t.indexOf("tc="+n[1][0].ID):n[1].forEach(function(v){v.a&&(o=t.indexOf(wa(v.a))),u.push(v.t||"")}),r.push('<comment ref="'+n[0]+'" authorId="'+o+'"><text>'),u.length<=1)r.push(es("t",wa(u[0]||"")));else{for(var f=`Comment:
`+u[0]+`
`,g=1;g<u.length;++g)f+=`Reply:
`+u[g]+`
`;r.push(es("t",wa(f)))}r.push("</text></comment>")}),r.push("</commentList>"),r.length>2&&(r[r.length]="</comments>",r[1]=r[1].replace("/>",">")),r.join("")}function sA(e,r,t){var n=[vn,Vt("ThreadedComments",null,{xmlns:Ln.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(o){var u="";(o[1]||[]).forEach(function(f,g){if(!f.T){delete f.ID;return}f.a&&r.indexOf(f.a)==-1&&r.push(f.a);var v={ref:o[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+t.tcid++).slice(-12)+"}"};g==0?u=v.id:v.parentId=u,f.ID=v.id,f.a&&(v.personId="{54EE7950-7262-4200-6969-"+("000000000000"+r.indexOf(f.a)).slice(-12)+"}"),n.push(Vt("threadedComment",es("text",f.t||""),v))})}),n.push("</ThreadedComments>"),n.join("")}function iA(e){var r=[vn,Vt("personList",null,{xmlns:Ln.TCMNT,"xmlns:x":Dd[0]}).replace(/[\/]>/,">")];return e.forEach(function(t,n){r.push(Vt("person",null,{displayName:t,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:t,providerId:"None"}))}),r.push("</personList>"),r.join("")}function oA(e){var r={};r.iauthor=e.read_shift(4);var t=kc(e);return r.rfx=t.s,r.ref=ka(t.s),e.l+=16,r}function lA(e,r){return r==null&&(r=xt(36)),r.write_shift(4,e[1].iauthor),Ld(e[0],r),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r}var cA=ms;function dA(e){return Fn(e.slice(0,54))}function uA(e){var r=Ws(),t=[];return Dt(r,628),Dt(r,630),e.forEach(function(n){n[1].forEach(function(o){t.indexOf(o.a)>-1||(t.push(o.a.slice(0,54)),Dt(r,632,dA(o.a)))})}),Dt(r,631),Dt(r,633),e.forEach(function(n){n[1].forEach(function(o){o.iauthor=t.indexOf(o.a);var u={s:Pn(n[0]),e:Pn(n[0])};Dt(r,635,lA([u,o])),o.t&&o.t.length>0&&Dt(r,637,hC(o)),Dt(r,636),delete o.iauthor})}),Dt(r,634),Dt(r,629),r.end()}function fA(e,r){r.FullPaths.forEach(function(t,n){if(n!=0){var o=t.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");o.slice(-1)!=="/"&&Aa.utils.cfb_add(e,o,r.FileIndex[n].content)}})}var $w=["xlsb","xlsm","xlam","biff8","xla"],hA=(function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,r={r:0,c:0};function t(n,o,u,f){var g=!1,v=!1;u.length==0?v=!0:u.charAt(0)=="["&&(v=!0,u=u.slice(1,-1)),f.length==0?g=!0:f.charAt(0)=="["&&(g=!0,f=f.slice(1,-1));var p=u.length>0?parseInt(u,10)|0:0,k=f.length>0?parseInt(f,10)|0:0;return g?k+=r.c:--k,v?p+=r.r:--p,o+(g?"":"$")+hs(k)+(v?"":"$")+ts(p)}return function(o,u){return r=u,o.replace(e,t)}})(),np=/(^|[^._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,sp=(function(){return function(r,t){return r.replace(np,function(n,o,u,f,g,v){var p=Jx(f)-(u?0:t.c),k=Kx(v)-(g?0:t.r),N=k==0?"":g?k+1:"["+k+"]",C=p==0?"":u?p+1:"["+p+"]";return o+"R"+N+"C"+C})}})();function mA(e,r){return e.replace(np,function(t,n,o,u,f,g){return n+(o=="$"?o+u:hs(Jx(u)+r.c))+(f=="$"?f+g:ts(Kx(g)+r.r))})}function gA(e){return e.length!=1}function yn(e){e.l+=1}function jl(e,r){var t=e.read_shift(2);return[t&16383,t>>14&1,t>>15&1]}function qw(e,r,t){var n=2;if(t){if(t.biff>=2&&t.biff<=5)return Kw(e);t.biff==12&&(n=4)}var o=e.read_shift(n),u=e.read_shift(n),f=jl(e),g=jl(e);return{s:{r:o,c:f[0],cRel:f[1],rRel:f[2]},e:{r:u,c:g[0],cRel:g[1],rRel:g[2]}}}function Kw(e){var r=jl(e),t=jl(e),n=e.read_shift(1),o=e.read_shift(1);return{s:{r:r[0],c:n,cRel:r[1],rRel:r[2]},e:{r:t[0],c:o,cRel:t[1],rRel:t[2]}}}function xA(e,r,t){if(t.biff<8)return Kw(e);var n=e.read_shift(t.biff==12?4:2),o=e.read_shift(t.biff==12?4:2),u=jl(e),f=jl(e);return{s:{r:n,c:u[0],cRel:u[1],rRel:u[2]},e:{r:o,c:f[0],cRel:f[1],rRel:f[2]}}}function Jw(e,r,t){if(t&&t.biff>=2&&t.biff<=5)return pA(e);var n=e.read_shift(t&&t.biff==12?4:2),o=jl(e);return{r:n,c:o[0],cRel:o[1],rRel:o[2]}}function pA(e){var r=jl(e),t=e.read_shift(1);return{r:r[0],c:t,cRel:r[1],rRel:r[2]}}function yA(e){var r=e.read_shift(2),t=e.read_shift(2);return{r,c:t&255,fQuoted:!!(t&16384),cRel:t>>15,rRel:t>>15}}function bA(e,r,t){var n=t&&t.biff?t.biff:8;if(n>=2&&n<=5)return vA(e);var o=e.read_shift(n>=12?4:2),u=e.read_shift(2),f=(u&16384)>>14,g=(u&32768)>>15;if(u&=16383,g==1)for(;o>524287;)o-=1048576;if(f==1)for(;u>8191;)u=u-16384;return{r:o,c:u,cRel:f,rRel:g}}function vA(e){var r=e.read_shift(2),t=e.read_shift(1),n=(r&32768)>>15,o=(r&16384)>>14;return r&=16383,n==1&&r>=8192&&(r=r-16384),o==1&&t>=128&&(t=t-256),{r,c:t,cRel:o,rRel:n}}function _A(e,r,t){var n=(e[e.l++]&96)>>5,o=qw(e,t.biff>=2&&t.biff<=5?6:8,t);return[n,o]}function wA(e,r,t){var n=(e[e.l++]&96)>>5,o=e.read_shift(2,"i"),u=8;if(t)switch(t.biff){case 5:e.l+=12,u=6;break;case 12:u=12;break}var f=qw(e,u,t);return[n,o,f]}function kA(e,r,t){var n=(e[e.l++]&96)>>5;return e.l+=t&&t.biff>8?12:t.biff<8?6:8,[n]}function NA(e,r,t){var n=(e[e.l++]&96)>>5,o=e.read_shift(2),u=8;if(t)switch(t.biff){case 5:e.l+=12,u=6;break;case 12:u=12;break}return e.l+=u,[n,o]}function SA(e,r,t){var n=(e[e.l++]&96)>>5,o=xA(e,r-1,t);return[n,o]}function EA(e,r,t){var n=(e[e.l++]&96)>>5;return e.l+=t.biff==2?6:t.biff==12?14:7,[n]}function iv(e){var r=e[e.l+1]&1,t=1;return e.l+=4,[r,t]}function CA(e,r,t){e.l+=2;for(var n=e.read_shift(t&&t.biff==2?1:2),o=[],u=0;u<=n;++u)o.push(e.read_shift(t&&t.biff==2?1:2));return o}function TA(e,r,t){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(t&&t.biff==2?1:2)]}function AA(e,r,t){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(t&&t.biff==2?1:2)]}function jA(e){var r=e[e.l+1]&255?1:0;return e.l+=2,[r,e.read_shift(2)]}function OA(e,r,t){var n=e[e.l+1]&255?1:0;return e.l+=t&&t.biff==2?3:4,[n]}function Qw(e){var r=e.read_shift(1),t=e.read_shift(1);return[r,t]}function MA(e){return e.read_shift(2),Qw(e)}function RA(e){return e.read_shift(2),Qw(e)}function DA(e,r,t){var n=(e[e.l]&96)>>5;e.l+=1;var o=Jw(e,0,t);return[n,o]}function IA(e,r,t){var n=(e[e.l]&96)>>5;e.l+=1;var o=bA(e,0,t);return[n,o]}function LA(e,r,t){var n=(e[e.l]&96)>>5;e.l+=1;var o=e.read_shift(2);t&&t.biff==5&&(e.l+=12);var u=Jw(e,0,t);return[n,o,u]}function PA(e,r,t){var n=(e[e.l]&96)>>5;e.l+=1;var o=e.read_shift(t&&t.biff<=3?1:2);return[P7[o],r4[o],n]}function FA(e,r,t){var n=e[e.l++],o=e.read_shift(1),u=t&&t.biff<=3?[n==88?-1:0,e.read_shift(1)]:BA(e);return[o,(u[0]===0?r4:L7)[u[1]]]}function BA(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function UA(e,r,t){e.l+=t&&t.biff==2?3:4}function zA(e,r,t){if(e.l++,t&&t.biff==12)return[e.read_shift(4,"i"),0];var n=e.read_shift(2),o=e.read_shift(t&&t.biff==2?1:2);return[n,o]}function HA(e){return e.l++,fu[e.read_shift(1)]}function WA(e){return e.l++,e.read_shift(2)}function VA(e){return e.l++,e.read_shift(1)!==0}function GA(e){return e.l++,Pd(e)}function XA(e,r,t){return e.l++,Iw(e,r-1,t)}function YA(e,r){var t=[e.read_shift(1)];if(r==12)switch(t[0]){case 2:t[0]=4;break;case 4:t[0]=16;break;case 0:t[0]=1;break;case 1:t[0]=2;break}switch(t[0]){case 4:t[1]=LC(e,1)?"TRUE":"FALSE",r!=12&&(e.l+=7);break;case 37:case 16:t[1]=fu[e[e.l]],e.l+=r==12?4:8;break;case 0:e.l+=8;break;case 1:t[1]=Pd(e);break;case 2:t[1]=UC(e,0,{biff:r>0&&r<8?2:r});break;default:throw new Error("Bad SerAr: "+t[0])}return t}function ZA(e,r,t){for(var n=e.read_shift(t.biff==12?4:2),o=[],u=0;u!=n;++u)o.push((t.biff==12?kc:WC)(e));return o}function $A(e,r,t){var n=0,o=0;t.biff==12?(n=e.read_shift(4),o=e.read_shift(4)):(o=1+e.read_shift(1),n=1+e.read_shift(2)),t.biff>=2&&t.biff<8&&(--n,--o==0&&(o=256));for(var u=0,f=[];u!=n&&(f[u]=[]);++u)for(var g=0;g!=o;++g)f[u][g]=YA(e,t.biff);return f}function qA(e,r,t){var n=e.read_shift(1)>>>5&3,o=!t||t.biff>=8?4:2,u=e.read_shift(o);switch(t.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[n,0,u]}function KA(e,r,t){if(t.biff==5)return JA(e);var n=e.read_shift(1)>>>5&3,o=e.read_shift(2),u=e.read_shift(4);return[n,o,u]}function JA(e){var r=e.read_shift(1)>>>5&3,t=e.read_shift(2,"i");e.l+=8;var n=e.read_shift(2);return e.l+=12,[r,t,n]}function QA(e,r,t){var n=e.read_shift(1)>>>5&3;e.l+=t&&t.biff==2?3:4;var o=e.read_shift(t&&t.biff==2?1:2);return[n,o]}function e7(e,r,t){var n=e.read_shift(1)>>>5&3,o=e.read_shift(t&&t.biff==2?1:2);return[n,o]}function t7(e,r,t){var n=e.read_shift(1)>>>5&3;return e.l+=4,t.biff<8&&e.l--,t.biff==12&&(e.l+=2),[n]}function r7(e,r,t){var n=(e[e.l++]&96)>>5,o=e.read_shift(2),u=4;if(t)switch(t.biff){case 5:u=15;break;case 12:u=6;break}return e.l+=u,[n,o]}var a7=po,n7=po,s7=po;function hu(e,r,t){return e.l+=2,[yA(e)]}function ip(e){return e.l+=6,[]}var i7=hu,o7=ip,l7=ip,c7=hu;function e4(e){return e.l+=2,[Rw(e),e.read_shift(2)&1]}var d7=hu,u7=e4,f7=ip,h7=hu,m7=hu,g7=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function x7(e){e.l+=2;var r=e.read_shift(2),t=e.read_shift(2),n=e.read_shift(4),o=e.read_shift(2),u=e.read_shift(2),f=g7[t>>2&31];return{ixti:r,coltype:t&3,rt:f,idx:n,c:o,C:u}}function p7(e){return e.l+=2,[e.read_shift(4)]}function y7(e,r,t){return e.l+=5,e.l+=2,e.l+=t.biff==2?1:4,["PTGSHEET"]}function b7(e,r,t){return e.l+=t.biff==2?4:5,["PTGENDSHEET"]}function v7(e){var r=e.read_shift(1)>>>5&3,t=e.read_shift(2);return[r,t]}function _7(e){var r=e.read_shift(1)>>>5&3,t=e.read_shift(2);return[r,t]}function w7(e){return e.l+=4,[0,0]}var ov={1:{n:"PtgExp",f:zA},2:{n:"PtgTbl",f:s7},3:{n:"PtgAdd",f:yn},4:{n:"PtgSub",f:yn},5:{n:"PtgMul",f:yn},6:{n:"PtgDiv",f:yn},7:{n:"PtgPower",f:yn},8:{n:"PtgConcat",f:yn},9:{n:"PtgLt",f:yn},10:{n:"PtgLe",f:yn},11:{n:"PtgEq",f:yn},12:{n:"PtgGe",f:yn},13:{n:"PtgGt",f:yn},14:{n:"PtgNe",f:yn},15:{n:"PtgIsect",f:yn},16:{n:"PtgUnion",f:yn},17:{n:"PtgRange",f:yn},18:{n:"PtgUplus",f:yn},19:{n:"PtgUminus",f:yn},20:{n:"PtgPercent",f:yn},21:{n:"PtgParen",f:yn},22:{n:"PtgMissArg",f:yn},23:{n:"PtgStr",f:XA},26:{n:"PtgSheet",f:y7},27:{n:"PtgEndSheet",f:b7},28:{n:"PtgErr",f:HA},29:{n:"PtgBool",f:VA},30:{n:"PtgInt",f:WA},31:{n:"PtgNum",f:GA},32:{n:"PtgArray",f:EA},33:{n:"PtgFunc",f:PA},34:{n:"PtgFuncVar",f:FA},35:{n:"PtgName",f:qA},36:{n:"PtgRef",f:DA},37:{n:"PtgArea",f:_A},38:{n:"PtgMemArea",f:QA},39:{n:"PtgMemErr",f:a7},40:{n:"PtgMemNoMem",f:n7},41:{n:"PtgMemFunc",f:e7},42:{n:"PtgRefErr",f:t7},43:{n:"PtgAreaErr",f:kA},44:{n:"PtgRefN",f:IA},45:{n:"PtgAreaN",f:SA},46:{n:"PtgMemAreaN",f:v7},47:{n:"PtgMemNoMemN",f:_7},57:{n:"PtgNameX",f:KA},58:{n:"PtgRef3d",f:LA},59:{n:"PtgArea3d",f:wA},60:{n:"PtgRefErr3d",f:r7},61:{n:"PtgAreaErr3d",f:NA},255:{}},k7={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},N7={1:{n:"PtgElfLel",f:e4},2:{n:"PtgElfRw",f:h7},3:{n:"PtgElfCol",f:i7},6:{n:"PtgElfRwV",f:m7},7:{n:"PtgElfColV",f:c7},10:{n:"PtgElfRadical",f:d7},11:{n:"PtgElfRadicalS",f:f7},13:{n:"PtgElfColS",f:o7},15:{n:"PtgElfColSV",f:l7},16:{n:"PtgElfRadicalLel",f:u7},25:{n:"PtgList",f:x7},29:{n:"PtgSxName",f:p7},255:{}},S7={0:{n:"PtgAttrNoop",f:w7},1:{n:"PtgAttrSemi",f:OA},2:{n:"PtgAttrIf",f:AA},4:{n:"PtgAttrChoose",f:CA},8:{n:"PtgAttrGoto",f:TA},16:{n:"PtgAttrSum",f:UA},32:{n:"PtgAttrBaxcel",f:iv},33:{n:"PtgAttrBaxcel",f:iv},64:{n:"PtgAttrSpace",f:MA},65:{n:"PtgAttrSpaceSemi",f:RA},128:{n:"PtgAttrIfError",f:jA},255:{}};function E7(e,r,t,n){if(n.biff<8)return po(e,r);for(var o=e.l+r,u=[],f=0;f!==t.length;++f)switch(t[f][0]){case"PtgArray":t[f][1]=$A(e,0,n),u.push(t[f][1]);break;case"PtgMemArea":t[f][2]=ZA(e,t[f][1],n),u.push(t[f][2]);break;case"PtgExp":n&&n.biff==12&&(t[f][1][1]=e.read_shift(4),u.push(t[f][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+t[f][0]}return r=o-e.l,r!==0&&u.push(po(e,r)),u}function C7(e,r,t){for(var n=e.l+r,o,u,f=[];n!=e.l;)r=n-e.l,u=e[e.l],o=ov[u]||ov[k7[u]],(u===24||u===25)&&(o=(u===24?N7:S7)[e[e.l+1]]),!o||!o.f?po(e,r):f.push([o.n,o.f(e,r,t)]);return f}function T7(e){for(var r=[],t=0;t<e.length;++t){for(var n=e[t],o=[],u=0;u<n.length;++u){var f=n[u];if(f)switch(f[0]){case 2:o.push('"'+f[1].replace(/"/g,'""')+'"');break;default:o.push(f[1])}else o.push("")}r.push(o.join(","))}return r.join(";")}var A7={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function j7(e,r){if(!e&&!(r&&r.biff<=5&&r.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function t4(e,r,t){if(!e)return"SH33TJSERR0";if(t.biff>8&&(!e.XTI||!e.XTI[r]))return e.SheetNames[r];if(!e.XTI)return"SH33TJSERR6";var n=e.XTI[r];if(t.biff<8)return r>1e4&&(r-=65536),r<0&&(r=-r),r==0?"":e.XTI[r-1];if(!n)return"SH33TJSERR1";var o="";if(t.biff>8)switch(e[n[0]][0]){case 357:return o=n[1]==-1?"#REF":e.SheetNames[n[1]],n[1]==n[2]?o:o+":"+e.SheetNames[n[2]];case 358:return t.SID!=null?e.SheetNames[t.SID]:"SH33TJSSAME"+e[n[0]][0];case 355:default:return"SH33TJSSRC"+e[n[0]][0]}switch(e[n[0]][0][0]){case 1025:return o=n[1]==-1?"#REF":e.SheetNames[n[1]]||"SH33TJSERR3",n[1]==n[2]?o:o+":"+e.SheetNames[n[2]];case 14849:return e[n[0]].slice(1).map(function(u){return u.Name}).join(";;");default:return e[n[0]][0][3]?(o=n[1]==-1?"#REF":e[n[0]][0][3][n[1]]||"SH33TJSERR4",n[1]==n[2]?o:o+":"+e[n[0]][0][3][n[2]]):"SH33TJSERR2"}}function lv(e,r,t){var n=t4(e,r,t);return n=="#REF"?n:j7(n,t)}function Nd(e,r,t,n,o){var u=o&&o.biff||8,f={s:{c:0,r:0}},g=[],v,p,k,N=0,C=0,O,I="";if(!e[0]||!e[0][0])return"";for(var M=-1,D="",z=0,B=e[0].length;z<B;++z){var U=e[0][z];switch(U[0]){case"PtgUminus":g.push("-"+g.pop());break;case"PtgUplus":g.push("+"+g.pop());break;case"PtgPercent":g.push(g.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(v=g.pop(),p=g.pop(),M>=0){switch(e[0][M][1][0]){case 0:D=tn(" ",e[0][M][1][1]);break;case 1:D=tn("\r",e[0][M][1][1]);break;default:if(D="",o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][M][1][0])}p=p+D,M=-1}g.push(p+A7[U[0]]+v);break;case"PtgIsect":v=g.pop(),p=g.pop(),g.push(p+" "+v);break;case"PtgUnion":v=g.pop(),p=g.pop(),g.push(p+","+v);break;case"PtgRange":v=g.pop(),p=g.pop(),g.push(p+":"+v);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":k=U0(U[1][1],f,o),g.push(z0(k,u));break;case"PtgRefN":k=t?U0(U[1][1],t,o):U[1][1],g.push(z0(k,u));break;case"PtgRef3d":N=U[1][1],k=U0(U[1][2],f,o),I=lv(n,N,o),g.push(I+"!"+z0(k,u));break;case"PtgFunc":case"PtgFuncVar":var H=U[1][0],q=U[1][1];H||(H=0),H&=127;var ne=H==0?[]:g.slice(-H);g.length-=H,q==="User"&&(q=ne.shift()),g.push(q+"("+ne.join(",")+")");break;case"PtgBool":g.push(U[1]?"TRUE":"FALSE");break;case"PtgInt":g.push(U[1]);break;case"PtgNum":g.push(String(U[1]));break;case"PtgStr":g.push('"'+U[1].replace(/"/g,'""')+'"');break;case"PtgErr":g.push(U[1]);break;case"PtgAreaN":O=Xb(U[1][1],t?{s:t}:f,o),g.push(Wg(O,o));break;case"PtgArea":O=Xb(U[1][1],f,o),g.push(Wg(O,o));break;case"PtgArea3d":N=U[1][1],O=U[1][2],I=lv(n,N,o),g.push(I+"!"+Wg(O,o));break;case"PtgAttrSum":g.push("SUM("+g.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":C=U[1][2];var V=(n.names||[])[C-1]||(n[0]||[])[C],J=V?V.Name:"SH33TJSNAME"+String(C);J&&J.slice(0,6)=="_xlfn."&&!o.xlfn&&(J=J.slice(6)),g.push(J);break;case"PtgNameX":var Q=U[1][1];C=U[1][2];var Te;if(o.biff<=5)Q<0&&(Q=-Q),n[Q]&&(Te=n[Q][C]);else{var je="";if(((n[Q]||[])[0]||[])[0]==14849||(((n[Q]||[])[0]||[])[0]==1025?n[Q][C]&&n[Q][C].itab>0&&(je=n.SheetNames[n[Q][C].itab-1]+"!"):je=n.SheetNames[C-1]+"!"),n[Q]&&n[Q][C])je+=n[Q][C].Name;else if(n[0]&&n[0][C])je+=n[0][C].Name;else{var me=(t4(n,Q,o)||"").split(";;");me[C-1]?je=me[C-1]:je+="SH33TJSERRX"}g.push(je);break}Te||(Te={Name:"SH33TJSERRY"}),g.push(Te.Name);break;case"PtgParen":var Se="(",Oe=")";if(M>=0){switch(D="",e[0][M][1][0]){case 2:Se=tn(" ",e[0][M][1][1])+Se;break;case 3:Se=tn("\r",e[0][M][1][1])+Se;break;case 4:Oe=tn(" ",e[0][M][1][1])+Oe;break;case 5:Oe=tn("\r",e[0][M][1][1])+Oe;break;default:if(o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][M][1][0])}M=-1}g.push(Se+g.pop()+Oe);break;case"PtgRefErr":g.push("#REF!");break;case"PtgRefErr3d":g.push("#REF!");break;case"PtgExp":k={c:U[1][1],r:U[1][0]};var ue={c:t.c,r:t.r};if(n.sharedf[ka(k)]){var be=n.sharedf[ka(k)];g.push(Nd(be,f,ue,n,o))}else{var re=!1;for(v=0;v!=n.arrayf.length;++v)if(p=n.arrayf[v],!(k.c<p[0].s.c||k.c>p[0].e.c)&&!(k.r<p[0].s.r||k.r>p[0].e.r)){g.push(Nd(p[1],f,ue,n,o)),re=!0;break}re||g.push(U[1])}break;case"PtgArray":g.push("{"+T7(U[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":M=z;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":g.push("");break;case"PtgAreaErr":g.push("#REF!");break;case"PtgAreaErr3d":g.push("#REF!");break;case"PtgList":g.push("Table"+U[1].idx+"[#"+U[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(U));default:throw new Error("Unrecognized Formula Token: "+String(U))}var de=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(o.biff!=3&&M>=0&&de.indexOf(e[0][z][0])==-1){U=e[0][M];var Ae=!0;switch(U[1][0]){case 4:Ae=!1;case 0:D=tn(" ",U[1][1]);break;case 5:Ae=!1;case 1:D=tn("\r",U[1][1]);break;default:if(D="",o.WTF)throw new Error("Unexpected PtgAttrSpaceType "+U[1][0])}g.push((Ae?D:"")+g.pop()+(Ae?"":D)),M=-1}}if(g.length>1&&o.WTF)throw new Error("bad formula stack");return g[0]}function O7(e){if(e==null){var r=xt(8);return r.write_shift(1,3),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,65535),r}else if(typeof e=="number")return gc(e);return gc(0)}function M7(e,r,t,n,o){var u=xc(r,t,o),f=O7(e.v),g=xt(6),v=33;g.write_shift(2,v),g.write_shift(4,0);for(var p=xt(e.bf.length),k=0;k<e.bf.length;++k)p[k]=e.bf[k];var N=Qn([u,f,g,p]);return N}function jh(e,r,t){var n=e.read_shift(4),o=C7(e,n,t),u=e.read_shift(4),f=u>0?E7(e,u,o,t):null;return[o,f]}var R7=jh,Oh=jh,D7=jh,I7=jh,L7={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"},r4={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"},P7={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 F7(e){var r="of:="+e.replace(np,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return r.replace(/;/g,"|").replace(/,/g,";")}function B7(e){return e.replace(/\./,"!")}var H0=typeof Map!="undefined";function op(e,r,t){var n=0,o=e.length;if(t){if(H0?t.has(r):Object.prototype.hasOwnProperty.call(t,r)){for(var u=H0?t.get(r):t[r];n<u.length;++n)if(e[u[n]].t===r)return e.Count++,u[n]}}else for(;n<o;++n)if(e[n].t===r)return e.Count++,n;return e[o]={t:r},e.Count++,e.Unique++,t&&(H0?(t.has(r)||t.set(r,[]),t.get(r).push(o)):(Object.prototype.hasOwnProperty.call(t,r)||(t[r]=[]),t[r].push(o))),o}function Mh(e,r){var t={min:e+1,max:e+1},n=-1;return r.MDW&&(Go=r.MDW),r.width!=null?t.customWidth=1:r.wpx!=null?n=sh(r.wpx):r.wch!=null&&(n=r.wch),n>-1?(t.width=bx(n),t.customWidth=1):r.width!=null&&(t.width=r.width),r.hidden&&(t.hidden=!0),r.level!=null&&(t.outlineLevel=t.level=r.level),t}function a4(e,r){if(e){var t=[.7,.7,.75,.75,.3,.3];e.left==null&&(e.left=t[0]),e.right==null&&(e.right=t[1]),e.top==null&&(e.top=t[2]),e.bottom==null&&(e.bottom=t[3]),e.header==null&&(e.header=t[4]),e.footer==null&&(e.footer=t[5])}}function Dl(e,r,t){var n=t.revssf[r.z!=null?r.z:"General"],o=60,u=e.length;if(n==null&&t.ssf){for(;o<392;++o)if(t.ssf[o]==null){J_(r.z,o),t.ssf[o]=r.z,t.revssf[r.z]=n=o;break}}for(o=0;o!=u;++o)if(e[o].numFmtId===n)return o;return e[u]={numFmtId:n,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},u}function U7(e,r,t){if(e&&e["!ref"]){var n=La(e["!ref"]);if(n.e.c<n.s.c||n.e.r<n.s.r)throw new Error("Bad range ("+t+"): "+e["!ref"])}}function z7(e){if(e.length===0)return"";for(var r='<mergeCells count="'+e.length+'">',t=0;t!=e.length;++t)r+='<mergeCell ref="'+bn(e[t])+'"/>';return r+"</mergeCells>"}function H7(e,r,t,n,o){var u=!1,f={},g=null;if(n.bookType!=="xlsx"&&r.vbaraw){var v=r.SheetNames[t];try{r.Workbook&&(v=r.Workbook.Sheets[t].CodeName||v)}catch(k){}u=!0,f.codeName=$0(wa(v))}if(e&&e["!outline"]){var p={summaryBelow:1,summaryRight:1};e["!outline"].above&&(p.summaryBelow=0),e["!outline"].left&&(p.summaryRight=0),g=(g||"")+Vt("outlinePr",null,p)}!u&&!g||(o[o.length]=Vt("sheetPr",g,f))}var W7=["objects","scenarios","selectLockedCells","selectUnlockedCells"],V7=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function G7(e){var r={sheet:1};return W7.forEach(function(t){e[t]!=null&&e[t]&&(r[t]="1")}),V7.forEach(function(t){e[t]!=null&&!e[t]&&(r[t]="0")}),e.password&&(r.password=Uw(e.password).toString(16).toUpperCase()),Vt("sheetProtection",null,r)}function X7(e){return a4(e),Vt("pageMargins",null,e)}function Y7(e,r){for(var t=["<cols>"],n,o=0;o!=r.length;++o)(n=r[o])&&(t[t.length]=Vt("col",null,Mh(o,n)));return t[t.length]="</cols>",t.join("")}function Z7(e,r,t,n){var o=typeof e.ref=="string"?e.ref:bn(e.ref);t.Workbook||(t.Workbook={Sheets:[]}),t.Workbook.Names||(t.Workbook.Names=[]);var u=t.Workbook.Names,f=hi(o);f.s.r==f.e.r&&(f.e.r=hi(r["!ref"]).e.r,o=bn(f));for(var g=0;g<u.length;++g){var v=u[g];if(v.Name=="_xlnm._FilterDatabase"&&v.Sheet==n){v.Ref="'"+t.SheetNames[n]+"'!"+o;break}}return g==u.length&&u.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+t.SheetNames[n]+"'!"+o}),Vt("autoFilter",null,{ref:o})}function $7(e,r,t,n){var o={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(o.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),Vt("sheetViews",Vt("sheetView",null,o),{})}function q7(e,r,t,n){if(e.c&&t["!comments"].push([r,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var o="",u=e.t,f=e.v;if(e.t!=="z")switch(e.t){case"b":o=e.v?"1":"0";break;case"n":o=""+e.v;break;case"e":o=fu[e.v];break;case"d":n&&n.cellDates?o=Es(e.v,-1).toISOString():(e=Gs(e),e.t="n",o=""+(e.v=Vs(Es(e.v)))),typeof e.z=="undefined"&&(e.z=rn[14]);break;default:o=e.v;break}var g=es("v",wa(o)),v={r},p=Dl(n.cellXfs,e,n);switch(p!==0&&(v.s=p),e.t){case"n":break;case"d":v.t="d";break;case"b":v.t="b";break;case"e":v.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(n&&n.bookSST){g=es("v",""+op(n.Strings,e.v,n.revStrings)),v.t="s";break}v.t="str";break}if(e.t!=u&&(e.t=u,e.v=f),typeof e.f=="string"&&e.f){var k=e.F&&e.F.slice(0,r.length)==r?{t:"array",ref:e.F}:null;g=Vt("f",wa(e.f),k)+(e.v!=null?g:"")}return e.l&&t["!links"].push([r,e.l]),e.D&&(v.cm=1),Vt("c",g,v)}function K7(e,r,t,n){var o=[],u=[],f=La(e["!ref"]),g="",v,p="",k=[],N=0,C=0,O=e["!rows"],I=Array.isArray(e),M={r:p},D,z=-1;for(C=f.s.c;C<=f.e.c;++C)k[C]=hs(C);for(N=f.s.r;N<=f.e.r;++N){for(u=[],p=ts(N),C=f.s.c;C<=f.e.c;++C){v=k[C]+p;var B=I?(e[N]||[])[C]:e[v];B!==void 0&&(g=q7(B,v,e,r))!=null&&u.push(g)}(u.length>0||O&&O[N])&&(M={r:p},O&&O[N]&&(D=O[N],D.hidden&&(M.hidden=1),z=-1,D.hpx?z=ih(D.hpx):D.hpt&&(z=D.hpt),z>-1&&(M.ht=z,M.customHeight=1),D.level&&(M.outlineLevel=D.level)),o[o.length]=Vt("row",u.join(""),M))}if(O)for(;N<O.length;++N)O&&O[N]&&(M={r:N+1},D=O[N],D.hidden&&(M.hidden=1),z=-1,D.hpx?z=ih(D.hpx):D.hpt&&(z=D.hpt),z>-1&&(M.ht=z,M.customHeight=1),D.level&&(M.outlineLevel=D.level),o[o.length]=Vt("row","",M));return o.join("")}function n4(e,r,t,n){var o=[vn,Vt("worksheet",null,{xmlns:Dd[0],"xmlns:r":Ln.r})],u=t.SheetNames[e],f=0,g="",v=t.Sheets[u];v==null&&(v={});var p=v["!ref"]||"A1",k=La(p);if(k.e.c>16383||k.e.r>1048575){if(r.WTF)throw new Error("Range "+p+" exceeds format limit A1:XFD1048576");k.e.c=Math.min(k.e.c,16383),k.e.r=Math.min(k.e.c,1048575),p=bn(k)}n||(n={}),v["!comments"]=[];var N=[];H7(v,t,e,r,o),o[o.length]=Vt("dimension",null,{ref:p}),o[o.length]=$7(v,r,e,t),r.sheetFormat&&(o[o.length]=Vt("sheetFormatPr",null,{defaultRowHeight:r.sheetFormat.defaultRowHeight||"16",baseColWidth:r.sheetFormat.baseColWidth||"10",outlineLevelRow:r.sheetFormat.outlineLevelRow||"7"})),v["!cols"]!=null&&v["!cols"].length>0&&(o[o.length]=Y7(v,v["!cols"])),o[f=o.length]="<sheetData/>",v["!links"]=[],v["!ref"]!=null&&(g=K7(v,r),g.length>0&&(o[o.length]=g)),o.length>f+1&&(o[o.length]="</sheetData>",o[f]=o[f].replace("/>",">")),v["!protect"]&&(o[o.length]=G7(v["!protect"])),v["!autofilter"]!=null&&(o[o.length]=Z7(v["!autofilter"],v,t,e)),v["!merges"]!=null&&v["!merges"].length>0&&(o[o.length]=z7(v["!merges"]));var C=-1,O,I=-1;return v["!links"].length>0&&(o[o.length]="<hyperlinks>",v["!links"].forEach(function(M){M[1].Target&&(O={ref:M[0]},M[1].Target.charAt(0)!="#"&&(I=_a(n,-1,wa(M[1].Target).replace(/#.*$/,""),oa.HLINK),O["r:id"]="rId"+I),(C=M[1].Target.indexOf("#"))>-1&&(O.location=wa(M[1].Target.slice(C+1))),M[1].Tooltip&&(O.tooltip=wa(M[1].Tooltip)),o[o.length]=Vt("hyperlink",null,O))}),o[o.length]="</hyperlinks>"),delete v["!links"],v["!margins"]!=null&&(o[o.length]=X7(v["!margins"])),(!r||r.ignoreEC||r.ignoreEC==null)&&(o[o.length]=es("ignoredErrors",Vt("ignoredError",null,{numberStoredAsText:1,sqref:p}))),N.length>0&&(I=_a(n,-1,"../drawings/drawing"+(e+1)+".xml",oa.DRAW),o[o.length]=Vt("drawing",null,{"r:id":"rId"+I}),v["!drawing"]=N),v["!comments"].length>0&&(I=_a(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",oa.VML),o[o.length]=Vt("legacyDrawing",null,{"r:id":"rId"+I}),v["!legacy"]=I),o.length>1&&(o[o.length]="</worksheet>",o[1]=o[1].replace("/>",">")),o.join("")}function J7(e,r){var t={},n=e.l+r;t.r=e.read_shift(4),e.l+=4;var o=e.read_shift(2);e.l+=1;var u=e.read_shift(1);return e.l=n,u&7&&(t.level=u&7),u&16&&(t.hidden=!0),u&32&&(t.hpt=o/20),t}function Q7(e,r,t){var n=xt(145),o=(t["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var u=320;o.hpx?u=ih(o.hpx)*20:o.hpt&&(u=o.hpt*20),n.write_shift(2,u),n.write_shift(1,0);var f=0;o.level&&(f|=o.level),o.hidden&&(f|=16),(o.hpx||o.hpt)&&(f|=32),n.write_shift(1,f),n.write_shift(1,0);var g=0,v=n.l;n.l+=4;for(var p={r:e,c:0},k=0;k<16;++k)if(!(r.s.c>k+1<<10||r.e.c<k<<10)){for(var N=-1,C=-1,O=k<<10;O<k+1<<10;++O){p.c=O;var I=Array.isArray(t)?(t[p.r]||[])[p.c]:t[ka(p)];I&&(N<0&&(N=O),C=O)}N<0||(++g,n.write_shift(4,N),n.write_shift(4,C))}var M=n.l;return n.l=v,n.write_shift(4,g),n.l=M,n.length>n.l?n.slice(0,n.l):n}function ej(e,r,t,n){var o=Q7(n,t,r);(o.length>17||(r["!rows"]||[])[n])&&Dt(e,0,o)}var tj=kc,rj=Ld;function aj(){}function nj(e,r){var t={},n=e[e.l];return++e.l,t.above=!(n&64),t.left=!(n&128),e.l+=18,t.name=mC(e),t}function sj(e,r,t){t==null&&(t=xt(84+4*e.length));var n=192;r&&(r.above&&(n&=-65),r.left&&(n&=-129)),t.write_shift(1,n);for(var o=1;o<3;++o)t.write_shift(1,0);return rh({auto:1},t),t.write_shift(-4,-1),t.write_shift(-4,-1),bw(e,t),t.slice(0,t.l)}function ij(e){var r=Ai(e);return[r]}function oj(e,r,t){return t==null&&(t=xt(8)),vc(r,t)}function lj(e){var r=_c(e);return[r]}function cj(e,r,t){return t==null&&(t=xt(4)),wc(r,t)}function dj(e){var r=Ai(e),t=e.read_shift(1);return[r,t,"b"]}function uj(e,r,t){return t==null&&(t=xt(9)),vc(r,t),t.write_shift(1,e.v?1:0),t}function fj(e){var r=_c(e),t=e.read_shift(1);return[r,t,"b"]}function hj(e,r,t){return t==null&&(t=xt(5)),wc(r,t),t.write_shift(1,e.v?1:0),t}function mj(e){var r=Ai(e),t=e.read_shift(1);return[r,t,"e"]}function gj(e,r,t){return t==null&&(t=xt(9)),vc(r,t),t.write_shift(1,e.v),t}function xj(e){var r=_c(e),t=e.read_shift(1);return[r,t,"e"]}function pj(e,r,t){return t==null&&(t=xt(8)),wc(r,t),t.write_shift(1,e.v),t.write_shift(2,0),t.write_shift(1,0),t}function yj(e){var r=Ai(e),t=e.read_shift(4);return[r,t,"s"]}function bj(e,r,t){return t==null&&(t=xt(12)),vc(r,t),t.write_shift(4,r.v),t}function vj(e){var r=_c(e),t=e.read_shift(4);return[r,t,"s"]}function _j(e,r,t){return t==null&&(t=xt(8)),wc(r,t),t.write_shift(4,r.v),t}function wj(e){var r=Ai(e),t=Pd(e);return[r,t,"n"]}function kj(e,r,t){return t==null&&(t=xt(16)),vc(r,t),gc(e.v,t),t}function Nj(e){var r=_c(e),t=Pd(e);return[r,t,"n"]}function Sj(e,r,t){return t==null&&(t=xt(12)),wc(r,t),gc(e.v,t),t}function Ej(e){var r=Ai(e),t=vw(e);return[r,t,"n"]}function Cj(e,r,t){return t==null&&(t=xt(12)),vc(r,t),_w(e.v,t),t}function Tj(e){var r=_c(e),t=vw(e);return[r,t,"n"]}function Aj(e,r,t){return t==null&&(t=xt(8)),wc(r,t),_w(e.v,t),t}function jj(e){var r=Ai(e),t=Qx(e);return[r,t,"is"]}function Oj(e){var r=Ai(e),t=ms(e);return[r,t,"str"]}function Mj(e,r,t){return t==null&&(t=xt(12+4*e.v.length)),vc(r,t),Fn(e.v,t),t.length>t.l?t.slice(0,t.l):t}function Rj(e){var r=_c(e),t=ms(e);return[r,t,"str"]}function Dj(e,r,t){return t==null&&(t=xt(8+4*e.v.length)),wc(r,t),Fn(e.v,t),t.length>t.l?t.slice(0,t.l):t}function Ij(e,r,t){var n=e.l+r,o=Ai(e);o.r=t["!row"];var u=e.read_shift(1),f=[o,u,"b"];if(t.cellFormula){e.l+=2;var g=Oh(e,n-e.l,t);f[3]=Nd(g,null,o,t.supbooks,t)}else e.l=n;return f}function Lj(e,r,t){var n=e.l+r,o=Ai(e);o.r=t["!row"];var u=e.read_shift(1),f=[o,u,"e"];if(t.cellFormula){e.l+=2;var g=Oh(e,n-e.l,t);f[3]=Nd(g,null,o,t.supbooks,t)}else e.l=n;return f}function Pj(e,r,t){var n=e.l+r,o=Ai(e);o.r=t["!row"];var u=Pd(e),f=[o,u,"n"];if(t.cellFormula){e.l+=2;var g=Oh(e,n-e.l,t);f[3]=Nd(g,null,o,t.supbooks,t)}else e.l=n;return f}function Fj(e,r,t){var n=e.l+r,o=Ai(e);o.r=t["!row"];var u=ms(e),f=[o,u,"str"];if(t.cellFormula){e.l+=2;var g=Oh(e,n-e.l,t);f[3]=Nd(g,null,o,t.supbooks,t)}else e.l=n;return f}var Bj=kc,Uj=Ld;function zj(e,r){return r==null&&(r=xt(4)),r.write_shift(4,e),r}function Hj(e,r){var t=e.l+r,n=kc(e),o=ep(e),u=ms(e),f=ms(e),g=ms(e);e.l=t;var v={rfx:n,relId:o,loc:u,display:g};return f&&(v.Tooltip=f),v}function Wj(e,r){var t=xt(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));Ld({s:Pn(e[0]),e:Pn(e[0])},t),tp("rId"+r,t);var n=e[1].Target.indexOf("#"),o=n==-1?"":e[1].Target.slice(n+1);return Fn(o||"",t),Fn(e[1].Tooltip||"",t),Fn("",t),t.slice(0,t.l)}function Vj(){}function Gj(e,r,t){var n=e.l+r,o=ww(e),u=e.read_shift(1),f=[o];if(f[2]=u,t.cellFormula){var g=R7(e,n-e.l,t);f[1]=g}else e.l=n;return f}function Xj(e,r,t){var n=e.l+r,o=kc(e),u=[o];if(t.cellFormula){var f=I7(e,n-e.l,t);u[1]=f,e.l=n}else e.l=n;return u}function Yj(e,r,t){t==null&&(t=xt(18));var n=Mh(e,r);t.write_shift(-4,e),t.write_shift(-4,e),t.write_shift(4,(n.width||10)*256),t.write_shift(4,0);var o=0;return r.hidden&&(o|=1),typeof n.width=="number"&&(o|=2),r.level&&(o|=r.level<<8),t.write_shift(2,o),t}var s4=["left","right","top","bottom","header","footer"];function Zj(e){var r={};return s4.forEach(function(t){r[t]=Pd(e)}),r}function $j(e,r){return r==null&&(r=xt(48)),a4(e),s4.forEach(function(t){gc(e[t],r)}),r}function qj(e){var r=e.read_shift(2);return e.l+=28,{RTL:r&32}}function Kj(e,r,t){t==null&&(t=xt(30));var n=924;return(((r||{}).Views||[])[0]||{}).RTL&&(n|=32),t.write_shift(2,n),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(2,0),t.write_shift(2,100),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(4,0),t}function Jj(e){var r=xt(24);return r.write_shift(4,4),r.write_shift(4,1),Ld(e,r),r}function Qj(e,r){return r==null&&(r=xt(66)),r.write_shift(2,e.password?Uw(e.password):0),r.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(t){t[1]?r.write_shift(4,e[t[0]]!=null&&!e[t[0]]?1:0):r.write_shift(4,e[t[0]]!=null&&e[t[0]]?0:1)}),r}function e9(){}function t9(){}function r9(e,r,t,n,o,u,f){if(r.v===void 0)return!1;var g="";switch(r.t){case"b":g=r.v?"1":"0";break;case"d":r=Gs(r),r.z=r.z||rn[14],r.v=Vs(Es(r.v)),r.t="n";break;case"n":case"e":g=""+r.v;break;default:g=r.v;break}var v={r:t,c:n};switch(v.s=Dl(o.cellXfs,r,o),r.l&&u["!links"].push([ka(v),r.l]),r.c&&u["!comments"].push([ka(v),r.c]),r.t){case"s":case"str":return o.bookSST?(g=op(o.Strings,r.v,o.revStrings),v.t="s",v.v=g,f?Dt(e,18,_j(r,v)):Dt(e,7,bj(r,v))):(v.t="str",f?Dt(e,17,Dj(r,v)):Dt(e,6,Mj(r,v))),!0;case"n":return r.v==(r.v|0)&&r.v>-1e3&&r.v<1e3?f?Dt(e,13,Aj(r,v)):Dt(e,2,Cj(r,v)):f?Dt(e,16,Sj(r,v)):Dt(e,5,kj(r,v)),!0;case"b":return v.t="b",f?Dt(e,15,hj(r,v)):Dt(e,4,uj(r,v)),!0;case"e":return v.t="e",f?Dt(e,14,pj(r,v)):Dt(e,3,gj(r,v)),!0}return f?Dt(e,12,cj(r,v)):Dt(e,1,oj(r,v)),!0}function a9(e,r,t,n){var o=La(r["!ref"]||"A1"),u,f="",g=[];Dt(e,145);var v=Array.isArray(r),p=o.e.r;r["!rows"]&&(p=Math.max(o.e.r,r["!rows"].length-1));for(var k=o.s.r;k<=p;++k){f=ts(k),ej(e,r,o,k);var N=!1;if(k<=o.e.r)for(var C=o.s.c;C<=o.e.c;++C){k===o.s.r&&(g[C]=hs(C)),u=g[C]+f;var O=v?(r[k]||[])[C]:r[u];if(!O){N=!1;continue}N=r9(e,O,k,C,n,r,N)}}Dt(e,146)}function n9(e,r){!r||!r["!merges"]||(Dt(e,177,zj(r["!merges"].length)),r["!merges"].forEach(function(t){Dt(e,176,Uj(t))}),Dt(e,178))}function s9(e,r){!r||!r["!cols"]||(Dt(e,390),r["!cols"].forEach(function(t,n){t&&Dt(e,60,Yj(n,t))}),Dt(e,391))}function i9(e,r){!r||!r["!ref"]||(Dt(e,648),Dt(e,649,Jj(La(r["!ref"]))),Dt(e,650))}function o9(e,r,t){r["!links"].forEach(function(n){if(n[1].Target){var o=_a(t,-1,n[1].Target.replace(/#.*$/,""),oa.HLINK);Dt(e,494,Wj(n,o))}}),delete r["!links"]}function l9(e,r,t,n){if(r["!comments"].length>0){var o=_a(n,-1,"../drawings/vmlDrawing"+(t+1)+".vml",oa.VML);Dt(e,551,tp("rId"+o)),r["!legacy"]=o}}function c9(e,r,t,n){if(r["!autofilter"]){var o=r["!autofilter"],u=typeof o.ref=="string"?o.ref:bn(o.ref);t.Workbook||(t.Workbook={Sheets:[]}),t.Workbook.Names||(t.Workbook.Names=[]);var f=t.Workbook.Names,g=hi(u);g.s.r==g.e.r&&(g.e.r=hi(r["!ref"]).e.r,u=bn(g));for(var v=0;v<f.length;++v){var p=f[v];if(p.Name=="_xlnm._FilterDatabase"&&p.Sheet==n){p.Ref="'"+t.SheetNames[n]+"'!"+u;break}}v==f.length&&f.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+t.SheetNames[n]+"'!"+u}),Dt(e,161,Ld(La(u))),Dt(e,162)}}function d9(e,r,t){Dt(e,133),Dt(e,137,Kj(r,t)),Dt(e,138),Dt(e,134)}function u9(e,r){r["!protect"]&&Dt(e,535,Qj(r["!protect"]))}function f9(e,r,t,n){var o=Ws(),u=t.SheetNames[e],f=t.Sheets[u]||{},g=u;try{t&&t.Workbook&&(g=t.Workbook.Sheets[e].CodeName||g)}catch(p){}var v=La(f["!ref"]||"A1");if(v.e.c>16383||v.e.r>1048575){if(r.WTF)throw new Error("Range "+(f["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");v.e.c=Math.min(v.e.c,16383),v.e.r=Math.min(v.e.c,1048575)}return f["!links"]=[],f["!comments"]=[],Dt(o,129),(t.vbaraw||f["!outline"])&&Dt(o,147,sj(g,f["!outline"])),Dt(o,148,rj(v)),d9(o,f,t.Workbook),s9(o,f),a9(o,f,e,r),u9(o,f),c9(o,f,t,e),n9(o,f),o9(o,f,n),f["!margins"]&&Dt(o,476,$j(f["!margins"])),(!r||r.ignoreEC||r.ignoreEC==null)&&i9(o,f),l9(o,f,e,n),Dt(o,130),o.end()}function h9(e,r){e.l+=10;var t=ms(e);return{name:t}}var m9=[["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 g9(e){return!e.Workbook||!e.Workbook.WBProps?"false":XE(e.Workbook.WBProps.date1904)?"true":"false"}var x9="][*?/\\".split("");function i4(e,r){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var t=!0;return x9.forEach(function(n){if(e.indexOf(n)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),t}function p9(e,r,t){e.forEach(function(n,o){i4(n);for(var u=0;u<o;++u)if(n==e[u])throw new Error("Duplicate Sheet Name: "+n);if(t){var f=r&&r[o]&&r[o].CodeName||n;if(f.charCodeAt(0)==95&&f.length>22)throw new Error("Bad Code Name: Worksheet"+f)}})}function y9(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var r=e.Workbook&&e.Workbook.Sheets||[];p9(e.SheetNames,r,!!e.vbaraw);for(var t=0;t<e.SheetNames.length;++t)U7(e.Sheets[e.SheetNames[t]],e.SheetNames[t],t)}function o4(e){var r=[vn];r[r.length]=Vt("workbook",null,{xmlns:Dd[0],"xmlns:r":Ln.r});var t=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(m9.forEach(function(g){e.Workbook.WBProps[g[0]]!=null&&e.Workbook.WBProps[g[0]]!=g[1]&&(n[g[0]]=e.Workbook.WBProps[g[0]])}),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),r[r.length]=Vt("workbookPr",null,n);var o=e.Workbook&&e.Workbook.Sheets||[],u=0;if(o&&o[0]&&o[0].Hidden){for(r[r.length]="<bookViews>",u=0;u!=e.SheetNames.length&&!(!o[u]||!o[u].Hidden);++u);u==e.SheetNames.length&&(u=0),r[r.length]='<workbookView firstSheet="'+u+'" activeTab="'+u+'"/>',r[r.length]="</bookViews>"}for(r[r.length]="<sheets>",u=0;u!=e.SheetNames.length;++u){var f={name:wa(e.SheetNames[u].slice(0,31))};if(f.sheetId=""+(u+1),f["r:id"]="rId"+(u+1),o[u])switch(o[u].Hidden){case 1:f.state="hidden";break;case 2:f.state="veryHidden";break}r[r.length]=Vt("sheet",null,f)}return r[r.length]="</sheets>",t&&(r[r.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(g){var v={name:g.Name};g.Comment&&(v.comment=g.Comment),g.Sheet!=null&&(v.localSheetId=""+g.Sheet),g.Hidden&&(v.hidden="1"),g.Ref&&(r[r.length]=Vt("definedName",wa(g.Ref),v))}),r[r.length]="</definedNames>"),r.length>2&&(r[r.length]="</workbook>",r[1]=r[1].replace("/>",">")),r.join("")}function b9(e,r){var t={};return t.Hidden=e.read_shift(4),t.iTabID=e.read_shift(4),t.strRelID=yx(e),t.name=ms(e),t}function v9(e,r){return r||(r=xt(127)),r.write_shift(4,e.Hidden),r.write_shift(4,e.iTabID),tp(e.strRelID,r),Fn(e.name.slice(0,31),r),r.length>r.l?r.slice(0,r.l):r}function _9(e,r){var t={},n=e.read_shift(4);t.defaultThemeVersion=e.read_shift(4);var o=r>8?ms(e):"";return o.length>0&&(t.CodeName=o),t.autoCompressPictures=!!(n&65536),t.backupFile=!!(n&64),t.checkCompatibility=!!(n&4096),t.date1904=!!(n&1),t.filterPrivacy=!!(n&8),t.hidePivotFieldList=!!(n&1024),t.promptedSolutions=!!(n&16),t.publishItems=!!(n&2048),t.refreshAllConnections=!!(n&262144),t.saveExternalLinkValues=!!(n&128),t.showBorderUnselectedTables=!!(n&4),t.showInkAnnotation=!!(n&32),t.showObjects=["all","placeholders","none"][n>>13&3],t.showPivotChartFilter=!!(n&32768),t.updateLinks=["userSet","never","always"][n>>8&3],t}function w9(e,r){r||(r=xt(72));var t=0;return e&&e.filterPrivacy&&(t|=8),r.write_shift(4,t),r.write_shift(4,0),bw(e&&e.CodeName||"ThisWorkbook",r),r.slice(0,r.l)}function k9(e,r,t){var n=e.l+r;e.l+=4,e.l+=1;var o=e.read_shift(4),u=gC(e),f=D7(e,0,t),g=ep(e);e.l=n;var v={Name:u,Ptg:f};return o<268435455&&(v.Sheet=o),g&&(v.Comment=g),v}function N9(e,r){Dt(e,143);for(var t=0;t!=r.SheetNames.length;++t){var n=r.Workbook&&r.Workbook.Sheets&&r.Workbook.Sheets[t]&&r.Workbook.Sheets[t].Hidden||0,o={Hidden:n,iTabID:t+1,strRelID:"rId"+(t+1),name:r.SheetNames[t]};Dt(e,156,v9(o))}Dt(e,144)}function S9(e,r){r||(r=xt(127));for(var t=0;t!=4;++t)r.write_shift(4,0);return Fn("SheetJS",r),Fn(Zf.version,r),Fn(Zf.version,r),Fn("7262",r),r.length>r.l?r.slice(0,r.l):r}function E9(e,r){r||(r=xt(29)),r.write_shift(-4,0),r.write_shift(-4,460),r.write_shift(4,28800),r.write_shift(4,17600),r.write_shift(4,500),r.write_shift(4,e),r.write_shift(4,e);var t=120;return r.write_shift(1,t),r.length>r.l?r.slice(0,r.l):r}function C9(e,r){if(!(!r.Workbook||!r.Workbook.Sheets)){for(var t=r.Workbook.Sheets,n=0,o=-1,u=-1;n<t.length;++n)!t[n]||!t[n].Hidden&&o==-1?o=n:t[n].Hidden==1&&u==-1&&(u=n);u>o||(Dt(e,135),Dt(e,158,E9(o)),Dt(e,136))}}function T9(e,r){var t=Ws();return Dt(t,131),Dt(t,128,S9()),Dt(t,153,w9(e.Workbook&&e.Workbook.WBProps||null)),C9(t,e),N9(t,e),Dt(t,132),t.end()}function A9(e,r,t){return(r.slice(-4)===".bin"?T9:o4)(e)}function j9(e,r,t,n,o){return(r.slice(-4)===".bin"?f9:n4)(e,t,n,o)}function O9(e,r,t){return(r.slice(-4)===".bin"?$T:Ww)(e,t)}function M9(e,r,t){return(r.slice(-4)===".bin"?wT:Bw)(e,t)}function R9(e,r,t){return(r.slice(-4)===".bin"?uA:Zw)(e)}function D9(e){return(e.slice(-4)===".bin"?aA:Xw)()}function I9(e,r){var t=[];return e.Props&&t.push(OC(e.Props,r)),e.Custprops&&t.push(MC(e.Props,e.Custprops)),t.join("")}function L9(){return""}function P9(e,r){var t=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return r.cellXfs.forEach(function(n,o){var u=[];u.push(Vt("NumberFormat",null,{"ss:Format":wa(rn[n.numFmtId])}));var f={"ss:ID":"s"+(21+o)};t.push(Vt("Style",u.join(""),f))}),Vt("Styles",t.join(""))}function l4(e){return Vt("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+sp(e.Ref,{r:0,c:0})})}function F9(e){if(!((e||{}).Workbook||{}).Names)return"";for(var r=e.Workbook.Names,t=[],n=0;n<r.length;++n){var o=r[n];o.Sheet==null&&(o.Name.match(/^_xlfn\./)||t.push(l4(o)))}return Vt("Names",t.join(""))}function B9(e,r,t,n){if(!e||!((n||{}).Workbook||{}).Names)return"";for(var o=n.Workbook.Names,u=[],f=0;f<o.length;++f){var g=o[f];g.Sheet==t&&(g.Name.match(/^_xlfn\./)||u.push(l4(g)))}return u.join("")}function U9(e,r,t,n){if(!e)return"";var o=[];if(e["!margins"]&&(o.push("<PageSetup>"),e["!margins"].header&&o.push(Vt("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&o.push(Vt("Footer",null,{"x:Margin":e["!margins"].footer})),o.push(Vt("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"})),o.push("</PageSetup>")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[t])if(n.Workbook.Sheets[t].Hidden)o.push(Vt("Visible",n.Workbook.Sheets[t].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var u=0;u<t&&!(n.Workbook.Sheets[u]&&!n.Workbook.Sheets[u].Hidden);++u);u==t&&o.push("<Selected/>")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&o.push("<DisplayRightToLeft/>"),e["!protect"]&&(o.push(es("ProtectContents","True")),e["!protect"].objects&&o.push(es("ProtectObjects","True")),e["!protect"].scenarios&&o.push(es("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?o.push(es("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&o.push(es("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(f){e["!protect"][f[0]]&&o.push("<"+f[1]+"/>")})),o.length==0?"":Vt("WorksheetOptions",o.join(""),{xmlns:ci.x})}function z9(e){return e.map(function(r){var t=GE(r.t||""),n=Vt("ss:Data",t,{xmlns:"http://www.w3.org/TR/REC-html40"});return Vt("Comment",n,{"ss:Author":r.a})}).join("")}function H9(e,r,t,n,o,u,f){if(!e||e.v==null&&e.f==null)return"";var g={};if(e.f&&(g["ss:Formula"]="="+wa(sp(e.f,f))),e.F&&e.F.slice(0,r.length)==r){var v=Pn(e.F.slice(r.length+1));g["ss:ArrayRange"]="RC:R"+(v.r==f.r?"":"["+(v.r-f.r)+"]")+"C"+(v.c==f.c?"":"["+(v.c-f.c)+"]")}if(e.l&&e.l.Target&&(g["ss:HRef"]=wa(e.l.Target),e.l.Tooltip&&(g["x:HRefScreenTip"]=wa(e.l.Tooltip))),t["!merges"])for(var p=t["!merges"],k=0;k!=p.length;++k)p[k].s.c!=f.c||p[k].s.r!=f.r||(p[k].e.c>p[k].s.c&&(g["ss:MergeAcross"]=p[k].e.c-p[k].s.c),p[k].e.r>p[k].s.r&&(g["ss:MergeDown"]=p[k].e.r-p[k].s.r));var N="",C="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":N="Number",C=String(e.v);break;case"b":N="Boolean",C=e.v?"1":"0";break;case"e":N="Error",C=fu[e.v];break;case"d":N="DateTime",C=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||rn[14]);break;case"s":N="String",C=VE(e.v||"");break}var O=Dl(n.cellXfs,e,n);g["ss:StyleID"]="s"+(21+O),g["ss:Index"]=f.c+1;var I=e.v!=null?C:"",M=e.t=="z"?"":'<Data ss:Type="'+N+'">'+I+"</Data>";return(e.c||[]).length>0&&(M+=z9(e.c)),Vt("Cell",M,g)}function W9(e,r){var t='<Row ss:Index="'+(e+1)+'"';return r&&(r.hpt&&!r.hpx&&(r.hpx=Hw(r.hpt)),r.hpx&&(t+=' ss:AutoFitHeight="0" ss:Height="'+r.hpx+'"'),r.hidden&&(t+=' ss:Hidden="1"')),t+">"}function V9(e,r,t,n){if(!e["!ref"])return"";var o=La(e["!ref"]),u=e["!merges"]||[],f=0,g=[];e["!cols"]&&e["!cols"].forEach(function(D,z){ap(D);var B=!!D.width,U=Mh(z,D),H={"ss:Index":z+1};B&&(H["ss:Width"]=nh(U.width)),D.hidden&&(H["ss:Hidden"]="1"),g.push(Vt("Column",null,H))});for(var v=Array.isArray(e),p=o.s.r;p<=o.e.r;++p){for(var k=[W9(p,(e["!rows"]||[])[p])],N=o.s.c;N<=o.e.c;++N){var C=!1;for(f=0;f!=u.length;++f)if(!(u[f].s.c>N)&&!(u[f].s.r>p)&&!(u[f].e.c<N)&&!(u[f].e.r<p)){(u[f].s.c!=N||u[f].s.r!=p)&&(C=!0);break}if(!C){var O={r:p,c:N},I=ka(O),M=v?(e[p]||[])[N]:e[I];k.push(H9(M,I,e,r,t,n,O))}}k.push("</Row>"),k.length>2&&g.push(k.join(""))}return g.join("")}function G9(e,r,t){var n=[],o=t.SheetNames[e],u=t.Sheets[o],f=u?B9(u,r,e,t):"";return f.length>0&&n.push("<Names>"+f+"</Names>"),f=u?V9(u,r,e,t):"",f.length>0&&n.push("<Table>"+f+"</Table>"),n.push(U9(u,r,e,t)),n.join("")}function X9(e,r){r||(r={}),e.SSF||(e.SSF=Gs(rn)),e.SSF&&(Ch(),Eh(e.SSF),r.revssf=Th(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF,r.cellXfs=[],Dl(r.cellXfs,{},{revssf:{General:0}}));var t=[];t.push(I9(e,r)),t.push(L9()),t.push(""),t.push("");for(var n=0;n<e.SheetNames.length;++n)t.push(Vt("Worksheet",G9(n,r,e),{"ss:Name":wa(e.SheetNames[n])}));return t[2]=P9(e,r),t[3]=F9(e),vn+Vt("Workbook",t.join(""),{xmlns:ci.ss,"xmlns:o":ci.o,"xmlns:x":ci.x,"xmlns:ss":ci.ss,"xmlns:dt":ci.dt,"xmlns:html":ci.html})}var Xg={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function Y9(e,r){var t=[],n=[],o=[],u=0,f,g=Ib(Zb,"n"),v=Ib($b,"n");if(e.Props)for(f=as(e.Props),u=0;u<f.length;++u)(Object.prototype.hasOwnProperty.call(g,f[u])?t:Object.prototype.hasOwnProperty.call(v,f[u])?n:o).push([f[u],e.Props[f[u]]]);if(e.Custprops)for(f=as(e.Custprops),u=0;u<f.length;++u)Object.prototype.hasOwnProperty.call(e.Props||{},f[u])||(Object.prototype.hasOwnProperty.call(g,f[u])?t:Object.prototype.hasOwnProperty.call(v,f[u])?n:o).push([f[u],e.Custprops[f[u]]]);var p=[];for(u=0;u<o.length;++u)Mw.indexOf(o[u][0])>-1||Aw.indexOf(o[u][0])>-1||o[u][1]!=null&&p.push(o[u]);n.length&&Aa.utils.cfb_add(r,"/SummaryInformation",ev(n,Xg.SI,v,$b)),(t.length||p.length)&&Aa.utils.cfb_add(r,"/DocumentSummaryInformation",ev(t,Xg.DSI,g,Zb,p.length?p:null,Xg.UDI))}function Z9(e,r){var t=r||{},n=Aa.utils.cfb_new({root:"R"}),o="/Workbook";switch(t.bookType||"xls"){case"xls":t.bookType="biff8";case"xla":t.bookType||(t.bookType="xla");case"biff8":o="/Workbook",t.biff=8;break;case"biff5":o="/Book",t.biff=5;break;default:throw new Error("invalid type "+t.bookType+" for XLS CFB")}return Aa.utils.cfb_add(n,o,c4(e,t)),t.biff==8&&(e.Props||e.Custprops)&&Y9(e,n),t.biff==8&&e.vbaraw&&fA(n,Aa.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var $9={0:{f:J7},1:{f:ij},2:{f:Ej},3:{f:mj},4:{f:dj},5:{f:wj},6:{f:Oj},7:{f:yj},8:{f:Fj},9:{f:Pj},10:{f:Ij},11:{f:Lj},12:{f:lj},13:{f:Tj},14:{f:xj},15:{f:fj},16:{f:Nj},17:{f:Rj},18:{f:vj},19:{f:Qx},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:k9},40:{},42:{},43:{f:OT},44:{f:AT},45:{f:DT},46:{f:LT},47:{f:IT},48:{},49:{f:lC},50:{},51:{f:JT},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:cT},62:{f:jj},63:{f:nA},64:{f:e9},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:po,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:qj},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:nj},148:{f:tj,p:16},151:{f:Vj},152:{},153:{f:_9},154:{},155:{},156:{f:b9},157:{},158:{},159:{T:1,f:bT},160:{T:-1},161:{T:1,f:kc},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:Bj},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:qT},336:{T:-1},337:{f:tA,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:yx},357:{},358:{},359:{},360:{T:1},361:{},362:{f:aT},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:Gj},427:{f:Xj},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:Zj},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:aj},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:Hj},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:yx},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:cA},633:{T:1},634:{T:-1},635:{T:1,f:oA},636:{T:-1},637:{f:fC},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:h9},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:t9},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 Xt(e,r,t,n){var o=r;if(!isNaN(o)){var u=n||(t||[]).length||0,f=e.next(4);f.write_shift(2,o),f.write_shift(2,u),u>0&&qx(t)&&e.push(t)}}function q9(e,r,t,n){var o=(t||[]).length||0;if(o<=8224)return Xt(e,r,t,o);var u=r;if(!isNaN(u)){for(var f=t.parts||[],g=0,v=0,p=0;p+(f[g]||8224)<=8224;)p+=f[g]||8224,g++;var k=e.next(4);for(k.write_shift(2,u),k.write_shift(2,p),e.push(t.slice(v,v+p)),v+=p;v<o;){for(k=e.next(4),k.write_shift(2,60),p=0;p+(f[g]||8224)<=8224;)p+=f[g]||8224,g++;k.write_shift(2,p),e.push(t.slice(v,v+p)),v+=p}}}function mu(e,r,t){return e||(e=xt(7)),e.write_shift(2,r),e.write_shift(2,t),e.write_shift(2,0),e.write_shift(1,0),e}function K9(e,r,t,n){var o=xt(9);return mu(o,e,r),Dw(t,n||"b",o),o}function J9(e,r,t){var n=xt(8+2*t.length);return mu(n,e,r),n.write_shift(1,t.length),n.write_shift(t.length,t,"sbcs"),n.l<n.length?n.slice(0,n.l):n}function Q9(e,r,t,n){if(r.v!=null)switch(r.t){case"d":case"n":var o=r.t=="d"?Vs(Es(r.v)):r.v;o==(o|0)&&o>=0&&o<65536?Xt(e,2,hT(t,n,o)):Xt(e,3,fT(t,n,o));return;case"b":case"e":Xt(e,5,K9(t,n,r.v,r.t));return;case"s":case"str":Xt(e,4,J9(t,n,(r.v||"").slice(0,255)));return}Xt(e,1,mu(null,t,n))}function eO(e,r,t,n){var o=Array.isArray(r),u=La(r["!ref"]||"A1"),f,g="",v=[];if(u.e.c>255||u.e.r>16383){if(n.WTF)throw new Error("Range "+(r["!ref"]||"A1")+" exceeds format limit A1:IV16384");u.e.c=Math.min(u.e.c,255),u.e.r=Math.min(u.e.c,16383),f=bn(u)}for(var p=u.s.r;p<=u.e.r;++p){g=ts(p);for(var k=u.s.c;k<=u.e.c;++k){p===u.s.r&&(v[k]=hs(k)),f=v[k]+g;var N=o?(r[p]||[])[k]:r[f];N&&Q9(e,N,p,k)}}}function tO(e,r){for(var t=r||{},n=Ws(),o=0,u=0;u<e.SheetNames.length;++u)e.SheetNames[u]==t.sheet&&(o=u);if(o==0&&t.sheet&&e.SheetNames[0]!=t.sheet)throw new Error("Sheet not found: "+t.sheet);return Xt(n,t.biff==4?1033:t.biff==3?521:9,rp(e,16,t)),eO(n,e.Sheets[e.SheetNames[o]],o,t),Xt(n,10),n.end()}function rO(e,r,t){Xt(e,49,$C({sz:12,name:"Arial"},t))}function aO(e,r,t){r&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var o=n[0];o<=n[1];++o)r[o]!=null&&Xt(e,1054,JC(o,r[o],t))})}function nO(e,r){var t=xt(19);t.write_shift(4,2151),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(2,3),t.write_shift(1,1),t.write_shift(4,0),Xt(e,2151,t),t=xt(39),t.write_shift(4,2152),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(2,3),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(2,1),t.write_shift(4,4),t.write_shift(2,0),Pw(La(r["!ref"]||"A1"),t),t.write_shift(4,4),Xt(e,2152,t)}function sO(e,r){for(var t=0;t<16;++t)Xt(e,224,rv({numFmtId:0,style:!0},0,r));r.cellXfs.forEach(function(n){Xt(e,224,rv(n,0,r))})}function iO(e,r){for(var t=0;t<r["!links"].length;++t){var n=r["!links"][t];Xt(e,440,iT(n)),n[1].Tooltip&&Xt(e,2048,oT(n))}delete r["!links"]}function oO(e,r){if(r){var t=0;r.forEach(function(n,o){++t<=256&&n&&Xt(e,125,dT(Mh(o,n),o))})}}function lO(e,r,t,n,o){var u=16+Dl(o.cellXfs,r,o);if(r.v==null&&!r.bf){Xt(e,513,xc(t,n,u));return}if(r.bf)Xt(e,6,M7(r,t,n,o,u));else switch(r.t){case"d":case"n":var f=r.t=="d"?Vs(Es(r.v)):r.v;Xt(e,515,rT(t,n,f,u));break;case"b":case"e":Xt(e,517,tT(t,n,r.v,u,o,r.t));break;case"s":case"str":if(o.bookSST){var g=op(o.Strings,r.v,o.revStrings);Xt(e,253,qC(t,n,g,u))}else Xt(e,516,KC(t,n,(r.v||"").slice(0,255),u,o));break;default:Xt(e,513,xc(t,n,u))}}function cO(e,r,t){var n=Ws(),o=t.SheetNames[e],u=t.Sheets[o]||{},f=(t||{}).Workbook||{},g=(f.Sheets||[])[e]||{},v=Array.isArray(u),p=r.biff==8,k,N="",C=[],O=La(u["!ref"]||"A1"),I=p?65536:16384;if(O.e.c>255||O.e.r>=I){if(r.WTF)throw new Error("Range "+(u["!ref"]||"A1")+" exceeds format limit A1:IV16384");O.e.c=Math.min(O.e.c,255),O.e.r=Math.min(O.e.c,I-1)}Xt(n,2057,rp(t,16,r)),Xt(n,13,Si(1)),Xt(n,12,Si(100)),Xt(n,15,Ns(!0)),Xt(n,17,Ns(!1)),Xt(n,16,gc(.001)),Xt(n,95,Ns(!0)),Xt(n,42,Ns(!1)),Xt(n,43,Ns(!1)),Xt(n,130,Si(1)),Xt(n,128,eT()),Xt(n,131,Ns(!1)),Xt(n,132,Ns(!1)),p&&oO(n,u["!cols"]),Xt(n,512,QC(O,r)),p&&(u["!links"]=[]);for(var M=O.s.r;M<=O.e.r;++M){N=ts(M);for(var D=O.s.c;D<=O.e.c;++D){M===O.s.r&&(C[D]=hs(D)),k=C[D]+N;var z=v?(u[M]||[])[D]:u[k];z&&(lO(n,z,M,D,r),p&&z.l&&u["!links"].push([k,z.l]))}}var B=g.CodeName||g.name||o;return p&&Xt(n,574,ZC((f.Views||[])[0])),p&&(u["!merges"]||[]).length&&Xt(n,229,sT(u["!merges"])),p&&iO(n,u),Xt(n,442,Lw(B)),p&&nO(n,u),Xt(n,10),n.end()}function dO(e,r,t){var n=Ws(),o=(e||{}).Workbook||{},u=o.Sheets||[],f=o.WBProps||{},g=t.biff==8,v=t.biff==5;if(Xt(n,2057,rp(e,5,t)),t.bookType=="xla"&&Xt(n,135),Xt(n,225,g?Si(1200):null),Xt(n,193,IC(2)),v&&Xt(n,191),v&&Xt(n,192),Xt(n,226),Xt(n,92,VC("SheetJS",t)),Xt(n,66,Si(g?1200:1252)),g&&Xt(n,353,Si(0)),g&&Xt(n,448),Xt(n,317,uT(e.SheetNames.length)),g&&e.vbaraw&&Xt(n,211),g&&e.vbaraw){var p=f.CodeName||"ThisWorkbook";Xt(n,442,Lw(p))}Xt(n,156,Si(17)),Xt(n,25,Ns(!1)),Xt(n,18,Ns(!1)),Xt(n,19,Si(0)),g&&Xt(n,431,Ns(!1)),g&&Xt(n,444,Si(0)),Xt(n,61,YC()),Xt(n,64,Ns(!1)),Xt(n,141,Si(0)),Xt(n,34,Ns(g9(e)=="true")),Xt(n,14,Ns(!0)),g&&Xt(n,439,Ns(!1)),Xt(n,218,Si(0)),rO(n,e,t),aO(n,e.SSF,t),sO(n,t),g&&Xt(n,352,Ns(!1));var k=n.end(),N=Ws();g&&Xt(N,140,lT()),g&&t.Strings&&q9(N,252,XC(t.Strings)),Xt(N,10);var C=N.end(),O=Ws(),I=0,M=0;for(M=0;M<e.SheetNames.length;++M)I+=(g?12:11)+(g?2:1)*e.SheetNames[M].length;var D=k.length+I+C.length;for(M=0;M<e.SheetNames.length;++M){var z=u[M]||{};Xt(O,133,GC({pos:D,hs:z.Hidden||0,dt:0,name:e.SheetNames[M]},t)),D+=r[M].length}var B=O.end();if(I!=B.length)throw new Error("BS8 "+I+" != "+B.length);var U=[];return k.length&&U.push(k),B.length&&U.push(B),C.length&&U.push(C),Qn(U)}function uO(e,r){var t=r||{},n=[];e&&!e.SSF&&(e.SSF=Gs(rn)),e&&e.SSF&&(Ch(),Eh(e.SSF),t.revssf=Th(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,lp(t),t.cellXfs=[],Dl(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var o=0;o<e.SheetNames.length;++o)n[n.length]=cO(o,t,e);return n.unshift(dO(e,n,t)),Qn(n)}function c4(e,r){for(var t=0;t<=e.SheetNames.length;++t){var n=e.Sheets[e.SheetNames[t]];if(!(!n||!n["!ref"])){var o=hi(n["!ref"]);o.e.c>255&&typeof console!="undefined"&&console.error&&console.error("Worksheet '"+e.SheetNames[t]+"' extends beyond column IV (255). Data may be lost.")}}var u=r||{};switch(u.biff||2){case 8:case 5:return uO(e,r);case 4:case 3:case 2:return tO(e,r)}throw new Error("invalid type "+u.bookType+" for BIFF")}function fO(e,r,t,n){for(var o=e["!merges"]||[],u=[],f=r.s.c;f<=r.e.c;++f){for(var g=0,v=0,p=0;p<o.length;++p)if(!(o[p].s.r>t||o[p].s.c>f)&&!(o[p].e.r<t||o[p].e.c<f)){if(o[p].s.r<t||o[p].s.c<f){g=-1;break}g=o[p].e.r-o[p].s.r+1,v=o[p].e.c-o[p].s.c+1;break}if(!(g<0)){var k=ka({r:t,c:f}),N=n.dense?(e[t]||[])[f]:e[k],C=N&&N.v!=null&&(N.h||WE(N.w||(qo(N),N.w)||""))||"",O={};g>1&&(O.rowspan=g),v>1&&(O.colspan=v),n.editable?C='<span contenteditable="true">'+C+"</span>":N&&(O["data-t"]=N&&N.t||"z",N.v!=null&&(O["data-v"]=N.v),N.z!=null&&(O["data-z"]=N.z),N.l&&(N.l.Target||"#").charAt(0)!="#"&&(C='<a href="'+N.l.Target+'">'+C+"</a>")),O.id=(n.id||"sjs")+"-"+k,u.push(Vt("td",C,O))}}var I="<tr>";return I+u.join("")+"</tr>"}var hO='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',mO="</body></html>";function gO(e,r,t){var n=[];return n.join("")+"<table"+(t&&t.id?' id="'+t.id+'"':"")+">"}function d4(e,r){var t=r||{},n=t.header!=null?t.header:hO,o=t.footer!=null?t.footer:mO,u=[n],f=hi(e["!ref"]);t.dense=Array.isArray(e),u.push(gO(e,f,t));for(var g=f.s.r;g<=f.e.r;++g)u.push(fO(e,f,g,t));return u.push("</table>"+o),u.join("")}function u4(e,r,t){var n=t||{},o=0,u=0;if(n.origin!=null)if(typeof n.origin=="number")o=n.origin;else{var f=typeof n.origin=="string"?Pn(n.origin):n.origin;o=f.r,u=f.c}var g=r.getElementsByTagName("tr"),v=Math.min(n.sheetRows||1e7,g.length),p={s:{r:0,c:0},e:{r:o,c:u}};if(e["!ref"]){var k=hi(e["!ref"]);p.s.r=Math.min(p.s.r,k.s.r),p.s.c=Math.min(p.s.c,k.s.c),p.e.r=Math.max(p.e.r,k.e.r),p.e.c=Math.max(p.e.c,k.e.c),o==-1&&(p.e.r=o=k.e.r+1)}var N=[],C=0,O=e["!rows"]||(e["!rows"]=[]),I=0,M=0,D=0,z=0,B=0,U=0;for(e["!cols"]||(e["!cols"]=[]);I<g.length&&M<v;++I){var H=g[I];if(cv(H)){if(n.display)continue;O[M]={hidden:!0}}var q=H.children;for(D=z=0;D<q.length;++D){var ne=q[D];if(!(n.display&&cv(ne))){var V=ne.hasAttribute("data-v")?ne.getAttribute("data-v"):ne.hasAttribute("v")?ne.getAttribute("v"):YE(ne.innerHTML),J=ne.getAttribute("data-z")||ne.getAttribute("z");for(C=0;C<N.length;++C){var Q=N[C];Q.s.c==z+u&&Q.s.r<M+o&&M+o<=Q.e.r&&(z=Q.e.c+1-u,C=-1)}U=+ne.getAttribute("colspan")||1,((B=+ne.getAttribute("rowspan")||1)>1||U>1)&&N.push({s:{r:M+o,c:z+u},e:{r:M+o+(B||1)-1,c:z+u+(U||1)-1}});var Te={t:"s",v:V},je=ne.getAttribute("data-t")||ne.getAttribute("t")||"";V!=null&&(V.length==0?Te.t=je||"z":n.raw||V.trim().length==0||je=="s"||(V==="TRUE"?Te={t:"b",v:!0}:V==="FALSE"?Te={t:"b",v:!1}:isNaN(Vo(V))?isNaN(Z0(V).getDate())||(Te={t:"d",v:Es(V)},n.cellDates||(Te={t:"n",v:Vs(Te.v)}),Te.z=n.dateNF||rn[14]):Te={t:"n",v:Vo(V)})),Te.z===void 0&&J!=null&&(Te.z=J);var me="",Se=ne.getElementsByTagName("A");if(Se&&Se.length)for(var Oe=0;Oe<Se.length&&!(Se[Oe].hasAttribute("href")&&(me=Se[Oe].getAttribute("href"),me.charAt(0)!="#"));++Oe);me&&me.charAt(0)!="#"&&(Te.l={Target:me}),n.dense?(e[M+o]||(e[M+o]=[]),e[M+o][z+u]=Te):e[ka({c:z+u,r:M+o})]=Te,p.e.c<z+u&&(p.e.c=z+u),z+=U}}++M}return N.length&&(e["!merges"]=(e["!merges"]||[]).concat(N)),p.e.r=Math.max(p.e.r,M-1+o),e["!ref"]=bn(p),M>=v&&(e["!fullref"]=bn((p.e.r=g.length-I+M-1+o,p))),e}function f4(e,r){var t=r||{},n=t.dense?[]:{};return u4(n,e,r)}function xO(e,r){return bc(f4(e,r),r)}function cv(e){var r="",t=pO(e);return t&&(r=t(e).getPropertyValue("display")),r||(r=e.style&&e.style.display),r==="none"}function pO(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var yO=(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(""),r="<office:document-styles "+q0({"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 vn+r}})(),dv=(function(){var e=function(u){return wa(u).replace(/ +/g,function(f){return'<text:s text:c="'+f.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},r=` <table:table-cell />
`,t=` <table:covered-table-cell/>
`,n=function(u,f,g){var v=[];v.push(' <table:table table:name="'+wa(f.SheetNames[g])+`" table:style-name="ta1">
`);var p=0,k=0,N=hi(u["!ref"]||"A1"),C=u["!merges"]||[],O=0,I=Array.isArray(u);if(u["!cols"])for(k=0;k<=N.e.c;++k)v.push(" <table:table-column"+(u["!cols"][k]?' table:style-name="co'+u["!cols"][k].ods+'"':"")+`></table:table-column>
`);var M="",D=u["!rows"]||[];for(p=0;p<N.s.r;++p)M=D[p]?' table:style-name="ro'+D[p].ods+'"':"",v.push(" <table:table-row"+M+`></table:table-row>
`);for(;p<=N.e.r;++p){for(M=D[p]?' table:style-name="ro'+D[p].ods+'"':"",v.push(" <table:table-row"+M+`>
`),k=0;k<N.s.c;++k)v.push(r);for(;k<=N.e.c;++k){var z=!1,B={},U="";for(O=0;O!=C.length;++O)if(!(C[O].s.c>k)&&!(C[O].s.r>p)&&!(C[O].e.c<k)&&!(C[O].e.r<p)){(C[O].s.c!=k||C[O].s.r!=p)&&(z=!0),B["table:number-columns-spanned"]=C[O].e.c-C[O].s.c+1,B["table:number-rows-spanned"]=C[O].e.r-C[O].s.r+1;break}if(z){v.push(t);continue}var H=ka({r:p,c:k}),q=I?(u[p]||[])[k]:u[H];if(q&&q.f&&(B["table:formula"]=wa(F7(q.f)),q.F&&q.F.slice(0,H.length)==H)){var ne=hi(q.F);B["table:number-matrix-columns-spanned"]=ne.e.c-ne.s.c+1,B["table:number-matrix-rows-spanned"]=ne.e.r-ne.s.r+1}if(!q){v.push(r);continue}switch(q.t){case"b":U=q.v?"TRUE":"FALSE",B["office:value-type"]="boolean",B["office:boolean-value"]=q.v?"true":"false";break;case"n":U=q.w||String(q.v||0),B["office:value-type"]="float",B["office:value"]=q.v||0;break;case"s":case"str":U=q.v==null?"":q.v,B["office:value-type"]="string";break;case"d":U=q.w||Es(q.v).toISOString(),B["office:value-type"]="date",B["office:date-value"]=Es(q.v).toISOString(),B["table:style-name"]="ce1";break;default:v.push(r);continue}var V=e(U);if(q.l&&q.l.Target){var J=q.l.Target;J=J.charAt(0)=="#"?"#"+B7(J.slice(1)):J,J.charAt(0)!="#"&&!J.match(/^\w+:/)&&(J="../"+J),V=Vt("text:a",V,{"xlink:href":J.replace(/&/g,"&amp;")})}v.push(" "+Vt("table:table-cell",Vt("text:p",V,{}),B)+`
`)}v.push(` </table:table-row>
`)}return v.push(` </table:table>
`),v.join("")},o=function(u,f){u.push(` <office:automatic-styles>
`),u.push(` <number:date-style style:name="N37" number:automatic-order="true">
`),u.push(` <number:month number:style="long"/>
`),u.push(` <number:text>/</number:text>
`),u.push(` <number:day number:style="long"/>
`),u.push(` <number:text>/</number:text>
`),u.push(` <number:year/>
`),u.push(` </number:date-style>
`);var g=0;f.SheetNames.map(function(p){return f.Sheets[p]}).forEach(function(p){if(p&&p["!cols"]){for(var k=0;k<p["!cols"].length;++k)if(p["!cols"][k]){var N=p["!cols"][k];if(N.width==null&&N.wpx==null&&N.wch==null)continue;ap(N),N.ods=g;var C=p["!cols"][k].wpx+"px";u.push(' <style:style style:name="co'+g+`" style:family="table-column">
`),u.push(' <style:table-column-properties fo:break-before="auto" style:column-width="'+C+`"/>
`),u.push(` </style:style>
`),++g}}});var v=0;f.SheetNames.map(function(p){return f.Sheets[p]}).forEach(function(p){if(p&&p["!rows"]){for(var k=0;k<p["!rows"].length;++k)if(p["!rows"][k]){p["!rows"][k].ods=v;var N=p["!rows"][k].hpx+"px";u.push(' <style:style style:name="ro'+v+`" style:family="table-row">
`),u.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+N+`"/>
`),u.push(` </style:style>
`),++v}}}),u.push(` <style:style style:name="ta1" style:family="table" style:master-page-name="mp1">
`),u.push(` <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
`),u.push(` </style:style>
`),u.push(` <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>
`),u.push(` </office:automatic-styles>
`)};return function(f,g){var v=[vn],p=q0({"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"}),k=q0({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});g.bookType=="fods"?(v.push("<office:document"+p+k+`>
`),v.push(Cw().replace(/office:document-meta/g,"office:meta"))):v.push("<office:document-content"+p+`>
`),o(v,f),v.push(` <office:body>
`),v.push(` <office:spreadsheet>
`);for(var N=0;N!=f.SheetNames.length;++N)v.push(n(f.Sheets[f.SheetNames[N]],f,N));return v.push(` </office:spreadsheet>
`),v.push(` </office:body>
`),g.bookType=="fods"?v.push("</office:document>"):v.push("</office:document-content>"),v.join("")}})();function h4(e,r){if(r.bookType=="fods")return dv(e,r);var t=Xx(),n="",o=[],u=[];return n="mimetype",Fr(t,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",Fr(t,n,dv(e,r)),o.push([n,"text/xml"]),u.push([n,"ContentFile"]),n="styles.xml",Fr(t,n,yO(e,r)),o.push([n,"text/xml"]),u.push([n,"StylesFile"]),n="meta.xml",Fr(t,n,vn+Cw()),o.push([n,"text/xml"]),u.push([n,"MetadataFile"]),n="manifest.rdf",Fr(t,n,jC(u)),o.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",Fr(t,n,TC(o)),t}function oh(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function bO(e){return typeof TextEncoder!="undefined"?new TextEncoder().encode(e):Gi($0(e))}function vO(e,r){e:for(var t=0;t<=e.length-r.length;++t){for(var n=0;n<r.length;++n)if(e[t+n]!=r[n])continue e;return!0}return!1}function Ol(e){var r=e.reduce(function(o,u){return o+u.length},0),t=new Uint8Array(r),n=0;return e.forEach(function(o){t.set(o,n),n+=o.length}),t}function _O(e,r,t){var n=Math.floor(t==0?0:Math.LOG10E*Math.log(Math.abs(t)))+6176-20,o=t/Math.pow(10,n-6176);e[r+15]|=n>>7,e[r+14]|=(n&127)<<1;for(var u=0;o>=1;++u,o/=256)e[r+u]=o&255;e[r+15]|=t>=0?0:128}function K0(e,r){var t=r?r[0]:0,n=e[t]&127;e:if(e[t++]>=128&&(n|=(e[t]&127)<<7,e[t++]<128||(n|=(e[t]&127)<<14,e[t++]<128)||(n|=(e[t]&127)<<21,e[t++]<128)||(n+=(e[t]&127)*Math.pow(2,28),++t,e[t++]<128)||(n+=(e[t]&127)*Math.pow(2,35),++t,e[t++]<128)||(n+=(e[t]&127)*Math.pow(2,42),++t,e[t++]<128)))break e;return r&&(r[0]=t),n}function va(e){var r=new Uint8Array(7);r[0]=e&127;var t=1;e:if(e>127){if(r[t-1]|=128,r[t]=e>>7&127,++t,e<=16383||(r[t-1]|=128,r[t]=e>>14&127,++t,e<=2097151)||(r[t-1]|=128,r[t]=e>>21&127,++t,e<=268435455)||(r[t-1]|=128,r[t]=e/256>>>21&127,++t,e<=34359738367)||(r[t-1]|=128,r[t]=e/65536>>>21&127,++t,e<=4398046511103))break e;r[t-1]|=128,r[t]=e/16777216>>>21&127,++t}return r.slice(0,t)}function _d(e){var r=0,t=e[r]&127;e:if(e[r++]>=128){if(t|=(e[r]&127)<<7,e[r++]<128||(t|=(e[r]&127)<<14,e[r++]<128)||(t|=(e[r]&127)<<21,e[r++]<128))break e;t|=(e[r]&127)<<28}return t}function Cn(e){for(var r=[],t=[0];t[0]<e.length;){var n=t[0],o=K0(e,t),u=o&7;o=Math.floor(o/8);var f=0,g;if(o==0)break;switch(u){case 0:{for(var v=t[0];e[t[0]++]>=128;);g=e.slice(v,t[0])}break;case 5:f=4,g=e.slice(t[0],t[0]+f),t[0]+=f;break;case 1:f=8,g=e.slice(t[0],t[0]+f),t[0]+=f;break;case 2:f=K0(e,t),g=e.slice(t[0],t[0]+f),t[0]+=f;break;case 3:case 4:default:throw new Error("PB Type ".concat(u," for Field ").concat(o," at offset ").concat(n))}var p={data:g,type:u};r[o]==null?r[o]=[p]:r[o].push(p)}return r}function Kn(e){var r=[];return e.forEach(function(t,n){t.forEach(function(o){o.data&&(r.push(va(n*8+o.type)),o.type==2&&r.push(va(o.data.length)),r.push(o.data))})}),Ol(r)}function Wi(e){for(var r,t=[],n=[0];n[0]<e.length;){var o=K0(e,n),u=Cn(e.slice(n[0],n[0]+o));n[0]+=o;var f={id:_d(u[1][0].data),messages:[]};u[2].forEach(function(g){var v=Cn(g.data),p=_d(v[3][0].data);f.messages.push({meta:v,data:e.slice(n[0],n[0]+p)}),n[0]+=p}),(r=u[3])!=null&&r[0]&&(f.merge=_d(u[3][0].data)>>>0>0),t.push(f)}return t}function od(e){var r=[];return e.forEach(function(t){var n=[];n[1]=[{data:va(t.id),type:0}],n[2]=[],t.merge!=null&&(n[3]=[{data:va(+!!t.merge),type:0}]);var o=[];t.messages.forEach(function(f){o.push(f.data),f.meta[3]=[{type:0,data:va(f.data.length)}],n[2].push({data:Kn(f.meta),type:2})});var u=Kn(n);r.push(va(u.length)),r.push(u),o.forEach(function(f){return r.push(f)})}),Ol(r)}function wO(e,r){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var t=[0],n=K0(r,t),o=[];t[0]<r.length;){var u=r[t[0]]&3;if(u==0){var f=r[t[0]++]>>2;if(f<60)++f;else{var g=f-59;f=r[t[0]],g>1&&(f|=r[t[0]+1]<<8),g>2&&(f|=r[t[0]+2]<<16),g>3&&(f|=r[t[0]+3]<<24),f>>>=0,f++,t[0]+=g}o.push(r.slice(t[0],t[0]+f)),t[0]+=f;continue}else{var v=0,p=0;if(u==1?(p=(r[t[0]]>>2&7)+4,v=(r[t[0]++]&224)<<3,v|=r[t[0]++]):(p=(r[t[0]++]>>2)+1,u==2?(v=r[t[0]]|r[t[0]+1]<<8,t[0]+=2):(v=(r[t[0]]|r[t[0]+1]<<8|r[t[0]+2]<<16|r[t[0]+3]<<24)>>>0,t[0]+=4)),o=[Ol(o)],v==0)throw new Error("Invalid offset 0");if(v>o[0].length)throw new Error("Invalid offset beyond length");if(p>=v)for(o.push(o[0].slice(-v)),p-=v;p>=o[o.length-1].length;)o.push(o[o.length-1]),p-=o[o.length-1].length;o.push(o[0].slice(-v,-v+p))}}var k=Ol(o);if(k.length!=n)throw new Error("Unexpected length: ".concat(k.length," != ").concat(n));return k}function Vi(e){for(var r=[],t=0;t<e.length;){var n=e[t++],o=e[t]|e[t+1]<<8|e[t+2]<<16;t+=3,r.push(wO(n,e.slice(t,t+o))),t+=o}if(t!==e.length)throw new Error("data is not a valid framed stream!");return Ol(r)}function ld(e){for(var r=[],t=0;t<e.length;){var n=Math.min(e.length-t,268435455),o=new Uint8Array(4);r.push(o);var u=va(n),f=u.length;r.push(u),n<=60?(f++,r.push(new Uint8Array([n-1<<2]))):n<=256?(f+=2,r.push(new Uint8Array([240,n-1&255]))):n<=65536?(f+=3,r.push(new Uint8Array([244,n-1&255,n-1>>8&255]))):n<=16777216?(f+=4,r.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(f+=5,r.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),r.push(e.slice(t,t+n)),f+=n,o[0]=0,o[1]=f&255,o[2]=f>>8&255,o[3]=f>>16&255,t+=n}return Ol(r)}function Yg(e,r){var t=new Uint8Array(32),n=oh(t),o=12,u=0;switch(t[0]=5,e.t){case"n":t[1]=2,_O(t,o,e.v),u|=1,o+=16;break;case"b":t[1]=6,n.setFloat64(o,e.v?1:0,!0),u|=2,o+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));t[1]=3,n.setUint32(o,r.indexOf(e.v),!0),u|=8,o+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,u,!0),t.slice(0,o)}function Zg(e,r){var t=new Uint8Array(32),n=oh(t),o=12,u=0;switch(t[0]=3,e.t){case"n":t[2]=2,n.setFloat64(o,e.v,!0),u|=32,o+=8;break;case"b":t[2]=6,n.setFloat64(o,e.v?1:0,!0),u|=32,o+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));t[2]=3,n.setUint32(o,r.indexOf(e.v),!0),u|=16,o+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,u,!0),t.slice(0,o)}function Sl(e){var r=Cn(e);return K0(r[1][0].data)}function kO(e,r,t){var n,o,u,f;if(!((n=e[6])!=null&&n[0])||!((o=e[7])!=null&&o[0]))throw"Mutation only works on post-BNC storages!";var g=((f=(u=e[8])==null?void 0:u[0])==null?void 0:f.data)&&_d(e[8][0].data)>0||!1;if(g)throw"Math only works with normal offsets";for(var v=0,p=oh(e[7][0].data),k=0,N=[],C=oh(e[4][0].data),O=0,I=[],M=0;M<r.length;++M){if(r[M]==null){p.setUint16(M*2,65535,!0),C.setUint16(M*2,65535);continue}p.setUint16(M*2,k,!0),C.setUint16(M*2,O,!0);var D,z;switch(typeof r[M]){case"string":D=Yg({t:"s",v:r[M]},t),z=Zg({t:"s",v:r[M]},t);break;case"number":D=Yg({t:"n",v:r[M]},t),z=Zg({t:"n",v:r[M]},t);break;case"boolean":D=Yg({t:"b",v:r[M]},t),z=Zg({t:"b",v:r[M]},t);break;default:throw new Error("Unsupported value "+r[M])}N.push(D),k+=D.length,I.push(z),O+=z.length,++v}for(e[2][0].data=va(v);M<e[7][0].data.length/2;++M)p.setUint16(M*2,65535,!0),C.setUint16(M*2,65535,!0);return e[6][0].data=Ol(N),e[3][0].data=Ol(I),v}function NO(e,r){if(!r||!r.numbers)throw new Error("Must pass a `numbers` option -- check the README");var t=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var n=hi(t["!ref"]);n.s.r=n.s.c=0;var o=!1;n.e.c>9&&(o=!0,n.e.c=9),n.e.r>49&&(o=!0,n.e.r=49),o&&console.error("The Numbers writer is currently limited to ".concat(bn(n)));var u=lh(t,{range:n,header:1}),f=["~Sh33tJ5~"];u.forEach(function(ae){return ae.forEach(function(se){typeof se=="string"&&f.push(se)})});var g={},v=[],p=Aa.read(r.numbers,{type:"base64"});p.FileIndex.map(function(ae,se){return[ae,p.FullPaths[se]]}).forEach(function(ae){var se=ae[0],he=ae[1];if(se.type==2&&se.name.match(/\.iwa/)){var pe=se.content,Je=Vi(pe),Fe=Wi(Je);Fe.forEach(function(ft){v.push(ft.id),g[ft.id]={deps:[],location:he,type:_d(ft.messages[0].meta[1][0].data)}})}}),v.sort(function(ae,se){return ae-se});var k=v.filter(function(ae){return ae>1}).map(function(ae){return[ae,va(ae)]});p.FileIndex.map(function(ae,se){return[ae,p.FullPaths[se]]}).forEach(function(ae){var se=ae[0];if(ae[1],!!se.name.match(/\.iwa/)){var he=Wi(Vi(se.content));he.forEach(function(pe){pe.messages.forEach(function(Je){k.forEach(function(Fe){pe.messages.some(function(ft){return _d(ft.meta[1][0].data)!=11006&&vO(ft.data,Fe[1])})&&g[Fe[0]].deps.push(pe.id)})})})}});for(var N=Aa.find(p,g[1].location),C=Wi(Vi(N.content)),O,I=0;I<C.length;++I){var M=C[I];M.id==1&&(O=M)}var D=Sl(Cn(O.messages[0].data)[1][0].data);for(N=Aa.find(p,g[D].location),C=Wi(Vi(N.content)),I=0;I<C.length;++I)M=C[I],M.id==D&&(O=M);for(D=Sl(Cn(O.messages[0].data)[2][0].data),N=Aa.find(p,g[D].location),C=Wi(Vi(N.content)),I=0;I<C.length;++I)M=C[I],M.id==D&&(O=M);for(D=Sl(Cn(O.messages[0].data)[2][0].data),N=Aa.find(p,g[D].location),C=Wi(Vi(N.content)),I=0;I<C.length;++I)M=C[I],M.id==D&&(O=M);var z=Cn(O.messages[0].data);{z[6][0].data=va(n.e.r+1),z[7][0].data=va(n.e.c+1);var B=Sl(z[46][0].data),U=Aa.find(p,g[B].location),H=Wi(Vi(U.content));{for(var q=0;q<H.length&&H[q].id!=B;++q);if(H[q].id!=B)throw"Bad ColumnRowUIDMapArchive";var ne=Cn(H[q].messages[0].data);ne[1]=[],ne[2]=[],ne[3]=[];for(var V=0;V<=n.e.c;++V){var J=[];J[1]=J[2]=[{type:0,data:va(V+420690)}],ne[1].push({type:2,data:Kn(J)}),ne[2].push({type:0,data:va(V)}),ne[3].push({type:0,data:va(V)})}ne[4]=[],ne[5]=[],ne[6]=[];for(var Q=0;Q<=n.e.r;++Q)J=[],J[1]=J[2]=[{type:0,data:va(Q+726270)}],ne[4].push({type:2,data:Kn(J)}),ne[5].push({type:0,data:va(Q)}),ne[6].push({type:0,data:va(Q)});H[q].messages[0].data=Kn(ne)}U.content=ld(od(H)),U.size=U.content.length,delete z[46];var Te=Cn(z[4][0].data);{Te[7][0].data=va(n.e.r+1);var je=Cn(Te[1][0].data),me=Sl(je[2][0].data);U=Aa.find(p,g[me].location),H=Wi(Vi(U.content));{if(H[0].id!=me)throw"Bad HeaderStorageBucket";var Se=Cn(H[0].messages[0].data);for(Q=0;Q<u.length;++Q){var Oe=Cn(Se[2][0].data);Oe[1][0].data=va(Q),Oe[4][0].data=va(u[Q].length),Se[2][Q]={type:Se[2][0].type,data:Kn(Oe)}}H[0].messages[0].data=Kn(Se)}U.content=ld(od(H)),U.size=U.content.length;var ue=Sl(Te[2][0].data);U=Aa.find(p,g[ue].location),H=Wi(Vi(U.content));{if(H[0].id!=ue)throw"Bad HeaderStorageBucket";for(Se=Cn(H[0].messages[0].data),V=0;V<=n.e.c;++V)Oe=Cn(Se[2][0].data),Oe[1][0].data=va(V),Oe[4][0].data=va(n.e.r+1),Se[2][V]={type:Se[2][0].type,data:Kn(Oe)};H[0].messages[0].data=Kn(Se)}U.content=ld(od(H)),U.size=U.content.length;var be=Sl(Te[4][0].data);(function(){for(var ae=Aa.find(p,g[be].location),se=Wi(Vi(ae.content)),he,pe=0;pe<se.length;++pe){var Je=se[pe];Je.id==be&&(he=Je)}var Fe=Cn(he.messages[0].data);{Fe[3]=[];var ft=[];f.forEach(function(zt,Ht){ft[1]=[{type:0,data:va(Ht)}],ft[2]=[{type:0,data:va(1)}],ft[3]=[{type:2,data:bO(zt)}],Fe[3].push({type:2,data:Kn(ft)})})}he.messages[0].data=Kn(Fe);var ot=od(se),Lt=ld(ot);ae.content=Lt,ae.size=ae.content.length})();var re=Cn(Te[3][0].data);{var de=re[1][0];delete re[2];var Ae=Cn(de.data);{var _e=Sl(Ae[2][0].data);(function(){for(var ae=Aa.find(p,g[_e].location),se=Wi(Vi(ae.content)),he,pe=0;pe<se.length;++pe){var Je=se[pe];Je.id==_e&&(he=Je)}var Fe=Cn(he.messages[0].data);{delete Fe[6],delete re[7];var ft=new Uint8Array(Fe[5][0].data);Fe[5]=[];for(var ot=0,Lt=0;Lt<=n.e.r;++Lt){var zt=Cn(ft);ot+=kO(zt,u[Lt],f),zt[1][0].data=va(Lt),Fe[5].push({data:Kn(zt),type:2})}Fe[1]=[{type:0,data:va(n.e.c+1)}],Fe[2]=[{type:0,data:va(n.e.r+1)}],Fe[3]=[{type:0,data:va(ot)}],Fe[4]=[{type:0,data:va(n.e.r+1)}]}he.messages[0].data=Kn(Fe);var Ht=od(se),ht=ld(Ht);ae.content=ht,ae.size=ae.content.length})()}de.data=Kn(Ae)}Te[3][0].data=Kn(re)}z[4][0].data=Kn(Te)}O.messages[0].data=Kn(z);var K=od(C),W=ld(K);return N.content=W,N.size=N.content.length,p}function SO(e){return function(t){for(var n=0;n!=e.length;++n){var o=e[n];t[o[0]]===void 0&&(t[o[0]]=o[1]),o[2]==="n"&&(t[o[0]]=Number(t[o[0]]))}}}function lp(e){SO([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function EO(e,r){return r.bookType=="ods"?h4(e,r):r.bookType=="numbers"?NO(e,r):r.bookType=="xlsb"?CO(e,r):TO(e,r)}function CO(e,r){hd=1024,e&&!e.SSF&&(e.SSF=Gs(rn)),e&&e.SSF&&(Ch(),Eh(e.SSF),r.revssf=Th(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,H0?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var t=r.bookType=="xlsb"?"bin":"xml",n=$w.indexOf(r.bookType)>-1,o=Nw();lp(r=r||{});var u=Xx(),f="",g=0;if(r.cellXfs=[],Dl(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),f="docProps/core.xml",Fr(u,f,Tw(e.Props,r)),o.coreprops.push(f),_a(r.rels,2,f,oa.CORE_PROPS),f="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var v=[],p=0;p<e.SheetNames.length;++p)(e.Workbook.Sheets[p]||{}).Hidden!=2&&v.push(e.SheetNames[p]);e.Props.SheetNames=v}for(e.Props.Worksheets=e.Props.SheetNames.length,Fr(u,f,jw(e.Props)),o.extprops.push(f),_a(r.rels,3,f,oa.EXT_PROPS),e.Custprops!==e.Props&&as(e.Custprops||{}).length>0&&(f="docProps/custom.xml",Fr(u,f,Ow(e.Custprops)),o.custprops.push(f),_a(r.rels,4,f,oa.CUST_PROPS)),g=1;g<=e.SheetNames.length;++g){var k={"!id":{}},N=e.Sheets[e.SheetNames[g-1]],C=(N||{})["!type"]||"sheet";switch(C){case"chart":default:f="xl/worksheets/sheet"+g+"."+t,Fr(u,f,j9(g-1,f,r,e,k)),o.sheets.push(f),_a(r.wbrels,-1,"worksheets/sheet"+g+"."+t,oa.WS[0])}if(N){var O=N["!comments"],I=!1,M="";O&&O.length>0&&(M="xl/comments"+g+"."+t,Fr(u,M,R9(O,M)),o.comments.push(M),_a(k,-1,"../comments"+g+"."+t,oa.CMNT),I=!0),N["!legacy"]&&I&&Fr(u,"xl/drawings/vmlDrawing"+g+".vml",Yw(g,N["!comments"])),delete N["!comments"],delete N["!legacy"]}k["!id"].rId1&&Fr(u,Ew(f),bd(k))}return r.Strings!=null&&r.Strings.length>0&&(f="xl/sharedStrings."+t,Fr(u,f,M9(r.Strings,f,r)),o.strs.push(f),_a(r.wbrels,-1,"sharedStrings."+t,oa.SST)),f="xl/workbook."+t,Fr(u,f,A9(e,f)),o.workbooks.push(f),_a(r.rels,1,f,oa.WB),f="xl/theme/theme1.xml",Fr(u,f,Gw(e.Themes,r)),o.themes.push(f),_a(r.wbrels,-1,"theme/theme1.xml",oa.THEME),f="xl/styles."+t,Fr(u,f,O9(e,f,r)),o.styles.push(f),_a(r.wbrels,-1,"styles."+t,oa.STY),e.vbaraw&&n&&(f="xl/vbaProject.bin",Fr(u,f,e.vbaraw),o.vba.push(f),_a(r.wbrels,-1,"vbaProject.bin",oa.VBA)),f="xl/metadata."+t,Fr(u,f,D9(f)),o.metadata.push(f),_a(r.wbrels,-1,"metadata."+t,oa.XLMETA),Fr(u,"[Content_Types].xml",Sw(o,r)),Fr(u,"_rels/.rels",bd(r.rels)),Fr(u,"xl/_rels/workbook."+t+".rels",bd(r.wbrels)),delete r.revssf,delete r.ssf,u}function TO(e,r){hd=1024,e&&!e.SSF&&(e.SSF=Gs(rn)),e&&e.SSF&&(Ch(),Eh(e.SSF),r.revssf=Th(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,H0?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var t="xml",n=$w.indexOf(r.bookType)>-1,o=Nw();lp(r=r||{});var u=Xx(),f="",g=0;if(r.cellXfs=[],Dl(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),f="docProps/core.xml",Fr(u,f,Tw(e.Props,r)),o.coreprops.push(f),_a(r.rels,2,f,oa.CORE_PROPS),f="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var v=[],p=0;p<e.SheetNames.length;++p)(e.Workbook.Sheets[p]||{}).Hidden!=2&&v.push(e.SheetNames[p]);e.Props.SheetNames=v}e.Props.Worksheets=e.Props.SheetNames.length,Fr(u,f,jw(e.Props)),o.extprops.push(f),_a(r.rels,3,f,oa.EXT_PROPS),e.Custprops!==e.Props&&as(e.Custprops||{}).length>0&&(f="docProps/custom.xml",Fr(u,f,Ow(e.Custprops)),o.custprops.push(f),_a(r.rels,4,f,oa.CUST_PROPS));var k=["SheetJ5"];for(r.tcid=0,g=1;g<=e.SheetNames.length;++g){var N={"!id":{}},C=e.Sheets[e.SheetNames[g-1]],O=(C||{})["!type"]||"sheet";switch(O){case"chart":default:f="xl/worksheets/sheet"+g+"."+t,Fr(u,f,n4(g-1,r,e,N)),o.sheets.push(f),_a(r.wbrels,-1,"worksheets/sheet"+g+"."+t,oa.WS[0])}if(C){var I=C["!comments"],M=!1,D="";if(I&&I.length>0){var z=!1;I.forEach(function(B){B[1].forEach(function(U){U.T==!0&&(z=!0)})}),z&&(D="xl/threadedComments/threadedComment"+g+"."+t,Fr(u,D,sA(I,k,r)),o.threadedcomments.push(D),_a(N,-1,"../threadedComments/threadedComment"+g+"."+t,oa.TCMNT)),D="xl/comments"+g+"."+t,Fr(u,D,Zw(I)),o.comments.push(D),_a(N,-1,"../comments"+g+"."+t,oa.CMNT),M=!0}C["!legacy"]&&M&&Fr(u,"xl/drawings/vmlDrawing"+g+".vml",Yw(g,C["!comments"])),delete C["!comments"],delete C["!legacy"]}N["!id"].rId1&&Fr(u,Ew(f),bd(N))}return r.Strings!=null&&r.Strings.length>0&&(f="xl/sharedStrings."+t,Fr(u,f,Bw(r.Strings,r)),o.strs.push(f),_a(r.wbrels,-1,"sharedStrings."+t,oa.SST)),f="xl/workbook."+t,Fr(u,f,o4(e)),o.workbooks.push(f),_a(r.rels,1,f,oa.WB),f="xl/theme/theme1.xml",Fr(u,f,Gw(e.Themes,r)),o.themes.push(f),_a(r.wbrels,-1,"theme/theme1.xml",oa.THEME),f="xl/styles."+t,Fr(u,f,Ww(e,r)),o.styles.push(f),_a(r.wbrels,-1,"styles."+t,oa.STY),e.vbaraw&&n&&(f="xl/vbaProject.bin",Fr(u,f,e.vbaraw),o.vba.push(f),_a(r.wbrels,-1,"vbaProject.bin",oa.VBA)),f="xl/metadata."+t,Fr(u,f,Xw()),o.metadata.push(f),_a(r.wbrels,-1,"metadata."+t,oa.XLMETA),k.length>1&&(f="xl/persons/person.xml",Fr(u,f,iA(k)),o.people.push(f),_a(r.wbrels,-1,"persons/person.xml",oa.PEOPLE)),Fr(u,"[Content_Types].xml",Sw(o,r)),Fr(u,"_rels/.rels",bd(r.rels)),Fr(u,"xl/_rels/workbook."+t+".rels",bd(r.wbrels)),delete r.revssf,delete r.ssf,u}function AO(e,r){var t="";switch((r||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":t=$o(e.slice(0,12));break;case"binary":t=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 "+(r&&r.type||"undefined"))}return[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3),t.charCodeAt(4),t.charCodeAt(5),t.charCodeAt(6),t.charCodeAt(7)]}function m4(e,r){switch(r.type){case"base64":case"binary":break;case"buffer":case"array":r.type="";break;case"file":return du(r.file,Aa.write(e,{type:ha?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");default:throw new Error("Unrecognized type "+r.type)}return Aa.write(e,r)}function jO(e,r){var t=Gs(r||{}),n=EO(e,t);return OO(n,t)}function OO(e,r){var t={},n=ha?"nodebuffer":typeof Uint8Array!="undefined"?"array":"string";if(r.compression&&(t.compression="DEFLATE"),r.password)t.type=n;else switch(r.type){case"base64":t.type="base64";break;case"binary":t.type="string";break;case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");case"buffer":case"file":t.type=n;break;default:throw new Error("Unrecognized type "+r.type)}var o=e.FullPaths?Aa.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[t.type]||t.type,compression:!!r.compression}):e.generate(t);if(typeof Deno!="undefined"&&typeof o=="string"){if(r.type=="binary"||r.type=="base64")return o;o=new Uint8Array(Sh(o))}return r.password&&typeof encrypt_agile!="undefined"?m4(encrypt_agile(o,r.password),r):r.type==="file"?du(r.file,o):r.type=="string"?F0(o):o}function MO(e,r){var t=r||{},n=Z9(e,t);return m4(n,t)}function mo(e,r,t){t||(t="");var n=t+e;switch(r.type){case"base64":return Y0($0(n));case"binary":return $0(n);case"string":return e;case"file":return du(r.file,n,"utf8");case"buffer":return ha?Jo(n,"utf8"):typeof TextEncoder!="undefined"?new TextEncoder().encode(n):mo(n,{type:"binary"}).split("").map(function(o){return o.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function RO(e,r){switch(r.type){case"base64":return Y0(e);case"binary":return e;case"string":return e;case"file":return du(r.file,e,"binary");case"buffer":return ha?Jo(e,"binary"):e.split("").map(function(t){return t.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function Of(e,r){switch(r.type){case"string":case"base64":case"binary":for(var t="",n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return r.type=="base64"?Y0(t):r.type=="string"?F0(t):t;case"file":return du(r.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+r.type)}}function g4(e,r){oE(),y9(e);var t=Gs(r||{});if(t.cellStyles&&(t.cellNF=!0,t.sheetStubs=!0),t.type=="array"){t.type="binary";var n=g4(e,t);return t.type="array",Sh(n)}var o=0;if(t.sheet&&(typeof t.sheet=="number"?o=t.sheet:o=e.SheetNames.indexOf(t.sheet),!e.SheetNames[o]))throw new Error("Sheet not found: "+t.sheet+" : "+typeof t.sheet);switch(t.bookType||"xlsb"){case"xml":case"xlml":return mo(X9(e,t),t);case"slk":case"sylk":return mo(gT.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"htm":case"html":return mo(d4(e.Sheets[e.SheetNames[o]],t),t);case"txt":return RO(x4(e.Sheets[e.SheetNames[o]],t),t);case"csv":return mo(cp(e.Sheets[e.SheetNames[o]],t),t,"\uFEFF");case"dif":return mo(xT.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"dbf":return Of(mT.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"prn":return mo(pT.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"rtf":return mo(NT.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"eth":return mo(Fw.from_sheet(e.Sheets[e.SheetNames[o]],t),t);case"fods":return mo(h4(e,t),t);case"wk1":return Of(av.sheet_to_wk1(e.Sheets[e.SheetNames[o]],t),t);case"wk3":return Of(av.book_to_wk3(e,t),t);case"biff2":t.biff||(t.biff=2);case"biff3":t.biff||(t.biff=3);case"biff4":return t.biff||(t.biff=4),Of(c4(e,t),t);case"biff5":t.biff||(t.biff=5);case"biff8":case"xla":case"xls":return t.biff||(t.biff=8),MO(e,t);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return jO(e,t);default:throw new Error("Unrecognized bookType |"+t.bookType+"|")}}function DO(e){if(!e.bookType){var r={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},t=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();t.match(/^\.[a-z]+$/)&&(e.bookType=t.slice(1)),e.bookType=r[e.bookType]||e.bookType}}function Fd(e,r,t){var n={};return n.type="file",n.file=r,DO(n),g4(e,n)}function IO(e,r,t,n,o,u,f,g){var v=ts(t),p=g.defval,k=g.raw||!Object.prototype.hasOwnProperty.call(g,"raw"),N=!0,C=o===1?[]:{};if(o!==1)if(Object.defineProperty)try{Object.defineProperty(C,"__rowNum__",{value:t,enumerable:!1})}catch(D){C.__rowNum__=t}else C.__rowNum__=t;if(!f||e[t])for(var O=r.s.c;O<=r.e.c;++O){var I=f?e[t][O]:e[n[O]+v];if(I===void 0||I.t===void 0){if(p===void 0)continue;u[O]!=null&&(C[u[O]]=p);continue}var M=I.v;switch(I.t){case"z":if(M==null)break;continue;case"e":M=M==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+I.t)}if(u[O]!=null){if(M==null)if(I.t=="e"&&M===null)C[u[O]]=null;else if(p!==void 0)C[u[O]]=p;else if(k&&M===null)C[u[O]]=null;else continue;else C[u[O]]=k&&(I.t!=="n"||I.t==="n"&&g.rawNumbers!==!1)?M:qo(I,M,g);M!=null&&(N=!1)}}return{row:C,isempty:N}}function lh(e,r){if(e==null||e["!ref"]==null)return[];var t={t:"n",v:0},n=0,o=1,u=[],f=0,g="",v={s:{r:0,c:0},e:{r:0,c:0}},p=r||{},k=p.range!=null?p.range:e["!ref"];switch(p.header===1?n=1:p.header==="A"?n=2:Array.isArray(p.header)?n=3:p.header==null&&(n=0),typeof k){case"string":v=La(k);break;case"number":v=La(e["!ref"]),v.s.r=k;break;default:v=k}n>0&&(o=0);var N=ts(v.s.r),C=[],O=[],I=0,M=0,D=Array.isArray(e),z=v.s.r,B=0,U={};D&&!e[z]&&(e[z]=[]);var H=p.skipHidden&&e["!cols"]||[],q=p.skipHidden&&e["!rows"]||[];for(B=v.s.c;B<=v.e.c;++B)if(!(H[B]||{}).hidden)switch(C[B]=hs(B),t=D?e[z][B]:e[C[B]+N],n){case 1:u[B]=B-v.s.c;break;case 2:u[B]=C[B];break;case 3:u[B]=p.header[B-v.s.c];break;default:if(t==null&&(t={w:"__EMPTY",t:"s"}),g=f=qo(t,null,p),M=U[f]||0,!M)U[f]=1;else{do g=f+"_"+M++;while(U[g]);U[f]=M,U[g]=1}u[B]=g}for(z=v.s.r+o;z<=v.e.r;++z)if(!(q[z]||{}).hidden){var ne=IO(e,v,z,C,n,u,D,p);(ne.isempty===!1||(n===1?p.blankrows!==!1:p.blankrows))&&(O[I++]=ne.row)}return O.length=I,O}var uv=/"/g;function LO(e,r,t,n,o,u,f,g){for(var v=!0,p=[],k="",N=ts(t),C=r.s.c;C<=r.e.c;++C)if(n[C]){var O=g.dense?(e[t]||[])[C]:e[n[C]+N];if(O==null)k="";else if(O.v!=null){v=!1,k=""+(g.rawNumbers&&O.t=="n"?O.v:qo(O,null,g));for(var I=0,M=0;I!==k.length;++I)if((M=k.charCodeAt(I))===o||M===u||M===34||g.forceQuotes){k='"'+k.replace(uv,'""')+'"';break}k=="ID"&&(k='"ID"')}else O.f!=null&&!O.F?(v=!1,k="="+O.f,k.indexOf(",")>=0&&(k='"'+k.replace(uv,'""')+'"')):k="";p.push(k)}return g.blankrows===!1&&v?null:p.join(f)}function cp(e,r){var t=[],n=r==null?{}:r;if(e==null||e["!ref"]==null)return"";var o=La(e["!ref"]),u=n.FS!==void 0?n.FS:",",f=u.charCodeAt(0),g=n.RS!==void 0?n.RS:`
`,v=g.charCodeAt(0),p=new RegExp((u=="|"?"\\|":u)+"+$"),k="",N=[];n.dense=Array.isArray(e);for(var C=n.skipHidden&&e["!cols"]||[],O=n.skipHidden&&e["!rows"]||[],I=o.s.c;I<=o.e.c;++I)(C[I]||{}).hidden||(N[I]=hs(I));for(var M=0,D=o.s.r;D<=o.e.r;++D)(O[D]||{}).hidden||(k=LO(e,o,D,N,f,v,u,n),k!=null&&(n.strip&&(k=k.replace(p,"")),(k||n.blankrows!==!1)&&t.push((M++?g:"")+k)));return delete n.dense,t.join("")}function x4(e,r){r||(r={}),r.FS=" ",r.RS=`
`;var t=cp(e,r);return t}function PO(e){var r="",t,n="";if(e==null||e["!ref"]==null)return[];var o=La(e["!ref"]),u="",f=[],g,v=[],p=Array.isArray(e);for(g=o.s.c;g<=o.e.c;++g)f[g]=hs(g);for(var k=o.s.r;k<=o.e.r;++k)for(u=ts(k),g=o.s.c;g<=o.e.c;++g)if(r=f[g]+u,t=p?(e[k]||[])[g]:e[r],n="",t!==void 0){if(t.F!=null){if(r=t.F,!t.f)continue;n=t.f,r.indexOf(":")==-1&&(r=r+":"+r)}if(t.f!=null)n=t.f;else{if(t.t=="z")continue;if(t.t=="n"&&t.v!=null)n=""+t.v;else if(t.t=="b")n=t.v?"TRUE":"FALSE";else if(t.w!==void 0)n="'"+t.w;else{if(t.v===void 0)continue;t.t=="s"?n="'"+t.v:n=""+t.v}}v[v.length]=r+"="+n}return v}function p4(e,r,t){var n=t||{},o=+!n.skipHeader,u=e||{},f=0,g=0;if(u&&n.origin!=null)if(typeof n.origin=="number")f=n.origin;else{var v=typeof n.origin=="string"?Pn(n.origin):n.origin;f=v.r,g=v.c}var p,k={s:{c:0,r:0},e:{c:g,r:f+r.length-1+o}};if(u["!ref"]){var N=La(u["!ref"]);k.e.c=Math.max(k.e.c,N.e.c),k.e.r=Math.max(k.e.r,N.e.r),f==-1&&(f=N.e.r+1,k.e.r=f+r.length-1+o)}else f==-1&&(f=0,k.e.r=r.length-1+o);var C=n.header||[],O=0;r.forEach(function(M,D){as(M).forEach(function(z){(O=C.indexOf(z))==-1&&(C[O=C.length]=z);var B=M[z],U="z",H="",q=ka({c:g+O,r:f+D+o});p=J0(u,q),B&&typeof B=="object"&&!(B instanceof Date)?u[q]=B:(typeof B=="number"?U="n":typeof B=="boolean"?U="b":typeof B=="string"?U="s":B instanceof Date?(U="d",n.cellDates||(U="n",B=Vs(B)),H=n.dateNF||rn[14]):B===null&&n.nullError&&(U="e",B=0),p?(p.t=U,p.v=B,delete p.w,delete p.R,H&&(p.z=H)):u[q]=p={t:U,v:B},H&&(p.z=H))})}),k.e.c=Math.max(k.e.c,g+C.length-1);var I=ts(f);if(o)for(O=0;O<C.length;++O)u[hs(O+g)+I]={t:"s",v:C[O]};return u["!ref"]=bn(k),u}function FO(e,r){return p4(null,e,r)}function J0(e,r,t){if(typeof r=="string"){if(Array.isArray(e)){var n=Pn(r);return e[n.r]||(e[n.r]=[]),e[n.r][n.c]||(e[n.r][n.c]={t:"z"})}return e[r]||(e[r]={t:"z"})}return typeof r!="number"?J0(e,ka(r)):J0(e,ka({r,c:t||0}))}function BO(e,r){if(typeof r=="number"){if(r>=0&&e.SheetNames.length>r)return r;throw new Error("Cannot find sheet # "+r)}else if(typeof r=="string"){var t=e.SheetNames.indexOf(r);if(t>-1)return t;throw new Error("Cannot find sheet name |"+r+"|")}else throw new Error("Cannot find sheet |"+r+"|")}function UO(){return{SheetNames:[],Sheets:{}}}function zO(e,r,t,n){var o=1;if(!t)for(;o<=65535&&e.SheetNames.indexOf(t="Sheet"+o)!=-1;++o,t=void 0);if(!t||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(t)>=0){var u=t.match(/(^.*?)(\d+)$/);o=u&&+u[2]||0;var f=u&&u[1]||t;for(++o;o<=65535&&e.SheetNames.indexOf(t=f+o)!=-1;++o);}if(i4(t),e.SheetNames.indexOf(t)>=0)throw new Error("Worksheet with name |"+t+"| already exists!");return e.SheetNames.push(t),e.Sheets[t]=r,t}function HO(e,r,t){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=BO(e,r);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),t){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+t)}e.Workbook.Sheets[n].Hidden=t}function WO(e,r){return e.z=r,e}function y4(e,r,t){return r?(e.l={Target:r},t&&(e.l.Tooltip=t)):delete e.l,e}function VO(e,r,t){return y4(e,"#"+r,t)}function GO(e,r,t){e.c||(e.c=[]),e.c.push({t:r,a:t||"SheetJS"})}function XO(e,r,t,n){for(var o=typeof r!="string"?r:La(r),u=typeof r=="string"?r:bn(r),f=o.s.r;f<=o.e.r;++f)for(var g=o.s.c;g<=o.e.c;++g){var v=J0(e,f,g);v.t="n",v.F=u,delete v.v,f==o.s.r&&g==o.s.c&&(v.f=t,n&&(v.D=!0))}return e}var Un={encode_col:hs,encode_row:ts,encode_cell:ka,encode_range:bn,decode_col:Jx,decode_row:Kx,split_cell:oC,decode_cell:Pn,decode_range:hi,format_cell:qo,sheet_add_aoa:yw,sheet_add_json:p4,sheet_add_dom:u4,aoa_to_sheet:Id,json_to_sheet:FO,table_to_sheet:f4,table_to_book:xO,sheet_to_csv:cp,sheet_to_txt:x4,sheet_to_json:lh,sheet_to_html:d4,sheet_to_formulae:PO,sheet_to_row_object_array:lh,sheet_get_cell:J0,book_new:UO,book_append_sheet:zO,book_set_sheet_visibility:HO,cell_set_number_format:WO,cell_set_hyperlink:y4,cell_set_internal_link:VO,cell_add_comment:GO,sheet_set_array_formula:XO,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const YO={},er=({label:e,doctype:r,value:t,onChange:n,placeholder:o,disabled:u=!1,filters:f,compact:g=!1,usePortal:v=!1})=>{const[p,k]=R.useState([]),[N,C]=R.useState(""),[O,I]=R.useState(!1),[M,D]=R.useState(!1),[z,B]=R.useState({top:0,left:0,width:0}),U=R.useRef(null),H=R.useRef(null),q=R.useRef(null),ne=R.useRef(null),V=R.useRef(""),J=R.useRef(!1),Q=f||YO,Te=R.useMemo(()=>JSON.stringify(Q),[Q]),je=R.useCallback((re="",de=!1)=>Ne(null,null,function*(){const Ae=`${re}-${Te}`;if(!(!de&&V.current===Ae)){V.current=Ae,D(!0);try{const _e=new URLSearchParams({doctype:r,txt:re});Q&&Object.keys(Q).length>0&&_e.append("filters",JSON.stringify(Q));const K=yield jt.apiCall(`/api/method/frappe.desk.search.search_link?${_e.toString()}`);k(K||[])}catch(_e){console.error(`Error fetching ${r} links:`,_e),k([])}finally{D(!1)}}}),[r,Te,Q]),me=R.useCallback(re=>{ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{je(re)},300)},[je]);R.useEffect(()=>{O&&!J.current&&(J.current=!0,je(N||"",!0)),O||(J.current=!1,V.current="")},[O]),R.useEffect(()=>()=>{ne.current&&clearTimeout(ne.current)},[]);const Se=R.useCallback(()=>{if(v&&H.current){const re=H.current.getBoundingClientRect();B({top:re.bottom+window.scrollY,left:re.left+window.scrollX,width:re.width})}},[v]);R.useEffect(()=>{if(O&&v){Se();const re=()=>Se();return window.addEventListener("scroll",re,!0),window.addEventListener("resize",re),()=>{window.removeEventListener("scroll",re,!0),window.removeEventListener("resize",re)}}},[O,v,Se]),R.useEffect(()=>{const re=de=>{const Ae=de.target,_e=U.current&&!U.current.contains(Ae),K=v&&q.current&&!q.current.contains(Ae);v?_e&&K&&(I(!1),C("")):_e&&(I(!1),C(""))};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[v]);const Oe=re=>{n(re),C(""),I(!1)},ue=()=>{n(""),C(""),I(!1)},be=()=>{const re=`bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600
rounded-md w-full shadow-lg ${g?"mt-0.5":"mt-1"}`,de=v?{position:"fixed",top:`${z.top}px`,left:`${z.left}px`,width:`${z.width}px`,zIndex:1050,marginTop:g?"2px":"4px"}:{};if(!O||u)return null;const Ae=a.jsxs("div",{ref:q,children:[M&&a.jsxs("div",{className:`${v?"":"absolute z-[1050]"} ${re} text-center text-gray-500 dark:text-gray-400
${g?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:de,children:[a.jsx("span",{className:"inline-block animate-spin mr-2",children:"⏳"}),"Loading..."]}),!M&&p.length>0&&a.jsx("ul",{className:`${v?"":"absolute z-[1050]"} ${re} overflow-auto
${g?"max-h-36":"max-h-48"}`,style:de,children:p.map((_e,K)=>a.jsxs("li",{onClick:()=>Oe(_e.value),className:`cursor-pointer text-gray-900 dark:text-gray-100
hover:bg-blue-500 dark:hover:bg-blue-600 hover:text-white
${g?"px-2 py-1 text-xs":"px-3 py-2 text-sm"}
${t===_e.value?"bg-blue-50 dark:bg-blue-700 font-semibold":""}`,children:[_e.value,_e.description&&a.jsx("span",{className:`text-gray-600 dark:text-gray-300 ml-2
${g?"text-[9px] ml-1":"text-xs ml-2"}`,children:_e.description})]},K))}),!M&&p.length===0&&a.jsx("div",{className:`${v?"":"absolute z-[1050]"} ${re} text-center text-gray-500 dark:text-gray-400
${g?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:de,children:"No results found"})]});return v?Dx.createPortal(Ae,document.body):Ae};return a.jsxs("div",{ref:U,className:`relative w-full ${g?"mb-2":"mb-4"}`,children:[a.jsx("label",{className:`block font-medium text-gray-700 dark:text-gray-300 ${g?"text-[10px] mb-0.5":"text-sm mb-1"}`,children:e}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{ref:H,type:"text",value:O?N:t,placeholder:o||`Select ${e}`,disabled:u,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
${g?"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"}
${t?g?"pr-5":"pr-8":""}`,onFocus:()=>{u||(I(!0),C(""),v&&Se())},onChange:re=>{const de=re.target.value;C(de),me(de)}}),t&&!u&&!O&&a.jsx("button",{type:"button",onClick:ue,className:`absolute top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300
${g?"right-1 text-xs":"right-2 text-sm"}`,children:"✕"})]}),be()]})},b4=(e="Asset")=>{const[r,t]=R.useState({isAdmin:!1,restrictions:{},permissionFilters:{},targetDoctype:e,loading:!0,error:null}),n=R.useCallback(p=>Ne(null,null,function*(){const k=p||e;try{t(C=>Ve(ke({},C),{loading:!0,error:null,targetDoctype:k}));const N=yield jt.getPermissionFilters(k);return t({isAdmin:N.is_admin,restrictions:N.restrictions||{},permissionFilters:N.filters||{},targetDoctype:k,loading:!1,error:null}),N}catch(N){return console.error(`Error fetching permissions for ${k}:`,N),t(C=>Ve(ke({},C),{loading:!1,error:N instanceof Error?N.message:"Failed to fetch permissions"})),null}}),[e]);R.useEffect(()=>{n()},[n]);const o=R.useCallback(p=>{var k;return((k=r.restrictions[p])==null?void 0:k.values)||[]},[r.restrictions]),u=R.useCallback(p=>r.isAdmin?!1:!!r.restrictions[p],[r.isAdmin,r.restrictions]),f=R.useMemo(()=>!r.isAdmin&&Object.keys(r.restrictions).length>0,[r.isAdmin,r.restrictions]),g=R.useCallback(p=>{if(r.isAdmin)return p;const k=ke({},p);for(const[N,C]of Object.entries(r.permissionFilters))if(!k[N])k[N]=C;else if(Array.isArray(C)&&C[0]==="in"){const O=C[1];typeof k[N]=="string"&&!O.includes(k[N])&&(k[N]=["in",[]])}return k},[r.isAdmin,r.permissionFilters]),v=R.useMemo(()=>Object.entries(r.restrictions).map(([p,k])=>({type:p,field:k.field,values:k.values,count:k.count})),[r.restrictions]);return Ve(ke({},r),{refetch:n,switchDoctype:n,getAllowedValues:o,hasRestriction:u,hasAnyRestrictions:f,mergeFilters:g,restrictionsList:v})};var ir;(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(ir||(ir={}));var fv=new Map([[ir.QR_CODE,"QR_CODE"],[ir.AZTEC,"AZTEC"],[ir.CODABAR,"CODABAR"],[ir.CODE_39,"CODE_39"],[ir.CODE_93,"CODE_93"],[ir.CODE_128,"CODE_128"],[ir.DATA_MATRIX,"DATA_MATRIX"],[ir.MAXICODE,"MAXICODE"],[ir.ITF,"ITF"],[ir.EAN_13,"EAN_13"],[ir.EAN_8,"EAN_8"],[ir.PDF_417,"PDF_417"],[ir.RSS_14,"RSS_14"],[ir.RSS_EXPANDED,"RSS_EXPANDED"],[ir.UPC_A,"UPC_A"],[ir.UPC_E,"UPC_E"],[ir.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),hv;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(hv||(hv={}));function ZO(e){return Object.values(ir).includes(e)}var ch;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(ch||(ch={}));var $O=(function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[ch.SCAN_TYPE_CAMERA,ch.SCAN_TYPE_FILE],e})(),v4=(function(){function e(r,t){this.format=r,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(r){if(!fv.has(r))throw"".concat(r," not in html5QrcodeSupportedFormatsTextMap");return new e(r,fv.get(r))},e})(),mv=(function(){function e(){}return e.createFromText=function(r){var t={text:r};return{decodedText:r,result:t}},e.createFromQrcodeResult=function(r){return{decodedText:r.text,result:r}},e})(),vx;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(vx||(vx={}));var qO=(function(){function e(){}return e.createFrom=function(r){return{errorMessage:r,type:vx.UNKWOWN_ERROR}},e})(),KO=(function(){function e(r){this.verbose=r}return e.prototype.log=function(r){this.verbose&&console.log(r)},e.prototype.warn=function(r){this.verbose&&console.warn(r)},e.prototype.logError=function(r,t){(this.verbose||t===!0)&&console.error(r)},e.prototype.logErrors=function(r){if(r.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(r)},e})();function zo(e){return typeof e=="undefined"||e===null}var md=(function(){function e(){}return e.codeParseError=function(r){return"QR code parse error, error = ".concat(r)},e.errorGettingUserMedia=function(r){return"Error getting userMedia, error = ".concat(r)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e})(),_4=(function(){function e(){}return e.isMediaStreamConstraintsValid=function(r,t){if(typeof r!="object"){var n=typeof r;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var o=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],u=new Set(o),f=Object.keys(r),g=0,v=f;g<v.length;g++){var p=v[g];if(u.has(p))return t.logError("".concat(p," is not supported videoConstaints."),!0),!1}return!0},e})(),O0={exports:{}},JO=O0.exports,gv;function QO(){return gv||(gv=1,(function(e,r){(function(t,n){n(r)})(JO,(function(t){function n(ee){return ee==null}var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,i){ee.__proto__=i}||function(ee,i){for(var c in i)i.hasOwnProperty(c)&&(ee[c]=i[c])};function u(ee,i){o(ee,i);function c(){this.constructor=ee}ee.prototype=i===null?Object.create(i):(c.prototype=i.prototype,new c)}function f(ee,i){var c=Object.setPrototypeOf;c?c(ee,i):ee.__proto__=i}function g(ee,i){i===void 0&&(i=ee.constructor);var c=Error.captureStackTrace;c&&c(ee,i)}var v=(function(ee){u(i,ee);function i(c){var h=this.constructor,x=ee.call(this,c)||this;return Object.defineProperty(x,"name",{value:h.name,enumerable:!1}),f(x,h.prototype),g(x),x}return i})(Error);class p extends v{constructor(i=void 0){super(i),this.message=i}getKind(){return this.constructor.kind}}p.kind="Exception";class k extends p{}k.kind="ArgumentException";class N extends p{}N.kind="IllegalArgumentException";class C{constructor(i){if(this.binarizer=i,i===null)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(i,c){return this.binarizer.getBlackRow(i,c)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(i,c,h,x){const y=this.binarizer.getLuminanceSource().crop(i,c,h,x);return new C(this.binarizer.createBinarizer(y))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const i=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new C(this.binarizer.createBinarizer(i))}rotateCounterClockwise45(){const i=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new C(this.binarizer.createBinarizer(i))}toString(){try{return this.getBlackMatrix().toString()}catch(i){return""}}}class O extends p{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class I{constructor(i){this.source=i}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class M{static arraycopy(i,c,h,x,y){for(;y--;)h[x++]=i[c++]}static currentTimeMillis(){return Date.now()}}class D extends p{}D.kind="IndexOutOfBoundsException";class z extends D{constructor(i=void 0,c=void 0){super(c),this.index=i,this.message=c}}z.kind="ArrayIndexOutOfBoundsException";class B{static fill(i,c){for(let h=0,x=i.length;h<x;h++)i[h]=c}static fillWithin(i,c,h,x){B.rangeCheck(i.length,c,h);for(let y=c;y<h;y++)i[y]=x}static rangeCheck(i,c,h){if(c>h)throw new N("fromIndex("+c+") > toIndex("+h+")");if(c<0)throw new z(c);if(h>i)throw new z(h)}static asList(...i){return i}static create(i,c,h){return Array.from({length:i}).map(y=>Array.from({length:c}).fill(h))}static createInt32Array(i,c,h){return Array.from({length:i}).map(y=>Int32Array.from({length:c}).fill(h))}static equals(i,c){if(!i||!c||!i.length||!c.length||i.length!==c.length)return!1;for(let h=0,x=i.length;h<x;h++)if(i[h]!==c[h])return!1;return!0}static hashCode(i){if(i===null)return 0;let c=1;for(const h of i)c=31*c+h;return c}static fillUint8Array(i,c){for(let h=0;h!==i.length;h++)i[h]=c}static copyOf(i,c){return i.slice(0,c)}static copyOfUint8Array(i,c){if(i.length<=c){const h=new Uint8Array(c);return h.set(i),h}return i.slice(0,c)}static copyOfRange(i,c,h){const x=h-c,y=new Int32Array(x);return M.arraycopy(i,c,y,0,x),y}static binarySearch(i,c,h){h===void 0&&(h=B.numberComparator);let x=0,y=i.length-1;for(;x<=y;){const w=y+x>>1,S=h(c,i[w]);if(S>0)x=w+1;else if(S<0)y=w-1;else return w}return-x-1}static numberComparator(i,c){return i-c}}class U{static numberOfTrailingZeros(i){let c;if(i===0)return 32;let h=31;return c=i<<16,c!==0&&(h-=16,i=c),c=i<<8,c!==0&&(h-=8,i=c),c=i<<4,c!==0&&(h-=4,i=c),c=i<<2,c!==0&&(h-=2,i=c),h-(i<<1>>>31)}static numberOfLeadingZeros(i){if(i===0)return 32;let c=1;return i>>>16||(c+=16,i<<=16),i>>>24||(c+=8,i<<=8),i>>>28||(c+=4,i<<=4),i>>>30||(c+=2,i<<=2),c-=i>>>31,c}static toHexString(i){return i.toString(16)}static toBinaryString(i){return String(parseInt(String(i),2))}static bitCount(i){return i=i-(i>>>1&1431655765),i=(i&858993459)+(i>>>2&858993459),i=i+(i>>>4)&252645135,i=i+(i>>>8),i=i+(i>>>16),i&63}static truncDivision(i,c){return Math.trunc(i/c)}static parseInt(i,c=void 0){return parseInt(i,c)}}U.MIN_VALUE_32_BITS=-2147483648,U.MAX_VALUE=Number.MAX_SAFE_INTEGER;class H{constructor(i,c){i===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=i,c==null?this.bits=H.makeArray(i):this.bits=c)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(i){if(i>this.bits.length*32){const c=H.makeArray(i);M.arraycopy(this.bits,0,c,0,this.bits.length),this.bits=c}}get(i){return(this.bits[Math.floor(i/32)]&1<<(i&31))!==0}set(i){this.bits[Math.floor(i/32)]|=1<<(i&31)}flip(i){this.bits[Math.floor(i/32)]^=1<<(i&31)}getNextSet(i){const c=this.size;if(i>=c)return c;const h=this.bits;let x=Math.floor(i/32),y=h[x];y&=~((1<<(i&31))-1);const w=h.length;for(;y===0;){if(++x===w)return c;y=h[x]}const S=x*32+U.numberOfTrailingZeros(y);return S>c?c:S}getNextUnset(i){const c=this.size;if(i>=c)return c;const h=this.bits;let x=Math.floor(i/32),y=~h[x];y&=~((1<<(i&31))-1);const w=h.length;for(;y===0;){if(++x===w)return c;y=~h[x]}const S=x*32+U.numberOfTrailingZeros(y);return S>c?c:S}setBulk(i,c){this.bits[Math.floor(i/32)]=c}setRange(i,c){if(c<i||i<0||c>this.size)throw new N;if(c===i)return;c--;const h=Math.floor(i/32),x=Math.floor(c/32),y=this.bits;for(let w=h;w<=x;w++){const S=w>h?0:i&31,P=(2<<(w<x?31:c&31))-(1<<S);y[w]|=P}}clear(){const i=this.bits.length,c=this.bits;for(let h=0;h<i;h++)c[h]=0}isRange(i,c,h){if(c<i||i<0||c>this.size)throw new N;if(c===i)return!0;c--;const x=Math.floor(i/32),y=Math.floor(c/32),w=this.bits;for(let S=x;S<=y;S++){const A=S>x?0:i&31,G=(2<<(S<y?31:c&31))-(1<<A)&4294967295;if((w[S]&G)!==(h?G:0))return!1}return!0}appendBit(i){this.ensureCapacity(this.size+1),i&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(i,c){if(c<0||c>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+c);for(let h=c;h>0;h--)this.appendBit((i>>h-1&1)===1)}appendBitArray(i){const c=i.size;this.ensureCapacity(this.size+c);for(let h=0;h<c;h++)this.appendBit(i.get(h))}xor(i){if(this.size!==i.size)throw new N("Sizes don't match");const c=this.bits;for(let h=0,x=c.length;h<x;h++)c[h]^=i.bits[h]}toBytes(i,c,h,x){for(let y=0;y<x;y++){let w=0;for(let S=0;S<8;S++)this.get(i)&&(w|=1<<7-S),i++;c[h+y]=w}}getBitArray(){return this.bits}reverse(){const i=new Int32Array(this.bits.length),c=Math.floor((this.size-1)/32),h=c+1,x=this.bits;for(let y=0;y<h;y++){let w=x[y];w=w>>1&1431655765|(w&1431655765)<<1,w=w>>2&858993459|(w&858993459)<<2,w=w>>4&252645135|(w&252645135)<<4,w=w>>8&16711935|(w&16711935)<<8,w=w>>16&65535|(w&65535)<<16,i[c-y]=w}if(this.size!==h*32){const y=h*32-this.size;let w=i[0]>>>y;for(let S=1;S<h;S++){const A=i[S];w|=A<<32-y,i[S-1]=w,w=A>>>y}i[h-1]=w}this.bits=i}static makeArray(i){return new Int32Array(Math.floor((i+31)/32))}equals(i){if(!(i instanceof H))return!1;const c=i;return this.size===c.size&&B.equals(this.bits,c.bits)}hashCode(){return 31*this.size+B.hashCode(this.bits)}toString(){let i="";for(let c=0,h=this.size;c<h;c++)(c&7)===0&&(i+=" "),i+=this.get(c)?"X":".";return i}clone(){return new H(this.size,this.bits.slice())}}var q;(function(ee){ee[ee.OTHER=0]="OTHER",ee[ee.PURE_BARCODE=1]="PURE_BARCODE",ee[ee.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",ee[ee.TRY_HARDER=3]="TRY_HARDER",ee[ee.CHARACTER_SET=4]="CHARACTER_SET",ee[ee.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",ee[ee.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",ee[ee.ASSUME_GS1=7]="ASSUME_GS1",ee[ee.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",ee[ee.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",ee[ee.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(q||(q={}));var ne=q;class V extends p{static getFormatInstance(){return new V}}V.kind="FormatException";var J;(function(ee){ee[ee.Cp437=0]="Cp437",ee[ee.ISO8859_1=1]="ISO8859_1",ee[ee.ISO8859_2=2]="ISO8859_2",ee[ee.ISO8859_3=3]="ISO8859_3",ee[ee.ISO8859_4=4]="ISO8859_4",ee[ee.ISO8859_5=5]="ISO8859_5",ee[ee.ISO8859_6=6]="ISO8859_6",ee[ee.ISO8859_7=7]="ISO8859_7",ee[ee.ISO8859_8=8]="ISO8859_8",ee[ee.ISO8859_9=9]="ISO8859_9",ee[ee.ISO8859_10=10]="ISO8859_10",ee[ee.ISO8859_11=11]="ISO8859_11",ee[ee.ISO8859_13=12]="ISO8859_13",ee[ee.ISO8859_14=13]="ISO8859_14",ee[ee.ISO8859_15=14]="ISO8859_15",ee[ee.ISO8859_16=15]="ISO8859_16",ee[ee.SJIS=16]="SJIS",ee[ee.Cp1250=17]="Cp1250",ee[ee.Cp1251=18]="Cp1251",ee[ee.Cp1252=19]="Cp1252",ee[ee.Cp1256=20]="Cp1256",ee[ee.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",ee[ee.UTF8=22]="UTF8",ee[ee.ASCII=23]="ASCII",ee[ee.Big5=24]="Big5",ee[ee.GB18030=25]="GB18030",ee[ee.EUC_KR=26]="EUC_KR"})(J||(J={}));class Q{constructor(i,c,h,...x){this.valueIdentifier=i,this.name=h,typeof c=="number"?this.values=Int32Array.from([c]):this.values=c,this.otherEncodingNames=x,Q.VALUE_IDENTIFIER_TO_ECI.set(i,this),Q.NAME_TO_ECI.set(h,this);const y=this.values;for(let w=0,S=y.length;w!==S;w++){const A=y[w];Q.VALUES_TO_ECI.set(A,this)}for(const w of x)Q.NAME_TO_ECI.set(w,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(i){if(i<0||i>=900)throw new V("incorect value");const c=Q.VALUES_TO_ECI.get(i);if(c===void 0)throw new V("incorect value");return c}static getCharacterSetECIByName(i){const c=Q.NAME_TO_ECI.get(i);if(c===void 0)throw new V("incorect value");return c}equals(i){if(!(i instanceof Q))return!1;const c=i;return this.getName()===c.getName()}}Q.VALUE_IDENTIFIER_TO_ECI=new Map,Q.VALUES_TO_ECI=new Map,Q.NAME_TO_ECI=new Map,Q.Cp437=new Q(J.Cp437,Int32Array.from([0,2]),"Cp437"),Q.ISO8859_1=new Q(J.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),Q.ISO8859_2=new Q(J.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),Q.ISO8859_3=new Q(J.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),Q.ISO8859_4=new Q(J.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),Q.ISO8859_5=new Q(J.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),Q.ISO8859_6=new Q(J.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),Q.ISO8859_7=new Q(J.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),Q.ISO8859_8=new Q(J.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),Q.ISO8859_9=new Q(J.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),Q.ISO8859_10=new Q(J.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),Q.ISO8859_11=new Q(J.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),Q.ISO8859_13=new Q(J.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),Q.ISO8859_14=new Q(J.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),Q.ISO8859_15=new Q(J.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),Q.ISO8859_16=new Q(J.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),Q.SJIS=new Q(J.SJIS,20,"SJIS","Shift_JIS"),Q.Cp1250=new Q(J.Cp1250,21,"Cp1250","windows-1250"),Q.Cp1251=new Q(J.Cp1251,22,"Cp1251","windows-1251"),Q.Cp1252=new Q(J.Cp1252,23,"Cp1252","windows-1252"),Q.Cp1256=new Q(J.Cp1256,24,"Cp1256","windows-1256"),Q.UnicodeBigUnmarked=new Q(J.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),Q.UTF8=new Q(J.UTF8,26,"UTF8","UTF-8"),Q.ASCII=new Q(J.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),Q.Big5=new Q(J.Big5,28,"Big5"),Q.GB18030=new Q(J.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),Q.EUC_KR=new Q(J.EUC_KR,30,"EUC_KR","EUC-KR");class Te extends p{}Te.kind="UnsupportedOperationException";class je{static decode(i,c){const h=this.encodingName(c);return this.customDecoder?this.customDecoder(i,h):typeof TextDecoder=="undefined"||this.shouldDecodeOnFallback(h)?this.decodeFallback(i,h):new TextDecoder(h).decode(i)}static shouldDecodeOnFallback(i){return!je.isBrowser()&&i==="ISO-8859-1"}static encode(i,c){const h=this.encodingName(c);return this.customEncoder?this.customEncoder(i,h):typeof TextEncoder=="undefined"?this.encodeFallback(i):new TextEncoder().encode(i)}static isBrowser(){return typeof window!="undefined"&&{}.toString.call(window)==="[object Window]"}static encodingName(i){return typeof i=="string"?i:i.getName()}static encodingCharacterSet(i){return i instanceof Q?i:Q.getCharacterSetECIByName(i)}static decodeFallback(i,c){const h=this.encodingCharacterSet(c);if(je.isDecodeFallbackSupported(h)){let x="";for(let y=0,w=i.length;y<w;y++){let S=i[y].toString(16);S.length<2&&(S="0"+S),x+="%"+S}return decodeURIComponent(x)}if(h.equals(Q.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(i.buffer));throw new Te(`Encoding ${this.encodingName(c)} not supported by fallback.`)}static isDecodeFallbackSupported(i){return i.equals(Q.UTF8)||i.equals(Q.ISO8859_1)||i.equals(Q.ASCII)}static encodeFallback(i){const h=btoa(unescape(encodeURIComponent(i))).split(""),x=[];for(let y=0;y<h.length;y++)x.push(h[y].charCodeAt(0));return new Uint8Array(x)}}class me{static castAsNonUtf8Char(i,c=null){const h=c?c.getName():this.ISO88591;return je.decode(new Uint8Array([i]),h)}static guessEncoding(i,c){if(c!=null&&c.get(ne.CHARACTER_SET)!==void 0)return c.get(ne.CHARACTER_SET).toString();const h=i.length;let x=!0,y=!0,w=!0,S=0,A=0,P=0,G=0,te=0,oe=0,Ce=0,Ie=0,Pe=0,Ke=0,it=0;const Bt=i.length>3&&i[0]===239&&i[1]===187&&i[2]===191;for(let Pt=0;Pt<h&&(x||y||w);Pt++){const Mt=i[Pt]&255;w&&(S>0?(Mt&128)===0?w=!1:S--:(Mt&128)!==0&&((Mt&64)===0?w=!1:(S++,(Mt&32)===0?A++:(S++,(Mt&16)===0?P++:(S++,(Mt&8)===0?G++:w=!1))))),x&&(Mt>127&&Mt<160?x=!1:Mt>159&&(Mt<192||Mt===215||Mt===247)&&it++),y&&(te>0?Mt<64||Mt===127||Mt>252?y=!1:te--:Mt===128||Mt===160||Mt>239?y=!1:Mt>160&&Mt<224?(oe++,Ie=0,Ce++,Ce>Pe&&(Pe=Ce)):Mt>127?(te++,Ce=0,Ie++,Ie>Ke&&(Ke=Ie)):(Ce=0,Ie=0))}return w&&S>0&&(w=!1),y&&te>0&&(y=!1),w&&(Bt||A+P+G>0)?me.UTF8:y&&(me.ASSUME_SHIFT_JIS||Pe>=3||Ke>=3)?me.SHIFT_JIS:x&&y?Pe===2&&oe===2||it*10>=h?me.SHIFT_JIS:me.ISO88591:x?me.ISO88591:y?me.SHIFT_JIS:w?me.UTF8:me.PLATFORM_DEFAULT_ENCODING}static format(i,...c){let h=-1;function x(w,S,A,P,G,te){if(w==="%%")return"%";if(c[++h]===void 0)return;w=P?parseInt(P.substr(1)):void 0;let oe=G?parseInt(G.substr(1)):void 0,Ce;switch(te){case"s":Ce=c[h];break;case"c":Ce=c[h][0];break;case"f":Ce=parseFloat(c[h]).toFixed(w);break;case"p":Ce=parseFloat(c[h]).toPrecision(w);break;case"e":Ce=parseFloat(c[h]).toExponential(w);break;case"x":Ce=parseInt(c[h]).toString(oe||16);break;case"d":Ce=parseFloat(parseInt(c[h],oe||10).toPrecision(w)).toFixed(0);break}Ce=typeof Ce=="object"?JSON.stringify(Ce):(+Ce).toString(oe);let Ie=parseInt(A),Pe=A&&A[0]+""=="0"?"0":" ";for(;Ce.length<Ie;)Ce=S!==void 0?Ce+Pe:Pe+Ce;return Ce}let y=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return i.replace(y,x)}static getBytes(i,c){return je.encode(i,c)}static getCharCode(i,c=0){return i.charCodeAt(c)}static getCharAt(i){return String.fromCharCode(i)}}me.SHIFT_JIS=Q.SJIS.getName(),me.GB2312="GB2312",me.ISO88591=Q.ISO8859_1.getName(),me.EUC_JP="EUC_JP",me.UTF8=Q.UTF8.getName(),me.PLATFORM_DEFAULT_ENCODING=me.UTF8,me.ASSUME_SHIFT_JIS=!1;class Se{constructor(i=""){this.value=i}enableDecoding(i){return this.encoding=i,this}append(i){return typeof i=="string"?this.value+=i.toString():this.encoding?this.value+=me.castAsNonUtf8Char(i,this.encoding):this.value+=String.fromCharCode(i),this}appendChars(i,c,h){for(let x=c;c<c+h;x++)this.append(i[x]);return this}length(){return this.value.length}charAt(i){return this.value.charAt(i)}deleteCharAt(i){this.value=this.value.substr(0,i)+this.value.substring(i+1)}setCharAt(i,c){this.value=this.value.substr(0,i)+c+this.value.substr(i+1)}substring(i,c){return this.value.substring(i,c)}setLengthToZero(){this.value=""}toString(){return this.value}insert(i,c){this.value=this.value.substr(0,i)+c+this.value.substr(i+c.length)}}class Oe{constructor(i,c,h,x){if(this.width=i,this.height=c,this.rowSize=h,this.bits=x,c==null&&(c=i),this.height=c,i<1||c<1)throw new N("Both dimensions must be greater than 0");h==null&&(h=Math.floor((i+31)/32)),this.rowSize=h,x==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(i){const c=i.length,h=i[0].length,x=new Oe(h,c);for(let y=0;y<c;y++){const w=i[y];for(let S=0;S<h;S++)w[S]&&x.set(S,y)}return x}static parseFromString(i,c,h){if(i===null)throw new N("stringRepresentation cannot be null");const x=new Array(i.length);let y=0,w=0,S=-1,A=0,P=0;for(;P<i.length;)if(i.charAt(P)===`
`||i.charAt(P)==="\r"){if(y>w){if(S===-1)S=y-w;else if(y-w!==S)throw new N("row lengths do not match");w=y,A++}P++}else if(i.substring(P,P+c.length)===c)P+=c.length,x[y]=!0,y++;else if(i.substring(P,P+h.length)===h)P+=h.length,x[y]=!1,y++;else throw new N("illegal character encountered: "+i.substring(P));if(y>w){if(S===-1)S=y-w;else if(y-w!==S)throw new N("row lengths do not match");A++}const G=new Oe(S,A);for(let te=0;te<y;te++)x[te]&&G.set(Math.floor(te%S),Math.floor(te/S));return G}get(i,c){const h=c*this.rowSize+Math.floor(i/32);return(this.bits[h]>>>(i&31)&1)!==0}set(i,c){const h=c*this.rowSize+Math.floor(i/32);this.bits[h]|=1<<(i&31)&4294967295}unset(i,c){const h=c*this.rowSize+Math.floor(i/32);this.bits[h]&=~(1<<(i&31)&4294967295)}flip(i,c){const h=c*this.rowSize+Math.floor(i/32);this.bits[h]^=1<<(i&31)&4294967295}xor(i){if(this.width!==i.getWidth()||this.height!==i.getHeight()||this.rowSize!==i.getRowSize())throw new N("input matrix dimensions do not match");const c=new H(Math.floor(this.width/32)+1),h=this.rowSize,x=this.bits;for(let y=0,w=this.height;y<w;y++){const S=y*h,A=i.getRow(y,c).getBitArray();for(let P=0;P<h;P++)x[S+P]^=A[P]}}clear(){const i=this.bits,c=i.length;for(let h=0;h<c;h++)i[h]=0}setRegion(i,c,h,x){if(c<0||i<0)throw new N("Left and top must be nonnegative");if(x<1||h<1)throw new N("Height and width must be at least 1");const y=i+h,w=c+x;if(w>this.height||y>this.width)throw new N("The region must fit inside the matrix");const S=this.rowSize,A=this.bits;for(let P=c;P<w;P++){const G=P*S;for(let te=i;te<y;te++)A[G+Math.floor(te/32)]|=1<<(te&31)&4294967295}}getRow(i,c){c==null||c.getSize()<this.width?c=new H(this.width):c.clear();const h=this.rowSize,x=this.bits,y=i*h;for(let w=0;w<h;w++)c.setBulk(w*32,x[y+w]);return c}setRow(i,c){M.arraycopy(c.getBitArray(),0,this.bits,i*this.rowSize,this.rowSize)}rotate180(){const i=this.getWidth(),c=this.getHeight();let h=new H(i),x=new H(i);for(let y=0,w=Math.floor((c+1)/2);y<w;y++)h=this.getRow(y,h),x=this.getRow(c-1-y,x),h.reverse(),x.reverse(),this.setRow(y,x),this.setRow(c-1-y,h)}getEnclosingRectangle(){const i=this.width,c=this.height,h=this.rowSize,x=this.bits;let y=i,w=c,S=-1,A=-1;for(let P=0;P<c;P++)for(let G=0;G<h;G++){const te=x[P*h+G];if(te!==0){if(P<w&&(w=P),P>A&&(A=P),G*32<y){let oe=0;for(;(te<<31-oe&4294967295)===0;)oe++;G*32+oe<y&&(y=G*32+oe)}if(G*32+31>S){let oe=31;for(;!(te>>>oe);)oe--;G*32+oe>S&&(S=G*32+oe)}}}return S<y||A<w?null:Int32Array.from([y,w,S-y+1,A-w+1])}getTopLeftOnBit(){const i=this.rowSize,c=this.bits;let h=0;for(;h<c.length&&c[h]===0;)h++;if(h===c.length)return null;const x=h/i;let y=h%i*32;const w=c[h];let S=0;for(;(w<<31-S&4294967295)===0;)S++;return y+=S,Int32Array.from([y,x])}getBottomRightOnBit(){const i=this.rowSize,c=this.bits;let h=c.length-1;for(;h>=0&&c[h]===0;)h--;if(h<0)return null;const x=Math.floor(h/i);let y=Math.floor(h%i)*32;const w=c[h];let S=31;for(;!(w>>>S);)S--;return y+=S,Int32Array.from([y,x])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(i){if(!(i instanceof Oe))return!1;const c=i;return this.width===c.width&&this.height===c.height&&this.rowSize===c.rowSize&&B.equals(this.bits,c.bits)}hashCode(){let i=this.width;return i=31*i+this.width,i=31*i+this.height,i=31*i+this.rowSize,i=31*i+B.hashCode(this.bits),i}toString(i="X ",c=" ",h=`
`){return this.buildToString(i,c,h)}buildToString(i,c,h){let x=new Se;for(let y=0,w=this.height;y<w;y++){for(let S=0,A=this.width;S<A;S++)x.append(this.get(S,y)?i:c);x.append(h)}return x.toString()}clone(){return new Oe(this.width,this.height,this.rowSize,this.bits.slice())}}class ue extends p{static getNotFoundInstance(){return new ue}}ue.kind="NotFoundException";class be extends I{constructor(i){super(i),this.luminances=be.EMPTY,this.buckets=new Int32Array(be.LUMINANCE_BUCKETS)}getBlackRow(i,c){const h=this.getLuminanceSource(),x=h.getWidth();c==null||c.getSize()<x?c=new H(x):c.clear(),this.initArrays(x);const y=h.getRow(i,this.luminances),w=this.buckets;for(let A=0;A<x;A++)w[(y[A]&255)>>be.LUMINANCE_SHIFT]++;const S=be.estimateBlackPoint(w);if(x<3)for(let A=0;A<x;A++)(y[A]&255)<S&&c.set(A);else{let A=y[0]&255,P=y[1]&255;for(let G=1;G<x-1;G++){const te=y[G+1]&255;(P*4-A-te)/2<S&&c.set(G),A=P,P=te}}return c}getBlackMatrix(){const i=this.getLuminanceSource(),c=i.getWidth(),h=i.getHeight(),x=new Oe(c,h);this.initArrays(c);const y=this.buckets;for(let A=1;A<5;A++){const P=Math.floor(h*A/5),G=i.getRow(P,this.luminances),te=Math.floor(c*4/5);for(let oe=Math.floor(c/5);oe<te;oe++){const Ce=G[oe]&255;y[Ce>>be.LUMINANCE_SHIFT]++}}const w=be.estimateBlackPoint(y),S=i.getMatrix();for(let A=0;A<h;A++){const P=A*c;for(let G=0;G<c;G++)(S[P+G]&255)<w&&x.set(G,A)}return x}createBinarizer(i){return new be(i)}initArrays(i){this.luminances.length<i&&(this.luminances=new Uint8ClampedArray(i));const c=this.buckets;for(let h=0;h<be.LUMINANCE_BUCKETS;h++)c[h]=0}static estimateBlackPoint(i){const c=i.length;let h=0,x=0,y=0;for(let G=0;G<c;G++)i[G]>y&&(x=G,y=i[G]),i[G]>h&&(h=i[G]);let w=0,S=0;for(let G=0;G<c;G++){const te=G-x,oe=i[G]*te*te;oe>S&&(w=G,S=oe)}if(x>w){const G=x;x=w,w=G}if(w-x<=c/16)throw new ue;let A=w-1,P=-1;for(let G=w-1;G>x;G--){const te=G-x,oe=te*te*(w-G)*(h-i[G]);oe>P&&(A=G,P=oe)}return A<<be.LUMINANCE_SHIFT}}be.LUMINANCE_BITS=5,be.LUMINANCE_SHIFT=8-be.LUMINANCE_BITS,be.LUMINANCE_BUCKETS=1<<be.LUMINANCE_BITS,be.EMPTY=Uint8ClampedArray.from([0]);class re extends be{constructor(i){super(i),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const i=this.getLuminanceSource(),c=i.getWidth(),h=i.getHeight();if(c>=re.MINIMUM_DIMENSION&&h>=re.MINIMUM_DIMENSION){const x=i.getMatrix();let y=c>>re.BLOCK_SIZE_POWER;(c&re.BLOCK_SIZE_MASK)!==0&&y++;let w=h>>re.BLOCK_SIZE_POWER;(h&re.BLOCK_SIZE_MASK)!==0&&w++;const S=re.calculateBlackPoints(x,y,w,c,h),A=new Oe(c,h);re.calculateThresholdForBlock(x,y,w,c,h,S,A),this.matrix=A}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(i){return new re(i)}static calculateThresholdForBlock(i,c,h,x,y,w,S){const A=y-re.BLOCK_SIZE,P=x-re.BLOCK_SIZE;for(let G=0;G<h;G++){let te=G<<re.BLOCK_SIZE_POWER;te>A&&(te=A);const oe=re.cap(G,2,h-3);for(let Ce=0;Ce<c;Ce++){let Ie=Ce<<re.BLOCK_SIZE_POWER;Ie>P&&(Ie=P);const Pe=re.cap(Ce,2,c-3);let Ke=0;for(let Bt=-2;Bt<=2;Bt++){const Pt=w[oe+Bt];Ke+=Pt[Pe-2]+Pt[Pe-1]+Pt[Pe]+Pt[Pe+1]+Pt[Pe+2]}const it=Ke/25;re.thresholdBlock(i,Ie,te,it,x,S)}}}static cap(i,c,h){return i<c?c:i>h?h:i}static thresholdBlock(i,c,h,x,y,w){for(let S=0,A=h*y+c;S<re.BLOCK_SIZE;S++,A+=y)for(let P=0;P<re.BLOCK_SIZE;P++)(i[A+P]&255)<=x&&w.set(c+P,h+S)}static calculateBlackPoints(i,c,h,x,y){const w=y-re.BLOCK_SIZE,S=x-re.BLOCK_SIZE,A=new Array(h);for(let P=0;P<h;P++){A[P]=new Int32Array(c);let G=P<<re.BLOCK_SIZE_POWER;G>w&&(G=w);for(let te=0;te<c;te++){let oe=te<<re.BLOCK_SIZE_POWER;oe>S&&(oe=S);let Ce=0,Ie=255,Pe=0;for(let it=0,Bt=G*x+oe;it<re.BLOCK_SIZE;it++,Bt+=x){for(let Pt=0;Pt<re.BLOCK_SIZE;Pt++){const Mt=i[Bt+Pt]&255;Ce+=Mt,Mt<Ie&&(Ie=Mt),Mt>Pe&&(Pe=Mt)}if(Pe-Ie>re.MIN_DYNAMIC_RANGE)for(it++,Bt+=x;it<re.BLOCK_SIZE;it++,Bt+=x)for(let Pt=0;Pt<re.BLOCK_SIZE;Pt++)Ce+=i[Bt+Pt]&255}let Ke=Ce>>re.BLOCK_SIZE_POWER*2;if(Pe-Ie<=re.MIN_DYNAMIC_RANGE&&(Ke=Ie/2,P>0&&te>0)){const it=(A[P-1][te]+2*A[P][te-1]+A[P-1][te-1])/4;Ie<it&&(Ke=it)}A[P][te]=Ke}}return A}}re.BLOCK_SIZE_POWER=3,re.BLOCK_SIZE=1<<re.BLOCK_SIZE_POWER,re.BLOCK_SIZE_MASK=re.BLOCK_SIZE-1,re.MINIMUM_DIMENSION=re.BLOCK_SIZE*5,re.MIN_DYNAMIC_RANGE=24;class de{constructor(i,c){this.width=i,this.height=c}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(i,c,h,x){throw new Te("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new Te("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new Te("This luminance source does not support rotation by 45 degrees.")}toString(){const i=new Uint8ClampedArray(this.width);let c=new Se;for(let h=0;h<this.height;h++){const x=this.getRow(h,i);for(let y=0;y<this.width;y++){const w=x[y]&255;let S;w<64?S="#":w<128?S="+":w<192?S=".":S=" ",c.append(S)}c.append(`
`)}return c.toString()}}class Ae extends de{constructor(i){super(i.getWidth(),i.getHeight()),this.delegate=i}getRow(i,c){const h=this.delegate.getRow(i,c),x=this.getWidth();for(let y=0;y<x;y++)h[y]=255-(h[y]&255);return h}getMatrix(){const i=this.delegate.getMatrix(),c=this.getWidth()*this.getHeight(),h=new Uint8ClampedArray(c);for(let x=0;x<c;x++)h[x]=255-(i[x]&255);return h}isCropSupported(){return this.delegate.isCropSupported()}crop(i,c,h,x){return new Ae(this.delegate.crop(i,c,h,x))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Ae(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Ae(this.delegate.rotateCounterClockwise45())}}class _e extends de{constructor(i){super(i.width,i.height),this.canvas=i,this.tempCanvasElement=null,this.buffer=_e.makeBufferFromCanvasImageData(i)}static makeBufferFromCanvasImageData(i){const c=i.getContext("2d").getImageData(0,0,i.width,i.height);return _e.toGrayscaleBuffer(c.data,i.width,i.height)}static toGrayscaleBuffer(i,c,h){const x=new Uint8ClampedArray(c*h);for(let y=0,w=0,S=i.length;y<S;y+=4,w++){let A;if(i[y+3]===0)A=255;else{const G=i[y],te=i[y+1],oe=i[y+2];A=306*G+601*te+117*oe+512>>10}x[w]=A}return x}getRow(i,c){if(i<0||i>=this.getHeight())throw new N("Requested row is outside the image: "+i);const h=this.getWidth(),x=i*h;return c===null?c=this.buffer.slice(x,x+h):(c.length<h&&(c=new Uint8ClampedArray(h)),c.set(this.buffer.slice(x,x+h))),c}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(i,c,h,x){return super.crop(i,c,h,x),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const i=this.canvas.ownerDocument.createElement("canvas");i.width=this.canvas.width,i.height=this.canvas.height,this.tempCanvasElement=i}return this.tempCanvasElement}rotate(i){const c=this.getTempCanvasElement(),h=c.getContext("2d"),x=i*_e.DEGREE_TO_RADIANS,y=this.canvas.width,w=this.canvas.height,S=Math.ceil(Math.abs(Math.cos(x))*y+Math.abs(Math.sin(x))*w),A=Math.ceil(Math.abs(Math.sin(x))*y+Math.abs(Math.cos(x))*w);return c.width=S,c.height=A,h.translate(S/2,A/2),h.rotate(x),h.drawImage(this.canvas,y/-2,w/-2),this.buffer=_e.makeBufferFromCanvasImageData(c),this}invert(){return new Ae(this)}}_e.DEGREE_TO_RADIANS=Math.PI/180;class K{constructor(i,c,h){this.deviceId=i,this.label=c,this.kind="videoinput",this.groupId=h||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var W=(globalThis||xf||self||window||void 0)&&(globalThis||xf||self||window||void 0).__awaiter||function(ee,i,c,h){function x(y){return y instanceof c?y:new c(function(w){w(y)})}return new(c||(c=Promise))(function(y,w){function S(G){try{P(h.next(G))}catch(te){w(te)}}function A(G){try{P(h.throw(G))}catch(te){w(te)}}function P(G){G.done?y(G.value):x(G.value).then(S,A)}P((h=h.apply(ee,i||[])).next())})};class ae{constructor(i,c=500,h){this.reader=i,this.timeBetweenScansMillis=c,this._hints=h,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator!="undefined"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(i){this._timeBetweenDecodingAttempts=i<0?0:i}set hints(i){this._hints=i||null}get hints(){return this._hints}listVideoInputDevices(){return W(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const i=yield navigator.mediaDevices.enumerateDevices(),c=[];for(const h of i){const x=h.kind==="video"?"videoinput":h.kind;if(x!=="videoinput")continue;const y=h.deviceId||h.id,w=h.label||`Video device ${c.length+1}`,S=h.groupId,A={deviceId:y,label:w,kind:x,groupId:S};c.push(A)}return c})}getVideoInputDevices(){return W(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(c=>new K(c.deviceId,c.label))})}findDeviceById(i){return W(this,void 0,void 0,function*(){const c=yield this.listVideoInputDevices();return c?c.find(h=>h.deviceId===i):null})}decodeFromInputVideoDevice(i,c){return W(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(i,c)})}decodeOnceFromVideoDevice(i,c){return W(this,void 0,void 0,function*(){this.reset();let h;i?h={deviceId:{exact:i}}:h={facingMode:"environment"};const x={video:h};return yield this.decodeOnceFromConstraints(x,c)})}decodeOnceFromConstraints(i,c){return W(this,void 0,void 0,function*(){const h=yield navigator.mediaDevices.getUserMedia(i);return yield this.decodeOnceFromStream(h,c)})}decodeOnceFromStream(i,c){return W(this,void 0,void 0,function*(){this.reset();const h=yield this.attachStreamToVideo(i,c);return yield this.decodeOnce(h)})}decodeFromInputVideoDeviceContinuously(i,c,h){return W(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(i,c,h)})}decodeFromVideoDevice(i,c,h){return W(this,void 0,void 0,function*(){let x;i?x={deviceId:{exact:i}}:x={facingMode:"environment"};const y={video:x};return yield this.decodeFromConstraints(y,c,h)})}decodeFromConstraints(i,c,h){return W(this,void 0,void 0,function*(){const x=yield navigator.mediaDevices.getUserMedia(i);return yield this.decodeFromStream(x,c,h)})}decodeFromStream(i,c,h){return W(this,void 0,void 0,function*(){this.reset();const x=yield this.attachStreamToVideo(i,c);return yield this.decodeContinuously(x,h)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(i,c){return W(this,void 0,void 0,function*(){const h=this.prepareVideoElement(c);return this.addVideoSource(h,i),this.videoElement=h,this.stream=i,yield this.playVideoOnLoadAsync(h),h})}playVideoOnLoadAsync(i){return new Promise((c,h)=>this.playVideoOnLoad(i,()=>c()))}playVideoOnLoad(i,c){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(i),i.addEventListener("ended",this.videoEndedListener),i.addEventListener("canplay",this.videoCanPlayListener),i.addEventListener("playing",c),this.tryPlayVideo(i)}isVideoPlaying(i){return i.currentTime>0&&!i.paused&&!i.ended&&i.readyState>2}tryPlayVideo(i){return W(this,void 0,void 0,function*(){if(this.isVideoPlaying(i)){console.warn("Trying to play video that is already playing.");return}try{yield i.play()}catch(c){console.warn("It was not possible to play the video.")}})}getMediaElement(i,c){const h=document.getElementById(i);if(!h)throw new k(`element with id '${i}' not found`);if(h.nodeName.toLowerCase()!==c.toLowerCase())throw new k(`element with id '${i}' must be an ${c} element`);return h}decodeFromImage(i,c){if(!i&&!c)throw new k("either imageElement with a src set or an url must be provided");return c&&!i?this.decodeFromImageUrl(c):this.decodeFromImageElement(i)}decodeFromVideo(i,c){if(!i&&!c)throw new k("Either an element with a src set or an URL must be provided");return c&&!i?this.decodeFromVideoUrl(c):this.decodeFromVideoElement(i)}decodeFromVideoContinuously(i,c,h){if(i===void 0&&c===void 0)throw new k("Either an element with a src set or an URL must be provided");return c&&!i?this.decodeFromVideoUrlContinuously(c,h):this.decodeFromVideoElementContinuously(i,h)}decodeFromImageElement(i){if(!i)throw new k("An image element must be provided.");this.reset();const c=this.prepareImageElement(i);this.imageElement=c;let h;return this.isImageLoaded(c)?h=this.decodeOnce(c,!1,!0):h=this._decodeOnLoadImage(c),h}decodeFromVideoElement(i){const c=this._decodeFromVideoElementSetup(i);return this._decodeOnLoadVideo(c)}decodeFromVideoElementContinuously(i,c){const h=this._decodeFromVideoElementSetup(i);return this._decodeOnLoadVideoContinuously(h,c)}_decodeFromVideoElementSetup(i){if(!i)throw new k("A video element must be provided.");this.reset();const c=this.prepareVideoElement(i);return this.videoElement=c,c}decodeFromImageUrl(i){if(!i)throw new k("An URL must be provided.");this.reset();const c=this.prepareImageElement();this.imageElement=c;const h=this._decodeOnLoadImage(c);return c.src=i,h}decodeFromVideoUrl(i){if(!i)throw new k("An URL must be provided.");this.reset();const c=this.prepareVideoElement(),h=this.decodeFromVideoElement(c);return c.src=i,h}decodeFromVideoUrlContinuously(i,c){if(!i)throw new k("An URL must be provided.");this.reset();const h=this.prepareVideoElement(),x=this.decodeFromVideoElementContinuously(h,c);return h.src=i,x}_decodeOnLoadImage(i){return new Promise((c,h)=>{this.imageLoadedListener=()=>this.decodeOnce(i,!1,!0).then(c,h),i.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(i){return W(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(i),yield this.decodeOnce(i)})}_decodeOnLoadVideoContinuously(i,c){return W(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(i),this.decodeContinuously(i,c)})}isImageLoaded(i){return!(!i.complete||i.naturalWidth===0)}prepareImageElement(i){let c;return typeof i=="undefined"&&(c=document.createElement("img"),c.width=200,c.height=200),typeof i=="string"&&(c=this.getMediaElement(i,"img")),i instanceof HTMLImageElement&&(c=i),c}prepareVideoElement(i){let c;return!i&&typeof document!="undefined"&&(c=document.createElement("video"),c.width=200,c.height=200),typeof i=="string"&&(c=this.getMediaElement(i,"video")),i instanceof HTMLVideoElement&&(c=i),c.setAttribute("autoplay","true"),c.setAttribute("muted","true"),c.setAttribute("playsinline","true"),c}decodeOnce(i,c=!0,h=!0){this._stopAsyncDecode=!1;const x=(y,w)=>{if(this._stopAsyncDecode){w(new ue("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const S=this.decode(i);y(S)}catch(S){const A=c&&S instanceof ue,G=(S instanceof O||S instanceof V)&&h;if(A||G)return setTimeout(x,this._timeBetweenDecodingAttempts,y,w);w(S)}};return new Promise((y,w)=>x(y,w))}decodeContinuously(i,c){this._stopContinuousDecode=!1;const h=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const x=this.decode(i);c(x,null),setTimeout(h,this.timeBetweenScansMillis)}catch(x){c(null,x);const y=x instanceof O||x instanceof V,w=x instanceof ue;(y||w)&&setTimeout(h,this._timeBetweenDecodingAttempts)}};h()}decode(i){const c=this.createBinaryBitmap(i);return this.decodeBitmap(c)}_isHTMLVideoElement(i){return i.videoWidth!==0}drawFrameOnCanvas(i,c,h){c||(c={sx:0,sy:0,sWidth:i.videoWidth,sHeight:i.videoHeight,dx:0,dy:0,dWidth:i.videoWidth,dHeight:i.videoHeight}),h||(h=this.captureCanvasContext),h.drawImage(i,c.sx,c.sy,c.sWidth,c.sHeight,c.dx,c.dy,c.dWidth,c.dHeight)}drawImageOnCanvas(i,c,h=this.captureCanvasContext){c||(c={sx:0,sy:0,sWidth:i.naturalWidth,sHeight:i.naturalHeight,dx:0,dy:0,dWidth:i.naturalWidth,dHeight:i.naturalHeight}),h||(h=this.captureCanvasContext),h.drawImage(i,c.sx,c.sy,c.sWidth,c.sHeight,c.dx,c.dy,c.dWidth,c.dHeight)}createBinaryBitmap(i){this.getCaptureCanvasContext(i),this._isHTMLVideoElement(i)?this.drawFrameOnCanvas(i):this.drawImageOnCanvas(i);const c=this.getCaptureCanvas(i),h=new _e(c),x=new re(h);return new C(x)}getCaptureCanvasContext(i){if(!this.captureCanvasContext){const h=this.getCaptureCanvas(i).getContext("2d");this.captureCanvasContext=h}return this.captureCanvasContext}getCaptureCanvas(i){if(!this.captureCanvas){const c=this.createCaptureCanvas(i);this.captureCanvas=c}return this.captureCanvas}decodeBitmap(i){return this.reader.decode(i,this._hints)}createCaptureCanvas(i){if(typeof document=="undefined")return this._destroyCaptureCanvas(),null;const c=document.createElement("canvas");let h,x;return typeof i!="undefined"&&(i instanceof HTMLVideoElement?(h=i.videoWidth,x=i.videoHeight):i instanceof HTMLImageElement&&(h=i.naturalWidth||i.width,x=i.naturalHeight||i.height)),c.style.width=h+"px",c.style.height=x+"px",c.width=h,c.height=x,c}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(i=>i.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener!="undefined"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener!="undefined"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener!="undefined"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(i,c){try{i.srcObject=c}catch(h){i.src=URL.createObjectURL(c)}}cleanVideoSource(i){try{i.srcObject=null}catch(c){i.src=""}this.videoElement.removeAttribute("src")}}class se{constructor(i,c,h=c==null?0:8*c.length,x,y,w=M.currentTimeMillis()){this.text=i,this.rawBytes=c,this.numBits=h,this.resultPoints=x,this.format=y,this.timestamp=w,this.text=i,this.rawBytes=c,h==null?this.numBits=c==null?0:8*c.length:this.numBits=h,this.resultPoints=x,this.format=y,this.resultMetadata=null,w==null?this.timestamp=M.currentTimeMillis():this.timestamp=w}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(i,c){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(i,c)}putAllMetadata(i){i!==null&&(this.resultMetadata===null?this.resultMetadata=i:this.resultMetadata=new Map(i))}addResultPoints(i){const c=this.resultPoints;if(c===null)this.resultPoints=i;else if(i!==null&&i.length>0){const h=new Array(c.length+i.length);M.arraycopy(c,0,h,0,c.length),M.arraycopy(i,0,h,c.length,i.length),this.resultPoints=h}}getTimestamp(){return this.timestamp}toString(){return this.text}}var he;(function(ee){ee[ee.AZTEC=0]="AZTEC",ee[ee.CODABAR=1]="CODABAR",ee[ee.CODE_39=2]="CODE_39",ee[ee.CODE_93=3]="CODE_93",ee[ee.CODE_128=4]="CODE_128",ee[ee.DATA_MATRIX=5]="DATA_MATRIX",ee[ee.EAN_8=6]="EAN_8",ee[ee.EAN_13=7]="EAN_13",ee[ee.ITF=8]="ITF",ee[ee.MAXICODE=9]="MAXICODE",ee[ee.PDF_417=10]="PDF_417",ee[ee.QR_CODE=11]="QR_CODE",ee[ee.RSS_14=12]="RSS_14",ee[ee.RSS_EXPANDED=13]="RSS_EXPANDED",ee[ee.UPC_A=14]="UPC_A",ee[ee.UPC_E=15]="UPC_E",ee[ee.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(he||(he={}));var pe=he,Je;(function(ee){ee[ee.OTHER=0]="OTHER",ee[ee.ORIENTATION=1]="ORIENTATION",ee[ee.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",ee[ee.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",ee[ee.ISSUE_NUMBER=4]="ISSUE_NUMBER",ee[ee.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",ee[ee.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",ee[ee.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",ee[ee.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",ee[ee.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",ee[ee.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Je||(Je={}));var Fe=Je;class ft{constructor(i,c,h,x,y=-1,w=-1){this.rawBytes=i,this.text=c,this.byteSegments=h,this.ecLevel=x,this.structuredAppendSequenceNumber=y,this.structuredAppendParity=w,this.numBits=i==null?0:8*i.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(i){this.numBits=i}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(i){this.errorsCorrected=i}getErasures(){return this.erasures}setErasures(i){this.erasures=i}getOther(){return this.other}setOther(i){this.other=i}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class ot{exp(i){return this.expTable[i]}log(i){if(i===0)throw new N;return this.logTable[i]}static addOrSubtract(i,c){return i^c}}class Lt{constructor(i,c){if(c.length===0)throw new N;this.field=i;const h=c.length;if(h>1&&c[0]===0){let x=1;for(;x<h&&c[x]===0;)x++;x===h?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(h-x),M.arraycopy(c,x,this.coefficients,0,this.coefficients.length))}else this.coefficients=c}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(i){return this.coefficients[this.coefficients.length-1-i]}evaluateAt(i){if(i===0)return this.getCoefficient(0);const c=this.coefficients;let h;if(i===1){h=0;for(let w=0,S=c.length;w!==S;w++){const A=c[w];h=ot.addOrSubtract(h,A)}return h}h=c[0];const x=c.length,y=this.field;for(let w=1;w<x;w++)h=ot.addOrSubtract(y.multiply(i,h),c[w]);return h}addOrSubtract(i){if(!this.field.equals(i.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero())return i;if(i.isZero())return this;let c=this.coefficients,h=i.coefficients;if(c.length>h.length){const w=c;c=h,h=w}let x=new Int32Array(h.length);const y=h.length-c.length;M.arraycopy(h,0,x,0,y);for(let w=y;w<h.length;w++)x[w]=ot.addOrSubtract(c[w-y],h[w]);return new Lt(this.field,x)}multiply(i){if(!this.field.equals(i.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero()||i.isZero())return this.field.getZero();const c=this.coefficients,h=c.length,x=i.coefficients,y=x.length,w=new Int32Array(h+y-1),S=this.field;for(let A=0;A<h;A++){const P=c[A];for(let G=0;G<y;G++)w[A+G]=ot.addOrSubtract(w[A+G],S.multiply(P,x[G]))}return new Lt(S,w)}multiplyScalar(i){if(i===0)return this.field.getZero();if(i===1)return this;const c=this.coefficients.length,h=this.field,x=new Int32Array(c),y=this.coefficients;for(let w=0;w<c;w++)x[w]=h.multiply(y[w],i);return new Lt(h,x)}multiplyByMonomial(i,c){if(i<0)throw new N;if(c===0)return this.field.getZero();const h=this.coefficients,x=h.length,y=new Int32Array(x+i),w=this.field;for(let S=0;S<x;S++)y[S]=w.multiply(h[S],c);return new Lt(w,y)}divide(i){if(!this.field.equals(i.field))throw new N("GenericGFPolys do not have same GenericGF field");if(i.isZero())throw new N("Divide by 0");const c=this.field;let h=c.getZero(),x=this;const y=i.getCoefficient(i.getDegree()),w=c.inverse(y);for(;x.getDegree()>=i.getDegree()&&!x.isZero();){const S=x.getDegree()-i.getDegree(),A=c.multiply(x.getCoefficient(x.getDegree()),w),P=i.multiplyByMonomial(S,A),G=c.buildMonomial(S,A);h=h.addOrSubtract(G),x=x.addOrSubtract(P)}return[h,x]}toString(){let i="";for(let c=this.getDegree();c>=0;c--){let h=this.getCoefficient(c);if(h!==0){if(h<0?(i+=" - ",h=-h):i.length>0&&(i+=" + "),c===0||h!==1){const x=this.field.log(h);x===0?i+="1":x===1?i+="a":(i+="a^",i+=x)}c!==0&&(c===1?i+="x":(i+="x^",i+=c))}}return i}}class zt extends p{}zt.kind="ArithmeticException";class Ht extends ot{constructor(i,c,h){super(),this.primitive=i,this.size=c,this.generatorBase=h;const x=new Int32Array(c);let y=1;for(let S=0;S<c;S++)x[S]=y,y*=2,y>=c&&(y^=i,y&=c-1);this.expTable=x;const w=new Int32Array(c);for(let S=0;S<c-1;S++)w[x[S]]=S;this.logTable=w,this.zero=new Lt(this,Int32Array.from([0])),this.one=new Lt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(i,c){if(i<0)throw new N;if(c===0)return this.zero;const h=new Int32Array(i+1);return h[0]=c,new Lt(this,h)}inverse(i){if(i===0)throw new zt;return this.expTable[this.size-this.logTable[i]-1]}multiply(i,c){return i===0||c===0?0:this.expTable[(this.logTable[i]+this.logTable[c])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+U.toHexString(this.primitive)+","+this.size+")"}equals(i){return i===this}}Ht.AZTEC_DATA_12=new Ht(4201,4096,1),Ht.AZTEC_DATA_10=new Ht(1033,1024,1),Ht.AZTEC_DATA_6=new Ht(67,64,1),Ht.AZTEC_PARAM=new Ht(19,16,1),Ht.QR_CODE_FIELD_256=new Ht(285,256,0),Ht.DATA_MATRIX_FIELD_256=new Ht(301,256,1),Ht.AZTEC_DATA_8=Ht.DATA_MATRIX_FIELD_256,Ht.MAXICODE_FIELD_64=Ht.AZTEC_DATA_6;class ht extends p{}ht.kind="ReedSolomonException";class tr extends p{}tr.kind="IllegalStateException";class Kt{constructor(i){this.field=i}decode(i,c){const h=this.field,x=new Lt(h,i),y=new Int32Array(c);let w=!0;for(let Ce=0;Ce<c;Ce++){const Ie=x.evaluateAt(h.exp(Ce+h.getGeneratorBase()));y[y.length-1-Ce]=Ie,Ie!==0&&(w=!1)}if(w)return;const S=new Lt(h,y),A=this.runEuclideanAlgorithm(h.buildMonomial(c,1),S,c),P=A[0],G=A[1],te=this.findErrorLocations(P),oe=this.findErrorMagnitudes(G,te);for(let Ce=0;Ce<te.length;Ce++){const Ie=i.length-1-h.log(te[Ce]);if(Ie<0)throw new ht("Bad error location");i[Ie]=Ht.addOrSubtract(i[Ie],oe[Ce])}}runEuclideanAlgorithm(i,c,h){if(i.getDegree()<c.getDegree()){const Ce=i;i=c,c=Ce}const x=this.field;let y=i,w=c,S=x.getZero(),A=x.getOne();for(;w.getDegree()>=(h/2|0);){let Ce=y,Ie=S;if(y=w,S=A,y.isZero())throw new ht("r_{i-1} was zero");w=Ce;let Pe=x.getZero();const Ke=y.getCoefficient(y.getDegree()),it=x.inverse(Ke);for(;w.getDegree()>=y.getDegree()&&!w.isZero();){const Bt=w.getDegree()-y.getDegree(),Pt=x.multiply(w.getCoefficient(w.getDegree()),it);Pe=Pe.addOrSubtract(x.buildMonomial(Bt,Pt)),w=w.addOrSubtract(y.multiplyByMonomial(Bt,Pt))}if(A=Pe.multiply(S).addOrSubtract(Ie),w.getDegree()>=y.getDegree())throw new tr("Division algorithm failed to reduce polynomial?")}const P=A.getCoefficient(0);if(P===0)throw new ht("sigmaTilde(0) was zero");const G=x.inverse(P),te=A.multiplyScalar(G),oe=w.multiplyScalar(G);return[te,oe]}findErrorLocations(i){const c=i.getDegree();if(c===1)return Int32Array.from([i.getCoefficient(1)]);const h=new Int32Array(c);let x=0;const y=this.field;for(let w=1;w<y.getSize()&&x<c;w++)i.evaluateAt(w)===0&&(h[x]=y.inverse(w),x++);if(x!==c)throw new ht("Error locator degree does not match number of roots");return h}findErrorMagnitudes(i,c){const h=c.length,x=new Int32Array(h),y=this.field;for(let w=0;w<h;w++){const S=y.inverse(c[w]);let A=1;for(let P=0;P<h;P++)if(w!==P){const G=y.multiply(c[P],S),te=(G&1)===0?G|1:G&-2;A=y.multiply(A,te)}x[w]=y.multiply(i.evaluateAt(S),y.inverse(A)),y.getGeneratorBase()!==0&&(x[w]=y.multiply(x[w],S))}return x}}var gt;(function(ee){ee[ee.UPPER=0]="UPPER",ee[ee.LOWER=1]="LOWER",ee[ee.MIXED=2]="MIXED",ee[ee.DIGIT=3]="DIGIT",ee[ee.PUNCT=4]="PUNCT",ee[ee.BINARY=5]="BINARY"})(gt||(gt={}));class ve{decode(i){this.ddata=i;let c=i.getBits(),h=this.extractBits(c),x=this.correctBits(h),y=ve.convertBoolArrayToByteArray(x),w=ve.getEncodedData(x),S=new ft(y,w,null,null);return S.setNumBits(x.length),S}static highLevelDecode(i){return this.getEncodedData(i)}static getEncodedData(i){let c=i.length,h=gt.UPPER,x=gt.UPPER,y="",w=0;for(;w<c;)if(x===gt.BINARY){if(c-w<5)break;let S=ve.readCode(i,w,5);if(w+=5,S===0){if(c-w<11)break;S=ve.readCode(i,w,11)+31,w+=11}for(let A=0;A<S;A++){if(c-w<8){w=c;break}const P=ve.readCode(i,w,8);y+=me.castAsNonUtf8Char(P),w+=8}x=h}else{let S=x===gt.DIGIT?4:5;if(c-w<S)break;let A=ve.readCode(i,w,S);w+=S;let P=ve.getCharacter(x,A);P.startsWith("CTRL_")?(h=x,x=ve.getTable(P.charAt(5)),P.charAt(6)==="L"&&(h=x)):(y+=P,x=h)}return y}static getTable(i){switch(i){case"L":return gt.LOWER;case"P":return gt.PUNCT;case"M":return gt.MIXED;case"D":return gt.DIGIT;case"B":return gt.BINARY;case"U":default:return gt.UPPER}}static getCharacter(i,c){switch(i){case gt.UPPER:return ve.UPPER_TABLE[c];case gt.LOWER:return ve.LOWER_TABLE[c];case gt.MIXED:return ve.MIXED_TABLE[c];case gt.PUNCT:return ve.PUNCT_TABLE[c];case gt.DIGIT:return ve.DIGIT_TABLE[c];default:throw new tr("Bad table")}}correctBits(i){let c,h;this.ddata.getNbLayers()<=2?(h=6,c=Ht.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(h=8,c=Ht.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(h=10,c=Ht.AZTEC_DATA_10):(h=12,c=Ht.AZTEC_DATA_12);let x=this.ddata.getNbDatablocks(),y=i.length/h;if(y<x)throw new V;let w=i.length%h,S=new Int32Array(y);for(let oe=0;oe<y;oe++,w+=h)S[oe]=ve.readCode(i,w,h);try{new Kt(c).decode(S,y-x)}catch(oe){throw new V(oe)}let A=(1<<h)-1,P=0;for(let oe=0;oe<x;oe++){let Ce=S[oe];if(Ce===0||Ce===A)throw new V;(Ce===1||Ce===A-1)&&P++}let G=new Array(x*h-P),te=0;for(let oe=0;oe<x;oe++){let Ce=S[oe];if(Ce===1||Ce===A-1)G.fill(Ce>1,te,te+h-1),te+=h-1;else for(let Ie=h-1;Ie>=0;--Ie)G[te++]=(Ce&1<<Ie)!==0}return G}extractBits(i){let c=this.ddata.isCompact(),h=this.ddata.getNbLayers(),x=(c?11:14)+h*4,y=new Int32Array(x),w=new Array(this.totalBitsInLayer(h,c));if(c)for(let S=0;S<y.length;S++)y[S]=S;else{let S=x+1+2*U.truncDivision(U.truncDivision(x,2)-1,15),A=x/2,P=U.truncDivision(S,2);for(let G=0;G<A;G++){let te=G+U.truncDivision(G,15);y[A-G-1]=P-te-1,y[A+G]=P+te+1}}for(let S=0,A=0;S<h;S++){let P=(h-S)*4+(c?9:12),G=S*2,te=x-1-G;for(let oe=0;oe<P;oe++){let Ce=oe*2;for(let Ie=0;Ie<2;Ie++)w[A+Ce+Ie]=i.get(y[G+Ie],y[G+oe]),w[A+2*P+Ce+Ie]=i.get(y[G+oe],y[te-Ie]),w[A+4*P+Ce+Ie]=i.get(y[te-Ie],y[te-oe]),w[A+6*P+Ce+Ie]=i.get(y[te-oe],y[G+Ie])}A+=P*8}return w}static readCode(i,c,h){let x=0;for(let y=c;y<c+h;y++)x<<=1,i[y]&&(x|=1);return x}static readByte(i,c){let h=i.length-c;return h>=8?ve.readCode(i,c,8):ve.readCode(i,c,h)<<8-h}static convertBoolArrayToByteArray(i){let c=new Uint8Array((i.length+7)/8);for(let h=0;h<c.length;h++)c[h]=ve.readByte(i,8*h);return c}totalBitsInLayer(i,c){return((c?88:112)+16*i)*i}}ve.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],ve.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],ve.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ve.PUNCT_TABLE=["","\r",`\r
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ve.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Le{constructor(){}static round(i){return i===NaN?0:i<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:i>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:i+(i<0?-.5:.5)|0}static distance(i,c,h,x){const y=i-h,w=c-x;return Math.sqrt(y*y+w*w)}static sum(i){let c=0;for(let h=0,x=i.length;h!==x;h++){const y=i[h];c+=y}return c}}class ut{static floatToIntBits(i){return i}}ut.MAX_VALUE=Number.MAX_SAFE_INTEGER;class tt{constructor(i,c){this.x=i,this.y=c}getX(){return this.x}getY(){return this.y}equals(i){if(i instanceof tt){const c=i;return this.x===c.x&&this.y===c.y}return!1}hashCode(){return 31*ut.floatToIntBits(this.x)+ut.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(i){const c=this.distance(i[0],i[1]),h=this.distance(i[1],i[2]),x=this.distance(i[0],i[2]);let y,w,S;if(h>=c&&h>=x?(w=i[0],y=i[1],S=i[2]):x>=h&&x>=c?(w=i[1],y=i[0],S=i[2]):(w=i[2],y=i[0],S=i[1]),this.crossProductZ(y,w,S)<0){const A=y;y=S,S=A}i[0]=y,i[1]=w,i[2]=S}static distance(i,c){return Le.distance(i.x,i.y,c.x,c.y)}static crossProductZ(i,c,h){const x=c.x,y=c.y;return(h.x-x)*(i.y-y)-(h.y-y)*(i.x-x)}}class Wt{constructor(i,c){this.bits=i,this.points=c}getBits(){return this.bits}getPoints(){return this.points}}class pt extends Wt{constructor(i,c,h,x,y){super(i,c),this.compact=h,this.nbDatablocks=x,this.nbLayers=y}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class We{constructor(i,c,h,x){this.image=i,this.height=i.getHeight(),this.width=i.getWidth(),c==null&&(c=We.INIT_SIZE),h==null&&(h=i.getWidth()/2|0),x==null&&(x=i.getHeight()/2|0);const y=c/2|0;if(this.leftInit=h-y,this.rightInit=h+y,this.upInit=x-y,this.downInit=x+y,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new ue}detect(){let i=this.leftInit,c=this.rightInit,h=this.upInit,x=this.downInit,y=!1,w=!0,S=!1,A=!1,P=!1,G=!1,te=!1;const oe=this.width,Ce=this.height;for(;w;){w=!1;let Ie=!0;for(;(Ie||!A)&&c<oe;)Ie=this.containsBlackPoint(h,x,c,!1),Ie?(c++,w=!0,A=!0):A||c++;if(c>=oe){y=!0;break}let Pe=!0;for(;(Pe||!P)&&x<Ce;)Pe=this.containsBlackPoint(i,c,x,!0),Pe?(x++,w=!0,P=!0):P||x++;if(x>=Ce){y=!0;break}let Ke=!0;for(;(Ke||!G)&&i>=0;)Ke=this.containsBlackPoint(h,x,i,!1),Ke?(i--,w=!0,G=!0):G||i--;if(i<0){y=!0;break}let it=!0;for(;(it||!te)&&h>=0;)it=this.containsBlackPoint(i,c,h,!0),it?(h--,w=!0,te=!0):te||h--;if(h<0){y=!0;break}w&&(S=!0)}if(!y&&S){const Ie=c-i;let Pe=null;for(let Pt=1;Pe===null&&Pt<Ie;Pt++)Pe=this.getBlackPointOnSegment(i,x-Pt,i+Pt,x);if(Pe==null)throw new ue;let Ke=null;for(let Pt=1;Ke===null&&Pt<Ie;Pt++)Ke=this.getBlackPointOnSegment(i,h+Pt,i+Pt,h);if(Ke==null)throw new ue;let it=null;for(let Pt=1;it===null&&Pt<Ie;Pt++)it=this.getBlackPointOnSegment(c,h+Pt,c-Pt,h);if(it==null)throw new ue;let Bt=null;for(let Pt=1;Bt===null&&Pt<Ie;Pt++)Bt=this.getBlackPointOnSegment(c,x-Pt,c-Pt,x);if(Bt==null)throw new ue;return this.centerEdges(Bt,Pe,it,Ke)}else throw new ue}getBlackPointOnSegment(i,c,h,x){const y=Le.round(Le.distance(i,c,h,x)),w=(h-i)/y,S=(x-c)/y,A=this.image;for(let P=0;P<y;P++){const G=Le.round(i+P*w),te=Le.round(c+P*S);if(A.get(G,te))return new tt(G,te)}return null}centerEdges(i,c,h,x){const y=i.getX(),w=i.getY(),S=c.getX(),A=c.getY(),P=h.getX(),G=h.getY(),te=x.getX(),oe=x.getY(),Ce=We.CORR;return y<this.width/2?[new tt(te-Ce,oe+Ce),new tt(S+Ce,A+Ce),new tt(P-Ce,G-Ce),new tt(y+Ce,w-Ce)]:[new tt(te+Ce,oe+Ce),new tt(S+Ce,A-Ce),new tt(P-Ce,G+Ce),new tt(y-Ce,w-Ce)]}containsBlackPoint(i,c,h,x){const y=this.image;if(x){for(let w=i;w<=c;w++)if(y.get(w,h))return!0}else for(let w=i;w<=c;w++)if(y.get(h,w))return!0;return!1}}We.INIT_SIZE=10,We.CORR=1;class Nt{static checkAndNudgePoints(i,c){const h=i.getWidth(),x=i.getHeight();let y=!0;for(let w=0;w<c.length&&y;w+=2){const S=Math.floor(c[w]),A=Math.floor(c[w+1]);if(S<-1||S>h||A<-1||A>x)throw new ue;y=!1,S===-1?(c[w]=0,y=!0):S===h&&(c[w]=h-1,y=!0),A===-1?(c[w+1]=0,y=!0):A===x&&(c[w+1]=x-1,y=!0)}y=!0;for(let w=c.length-2;w>=0&&y;w-=2){const S=Math.floor(c[w]),A=Math.floor(c[w+1]);if(S<-1||S>h||A<-1||A>x)throw new ue;y=!1,S===-1?(c[w]=0,y=!0):S===h&&(c[w]=h-1,y=!0),A===-1?(c[w+1]=0,y=!0):A===x&&(c[w+1]=x-1,y=!0)}}}class At{constructor(i,c,h,x,y,w,S,A,P){this.a11=i,this.a21=c,this.a31=h,this.a12=x,this.a22=y,this.a32=w,this.a13=S,this.a23=A,this.a33=P}static quadrilateralToQuadrilateral(i,c,h,x,y,w,S,A,P,G,te,oe,Ce,Ie,Pe,Ke){const it=At.quadrilateralToSquare(i,c,h,x,y,w,S,A);return At.squareToQuadrilateral(P,G,te,oe,Ce,Ie,Pe,Ke).times(it)}transformPoints(i){const c=i.length,h=this.a11,x=this.a12,y=this.a13,w=this.a21,S=this.a22,A=this.a23,P=this.a31,G=this.a32,te=this.a33;for(let oe=0;oe<c;oe+=2){const Ce=i[oe],Ie=i[oe+1],Pe=y*Ce+A*Ie+te;i[oe]=(h*Ce+w*Ie+P)/Pe,i[oe+1]=(x*Ce+S*Ie+G)/Pe}}transformPointsWithValues(i,c){const h=this.a11,x=this.a12,y=this.a13,w=this.a21,S=this.a22,A=this.a23,P=this.a31,G=this.a32,te=this.a33,oe=i.length;for(let Ce=0;Ce<oe;Ce++){const Ie=i[Ce],Pe=c[Ce],Ke=y*Ie+A*Pe+te;i[Ce]=(h*Ie+w*Pe+P)/Ke,c[Ce]=(x*Ie+S*Pe+G)/Ke}}static squareToQuadrilateral(i,c,h,x,y,w,S,A){const P=i-h+y-S,G=c-x+w-A;if(P===0&&G===0)return new At(h-i,y-h,i,x-c,w-x,c,0,0,1);{const te=h-y,oe=S-y,Ce=x-w,Ie=A-w,Pe=te*Ie-oe*Ce,Ke=(P*Ie-oe*G)/Pe,it=(te*G-P*Ce)/Pe;return new At(h-i+Ke*h,S-i+it*S,i,x-c+Ke*x,A-c+it*A,c,Ke,it,1)}}static quadrilateralToSquare(i,c,h,x,y,w,S,A){return At.squareToQuadrilateral(i,c,h,x,y,w,S,A).buildAdjoint()}buildAdjoint(){return new At(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(i){return new At(this.a11*i.a11+this.a21*i.a12+this.a31*i.a13,this.a11*i.a21+this.a21*i.a22+this.a31*i.a23,this.a11*i.a31+this.a21*i.a32+this.a31*i.a33,this.a12*i.a11+this.a22*i.a12+this.a32*i.a13,this.a12*i.a21+this.a22*i.a22+this.a32*i.a23,this.a12*i.a31+this.a22*i.a32+this.a32*i.a33,this.a13*i.a11+this.a23*i.a12+this.a33*i.a13,this.a13*i.a21+this.a23*i.a22+this.a33*i.a23,this.a13*i.a31+this.a23*i.a32+this.a33*i.a33)}}class Qt extends Nt{sampleGrid(i,c,h,x,y,w,S,A,P,G,te,oe,Ce,Ie,Pe,Ke,it,Bt,Pt){const Mt=At.quadrilateralToQuadrilateral(x,y,w,S,A,P,G,te,oe,Ce,Ie,Pe,Ke,it,Bt,Pt);return this.sampleGridWithTransform(i,c,h,Mt)}sampleGridWithTransform(i,c,h,x){if(c<=0||h<=0)throw new ue;const y=new Oe(c,h),w=new Float32Array(2*c);for(let S=0;S<h;S++){const A=w.length,P=S+.5;for(let G=0;G<A;G+=2)w[G]=G/2+.5,w[G+1]=P;x.transformPoints(w),Nt.checkAndNudgePoints(i,w);try{for(let G=0;G<A;G+=2)i.get(Math.floor(w[G]),Math.floor(w[G+1]))&&y.set(G/2,S)}catch(G){throw new ue}}return y}}class cr{static setGridSampler(i){cr.gridSampler=i}static getInstance(){return cr.gridSampler}}cr.gridSampler=new Qt;class He{constructor(i,c){this.x=i,this.y=c}toResultPoint(){return new tt(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class It{constructor(i){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=i}detect(){return this.detectMirror(!1)}detectMirror(i){let c=this.getMatrixCenter(),h=this.getBullsEyeCorners(c);if(i){let w=h[0];h[0]=h[2],h[2]=w}this.extractParameters(h);let x=this.sampleGrid(this.image,h[this.shift%4],h[(this.shift+1)%4],h[(this.shift+2)%4],h[(this.shift+3)%4]),y=this.getMatrixCornerPoints(h);return new pt(x,y,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(i){if(!this.isValidPoint(i[0])||!this.isValidPoint(i[1])||!this.isValidPoint(i[2])||!this.isValidPoint(i[3]))throw new ue;let c=2*this.nbCenterLayers,h=new Int32Array([this.sampleLine(i[0],i[1],c),this.sampleLine(i[1],i[2],c),this.sampleLine(i[2],i[3],c),this.sampleLine(i[3],i[0],c)]);this.shift=this.getRotation(h,c);let x=0;for(let w=0;w<4;w++){let S=h[(this.shift+w)%4];this.compact?(x<<=7,x+=S>>1&127):(x<<=10,x+=(S>>2&992)+(S>>1&31))}let y=this.getCorrectedParameterData(x,this.compact);this.compact?(this.nbLayers=(y>>6)+1,this.nbDataBlocks=(y&63)+1):(this.nbLayers=(y>>11)+1,this.nbDataBlocks=(y&2047)+1)}getRotation(i,c){let h=0;i.forEach((x,y,w)=>{let S=(x>>c-2<<1)+(x&1);h=(h<<3)+S}),h=((h&1)<<11)+(h>>1);for(let x=0;x<4;x++)if(U.bitCount(h^this.EXPECTED_CORNER_BITS[x])<=2)return x;throw new ue}getCorrectedParameterData(i,c){let h,x;c?(h=7,x=2):(h=10,x=4);let y=h-x,w=new Int32Array(h);for(let A=h-1;A>=0;--A)w[A]=i&15,i>>=4;try{new Kt(Ht.AZTEC_PARAM).decode(w,y)}catch(A){throw new ue}let S=0;for(let A=0;A<x;A++)S=(S<<4)+w[A];return S}getBullsEyeCorners(i){let c=i,h=i,x=i,y=i,w=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let te=this.getFirstDifferent(c,w,1,-1),oe=this.getFirstDifferent(h,w,1,1),Ce=this.getFirstDifferent(x,w,-1,1),Ie=this.getFirstDifferent(y,w,-1,-1);if(this.nbCenterLayers>2){let Pe=this.distancePoint(Ie,te)*this.nbCenterLayers/(this.distancePoint(y,c)*(this.nbCenterLayers+2));if(Pe<.75||Pe>1.25||!this.isWhiteOrBlackRectangle(te,oe,Ce,Ie))break}c=te,h=oe,x=Ce,y=Ie,w=!w}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new ue;this.compact=this.nbCenterLayers===5;let S=new tt(c.getX()+.5,c.getY()-.5),A=new tt(h.getX()+.5,h.getY()+.5),P=new tt(x.getX()-.5,x.getY()+.5),G=new tt(y.getX()-.5,y.getY()-.5);return this.expandSquare([S,A,P,G],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let i,c,h,x;try{let S=new We(this.image).detect();i=S[0],c=S[1],h=S[2],x=S[3]}catch(S){let A=this.image.getWidth()/2,P=this.image.getHeight()/2;i=this.getFirstDifferent(new He(A+7,P-7),!1,1,-1).toResultPoint(),c=this.getFirstDifferent(new He(A+7,P+7),!1,1,1).toResultPoint(),h=this.getFirstDifferent(new He(A-7,P+7),!1,-1,1).toResultPoint(),x=this.getFirstDifferent(new He(A-7,P-7),!1,-1,-1).toResultPoint()}let y=Le.round((i.getX()+x.getX()+c.getX()+h.getX())/4),w=Le.round((i.getY()+x.getY()+c.getY()+h.getY())/4);try{let S=new We(this.image,15,y,w).detect();i=S[0],c=S[1],h=S[2],x=S[3]}catch(S){i=this.getFirstDifferent(new He(y+7,w-7),!1,1,-1).toResultPoint(),c=this.getFirstDifferent(new He(y+7,w+7),!1,1,1).toResultPoint(),h=this.getFirstDifferent(new He(y-7,w+7),!1,-1,1).toResultPoint(),x=this.getFirstDifferent(new He(y-7,w-7),!1,-1,-1).toResultPoint()}return y=Le.round((i.getX()+x.getX()+c.getX()+h.getX())/4),w=Le.round((i.getY()+x.getY()+c.getY()+h.getY())/4),new He(y,w)}getMatrixCornerPoints(i){return this.expandSquare(i,2*this.nbCenterLayers,this.getDimension())}sampleGrid(i,c,h,x,y){let w=cr.getInstance(),S=this.getDimension(),A=S/2-this.nbCenterLayers,P=S/2+this.nbCenterLayers;return w.sampleGrid(i,S,S,A,A,P,A,P,P,A,P,c.getX(),c.getY(),h.getX(),h.getY(),x.getX(),x.getY(),y.getX(),y.getY())}sampleLine(i,c,h){let x=0,y=this.distanceResultPoint(i,c),w=y/h,S=i.getX(),A=i.getY(),P=w*(c.getX()-i.getX())/y,G=w*(c.getY()-i.getY())/y;for(let te=0;te<h;te++)this.image.get(Le.round(S+te*P),Le.round(A+te*G))&&(x|=1<<h-te-1);return x}isWhiteOrBlackRectangle(i,c,h,x){let y=3;i=new He(i.getX()-y,i.getY()+y),c=new He(c.getX()-y,c.getY()-y),h=new He(h.getX()+y,h.getY()-y),x=new He(x.getX()+y,x.getY()+y);let w=this.getColor(x,i);if(w===0)return!1;let S=this.getColor(i,c);return S!==w||(S=this.getColor(c,h),S!==w)?!1:(S=this.getColor(h,x),S===w)}getColor(i,c){let h=this.distancePoint(i,c),x=(c.getX()-i.getX())/h,y=(c.getY()-i.getY())/h,w=0,S=i.getX(),A=i.getY(),P=this.image.get(i.getX(),i.getY()),G=Math.ceil(h);for(let oe=0;oe<G;oe++)S+=x,A+=y,this.image.get(Le.round(S),Le.round(A))!==P&&w++;let te=w/h;return te>.1&&te<.9?0:te<=.1===P?1:-1}getFirstDifferent(i,c,h,x){let y=i.getX()+h,w=i.getY()+x;for(;this.isValid(y,w)&&this.image.get(y,w)===c;)y+=h,w+=x;for(y-=h,w-=x;this.isValid(y,w)&&this.image.get(y,w)===c;)y+=h;for(y-=h;this.isValid(y,w)&&this.image.get(y,w)===c;)w+=x;return w-=x,new He(y,w)}expandSquare(i,c,h){let x=h/(2*c),y=i[0].getX()-i[2].getX(),w=i[0].getY()-i[2].getY(),S=(i[0].getX()+i[2].getX())/2,A=(i[0].getY()+i[2].getY())/2,P=new tt(S+x*y,A+x*w),G=new tt(S-x*y,A-x*w);y=i[1].getX()-i[3].getX(),w=i[1].getY()-i[3].getY(),S=(i[1].getX()+i[3].getX())/2,A=(i[1].getY()+i[3].getY())/2;let te=new tt(S+x*y,A+x*w),oe=new tt(S-x*y,A-x*w);return[P,te,G,oe]}isValid(i,c){return i>=0&&i<this.image.getWidth()&&c>0&&c<this.image.getHeight()}isValidPoint(i){let c=Le.round(i.getX()),h=Le.round(i.getY());return this.isValid(c,h)}distancePoint(i,c){return Le.distance(i.getX(),i.getY(),c.getX(),c.getY())}distanceResultPoint(i,c){return Le.distance(i.getX(),i.getY(),c.getX(),c.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(U.truncDivision(this.nbLayers-4,8)+1)+15}}class Zt{decode(i,c=null){let h=null,x=new It(i.getBlackMatrix()),y=null,w=null;try{let G=x.detectMirror(!1);y=G.getPoints(),this.reportFoundResultPoints(c,y),w=new ve().decode(G)}catch(G){h=G}if(w==null)try{let G=x.detectMirror(!0);y=G.getPoints(),this.reportFoundResultPoints(c,y),w=new ve().decode(G)}catch(G){throw h!=null?h:G}let S=new se(w.getText(),w.getRawBytes(),w.getNumBits(),y,pe.AZTEC,M.currentTimeMillis()),A=w.getByteSegments();A!=null&&S.putMetadata(Fe.BYTE_SEGMENTS,A);let P=w.getECLevel();return P!=null&&S.putMetadata(Fe.ERROR_CORRECTION_LEVEL,P),S}reportFoundResultPoints(i,c){if(i!=null){let h=i.get(ne.NEED_RESULT_POINT_CALLBACK);h!=null&&c.forEach((x,y,w)=>{h.foundPossibleResultPoint(x)})}}reset(){}}class yr extends ae{constructor(i=500){super(new Zt,i)}}class Ye{decode(i,c){try{return this.doDecode(i,c)}catch(h){if(c&&c.get(ne.TRY_HARDER)===!0&&i.isRotateSupported()){const y=i.rotateCounterClockwise(),w=this.doDecode(y,c),S=w.getResultMetadata();let A=270;S!==null&&S.get(Fe.ORIENTATION)===!0&&(A=A+S.get(Fe.ORIENTATION)%360),w.putMetadata(Fe.ORIENTATION,A);const P=w.getResultPoints();if(P!==null){const G=y.getHeight();for(let te=0;te<P.length;te++)P[te]=new tt(G-P[te].getY()-1,P[te].getX())}return w}else throw new ue}}reset(){}doDecode(i,c){const h=i.getWidth(),x=i.getHeight();let y=new H(h);const w=c&&c.get(ne.TRY_HARDER)===!0,S=Math.max(1,x>>(w?8:5));let A;w?A=x:A=15;const P=Math.trunc(x/2);for(let G=0;G<A;G++){const te=Math.trunc((G+1)/2),oe=(G&1)===0,Ce=P+S*(oe?te:-te);if(Ce<0||Ce>=x)break;try{y=i.getBlackRow(Ce,y)}catch(Ie){continue}for(let Ie=0;Ie<2;Ie++){if(Ie===1&&(y.reverse(),c&&c.get(ne.NEED_RESULT_POINT_CALLBACK)===!0)){const Pe=new Map;c.forEach((Ke,it)=>Pe.set(it,Ke)),Pe.delete(ne.NEED_RESULT_POINT_CALLBACK),c=Pe}try{const Pe=this.decodeRow(Ce,y,c);if(Ie===1){Pe.putMetadata(Fe.ORIENTATION,180);const Ke=Pe.getResultPoints();Ke!==null&&(Ke[0]=new tt(h-Ke[0].getX()-1,Ke[0].getY()),Ke[1]=new tt(h-Ke[1].getX()-1,Ke[1].getY()))}return Pe}catch(Pe){}}}throw new ue}static recordPattern(i,c,h){const x=h.length;for(let P=0;P<x;P++)h[P]=0;const y=i.getSize();if(c>=y)throw new ue;let w=!i.get(c),S=0,A=c;for(;A<y;){if(i.get(A)!==w)h[S]++;else{if(++S===x)break;h[S]=1,w=!w}A++}if(!(S===x||S===x-1&&A===y))throw new ue}static recordPatternInReverse(i,c,h){let x=h.length,y=i.get(c);for(;c>0&&x>=0;)i.get(--c)!==y&&(x--,y=!y);if(x>=0)throw new ue;Ye.recordPattern(i,c+1,h)}static patternMatchVariance(i,c,h){const x=i.length;let y=0,w=0;for(let P=0;P<x;P++)y+=i[P],w+=c[P];if(y<w)return Number.POSITIVE_INFINITY;const S=y/w;h*=S;let A=0;for(let P=0;P<x;P++){const G=i[P],te=c[P]*S,oe=G>te?G-te:te-G;if(oe>h)return Number.POSITIVE_INFINITY;A+=oe}return A/y}}class Ge extends Ye{static findStartPattern(i){const c=i.getSize(),h=i.getNextSet(0);let x=0,y=Int32Array.from([0,0,0,0,0,0]),w=h,S=!1;const A=6;for(let P=h;P<c;P++)if(i.get(P)!==S)y[x]++;else{if(x===A-1){let G=Ge.MAX_AVG_VARIANCE,te=-1;for(let oe=Ge.CODE_START_A;oe<=Ge.CODE_START_C;oe++){const Ce=Ye.patternMatchVariance(y,Ge.CODE_PATTERNS[oe],Ge.MAX_INDIVIDUAL_VARIANCE);Ce<G&&(G=Ce,te=oe)}if(te>=0&&i.isRange(Math.max(0,w-(P-w)/2),w,!1))return Int32Array.from([w,P,te]);w+=y[0]+y[1],y=y.slice(2,y.length-1),y[x-1]=0,y[x]=0,x--}else x++;y[x]=1,S=!S}throw new ue}static decodeCode(i,c,h){Ye.recordPattern(i,h,c);let x=Ge.MAX_AVG_VARIANCE,y=-1;for(let w=0;w<Ge.CODE_PATTERNS.length;w++){const S=Ge.CODE_PATTERNS[w],A=this.patternMatchVariance(c,S,Ge.MAX_INDIVIDUAL_VARIANCE);A<x&&(x=A,y=w)}if(y>=0)return y;throw new ue}decodeRow(i,c,h){const x=h&&h.get(ne.ASSUME_GS1)===!0,y=Ge.findStartPattern(c),w=y[2];let S=0;const A=new Uint8Array(20);A[S++]=w;let P;switch(w){case Ge.CODE_START_A:P=Ge.CODE_CODE_A;break;case Ge.CODE_START_B:P=Ge.CODE_CODE_B;break;case Ge.CODE_START_C:P=Ge.CODE_CODE_C;break;default:throw new V}let G=!1,te=!1,oe="",Ce=y[0],Ie=y[1];const Pe=Int32Array.from([0,0,0,0,0,0]);let Ke=0,it=0,Bt=w,Pt=0,Mt=!0,jr=!1,Sr=!1;for(;!G;){const vs=te;switch(te=!1,Ke=it,it=Ge.decodeCode(c,Pe,Ie),A[S++]=it,it!==Ge.CODE_STOP&&(Mt=!0),it!==Ge.CODE_STOP&&(Pt++,Bt+=Pt*it),Ce=Ie,Ie+=Pe.reduce((Ac,pi)=>Ac+pi,0),it){case Ge.CODE_START_A:case Ge.CODE_START_B:case Ge.CODE_START_C:throw new V}switch(P){case Ge.CODE_CODE_A:if(it<64)Sr===jr?oe+=String.fromCharCode(32+it):oe+=String.fromCharCode(32+it+128),Sr=!1;else if(it<96)Sr===jr?oe+=String.fromCharCode(it-64):oe+=String.fromCharCode(it+64),Sr=!1;else switch(it!==Ge.CODE_STOP&&(Mt=!1),it){case Ge.CODE_FNC_1:x&&(oe.length===0?oe+="]C1":oe+="");break;case Ge.CODE_FNC_2:case Ge.CODE_FNC_3:break;case Ge.CODE_FNC_4_A:!jr&&Sr?(jr=!0,Sr=!1):jr&&Sr?(jr=!1,Sr=!1):Sr=!0;break;case Ge.CODE_SHIFT:te=!0,P=Ge.CODE_CODE_B;break;case Ge.CODE_CODE_B:P=Ge.CODE_CODE_B;break;case Ge.CODE_CODE_C:P=Ge.CODE_CODE_C;break;case Ge.CODE_STOP:G=!0;break}break;case Ge.CODE_CODE_B:if(it<96)Sr===jr?oe+=String.fromCharCode(32+it):oe+=String.fromCharCode(32+it+128),Sr=!1;else switch(it!==Ge.CODE_STOP&&(Mt=!1),it){case Ge.CODE_FNC_1:x&&(oe.length===0?oe+="]C1":oe+="");break;case Ge.CODE_FNC_2:case Ge.CODE_FNC_3:break;case Ge.CODE_FNC_4_B:!jr&&Sr?(jr=!0,Sr=!1):jr&&Sr?(jr=!1,Sr=!1):Sr=!0;break;case Ge.CODE_SHIFT:te=!0,P=Ge.CODE_CODE_A;break;case Ge.CODE_CODE_A:P=Ge.CODE_CODE_A;break;case Ge.CODE_CODE_C:P=Ge.CODE_CODE_C;break;case Ge.CODE_STOP:G=!0;break}break;case Ge.CODE_CODE_C:if(it<100)it<10&&(oe+="0"),oe+=it;else switch(it!==Ge.CODE_STOP&&(Mt=!1),it){case Ge.CODE_FNC_1:x&&(oe.length===0?oe+="]C1":oe+="");break;case Ge.CODE_CODE_A:P=Ge.CODE_CODE_A;break;case Ge.CODE_CODE_B:P=Ge.CODE_CODE_B;break;case Ge.CODE_STOP:G=!0;break}break}vs&&(P=P===Ge.CODE_CODE_A?Ge.CODE_CODE_B:Ge.CODE_CODE_A)}const Qr=Ie-Ce;if(Ie=c.getNextUnset(Ie),!c.isRange(Ie,Math.min(c.getSize(),Ie+(Ie-Ce)/2),!1))throw new ue;if(Bt-=Pt*Ke,Bt%103!==Ke)throw new O;const kn=oe.length;if(kn===0)throw new ue;kn>0&&Mt&&(P===Ge.CODE_CODE_C?oe=oe.substring(0,kn-2):oe=oe.substring(0,kn-1));const Nn=(y[1]+y[0])/2,qr=Ce+Qr/2,ln=A.length,Rn=new Uint8Array(ln);for(let vs=0;vs<ln;vs++)Rn[vs]=A[vs];const no=[new tt(Nn,i),new tt(qr,i)];return new se(oe,Rn,0,no,pe.CODE_128,new Date().getTime())}}Ge.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],Ge.MAX_AVG_VARIANCE=.25,Ge.MAX_INDIVIDUAL_VARIANCE=.7,Ge.CODE_SHIFT=98,Ge.CODE_CODE_C=99,Ge.CODE_CODE_B=100,Ge.CODE_CODE_A=101,Ge.CODE_FNC_1=102,Ge.CODE_FNC_2=97,Ge.CODE_FNC_3=96,Ge.CODE_FNC_4_A=101,Ge.CODE_FNC_4_B=100,Ge.CODE_START_A=103,Ge.CODE_START_B=104,Ge.CODE_START_C=105,Ge.CODE_STOP=106;class Ct extends Ye{constructor(i=!1,c=!1){super(),this.usingCheckDigit=i,this.extendedMode=c,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(i,c,h){let x=this.counters;x.fill(0),this.decodeRowResult="";let y=Ct.findAsteriskPattern(c,x),w=c.getNextSet(y[1]),S=c.getSize(),A,P;do{Ct.recordPattern(c,w,x);let Pe=Ct.toNarrowWidePattern(x);if(Pe<0)throw new ue;A=Ct.patternToChar(Pe),this.decodeRowResult+=A,P=w;for(let Ke of x)w+=Ke;w=c.getNextSet(w)}while(A!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let G=0;for(let Pe of x)G+=Pe;let te=w-P-G;if(w!==S&&te*2<G)throw new ue;if(this.usingCheckDigit){let Pe=this.decodeRowResult.length-1,Ke=0;for(let it=0;it<Pe;it++)Ke+=Ct.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(it));if(this.decodeRowResult.charAt(Pe)!==Ct.ALPHABET_STRING.charAt(Ke%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,Pe)}if(this.decodeRowResult.length===0)throw new ue;let oe;this.extendedMode?oe=Ct.decodeExtended(this.decodeRowResult):oe=this.decodeRowResult;let Ce=(y[1]+y[0])/2,Ie=P+G/2;return new se(oe,null,0,[new tt(Ce,i),new tt(Ie,i)],pe.CODE_39,new Date().getTime())}static findAsteriskPattern(i,c){let h=i.getSize(),x=i.getNextSet(0),y=0,w=x,S=!1,A=c.length;for(let P=x;P<h;P++)if(i.get(P)!==S)c[y]++;else{if(y===A-1){if(this.toNarrowWidePattern(c)===Ct.ASTERISK_ENCODING&&i.isRange(Math.max(0,w-Math.floor((P-w)/2)),w,!1))return[w,P];w+=c[0]+c[1],c.copyWithin(0,2,2+y-1),c[y-1]=0,c[y]=0,y--}else y++;c[y]=1,S=!S}throw new ue}static toNarrowWidePattern(i){let c=i.length,h=0,x;do{let y=2147483647;for(let A of i)A<y&&A>h&&(y=A);h=y,x=0;let w=0,S=0;for(let A=0;A<c;A++){let P=i[A];P>h&&(S|=1<<c-1-A,x++,w+=P)}if(x===3){for(let A=0;A<c&&x>0;A++){let P=i[A];if(P>h&&(x--,P*2>=w))return-1}return S}}while(x>3);return-1}static patternToChar(i){for(let c=0;c<Ct.CHARACTER_ENCODINGS.length;c++)if(Ct.CHARACTER_ENCODINGS[c]===i)return Ct.ALPHABET_STRING.charAt(c);if(i===Ct.ASTERISK_ENCODING)return"*";throw new ue}static decodeExtended(i){let c=i.length,h="";for(let x=0;x<c;x++){let y=i.charAt(x);if(y==="+"||y==="$"||y==="%"||y==="/"){let w=i.charAt(x+1),S="\0";switch(y){case"+":if(w>="A"&&w<="Z")S=String.fromCharCode(w.charCodeAt(0)+32);else throw new V;break;case"$":if(w>="A"&&w<="Z")S=String.fromCharCode(w.charCodeAt(0)-64);else throw new V;break;case"%":if(w>="A"&&w<="E")S=String.fromCharCode(w.charCodeAt(0)-38);else if(w>="F"&&w<="J")S=String.fromCharCode(w.charCodeAt(0)-11);else if(w>="K"&&w<="O")S=String.fromCharCode(w.charCodeAt(0)+16);else if(w>="P"&&w<="T")S=String.fromCharCode(w.charCodeAt(0)+43);else if(w==="U")S="\0";else if(w==="V")S="@";else if(w==="W")S="`";else if(w==="X"||w==="Y"||w==="Z")S="";else throw new V;break;case"/":if(w>="A"&&w<="O")S=String.fromCharCode(w.charCodeAt(0)-32);else if(w==="Z")S=":";else throw new V;break}h+=S,x++}else h+=y}return h}}Ct.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Ct.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Ct.ASTERISK_ENCODING=148;class Ft extends Ye{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(i,c,h){let x=this.decodeStart(c),y=this.decodeEnd(c),w=new Se;Ft.decodeMiddle(c,x[1],y[0],w);let S=w.toString(),A=null;h!=null&&(A=h.get(ne.ALLOWED_LENGTHS)),A==null&&(A=Ft.DEFAULT_ALLOWED_LENGTHS);let P=S.length,G=!1,te=0;for(let Ie of A){if(P===Ie){G=!0;break}Ie>te&&(te=Ie)}if(!G&&P>te&&(G=!0),!G)throw new V;const oe=[new tt(x[1],i),new tt(y[0],i)];return new se(S,null,0,oe,pe.ITF,new Date().getTime())}static decodeMiddle(i,c,h,x){let y=new Int32Array(10),w=new Int32Array(5),S=new Int32Array(5);for(y.fill(0),w.fill(0),S.fill(0);c<h;){Ye.recordPattern(i,c,y);for(let P=0;P<5;P++){let G=2*P;w[P]=y[G],S[P]=y[G+1]}let A=Ft.decodeDigit(w);x.append(A.toString()),A=this.decodeDigit(S),x.append(A.toString()),y.forEach(function(P){c+=P})}}decodeStart(i){let c=Ft.skipWhiteSpace(i),h=Ft.findGuardPattern(i,c,Ft.START_PATTERN);return this.narrowLineWidth=(h[1]-h[0])/4,this.validateQuietZone(i,h[0]),h}validateQuietZone(i,c){let h=this.narrowLineWidth*10;h=h<c?h:c;for(let x=c-1;h>0&&x>=0&&!i.get(x);x--)h--;if(h!==0)throw new ue}static skipWhiteSpace(i){const c=i.getSize(),h=i.getNextSet(0);if(h===c)throw new ue;return h}decodeEnd(i){i.reverse();try{let c=Ft.skipWhiteSpace(i),h;try{h=Ft.findGuardPattern(i,c,Ft.END_PATTERN_REVERSED[0])}catch(y){y instanceof ue&&(h=Ft.findGuardPattern(i,c,Ft.END_PATTERN_REVERSED[1]))}this.validateQuietZone(i,h[0]);let x=h[0];return h[0]=i.getSize()-h[1],h[1]=i.getSize()-x,h}finally{i.reverse()}}static findGuardPattern(i,c,h){let x=h.length,y=new Int32Array(x),w=i.getSize(),S=!1,A=0,P=c;y.fill(0);for(let G=c;G<w;G++)if(i.get(G)!==S)y[A]++;else{if(A===x-1){if(Ye.patternMatchVariance(y,h,Ft.MAX_INDIVIDUAL_VARIANCE)<Ft.MAX_AVG_VARIANCE)return[P,G];P+=y[0]+y[1],M.arraycopy(y,2,y,0,A-1),y[A-1]=0,y[A]=0,A--}else A++;y[A]=1,S=!S}throw new ue}static decodeDigit(i){let c=Ft.MAX_AVG_VARIANCE,h=-1,x=Ft.PATTERNS.length;for(let y=0;y<x;y++){let w=Ft.PATTERNS[y],S=Ye.patternMatchVariance(i,w,Ft.MAX_INDIVIDUAL_VARIANCE);S<c?(c=S,h=y):S===c&&(h=-1)}if(h>=0)return h%10;throw new ue}}Ft.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Ft.MAX_AVG_VARIANCE=.38,Ft.MAX_INDIVIDUAL_VARIANCE=.5,Ft.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ft.START_PATTERN=Int32Array.from([1,1,1,1]),Ft.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Jt extends Ye{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(i){let c=!1,h,x=0,y=Int32Array.from([0,0,0]);for(;!c;){y=Int32Array.from([0,0,0]),h=Jt.findGuardPattern(i,x,!1,this.START_END_PATTERN,y);let w=h[0];x=h[1];let S=w-(x-w);S>=0&&(c=i.isRange(S,w,!1))}return h}static checkChecksum(i){return Jt.checkStandardUPCEANChecksum(i)}static checkStandardUPCEANChecksum(i){let c=i.length;if(c===0)return!1;let h=parseInt(i.charAt(c-1),10);return Jt.getStandardUPCEANChecksum(i.substring(0,c-1))===h}static getStandardUPCEANChecksum(i){let c=i.length,h=0;for(let x=c-1;x>=0;x-=2){let y=i.charAt(x).charCodeAt(0)-48;if(y<0||y>9)throw new V;h+=y}h*=3;for(let x=c-2;x>=0;x-=2){let y=i.charAt(x).charCodeAt(0)-48;if(y<0||y>9)throw new V;h+=y}return(1e3-h)%10}static decodeEnd(i,c){return Jt.findGuardPattern(i,c,!1,Jt.START_END_PATTERN,new Int32Array(Jt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(i,c,h,x){return this.findGuardPattern(i,c,h,x,new Int32Array(x.length))}static findGuardPattern(i,c,h,x,y){let w=i.getSize();c=h?i.getNextUnset(c):i.getNextSet(c);let S=0,A=c,P=x.length,G=h;for(let te=c;te<w;te++)if(i.get(te)!==G)y[S]++;else{if(S===P-1){if(Ye.patternMatchVariance(y,x,Jt.MAX_INDIVIDUAL_VARIANCE)<Jt.MAX_AVG_VARIANCE)return Int32Array.from([A,te]);A+=y[0]+y[1];let oe=y.slice(2,y.length-1);for(let Ce=0;Ce<S-1;Ce++)y[Ce]=oe[Ce];y[S-1]=0,y[S]=0,S--}else S++;y[S]=1,G=!G}throw new ue}static decodeDigit(i,c,h,x){this.recordPattern(i,h,c);let y=this.MAX_AVG_VARIANCE,w=-1,S=x.length;for(let A=0;A<S;A++){let P=x[A],G=Ye.patternMatchVariance(c,P,Jt.MAX_INDIVIDUAL_VARIANCE);G<y&&(y=G,w=A)}if(w>=0)return w;throw new ue}}Jt.MAX_AVG_VARIANCE=.48,Jt.MAX_INDIVIDUAL_VARIANCE=.7,Jt.START_END_PATTERN=Int32Array.from([1,1,1]),Jt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Jt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Jt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Dr{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(i,c,h){let x=this.decodeRowStringBuffer,y=this.decodeMiddle(c,h,x),w=x.toString(),S=Dr.parseExtensionString(w),A=[new tt((h[0]+h[1])/2,i),new tt(y,i)],P=new se(w,null,0,A,pe.UPC_EAN_EXTENSION,new Date().getTime());return S!=null&&P.putAllMetadata(S),P}decodeMiddle(i,c,h){let x=this.decodeMiddleCounters;x[0]=0,x[1]=0,x[2]=0,x[3]=0;let y=i.getSize(),w=c[1],S=0;for(let P=0;P<5&&w<y;P++){let G=Jt.decodeDigit(i,x,w,Jt.L_AND_G_PATTERNS);h+=String.fromCharCode(48+G%10);for(let te of x)w+=te;G>=10&&(S|=1<<4-P),P!==4&&(w=i.getNextSet(w),w=i.getNextUnset(w))}if(h.length!==5)throw new ue;let A=this.determineCheckDigit(S);if(Dr.extensionChecksum(h.toString())!==A)throw new ue;return w}static extensionChecksum(i){let c=i.length,h=0;for(let x=c-2;x>=0;x-=2)h+=i.charAt(x).charCodeAt(0)-48;h*=3;for(let x=c-1;x>=0;x-=2)h+=i.charAt(x).charCodeAt(0)-48;return h*=3,h%10}determineCheckDigit(i){for(let c=0;c<10;c++)if(i===this.CHECK_DIGIT_ENCODINGS[c])return c;throw new ue}static parseExtensionString(i){if(i.length!==5)return null;let c=Dr.parseExtension5String(i);return c==null?null:new Map([[Fe.SUGGESTED_PRICE,c]])}static parseExtension5String(i){let c;switch(i.charAt(0)){case"0":c="£";break;case"5":c="$";break;case"9":switch(i){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}c="";break;default:c="";break}let h=parseInt(i.substring(1)),x=(h/100).toString(),y=h%100,w=y<10?"0"+y:y.toString();return c+x+"."+w}}class kt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(i,c,h){let x=this.decodeRowStringBuffer,y=this.decodeMiddle(c,h,x),w=x.toString(),S=kt.parseExtensionString(w),A=[new tt((h[0]+h[1])/2,i),new tt(y,i)],P=new se(w,null,0,A,pe.UPC_EAN_EXTENSION,new Date().getTime());return S!=null&&P.putAllMetadata(S),P}decodeMiddle(i,c,h){let x=this.decodeMiddleCounters;x[0]=0,x[1]=0,x[2]=0,x[3]=0;let y=i.getSize(),w=c[1],S=0;for(let A=0;A<2&&w<y;A++){let P=Jt.decodeDigit(i,x,w,Jt.L_AND_G_PATTERNS);h+=String.fromCharCode(48+P%10);for(let G of x)w+=G;P>=10&&(S|=1<<1-A),A!==1&&(w=i.getNextSet(w),w=i.getNextUnset(w))}if(h.length!==2)throw new ue;if(parseInt(h.toString())%4!==S)throw new ue;return w}static parseExtensionString(i){return i.length!==2?null:new Map([[Fe.ISSUE_NUMBER,parseInt(i)]])}}class Re{static decodeRow(i,c,h){let x=Jt.findGuardPattern(c,h,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Dr().decodeRow(i,c,x)}catch(y){return new kt().decodeRow(i,c,x)}}}Re.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class qe extends Jt{constructor(){super(),this.decodeRowStringBuffer="",qe.L_AND_G_PATTERNS=qe.L_PATTERNS.map(i=>Int32Array.from(i));for(let i=10;i<20;i++){let c=qe.L_PATTERNS[i-10],h=new Int32Array(c.length);for(let x=0;x<c.length;x++)h[x]=c[c.length-x-1];qe.L_AND_G_PATTERNS[i]=h}}decodeRow(i,c,h){let x=qe.findStartGuardPattern(c),y=h==null?null:h.get(ne.NEED_RESULT_POINT_CALLBACK);if(y!=null){const Mt=new tt((x[0]+x[1])/2,i);y.foundPossibleResultPoint(Mt)}let w=this.decodeMiddle(c,x,this.decodeRowStringBuffer),S=w.rowOffset,A=w.resultString;if(y!=null){const Mt=new tt(S,i);y.foundPossibleResultPoint(Mt)}let P=this.decodeEnd(c,S);if(y!=null){const Mt=new tt((P[0]+P[1])/2,i);y.foundPossibleResultPoint(Mt)}let G=P[1],te=G+(G-P[0]);if(te>=c.getSize()||!c.isRange(G,te,!1))throw new ue;let oe=A.toString();if(oe.length<8)throw new V;if(!qe.checkChecksum(oe))throw new O;let Ce=(x[1]+x[0])/2,Ie=(P[1]+P[0])/2,Pe=this.getBarcodeFormat(),Ke=[new tt(Ce,i),new tt(Ie,i)],it=new se(oe,null,0,Ke,Pe,new Date().getTime()),Bt=0;try{let Mt=Re.decodeRow(i,c,P[1]);it.putMetadata(Fe.UPC_EAN_EXTENSION,Mt.getText()),it.putAllMetadata(Mt.getResultMetadata()),it.addResultPoints(Mt.getResultPoints()),Bt=Mt.getText().length}catch(Mt){}let Pt=h==null?null:h.get(ne.ALLOWED_EAN_EXTENSIONS);if(Pt!=null){let Mt=!1;for(let jr in Pt)if(Bt.toString()===jr){Mt=!0;break}if(!Mt)throw new ue}return it}decodeEnd(i,c){return qe.findGuardPattern(i,c,!1,qe.START_END_PATTERN,new Int32Array(qe.START_END_PATTERN.length).fill(0))}static checkChecksum(i){return qe.checkStandardUPCEANChecksum(i)}static checkStandardUPCEANChecksum(i){let c=i.length;if(c===0)return!1;let h=parseInt(i.charAt(c-1),10);return qe.getStandardUPCEANChecksum(i.substring(0,c-1))===h}static getStandardUPCEANChecksum(i){let c=i.length,h=0;for(let x=c-1;x>=0;x-=2){let y=i.charAt(x).charCodeAt(0)-48;if(y<0||y>9)throw new V;h+=y}h*=3;for(let x=c-2;x>=0;x-=2){let y=i.charAt(x).charCodeAt(0)-48;if(y<0||y>9)throw new V;h+=y}return(1e3-h)%10}}class Tt extends qe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(i,c,h){let x=this.decodeMiddleCounters;x[0]=0,x[1]=0,x[2]=0,x[3]=0;let y=i.getSize(),w=c[1],S=0;for(let P=0;P<6&&w<y;P++){let G=qe.decodeDigit(i,x,w,qe.L_AND_G_PATTERNS);h+=String.fromCharCode(48+G%10);for(let te of x)w+=te;G>=10&&(S|=1<<5-P)}h=Tt.determineFirstDigit(h,S),w=qe.findGuardPattern(i,w,!0,qe.MIDDLE_PATTERN,new Int32Array(qe.MIDDLE_PATTERN.length).fill(0))[1];for(let P=0;P<6&&w<y;P++){let G=qe.decodeDigit(i,x,w,qe.L_PATTERNS);h+=String.fromCharCode(48+G);for(let te of x)w+=te}return{rowOffset:w,resultString:h}}getBarcodeFormat(){return pe.EAN_13}static determineFirstDigit(i,c){for(let h=0;h<10;h++)if(c===this.FIRST_DIGIT_ENCODINGS[h])return i=String.fromCharCode(48+h)+i,i;throw new ue}}Tt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class xr extends qe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(i,c,h){const x=this.decodeMiddleCounters;x[0]=0,x[1]=0,x[2]=0,x[3]=0;let y=i.getSize(),w=c[1];for(let A=0;A<4&&w<y;A++){let P=qe.decodeDigit(i,x,w,qe.L_PATTERNS);h+=String.fromCharCode(48+P);for(let G of x)w+=G}w=qe.findGuardPattern(i,w,!0,qe.MIDDLE_PATTERN,new Int32Array(qe.MIDDLE_PATTERN.length).fill(0))[1];for(let A=0;A<4&&w<y;A++){let P=qe.decodeDigit(i,x,w,qe.L_PATTERNS);h+=String.fromCharCode(48+P);for(let G of x)w+=G}return{rowOffset:w,resultString:h}}getBarcodeFormat(){return pe.EAN_8}}class Hr extends qe{constructor(){super(...arguments),this.ean13Reader=new Tt}getBarcodeFormat(){return pe.UPC_A}decode(i,c){return this.maybeReturnResult(this.ean13Reader.decode(i))}decodeRow(i,c,h){return this.maybeReturnResult(this.ean13Reader.decodeRow(i,c,h))}decodeMiddle(i,c,h){return this.ean13Reader.decodeMiddle(i,c,h)}maybeReturnResult(i){let c=i.getText();if(c.charAt(0)==="0"){let h=new se(c.substring(1),null,null,i.getResultPoints(),pe.UPC_A);return i.getResultMetadata()!=null&&h.putAllMetadata(i.getResultMetadata()),h}else throw new ue}reset(){this.ean13Reader.reset()}}class Ir extends qe{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(i,c,h){const x=this.decodeMiddleCounters.map(P=>P);x[0]=0,x[1]=0,x[2]=0,x[3]=0;const y=i.getSize();let w=c[1],S=0;for(let P=0;P<6&&w<y;P++){const G=Ir.decodeDigit(i,x,w,Ir.L_AND_G_PATTERNS);h+=String.fromCharCode(48+G%10);for(let te of x)w+=te;G>=10&&(S|=1<<5-P)}let A=Ir.determineNumSysAndCheckDigit(h,S);return{rowOffset:w,resultString:A}}decodeEnd(i,c){return Ir.findGuardPatternWithoutCounters(i,c,!0,Ir.MIDDLE_END_PATTERN)}checkChecksum(i){return qe.checkChecksum(Ir.convertUPCEtoUPCA(i))}static determineNumSysAndCheckDigit(i,c){for(let h=0;h<=1;h++)for(let x=0;x<10;x++)if(c===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[h][x]){let y=String.fromCharCode(48+h),w=String.fromCharCode(48+x);return y+i+w}throw ue.getNotFoundInstance()}getBarcodeFormat(){return pe.UPC_E}static convertUPCEtoUPCA(i){const c=i.slice(1,7).split("").map(y=>y.charCodeAt(0)),h=new Se;h.append(i.charAt(0));let x=c[5];switch(x){case 0:case 1:case 2:h.appendChars(c,0,2),h.append(x),h.append("0000"),h.appendChars(c,2,3);break;case 3:h.appendChars(c,0,3),h.append("00000"),h.appendChars(c,3,2);break;case 4:h.appendChars(c,0,4),h.append("00000"),h.append(c[4]);break;default:h.appendChars(c,0,5),h.append("0000"),h.append(x);break}return i.length>=8&&h.append(i.charAt(7)),h.toString()}}Ir.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ir.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class Pa extends Ye{constructor(i){super();let c=i==null?null:i.get(ne.POSSIBLE_FORMATS),h=[];n(c)?(h.push(new Tt),h.push(new Hr),h.push(new xr),h.push(new Ir)):(c.indexOf(pe.EAN_13)>-1&&h.push(new Tt),c.indexOf(pe.UPC_A)>-1&&h.push(new Hr),c.indexOf(pe.EAN_8)>-1&&h.push(new xr),c.indexOf(pe.UPC_E)>-1&&h.push(new Ir)),this.readers=h}decodeRow(i,c,h){for(let x of this.readers)try{const y=x.decodeRow(i,c,h),w=y.getBarcodeFormat()===pe.EAN_13&&y.getText().charAt(0)==="0",S=h==null?null:h.get(ne.POSSIBLE_FORMATS),A=S==null||S.includes(pe.UPC_A);if(w&&A){const P=y.getRawBytes(),G=new se(y.getText().substring(1),P,P?P.length:null,y.getResultPoints(),pe.UPC_A);return G.putAllMetadata(y.getResultMetadata()),G}return y}catch(y){}throw new ue}reset(){for(let i of this.readers)i.reset()}}class ca extends Ye{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(i,c){for(let h=0;h<c.length;h++)if(Ye.patternMatchVariance(i,c[h],ca.MAX_INDIVIDUAL_VARIANCE)<ca.MAX_AVG_VARIANCE)return h;throw new ue}static count(i){return Le.sum(new Int32Array(i))}static increment(i,c){let h=0,x=c[0];for(let y=1;y<i.length;y++)c[y]>x&&(x=c[y],h=y);i[h]++}static decrement(i,c){let h=0,x=c[0];for(let y=1;y<i.length;y++)c[y]<x&&(x=c[y],h=y);i[h]--}static isFinderPattern(i){let c=i[0]+i[1],h=c+i[2]+i[3],x=c/h;if(x>=ca.MIN_FINDER_PATTERN_RATIO&&x<=ca.MAX_FINDER_PATTERN_RATIO){let y=Number.MAX_SAFE_INTEGER,w=Number.MIN_SAFE_INTEGER;for(let S of i)S>w&&(w=S),S<y&&(y=S);return w<10*y}return!1}}ca.MAX_AVG_VARIANCE=.2,ca.MAX_INDIVIDUAL_VARIANCE=.45,ca.MIN_FINDER_PATTERN_RATIO=9.5/12,ca.MAX_FINDER_PATTERN_RATIO=12.5/14;class _n{constructor(i,c){this.value=i,this.checksumPortion=c}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(i){if(!(i instanceof _n))return!1;const c=i;return this.value===c.value&&this.checksumPortion===c.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class fn{constructor(i,c,h,x,y){this.value=i,this.startEnd=c,this.value=i,this.startEnd=c,this.resultPoints=new Array,this.resultPoints.push(new tt(h,y)),this.resultPoints.push(new tt(x,y))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(i){if(!(i instanceof fn))return!1;const c=i;return this.value===c.value}hashCode(){return this.value}}class hn{constructor(){}static getRSSvalue(i,c,h){let x=0;for(let A of i)x+=A;let y=0,w=0,S=i.length;for(let A=0;A<S-1;A++){let P;for(P=1,w|=1<<A;P<i[A];P++,w&=~(1<<A)){let G=hn.combins(x-P-1,S-A-2);if(h&&w===0&&x-P-(S-A-1)>=S-A-1&&(G-=hn.combins(x-P-(S-A),S-A-2)),S-A-1>1){let te=0;for(let oe=x-P-(S-A-2);oe>c;oe--)te+=hn.combins(x-P-oe-1,S-A-3);G-=te*(S-1-A)}else x-P>c&&G--;y+=G}x-=P}return y}static combins(i,c){let h,x;i-c>c?(x=c,h=i-c):(x=i-c,h=c);let y=1,w=1;for(let S=i;S>h;S--)y*=S,w<=x&&(y/=w,w++);for(;w<=x;)y/=w,w++;return y}}class Xs{static buildBitArray(i){let c=i.length*2-1;i[i.length-1].getRightChar()==null&&(c-=1);let h=12*c,x=new H(h),y=0,S=i[0].getRightChar().getValue();for(let A=11;A>=0;--A)(S&1<<A)!=0&&x.set(y),y++;for(let A=1;A<i.length;++A){let P=i[A],G=P.getLeftChar().getValue();for(let te=11;te>=0;--te)(G&1<<te)!=0&&x.set(y),y++;if(P.getRightChar()!=null){let te=P.getRightChar().getValue();for(let oe=11;oe>=0;--oe)(te&1<<oe)!=0&&x.set(y),y++}}return x}}class Ha{constructor(i,c){c?this.decodedInformation=null:(this.finished=i,this.decodedInformation=c)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class gs{constructor(i){this.newPosition=i}getNewPosition(){return this.newPosition}}class $r extends gs{constructor(i,c){super(i),this.value=c}getValue(){return this.value}isFNC1(){return this.value===$r.FNC1}}$r.FNC1="$";class rr extends gs{constructor(i,c,h){super(i),h?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=c}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class ie extends gs{constructor(i,c,h){if(super(i),c<0||c>10||h<0||h>10)throw new V;this.firstDigit=c,this.secondDigit=h}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===ie.FNC1}isSecondDigitFNC1(){return this.secondDigit===ie.FNC1}isAnyFNC1(){return this.firstDigit===ie.FNC1||this.secondDigit===ie.FNC1}}ie.FNC1=10;class Z{constructor(){}static parseFieldsInGeneralPurpose(i){if(!i)return null;if(i.length<2)throw new ue;let c=i.substring(0,2);for(let y of Z.TWO_DIGIT_DATA_LENGTH)if(y[0]===c)return y[1]===Z.VARIABLE_LENGTH?Z.processVariableAI(2,y[2],i):Z.processFixedAI(2,y[1],i);if(i.length<3)throw new ue;let h=i.substring(0,3);for(let y of Z.THREE_DIGIT_DATA_LENGTH)if(y[0]===h)return y[1]===Z.VARIABLE_LENGTH?Z.processVariableAI(3,y[2],i):Z.processFixedAI(3,y[1],i);for(let y of Z.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(y[0]===h)return y[1]===Z.VARIABLE_LENGTH?Z.processVariableAI(4,y[2],i):Z.processFixedAI(4,y[1],i);if(i.length<4)throw new ue;let x=i.substring(0,4);for(let y of Z.FOUR_DIGIT_DATA_LENGTH)if(y[0]===x)return y[1]===Z.VARIABLE_LENGTH?Z.processVariableAI(4,y[2],i):Z.processFixedAI(4,y[1],i);throw new ue}static processFixedAI(i,c,h){if(h.length<i)throw new ue;let x=h.substring(0,i);if(h.length<i+c)throw new ue;let y=h.substring(i,i+c),w=h.substring(i+c),S="("+x+")"+y,A=Z.parseFieldsInGeneralPurpose(w);return A==null?S:S+A}static processVariableAI(i,c,h){let x=h.substring(0,i),y;h.length<i+c?y=h.length:y=i+c;let w=h.substring(i,y),S=h.substring(y),A="("+x+")"+w,P=Z.parseFieldsInGeneralPurpose(S);return P==null?A:A+P}}Z.VARIABLE_LENGTH=[],Z.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Z.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Z.VARIABLE_LENGTH,20],["22",Z.VARIABLE_LENGTH,29],["30",Z.VARIABLE_LENGTH,8],["37",Z.VARIABLE_LENGTH,8],["90",Z.VARIABLE_LENGTH,30],["91",Z.VARIABLE_LENGTH,30],["92",Z.VARIABLE_LENGTH,30],["93",Z.VARIABLE_LENGTH,30],["94",Z.VARIABLE_LENGTH,30],["95",Z.VARIABLE_LENGTH,30],["96",Z.VARIABLE_LENGTH,30],["97",Z.VARIABLE_LENGTH,3],["98",Z.VARIABLE_LENGTH,30],["99",Z.VARIABLE_LENGTH,30]],Z.THREE_DIGIT_DATA_LENGTH=[["240",Z.VARIABLE_LENGTH,30],["241",Z.VARIABLE_LENGTH,30],["242",Z.VARIABLE_LENGTH,6],["250",Z.VARIABLE_LENGTH,30],["251",Z.VARIABLE_LENGTH,30],["253",Z.VARIABLE_LENGTH,17],["254",Z.VARIABLE_LENGTH,20],["400",Z.VARIABLE_LENGTH,30],["401",Z.VARIABLE_LENGTH,30],["402",17],["403",Z.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Z.VARIABLE_LENGTH,20],["421",Z.VARIABLE_LENGTH,15],["422",3],["423",Z.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Z.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",Z.VARIABLE_LENGTH,15],["391",Z.VARIABLE_LENGTH,18],["392",Z.VARIABLE_LENGTH,15],["393",Z.VARIABLE_LENGTH,18],["703",Z.VARIABLE_LENGTH,30]],Z.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Z.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Z.VARIABLE_LENGTH,20],["8003",Z.VARIABLE_LENGTH,30],["8004",Z.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Z.VARIABLE_LENGTH,30],["8008",Z.VARIABLE_LENGTH,12],["8018",18],["8020",Z.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Z.VARIABLE_LENGTH,70],["8200",Z.VARIABLE_LENGTH,70]];class ce{constructor(i){this.buffer=new Se,this.information=i}decodeAllCodes(i,c){let h=c,x=null;do{let y=this.decodeGeneralPurposeField(h,x),w=Z.parseFieldsInGeneralPurpose(y.getNewString());if(w!=null&&i.append(w),y.isRemaining()?x=""+y.getRemainingValue():x=null,h===y.getNewPosition())break;h=y.getNewPosition()}while(!0);return i.toString()}isStillNumeric(i){if(i+7>this.information.getSize())return i+4<=this.information.getSize();for(let c=i;c<i+3;++c)if(this.information.get(c))return!0;return this.information.get(i+3)}decodeNumeric(i){if(i+7>this.information.getSize()){let y=this.extractNumericValueFromBitArray(i,4);return y===0?new ie(this.information.getSize(),ie.FNC1,ie.FNC1):new ie(this.information.getSize(),y-1,ie.FNC1)}let c=this.extractNumericValueFromBitArray(i,7),h=(c-8)/11,x=(c-8)%11;return new ie(i+7,h,x)}extractNumericValueFromBitArray(i,c){return ce.extractNumericValueFromBitArray(this.information,i,c)}static extractNumericValueFromBitArray(i,c,h){let x=0;for(let y=0;y<h;++y)i.get(c+y)&&(x|=1<<h-y-1);return x}decodeGeneralPurposeField(i,c){this.buffer.setLengthToZero(),c!=null&&this.buffer.append(c),this.current.setPosition(i);let h=this.parseBlocks();return h!=null&&h.isRemaining()?new rr(this.current.getPosition(),this.buffer.toString(),h.getRemainingValue()):new rr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let i,c;do{let h=this.current.getPosition();if(this.current.isAlpha()?(c=this.parseAlphaBlock(),i=c.isFinished()):this.current.isIsoIec646()?(c=this.parseIsoIec646Block(),i=c.isFinished()):(c=this.parseNumericBlock(),i=c.isFinished()),!(h!==this.current.getPosition())&&!i)break}while(!i);return c.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let i=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFirstDigitFNC1()){let c;return i.isSecondDigitFNC1()?c=new rr(this.current.getPosition(),this.buffer.toString()):c=new rr(this.current.getPosition(),this.buffer.toString(),i.getSecondDigit()),new Ha(!0,c)}if(this.buffer.append(i.getFirstDigit()),i.isSecondDigitFNC1()){let c=new rr(this.current.getPosition(),this.buffer.toString());return new Ha(!0,c)}this.buffer.append(i.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Ha(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let i=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFNC1()){let c=new rr(this.current.getPosition(),this.buffer.toString());return new Ha(!0,c)}this.buffer.append(i.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new Ha(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let i=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFNC1()){let c=new rr(this.current.getPosition(),this.buffer.toString());return new Ha(!0,c)}this.buffer.append(i.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new Ha(!1)}isStillIsoIec646(i){if(i+5>this.information.getSize())return!1;let c=this.extractNumericValueFromBitArray(i,5);if(c>=5&&c<16)return!0;if(i+7>this.information.getSize())return!1;let h=this.extractNumericValueFromBitArray(i,7);if(h>=64&&h<116)return!0;if(i+8>this.information.getSize())return!1;let x=this.extractNumericValueFromBitArray(i,8);return x>=232&&x<253}decodeIsoIec646(i){let c=this.extractNumericValueFromBitArray(i,5);if(c===15)return new $r(i+5,$r.FNC1);if(c>=5&&c<15)return new $r(i+5,"0"+(c-5));let h=this.extractNumericValueFromBitArray(i,7);if(h>=64&&h<90)return new $r(i+7,""+(h+1));if(h>=90&&h<116)return new $r(i+7,""+(h+7));let x=this.extractNumericValueFromBitArray(i,8),y;switch(x){case 232:y="!";break;case 233:y='"';break;case 234:y="%";break;case 235:y="&";break;case 236:y="'";break;case 237:y="(";break;case 238:y=")";break;case 239:y="*";break;case 240:y="+";break;case 241:y=",";break;case 242:y="-";break;case 243:y=".";break;case 244:y="/";break;case 245:y=":";break;case 246:y=";";break;case 247:y="<";break;case 248:y="=";break;case 249:y=">";break;case 250:y="?";break;case 251:y="_";break;case 252:y=" ";break;default:throw new V}return new $r(i+8,y)}isStillAlpha(i){if(i+5>this.information.getSize())return!1;let c=this.extractNumericValueFromBitArray(i,5);if(c>=5&&c<16)return!0;if(i+6>this.information.getSize())return!1;let h=this.extractNumericValueFromBitArray(i,6);return h>=16&&h<63}decodeAlphanumeric(i){let c=this.extractNumericValueFromBitArray(i,5);if(c===15)return new $r(i+5,$r.FNC1);if(c>=5&&c<15)return new $r(i+5,"0"+(c-5));let h=this.extractNumericValueFromBitArray(i,6);if(h>=32&&h<58)return new $r(i+6,""+(h+33));let x;switch(h){case 58:x="*";break;case 59:x=",";break;case 60:x="-";break;case 61:x=".";break;case 62:x="/";break;default:throw new tr("Decoding invalid alphanumeric value: "+h)}return new $r(i+6,x)}isAlphaTo646ToAlphaLatch(i){if(i+1>this.information.getSize())return!1;for(let c=0;c<5&&c+i<this.information.getSize();++c)if(c===2){if(!this.information.get(i+2))return!1}else if(this.information.get(i+c))return!1;return!0}isAlphaOr646ToNumericLatch(i){if(i+3>this.information.getSize())return!1;for(let c=i;c<i+3;++c)if(this.information.get(c))return!1;return!0}isNumericToAlphaNumericLatch(i){if(i+1>this.information.getSize())return!1;for(let c=0;c<4&&c+i<this.information.getSize();++c)if(this.information.get(i+c))return!1;return!0}}class xe{constructor(i){this.information=i,this.generalDecoder=new ce(i)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class ye extends xe{constructor(i){super(i)}encodeCompressedGtin(i,c){i.append("(01)");let h=i.length();i.append("9"),this.encodeCompressedGtinWithoutAI(i,c,h)}encodeCompressedGtinWithoutAI(i,c,h){for(let x=0;x<4;++x){let y=this.getGeneralDecoder().extractNumericValueFromBitArray(c+10*x,10);y/100===0&&i.append("0"),y/10===0&&i.append("0"),i.append(y)}ye.appendCheckDigit(i,h)}static appendCheckDigit(i,c){let h=0;for(let x=0;x<13;x++){let y=i.charAt(x+c).charCodeAt(0)-48;h+=(x&1)===0?3*y:y}h=10-h%10,h===10&&(h=0),i.append(h)}}ye.GTIN_SIZE=40;class Ee extends ye{constructor(i){super(i)}parseInformation(){let i=new Se;i.append("(01)");let c=i.length(),h=this.getGeneralDecoder().extractNumericValueFromBitArray(Ee.HEADER_SIZE,4);return i.append(h),this.encodeCompressedGtinWithoutAI(i,Ee.HEADER_SIZE+4,c),this.getGeneralDecoder().decodeAllCodes(i,Ee.HEADER_SIZE+44)}}Ee.HEADER_SIZE=4;class ge extends xe{constructor(i){super(i)}parseInformation(){let i=new Se;return this.getGeneralDecoder().decodeAllCodes(i,ge.HEADER_SIZE)}}ge.HEADER_SIZE=5;class Be extends ye{constructor(i){super(i)}encodeCompressedWeight(i,c,h){let x=this.getGeneralDecoder().extractNumericValueFromBitArray(c,h);this.addWeightCode(i,x);let y=this.checkWeight(x),w=1e5;for(let S=0;S<5;++S)y/w===0&&i.append("0"),w/=10;i.append(y)}}class ze extends Be{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()!=ze.HEADER_SIZE+Be.GTIN_SIZE+ze.WEIGHT_SIZE)throw new ue;let i=new Se;return this.encodeCompressedGtin(i,ze.HEADER_SIZE),this.encodeCompressedWeight(i,ze.HEADER_SIZE+Be.GTIN_SIZE,ze.WEIGHT_SIZE),i.toString()}}ze.HEADER_SIZE=5,ze.WEIGHT_SIZE=15;class Ze extends ze{constructor(i){super(i)}addWeightCode(i,c){i.append("(3103)")}checkWeight(i){return i}}class et extends ze{constructor(i){super(i)}addWeightCode(i,c){c<1e4?i.append("(3202)"):i.append("(3203)")}checkWeight(i){return i<1e4?i:i-1e4}}class _t extends ye{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()<_t.HEADER_SIZE+ye.GTIN_SIZE)throw new ue;let i=new Se;this.encodeCompressedGtin(i,_t.HEADER_SIZE);let c=this.getGeneralDecoder().extractNumericValueFromBitArray(_t.HEADER_SIZE+ye.GTIN_SIZE,_t.LAST_DIGIT_SIZE);i.append("(392"),i.append(c),i.append(")");let h=this.getGeneralDecoder().decodeGeneralPurposeField(_t.HEADER_SIZE+ye.GTIN_SIZE+_t.LAST_DIGIT_SIZE,null);return i.append(h.getNewString()),i.toString()}}_t.HEADER_SIZE=8,_t.LAST_DIGIT_SIZE=2;class vt extends ye{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()<vt.HEADER_SIZE+ye.GTIN_SIZE)throw new ue;let i=new Se;this.encodeCompressedGtin(i,vt.HEADER_SIZE);let c=this.getGeneralDecoder().extractNumericValueFromBitArray(vt.HEADER_SIZE+ye.GTIN_SIZE,vt.LAST_DIGIT_SIZE);i.append("(393"),i.append(c),i.append(")");let h=this.getGeneralDecoder().extractNumericValueFromBitArray(vt.HEADER_SIZE+ye.GTIN_SIZE+vt.LAST_DIGIT_SIZE,vt.FIRST_THREE_DIGITS_SIZE);h/100==0&&i.append("0"),h/10==0&&i.append("0"),i.append(h);let x=this.getGeneralDecoder().decodeGeneralPurposeField(vt.HEADER_SIZE+ye.GTIN_SIZE+vt.LAST_DIGIT_SIZE+vt.FIRST_THREE_DIGITS_SIZE,null);return i.append(x.getNewString()),i.toString()}}vt.HEADER_SIZE=8,vt.LAST_DIGIT_SIZE=2,vt.FIRST_THREE_DIGITS_SIZE=10;class Ot extends Be{constructor(i,c,h){super(i),this.dateCode=h,this.firstAIdigits=c}parseInformation(){if(this.getInformation().getSize()!=Ot.HEADER_SIZE+Ot.GTIN_SIZE+Ot.WEIGHT_SIZE+Ot.DATE_SIZE)throw new ue;let i=new Se;return this.encodeCompressedGtin(i,Ot.HEADER_SIZE),this.encodeCompressedWeight(i,Ot.HEADER_SIZE+Ot.GTIN_SIZE,Ot.WEIGHT_SIZE),this.encodeCompressedDate(i,Ot.HEADER_SIZE+Ot.GTIN_SIZE+Ot.WEIGHT_SIZE),i.toString()}encodeCompressedDate(i,c){let h=this.getGeneralDecoder().extractNumericValueFromBitArray(c,Ot.DATE_SIZE);if(h==38400)return;i.append("("),i.append(this.dateCode),i.append(")");let x=h%32;h/=32;let y=h%12+1;h/=12;let w=h;w/10==0&&i.append("0"),i.append(w),y/10==0&&i.append("0"),i.append(y),x/10==0&&i.append("0"),i.append(x)}addWeightCode(i,c){i.append("("),i.append(this.firstAIdigits),i.append(c/1e5),i.append(")")}checkWeight(i){return i%1e5}}Ot.HEADER_SIZE=8,Ot.WEIGHT_SIZE=20,Ot.DATE_SIZE=16;function Rt(ee){try{if(ee.get(1))return new Ee(ee);if(!ee.get(2))return new ge(ee);switch(ce.extractNumericValueFromBitArray(ee,1,4)){case 4:return new Ze(ee);case 5:return new et(ee)}switch(ce.extractNumericValueFromBitArray(ee,1,5)){case 12:return new _t(ee);case 13:return new vt(ee)}switch(ce.extractNumericValueFromBitArray(ee,1,7)){case 56:return new Ot(ee,"310","11");case 57:return new Ot(ee,"320","11");case 58:return new Ot(ee,"310","13");case 59:return new Ot(ee,"320","13");case 60:return new Ot(ee,"310","15");case 61:return new Ot(ee,"320","15");case 62:return new Ot(ee,"310","17");case 63:return new Ot(ee,"320","17")}}catch(i){throw console.log(i),new tr("unknown decoder: "+ee)}}class Ut{constructor(i,c,h,x){this.leftchar=i,this.rightchar=c,this.finderpattern=h,this.maybeLast=x}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(i,c){return i instanceof Ut?Ut.equalsOrNull(i.leftchar,c.leftchar)&&Ut.equalsOrNull(i.rightchar,c.rightchar)&&Ut.equalsOrNull(i.finderpattern,c.finderpattern):!1}static equalsOrNull(i,c){return i===null?c===null:Ut.equals(i,c)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class nr{constructor(i,c,h){this.pairs=i,this.rowNumber=c,this.wasReversed=h}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(i){return this.checkEqualitity(this,i)}toString(){return"{ "+this.pairs+" }"}equals(i,c){return i instanceof nr?this.checkEqualitity(i,c)&&i.wasReversed===c.wasReversed:!1}checkEqualitity(i,c){if(!i||!c)return;let h;return i.forEach((x,y)=>{c.forEach(w=>{x.getLeftChar().getValue()===w.getLeftChar().getValue()&&x.getRightChar().getValue()===w.getRightChar().getValue()&&x.getFinderPatter().getValue()===w.getFinderPatter().getValue()&&(h=!0)})}),h}}class ct extends ca{constructor(i){super(...arguments),this.pairs=new Array(ct.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=i===!0}decodeRow(i,c,h){this.pairs.length=0,this.startFromEven=!1;try{return ct.constructResult(this.decodeRow2pairs(i,c))}catch(x){this.verbose&&console.log(x)}return this.pairs.length=0,this.startFromEven=!0,ct.constructResult(this.decodeRow2pairs(i,c))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(i,c){let h=!1;for(;!h;)try{this.pairs.push(this.retrieveNextPair(c,this.pairs,i))}catch(y){if(y instanceof ue){if(!this.pairs.length)throw new ue;h=!0}}if(this.checkChecksum())return this.pairs;let x;if(this.rows.length?x=!0:x=!1,this.storeRow(i,!1),x){let y=this.checkRowsBoolean(!1);if(y!=null||(y=this.checkRowsBoolean(!0),y!=null))return y}throw new ue}checkRowsBoolean(i){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,i&&(this.rows=this.rows.reverse());let c=null;try{c=this.checkRows(new Array,0)}catch(h){this.verbose&&console.log(h)}return i&&(this.rows=this.rows.reverse()),c}checkRows(i,c){for(let h=c;h<this.rows.length;h++){let x=this.rows[h];this.pairs.length=0;for(let w of i)this.pairs.push(w.getPairs());if(this.pairs.push(x.getPairs()),!ct.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let y=new Array(i);y.push(x);try{return this.checkRows(y,h+1)}catch(w){this.verbose&&console.log(w)}}throw new ue}static isValidSequence(i){for(let c of ct.FINDER_PATTERN_SEQUENCES){if(i.length>c.length)continue;let h=!0;for(let x=0;x<i.length;x++)if(i[x].getFinderPattern().getValue()!=c[x]){h=!1;break}if(h)return!0}return!1}storeRow(i,c){let h=0,x=!1,y=!1;for(;h<this.rows.length;){let w=this.rows[h];if(w.getRowNumber()>i){y=w.isEquivalent(this.pairs);break}x=w.isEquivalent(this.pairs),h++}y||x||ct.isPartialRow(this.pairs,this.rows)||(this.rows.push(h,new nr(this.pairs,i,c)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(i,c){for(let h of c)if(h.getPairs().length!==i.length){for(let x of h.getPairs())for(let y of i)if(Ut.equals(x,y))break}}static isPartialRow(i,c){for(let h of c){let x=!0;for(let y of i){let w=!1;for(let S of h.getPairs())if(y.equals(S)){w=!0;break}if(!w){x=!1;break}}if(x)return!0}return!1}getRows(){return this.rows}static constructResult(i){let c=Xs.buildBitArray(i),x=Rt(c).parseInformation(),y=i[0].getFinderPattern().getResultPoints(),w=i[i.length-1].getFinderPattern().getResultPoints(),S=[y[0],y[1],w[0],w[1]];return new se(x,null,null,S,pe.RSS_EXPANDED,null)}checkChecksum(){let i=this.pairs.get(0),c=i.getLeftChar(),h=i.getRightChar();if(h==null)return!1;let x=h.getChecksumPortion(),y=2;for(let S=1;S<this.pairs.size();++S){let A=this.pairs.get(S);x+=A.getLeftChar().getChecksumPortion(),y++;let P=A.getRightChar();P!=null&&(x+=P.getChecksumPortion(),y++)}return x%=211,211*(y-4)+x==c.getValue()}static getNextSecondBar(i,c){let h;return i.get(c)?(h=i.getNextUnset(c),h=i.getNextSet(h)):(h=i.getNextSet(c),h=i.getNextUnset(h)),h}retrieveNextPair(i,c,h){let x=c.length%2==0;this.startFromEven&&(x=!x);let y,w=!0,S=-1;do this.findNextPair(i,c,S),y=this.parseFoundFinderPattern(i,h,x),y==null?S=ct.getNextSecondBar(i,this.startEnd[0]):w=!1;while(w);let A=this.decodeDataCharacter(i,y,x,!0);if(!this.isEmptyPair(c)&&c[c.length-1].mustBeLast())throw new ue;let P;try{P=this.decodeDataCharacter(i,y,x,!1)}catch(G){P=null,this.verbose&&console.log(G)}return new Ut(A,P,y,!0)}isEmptyPair(i){return i.length===0}findNextPair(i,c,h){let x=this.getDecodeFinderCounters();x[0]=0,x[1]=0,x[2]=0,x[3]=0;let y=i.getSize(),w;h>=0?w=h:this.isEmptyPair(c)?w=0:w=c[c.length-1].getFinderPattern().getStartEnd()[1];let S=c.length%2!=0;this.startFromEven&&(S=!S);let A=!1;for(;w<y&&(A=!i.get(w),!!A);)w++;let P=0,G=w;for(let te=w;te<y;te++)if(i.get(te)!=A)x[P]++;else{if(P==3){if(S&&ct.reverseCounters(x),ct.isFinderPattern(x)){this.startEnd[0]=G,this.startEnd[1]=te;return}S&&ct.reverseCounters(x),G+=x[0]+x[1],x[0]=x[2],x[1]=x[3],x[2]=0,x[3]=0,P--}else P++;x[P]=1,A=!A}throw new ue}static reverseCounters(i){let c=i.length;for(let h=0;h<c/2;++h){let x=i[h];i[h]=i[c-h-1],i[c-h-1]=x}}parseFoundFinderPattern(i,c,h){let x,y,w;if(h){let P=this.startEnd[0]-1;for(;P>=0&&!i.get(P);)P--;P++,x=this.startEnd[0]-P,y=P,w=this.startEnd[1]}else y=this.startEnd[0],w=i.getNextUnset(this.startEnd[1]+1),x=w-this.startEnd[1];let S=this.getDecodeFinderCounters();M.arraycopy(S,0,S,1,S.length-1),S[0]=x;let A;try{A=this.parseFinderValue(S,ct.FINDER_PATTERNS)}catch(P){return null}return new fn(A,[y,w],y,w,c)}decodeDataCharacter(i,c,h,x){let y=this.getDataCharacterCounters();for(let qr=0;qr<y.length;qr++)y[qr]=0;if(x)ct.recordPatternInReverse(i,c.getStartEnd()[0],y);else{ct.recordPattern(i,c.getStartEnd()[1],y);for(let qr=0,ln=y.length-1;qr<ln;qr++,ln--){let Rn=y[qr];y[qr]=y[ln],y[ln]=Rn}}let w=17,S=Le.sum(new Int32Array(y))/w,A=(c.getStartEnd()[1]-c.getStartEnd()[0])/15;if(Math.abs(S-A)/A>.3)throw new ue;let P=this.getOddCounts(),G=this.getEvenCounts(),te=this.getOddRoundingErrors(),oe=this.getEvenRoundingErrors();for(let qr=0;qr<y.length;qr++){let ln=1*y[qr]/S,Rn=ln+.5;if(Rn<1){if(ln<.3)throw new ue;Rn=1}else if(Rn>8){if(ln>8.7)throw new ue;Rn=8}let no=qr/2;(qr&1)==0?(P[no]=Rn,te[no]=ln-Rn):(G[no]=Rn,oe[no]=ln-Rn)}this.adjustOddEvenCounts(w);let Ce=4*c.getValue()+(h?0:2)+(x?0:1)-1,Ie=0,Pe=0;for(let qr=P.length-1;qr>=0;qr--){if(ct.isNotA1left(c,h,x)){let ln=ct.WEIGHTS[Ce][2*qr];Pe+=P[qr]*ln}Ie+=P[qr]}let Ke=0;for(let qr=G.length-1;qr>=0;qr--)if(ct.isNotA1left(c,h,x)){let ln=ct.WEIGHTS[Ce][2*qr+1];Ke+=G[qr]*ln}let it=Pe+Ke;if((Ie&1)!=0||Ie>13||Ie<4)throw new ue;let Bt=(13-Ie)/2,Pt=ct.SYMBOL_WIDEST[Bt],Mt=9-Pt,jr=hn.getRSSvalue(P,Pt,!0),Sr=hn.getRSSvalue(G,Mt,!1),Qr=ct.EVEN_TOTAL_SUBSET[Bt],kn=ct.GSUM[Bt],Nn=jr*Qr+Sr+kn;return new _n(Nn,it)}static isNotA1left(i,c,h){return!(i.getValue()==0&&c&&h)}adjustOddEvenCounts(i){let c=Le.sum(new Int32Array(this.getOddCounts())),h=Le.sum(new Int32Array(this.getEvenCounts())),x=!1,y=!1;c>13?y=!0:c<4&&(x=!0);let w=!1,S=!1;h>13?S=!0:h<4&&(w=!0);let A=c+h-i,P=(c&1)==1,G=(h&1)==0;if(A==1)if(P){if(G)throw new ue;y=!0}else{if(!G)throw new ue;S=!0}else if(A==-1)if(P){if(G)throw new ue;x=!0}else{if(!G)throw new ue;w=!0}else if(A==0){if(P){if(!G)throw new ue;c<h?(x=!0,S=!0):(y=!0,w=!0)}else if(G)throw new ue}else throw new ue;if(x){if(y)throw new ue;ct.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(y&&ct.decrement(this.getOddCounts(),this.getOddRoundingErrors()),w){if(S)throw new ue;ct.increment(this.getEvenCounts(),this.getOddRoundingErrors())}S&&ct.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ct.SYMBOL_WIDEST=[7,5,4,3,1],ct.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ct.GSUM=[0,348,1388,2948,3988],ct.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],ct.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],ct.FINDER_PAT_A=0,ct.FINDER_PAT_B=1,ct.FINDER_PAT_C=2,ct.FINDER_PAT_D=3,ct.FINDER_PAT_E=4,ct.FINDER_PAT_F=5,ct.FINDER_PATTERN_SEQUENCES=[[ct.FINDER_PAT_A,ct.FINDER_PAT_A],[ct.FINDER_PAT_A,ct.FINDER_PAT_B,ct.FINDER_PAT_B],[ct.FINDER_PAT_A,ct.FINDER_PAT_C,ct.FINDER_PAT_B,ct.FINDER_PAT_D],[ct.FINDER_PAT_A,ct.FINDER_PAT_E,ct.FINDER_PAT_B,ct.FINDER_PAT_D,ct.FINDER_PAT_C],[ct.FINDER_PAT_A,ct.FINDER_PAT_E,ct.FINDER_PAT_B,ct.FINDER_PAT_D,ct.FINDER_PAT_D,ct.FINDER_PAT_F],[ct.FINDER_PAT_A,ct.FINDER_PAT_E,ct.FINDER_PAT_B,ct.FINDER_PAT_D,ct.FINDER_PAT_E,ct.FINDER_PAT_F,ct.FINDER_PAT_F],[ct.FINDER_PAT_A,ct.FINDER_PAT_A,ct.FINDER_PAT_B,ct.FINDER_PAT_B,ct.FINDER_PAT_C,ct.FINDER_PAT_C,ct.FINDER_PAT_D,ct.FINDER_PAT_D],[ct.FINDER_PAT_A,ct.FINDER_PAT_A,ct.FINDER_PAT_B,ct.FINDER_PAT_B,ct.FINDER_PAT_C,ct.FINDER_PAT_C,ct.FINDER_PAT_D,ct.FINDER_PAT_E,ct.FINDER_PAT_E],[ct.FINDER_PAT_A,ct.FINDER_PAT_A,ct.FINDER_PAT_B,ct.FINDER_PAT_B,ct.FINDER_PAT_C,ct.FINDER_PAT_C,ct.FINDER_PAT_D,ct.FINDER_PAT_E,ct.FINDER_PAT_F,ct.FINDER_PAT_F],[ct.FINDER_PAT_A,ct.FINDER_PAT_A,ct.FINDER_PAT_B,ct.FINDER_PAT_B,ct.FINDER_PAT_C,ct.FINDER_PAT_D,ct.FINDER_PAT_D,ct.FINDER_PAT_E,ct.FINDER_PAT_E,ct.FINDER_PAT_F,ct.FINDER_PAT_F]],ct.MAX_PAIRS=11;class ga extends _n{constructor(i,c,h){super(i,c),this.count=0,this.finderPattern=h}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class kr extends ca{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(i,c,h){const x=this.decodePair(c,!1,i,h);kr.addOrTally(this.possibleLeftPairs,x),c.reverse();let y=this.decodePair(c,!0,i,h);kr.addOrTally(this.possibleRightPairs,y),c.reverse();for(let w of this.possibleLeftPairs)if(w.getCount()>1){for(let S of this.possibleRightPairs)if(S.getCount()>1&&kr.checkChecksum(w,S))return kr.constructResult(w,S)}throw new ue}static addOrTally(i,c){if(c==null)return;let h=!1;for(let x of i)if(x.getValue()===c.getValue()){x.incrementCount(),h=!0;break}h||i.push(c)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(i,c){let h=4537077*i.getValue()+c.getValue(),x=new String(h).toString(),y=new Se;for(let P=13-x.length;P>0;P--)y.append("0");y.append(x);let w=0;for(let P=0;P<13;P++){let G=y.charAt(P).charCodeAt(0)-48;w+=(P&1)===0?3*G:G}w=10-w%10,w===10&&(w=0),y.append(w.toString());let S=i.getFinderPattern().getResultPoints(),A=c.getFinderPattern().getResultPoints();return new se(y.toString(),null,0,[S[0],S[1],A[0],A[1]],pe.RSS_14,new Date().getTime())}static checkChecksum(i,c){let h=(i.getChecksumPortion()+16*c.getChecksumPortion())%79,x=9*i.getFinderPattern().getValue()+c.getFinderPattern().getValue();return x>72&&x--,x>8&&x--,h===x}decodePair(i,c,h,x){try{let y=this.findFinderPattern(i,c),w=this.parseFoundFinderPattern(i,h,c,y),S=x==null?null:x.get(ne.NEED_RESULT_POINT_CALLBACK);if(S!=null){let G=(y[0]+y[1])/2;c&&(G=i.getSize()-1-G),S.foundPossibleResultPoint(new tt(G,h))}let A=this.decodeDataCharacter(i,w,!0),P=this.decodeDataCharacter(i,w,!1);return new ga(1597*A.getValue()+P.getValue(),A.getChecksumPortion()+4*P.getChecksumPortion(),w)}catch(y){return null}}decodeDataCharacter(i,c,h){let x=this.getDataCharacterCounters();for(let Ke=0;Ke<x.length;Ke++)x[Ke]=0;if(h)Ye.recordPatternInReverse(i,c.getStartEnd()[0],x);else{Ye.recordPattern(i,c.getStartEnd()[1]+1,x);for(let Ke=0,it=x.length-1;Ke<it;Ke++,it--){let Bt=x[Ke];x[Ke]=x[it],x[it]=Bt}}let y=h?16:15,w=Le.sum(new Int32Array(x))/y,S=this.getOddCounts(),A=this.getEvenCounts(),P=this.getOddRoundingErrors(),G=this.getEvenRoundingErrors();for(let Ke=0;Ke<x.length;Ke++){let it=x[Ke]/w,Bt=Math.floor(it+.5);Bt<1?Bt=1:Bt>8&&(Bt=8);let Pt=Math.floor(Ke/2);(Ke&1)===0?(S[Pt]=Bt,P[Pt]=it-Bt):(A[Pt]=Bt,G[Pt]=it-Bt)}this.adjustOddEvenCounts(h,y);let te=0,oe=0;for(let Ke=S.length-1;Ke>=0;Ke--)oe*=9,oe+=S[Ke],te+=S[Ke];let Ce=0,Ie=0;for(let Ke=A.length-1;Ke>=0;Ke--)Ce*=9,Ce+=A[Ke],Ie+=A[Ke];let Pe=oe+3*Ce;if(h){if((te&1)!==0||te>12||te<4)throw new ue;let Ke=(12-te)/2,it=kr.OUTSIDE_ODD_WIDEST[Ke],Bt=9-it,Pt=hn.getRSSvalue(S,it,!1),Mt=hn.getRSSvalue(A,Bt,!0),jr=kr.OUTSIDE_EVEN_TOTAL_SUBSET[Ke],Sr=kr.OUTSIDE_GSUM[Ke];return new _n(Pt*jr+Mt+Sr,Pe)}else{if((Ie&1)!==0||Ie>10||Ie<4)throw new ue;let Ke=(10-Ie)/2,it=kr.INSIDE_ODD_WIDEST[Ke],Bt=9-it,Pt=hn.getRSSvalue(S,it,!0),Mt=hn.getRSSvalue(A,Bt,!1),jr=kr.INSIDE_ODD_TOTAL_SUBSET[Ke],Sr=kr.INSIDE_GSUM[Ke];return new _n(Mt*jr+Pt+Sr,Pe)}}findFinderPattern(i,c){let h=this.getDecodeFinderCounters();h[0]=0,h[1]=0,h[2]=0,h[3]=0;let x=i.getSize(),y=!1,w=0;for(;w<x&&(y=!i.get(w),c!==y);)w++;let S=0,A=w;for(let P=w;P<x;P++)if(i.get(P)!==y)h[S]++;else{if(S===3){if(ca.isFinderPattern(h))return[A,P];A+=h[0]+h[1],h[0]=h[2],h[1]=h[3],h[2]=0,h[3]=0,S--}else S++;h[S]=1,y=!y}throw new ue}parseFoundFinderPattern(i,c,h,x){let y=i.get(x[0]),w=x[0]-1;for(;w>=0&&y!==i.get(w);)w--;w++;const S=x[0]-w,A=this.getDecodeFinderCounters(),P=new Int32Array(A.length);M.arraycopy(A,0,P,1,A.length-1),P[0]=S;const G=this.parseFinderValue(P,kr.FINDER_PATTERNS);let te=w,oe=x[1];return h&&(te=i.getSize()-1-te,oe=i.getSize()-1-oe),new fn(G,[w,x[1]],te,oe,c)}adjustOddEvenCounts(i,c){let h=Le.sum(new Int32Array(this.getOddCounts())),x=Le.sum(new Int32Array(this.getEvenCounts())),y=!1,w=!1,S=!1,A=!1;i?(h>12?w=!0:h<4&&(y=!0),x>12?A=!0:x<4&&(S=!0)):(h>11?w=!0:h<5&&(y=!0),x>10?A=!0:x<4&&(S=!0));let P=h+x-c,G=(h&1)===(i?1:0),te=(x&1)===1;if(P===1)if(G){if(te)throw new ue;w=!0}else{if(!te)throw new ue;A=!0}else if(P===-1)if(G){if(te)throw new ue;y=!0}else{if(!te)throw new ue;S=!0}else if(P===0){if(G){if(!te)throw new ue;h<x?(y=!0,A=!0):(w=!0,S=!0)}else if(te)throw new ue}else throw new ue;if(y){if(w)throw new ue;ca.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(w&&ca.decrement(this.getOddCounts(),this.getOddRoundingErrors()),S){if(A)throw new ue;ca.increment(this.getEvenCounts(),this.getOddRoundingErrors())}A&&ca.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}kr.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],kr.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],kr.OUTSIDE_GSUM=[0,161,961,2015,2715],kr.INSIDE_GSUM=[0,336,1036,1516],kr.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],kr.INSIDE_ODD_WIDEST=[2,4,6,8],kr.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class Wa extends Ye{constructor(i,c){super(),this.readers=[],this.verbose=c===!0;const h=i?i.get(ne.POSSIBLE_FORMATS):null,x=i&&i.get(ne.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;h?((h.includes(pe.EAN_13)||h.includes(pe.UPC_A)||h.includes(pe.EAN_8)||h.includes(pe.UPC_E))&&this.readers.push(new Pa(i)),h.includes(pe.CODE_39)&&this.readers.push(new Ct(x)),h.includes(pe.CODE_128)&&this.readers.push(new Ge),h.includes(pe.ITF)&&this.readers.push(new Ft),h.includes(pe.RSS_14)&&this.readers.push(new kr),h.includes(pe.RSS_EXPANDED)&&this.readers.push(new ct(this.verbose))):(this.readers.push(new Pa(i)),this.readers.push(new Ct),this.readers.push(new Pa(i)),this.readers.push(new Ge),this.readers.push(new Ft),this.readers.push(new kr),this.readers.push(new ct(this.verbose)))}decodeRow(i,c,h){for(let x=0;x<this.readers.length;x++)try{return this.readers[x].decodeRow(i,c,h)}catch(y){}throw new ue}reset(){this.readers.forEach(i=>i.reset())}}class xs extends ae{constructor(i=500,c){super(new Wa(c),i,c)}}class Or{constructor(i,c,h){this.ecCodewords=i,this.ecBlocks=[c],h&&this.ecBlocks.push(h)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Cr{constructor(i,c){this.count=i,this.dataCodewords=c}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Nr{constructor(i,c,h,x,y,w){this.versionNumber=i,this.symbolSizeRows=c,this.symbolSizeColumns=h,this.dataRegionSizeRows=x,this.dataRegionSizeColumns=y,this.ecBlocks=w;let S=0;const A=w.getECCodewords(),P=w.getECBlocks();for(let G of P)S+=G.getCount()*(G.getDataCodewords()+A);this.totalCodewords=S}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(i,c){if((i&1)!==0||(c&1)!==0)throw new V;for(let h of Nr.VERSIONS)if(h.symbolSizeRows===i&&h.symbolSizeColumns===c)return h;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new Nr(1,10,10,8,8,new Or(5,new Cr(1,3))),new Nr(2,12,12,10,10,new Or(7,new Cr(1,5))),new Nr(3,14,14,12,12,new Or(10,new Cr(1,8))),new Nr(4,16,16,14,14,new Or(12,new Cr(1,12))),new Nr(5,18,18,16,16,new Or(14,new Cr(1,18))),new Nr(6,20,20,18,18,new Or(18,new Cr(1,22))),new Nr(7,22,22,20,20,new Or(20,new Cr(1,30))),new Nr(8,24,24,22,22,new Or(24,new Cr(1,36))),new Nr(9,26,26,24,24,new Or(28,new Cr(1,44))),new Nr(10,32,32,14,14,new Or(36,new Cr(1,62))),new Nr(11,36,36,16,16,new Or(42,new Cr(1,86))),new Nr(12,40,40,18,18,new Or(48,new Cr(1,114))),new Nr(13,44,44,20,20,new Or(56,new Cr(1,144))),new Nr(14,48,48,22,22,new Or(68,new Cr(1,174))),new Nr(15,52,52,24,24,new Or(42,new Cr(2,102))),new Nr(16,64,64,14,14,new Or(56,new Cr(2,140))),new Nr(17,72,72,16,16,new Or(36,new Cr(4,92))),new Nr(18,80,80,18,18,new Or(48,new Cr(4,114))),new Nr(19,88,88,20,20,new Or(56,new Cr(4,144))),new Nr(20,96,96,22,22,new Or(68,new Cr(4,174))),new Nr(21,104,104,24,24,new Or(56,new Cr(6,136))),new Nr(22,120,120,18,18,new Or(68,new Cr(6,175))),new Nr(23,132,132,20,20,new Or(62,new Cr(8,163))),new Nr(24,144,144,22,22,new Or(62,new Cr(8,156),new Cr(2,155))),new Nr(25,8,18,6,16,new Or(7,new Cr(1,5))),new Nr(26,8,32,6,14,new Or(11,new Cr(1,10))),new Nr(27,12,26,10,24,new Or(14,new Cr(1,16))),new Nr(28,12,36,10,16,new Or(18,new Cr(1,22))),new Nr(29,16,36,14,16,new Or(24,new Cr(1,32))),new Nr(30,16,48,14,22,new Or(28,new Cr(1,49)))]}}Nr.VERSIONS=Nr.buildVersions();class br{constructor(i){const c=i.getHeight();if(c<8||c>144||(c&1)!==0)throw new V;this.version=br.readVersion(i),this.mappingBitMatrix=this.extractDataRegion(i),this.readMappingMatrix=new Oe(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(i){const c=i.getHeight(),h=i.getWidth();return Nr.getVersionForDimensions(c,h)}readCodewords(){const i=new Int8Array(this.version.getTotalCodewords());let c=0,h=4,x=0;const y=this.mappingBitMatrix.getHeight(),w=this.mappingBitMatrix.getWidth();let S=!1,A=!1,P=!1,G=!1;do if(h===y&&x===0&&!S)i[c++]=this.readCorner1(y,w)&255,h-=2,x+=2,S=!0;else if(h===y-2&&x===0&&(w&3)!==0&&!A)i[c++]=this.readCorner2(y,w)&255,h-=2,x+=2,A=!0;else if(h===y+4&&x===2&&(w&7)===0&&!P)i[c++]=this.readCorner3(y,w)&255,h-=2,x+=2,P=!0;else if(h===y-2&&x===0&&(w&7)===4&&!G)i[c++]=this.readCorner4(y,w)&255,h-=2,x+=2,G=!0;else{do h<y&&x>=0&&!this.readMappingMatrix.get(x,h)&&(i[c++]=this.readUtah(h,x,y,w)&255),h-=2,x+=2;while(h>=0&&x<w);h+=1,x+=3;do h>=0&&x<w&&!this.readMappingMatrix.get(x,h)&&(i[c++]=this.readUtah(h,x,y,w)&255),h+=2,x-=2;while(h<y&&x>=0);h+=3,x+=1}while(h<y||x<w);if(c!==this.version.getTotalCodewords())throw new V;return i}readModule(i,c,h,x){return i<0&&(i+=h,c+=4-(h+4&7)),c<0&&(c+=x,i+=4-(x+4&7)),this.readMappingMatrix.set(c,i),this.mappingBitMatrix.get(c,i)}readUtah(i,c,h,x){let y=0;return this.readModule(i-2,c-2,h,x)&&(y|=1),y<<=1,this.readModule(i-2,c-1,h,x)&&(y|=1),y<<=1,this.readModule(i-1,c-2,h,x)&&(y|=1),y<<=1,this.readModule(i-1,c-1,h,x)&&(y|=1),y<<=1,this.readModule(i-1,c,h,x)&&(y|=1),y<<=1,this.readModule(i,c-2,h,x)&&(y|=1),y<<=1,this.readModule(i,c-1,h,x)&&(y|=1),y<<=1,this.readModule(i,c,h,x)&&(y|=1),y}readCorner1(i,c){let h=0;return this.readModule(i-1,0,i,c)&&(h|=1),h<<=1,this.readModule(i-1,1,i,c)&&(h|=1),h<<=1,this.readModule(i-1,2,i,c)&&(h|=1),h<<=1,this.readModule(0,c-2,i,c)&&(h|=1),h<<=1,this.readModule(0,c-1,i,c)&&(h|=1),h<<=1,this.readModule(1,c-1,i,c)&&(h|=1),h<<=1,this.readModule(2,c-1,i,c)&&(h|=1),h<<=1,this.readModule(3,c-1,i,c)&&(h|=1),h}readCorner2(i,c){let h=0;return this.readModule(i-3,0,i,c)&&(h|=1),h<<=1,this.readModule(i-2,0,i,c)&&(h|=1),h<<=1,this.readModule(i-1,0,i,c)&&(h|=1),h<<=1,this.readModule(0,c-4,i,c)&&(h|=1),h<<=1,this.readModule(0,c-3,i,c)&&(h|=1),h<<=1,this.readModule(0,c-2,i,c)&&(h|=1),h<<=1,this.readModule(0,c-1,i,c)&&(h|=1),h<<=1,this.readModule(1,c-1,i,c)&&(h|=1),h}readCorner3(i,c){let h=0;return this.readModule(i-1,0,i,c)&&(h|=1),h<<=1,this.readModule(i-1,c-1,i,c)&&(h|=1),h<<=1,this.readModule(0,c-3,i,c)&&(h|=1),h<<=1,this.readModule(0,c-2,i,c)&&(h|=1),h<<=1,this.readModule(0,c-1,i,c)&&(h|=1),h<<=1,this.readModule(1,c-3,i,c)&&(h|=1),h<<=1,this.readModule(1,c-2,i,c)&&(h|=1),h<<=1,this.readModule(1,c-1,i,c)&&(h|=1),h}readCorner4(i,c){let h=0;return this.readModule(i-3,0,i,c)&&(h|=1),h<<=1,this.readModule(i-2,0,i,c)&&(h|=1),h<<=1,this.readModule(i-1,0,i,c)&&(h|=1),h<<=1,this.readModule(0,c-2,i,c)&&(h|=1),h<<=1,this.readModule(0,c-1,i,c)&&(h|=1),h<<=1,this.readModule(1,c-1,i,c)&&(h|=1),h<<=1,this.readModule(2,c-1,i,c)&&(h|=1),h<<=1,this.readModule(3,c-1,i,c)&&(h|=1),h}extractDataRegion(i){const c=this.version.getSymbolSizeRows(),h=this.version.getSymbolSizeColumns();if(i.getHeight()!==c)throw new N("Dimension of bitMatrix must match the version size");const x=this.version.getDataRegionSizeRows(),y=this.version.getDataRegionSizeColumns(),w=c/x|0,S=h/y|0,A=w*x,P=S*y,G=new Oe(P,A);for(let te=0;te<w;++te){const oe=te*x;for(let Ce=0;Ce<S;++Ce){const Ie=Ce*y;for(let Pe=0;Pe<x;++Pe){const Ke=te*(x+2)+1+Pe,it=oe+Pe;for(let Bt=0;Bt<y;++Bt){const Pt=Ce*(y+2)+1+Bt;if(i.get(Pt,Ke)){const Mt=Ie+Bt;G.set(Mt,it)}}}}}return G}}class ea{constructor(i,c){this.numDataCodewords=i,this.codewords=c}static getDataBlocks(i,c){const h=c.getECBlocks();let x=0;const y=h.getECBlocks();for(let Pe of y)x+=Pe.getCount();const w=new Array(x);let S=0;for(let Pe of y)for(let Ke=0;Ke<Pe.getCount();Ke++){const it=Pe.getDataCodewords(),Bt=h.getECCodewords()+it;w[S++]=new ea(it,new Uint8Array(Bt))}const P=w[0].codewords.length-h.getECCodewords(),G=P-1;let te=0;for(let Pe=0;Pe<G;Pe++)for(let Ke=0;Ke<S;Ke++)w[Ke].codewords[Pe]=i[te++];const oe=c.getVersionNumber()===24,Ce=oe?8:S;for(let Pe=0;Pe<Ce;Pe++)w[Pe].codewords[P-1]=i[te++];const Ie=w[0].codewords.length;for(let Pe=P;Pe<Ie;Pe++)for(let Ke=0;Ke<S;Ke++){const it=oe?(Ke+8)%S:Ke,Bt=oe&&it>7?Pe-1:Pe;w[it].codewords[Bt]=i[te++]}if(te!==i.length)throw new N;return w}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class jn{constructor(i){this.bytes=i,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(i){if(i<1||i>32||i>this.available())throw new N(""+i);let c=0,h=this.bitOffset,x=this.byteOffset;const y=this.bytes;if(h>0){const w=8-h,S=i<w?i:w,A=w-S,P=255>>8-S<<A;c=(y[x]&P)>>A,i-=S,h+=S,h===8&&(h=0,x++)}if(i>0){for(;i>=8;)c=c<<8|y[x]&255,x++,i-=8;if(i>0){const w=8-i,S=255>>w<<w;c=c<<i|(y[x]&S)>>w,h+=i}}return this.bitOffset=h,this.byteOffset=x,c}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Br;(function(ee){ee[ee.PAD_ENCODE=0]="PAD_ENCODE",ee[ee.ASCII_ENCODE=1]="ASCII_ENCODE",ee[ee.C40_ENCODE=2]="C40_ENCODE",ee[ee.TEXT_ENCODE=3]="TEXT_ENCODE",ee[ee.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",ee[ee.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",ee[ee.BASE256_ENCODE=6]="BASE256_ENCODE"})(Br||(Br={}));class On{static decode(i){const c=new jn(i),h=new Se,x=new Se,y=new Array;let w=Br.ASCII_ENCODE;do if(w===Br.ASCII_ENCODE)w=this.decodeAsciiSegment(c,h,x);else{switch(w){case Br.C40_ENCODE:this.decodeC40Segment(c,h);break;case Br.TEXT_ENCODE:this.decodeTextSegment(c,h);break;case Br.ANSIX12_ENCODE:this.decodeAnsiX12Segment(c,h);break;case Br.EDIFACT_ENCODE:this.decodeEdifactSegment(c,h);break;case Br.BASE256_ENCODE:this.decodeBase256Segment(c,h,y);break;default:throw new V}w=Br.ASCII_ENCODE}while(w!==Br.PAD_ENCODE&&c.available()>0);return x.length()>0&&h.append(x.toString()),new ft(i,h.toString(),y.length===0?null:y,null)}static decodeAsciiSegment(i,c,h){let x=!1;do{let y=i.readBits(8);if(y===0)throw new V;if(y<=128)return x&&(y+=128),c.append(String.fromCharCode(y-1)),Br.ASCII_ENCODE;if(y===129)return Br.PAD_ENCODE;if(y<=229){const w=y-130;w<10&&c.append("0"),c.append(""+w)}else switch(y){case 230:return Br.C40_ENCODE;case 231:return Br.BASE256_ENCODE;case 232:c.append("");break;case 233:case 234:break;case 235:x=!0;break;case 236:c.append("[)>05"),h.insert(0,"");break;case 237:c.append("[)>06"),h.insert(0,"");break;case 238:return Br.ANSIX12_ENCODE;case 239:return Br.TEXT_ENCODE;case 240:return Br.EDIFACT_ENCODE;case 241:break;default:if(y!==254||i.available()!==0)throw new V;break}}while(i.available()>0);return Br.ASCII_ENCODE}static decodeC40Segment(i,c){let h=!1;const x=[];let y=0;do{if(i.available()===8)return;const w=i.readBits(8);if(w===254)return;this.parseTwoBytes(w,i.readBits(8),x);for(let S=0;S<3;S++){const A=x[S];switch(y){case 0:if(A<3)y=A+1;else if(A<this.C40_BASIC_SET_CHARS.length){const P=this.C40_BASIC_SET_CHARS[A];h?(c.append(String.fromCharCode(P.charCodeAt(0)+128)),h=!1):c.append(P)}else throw new V;break;case 1:h?(c.append(String.fromCharCode(A+128)),h=!1):c.append(String.fromCharCode(A)),y=0;break;case 2:if(A<this.C40_SHIFT2_SET_CHARS.length){const P=this.C40_SHIFT2_SET_CHARS[A];h?(c.append(String.fromCharCode(P.charCodeAt(0)+128)),h=!1):c.append(P)}else switch(A){case 27:c.append("");break;case 30:h=!0;break;default:throw new V}y=0;break;case 3:h?(c.append(String.fromCharCode(A+224)),h=!1):c.append(String.fromCharCode(A+96)),y=0;break;default:throw new V}}}while(i.available()>0)}static decodeTextSegment(i,c){let h=!1,x=[],y=0;do{if(i.available()===8)return;const w=i.readBits(8);if(w===254)return;this.parseTwoBytes(w,i.readBits(8),x);for(let S=0;S<3;S++){const A=x[S];switch(y){case 0:if(A<3)y=A+1;else if(A<this.TEXT_BASIC_SET_CHARS.length){const P=this.TEXT_BASIC_SET_CHARS[A];h?(c.append(String.fromCharCode(P.charCodeAt(0)+128)),h=!1):c.append(P)}else throw new V;break;case 1:h?(c.append(String.fromCharCode(A+128)),h=!1):c.append(String.fromCharCode(A)),y=0;break;case 2:if(A<this.TEXT_SHIFT2_SET_CHARS.length){const P=this.TEXT_SHIFT2_SET_CHARS[A];h?(c.append(String.fromCharCode(P.charCodeAt(0)+128)),h=!1):c.append(P)}else switch(A){case 27:c.append("");break;case 30:h=!0;break;default:throw new V}y=0;break;case 3:if(A<this.TEXT_SHIFT3_SET_CHARS.length){const P=this.TEXT_SHIFT3_SET_CHARS[A];h?(c.append(String.fromCharCode(P.charCodeAt(0)+128)),h=!1):c.append(P),y=0}else throw new V;break;default:throw new V}}}while(i.available()>0)}static decodeAnsiX12Segment(i,c){const h=[];do{if(i.available()===8)return;const x=i.readBits(8);if(x===254)return;this.parseTwoBytes(x,i.readBits(8),h);for(let y=0;y<3;y++){const w=h[y];switch(w){case 0:c.append("\r");break;case 1:c.append("*");break;case 2:c.append(">");break;case 3:c.append(" ");break;default:if(w<14)c.append(String.fromCharCode(w+44));else if(w<40)c.append(String.fromCharCode(w+51));else throw new V;break}}}while(i.available()>0)}static parseTwoBytes(i,c,h){let x=(i<<8)+c-1,y=Math.floor(x/1600);h[0]=y,x-=y*1600,y=Math.floor(x/40),h[1]=y,h[2]=x-y*40}static decodeEdifactSegment(i,c){do{if(i.available()<=16)return;for(let h=0;h<4;h++){let x=i.readBits(6);if(x===31){const y=8-i.getBitOffset();y!==8&&i.readBits(y);return}(x&32)===0&&(x|=64),c.append(String.fromCharCode(x))}}while(i.available()>0)}static decodeBase256Segment(i,c,h){let x=1+i.getByteOffset();const y=this.unrandomize255State(i.readBits(8),x++);let w;if(y===0?w=i.available()/8|0:y<250?w=y:w=250*(y-249)+this.unrandomize255State(i.readBits(8),x++),w<0)throw new V;const S=new Uint8Array(w);for(let A=0;A<w;A++){if(i.available()<8)throw new V;S[A]=this.unrandomize255State(i.readBits(8),x++)}h.push(S);try{c.append(je.decode(S,me.ISO88591))}catch(A){throw new tr("Platform does not support required encoding: "+A.message)}}static unrandomize255State(i,c){const h=149*c%255+1,x=i-h;return x>=0?x:x+256}}On.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],On.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],On.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],On.TEXT_SHIFT2_SET_CHARS=On.C40_SHIFT2_SET_CHARS,On.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class Il{constructor(){this.rsDecoder=new Kt(Ht.DATA_MATRIX_FIELD_256)}decode(i){const c=new br(i),h=c.getVersion(),x=c.readCodewords(),y=ea.getDataBlocks(x,h);let w=0;for(let P of y)w+=P.getNumDataCodewords();const S=new Uint8Array(w),A=y.length;for(let P=0;P<A;P++){const G=y[P],te=G.getCodewords(),oe=G.getNumDataCodewords();this.correctErrors(te,oe);for(let Ce=0;Ce<oe;Ce++)S[Ce*A+P]=te[Ce]}return On.decode(S)}correctErrors(i,c){const h=new Int32Array(i);try{this.rsDecoder.decode(h,i.length-c)}catch(x){throw new O}for(let x=0;x<c;x++)i[x]=h[x]}}class or{constructor(i){this.image=i,this.rectangleDetector=new We(this.image)}detect(){const i=this.rectangleDetector.detect();let c=this.detectSolid1(i);if(c=this.detectSolid2(c),c[3]=this.correctTopRight(c),!c[3])throw new ue;c=this.shiftToModuleCenter(c);const h=c[0],x=c[1],y=c[2],w=c[3];let S=this.transitionsBetween(h,w)+1,A=this.transitionsBetween(y,w)+1;(S&1)===1&&(S+=1),(A&1)===1&&(A+=1),4*S<7*A&&4*A<7*S&&(S=A=Math.max(S,A));let P=or.sampleGrid(this.image,h,x,y,w,S,A);return new Wt(P,[h,x,y,w])}static shiftPoint(i,c,h){let x=(c.getX()-i.getX())/(h+1),y=(c.getY()-i.getY())/(h+1);return new tt(i.getX()+x,i.getY()+y)}static moveAway(i,c,h){let x=i.getX(),y=i.getY();return x<c?x-=1:x+=1,y<h?y-=1:y+=1,new tt(x,y)}detectSolid1(i){let c=i[0],h=i[1],x=i[3],y=i[2],w=this.transitionsBetween(c,h),S=this.transitionsBetween(h,x),A=this.transitionsBetween(x,y),P=this.transitionsBetween(y,c),G=w,te=[y,c,h,x];return G>S&&(G=S,te[0]=c,te[1]=h,te[2]=x,te[3]=y),G>A&&(G=A,te[0]=h,te[1]=x,te[2]=y,te[3]=c),G>P&&(te[0]=x,te[1]=y,te[2]=c,te[3]=h),te}detectSolid2(i){let c=i[0],h=i[1],x=i[2],y=i[3],w=this.transitionsBetween(c,y),S=or.shiftPoint(h,x,(w+1)*4),A=or.shiftPoint(x,h,(w+1)*4),P=this.transitionsBetween(S,c),G=this.transitionsBetween(A,y);return P<G?(i[0]=c,i[1]=h,i[2]=x,i[3]=y):(i[0]=h,i[1]=x,i[2]=y,i[3]=c),i}correctTopRight(i){let c=i[0],h=i[1],x=i[2],y=i[3],w=this.transitionsBetween(c,y),S=this.transitionsBetween(h,y),A=or.shiftPoint(c,h,(S+1)*4),P=or.shiftPoint(x,h,(w+1)*4);w=this.transitionsBetween(A,y),S=this.transitionsBetween(P,y);let G=new tt(y.getX()+(x.getX()-h.getX())/(w+1),y.getY()+(x.getY()-h.getY())/(w+1)),te=new tt(y.getX()+(c.getX()-h.getX())/(S+1),y.getY()+(c.getY()-h.getY())/(S+1));if(!this.isValid(G))return this.isValid(te)?te:null;if(!this.isValid(te))return G;let oe=this.transitionsBetween(A,G)+this.transitionsBetween(P,G),Ce=this.transitionsBetween(A,te)+this.transitionsBetween(P,te);return oe>Ce?G:te}shiftToModuleCenter(i){let c=i[0],h=i[1],x=i[2],y=i[3],w=this.transitionsBetween(c,y)+1,S=this.transitionsBetween(x,y)+1,A=or.shiftPoint(c,h,S*4),P=or.shiftPoint(x,h,w*4);w=this.transitionsBetween(A,y)+1,S=this.transitionsBetween(P,y)+1,(w&1)===1&&(w+=1),(S&1)===1&&(S+=1);let G=(c.getX()+h.getX()+x.getX()+y.getX())/4,te=(c.getY()+h.getY()+x.getY()+y.getY())/4;c=or.moveAway(c,G,te),h=or.moveAway(h,G,te),x=or.moveAway(x,G,te),y=or.moveAway(y,G,te);let oe,Ce;return A=or.shiftPoint(c,h,S*4),A=or.shiftPoint(A,y,w*4),oe=or.shiftPoint(h,c,S*4),oe=or.shiftPoint(oe,x,w*4),P=or.shiftPoint(x,y,S*4),P=or.shiftPoint(P,h,w*4),Ce=or.shiftPoint(y,x,S*4),Ce=or.shiftPoint(Ce,c,w*4),[A,oe,P,Ce]}isValid(i){return i.getX()>=0&&i.getX()<this.image.getWidth()&&i.getY()>0&&i.getY()<this.image.getHeight()}static sampleGrid(i,c,h,x,y,w,S){return cr.getInstance().sampleGrid(i,w,S,.5,.5,w-.5,.5,w-.5,S-.5,.5,S-.5,c.getX(),c.getY(),y.getX(),y.getY(),x.getX(),x.getY(),h.getX(),h.getY())}transitionsBetween(i,c){let h=Math.trunc(i.getX()),x=Math.trunc(i.getY()),y=Math.trunc(c.getX()),w=Math.trunc(c.getY()),S=Math.abs(w-x)>Math.abs(y-h);if(S){let Pe=h;h=x,x=Pe,Pe=y,y=w,w=Pe}let A=Math.abs(y-h),P=Math.abs(w-x),G=-A/2,te=x<w?1:-1,oe=h<y?1:-1,Ce=0,Ie=this.image.get(S?x:h,S?h:x);for(let Pe=h,Ke=x;Pe!==y;Pe+=oe){let it=this.image.get(S?Ke:Pe,S?Pe:Ke);if(it!==Ie&&(Ce++,Ie=it),G+=P,G>0){if(Ke===w)break;Ke+=te,G-=A}}return Ce}}class Kr{constructor(){this.decoder=new Il}decode(i,c=null){let h,x;if(c!=null&&c.has(ne.PURE_BARCODE)){const P=Kr.extractPureBits(i.getBlackMatrix());h=this.decoder.decode(P),x=Kr.NO_POINTS}else{const P=new or(i.getBlackMatrix()).detect();h=this.decoder.decode(P.getBits()),x=P.getPoints()}const y=h.getRawBytes(),w=new se(h.getText(),y,8*y.length,x,pe.DATA_MATRIX,M.currentTimeMillis()),S=h.getByteSegments();S!=null&&w.putMetadata(Fe.BYTE_SEGMENTS,S);const A=h.getECLevel();return A!=null&&w.putMetadata(Fe.ERROR_CORRECTION_LEVEL,A),w}reset(){}static extractPureBits(i){const c=i.getTopLeftOnBit(),h=i.getBottomRightOnBit();if(c==null||h==null)throw new ue;const x=this.moduleSize(c,i);let y=c[1];const w=h[1];let S=c[0];const P=(h[0]-S+1)/x,G=(w-y+1)/x;if(P<=0||G<=0)throw new ue;const te=x/2;y+=te,S+=te;const oe=new Oe(P,G);for(let Ce=0;Ce<G;Ce++){const Ie=y+Ce*x;for(let Pe=0;Pe<P;Pe++)i.get(S+Pe*x,Ie)&&oe.set(Pe,Ce)}return oe}static moduleSize(i,c){const h=c.getWidth();let x=i[0];const y=i[1];for(;x<h&&c.get(x,y);)x++;if(x===h)throw new ue;const w=x-i[0];if(w===0)throw new ue;return w}}Kr.NO_POINTS=[];class Qi extends ae{constructor(i=500){super(new Kr,i)}}var Ys;(function(ee){ee[ee.L=0]="L",ee[ee.M=1]="M",ee[ee.Q=2]="Q",ee[ee.H=3]="H"})(Ys||(Ys={}));class pr{constructor(i,c,h){this.value=i,this.stringValue=c,this.bits=h,pr.FOR_BITS.set(h,this),pr.FOR_VALUE.set(i,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(i){switch(i){case"L":return pr.L;case"M":return pr.M;case"Q":return pr.Q;case"H":return pr.H;default:throw new k(i+"not available")}}toString(){return this.stringValue}equals(i){if(!(i instanceof pr))return!1;const c=i;return this.value===c.value}static forBits(i){if(i<0||i>=pr.FOR_BITS.size)throw new N;return pr.FOR_BITS.get(i)}}pr.FOR_BITS=new Map,pr.FOR_VALUE=new Map,pr.L=new pr(Ys.L,"L",1),pr.M=new pr(Ys.M,"M",0),pr.Q=new pr(Ys.Q,"Q",3),pr.H=new pr(Ys.H,"H",2);class Ya{constructor(i){this.errorCorrectionLevel=pr.forBits(i>>3&3),this.dataMask=i&7}static numBitsDiffering(i,c){return U.bitCount(i^c)}static decodeFormatInformation(i,c){const h=Ya.doDecodeFormatInformation(i,c);return h!==null?h:Ya.doDecodeFormatInformation(i^Ya.FORMAT_INFO_MASK_QR,c^Ya.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(i,c){let h=Number.MAX_SAFE_INTEGER,x=0;for(const y of Ya.FORMAT_INFO_DECODE_LOOKUP){const w=y[0];if(w===i||w===c)return new Ya(y[1]);let S=Ya.numBitsDiffering(i,w);S<h&&(x=y[1],h=S),i!==c&&(S=Ya.numBitsDiffering(c,w),S<h&&(x=y[1],h=S))}return h<=3?new Ya(x):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(i){if(!(i instanceof Ya))return!1;const c=i;return this.errorCorrectionLevel===c.errorCorrectionLevel&&this.dataMask===c.dataMask}}Ya.FORMAT_INFO_MASK_QR=21522,Ya.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class Qe{constructor(i,...c){this.ecCodewordsPerBlock=i,this.ecBlocks=c}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let i=0;const c=this.ecBlocks;for(const h of c)i+=h.getCount();return i}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class we{constructor(i,c){this.count=i,this.dataCodewords=c}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Gt{constructor(i,c,...h){this.versionNumber=i,this.alignmentPatternCenters=c,this.ecBlocks=h;let x=0;const y=h[0].getECCodewordsPerBlock(),w=h[0].getECBlocks();for(const S of w)x+=S.getCount()*(S.getDataCodewords()+y);this.totalCodewords=x}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(i){return this.ecBlocks[i.getValue()]}static getProvisionalVersionForDimension(i){if(i%4!==1)throw new V;try{return this.getVersionForNumber((i-17)/4)}catch(c){throw new V}}static getVersionForNumber(i){if(i<1||i>40)throw new N;return Gt.VERSIONS[i-1]}static decodeVersionInformation(i){let c=Number.MAX_SAFE_INTEGER,h=0;for(let x=0;x<Gt.VERSION_DECODE_INFO.length;x++){const y=Gt.VERSION_DECODE_INFO[x];if(y===i)return Gt.getVersionForNumber(x+7);const w=Ya.numBitsDiffering(i,y);w<c&&(h=x+7,c=w)}return c<=3?Gt.getVersionForNumber(h):null}buildFunctionPattern(){const i=this.getDimensionForVersion(),c=new Oe(i);c.setRegion(0,0,9,9),c.setRegion(i-8,0,8,9),c.setRegion(0,i-8,9,8);const h=this.alignmentPatternCenters.length;for(let x=0;x<h;x++){const y=this.alignmentPatternCenters[x]-2;for(let w=0;w<h;w++)x===0&&(w===0||w===h-1)||x===h-1&&w===0||c.setRegion(this.alignmentPatternCenters[w]-2,y,5,5)}return c.setRegion(6,9,1,i-17),c.setRegion(9,6,i-17,1),this.versionNumber>6&&(c.setRegion(i-11,0,3,6),c.setRegion(0,i-11,6,3)),c}toString(){return""+this.versionNumber}}Gt.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Gt.VERSIONS=[new Gt(1,new Int32Array(0),new Qe(7,new we(1,19)),new Qe(10,new we(1,16)),new Qe(13,new we(1,13)),new Qe(17,new we(1,9))),new Gt(2,Int32Array.from([6,18]),new Qe(10,new we(1,34)),new Qe(16,new we(1,28)),new Qe(22,new we(1,22)),new Qe(28,new we(1,16))),new Gt(3,Int32Array.from([6,22]),new Qe(15,new we(1,55)),new Qe(26,new we(1,44)),new Qe(18,new we(2,17)),new Qe(22,new we(2,13))),new Gt(4,Int32Array.from([6,26]),new Qe(20,new we(1,80)),new Qe(18,new we(2,32)),new Qe(26,new we(2,24)),new Qe(16,new we(4,9))),new Gt(5,Int32Array.from([6,30]),new Qe(26,new we(1,108)),new Qe(24,new we(2,43)),new Qe(18,new we(2,15),new we(2,16)),new Qe(22,new we(2,11),new we(2,12))),new Gt(6,Int32Array.from([6,34]),new Qe(18,new we(2,68)),new Qe(16,new we(4,27)),new Qe(24,new we(4,19)),new Qe(28,new we(4,15))),new Gt(7,Int32Array.from([6,22,38]),new Qe(20,new we(2,78)),new Qe(18,new we(4,31)),new Qe(18,new we(2,14),new we(4,15)),new Qe(26,new we(4,13),new we(1,14))),new Gt(8,Int32Array.from([6,24,42]),new Qe(24,new we(2,97)),new Qe(22,new we(2,38),new we(2,39)),new Qe(22,new we(4,18),new we(2,19)),new Qe(26,new we(4,14),new we(2,15))),new Gt(9,Int32Array.from([6,26,46]),new Qe(30,new we(2,116)),new Qe(22,new we(3,36),new we(2,37)),new Qe(20,new we(4,16),new we(4,17)),new Qe(24,new we(4,12),new we(4,13))),new Gt(10,Int32Array.from([6,28,50]),new Qe(18,new we(2,68),new we(2,69)),new Qe(26,new we(4,43),new we(1,44)),new Qe(24,new we(6,19),new we(2,20)),new Qe(28,new we(6,15),new we(2,16))),new Gt(11,Int32Array.from([6,30,54]),new Qe(20,new we(4,81)),new Qe(30,new we(1,50),new we(4,51)),new Qe(28,new we(4,22),new we(4,23)),new Qe(24,new we(3,12),new we(8,13))),new Gt(12,Int32Array.from([6,32,58]),new Qe(24,new we(2,92),new we(2,93)),new Qe(22,new we(6,36),new we(2,37)),new Qe(26,new we(4,20),new we(6,21)),new Qe(28,new we(7,14),new we(4,15))),new Gt(13,Int32Array.from([6,34,62]),new Qe(26,new we(4,107)),new Qe(22,new we(8,37),new we(1,38)),new Qe(24,new we(8,20),new we(4,21)),new Qe(22,new we(12,11),new we(4,12))),new Gt(14,Int32Array.from([6,26,46,66]),new Qe(30,new we(3,115),new we(1,116)),new Qe(24,new we(4,40),new we(5,41)),new Qe(20,new we(11,16),new we(5,17)),new Qe(24,new we(11,12),new we(5,13))),new Gt(15,Int32Array.from([6,26,48,70]),new Qe(22,new we(5,87),new we(1,88)),new Qe(24,new we(5,41),new we(5,42)),new Qe(30,new we(5,24),new we(7,25)),new Qe(24,new we(11,12),new we(7,13))),new Gt(16,Int32Array.from([6,26,50,74]),new Qe(24,new we(5,98),new we(1,99)),new Qe(28,new we(7,45),new we(3,46)),new Qe(24,new we(15,19),new we(2,20)),new Qe(30,new we(3,15),new we(13,16))),new Gt(17,Int32Array.from([6,30,54,78]),new Qe(28,new we(1,107),new we(5,108)),new Qe(28,new we(10,46),new we(1,47)),new Qe(28,new we(1,22),new we(15,23)),new Qe(28,new we(2,14),new we(17,15))),new Gt(18,Int32Array.from([6,30,56,82]),new Qe(30,new we(5,120),new we(1,121)),new Qe(26,new we(9,43),new we(4,44)),new Qe(28,new we(17,22),new we(1,23)),new Qe(28,new we(2,14),new we(19,15))),new Gt(19,Int32Array.from([6,30,58,86]),new Qe(28,new we(3,113),new we(4,114)),new Qe(26,new we(3,44),new we(11,45)),new Qe(26,new we(17,21),new we(4,22)),new Qe(26,new we(9,13),new we(16,14))),new Gt(20,Int32Array.from([6,34,62,90]),new Qe(28,new we(3,107),new we(5,108)),new Qe(26,new we(3,41),new we(13,42)),new Qe(30,new we(15,24),new we(5,25)),new Qe(28,new we(15,15),new we(10,16))),new Gt(21,Int32Array.from([6,28,50,72,94]),new Qe(28,new we(4,116),new we(4,117)),new Qe(26,new we(17,42)),new Qe(28,new we(17,22),new we(6,23)),new Qe(30,new we(19,16),new we(6,17))),new Gt(22,Int32Array.from([6,26,50,74,98]),new Qe(28,new we(2,111),new we(7,112)),new Qe(28,new we(17,46)),new Qe(30,new we(7,24),new we(16,25)),new Qe(24,new we(34,13))),new Gt(23,Int32Array.from([6,30,54,78,102]),new Qe(30,new we(4,121),new we(5,122)),new Qe(28,new we(4,47),new we(14,48)),new Qe(30,new we(11,24),new we(14,25)),new Qe(30,new we(16,15),new we(14,16))),new Gt(24,Int32Array.from([6,28,54,80,106]),new Qe(30,new we(6,117),new we(4,118)),new Qe(28,new we(6,45),new we(14,46)),new Qe(30,new we(11,24),new we(16,25)),new Qe(30,new we(30,16),new we(2,17))),new Gt(25,Int32Array.from([6,32,58,84,110]),new Qe(26,new we(8,106),new we(4,107)),new Qe(28,new we(8,47),new we(13,48)),new Qe(30,new we(7,24),new we(22,25)),new Qe(30,new we(22,15),new we(13,16))),new Gt(26,Int32Array.from([6,30,58,86,114]),new Qe(28,new we(10,114),new we(2,115)),new Qe(28,new we(19,46),new we(4,47)),new Qe(28,new we(28,22),new we(6,23)),new Qe(30,new we(33,16),new we(4,17))),new Gt(27,Int32Array.from([6,34,62,90,118]),new Qe(30,new we(8,122),new we(4,123)),new Qe(28,new we(22,45),new we(3,46)),new Qe(30,new we(8,23),new we(26,24)),new Qe(30,new we(12,15),new we(28,16))),new Gt(28,Int32Array.from([6,26,50,74,98,122]),new Qe(30,new we(3,117),new we(10,118)),new Qe(28,new we(3,45),new we(23,46)),new Qe(30,new we(4,24),new we(31,25)),new Qe(30,new we(11,15),new we(31,16))),new Gt(29,Int32Array.from([6,30,54,78,102,126]),new Qe(30,new we(7,116),new we(7,117)),new Qe(28,new we(21,45),new we(7,46)),new Qe(30,new we(1,23),new we(37,24)),new Qe(30,new we(19,15),new we(26,16))),new Gt(30,Int32Array.from([6,26,52,78,104,130]),new Qe(30,new we(5,115),new we(10,116)),new Qe(28,new we(19,47),new we(10,48)),new Qe(30,new we(15,24),new we(25,25)),new Qe(30,new we(23,15),new we(25,16))),new Gt(31,Int32Array.from([6,30,56,82,108,134]),new Qe(30,new we(13,115),new we(3,116)),new Qe(28,new we(2,46),new we(29,47)),new Qe(30,new we(42,24),new we(1,25)),new Qe(30,new we(23,15),new we(28,16))),new Gt(32,Int32Array.from([6,34,60,86,112,138]),new Qe(30,new we(17,115)),new Qe(28,new we(10,46),new we(23,47)),new Qe(30,new we(10,24),new we(35,25)),new Qe(30,new we(19,15),new we(35,16))),new Gt(33,Int32Array.from([6,30,58,86,114,142]),new Qe(30,new we(17,115),new we(1,116)),new Qe(28,new we(14,46),new we(21,47)),new Qe(30,new we(29,24),new we(19,25)),new Qe(30,new we(11,15),new we(46,16))),new Gt(34,Int32Array.from([6,34,62,90,118,146]),new Qe(30,new we(13,115),new we(6,116)),new Qe(28,new we(14,46),new we(23,47)),new Qe(30,new we(44,24),new we(7,25)),new Qe(30,new we(59,16),new we(1,17))),new Gt(35,Int32Array.from([6,30,54,78,102,126,150]),new Qe(30,new we(12,121),new we(7,122)),new Qe(28,new we(12,47),new we(26,48)),new Qe(30,new we(39,24),new we(14,25)),new Qe(30,new we(22,15),new we(41,16))),new Gt(36,Int32Array.from([6,24,50,76,102,128,154]),new Qe(30,new we(6,121),new we(14,122)),new Qe(28,new we(6,47),new we(34,48)),new Qe(30,new we(46,24),new we(10,25)),new Qe(30,new we(2,15),new we(64,16))),new Gt(37,Int32Array.from([6,28,54,80,106,132,158]),new Qe(30,new we(17,122),new we(4,123)),new Qe(28,new we(29,46),new we(14,47)),new Qe(30,new we(49,24),new we(10,25)),new Qe(30,new we(24,15),new we(46,16))),new Gt(38,Int32Array.from([6,32,58,84,110,136,162]),new Qe(30,new we(4,122),new we(18,123)),new Qe(28,new we(13,46),new we(32,47)),new Qe(30,new we(48,24),new we(14,25)),new Qe(30,new we(42,15),new we(32,16))),new Gt(39,Int32Array.from([6,26,54,82,110,138,166]),new Qe(30,new we(20,117),new we(4,118)),new Qe(28,new we(40,47),new we(7,48)),new Qe(30,new we(43,24),new we(22,25)),new Qe(30,new we(10,15),new we(67,16))),new Gt(40,Int32Array.from([6,30,58,86,114,142,170]),new Qe(30,new we(19,118),new we(6,119)),new Qe(28,new we(18,47),new we(31,48)),new Qe(30,new we(34,24),new we(34,25)),new Qe(30,new we(20,15),new we(61,16)))];var pa;(function(ee){ee[ee.DATA_MASK_000=0]="DATA_MASK_000",ee[ee.DATA_MASK_001=1]="DATA_MASK_001",ee[ee.DATA_MASK_010=2]="DATA_MASK_010",ee[ee.DATA_MASK_011=3]="DATA_MASK_011",ee[ee.DATA_MASK_100=4]="DATA_MASK_100",ee[ee.DATA_MASK_101=5]="DATA_MASK_101",ee[ee.DATA_MASK_110=6]="DATA_MASK_110",ee[ee.DATA_MASK_111=7]="DATA_MASK_111"})(pa||(pa={}));class an{constructor(i,c){this.value=i,this.isMasked=c}unmaskBitMatrix(i,c){for(let h=0;h<c;h++)for(let x=0;x<c;x++)this.isMasked(h,x)&&i.flip(x,h)}}an.values=new Map([[pa.DATA_MASK_000,new an(pa.DATA_MASK_000,(ee,i)=>(ee+i&1)===0)],[pa.DATA_MASK_001,new an(pa.DATA_MASK_001,(ee,i)=>(ee&1)===0)],[pa.DATA_MASK_010,new an(pa.DATA_MASK_010,(ee,i)=>i%3===0)],[pa.DATA_MASK_011,new an(pa.DATA_MASK_011,(ee,i)=>(ee+i)%3===0)],[pa.DATA_MASK_100,new an(pa.DATA_MASK_100,(ee,i)=>(Math.floor(ee/2)+Math.floor(i/3)&1)===0)],[pa.DATA_MASK_101,new an(pa.DATA_MASK_101,(ee,i)=>ee*i%6===0)],[pa.DATA_MASK_110,new an(pa.DATA_MASK_110,(ee,i)=>ee*i%6<3)],[pa.DATA_MASK_111,new an(pa.DATA_MASK_111,(ee,i)=>(ee+i+ee*i%3&1)===0)]]);class Ts{constructor(i){const c=i.getHeight();if(c<21||(c&3)!==1)throw new V;this.bitMatrix=i}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let i=0;for(let y=0;y<6;y++)i=this.copyBit(y,8,i);i=this.copyBit(7,8,i),i=this.copyBit(8,8,i),i=this.copyBit(8,7,i);for(let y=5;y>=0;y--)i=this.copyBit(8,y,i);const c=this.bitMatrix.getHeight();let h=0;const x=c-7;for(let y=c-1;y>=x;y--)h=this.copyBit(8,y,h);for(let y=c-8;y<c;y++)h=this.copyBit(y,8,h);if(this.parsedFormatInfo=Ya.decodeFormatInformation(i,h),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new V}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const i=this.bitMatrix.getHeight(),c=Math.floor((i-17)/4);if(c<=6)return Gt.getVersionForNumber(c);let h=0;const x=i-11;for(let w=5;w>=0;w--)for(let S=i-9;S>=x;S--)h=this.copyBit(S,w,h);let y=Gt.decodeVersionInformation(h);if(y!==null&&y.getDimensionForVersion()===i)return this.parsedVersion=y,y;h=0;for(let w=5;w>=0;w--)for(let S=i-9;S>=x;S--)h=this.copyBit(w,S,h);if(y=Gt.decodeVersionInformation(h),y!==null&&y.getDimensionForVersion()===i)return this.parsedVersion=y,y;throw new V}copyBit(i,c,h){return(this.isMirror?this.bitMatrix.get(c,i):this.bitMatrix.get(i,c))?h<<1|1:h<<1}readCodewords(){const i=this.readFormatInformation(),c=this.readVersion(),h=an.values.get(i.getDataMask()),x=this.bitMatrix.getHeight();h.unmaskBitMatrix(this.bitMatrix,x);const y=c.buildFunctionPattern();let w=!0;const S=new Uint8Array(c.getTotalCodewords());let A=0,P=0,G=0;for(let te=x-1;te>0;te-=2){te===6&&te--;for(let oe=0;oe<x;oe++){const Ce=w?x-1-oe:oe;for(let Ie=0;Ie<2;Ie++)y.get(te-Ie,Ce)||(G++,P<<=1,this.bitMatrix.get(te-Ie,Ce)&&(P|=1),G===8&&(S[A++]=P,G=0,P=0))}w=!w}if(A!==c.getTotalCodewords())throw new V;return S}remask(){if(this.parsedFormatInfo===null)return;const i=an.values[this.parsedFormatInfo.getDataMask()],c=this.bitMatrix.getHeight();i.unmaskBitMatrix(this.bitMatrix,c)}setMirror(i){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=i}mirror(){const i=this.bitMatrix;for(let c=0,h=i.getWidth();c<h;c++)for(let x=c+1,y=i.getHeight();x<y;x++)i.get(c,x)!==i.get(x,c)&&(i.flip(x,c),i.flip(c,x))}}class yo{constructor(i,c){this.numDataCodewords=i,this.codewords=c}static getDataBlocks(i,c,h){if(i.length!==c.getTotalCodewords())throw new N;const x=c.getECBlocksForLevel(h);let y=0;const w=x.getECBlocks();for(const Ie of w)y+=Ie.getCount();const S=new Array(y);let A=0;for(const Ie of w)for(let Pe=0;Pe<Ie.getCount();Pe++){const Ke=Ie.getDataCodewords(),it=x.getECCodewordsPerBlock()+Ke;S[A++]=new yo(Ke,new Uint8Array(it))}const P=S[0].codewords.length;let G=S.length-1;for(;G>=0&&S[G].codewords.length!==P;)G--;G++;const te=P-x.getECCodewordsPerBlock();let oe=0;for(let Ie=0;Ie<te;Ie++)for(let Pe=0;Pe<A;Pe++)S[Pe].codewords[Ie]=i[oe++];for(let Ie=G;Ie<A;Ie++)S[Ie].codewords[te]=i[oe++];const Ce=S[0].codewords.length;for(let Ie=te;Ie<Ce;Ie++)for(let Pe=0;Pe<A;Pe++){const Ke=Pe<G?Ie:Ie+1;S[Pe].codewords[Ke]=i[oe++]}return S}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var nn;(function(ee){ee[ee.TERMINATOR=0]="TERMINATOR",ee[ee.NUMERIC=1]="NUMERIC",ee[ee.ALPHANUMERIC=2]="ALPHANUMERIC",ee[ee.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",ee[ee.BYTE=4]="BYTE",ee[ee.ECI=5]="ECI",ee[ee.KANJI=6]="KANJI",ee[ee.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",ee[ee.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",ee[ee.HANZI=9]="HANZI"})(nn||(nn={}));class ur{constructor(i,c,h,x){this.value=i,this.stringValue=c,this.characterCountBitsForVersions=h,this.bits=x,ur.FOR_BITS.set(x,this),ur.FOR_VALUE.set(i,this)}static forBits(i){const c=ur.FOR_BITS.get(i);if(c===void 0)throw new N;return c}getCharacterCountBits(i){const c=i.getVersionNumber();let h;return c<=9?h=0:c<=26?h=1:h=2,this.characterCountBitsForVersions[h]}getValue(){return this.value}getBits(){return this.bits}equals(i){if(!(i instanceof ur))return!1;const c=i;return this.value===c.value}toString(){return this.stringValue}}ur.FOR_BITS=new Map,ur.FOR_VALUE=new Map,ur.TERMINATOR=new ur(nn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ur.NUMERIC=new ur(nn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ur.ALPHANUMERIC=new ur(nn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ur.STRUCTURED_APPEND=new ur(nn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ur.BYTE=new ur(nn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ur.ECI=new ur(nn.ECI,"ECI",Int32Array.from([0,0,0]),7),ur.KANJI=new ur(nn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ur.FNC1_FIRST_POSITION=new ur(nn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ur.FNC1_SECOND_POSITION=new ur(nn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ur.HANZI=new ur(nn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class da{static decode(i,c,h,x){const y=new jn(i);let w=new Se;const S=new Array;let A=-1,P=-1;try{let G=null,te=!1,oe;do{if(y.available()<4)oe=ur.TERMINATOR;else{const Ce=y.readBits(4);oe=ur.forBits(Ce)}switch(oe){case ur.TERMINATOR:break;case ur.FNC1_FIRST_POSITION:case ur.FNC1_SECOND_POSITION:te=!0;break;case ur.STRUCTURED_APPEND:if(y.available()<16)throw new V;A=y.readBits(8),P=y.readBits(8);break;case ur.ECI:const Ce=da.parseECIValue(y);if(G=Q.getCharacterSetECIByValue(Ce),G===null)throw new V;break;case ur.HANZI:const Ie=y.readBits(4),Pe=y.readBits(oe.getCharacterCountBits(c));Ie===da.GB2312_SUBSET&&da.decodeHanziSegment(y,w,Pe);break;default:const Ke=y.readBits(oe.getCharacterCountBits(c));switch(oe){case ur.NUMERIC:da.decodeNumericSegment(y,w,Ke);break;case ur.ALPHANUMERIC:da.decodeAlphanumericSegment(y,w,Ke,te);break;case ur.BYTE:da.decodeByteSegment(y,w,Ke,G,S,x);break;case ur.KANJI:da.decodeKanjiSegment(y,w,Ke);break;default:throw new V}break}}while(oe!==ur.TERMINATOR)}catch(G){throw new V}return new ft(i,w.toString(),S.length===0?null:S,h===null?null:h.toString(),A,P)}static decodeHanziSegment(i,c,h){if(h*13>i.available())throw new V;const x=new Uint8Array(2*h);let y=0;for(;h>0;){const w=i.readBits(13);let S=w/96<<8&4294967295|w%96;S<959?S+=41377:S+=42657,x[y]=S>>8&255,x[y+1]=S&255,y+=2,h--}try{c.append(je.decode(x,me.GB2312))}catch(w){throw new V(w)}}static decodeKanjiSegment(i,c,h){if(h*13>i.available())throw new V;const x=new Uint8Array(2*h);let y=0;for(;h>0;){const w=i.readBits(13);let S=w/192<<8&4294967295|w%192;S<7936?S+=33088:S+=49472,x[y]=S>>8,x[y+1]=S,y+=2,h--}try{c.append(je.decode(x,me.SHIFT_JIS))}catch(w){throw new V(w)}}static decodeByteSegment(i,c,h,x,y,w){if(8*h>i.available())throw new V;const S=new Uint8Array(h);for(let P=0;P<h;P++)S[P]=i.readBits(8);let A;x===null?A=me.guessEncoding(S,w):A=x.getName();try{c.append(je.decode(S,A))}catch(P){throw new V(P)}y.push(S)}static toAlphaNumericChar(i){if(i>=da.ALPHANUMERIC_CHARS.length)throw new V;return da.ALPHANUMERIC_CHARS[i]}static decodeAlphanumericSegment(i,c,h,x){const y=c.length();for(;h>1;){if(i.available()<11)throw new V;const w=i.readBits(11);c.append(da.toAlphaNumericChar(Math.floor(w/45))),c.append(da.toAlphaNumericChar(w%45)),h-=2}if(h===1){if(i.available()<6)throw new V;c.append(da.toAlphaNumericChar(i.readBits(6)))}if(x)for(let w=y;w<c.length();w++)c.charAt(w)==="%"&&(w<c.length()-1&&c.charAt(w+1)==="%"?c.deleteCharAt(w+1):c.setCharAt(w,""))}static decodeNumericSegment(i,c,h){for(;h>=3;){if(i.available()<10)throw new V;const x=i.readBits(10);if(x>=1e3)throw new V;c.append(da.toAlphaNumericChar(Math.floor(x/100))),c.append(da.toAlphaNumericChar(Math.floor(x/10)%10)),c.append(da.toAlphaNumericChar(x%10)),h-=3}if(h===2){if(i.available()<7)throw new V;const x=i.readBits(7);if(x>=100)throw new V;c.append(da.toAlphaNumericChar(Math.floor(x/10))),c.append(da.toAlphaNumericChar(x%10))}else if(h===1){if(i.available()<4)throw new V;const x=i.readBits(4);if(x>=10)throw new V;c.append(da.toAlphaNumericChar(x))}}static parseECIValue(i){const c=i.readBits(8);if((c&128)===0)return c&127;if((c&192)===128){const h=i.readBits(8);return(c&63)<<8&4294967295|h}if((c&224)===192){const h=i.readBits(16);return(c&31)<<16&4294967295|h}throw new V}}da.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",da.GB2312_SUBSET=1;class bo{constructor(i){this.mirrored=i}isMirrored(){return this.mirrored}applyMirroredCorrection(i){if(!this.mirrored||i===null||i.length<3)return;const c=i[0];i[0]=i[2],i[2]=c}}class Ll{constructor(){this.rsDecoder=new Kt(Ht.QR_CODE_FIELD_256)}decodeBooleanArray(i,c){return this.decodeBitMatrix(Oe.parseFromBooleanArray(i),c)}decodeBitMatrix(i,c){const h=new Ts(i);let x=null;try{return this.decodeBitMatrixParser(h,c)}catch(y){x=y}try{h.remask(),h.setMirror(!0),h.readVersion(),h.readFormatInformation(),h.mirror();const y=this.decodeBitMatrixParser(h,c);return y.setOther(new bo(!0)),y}catch(y){throw x!==null?x:y}}decodeBitMatrixParser(i,c){const h=i.readVersion(),x=i.readFormatInformation().getErrorCorrectionLevel(),y=i.readCodewords(),w=yo.getDataBlocks(y,h,x);let S=0;for(const G of w)S+=G.getNumDataCodewords();const A=new Uint8Array(S);let P=0;for(const G of w){const te=G.getCodewords(),oe=G.getNumDataCodewords();this.correctErrors(te,oe);for(let Ce=0;Ce<oe;Ce++)A[P++]=te[Ce]}return da.decode(A,h,x,c)}correctErrors(i,c){const h=new Int32Array(i);try{this.rsDecoder.decode(h,i.length-c)}catch(x){throw new O}for(let x=0;x<c;x++)i[x]=h[x]}}class mi extends tt{constructor(i,c,h){super(i,c),this.estimatedModuleSize=h}aboutEquals(i,c,h){if(Math.abs(c-this.getY())<=i&&Math.abs(h-this.getX())<=i){const x=Math.abs(i-this.estimatedModuleSize);return x<=1||x<=this.estimatedModuleSize}return!1}combineEstimate(i,c,h){const x=(this.getX()+c)/2,y=(this.getY()+i)/2,w=(this.estimatedModuleSize+h)/2;return new mi(x,y,w)}}class wn{constructor(i,c,h,x,y,w,S){this.image=i,this.startX=c,this.startY=h,this.width=x,this.height=y,this.moduleSize=w,this.resultPointCallback=S,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const i=this.startX,c=this.height,h=this.width,x=i+h,y=this.startY+c/2,w=new Int32Array(3),S=this.image;for(let A=0;A<c;A++){const P=y+((A&1)===0?Math.floor((A+1)/2):-Math.floor((A+1)/2));w[0]=0,w[1]=0,w[2]=0;let G=i;for(;G<x&&!S.get(G,P);)G++;let te=0;for(;G<x;){if(S.get(G,P))if(te===1)w[1]++;else if(te===2){if(this.foundPatternCross(w)){const oe=this.handlePossibleCenter(w,P,G);if(oe!==null)return oe}w[0]=w[2],w[1]=1,w[2]=0,te=1}else w[++te]++;else te===1&&te++,w[te]++;G++}if(this.foundPatternCross(w)){const oe=this.handlePossibleCenter(w,P,x);if(oe!==null)return oe}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new ue}static centerFromEnd(i,c){return c-i[2]-i[1]/2}foundPatternCross(i){const c=this.moduleSize,h=c/2;for(let x=0;x<3;x++)if(Math.abs(c-i[x])>=h)return!1;return!0}crossCheckVertical(i,c,h,x){const y=this.image,w=y.getHeight(),S=this.crossCheckStateCount;S[0]=0,S[1]=0,S[2]=0;let A=i;for(;A>=0&&y.get(c,A)&&S[1]<=h;)S[1]++,A--;if(A<0||S[1]>h)return NaN;for(;A>=0&&!y.get(c,A)&&S[0]<=h;)S[0]++,A--;if(S[0]>h)return NaN;for(A=i+1;A<w&&y.get(c,A)&&S[1]<=h;)S[1]++,A++;if(A===w||S[1]>h)return NaN;for(;A<w&&!y.get(c,A)&&S[2]<=h;)S[2]++,A++;if(S[2]>h)return NaN;const P=S[0]+S[1]+S[2];return 5*Math.abs(P-x)>=2*x?NaN:this.foundPatternCross(S)?wn.centerFromEnd(S,A):NaN}handlePossibleCenter(i,c,h){const x=i[0]+i[1]+i[2],y=wn.centerFromEnd(i,h),w=this.crossCheckVertical(c,y,2*i[1],x);if(!isNaN(w)){const S=(i[0]+i[1]+i[2])/3;for(const P of this.possibleCenters)if(P.aboutEquals(S,w,y))return P.combineEstimate(w,y,S);const A=new mi(y,w,S);this.possibleCenters.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return null}}class eo extends tt{constructor(i,c,h,x){super(i,c),this.estimatedModuleSize=h,this.count=x,x===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(i,c,h){if(Math.abs(c-this.getY())<=i&&Math.abs(h-this.getX())<=i){const x=Math.abs(i-this.estimatedModuleSize);return x<=1||x<=this.estimatedModuleSize}return!1}combineEstimate(i,c,h){const x=this.count+1,y=(this.count*this.getX()+c)/x,w=(this.count*this.getY()+i)/x,S=(this.count*this.estimatedModuleSize+h)/x;return new eo(y,w,S,x)}}class vo{constructor(i){this.bottomLeft=i[0],this.topLeft=i[1],this.topRight=i[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class ja{constructor(i,c){this.image=i,this.resultPointCallback=c,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=c}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(i){const c=i!=null&&i.get(ne.TRY_HARDER)!==void 0,h=i!=null&&i.get(ne.PURE_BARCODE)!==void 0,x=this.image,y=x.getHeight(),w=x.getWidth();let S=Math.floor(3*y/(4*ja.MAX_MODULES));(S<ja.MIN_SKIP||c)&&(S=ja.MIN_SKIP);let A=!1;const P=new Int32Array(5);for(let te=S-1;te<y&&!A;te+=S){P[0]=0,P[1]=0,P[2]=0,P[3]=0,P[4]=0;let oe=0;for(let Ce=0;Ce<w;Ce++)if(x.get(Ce,te))(oe&1)===1&&oe++,P[oe]++;else if((oe&1)===0)if(oe===4)if(ja.foundPatternCross(P)){if(this.handlePossibleCenter(P,te,Ce,h)===!0)if(S=2,this.hasSkipped===!0)A=this.haveMultiplyConfirmedCenters();else{const Pe=this.findRowSkip();Pe>P[2]&&(te+=Pe-P[2]-S,Ce=w-1)}else{P[0]=P[2],P[1]=P[3],P[2]=P[4],P[3]=1,P[4]=0,oe=3;continue}oe=0,P[0]=0,P[1]=0,P[2]=0,P[3]=0,P[4]=0}else P[0]=P[2],P[1]=P[3],P[2]=P[4],P[3]=1,P[4]=0,oe=3;else P[++oe]++;else P[oe]++;ja.foundPatternCross(P)&&this.handlePossibleCenter(P,te,w,h)===!0&&(S=P[0],this.hasSkipped&&(A=this.haveMultiplyConfirmedCenters()))}const G=this.selectBestPatterns();return tt.orderBestPatterns(G),new vo(G)}static centerFromEnd(i,c){return c-i[4]-i[3]-i[2]/2}static foundPatternCross(i){let c=0;for(let y=0;y<5;y++){const w=i[y];if(w===0)return!1;c+=w}if(c<7)return!1;const h=c/7,x=h/2;return Math.abs(h-i[0])<x&&Math.abs(h-i[1])<x&&Math.abs(3*h-i[2])<3*x&&Math.abs(h-i[3])<x&&Math.abs(h-i[4])<x}getCrossCheckStateCount(){const i=this.crossCheckStateCount;return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i}crossCheckDiagonal(i,c,h,x){const y=this.getCrossCheckStateCount();let w=0;const S=this.image;for(;i>=w&&c>=w&&S.get(c-w,i-w);)y[2]++,w++;if(i<w||c<w)return!1;for(;i>=w&&c>=w&&!S.get(c-w,i-w)&&y[1]<=h;)y[1]++,w++;if(i<w||c<w||y[1]>h)return!1;for(;i>=w&&c>=w&&S.get(c-w,i-w)&&y[0]<=h;)y[0]++,w++;if(y[0]>h)return!1;const A=S.getHeight(),P=S.getWidth();for(w=1;i+w<A&&c+w<P&&S.get(c+w,i+w);)y[2]++,w++;if(i+w>=A||c+w>=P)return!1;for(;i+w<A&&c+w<P&&!S.get(c+w,i+w)&&y[3]<h;)y[3]++,w++;if(i+w>=A||c+w>=P||y[3]>=h)return!1;for(;i+w<A&&c+w<P&&S.get(c+w,i+w)&&y[4]<h;)y[4]++,w++;if(y[4]>=h)return!1;const G=y[0]+y[1]+y[2]+y[3]+y[4];return Math.abs(G-x)<2*x&&ja.foundPatternCross(y)}crossCheckVertical(i,c,h,x){const y=this.image,w=y.getHeight(),S=this.getCrossCheckStateCount();let A=i;for(;A>=0&&y.get(c,A);)S[2]++,A--;if(A<0)return NaN;for(;A>=0&&!y.get(c,A)&&S[1]<=h;)S[1]++,A--;if(A<0||S[1]>h)return NaN;for(;A>=0&&y.get(c,A)&&S[0]<=h;)S[0]++,A--;if(S[0]>h)return NaN;for(A=i+1;A<w&&y.get(c,A);)S[2]++,A++;if(A===w)return NaN;for(;A<w&&!y.get(c,A)&&S[3]<h;)S[3]++,A++;if(A===w||S[3]>=h)return NaN;for(;A<w&&y.get(c,A)&&S[4]<h;)S[4]++,A++;if(S[4]>=h)return NaN;const P=S[0]+S[1]+S[2]+S[3]+S[4];return 5*Math.abs(P-x)>=2*x?NaN:ja.foundPatternCross(S)?ja.centerFromEnd(S,A):NaN}crossCheckHorizontal(i,c,h,x){const y=this.image,w=y.getWidth(),S=this.getCrossCheckStateCount();let A=i;for(;A>=0&&y.get(A,c);)S[2]++,A--;if(A<0)return NaN;for(;A>=0&&!y.get(A,c)&&S[1]<=h;)S[1]++,A--;if(A<0||S[1]>h)return NaN;for(;A>=0&&y.get(A,c)&&S[0]<=h;)S[0]++,A--;if(S[0]>h)return NaN;for(A=i+1;A<w&&y.get(A,c);)S[2]++,A++;if(A===w)return NaN;for(;A<w&&!y.get(A,c)&&S[3]<h;)S[3]++,A++;if(A===w||S[3]>=h)return NaN;for(;A<w&&y.get(A,c)&&S[4]<h;)S[4]++,A++;if(S[4]>=h)return NaN;const P=S[0]+S[1]+S[2]+S[3]+S[4];return 5*Math.abs(P-x)>=x?NaN:ja.foundPatternCross(S)?ja.centerFromEnd(S,A):NaN}handlePossibleCenter(i,c,h,x){const y=i[0]+i[1]+i[2]+i[3]+i[4];let w=ja.centerFromEnd(i,h),S=this.crossCheckVertical(c,Math.floor(w),i[2],y);if(!isNaN(S)&&(w=this.crossCheckHorizontal(Math.floor(w),Math.floor(S),i[2],y),!isNaN(w)&&(!x||this.crossCheckDiagonal(Math.floor(S),Math.floor(w),i[2],y)))){const A=y/7;let P=!1;const G=this.possibleCenters;for(let te=0,oe=G.length;te<oe;te++){const Ce=G[te];if(Ce.aboutEquals(A,S,w)){G[te]=Ce.combineEstimate(S,w,A),P=!0;break}}if(!P){const te=new eo(w,S,A);G.push(te),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(te)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let c=null;for(const h of this.possibleCenters)if(h.getCount()>=ja.CENTER_QUORUM)if(c==null)c=h;else return this.hasSkipped=!0,Math.floor((Math.abs(c.getX()-h.getX())-Math.abs(c.getY()-h.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let i=0,c=0;const h=this.possibleCenters.length;for(const w of this.possibleCenters)w.getCount()>=ja.CENTER_QUORUM&&(i++,c+=w.getEstimatedModuleSize());if(i<3)return!1;const x=c/h;let y=0;for(const w of this.possibleCenters)y+=Math.abs(w.getEstimatedModuleSize()-x);return y<=.05*c}selectBestPatterns(){const i=this.possibleCenters.length;if(i<3)throw new ue;const c=this.possibleCenters;let h;if(i>3){let x=0,y=0;for(const A of this.possibleCenters){const P=A.getEstimatedModuleSize();x+=P,y+=P*P}h=x/i;let w=Math.sqrt(y/i-h*h);c.sort((A,P)=>{const G=Math.abs(P.getEstimatedModuleSize()-h),te=Math.abs(A.getEstimatedModuleSize()-h);return G<te?-1:G>te?1:0});const S=Math.max(.2*h,w);for(let A=0;A<c.length&&c.length>3;A++){const P=c[A];Math.abs(P.getEstimatedModuleSize()-h)>S&&(c.splice(A,1),A--)}}if(c.length>3){let x=0;for(const y of c)x+=y.getEstimatedModuleSize();h=x/c.length,c.sort((y,w)=>{if(w.getCount()===y.getCount()){const S=Math.abs(w.getEstimatedModuleSize()-h),A=Math.abs(y.getEstimatedModuleSize()-h);return S<A?1:S>A?-1:0}else return w.getCount()-y.getCount()}),c.splice(3)}return[c[0],c[1],c[2]]}}ja.CENTER_QUORUM=2,ja.MIN_SKIP=3,ja.MAX_MODULES=57;class mr{constructor(i){this.image=i}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(i){this.resultPointCallback=i==null?null:i.get(ne.NEED_RESULT_POINT_CALLBACK);const h=new ja(this.image,this.resultPointCallback).find(i);return this.processFinderPatternInfo(h)}processFinderPatternInfo(i){const c=i.getTopLeft(),h=i.getTopRight(),x=i.getBottomLeft(),y=this.calculateModuleSize(c,h,x);if(y<1)throw new ue("No pattern found in proccess finder.");const w=mr.computeDimension(c,h,x,y),S=Gt.getProvisionalVersionForDimension(w),A=S.getDimensionForVersion()-7;let P=null;if(S.getAlignmentPatternCenters().length>0){const Ce=h.getX()-c.getX()+x.getX(),Ie=h.getY()-c.getY()+x.getY(),Pe=1-3/A,Ke=Math.floor(c.getX()+Pe*(Ce-c.getX())),it=Math.floor(c.getY()+Pe*(Ie-c.getY()));for(let Bt=4;Bt<=16;Bt<<=1)try{P=this.findAlignmentInRegion(y,Ke,it,Bt);break}catch(Pt){if(!(Pt instanceof ue))throw Pt}}const G=mr.createTransform(c,h,x,P,w),te=mr.sampleGrid(this.image,G,w);let oe;return P===null?oe=[x,c,h]:oe=[x,c,h,P],new Wt(te,oe)}static createTransform(i,c,h,x,y){const w=y-3.5;let S,A,P,G;return x!==null?(S=x.getX(),A=x.getY(),P=w-3,G=P):(S=c.getX()-i.getX()+h.getX(),A=c.getY()-i.getY()+h.getY(),P=w,G=w),At.quadrilateralToQuadrilateral(3.5,3.5,w,3.5,P,G,3.5,w,i.getX(),i.getY(),c.getX(),c.getY(),S,A,h.getX(),h.getY())}static sampleGrid(i,c,h){return cr.getInstance().sampleGridWithTransform(i,h,h,c)}static computeDimension(i,c,h,x){const y=Le.round(tt.distance(i,c)/x),w=Le.round(tt.distance(i,h)/x);let S=Math.floor((y+w)/2)+7;switch(S&3){case 0:S++;break;case 2:S--;break;case 3:throw new ue("Dimensions could be not found.")}return S}calculateModuleSize(i,c,h){return(this.calculateModuleSizeOneWay(i,c)+this.calculateModuleSizeOneWay(i,h))/2}calculateModuleSizeOneWay(i,c){const h=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(i.getX()),Math.floor(i.getY()),Math.floor(c.getX()),Math.floor(c.getY())),x=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(c.getX()),Math.floor(c.getY()),Math.floor(i.getX()),Math.floor(i.getY()));return isNaN(h)?x/7:isNaN(x)?h/7:(h+x)/14}sizeOfBlackWhiteBlackRunBothWays(i,c,h,x){let y=this.sizeOfBlackWhiteBlackRun(i,c,h,x),w=1,S=i-(h-i);S<0?(w=i/(i-S),S=0):S>=this.image.getWidth()&&(w=(this.image.getWidth()-1-i)/(S-i),S=this.image.getWidth()-1);let A=Math.floor(c-(x-c)*w);return w=1,A<0?(w=c/(c-A),A=0):A>=this.image.getHeight()&&(w=(this.image.getHeight()-1-c)/(A-c),A=this.image.getHeight()-1),S=Math.floor(i+(S-i)*w),y+=this.sizeOfBlackWhiteBlackRun(i,c,S,A),y-1}sizeOfBlackWhiteBlackRun(i,c,h,x){const y=Math.abs(x-c)>Math.abs(h-i);if(y){let Ce=i;i=c,c=Ce,Ce=h,h=x,x=Ce}const w=Math.abs(h-i),S=Math.abs(x-c);let A=-w/2;const P=i<h?1:-1,G=c<x?1:-1;let te=0;const oe=h+P;for(let Ce=i,Ie=c;Ce!==oe;Ce+=P){const Pe=y?Ie:Ce,Ke=y?Ce:Ie;if(te===1===this.image.get(Pe,Ke)){if(te===2)return Le.distance(Ce,Ie,i,c);te++}if(A+=S,A>0){if(Ie===x)break;Ie+=G,A-=w}}return te===2?Le.distance(h+P,x,i,c):NaN}findAlignmentInRegion(i,c,h,x){const y=Math.floor(x*i),w=Math.max(0,c-y),S=Math.min(this.image.getWidth()-1,c+y);if(S-w<i*3)throw new ue("Alignment top exceeds estimated module size.");const A=Math.max(0,h-y),P=Math.min(this.image.getHeight()-1,h+y);if(P-A<i*3)throw new ue("Alignment bottom exceeds estimated module size.");return new wn(this.image,w,A,S-w,P-A,i,this.resultPointCallback).find()}}class Za{constructor(){this.decoder=new Ll}getDecoder(){return this.decoder}decode(i,c){let h,x;if(c!=null&&c.get(ne.PURE_BARCODE)!==void 0){const A=Za.extractPureBits(i.getBlackMatrix());h=this.decoder.decodeBitMatrix(A,c),x=Za.NO_POINTS}else{const A=new mr(i.getBlackMatrix()).detect(c);h=this.decoder.decodeBitMatrix(A.getBits(),c),x=A.getPoints()}h.getOther()instanceof bo&&h.getOther().applyMirroredCorrection(x);const y=new se(h.getText(),h.getRawBytes(),void 0,x,pe.QR_CODE,void 0),w=h.getByteSegments();w!==null&&y.putMetadata(Fe.BYTE_SEGMENTS,w);const S=h.getECLevel();return S!==null&&y.putMetadata(Fe.ERROR_CORRECTION_LEVEL,S),h.hasStructuredAppend()&&(y.putMetadata(Fe.STRUCTURED_APPEND_SEQUENCE,h.getStructuredAppendSequenceNumber()),y.putMetadata(Fe.STRUCTURED_APPEND_PARITY,h.getStructuredAppendParity())),y}reset(){}static extractPureBits(i){const c=i.getTopLeftOnBit(),h=i.getBottomRightOnBit();if(c===null||h===null)throw new ue;const x=this.moduleSize(c,i);let y=c[1],w=h[1],S=c[0],A=h[0];if(S>=A||y>=w)throw new ue;if(w-y!==A-S&&(A=S+(w-y),A>=i.getWidth()))throw new ue;const P=Math.round((A-S+1)/x),G=Math.round((w-y+1)/x);if(P<=0||G<=0)throw new ue;if(G!==P)throw new ue;const te=Math.floor(x/2);y+=te,S+=te;const oe=S+Math.floor((P-1)*x)-A;if(oe>0){if(oe>te)throw new ue;S-=oe}const Ce=y+Math.floor((G-1)*x)-w;if(Ce>0){if(Ce>te)throw new ue;y-=Ce}const Ie=new Oe(P,G);for(let Pe=0;Pe<G;Pe++){const Ke=y+Math.floor(Pe*x);for(let it=0;it<P;it++)i.get(S+Math.floor(it*x),Ke)&&Ie.set(it,Pe)}return Ie}static moduleSize(i,c){const h=c.getHeight(),x=c.getWidth();let y=i[0],w=i[1],S=!0,A=0;for(;y<x&&w<h;){if(S!==c.get(y,w)){if(++A===5)break;S=!S}y++,w++}if(y===x||w===h)throw new ue;return(y-i[0])/7}}Za.NO_POINTS=new Array;class qt{PDF417Common(){}static getBitCountSum(i){return Le.sum(i)}static toIntArray(i){if(i==null||!i.length)return qt.EMPTY_INT_ARRAY;const c=new Int32Array(i.length);let h=0;for(const x of i)c[h++]=x;return c}static getCodeword(i){const c=B.binarySearch(qt.SYMBOL_TABLE,i&262143);return c<0?-1:(qt.CODEWORD_TABLE[c]-1)%qt.NUMBER_OF_CODEWORDS}}qt.NUMBER_OF_CODEWORDS=929,qt.MAX_CODEWORDS_IN_BARCODE=qt.NUMBER_OF_CODEWORDS-1,qt.MIN_ROWS_IN_BARCODE=3,qt.MAX_ROWS_IN_BARCODE=90,qt.MODULES_IN_CODEWORD=17,qt.MODULES_IN_STOP_PATTERN=18,qt.BARS_IN_MODULE=8,qt.EMPTY_INT_ARRAY=new Int32Array([]),qt.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),qt.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class Pl{constructor(i,c){this.bits=i,this.points=c}getBits(){return this.bits}getPoints(){return this.points}}class _r{static detectMultiple(i,c,h){let x=i.getBlackMatrix(),y=_r.detect(h,x);return y.length||(x=x.clone(),x.rotate180(),y=_r.detect(h,x)),new Pl(x,y)}static detect(i,c){const h=new Array;let x=0,y=0,w=!1;for(;x<c.getHeight();){const S=_r.findVertices(c,x,y);if(S[0]==null&&S[3]==null){if(!w)break;w=!1,y=0;for(const A of h)A[1]!=null&&(x=Math.trunc(Math.max(x,A[1].getY()))),A[3]!=null&&(x=Math.max(x,Math.trunc(A[3].getY())));x+=_r.ROW_STEP;continue}if(w=!0,h.push(S),!i)break;S[2]!=null?(y=Math.trunc(S[2].getX()),x=Math.trunc(S[2].getY())):(y=Math.trunc(S[4].getX()),x=Math.trunc(S[4].getY()))}return h}static findVertices(i,c,h){const x=i.getHeight(),y=i.getWidth(),w=new Array(8);return _r.copyToResult(w,_r.findRowsWithPattern(i,x,y,c,h,_r.START_PATTERN),_r.INDEXES_START_PATTERN),w[4]!=null&&(h=Math.trunc(w[4].getX()),c=Math.trunc(w[4].getY())),_r.copyToResult(w,_r.findRowsWithPattern(i,x,y,c,h,_r.STOP_PATTERN),_r.INDEXES_STOP_PATTERN),w}static copyToResult(i,c,h){for(let x=0;x<h.length;x++)i[h[x]]=c[x]}static findRowsWithPattern(i,c,h,x,y,w){const S=new Array(4);let A=!1;const P=new Int32Array(w.length);for(;x<c;x+=_r.ROW_STEP){let te=_r.findGuardPattern(i,y,x,h,!1,w,P);if(te!=null){for(;x>0;){const oe=_r.findGuardPattern(i,y,--x,h,!1,w,P);if(oe!=null)te=oe;else{x++;break}}S[0]=new tt(te[0],x),S[1]=new tt(te[1],x),A=!0;break}}let G=x+1;if(A){let te=0,oe=Int32Array.from([Math.trunc(S[0].getX()),Math.trunc(S[1].getX())]);for(;G<c;G++){const Ce=_r.findGuardPattern(i,oe[0],G,h,!1,w,P);if(Ce!=null&&Math.abs(oe[0]-Ce[0])<_r.MAX_PATTERN_DRIFT&&Math.abs(oe[1]-Ce[1])<_r.MAX_PATTERN_DRIFT)oe=Ce,te=0;else{if(te>_r.SKIPPED_ROW_COUNT_MAX)break;te++}}G-=te+1,S[2]=new tt(oe[0],G),S[3]=new tt(oe[1],G)}return G-x<_r.BARCODE_MIN_HEIGHT&&B.fill(S,null),S}static findGuardPattern(i,c,h,x,y,w,S){B.fillWithin(S,0,S.length,0);let A=c,P=0;for(;i.get(A,h)&&A>0&&P++<_r.MAX_PIXEL_DRIFT;)A--;let G=A,te=0,oe=w.length;for(let Ce=y;G<x;G++)if(i.get(G,h)!==Ce)S[te]++;else{if(te===oe-1){if(_r.patternMatchVariance(S,w,_r.MAX_INDIVIDUAL_VARIANCE)<_r.MAX_AVG_VARIANCE)return new Int32Array([A,G]);A+=S[0]+S[1],M.arraycopy(S,2,S,0,te-1),S[te-1]=0,S[te]=0,te--}else te++;S[te]=1,Ce=!Ce}return te===oe-1&&_r.patternMatchVariance(S,w,_r.MAX_INDIVIDUAL_VARIANCE)<_r.MAX_AVG_VARIANCE?new Int32Array([A,G-1]):null}static patternMatchVariance(i,c,h){let x=i.length,y=0,w=0;for(let P=0;P<x;P++)y+=i[P],w+=c[P];if(y<w)return 1/0;let S=y/w;h*=S;let A=0;for(let P=0;P<x;P++){let G=i[P],te=c[P]*S,oe=G>te?G-te:te-G;if(oe>h)return 1/0;A+=oe}return A/y}}_r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),_r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),_r.MAX_AVG_VARIANCE=.42,_r.MAX_INDIVIDUAL_VARIANCE=.8,_r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),_r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),_r.MAX_PIXEL_DRIFT=3,_r.MAX_PATTERN_DRIFT=5,_r.SKIPPED_ROW_COUNT_MAX=25,_r.ROW_STEP=5,_r.BARCODE_MIN_HEIGHT=10;class ua{constructor(i,c){if(c.length===0)throw new N;this.field=i;let h=c.length;if(h>1&&c[0]===0){let x=1;for(;x<h&&c[x]===0;)x++;x===h?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(h-x),M.arraycopy(c,x,this.coefficients,0,this.coefficients.length))}else this.coefficients=c}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(i){return this.coefficients[this.coefficients.length-1-i]}evaluateAt(i){if(i===0)return this.getCoefficient(0);if(i===1){let x=0;for(let y of this.coefficients)x=this.field.add(x,y);return x}let c=this.coefficients[0],h=this.coefficients.length;for(let x=1;x<h;x++)c=this.field.add(this.field.multiply(i,c),this.coefficients[x]);return c}add(i){if(!this.field.equals(i.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero())return i;if(i.isZero())return this;let c=this.coefficients,h=i.coefficients;if(c.length>h.length){let w=c;c=h,h=w}let x=new Int32Array(h.length),y=h.length-c.length;M.arraycopy(h,0,x,0,y);for(let w=y;w<h.length;w++)x[w]=this.field.add(c[w-y],h[w]);return new ua(this.field,x)}subtract(i){if(!this.field.equals(i.field))throw new N("ModulusPolys do not have same ModulusGF field");return i.isZero()?this:this.add(i.negative())}multiply(i){return i instanceof ua?this.multiplyOther(i):this.multiplyScalar(i)}multiplyOther(i){if(!this.field.equals(i.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero()||i.isZero())return new ua(this.field,new Int32Array([0]));let c=this.coefficients,h=c.length,x=i.coefficients,y=x.length,w=new Int32Array(h+y-1);for(let S=0;S<h;S++){let A=c[S];for(let P=0;P<y;P++)w[S+P]=this.field.add(w[S+P],this.field.multiply(A,x[P]))}return new ua(this.field,w)}negative(){let i=this.coefficients.length,c=new Int32Array(i);for(let h=0;h<i;h++)c[h]=this.field.subtract(0,this.coefficients[h]);return new ua(this.field,c)}multiplyScalar(i){if(i===0)return new ua(this.field,new Int32Array([0]));if(i===1)return this;let c=this.coefficients.length,h=new Int32Array(c);for(let x=0;x<c;x++)h[x]=this.field.multiply(this.coefficients[x],i);return new ua(this.field,h)}multiplyByMonomial(i,c){if(i<0)throw new N;if(c===0)return new ua(this.field,new Int32Array([0]));let h=this.coefficients.length,x=new Int32Array(h+i);for(let y=0;y<h;y++)x[y]=this.field.multiply(this.coefficients[y],c);return new ua(this.field,x)}toString(){let i=new Se;for(let c=this.getDegree();c>=0;c--){let h=this.getCoefficient(c);h!==0&&(h<0?(i.append(" - "),h=-h):i.length()>0&&i.append(" + "),(c===0||h!==1)&&i.append(h),c!==0&&(c===1?i.append("x"):(i.append("x^"),i.append(c))))}return i.toString()}}class _o{add(i,c){return(i+c)%this.modulus}subtract(i,c){return(this.modulus+i-c)%this.modulus}exp(i){return this.expTable[i]}log(i){if(i===0)throw new N;return this.logTable[i]}inverse(i){if(i===0)throw new zt;return this.expTable[this.modulus-this.logTable[i]-1]}multiply(i,c){return i===0||c===0?0:this.expTable[(this.logTable[i]+this.logTable[c])%(this.modulus-1)]}getSize(){return this.modulus}equals(i){return i===this}}class Hn extends _o{constructor(i,c){super(),this.modulus=i,this.expTable=new Int32Array(i),this.logTable=new Int32Array(i);let h=1;for(let x=0;x<i;x++)this.expTable[x]=h,h=h*c%i;for(let x=0;x<i-1;x++)this.logTable[this.expTable[x]]=x;this.zero=new ua(this,new Int32Array([0])),this.one=new ua(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(i,c){if(i<0)throw new N;if(c===0)return this.zero;let h=new Int32Array(i+1);return h[0]=c,new ua(this,h)}}Hn.PDF417_GF=new Hn(qt.NUMBER_OF_CODEWORDS,3);class ps{constructor(){this.field=Hn.PDF417_GF}decode(i,c,h){let x=new ua(this.field,i),y=new Int32Array(c),w=!1;for(let Ie=c;Ie>0;Ie--){let Pe=x.evaluateAt(this.field.exp(Ie));y[c-Ie]=Pe,Pe!==0&&(w=!0)}if(!w)return 0;let S=this.field.getOne();if(h!=null)for(const Ie of h){let Pe=this.field.exp(i.length-1-Ie),Ke=new ua(this.field,new Int32Array([this.field.subtract(0,Pe),1]));S=S.multiply(Ke)}let A=new ua(this.field,y),P=this.runEuclideanAlgorithm(this.field.buildMonomial(c,1),A,c),G=P[0],te=P[1],oe=this.findErrorLocations(G),Ce=this.findErrorMagnitudes(te,G,oe);for(let Ie=0;Ie<oe.length;Ie++){let Pe=i.length-1-this.field.log(oe[Ie]);if(Pe<0)throw O.getChecksumInstance();i[Pe]=this.field.subtract(i[Pe],Ce[Ie])}return oe.length}runEuclideanAlgorithm(i,c,h){if(i.getDegree()<c.getDegree()){let oe=i;i=c,c=oe}let x=i,y=c,w=this.field.getZero(),S=this.field.getOne();for(;y.getDegree()>=Math.round(h/2);){let oe=x,Ce=w;if(x=y,w=S,x.isZero())throw O.getChecksumInstance();y=oe;let Ie=this.field.getZero(),Pe=x.getCoefficient(x.getDegree()),Ke=this.field.inverse(Pe);for(;y.getDegree()>=x.getDegree()&&!y.isZero();){let it=y.getDegree()-x.getDegree(),Bt=this.field.multiply(y.getCoefficient(y.getDegree()),Ke);Ie=Ie.add(this.field.buildMonomial(it,Bt)),y=y.subtract(x.multiplyByMonomial(it,Bt))}S=Ie.multiply(w).subtract(Ce).negative()}let A=S.getCoefficient(0);if(A===0)throw O.getChecksumInstance();let P=this.field.inverse(A),G=S.multiply(P),te=y.multiply(P);return[G,te]}findErrorLocations(i){let c=i.getDegree(),h=new Int32Array(c),x=0;for(let y=1;y<this.field.getSize()&&x<c;y++)i.evaluateAt(y)===0&&(h[x]=this.field.inverse(y),x++);if(x!==c)throw O.getChecksumInstance();return h}findErrorMagnitudes(i,c,h){let x=c.getDegree(),y=new Int32Array(x);for(let P=1;P<=x;P++)y[x-P]=this.field.multiply(P,c.getCoefficient(P));let w=new ua(this.field,y),S=h.length,A=new Int32Array(S);for(let P=0;P<S;P++){let G=this.field.inverse(h[P]),te=this.field.subtract(0,i.evaluateAt(G)),oe=this.field.inverse(w.evaluateAt(G));A[P]=this.field.multiply(te,oe)}return A}}class Wn{constructor(i,c,h,x,y){i instanceof Wn?this.constructor_2(i):this.constructor_1(i,c,h,x,y)}constructor_1(i,c,h,x,y){const w=c==null||h==null,S=x==null||y==null;if(w&&S)throw new ue;w?(c=new tt(0,x.getY()),h=new tt(0,y.getY())):S&&(x=new tt(i.getWidth()-1,c.getY()),y=new tt(i.getWidth()-1,h.getY())),this.image=i,this.topLeft=c,this.bottomLeft=h,this.topRight=x,this.bottomRight=y,this.minX=Math.trunc(Math.min(c.getX(),h.getX())),this.maxX=Math.trunc(Math.max(x.getX(),y.getX())),this.minY=Math.trunc(Math.min(c.getY(),x.getY())),this.maxY=Math.trunc(Math.max(h.getY(),y.getY()))}constructor_2(i){this.image=i.image,this.topLeft=i.getTopLeft(),this.bottomLeft=i.getBottomLeft(),this.topRight=i.getTopRight(),this.bottomRight=i.getBottomRight(),this.minX=i.getMinX(),this.maxX=i.getMaxX(),this.minY=i.getMinY(),this.maxY=i.getMaxY()}static merge(i,c){return i==null?c:c==null?i:new Wn(i.image,i.topLeft,i.bottomLeft,c.topRight,c.bottomRight)}addMissingRows(i,c,h){let x=this.topLeft,y=this.bottomLeft,w=this.topRight,S=this.bottomRight;if(i>0){let A=h?this.topLeft:this.topRight,P=Math.trunc(A.getY()-i);P<0&&(P=0);let G=new tt(A.getX(),P);h?x=G:w=G}if(c>0){let A=h?this.bottomLeft:this.bottomRight,P=Math.trunc(A.getY()+c);P>=this.image.getHeight()&&(P=this.image.getHeight()-1);let G=new tt(A.getX(),P);h?y=G:S=G}return new Wn(this.image,x,y,w,S)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Fa{constructor(i,c,h,x){this.columnCount=i,this.errorCorrectionLevel=x,this.rowCountUpperPart=c,this.rowCountLowerPart=h,this.rowCount=c+h}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class ns{constructor(){this.buffer=""}static form(i,c){let h=-1;function x(w,S,A,P,G,te){if(w==="%%")return"%";if(c[++h]===void 0)return;w=P?parseInt(P.substr(1)):void 0;let oe=G?parseInt(G.substr(1)):void 0,Ce;switch(te){case"s":Ce=c[h];break;case"c":Ce=c[h][0];break;case"f":Ce=parseFloat(c[h]).toFixed(w);break;case"p":Ce=parseFloat(c[h]).toPrecision(w);break;case"e":Ce=parseFloat(c[h]).toExponential(w);break;case"x":Ce=parseInt(c[h]).toString(oe||16);break;case"d":Ce=parseFloat(parseInt(c[h],oe||10).toPrecision(w)).toFixed(0);break}Ce=typeof Ce=="object"?JSON.stringify(Ce):(+Ce).toString(oe);let Ie=parseInt(A),Pe=A&&A[0]+""=="0"?"0":" ";for(;Ce.length<Ie;)Ce=S!==void 0?Ce+Pe:Pe+Ce;return Ce}let y=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return i.replace(y,x)}format(i,...c){this.buffer+=ns.form(i,c)}toString(){return this.buffer}}class Zs{constructor(i){this.boundingBox=new Wn(i),this.codewords=new Array(i.getMaxY()-i.getMinY()+1)}getCodewordNearby(i){let c=this.getCodeword(i);if(c!=null)return c;for(let h=1;h<Zs.MAX_NEARBY_DISTANCE;h++){let x=this.imageRowToCodewordIndex(i)-h;if(x>=0&&(c=this.codewords[x],c!=null)||(x=this.imageRowToCodewordIndex(i)+h,x<this.codewords.length&&(c=this.codewords[x],c!=null)))return c}return null}imageRowToCodewordIndex(i){return i-this.boundingBox.getMinY()}setCodeword(i,c){this.codewords[this.imageRowToCodewordIndex(i)]=c}getCodeword(i){return this.codewords[this.imageRowToCodewordIndex(i)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const i=new ns;let c=0;for(const h of this.codewords){if(h==null){i.format("%3d: | %n",c++);continue}i.format("%3d: %3d|%3d%n",c++,h.getRowNumber(),h.getValue())}return i.toString()}}Zs.MAX_NEARBY_DISTANCE=5;class $s{constructor(){this.values=new Map}setValue(i){i=Math.trunc(i);let c=this.values.get(i);c==null&&(c=0),c++,this.values.set(i,c)}getValue(){let i=-1,c=new Array;for(const[h,x]of this.values.entries()){const y={getKey:()=>h,getValue:()=>x};y.getValue()>i?(i=y.getValue(),c=[],c.push(y.getKey())):y.getValue()===i&&c.push(y.getKey())}return qt.toIntArray(c)}getConfidence(i){return this.values.get(i)}}class Fl extends Zs{constructor(i,c){super(i),this._isLeft=c}setRowNumbers(){for(let i of this.getCodewords())i!=null&&i.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(i){let c=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(c,i);let h=this.getBoundingBox(),x=this._isLeft?h.getTopLeft():h.getTopRight(),y=this._isLeft?h.getBottomLeft():h.getBottomRight(),w=this.imageRowToCodewordIndex(Math.trunc(x.getY())),S=this.imageRowToCodewordIndex(Math.trunc(y.getY())),A=-1,P=1,G=0;for(let te=w;te<S;te++){if(c[te]==null)continue;let oe=c[te],Ce=oe.getRowNumber()-A;if(Ce===0)G++;else if(Ce===1)P=Math.max(P,G),G=1,A=oe.getRowNumber();else if(Ce<0||oe.getRowNumber()>=i.getRowCount()||Ce>te)c[te]=null;else{let Ie;P>2?Ie=(P-2)*Ce:Ie=Ce;let Pe=Ie>=te;for(let Ke=1;Ke<=Ie&&!Pe;Ke++)Pe=c[te-Ke]!=null;Pe?c[te]=null:(A=oe.getRowNumber(),G=1)}}}getRowHeights(){let i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);let c=new Int32Array(i.getRowCount());for(let h of this.getCodewords())if(h!=null){let x=h.getRowNumber();if(x>=c.length)continue;c[x]++}return c}adjustIncompleteIndicatorColumnRowNumbers(i){let c=this.getBoundingBox(),h=this._isLeft?c.getTopLeft():c.getTopRight(),x=this._isLeft?c.getBottomLeft():c.getBottomRight(),y=this.imageRowToCodewordIndex(Math.trunc(h.getY())),w=this.imageRowToCodewordIndex(Math.trunc(x.getY())),S=this.getCodewords(),A=-1;for(let P=y;P<w;P++){if(S[P]==null)continue;let G=S[P];G.setRowNumberAsRowIndicatorColumn();let te=G.getRowNumber()-A;te===0||(te===1?A=G.getRowNumber():G.getRowNumber()>=i.getRowCount()?S[P]=null:A=G.getRowNumber())}}getBarcodeMetadata(){let i=this.getCodewords(),c=new $s,h=new $s,x=new $s,y=new $s;for(let S of i){if(S==null)continue;S.setRowNumberAsRowIndicatorColumn();let A=S.getValue()%30,P=S.getRowNumber();switch(this._isLeft||(P+=2),P%3){case 0:h.setValue(A*3+1);break;case 1:y.setValue(A/3),x.setValue(A%3);break;case 2:c.setValue(A+1);break}}if(c.getValue().length===0||h.getValue().length===0||x.getValue().length===0||y.getValue().length===0||c.getValue()[0]<1||h.getValue()[0]+x.getValue()[0]<qt.MIN_ROWS_IN_BARCODE||h.getValue()[0]+x.getValue()[0]>qt.MAX_ROWS_IN_BARCODE)return null;let w=new Fa(c.getValue()[0],h.getValue()[0],x.getValue()[0],y.getValue()[0]);return this.removeIncorrectCodewords(i,w),w}removeIncorrectCodewords(i,c){for(let h=0;h<i.length;h++){let x=i[h];if(i[h]==null)continue;let y=x.getValue()%30,w=x.getRowNumber();if(w>c.getRowCount()){i[h]=null;continue}switch(this._isLeft||(w+=2),w%3){case 0:y*3+1!==c.getRowCountUpperPart()&&(i[h]=null);break;case 1:(Math.trunc(y/3)!==c.getErrorCorrectionLevel()||y%3!==c.getRowCountLowerPart())&&(i[h]=null);break;case 2:y+1!==c.getColumnCount()&&(i[h]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
`+super.toString()}}class Va{constructor(i,c){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=i,this.barcodeColumnCount=i.getColumnCount(),this.boundingBox=c,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let i=qt.MAX_CODEWORDS_IN_BARCODE,c;do c=i,i=this.adjustRowNumbersAndGetCount();while(i>0&&i<c);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(i){i!=null&&i.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let i=this.adjustRowNumbersByRow();if(i===0)return 0;for(let c=1;c<this.barcodeColumnCount+1;c++){let h=this.detectionResultColumns[c].getCodewords();for(let x=0;x<h.length;x++)h[x]!=null&&(h[x].hasValidRowNumber()||this.adjustRowNumbers(c,x,h))}return i}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let i=this.detectionResultColumns[0].getCodewords(),c=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let h=0;h<i.length;h++)if(i[h]!=null&&c[h]!=null&&i[h].getRowNumber()===c[h].getRowNumber())for(let x=1;x<=this.barcodeColumnCount;x++){let y=this.detectionResultColumns[x].getCodewords()[h];y!=null&&(y.setRowNumber(i[h].getRowNumber()),y.hasValidRowNumber()||(this.detectionResultColumns[x].getCodewords()[h]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let i=0,c=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let h=0;h<c.length;h++){if(c[h]==null)continue;let x=c[h].getRowNumber(),y=0;for(let w=this.barcodeColumnCount+1;w>0&&y<this.ADJUST_ROW_NUMBER_SKIP;w--){let S=this.detectionResultColumns[w].getCodewords()[h];S!=null&&(y=Va.adjustRowNumberIfValid(x,y,S),S.hasValidRowNumber()||i++)}}return i}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let i=0,c=this.detectionResultColumns[0].getCodewords();for(let h=0;h<c.length;h++){if(c[h]==null)continue;let x=c[h].getRowNumber(),y=0;for(let w=1;w<this.barcodeColumnCount+1&&y<this.ADJUST_ROW_NUMBER_SKIP;w++){let S=this.detectionResultColumns[w].getCodewords()[h];S!=null&&(y=Va.adjustRowNumberIfValid(x,y,S),S.hasValidRowNumber()||i++)}}return i}static adjustRowNumberIfValid(i,c,h){return h==null||h.hasValidRowNumber()||(h.isValidRowNumber(i)?(h.setRowNumber(i),c=0):++c),c}adjustRowNumbers(i,c,h){if(!this.detectionResultColumns[i-1])return;let x=h[c],y=this.detectionResultColumns[i-1].getCodewords(),w=y;this.detectionResultColumns[i+1]!=null&&(w=this.detectionResultColumns[i+1].getCodewords());let S=new Array(14);S[2]=y[c],S[3]=w[c],c>0&&(S[0]=h[c-1],S[4]=y[c-1],S[5]=w[c-1]),c>1&&(S[8]=h[c-2],S[10]=y[c-2],S[11]=w[c-2]),c<h.length-1&&(S[1]=h[c+1],S[6]=y[c+1],S[7]=w[c+1]),c<h.length-2&&(S[9]=h[c+2],S[12]=y[c+2],S[13]=w[c+2]);for(let A of S)if(Va.adjustRowNumber(x,A))return}static adjustRowNumber(i,c){return c==null?!1:c.hasValidRowNumber()&&c.getBucket()===i.getBucket()?(i.setRowNumber(c.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(i){this.boundingBox=i}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(i,c){this.detectionResultColumns[i]=c}getDetectionResultColumn(i){return this.detectionResultColumns[i]}toString(){let i=this.detectionResultColumns[0];i==null&&(i=this.detectionResultColumns[this.barcodeColumnCount+1]);let c=new ns;for(let h=0;h<i.getCodewords().length;h++){c.format("CW %3d:",h);for(let x=0;x<this.barcodeColumnCount+2;x++){if(this.detectionResultColumns[x]==null){c.format(" | ");continue}let y=this.detectionResultColumns[x].getCodewords()[h];if(y==null){c.format(" | ");continue}c.format(" %3d|%3d",y.getRowNumber(),y.getValue())}c.format("%n")}return c.toString()}}class Vn{constructor(i,c,h,x){this.rowNumber=Vn.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(i),this.endX=Math.trunc(c),this.bucket=Math.trunc(h),this.value=Math.trunc(x)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(i){return i!==Vn.BARCODE_ROW_UNKNOWN&&this.bucket===i%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(i){this.rowNumber=i}toString(){return this.rowNumber+"|"+this.value}}Vn.BARCODE_ROW_UNKNOWN=-1;class sn{static initialize(){for(let i=0;i<qt.SYMBOL_TABLE.length;i++){let c=qt.SYMBOL_TABLE[i],h=c&1;for(let x=0;x<qt.BARS_IN_MODULE;x++){let y=0;for(;(c&1)===h;)y+=1,c>>=1;h=c&1,sn.RATIOS_TABLE[i]||(sn.RATIOS_TABLE[i]=new Array(qt.BARS_IN_MODULE)),sn.RATIOS_TABLE[i][qt.BARS_IN_MODULE-x-1]=Math.fround(y/qt.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(i){let c=sn.getDecodedCodewordValue(sn.sampleBitCounts(i));return c!==-1?c:sn.getClosestDecodedValue(i)}static sampleBitCounts(i){let c=Le.sum(i),h=new Int32Array(qt.BARS_IN_MODULE),x=0,y=0;for(let w=0;w<qt.MODULES_IN_CODEWORD;w++){let S=c/(2*qt.MODULES_IN_CODEWORD)+w*c/qt.MODULES_IN_CODEWORD;y+i[x]<=S&&(y+=i[x],x++),h[x]++}return h}static getDecodedCodewordValue(i){let c=sn.getBitValue(i);return qt.getCodeword(c)===-1?-1:c}static getBitValue(i){let c=0;for(let h=0;h<i.length;h++)for(let x=0;x<i[h];x++)c=c<<1|(h%2===0?1:0);return Math.trunc(c)}static getClosestDecodedValue(i){let c=Le.sum(i),h=new Array(qt.BARS_IN_MODULE);if(c>1)for(let w=0;w<h.length;w++)h[w]=Math.fround(i[w]/c);let x=ut.MAX_VALUE,y=-1;this.bSymbolTableReady||sn.initialize();for(let w=0;w<sn.RATIOS_TABLE.length;w++){let S=0,A=sn.RATIOS_TABLE[w];for(let P=0;P<qt.BARS_IN_MODULE;P++){let G=Math.fround(A[P]-h[P]);if(S+=Math.fround(G*G),S>=x)break}S<x&&(x=S,y=qt.SYMBOL_TABLE[w])}return y}}sn.bSymbolTableReady=!1,sn.RATIOS_TABLE=new Array(qt.SYMBOL_TABLE.length).map(ee=>new Array(qt.BARS_IN_MODULE));class ji{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(i){this.segmentIndex=i}getFileId(){return this.fileId}setFileId(i){this.fileId=i}getOptionalData(){return this.optionalData}setOptionalData(i){this.optionalData=i}isLastSegment(){return this.lastSegment}setLastSegment(i){this.lastSegment=i}getSegmentCount(){return this.segmentCount}setSegmentCount(i){this.segmentCount=i}getSender(){return this.sender||null}setSender(i){this.sender=i}getAddressee(){return this.addressee||null}setAddressee(i){this.addressee=i}getFileName(){return this.fileName}setFileName(i){this.fileName=i}getFileSize(){return this.fileSize}setFileSize(i){this.fileSize=i}getChecksum(){return this.checksum}setChecksum(i){this.checksum=i}getTimestamp(){return this.timestamp}setTimestamp(i){this.timestamp=i}}class Ur{static parseLong(i,c=void 0){return parseInt(i,c)}}class Qo extends p{}Qo.kind="NullPointerException";class Gn{writeBytes(i){this.writeBytesOffset(i,0,i.length)}writeBytesOffset(i,c,h){if(i==null)throw new Qo;if(c<0||c>i.length||h<0||c+h>i.length||c+h<0)throw new D;if(h===0)return;for(let x=0;x<h;x++)this.write(i[c+x])}flush(){}close(){}}class qs extends p{}class wo extends Gn{constructor(i=32){if(super(),this.count=0,i<0)throw new N("Negative initial size: "+i);this.buf=new Uint8Array(i)}ensureCapacity(i){i-this.buf.length>0&&this.grow(i)}grow(i){let h=this.buf.length<<1;if(h-i<0&&(h=i),h<0){if(i<0)throw new qs;h=U.MAX_VALUE}this.buf=B.copyOfUint8Array(this.buf,h)}write(i){this.ensureCapacity(this.count+1),this.buf[this.count]=i,this.count+=1}writeBytesOffset(i,c,h){if(c<0||c>i.length||h<0||c+h-i.length>0)throw new D;this.ensureCapacity(this.count+h),M.arraycopy(i,c,this.buf,this.count,h),this.count+=h}writeTo(i){i.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return B.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(i){return i?typeof i=="string"?this.toString_string(i):this.toString_number(i):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(i){return new String(this.buf).toString()}toString_number(i){return new String(this.buf).toString()}close(){}}var Jr;(function(ee){ee[ee.ALPHA=0]="ALPHA",ee[ee.LOWER=1]="LOWER",ee[ee.MIXED=2]="MIXED",ee[ee.PUNCT=3]="PUNCT",ee[ee.ALPHA_SHIFT=4]="ALPHA_SHIFT",ee[ee.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Jr||(Jr={}));function el(){if(typeof window!="undefined")return window.BigInt||null;if(typeof xf!="undefined")return xf.BigInt||null;if(typeof self!="undefined")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let tl;function Ks(ee){if(typeof tl=="undefined"&&(tl=el()),tl===null)throw new Error("BigInt is not supported!");return tl(ee)}function Bl(){let ee=[];ee[0]=Ks(1);let i=Ks(900);ee[1]=i;for(let c=2;c<16;c++)ee[c]=ee[c-1]*i;return ee}class lt{static decode(i,c){let h=new Se(""),x=Q.ISO8859_1;h.enableDecoding(x);let y=1,w=i[y++],S=new ji;for(;y<i[0];){switch(w){case lt.TEXT_COMPACTION_MODE_LATCH:y=lt.textCompaction(i,y,h);break;case lt.BYTE_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH_6:y=lt.byteCompaction(w,i,x,y,h);break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:h.append(i[y++]);break;case lt.NUMERIC_COMPACTION_MODE_LATCH:y=lt.numericCompaction(i,y,h);break;case lt.ECI_CHARSET:Q.getCharacterSetECIByValue(i[y++]);break;case lt.ECI_GENERAL_PURPOSE:y+=2;break;case lt.ECI_USER_DEFINED:y++;break;case lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:y=lt.decodeMacroBlock(i,y,S);break;case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case lt.MACRO_PDF417_TERMINATOR:throw new V;default:y--,y=lt.textCompaction(i,y,h);break}if(y<i.length)w=i[y++];else throw V.getFormatInstance()}if(h.length()===0)throw V.getFormatInstance();let A=new ft(null,h.toString(),null,c);return A.setOther(S),A}static decodeMacroBlock(i,c,h){if(c+lt.NUMBER_OF_SEQUENCE_CODEWORDS>i[0])throw V.getFormatInstance();let x=new Int32Array(lt.NUMBER_OF_SEQUENCE_CODEWORDS);for(let S=0;S<lt.NUMBER_OF_SEQUENCE_CODEWORDS;S++,c++)x[S]=i[c];h.setSegmentIndex(U.parseInt(lt.decodeBase900toBase10(x,lt.NUMBER_OF_SEQUENCE_CODEWORDS)));let y=new Se;c=lt.textCompaction(i,c,y),h.setFileId(y.toString());let w=-1;for(i[c]===lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(w=c+1);c<i[0];)switch(i[c]){case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(c++,i[c]){case lt.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let S=new Se;c=lt.textCompaction(i,c+1,S),h.setFileName(S.toString());break;case lt.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let A=new Se;c=lt.textCompaction(i,c+1,A),h.setSender(A.toString());break;case lt.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let P=new Se;c=lt.textCompaction(i,c+1,P),h.setAddressee(P.toString());break;case lt.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let G=new Se;c=lt.numericCompaction(i,c+1,G),h.setSegmentCount(U.parseInt(G.toString()));break;case lt.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let te=new Se;c=lt.numericCompaction(i,c+1,te),h.setTimestamp(Ur.parseLong(te.toString()));break;case lt.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let oe=new Se;c=lt.numericCompaction(i,c+1,oe),h.setChecksum(U.parseInt(oe.toString()));break;case lt.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let Ce=new Se;c=lt.numericCompaction(i,c+1,Ce),h.setFileSize(Ur.parseLong(Ce.toString()));break;default:throw V.getFormatInstance()}break;case lt.MACRO_PDF417_TERMINATOR:c++,h.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(w!==-1){let S=c-w;h.isLastSegment()&&S--,h.setOptionalData(B.copyOfRange(i,w,w+S))}return c}static textCompaction(i,c,h){let x=new Int32Array((i[0]-c)*2),y=new Int32Array((i[0]-c)*2),w=0,S=!1;for(;c<i[0]&&!S;){let A=i[c++];if(A<lt.TEXT_COMPACTION_MODE_LATCH)x[w]=A/30,x[w+1]=A%30,w+=2;else switch(A){case lt.TEXT_COMPACTION_MODE_LATCH:x[w++]=lt.TEXT_COMPACTION_MODE_LATCH;break;case lt.BYTE_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH_6:case lt.NUMERIC_COMPACTION_MODE_LATCH:case lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case lt.MACRO_PDF417_TERMINATOR:c--,S=!0;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x[w]=lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,A=i[c++],y[w]=A,w++;break}}return lt.decodeTextCompaction(x,y,w,h),c}static decodeTextCompaction(i,c,h,x){let y=Jr.ALPHA,w=Jr.ALPHA,S=0;for(;S<h;){let A=i[S],P="";switch(y){case Jr.ALPHA:if(A<26)P=String.fromCharCode(65+A);else switch(A){case 26:P=" ";break;case lt.LL:y=Jr.LOWER;break;case lt.ML:y=Jr.MIXED;break;case lt.PS:w=y,y=Jr.PUNCT_SHIFT;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x.append(c[S]);break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break;case Jr.LOWER:if(A<26)P=String.fromCharCode(97+A);else switch(A){case 26:P=" ";break;case lt.AS:w=y,y=Jr.ALPHA_SHIFT;break;case lt.ML:y=Jr.MIXED;break;case lt.PS:w=y,y=Jr.PUNCT_SHIFT;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x.append(c[S]);break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break;case Jr.MIXED:if(A<lt.PL)P=lt.MIXED_CHARS[A];else switch(A){case lt.PL:y=Jr.PUNCT;break;case 26:P=" ";break;case lt.LL:y=Jr.LOWER;break;case lt.AL:y=Jr.ALPHA;break;case lt.PS:w=y,y=Jr.PUNCT_SHIFT;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x.append(c[S]);break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break;case Jr.PUNCT:if(A<lt.PAL)P=lt.PUNCT_CHARS[A];else switch(A){case lt.PAL:y=Jr.ALPHA;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x.append(c[S]);break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break;case Jr.ALPHA_SHIFT:if(y=w,A<26)P=String.fromCharCode(65+A);else switch(A){case 26:P=" ";break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break;case Jr.PUNCT_SHIFT:if(y=w,A<lt.PAL)P=lt.PUNCT_CHARS[A];else switch(A){case lt.PAL:y=Jr.ALPHA;break;case lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:x.append(c[S]);break;case lt.TEXT_COMPACTION_MODE_LATCH:y=Jr.ALPHA;break}break}P!==""&&x.append(P),S++}}static byteCompaction(i,c,h,x,y){let w=new wo,S=0,A=0,P=!1;switch(i){case lt.BYTE_COMPACTION_MODE_LATCH:let G=new Int32Array(6),te=c[x++];for(;x<c[0]&&!P;)switch(G[S++]=te,A=900*A+te,te=c[x++],te){case lt.TEXT_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH:case lt.NUMERIC_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH_6:case lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case lt.MACRO_PDF417_TERMINATOR:x--,P=!0;break;default:if(S%5===0&&S>0){for(let oe=0;oe<6;++oe)w.write(Number(Ks(A)>>Ks(8*(5-oe))));A=0,S=0}break}x===c[0]&&te<lt.TEXT_COMPACTION_MODE_LATCH&&(G[S++]=te);for(let oe=0;oe<S;oe++)w.write(G[oe]);break;case lt.BYTE_COMPACTION_MODE_LATCH_6:for(;x<c[0]&&!P;){let oe=c[x++];if(oe<lt.TEXT_COMPACTION_MODE_LATCH)S++,A=900*A+oe;else switch(oe){case lt.TEXT_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH:case lt.NUMERIC_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH_6:case lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case lt.MACRO_PDF417_TERMINATOR:x--,P=!0;break}if(S%5===0&&S>0){for(let Ce=0;Ce<6;++Ce)w.write(Number(Ks(A)>>Ks(8*(5-Ce))));A=0,S=0}}break}return y.append(je.decode(w.toByteArray(),h)),x}static numericCompaction(i,c,h){let x=0,y=!1,w=new Int32Array(lt.MAX_NUMERIC_CODEWORDS);for(;c<i[0]&&!y;){let S=i[c++];if(c===i[0]&&(y=!0),S<lt.TEXT_COMPACTION_MODE_LATCH)w[x]=S,x++;else switch(S){case lt.TEXT_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH:case lt.BYTE_COMPACTION_MODE_LATCH_6:case lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case lt.MACRO_PDF417_TERMINATOR:c--,y=!0;break}(x%lt.MAX_NUMERIC_CODEWORDS===0||S===lt.NUMERIC_COMPACTION_MODE_LATCH||y)&&x>0&&(h.append(lt.decodeBase900toBase10(w,x)),x=0)}return c}static decodeBase900toBase10(i,c){let h=Ks(0);for(let y=0;y<c;y++)h+=lt.EXP900[c-y-1]*Ks(i[y]);let x=h.toString();if(x.charAt(0)!=="1")throw new V;return x.substring(1)}}lt.TEXT_COMPACTION_MODE_LATCH=900,lt.BYTE_COMPACTION_MODE_LATCH=901,lt.NUMERIC_COMPACTION_MODE_LATCH=902,lt.BYTE_COMPACTION_MODE_LATCH_6=924,lt.ECI_USER_DEFINED=925,lt.ECI_GENERAL_PURPOSE=926,lt.ECI_CHARSET=927,lt.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,lt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,lt.MACRO_PDF417_TERMINATOR=922,lt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,lt.MAX_NUMERIC_CODEWORDS=15,lt.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,lt.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,lt.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,lt.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,lt.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,lt.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,lt.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,lt.PL=25,lt.LL=27,lt.AS=27,lt.ML=28,lt.AL=28,lt.PS=29,lt.PAL=29,lt.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
-.$/"|*()?{}'`,lt.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",lt.EXP900=el()?Bl():[],lt.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Tr{constructor(){}static decode(i,c,h,x,y,w,S){let A=new Wn(i,c,h,x,y),P=null,G=null,te;for(let Ie=!0;;Ie=!1){if(c!=null&&(P=Tr.getRowIndicatorColumn(i,A,c,!0,w,S)),x!=null&&(G=Tr.getRowIndicatorColumn(i,A,x,!1,w,S)),te=Tr.merge(P,G),te==null)throw ue.getNotFoundInstance();let Pe=te.getBoundingBox();if(Ie&&Pe!=null&&(Pe.getMinY()<A.getMinY()||Pe.getMaxY()>A.getMaxY()))A=Pe;else break}te.setBoundingBox(A);let oe=te.getBarcodeColumnCount()+1;te.setDetectionResultColumn(0,P),te.setDetectionResultColumn(oe,G);let Ce=P!=null;for(let Ie=1;Ie<=oe;Ie++){let Pe=Ce?Ie:oe-Ie;if(te.getDetectionResultColumn(Pe)!==void 0)continue;let Ke;Pe===0||Pe===oe?Ke=new Fl(A,Pe===0):Ke=new Zs(A),te.setDetectionResultColumn(Pe,Ke);let it=-1,Bt=it;for(let Pt=A.getMinY();Pt<=A.getMaxY();Pt++){if(it=Tr.getStartColumn(te,Pe,Pt,Ce),it<0||it>A.getMaxX()){if(Bt===-1)continue;it=Bt}let Mt=Tr.detectCodeword(i,A.getMinX(),A.getMaxX(),Ce,it,Pt,w,S);Mt!=null&&(Ke.setCodeword(Pt,Mt),Bt=it,w=Math.min(w,Mt.getWidth()),S=Math.max(S,Mt.getWidth()))}}return Tr.createDecoderResult(te)}static merge(i,c){if(i==null&&c==null)return null;let h=Tr.getBarcodeMetadata(i,c);if(h==null)return null;let x=Wn.merge(Tr.adjustBoundingBox(i),Tr.adjustBoundingBox(c));return new Va(h,x)}static adjustBoundingBox(i){if(i==null)return null;let c=i.getRowHeights();if(c==null)return null;let h=Tr.getMax(c),x=0;for(let S of c)if(x+=h-S,S>0)break;let y=i.getCodewords();for(let S=0;x>0&&y[S]==null;S++)x--;let w=0;for(let S=c.length-1;S>=0&&(w+=h-c[S],!(c[S]>0));S--);for(let S=y.length-1;w>0&&y[S]==null;S--)w--;return i.getBoundingBox().addMissingRows(x,w,i.isLeft())}static getMax(i){let c=-1;for(let h of i)c=Math.max(c,h);return c}static getBarcodeMetadata(i,c){let h;if(i==null||(h=i.getBarcodeMetadata())==null)return c==null?null:c.getBarcodeMetadata();let x;return c==null||(x=c.getBarcodeMetadata())==null?h:h.getColumnCount()!==x.getColumnCount()&&h.getErrorCorrectionLevel()!==x.getErrorCorrectionLevel()&&h.getRowCount()!==x.getRowCount()?null:h}static getRowIndicatorColumn(i,c,h,x,y,w){let S=new Fl(c,x);for(let A=0;A<2;A++){let P=A===0?1:-1,G=Math.trunc(Math.trunc(h.getX()));for(let te=Math.trunc(Math.trunc(h.getY()));te<=c.getMaxY()&&te>=c.getMinY();te+=P){let oe=Tr.detectCodeword(i,0,i.getWidth(),x,G,te,y,w);oe!=null&&(S.setCodeword(te,oe),x?G=oe.getStartX():G=oe.getEndX())}}return S}static adjustCodewordCount(i,c){let h=c[0][1],x=h.getValue(),y=i.getBarcodeColumnCount()*i.getBarcodeRowCount()-Tr.getNumberOfECCodeWords(i.getBarcodeECLevel());if(x.length===0){if(y<1||y>qt.MAX_CODEWORDS_IN_BARCODE)throw ue.getNotFoundInstance();h.setValue(y)}else x[0]!==y&&h.setValue(y)}static createDecoderResult(i){let c=Tr.createBarcodeMatrix(i);Tr.adjustCodewordCount(i,c);let h=new Array,x=new Int32Array(i.getBarcodeRowCount()*i.getBarcodeColumnCount()),y=[],w=new Array;for(let A=0;A<i.getBarcodeRowCount();A++)for(let P=0;P<i.getBarcodeColumnCount();P++){let G=c[A][P+1].getValue(),te=A*i.getBarcodeColumnCount()+P;G.length===0?h.push(te):G.length===1?x[te]=G[0]:(w.push(te),y.push(G))}let S=new Array(y.length);for(let A=0;A<S.length;A++)S[A]=y[A];return Tr.createDecoderResultFromAmbiguousValues(i.getBarcodeECLevel(),x,qt.toIntArray(h),qt.toIntArray(w),S)}static createDecoderResultFromAmbiguousValues(i,c,h,x,y){let w=new Int32Array(x.length),S=100;for(;S-- >0;){for(let A=0;A<w.length;A++)c[x[A]]=y[A][w[A]];try{return Tr.decodeCodewords(c,i,h)}catch(A){if(!(A instanceof O))throw A}if(w.length===0)throw O.getChecksumInstance();for(let A=0;A<w.length;A++)if(w[A]<y[A].length-1){w[A]++;break}else if(w[A]=0,A===w.length-1)throw O.getChecksumInstance()}throw O.getChecksumInstance()}static createBarcodeMatrix(i){let c=Array.from({length:i.getBarcodeRowCount()},()=>new Array(i.getBarcodeColumnCount()+2));for(let x=0;x<c.length;x++)for(let y=0;y<c[x].length;y++)c[x][y]=new $s;let h=0;for(let x of i.getDetectionResultColumns()){if(x!=null){for(let y of x.getCodewords())if(y!=null){let w=y.getRowNumber();if(w>=0){if(w>=c.length)continue;c[w][h].setValue(y.getValue())}}}h++}return c}static isValidBarcodeColumn(i,c){return c>=0&&c<=i.getBarcodeColumnCount()+1}static getStartColumn(i,c,h,x){let y=x?1:-1,w=null;if(Tr.isValidBarcodeColumn(i,c-y)&&(w=i.getDetectionResultColumn(c-y).getCodeword(h)),w!=null)return x?w.getEndX():w.getStartX();if(w=i.getDetectionResultColumn(c).getCodewordNearby(h),w!=null)return x?w.getStartX():w.getEndX();if(Tr.isValidBarcodeColumn(i,c-y)&&(w=i.getDetectionResultColumn(c-y).getCodewordNearby(h)),w!=null)return x?w.getEndX():w.getStartX();let S=0;for(;Tr.isValidBarcodeColumn(i,c-y);){c-=y;for(let A of i.getDetectionResultColumn(c).getCodewords())if(A!=null)return(x?A.getEndX():A.getStartX())+y*S*(A.getEndX()-A.getStartX());S++}return x?i.getBoundingBox().getMinX():i.getBoundingBox().getMaxX()}static detectCodeword(i,c,h,x,y,w,S,A){y=Tr.adjustCodewordStartColumn(i,c,h,x,y,w);let P=Tr.getModuleBitCount(i,c,h,x,y,w);if(P==null)return null;let G,te=Le.sum(P);if(x)G=y+te;else{for(let Ie=0;Ie<P.length/2;Ie++){let Pe=P[Ie];P[Ie]=P[P.length-1-Ie],P[P.length-1-Ie]=Pe}G=y,y=G-te}if(!Tr.checkCodewordSkew(te,S,A))return null;let oe=sn.getDecodedValue(P),Ce=qt.getCodeword(oe);return Ce===-1?null:new Vn(y,G,Tr.getCodewordBucketNumber(oe),Ce)}static getModuleBitCount(i,c,h,x,y,w){let S=y,A=new Int32Array(8),P=0,G=x?1:-1,te=x;for(;(x?S<h:S>=c)&&P<A.length;)i.get(S,w)===te?(A[P]++,S+=G):(P++,te=!te);return P===A.length||S===(x?h:c)&&P===A.length-1?A:null}static getNumberOfECCodeWords(i){return 2<<i}static adjustCodewordStartColumn(i,c,h,x,y,w){let S=y,A=x?-1:1;for(let P=0;P<2;P++){for(;(x?S>=c:S<h)&&x===i.get(S,w);){if(Math.abs(y-S)>Tr.CODEWORD_SKEW_SIZE)return y;S+=A}A=-A,x=!x}return S}static checkCodewordSkew(i,c,h){return c-Tr.CODEWORD_SKEW_SIZE<=i&&i<=h+Tr.CODEWORD_SKEW_SIZE}static decodeCodewords(i,c,h){if(i.length===0)throw V.getFormatInstance();let x=1<<c+1,y=Tr.correctErrors(i,h,x);Tr.verifyCodewordCount(i,x);let w=lt.decode(i,""+c);return w.setErrorsCorrected(y),w.setErasures(h.length),w}static correctErrors(i,c,h){if(c!=null&&c.length>h/2+Tr.MAX_ERRORS||h<0||h>Tr.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return Tr.errorCorrection.decode(i,h,c)}static verifyCodewordCount(i,c){if(i.length<4)throw V.getFormatInstance();let h=i[0];if(h>i.length)throw V.getFormatInstance();if(h===0)if(c<i.length)i[0]=i.length-c;else throw V.getFormatInstance()}static getBitCountForCodeword(i){let c=new Int32Array(8),h=0,x=c.length-1;for(;!((i&1)!==h&&(h=i&1,x--,x<0));)c[x]++,i>>=1;return c}static getCodewordBucketNumber(i){return i instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(i):this.getCodewordBucketNumber_number(i)}static getCodewordBucketNumber_number(i){return Tr.getCodewordBucketNumber(Tr.getBitCountForCodeword(i))}static getCodewordBucketNumber_Int32Array(i){return(i[0]-i[2]+i[4]-i[6]+9)%9}static toString(i){let c=new ns;for(let h=0;h<i.length;h++){c.format("Row %2d: ",h);for(let x=0;x<i[h].length;x++){let y=i[h][x];y.getValue().length===0?c.format(" ",null):c.format("%4d(%2d)",y.getValue()[0],y.getConfidence(y.getValue()[0]))}c.format("%n")}return c.toString()}}Tr.CODEWORD_SKEW_SIZE=2,Tr.MAX_ERRORS=3,Tr.MAX_EC_CODEWORDS=512,Tr.errorCorrection=new ps;class on{decode(i,c=null){let h=on.decode(i,c,!1);if(h==null||h.length===0||h[0]==null)throw ue.getNotFoundInstance();return h[0]}decodeMultiple(i,c=null){try{return on.decode(i,c,!0)}catch(h){throw h instanceof V||h instanceof O?ue.getNotFoundInstance():h}}static decode(i,c,h){const x=new Array,y=_r.detectMultiple(i,c,h);for(const w of y.getPoints()){const S=Tr.decode(y.getBits(),w[4],w[5],w[6],w[7],on.getMinCodewordWidth(w),on.getMaxCodewordWidth(w)),A=new se(S.getText(),S.getRawBytes(),void 0,w,pe.PDF_417);A.putMetadata(Fe.ERROR_CORRECTION_LEVEL,S.getECLevel());const P=S.getOther();P!=null&&A.putMetadata(Fe.PDF417_EXTRA_METADATA,P),x.push(A)}return x.map(w=>w)}static getMaxWidth(i,c){return i==null||c==null?0:Math.trunc(Math.abs(i.getX()-c.getX()))}static getMinWidth(i,c){return i==null||c==null?U.MAX_VALUE:Math.trunc(Math.abs(i.getX()-c.getX()))}static getMaxCodewordWidth(i){return Math.floor(Math.max(Math.max(on.getMaxWidth(i[0],i[4]),on.getMaxWidth(i[6],i[2])*qt.MODULES_IN_CODEWORD/qt.MODULES_IN_STOP_PATTERN),Math.max(on.getMaxWidth(i[1],i[5]),on.getMaxWidth(i[7],i[3])*qt.MODULES_IN_CODEWORD/qt.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(i){return Math.floor(Math.min(Math.min(on.getMinWidth(i[0],i[4]),on.getMinWidth(i[6],i[2])*qt.MODULES_IN_CODEWORD/qt.MODULES_IN_STOP_PATTERN),Math.min(on.getMinWidth(i[1],i[5]),on.getMinWidth(i[7],i[3])*qt.MODULES_IN_CODEWORD/qt.MODULES_IN_STOP_PATTERN)))}reset(){}}class Xn extends p{}Xn.kind="ReaderException";class Nc{constructor(i,c){this.verbose=i===!0,c&&this.setHints(c)}decode(i,c){return c&&this.setHints(c),this.decodeInternal(i)}decodeWithState(i){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(i)}setHints(i){this.hints=i;const c=!n(i)&&i.get(ne.TRY_HARDER)===!0,h=n(i)?null:i.get(ne.POSSIBLE_FORMATS),x=new Array;if(!n(h)){const y=h.some(w=>w===pe.UPC_A||w===pe.UPC_E||w===pe.EAN_13||w===pe.EAN_8||w===pe.CODABAR||w===pe.CODE_39||w===pe.CODE_93||w===pe.CODE_128||w===pe.ITF||w===pe.RSS_14||w===pe.RSS_EXPANDED);y&&!c&&x.push(new Wa(i,this.verbose)),h.includes(pe.QR_CODE)&&x.push(new Za),h.includes(pe.DATA_MATRIX)&&x.push(new Kr),h.includes(pe.AZTEC)&&x.push(new Zt),h.includes(pe.PDF_417)&&x.push(new on),y&&c&&x.push(new Wa(i,this.verbose))}x.length===0&&(c||x.push(new Wa(i,this.verbose)),x.push(new Za),x.push(new Kr),x.push(new Zt),x.push(new on),c&&x.push(new Wa(i,this.verbose))),this.readers=x}reset(){if(this.readers!==null)for(const i of this.readers)i.reset()}decodeInternal(i){if(this.readers===null)throw new Xn("No readers where selected, nothing can be read.");for(const c of this.readers)try{return c.decode(i,this.hints)}catch(h){if(h instanceof Xn)continue}throw new ue("No MultiFormat Readers were able to detect the code.")}}class Ul extends ae{constructor(i=null,c=500){const h=new Nc;h.setHints(i),super(h,c)}decodeBitmap(i){return this.reader.decodeWithState(i)}}class gi extends ae{constructor(i=500){super(new on,i)}}class Sc extends ae{constructor(i=500){super(new Za,i)}}var rl;(function(ee){ee[ee.ERROR_CORRECTION=0]="ERROR_CORRECTION",ee[ee.CHARACTER_SET=1]="CHARACTER_SET",ee[ee.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",ee[ee.MIN_SIZE=3]="MIN_SIZE",ee[ee.MAX_SIZE=4]="MAX_SIZE",ee[ee.MARGIN=5]="MARGIN",ee[ee.PDF417_COMPACT=6]="PDF417_COMPACT",ee[ee.PDF417_COMPACTION=7]="PDF417_COMPACTION",ee[ee.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",ee[ee.AZTEC_LAYERS=9]="AZTEC_LAYERS",ee[ee.QR_VERSION=10]="QR_VERSION"})(rl||(rl={}));var Ra=rl;class ko{constructor(i){this.field=i,this.cachedGenerators=[],this.cachedGenerators.push(new Lt(i,Int32Array.from([1])))}buildGenerator(i){const c=this.cachedGenerators;if(i>=c.length){let h=c[c.length-1];const x=this.field;for(let y=c.length;y<=i;y++){const w=h.multiply(new Lt(x,Int32Array.from([1,x.exp(y-1+x.getGeneratorBase())])));c.push(w),h=w}}return c[i]}encode(i,c){if(c===0)throw new N("No error correction bytes");const h=i.length-c;if(h<=0)throw new N("No data bytes provided");const x=this.buildGenerator(c),y=new Int32Array(h);M.arraycopy(i,0,y,0,h);let w=new Lt(this.field,y);w=w.multiplyByMonomial(c,1);const A=w.divide(x)[1].getCoefficients(),P=c-A.length;for(let G=0;G<P;G++)i[h+G]=0;M.arraycopy(A,0,i,h+P,A.length)}}class Oa{constructor(){}static applyMaskPenaltyRule1(i){return Oa.applyMaskPenaltyRule1Internal(i,!0)+Oa.applyMaskPenaltyRule1Internal(i,!1)}static applyMaskPenaltyRule2(i){let c=0;const h=i.getArray(),x=i.getWidth(),y=i.getHeight();for(let w=0;w<y-1;w++){const S=h[w];for(let A=0;A<x-1;A++){const P=S[A];P===S[A+1]&&P===h[w+1][A]&&P===h[w+1][A+1]&&c++}}return Oa.N2*c}static applyMaskPenaltyRule3(i){let c=0;const h=i.getArray(),x=i.getWidth(),y=i.getHeight();for(let w=0;w<y;w++)for(let S=0;S<x;S++){const A=h[w];S+6<x&&A[S]===1&&A[S+1]===0&&A[S+2]===1&&A[S+3]===1&&A[S+4]===1&&A[S+5]===0&&A[S+6]===1&&(Oa.isWhiteHorizontal(A,S-4,S)||Oa.isWhiteHorizontal(A,S+7,S+11))&&c++,w+6<y&&h[w][S]===1&&h[w+1][S]===0&&h[w+2][S]===1&&h[w+3][S]===1&&h[w+4][S]===1&&h[w+5][S]===0&&h[w+6][S]===1&&(Oa.isWhiteVertical(h,S,w-4,w)||Oa.isWhiteVertical(h,S,w+7,w+11))&&c++}return c*Oa.N3}static isWhiteHorizontal(i,c,h){c=Math.max(c,0),h=Math.min(h,i.length);for(let x=c;x<h;x++)if(i[x]===1)return!1;return!0}static isWhiteVertical(i,c,h,x){h=Math.max(h,0),x=Math.min(x,i.length);for(let y=h;y<x;y++)if(i[y][c]===1)return!1;return!0}static applyMaskPenaltyRule4(i){let c=0;const h=i.getArray(),x=i.getWidth(),y=i.getHeight();for(let A=0;A<y;A++){const P=h[A];for(let G=0;G<x;G++)P[G]===1&&c++}const w=i.getHeight()*i.getWidth();return Math.floor(Math.abs(c*2-w)*10/w)*Oa.N4}static getDataMaskBit(i,c,h){let x,y;switch(i){case 0:x=h+c&1;break;case 1:x=h&1;break;case 2:x=c%3;break;case 3:x=(h+c)%3;break;case 4:x=Math.floor(h/2)+Math.floor(c/3)&1;break;case 5:y=h*c,x=(y&1)+y%3;break;case 6:y=h*c,x=(y&1)+y%3&1;break;case 7:y=h*c,x=y%3+(h+c&1)&1;break;default:throw new N("Invalid mask pattern: "+i)}return x===0}static applyMaskPenaltyRule1Internal(i,c){let h=0;const x=c?i.getHeight():i.getWidth(),y=c?i.getWidth():i.getHeight(),w=i.getArray();for(let S=0;S<x;S++){let A=0,P=-1;for(let G=0;G<y;G++){const te=c?w[S][G]:w[G][S];te===P?A++:(A>=5&&(h+=Oa.N1+(A-5)),A=1,P=te)}A>=5&&(h+=Oa.N1+(A-5))}return h}}Oa.N1=3,Oa.N2=3,Oa.N3=40,Oa.N4=10;class No{constructor(i,c){this.width=i,this.height=c;const h=new Array(c);for(let x=0;x!==c;x++)h[x]=new Uint8Array(i);this.bytes=h}getHeight(){return this.height}getWidth(){return this.width}get(i,c){return this.bytes[c][i]}getArray(){return this.bytes}setNumber(i,c,h){this.bytes[c][i]=h}setBoolean(i,c,h){this.bytes[c][i]=h?1:0}clear(i){for(const c of this.bytes)B.fill(c,i)}equals(i){if(!(i instanceof No))return!1;const c=i;if(this.width!==c.width||this.height!==c.height)return!1;for(let h=0,x=this.height;h<x;++h){const y=this.bytes[h],w=c.bytes[h];for(let S=0,A=this.width;S<A;++S)if(y[S]!==w[S])return!1}return!0}toString(){const i=new Se;for(let c=0,h=this.height;c<h;++c){const x=this.bytes[c];for(let y=0,w=this.width;y<w;++y)switch(x[y]){case 0:i.append(" 0");break;case 1:i.append(" 1");break;default:i.append(" ");break}i.append(`
`)}return i.toString()}}class Oi{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const i=new Se;return i.append(`<<
`),i.append(" mode: "),i.append(this.mode?this.mode.toString():"null"),i.append(`
ecLevel: `),i.append(this.ecLevel?this.ecLevel.toString():"null"),i.append(`
version: `),i.append(this.version?this.version.toString():"null"),i.append(`
maskPattern: `),i.append(this.maskPattern.toString()),this.matrix?(i.append(`
matrix:
`),i.append(this.matrix.toString())):i.append(`
matrix: null
`),i.append(`>>
`),i.toString()}setMode(i){this.mode=i}setECLevel(i){this.ecLevel=i}setVersion(i){this.version=i}setMaskPattern(i){this.maskPattern=i}setMatrix(i){this.matrix=i}static isValidMaskPattern(i){return i>=0&&i<Oi.NUM_MASK_PATTERNS}}Oi.NUM_MASK_PATTERNS=8;class ta extends p{}ta.kind="WriterException";class hr{constructor(){}static clearMatrix(i){i.clear(255)}static buildMatrix(i,c,h,x,y){hr.clearMatrix(y),hr.embedBasicPatterns(h,y),hr.embedTypeInfo(c,x,y),hr.maybeEmbedVersionInfo(h,y),hr.embedDataBits(i,x,y)}static embedBasicPatterns(i,c){hr.embedPositionDetectionPatternsAndSeparators(c),hr.embedDarkDotAtLeftBottomCorner(c),hr.maybeEmbedPositionAdjustmentPatterns(i,c),hr.embedTimingPatterns(c)}static embedTypeInfo(i,c,h){const x=new H;hr.makeTypeInfoBits(i,c,x);for(let y=0,w=x.getSize();y<w;++y){const S=x.get(x.getSize()-1-y),A=hr.TYPE_INFO_COORDINATES[y],P=A[0],G=A[1];if(h.setBoolean(P,G,S),y<8){const te=h.getWidth()-y-1;h.setBoolean(te,8,S)}else{const oe=h.getHeight()-7+(y-8);h.setBoolean(8,oe,S)}}}static maybeEmbedVersionInfo(i,c){if(i.getVersionNumber()<7)return;const h=new H;hr.makeVersionInfoBits(i,h);let x=17;for(let y=0;y<6;++y)for(let w=0;w<3;++w){const S=h.get(x);x--,c.setBoolean(y,c.getHeight()-11+w,S),c.setBoolean(c.getHeight()-11+w,y,S)}}static embedDataBits(i,c,h){let x=0,y=-1,w=h.getWidth()-1,S=h.getHeight()-1;for(;w>0;){for(w===6&&(w-=1);S>=0&&S<h.getHeight();){for(let A=0;A<2;++A){const P=w-A;if(!hr.isEmpty(h.get(P,S)))continue;let G;x<i.getSize()?(G=i.get(x),++x):G=!1,c!==255&&Oa.getDataMaskBit(c,P,S)&&(G=!G),h.setBoolean(P,S,G)}S+=y}y=-y,S+=y,w-=2}if(x!==i.getSize())throw new ta("Not all bits consumed: "+x+"/"+i.getSize())}static findMSBSet(i){return 32-U.numberOfLeadingZeros(i)}static calculateBCHCode(i,c){if(c===0)throw new N("0 polynomial");const h=hr.findMSBSet(c);for(i<<=h-1;hr.findMSBSet(i)>=h;)i^=c<<hr.findMSBSet(i)-h;return i}static makeTypeInfoBits(i,c,h){if(!Oi.isValidMaskPattern(c))throw new ta("Invalid mask pattern");const x=i.getBits()<<3|c;h.appendBits(x,5);const y=hr.calculateBCHCode(x,hr.TYPE_INFO_POLY);h.appendBits(y,10);const w=new H;if(w.appendBits(hr.TYPE_INFO_MASK_PATTERN,15),h.xor(w),h.getSize()!==15)throw new ta("should not happen but we got: "+h.getSize())}static makeVersionInfoBits(i,c){c.appendBits(i.getVersionNumber(),6);const h=hr.calculateBCHCode(i.getVersionNumber(),hr.VERSION_INFO_POLY);if(c.appendBits(h,12),c.getSize()!==18)throw new ta("should not happen but we got: "+c.getSize())}static isEmpty(i){return i===255}static embedTimingPatterns(i){for(let c=8;c<i.getWidth()-8;++c){const h=(c+1)%2;hr.isEmpty(i.get(c,6))&&i.setNumber(c,6,h),hr.isEmpty(i.get(6,c))&&i.setNumber(6,c,h)}}static embedDarkDotAtLeftBottomCorner(i){if(i.get(8,i.getHeight()-8)===0)throw new ta;i.setNumber(8,i.getHeight()-8,1)}static embedHorizontalSeparationPattern(i,c,h){for(let x=0;x<8;++x){if(!hr.isEmpty(h.get(i+x,c)))throw new ta;h.setNumber(i+x,c,0)}}static embedVerticalSeparationPattern(i,c,h){for(let x=0;x<7;++x){if(!hr.isEmpty(h.get(i,c+x)))throw new ta;h.setNumber(i,c+x,0)}}static embedPositionAdjustmentPattern(i,c,h){for(let x=0;x<5;++x){const y=hr.POSITION_ADJUSTMENT_PATTERN[x];for(let w=0;w<5;++w)h.setNumber(i+w,c+x,y[w])}}static embedPositionDetectionPattern(i,c,h){for(let x=0;x<7;++x){const y=hr.POSITION_DETECTION_PATTERN[x];for(let w=0;w<7;++w)h.setNumber(i+w,c+x,y[w])}}static embedPositionDetectionPatternsAndSeparators(i){const c=hr.POSITION_DETECTION_PATTERN[0].length;hr.embedPositionDetectionPattern(0,0,i),hr.embedPositionDetectionPattern(i.getWidth()-c,0,i),hr.embedPositionDetectionPattern(0,i.getWidth()-c,i);const h=8;hr.embedHorizontalSeparationPattern(0,h-1,i),hr.embedHorizontalSeparationPattern(i.getWidth()-h,h-1,i),hr.embedHorizontalSeparationPattern(0,i.getWidth()-h,i);const x=7;hr.embedVerticalSeparationPattern(x,0,i),hr.embedVerticalSeparationPattern(i.getHeight()-x-1,0,i),hr.embedVerticalSeparationPattern(x,i.getHeight()-x,i)}static maybeEmbedPositionAdjustmentPatterns(i,c){if(i.getVersionNumber()<2)return;const h=i.getVersionNumber()-1,x=hr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[h];for(let y=0,w=x.length;y!==w;y++){const S=x[y];if(S>=0)for(let A=0;A!==w;A++){const P=x[A];P>=0&&hr.isEmpty(c.get(P,S))&&hr.embedPositionAdjustmentPattern(P-2,S-2,c)}}}}hr.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),hr.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),hr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),hr.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),hr.VERSION_INFO_POLY=7973,hr.TYPE_INFO_POLY=1335,hr.TYPE_INFO_MASK_PATTERN=21522;class Ud{constructor(i,c){this.dataBytes=i,this.errorCorrectionBytes=c}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class xa{constructor(){}static calculateMaskPenalty(i){return Oa.applyMaskPenaltyRule1(i)+Oa.applyMaskPenaltyRule2(i)+Oa.applyMaskPenaltyRule3(i)+Oa.applyMaskPenaltyRule4(i)}static encode(i,c,h=null){let x=xa.DEFAULT_BYTE_MODE_ENCODING;const y=h!==null&&h.get(Ra.CHARACTER_SET)!==void 0;y&&(x=h.get(Ra.CHARACTER_SET).toString());const w=this.chooseMode(i,x),S=new H;if(w===ur.BYTE&&(y||xa.DEFAULT_BYTE_MODE_ENCODING!==x)){const Pt=Q.getCharacterSetECIByName(x);Pt!==void 0&&this.appendECI(Pt,S)}this.appendModeInfo(w,S);const A=new H;this.appendBytes(i,w,A,x);let P;if(h!==null&&h.get(Ra.QR_VERSION)!==void 0){const Pt=Number.parseInt(h.get(Ra.QR_VERSION).toString(),10);P=Gt.getVersionForNumber(Pt);const Mt=this.calculateBitsNeeded(w,S,A,P);if(!this.willFit(Mt,P,c))throw new ta("Data too big for requested version")}else P=this.recommendVersion(c,w,S,A);const G=new H;G.appendBitArray(S);const te=w===ur.BYTE?A.getSizeInBytes():i.length;this.appendLengthInfo(te,P,w,G),G.appendBitArray(A);const oe=P.getECBlocksForLevel(c),Ce=P.getTotalCodewords()-oe.getTotalECCodewords();this.terminateBits(Ce,G);const Ie=this.interleaveWithECBytes(G,P.getTotalCodewords(),Ce,oe.getNumBlocks()),Pe=new Oi;Pe.setECLevel(c),Pe.setMode(w),Pe.setVersion(P);const Ke=P.getDimensionForVersion(),it=new No(Ke,Ke),Bt=this.chooseMaskPattern(Ie,c,P,it);return Pe.setMaskPattern(Bt),hr.buildMatrix(Ie,c,P,Bt,it),Pe.setMatrix(it),Pe}static recommendVersion(i,c,h,x){const y=this.calculateBitsNeeded(c,h,x,Gt.getVersionForNumber(1)),w=this.chooseVersion(y,i),S=this.calculateBitsNeeded(c,h,x,w);return this.chooseVersion(S,i)}static calculateBitsNeeded(i,c,h,x){return c.getSize()+i.getCharacterCountBits(x)+h.getSize()}static getAlphanumericCode(i){return i<xa.ALPHANUMERIC_TABLE.length?xa.ALPHANUMERIC_TABLE[i]:-1}static chooseMode(i,c=null){if(Q.SJIS.getName()===c&&this.isOnlyDoubleByteKanji(i))return ur.KANJI;let h=!1,x=!1;for(let y=0,w=i.length;y<w;++y){const S=i.charAt(y);if(xa.isDigit(S))h=!0;else if(this.getAlphanumericCode(S.charCodeAt(0))!==-1)x=!0;else return ur.BYTE}return x?ur.ALPHANUMERIC:h?ur.NUMERIC:ur.BYTE}static isOnlyDoubleByteKanji(i){let c;try{c=je.encode(i,Q.SJIS)}catch(x){return!1}const h=c.length;if(h%2!==0)return!1;for(let x=0;x<h;x+=2){const y=c[x]&255;if((y<129||y>159)&&(y<224||y>235))return!1}return!0}static chooseMaskPattern(i,c,h,x){let y=Number.MAX_SAFE_INTEGER,w=-1;for(let S=0;S<Oi.NUM_MASK_PATTERNS;S++){hr.buildMatrix(i,c,h,S,x);let A=this.calculateMaskPenalty(x);A<y&&(y=A,w=S)}return w}static chooseVersion(i,c){for(let h=1;h<=40;h++){const x=Gt.getVersionForNumber(h);if(xa.willFit(i,x,c))return x}throw new ta("Data too big")}static willFit(i,c,h){const x=c.getTotalCodewords(),w=c.getECBlocksForLevel(h).getTotalECCodewords(),S=x-w,A=(i+7)/8;return S>=A}static terminateBits(i,c){const h=i*8;if(c.getSize()>h)throw new ta("data bits cannot fit in the QR Code"+c.getSize()+" > "+h);for(let w=0;w<4&&c.getSize()<h;++w)c.appendBit(!1);const x=c.getSize()&7;if(x>0)for(let w=x;w<8;w++)c.appendBit(!1);const y=i-c.getSizeInBytes();for(let w=0;w<y;++w)c.appendBits((w&1)===0?236:17,8);if(c.getSize()!==h)throw new ta("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(i,c,h,x,y,w){if(x>=h)throw new ta("Block ID too large");const S=i%h,A=h-S,P=Math.floor(i/h),G=P+1,te=Math.floor(c/h),oe=te+1,Ce=P-te,Ie=G-oe;if(Ce!==Ie)throw new ta("EC bytes mismatch");if(h!==A+S)throw new ta("RS blocks mismatch");if(i!==(te+Ce)*A+(oe+Ie)*S)throw new ta("Total bytes mismatch");x<A?(y[0]=te,w[0]=Ce):(y[0]=oe,w[0]=Ie)}static interleaveWithECBytes(i,c,h,x){if(i.getSizeInBytes()!==h)throw new ta("Number of bits and data bytes does not match");let y=0,w=0,S=0;const A=new Array;for(let G=0;G<x;++G){const te=new Int32Array(1),oe=new Int32Array(1);xa.getNumDataBytesAndNumECBytesForBlockID(c,h,x,G,te,oe);const Ce=te[0],Ie=new Uint8Array(Ce);i.toBytes(8*y,Ie,0,Ce);const Pe=xa.generateECBytes(Ie,oe[0]);A.push(new Ud(Ie,Pe)),w=Math.max(w,Ce),S=Math.max(S,Pe.length),y+=te[0]}if(h!==y)throw new ta("Data bytes does not match offset");const P=new H;for(let G=0;G<w;++G)for(const te of A){const oe=te.getDataBytes();G<oe.length&&P.appendBits(oe[G],8)}for(let G=0;G<S;++G)for(const te of A){const oe=te.getErrorCorrectionBytes();G<oe.length&&P.appendBits(oe[G],8)}if(c!==P.getSizeInBytes())throw new ta("Interleaving error: "+c+" and "+P.getSizeInBytes()+" differ.");return P}static generateECBytes(i,c){const h=i.length,x=new Int32Array(h+c);for(let w=0;w<h;w++)x[w]=i[w]&255;new ko(Ht.QR_CODE_FIELD_256).encode(x,c);const y=new Uint8Array(c);for(let w=0;w<c;w++)y[w]=x[h+w];return y}static appendModeInfo(i,c){c.appendBits(i.getBits(),4)}static appendLengthInfo(i,c,h,x){const y=h.getCharacterCountBits(c);if(i>=1<<y)throw new ta(i+" is bigger than "+((1<<y)-1));x.appendBits(i,y)}static appendBytes(i,c,h,x){switch(c){case ur.NUMERIC:xa.appendNumericBytes(i,h);break;case ur.ALPHANUMERIC:xa.appendAlphanumericBytes(i,h);break;case ur.BYTE:xa.append8BitBytes(i,h,x);break;case ur.KANJI:xa.appendKanjiBytes(i,h);break;default:throw new ta("Invalid mode: "+c)}}static getDigit(i){return i.charCodeAt(0)-48}static isDigit(i){const c=xa.getDigit(i);return c>=0&&c<=9}static appendNumericBytes(i,c){const h=i.length;let x=0;for(;x<h;){const y=xa.getDigit(i.charAt(x));if(x+2<h){const w=xa.getDigit(i.charAt(x+1)),S=xa.getDigit(i.charAt(x+2));c.appendBits(y*100+w*10+S,10),x+=3}else if(x+1<h){const w=xa.getDigit(i.charAt(x+1));c.appendBits(y*10+w,7),x+=2}else c.appendBits(y,4),x++}}static appendAlphanumericBytes(i,c){const h=i.length;let x=0;for(;x<h;){const y=xa.getAlphanumericCode(i.charCodeAt(x));if(y===-1)throw new ta;if(x+1<h){const w=xa.getAlphanumericCode(i.charCodeAt(x+1));if(w===-1)throw new ta;c.appendBits(y*45+w,11),x+=2}else c.appendBits(y,6),x++}}static append8BitBytes(i,c,h){let x;try{x=je.encode(i,h)}catch(y){throw new ta(y)}for(let y=0,w=x.length;y!==w;y++){const S=x[y];c.appendBits(S,8)}}static appendKanjiBytes(i,c){let h;try{h=je.encode(i,Q.SJIS)}catch(y){throw new ta(y)}const x=h.length;for(let y=0;y<x;y+=2){const w=h[y]&255,S=h[y+1]&255,A=w<<8&4294967295|S;let P=-1;if(A>=33088&&A<=40956?P=A-33088:A>=57408&&A<=60351&&(P=A-49472),P===-1)throw new ta("Invalid byte sequence");const G=(P>>8)*192+(P&255);c.appendBits(G,13)}}static appendECI(i,c){c.appendBits(ur.ECI.getBits(),4),c.appendBits(i.getValue(),8)}}xa.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),xa.DEFAULT_BYTE_MODE_ENCODING=Q.UTF8.getName();class xi{write(i,c,h,x=null){if(i.length===0)throw new N("Found empty contents");if(c<0||h<0)throw new N("Requested dimensions are too small: "+c+"x"+h);let y=pr.L,w=xi.QUIET_ZONE_SIZE;x!==null&&(x.get(Ra.ERROR_CORRECTION)!==void 0&&(y=pr.fromString(x.get(Ra.ERROR_CORRECTION).toString())),x.get(Ra.MARGIN)!==void 0&&(w=Number.parseInt(x.get(Ra.MARGIN).toString(),10)));const S=xa.encode(i,y,x);return this.renderResult(S,c,h,w)}writeToDom(i,c,h,x,y=null){typeof i=="string"&&(i=document.querySelector(i));const w=this.write(c,h,x,y);i&&i.appendChild(w)}renderResult(i,c,h,x){const y=i.getMatrix();if(y===null)throw new tr;const w=y.getWidth(),S=y.getHeight(),A=w+x*2,P=S+x*2,G=Math.max(c,A),te=Math.max(h,P),oe=Math.min(Math.floor(G/A),Math.floor(te/P)),Ce=Math.floor((G-w*oe)/2),Ie=Math.floor((te-S*oe)/2),Pe=this.createSVGElement(G,te);for(let Ke=0,it=Ie;Ke<S;Ke++,it+=oe)for(let Bt=0,Pt=Ce;Bt<w;Bt++,Pt+=oe)if(y.get(Bt,Ke)===1){const Mt=this.createSvgRectElement(Pt,it,oe,oe);Pe.appendChild(Mt)}return Pe}createSVGElement(i,c){const h=document.createElementNS(xi.SVG_NS,"svg");return h.setAttributeNS(null,"height",i.toString()),h.setAttributeNS(null,"width",c.toString()),h}createSvgRectElement(i,c,h,x){const y=document.createElementNS(xi.SVG_NS,"rect");return y.setAttributeNS(null,"x",i.toString()),y.setAttributeNS(null,"y",c.toString()),y.setAttributeNS(null,"height",h.toString()),y.setAttributeNS(null,"width",x.toString()),y.setAttributeNS(null,"fill","#000000"),y}}xi.QUIET_ZONE_SIZE=4,xi.SVG_NS="http://www.w3.org/2000/svg";class Js{encode(i,c,h,x,y){if(i.length===0)throw new N("Found empty contents");if(c!==pe.QR_CODE)throw new N("Can only encode QR_CODE, but got "+c);if(h<0||x<0)throw new N(`Requested dimensions are too small: ${h}x${x}`);let w=pr.L,S=Js.QUIET_ZONE_SIZE;y!==null&&(y.get(Ra.ERROR_CORRECTION)!==void 0&&(w=pr.fromString(y.get(Ra.ERROR_CORRECTION).toString())),y.get(Ra.MARGIN)!==void 0&&(S=Number.parseInt(y.get(Ra.MARGIN).toString(),10)));const A=xa.encode(i,w,y);return Js.renderResult(A,h,x,S)}static renderResult(i,c,h,x){const y=i.getMatrix();if(y===null)throw new tr;const w=y.getWidth(),S=y.getHeight(),A=w+x*2,P=S+x*2,G=Math.max(c,A),te=Math.max(h,P),oe=Math.min(Math.floor(G/A),Math.floor(te/P)),Ce=Math.floor((G-w*oe)/2),Ie=Math.floor((te-S*oe)/2),Pe=new Oe(G,te);for(let Ke=0,it=Ie;Ke<S;Ke++,it+=oe)for(let Bt=0,Pt=Ce;Bt<w;Bt++,Pt+=oe)y.get(Bt,Ke)===1&&Pe.setRegion(Pt,it,oe,oe);return Pe}}Js.QUIET_ZONE_SIZE=4;class Mi{encode(i,c,h,x,y){let w;switch(c){case pe.QR_CODE:w=new Js;break;default:throw new N("No encoder available for format "+c)}return w.encode(i,c,h,x,y)}}class As extends de{constructor(i,c,h,x,y,w,S,A){if(super(w,S),this.yuvData=i,this.dataWidth=c,this.dataHeight=h,this.left=x,this.top=y,x+w>c||y+S>h)throw new N("Crop rectangle does not fit within image data.");A&&this.reverseHorizontal(w,S)}getRow(i,c){if(i<0||i>=this.getHeight())throw new N("Requested row is outside the image: "+i);const h=this.getWidth();(c==null||c.length<h)&&(c=new Uint8ClampedArray(h));const x=(i+this.top)*this.dataWidth+this.left;return M.arraycopy(this.yuvData,x,c,0,h),c}getMatrix(){const i=this.getWidth(),c=this.getHeight();if(i===this.dataWidth&&c===this.dataHeight)return this.yuvData;const h=i*c,x=new Uint8ClampedArray(h);let y=this.top*this.dataWidth+this.left;if(i===this.dataWidth)return M.arraycopy(this.yuvData,y,x,0,h),x;for(let w=0;w<c;w++){const S=w*i;M.arraycopy(this.yuvData,y,x,S,i),y+=this.dataWidth}return x}isCropSupported(){return!0}crop(i,c,h,x){return new As(this.yuvData,this.dataWidth,this.dataHeight,this.left+i,this.top+c,h,x,!1)}renderThumbnail(){const i=this.getWidth()/As.THUMBNAIL_SCALE_FACTOR,c=this.getHeight()/As.THUMBNAIL_SCALE_FACTOR,h=new Int32Array(i*c),x=this.yuvData;let y=this.top*this.dataWidth+this.left;for(let w=0;w<c;w++){const S=w*i;for(let A=0;A<i;A++){const P=x[y+A*As.THUMBNAIL_SCALE_FACTOR]&255;h[S+A]=4278190080|P*65793}y+=this.dataWidth*As.THUMBNAIL_SCALE_FACTOR}return h}getThumbnailWidth(){return this.getWidth()/As.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/As.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(i,c){const h=this.yuvData;for(let x=0,y=this.top*this.dataWidth+this.left;x<c;x++,y+=this.dataWidth){const w=y+i/2;for(let S=y,A=y+i-1;S<w;S++,A--){const P=h[S];h[S]=h[A],h[A]=P}}}invert(){return new Ae(this)}}As.THUMBNAIL_SCALE_FACTOR=2;class Ri extends de{constructor(i,c,h,x,y,w,S){if(super(c,h),this.dataWidth=x,this.dataHeight=y,this.left=w,this.top=S,i.BYTES_PER_ELEMENT===4){const A=c*h,P=new Uint8ClampedArray(A);for(let G=0;G<A;G++){const te=i[G],oe=te>>16&255,Ce=te>>7&510,Ie=te&255;P[G]=(oe+Ce+Ie)/4&255}this.luminances=P}else this.luminances=i;if(x===void 0&&(this.dataWidth=c),y===void 0&&(this.dataHeight=h),w===void 0&&(this.left=0),S===void 0&&(this.top=0),this.left+c>this.dataWidth||this.top+h>this.dataHeight)throw new N("Crop rectangle does not fit within image data.")}getRow(i,c){if(i<0||i>=this.getHeight())throw new N("Requested row is outside the image: "+i);const h=this.getWidth();(c==null||c.length<h)&&(c=new Uint8ClampedArray(h));const x=(i+this.top)*this.dataWidth+this.left;return M.arraycopy(this.luminances,x,c,0,h),c}getMatrix(){const i=this.getWidth(),c=this.getHeight();if(i===this.dataWidth&&c===this.dataHeight)return this.luminances;const h=i*c,x=new Uint8ClampedArray(h);let y=this.top*this.dataWidth+this.left;if(i===this.dataWidth)return M.arraycopy(this.luminances,y,x,0,h),x;for(let w=0;w<c;w++){const S=w*i;M.arraycopy(this.luminances,y,x,S,i),y+=this.dataWidth}return x}isCropSupported(){return!0}crop(i,c,h,x){return new Ri(this.luminances,h,x,this.dataWidth,this.dataHeight,this.left+i,this.top+c)}invert(){return new Ae(this)}}class Yn extends Q{static forName(i){return this.getCharacterSetECIByName(i)}}class to{}to.ISO_8859_1=Q.ISO8859_1;class Di{isCompact(){return this.compact}setCompact(i){this.compact=i}getSize(){return this.size}setSize(i){this.size=i}getLayers(){return this.layers}setLayers(i){this.layers=i}getCodeWords(){return this.codeWords}setCodeWords(i){this.codeWords=i}getMatrix(){return this.matrix}setMatrix(i){this.matrix=i}}class Ec{static singletonList(i){return[i]}static min(i,c){return i.sort(c)[0]}}class al{constructor(i){this.previous=i}getPrevious(){return this.previous}}class Qs extends al{constructor(i,c,h){super(i),this.value=c,this.bitCount=h}appendTo(i,c){i.appendBits(this.value,this.bitCount)}add(i,c){return new Qs(this,i,c)}addBinaryShift(i,c){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Qs(this,i,c)}toString(){let i=this.value&(1<<this.bitCount)-1;return i|=1<<this.bitCount,"<"+U.toBinaryString(i|1<<this.bitCount).substring(1)+">"}}class nl extends Qs{constructor(i,c,h){super(i,0,0),this.binaryShiftStart=c,this.binaryShiftByteCount=h}appendTo(i,c){for(let h=0;h<this.binaryShiftByteCount;h++)(h===0||h===31&&this.binaryShiftByteCount<=62)&&(i.appendBits(31,5),this.binaryShiftByteCount>62?i.appendBits(this.binaryShiftByteCount-31,16):h===0?i.appendBits(Math.min(this.binaryShiftByteCount,31),5):i.appendBits(this.binaryShiftByteCount-31,5)),i.appendBits(c[this.binaryShiftStart+h],8)}addBinaryShift(i,c){return new nl(this,i,c)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Cc(ee,i,c){return new nl(ee,i,c)}function Ii(ee,i,c){return new Qs(ee,i,c)}const ro=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],$a=0,ei=1,ss=2,ys=3,bs=4,js=new Qs(null,0,0),Li=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function So(ee){for(let i of ee)B.fill(i,-1);return ee[$a][bs]=0,ee[ei][bs]=0,ee[ei][$a]=28,ee[ys][bs]=0,ee[ss][bs]=0,ee[ss][$a]=15,ee}const ao=So(B.createInt32Array(6,6));class Mn{constructor(i,c,h,x){this.token=i,this.mode=c,this.binaryShiftByteCount=h,this.bitCount=x}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(i,c){let h=this.bitCount,x=this.token;if(i!==this.mode){let w=Li[this.mode][i];x=Ii(x,w&65535,w>>16),h+=w>>16}let y=i===ss?4:5;return x=Ii(x,c,y),new Mn(x,i,0,h+y)}shiftAndAppend(i,c){let h=this.token,x=this.mode===ss?4:5;return h=Ii(h,ao[this.mode][i],x),h=Ii(h,c,5),new Mn(h,this.mode,0,this.bitCount+x+5)}addBinaryShiftChar(i){let c=this.token,h=this.mode,x=this.bitCount;if(this.mode===bs||this.mode===ss){let S=Li[h][$a];c=Ii(c,S&65535,S>>16),x+=S>>16,h=$a}let y=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,w=new Mn(c,h,this.binaryShiftByteCount+1,x+y);return w.binaryShiftByteCount===2078&&(w=w.endBinaryShift(i+1)),w}endBinaryShift(i){if(this.binaryShiftByteCount===0)return this;let c=this.token;return c=Cc(c,i-this.binaryShiftByteCount,this.binaryShiftByteCount),new Mn(c,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(i){let c=this.bitCount+(Li[this.mode][i.mode]>>16);return this.binaryShiftByteCount<i.binaryShiftByteCount?c+=Mn.calculateBinaryShiftCost(i)-Mn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>i.binaryShiftByteCount&&i.binaryShiftByteCount>0&&(c+=10),c<=i.bitCount}toBitArray(i){let c=[];for(let x=this.endBinaryShift(i.length).token;x!==null;x=x.getPrevious())c.unshift(x);let h=new H;for(const x of c)x.appendTo(h,i);return h}toString(){return me.format("%s bits=%d bytes=%d",ro[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(i){return i.binaryShiftByteCount>62?21:i.binaryShiftByteCount>31?20:i.binaryShiftByteCount>0?10:0}}Mn.INITIAL_STATE=new Mn(js,$a,0,0);function Tc(ee){const i=me.getCharCode(" "),c=me.getCharCode("."),h=me.getCharCode(",");ee[$a][i]=1;const x=me.getCharCode("Z"),y=me.getCharCode("A");for(let oe=y;oe<=x;oe++)ee[$a][oe]=oe-y+2;ee[ei][i]=1;const w=me.getCharCode("z"),S=me.getCharCode("a");for(let oe=S;oe<=w;oe++)ee[ei][oe]=oe-S+2;ee[ss][i]=1;const A=me.getCharCode("9"),P=me.getCharCode("0");for(let oe=P;oe<=A;oe++)ee[ss][oe]=oe-P+2;ee[ss][h]=12,ee[ss][c]=13;const G=["\0"," ","","","","","","","\x07","\b"," ",`
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let oe=0;oe<G.length;oe++)ee[ys][me.getCharCode(G[oe])]=oe;const te=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let oe=0;oe<te.length;oe++)me.getCharCode(te[oe])>0&&(ee[bs][me.getCharCode(te[oe])]=oe);return ee}const is=Tc(B.createInt32Array(5,256));class Os{constructor(i){this.text=i}encode(){const i=me.getCharCode(" "),c=me.getCharCode(`
`);let h=Ec.singletonList(Mn.INITIAL_STATE);for(let y=0;y<this.text.length;y++){let w,S=y+1<this.text.length?this.text[y+1]:0;switch(this.text[y]){case me.getCharCode("\r"):w=S===c?2:0;break;case me.getCharCode("."):w=S===i?3:0;break;case me.getCharCode(","):w=S===i?4:0;break;case me.getCharCode(":"):w=S===i?5:0;break;default:w=0}w>0?(h=Os.updateStateListForPair(h,y,w),y++):h=this.updateStateListForChar(h,y)}return Ec.min(h,(y,w)=>y.getBitCount()-w.getBitCount()).toBitArray(this.text)}updateStateListForChar(i,c){const h=[];for(let x of i)this.updateStateForChar(x,c,h);return Os.simplifyStates(h)}updateStateForChar(i,c,h){let x=this.text[c]&255,y=is[i.getMode()][x]>0,w=null;for(let S=0;S<=bs;S++){let A=is[S][x];if(A>0){if(w==null&&(w=i.endBinaryShift(c)),!y||S===i.getMode()||S===ss){const P=w.latchAndAppend(S,A);h.push(P)}if(!y&&ao[i.getMode()][S]>=0){const P=w.shiftAndAppend(S,A);h.push(P)}}}if(i.getBinaryShiftByteCount()>0||is[i.getMode()][x]===0){let S=i.addBinaryShiftChar(c);h.push(S)}}static updateStateListForPair(i,c,h){const x=[];for(let y of i)this.updateStateForPair(y,c,h,x);return this.simplifyStates(x)}static updateStateForPair(i,c,h,x){let y=i.endBinaryShift(c);if(x.push(y.latchAndAppend(bs,h)),i.getMode()!==bs&&x.push(y.shiftAndAppend(bs,h)),h===3||h===4){let w=y.latchAndAppend(ss,16-h).latchAndAppend(ss,1);x.push(w)}if(i.getBinaryShiftByteCount()>0){let w=i.addBinaryShiftChar(c).addBinaryShiftChar(c+1);x.push(w)}}static simplifyStates(i){let c=[];for(const h of i){let x=!0;for(const y of c){if(y.isBetterThanOrEqualTo(h)){x=!1;break}h.isBetterThanOrEqualTo(y)&&(c=c.filter(w=>w!==y))}x&&c.push(h)}return c}}class zr{constructor(){}static encodeBytes(i){return zr.encode(i,zr.DEFAULT_EC_PERCENT,zr.DEFAULT_AZTEC_LAYERS)}static encode(i,c,h){let x=new Os(i).encode(),y=U.truncDivision(x.getSize()*c,100)+11,w=x.getSize()+y,S,A,P,G,te;if(h!==zr.DEFAULT_AZTEC_LAYERS){if(S=h<0,A=Math.abs(h),A>(S?zr.MAX_NB_BITS_COMPACT:zr.MAX_NB_BITS))throw new N(me.format("Illegal value %s for layers",h));P=zr.totalBitsInLayer(A,S),G=zr.WORD_SIZE[A];let Mt=P-P%G;if(te=zr.stuffBits(x,G),te.getSize()+y>Mt)throw new N("Data to large for user specified layer");if(S&&te.getSize()>G*64)throw new N("Data to large for user specified layer")}else{G=0,te=null;for(let Mt=0;;Mt++){if(Mt>zr.MAX_NB_BITS)throw new N("Data too large for an Aztec code");if(S=Mt<=3,A=S?Mt+1:Mt,P=zr.totalBitsInLayer(A,S),w>P)continue;(te==null||G!==zr.WORD_SIZE[A])&&(G=zr.WORD_SIZE[A],te=zr.stuffBits(x,G));let jr=P-P%G;if(!(S&&te.getSize()>G*64)&&te.getSize()+y<=jr)break}}let oe=zr.generateCheckWords(te,P,G),Ce=te.getSize()/G,Ie=zr.generateModeMessage(S,A,Ce),Pe=(S?11:14)+A*4,Ke=new Int32Array(Pe),it;if(S){it=Pe;for(let Mt=0;Mt<Ke.length;Mt++)Ke[Mt]=Mt}else{it=Pe+1+2*U.truncDivision(U.truncDivision(Pe,2)-1,15);let Mt=U.truncDivision(Pe,2),jr=U.truncDivision(it,2);for(let Sr=0;Sr<Mt;Sr++){let Qr=Sr+U.truncDivision(Sr,15);Ke[Mt-Sr-1]=jr-Qr-1,Ke[Mt+Sr]=jr+Qr+1}}let Bt=new Oe(it);for(let Mt=0,jr=0;Mt<A;Mt++){let Sr=(A-Mt)*4+(S?9:12);for(let Qr=0;Qr<Sr;Qr++){let kn=Qr*2;for(let Nn=0;Nn<2;Nn++)oe.get(jr+kn+Nn)&&Bt.set(Ke[Mt*2+Nn],Ke[Mt*2+Qr]),oe.get(jr+Sr*2+kn+Nn)&&Bt.set(Ke[Mt*2+Qr],Ke[Pe-1-Mt*2-Nn]),oe.get(jr+Sr*4+kn+Nn)&&Bt.set(Ke[Pe-1-Mt*2-Nn],Ke[Pe-1-Mt*2-Qr]),oe.get(jr+Sr*6+kn+Nn)&&Bt.set(Ke[Pe-1-Mt*2-Qr],Ke[Mt*2+Nn])}jr+=Sr*8}if(zr.drawModeMessage(Bt,S,it,Ie),S)zr.drawBullsEye(Bt,U.truncDivision(it,2),5);else{zr.drawBullsEye(Bt,U.truncDivision(it,2),7);for(let Mt=0,jr=0;Mt<U.truncDivision(Pe,2)-1;Mt+=15,jr+=16)for(let Sr=U.truncDivision(it,2)&1;Sr<it;Sr+=2)Bt.set(U.truncDivision(it,2)-jr,Sr),Bt.set(U.truncDivision(it,2)+jr,Sr),Bt.set(Sr,U.truncDivision(it,2)-jr),Bt.set(Sr,U.truncDivision(it,2)+jr)}let Pt=new Di;return Pt.setCompact(S),Pt.setSize(it),Pt.setLayers(A),Pt.setCodeWords(Ce),Pt.setMatrix(Bt),Pt}static drawBullsEye(i,c,h){for(let x=0;x<h;x+=2)for(let y=c-x;y<=c+x;y++)i.set(y,c-x),i.set(y,c+x),i.set(c-x,y),i.set(c+x,y);i.set(c-h,c-h),i.set(c-h+1,c-h),i.set(c-h,c-h+1),i.set(c+h,c-h),i.set(c+h,c-h+1),i.set(c+h,c+h-1)}static generateModeMessage(i,c,h){let x=new H;return i?(x.appendBits(c-1,2),x.appendBits(h-1,6),x=zr.generateCheckWords(x,28,4)):(x.appendBits(c-1,5),x.appendBits(h-1,11),x=zr.generateCheckWords(x,40,4)),x}static drawModeMessage(i,c,h,x){let y=U.truncDivision(h,2);if(c)for(let w=0;w<7;w++){let S=y-3+w;x.get(w)&&i.set(S,y-5),x.get(w+7)&&i.set(y+5,S),x.get(20-w)&&i.set(S,y+5),x.get(27-w)&&i.set(y-5,S)}else for(let w=0;w<10;w++){let S=y-5+w+U.truncDivision(w,5);x.get(w)&&i.set(S,y-7),x.get(w+10)&&i.set(y+7,S),x.get(29-w)&&i.set(S,y+7),x.get(39-w)&&i.set(y-7,S)}}static generateCheckWords(i,c,h){let x=i.getSize()/h,y=new ko(zr.getGF(h)),w=U.truncDivision(c,h),S=zr.bitsToWords(i,h,w);y.encode(S,w-x);let A=c%h,P=new H;P.appendBits(0,A);for(const G of Array.from(S))P.appendBits(G,h);return P}static bitsToWords(i,c,h){let x=new Int32Array(h),y,w;for(y=0,w=i.getSize()/c;y<w;y++){let S=0;for(let A=0;A<c;A++)S|=i.get(y*c+A)?1<<c-A-1:0;x[y]=S}return x}static getGF(i){switch(i){case 4:return Ht.AZTEC_PARAM;case 6:return Ht.AZTEC_DATA_6;case 8:return Ht.AZTEC_DATA_8;case 10:return Ht.AZTEC_DATA_10;case 12:return Ht.AZTEC_DATA_12;default:throw new N("Unsupported word size "+i)}}static stuffBits(i,c){let h=new H,x=i.getSize(),y=(1<<c)-2;for(let w=0;w<x;w+=c){let S=0;for(let A=0;A<c;A++)(w+A>=x||i.get(w+A))&&(S|=1<<c-1-A);(S&y)===y?(h.appendBits(S&y,c),w--):(S&y)===0?(h.appendBits(S|1,c),w--):h.appendBits(S,c)}return h}static totalBitsInLayer(i,c){return((c?88:112)+16*i)*i}}zr.DEFAULT_EC_PERCENT=33,zr.DEFAULT_AZTEC_LAYERS=0,zr.MAX_NB_BITS=32,zr.MAX_NB_BITS_COMPACT=4,zr.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Pi{encode(i,c,h,x){return this.encodeWithHints(i,c,h,x,null)}encodeWithHints(i,c,h,x,y){let w=to.ISO_8859_1,S=zr.DEFAULT_EC_PERCENT,A=zr.DEFAULT_AZTEC_LAYERS;return y!=null&&(y.has(Ra.CHARACTER_SET)&&(w=Yn.forName(y.get(Ra.CHARACTER_SET).toString())),y.has(Ra.ERROR_CORRECTION)&&(S=U.parseInt(y.get(Ra.ERROR_CORRECTION).toString())),y.has(Ra.AZTEC_LAYERS)&&(A=U.parseInt(y.get(Ra.AZTEC_LAYERS).toString()))),Pi.encodeLayers(i,c,h,x,w,S,A)}static encodeLayers(i,c,h,x,y,w,S){if(c!==pe.AZTEC)throw new N("Can only encode AZTEC, but got "+c);let A=zr.encode(me.getBytes(i,y),w,S);return Pi.renderResult(A,h,x)}static renderResult(i,c,h){let x=i.getMatrix();if(x==null)throw new tr;let y=x.getWidth(),w=x.getHeight(),S=Math.max(c,y),A=Math.max(h,w),P=Math.min(S/y,A/w),G=(S-y*P)/2,te=(A-w*P)/2,oe=new Oe(S,A);for(let Ce=0,Ie=te;Ce<w;Ce++,Ie+=P)for(let Pe=0,Ke=G;Pe<y;Pe++,Ke+=P)x.get(Pe,Ce)&&oe.setRegion(Ke,Ie,P,P);return oe}}t.AbstractExpandedDecoder=xe,t.ArgumentException=k,t.ArithmeticException=zt,t.AztecCode=Di,t.AztecCodeReader=Zt,t.AztecCodeWriter=Pi,t.AztecDecoder=ve,t.AztecDetector=It,t.AztecDetectorResult=pt,t.AztecEncoder=zr,t.AztecHighLevelEncoder=Os,t.AztecPoint=He,t.BarcodeFormat=pe,t.Binarizer=I,t.BinaryBitmap=C,t.BitArray=H,t.BitMatrix=Oe,t.BitSource=jn,t.BrowserAztecCodeReader=yr,t.BrowserBarcodeReader=xs,t.BrowserCodeReader=ae,t.BrowserDatamatrixCodeReader=Qi,t.BrowserMultiFormatReader=Ul,t.BrowserPDF417Reader=gi,t.BrowserQRCodeReader=Sc,t.BrowserQRCodeSvgWriter=xi,t.CharacterSetECI=Q,t.ChecksumException=O,t.Code128Reader=Ge,t.Code39Reader=Ct,t.DataMatrixDecodedBitStreamParser=On,t.DataMatrixReader=Kr,t.DecodeHintType=ne,t.DecoderResult=ft,t.DefaultGridSampler=Qt,t.DetectorResult=Wt,t.EAN13Reader=Tt,t.EncodeHintType=Ra,t.Exception=p,t.FormatException=V,t.GenericGF=Ht,t.GenericGFPoly=Lt,t.GlobalHistogramBinarizer=be,t.GridSampler=Nt,t.GridSamplerInstance=cr,t.HTMLCanvasElementLuminanceSource=_e,t.HybridBinarizer=re,t.ITFReader=Ft,t.IllegalArgumentException=N,t.IllegalStateException=tr,t.InvertedLuminanceSource=Ae,t.LuminanceSource=de,t.MathUtils=Le,t.MultiFormatOneDReader=Wa,t.MultiFormatReader=Nc,t.MultiFormatWriter=Mi,t.NotFoundException=ue,t.OneDReader=Ye,t.PDF417DecodedBitStreamParser=lt,t.PDF417DecoderErrorCorrection=ps,t.PDF417Reader=on,t.PDF417ResultMetadata=ji,t.PerspectiveTransform=At,t.PlanarYUVLuminanceSource=As,t.QRCodeByteMatrix=No,t.QRCodeDataMask=an,t.QRCodeDecodedBitStreamParser=da,t.QRCodeDecoderErrorCorrectionLevel=pr,t.QRCodeDecoderFormatInformation=Ya,t.QRCodeEncoder=xa,t.QRCodeEncoderQRCode=Oi,t.QRCodeMaskUtil=Oa,t.QRCodeMatrixUtil=hr,t.QRCodeMode=ur,t.QRCodeReader=Za,t.QRCodeVersion=Gt,t.QRCodeWriter=Js,t.RGBLuminanceSource=Ri,t.RSS14Reader=kr,t.RSSExpandedReader=ct,t.ReaderException=Xn,t.ReedSolomonDecoder=Kt,t.ReedSolomonEncoder=ko,t.ReedSolomonException=ht,t.Result=se,t.ResultMetadataType=Fe,t.ResultPoint=tt,t.StringUtils=me,t.UnsupportedOperationException=Te,t.VideoInputDevice=K,t.WhiteRectangleDetector=We,t.WriterException=ta,t.ZXingArrays=B,t.ZXingCharset=Yn,t.ZXingInteger=U,t.ZXingStandardCharsets=to,t.ZXingStringBuilder=Se,t.ZXingStringEncoding=je,t.ZXingSystem=M,t.createAbstractExpandedDecoder=Rt,Object.defineProperty(t,"__esModule",{value:!0})}))})(O0,O0.exports)),O0.exports}var Ia=QO();const eM=Sx(Ia),tM=mk({__proto__:null,default:eM},[Ia]);var xv=(function(){function e(r,t,n){if(this.formatMap=new Map([[ir.QR_CODE,Ia.BarcodeFormat.QR_CODE],[ir.AZTEC,Ia.BarcodeFormat.AZTEC],[ir.CODABAR,Ia.BarcodeFormat.CODABAR],[ir.CODE_39,Ia.BarcodeFormat.CODE_39],[ir.CODE_93,Ia.BarcodeFormat.CODE_93],[ir.CODE_128,Ia.BarcodeFormat.CODE_128],[ir.DATA_MATRIX,Ia.BarcodeFormat.DATA_MATRIX],[ir.MAXICODE,Ia.BarcodeFormat.MAXICODE],[ir.ITF,Ia.BarcodeFormat.ITF],[ir.EAN_13,Ia.BarcodeFormat.EAN_13],[ir.EAN_8,Ia.BarcodeFormat.EAN_8],[ir.PDF_417,Ia.BarcodeFormat.PDF_417],[ir.RSS_14,Ia.BarcodeFormat.RSS_14],[ir.RSS_EXPANDED,Ia.BarcodeFormat.RSS_EXPANDED],[ir.UPC_A,Ia.BarcodeFormat.UPC_A],[ir.UPC_E,Ia.BarcodeFormat.UPC_E],[ir.UPC_EAN_EXTENSION,Ia.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!tM)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=n;var o=this.createZXingFormats(r),u=new Map;u.set(Ia.DecodeHintType.POSSIBLE_FORMATS,o),u.set(Ia.DecodeHintType.TRY_HARDER,!1),this.hints=u}return e.prototype.decodeAsync=function(r){var t=this;return new Promise(function(n,o){try{n(t.decode(r))}catch(u){o(u)}})},e.prototype.decode=function(r){var t=new Ia.MultiFormatReader(this.verbose,this.hints),n=new Ia.HTMLCanvasElementLuminanceSource(r),o=new Ia.BinaryBitmap(new Ia.HybridBinarizer(n)),u=t.decode(o);return{text:u.text,format:v4.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var r=new Map;return this.formatMap.forEach(function(t,n,o){r.set(t,n)}),r},e.prototype.toHtml5QrcodeSupportedFormats=function(r){if(!this.reverseFormatMap.has(r))throw"reverseFormatMap doesn't have ".concat(r);return this.reverseFormatMap.get(r)},e.prototype.createZXingFormats=function(r){for(var t=[],n=0,o=r;n<o.length;n++){var u=o[n];this.formatMap.has(u)?t.push(this.formatMap.get(u)):this.logger.logError("".concat(u," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e})(),rM=function(e,r,t,n){function o(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function g(k){try{p(n.next(k))}catch(N){f(N)}}function v(k){try{p(n.throw(k))}catch(N){f(N)}}function p(k){k.done?u(k.value):o(k.value).then(g,v)}p((n=n.apply(e,r||[])).next())})},aM=function(e,r){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,o,u,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(p){return function(k){return v([p,k])}}function v(p){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(t=0)),t;)try{if(n=1,o&&(u=p[0]&2?o.return:p[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,p[1])).done)return u;switch(o=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){t.label=p[1];break}if(p[0]===6&&t.label<u[1]){t.label=u[1],u=p;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(p);break}u[2]&&t.ops.pop(),t.trys.pop();continue}p=r.call(e,t)}catch(k){p=[6,k],o=0}finally{n=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},pv=(function(){function e(r,t,n){if(this.formatMap=new Map([[ir.QR_CODE,"qr_code"],[ir.AZTEC,"aztec"],[ir.CODABAR,"codabar"],[ir.CODE_39,"code_39"],[ir.CODE_93,"code_93"],[ir.CODE_128,"code_128"],[ir.DATA_MATRIX,"data_matrix"],[ir.ITF,"itf"],[ir.EAN_13,"ean_13"],[ir.EAN_8,"ean_8"],[ir.PDF_417,"pdf417"],[ir.UPC_A,"upc_a"],[ir.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=t,this.logger=n;var o=this.createBarcodeDetectorFormats(r);if(this.detector=new BarcodeDetector(o),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var r=new BarcodeDetector({formats:["qr_code"]});return typeof r!="undefined"},e.prototype.decodeAsync=function(r){return rM(this,void 0,void 0,function(){var t,n;return aM(this,function(o){switch(o.label){case 0:return[4,this.detector.detect(r)];case 1:if(t=o.sent(),!t||t.length===0)throw"No barcode or QR code detected.";return n=this.selectLargestBarcode(t),[2,{text:n.rawValue,format:v4.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(r){for(var t=null,n=0,o=0,u=r;o<u.length;o++){var f=u[o],g=f.boundingBox.width*f.boundingBox.height;g>n&&(n=g,t=f)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(r){for(var t=[],n=0,o=r;n<o.length;n++){var u=o[n];this.formatMap.has(u)?t.push(this.formatMap.get(u)):this.logger.warn("".concat(u," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(r){if(!this.reverseFormatMap.has(r))throw"reverseFormatMap doesn't have ".concat(r);return this.reverseFormatMap.get(r)},e.prototype.createReverseFormatMap=function(){var r=new Map;return this.formatMap.forEach(function(t,n,o){r.set(t,n)}),r},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e})(),yv=function(e,r,t,n){function o(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function g(k){try{p(n.next(k))}catch(N){f(N)}}function v(k){try{p(n.throw(k))}catch(N){f(N)}}function p(k){k.done?u(k.value):o(k.value).then(g,v)}p((n=n.apply(e,r||[])).next())})},bv=function(e,r){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,o,u,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(p){return function(k){return v([p,k])}}function v(p){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(t=0)),t;)try{if(n=1,o&&(u=p[0]&2?o.return:p[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,p[1])).done)return u;switch(o=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){t.label=p[1];break}if(p[0]===6&&t.label<u[1]){t.label=u[1],u=p;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(p);break}u[2]&&t.ops.pop(),t.trys.pop();continue}p=r.call(e,t)}catch(k){p=[6,k],o=0}finally{n=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},nM=(function(){function e(r,t,n,o){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,t&&pv.isSupported()?(this.primaryDecoder=new pv(r,n,o),this.secondaryDecoder=new xv(r,n,o)):this.primaryDecoder=new xv(r,n,o)}return e.prototype.decodeAsync=function(r){return yv(this,void 0,void 0,function(){var t;return bv(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(r)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(r){return yv(this,void 0,void 0,function(){var t,n;return bv(this,function(o){switch(o.label){case 0:t=performance.now(),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(r)];case 2:return[2,o.sent()];case 3:if(n=o.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(r)];throw n;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(r){if(this.verbose){var t=performance.now()-r;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var r=0,t=0,n=this.executionResults;t<n.length;t++){var o=n[t];r+=o}var u=r/this.executionResults.length;console.log("".concat(u," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e})(),dp=(function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(n[u]=o[u])},e(r,t)};return function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");e(r,t);function n(){this.constructor=r}r.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),dh=function(e,r,t,n){function o(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function g(k){try{p(n.next(k))}catch(N){f(N)}}function v(k){try{p(n.throw(k))}catch(N){f(N)}}function p(k){k.done?u(k.value):o(k.value).then(g,v)}p((n=n.apply(e,r||[])).next())})},uh=function(e,r){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,o,u,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(p){return function(k){return v([p,k])}}function v(p){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(t=0)),t;)try{if(n=1,o&&(u=p[0]&2?o.return:p[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,p[1])).done)return u;switch(o=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){t.label=p[1];break}if(p[0]===6&&t.label<u[1]){t.label=u[1],u=p;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(p);break}u[2]&&t.ops.pop(),t.trys.pop();continue}p=r.call(e,t)}catch(k){p=[6,k],o=0}finally{n=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},w4=(function(){function e(r,t){this.name=r,this.track=t}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(r){var t={};t[this.name]=r;var n={advanced:[t]};return this.track.applyConstraints(n)},e.prototype.value=function(){var r=this.track.getSettings();if(this.name in r){var t=r[this.name];return t}return null},e})(),sM=(function(e){dp(r,e);function r(t,n){return e.call(this,t,n)||this}return r.prototype.min=function(){return this.getCapabilities().min},r.prototype.max=function(){return this.getCapabilities().max},r.prototype.step=function(){return this.getCapabilities().step},r.prototype.apply=function(t){var n={};n[this.name]=t;var o={advanced:[n]};return this.track.applyConstraints(o)},r.prototype.getCapabilities=function(){this.failIfNotSupported();var t=this.track.getCapabilities(),n=t[this.name];return{min:n.min,max:n.max,step:n.step}},r.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},r})(w4),iM=(function(e){dp(r,e);function r(t){return e.call(this,"zoom",t)||this}return r})(sM),oM=(function(e){dp(r,e);function r(t){return e.call(this,"torch",t)||this}return r})(w4),lM=(function(){function e(r){this.track=r}return e.prototype.zoomFeature=function(){return new iM(this.track)},e.prototype.torchFeature=function(){return new oM(this.track)},e})(),cM=(function(){function e(r,t,n){this.isClosed=!1,this.parentElement=r,this.mediaStream=t,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),r.append(this.surface)}return e.prototype.createVideoElement=function(r){var t=document.createElement("video");return t.style.width="".concat(r,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var r=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var n=r.surface.clientWidth,o=r.surface.clientHeight;r.callbacks.onRenderSurfaceReady(n,o),r.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(r,t,n,o){return dh(this,void 0,void 0,function(){var u,f;return uh(this,function(g){switch(g.label){case 0:return u=new e(r,t,o),n.aspectRatio?(f={aspectRatio:n.aspectRatio},[4,u.getFirstTrackOrFail().applyConstraints(f)]):[3,2];case 1:g.sent(),g.label=2;case 2:return u.setupSurface(),[2,u]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(r){this.failIfClosed();var t=this,n=function(){setTimeout(r,200),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(r){return dh(this,void 0,void 0,function(){return uh(this,function(t){if("aspectRatio"in r)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(r)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var r=this;return new Promise(function(t,n){var o=r.mediaStream.getVideoTracks(),u=o.length,f=0;r.mediaStream.getVideoTracks().forEach(function(g){r.mediaStream.removeTrack(g),g.stop(),++f,f>=u&&(r.isClosed=!0,r.parentElement.removeChild(r.surface),t())})})},e.prototype.getCapabilities=function(){return new lM(this.getFirstTrackOrFail())},e})(),dM=(function(){function e(r){this.mediaStream=r}return e.prototype.render=function(r,t,n){return dh(this,void 0,void 0,function(){return uh(this,function(o){return[2,cM.create(r,this.mediaStream,t,n)]})})},e.create=function(r){return dh(this,void 0,void 0,function(){var t,n;return uh(this,function(o){switch(o.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return t={audio:!1,video:r},[4,navigator.mediaDevices.getUserMedia(t)];case 1:return n=o.sent(),[2,new e(n)]}})})},e})(),vv=function(e,r,t,n){function o(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function g(k){try{p(n.next(k))}catch(N){f(N)}}function v(k){try{p(n.throw(k))}catch(N){f(N)}}function p(k){k.done?u(k.value):o(k.value).then(g,v)}p((n=n.apply(e,r||[])).next())})},_v=function(e,r){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,o,u,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(p){return function(k){return v([p,k])}}function v(p){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(t=0)),t;)try{if(n=1,o&&(u=p[0]&2?o.return:p[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,p[1])).done)return u;switch(o=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){t.label=p[1];break}if(p[0]===6&&t.label<u[1]){t.label=u[1],u=p;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(p);break}u[2]&&t.ops.pop(),t.trys.pop();continue}p=r.call(e,t)}catch(k){p=[6,k],o=0}finally{n=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},uM=(function(){function e(){}return e.failIfNotSupported=function(){return vv(this,void 0,void 0,function(){return _v(this,function(r){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(r){return vv(this,void 0,void 0,function(){return _v(this,function(t){return[2,dM.create(r)]})})},e})(),fM=function(e,r,t,n){function o(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function g(k){try{p(n.next(k))}catch(N){f(N)}}function v(k){try{p(n.throw(k))}catch(N){f(N)}}function p(k){k.done?u(k.value):o(k.value).then(g,v)}p((n=n.apply(e,r||[])).next())})},hM=function(e,r){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,o,u,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(p){return function(k){return v([p,k])}}function v(p){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(t=0)),t;)try{if(n=1,o&&(u=p[0]&2?o.return:p[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,p[1])).done)return u;switch(o=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){t.label=p[1];break}if(p[0]===6&&t.label<u[1]){t.label=u[1],u=p;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(p);break}u[2]&&t.ops.pop(),t.trys.pop();continue}p=r.call(e,t)}catch(k){p=[6,k],o=0}finally{n=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},mM=(function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var r=MediaStreamTrack;return MediaStreamTrack&&r.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var r=md.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(r=md.insecureContextCameraQueryError()),Promise.reject(r)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var r=location.host.split(":")[0];return r==="127.0.0.1"||r==="localhost"},e.getCamerasFromMediaDevices=function(){return fM(this,void 0,void 0,function(){var r,t,n,o,u,f,g;return hM(this,function(v){switch(v.label){case 0:return r=function(p){for(var k=p.getVideoTracks(),N=0,C=k;N<C.length;N++){var O=C[N];O.enabled=!1,O.stop(),p.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=v.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=v.sent(),o=[],u=0,f=n;u<f.length;u++)g=f[u],g.kind==="videoinput"&&o.push({id:g.deviceId,label:g.label});return r(t),[2,o]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(r,t){var n=function(u){for(var f=[],g=0,v=u;g<v.length;g++){var p=v[g];p.kind==="video"&&f.push({id:p.id,label:p.label})}r(f)},o=MediaStreamTrack;o.getSources(n)})},e})(),Qa;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(Qa||(Qa={}));var gM=(function(){function e(){this.state=Qa.NOT_STARTED,this.onGoingTransactionNewState=Qa.UNKNOWN}return e.prototype.directTransition=function(r){this.failIfTransitionOngoing(),this.validateTransition(r),this.state=r},e.prototype.startTransition=function(r){return this.failIfTransitionOngoing(),this.validateTransition(r),this.onGoingTransactionNewState=r,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===Qa.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var r=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Qa.UNKNOWN,this.directTransition(r)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===Qa.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Qa.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Qa.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(r){switch(this.state){case Qa.UNKNOWN:throw"Transition from unknown is not allowed";case Qa.NOT_STARTED:this.failIfNewStateIs(r,[Qa.PAUSED]);break;case Qa.SCANNING:break;case Qa.PAUSED:break}},e.prototype.failIfNewStateIs=function(r,t){for(var n=0,o=t;n<o.length;n++){var u=o[n];if(r===u)throw"Cannot transition from ".concat(this.state," to ").concat(r)}},e})(),xM=(function(){function e(r){this.stateManager=r}return e.prototype.startTransition=function(r){return this.stateManager.startTransition(r)},e.prototype.directTransition=function(r){this.stateManager.directTransition(r)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===Qa.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==Qa.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Qa.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===Qa.PAUSED},e})(),pM=(function(){function e(){}return e.create=function(){return new xM(new gM)},e})(),yM=(function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(n[u]=o[u])},e(r,t)};return function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");e(r,t);function n(){this.constructor=r}r.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),ii=(function(e){yM(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}return r.DEFAULT_WIDTH=300,r.DEFAULT_WIDTH_OFFSET=2,r.FILE_SCAN_MIN_HEIGHT=300,r.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,r.MIN_QR_BOX_SIZE=50,r.SHADED_LEFT=1,r.SHADED_RIGHT=2,r.SHADED_TOP=3,r.SHADED_BOTTOM=4,r.SHADED_REGION_ELEMENT_ID="qr-shaded-region",r.VERBOSE=!1,r.BORDER_SHADER_DEFAULT_COLOR="#ffffff",r.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",r})($O),bM=(function(){function e(r,t){this.logger=t,this.fps=ii.SCAN_DEFAULT_FPS,r?(r.fps&&(this.fps=r.fps),this.disableFlip=r.disableFlip===!0,this.qrbox=r.qrbox,this.aspectRatio=r.aspectRatio,this.videoConstraints=r.videoConstraints):this.disableFlip=ii.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?_4.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!zo(this.qrbox)},e.create=function(r,t){return new e(r,t)},e})(),vM=(function(){function e(r,t){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(r))throw"HTML Element with id=".concat(r," not found");this.elementId=r,this.verbose=!1;var n;typeof t=="boolean"?this.verbose=t===!0:t&&(n=t,this.verbose=n.verbose===!0,n.experimentalFeatures),this.logger=new KO(this.verbose),this.qrcode=new nM(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=pM.create()}return e.prototype.start=function(r,t,n,o){var u=this;if(!r)throw"cameraIdOrConfig is required";if(!n||typeof n!="function")throw"qrCodeSuccessCallback is required and should be a function.";var f;o?f=o:f=this.verbose?this.logger.log:function(){};var g=bM.create(t,this.logger);this.clearElement();var v=!1;g.videoConstraints&&(g.isMediaStreamConstraintsValid()?v=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var p=v,k=document.getElementById(this.elementId);k.clientWidth?k.clientWidth:ii.DEFAULT_WIDTH,k.style.position="relative",this.shouldScan=!0,this.element=k;var N=this,C=this.stateManagerProxy.startTransition(Qa.SCANNING);return new Promise(function(O,I){var M=p?g.videoConstraints:N.createVideoConstraints(r);if(!M){C.cancel(),I("videoConstraints should be defined");return}var D={};(!p||g.aspectRatio)&&(D.aspectRatio=g.aspectRatio);var z={onRenderSurfaceReady:function(B,U){N.setupUi(B,U,g),N.isScanning=!0,N.foreverScan(g,n,f)}};uM.failIfNotSupported().then(function(B){B.create(M).then(function(U){return U.render(u.element,D,z).then(function(H){N.renderedCamera=H,C.execute(),O(null)}).catch(function(H){C.cancel(),I(H)})}).catch(function(U){C.cancel(),I(md.errorGettingUserMedia(U))})}).catch(function(B){C.cancel(),I(md.cameraStreamingNotSupported())})})},e.prototype.pause=function(r){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Qa.PAUSED),this.showPausedState(),(zo(r)||r!==!0)&&(r=!1),r&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var r=this,t=function(){r.stateManagerProxy.directTransition(Qa.SCANNING),r.hidePausedState()};if(!this.renderedCamera.isPaused()){t();return}this.renderedCamera.resume(function(){t()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var r=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(Qa.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=function(){if(r.element){var u=document.getElementById(ii.SHADED_REGION_ELEMENT_ID);u&&r.element.removeChild(u)}},o=this;return this.renderedCamera.close().then(function(){return o.renderedCamera=null,o.element&&(o.element.removeChild(o.canvasElement),o.canvasElement=null),n(),o.qrRegion&&(o.qrRegion=null),o.context&&(o.context=null),t.execute(),o.hidePausedState(),o.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(r,t){return this.scanFileV2(r,t).then(function(n){return n.decodedText})},e.prototype.scanFileV2=function(r,t){var n=this;if(!r||!(r instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(zo(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(o,u){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(r);var f=new Image;f.onload=function(){var g=f.width,v=f.height,p=document.getElementById(n.elementId),k=p.clientWidth?p.clientWidth:ii.DEFAULT_WIDTH,N=Math.max(p.clientHeight?p.clientHeight:v,ii.FILE_SCAN_MIN_HEIGHT),C=n.computeCanvasDrawConfig(g,v,k,N);if(t){var O=n.createCanvasElement(k,N,"qr-canvas-visible");O.style.display="inline-block",p.appendChild(O);var I=O.getContext("2d");if(!I)throw"Unable to get 2d context from canvas";I.canvas.width=k,I.canvas.height=N,I.drawImage(f,0,0,g,v,C.x,C.y,C.width,C.height)}var M=ii.FILE_SCAN_HIDDEN_CANVAS_PADDING,D=Math.max(f.width,C.width),z=Math.max(f.height,C.height),B=D+2*M,U=z+2*M,H=n.createCanvasElement(B,U);p.appendChild(H);var q=H.getContext("2d");if(!q)throw"Unable to get 2d context from canvas";q.canvas.width=B,q.canvas.height=U,q.drawImage(f,0,0,g,v,M,M,D,z);try{n.qrcode.decodeRobustlyAsync(H).then(function(ne){o(mv.createFromQrcodeResult(ne))}).catch(u)}catch(ne){u("QR code parse error, error = ".concat(ne))}},f.onerror=u,f.onabort=u,f.onstalled=u,f.onsuspend=u,f.src=URL.createObjectURL(r)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return mM.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(r){if(r){if(!_4.isMediaStreamConstraintsValid(r,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(r)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(r){var t=[ir.QR_CODE,ir.AZTEC,ir.CODABAR,ir.CODE_39,ir.CODE_93,ir.CODE_128,ir.DATA_MATRIX,ir.MAXICODE,ir.ITF,ir.EAN_13,ir.EAN_8,ir.PDF_417,ir.RSS_14,ir.RSS_EXPANDED,ir.UPC_A,ir.UPC_E,ir.UPC_EAN_EXTENSION];if(!r||typeof r=="boolean"||!r.formatsToSupport)return t;if(!Array.isArray(r.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(r.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],o=0,u=r.formatsToSupport;o<u.length;o++){var f=u[o];ZO(f)?n.push(f):this.logger.warn("Invalid format: ".concat(f," passed in config, ignoring."))}if(n.length===0)throw"None of formatsToSupport match supported values.";return n},e.prototype.getUseBarCodeDetectorIfSupported=function(r){if(zo(r))return!0;if(!zo(r.useBarCodeDetectorIfSupported))return r.useBarCodeDetectorIfSupported!==!1;if(zo(r.experimentalFeatures))return!0;var t=r.experimentalFeatures;return zo(t.useBarCodeDetectorIfSupported)?!0:t.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(r,t,n){var o=this,u=n.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(r,t,u),g=function(p){if(p<ii.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ii.MIN_QR_BOX_SIZE,"px.")},v=function(p){return p>r&&(o.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),p=r),p};g(f.width),g(f.height),f.width=v(f.width)},e.prototype.validateQrboxConfig=function(r){if(typeof r!="number"&&typeof r!="function"&&(r.width===void 0||r.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(r,t,n){if(typeof n=="number")return{width:n,height:n};if(typeof n=="function")try{return n(r,t)}catch(o){throw new Error("qrbox config was passed as a function but it failed with unknown error"+o)}return n},e.prototype.setupUi=function(r,t,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(r,t,n);var o=zo(n.qrbox)?{width:r,height:t}:n.qrbox;this.validateQrboxConfig(o);var u=this.toQrdimensions(r,t,o);u.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var f=n.isShadedBoxEnabled()&&u.height<=t,g={x:0,y:0,width:r,height:t},v=f?this.getShadedRegionBounds(r,t,u):g,p=this.createCanvasElement(v.width,v.height),k={willReadFrequently:!0},N=p.getContext("2d",k);N.canvas.width=v.width,N.canvas.height=v.height,this.element.append(p),f&&this.possiblyInsertShadingElement(this.element,r,t,u),this.createScannerPausedUiElement(this.element),this.qrRegion=v,this.context=N,this.canvasElement=p},e.prototype.createScannerPausedUiElement=function(r){var t=document.createElement("div");t.innerText=md.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",r.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(r,t){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(o){return r(o.text,mv.createFromQrcodeResult(o)),n.possiblyUpdateShaders(!0),!0}).catch(function(o){n.possiblyUpdateShaders(!1);var u=md.codeParseError(o);return t(u,qO.createFrom(u)),!1})},e.prototype.foreverScan=function(r,t,n){var o=this;if(this.shouldScan&&this.renderedCamera){var u=this.renderedCamera.getSurface(),f=u.videoWidth/u.clientWidth,g=u.videoHeight/u.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var v=this.qrRegion.width*f,p=this.qrRegion.height*g,k=this.qrRegion.x*f,N=this.qrRegion.y*g;this.context.drawImage(u,k,N,v,p,0,0,this.qrRegion.width,this.qrRegion.height);var C=function(){o.foreverScanTimeout=setTimeout(function(){o.foreverScan(r,t,n)},o.getTimeoutFps(r.fps))};this.scanContext(t,n).then(function(O){!O&&r.disableFlip!==!0?(o.context.translate(o.context.canvas.width,0),o.context.scale(-1,1),o.scanContext(t,n).finally(function(){C()})):C()}).catch(function(O){o.logger.logError("Error happend while scanning context",O),C()})}},e.prototype.createVideoConstraints=function(r){if(typeof r=="string")return{deviceId:{exact:r}};if(typeof r=="object"){var t="facingMode",n="deviceId",o={user:!0,environment:!0},u="exact",f=function(I){if(I in o)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(I,"'")},g=Object.keys(r);if(g.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(g.length," keys");var v=Object.keys(r)[0];if(v!==t&&v!==n)throw"Only '".concat(t,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(v===t){var p=r.facingMode;if(typeof p=="string"){if(f(p))return{facingMode:p}}else if(typeof p=="object")if(u in p){if(f(p["".concat(u)]))return{facingMode:{exact:p["".concat(u)]}}}else throw"'facingMode' should be string or object with"+" ".concat(u," as key.");else{var k=typeof p;throw"Invalid type of 'facingMode' = ".concat(k)}}else{var N=r.deviceId;if(typeof N=="string")return{deviceId:N};if(typeof N=="object"){if(u in N)return{deviceId:{exact:N["".concat(u)]}};throw"'deviceId' should be string or object with"+" ".concat(u," as key.")}else{var C=typeof N;throw"Invalid type of 'deviceId' = ".concat(C)}}}var O=typeof r;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},e.prototype.computeCanvasDrawConfig=function(r,t,n,o){if(r<=n&&t<=o){var u=(n-r)/2,f=(o-t)/2;return{x:u,y:f,width:r,height:t}}else{var g=r,v=t;return r>n&&(t=n/r*t,r=n),t>o&&(r=o/t*r,t=o),this.logger.log("Image downsampled from "+"".concat(g,"X").concat(v)+" to ".concat(r,"X").concat(t,".")),this.computeCanvasDrawConfig(r,t,n,o)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var r=document.getElementById(this.elementId);r&&(r.innerHTML="")},e.prototype.possiblyUpdateShaders=function(r){this.qrMatch!==r&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=r?ii.BORDER_SHADER_MATCH_COLOR:ii.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=r)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(r,t,n){var o=r,u=t,f=document.createElement("canvas");return f.style.width="".concat(o,"px"),f.style.height="".concat(u,"px"),f.style.display="none",f.id=zo(n)?"qr-canvas":n,f},e.prototype.getShadedRegionBounds=function(r,t,n){if(n.width>r||n.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(r-n.width)/2,y:(t-n.height)/2,width:n.width,height:n.height}},e.prototype.possiblyInsertShadingElement=function(r,t,n,o){if(!(t-o.width<1||n-o.height<1)){var u=document.createElement("div");u.style.position="absolute";var f=(t-o.width)/2,g=(n-o.height)/2;if(u.style.borderLeft="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderRight="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderTop="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderBottom="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),u.style.boxSizing="border-box",u.style.top="0px",u.style.bottom="0px",u.style.left="0px",u.style.right="0px",u.id="".concat(ii.SHADED_REGION_ELEMENT_ID),t-o.width<11||n-o.height<11)this.hasBorderShaders=!1;else{var v=5,p=40;this.insertShaderBorders(u,p,v,-v,null,0,!0),this.insertShaderBorders(u,p,v,-v,null,0,!1),this.insertShaderBorders(u,p,v,null,-v,0,!0),this.insertShaderBorders(u,p,v,null,-v,0,!1),this.insertShaderBorders(u,v,p+v,-v,null,-v,!0),this.insertShaderBorders(u,v,p+v,null,-v,-v,!0),this.insertShaderBorders(u,v,p+v,-v,null,-v,!1),this.insertShaderBorders(u,v,p+v,null,-v,-v,!1),this.hasBorderShaders=!0}r.append(u)}},e.prototype.insertShaderBorders=function(r,t,n,o,u,f,g){var v=document.createElement("div");v.style.position="absolute",v.style.backgroundColor=ii.BORDER_SHADER_DEFAULT_COLOR,v.style.width="".concat(t,"px"),v.style.height="".concat(n,"px"),o!==null&&(v.style.top="".concat(o,"px")),u!==null&&(v.style.bottom="".concat(u,"px")),g?v.style.left="".concat(f,"px"):v.style.right="".concat(f,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(v),r.appendChild(v)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(r){return 1e3/r},e})(),wv;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(wv||(wv={}));const $g="/asm_app";function _M(e){const r=(e||"").trim();if(!r)return null;let t=r;try{if(/^https?:\/\//i.test(r)){const n=new URL(r);t=n.pathname+n.search+n.hash}}catch(n){}return(t.startsWith($g+"/")||t===$g)&&(t=t.slice($g.length)||"/"),t.startsWith("/")?t.split("?")[0]||t:/^(ACC-ASS-|AST-|ACC-WO-)/i.test(t)||/^[A-Z0-9-]+$/i.test(t)?/^(ACC-WO-|WO-)/i.test(t)?`/work-orders/${t}`:`/assets/${t}`:null}const wM=({isOpen:e,onClose:r,onScan:t,title:n="Scan QR Code",facingMode:o="environment"})=>{const u=ma(),g=`qr-reader-${R.useId().replace(/:/g,"")}`,v=R.useRef(null),p=R.useRef(!1),[k,N]=R.useState(null),[C,O]=R.useState(!1),I=()=>Ne(null,null,function*(){const D=v.current;if(v.current=null,!!D)try{D.isScanning&&(yield D.stop()),D.clear()}catch(z){}}),M=D=>Ne(null,null,function*(){if(p.current)return;p.current=!0;const z=_M(D);if(t){yield I(),r(),t(D,z);return}if(z){yield I(),r(),u(z);return}p.current=!1,N(`Unrecognized QR code: ${D}`)});return R.useEffect(()=>{if(!e)return;let D=!1;p.current=!1,N(null),O(!0);const z=()=>Ne(null,null,function*(){try{if(yield I(),D)return;const U=new vM(g);v.current=U,yield U.start({facingMode:o},{fps:10,qrbox:(H,q)=>{const ne=Math.min(H,q),V=Math.max(180,Math.floor(ne*.7));return{width:V,height:V}},aspectRatio:1},H=>{M(H)},()=>{})}catch(U){if(console.error("QR scanner start failed:",U),!D){const H=U instanceof Error?U.message:"Could not open camera";N(H.includes("NotAllowedError")||H.toLowerCase().includes("permission")?"Camera permission denied. Please allow camera access and try again.":`Camera unavailable: ${H}`)}}finally{D||O(!1)}}),B=window.setTimeout(()=>{z()},100);return()=>{D=!0,window.clearTimeout(B),I()}},[e,g,o]),e?Dx.createPortal(a.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/70 p-4",children:a.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl bg-white shadow-2xl dark:bg-gray-800",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-700",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-base font-semibold text-gray-900 dark:text-white",children:[a.jsx(o_,{className:"text-teal-600"}),n]}),a.jsx("button",{type:"button",onClick:()=>{I().then(r)},className:"rounded-lg p-2 text-gray-500 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","aria-label":"Close scanner",children:a.jsx(Yt,{})})]}),a.jsxs("div",{className:"space-y-3 p-4",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Point the camera at an asset QR code. You will stay inside the app."}),C&&!k&&a.jsx("p",{className:"text-center text-sm text-teal-600 dark:text-teal-400",children:"Starting camera…"}),k&&a.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300",children:k}),a.jsx("div",{id:g,className:"overflow-hidden rounded-lg bg-black [&_video]:max-h-[60vh] [&_video]:w-full [&_video]:object-cover"})]}),a.jsx("div",{className:"border-t border-gray-200 px-4 py-3 dark:border-gray-700",children:a.jsx("button",{type:"button",onClick:()=>{I().then(r)},className:"w-full rounded-lg bg-gray-200 px-4 py-2 text-sm font-medium text-gray-800 hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600",children:"Cancel"})})]})}),document.body):null},kM=({className:e,label:r="Scan QR",title:t,onScan:n})=>{const[o,u]=R.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>u(!0),className:e||"bg-teal-600 hover:bg-teal-700 text-white px-4 py-2 rounded-lg flex items-center justify-center gap-2 shadow transition-all w-full sm:w-auto",children:[a.jsx(o_,{}),a.jsx("span",{className:"font-medium",children:r})]}),a.jsx(wM,{isOpen:o,onClose:()=>u(!1),onScan:n,title:t})]})},NM=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const{t:v}=Xa(),[p,k]=R.useState(t>0?"selected":"all_with_filters"),[N,C]=R.useState("csv"),[O,I]=R.useState(g.filter(B=>B.default).map(B=>B.key));R.useEffect(()=>{t>0?k("selected"):k("all_with_filters")},[t]);const M=B=>{I(U=>U.includes(B)?U.filter(H=>H!==B):[...U,B])},D=()=>{I(g.map(B=>B.key))},z=()=>{I(g.filter(B=>B.default).map(B=>B.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(Cs,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[v("listPages.export")," ",v("assets.title")]})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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:v("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 ${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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>k("selected"),disabled:t===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 ",t," selected asset",t!==1?"s":""]})]}),t>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:[t," 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:()=>k("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 ",o," asset",o!==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:[o," 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:()=>k("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 ",n," asset",n!==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:[n," 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:v("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 ${N==="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:N==="csv",onChange:()=>C("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:v("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 ${N==="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:N==="excel",onChange:()=>C("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:v("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:D,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:z,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:g.map(B=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${O.includes(B.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:O.includes(B.key),onChange:()=>M(B.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:B.label})]},B.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[O.length," column",O.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 ${t} selected row${t!==1?"s":""}`,p==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(p,N,O),disabled:O.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},SM=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState(0),[o,u]=R.useState(""),[f,g]=R.useState(null),[v,p]=R.useState(null),k=R.useRef(null),N=20,C=[{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}],[O,I]=R.useState(!1),[M,D]=R.useState(new Set),[z,B]=R.useState(!1),[U,H]=R.useState(!1),{permissionFilters:q,loading:ne,error:V,hasAnyRestrictions:J}=b4("Asset"),[Q,Te]=R.useState(!1),je=["Maintenance Manager","Maintenance User","System Manager"];R.useEffect(()=>{Ne(null,null,function*(){try{console.log("🔍 [Role Check] Starting role check...");const ze=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:je.join(",")})})).json();console.log("🔍 [Role Check] API Response:",ze),ze.message?(console.log("🔍 [Role Check] User roles:",ze.message.user_roles),console.log("🔍 [Role Check] Matching roles:",ze.message.matching_roles),console.log("✅ [Role Check] Has allowed role:",ze.message.has_role),Te(ze.message.has_role)):(console.error("❌ [Role Check] Invalid response:",ze),Te(!1))}catch(Be){console.error("❌ [Role Check] Error:",Be),Te(!1)}})},[]);const[me,Se]=R.useState(""),[Oe,ue]=R.useState(""),[be,re]=R.useState(""),[de,Ae]=R.useState(""),[_e,K]=R.useState(""),[W,ae]=R.useState(""),[se,he]=R.useState(""),[pe,Je]=R.useState(""),[Fe,ft]=R.useState(""),[ot,Lt]=R.useState(""),[zt,Ht]=R.useState(""),[ht,tr]=R.useState(!0),[Kt,gt]=R.useState(0),[ve,Le]=R.useState([]),[ut,tt]=R.useState(!1),[Wt,pt]=R.useState(""),[We,Nt]=R.useState(""),[At,Qt]=R.useState(""),cr=R.useRef(null),He=R.useRef(null);R.useEffect(()=>{const ge=localStorage.getItem("assetFilterPresets");ge&&Le(JSON.parse(ge))},[]),R.useEffect(()=>{const ge=[me,Oe,be,W,se,pe,de,_e,Fe,ot,zt,o].filter(Boolean).length;gt(ge)},[me,Oe,be,W,se,pe,de,_e,Fe,ot,zt,o]);const It={};me&&(It.name=me),Oe&&(It.company=Oe),be&&(It.custom_site=be),de&&(It.custom_manufacturer=de),_e&&(It.supplier=_e),W&&(It.location=W),se&&(It.department=se),pe&&(It.custom_modality=pe),Fe&&(It.custom_device_status=Fe),ot&&(It.asset_name=["like",`%${ot}%`]),zt&&(It.custom_serial_number=["like",`%${zt}%`]),o&&(It.asset_name=["like",`%${o}%`]);const{assets:Zt,totalCount:yr,hasMore:Ye,loading:Ge,error:Ct,refetch:Ft}=aE(It,N,t*N,"creation desc",q),{deleteAsset:Jt,loading:Dr}=F_();R.useEffect(()=>{!Ge&&!O&&!ne&&I(!0)},[Ge,O,ne]),R.useEffect(()=>{t!==0&&n(0)},[me,Oe,be,de,_e,W,se,pe,Fe,ot,zt,o]),R.useEffect(()=>{D(new Set)},[me,Oe,be,de,_e,W,se,pe,Fe,ot,zt,o,t]);const kt=ge=>{Nt(ge),cr.current&&clearTimeout(cr.current),cr.current=window.setTimeout(()=>{Lt(ge)},800)},Re=ge=>{Qt(ge),He.current&&clearTimeout(He.current),He.current=window.setTimeout(()=>{Ht(ge)},800)},qe=(ge,Be)=>{ge.key==="Enter"&&(ge.preventDefault(),Be==="assetName"?(cr.current&&clearTimeout(cr.current),Lt(We)):Be==="serialNumber"&&(He.current&&clearTimeout(He.current),Ht(At)))},Tt=()=>{if(!Wt.trim()){alert("Please enter a filter name");return}const ge={id:Date.now(),name:Wt,filters:{filterAssetId:me,filterCompany:Oe,filterSite:be,filterLocation:W,filterDepartment:se,filterModality:pe,filterManufacturer:de,filterSupplier:_e,filterDeviceStatus:Fe,filterAssetName:ot,filterSerialNumber:zt,searchTerm:o}},Be=[...ve,ge];Le(Be),pt(""),tt(!1),localStorage.setItem("assetFilterPresets",JSON.stringify(Be))},xr=ge=>{const Be=ge.filters;Se(Be.filterAssetId||""),ue(Be.filterCompany||""),re(Be.filterSite||""),ae(Be.filterLocation||""),he(Be.filterDepartment||""),Je(Be.filterModality||""),Ae(Be.filterManufacturer||""),K(Be.filterSupplier||""),ft(Be.filterDeviceStatus||""),Lt(Be.filterAssetName||""),Nt(Be.filterAssetName||""),Ht(Be.filterSerialNumber||""),Qt(Be.filterSerialNumber||""),u(Be.searchTerm||"")},Hr=ge=>{const Be=ve.filter(ze=>ze.id!==ge);Le(Be),localStorage.setItem("assetFilterPresets",JSON.stringify(Be))};R.useEffect(()=>()=>{cr.current&&clearTimeout(cr.current),He.current&&clearTimeout(He.current)},[]);const Ir=ge=>ge?new Date(ge).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-";R.useEffect(()=>{const ge=Be=>{k.current&&!k.current.contains(Be.target)&&p(null)};return v&&document.addEventListener("mousedown",ge),()=>{document.removeEventListener("mousedown",ge)}},[v]);const Pa=ge=>{D(Be=>{const ze=new Set(Be);return ze.has(ge)?ze.delete(ge):ze.add(ge),ze})},ca=()=>{M.size===Zt.length?D(new Set):D(new Set(Zt.map(ge=>ge.name)))},_n=Zt.length>0&&M.size===Zt.length,fn=M.size>0&&M.size<Zt.length,hn=R.useCallback(()=>Ne(null,null,function*(){const ge=[];let Be=0;const ze=100;let Ze=!0;for(;Ze;)try{const vt=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset",filters:ke(ke({},It),q),fields:["*"],limit_start:Be*ze,limit_page_length:ze,order_by:"creation desc"})})).json()).message||[];ge.push(...vt),vt.length<ze?Ze=!1:Be++,Be>100&&(console.warn("Export safety limit reached"),Ze=!1)}catch(et){throw console.error("Error fetching assets for export:",et),et}return ge}),[It,q]),Xs=(ge,Be,ze)=>Ne(null,null,function*(){H(!0);try{let Ze=[];switch(ge){case"selected":Ze=Zt.filter(_t=>M.has(_t.name));break;case"all_on_page":Ze=Zt;break;case"all_with_filters":Ze=yield hn();break}if(Ze.length===0){alert("No data to export");return}const et=ze.map(_t=>{const vt=C.find(Ot=>Ot.key===_t);return(vt==null?void 0:vt.label)||_t});if(Be==="csv"){const _t=[et.join(","),...Ze.map(Ut=>ze.map(nr=>{let ct=Ut[nr]||"";return typeof ct=="string"&&(ct.includes(",")||ct.includes('"')||ct.includes(`
`))&&(ct=`"${ct.replace(/"/g,'""')}"`),ct}).join(","))].join(`
`),vt=new Blob(["\uFEFF"+_t],{type:"text/csv;charset=utf-8;"}),Ot=URL.createObjectURL(vt),Rt=document.createElement("a");Rt.href=Ot,Rt.download=`assets_export_${new Date().toISOString().split("T")[0]}.csv`,Rt.click(),URL.revokeObjectURL(Ot)}else if(Be==="excel"){const _t=[et,...Ze.map(Rt=>ze.map(Ut=>Rt[Ut]||""))],vt=Un.aoa_to_sheet(_t),Ot=Un.book_new();Un.book_append_sheet(Ot,vt,"Assets"),Fd(Ot,`assets_export_${new Date().toISOString().split("T")[0]}.xlsx`)}B(!1),D(new Set)}catch(Ze){console.error("Export failed:",Ze),alert(`Export failed: ${Ze instanceof Error?Ze.message:"Unknown error"}`)}finally{H(!1)}}),Ha=()=>r("/assets/new"),gs=ge=>r(`/assets/${ge}`),$r=ge=>r(`/assets/${ge}`),rr=ge=>r(`/assets/new?duplicate=${ge}`),ie=ge=>{const Be=new URLSearchParams;ge.name&&Be.append("asset",ge.name),ge.asset_name&&Be.append("asset_name",ge.asset_name),ge.custom_asset_type&&Be.append("asset_type",ge.custom_asset_type),ge.custom_manufacturer&&Be.append("manufacturer",ge.custom_manufacturer),ge.custom_serial_number&&Be.append("serial_number",ge.custom_serial_number),ge.department&&Be.append("department",ge.department),ge.custom_site_contractor&&Be.append("site_contractor",ge.custom_site_contractor),ge.custom_subcontractor&&Be.append("subcontractor",ge.custom_subcontractor),ge.company&&Be.append("company",ge.company),ge.custom_service_agreement&&Be.append("custom_service_agreement",ge.custom_service_agreement),ge.custom_service_coverage&&Be.append("custom_service_coverage",ge.custom_service_coverage),ge.custom_site&&Be.append("site_name",ge.custom_site),r(`/work-orders/new?${Be.toString()}`)},Z=ge=>{r(`/work-orders?asset=${encodeURIComponent(ge)}`)},ce=ge=>Ne(null,null,function*(){try{yield Jt(ge),g(null),Ft(),alert("Asset deleted successfully!")}catch(Be){alert(`Failed to delete asset: ${Be instanceof Error?Be.message:"Unknown error"}`)}}),xe=ge=>{window.open(`/assets/${ge}?print=true`,"_blank")},ye=()=>{Se(""),ue(""),re(""),Ae(""),K(""),ae(""),he(""),Je(""),ft(""),Lt(""),Ht(""),Nt(""),Qt(""),u(""),cr.current&&clearTimeout(cr.current),He.current&&clearTimeout(He.current)},Ee=me||Oe||be||de||_e||W||se||pe||Fe||ot||zt||o;return ne&&!O?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..."})]})}):V?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:V}),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"})]})]})}):Ge&&!O?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")})]})}):Ct?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:Ft,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-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 dark:text-white break-words",children:e("assets.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",yr," asset",yr!==1?"s":"",M.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",M.size," selected"]}),Ge&&O&&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.jsx(kM,{label:"Scan QR",title:"Scan Asset QR"}),a.jsxs("button",{onClick:()=>B(!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:yr===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),M.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:M.size})]}),Q&&a.jsxs("button",{onClick:Ha,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(Ei,{}),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:()=>tr(!ht),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:ht?a.jsx(ru,{size:14}):a.jsx(Td,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($i,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),Kt>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:Kt})]}),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:[me&&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:"})," ",me,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),Se("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),Oe&&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:"})," ",Oe,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),ue("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),be&&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:"})," ",be,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),re("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),ot&&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:"})," ",ot,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),Lt(""),Nt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),zt&&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:"})," ",zt,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),Ht(""),Qt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),Fe&&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:"})," ",Fe,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),ft("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),W&&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:"})," ",W,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),ae("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),se&&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:"})," ",se,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),he("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),pe&&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:"})," ",pe,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),Je("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),de&&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:"})," ",de,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),Ae("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),_e&&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:"})," ",_e,a.jsx("button",{onClick:ge=>{ge.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Kt>0&&a.jsxs("button",{onClick:()=>tt(!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(Tn,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Ee&&a.jsxs("button",{onClick:ye,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(Yt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),ht&&a.jsxs("div",{className:"p-4",children:[ve.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(nu,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ve.map(ge=>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:()=>xr(ge),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:ge.name}),a.jsx("button",{onClick:()=>Hr(ge.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(la,{size:10})})]},ge.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(er,{label:"Asset ID",doctype:"Asset",value:me,onChange:ge=>Se(ge),placeholder:"Select Asset ID",disabled:!1,compact:!0}),me&&a.jsx("button",{onClick:()=>Se(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:We,onChange:ge=>kt(ge.target.value),onKeyDown:ge=>qe(ge,"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"}),We&&We!==ot&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),ot&&a.jsx("button",{onClick:()=>{Lt(""),Nt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{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:At,onChange:ge=>Re(ge.target.value),onKeyDown:ge=>qe(ge,"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"}),At&&At!==zt&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),zt&&a.jsx("button",{onClick:()=>{Ht(""),Qt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(er,{label:"Hospital",doctype:"Company",value:Oe,onChange:ge=>ue(ge),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),Oe&&a.jsx("button",{onClick:()=>ue(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(er,{label:"PHCC Site",doctype:"Mobile Team Site",value:be,onChange:ge=>re(ge),placeholder:"Select Site",disabled:!1,compact:!0}),be&&a.jsx("button",{onClick:()=>re(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:Fe,onChange:ge=>ft(ge.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"})]}),Fe&&a.jsx("button",{onClick:()=>ft(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[57]",children:[a.jsx(er,{label:"Location",doctype:"Location",value:W,onChange:ge=>ae(ge),placeholder:"Select Location",disabled:!1,compact:!0}),W&&a.jsx("button",{onClick:()=>ae(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[56]",children:[a.jsx(er,{label:"Department",doctype:"Department",value:se,onChange:ge=>he(ge),placeholder:"Select Department",disabled:!1,compact:!0}),se&&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(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(er,{label:"Modality",doctype:"Modality",value:pe,onChange:ge=>Je(ge),placeholder:"Select Modality",disabled:!1,compact:!0}),pe&&a.jsx("button",{onClick:()=>Je(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[54]",children:[a.jsx(er,{label:"Manufacturer",doctype:"Manufacturer",value:de,onChange:ge=>Ae(ge),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),de&&a.jsx("button",{onClick:()=>Ae(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[53]",children:[a.jsx(er,{label:"Supplier",doctype:"Supplier",value:_e,onChange:ge=>K(ge),placeholder:"Select Supplier",disabled:!1,compact:!0}),_e&&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(Yt,{size:10})})]})]})})})]})]}),ut&&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:Wt,onChange:ge=>pt(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"&&(ge.preventDefault(),Tt())},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:()=>{tt(!1),pt("")},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:Tt,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(Tn,{size:12}),"Save Filter"]})]})]})}),a.jsx(NM,{isOpen:z,onClose:()=>B(!1),selectedCount:M.size,totalCount:yr,pageCount:Zt.length,onExport:Xs,isExporting:U,exportColumns:C}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[Ge&&O&&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:ca,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:_n?"Deselect all":"Select all",children:_n?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):fn?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:Zt.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(xo,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No assets found"}),Ee?a.jsx("button",{onClick:ye,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):Q?a.jsx("button",{onClick:Ha,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]})})}):Zt.map(ge=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${M.has(ge.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>gs(ge.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:Be=>Be.stopPropagation(),children:a.jsx("button",{onClick:()=>Pa(ge.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:M.has(ge.name)?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Bn,{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:ge.asset_name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:ge.name})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ge.custom_serial_number||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ge.company||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ge.location||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:ge.custom_device_status||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ir(ge.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:Be=>Be.stopPropagation(),children:[a.jsx("button",{onClick:()=>gs(ge.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:a.jsx(Yi,{})}),a.jsx("button",{onClick:()=>$r(ge.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Asset",children:a.jsx(rs,{})}),a.jsx("button",{onClick:()=>rr(ge.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Asset",children:a.jsx(Ad,{})}),a.jsx("button",{onClick:()=>ie(ge),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(ob,{})}),a.jsx("button",{onClick:()=>Z(ge.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(sb,{})}),a.jsx("button",{onClick:()=>g(ge.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Asset",disabled:Dr,children:a.jsx(la,{})}),a.jsxs("div",{className:"relative",ref:v===ge.name?k:null,children:[a.jsx("button",{onClick:()=>p(v===ge.name?null:ge.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(au,{})}),v===ge.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(ge),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[a.jsx(ob,{className:"text-orange-500"}),"Create Work Order"]}),a.jsxs("button",{onClick:()=>{Z(ge.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[a.jsx(sb,{className:"text-cyan-500"}),"View Linked WOs"]}),a.jsxs("button",{onClick:()=>{xe(ge.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[a.jsx(fc,{className:"text-purple-500"}),"Print Asset"]})]})]})]})})]},ge.name))})]})}),Zt.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:t*N+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((t+1)*N,yr)})," ","of ",a.jsx("span",{className:"font-medium",children:yr})," 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:t===0,onClick:()=>n(t-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:!Ye,onClick:()=>n(t+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"})]})]})]}),f&&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(la,{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:"})," ",f]})}),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:Dr,children:"Cancel"}),a.jsx("button",{onClick:()=>ce(f),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:Dr,children:Dr?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(la,{}),"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;
}
`})]})},EM=e=>{const[r,t]=R.useState([]),[n,o]=R.useState(new Set),[u,f]=R.useState(!0),[g,v]=R.useState(null);return R.useEffect(()=>{Ne(null,null,function*(){try{f(!0);const N=yield jt.apiCall(`/api/resource/DocType/${e}`),O=(N.data||N).fields||[],I=new Set;O.forEach(M=>{M.allow_on_submit===1&&I.add(M.fieldname)}),t(O),o(I),v(null)}catch(N){console.error(`[DocTypeMeta] Error fetching DocType meta for ${e}:`,N),v(N instanceof Error?N.message:"Unknown error"),t([]),o(new Set)}finally{f(!1)}})},[e]),{fields:r,allowOnSubmitFields:n,isAllowedOnSubmit:k=>n.has(k),loading:u,error:g}};function qg(e,r){if(!e||(e=e.trim(),!e))return!1;if(!e.startsWith("eval:"))return!!r[e];const t=e.substring(5).trim();try{return new Function("doc",`
try {
return Boolean(${t});
} catch (e) {
console.warn('Expression evaluation error:', e);
return false;
}
`)(r)}catch(n){return console.warn(`Failed to evaluate expression: ${e}`,n),!1}}function CM(e){if(!e)return null;const r=e.split(".");return r.length!==2?null:{linkField:r[0],targetField:r[1]}}const Kg={};function k4(e,r){const[t,n]=R.useState([]),[o,u]=R.useState(!0),[f,g]=R.useState(null);R.useEffect(()=>{if(!e){u(!1);return}if(Kg[e]){n(Kg[e]),u(!1);return}Ne(null,null,function*(){var B;u(!0);try{const U=yield jt.apiCall(`/api/method/frappe.client.get_doc?doctype=DocType&name=${encodeURIComponent(e)}`,{credentials:"include"});if((B=U==null?void 0:U.message)!=null&&B.fields){const H=U.message.fields.map(q=>({fieldname:q.fieldname,label:q.label,fieldtype:q.fieldtype,options:q.options,reqd:q.reqd,hidden:q.hidden,read_only:q.read_only,depends_on:q.depends_on,mandatory_depends_on:q.mandatory_depends_on,read_only_depends_on:q.read_only_depends_on,fetch_from:q.fetch_from,fetch_if_empty:q.fetch_if_empty,default:q.default,description:q.description,in_list_view:q.in_list_view,permlevel:q.permlevel,allow_on_submit:q.allow_on_submit}));Kg[e]=H,n(H)}}catch(U){console.warn(`Could not fetch DocType meta for ${e}:`,U.message),g(U.message)}finally{u(!1)}})},[e]);const v=R.useMemo(()=>{const z={};return t.forEach(B=>{z[B.fieldname]=B}),z},[t]),p=R.useCallback(z=>{const B=v[z];if(!B)return{isVisible:!0,isReadOnly:!1,isMandatory:!1};let U=!(B.hidden===1||B.hidden===!0);B.depends_on&&U&&(U=qg(B.depends_on,r));let H=B.read_only===1||B.read_only===!0;B.read_only_depends_on&&(H=H||qg(B.read_only_depends_on,r));let q=B.reqd===1||B.reqd===!0;return B.mandatory_depends_on&&(q=q||qg(B.mandatory_depends_on,r)),{isVisible:U,isReadOnly:H,isMandatory:q}},[v,r]),k=R.useCallback(z=>p(z).isVisible,[p]),N=R.useCallback(z=>{const B=p(z);return B.isVisible&&B.isMandatory},[p]),C=R.useCallback(z=>p(z).isReadOnly,[p]),O=R.useCallback(z=>{const B=v[z];return(B==null?void 0:B.label)||z},[v]),I=R.useCallback(z=>{const B=v[z];return B!=null&&B.options?B.fieldtype==="Select"?B.options.split(`
`).filter(U=>U.trim()!==""):[]:[]},[v]),M=R.useCallback((z,B)=>{const U=v[z];if(!(U!=null&&U.fetch_from)||!B)return;const H=CM(U.fetch_from);if(H)return B[H.targetField]},[v]),D=R.useCallback(()=>{const z={};return t.forEach(B=>{const U=p(B.fieldname);if(U.isVisible&&U.isMandatory){const H=r[B.fieldname];(H==null||H==="")&&(z[B.fieldname]=`${B.label||B.fieldname} is required`)}}),{valid:Object.keys(z).length===0,errors:z}},[t,r,p]);return{loading:o,error:f,fields:t,getFieldState:p,shouldShowField:k,isMandatory:N,isReadOnly:C,getFieldLabel:O,getFieldOptions:I,getFetchFromValue:M,validateMandatory:D}}const TM=()=>{var gt;const{assetName:e}=Ml(),r=ma(),[t]=Rl(),n=t.get("duplicate"),o=e==="new",u=o&&!!n,{isAllowedOnSubmit:f}=EM("Asset"),[g,v]=R.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:p,isMandatory:k,isReadOnly:N}=k4("Asset",g),{asset:C,loading:O,error:I,refetch:M}=nE(u?n:o?null:e||null),{createAsset:D,updateAsset:z,submitAsset:B,loading:U}=F_(),[H,q]=R.useState(o),ne=(gt=C==null?void 0:C.docstatus)!=null?gt:0,V=ne===1,J=ne===2,Q=ne===0,[Te,je]=R.useState(!1),me=R.useRef(null);R.useEffect(()=>{const ve=Le=>{me.current&&!me.current.contains(Le.target)&&je(!1)};return document.addEventListener("mousedown",ve),()=>document.removeEventListener("mousedown",ve)},[]),R.useEffect(()=>{},[C,ne,Q,V,J,H]);const Se=R.useCallback(ve=>!H||J||N(ve)?!0:V?!f(ve):!Q,[H,J,V,Q,f,N]),Oe=R.useCallback(ve=>p(ve),[p]);R.useCallback(ve=>k(ve),[k]);const[ue,be]=R.useState(""),[re,de]=R.useState({});R.useEffect(()=>{o&&!g.available_for_use_date&&v(ve=>Ve(ke({},ve),{available_for_use_date:new Date().toISOString().split("T")[0],__islocal:!0}))},[o]),R.useEffect(()=>{function ve(){return Ne(this,null,function*(){try{const Le=yield jt.getUserDetails();be(Le.custom_site_name||""),v(ut=>{const tt={};return(o||!ut.company)&&Le.custom_site_name&&(tt.company=Le.custom_site_name,tt.asset_owner_company=Le.custom_site_name),!ut.custom_site&&Le.custom_phcc_site_name&&(tt.custom_site=Le.custom_phcc_site_name),ke(ke({},ut),tt)})}catch(Le){console.error("Error loading user details",Le)}})}ve()},[o]);const Ae=()=>{const Le={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]};v(ut=>Ve(ke({},ut),{finance_books:[...ut.finance_books||[],Le]}))},_e=ve=>{v(Le=>{const ut=[...Le.finance_books||[]];return ut.splice(ve,1),Ve(ke({},Le),{finance_books:ut})})},K=(ve,Le)=>{v(ut=>{const tt=[...ut.finance_books||[]];return tt[ve]=ke(ke({},tt[ve]||{}),Le),Ve(ke({},ut),{finance_books:tt})})};R.useEffect(()=>{if(g.calculate_depreciation&&(!g.finance_books||g.finance_books.length===0)){const Le={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]};v(ut=>Ve(ke({},ut),{finance_books:[Le]}))}},[g.calculate_depreciation]);const W=(ve,Le,ut)=>{v(tt=>{const Wt=[...tt.custom_spare_parts||[]],pt=ke({},Wt[ve]);Le==="qty"||Le==="rate"?(pt[Le]=ut,pt.amount=(pt.qty||0)*(pt.rate||0)):pt[Le]=ut,Wt[ve]=pt;const We=Wt.reduce((Nt,At)=>Nt+(At.amount||0),0);return Ve(ke({},tt),{custom_spare_parts:Wt,custom_total_spare_parts_amount:We})})},ae=()=>{v(ve=>Ve(ke({},ve),{custom_spare_parts:[...ve.custom_spare_parts||[],{qty:0,rate:0,amount:0}]}))},se=ve=>{v(Le=>{const ut=[...Le.custom_spare_parts||[]];ut.splice(ve,1);const tt=ut.reduce((Wt,pt)=>Wt+(pt.amount||0),0);return Ve(ke({},Le),{custom_spare_parts:ut,custom_total_spare_parts_amount:tt})})};R.useEffect(()=>{if(g.available_for_use_date){const ve=new Date(g.available_for_use_date),ut=new Date().getTime()-ve.getTime(),Wt=Math.floor(ut/(1e3*60*60*24))*24,pt=Wt-(g.custom_down_time||0);v(We=>Ve(ke({},We),{custom_total_hours:Wt,custom_up_time:pt}))}},[g.available_for_use_date,g.custom_down_time]);const he=R.useRef("");R.useEffect(()=>{if(!H){he.current=g.custom_asset_type||"";return}const ve=(g.custom_asset_type||"").toString().trim().toLowerCase(),Le=(he.current||"").toString().trim().toLowerCase();ve!==Le&&(he.current=g.custom_asset_type||"",ve==="biomedical"?g.custom_site_contractor!=="SAMAMA"&&v(ut=>Ve(ke({},ut),{custom_site_contractor:"SAMAMA"})):Le==="biomedical"&&g.custom_site_contractor==="SAMAMA"&&v(ut=>Ve(ke({},ut),{custom_site_contractor:""})))},[g.custom_asset_type,H]),R.useEffect(()=>{const ve={};g.company&&(ve.company=g.company);const Le=ue&&ue.startsWith("Mobile")||g.company&&g.company.startsWith("Mobile");(ue||g.company)&&(Le?ve.department_name=["not like","Non Bio%"]:ve.department_name=["not like","Non Bio%"]),de(ve)},[g.company,ue]),R.useEffect(()=>{C&&(he.current=C.custom_asset_type||"",v({asset_name:u?`${C.asset_name} (Copy)`:C.asset_name||"",company:C.company||"",custom_serial_number:u?"":C.custom_serial_number||"",location:C.location||"",custom_manufacturer:C.custom_manufacturer||"",department:C.department||"",custom_moh_supervisor:C.custom_moh_supervisor||"",custom_team_leader:C.custom_team_leader||"",custom_asset_type:C.custom_asset_type||"",custom_manufacturing_year:C.custom_manufacturing_year||"",custom_model:C.custom_model||"",custom_class:C.custom_class||"",custom_device_status:C.custom_device_status||"",custom_down_time:C.custom_down_time||0,asset_owner_company:C.asset_owner_company||"",custom_up_time:C.custom_up_time||0,custom_total_hours:C.custom_total_hours||0,custom_modality:C.custom_modality||"",custom_attach_image:C.custom_attach_image||"",custom_site_contractor:C.custom_site_contractor||"",custom_site:C.custom_site||"",custom_total_amount:C.custom_total_amount||0,gross_purchase_amount:C.gross_purchase_amount||0,available_for_use_date:C.available_for_use_date||"",calculate_depreciation:C.calculate_depreciation||!1,finance_books:C.finance_books||[],custom_service_agreement:C.custom_service_agreement||"",custom_service_coverage:C.custom_service_coverage||"",custom_start_date:C.custom_start_date?C.custom_start_date.split(" ")[0]:"",custom_end_date:C.custom_end_date?C.custom_end_date.split(" ")[0]:"",custom_warranty:C.custom_warranty||!1,custom_extended_warranty:C.custom_extended_warranty||!1,custom__service_contract:C.custom__service_contract||!1,custom_covering_spare_parts:C.custom_covering_spare_parts||!1,custom_spare_parts_labour:C.custom_spare_parts_labour||!1,custom_covering_labour:C.custom_covering_labour||!1,custom_ppm_only:C.custom_ppm_only||!1,custom_support_plan:C.custom_support_plan||"",custom_spare_parts:C.custom_spare_parts||[],custom_total_spare_parts_amount:C.custom_total_spare_parts_amount||0}))},[C,u]);const[pe,Je]=R.useState(null);R.useEffect(()=>{if(!e||e==="new")return;Ne(null,null,function*(){var Le;try{const ut=`/files/${e}-qr.png`;if((yield fetch(ut,{method:"HEAD"})).ok){Je(ut);return}const Wt=yield jt.apiCall(`/api/resource/File?filters=[["File","attached_to_name","=","${e}"]]`);((Le=Wt==null?void 0:Wt.data)==null?void 0:Le.length)>0&&Je(Wt.data[0].file_url)}catch(ut){console.error("Error loading QR code:",ut)}})},[e,C]);const Fe=ve=>{const{name:Le,value:ut}=ve.target;v(tt=>Ve(ke({},tt),{[Le]:ut}))},ft=ve=>Ne(null,null,function*(){if(ve.preventDefault(),!g.asset_name){alert("Please enter an Asset Name");return}if(!g.custom_asset_type){alert("Please select a Category");return}console.log("Submitting asset data:",g);try{if(o||u){const Le=yield D(g);if(Le.name){const tt=`/files/${Le.name}-qr.png`;Je(tt)}alert(u?"Asset duplicated successfully!":"Asset created successfully!"),r(`/assets/${Le.name}`)}else e&&(yield z(e,g),alert("Asset updated successfully!"),q(!1),M())}catch(Le){console.error("Asset save error:",Le);const ut=Le instanceof Error?Le.message:"Unknown error";ut.includes("404")||ut.includes("not found")||ut.includes("has no attribute")||ut.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: `+ut):alert(`Failed to save asset:
`+ut)}}),ot=()=>Ne(null,null,function*(){if(!e||o){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 B(e),alert("Asset submitted successfully!"),M(),q(!1)}catch(ve){console.error("Asset submit error:",ve);const Le=ve instanceof Error?ve.message:"Unknown error";alert(`Failed to submit asset:
`+Le)}});if(O)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(I&&!o&&!u)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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: ",I]}),a.jsx("button",{onClick:()=>r("/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(I&&u)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:()=>r("/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 Lt=()=>{if(!pe||!C)return;const ve=window.open("","_blank");ve&&(ve.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>Print QR Code - ${C.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> ${C.name}<br/>
<strong>Asset Name:</strong> ${C.asset_name||"N/A"}
</div>
<img src="${pe}" alt="QR Code" class="qr-image" onload="window.print();" />
</div>
</body>
</html>
`),ve.document.close())},zt=()=>{const ve=window.open("","_blank");ve&&(ve.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>
`),ve.document.close())},Ht=()=>Ne(null,null,function*(){if(!e||o){alert("Please save the asset first to view PPM Plan");return}try{const ve=yield jt.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"]`),Le=(ve==null?void 0:ve.data)||[],ut=(He,It)=>{const Zt=new Date(He);return Zt.setDate(Zt.getDate()+It),Zt},tt=(He,It)=>{const Zt=new Date(He);return Zt.setMonth(Zt.getMonth()+It),Zt},Wt=(He,It)=>{const Zt=new Date(He);return Zt.setFullYear(Zt.getFullYear()+It),Zt},pt=(He,It)=>{switch(It){case"Daily":return ut(He,1);case"Weekly":return ut(He,7);case"Monthly":return tt(He,1);case"Quarterly":return tt(He,3);case"Half-yearly":return tt(He,6);case"Yearly":return Wt(He,1);case"2 Yearly":return Wt(He,2);case"3 Yearly":return Wt(He,3);default:return tt(He,1)}},We=He=>He.toISOString().split("T")[0],Nt=Wt(new Date,5),At=[];for(const He of Le){let It=new Date(He.due_date);const Zt=He.periodicity||"Monthly";for(let yr=0;yr<60&&(At.push({asset_name:He.asset_name||"",custom_asset_names:He.custom_asset_names||"",serial_number:g.custom_serial_number||"N/A",due_date:We(It),periodicity:Zt,maintenance_type:He.maintenance_type||"",assign_to_name:He.assign_to_name||"",status:"Planned"}),It=pt(It,Zt),!(It>Nt));yr++);}At.sort((He,It)=>new Date(He.due_date).getTime()-new Date(It.due_date).getTime());const Qt=window.open("","_blank");if(!Qt)return;const cr=At.length>0?At.map((He,It)=>`
<tr class="${It%2===0?"bg-white":"bg-gray-50"}">
<td class="border px-3 py-2">${He.asset_name}</td>
<td class="border px-3 py-2">${He.custom_asset_names}</td>
<td class="border px-3 py-2">${He.serial_number}</td>
<td class="border px-3 py-2">${He.due_date}</td>
<td class="border px-3 py-2">${He.periodicity}</td>
<td class="border px-3 py-2">${He.maintenance_type}</td>
<td class="border px-3 py-2">${He.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">${He.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>';Qt.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> ${g.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>
${cr}
</tbody>
</table>
</div>
<div class="summary">
<strong>Summary:</strong> ${At.length} planned maintenance entries for the next 5 years
</div>
</div>
</body>
</html>
`),Qt.document.close()}catch(ve){console.error("Error fetching PPM Plan:",ve),alert("Failed to load PPM Plan. Please try again.")}}),ht=()=>Ne(null,null,function*(){if(!e||o){alert("Please save the asset first to view Asset History");return}try{const ve=yield jt.apiCall(`/api/resource/Asset/${e}`),Le=(ve==null?void 0:ve.data)||{},ut=yield jt.apiCall(`/api/resource/Work_Order?filters=[["asset","=","${e}"]]&fields=["name","work_order_type","repair_status","creation","total_repair_cost"]`),tt=(ut==null?void 0:ut.data)||[],Wt=yield jt.apiCall(`/api/resource/Asset Maintenance?filters=[["asset_name","=","${e}"]]&fields=["name","maintenance_team","custom_type_of_maintenance"]`),pt=(Wt==null?void 0:Wt.data)||[];let We=[],Nt=[];for(const kt of pt){const Re=yield jt.apiCall(`/api/resource/Asset Maintenance/${kt.name}`),qe=(Re==null?void 0:Re.data)||{};qe.asset_maintenance_tasks&&(Nt=[...Nt,...qe.asset_maintenance_tasks.map(xr=>Ve(ke({},xr),{maintenance_id:kt.name}))]);const Tt=yield jt.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_maintenance","=","${kt.name}"]]&fields=["name","maintenance_status","assign_to_name","maintenance_type","due_date","completion_date","periodicity","actions_performed"]&order_by=completion_date desc`);We=[...We,...(Tt==null?void 0:Tt.data)||[]]}const At=We.filter(kt=>kt.maintenance_status==="Completed"),Qt=We.filter(kt=>kt.maintenance_status!=="Completed"),cr={};We.forEach(kt=>{cr[kt.maintenance_status]=(cr[kt.maintenance_status]||0)+1});const He=Le.custom_spare_parts||[],It={};He.forEach(kt=>{const Re=kt.work_order||"Unassigned";It[Re]||(It[Re]=[]),It[Re].push(kt)});const Zt=window.open("","_blank");if(!Zt)return;const yr=tt.length>0?tt.map((kt,Re)=>{const qe=kt.repair_status==="Completed"?"bg-green-100 text-green-800":kt.repair_status==="Work In Progress"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800";return`
<tr class="${Re%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3 font-medium text-blue-600">${kt.name}</td>
<td class="px-4 py-3">${kt.work_order_type||"-"}</td>
<td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs font-medium ${qe}">${kt.repair_status||"-"}</span></td>
<td class="px-4 py-3 font-semibold">${parseFloat(kt.total_repair_cost||0).toFixed(2)} ر.س</td>
<td class="px-4 py-3 text-gray-500">${kt.creation?new Date(kt.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 Ye="";Object.keys(It).length>0?Object.keys(It).forEach(kt=>{Ye+=`
<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">${kt}</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[kt].map((Re,qe)=>`
<tr class="${qe%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-2">${Re.item_code||"-"}</td>
<td class="px-4 py-2">${Re.qty||0}</td>
<td class="px-4 py-2">${Re.rate||0} ر.س</td>
<td class="px-4 py-2 font-medium">${Re.amount||0} ر.س</td>
</tr>
`).join("")}
</tbody>
</table>
</div>
`}):Ye='<p class="text-gray-500 text-center py-8">No Spare Parts Used</p>';const Ge=pt.length>0?pt.map(kt=>`
<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">${kt.name}</p>
</div>
<div class="text-right">
<p class="text-sm text-gray-500">Type</p>
<p class="font-medium">${kt.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">${kt.maintenance_team||"-"}</p>
</div>
</div>
`).join(""):'<p class="text-gray-500 text-center py-8">No Maintenance Records Found</p>',Ct=Nt.length>0?Nt.map((kt,Re)=>`
<tr class="${Re%2===0?"bg-white":"bg-gray-50"}">
<td class="px-4 py-3">${kt.assign_to_name||"-"}</td>
<td class="px-4 py-3">${kt.periodicity||"-"}</td>
<td class="px-4 py-3">${kt.next_due_date||"-"}</td>
<td class="px-4 py-3 text-blue-600 text-sm">${kt.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>',Ft=Object.keys(cr).length>0?Object.entries(cr).map(([kt,Re])=>`
<div class="flex items-center justify-between p-3 rounded-lg border ${kt==="Completed"?"bg-green-100 text-green-800 border-green-200":kt==="Planned"?"bg-blue-100 text-blue-800 border-blue-200":"bg-yellow-100 text-yellow-800 border-yellow-200"}">
<span class="font-medium">${kt}</span>
<span class="text-2xl font-bold">${Re}</span>
</div>
`).join(""):'<p class="text-gray-500 text-center">No Data</p>',Jt=At.length>0?At.map((kt,Re)=>`
<tr class="${Re%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${kt.name}</td>
<td class="px-3 py-2">${kt.assign_to_name||"-"}</td>
<td class="px-3 py-2">${kt.maintenance_type||"-"}</td>
<td class="px-3 py-2">${kt.due_date||"-"}</td>
<td class="px-3 py-2 text-green-600 font-medium">${kt.completion_date||"-"}</td>
<td class="px-3 py-2">${kt.periodicity||"-"}</td>
<td class="px-3 py-2 text-sm text-gray-600">${kt.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>',Dr=Qt.length>0?Qt.map((kt,Re)=>{const qe=kt.maintenance_status==="Planned"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800";return`
<tr class="${Re%2===0?"bg-white":"bg-gray-50"}">
<td class="px-3 py-2 text-blue-600 font-medium">${kt.name}</td>
<td class="px-3 py-2">${kt.assign_to_name||"-"}</td>
<td class="px-3 py-2">${kt.maintenance_type||"-"}</td>
<td class="px-3 py-2">${kt.due_date||"-"}</td>
<td class="px-3 py-2">${kt.periodicity||"-"}</td>
<td class="px-3 py-2"><span class="px-2 py-1 rounded-full text-xs font-medium ${qe}">${kt.maintenance_status||"-"}</span></td>
<td class="px-3 py-2 text-sm text-gray-600">${kt.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>';Zt.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">${Le.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">${Le.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">${Le.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">${Le.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">${Le.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>
${yr}
</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">
${Ye}
</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">
${Ge}
</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>
${Ct}
</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">
${Ft}
</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>
${Jt}
</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>
${Dr}
</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>
`),Zt.document.close()}catch(ve){console.error("Error fetching Asset History:",ve),alert("Failed to load Asset History. Please try again.")}}),tr=()=>{if(!e||o){alert("Please save the asset first to view Installation Report");return}const ve=window.open("","_blank");if(!ve)return;const Le=new Date,ut=We=>{const Nt=String(We.getDate()).padStart(2,"0"),At=String(We.getMonth()+1).padStart(2,"0"),Qt=We.getFullYear();return`${Nt}/${At}/${Qt}`},tt=(C==null?void 0:C.custom_spare_parts)||[];let Wt="";const pt=3;if(tt.length>0){tt.forEach((We,Nt)=>{Wt+=`
<tr>
<td>${Nt+1}</td>
<td>${We.item_name||""}</td>
<td>${We.item_code||""}</td>
<td>${We.uom||""}</td>
<td>${We.qty||""}</td>
</tr>
`});for(let We=tt.length;We<pt;We++)Wt+=`
<tr>
<td>${We+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`}else for(let We=0;We<pt;We++)Wt+=`
<tr>
<td>${We+1}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
`;ve.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">${ut(Le)}</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">${ut(Le)}</span> م</div>
</div>
<div style="margin: 15px 0; font-weight: bold;">
مستشفى <span class="dotted-line" style="min-width: 200px;">${g.company||""}</span>
</div>
<!-- Main Content -->
<div class="main-content">
تشهد مستشفى <span class="dotted-line" style="min-width: 180px;">${g.company||""}</span> بأن <span class="dotted-line" style="min-width: 180px;">${g.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">${g.asset_name||""}</span>
<span class="arabic-label">اسم الجهاز:</span>
</div>
<div class="equipment-item">
<span>MFR</span>
<span class="colon">:</span>
<span class="field-value">${g.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">${g.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">${g.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;">${g.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>
${Wt}
</tbody>
</table>
<!-- Footer Text -->
<div class="footer-text">
وذلك طبقا لعقد صيانة وإصلاح الأجهزة الطبية بمستشفى <span class="dotted-line" style="min-width: 150px;">${g.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>
`),ve.document.close()},Kt=()=>{if(!e||o){alert("Please save the asset first to view Dismantling Report");return}const ve=window.open("","_blank");if(!ve)return;const Le=new Date,ut=pt=>{const We=String(pt.getDate()).padStart(2,"0"),Nt=String(pt.getMonth()+1).padStart(2,"0"),At=pt.getFullYear();return`${We}/${Nt}/${At}`},tt=C!=null&&C.creation?new Date(C.creation):null;let Wt="";if(tt){const pt=Math.floor((Le.getTime()-tt.getTime())/31536e6),We=Math.floor((Le.getTime()-tt.getTime())%(1e3*60*60*24*365)/(1e3*60*60*24*30));Wt=`${pt} سنة و ${We} شهر`}ve.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;">${g.department||""}</span>
</div>
<!-- Equipment Data Section -->
<div class="section-title">0-1 بيانات الجهاز المطلوب تكهينه :</div>
<table class="equipment-table">
<tr>
<td>اسم الجهاز</td>
<td>${g.asset_name||""}</td>
<td>الرقم التسلسلي</td>
<td>${g.custom_serial_number||""}</td>
</tr>
<tr>
<td>الشركة الصانعة</td>
<td>${g.custom_manufacturer||""}</td>
<td>تاريخ التوريد</td>
<td>${tt?ut(tt):""}</td>
</tr>
<tr>
<td>الطراز/الموديل</td>
<td>${g.custom_model||""}</td>
<td>مدة استخدام الجهاز</td>
<td>${Wt}</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>
`),ve.document.close()};return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-4 sm:p-6 min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("button",{onClick:()=>r("/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(Ki,{}),a.jsx("span",{className:"text-gray-900 dark:text-white font-medium",children:u?"Duplicate Asset":o?"New Asset Details":"Asset Details"})]}),C&&a.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${ne===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300":ne===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:ne===0?"Draft":ne===1?"Submitted":"Cancelled"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!o&&!H&&!J&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:me,children:[a.jsxs("button",{onClick:()=>je(!Te),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(Td,{size:12,className:`transition-transform ${Te?"rotate-180":""}`})]}),Te&&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:[pe&&a.jsxs("button",{onClick:()=>{Lt(),je(!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(vf,{size:14}),"Print QR"]}),a.jsxs("button",{onClick:()=>{zt(),je(!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(vf,{size:14}),"Stay Plugged"]}),a.jsxs("button",{onClick:()=>{Ht(),je(!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(Yo,{size:14}),"PPM Plan"]}),a.jsxs("button",{onClick:()=>{ht(),je(!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(ox,{size:14}),"Asset History"]}),a.jsxs("button",{onClick:()=>{tr(),je(!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(t5,{size:14}),"Installation Report"]}),(C==null?void 0:C.status)==="Scrapped"&&a.jsxs("button",{onClick:()=>{Kt(),je(!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(l5,{size:14}),"Dismantling Report"]})]})})]}),a.jsxs("button",{onClick:()=>q(!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(rs,{}),"Edit"]}),Q&&a.jsxs("button",{onClick:ot,disabled:U,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(l_,{}),U?"Submitting...":"Submit"]})]}),J&&a.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 italic",children:"Cancelled documents cannot be edited"}),H&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{o?r("/assets"):q(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 dark:text-gray-800 px-2 py-1 rounded-lg",disabled:U,children:"Cancel"}),a.jsxs("button",{onClick:ft,disabled:U,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(Tn,{}),U?"Saving...":"Save Changes"]})]})]})]}),a.jsxs("form",{onSubmit:ft,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:g.asset_name,onChange:Fe,placeholder:"e.g. Laptop Model X",required:!0,disabled:Se("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(er,{label:"Category",doctype:"Asset Type",value:g.custom_asset_type||"",onChange:ve=>v(Ve(ke({},g),{custom_asset_type:ve})),disabled:Se("custom_asset_type")}),a.jsx(er,{label:"Modality",doctype:"Modality",value:g.custom_modality||"",onChange:ve=>v(Ve(ke({},g),{custom_modality:ve})),disabled:Se("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:g.custom_class,onChange:Fe,disabled:Se("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:o||u?"Auto-generated":C==null?void 0:C.name,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),u&&a.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",n]})]}),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:g.custom_device_status,onChange:Fe,disabled:!H,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:g.custom_serial_number,onChange:Fe,placeholder:"e.g. SN-12345",disabled:Se("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(er,{label:"Manufacturer",doctype:"Manufacturer",value:g.custom_manufacturer||"",onChange:ve=>v(Ve(ke({},g),{custom_manufacturer:ve})),disabled:Se("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:g.custom_model,onChange:Fe,placeholder:"Model number",disabled:Se("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:g.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:g.custom_down_time||0,onChange:Fe,placeholder:"0",disabled:Se("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:g.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(er,{label:"Hospital",doctype:"Company",value:g.company||"",onChange:ve=>{v(Ve(ke({},g),{company:ve,asset_owner_company:ve,department:""}))},disabled:Se("company"),filters:{domain:"Healthcare"}}),Oe("custom_site")&&a.jsx("div",{children:a.jsx(er,{label:"Site name",doctype:"Mobile Team Site",value:g.custom_site||"",onChange:ve=>v(Ve(ke({},g),{custom_site:ve})),disabled:Se("custom_site"),placeholder:"Select Site"})}),a.jsx(er,{label:"Department",doctype:"Department",value:g.department||"",onChange:ve=>v(Ve(ke({},g),{department:ve})),disabled:Se("department"),filters:re}),a.jsx(er,{label:"Location",doctype:"Location",value:g.location||"",onChange:ve=>v(Ve(ke({},g),{location:ve})),disabled:Se("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:!H,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:!H,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:pe?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:pe,alt:`QR Code for ${(C==null?void 0:C.name)||"Asset"}`,className:"w-[120px] h-[120px] object-contain",onError:ve=>{const Le=ve.target;Le.style.display="none";const ut=Le.nextElementSibling;ut&&(ut.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(vf,{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(vf,{size:80,className:"text-gray-400 dark:text-gray-500"})})}),(C==null?void 0:C.name)&&a.jsxs("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-center",children:["Asset ID: ",C.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:!H,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:g.custom_site_contractor,onChange:Fe,disabled:Se("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:!H,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:g.custom_service_agreement||"",onChange:Fe,disabled:Se("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:g.custom_service_coverage||"",onChange:Fe,disabled:Se("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:g.custom_start_date||"",onChange:Fe,disabled:Se("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:g.custom_end_date||"",onChange:Fe,disabled:Se("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:g.custom_total_amount,onChange:Fe,disabled:Se("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:!H,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:!H,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(er,{label:"MOH Supervisor",doctype:"User",value:g.custom_moh_supervisor||"",onChange:ve=>v(Ve(ke({},g),{custom_moh_supervisor:ve})),disabled:Se("custom_moh_supervisor")}),a.jsx(er,{label:"Team Leader",doctype:"User",value:g.custom_team_leader||"",onChange:ve=>v(Ve(ke({},g),{custom_team_leader:ve})),disabled:Se("custom_team_leader")}),a.jsx(er,{label:"Supplier/Vendor",doctype:"Supplier",value:g.supplier||"",onChange:ve=>v(Ve(ke({},g),{supplier:ve})),disabled:Se("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:g.gross_purchase_amount||0,onChange:Fe,disabled:Se("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:!H,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:!H,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:g.available_for_use_date||"",onChange:ve=>v(Le=>Ve(ke({},Le),{available_for_use_date:ve.target.value})),disabled:Se("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:g.calculate_depreciation,onChange:ve=>v(Ve(ke({},g),{calculate_depreciation:ve.target.checked})),disabled:!H,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"})]}),g.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"}),H&&a.jsxs("button",{type:"button",onClick:Ae,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"]})]}),(!g.finance_books||g.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.'}),g.finance_books&&g.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*"}),H&&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:g.finance_books.map((ve,Le)=>{var ut,tt;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(er,{label:"",doctype:"Finance Book",value:ve.finance_book||"",onChange:Wt=>K(Le,{finance_book:Wt}),disabled:!H})})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("select",{value:ve.depreciation_method||"",onChange:Wt=>K(Le,{depreciation_method:Wt.target.value}),disabled:!H,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:(ut=ve.total_number_of_depreciations)!=null?ut:"",onChange:Wt=>K(Le,{total_number_of_depreciations:Number(Wt.target.value)}),disabled:!H,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:(tt=ve.frequency_of_depreciation)!=null?tt:"",onChange:Wt=>K(Le,{frequency_of_depreciation:Number(Wt.target.value)}),disabled:!H,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:ve.depreciation_start_date||"",onChange:Wt=>K(Le,{depreciation_start_date:Wt.target.value}),disabled:!H,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"})}),H&&a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>_e(Le),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors",children:"Remove"})})]},Le)})})]})})})]})]})}),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:!H,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:!H,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:g.custom_warranty||!1,onChange:ve=>{v(Ve(ke({},g),{custom_warranty:ve.target.checked}))},disabled:Se("custom_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_extended_warranty||!1,onChange:ve=>{v(Ve(ke({},g),{custom_extended_warranty:ve.target.checked}))},disabled:Se("custom_extended_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom__service_contract||!1,onChange:ve=>{v(Ve(ke({},g),{custom__service_contract:ve.target.checked}))},disabled:Se("custom__service_contract"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_covering_spare_parts||!1,onChange:ve=>{v(Ve(ke({},g),{custom_covering_spare_parts:ve.target.checked}))},disabled:Se("custom_covering_spare_parts"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_spare_parts_labour||!1,onChange:ve=>{v(Ve(ke({},g),{custom_spare_parts_labour:ve.target.checked}))},disabled:Se("custom_spare_parts_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_covering_labour||!1,onChange:ve=>{v(Ve(ke({},g),{custom_covering_labour:ve.target.checked}))},disabled:Se("custom_covering_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_ppm_only||!1,onChange:ve=>{v(Ve(ke({},g),{custom_ppm_only:ve.target.checked}))},disabled:Se("custom_ppm_only"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${g.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:g.custom_support_plan||"",onChange:Fe,disabled:Se("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"}),H&&a.jsxs("button",{type:"button",onClick:ae,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"]})]}),(!g.custom_spare_parts||g.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.'}),g.custom_spare_parts&&g.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"}),H&&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:g.custom_spare_parts.map((ve,Le)=>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:ve.item_code||"",onChange:ut=>W(Le,"item_code",ut.target.value),disabled:!H,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:ve.item_name||"",onChange:ut=>W(Le,"item_name",ut.target.value),disabled:!H,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:ve.qty||0,onChange:ut=>W(Le,"qty",Number(ut.target.value)),disabled:!H,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:ve.rate||0,onChange:ut=>W(Le,"rate",Number(ut.target.value)),disabled:!H,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:ve.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:ve.uom||"",onChange:ut=>W(Le,"uom",ut.target.value),disabled:!H,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"})}),H&&a.jsx("td",{className:"px-4 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>se(Le),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors text-sm",children:"Remove"})})]},Le))}),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:g.custom_total_spare_parts_amount||0}),a.jsx("td",{colSpan:H?2:1})]})})]})})]})]})]})},AM=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const{t:v}=Xa(),[p,k]=R.useState(t>0?"selected":"all_with_filters"),[N,C]=R.useState("csv"),[O,I]=R.useState(g.filter(B=>B.default).map(B=>B.key));R.useEffect(()=>{t>0?k("selected"):k("all_with_filters")},[t]);const M=B=>{I(U=>U.includes(B)?U.filter(H=>H!==B):[...U,B])},D=()=>{I(g.map(B=>B.key))},z=()=>{I(g.filter(B=>B.default).map(B=>B.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(Cs,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[v("listPages.export")," ",v("workOrders.title")]})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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 ${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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>k("selected"),disabled:t===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 ",t," selected work order",t!==1?"s":""]})]}),t>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:[t," 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:()=>k("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 ",o," work order",o!==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:[o," 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:()=>k("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 ",n," work order",n!==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:[n," 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 ${N==="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:N==="csv",onChange:()=>C("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{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 ${N==="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:N==="excel",onChange:()=>C("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{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:D,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:z,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:g.map(B=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${O.includes(B.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:O.includes(B.key),onChange:()=>M(B.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:B.label})]},B.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[O.length," column",O.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 ${t} selected row${t!==1?"s":""}`,p==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(p,N,O),disabled:O.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},jM=()=>{const{t:e}=Xa(),r=ma(),[t,n]=Rl(),[o,u]=R.useState(0),[f,g]=R.useState(null),[v,p]=R.useState(null),k=R.useRef(null),N=20,C=[{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}],O=t.get("asset"),[I,M]=R.useState(!1),[D,z]=R.useState(new Set),[B,U]=R.useState(!1),[H,q]=R.useState(!1),{permissionFilters:ne,loading:V,error:J,hasAnyRestrictions:Q}=b4("Work_Order"),[Te,je]=R.useState(""),[me,Se]=R.useState(""),[Oe,ue]=R.useState(""),[be,re]=R.useState(""),[de,Ae]=R.useState(""),[_e,K]=R.useState(""),[W,ae]=R.useState(""),[se,he]=R.useState(""),[pe,Je]=R.useState(""),[Fe,ft]=R.useState(""),[ot,Lt]=R.useState(""),[zt,Ht]=R.useState(!0),[ht,tr]=R.useState(0),[Kt,gt]=R.useState([]),[ve,Le]=R.useState(!1),[ut,tt]=R.useState(""),[Wt,pt]=R.useState(""),We=R.useRef(null);R.useEffect(()=>{const Z=t.get("company"),ce=t.get("priority"),xe=t.get("status"),ye=t.get("site_name");Z&&re(Z),ce&&Lt(ce),xe&&K(xe),ye&&Ae(ye)},[t]),R.useEffect(()=>{O&&Se(O)},[O]),R.useEffect(()=>{const Z=localStorage.getItem("workOrderFilterPresets");Z&&gt(JSON.parse(Z))},[]),R.useEffect(()=>{const Z=[Te,me,Oe,be,de,_e,W,se,pe,Fe,ot].filter(Boolean).length;tr(Z)},[Te,me,Oe,be,de,_e,W,se,pe,Fe,ot]);const Nt={};Te&&(Nt.name=Te),me&&(Nt.asset=me),Oe&&(Nt.work_order_type=Oe),be&&(Nt.company=be),de&&(Nt.site_name=de),_e&&(Nt.repair_status=_e),W&&(Nt.custom_serial_number=["like",`%${W}%`]),se&&(Nt.custom_manufacturer=se),pe&&(Nt.supplier=pe),Fe&&(Nt.department=Fe),ot&&(Nt.custom_priority_=ot);const{workOrders:At,totalCount:Qt,hasMore:cr,loading:He,error:It,refetch:Zt}=t_(Nt,N,o*N,"modified desc",ne),{deleteWorkOrder:yr,loading:Ye}=r_();R.useEffect(()=>{!He&&!I&&!V&&M(!0)},[He,I,V]),R.useEffect(()=>{o!==0&&u(0)},[Te,me,Oe,be,de,_e,W,se,pe,Fe,ot]),R.useEffect(()=>{z(new Set)},[Te,me,Oe,be,de,_e,W,se,pe,Fe,ot,o]);const Ge=Z=>{pt(Z),We.current&&clearTimeout(We.current),We.current=window.setTimeout(()=>{ae(Z)},800)},Ct=Z=>{Z.key==="Enter"&&(Z.preventDefault(),We.current&&clearTimeout(We.current),ae(Wt))},Ft=()=>{if(!ut.trim()){alert("Please enter a filter name");return}const Z={id:Date.now(),name:ut,filters:{filterWorkOrderId:Te,filterAsset:me,filterType:Oe,filterCompany:be,filterSiteName:de,filterStatus:_e,filterSerialNumber:W,filterManufacturer:se,filterSupplier:pe,filterDepartment:Fe,filterPriority:ot}},ce=[...Kt,Z];gt(ce),tt(""),Le(!1),localStorage.setItem("workOrderFilterPresets",JSON.stringify(ce))},Jt=Z=>{const ce=Z.filters;je(ce.filterWorkOrderId||""),Se(ce.filterAsset||""),ue(ce.filterType||""),re(ce.filterCompany||""),Ae(ce.filterSiteName||""),K(ce.filterStatus||""),ae(ce.filterSerialNumber||""),pt(ce.filterSerialNumber||""),he(ce.filterManufacturer||""),Je(ce.filterSupplier||""),ft(ce.filterDepartment||""),Lt(ce.filterPriority||"")},Dr=Z=>{const ce=Kt.filter(xe=>xe.id!==Z);gt(ce),localStorage.setItem("workOrderFilterPresets",JSON.stringify(ce))};R.useEffect(()=>()=>{We.current&&clearTimeout(We.current)},[]),R.useEffect(()=>{const Z=ce=>{k.current&&!k.current.contains(ce.target)&&p(null)};return v&&document.addEventListener("mousedown",Z),()=>{document.removeEventListener("mousedown",Z)}},[v]);const kt=Z=>{z(ce=>{const xe=new Set(ce);return xe.has(Z)?xe.delete(Z):xe.add(Z),xe})},Re=()=>{D.size===At.length?z(new Set):z(new Set(At.map(Z=>Z.name)))},qe=At.length>0&&D.size===At.length,Tt=D.size>0&&D.size<At.length,xr=R.useCallback(()=>Ne(null,null,function*(){const Z=[];let ce=0;const xe=100;let ye=!0;for(;ye;)try{const Be=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Work_Order",filters:ke(ke({},Nt),ne),fields:["*"],limit_start:ce*xe,limit_page_length:xe,order_by:"creation desc"})})).json()).message||[];Z.push(...Be),Be.length<xe?ye=!1:ce++,ce>100&&(console.warn("Export safety limit reached"),ye=!1)}catch(Ee){throw console.error("Error fetching work orders for export:",Ee),Ee}return Z}),[Nt,ne]),Hr=(Z,ce,xe)=>Ne(null,null,function*(){q(!0);try{let ye=[];switch(Z){case"selected":ye=At.filter(ge=>D.has(ge.name));break;case"all_on_page":ye=At;break;case"all_with_filters":ye=yield xr();break}if(ye.length===0){alert("No data to export");return}const Ee=xe.map(ge=>{const Be=C.find(ze=>ze.key===ge);return(Be==null?void 0:Be.label)||ge});if(ce==="csv"){const ge=[Ee.join(","),...ye.map(et=>xe.map(_t=>{let vt=et[_t]||"";return typeof vt=="string"&&(vt.includes(",")||vt.includes('"')||vt.includes(`
`))&&(vt=`"${vt.replace(/"/g,'""')}"`),vt}).join(","))].join(`
`),Be=new Blob(["\uFEFF"+ge],{type:"text/csv;charset=utf-8;"}),ze=URL.createObjectURL(Be),Ze=document.createElement("a");Ze.href=ze,Ze.download=`work_orders_export_${new Date().toISOString().split("T")[0]}.csv`,Ze.click(),URL.revokeObjectURL(ze)}else if(ce==="excel"){const ge=[Ee,...ye.map(Ze=>xe.map(et=>Ze[et]||""))],Be=Un.aoa_to_sheet(ge),ze=Un.book_new();Un.book_append_sheet(ze,Be,"Work Orders"),Fd(ze,`work_orders_export_${new Date().toISOString().split("T")[0]}.xlsx`)}U(!1),z(new Set)}catch(ye){console.error("Export failed:",ye),alert(`Export failed: ${ye instanceof Error?ye.message:"Unknown error"}`)}finally{q(!1)}}),Ir=()=>r("/work-orders/new"),Pa=Z=>r(`/work-orders/${Z}`),ca=Z=>r(`/work-orders/${Z}`),_n=Z=>r(`/work-orders/new?duplicate=${Z}`),fn=Z=>Ne(null,null,function*(){try{yield yr(Z),g(null),Zt(),alert("Work order deleted successfully!")}catch(ce){alert(`Failed to delete work order: ${ce instanceof Error?ce.message:"Unknown error"}`)}}),hn=Z=>{window.open(`/work-orders/${Z}?print=true`,"_blank")},Xs=()=>{je(""),Se(""),ue(""),re(""),Ae(""),K(""),ae(""),pt(""),he(""),Je(""),ft(""),Lt(""),(t.has("asset")||t.has("site_name"))&&(t.delete("asset"),t.delete("site_name"),n(t)),We.current&&clearTimeout(We.current)},Ha=Te||me||Oe||be||de||_e||W||se||pe||Fe||ot,gs=Z=>Z?new Date(Z).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",$r=Z=>{switch(Z==null?void 0:Z.toLowerCase()){case"completed":return a.jsx(Ua,{className:"text-green-500"});case"in progress":return a.jsx(Tl,{className:"text-blue-500"});case"pending":return a.jsx(en,{className:"text-yellow-500"});default:return a.jsx(Tl,{className:"text-gray-400"})}},rr=Z=>{switch(Z==null?void 0:Z.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"}},ie=Z=>{switch(Z==null?void 0:Z.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 V&&!I?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..."})]})}):J?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:J}),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"})]})]})}):He&&!I?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-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:Zt,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-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 dark:text-white break-words",children:e("workOrders.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",Qt," work order",Qt!==1?"s":"",D.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",D.size," selected"]}),He&&I&&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:()=>U(!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:Qt===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),D.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:D.size})]}),a.jsxs("button",{onClick:Ir,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(Ei,{}),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:()=>Ht(!zt),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:zt?a.jsx(ru,{size:14}):a.jsx(Td,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($i,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"})]}),ht>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ht})]}),Ha&&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:[Te&&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:"})," ",Te,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),je("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),me&&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:"})," ",me,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),Se(""),t.delete("asset"),n(t)},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),Oe&&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:"})," ",Oe,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),ue("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),be&&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:"})," ",be,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),re("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),de&&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:"})," ",de,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),Ae(""),t.delete("site_name"),n(t)},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),_e&&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:"})," ",_e,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),K("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),W&&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:"})," ",W,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),ae(""),pt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),se&&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:"})," ",se,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),he("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),pe&&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:"})," ",pe,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),Je("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),Fe&&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:"})," ",Fe,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),ft("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),ot&&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:"})," ",ot,a.jsx("button",{onClick:Z=>{Z.stopPropagation(),Lt("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ht>0&&a.jsxs("button",{onClick:()=>Le(!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(Tn,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Ha&&a.jsxs("button",{onClick:Xs,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(Yt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),zt&&a.jsxs("div",{className:"p-4",children:[Kt.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(nu,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Kt.map(Z=>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:()=>Jt(Z),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:Z.name}),a.jsx("button",{onClick:()=>Dr(Z.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(la,{size:10})})]},Z.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(er,{label:"Work Order ID",doctype:"Work_Order",value:Te,onChange:Z=>je(Z),placeholder:"Select WO ID",disabled:!1,compact:!0}),Te&&a.jsx("button",{onClick:()=>je(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(er,{label:"Asset",doctype:"Asset",value:me,onChange:Z=>Se(Z),placeholder:"Select Asset",disabled:!1,compact:!0}),me&&a.jsx("button",{onClick:()=>{Se(""),t.delete("asset"),n(t)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(er,{label:"Type",doctype:"Issue Type",value:Oe,onChange:Z=>ue(Z),placeholder:"Select Type",disabled:!1,compact:!0}),Oe&&a.jsx("button",{onClick:()=>ue(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[57]",children:[a.jsx(er,{label:"Hospital",doctype:"Company",value:be,onChange:Z=>re(Z),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),be&&a.jsx("button",{onClick:()=>re(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[56]",children:[a.jsx(er,{label:"PHCC Site",doctype:"Mobile Team Site",value:de,onChange:Z=>Ae(Z),placeholder:"Select Site",disabled:!1,compact:!0}),de&&a.jsx("button",{onClick:()=>{Ae(""),t.delete("site_name"),n(t)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:_e,onChange:Z=>K(Z.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[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"})]}),_e&&a.jsx("button",{onClick:()=>K(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{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:Z=>Ge(Z.target.value),onKeyDown:Ct,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!==W&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),W&&a.jsx("button",{onClick:()=>{ae(""),pt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(er,{label:"Manufacturer",doctype:"Manufacturer",value:se,onChange:Z=>he(Z),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),se&&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(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[54]",children:[a.jsx(er,{label:"Supplier",doctype:"Supplier",value:pe,onChange:Z=>Je(Z),placeholder:"Select Supplier",disabled:!1,compact:!0}),pe&&a.jsx("button",{onClick:()=>Je(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[53]",children:[a.jsx(er,{label:"Department",doctype:"Department",value:Fe,onChange:Z=>ft(Z),placeholder:"Select Department",disabled:!1,compact:!0}),Fe&&a.jsx("button",{onClick:()=>ft(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:ot,onChange:Z=>Lt(Z.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[a.jsx("option",{value:"",children:"All Priorities"}),a.jsx("option",{value:"Normal",children:"Normal"}),a.jsx("option",{value:"Urgent",children:"Urgent"})]}),ot&&a.jsx("button",{onClick:()=>Lt(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]})]})})})]})]}),ve&&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:ut,onChange:Z=>tt(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&(Z.preventDefault(),Ft())},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:()=>{Le(!1),tt("")},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(Tn,{size:12}),"Save Filter"]})]})]})}),a.jsx(AM,{isOpen:B,onClose:()=>U(!1),selectedCount:D.size,totalCount:Qt,pageCount:At.length,onExport:Hr,isExporting:H,exportColumns:C}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[He&&I&&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:Re,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:qe?"Deselect all":"Select all",children:qe?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):Tt?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:At.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(xo,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No work orders found"}),Ha?a.jsx("button",{onClick:Xs,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:Ir,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"})]})})}):At.map(Z=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${D.has(Z.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>Pa(Z.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:ce=>ce.stopPropagation(),children:a.jsx("button",{onClick:()=>kt(Z.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:D.has(Z.name)?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Bn,{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:Z.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:gs(Z.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:Z.asset_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Z.asset||""})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Z.work_order_type||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Z.department||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[$r(Z.repair_status||""),a.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${rr(Z.repair_status||"")}`,children:Z.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 ${ie(Z.custom_priority_||"")}`,children:Z.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:ce=>ce.stopPropagation(),children:[a.jsx("button",{onClick:()=>Pa(Z.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:a.jsx(Yi,{})}),a.jsx("button",{onClick:()=>ca(Z.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Work Order",children:a.jsx(rs,{})}),a.jsx("button",{onClick:()=>_n(Z.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Work Order",children:a.jsx(Ad,{})}),a.jsx("button",{onClick:()=>g(Z.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Work Order",disabled:Ye,children:a.jsx(la,{})}),a.jsxs("div",{className:"relative",ref:v===Z.name?k:null,children:[a.jsx("button",{onClick:()=>p(v===Z.name?null:Z.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:a.jsx(au,{})}),v===Z.name&&a.jsx("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:()=>{hn(Z.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[a.jsx(fc,{className:"text-purple-500"}),"Print Work Order"]})})]})]})})]},Z.name))})]})}),At.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:o*N+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((o+1)*N,Qt)})," ","of ",a.jsx("span",{className:"font-medium",children:Qt})," results",Q&&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:o===0,onClick:()=>u(o-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:!cr,onClick:()=>u(o+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"})]})]})]}),f&&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(la,{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:"})," ",f]})}),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:Ye,children:"Cancel"}),a.jsx("button",{onClick:()=>fn(f),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:Ye,children:Ye?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(la,{}),"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 gd=null,xd=null;const OM=(e,r)=>{gd=e,r&&(xd=r),console.log("[Workflow] User set manually:",e,"Roles:",r)},MM=()=>{gd=null,xd=null},up=()=>Ne(null,null,function*(){try{if(gd&&xd)return console.log("[Workflow] Using cached user:",gd,"roles:",xd),{user:gd,roles:xd};const e=yield jt.getUserDetails();if(e&&e.email){const r=e.email||e.user_id,t=e.roles||[];return gd=r,xd=t,console.log("[Workflow] User from getUserDetails():",r),console.log("[Workflow] Roles from getUserDetails():",t),{user:r,roles:t}}return console.warn("[Workflow] getUserDetails() returned no user"),{user:"",roles:[]}}catch(e){return console.error("[Workflow] Error getting user details:",e),{user:"",roles:[]}}}),RM=()=>Ne(null,null,function*(){const{user:e}=yield up();return e}),Rh=()=>Ne(null,null,function*(){const{roles:e}=yield up();return e}),Dh=()=>Ne(null,null,function*(){try{const e=yield Rh(),r=e.includes("System Manager");return console.log("[Workflow] Is System Manager:",r,"Roles:",e),r}catch(e){return console.error("[Workflow] Error checking System Manager role:",e),!1}}),fp=(e,r)=>{if(!e||e.trim()==="")return!0;try{console.log("[Workflow] Evaluating condition:",e),console.log("[Workflow] Document data for condition:",{asset_type:r.asset_type,site_name:r.site_name,need_procurement:r.need_procurement,custom_assign_to_contractor:r.custom_assign_to_contractor,docstatus:r.docstatus});let t=e;t=t.replace(/\band\b/g,"&&"),t=t.replace(/\bor\b/g,"||"),t=t.replace(/\bnot\s+/g,"!"),t=t.replace(/\bTrue\b/g,"true"),t=t.replace(/\bFalse\b/g,"false"),t=t.replace(/\bNone\b/g,"null"),t=t.replace(/doc\.(\w+)/g,(o,u)=>{const f=r[u];return f==null||f===""?"false":typeof f=="string"?`"${f.replace(/"/g,'\\"')}"`:typeof f=="boolean"?f?"true":"false":typeof f=="number"?String(f):JSON.stringify(f)}),t=t.replace(/== 1/g,"=== 1"),t=t.replace(/== 0/g,"=== 0"),t=t.replace(/!= 1/g,"!== 1"),t=t.replace(/!= 0/g,"!== 0"),console.log("[Workflow] Transformed condition:",t);const n=new Function(`return (${t})`)();return console.log("[Workflow] Condition result:",n),!!n}catch(t){return console.error("[Workflow] Error evaluating condition:",e,t),!1}},Ih=e=>Ne(null,null,function*(){var r,t,n,o;try{console.log("[Workflow] Getting workflow info for doctype:",e);const u=yield jt.apiCall(`/api/resource/Workflow?filters=[["document_type","=","${e}"],["is_active","=",1]]&fields=["name","workflow_state_field"]&limit=1`);if(console.log("[Workflow] Workflow response:",u),!(u!=null&&u.data)||u.data.length===0)return console.warn("[Workflow] No active workflow found for doctype:",e),null;const f=u.data[0].name;console.log("[Workflow] Found workflow:",f);const g=yield jt.apiCall(`/api/resource/Workflow/${encodeURIComponent(f)}`);return console.log("[Workflow] Full workflow data:",g==null?void 0:g.data),console.log("[Workflow] Transitions count:",(t=(r=g==null?void 0:g.data)==null?void 0:r.transitions)==null?void 0:t.length),console.log("[Workflow] States count:",(o=(n=g==null?void 0:g.data)==null?void 0:n.states)==null?void 0:o.length),{workflow_name:g.data.name,workflow_state:"",workflow_state_field:g.data.workflow_state_field,transitions:g.data.transitions||[],states:g.data.states||[]}}catch(u){return console.error("[Workflow] Error fetching workflow info:",u),null}}),N4=(e,r,t)=>Ne(null,null,function*(){try{console.log("[Workflow] Getting all transitions for state:",r);const n=yield Ih(e);if(!n)return console.warn("[Workflow] No workflow info found"),[];console.log("[Workflow] All transitions from workflow:",n.transitions.length);let o=n.transitions.filter(g=>g.state===r);console.log("[Workflow] Transitions for state",r,":",o.length),t&&(o=o.filter(g=>{const v=fp(g.condition,t);return console.log(`[Workflow] Transition "${g.action}" (allowed: ${g.allowed}) condition "${g.condition||"none"}" = ${v}`),v}),console.log("[Workflow] Transitions after condition evaluation:",o.length));const u=new Set,f=[];for(const g of o){const v=`${g.action}::${g.next_state}`;u.has(v)?console.log(`[Workflow] Skipping duplicate: ${g.action} → ${g.next_state} (allowed: ${g.allowed})`):(u.add(v),f.push(g))}return console.log("[Workflow] Unique transitions after deduplication:",f.length),f}catch(n){return console.error("[Workflow] Error fetching all transitions:",n),[]}}),DM=(e,r,t,n)=>Ne(null,null,function*(){var o;try{console.log("[Workflow] getWorkflowTransitions called with:",{doctype:e,docname:r,currentState:t});const u=yield Dh(),f=yield Rh();if(console.log("[Workflow] User is System Manager:",u),console.log("[Workflow] User roles:",f),u&&t){console.log("[Workflow] System Manager detected, getting all transitions for state:",t);const p=yield N4(e,t,n);return console.log("[Workflow] Final transitions for System Manager:",p.map(k=>`${k.action} → ${k.next_state}`)),p}console.log("[Workflow] Non-System Manager, using Frappe API");const g=yield jt.apiCall("/api/method/frappe.model.workflow.get_transitions",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:r})})});console.log("[Workflow] Frappe transitions raw response:",g);let v=[];if(Array.isArray(g)?v=g:g!=null&&g.message&&Array.isArray(g.message)?v=g.message:g!=null&&g.data&&Array.isArray(g.data)?v=g.data:(o=g==null?void 0:g.data)!=null&&o.message&&Array.isArray(g.data.message)&&(v=g.data.message),console.log("[Workflow] Parsed transitions:",v),console.log("[Workflow] Transitions count:",v.length),v.length===0&&t&&n){console.log("[Workflow] Frappe API returned no transitions, trying local filtering");const p=yield Ih(e);if(p){const k=p.transitions.filter(O=>!(O.state!==t||!f.includes(O.allowed)||!fp(O.condition,n))),N=new Set,C=[];for(const O of k){const I=`${O.action}::${O.next_state}`;N.has(I)||(N.add(I),C.push(O))}return console.log("[Workflow] Local filtered transitions:",C),C}}return v}catch(u){return console.error("[Workflow] Error fetching workflow transitions:",u),[]}}),IM=(e,r,t,n)=>Ne(null,null,function*(){try{if(console.log("[Workflow] Applying action:",{doctype:e,docname:r,action:t,nextState:n}),(yield Dh())&&n)try{const f=yield jt.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:r}),action:t})});return console.log("[Workflow] Action applied successfully via workflow API"),f==null?void 0:f.message}catch(f){console.log("[Workflow] Normal workflow failed, System Manager forcing state change...");const g=yield jt.apiCall(`/api/resource/${e}/${encodeURIComponent(r)}`,{method:"PUT",body:JSON.stringify({workflow_state:n})});return console.log("[Workflow] Force update response:",g),g==null?void 0:g.data}const u=yield jt.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:r}),action:t})});return console.log("[Workflow] Action applied successfully"),u==null?void 0:u.message}catch(o){throw console.error("[Workflow] Error applying workflow action:",o),o}}),LM=(e,r,t)=>Ne(null,null,function*(){try{if(yield Dh())return console.log("[Workflow] System Manager can always edit"),!0;const o=yield Ih(e);if(!o)return!0;const u=yield Rh(),f=o.states.filter(v=>v.state===t);if(f.length===0)return!0;const g=f.some(v=>u.includes(v.allow_edit));return console.log("[Workflow] Can user edit:",g,"User roles:",u,"Allowed roles:",f.map(v=>v.allow_edit)),g}catch(n){return console.error("[Workflow] Error checking edit permission:",n),!1}}),S4=e=>{const r={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 r[e]||r.Draft},E4=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",C4=e=>({Apply:"📤","Send For Repair":"🔧","Send For Approval":"📋","Material Request":"📦",Accept:"✅",Reject:"❌",Close:"🔒","Re-Open":"🔓",Cancel:"🚫",Approve:"✅"})[e]||"▶️",ac={getWorkflowTransitions:DM,applyWorkflowAction:IM,getWorkflowInfo:Ih,getCurrentUserRoles:Rh,getCurrentUser:RM,getCurrentUserAndRoles:up,setCurrentUser:OM,clearCurrentUser:MM,canUserEditDocument:LM,getWorkflowStateStyle:S4,getActionButtonStyle:E4,getActionIcon:C4,isSystemManager:Dh,getAllTransitionsForState:N4,evaluateCondition:fp},T4=({doctype:e,docname:r,workflowState:t,enabled:n=!0,docData:o})=>{const[u,f]=R.useState([]),[g,v]=R.useState(null),[p,k]=R.useState([]),[N,C]=R.useState(""),[O,I]=R.useState(!1),[M,D]=R.useState(!1),[z,B]=R.useState(!1),[U,H]=R.useState(null),[q,ne]=R.useState(!0);R.useEffect(()=>{if(!n)return;Ne(null,null,function*(){try{const Te=yield ac.getWorkflowInfo(e);v(Te)}catch(Te){console.error("Error fetching workflow info:",Te)}})},[e,n]),R.useEffect(()=>{if(!n)return;Ne(null,null,function*(){try{const[Te,je,me]=yield Promise.all([ac.getCurrentUserRoles(),ac.getCurrentUser(),ac.isSystemManager()]);k(Te),C(je),I(me),me&&ne(!0)}catch(Te){console.error("Error fetching user info:",Te)}})},[n]);const V=R.useCallback(()=>Ne(null,null,function*(){if(!r||!n){f([]);return}D(!0),H(null);try{const Q=yield ac.getWorkflowTransitions(e,r,t,o);if(console.log("[useWorkflow] Available transitions:",Q),f(Q),t){const Te=yield ac.canUserEditDocument(e,r,t);ne(Te)}}catch(Q){console.error("Error fetching transitions:",Q),H("Failed to load workflow actions"),f([])}finally{D(!1)}}),[e,r,t,n,o]);R.useEffect(()=>{V()},[V]);const J=R.useCallback((Q,Te)=>Ne(null,null,function*(){if(!r)return H("Document not saved yet"),!1;B(!0),H(null);try{return yield ac.applyWorkflowAction(e,r,Q,Te),yield V(),!0}catch(je){console.error("Error applying workflow action:",je);let me="Failed to apply action";if(je.message)me=je.message;else if(je._server_messages)try{me=JSON.parse(je._server_messages).map(Oe=>{try{return JSON.parse(Oe).message}catch(ue){return Oe}}).join(`
`)}catch(Se){me=je._server_messages}return H(me),!1}finally{B(!1)}}),[e,r,V]);return{transitions:u,workflowInfo:g,userRoles:p,currentUser:N,isSystemManager:O,loading:M,actionLoading:z,error:U,canEdit:q,applyAction:J,refreshTransitions:V,getStateStyle:S4,getButtonStyle:E4,getIcon:C4}};function A4(e){var r,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(r=0;r<o;r++)e[r]&&(t=A4(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function dc(){for(var e,r,t=0,n="",o=arguments.length;t<o;t++)(e=arguments[t])&&(r=A4(e))&&(n&&(n+=" "),n+=r);return n}function PM(e){if(typeof document=="undefined")return;let r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",r.firstChild?r.insertBefore(t,r.firstChild):r.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}PM(`: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 gu=e=>typeof e=="number"&&!isNaN(e),pc=e=>typeof e=="string",Ko=e=>typeof e=="function",FM=e=>pc(e)||gu(e),_x=e=>pc(e)||Ko(e)?e:null,BM=(e,r)=>e===!1||gu(e)&&e>0?e:r,wx=e=>R.isValidElement(e)||pc(e)||Ko(e)||gu(e);function UM(e,r,t=300){let{scrollHeight:n,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=n+"px",o.transition=`all ${t}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(r,t)})})}function zM({enter:e,exit:r,appendPosition:t=!1,collapse:n=!0,collapseDuration:o=300}){return function({children:u,position:f,preventExitTransition:g,done:v,nodeRef:p,isIn:k,playToast:N}){let C=t?`${e}--${f}`:e,O=t?`${r}--${f}`:r,I=R.useRef(0);return R.useLayoutEffect(()=>{let M=p.current,D=C.split(" "),z=B=>{B.target===p.current&&(N(),M.removeEventListener("animationend",z),M.removeEventListener("animationcancel",z),I.current===0&&B.type!=="animationcancel"&&M.classList.remove(...D))};M.classList.add(...D),M.addEventListener("animationend",z),M.addEventListener("animationcancel",z)},[]),R.useEffect(()=>{let M=p.current,D=()=>{M.removeEventListener("animationend",D),n?UM(M,v,o):v()};k||(g?D():(I.current=1,M.className+=` ${O}`,M.addEventListener("animationend",D)))},[k]),Zr.createElement(Zr.Fragment,null,u)}}function kv(e,r){return{content:j4(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:r}}function j4(e,r,t=!1){return R.isValidElement(e)&&!pc(e.type)?R.cloneElement(e,{closeToast:r.closeToast,toastProps:r,data:r.data,isPaused:t}):Ko(e)?e({closeToast:r.closeToast,toastProps:r,data:r.data,isPaused:t}):e}function HM({closeToast:e,theme:r,ariaLabel:t="close"}){return Zr.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:n=>{n.stopPropagation(),e(!0)},"aria-label":t},Zr.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Zr.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 WM({delay:e,isRunning:r,closeToast:t,type:n="default",hide:o,className:u,controlledProgress:f,progress:g,rtl:v,isIn:p,theme:k}){let N=o||f&&g===0,C={animationDuration:`${e}ms`,animationPlayState:r?"running":"paused"};f&&(C.transform=`scaleX(${g})`);let O=dc("Toastify__progress-bar",f?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${k}`,`Toastify__progress-bar--${n}`,{"Toastify__progress-bar--rtl":v}),I=Ko(u)?u({rtl:v,type:n,defaultClassName:O}):dc(O,u),M={[f&&g>=1?"onTransitionEnd":"onAnimationEnd"]:f&&g<1?null:()=>{p&&t()}};return Zr.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":N},Zr.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${k} Toastify__progress-bar--${n}`}),Zr.createElement("div",ke({role:"progressbar","aria-hidden":N?"true":"false","aria-label":"notification timer",className:I,style:C},M)))}var VM=1,O4=()=>`${VM++}`;function GM(e,r,t){let n=1,o=0,u=[],f=[],g=r,v=new Map,p=new Set,k=B=>(p.add(B),()=>p.delete(B)),N=()=>{f=Array.from(v.values()),p.forEach(B=>B())},C=({containerId:B,toastId:U,updateId:H})=>{let q=B?B!==e:e!==1,ne=v.has(U)&&H==null;return q||ne},O=(B,U)=>{v.forEach(H=>{var q;(U==null||U===H.props.toastId)&&((q=H.toggle)==null||q.call(H,B))})},I=B=>{var U,H;(H=(U=B.props)==null?void 0:U.onClose)==null||H.call(U,B.removalReason),B.isActive=!1},M=B=>{if(B==null)v.forEach(I);else{let U=v.get(B);U&&I(U)}N()},D=()=>{o-=u.length,u=[]},z=B=>{var U,H;let{toastId:q,updateId:ne}=B.props,V=ne==null;B.staleId&&v.delete(B.staleId),B.isActive=!0,v.set(q,B),N(),t(kv(B,V?"added":"updated")),V&&((H=(U=B.props).onOpen)==null||H.call(U))};return{id:e,props:g,observe:k,toggle:O,removeToast:M,toasts:v,clearQueue:D,buildToast:(B,U)=>{if(C(U))return;let{toastId:H,updateId:q,data:ne,staleId:V,delay:J}=U,Q=q==null;Q&&o++;let Te=Ve(ke(Ve(ke({},g),{style:g.toastStyle,key:n++}),Object.fromEntries(Object.entries(U).filter(([me,Se])=>Se!=null))),{toastId:H,updateId:q,data:ne,isIn:!1,className:_x(U.className||g.toastClassName),progressClassName:_x(U.progressClassName||g.progressClassName),autoClose:U.isLoading?!1:BM(U.autoClose,g.autoClose),closeToast(me){v.get(H).removalReason=me,M(H)},deleteToast(){let me=v.get(H);if(me!=null){if(t(kv(me,"removed")),v.delete(H),o--,o<0&&(o=0),u.length>0){z(u.shift());return}N()}}});Te.closeButton=g.closeButton,U.closeButton===!1||wx(U.closeButton)?Te.closeButton=U.closeButton:U.closeButton===!0&&(Te.closeButton=wx(g.closeButton)?g.closeButton:!0);let je={content:B,props:Te,staleId:V};g.limit&&g.limit>0&&o>g.limit&&Q?u.push(je):gu(J)?setTimeout(()=>{z(je)},J):z(je)},setProps(B){g=B},setToggle:(B,U)=>{let H=v.get(B);H&&(H.toggle=U)},isToastActive:B=>{var U;return(U=v.get(B))==null?void 0:U.isActive},getSnapshot:()=>f}}var Ss=new Map,Q0=[],kx=new Set,XM=e=>kx.forEach(r=>r(e)),M4=()=>Ss.size>0;function YM(){Q0.forEach(e=>D4(e.content,e.options)),Q0=[]}var ZM=(e,{containerId:r})=>{var t;return(t=Ss.get(r||1))==null?void 0:t.toasts.get(e)};function R4(e,r){var t;if(r)return!!((t=Ss.get(r))!=null&&t.isToastActive(e));let n=!1;return Ss.forEach(o=>{o.isToastActive(e)&&(n=!0)}),n}function $M(e){if(!M4()){Q0=Q0.filter(r=>e!=null&&r.options.toastId!==e);return}if(e==null||FM(e))Ss.forEach(r=>{r.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let r=Ss.get(e.containerId);r?r.removeToast(e.id):Ss.forEach(t=>{t.removeToast(e.id)})}}var qM=(e={})=>{Ss.forEach(r=>{r.props.limit&&(!e.containerId||r.id===e.containerId)&&r.clearQueue()})};function D4(e,r){wx(e)&&(M4()||Q0.push({content:e,options:r}),Ss.forEach(t=>{t.buildToast(e,r)}))}function KM(e){var r;(r=Ss.get(e.containerId||1))==null||r.setToggle(e.id,e.fn)}function I4(e,r){Ss.forEach(t=>{(r==null||!(r!=null&&r.containerId)||(r==null?void 0:r.containerId)===t.id)&&t.toggle(e,r==null?void 0:r.id)})}function JM(e){let r=e.containerId||1;return{subscribe(t){let n=GM(r,e,XM);Ss.set(r,n);let o=n.observe(t);return YM(),()=>{o(),Ss.delete(r)}},setProps(t){var n;(n=Ss.get(r))==null||n.setProps(t)},getSnapshot(){var t;return(t=Ss.get(r))==null?void 0:t.getSnapshot()}}}function QM(e){return kx.add(e),()=>{kx.delete(e)}}function eR(e){return e&&(pc(e.toastId)||gu(e.toastId))?e.toastId:O4()}function xu(e,r){return D4(e,r),r.toastId}function Lh(e,r){return Ve(ke({},r),{type:r&&r.type||e,toastId:eR(r)})}function Ph(e){return(r,t)=>xu(r,Lh(e,t))}function ar(e,r){return xu(e,Lh("default",r))}ar.loading=(e,r)=>xu(e,Lh("default",ke({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},r)));function tR(e,{pending:r,error:t,success:n},o){let u;r&&(u=pc(r)?ar.loading(r,o):ar.loading(r.render,ke(ke({},o),r)));let f={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},g=(p,k,N)=>{if(k==null){ar.dismiss(u);return}let C=Ve(ke(ke({type:p},f),o),{data:N}),O=pc(k)?{render:k}:k;return u?ar.update(u,ke(ke({},C),O)):ar(O.render,ke(ke({},C),O)),N},v=Ko(e)?e():e;return v.then(p=>g("success",n,p)).catch(p=>g("error",t,p)),v}ar.promise=tR;ar.success=Ph("success");ar.info=Ph("info");ar.error=Ph("error");ar.warning=Ph("warning");ar.warn=ar.warning;ar.dark=(e,r)=>xu(e,Lh("default",ke({theme:"dark"},r)));function rR(e){$M(e)}ar.dismiss=rR;ar.clearWaitingQueue=qM;ar.isActive=R4;ar.update=(e,r={})=>{let t=ZM(e,r);if(t){let{props:n,content:o}=t,u=Ve(ke(ke({delay:100},n),r),{toastId:r.toastId||e,updateId:O4()});u.toastId!==e&&(u.staleId=e);let f=u.render||o;delete u.render,xu(f,u)}};ar.done=e=>{ar.update(e,{progress:1})};ar.onChange=QM;ar.play=e=>I4(!0,e);ar.pause=e=>I4(!1,e);function aR(e){var r;let{subscribe:t,getSnapshot:n,setProps:o}=R.useRef(JM(e)).current;o(e);let u=(r=R.useSyncExternalStore(t,n,n))==null?void 0:r.slice();function f(g){if(!u)return[];let v=new Map;return e.newestOnTop&&u.reverse(),u.forEach(p=>{let{position:k}=p.props;v.has(k)||v.set(k,[]),v.get(k).push(p)}),Array.from(v,p=>g(p[0],p[1]))}return{getToastToRender:f,isToastActive:R4,count:u==null?void 0:u.length}}function nR(e){let[r,t]=R.useState(!1),[n,o]=R.useState(!1),u=R.useRef(null),f=R.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:g,pauseOnHover:v,closeToast:p,onClick:k,closeOnClick:N}=e;KM({id:e.toastId,containerId:e.containerId,fn:t}),R.useEffect(()=>{if(e.pauseOnFocusLoss)return C(),()=>{O()}},[e.pauseOnFocusLoss]);function C(){document.hasFocus()||z(),window.addEventListener("focus",D),window.addEventListener("blur",z)}function O(){window.removeEventListener("focus",D),window.removeEventListener("blur",z)}function I(V){if(e.draggable===!0||e.draggable===V.pointerType){B();let J=u.current;f.canCloseOnClick=!0,f.canDrag=!0,J.style.transition="none",e.draggableDirection==="x"?(f.start=V.clientX,f.removalDistance=J.offsetWidth*(e.draggablePercent/100)):(f.start=V.clientY,f.removalDistance=J.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function M(V){let{top:J,bottom:Q,left:Te,right:je}=u.current.getBoundingClientRect();V.nativeEvent.type!=="touchend"&&e.pauseOnHover&&V.clientX>=Te&&V.clientX<=je&&V.clientY>=J&&V.clientY<=Q?z():D()}function D(){t(!0)}function z(){t(!1)}function B(){f.didMove=!1,document.addEventListener("pointermove",H),document.addEventListener("pointerup",q)}function U(){document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",q)}function H(V){let J=u.current;if(f.canDrag&&J){f.didMove=!0,r&&z(),e.draggableDirection==="x"?f.delta=V.clientX-f.start:f.delta=V.clientY-f.start,f.start!==V.clientX&&(f.canCloseOnClick=!1);let Q=e.draggableDirection==="x"?`${f.delta}px, var(--y)`:`0, calc(${f.delta}px + var(--y))`;J.style.transform=`translate3d(${Q},0)`,J.style.opacity=`${1-Math.abs(f.delta/f.removalDistance)}`}}function q(){U();let V=u.current;if(f.canDrag&&f.didMove&&V){if(f.canDrag=!1,Math.abs(f.delta)>f.removalDistance){o(!0),e.closeToast(!0),e.collapseAll();return}V.style.transition="transform 0.2s, opacity 0.2s",V.style.removeProperty("transform"),V.style.removeProperty("opacity")}}let ne={onPointerDown:I,onPointerUp:M};return g&&v&&(ne.onMouseEnter=z,e.stacked||(ne.onMouseLeave=D)),N&&(ne.onClick=V=>{k&&k(V),f.canCloseOnClick&&p(!0)}),{playToast:D,pauseToast:z,isRunning:r,preventExitTransition:n,toastRef:u,eventHandlers:ne}}var sR=typeof window!="undefined"?R.useLayoutEffect:R.useEffect,Fh=o=>{var u=o,{theme:e,type:r,isLoading:t}=u,n=Us(u,["theme","type","isLoading"]);return Zr.createElement("svg",ke({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${r})`},n))};function iR(e){return Zr.createElement(Fh,ke({},e),Zr.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 oR(e){return Zr.createElement(Fh,ke({},e),Zr.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 lR(e){return Zr.createElement(Fh,ke({},e),Zr.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 cR(e){return Zr.createElement(Fh,ke({},e),Zr.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 dR(){return Zr.createElement("div",{className:"Toastify__spinner"})}var Nx={info:oR,warning:iR,success:lR,error:cR,spinner:dR},uR=e=>e in Nx;function fR({theme:e,type:r,isLoading:t,icon:n}){let o=null,u={theme:e,type:r};return n===!1||(Ko(n)?o=n(Ve(ke({},u),{isLoading:t})):R.isValidElement(n)?o=R.cloneElement(n,u):t?o=Nx.spinner():uR(r)&&(o=Nx[r](u))),o}var hR=e=>{let{isRunning:r,preventExitTransition:t,toastRef:n,eventHandlers:o,playToast:u}=nR(e),{closeButton:f,children:g,autoClose:v,onClick:p,type:k,hideProgressBar:N,closeToast:C,transition:O,position:I,className:M,style:D,progressClassName:z,updateId:B,role:U,progress:H,rtl:q,toastId:ne,deleteToast:V,isIn:J,isLoading:Q,closeOnClick:Te,theme:je,ariaLabel:me}=e,Se=dc("Toastify__toast",`Toastify__toast-theme--${je}`,`Toastify__toast--${k}`,{"Toastify__toast--rtl":q},{"Toastify__toast--close-on-click":Te}),Oe=Ko(M)?M({rtl:q,position:I,type:k,defaultClassName:Se}):dc(Se,M),ue=fR(e),be=!!H||!v,re={closeToast:C,type:k,theme:je},de=null;return f===!1||(Ko(f)?de=f(re):R.isValidElement(f)?de=R.cloneElement(f,re):de=HM(re)),Zr.createElement(O,{isIn:J,done:V,position:I,preventExitTransition:t,nodeRef:n,playToast:u},Zr.createElement("div",ke(Ve(ke({id:ne,tabIndex:0,onClick:p,"data-in":J,className:Oe},o),{style:D,ref:n}),J&&{role:U,"aria-label":me}),ue!=null&&Zr.createElement("div",{className:dc("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!Q})},ue),j4(g,e,!r),de,!e.customProgressBar&&Zr.createElement(WM,Ve(ke({},B&&!be?{key:`p-${B}`}:{}),{rtl:q,theme:je,delay:v,isRunning:r,isIn:J,closeToast:C,hide:N,type:k,className:z,controlledProgress:be,progress:H||0}))))},mR=(e,r=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:r}),pu=zM(mR("bounce",!0)),gR={position:"top-right",transition:pu,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 Bh(e){let r=ke(ke({},gR),e),t=e.stacked,[n,o]=R.useState(!0),u=R.useRef(null),{getToastToRender:f,isToastActive:g,count:v}=aR(r),{className:p,style:k,rtl:N,containerId:C,hotKeys:O}=r;function I(D){let z=dc("Toastify__toast-container",`Toastify__toast-container--${D}`,{"Toastify__toast-container--rtl":N});return Ko(p)?p({position:D,rtl:N,defaultClassName:z}):dc(z,_x(p))}function M(){t&&(o(!0),ar.play())}return sR(()=>{var D;if(t){let z=u.current.querySelectorAll('[data-in="true"]'),B=12,U=(D=r.position)==null?void 0:D.includes("top"),H=0,q=0;Array.from(z).reverse().forEach((ne,V)=>{let J=ne;J.classList.add("Toastify__toast--stacked"),V>0&&(J.dataset.collapsed=`${n}`),J.dataset.pos||(J.dataset.pos=U?"top":"bot");let Q=H*(n?.2:1)+(n?0:B*V);J.style.setProperty("--y",`${U?Q:Q*-1}px`),J.style.setProperty("--g",`${B}`),J.style.setProperty("--s",`${1-(n?q:0)}`),H+=J.offsetHeight,q+=.025})}},[n,v,t]),R.useEffect(()=>{function D(z){var B;let U=u.current;O(z)&&((B=U.querySelector('[tabIndex="0"]'))==null||B.focus(),o(!1),ar.pause()),z.key==="Escape"&&(document.activeElement===U||U!=null&&U.contains(document.activeElement))&&(o(!0),ar.play())}return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[O]),Zr.createElement("section",{ref:u,className:"Toastify",id:C,onMouseEnter:()=>{t&&(o(!1),ar.pause())},onMouseLeave:M,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":r["aria-label"]},f((D,z)=>{let B=z.length?ke({},k):Ve(ke({},k),{pointerEvents:"none"});return Zr.createElement("div",{tabIndex:-1,className:I(D),"data-stacked":t,style:B,key:`c-${D}`},z.map(({content:U,props:H})=>Zr.createElement(hR,Ve(ke({},H),{stacked:t,collapseAll:M,isIn:g(H.toastId,H.containerId),key:`t-${H.key}`}),U)))}))}const xR=({doctype:e,docname:r,workflowState:t,onActionComplete:n,onStateChange:o,showStateInfo:u=!0,className:f=""})=>{const{transitions:g,loading:v,actionLoading:p,error:k,applyAction:N,getStateStyle:C,getButtonStyle:O,getIcon:I}=T4({doctype:e,docname:r,workflowState:t,enabled:!!r}),[M,D]=R.useState(null),z=["Reject","Cancel","Close"],B=q=>Ne(null,null,function*(){if(z.includes(q)&&M!==q){D(q);return}D(null);const ne=yield N(q);n&&n(q,ne),ne&&o&&o()}),U=()=>{D(null)};if(!r)return null;const H=C(t||"Draft");return a.jsxs("div",{className:`space-y-4 ${f}`,children:[u&&t&&a.jsx("div",{className:`p-4 rounded-lg border ${H.bg} ${H.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 ${H.text}`,children:t})]}),a.jsx("div",{className:`w-3 h-3 rounded-full ${H.bg.replace("100","500").replace("900/30","500")}`})]})}),v&&a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsx(fs,{className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading workflow actions..."})]}),k&&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(en,{className:"text-red-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})]})}),M&&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(en,{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:M})," this work order?"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>B(M),disabled:p,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:p?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(fs,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${M}`}),a.jsx("button",{onClick:U,disabled:p,className:"px-3 py-1.5 bg-gray-300 hover:bg-gray-400 text-gray-700 text-sm rounded-md disabled:opacity-50",children:"Cancel"})]})]}),!v&&g.length>0&&!M&&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(A0,{size:12}),"Available Actions"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.map((q,ne)=>a.jsxs("button",{onClick:()=>B(q.action),disabled:p,className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center gap-2 ${O(q.action)}`,title:`Move to: ${q.next_state}`,children:[p?a.jsx(fs,{className:"animate-spin",size:14}):a.jsx("span",{children:I(q.action)}),q.action]},`${q.action}-${ne}`))}),a.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:g.map((q,ne)=>a.jsxs("span",{className:"inline-block mr-3",children:[q.action," → ",a.jsx("span",{className:"font-medium",children:q.next_state})]},ne))})]}),!v&&g.length===0&&r&&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"})})]})},pR="Service Report",Nv=()=>new Date().toISOString().split("T")[0],yR=(e,r)=>{if(!e)return"";const t=new Date(e);return t.setDate(t.getDate()+r),t.toISOString().split("T")[0]},bR=()=>{var Jt,Dr,kt;const{workOrderName:e}=Ml(),r=ma(),[t]=Rl(),n=t.get("duplicate"),o=t.get("asset"),u=!!o,f=e==="new",g=f&&!!n,v=()=>{if(!e||f)return;const qe=`${wr.BASE_URL}/printview?doctype=Work_Order&name=${encodeURIComponent(e)}&format=${encodeURIComponent(pR)}&trigger_print=1`;window.open(qe,"_blank")||ar.warning("Please allow popups for this site to print the Service Report.",{position:"top-right",autoClose:5e3,icon:a.jsx(en,{})})},[p,k]=R.useState(!1),{workOrder:N,loading:C,error:O,refetch:I}=FS(g?n:f?null:e||null),{createWorkOrder:M,updateWorkOrder:D,loading:z}=r_(),[B,U]=R.useState(f),[H,q]=R.useState(!1),[ne,V]=R.useState(null),[J,Q]=R.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:f?Nv():"",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}),Te=J.asset_type==="Non Biomedical",je=R.useCallback((Re,qe,Tt)=>{if(!Re)return"";let xr=0;const Hr=Tt===1;return qe==="Normal"?xr=Hr?30:5:qe==="Urgent"&&(xr=Hr?30:1),yR(Re,xr)},[]);R.useEffect(()=>{if(!B)return;const Re=je(J.failure_date,J.custom_priority_||"Normal",J.need_procurement||0);Re&&Re!==J.custom_deadline_date&&Q(qe=>Ve(ke({},qe),{custom_deadline_date:Re}))},[J.failure_date,J.custom_priority_,J.need_procurement,B,je]),R.useEffect(()=>{Te&&B&&Q(Re=>Ve(ke({},Re),{asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}))},[Te,B]);const{shouldShowField:me,isMandatory:Se,isReadOnly:Oe}=k4("Work_Order",J);R.useCallback(Re=>me(Re),[me]),R.useCallback(Re=>Se(Re),[Se]);const ue=R.useCallback(Re=>Oe(Re),[Oe]);R.useCallback(Re=>B?ue(Re):!0,[B,ue]);const be=R.useMemo(()=>{if(!f)return{asset_type:(N==null?void 0:N.asset_type)||J.asset_type||"",site_name:(N==null?void 0:N.site_name)||J.site_name||"",need_procurement:(N==null?void 0:N.need_procurement)||J.need_procurement||0,custom_assign_to_contractor:(N==null?void 0:N.custom_assign_to_contractor)||J.custom_assign_to_contractor||"",docstatus:(N==null?void 0:N.docstatus)||J.docstatus||0,company:(N==null?void 0:N.company)||J.company||"",department:(N==null?void 0:N.department)||J.department||"",repair_status:(N==null?void 0:N.repair_status)||J.repair_status||""}},[f,N==null?void 0:N.asset_type,N==null?void 0:N.site_name,N==null?void 0:N.need_procurement,N==null?void 0:N.custom_assign_to_contractor,N==null?void 0:N.docstatus,N==null?void 0:N.company,N==null?void 0:N.department,N==null?void 0:N.repair_status,J.asset_type,J.site_name,J.need_procurement,J.custom_assign_to_contractor,J.docstatus,J.company,J.department,J.repair_status]),{transitions:re,loading:de,actionLoading:Ae,error:_e,isSystemManager:K,applyAction:W,getStateStyle:ae,getButtonStyle:se,getIcon:he}=T4({doctype:"Work_Order",docname:f?null:e||null,workflowState:N==null?void 0:N.workflow_state,enabled:!f,docData:be}),pe="Al Jouf Central Warehouse - AJH",[Je,Fe]=R.useState({}),ft=(Re,qe)=>Ne(null,null,function*(){if(!Re||!qe)return 0;try{const Tt=yield jt.apiCall(`/api/resource/Bin?filters=[["item_code","=","${Re}"],["warehouse","=","${qe}"]]&fields=["actual_qty"]&limit=1`);return Tt!=null&&Tt.data&&Tt.data.length>0&&Tt.data[0].actual_qty||0}catch(Tt){return console.error("Error fetching available stock:",Tt),0}}),ot=Re=>Ne(null,null,function*(){var qe;if(!Re)return 0;try{const Tt=yield jt.apiCall(`/api/resource/Item/${Re}?fields=["valuation_rate"]`);return((qe=Tt==null?void 0:Tt.data)==null?void 0:qe.valuation_rate)||0}catch(Tt){return console.error("Error fetching valuation rate:",Tt),0}}),Lt=(Re,qe)=>Ne(null,null,function*(){const Tt=[...J.stock_items||[]];if(Tt[Re]=Ve(ke({},Tt[Re]),{item_code:qe}),qe){const xr=yield ot(qe);if(Tt[Re].valuation_rate=xr,Tt[Re].total_value=xr*(Tt[Re].consumed_quantity||1),Tt[Re].warehouse){const Hr=yield ft(qe,Tt[Re].warehouse);Tt[Re].custom_available_stock=Hr,Ht(Re,Tt[Re].consumed_quantity,Hr,qe,Tt[Re].warehouse)}}Q(Ve(ke({},J),{stock_items:Tt}))}),zt=(Re,qe)=>Ne(null,null,function*(){const Tt=[...J.stock_items||[]];if(Tt[Re]=Ve(ke({},Tt[Re]),{warehouse:qe}),qe&&Tt[Re].item_code){const xr=yield ft(Tt[Re].item_code,qe);Tt[Re].custom_available_stock=xr,Ht(Re,Tt[Re].consumed_quantity,xr,Tt[Re].item_code,qe)}Q(Ve(ke({},J),{stock_items:Tt}))}),Ht=(Re,qe,Tt,xr,Hr)=>{qe>Tt?(Fe(Ir=>Ve(ke({},Ir),{[Re]:`Insufficient stock for ${xr} in ${Hr}. Available: ${Tt}, Required: ${qe}`})),ar.warning(`Insufficient stock for ${xr}. Available: ${Tt}, Required: ${qe}`,{position:"top-right",autoClose:5e3,icon:a.jsx(en,{}),toastId:`stock-warning-${Re}`})):Fe(Ir=>{const Pa=ke({},Ir);return delete Pa[Re],Pa})},ht=(Re,qe)=>{const Tt=[...J.stock_items||[]],xr=Tt[Re].valuation_rate||0,Hr=Tt[Re].custom_available_stock||0;Tt[Re]=Ve(ke({},Tt[Re]),{consumed_quantity:qe,total_value:xr*qe}),Tt[Re].item_code&&Tt[Re].warehouse&&Ht(Re,qe,Hr,Tt[Re].item_code,Tt[Re].warehouse),Q(Ve(ke({},J),{stock_items:Tt}))},[tr,Kt]=R.useState({});R.useEffect(()=>{const Re={};J.company&&(Re.company=J.company),Kt(Re)},[J.company]);const gt=Re=>Ne(null,null,function*(){if(!Re)return null;try{q(!0);const qe=yield jt.apiCall(`/api/resource/Asset/${Re}`);return(qe==null?void 0:qe.data)||null}catch(qe){return console.error("Error fetching asset details:",qe),null}finally{q(!1)}}),ve=Re=>Ne(null,null,function*(){if(!Re)return null;try{q(!0);const qe=yield jt.apiCall(`/api/resource/Asset?filters=[["custom_serial_number","=","${Re}"]]&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 qe!=null&&qe.data&&qe.data.length>0?qe.data[0]:null}catch(qe){return console.error("Error fetching asset by serial number:",qe),null}finally{q(!1)}}),Le=Re=>Re?Re.split(" ")[0]:"",ut=Re=>{Re&&Q(qe=>Ve(ke({},qe),{asset:Re.name||qe.asset,asset_name:Re.asset_name||"",company:Re.company||"",department:Re.department||"",serial_number:Re.custom_serial_number||"",asset_type:Re.custom_asset_type||"",manufacturer:Re.custom_manufacturer||"",supplier:Re.supplier||"",custom_site_contractor:Re.custom_site_contractor||"",custom_subcontractor:Re.custom_subcontractor||"",model:Re.custom_model||"",site_name:Re.custom_site||"",custom_service_agreement:Re.custom_service_agreement||"",custom_service_coverage:Re.custom_service_coverage||"",custom_start_date:Le(Re.custom_start_date)||"",custom_end_date:Le(Re.custom_end_date)||"",custom_total_amount:Re.custom_total_amount||0,custom_assigned_supervisor:Re.custom_team_leader||"",custom_moh_supervisor:Re.custom_moh_supervisor||""}))},tt=Re=>Ne(null,null,function*(){if(Q(qe=>Ve(ke({},qe),{asset:Re})),Re){const qe=yield gt(Re);qe&&ut(qe)}else Q(qe=>Ve(ke({},qe),{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}))}),Wt=()=>Ne(null,null,function*(){if(!J.serial_number){ar.warning("Please enter a serial number to search",{position:"top-right",autoClose:3e3,icon:a.jsx(en,{})});return}const Re=yield ve(J.serial_number);Re?(ut(Re),ar.success(`Asset found: ${Re.asset_name||Re.name}`,{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})})):ar.error("No asset found with this serial number",{position:"top-right",autoClose:4e3,icon:a.jsx(In,{})})}),pt=()=>Ne(null,null,function*(){if(J.serial_number&&!J.asset){const Re=yield ve(J.serial_number);Re&&ut(Re)}});R.useEffect(()=>{if(f&&u&&!g){const Re={asset:t.get("asset")||"",asset_name:t.get("asset_name")||"",asset_type:t.get("asset_type")||"",manufacturer:t.get("manufacturer")||"",supplier:t.get("supplier")||"",serial_number:t.get("serial_number")||"",department:t.get("department")||"",custom_site_contractor:t.get("site_contractor")||"",custom_subcontractor:t.get("subcontractor")||"",company:t.get("company")||"",site_name:t.get("site_name")||"",custom_assigned_supervisor:t.get("team_leader")||"",custom_moh_supervisor:t.get("moh_supervisor")||""};Q(qe=>Ve(ke(ke({},qe),Re),{repair_status:"Open",workflow_state:"Draft",custom_priority_:"Normal",failure_date:Nv()}))}},[f,u,g,t]),R.useEffect(()=>{N&&Q({company:N.company||"",work_order_type:N.work_order_type||"",asset:N.asset||"",asset_name:g?`${N.asset_name} (Copy)`:N.asset_name||"",description:N.description||"",repair_status:g?"Open":N.repair_status||"Open",workflow_state:g?"Draft":N.workflow_state||"Draft",department:N.department||"",custom_priority_:N.custom_priority_||"Normal",asset_type:N.asset_type||"",manufacturer:N.manufacturer||"",supplier:N.supplier||"",serial_number:N.serial_number||"",model:N.model||"",custom_site_contractor:N.custom_site_contractor||"",custom_subcontractor:N.custom_subcontractor||"",failure_date:Le(N.failure_date)||"",custom_deadline_date:Le(N.custom_deadline_date)||"",first_responded_on:Le(N.first_responded_on)||"",completion_date:Le(N.completion_date)||"",actions_performed:N.actions_performed||"",stock_consumption:N.stock_consumption||0,stock_items:N.stock_items||[],site_name:N.site_name||"",need_procurement:N.need_procurement||0,custom_assign_to_contractor:N.custom_assign_to_contractor||"",docstatus:N.docstatus||0,custom_assigned_supervisor:N.custom_assigned_supervisor||"",custom_moh_supervisor:N.custom_moh_supervisor||"",total_hours_spent:N.total_hours_spent||0,custom_pending_reason:N.custom_pending_reason||"",total_repair_cost:N.total_repair_cost||0,custom_service_agreement:N.custom_service_agreement||"",custom_service_coverage:N.custom_service_coverage||"",custom_start_date:Le(N.custom_start_date)||"",custom_end_date:Le(N.custom_end_date)||"",custom_total_amount:N.custom_total_amount||0})},[N,g]);const We=Re=>{const{name:qe,value:Tt}=Re.target;Q(xr=>Ve(ke({},xr),{[qe]:Tt}))},Nt=Re=>{const qe=Re.target.value;Q(Tt=>Ve(ke({},Tt),{custom_priority_:qe}))},At=Re=>{const qe=Re.target.value;Q(Tt=>Ve(ke({},Tt),{failure_date:qe}))},Qt=Re=>{const qe=Re.target.checked?1:0;Q(Tt=>Ve(ke({},Tt),{need_procurement:qe}))},cr=Re=>{Q(Re==="Non Biomedical"?qe=>Ve(ke({},qe),{asset_type:Re,asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}):qe=>Ve(ke({},qe),{asset_type:Re}))},He=Re=>Ne(null,null,function*(){if(Re.preventDefault(),!J.work_order_type){ar.error("Please select a Work Order Type",{position:"top-right",autoClose:4e3,icon:a.jsx(In,{})});return}try{if(f||g){const qe=yield M(J),Tt=g?"Work order duplicated successfully!":u?"Work order created from asset successfully!":"Work order created successfully!";ar.success(Tt,{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),r(`/work-orders/${qe.name}`)}else e&&(yield D(e,J),ar.success("Work order updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),U(!1),I())}catch(qe){console.error("Work order save error:",qe);const Tt=qe instanceof Error?qe.message:"Unknown error",xr=JSON.stringify(qe);Tt.includes("TimestampMismatchError")||Tt.includes("Document has been modified")||Tt.includes("Please refresh")||xr.includes("TimestampMismatchError")?(ar.error("Document was modified by another user. Refreshing...",{position:"top-right",autoClose:4e3,icon:a.jsx(en,{})}),yield I(),ar.info("Please review the latest changes and try saving again.",{position:"top-right",autoClose:5e3,icon:a.jsx(A0,{})})):ar.error(`Failed to save work order: ${Tt}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}});R.useEffect(()=>{f||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(Re=>Re.json()).then(Re=>{var qe;(qe=Re.message)!=null&&qe.has_role&&k(!0)}).catch(Re=>console.error("Role check error:",Re))},[f]);const It=(Re,qe)=>Ne(null,null,function*(){if(["Reject","Cancel","Close"].includes(Re)&&(ne==null?void 0:ne.action)!==Re){V({action:Re,nextState:qe||""});return}V(null);const xr=ar.loading(`Applying action "${Re}"...`,{position:"top-right"}),Hr=yield W(Re,qe);if(ar.dismiss(xr),Hr)ar.success(`Action "${Re}" completed successfully!`,{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),I();else{const Ir=_e||"Please try again.";Ir.includes("TimestampMismatchError")||Ir.includes("Document has been modified")||Ir.includes("Please refresh")?(ar.error("Document was modified. Refreshing...",{position:"top-right",autoClose:4e3,icon:a.jsx(en,{})}),yield I(),ar.info("Please try the action again after reviewing the latest changes.",{position:"top-right",autoClose:5e3,icon:a.jsx(A0,{})})):ar.error(`Failed to apply action "${Re}". ${Ir}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}});if(C)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(O&&!f&&!g)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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: ",O]}),a.jsx("button",{onClick:()=>r("/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 Zt=()=>g?"Duplicate Work Order":u?"Create Work Order from Asset":f?"New Work Order":"Work Order Details",yr=(N==null?void 0:N.workflow_state)||J.workflow_state||"Draft",Ye=ae(yr),Ge=(Dr=(Jt=N==null?void 0:N.docstatus)!=null?Jt:J.docstatus)!=null?Dr:0,Ct=(N==null?void 0:N.workflow_state)||J.workflow_state||"Draft",Ft=f||K&&Ge===0||p&&Ct==="Sent to Team Leader"||!de&&re.length>0;return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-4 sm:p-6 min-w-0 overflow-x-hidden",children:[a.jsx(Bh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:pu}),a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("button",{onClick:()=>r("/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(Ki,{}),a.jsx("span",{className:"text-gray-900 dark:text-white",children:Zt()})]}),!f&&a.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${Ye.bg} ${Ye.text} ${Ye.border} border`,children:yr}),u&&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(Pg,{size:10}),"Linked from Asset: ",o]}),H&&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(fs,{className:"animate-spin",size:12}),"Loading asset details..."]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!f&&a.jsxs("button",{onClick:v,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(fc,{}),"Service Report"]}),!f&&!B&&Ft&&a.jsxs("button",{onClick:()=>{U(!0),ar.info("Edit mode enabled",{position:"top-right",autoClose:2e3,icon:a.jsx(rs,{})})},className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[a.jsx(rs,{}),"Edit"]}),B&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{f?r("/work-orders"):(U(!1),ar.info("Edit cancelled - changes discarded",{position:"top-right",autoClose:2e3,icon:a.jsx(In,{})}))},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:z,children:"Cancel"}),a.jsxs("button",{onClick:He,disabled:z||H,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(Tn,{}),z?"Saving...":"Save Changes"]})]})]})]}),u&&f&&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(Pg,{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:J.asset_name||o}),". Please select a Work Order Type and add any additional details."]})]})]})}),a.jsx("form",{onSubmit:He,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"}),u&&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(Pg,{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(er,{label:"Hospital",doctype:"Company",value:J.company||"",onChange:Re=>Q(Ve(ke({},J),{company:Re,department:""})),disabled:!B,filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(er,{label:"Asset Type",doctype:"Asset Type",value:J.asset_type||"",onChange:cr,disabled:!B})}),(Te||((kt=J.company)==null?void 0:kt.startsWith("Mobile")))&&a.jsx("div",{children:a.jsx(er,{label:"Site Name",doctype:"Mobile Team Site",value:J.site_name||"",onChange:Re=>Q(Ve(ke({},J),{site_name:Re})),disabled:!B})}),!Te&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-[50]",children:[a.jsx(er,{label:"Asset ID",doctype:"Asset",value:J.asset||"",onChange:tt,disabled:!B||H,filters:J.company?{company:J.company}:{}}),J.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:J.serial_number,onChange:We,onBlur:pt,disabled:!B||H,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"}),B&&a.jsx("button",{type:"button",onClick:Wt,disabled:H||!J.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(xo,{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:J.asset_name,onChange:We,disabled:!B,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(er,{label:"Manufacturer",doctype:"Manufacturer",value:J.manufacturer||"",onChange:Re=>Q(Ve(ke({},J),{manufacturer:Re})),disabled:!B})}),a.jsx("div",{children:a.jsx(er,{label:"Supplier",doctype:"Supplier",value:J.supplier||"",onChange:Re=>Q(Ve(ke({},J),{supplier:Re})),disabled:!B})}),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:J.model,onChange:We,disabled:!B,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:f||g?"Auto-generated":N==null?void 0:N.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(er,{label:"Work Order Type",doctype:"Issue Type",value:J.work_order_type||"",onChange:Re=>Q(Ve(ke({},J),{work_order_type:Re})),disabled:!B})}),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:J.custom_priority_,onChange:Nt,disabled:!B,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:J.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:J.custom_pending_reason||"",onChange:We,disabled:!B,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:J.need_procurement===1,onChange:Qt,disabled:!B,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"})]})})]})]}),!Te&&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:J.custom_site_contractor,onChange:We,disabled:!B,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:J.custom_subcontractor,onChange:We,disabled:!B,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:J.custom_service_agreement||"",onChange:We,disabled:!B,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:J.custom_service_coverage||"",onChange:We,disabled:!B,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:J.custom_start_date||"",onChange:We,disabled:!B,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:J.custom_end_date||"",onChange:We,disabled:!B,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:J.custom_total_amount||0,onChange:We,disabled:!B,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:J.description,onChange:We,disabled:!B,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:J.actions_performed,onChange:We,disabled:!B,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(er,{label:"MOH Supervisor",doctype:"User",value:J.custom_moh_supervisor||"",onChange:Re=>Q(Ve(ke({},J),{custom_moh_supervisor:Re})),disabled:!B})}),a.jsx("div",{children:a.jsx(er,{label:"Team Leader",doctype:"User",value:J.custom_assigned_supervisor||"",onChange:Re=>Q(Ve(ke({},J),{custom_assigned_supervisor:Re})),disabled:!B})}),a.jsx("div",{children:a.jsx(er,{label:"Assigned Technician",doctype:"User",value:J.custom_assign_to_contractor||"",onChange:Re=>Q(Ve(ke({},J),{custom_assign_to_contractor:Re})),disabled:!B})}),a.jsx("div",{children:a.jsx(er,{label:"Department",doctype:"Department",value:J.department||"",onChange:Re=>Q(Ve(ke({},J),{department:Re})),disabled:!B,filters:tr})}),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:J.failure_date,onChange:At,disabled:!B,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:J.custom_deadline_date,onChange:We,disabled:!B,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"}),B&&J.failure_date&&a.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[J.custom_priority_==="Urgent"?"Urgent":"Normal"," priority",J.need_procurement===1?" + Procurement":"",":"," ","+",J.need_procurement===1?30:J.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:J.total_hours_spent||0,onChange:We,disabled:!B,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:J.first_responded_on,onChange:We,disabled:!B,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:J.completion_date,onChange:We,disabled:!B,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:J.stock_consumption===1,onChange:Re=>{var qe;Q(Ve(ke({},J),{stock_consumption:Re.target.checked?1:0,stock_items:Re.target.checked?(qe=J.stock_items)!=null&&qe.length?J.stock_items:[{item_code:"",warehouse:pe,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]:[]}))},disabled:!B,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"})]}),J.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"}),B&&a.jsxs("button",{type:"button",onClick:()=>{Q(Ve(ke({},J),{stock_items:[...J.stock_items||[],{item_code:"",warehouse:pe,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]})),ar.info("New stock item row added",{position:"top-right",autoClose:2e3,icon:a.jsx(Ei,{})})},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(Ei,{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"}),B&&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:(J.stock_items||[]).length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:B?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"}),B&&a.jsx("button",{type:"button",onClick:()=>{Q(Ve(ke({},J),{stock_items:[{item_code:"",warehouse:pe,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"})]})}):(J.stock_items||[]).map((Re,qe)=>a.jsxs(Zr.Fragment,{children:[a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${Je[qe]?"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:qe+1}),a.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-qe},children:a.jsx("div",{className:"relative",children:a.jsx(er,{label:"",doctype:"Item",value:Re.item_code,onChange:Tt=>Lt(qe,Tt),disabled:!B,placeholder:"Select Item",compact:!0,usePortal:!0,filters:ke({is_stock_item:1},J.company?{custom_hospital_name:J.company}:{})})})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"0",step:"0.01",value:Re.valuation_rate||0,onChange:Tt=>{const xr=[...J.stock_items||[]],Hr=parseFloat(Tt.target.value)||0,Ir=xr[qe].consumed_quantity||0;xr[qe]=Ve(ke({},xr[qe]),{valuation_rate:Hr,total_value:Hr*Ir}),Q(Ve(ke({},J),{stock_items:xr}))},disabled:!B,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-qe},children:a.jsx("div",{className:"relative",children:a.jsx(er,{label:"",doctype:"Warehouse",value:Re.warehouse,onChange:Tt=>zt(qe,Tt),disabled:!B,placeholder:"Select Warehouse",compact:!0,usePortal:!0})})}),a.jsx("td",{className:"px-3 py-3",children:a.jsx("input",{type:"number",min:"1",value:Re.consumed_quantity||1,onChange:Tt=>ht(qe,parseInt(Tt.target.value)||1),disabled:!B,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 ${Je[qe]?"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:Re.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:Re.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"})}),B&&a.jsx("td",{className:"px-3 py-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>{var Hr;const Tt=(Hr=J.stock_items)==null?void 0:Hr[qe],xr=(J.stock_items||[]).filter((Ir,Pa)=>Pa!==qe);Q(Ve(ke({},J),{stock_items:xr})),Fe(Ir=>{const Pa=ke({},Ir);return delete Pa[qe],Pa}),ar.warning(`Stock item ${(Tt==null?void 0:Tt.item_code)||"row"} removed`,{position:"top-right",autoClose:2e3,icon:a.jsx(la,{})})},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(la,{size:14})})})]}),Je[qe]&&a.jsx("tr",{className:"bg-red-50 dark:bg-red-900/30",children:a.jsx("td",{colSpan:B?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(en,{}),a.jsx("span",{children:Je[qe]})]})})})]},qe))})]})})}),(J.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:(J.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:(J.stock_items||[]).reduce((Re,qe)=>Re+(qe.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:(J.stock_items||[]).reduce((Re,qe)=>Re+(qe.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:J.total_repair_cost||0,onChange:We,disabled:!B,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:[!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("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 ${Ye.bg} ${Ye.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 ${Ye.text}`,children:yr})]}),de&&a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-4",children:[a.jsx(fs,{className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading actions..."})]}),_e&&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(en,{className:"text-red-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:_e})]})}),ne&&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(en,{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:ne.action})," this work order?"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>It(ne.action,ne.nextState),disabled:Ae,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:Ae?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(fs,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${ne.action}`}),a.jsx("button",{onClick:()=>V(null),disabled:Ae,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"})]})]}),!de&&re.length>0&&!ne&&a.jsxs("div",{className:"space-y-3",children:[K&&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(A0,{size:12}),"Available Actions (",re.length,")"]}),a.jsx("div",{className:"flex flex-col gap-2",children:re.map((Re,qe)=>a.jsxs("button",{onClick:()=>It(Re.action,Re.next_state),disabled:Ae,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 ${se(Re.action)}`,children:[Ae?a.jsx(fs,{className:"animate-spin",size:14}):a.jsx("span",{children:he(Re.action)}),Re.action]},`${Re.action}-${Re.next_state}-${qe}`))}),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:"}),re.map((Re,qe)=>a.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Re.action," → ",a.jsx("span",{className:"font-medium",children:Re.next_state})]},qe))]})]}),!de&&re.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"}),!f&&N&&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:N.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:N.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:N.creation?new Date(N.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:N.modified?new Date(N.modified).toLocaleString():"-"})]})]}),f&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(A0,{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;
}
`})]})},vR=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState(0),[o,u]=R.useState(""),[f,g]=R.useState(""),[v,p]=R.useState(null),[k,N]=R.useState(null),C=R.useRef(null),O=20,I=f?{maintenance_status:f}:{},{logs:M,totalCount:D,hasMore:z,loading:B,error:U,refetch:H}=ph(I,O,t*O,"due_date asc"),{deleteLog:q,loading:ne}=a_();R.useEffect(()=>{const Ae=_e=>{C.current&&!C.current.contains(_e.target)&&N(null)};return k&&document.addEventListener("mousedown",Ae),()=>{document.removeEventListener("mousedown",Ae)}},[k]);const V=()=>{r("/maintenance/new")},J=Ae=>{r(`/maintenance/${Ae}`)},Q=Ae=>{r(`/maintenance/${Ae}`)},Te=Ae=>Ne(null,null,function*(){try{yield q(Ae),p(null),H(),alert("Maintenance log deleted successfully!")}catch(_e){alert(`Failed to delete: ${_e instanceof Error?_e.message:"Unknown error"}`)}}),je=Ae=>{r(`/maintenance/new?duplicate=${Ae}`)},me=Ae=>{const _e=JSON.stringify(Ae,null,2),K=new Blob([_e],{type:"application/json"}),W=URL.createObjectURL(K),ae=document.createElement("a");ae.href=W,ae.download=`maintenance_${Ae.name}.json`,ae.click(),URL.revokeObjectURL(W)},Se=Ae=>{window.open(`/maintenance/${Ae}?print=true`,"_blank")},Oe=()=>{const _e=[["Log ID","Asset","Type","Status","Due Date","Assigned To"].join(","),...M.map(se=>[se.name,se.asset_name||"",se.maintenance_type||"",se.maintenance_status||"",se.due_date||"",se.assign_to_name||""].join(","))].join(`
`),K=new Blob([_e],{type:"text/csv"}),W=URL.createObjectURL(K),ae=document.createElement("a");ae.href=W,ae.download=`maintenance_logs_${new Date().toISOString().split("T")[0]}.csv`,ae.click(),URL.revokeObjectURL(W)},ue=Ae=>{switch(Ae==null?void 0:Ae.toLowerCase()){case"completed":return a.jsx(Ua,{className:"text-green-500"});case"planned":return a.jsx(i_,{className:"text-blue-500"});case"overdue":return a.jsx(en,{className:"text-red-500"});default:return a.jsx(Tl,{className:"text-gray-400"})}},be=Ae=>{switch(Ae==null?void 0:Ae.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"}},re=(Ae,_e)=>!Ae||(_e==null?void 0:_e.toLowerCase())==="completed"?!1:new Date(Ae)<new Date;if(B&&t===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(U)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:H,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:"})," ",U]})})]})});const de=M.filter(Ae=>{var _e,K,W;return((_e=Ae.name)==null?void 0:_e.toLowerCase().includes(o.toLowerCase()))||((K=Ae.asset_name)==null?void 0:K.toLowerCase().includes(o.toLowerCase()))||((W=Ae.task_name)==null?void 0:W.toLowerCase().includes(o.toLowerCase()))});return a.jsxs("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 dark:text-white break-words",children:e("maintenance.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[e("listPages.total"),": ",D," ",e("maintenance.maintenanceLogs")]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:Oe,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:M.length===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:e("listPages.exportAllOnPage")})]}),a.jsxs("button",{onClick:V,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(Ei,{}),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(xo,{className:"text-gray-400 dark:text-gray-500"}),a.jsx("input",{type:"text",placeholder:e("listPages.searchPlaceholder"),value:o,onChange:Ae=>u(Ae.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:f,onChange:Ae=>{g(Ae.target.value),n(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:de.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(xo,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:e("listPages.noMaintenanceLogsFound")}),a.jsx("button",{onClick:V,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:e("listPages.createFirstMaintenanceLog")})]})})}):de.map(Ae=>{const _e=re(Ae.due_date||"",Ae.maintenance_status||"");return a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${_e?"bg-red-50 dark:bg-red-900/10":""}`,onClick:()=>J(Ae.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:Ae.name}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:Ae.creation?new Date(Ae.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:Ae.asset_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ae.custom_asset_type||""})]}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ae.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:Ae.due_date?new Date(Ae.due_date).toLocaleDateString():"-"}),_e&&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:[ue(Ae.maintenance_status||""),a.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${be(Ae.maintenance_status||"")}`,children:Ae.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:K=>K.stopPropagation(),children:[a.jsx("button",{onClick:()=>J(Ae.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(Yi,{})}),a.jsx("button",{onClick:()=>Q(Ae.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(rs,{})}),a.jsx("button",{onClick:()=>je(Ae.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(Ad,{})}),a.jsx("button",{onClick:()=>p(Ae.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:ne,children:a.jsx(la,{})}),a.jsxs("div",{className:"relative",ref:k===Ae.name?C:null,children:[a.jsx("button",{onClick:()=>N(k===Ae.name?null:Ae.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(au,{})}),k===Ae.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:()=>{me(Ae),N(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(yc,{className:"text-blue-500"}),"Export as JSON"]}),a.jsxs("button",{onClick:()=>{Se(Ae.name),N(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(fc,{className:"text-purple-500"}),"Print Log"]})]})]})]})})]},Ae.name)})})]})}),de.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:t*O+1})," to"," ",a.jsx("span",{className:"font-medium",children:Math.min((t+1)*O,D)})," ","of ",a.jsx("span",{className:"font-medium",children:D})," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{disabled:t===0,onClick:()=>n(t-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:!z,onClick:()=>n(t+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"})]})]})]}),v&&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(la,{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:"})," ",v]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>p(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:ne,children:"Cancel"}),a.jsx("button",{onClick:()=>Te(v),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:ne,children:ne?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(la,{}),"Delete Log"]})})]})]})]})})})]})},_R=jt,wR=({message:e,type:r,onClose:t})=>{R.useEffect(()=>{const o=setTimeout(t,1e4);return()=>clearTimeout(o)},[t]);const n=r==="warning"?"bg-yellow-500":r==="success"?"bg-green-500":"bg-red-500";return a.jsx("div",{className:`fixed top-4 right-4 ${n} 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(en,{className:"mt-0.5 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:e}),a.jsx("button",{onClick:t,className:"ml-2 text-white hover:text-gray-200",children:a.jsx(Yt,{})})]})})},kR=()=>{const{t:e}=Xa(),{logName:r}=Ml(),t=ma(),[n]=Rl(),o=n.get("duplicate"),u=r==="new",f=u&&!!o,{log:g,loading:v,error:p}=US(f?o:u?null:r||null),{createLog:k,updateLog:N,loading:C}=a_(),O=(g==null?void 0:g.workflow_state)==="Approved",[I,M]=R.useState(u),[D,z]=R.useState([]),[B,U]=R.useState(null),[H,q]=R.useState(!1),[ne,V]=R.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:""}),J=R.useCallback((_e,K,W)=>{if(W!=="Completed"){V(pe=>Ve(ke({},pe),{custom_early_completion:""}));return}if(!_e||!K)return;const ae=new Date(_e),se=new Date(K),he=new Date(ae.getFullYear(),ae.getMonth(),1);if(se<he){V(Fe=>Ve(ke({},Fe),{custom_early_completion:"Yes"}));const pe=se.toLocaleDateString(),Je=ae.toLocaleDateString();U({message:`⚠️ Warning: Completion Date (${pe}) is before the Due Date Month (${Je}). Please verify.`,type:"warning"})}},[]),Q=R.useCallback(_e=>Ne(null,null,function*(){var K;if(_e){q(!0);try{const W=yield _R.apiCall(`/api/resource/PPM Templates/${encodeURIComponent(_e)}`,"GET");if((K=W==null?void 0:W.data)!=null&&K.ppm_template_table&&Array.isArray(W.data.ppm_template_table)){const ae=W.data.ppm_template_table.map((se,he)=>({idx:he+1,maintenance_name:se.maintenance_name||"",working:0,defect_found:0,not_working:0}));z(ae)}}catch(W){console.error("Error loading PPM template:",W),U({message:"Failed to load PPM template. Please add items manually.",type:"error"})}finally{q(!1)}}}),[]);R.useEffect(()=>{g&&(g.workflow_state==="Approved"&&M(!1),V({asset_name:g.asset_name||"",custom_asset_type:g.custom_asset_type||"",item_code:g.item_code||"",item_name:g.item_name||"",custom_asset_names:g.custom_asset_names||"",custom_hospital_name:g.custom_hospital_name||"",task:g.task||"",task_name:g.task_name||"",maintenance_type:g.maintenance_type||"Preventive Maintenance",periodicity:g.periodicity||"",has_certificate:g.has_certificate||0,custom_early_completion:f?"":g.custom_early_completion||"",maintenance_status:f?"Planned":g.maintenance_status||"Planned",custom_accepted_by_moh:g.custom_accepted_by_moh||0,assign_to_name:g.assign_to_name||"",due_date:g.due_date||"",completion_date:f?"":g.completion_date||"",custom_early_completion_reason:f?"":g.custom_early_completion_reason||"",custom_accepted_by_moh_:g.custom_accepted_by_moh_||0,custom_template:g.custom_template||"",custom_table:g.custom_table||[],description:g.description||""}),g.custom_table&&Array.isArray(g.custom_table)&&g.custom_table.length>0?z(g.custom_table.map((_e,K)=>({name:_e.name,idx:_e.idx||K+1,maintenance_name:_e.maintenance_name||"",working:_e.working||0,defect_found:_e.defect_found||0,not_working:_e.not_working||0}))):g.custom_template&&(!g.custom_table||g.custom_table.length===0)&&Q(g.custom_template))},[g,f,Q]),R.useEffect(()=>{ne.completion_date&&ne.due_date&&J(ne.due_date,ne.completion_date,ne.maintenance_status)},[ne.completion_date,ne.due_date,ne.maintenance_status,J]);const Te=_e=>{const{name:K,value:W,type:ae}=_e.target,se=_e.target.checked;V(he=>Ve(ke({},he),{[K]:ae==="checkbox"?se?1:0:W}))},je=_e=>{const K=_e.target.value;V(W=>Ve(ke({},W),{maintenance_status:K})),K==="Completed"?J(ne.due_date||"",ne.completion_date||"",K):V(W=>Ve(ke({},W),{custom_early_completion:""}))},me=_e=>{const K=_e.target.value;V(W=>Ve(ke({},W),{completion_date:K})),ne.maintenance_status==="Completed"&&J(ne.due_date||"",K,ne.maintenance_status)},Se=_e=>Ne(null,null,function*(){const K=_e.target.value;V(W=>Ve(ke({},W),{custom_template:K})),(K&&D.length===0||K&&D.length>0&&window.confirm("Loading a template will replace existing checklist items. Continue?"))&&Q(K)}),Oe=()=>{const _e={idx:D.length+1,maintenance_name:"",working:0,defect_found:0,not_working:0};z([...D,_e])},ue=_e=>{const K=D.filter((W,ae)=>ae!==_e).map((W,ae)=>Ve(ke({},W),{idx:ae+1}));z(K)},be=(_e,K,W)=>{const ae=[...D];ae[_e]=Ve(ke({},ae[_e]),{[K]:W}),z(ae)},re=_e=>Ne(null,null,function*(){if(_e.preventDefault(),!ne.asset_name){alert("Please enter Asset Name");return}if(!ne.maintenance_type){alert("Please select Maintenance Type");return}const K=D.map((ae,se)=>{const he={idx:ae.idx||se+1,maintenance_name:ae.maintenance_name||"",working:ae.working?1:0,defect_found:ae.defect_found?1:0,not_working:ae.not_working?1:0};return ae.name&&typeof ae.name=="string"&&ae.name.trim()!==""&&(he.name=ae.name),he}),W=Ve(ke({},ne),{custom_table:K});console.log("Submitting maintenance log data:",W);try{if(u||f){const ae=yield k(W);alert(f?"Maintenance log duplicated successfully!":"Maintenance log created successfully!"),t(`/maintenance/${ae.name}`)}else r&&(yield N(r,W),alert("Maintenance log updated successfully!"),M(!1))}catch(ae){console.error("Maintenance log save error:",ae),alert("Failed to save: "+(ae instanceof Error?ae.message:"Unknown error"))}}),de=_e=>({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"})[_e]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",Ae=_e=>({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"})[_e]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";return v?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..."})]})}):p&&!u&&!f?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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("/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-4 sm:p-6 min-w-0 overflow-x-hidden",children:[B&&a.jsx(wR,{message:B.message,type:B.type,onClose:()=>U(null)}),a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("button",{onClick:()=>t("/maintenance"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[a.jsx(Ki,{}),a.jsx("span",{className:"text-gray-900 dark:text-white font-semibold",children:f?"Duplicate Maintenance Log":u?"New Maintenance Log":"Maintenance Log Details"})]}),!u&&(g==null?void 0:g.workflow_state)&&a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${de(g.workflow_state)}`,children:g.workflow_state})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!u&&!I&&!O&&a.jsxs("button",{onClick:()=>M(!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(rs,{}),"Edit"]}),I&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{u?t("/maintenance"):M(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:C,children:"Cancel"}),a.jsxs("button",{onClick:re,disabled:C,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(Tn,{}),C?"Saving...":"Save Changes"]})]})]})]}),a.jsx("form",{onSubmit:re,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:u||f?"Auto-generated":(g==null?void 0:g.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"}),f&&a.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",o]})]}),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:ne.custom_hospital_name||"",onChange:Te,disabled:!I,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:ne.asset_name,onChange:Te,required:!0,disabled:!I,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:ne.custom_asset_names||"",onChange:Te,disabled:!I,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:ne.custom_asset_type||"",onChange:Te,disabled:!I,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:ne.maintenance_type,onChange:Te,required:!0,disabled:!I,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:ne.periodicity||"",onChange:Te,disabled:!I,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",H&&a.jsx("span",{className:"ml-2 text-blue-500",children:"(Loading...)"})]}),a.jsx("input",{type:"text",name:"custom_template",value:ne.custom_template||"",onChange:Se,disabled:!I,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:ne.maintenance_status,onChange:je,disabled:!I,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:ne.assign_to_name||"",onChange:Te,disabled:!I,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:ne.due_date||"",onChange:Te,disabled:!I,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:ne.completion_date||"",onChange:me,disabled:!I,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",ne.custom_early_completion==="Yes"&&a.jsx("span",{className:"ml-2 text-yellow-500",children:"⚠️ Auto-detected"})]}),a.jsx("input",{type:"text",value:ne.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"})]}),ne.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:ne.custom_early_completion_reason||"",onChange:Te,disabled:!I,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:!!ne.custom_accepted_by_moh,onChange:Te,disabled:!I,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(a5,{}),"PPM Checklist Table",H&&a.jsx("span",{className:"text-sm text-blue-500 font-normal",children:"(Loading template...)"})]}),I&&a.jsxs("button",{type:"button",onClick:Oe,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(Ei,{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(l_,{})," 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(en,{})," 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(Yt,{})," Not Working"]})}),I&&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:D.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:I?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:["No checklist items. ",I&&'Enter a template name above or click "Add Row" to add items.']})}):D.map((_e,K)=>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:_e.idx||K+1}),a.jsx("td",{className:"py-3 px-3",children:I?a.jsx("input",{type:"text",value:_e.maintenance_name,onChange:W=>be(K,"maintenance_name",W.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:_e.maintenance_name})}),a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("input",{type:"checkbox",checked:!!_e.working,onChange:W=>be(K,"working",W.target.checked?1:0),disabled:!I,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:!!_e.defect_found,onChange:W=>be(K,"defect_found",W.target.checked?1:0),disabled:!I,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:!!_e.not_working,onChange:W=>be(K,"not_working",W.target.checked?1:0),disabled:!I,className:"w-5 h-5 text-red-600 rounded focus:ring-2 focus:ring-red-500 cursor-pointer disabled:cursor-default"})}),I&&a.jsx("td",{className:"py-3 px-3 text-center",children:a.jsx("button",{type:"button",onClick:()=>ue(K),className:"text-red-500 hover:text-red-700 p-1",title:"Remove row",children:a.jsx(la,{})})})]},_e.name||K))})]})})]})]}),a.jsxs("div",{className:"space-y-6",children:[!u&&g&&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(xR,{doctype:"Asset Maintenance Log",docname:g.name||null,workflowState:g.workflow_state,showStateInfo:!1,onActionComplete:(_e,K)=>{K&&console.log(`Action "${_e}" 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"}),!u&&g?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 ${Ae(ne.maintenance_status)}`,children:ne.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 ${de(g.workflow_state||"Draft")}`,children:g.workflow_state||"Draft"})]}),ne.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:ne.due_date?new Date(ne.due_date).toLocaleDateString():"Not set"}),ne.due_date&&new Date(ne.due_date)<new Date&&ne.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:ne.completion_date?new Date(ne.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:ne.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:[D.length," item(s)"]}),D.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: ",D.filter(_e=>_e.working).length]}),a.jsxs("p",{className:"text-yellow-600 dark:text-yellow-400",children:["⚠ Defects: ",D.filter(_e=>_e.defect_found).length]}),a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["✗ Not Working: ",D.filter(_e=>_e.not_working).length]})]})]})]}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Tl,{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"})]})]}),!u&&g&&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:g.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:g.creation?new Date(g.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:g.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:g.modified?new Date(g.modified).toLocaleString():"-"})]})]})]})]})]})})]})};class NR{getAssetMaintenances(r,t,n=20,o=0,u){return Ne(this,null,function*(){const f=new URLSearchParams;r&&f.append("filters",JSON.stringify(r)),t&&t.length>0&&f.append("fields",JSON.stringify(t)),f.append("limit",n.toString()),f.append("offset",o.toString()),u&&f.append("order_by",u);const g=`${wr.ENDPOINTS.GET_ASSET_MAINTENANCES}?${f.toString()}`;return jt.apiCall(g)})}getAssetMaintenanceDetails(r){return Ne(this,null,function*(){const t=new URLSearchParams;t.append("maintenance_name",r);const n=`${wr.ENDPOINTS.GET_ASSET_MAINTENANCE_DETAILS}?${t.toString()}`;return jt.apiCall(n)})}createAssetMaintenance(r){return Ne(this,null,function*(){const t=`${wr.ENDPOINTS.CREATE_ASSET_MAINTENANCE}`;return jt.apiCall(t,{method:"POST",body:JSON.stringify({maintenance_data:JSON.stringify(r)})})})}updateAssetMaintenance(r,t){return Ne(this,null,function*(){const n=`${wr.ENDPOINTS.UPDATE_ASSET_MAINTENANCE}`;return jt.apiCall(n,{method:"POST",body:JSON.stringify({maintenance_name:r,maintenance_data:JSON.stringify(t)})})})}deleteAssetMaintenance(r){return Ne(this,null,function*(){const t=`${wr.ENDPOINTS.DELETE_ASSET_MAINTENANCE}`;return jt.apiCall(t,{method:"POST",body:JSON.stringify({maintenance_name:r})})})}getMaintenanceTasks(r){return Ne(this,null,function*(){const t=new URLSearchParams;t.append("maintenance_name",r);const n=`${wr.ENDPOINTS.GET_MAINTENANCE_TASKS}?${t.toString()}`;return jt.apiCall(n)})}getServiceCoverage(r){return Ne(this,null,function*(){const t=new URLSearchParams;t.append("maintenance_name",r);const n=`${wr.ENDPOINTS.GET_SERVICE_COVERAGE}?${t.toString()}`;return jt.apiCall(n)})}getMaintenancesByAsset(r,t,n=20,o=0){return Ne(this,null,function*(){const u=new URLSearchParams;u.append("asset_name",r),t&&u.append("filters",JSON.stringify(t)),u.append("limit",n.toString()),u.append("offset",o.toString());const f=`${wr.ENDPOINTS.GET_MAINTENANCES_BY_ASSET}?${u.toString()}`;return jt.apiCall(f)})}getActiveServiceContracts(r,t=20,n=0){return Ne(this,null,function*(){const o=new URLSearchParams;r&&o.append("filters",JSON.stringify(r)),o.append("limit",t.toString()),o.append("offset",n.toString());const u=`${wr.ENDPOINTS.GET_ACTIVE_SERVICE_CONTRACTS}?${o.toString()}`;return jt.apiCall(u)})}}const W0=new NR;function SR(e,r=20,t=0,n){const[o,u]=R.useState([]),[f,g]=R.useState(0),[v,p]=R.useState(!1),[k,N]=R.useState(!0),[C,O]=R.useState(null),[I,M]=R.useState(0),D=R.useRef(!1),z=JSON.stringify(e);R.useEffect(()=>{if(D.current&&C)return;let U=!1;return D.current=!0,Ne(null,null,function*(){try{N(!0);const q=yield W0.getAssetMaintenances(e,void 0,r,t,n);U||(u(q.asset_maintenances),g(q.total_count),p(q.has_more),O(null))}catch(q){if(!U){const ne=q instanceof Error?q.message:"Failed to fetch PPM schedules";ne.includes("417")||ne.includes("Expectation Failed")||ne.includes("has no attribute")?O("API endpoint not deployed. Please deploy ppm_api.py to your Frappe server."):O(ne),u([]),g(0),p(!1)}}finally{U||N(!1)}}),()=>{U=!0}},[z,r,t,n,I]);const B=R.useCallback(()=>{D.current=!1,M(U=>U+1)},[]);return{ppms:o,totalCount:f,hasMore:v,loading:k,error:C,refetch:B}}function ER(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}try{o(!0),f(null);const p=yield W0.getAssetMaintenanceDetails(e);t(p)}catch(p){f(p instanceof Error?p.message:"Failed to fetch PPM details")}finally{o(!1)}}),[e]);R.useEffect(()=>{g()},[g]);const v=R.useCallback(()=>{g()},[g]);return{ppm:r,loading:n,error:u,refetch:v}}function L4(){const[e,r]=R.useState(!1),[t,n]=R.useState(null),o=R.useCallback(g=>Ne(null,null,function*(){try{return r(!0),n(null),yield W0.createAssetMaintenance(g)}catch(v){const p=v instanceof Error?v.message:"Failed to create PPM schedule";throw n(p),v}finally{r(!1)}}),[]),u=R.useCallback((g,v)=>Ne(null,null,function*(){try{return r(!0),n(null),yield W0.updateAssetMaintenance(g,v)}catch(p){const k=p instanceof Error?p.message:"Failed to update PPM schedule";throw n(k),p}finally{r(!1)}}),[]),f=R.useCallback(g=>Ne(null,null,function*(){try{return r(!0),n(null),yield W0.deleteAssetMaintenance(g)}catch(v){const p=v instanceof Error?v.message:"Failed to delete PPM schedule";throw n(p),v}finally{r(!1)}}),[]);return{createPPM:o,updatePPM:u,deletePPM:f,loading:e,error:t}}const CR=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState(0),[o,u]=R.useState(""),[f,g]=R.useState(""),[v,p]=R.useState(null),[k,N]=R.useState(null),C=R.useRef(null),O=20,I=f?{company:f}:{},{ppms:M,totalCount:D,hasMore:z,loading:B,error:U,refetch:H}=SR(I,O,t*O,"creation desc"),{deletePPM:q,loading:ne}=L4();R.useEffect(()=>{const ue=be=>{C.current&&!C.current.contains(be.target)&&N(null)};return k&&document.addEventListener("mousedown",ue),()=>{document.removeEventListener("mousedown",ue)}},[k]);const V=()=>{r("/ppm/new")},J=ue=>{r(`/ppm/${ue}`)},Q=ue=>{r(`/ppm/${ue}`)},Te=ue=>Ne(null,null,function*(){try{yield q(ue),p(null),H(),alert("PPM schedule deleted successfully!")}catch(be){alert(`Failed to delete: ${be instanceof Error?be.message:"Unknown error"}`)}}),je=ue=>{r(`/ppm/new?duplicate=${ue}`)},me=ue=>{const be=JSON.stringify(ue,null,2),re=new Blob([be],{type:"application/json"}),de=URL.createObjectURL(re),Ae=document.createElement("a");Ae.href=de,Ae.download=`ppm_${ue.name}.json`,Ae.click(),URL.revokeObjectURL(de)},Se=()=>{const be=[["PPM ID","Company","Asset","Asset Type","Frequency","No. of PMs","Total Amount"].join(","),...M.map(_e=>[_e.name,_e.company||"",_e.asset_name||"",_e.custom_asset_type||"",_e.custom_frequency||"",_e.custom_no_of_pms||"",_e.custom_total_amount||""].join(","))].join(`
`),re=new Blob([be],{type:"text/csv"}),de=URL.createObjectURL(re),Ae=document.createElement("a");Ae.href=de,Ae.download=`ppm_schedules_${new Date().toISOString().split("T")[0]}.csv`,Ae.click(),URL.revokeObjectURL(de)};if(B&&t===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(U)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:H,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:"})," ",U]})})]})});const Oe=M.filter(ue=>{var be,re,de,Ae;return((be=ue.name)==null?void 0:be.toLowerCase().includes(o.toLowerCase()))||((re=ue.asset_name)==null?void 0:re.toLowerCase().includes(o.toLowerCase()))||((de=ue.company)==null?void 0:de.toLowerCase().includes(o.toLowerCase()))||((Ae=ue.custom_asset_type)==null?void 0:Ae.toLowerCase().includes(o.toLowerCase()))});return a.jsxs("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 dark:text-white break-words",children:e("ppm.title")}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",D," PPM schedule",D!==1?"s":""]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:Se,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:M.length===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")})]}),a.jsxs("button",{onClick:V,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(Ei,{}),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(xo,{className:"text-gray-400 dark:text-gray-500"}),a.jsx("input",{type:"text",placeholder:"Search by ID, asset, company...",value:o,onChange:ue=>u(ue.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:f,onChange:ue=>{g(ue.target.value),n(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:Oe.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(xo,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No PPM schedules found"}),a.jsx("button",{onClick:V,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"})]})})}):Oe.map(ue=>a.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>J(ue.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:ue.name})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ix,{className:"text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:ue.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:ue.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:ue.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:ue.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:ue.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:ue.custom_total_amount?`$${ue.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:be=>be.stopPropagation(),children:[a.jsx("button",{onClick:()=>N(k===ue.name?null:ue.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(au,{})}),k===ue.name&&a.jsxs("div",{ref:C,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:()=>{J(ue.name),N(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(Yi,{}),"View"]}),a.jsxs("button",{onClick:()=>{Q(ue.name),N(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(rs,{}),"Edit"]}),a.jsxs("button",{onClick:()=>{je(ue.name),N(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(Ad,{}),"Duplicate"]}),a.jsxs("button",{onClick:()=>{me(ue),N(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(Cs,{}),"Export"]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700"}),a.jsxs("button",{onClick:()=>{p(ue.name),N(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(la,{}),"Delete"]})]})]})})]},ue.name))})]})}),(z||t>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 ",t*O+1," to ",Math.min((t+1)*O,D)," of ",D," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>n(Math.max(0,t-1)),disabled:t===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:()=>n(t+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"})]})]})]}),v&&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:()=>p(null),className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600",children:"Cancel"}),a.jsx("button",{onClick:()=>Te(v),disabled:ne,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50",children:ne?"Deleting...":"Delete"})]})]})})]})},TR=()=>{const{ppmName:e}=Ml(),r=ma(),[t]=Rl(),n=t.get("duplicate"),o=e==="new",u=o&&!!n,{ppm:f,loading:g,error:v,refetch:p}=ER(u?n:o?null:e||null),{createPPM:k,updatePPM:N,loading:C}=L4(),[O,I]=R.useState(o),[M,D]=R.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});R.useEffect(()=>{f&&D({company:f.company||"",asset_name:f.asset_name||"",custom_asset_type:f.custom_asset_type||"",maintenance_team:f.maintenance_team||"",custom_frequency:f.custom_frequency||"",custom_total_amount:f.custom_total_amount||0,custom_no_of_pms:f.custom_no_of_pms||0,custom_price_per_pm:f.custom_price_per_pm||0})},[f,u]);const z=U=>{const{name:H,value:q}=U.target;D(ne=>Ve(ke({},ne),{[H]:H.includes("amount")||H.includes("pms")||H.includes("price")?parseFloat(q)||0:q}))},B=U=>Ne(null,null,function*(){var H;if(U.preventDefault(),!M.asset_name){alert("Please enter Asset Name");return}try{if(o||u){const q=yield k(M);alert(u?"PPM schedule duplicated successfully!":"PPM schedule created successfully!"),(H=q.asset_maintenance)!=null&&H.name?r(`/ppm/${q.asset_maintenance.name}`):(p(),r("/ppm"))}else e&&(yield N(e,M),alert("PPM schedule updated successfully!"),I(!1),p())}catch(q){console.error("PPM save error:",q),alert("Failed to save: "+(q instanceof Error?q.message:"Unknown error"))}});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-blue-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading PPM schedule..."})]})}):v&&!o&&!u?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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: ",v]}),a.jsx("button",{onClick:()=>r("/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-4 sm:p-6 min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsx("div",{className:"flex items-center gap-4",children:a.jsxs("button",{onClick:()=>r("/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(Ki,{}),a.jsx("span",{className:"text-gray-900 dark:text-white",children:u?"Duplicate PPM Schedule":o?"New PPM Schedule":"PPM Schedule Details"})]})}),a.jsx("div",{className:"flex items-center gap-3",children:!o&&!O&&a.jsxs("button",{onClick:()=>I(!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(rs,{}),"Edit"]})})]}),a.jsxs("form",{onSubmit:B,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 *"}),O?a.jsx("input",{type:"text",name:"company",value:M.company,onChange:z,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:(f==null?void 0:f.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 *"}),O?a.jsx("input",{type:"text",name:"asset_name",value:M.asset_name,onChange:z,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:(f==null?void 0:f.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"}),O?a.jsx("input",{type:"text",name:"custom_asset_type",value:M.custom_asset_type,onChange:z,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:(f==null?void 0:f.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"}),O?a.jsx("input",{type:"text",name:"maintenance_team",value:M.maintenance_team,onChange:z,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:(f==null?void 0:f.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"}),O?a.jsx("input",{type:"text",name:"custom_frequency",value:M.custom_frequency,onChange:z,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:(f==null?void 0:f.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"}),O?a.jsx("input",{type:"number",name:"custom_no_of_pms",value:M.custom_no_of_pms,onChange:z,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:(f==null?void 0:f.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"}),O?a.jsx("input",{type:"number",name:"custom_price_per_pm",value:M.custom_price_per_pm,onChange:z,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:f!=null&&f.custom_price_per_pm?`$${f.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"}),O?a.jsx("input",{type:"number",name:"custom_total_amount",value:M.custom_total_amount,onChange:z,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:f!=null&&f.custom_total_amount?`$${f.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"}),!o&&f&&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:f.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:f.creation?new Date(f.creation).toLocaleString():"-"})]})]}),o&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(lx,{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"})]})]})})]}),O&&a.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{o?r("/ppm"):(I(!1),f&&D({company:f.company||"",asset_name:f.asset_name||"",custom_asset_type:f.custom_asset_type||"",maintenance_team:f.maintenance_team||"",custom_frequency:f.custom_frequency||"",custom_total_amount:f.custom_total_amount||0,custom_no_of_pms:f.custom_no_of_pms||0,custom_price_per_pm:f.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:C,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(Tn,{}),C?"Saving...":o?"Create":"Save Changes"]})]})]})]})};class AR{submitDocument(r,t){return Ne(this,null,function*(){try{const n=yield this.fetchWithTimeout(`${wr.BASE_URL}/api/resource/PM Schedule Generator/${encodeURIComponent(r)}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"},3e4);if(!n.ok){const g=yield n.text();console.warn("Failed to fetch document for submit:",g);return}const u=(yield n.json()).data;if(!u){console.warn("No document data received");return}const f=yield this.fetchWithTimeout(`${wr.BASE_URL}/api/method/frappe.client.submit`,{method:"POST",headers:t,credentials:"include",body:JSON.stringify({doc:u})},6e4);if(f.ok)console.log("✅ Document submitted successfully");else{const g=yield f.text();console.warn("Failed to submit document:",g)}}catch(n){console.warn("Error submitting document:",n.message)}})}fetchWithTimeout(r,t,n=12e4){return Ne(this,null,function*(){var f,g;const o=new AbortController,u=setTimeout(()=>o.abort(),n);try{const v=yield fetch(r,Ve(ke({},t),{signal:o.signal}));return clearTimeout(u),v}catch(v){throw clearTimeout(u),v.name==="AbortError"?new Error(`Request timeout after ${n}ms. The server may be slow or the request is too large.`):(f=v.message)!=null&&f.includes("Failed to fetch")||(g=v.message)!=null&&g.includes("ERR_CONNECTION_TIMED_OUT")?new Error(`Connection timeout. Please check:
1. Your internet connection
2. Server is accessible
3. Try with fewer assets`):v}})}getFilteredAssets(r){return Ne(this,null,function*(){const t=[];r.modality&&t.push(["custom_modality","=",r.modality]),r.asset_type&&t.push(["custom_asset_type","=",r.asset_type]),r.department&&t.push(["department","=",r.department]),r.location&&t.push(["location","=",r.location]),r.manufacturer&&t.push(["custom_manufacturer","=",r.manufacturer]),r.model&&t.push(["custom_model","=",r.model]);const n=JSON.stringify(t),o=JSON.stringify(["name","asset_name","custom_asset_type","department","location","custom_manufacturer","custom_model","custom_modality","company"]),u=yield jt.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(n)}&fields=${encodeURIComponent(o)}&limit_page_length=1000`);return(u==null?void 0:u.data)||[]})}createBulkMaintenanceSchedules(r){return Ne(this,null,function*(){var u,g,v,p,k,N;if(!r.hospital)throw new Error("Hospital/Company is required to create PM Schedule Generator");if(!r.periodicity)throw new Error("Periodicity is required");if(r.assets.length===0)throw new Error("At least one asset must be selected");r.assets.length>50&&console.warn(`Creating schedules for ${r.assets.length} assets. This may take a while...`);const t={doctype:"PM Schedule Generator",hospital:r.hospital,start_date:r.start_date,end_date:r.end_date,periodicity:r.periodicity,pm_for:r.pm_for||null,no_of_pms:r.no_of_pms||null,maintenance_team:r.maintenance_team||null,maintenance_manager:r.maintenance_manager||null,assign_to:r.assign_to||null,modality:r.modality||null,manufacturer:r.manufacturer||null,model:r.model||null,department:r.department||null,maintenance_entries:r.assets.map(C=>({doctype:"PM Entry Line",asset:C.name,start_date:r.start_date,end_date:r.end_date,manufacturer:C.custom_manufacturer||null,model:C.custom_model||null}))};console.log("Creating PM Schedule Generator with document:",JSON.stringify(t,null,2));const n=yield jt.getCSRFToken(),o={"Content-Type":"application/json",Accept:"application/json"};n&&(o["X-Frappe-CSRF-Token"]=n);try{const C=yield this.fetchWithTimeout(`${wr.BASE_URL}/api/method/frappe.client.insert`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify({doc:t})},12e4),O=yield C.text();if(console.log("frappe.client.insert response:",O),!C.ok)throw new Error(`HTTP ${C.status}: ${O}`);const I=JSON.parse(O),M=(u=I==null?void 0:I.message)==null?void 0:u.name;if(M)return console.log("✅ PM Schedule Generator created successfully:",M),yield this.submitDocument(M,o),{success:!0,created:r.assets.length,document:M,message:`PM Schedule Generator "${M}" created and submitted with ${r.assets.length} assets`};throw new Error("No document name in response")}catch(C){console.warn("Method 1 (frappe.client.insert) failed:",C.message);try{const f=t,{doctype:O,maintenance_entries:I}=f,M=Us(f,["doctype","maintenance_entries"]),D=Ve(ke({},M),{maintenance_entries:I.map(V=>{var J=V,{doctype:q}=J,ne=Us(J,["doctype"]);return ne})});console.log("Trying Resource API with:",JSON.stringify(D,null,2));const z=yield this.fetchWithTimeout(`${wr.BASE_URL}/api/resource/PM%20Schedule%20Generator`,{method:"POST",headers:o,credentials:"include",body:JSON.stringify(D)},12e4),B=yield z.text();if(console.log("Resource API response:",B),!z.ok)throw new Error(`HTTP ${z.status}: ${B}`);const U=JSON.parse(B),H=(g=U==null?void 0:U.data)==null?void 0:g.name;if(H)return console.log("✅ PM Schedule Generator created via Resource API:",H),yield this.submitDocument(H,o),{success:!0,created:r.assets.length,document:H,message:`PM Schedule Generator "${H}" created and submitted with ${r.assets.length} assets`};throw new Error("No document name in response")}catch(O){console.warn("Method 2 (Resource API) failed:",O.message);const I=[];throw(((v=C==null?void 0:C.message)==null?void 0:v.includes("timeout"))||((p=C==null?void 0:C.message)==null?void 0:p.includes("Failed to fetch")))&&(((k=O==null?void 0:O.message)==null?void 0:k.includes("timeout"))||((N=O==null?void 0:O.message)==null?void 0:N.includes("Failed to fetch")))?I.push(`⚠️ Connection timeout detected. This usually means:
• The server is taking too long to process ${r.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`):(I.push("Failed to create PM Schedule Generator. Errors:"),C!=null&&C.message&&I.push(`• frappe.client.insert: ${C.message.substring(0,150)}`),O!=null&&O.message&&I.push(`• Resource API: ${O.message.substring(0,150)}`),I.push(`
Please ensure:
1. Hospital (${r.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.
${I.join(`
`)}`)}}})}getFilterOptions(){return Ne(this,null,function*(){try{const r=yield jt.apiCall(`/api/resource/Asset?fields=${encodeURIComponent(JSON.stringify(["custom_modality","custom_asset_type","department","location","custom_manufacturer","custom_model"]))}&limit_page_length=1000`),t=(r==null?void 0:r.data)||[];return{modalities:[...new Set(t.map(o=>o.custom_modality).filter(Boolean))],assetTypes:[...new Set(t.map(o=>o.custom_asset_type).filter(Boolean))],departments:[...new Set(t.map(o=>o.department).filter(Boolean))],locations:[...new Set(t.map(o=>o.location).filter(Boolean))],manufacturers:[...new Set(t.map(o=>o.custom_manufacturer).filter(Boolean))],models:[...new Set(t.map(o=>o.custom_model).filter(Boolean))],company:[...new Set(t.map(o=>o.company).filter(Boolean))]}}catch(r){return console.error("Error fetching filter options:",r),{modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}}})}getMaintenanceTeams(){return Ne(this,null,function*(){try{const r=yield jt.apiCall(`/api/resource/Asset Maintenance Team?fields=${encodeURIComponent(JSON.stringify(["name"]))}&limit_page_length=1000`);return r!=null&&r.data&&r.data.length>0?r.data.map(t=>({name:t.name,maintenance_team_name:t.name})):[]}catch(r){return console.warn("Could not fetch maintenance teams:",(r==null?void 0:r.message)||"Unknown error"),[]}})}getMaintenanceTeamDetails(r){return Ne(this,null,function*(){try{const t=yield jt.apiCall(`/api/resource/Asset Maintenance Team/${encodeURIComponent(r)}`);if(t!=null&&t.data){const n=t.data,o=[];return n.maintenance_team_members&&Array.isArray(n.maintenance_team_members)&&n.maintenance_team_members.forEach(u=>{u.team_member&&o.push(u.team_member)}),{name:n.name,maintenance_manager:n.maintenance_manager||void 0,team_members:o.length>0?o:void 0}}return null}catch(t){return console.warn("Could not fetch maintenance team details:",(t==null?void 0:t.message)||"Unknown error"),null}})}}const Mf=new AR,jR=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState({}),[o,u]=R.useState([]),[f,g]=R.useState({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:"",department:""}),[v,p]=R.useState(!1),[k,N]=R.useState(!1),[C,O]=R.useState([]),[I,M]=R.useState({modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}),[D,z]=R.useState([]),[B,U]=R.useState(""),[H,q]=R.useState(null);R.useEffect(()=>{V(),J()},[]);const ne=(re,de,Ae)=>{if(!re||!de||!Ae)return null;const _e=parseInt(Ae,10);if(isNaN(_e)||_e<1)return null;const K=_e-1;if(K<0)return null;const W=new Date(re),ae=new Date(W);switch(de){case"Daily":ae.setDate(ae.getDate()+K);break;case"Weekly":ae.setDate(ae.getDate()+K*7);break;case"Monthly":ae.setMonth(ae.getMonth()+K);break;case"Quarterly":ae.setMonth(ae.getMonth()+K*3);break;case"Half-yearly":ae.setMonth(ae.getMonth()+K*6);break;case"Yearly":ae.setFullYear(ae.getFullYear()+K);break;case"2 Yearly":ae.setFullYear(ae.getFullYear()+K*2);break;case"3 Yearly":ae.setFullYear(ae.getFullYear()+K*3);break;default:return null}const se=ae.getFullYear(),he=String(ae.getMonth()+1).padStart(2,"0"),pe=String(ae.getDate()).padStart(2,"0");return`${se}-${he}-${pe}`};R.useEffect(()=>{Ne(null,null,function*(){if(f.maintenance_team){const de=yield Mf.getMaintenanceTeamDetails(f.maintenance_team);de&&g(Ae=>Ve(ke({},Ae),{maintenance_manager:de.maintenance_manager||"",assign_to:de.team_members&&de.team_members.length===1?de.team_members[0]:Ae.assign_to}))}else g(de=>Ve(ke({},de),{maintenance_manager:"",assign_to:""}))})},[f.maintenance_team]),R.useEffect(()=>{if(f.start_date&&f.periodicity&&f.no_of_pms){const re=ne(f.start_date,f.periodicity,f.no_of_pms);re&&g(de=>Ve(ke({},de),{end_date:re}))}},[f.start_date,f.periodicity,f.no_of_pms]);const V=()=>Ne(null,null,function*(){const re=yield Mf.getFilterOptions();M(re)}),J=()=>Ne(null,null,function*(){const re=yield Mf.getMaintenanceTeams();z(re)}),Q=()=>Ne(null,null,function*(){N(!0);try{const re=new URLSearchParams;t.company&&re.append("company",t.company),t.custom_modality&&re.append("custom_modality",t.custom_modality),t.custom_manufacturer&&re.append("custom_manufacturer",t.custom_manufacturer),t.custom_device_status&&re.append("custom_device_status",t.custom_device_status),t.custom_model&&re.append("custom_model",t.custom_model),t.department&&re.append("department",t.department);const de=yield fetch(`/api/method/get_assets?${re.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!de.ok)throw new Error(`HTTP error! status: ${de.status}`);const _e=(yield de.json()).message||[];O(_e),u([])}catch(re){console.error("Error fetching assets:",re),alert("Failed to fetch assets: "+(re instanceof Error?re.message:"Unknown error"))}finally{N(!1)}}),Te=(re,de)=>{n(Ae=>Ve(ke({},Ae),{[re]:de||void 0}))},je=re=>{u(de=>de.includes(re)?de.filter(Ae=>Ae!==re):[...de,re])},me=()=>{const re=Se();o.length===re.length&&re.length>0?u([]):u(re.map(de=>de.name))},Se=()=>{if(!B)return C;const re=B.toLowerCase();return C.filter(de=>{var Ae,_e,K,W,ae,se;return((Ae=de.asset_name)==null?void 0:Ae.toLowerCase().includes(re))||((_e=de.custom_modality)==null?void 0:_e.toLowerCase().includes(re))||((K=de.company)==null?void 0:K.toLowerCase().includes(re))||((W=de.custom_manufacturer)==null?void 0:W.toLowerCase().includes(re))||((ae=de.custom_model)==null?void 0:ae.toLowerCase().includes(re))||((se=de.custom_device_status)==null?void 0:se.toLowerCase().includes(re))})},Oe=()=>Ne(null,null,function*(){if(o.length===0){alert("Please select at least one asset");return}if(!t.company){alert("Please select a Hospital/Company in the filters first");return}if(!f.pm_for){alert("Please enter a PM Name");return}if(!f.start_date||!f.end_date){alert("Please select start and end dates");return}if(new Date(f.start_date)>new Date(f.end_date)){alert("Start date must be before end date");return}if(!f.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 ${o.length} asset(s)?`)){p(!0);try{const de=C.filter(K=>o.includes(K.name)).map(K=>({name:K.name,custom_manufacturer:K.custom_manufacturer,custom_model:K.custom_model})),Ae={assets:de,start_date:f.start_date,end_date:f.end_date,maintenance_team:f.maintenance_team||void 0,assign_to:f.assign_to||void 0,maintenance_manager:f.maintenance_manager||void 0,periodicity:f.periodicity,maintenance_type:f.maintenance_type,no_of_pms:f.no_of_pms||void 0,pm_for:f.pm_for||void 0,hospital:t.company,modality:t.custom_modality,manufacturer:t.custom_manufacturer,model:t.custom_model,department:f.department||t.department||void 0};console.log("=== DEBUG: Selected Asset Details ===",de),console.log("=== DEBUG: bulkData ===",Ae);const _e=yield Mf.createBulkMaintenanceSchedules(Ae);q({show:!0,document:_e.document,count:_e.created||o.length,type:"pm_schedule"}),u([]),g({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:"",department:""})}catch(de){console.error("Error creating schedules:",de);const Ae=de instanceof Error?de.message:"Unknown error";alert(`Failed to create maintenance schedules:
${Ae}`)}finally{p(!1)}}}),ue=Se(),be=Object.values(t).some(re=>re);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:()=>r("/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(Ki,{}),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($i,{})," Filter Assets"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[a.jsx("div",{children:a.jsx(er,{label:"Hospital/Company *",doctype:"Company",value:t.company||"",onChange:re=>Te("company",re),placeholder:"Select a hospital/company"})}),a.jsx("div",{children:a.jsx(er,{label:"Modality",doctype:"Modality",value:t.custom_modality||"",onChange:re=>Te("custom_modality",re),placeholder:"Leave empty for all modalities"})}),a.jsx("div",{children:a.jsx(er,{label:"Manufacturer",doctype:"Manufacturer",value:t.custom_manufacturer||"",onChange:re=>Te("custom_manufacturer",re),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:t.custom_device_status||"",onChange:re=>Te("custom_device_status",re.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:"Up",children:"Up"}),a.jsx("option",{value:"Down",children:"Down"})]})]}),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:t.custom_model||"",onChange:re=>Te("custom_model",re.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)"}),I.models.map(re=>a.jsx("option",{value:re,children:re},re))]})]}),a.jsx("div",{children:a.jsx(er,{label:"Department",doctype:"Department",value:t.department||"",onChange:re=>Te("department",re),placeholder:"Select department (optional)"})})]}),a.jsxs("div",{className:"mt-4 flex gap-3",children:[a.jsx("button",{onClick:Q,disabled:k,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:k?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Loading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(xo,{}),"Fetch Assets"]})}),be&&a.jsx("button",{onClick:()=>{n({}),O([]),u([])},className:"bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg",children:"Clear Filters"})]})]}),C.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 (",o.length," of ",C.length," selected)"]}),a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"relative",children:[a.jsx(xo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Search assets...",value:B,onChange:re=>U(re.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:me,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:o.length===ue.length&&ue.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:o.length===ue.length&&ue.length>0,onChange:me,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:ue.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"})}):ue.map(re=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${o.includes(re.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[a.jsx("td",{className:"p-3",children:a.jsx("input",{type:"checkbox",checked:o.includes(re.name),onChange:()=>je(re.name),className:"rounded"})}),a.jsx("td",{className:"p-3 text-sm text-gray-900 dark:text-white font-medium",children:re.asset_name}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:re.custom_modality||"-"}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:re.custom_manufacturer||"-"}),a.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:re.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 ${re.custom_device_status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":re.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:re.custom_device_status||"-"})})]},re.name))})]})})]}),o.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(If,{})," 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:f.pm_for,onChange:re=>g(de=>Ve(ke({},de),{pm_for:re.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:f.start_date,onChange:re=>g(de=>Ve(ke({},de),{start_date:re.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:f.periodicity,onChange:re=>g(de=>Ve(ke({},de),{periodicity:re.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:f.maintenance_type,onChange:re=>g(de=>Ve(ke({},de),{maintenance_type:re.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:f.no_of_pms,onChange:re=>g(de=>Ve(ke({},de),{no_of_pms:re.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:f.end_date,onChange:re=>g(de=>Ve(ke({},de),{end_date:re.target.value})),min:f.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(er,{label:"Maintenance Team",doctype:"Asset Maintenance Team",value:f.maintenance_team,onChange:re=>g(de=>Ve(ke({},de),{maintenance_team:re}))}),f.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:"})," ",f.maintenance_manager]})]}),a.jsxs("div",{children:[a.jsx(er,{label:"Assign To *",doctype:"User",value:f.assign_to,onChange:re=>g(de=>Ve(ke({},de),{assign_to:re})),placeholder:f.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"}),f.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:"})," ",f.assign_to]})]}),a.jsx("div",{children:a.jsx(er,{label:"Department",doctype:"Department",value:f.department,onChange:re=>g(de=>Ve(ke({},de),{department:re})),placeholder:"Select department (optional)"})})]}),a.jsx("button",{onClick:Oe,disabled:v||!f.start_date||!f.end_date||!f.pm_for||!f.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:v?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Creating Schedules..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ua,{}),"Generate Maintenance Schedules (",o.length," asset",o.length!==1?"s":"",")"]})})]}),C.length===0&&!k&&!(H!=null&&H.show)&&a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-12 text-center",children:[a.jsx($i,{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."})]}),(H==null?void 0:H.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(Ua,{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:[H.count," maintenance schedule",H.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:H.document})]}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["A PM Schedule Generator document has been created with ",H.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:[H.document&&a.jsxs("button",{onClick:()=>{r(`/ppm-planner/${H.document}`),q(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(If,{}),"View PPM Planner"]}),a.jsxs("button",{onClick:()=>r("/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(If,{}),"View Calendar"]}),a.jsx("button",{onClick:()=>q(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 hp(e={},r=20,t=0,n="creation desc",o={}){const[u,f]=R.useState([]),[g,v]=R.useState(0),[p,k]=R.useState(!1),[N,C]=R.useState(!0),[O,I]=R.useState(null),[M,D]=R.useState(0),z=JSON.stringify(e),B=JSON.stringify(o);R.useEffect(()=>{let H=!1;const q=z,ne=B,V=r,J=t,Q=n;return Ne(null,null,function*(){try{C(!0),I(null);let je={},me={};try{je=q?JSON.parse(q):{}}catch(ue){je={}}try{me=ne?JSON.parse(ne):{}}catch(ue){me={}}const Se=ke(ke({},je),me),Oe=yield jt.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(Se),limit:V,offset:J,order_by:Q,include_child_tables:!0,fields:JSON.stringify(["name","pm_for","hospital","modality","periodicity","start_date","end_date","due_date"])})});if(!H){const ue=(Oe==null?void 0:Oe.message)||Oe;if(ue&&ue.pm_schedules){const be=ue.pm_schedules||[];if(console.log("[usePMSchedules] Loaded",be.length,"PM Schedules"),be.length>0){const re=be[0];console.log("[usePMSchedules] 🔍 FIRST SCHEDULE FIELDS:",{name:re.name,pm_for:re.pm_for,"pm_for (bracket)":re.pm_for,allKeys:Object.keys(re),allKeysList:Object.keys(re).join(", "),fullObject:re})}f(be),v(ue.total_count||0),k(ue.has_more||!1)}else console.warn("[usePMSchedules] No pm_schedules in response:",Oe),f([]),v(0),k(!1)}}catch(je){H||(console.error("Error fetching PM Schedules:",je),I(je instanceof Error?je.message:"Failed to fetch PM Schedules"),f([]),v(0))}finally{H||C(!1)}}),()=>{H=!0}},[z,B,r,t,n,M]);const U=R.useCallback(()=>{D(H=>H+1)},[]);return{pmSchedules:u,totalCount:g,hasMore:p,loading:N,error:O,refetch:U}}function OR(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}o(!0),f(null);try{const v=yield jt.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:",v),v&&v.name&&!v.error)console.log("[usePMScheduleDetails] Setting PM Schedule:",v),t(v);else{const p=(v==null?void 0:v.error)||"PM Schedule not found";console.warn("[usePMScheduleDetails] Error or not found:",p),f(p),t(null)}}catch(v){console.error("Error fetching PM Schedule details:",v),f(v instanceof Error?v.message:"Failed to fetch PM Schedule"),t(null)}finally{o(!1)}}),[e]);return R.useEffect(()=>{g()},[g]),{pmSchedule:r,loading:n,error:u,refetch:g}}function P4(){const[e,r]=R.useState(!1);return{createPMSchedule:k=>Ne(null,null,function*(){r(!0);try{const N=yield jt.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(k)})});if(N!=null&&N.success)return N.pm_schedule;throw new Error((N==null?void 0:N.error)||"Failed to create PM Schedule")}finally{r(!1)}}),updatePMSchedule:(k,N)=>Ne(null,null,function*(){r(!0);try{const C=yield jt.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:k,pm_schedule_data:JSON.stringify(N)})});if(C!=null&&C.success)return C.pm_schedule;throw new Error((C==null?void 0:C.error)||"Failed to update PM Schedule")}finally{r(!1)}}),deletePMSchedule:k=>Ne(null,null,function*(){r(!0);try{const N=yield jt.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:k})});if(!(N!=null&&N.success))throw new Error((N==null?void 0:N.error)||"Failed to delete PM Schedule")}finally{r(!1)}}),submitPMSchedule:k=>Ne(null,null,function*(){r(!0);try{const N=yield jt.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:k})});if(N!=null&&N.success)return N.pm_schedule;throw new Error((N==null?void 0:N.error)||"Failed to submit PM Schedule")}finally{r(!1)}}),cancelPMSchedule:k=>Ne(null,null,function*(){r(!0);try{const N=yield jt.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:k})});if(N!=null&&N.success)return N.pm_schedule;throw new Error((N==null?void 0:N.error)||"Failed to cancel PM Schedule")}finally{r(!1)}}),addMaintenanceEntry:(k,N)=>Ne(null,null,function*(){r(!0);try{const C=yield jt.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:k,entry_data:JSON.stringify(N)})});if(C!=null&&C.success)return C.maintenance_entries;throw new Error((C==null?void 0:C.error)||"Failed to add maintenance entry")}finally{r(!1)}}),removeMaintenanceEntry:(k,N)=>Ne(null,null,function*(){r(!0);try{const C=yield jt.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:k,entry_name:N})});if(C!=null&&C.success)return C.maintenance_entries;throw new Error((C==null?void 0:C.error)||"Failed to remove maintenance entry")}finally{r(!1)}}),updateMaintenanceEntry:(k,N,C)=>Ne(null,null,function*(){r(!0);try{const O=yield jt.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:k,entry_name:N,entry_data:JSON.stringify(C)})});if(O!=null&&O.success)return O.maintenance_entries;throw new Error((O==null?void 0:O.error)||"Failed to update maintenance entry")}finally{r(!1)}}),loading:e}}const MR=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const{t:v}=Xa(),[p,k]=R.useState(t>0?"selected":"all_with_filters"),[N,C]=R.useState("csv"),[O,I]=R.useState(g.filter(B=>B.default).map(B=>B.key));R.useEffect(()=>{t>0?k("selected"):k("all_with_filters")},[t]);const M=B=>{I(U=>U.includes(B)?U.filter(H=>H!==B):[...U,B])},D=()=>{I(g.map(B=>B.key))},z=()=>{I(g.filter(B=>B.default).map(B=>B.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(Cs,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[v("listPages.export")," PPM Schedules"]})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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 ${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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>k("selected"),disabled:t===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 ",t," selected schedule",t!==1?"s":""]})]}),t>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:[t," 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:()=>k("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 ",o," schedule",o!==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:[o," 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:()=>k("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 ",n," schedule",n!==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:[n," 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:v("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 ${N==="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:N==="csv",onChange:()=>C("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{className:"text-green-600 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:v("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 ${N==="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:N==="excel",onChange:()=>C("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{className:"text-green-700 text-xl"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:v("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:D,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:z,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:g.map(B=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${O.includes(B.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:O.includes(B.key),onChange:()=>M(B.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:B.label})]},B.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[O.length," column",O.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 ${t} selected row${t!==1?"s":""}`,p==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(p,N,O),disabled:O.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},RR=({isOpen:e,onClose:r,selectedItems:t,onPrint:n,isPrinting:o})=>{const{t:u}=Xa(),[f,g]=R.useState(""),[v,p]=R.useState(!0),[k,N]=R.useState(""),[C,O]=R.useState("A4"),[I,M]=R.useState([]),[D,z]=R.useState([]),[B,U]=R.useState(!1);R.useEffect(()=>{e&&(H(),q())},[e]);const H=()=>Ne(null,null,function*(){U(!0);try{const Q=((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(Te=>Te.name);M(Q),Q.length>0&&!f&&g(Q[0])}catch(V){console.error("Error fetching print formats:",V)}finally{U(!1)}}),q=()=>Ne(null,null,function*(){try{const Q=((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(Te=>Te.name);z(Q),Q.length>0&&!k&&N(Q[0])}catch(V){console.error("Error fetching letterheads:",V)}}),ne=()=>{if(!f){alert("Please select a print format");return}n(f,k,!v,C)};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(fc,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Print PM Schedules"})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:o,children:a.jsx(Yt,{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(fi,{className:"text-purple-600 dark:text-purple-400"}),a.jsxs("span",{className:"font-medium text-purple-800 dark:text-purple-300",children:[t.length," schedule",t.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:[t.slice(0,5).join(", "),t.length>5&&` and ${t.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:"*"})]}),B?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..."]}):I.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:f,onChange:V=>g(V.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"}),I.map(V=>a.jsx("option",{value:V,children:V},V))]})]}),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:v,onChange:V=>p(V.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"})]})}),v&&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:k,onChange:V=>N(V.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"}),D.map(V=>a.jsx("option",{value:V,children:V},V))]})]}),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:C,onChange:V=>O(V.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:r,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:o,children:"Cancel"}),a.jsx("button",{onClick:ne,disabled:!f||o||t.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:o?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(fc,{}),"Print ",t.length," Schedule",t.length!==1?"s":""]})})]})]})}):null},DR=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState(0),[o,u]=R.useState(""),[f,g]=R.useState(null),[v,p]=R.useState(null),k=R.useRef(null),[N,C]=R.useState(!1),[O,I]=R.useState(""),[M,D]=R.useState(""),[z,B]=R.useState(""),[U,H]=R.useState(""),[q,ne]=R.useState(new Set),[V,J]=R.useState(!1),[Q,Te]=R.useState(!1),[je,me]=R.useState(!1),[Se,Oe]=R.useState(!1),ue=20,be=[{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}],re={};O&&(re.hospital=O),M&&(re.modality=M),z&&(re.manufacturer=z),U&&(re.periodicity=U);const{pmSchedules:de,totalCount:Ae,hasMore:_e,loading:K,error:W,refetch:ae}=hp(re,ue,t*ue,"creation desc"),{deletePMSchedule:se,loading:he}=P4();R.useEffect(()=>{const pt=We=>{k.current&&!k.current.contains(We.target)&&p(null)};return v&&document.addEventListener("mousedown",pt),()=>{document.removeEventListener("mousedown",pt)}},[v]),R.useEffect(()=>{ne(new Set)},[O,M,z,U,o,t]);const pe=de.filter(pt=>{var Nt,At,Qt,cr,He,It;if(!o)return!0;const We=o.toLowerCase();return((Nt=pt.name)==null?void 0:Nt.toLowerCase().includes(We))||((At=pt.pm_for)==null?void 0:At.toLowerCase().includes(We))||((Qt=pt.hospital)==null?void 0:Qt.toLowerCase().includes(We))||((cr=pt.modality)==null?void 0:cr.toLowerCase().includes(We))||((He=pt.manufacturer)==null?void 0:He.toLowerCase().includes(We))||((It=pt.maintenance_team)==null?void 0:It.toLowerCase().includes(We))}),Je=()=>{q.size===pe.length?ne(new Set):ne(new Set(pe.map(pt=>pt.name)))},Fe=pe.length>0&&q.size===pe.length,ft=q.size>0&&q.size<pe.length,ot=pt=>{ne(We=>{const Nt=new Set(We);return Nt.has(pt)?Nt.delete(pt):Nt.add(pt),Nt})},Lt=R.useCallback(()=>Ne(null,null,function*(){const pt=[];let We=0;const Nt=100;let At=!0;for(;At;)try{const He=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"PM Schedule Generator",filters:re,fields:["*"],limit_start:We*Nt,limit_page_length:Nt,order_by:"creation desc"})})).json()).message||[];pt.push(...He),He.length<Nt?At=!1:We++,We>100&&(console.warn("Export safety limit reached"),At=!1)}catch(Qt){throw console.error("Error fetching schedules for export:",Qt),Qt}return pt}),[re]),zt=(pt,We,Nt)=>Ne(null,null,function*(){Te(!0);try{let At=[];switch(pt){case"selected":At=pe.filter(He=>q.has(He.name));break;case"all_on_page":At=pe;break;case"all_with_filters":At=yield Lt();break}if(At.length===0){alert("No data to export");return}const Qt=At.map(He=>{const It=ke({},He);if(Nt.includes("docstatus")){const Zt=Le(He);It.docstatus=Zt===1?"Submitted":Zt===2?"Cancelled":"Draft"}return It}),cr=Nt.map(He=>{const It=be.find(Zt=>Zt.key===He);return(It==null?void 0:It.label)||He});if(We==="csv"){const He=[cr.join(","),...Qt.map(Ye=>Nt.map(Ge=>{let Ct=Ye[Ge]||"";return typeof Ct=="string"&&(Ct.includes(",")||Ct.includes('"')||Ct.includes(`
`))&&(Ct=`"${Ct.replace(/"/g,'""')}"`),Ct}).join(","))].join(`
`),It=new Blob(["\uFEFF"+He],{type:"text/csv;charset=utf-8;"}),Zt=URL.createObjectURL(It),yr=document.createElement("a");yr.href=Zt,yr.download=`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.csv`,yr.click(),URL.revokeObjectURL(Zt)}else if(We==="excel"){const He=[cr,...Qt.map(yr=>Nt.map(Ye=>yr[Ye]||""))],It=Un.aoa_to_sheet(He),Zt=Un.book_new();Un.book_append_sheet(Zt,It,"PPM Schedules"),Fd(Zt,`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.xlsx`)}J(!1),ne(new Set)}catch(At){console.error("Export failed:",At),alert(`Export failed: ${At instanceof Error?At.message:"Unknown error"}`)}finally{Te(!1)}}),Ht=(pt,We,Nt,At)=>{Oe(!0);try{const Qt=Array.from(q);if(Qt.length===0){alert("No schedules selected for printing");return}const cr=window.location.origin,He=new URLSearchParams;He.append("doctype","PM Schedule Generator"),He.append("name",JSON.stringify(Qt)),He.append("format",pt),He.append("no_letterhead",Nt?"1":"0"),We&&!Nt&&He.append("letterhead",We),He.append("options",JSON.stringify({"page-size":At}));const It=`${cr}/api/method/frappe.utils.print_format.download_multi_pdf?${He.toString()}`;window.open(It,"_blank"),me(!1)}catch(Qt){console.error("Print failed:",Qt),alert(`Print failed: ${Qt instanceof Error?Qt.message:"Unknown error"}`)}finally{Oe(!1)}},ht=()=>{r("/ppm-planner/new")},tr=pt=>{r(`/ppm-planner/${pt}`)},Kt=pt=>{r(`/ppm-planner/${pt}`)},gt=pt=>Ne(null,null,function*(){try{yield se(pt),ae(),g(null)}catch(We){console.error("Error deleting PM Schedule:",We),alert("Failed to delete PM Schedule")}}),ve=()=>{I(""),D(""),B(""),H(""),n(0)},Le=pt=>{var We;return pt.docstatus!==void 0?Number(pt.docstatus):((We=pt.maintenance_entries)==null?void 0:We.length)>0?Number(pt.maintenance_entries[0].docstatus):0},ut=O||M||z||U,tt=[O,M,z,U].filter(Boolean).length,Wt=Math.ceil(Ae/ue);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(Yo,{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"),q.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",q.size," selected"]})]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>J(!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:Ae===0,children:[a.jsx(Cs,{}),a.jsx("span",{children:e("listPages.export")}),q.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:q.size})]}),a.jsxs("button",{onClick:()=>me(!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:q.size===0,title:q.size===0?"Select schedules to print":`Print ${q.size} selected`,children:[a.jsx(fc,{}),a.jsx("span",{children:"Print"}),q.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:q.size})]}),a.jsxs("button",{onClick:ht,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(Ei,{}),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(xo,{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:o,onChange:pt=>u(pt.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:()=>C(!N),className:`px-3 py-1.5 border rounded-lg transition-colors flex items-center gap-2 text-sm ${ut?"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($i,{}),a.jsx("span",{children:e("listPages.filters")}),tt>0&&a.jsx("span",{className:"bg-blue-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:tt}),N?a.jsx(ru,{}):a.jsx(Td,{})]})]}),N&&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(er,{label:e("commonFields.hospital"),doctype:"Company",value:O,onChange:I,placeholder:e("filters.allHospitals"),filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(er,{label:e("commonFields.modality"),doctype:"Modality",value:M,onChange:D,placeholder:e("filters.allModalities"),filters:{}})}),a.jsx("div",{children:a.jsx(er,{label:e("commonFields.manufacturer"),doctype:"Manufacturer",value:z,onChange:B,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:U,onChange:pt=>H(pt.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"})]})]})]}),ut&&a.jsx("div",{className:"mt-4 flex justify-end",children:a.jsxs("button",{onClick:ve,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(Yt,{}),e("listPages.clearFilters")]})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 lg:p-5",children:K&&t===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")})]}):W?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:W})}):pe.length===0?a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center",children:[a.jsx(Yo,{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(o||ut?"listPages.tryAdjustingFilters":"listPages.getStartedCreateFirst")}),!o&&!ut&&a.jsx("button",{onClick:ht,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:Je,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Fe?"Deselect all":"Select all",children:Fe?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):ft?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:pe.map(pt=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${q.has(pt.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[a.jsx("td",{className:"px-4 py-4",children:a.jsx("button",{onClick:()=>ot(pt.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:q.has(pt.name)?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Bn,{size:18})})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:a.jsx("button",{onClick:()=>tr(pt.name),className:"text-blue-600 dark:text-blue-400 hover:underline font-medium",children:pt.name})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:pt.pm_for||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:pt.hospital||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:pt.modality||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:pt.manufacturer||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:pt.periodicity||"-"}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:(()=>{const We=Le(pt);return a.jsx("span",{className:`px-2 py-1 text-xs font-semibold rounded-full ${We===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":We===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:We===1?"Submitted":We===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:v===pt.name?k:null,children:[a.jsx("button",{onClick:()=>p(v===pt.name?null:pt.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2",children:a.jsx(au,{})}),v===pt.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:()=>{tr(pt.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[a.jsx(Yi,{})," ",e("listPages.view")]}),a.jsxs("button",{onClick:()=>{Kt(pt.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[a.jsx(rs,{})," ",e("listPages.edit")]}),a.jsxs("button",{onClick:()=>{g(pt.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[a.jsx(la,{})," ",e("listPages.delete")]})]})]})})]},pt.name))})]}),Wt>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")," ",t*ue+1," ",e("listPages.to")," ",Math.min((t+1)*ue,Ae)," ",e("listPages.of")," ",Ae," ",e("listPages.results")]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>n(Math.max(0,t-1)),disabled:t===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:()=>n(t+1),disabled:!_e,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(MR,{isOpen:V,onClose:()=>J(!1),selectedCount:q.size,totalCount:Ae,pageCount:pe.length,onExport:zt,isExporting:Q,exportColumns:be}),a.jsx(RR,{isOpen:je,onClose:()=>me(!1),selectedItems:Array.from(q),onPrint:Ht,isPrinting:Se}),f&&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:()=>g(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:he,children:e("common.cancel")}),a.jsx("button",{onClick:()=>gt(f),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:he,children:e(he?"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;
}
`})]})},IR=()=>{const{t:e}=Xa(),{scheduleName:r}=Ml(),t=ma(),{pmSchedule:n,loading:o,error:u,refetch:f}=OR(r||null),{updatePMSchedule:g,deletePMSchedule:v,submitPMSchedule:p,cancelPMSchedule:k,loading:N}=P4(),{logs:C,refetch:O}=ph({},1e4,0),[I,M]=R.useState(!1),[D,z]=R.useState(!1),[B,U]=R.useState(!1),[H,q]=R.useState(""),[ne,V]=R.useState(""),[J,Q]=R.useState(!1),[Te,je]=R.useState(!1),[me,Se]=R.useState(new Set),[Oe,ue]=R.useState(!1),[be,re]=R.useState(!1),[de,Ae]=R.useState(new Set),[_e,K]=R.useState([]),[W,ae]=R.useState([]),[se,he]=R.useState([]),[pe,Je]=R.useState(""),[Fe,ft]=R.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:""});R.useEffect(()=>{Ne(null,null,function*(){try{const Ct=yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",credentials:"include"})).json();Ct.message&&Je(Ct.message)}catch(Ge){console.error("Error fetching current user:",Ge)}})},[]),R.useEffect(()=>{if(r){const Ye=localStorage.getItem(`ppm_activity_${r}`);Ye&&he(JSON.parse(Ye))}},[r]),R.useEffect(()=>{if(n!=null&&n.maintenance_entries&&C.length>0){const Ye=[],Ge=[];n.maintenance_entries.forEach(Ct=>{C.filter(Jt=>Jt.asset_name===Ct.asset).forEach(Jt=>{Jt.workflow_state==="Applied"?Ge.push(Ve(ke({},Jt),{asset_display_name:Ct.asset_name||Ct.asset})):Jt.maintenance_status==="Planned"&&(!Jt.workflow_state||Jt.workflow_state==="Draft")&&Ye.push(Ve(ke({},Jt),{asset_display_name:Ct.asset_name||Ct.asset}))})}),K(Ye),ae(Ge)}},[n,C]),R.useEffect(()=>{if(C.length>0&&(n!=null&&n.maintenance_entries)){const Ye=[];if(n.maintenance_entries.forEach(Ge=>{C.filter(Ft=>Ft.asset_name===Ge.asset).forEach(Ft=>{const Jt=Ft.maintenance_status==="Planned"&&(!Ft.workflow_state||Ft.workflow_state==="Draft"),Dr=Ft.workflow_state==="Applied";(Jt||Dr)&&Ft.due_date&&Ye.push(Ft.due_date)})}),Ye.length>0){const Ge=Ye.sort((Ct,Ft)=>new Date(Ct).getTime()-new Date(Ft).getTime())[0];console.log("📅 Pending due dates:",Ye),console.log("📅 Earliest (Next PM Date):",Ge),ft(Ct=>Ct.next_pm_date!==Ge?Ve(ke({},Ct),{next_pm_date:Ge}):Ct)}else console.log("📅 No pending entries found - all completed"),ft(Ge=>Ve(ke({},Ge),{next_pm_date:""}))}},[n,C]),R.useEffect(()=>{n&&ft({hospital:n.hospital||"",modality:n.modality||"",device_status:n.device_status||"",start_date:n.start_date||"",end_date:n.end_date||"",maintenance_team:n.maintenance_team||"",maintenance_manager:n.maintenance_manager||"",periodicity:n.periodicity||"Monthly",assign_to:n.assign_to||"",due_date:n.due_date||"",next_pm_date:n.next_pm_date||"",manufacturer:n.manufacturer||"",model:n.model||"",pm_for:n.pm_for||"",asset_name:n.asset_name||"",no_of_pms:n.no_of_pms||""})},[n]),R.useEffect(()=>{if(H&&Fe.next_pm_date){const Ye=new Date(H),Ge=new Date(Fe.next_pm_date);Q(Ye<Ge)}else Q(!1)},[H,Fe.next_pm_date]);const ot=(Ye,Ge,Ct)=>{if(!Ye||!Ge||!Ct)return null;const Ft=parseInt(Ct,10);if(isNaN(Ft)||Ft<1)return null;const Jt=Ft-1;if(Jt<0)return null;const Dr=new Date(Ye),kt=new Date(Dr);switch(Ge){case"Daily":kt.setDate(kt.getDate()+Jt);break;case"Weekly":kt.setDate(kt.getDate()+Jt*7);break;case"Monthly":kt.setMonth(kt.getMonth()+Jt);break;case"Quarterly":kt.setMonth(kt.getMonth()+Jt*3);break;case"Half-yearly":kt.setMonth(kt.getMonth()+Jt*6);break;case"Yearly":kt.setFullYear(kt.getFullYear()+Jt);break;case"2 Yearly":kt.setFullYear(kt.getFullYear()+Jt*2);break;case"3 Yearly":kt.setFullYear(kt.getFullYear()+Jt*3);break;default:return null}const Re=kt.getFullYear(),qe=String(kt.getMonth()+1).padStart(2,"0"),Tt=String(kt.getDate()).padStart(2,"0");return`${Re}-${qe}-${Tt}`},Lt=Ye=>{const{name:Ge,value:Ct}=Ye.target;ft(Ft=>{const Jt=Ve(ke({},Ft),{[Ge]:Ct});if(Ge==="start_date"||Ge==="periodicity"||Ge==="no_of_pms"){const Dr=ot(Ge==="start_date"?Ct:Ft.start_date,Ge==="periodicity"?Ct:Ft.periodicity,Ge==="no_of_pms"?Ct:Ft.no_of_pms);Dr&&(Jt.end_date=Dr)}return Jt})},zt=()=>Ne(null,null,function*(){if(r)try{yield g(r,Fe),M(!1),f(),alert("PPM Planner updated successfully")}catch(Ye){console.error("Error updating PPM Planner:",Ye),alert("Failed to update PPM Planner")}}),Ht=()=>Ne(null,null,function*(){if(r)try{yield v(r),t("/ppm-planner")}catch(Ye){console.error("Error deleting PPM Planner:",Ye),alert("Failed to delete PPM Planner")}}),ht=()=>Ne(null,null,function*(){if(r)try{yield p(r),f(),alert("PPM Planner submitted successfully")}catch(Ye){console.error("Error submitting PPM Planner:",Ye),alert("Failed to submit PPM Planner")}}),tr=()=>Ne(null,null,function*(){if(r)try{yield k(r),f(),alert("PPM Planner cancelled successfully")}catch(Ye){console.error("Error cancelling PPM Planner:",Ye),alert("Failed to cancel PPM Planner")}}),Kt=()=>{if(_e.length===0){alert("No planned maintenance entries found to apply.");return}const Ye=new Date().toISOString().split("T")[0];q(Ye),V(""),Se(new Set(_e.map(Ge=>Ge.name))),U(!0)},gt=Ye=>{Se(Ge=>{const Ct=new Set(Ge);return Ct.has(Ye)?Ct.delete(Ye):Ct.add(Ye),Ct})},ve=()=>{Se(new Set(_e.map(Ye=>Ye.name)))},Le=()=>{Se(new Set)},ut=()=>Ne(null,null,function*(){if(!H){alert("Please enter a completion date.");return}if(J&&!ne.trim()){alert("Please provide a reason for early completion.");return}if(me.size===0){alert("Please select at least one entry to complete.");return}je(!0);try{let Ye=0,Ge=0;const Ct=[],Ft=_e.filter(kt=>me.has(kt.name));for(const kt of Ft)try{const Re={maintenance_status:"Completed",workflow_state:"Applied",completion_date:H};J&&ne&&(Re.custom_early_completion_reason=ne,Re.custom_early_completion="Yes");const Tt=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:kt.name,fieldname:Re})})).json();Tt.message?(Ye++,Ct.push(kt.name)):(Ge++,console.error(`Failed to apply ${kt.name}:`,Tt))}catch(Re){Ge++,console.error(`Error applying ${kt.name}:`,Re)}const Dr=[{id:Date.now().toString(),user:pe||"Unknown User",timestamp:new Date().toISOString(),action:"Applied",entriesCount:Ye,completionDate:H,earlyReason:J?ne:void 0,entries:Ct},...se];he(Dr),r&&localStorage.setItem(`ppm_activity_${r}`,JSON.stringify(Dr)),U(!1),q(""),V(""),Se(new Set),O(),f(),alert(Ge===0?`Successfully applied ${Ye} maintenance entries. They are now pending approval.`:`Applied ${Ye} entries. Failed to apply ${Ge} entries.`)}catch(Ye){console.error("Error applying entries:",Ye),alert("Failed to apply entries.")}finally{je(!1)}}),tt=()=>{if(W.length===0){alert("No entries pending approval.");return}Ae(new Set(W.map(Ye=>Ye.name))),ue(!0)},Wt=Ye=>{Ae(Ge=>{const Ct=new Set(Ge);return Ct.has(Ye)?Ct.delete(Ye):Ct.add(Ye),Ct})},pt=()=>{Ae(new Set(W.map(Ye=>Ye.name)))},We=()=>{Ae(new Set)},Nt=()=>Ne(null,null,function*(){if(de.size===0){alert("Please select at least one entry to approve.");return}re(!0);try{let Ye=0,Ge=0;const Ct=[],Ft=W.filter(kt=>de.has(kt.name));for(const kt of Ft)try{const qe=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(kt.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(!qe.data){console.error(`Failed to get document ${kt.name}`),Ge++;continue}const Tt=Ve(ke({},qe.data),{workflow_state:"Approved",docstatus:1}),Hr=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(kt.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(Tt)})).json();if(Hr.data&&Hr.data.docstatus===1)Ye++,Ct.push(kt.name),console.log(`✅ Successfully approved and submitted: ${kt.name}`);else{console.log(`Trying alternative submit method for ${kt.name}...`);const Ir=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:kt.name,workflow_action:"Approve"})}),ca=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:kt.name,method:"submit"})})).json();ca.message||!ca.exc?(Ye++,Ct.push(kt.name),console.log(`✅ Successfully submitted via run_doc_method: ${kt.name}`)):(Ge++,console.error(`Failed to submit ${kt.name}:`,ca))}}catch(Re){Ge++,console.error(`Error approving ${kt.name}:`,Re)}const Dr=[{id:Date.now().toString(),user:pe||"Unknown User",timestamp:new Date().toISOString(),action:"Approved",entriesCount:Ye,entries:Ct},...se];he(Dr),r&&localStorage.setItem(`ppm_activity_${r}`,JSON.stringify(Dr)),ue(!1),Ae(new Set),setTimeout(()=>{O(),f()},1e3),alert(Ge===0?`Successfully approved and submitted ${Ye} maintenance entries. New planned entries should be created automatically.`:`Approved ${Ye} entries. Failed to approve ${Ge} entries.`)}catch(Ye){console.error("Error approving entries:",Ye),alert("Failed to approve entries.")}finally{re(!1)}}),At=Ye=>{switch(Ye){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"}},Qt=Ye=>C.filter(Ct=>Ct.asset_name===Ye).filter(Ct=>{const Ft=Ct.maintenance_status==="Planned"&&(!Ct.workflow_state||Ct.workflow_state==="Draft"),Jt=Ct.workflow_state==="Applied";return Ft||Jt}),cr=Ye=>Qt(Ye).length>0,He=()=>n!=null&&n.maintenance_entries?n.maintenance_entries.filter(Ye=>cr(Ye.asset)):[];if(o)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(fs,{className:"animate-spin text-blue-600",size:24}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Loading PPM Planner..."})]})});if(u)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:u}),a.jsx("button",{onClick:()=>t("/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(!n)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:()=>t("/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=n.docstatus===0,Zt=n.docstatus===1;n.docstatus;const yr=He();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:()=>t("/ppm-planner"),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a.jsx(Ki,{className:"text-gray-600 dark:text-gray-400"})}),a.jsx(Yo,{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:n.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 ${Zt?"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:Zt?"Submitted":It?"Draft":"Cancelled"})]}),a.jsxs("div",{className:"flex gap-2",children:[Zt&&a.jsxs("div",{className:"flex gap-2 mr-4 pr-4 border-r border-gray-300 dark:border-gray-600",children:[_e.length>0&&a.jsxs("button",{onClick:Kt,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(bf,{}),"Bulk Complete(",_e.length,")"]}),W.length>0&&a.jsxs("button",{onClick:tt,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(_f,{}),"Approve (",W.length,")"]})]}),It&&!I&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>M(!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(rs,{}),"Edit"]}),a.jsxs("button",{onClick:ht,disabled:N,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(Ua,{}),"Submit"]}),a.jsxs("button",{onClick:()=>z(!0),disabled:N,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(la,{}),"Delete"]})]}),I&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:zt,disabled:N,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:[N?a.jsx(fs,{className:"animate-spin"}):a.jsx(Tn,{}),"Save"]}),a.jsx("button",{onClick:()=>{M(!1),ft({hospital:n.hospital||"",modality:n.modality||"",device_status:n.device_status||"",start_date:n.start_date||"",end_date:n.end_date||"",maintenance_team:n.maintenance_team||"",maintenance_manager:n.maintenance_manager||"",periodicity:n.periodicity||"Monthly",assign_to:n.assign_to||"",due_date:n.due_date||"",next_pm_date:n.next_pm_date||"",manufacturer:n.manufacturer||"",model:n.model||"",pm_for:n.pm_for||"",asset_name:n.asset_name||"",no_of_pms:n.no_of_pms||""})},disabled:N,className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-colors disabled:opacity-50",children:"Cancel"})]}),Zt&&a.jsx("button",{onClick:tr,disabled:N,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"})]})]}),Zt&&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:"}),_e.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:[_e.length," Planned"]}),W.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:[W.length," Pending Approval"]}),_e.length===0&&W.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:I?a.jsx(er,{label:"Hospital *",doctype:"Company",value:Fe.hospital,onChange:Ye=>ft(Ge=>Ve(ke({},Ge),{hospital:Ye})),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:n.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"}),I?a.jsx("input",{type:"text",name:"modality",value:Fe.modality,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"device_status",value:Fe.device_status,onChange:Lt,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:n.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 *"}),I?a.jsxs("select",{name:"periodicity",value:Fe.periodicity,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"manufacturer",value:Fe.manufacturer,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"model",value:Fe.model,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"pm_for",value:Fe.pm_for,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"asset_name",value:Fe.asset_name,onChange:Lt,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:n.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 *"}),I?a.jsx("input",{type:"date",name:"start_date",value:Fe.start_date,onChange:Lt,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:n.start_date?new Date(n.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 *"}),I?a.jsx("input",{type:"date",name:"end_date",value:Fe.end_date,onChange:Lt,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:n.end_date?new Date(n.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"}),I?a.jsx("input",{type:"date",name:"due_date",value:Fe.due_date,onChange:Lt,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:n.due_date?new Date(n.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"}),I?a.jsx("input",{type:"date",name:"next_pm_date",value:Fe.next_pm_date,onChange:Lt,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:Fe.next_pm_date?new Date(Fe.next_pm_date).toLocaleDateString():n.next_pm_date?new Date(n.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"}),I?a.jsx("input",{type:"number",name:"no_of_pms",value:Fe.no_of_pms,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"maintenance_team",value:Fe.maintenance_team,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"maintenance_manager",value:Fe.maintenance_manager,onChange:Lt,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:n.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"}),I?a.jsx("input",{type:"text",name:"assign_to",value:Fe.assign_to,onChange:Lt,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:n.assign_to||"-"})]})]})]}),yr.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:yr.map((Ye,Ge)=>{const Ct=Qt(Ye.asset);return Ct.map((Ft,Jt)=>a.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[Jt===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:Ct.length,children:Ye.asset?a.jsx("button",{onClick:()=>t(`/assets/${Ye.asset}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:Ye.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:Ct.length,children:Ye.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:Ct.length,children:Ye.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:()=>t(`/maintenance/${Ft.name}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:Ft.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 ${Ft.workflow_state==="Applied"?At("Applied"):At("Planned")}`,children:Ft.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:Ft.due_date?new Date(Ft.due_date).toLocaleDateString():"-"})]},`${Ye.name}-${Ft.name}`))})})]})})]}),Zt&&yr.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(Ua,{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:n.creation?new Date(n.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:n.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:n.modified?new Date(n.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:n.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(ox,{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"})]}),se.length===0?a.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[a.jsx(ox,{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:se.map(Ye=>a.jsx("div",{className:`rounded-lg p-3 border ${Ye.action==="Approved"?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":Ye.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 ${Ye.action==="Approved"?"bg-green-100 dark:bg-green-900/30":Ye.action==="Applied"?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-600"}`,children:Ye.action==="Approved"?a.jsx(_f,{className:"text-green-600 dark:text-green-400 text-sm"}):a.jsx(bf,{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 ${Ye.action==="Approved"?"text-green-800 dark:text-green-300":Ye.action==="Applied"?"text-blue-800 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:Ye.action}),a.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx(Gf,{className:"text-[10px]"}),a.jsx("span",{className:"truncate",children:Ye.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(Tl,{className:"text-[10px]"}),a.jsx("span",{children:new Date(Ye.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 ${Ye.action==="Approved"?"text-green-600 dark:text-green-400":"text-blue-600 dark:text-blue-400"}`,children:Ye.entriesCount})]}),Ye.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(Ye.completionDate).toLocaleDateString()})]})]})})]})]})},Ye.id))})]})})]}),B&&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(bf,{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:[me.size," of ",_e.length," ",_e.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:ve,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:Le,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:_e.map((Ye,Ge)=>a.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${me.has(Ye.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:me.has(Ye.name),onChange:()=>gt(Ye.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:Ge+1}),a.jsxs("div",{className:"truncate",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ye.asset_display_name||Ye.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:Ye.name})]})]}),Ye.due_date&&a.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Due: ",new Date(Ye.due_date).toLocaleDateString()]})]})]},Ye.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:[me.size," selected"]}),me.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:H,onChange:Ye=>q(Ye.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"})]}),Fe.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(Yo,{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(Fe.next_pm_date).toLocaleDateString()})]})]})}),J&&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:ne,onChange:Ye=>V(Ye.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:()=>{U(!1),q(""),V(""),Se(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:Te,children:"Cancel"}),a.jsx("button",{onClick:ut,disabled:Te||!H||me.size===0||J&&!ne.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:Te?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(bf,{}),"Complete (",me.size,")"]})})]})]})}),Oe&&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(_f,{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:[de.size," of ",W.length," ",W.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:pt,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:We,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:W.map((Ye,Ge)=>a.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${de.has(Ye.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:de.has(Ye.name),onChange:()=>Wt(Ye.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:Ge+1}),a.jsxs("div",{className:"truncate",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ye.asset_display_name||Ye.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:Ye.name})]})]}),Ye.completion_date&&a.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Completed: ",new Date(Ye.completion_date).toLocaleDateString()]})]})]},Ye.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:[de.size," selected"]}),de.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:()=>{ue(!1),Ae(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:be,children:"Cancel"}),a.jsx("button",{onClick:Nt,disabled:be||de.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:be?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Approving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(_f,{}),"Approve (",de.size,")"]})})]})]})}),D&&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:()=>z(!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:N,children:"Cancel"}),a.jsx("button",{onClick:Ht,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:N,children:N?"Deleting...":"Delete"})]})]})})]})},LR=({month:e,year:r,filters:t={},viewType:n="maintenance-log",timeView:o="day-month"})=>{const u=ma(),f=new Date,[g,v]=R.useState(e!=null?e:f.getMonth()),[p,k]=R.useState(r!=null?r:f.getFullYear()),N=new Date(p,g,1).toISOString().split("T")[0],C=new Date(p,g+1,0).toISOString().split("T")[0],O=JSON.stringify(t),I=R.useMemo(()=>t,[O]),M=R.useMemo(()=>ke({due_date:["between",[N,C]]},I),[N,C,I]),D=R.useMemo(()=>({}),[]),z=R.useMemo(()=>({}),[]),{logs:B,loading:U}=ph(n==="maintenance-log"?M:D,n==="maintenance-log"?1e3:0,0,"due_date asc"),{pmSchedules:H,loading:q}=hp(n==="ppm-planner"?I:D,1e3,0,"creation desc",z),ne=n==="maintenance-log"?U:q,V=R.useMemo(()=>n==="maintenance-log"?B.filter(re=>{if(!re.due_date)return!1;const de=new Date(re.due_date);return de.getMonth()===g&&de.getFullYear()===p}):H.filter(de=>{const Ae=de.due_date||de.start_date;if(!Ae)return!1;const[_e,K,W]=Ae.split("-").map(Number),ae=new Date(_e,K-1,W);return ae.getMonth()===g&&ae.getFullYear()===p}),[B,H,g,p,n]);R.useEffect(()=>{n==="ppm-planner"&&!q&&(console.log("=== PPM PLANNER DEBUG ==="),console.log("[MaintenanceCalendar] Viewing Month:",g+1,"Year:",p),console.log("[MaintenanceCalendar] Total PM Schedules fetched:",H.length),console.log("[MaintenanceCalendar] Filtered for current month:",V.length),V.length>0?(console.log("[MaintenanceCalendar] Schedules showing in this month:"),V.forEach(re=>{console.log(` - ${re.name}: due_date=${re.due_date}, start_date=${re.start_date}`)})):(console.log("[MaintenanceCalendar] No schedules match this month."),console.log("[MaintenanceCalendar] Due dates in fetched data:"),H.slice(0,5).forEach(re=>{const de=re.due_date||re.start_date;console.log(` - ${re.name}: due_date=${re.due_date}, start_date=${re.start_date}, will show in: ${de?(()=>{const[Ae,_e]=de.split("-").map(Number);return`${_e}/${Ae}`})():"unknown"}`)}),console.log("[MaintenanceCalendar] TIP: Navigate to the month where due_dates match to see schedules.")),console.log("========================="))},[n,H,q,V.length,g,p]);const J=(re,de)=>{const Ae=new Date(de)<new Date&&re!=="Completed";switch(re){case"Completed":return"bg-green-500 text-white border-green-600";case"Planned":return Ae?"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"}},Q=new Date(p,g,1).getDay(),Te=new Date(p,g+1,0).getDate(),je=Array.from({length:Te},(re,de)=>de+1),me=re=>{re>0?g===11?(v(0),k(p+1)):v(g+1):g===0?(v(11),k(p-1)):v(g-1)},Se=re=>n==="maintenance-log"?V.filter(de=>de.due_date?new Date(de.due_date).getDate()===re:!1):V.filter(Ae=>{const _e=Ae.due_date||Ae.start_date;if(!_e)return!1;const[K,W,ae]=_e.split("-").map(Number),se=new Date(K,W-1,ae);return se.getDate()===re&&se.getMonth()===g&&se.getFullYear()===p}),Oe=()=>{v(f.getMonth()),k(f.getFullYear())},ue=["January","February","March","April","May","June","July","August","September","October","November","December"],be=["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(Yo,{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:[ue[g]," ",p]})]}),a.jsxs("div",{className:"flex gap-1 lg:gap-2",children:[a.jsx("button",{onClick:()=>me(-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(yh,{})}),a.jsx("button",{onClick:Oe,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:()=>me(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(bh,{})})]})]}),ne?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 ",n==="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:be.map(re=>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:re},re))}),a.jsxs("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 auto-rows-fr",children:[Array.from({length:Q}).map((re,de)=>a.jsx("div",{className:"p-1 lg:p-2"},`empty-${de}`)),je.map(re=>{const de=Se(re),Ae=re===f.getDate()&&g===f.getMonth()&&p===f.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 ${Ae?"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 ${Ae?"text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300"}`,children:re}),a.jsxs("div",{className:"space-y-1 flex-1 overflow-hidden",children:[de.slice(0,2).map(_e=>{if(n==="maintenance-log"){const K=_e,W=new Date(K.due_date||"")<new Date&&K.maintenance_status!=="Completed";return a.jsx("div",{onClick:()=>u(`/maintenance/${K.name}`),className:`text-xs p-1 rounded border ${J(K.maintenance_status||"Planned",K.due_date||"")} truncate cursor-pointer hover:opacity-80 transition-opacity`,title:`${K.asset_name||K.name} - ${K.maintenance_status||"Planned"}${W?" (Overdue)":""} - Click to view details`,children:a.jsx("div",{className:"truncate font-medium text-xs",children:K.asset_name||K.name})},K.name)}else{const K=_e,ae=K.pm_for||K.pm_for||K["PM Name"]||null||K.name||"PPM Planner",se=K.name?`${K.name}${K.modality?` - ${K.modality}`:""}${K.hospital?` - ${K.hospital}`:""} - Click to view PPM Planner`:"Click to view PPM Planner";return a.jsx("div",{onClick:()=>u(`/ppm-planner/${K.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:se,children:a.jsx("div",{className:"truncate font-medium text-xs",children:ae})},K.name)}}),de.length>2&&a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["+",de.length-2]})]})]},re)})]})]}),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:n==="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:V.filter(re=>re.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:V.filter(re=>re.maintenance_status==="Planned"&&new Date(re.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:V.filter(re=>new Date(re.due_date||"")<new Date&&re.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:V.length}),a.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"PPM Planners"})]})})]})})]})]})},PR=()=>{const e=ma(),[r]=Rl(),[t,n]=R.useState(""),[o,u]=R.useState(""),[f,g]=R.useState(""),[v,p]=R.useState("");R.useEffect(()=>{const U=r.get("hospital"),H=r.get("status");U&&n(U),H&&g(H)},[r]);const[k,N]=R.useState("maintenance-log"),[C,O]=R.useState(!1),[I,M]=R.useState(0);R.useEffect(()=>{const U=[t,o,f,v].filter(Boolean).length;M(U)},[t,o,f,v]);const D=()=>{n(""),u(""),g(""),p("")},z=t||o||f||v,B=R.useMemo(()=>{const U={};return t&&(U.company=t),o&&(U.department=o),f&&(U.maintenance_status=f),v&&(U.assign_to_name=v),U},[t,o,f,v]);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(Yo,{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:k,onChange:U=>N(U.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:()=>O(!C),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 ${z?"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($i,{size:14}),a.jsx("span",{className:"hidden sm:inline",children:"Filters"}),I>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:I}),C?a.jsx(ru,{size:12}):a.jsx(Td,{size:12})]})]}),k==="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(n5,{size:14}),a.jsx("span",{className:"hidden sm:inline",children:"Yearly Map"}),a.jsx("span",{className:"sm:hidden",children:"Map"})]})]})]})]}),C&&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(er,{label:"Hospital",doctype:"Company",value:t,onChange:U=>n(U),placeholder:"Select Hospital",compact:!0}),t&&a.jsx("button",{onClick:()=>n(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[55]",children:[a.jsx(er,{label:"Department",doctype:"Department",value:o,onChange:U=>u(U),placeholder:"All Departments",compact:!0}),o&&a.jsx("button",{onClick:()=>u(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:f,onChange:U=>g(U.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"})]}),f&&a.jsx("button",{onClick:()=>g(""),className:"absolute right-8 top-7 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[50]",children:[a.jsx(er,{label:"Assigned To",doctype:"User",value:v,onChange:U=>p(U),placeholder:"All Technicians",compact:!0}),v&&a.jsx("button",{onClick:()=>p(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]})]}),z&&a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsxs("button",{onClick:D,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(Yt,{}),"Clear Filters"]})})]})]}),a.jsx("div",{className:"flex-1 overflow-hidden px-3 pb-3 lg:px-4 lg:pb-4",children:a.jsx(LR,{filters:B,viewType:k,timeView:"day-month"})})]})},Sv=()=>{const e=ma(),[r,t]=R.useState(2025),[n,o]=R.useState(2030),u=R.useMemo(()=>({}),[]),f=R.useMemo(()=>({}),[]),{pmSchedules:g,loading:v,error:p}=hp(u,1e3,0,"creation desc",f),k=(M,D,z,B,U)=>{const H=M.toLowerCase().trim(),q=D.getFullYear(),ne=D.getMonth(),V=new Date(B,U,1),J=new Date(B,U+1,0,23,59,59,999);if(V>z||J<D)return!1;const Q=(B-q)*12+(U-ne);switch(H){case"daily":return V<=z&&J>=D;case"weekly":return V<=z&&J>=D;case"monthly":return Q>=0&&V<=z;case"quarterly":return Q>=0&&Q%3===0&&V<=z;case"half-yearly":case"half yearly":return Q>=0&&Q%6===0&&V<=z;case"yearly":case"annually":return U===ne&&V<=z&&V>=D;case"2 yearly":case"2-yearly":return Q>=0&&Q%24===0&&V<=z;case"3 yearly":case"3-yearly":return Q>=0&&Q%36===0&&V<=z;default:return V<=z&&J>=D}},N=R.useMemo(()=>{const M={};for(let D=r;D<=n;D++){M[D]={};for(let z=0;z<12;z++)M[D][z]=[]}return g.forEach(D=>{let z=null,B=null;if(D.start_date){const[q,ne,V]=D.start_date.split("-").map(Number)}if(D.end_date){const[q,ne,V]=D.end_date.split("-").map(Number);z=new Date(q,ne-1,V)}if(D.due_date){const[q,ne,V]=D.due_date.split("-").map(Number);B=new Date(q,ne-1,V)}if(!B)return;const U=z||B,H=D.periodicity||"monthly";for(let q=r;q<=n;q++)for(let ne=0;ne<12;ne++)k(H,B,U,q,ne)&&(M[q][ne].some(J=>J.name===D.name)||M[q][ne].push(D))}),M},[g,r,n]);R.useEffect(()=>{v||(console.log("[YearlyPPMPlannerPage] PM Schedules count:",g.length),console.log("[YearlyPPMPlannerPage] Matrix years:",r,"to",n))},[g,v,r,n]);const C=M=>{t(D=>D+M),o(D=>D+M)},O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],I=Array.from({length:n-r+1},(M,D)=>r+D);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(Ki,{className:"text-gray-600 dark:text-gray-400",size:18})}),a.jsx(Yo,{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(If,{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:()=>C(-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(yh,{})}),a.jsxs("h2",{className:"text-lg font-bold text-gray-800 dark:text-white",children:[r," - ",n]}),a.jsx("button",{onClick:()=>C(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(bh,{})})]})})}),a.jsx("div",{className:"flex-1 overflow-auto px-3 pb-3 lg:px-4 lg:pb-4",children:v?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..."})]}):p?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: ",p]})})}):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"}),O.map((M,D)=>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:M},D))]})}),a.jsx("tbody",{children:I.map(M=>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:M}),O.map((D,z)=>{var U;const B=((U=N[M])==null?void 0:U[z])||[];return a.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-2 py-2 align-top min-h-[60px]",children:B.length>0?a.jsx("div",{className:"space-y-1",children:B.map(H=>{const q=H.pm_for||H.pm_for||H["PM Name"]||null;B.indexOf(H)===0&&console.log("[YearlyCalendar] 🔍 SCHEDULE IN CELL:",{name:H.name,pm_for:H.pm_for,"pm_for (bracket)":H.pm_for,allKeys:Object.keys(H),pmName:q});const ne=q||H.name||"PPM Planner",V=[];H.name&&V.push(H.name),H.modality&&V.push(H.modality),H.hospital&&V.push(H.hospital);const J=V.length>0?`${V.join(" - ")} - Click to view details`:"Click to view details";return a.jsx("div",{onClick:()=>e(`/ppm-planner/${H.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:J,children:a.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-300 leading-tight group-hover:underline break-words",children:ne})},H.name)})}):a.jsx("div",{className:"text-xs text-gray-300 dark:text-gray-700 text-center py-1",children:"-"})},z)})]},M))})]})})})})]})};function F4(e,r){const t=R.useRef(r);R.useEffect(function(){r!==t.current&&e.attributionControl!=null&&(t.current!=null&&e.attributionControl.removeAttribution(t.current),r!=null&&e.attributionControl.addAttribution(r)),t.current=r},[e,r])}const FR=1;function BR(e){return Object.freeze({__version:FR,map:e})}function UR(e,r){return Object.freeze(ke(ke({},e),r))}const mp=R.createContext(null);function gp(){const e=R.use(mp);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function zR(e){function r(t,n){const{instance:o,context:u}=e(t).current;R.useImperativeHandle(n,()=>o);const{children:f}=t;return f==null?null:Zr.createElement(mp,{value:u},f)}return R.forwardRef(r)}function HR(e){function r(t,n){const[o,u]=R.useState(!1),{instance:f}=e(t,u).current;R.useImperativeHandle(n,()=>f),R.useEffect(function(){o&&f.update()},[f,o,t.children]);const g=f._contentNode;return g?Dx.createPortal(t.children,g):null}return R.forwardRef(r)}function WR(e){function r(t,n){const{instance:o}=e(t).current;return R.useImperativeHandle(n,()=>o),null}return R.forwardRef(r)}function B4(e,r){const t=R.useRef(void 0);R.useEffect(function(){return r!=null&&e.instance.on(r),t.current=r,function(){t.current!=null&&e.instance.off(t.current),t.current=null}},[e,r])}function xp(e,r){var n;const t=(n=e.pane)!=null?n:r.pane;return t?Ve(ke({},e),{pane:t}):e}function VR(e,r){return function(n,o){const u=gp(),f=e(xp(n,u),u);return F4(u.map,n.attribution),B4(f.current,n.eventHandlers),r(f.current,u,n,o),f}}var M0={exports:{}};var GR=M0.exports,Ev;function XR(){return Ev||(Ev=1,(function(e,r){(function(t,n){n(r)})(GR,(function(t){var n="1.9.4";function o(d){var b,E,F,X;for(E=1,F=arguments.length;E<F;E++){X=arguments[E];for(b in X)d[b]=X[b]}return d}var u=Object.create||(function(){function d(){}return function(b){return d.prototype=b,new d}})();function f(d,b){var E=Array.prototype.slice;if(d.bind)return d.bind.apply(d,E.call(arguments,1));var F=E.call(arguments,2);return function(){return d.apply(b,F.length?F.concat(E.call(arguments)):arguments)}}var g=0;function v(d){return"_leaflet_id"in d||(d._leaflet_id=++g),d._leaflet_id}function p(d,b,E){var F,X,le,Me;return Me=function(){F=!1,X&&(le.apply(E,X),X=!1)},le=function(){F?X=arguments:(d.apply(E,arguments),setTimeout(Me,b),F=!0)},le}function k(d,b,E){var F=b[1],X=b[0],le=F-X;return d===F&&E?d:((d-X)%le+le)%le+X}function N(){return!1}function C(d,b){if(b===!1)return d;var E=Math.pow(10,b===void 0?6:b);return Math.round(d*E)/E}function O(d){return d.trim?d.trim():d.replace(/^\s+|\s+$/g,"")}function I(d){return O(d).split(/\s+/)}function M(d,b){Object.prototype.hasOwnProperty.call(d,"options")||(d.options=d.options?u(d.options):{});for(var E in b)d.options[E]=b[E];return d.options}function D(d,b,E){var F=[];for(var X in d)F.push(encodeURIComponent(E?X.toUpperCase():X)+"="+encodeURIComponent(d[X]));return(!b||b.indexOf("?")===-1?"?":"&")+F.join("&")}var z=/\{ *([\w_ -]+) *\}/g;function B(d,b){return d.replace(z,function(E,F){var X=b[F];if(X===void 0)throw new Error("No value provided for variable "+E);return typeof X=="function"&&(X=X(b)),X})}var U=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"};function H(d,b){for(var E=0;E<d.length;E++)if(d[E]===b)return E;return-1}var q="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function ne(d){return window["webkit"+d]||window["moz"+d]||window["ms"+d]}var V=0;function J(d){var b=+new Date,E=Math.max(0,16-(b-V));return V=b+E,window.setTimeout(d,E)}var Q=window.requestAnimationFrame||ne("RequestAnimationFrame")||J,Te=window.cancelAnimationFrame||ne("CancelAnimationFrame")||ne("CancelRequestAnimationFrame")||function(d){window.clearTimeout(d)};function je(d,b,E){if(E&&Q===J)d.call(b);else return Q.call(window,f(d,b))}function me(d){d&&Te.call(window,d)}var Se={__proto__:null,extend:o,create:u,bind:f,get lastId(){return g},stamp:v,throttle:p,wrapNum:k,falseFn:N,formatNum:C,trim:O,splitWords:I,setOptions:M,getParamString:D,template:B,isArray:U,indexOf:H,emptyImageUrl:q,requestFn:Q,cancelFn:Te,requestAnimFrame:je,cancelAnimFrame:me};function Oe(){}Oe.extend=function(d){var b=function(){M(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},E=b.__super__=this.prototype,F=u(E);F.constructor=b,b.prototype=F;for(var X in this)Object.prototype.hasOwnProperty.call(this,X)&&X!=="prototype"&&X!=="__super__"&&(b[X]=this[X]);return d.statics&&o(b,d.statics),d.includes&&(ue(d.includes),o.apply(null,[F].concat(d.includes))),o(F,d),delete F.statics,delete F.includes,F.options&&(F.options=E.options?u(E.options):{},o(F.options,d.options)),F._initHooks=[],F.callInitHooks=function(){if(!this._initHooksCalled){E.callInitHooks&&E.callInitHooks.call(this),this._initHooksCalled=!0;for(var le=0,Me=F._initHooks.length;le<Me;le++)F._initHooks[le].call(this)}},b},Oe.include=function(d){var b=this.prototype.options;return o(this.prototype,d),d.options&&(this.prototype.options=b,this.mergeOptions(d.options)),this},Oe.mergeOptions=function(d){return o(this.prototype.options,d),this},Oe.addInitHook=function(d){var b=Array.prototype.slice.call(arguments,1),E=typeof d=="function"?d:function(){this[d].apply(this,b)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(E),this};function ue(d){if(!(typeof L=="undefined"||!L||!L.Mixin)){d=U(d)?d:[d];for(var b=0;b<d.length;b++)d[b]===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 be={on:function(d,b,E){if(typeof d=="object")for(var F in d)this._on(F,d[F],b);else{d=I(d);for(var X=0,le=d.length;X<le;X++)this._on(d[X],b,E)}return this},off:function(d,b,E){if(!arguments.length)delete this._events;else if(typeof d=="object")for(var F in d)this._off(F,d[F],b);else{d=I(d);for(var X=arguments.length===1,le=0,Me=d.length;le<Me;le++)X?this._off(d[le]):this._off(d[le],b,E)}return this},_on:function(d,b,E,F){if(typeof b!="function"){console.warn("wrong listener type: "+typeof b);return}if(this._listens(d,b,E)===!1){E===this&&(E=void 0);var X={fn:b,ctx:E};F&&(X.once=!0),this._events=this._events||{},this._events[d]=this._events[d]||[],this._events[d].push(X)}},_off:function(d,b,E){var F,X,le;if(this._events&&(F=this._events[d],!!F)){if(arguments.length===1){if(this._firingCount)for(X=0,le=F.length;X<le;X++)F[X].fn=N;delete this._events[d];return}if(typeof b!="function"){console.warn("wrong listener type: "+typeof b);return}var Me=this._listens(d,b,E);if(Me!==!1){var $e=F[Me];this._firingCount&&($e.fn=N,this._events[d]=F=F.slice()),F.splice(Me,1)}}},fire:function(d,b,E){if(!this.listens(d,E))return this;var F=o({},b,{type:d,target:this,sourceTarget:b&&b.sourceTarget||this});if(this._events){var X=this._events[d];if(X){this._firingCount=this._firingCount+1||1;for(var le=0,Me=X.length;le<Me;le++){var $e=X[le],nt=$e.fn;$e.once&&this.off(d,nt,$e.ctx),nt.call($e.ctx||this,F)}this._firingCount--}}return E&&this._propagateEvent(F),this},listens:function(d,b,E,F){typeof d!="string"&&console.warn('"string" type argument expected');var X=b;typeof b!="function"&&(F=!!b,X=void 0,E=void 0);var le=this._events&&this._events[d];if(le&&le.length&&this._listens(d,X,E)!==!1)return!0;if(F){for(var Me in this._eventParents)if(this._eventParents[Me].listens(d,b,E,F))return!0}return!1},_listens:function(d,b,E){if(!this._events)return!1;var F=this._events[d]||[];if(!b)return!!F.length;E===this&&(E=void 0);for(var X=0,le=F.length;X<le;X++)if(F[X].fn===b&&F[X].ctx===E)return X;return!1},once:function(d,b,E){if(typeof d=="object")for(var F in d)this._on(F,d[F],b,!0);else{d=I(d);for(var X=0,le=d.length;X<le;X++)this._on(d[X],b,E,!0)}return this},addEventParent:function(d){return this._eventParents=this._eventParents||{},this._eventParents[v(d)]=d,this},removeEventParent:function(d){return this._eventParents&&delete this._eventParents[v(d)],this},_propagateEvent:function(d){for(var b in this._eventParents)this._eventParents[b].fire(d.type,o({layer:d.target,propagatedFrom:d.target},d),!0)}};be.addEventListener=be.on,be.removeEventListener=be.clearAllEventListeners=be.off,be.addOneTimeEventListener=be.once,be.fireEvent=be.fire,be.hasEventListeners=be.listens;var re=Oe.extend(be);function de(d,b,E){this.x=E?Math.round(d):d,this.y=E?Math.round(b):b}var Ae=Math.trunc||function(d){return d>0?Math.floor(d):Math.ceil(d)};de.prototype={clone:function(){return new de(this.x,this.y)},add:function(d){return this.clone()._add(_e(d))},_add:function(d){return this.x+=d.x,this.y+=d.y,this},subtract:function(d){return this.clone()._subtract(_e(d))},_subtract:function(d){return this.x-=d.x,this.y-=d.y,this},divideBy:function(d){return this.clone()._divideBy(d)},_divideBy:function(d){return this.x/=d,this.y/=d,this},multiplyBy:function(d){return this.clone()._multiplyBy(d)},_multiplyBy:function(d){return this.x*=d,this.y*=d,this},scaleBy:function(d){return new de(this.x*d.x,this.y*d.y)},unscaleBy:function(d){return new de(this.x/d.x,this.y/d.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=Ae(this.x),this.y=Ae(this.y),this},distanceTo:function(d){d=_e(d);var b=d.x-this.x,E=d.y-this.y;return Math.sqrt(b*b+E*E)},equals:function(d){return d=_e(d),d.x===this.x&&d.y===this.y},contains:function(d){return d=_e(d),Math.abs(d.x)<=Math.abs(this.x)&&Math.abs(d.y)<=Math.abs(this.y)},toString:function(){return"Point("+C(this.x)+", "+C(this.y)+")"}};function _e(d,b,E){return d instanceof de?d:U(d)?new de(d[0],d[1]):d==null?d:typeof d=="object"&&"x"in d&&"y"in d?new de(d.x,d.y):new de(d,b,E)}function K(d,b){if(d)for(var E=b?[d,b]:d,F=0,X=E.length;F<X;F++)this.extend(E[F])}K.prototype={extend:function(d){var b,E;if(!d)return this;if(d instanceof de||typeof d[0]=="number"||"x"in d)b=E=_e(d);else if(d=W(d),b=d.min,E=d.max,!b||!E)return this;return!this.min&&!this.max?(this.min=b.clone(),this.max=E.clone()):(this.min.x=Math.min(b.x,this.min.x),this.max.x=Math.max(E.x,this.max.x),this.min.y=Math.min(b.y,this.min.y),this.max.y=Math.max(E.y,this.max.y)),this},getCenter:function(d){return _e((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,d)},getBottomLeft:function(){return _e(this.min.x,this.max.y)},getTopRight:function(){return _e(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(d){var b,E;return typeof d[0]=="number"||d instanceof de?d=_e(d):d=W(d),d instanceof K?(b=d.min,E=d.max):b=E=d,b.x>=this.min.x&&E.x<=this.max.x&&b.y>=this.min.y&&E.y<=this.max.y},intersects:function(d){d=W(d);var b=this.min,E=this.max,F=d.min,X=d.max,le=X.x>=b.x&&F.x<=E.x,Me=X.y>=b.y&&F.y<=E.y;return le&&Me},overlaps:function(d){d=W(d);var b=this.min,E=this.max,F=d.min,X=d.max,le=X.x>b.x&&F.x<E.x,Me=X.y>b.y&&F.y<E.y;return le&&Me},isValid:function(){return!!(this.min&&this.max)},pad:function(d){var b=this.min,E=this.max,F=Math.abs(b.x-E.x)*d,X=Math.abs(b.y-E.y)*d;return W(_e(b.x-F,b.y-X),_e(E.x+F,E.y+X))},equals:function(d){return d?(d=W(d),this.min.equals(d.getTopLeft())&&this.max.equals(d.getBottomRight())):!1}};function W(d,b){return!d||d instanceof K?d:new K(d,b)}function ae(d,b){if(d)for(var E=b?[d,b]:d,F=0,X=E.length;F<X;F++)this.extend(E[F])}ae.prototype={extend:function(d){var b=this._southWest,E=this._northEast,F,X;if(d instanceof he)F=d,X=d;else if(d instanceof ae){if(F=d._southWest,X=d._northEast,!F||!X)return this}else return d?this.extend(pe(d)||se(d)):this;return!b&&!E?(this._southWest=new he(F.lat,F.lng),this._northEast=new he(X.lat,X.lng)):(b.lat=Math.min(F.lat,b.lat),b.lng=Math.min(F.lng,b.lng),E.lat=Math.max(X.lat,E.lat),E.lng=Math.max(X.lng,E.lng)),this},pad:function(d){var b=this._southWest,E=this._northEast,F=Math.abs(b.lat-E.lat)*d,X=Math.abs(b.lng-E.lng)*d;return new ae(new he(b.lat-F,b.lng-X),new he(E.lat+F,E.lng+X))},getCenter:function(){return new he((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 he(this.getNorth(),this.getWest())},getSouthEast:function(){return new he(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(d){typeof d[0]=="number"||d instanceof he||"lat"in d?d=pe(d):d=se(d);var b=this._southWest,E=this._northEast,F,X;return d instanceof ae?(F=d.getSouthWest(),X=d.getNorthEast()):F=X=d,F.lat>=b.lat&&X.lat<=E.lat&&F.lng>=b.lng&&X.lng<=E.lng},intersects:function(d){d=se(d);var b=this._southWest,E=this._northEast,F=d.getSouthWest(),X=d.getNorthEast(),le=X.lat>=b.lat&&F.lat<=E.lat,Me=X.lng>=b.lng&&F.lng<=E.lng;return le&&Me},overlaps:function(d){d=se(d);var b=this._southWest,E=this._northEast,F=d.getSouthWest(),X=d.getNorthEast(),le=X.lat>b.lat&&F.lat<E.lat,Me=X.lng>b.lng&&F.lng<E.lng;return le&&Me},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(d,b){return d?(d=se(d),this._southWest.equals(d.getSouthWest(),b)&&this._northEast.equals(d.getNorthEast(),b)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function se(d,b){return d instanceof ae?d:new ae(d,b)}function he(d,b,E){if(isNaN(d)||isNaN(b))throw new Error("Invalid LatLng object: ("+d+", "+b+")");this.lat=+d,this.lng=+b,E!==void 0&&(this.alt=+E)}he.prototype={equals:function(d,b){if(!d)return!1;d=pe(d);var E=Math.max(Math.abs(this.lat-d.lat),Math.abs(this.lng-d.lng));return E<=(b===void 0?1e-9:b)},toString:function(d){return"LatLng("+C(this.lat,d)+", "+C(this.lng,d)+")"},distanceTo:function(d){return Fe.distance(this,pe(d))},wrap:function(){return Fe.wrapLatLng(this)},toBounds:function(d){var b=180*d/40075017,E=b/Math.cos(Math.PI/180*this.lat);return se([this.lat-b,this.lng-E],[this.lat+b,this.lng+E])},clone:function(){return new he(this.lat,this.lng,this.alt)}};function pe(d,b,E){return d instanceof he?d:U(d)&&typeof d[0]!="object"?d.length===3?new he(d[0],d[1],d[2]):d.length===2?new he(d[0],d[1]):null:d==null?d:typeof d=="object"&&"lat"in d?new he(d.lat,"lng"in d?d.lng:d.lon,d.alt):b===void 0?null:new he(d,b,E)}var Je={latLngToPoint:function(d,b){var E=this.projection.project(d),F=this.scale(b);return this.transformation._transform(E,F)},pointToLatLng:function(d,b){var E=this.scale(b),F=this.transformation.untransform(d,E);return this.projection.unproject(F)},project:function(d){return this.projection.project(d)},unproject:function(d){return this.projection.unproject(d)},scale:function(d){return 256*Math.pow(2,d)},zoom:function(d){return Math.log(d/256)/Math.LN2},getProjectedBounds:function(d){if(this.infinite)return null;var b=this.projection.bounds,E=this.scale(d),F=this.transformation.transform(b.min,E),X=this.transformation.transform(b.max,E);return new K(F,X)},infinite:!1,wrapLatLng:function(d){var b=this.wrapLng?k(d.lng,this.wrapLng,!0):d.lng,E=this.wrapLat?k(d.lat,this.wrapLat,!0):d.lat,F=d.alt;return new he(E,b,F)},wrapLatLngBounds:function(d){var b=d.getCenter(),E=this.wrapLatLng(b),F=b.lat-E.lat,X=b.lng-E.lng;if(F===0&&X===0)return d;var le=d.getSouthWest(),Me=d.getNorthEast(),$e=new he(le.lat-F,le.lng-X),nt=new he(Me.lat-F,Me.lng-X);return new ae($e,nt)}},Fe=o({},Je,{wrapLng:[-180,180],R:6371e3,distance:function(d,b){var E=Math.PI/180,F=d.lat*E,X=b.lat*E,le=Math.sin((b.lat-d.lat)*E/2),Me=Math.sin((b.lng-d.lng)*E/2),$e=le*le+Math.cos(F)*Math.cos(X)*Me*Me,nt=2*Math.atan2(Math.sqrt($e),Math.sqrt(1-$e));return this.R*nt}}),ft=6378137,ot={R:ft,MAX_LATITUDE:85.0511287798,project:function(d){var b=Math.PI/180,E=this.MAX_LATITUDE,F=Math.max(Math.min(E,d.lat),-E),X=Math.sin(F*b);return new de(this.R*d.lng*b,this.R*Math.log((1+X)/(1-X))/2)},unproject:function(d){var b=180/Math.PI;return new he((2*Math.atan(Math.exp(d.y/this.R))-Math.PI/2)*b,d.x*b/this.R)},bounds:(function(){var d=ft*Math.PI;return new K([-d,-d],[d,d])})()};function Lt(d,b,E,F){if(U(d)){this._a=d[0],this._b=d[1],this._c=d[2],this._d=d[3];return}this._a=d,this._b=b,this._c=E,this._d=F}Lt.prototype={transform:function(d,b){return this._transform(d.clone(),b)},_transform:function(d,b){return b=b||1,d.x=b*(this._a*d.x+this._b),d.y=b*(this._c*d.y+this._d),d},untransform:function(d,b){return b=b||1,new de((d.x/b-this._b)/this._a,(d.y/b-this._d)/this._c)}};function zt(d,b,E,F){return new Lt(d,b,E,F)}var Ht=o({},Fe,{code:"EPSG:3857",projection:ot,transformation:(function(){var d=.5/(Math.PI*ot.R);return zt(d,.5,-d,.5)})()}),ht=o({},Ht,{code:"EPSG:900913"});function tr(d){return document.createElementNS("http://www.w3.org/2000/svg",d)}function Kt(d,b){var E="",F,X,le,Me,$e,nt;for(F=0,le=d.length;F<le;F++){for($e=d[F],X=0,Me=$e.length;X<Me;X++)nt=$e[X],E+=(X?"L":"M")+nt.x+" "+nt.y;E+=b?rr.svg?"z":"x":""}return E||"M0 0"}var gt=document.documentElement.style,ve="ActiveXObject"in window,Le=ve&&!document.addEventListener,ut="msLaunchUri"in navigator&&!("documentMode"in document),tt=$r("webkit"),Wt=$r("android"),pt=$r("android 2")||$r("android 3"),We=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Nt=Wt&&$r("Google")&&We<537&&!("AudioNode"in window),At=!!window.opera,Qt=!ut&&$r("chrome"),cr=$r("gecko")&&!tt&&!At&&!ve,He=!Qt&&$r("safari"),It=$r("phantom"),Zt="OTransition"in gt,yr=navigator.platform.indexOf("Win")===0,Ye=ve&&"transition"in gt,Ge="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!pt,Ct="MozPerspective"in gt,Ft=!window.L_DISABLE_3D&&(Ye||Ge||Ct)&&!Zt&&!It,Jt=typeof orientation!="undefined"||$r("mobile"),Dr=Jt&&tt,kt=Jt&&Ge,Re=!window.PointerEvent&&window.MSPointerEvent,qe=!!(window.PointerEvent||Re),Tt="ontouchstart"in window||!!window.TouchEvent,xr=!window.L_NO_TOUCH&&(Tt||qe),Hr=Jt&&At,Ir=Jt&&cr,Pa=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ca=(function(){var d=!1;try{var b=Object.defineProperty({},"passive",{get:function(){d=!0}});window.addEventListener("testPassiveEventSupport",N,b),window.removeEventListener("testPassiveEventSupport",N,b)}catch(E){}return d})(),_n=(function(){return!!document.createElement("canvas").getContext})(),fn=!!(document.createElementNS&&tr("svg").createSVGRect),hn=!!fn&&(function(){var d=document.createElement("div");return d.innerHTML="<svg/>",(d.firstChild&&d.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Xs=!fn&&(function(){try{var d=document.createElement("div");d.innerHTML='<v:shape adj="1"/>';var b=d.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch(E){return!1}})(),Ha=navigator.platform.indexOf("Mac")===0,gs=navigator.platform.indexOf("Linux")===0;function $r(d){return navigator.userAgent.toLowerCase().indexOf(d)>=0}var rr={ie:ve,ielt9:Le,edge:ut,webkit:tt,android:Wt,android23:pt,androidStock:Nt,opera:At,chrome:Qt,gecko:cr,safari:He,phantom:It,opera12:Zt,win:yr,ie3d:Ye,webkit3d:Ge,gecko3d:Ct,any3d:Ft,mobile:Jt,mobileWebkit:Dr,mobileWebkit3d:kt,msPointer:Re,pointer:qe,touch:xr,touchNative:Tt,mobileOpera:Hr,mobileGecko:Ir,retina:Pa,passiveEvents:ca,canvas:_n,svg:fn,vml:Xs,inlineSvg:hn,mac:Ha,linux:gs},ie=rr.msPointer?"MSPointerDown":"pointerdown",Z=rr.msPointer?"MSPointerMove":"pointermove",ce=rr.msPointer?"MSPointerUp":"pointerup",xe=rr.msPointer?"MSPointerCancel":"pointercancel",ye={touchstart:ie,touchmove:Z,touchend:ce,touchcancel:xe},Ee={touchstart:Ut,touchmove:Rt,touchend:Rt,touchcancel:Rt},ge={},Be=!1;function ze(d,b,E){return b==="touchstart"&&Ot(),Ee[b]?(E=Ee[b].bind(this,E),d.addEventListener(ye[b],E,!1),E):(console.warn("wrong event specified:",b),N)}function Ze(d,b,E){if(!ye[b]){console.warn("wrong event specified:",b);return}d.removeEventListener(ye[b],E,!1)}function et(d){ge[d.pointerId]=d}function _t(d){ge[d.pointerId]&&(ge[d.pointerId]=d)}function vt(d){delete ge[d.pointerId]}function Ot(){Be||(document.addEventListener(ie,et,!0),document.addEventListener(Z,_t,!0),document.addEventListener(ce,vt,!0),document.addEventListener(xe,vt,!0),Be=!0)}function Rt(d,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var E in ge)b.touches.push(ge[E]);b.changedTouches=[b],d(b)}}function Ut(d,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&Fa(b),Rt(d,b)}function nr(d){var b={},E,F;for(F in d)E=d[F],b[F]=E&&E.bind?E.bind(d):E;return d=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var ct=200;function ga(d,b){d.addEventListener("dblclick",b);var E=0,F;function X(le){if(le.detail!==1){F=le.detail;return}if(!(le.pointerType==="mouse"||le.sourceCapabilities&&!le.sourceCapabilities.firesTouchEvents)){var Me=Zs(le);if(!(Me.some(function(nt){return nt instanceof HTMLLabelElement&&nt.attributes.for})&&!Me.some(function(nt){return nt instanceof HTMLInputElement||nt instanceof HTMLSelectElement}))){var $e=Date.now();$e-E<=ct?(F++,F===2&&b(nr(le))):F=1,E=$e}}}return d.addEventListener("click",X),{dblclick:b,simDblclick:X}}function kr(d,b){d.removeEventListener("dblclick",b.dblclick),d.removeEventListener("click",b.simDblclick)}var Wa=Qe(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),xs=Qe(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Or=xs==="webkitTransition"||xs==="OTransition"?xs+"End":"transitionend";function Cr(d){return typeof d=="string"?document.getElementById(d):d}function Nr(d,b){var E=d.style[b]||d.currentStyle&&d.currentStyle[b];if((!E||E==="auto")&&document.defaultView){var F=document.defaultView.getComputedStyle(d,null);E=F?F[b]:null}return E==="auto"?null:E}function br(d,b,E){var F=document.createElement(d);return F.className=b||"",E&&E.appendChild(F),F}function ea(d){var b=d.parentNode;b&&b.removeChild(d)}function jn(d){for(;d.firstChild;)d.removeChild(d.firstChild)}function Br(d){var b=d.parentNode;b&&b.lastChild!==d&&b.appendChild(d)}function On(d){var b=d.parentNode;b&&b.firstChild!==d&&b.insertBefore(d,b.firstChild)}function Il(d,b){if(d.classList!==void 0)return d.classList.contains(b);var E=Ys(d);return E.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(E)}function or(d,b){if(d.classList!==void 0)for(var E=I(b),F=0,X=E.length;F<X;F++)d.classList.add(E[F]);else if(!Il(d,b)){var le=Ys(d);Qi(d,(le?le+" ":"")+b)}}function Kr(d,b){d.classList!==void 0?d.classList.remove(b):Qi(d,O((" "+Ys(d)+" ").replace(" "+b+" "," ")))}function Qi(d,b){d.className.baseVal===void 0?d.className=b:d.className.baseVal=b}function Ys(d){return d.correspondingElement&&(d=d.correspondingElement),d.className.baseVal===void 0?d.className:d.className.baseVal}function pr(d,b){"opacity"in d.style?d.style.opacity=b:"filter"in d.style&&Ya(d,b)}function Ya(d,b){var E=!1,F="DXImageTransform.Microsoft.Alpha";try{E=d.filters.item(F)}catch(X){if(b===1)return}b=Math.round(b*100),E?(E.Enabled=b!==100,E.Opacity=b):d.style.filter+=" progid:"+F+"(opacity="+b+")"}function Qe(d){for(var b=document.documentElement.style,E=0;E<d.length;E++)if(d[E]in b)return d[E];return!1}function we(d,b,E){var F=b||new de(0,0);d.style[Wa]=(rr.ie3d?"translate("+F.x+"px,"+F.y+"px)":"translate3d("+F.x+"px,"+F.y+"px,0)")+(E?" scale("+E+")":"")}function Gt(d,b){d._leaflet_pos=b,rr.any3d?we(d,b):(d.style.left=b.x+"px",d.style.top=b.y+"px")}function pa(d){return d._leaflet_pos||new de(0,0)}var an,Ts,yo;if("onselectstart"in document)an=function(){mr(window,"selectstart",Fa)},Ts=function(){qt(window,"selectstart",Fa)};else{var nn=Qe(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);an=function(){if(nn){var d=document.documentElement.style;yo=d[nn],d[nn]="none"}},Ts=function(){nn&&(document.documentElement.style[nn]=yo,yo=void 0)}}function ur(){mr(window,"dragstart",Fa)}function da(){qt(window,"dragstart",Fa)}var bo,Ll;function mi(d){for(;d.tabIndex===-1;)d=d.parentNode;d.style&&(wn(),bo=d,Ll=d.style.outlineStyle,d.style.outlineStyle="none",mr(window,"keydown",wn))}function wn(){bo&&(bo.style.outlineStyle=Ll,bo=void 0,Ll=void 0,qt(window,"keydown",wn))}function eo(d){do d=d.parentNode;while((!d.offsetWidth||!d.offsetHeight)&&d!==document.body);return d}function vo(d){var b=d.getBoundingClientRect();return{x:b.width/d.offsetWidth||1,y:b.height/d.offsetHeight||1,boundingClientRect:b}}var ja={__proto__:null,TRANSFORM:Wa,TRANSITION:xs,TRANSITION_END:Or,get:Cr,getStyle:Nr,create:br,remove:ea,empty:jn,toFront:Br,toBack:On,hasClass:Il,addClass:or,removeClass:Kr,setClass:Qi,getClass:Ys,setOpacity:pr,testProp:Qe,setTransform:we,setPosition:Gt,getPosition:pa,get disableTextSelection(){return an},get enableTextSelection(){return Ts},disableImageDrag:ur,enableImageDrag:da,preventOutline:mi,restoreOutline:wn,getSizedParentNode:eo,getScale:vo};function mr(d,b,E,F){if(b&&typeof b=="object")for(var X in b)ua(d,X,b[X],E);else{b=I(b);for(var le=0,Me=b.length;le<Me;le++)ua(d,b[le],E,F)}return this}var Za="_leaflet_events";function qt(d,b,E,F){if(arguments.length===1)Pl(d),delete d[Za];else if(b&&typeof b=="object")for(var X in b)_o(d,X,b[X],E);else if(b=I(b),arguments.length===2)Pl(d,function($e){return H(b,$e)!==-1});else for(var le=0,Me=b.length;le<Me;le++)_o(d,b[le],E,F);return this}function Pl(d,b){for(var E in d[Za]){var F=E.split(/\d/)[0];(!b||b(F))&&_o(d,F,null,null,E)}}var _r={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ua(d,b,E,F){var X=b+v(E)+(F?"_"+v(F):"");if(d[Za]&&d[Za][X])return this;var le=function($e){return E.call(F||d,$e||window.event)},Me=le;!rr.touchNative&&rr.pointer&&b.indexOf("touch")===0?le=ze(d,b,le):rr.touch&&b==="dblclick"?le=ga(d,le):"addEventListener"in d?b==="touchstart"||b==="touchmove"||b==="wheel"||b==="mousewheel"?d.addEventListener(_r[b]||b,le,rr.passiveEvents?{passive:!1}:!1):b==="mouseenter"||b==="mouseleave"?(le=function($e){$e=$e||window.event,Vn(d,$e)&&Me($e)},d.addEventListener(_r[b],le,!1)):d.addEventListener(b,Me,!1):d.attachEvent("on"+b,le),d[Za]=d[Za]||{},d[Za][X]=le}function _o(d,b,E,F,X){X=X||b+v(E)+(F?"_"+v(F):"");var le=d[Za]&&d[Za][X];if(!le)return this;!rr.touchNative&&rr.pointer&&b.indexOf("touch")===0?Ze(d,b,le):rr.touch&&b==="dblclick"?kr(d,le):"removeEventListener"in d?d.removeEventListener(_r[b]||b,le,!1):d.detachEvent("on"+b,le),d[Za][X]=null}function Hn(d){return d.stopPropagation?d.stopPropagation():d.originalEvent?d.originalEvent._stopped=!0:d.cancelBubble=!0,this}function ps(d){return ua(d,"wheel",Hn),this}function Wn(d){return mr(d,"mousedown touchstart dblclick contextmenu",Hn),d._leaflet_disable_click=!0,this}function Fa(d){return d.preventDefault?d.preventDefault():d.returnValue=!1,this}function ns(d){return Fa(d),Hn(d),this}function Zs(d){if(d.composedPath)return d.composedPath();for(var b=[],E=d.target;E;)b.push(E),E=E.parentNode;return b}function $s(d,b){if(!b)return new de(d.clientX,d.clientY);var E=vo(b),F=E.boundingClientRect;return new de((d.clientX-F.left)/E.x-b.clientLeft,(d.clientY-F.top)/E.y-b.clientTop)}var Fl=rr.linux&&rr.chrome?window.devicePixelRatio:rr.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Va(d){return rr.edge?d.wheelDeltaY/2:d.deltaY&&d.deltaMode===0?-d.deltaY/Fl:d.deltaY&&d.deltaMode===1?-d.deltaY*20:d.deltaY&&d.deltaMode===2?-d.deltaY*60:d.deltaX||d.deltaZ?0:d.wheelDelta?(d.wheelDeltaY||d.wheelDelta)/2:d.detail&&Math.abs(d.detail)<32765?-d.detail*20:d.detail?d.detail/-32765*60:0}function Vn(d,b){var E=b.relatedTarget;if(!E)return!0;try{for(;E&&E!==d;)E=E.parentNode}catch(F){return!1}return E!==d}var sn={__proto__:null,on:mr,off:qt,stopPropagation:Hn,disableScrollPropagation:ps,disableClickPropagation:Wn,preventDefault:Fa,stop:ns,getPropagationPath:Zs,getMousePosition:$s,getWheelDelta:Va,isExternalTarget:Vn,addListener:mr,removeListener:qt},ji=re.extend({run:function(d,b,E,F){this.stop(),this._el=d,this._inProgress=!0,this._duration=E||.25,this._easeOutPower=1/Math.max(F||.5,.2),this._startPos=pa(d),this._offset=b.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=je(this._animate,this),this._step()},_step:function(d){var b=+new Date-this._startTime,E=this._duration*1e3;b<E?this._runFrame(this._easeOut(b/E),d):(this._runFrame(1),this._complete())},_runFrame:function(d,b){var E=this._startPos.add(this._offset.multiplyBy(d));b&&E._round(),Gt(this._el,E),this.fire("step")},_complete:function(){me(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(d){return 1-Math.pow(1-d,this._easeOutPower)}}),Ur=re.extend({options:{crs:Ht,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(d,b){b=M(this,b),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(d),this._initLayout(),this._onResize=f(this._onResize,this),this._initEvents(),b.maxBounds&&this.setMaxBounds(b.maxBounds),b.zoom!==void 0&&(this._zoom=this._limitZoom(b.zoom)),b.center&&b.zoom!==void 0&&this.setView(pe(b.center),b.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=xs&&rr.any3d&&!rr.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),mr(this._proxy,Or,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(d,b,E){if(b=b===void 0?this._zoom:this._limitZoom(b),d=this._limitCenter(pe(d),b,this.options.maxBounds),E=E||{},this._stop(),this._loaded&&!E.reset&&E!==!0){E.animate!==void 0&&(E.zoom=o({animate:E.animate},E.zoom),E.pan=o({animate:E.animate,duration:E.duration},E.pan));var F=this._zoom!==b?this._tryAnimatedZoom&&this._tryAnimatedZoom(d,b,E.zoom):this._tryAnimatedPan(d,E.pan);if(F)return clearTimeout(this._sizeTimer),this}return this._resetView(d,b,E.pan&&E.pan.noMoveStart),this},setZoom:function(d,b){return this._loaded?this.setView(this.getCenter(),d,{zoom:b}):(this._zoom=d,this)},zoomIn:function(d,b){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+d,b)},zoomOut:function(d,b){return d=d||(rr.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-d,b)},setZoomAround:function(d,b,E){var F=this.getZoomScale(b),X=this.getSize().divideBy(2),le=d instanceof de?d:this.latLngToContainerPoint(d),Me=le.subtract(X).multiplyBy(1-1/F),$e=this.containerPointToLatLng(X.add(Me));return this.setView($e,b,{zoom:E})},_getBoundsCenterZoom:function(d,b){b=b||{},d=d.getBounds?d.getBounds():se(d);var E=_e(b.paddingTopLeft||b.padding||[0,0]),F=_e(b.paddingBottomRight||b.padding||[0,0]),X=this.getBoundsZoom(d,!1,E.add(F));if(X=typeof b.maxZoom=="number"?Math.min(b.maxZoom,X):X,X===1/0)return{center:d.getCenter(),zoom:X};var le=F.subtract(E).divideBy(2),Me=this.project(d.getSouthWest(),X),$e=this.project(d.getNorthEast(),X),nt=this.unproject(Me.add($e).divideBy(2).add(le),X);return{center:nt,zoom:X}},fitBounds:function(d,b){if(d=se(d),!d.isValid())throw new Error("Bounds are not valid.");var E=this._getBoundsCenterZoom(d,b);return this.setView(E.center,E.zoom,b)},fitWorld:function(d){return this.fitBounds([[-90,-180],[90,180]],d)},panTo:function(d,b){return this.setView(d,this._zoom,{pan:b})},panBy:function(d,b){if(d=_e(d).round(),b=b||{},!d.x&&!d.y)return this.fire("moveend");if(b.animate!==!0&&!this.getSize().contains(d))return this._resetView(this.unproject(this.project(this.getCenter()).add(d)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ji,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),b.noMoveStart||this.fire("movestart"),b.animate!==!1){or(this._mapPane,"leaflet-pan-anim");var E=this._getMapPanePos().subtract(d).round();this._panAnim.run(this._mapPane,E,b.duration||.25,b.easeLinearity)}else this._rawPanBy(d),this.fire("move").fire("moveend");return this},flyTo:function(d,b,E){if(E=E||{},E.animate===!1||!rr.any3d)return this.setView(d,b,E);this._stop();var F=this.project(this.getCenter()),X=this.project(d),le=this.getSize(),Me=this._zoom;d=pe(d),b=b===void 0?Me:b;var $e=Math.max(le.x,le.y),nt=$e*this.getZoomScale(Me,b),St=X.distanceTo(F)||1,$t=1.42,fr=$t*$t;function Lr(Ga){var Fi=Ga?-1:1,To=Ga?nt:$e,Xd=nt*nt-$e*$e+Fi*fr*fr*St*St,Gl=2*To*fr*St,Xl=Xd/Gl,lo=Math.sqrt(Xl*Xl+1)-Xl,Bi=lo<1e-9?-18:Math.log(lo);return Bi}function Sn(Ga){return(Math.exp(Ga)-Math.exp(-Ga))/2}function qa(Ga){return(Math.exp(Ga)+Math.exp(-Ga))/2}function _s(Ga){return Sn(Ga)/qa(Ga)}var ra=Lr(0);function aa(Ga){return $e*(qa(ra)/qa(ra+$t*Ga))}function Wr(Ga){return $e*(qa(ra)*_s(ra+$t*Ga)-Sn(ra))/fr}function io(Ga){return 1-Math.pow(1-Ga,1.5)}var Ds=Date.now(),Rc=(Lr(1)-ra)/$t,oo=E.duration?1e3*E.duration:1e3*Rc*.8;function Gd(){var Ga=(Date.now()-Ds)/oo,Fi=io(Ga)*Rc;Ga<=1?(this._flyToFrame=je(Gd,this),this._move(this.unproject(F.add(X.subtract(F).multiplyBy(Wr(Fi)/St)),Me),this.getScaleZoom($e/aa(Fi),Me),{flyTo:!0})):this._move(d,b)._moveEnd(!0)}return this._moveStart(!0,E.noMoveStart),Gd.call(this),this},flyToBounds:function(d,b){var E=this._getBoundsCenterZoom(d,b);return this.flyTo(E.center,E.zoom,b)},setMaxBounds:function(d){return d=se(d),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),d.isValid()?(this.options.maxBounds=d,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(d){var b=this.options.minZoom;return this.options.minZoom=d,this._loaded&&b!==d&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(d):this},setMaxZoom:function(d){var b=this.options.maxZoom;return this.options.maxZoom=d,this._loaded&&b!==d&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(d):this},panInsideBounds:function(d,b){this._enforcingBounds=!0;var E=this.getCenter(),F=this._limitCenter(E,this._zoom,se(d));return E.equals(F)||this.panTo(F,b),this._enforcingBounds=!1,this},panInside:function(d,b){b=b||{};var E=_e(b.paddingTopLeft||b.padding||[0,0]),F=_e(b.paddingBottomRight||b.padding||[0,0]),X=this.project(this.getCenter()),le=this.project(d),Me=this.getPixelBounds(),$e=W([Me.min.add(E),Me.max.subtract(F)]),nt=$e.getSize();if(!$e.contains(le)){this._enforcingBounds=!0;var St=le.subtract($e.getCenter()),$t=$e.extend(le).getSize().subtract(nt);X.x+=St.x<0?-$t.x:$t.x,X.y+=St.y<0?-$t.y:$t.y,this.panTo(this.unproject(X),b),this._enforcingBounds=!1}return this},invalidateSize:function(d){if(!this._loaded)return this;d=o({animate:!1,pan:!0},d===!0?{animate:!0}:d);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var E=this.getSize(),F=b.divideBy(2).round(),X=E.divideBy(2).round(),le=F.subtract(X);return!le.x&&!le.y?this:(d.animate&&d.pan?this.panBy(le):(d.pan&&this._rawPanBy(le),this.fire("move"),d.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(f(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:E}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(d){if(d=this._locateOptions=o({timeout:1e4,watch:!1},d),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=f(this._handleGeolocationResponse,this),E=f(this._handleGeolocationError,this);return d.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,E,d):navigator.geolocation.getCurrentPosition(b,E,d),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(d){if(this._container._leaflet_id){var b=d.code,E=d.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+E+"."})}},_handleGeolocationResponse:function(d){if(this._container._leaflet_id){var b=d.coords.latitude,E=d.coords.longitude,F=new he(b,E),X=F.toBounds(d.coords.accuracy*2),le=this._locateOptions;if(le.setView){var Me=this.getBoundsZoom(X);this.setView(F,le.maxZoom?Math.min(Me,le.maxZoom):Me)}var $e={latlng:F,bounds:X,timestamp:d.timestamp};for(var nt in d.coords)typeof d.coords[nt]=="number"&&($e[nt]=d.coords[nt]);this.fire("locationfound",$e)}},addHandler:function(d,b){if(!b)return this;var E=this[d]=new b(this);return this._handlers.push(E),this.options[d]&&E.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(b){this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ea(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(me(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var d;for(d in this._layers)this._layers[d].remove();for(d in this._panes)ea(this._panes[d]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(d,b){var E="leaflet-pane"+(d?" leaflet-"+d.replace("Pane","")+"-pane":""),F=br("div",E,b||this._mapPane);return d&&(this._panes[d]=F),F},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var d=this.getPixelBounds(),b=this.unproject(d.getBottomLeft()),E=this.unproject(d.getTopRight());return new ae(b,E)},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(d,b,E){d=se(d),E=_e(E||[0,0]);var F=this.getZoom()||0,X=this.getMinZoom(),le=this.getMaxZoom(),Me=d.getNorthWest(),$e=d.getSouthEast(),nt=this.getSize().subtract(E),St=W(this.project($e,F),this.project(Me,F)).getSize(),$t=rr.any3d?this.options.zoomSnap:1,fr=nt.x/St.x,Lr=nt.y/St.y,Sn=b?Math.max(fr,Lr):Math.min(fr,Lr);return F=this.getScaleZoom(Sn,F),$t&&(F=Math.round(F/($t/100))*($t/100),F=b?Math.ceil(F/$t)*$t:Math.floor(F/$t)*$t),Math.max(X,Math.min(le,F))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new de(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(d,b){var E=this._getTopLeftPoint(d,b);return new K(E,E.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(d){return this.options.crs.getProjectedBounds(d===void 0?this.getZoom():d)},getPane:function(d){return typeof d=="string"?this._panes[d]:d},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(d,b){var E=this.options.crs;return b=b===void 0?this._zoom:b,E.scale(d)/E.scale(b)},getScaleZoom:function(d,b){var E=this.options.crs;b=b===void 0?this._zoom:b;var F=E.zoom(d*E.scale(b));return isNaN(F)?1/0:F},project:function(d,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(pe(d),b)},unproject:function(d,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng(_e(d),b)},layerPointToLatLng:function(d){var b=_e(d).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(d){var b=this.project(pe(d))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(d){return this.options.crs.wrapLatLng(pe(d))},wrapLatLngBounds:function(d){return this.options.crs.wrapLatLngBounds(se(d))},distance:function(d,b){return this.options.crs.distance(pe(d),pe(b))},containerPointToLayerPoint:function(d){return _e(d).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(d){return _e(d).add(this._getMapPanePos())},containerPointToLatLng:function(d){var b=this.containerPointToLayerPoint(_e(d));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(d){return this.layerPointToContainerPoint(this.latLngToLayerPoint(pe(d)))},mouseEventToContainerPoint:function(d){return $s(d,this._container)},mouseEventToLayerPoint:function(d){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(d))},mouseEventToLatLng:function(d){return this.layerPointToLatLng(this.mouseEventToLayerPoint(d))},_initContainer:function(d){var b=this._container=Cr(d);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");mr(b,"scroll",this._onScroll,this),this._containerId=v(b)},_initLayout:function(){var d=this._container;this._fadeAnimated=this.options.fadeAnimation&&rr.any3d,or(d,"leaflet-container"+(rr.touch?" leaflet-touch":"")+(rr.retina?" leaflet-retina":"")+(rr.ielt9?" leaflet-oldie":"")+(rr.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=Nr(d,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(d.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var d=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Gt(this._mapPane,new de(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(or(d.markerPane,"leaflet-zoom-hide"),or(d.shadowPane,"leaflet-zoom-hide"))},_resetView:function(d,b,E){Gt(this._mapPane,new de(0,0));var F=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var X=this._zoom!==b;this._moveStart(X,E)._move(d,b)._moveEnd(X),this.fire("viewreset"),F&&this.fire("load")},_moveStart:function(d,b){return d&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(d,b,E,F){b===void 0&&(b=this._zoom);var X=this._zoom!==b;return this._zoom=b,this._lastCenter=d,this._pixelOrigin=this._getNewPixelOrigin(d),F?E&&E.pinch&&this.fire("zoom",E):((X||E&&E.pinch)&&this.fire("zoom",E),this.fire("move",E)),this},_moveEnd:function(d){return d&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return me(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(d){Gt(this._mapPane,this._getMapPanePos().subtract(d))},_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(d){this._targets={},this._targets[v(this._container)]=this;var b=d?qt:mr;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),rr.any3d&&this.options.transform3DLimit&&(d?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){me(this._resizeRequest),this._resizeRequest=je(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var d=this._getMapPanePos();Math.max(Math.abs(d.x),Math.abs(d.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(d,b){for(var E=[],F,X=b==="mouseout"||b==="mouseover",le=d.target||d.srcElement,Me=!1;le;){if(F=this._targets[v(le)],F&&(b==="click"||b==="preclick")&&this._draggableMoved(F)){Me=!0;break}if(F&&F.listens(b,!0)&&(X&&!Vn(le,d)||(E.push(F),X))||le===this._container)break;le=le.parentNode}return!E.length&&!Me&&!X&&this.listens(b,!0)&&(E=[this]),E},_isClickDisabled:function(d){for(;d&&d!==this._container;){if(d._leaflet_disable_click)return!0;d=d.parentNode}},_handleDOMEvent:function(d){var b=d.target||d.srcElement;if(!(!this._loaded||b._leaflet_disable_events||d.type==="click"&&this._isClickDisabled(b))){var E=d.type;E==="mousedown"&&mi(b),this._fireDOMEvent(d,E)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(d,b,E){if(d.type==="click"){var F=o({},d);F.type="preclick",this._fireDOMEvent(F,F.type,E)}var X=this._findEventTargets(d,b);if(E){for(var le=[],Me=0;Me<E.length;Me++)E[Me].listens(b,!0)&&le.push(E[Me]);X=le.concat(X)}if(X.length){b==="contextmenu"&&Fa(d);var $e=X[0],nt={originalEvent:d};if(d.type!=="keypress"&&d.type!=="keydown"&&d.type!=="keyup"){var St=$e.getLatLng&&(!$e._radius||$e._radius<=10);nt.containerPoint=St?this.latLngToContainerPoint($e.getLatLng()):this.mouseEventToContainerPoint(d),nt.layerPoint=this.containerPointToLayerPoint(nt.containerPoint),nt.latlng=St?$e.getLatLng():this.layerPointToLatLng(nt.layerPoint)}for(Me=0;Me<X.length;Me++)if(X[Me].fire(b,nt,!0),nt.originalEvent._stopped||X[Me].options.bubblingMouseEvents===!1&&H(this._mouseEvents,b)!==-1)return}},_draggableMoved:function(d){return d=d.dragging&&d.dragging.enabled()?d:this,d.dragging&&d.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var d=0,b=this._handlers.length;d<b;d++)this._handlers[d].disable()},whenReady:function(d,b){return this._loaded?d.call(b||this,{target:this}):this.on("load",d,b),this},_getMapPanePos:function(){return pa(this._mapPane)||new de(0,0)},_moved:function(){var d=this._getMapPanePos();return d&&!d.equals([0,0])},_getTopLeftPoint:function(d,b){var E=d&&b!==void 0?this._getNewPixelOrigin(d,b):this.getPixelOrigin();return E.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(d,b){var E=this.getSize()._divideBy(2);return this.project(d,b)._subtract(E)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(d,b,E){var F=this._getNewPixelOrigin(E,b);return this.project(d,b)._subtract(F)},_latLngBoundsToNewLayerBounds:function(d,b,E){var F=this._getNewPixelOrigin(E,b);return W([this.project(d.getSouthWest(),b)._subtract(F),this.project(d.getNorthWest(),b)._subtract(F),this.project(d.getSouthEast(),b)._subtract(F),this.project(d.getNorthEast(),b)._subtract(F)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(d){return this.latLngToLayerPoint(d).subtract(this._getCenterLayerPoint())},_limitCenter:function(d,b,E){if(!E)return d;var F=this.project(d,b),X=this.getSize().divideBy(2),le=new K(F.subtract(X),F.add(X)),Me=this._getBoundsOffset(le,E,b);return Math.abs(Me.x)<=1&&Math.abs(Me.y)<=1?d:this.unproject(F.add(Me),b)},_limitOffset:function(d,b){if(!b)return d;var E=this.getPixelBounds(),F=new K(E.min.add(d),E.max.add(d));return d.add(this._getBoundsOffset(F,b))},_getBoundsOffset:function(d,b,E){var F=W(this.project(b.getNorthEast(),E),this.project(b.getSouthWest(),E)),X=F.min.subtract(d.min),le=F.max.subtract(d.max),Me=this._rebound(X.x,-le.x),$e=this._rebound(X.y,-le.y);return new de(Me,$e)},_rebound:function(d,b){return d+b>0?Math.round(d-b)/2:Math.max(0,Math.ceil(d))-Math.max(0,Math.floor(b))},_limitZoom:function(d){var b=this.getMinZoom(),E=this.getMaxZoom(),F=rr.any3d?this.options.zoomSnap:1;return F&&(d=Math.round(d/F)*F),Math.max(b,Math.min(E,d))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Kr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(d,b){var E=this._getCenterOffset(d)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(E)?!1:(this.panBy(E,b),!0)},_createAnimProxy:function(){var d=this._proxy=br("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(d),this.on("zoomanim",function(b){var E=Wa,F=this._proxy.style[E];we(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),F===this._proxy.style[E]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ea(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var d=this.getCenter(),b=this.getZoom();we(this._proxy,this.project(d,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(d){this._animatingZoom&&d.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(d,b,E){if(this._animatingZoom)return!0;if(E=E||{},!this._zoomAnimated||E.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var F=this.getZoomScale(b),X=this._getCenterOffset(d)._divideBy(1-1/F);return E.animate!==!0&&!this.getSize().contains(X)?!1:(je(function(){this._moveStart(!0,E.noMoveStart||!1)._animateZoom(d,b,!0)},this),!0)},_animateZoom:function(d,b,E,F){this._mapPane&&(E&&(this._animatingZoom=!0,this._animateToCenter=d,this._animateToZoom=b,or(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:d,zoom:b,noUpdate:F}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(f(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Kr(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 Qo(d,b){return new Ur(d,b)}var Gn=Oe.extend({options:{position:"topright"},initialize:function(d){M(this,d)},getPosition:function(){return this.options.position},setPosition:function(d){var b=this._map;return b&&b.removeControl(this),this.options.position=d,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(d){this.remove(),this._map=d;var b=this._container=this.onAdd(d),E=this.getPosition(),F=d._controlCorners[E];return or(b,"leaflet-control"),E.indexOf("bottom")!==-1?F.insertBefore(b,F.firstChild):F.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ea(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(d){this._map&&d&&d.screenX>0&&d.screenY>0&&this._map.getContainer().focus()}}),qs=function(d){return new Gn(d)};Ur.include({addControl:function(d){return d.addTo(this),this},removeControl:function(d){return d.remove(),this},_initControlPos:function(){var d=this._controlCorners={},b="leaflet-",E=this._controlContainer=br("div",b+"control-container",this._container);function F(X,le){var Me=b+X+" "+b+le;d[X+le]=br("div",Me,E)}F("top","left"),F("top","right"),F("bottom","left"),F("bottom","right")},_clearControlPos:function(){for(var d in this._controlCorners)ea(this._controlCorners[d]);ea(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var wo=Gn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(d,b,E,F){return E<F?-1:F<E?1:0}},initialize:function(d,b,E){M(this,E),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var F in d)this._addLayer(d[F],F);for(F in b)this._addLayer(b[F],F,!0)},onAdd:function(d){this._initLayout(),this._update(),this._map=d,d.on("zoomend",this._checkDisabledLayers,this);for(var b=0;b<this._layers.length;b++)this._layers[b].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(d){return Gn.prototype.addTo.call(this,d),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var d=0;d<this._layers.length;d++)this._layers[d].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(d,b){return this._addLayer(d,b),this._map?this._update():this},addOverlay:function(d,b){return this._addLayer(d,b,!0),this._map?this._update():this},removeLayer:function(d){d.off("add remove",this._onLayerChange,this);var b=this._getLayer(v(d));return b&&this._layers.splice(this._layers.indexOf(b),1),this._map?this._update():this},expand:function(){or(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var d=this._map.getSize().y-(this._container.offsetTop+50);return d<this._section.clientHeight?(or(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=d+"px"):Kr(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Kr(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var d="leaflet-control-layers",b=this._container=br("div",d),E=this.options.collapsed;b.setAttribute("aria-haspopup",!0),Wn(b),ps(b);var F=this._section=br("section",d+"-list");E&&(this._map.on("click",this.collapse,this),mr(b,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var X=this._layersLink=br("a",d+"-toggle",b);X.href="#",X.title="Layers",X.setAttribute("role","button"),mr(X,{keydown:function(le){le.keyCode===13&&this._expandSafely()},click:function(le){Fa(le),this._expandSafely()}},this),E||this.expand(),this._baseLayersList=br("div",d+"-base",F),this._separator=br("div",d+"-separator",F),this._overlaysList=br("div",d+"-overlays",F),b.appendChild(F)},_getLayer:function(d){for(var b=0;b<this._layers.length;b++)if(this._layers[b]&&v(this._layers[b].layer)===d)return this._layers[b]},_addLayer:function(d,b,E){this._map&&d.on("add remove",this._onLayerChange,this),this._layers.push({layer:d,name:b,overlay:E}),this.options.sortLayers&&this._layers.sort(f(function(F,X){return this.options.sortFunction(F.layer,X.layer,F.name,X.name)},this)),this.options.autoZIndex&&d.setZIndex&&(this._lastZIndex++,d.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;jn(this._baseLayersList),jn(this._overlaysList),this._layerControlInputs=[];var d,b,E,F,X=0;for(E=0;E<this._layers.length;E++)F=this._layers[E],this._addItem(F),b=b||F.overlay,d=d||!F.overlay,X+=F.overlay?0:1;return this.options.hideSingleBase&&(d=d&&X>1,this._baseLayersList.style.display=d?"":"none"),this._separator.style.display=b&&d?"":"none",this},_onLayerChange:function(d){this._handlingClick||this._update();var b=this._getLayer(v(d.target)),E=b.overlay?d.type==="add"?"overlayadd":"overlayremove":d.type==="add"?"baselayerchange":null;E&&this._map.fire(E,b)},_createRadioElement:function(d,b){var E='<input type="radio" class="leaflet-control-layers-selector" name="'+d+'"'+(b?' checked="checked"':"")+"/>",F=document.createElement("div");return F.innerHTML=E,F.firstChild},_addItem:function(d){var b=document.createElement("label"),E=this._map.hasLayer(d.layer),F;d.overlay?(F=document.createElement("input"),F.type="checkbox",F.className="leaflet-control-layers-selector",F.defaultChecked=E):F=this._createRadioElement("leaflet-base-layers_"+v(this),E),this._layerControlInputs.push(F),F.layerId=v(d.layer),mr(F,"click",this._onInputClick,this);var X=document.createElement("span");X.innerHTML=" "+d.name;var le=document.createElement("span");b.appendChild(le),le.appendChild(F),le.appendChild(X);var Me=d.overlay?this._overlaysList:this._baseLayersList;return Me.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var d=this._layerControlInputs,b,E,F=[],X=[];this._handlingClick=!0;for(var le=d.length-1;le>=0;le--)b=d[le],E=this._getLayer(b.layerId).layer,b.checked?F.push(E):b.checked||X.push(E);for(le=0;le<X.length;le++)this._map.hasLayer(X[le])&&this._map.removeLayer(X[le]);for(le=0;le<F.length;le++)this._map.hasLayer(F[le])||this._map.addLayer(F[le]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var d=this._layerControlInputs,b,E,F=this._map.getZoom(),X=d.length-1;X>=0;X--)b=d[X],E=this._getLayer(b.layerId).layer,b.disabled=E.options.minZoom!==void 0&&F<E.options.minZoom||E.options.maxZoom!==void 0&&F>E.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var d=this._section;this._preventClick=!0,mr(d,"click",Fa),this.expand();var b=this;setTimeout(function(){qt(d,"click",Fa),b._preventClick=!1})}}),Jr=function(d,b,E){return new wo(d,b,E)},el=Gn.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(d){var b="leaflet-control-zoom",E=br("div",b+" leaflet-bar"),F=this.options;return this._zoomInButton=this._createButton(F.zoomInText,F.zoomInTitle,b+"-in",E,this._zoomIn),this._zoomOutButton=this._createButton(F.zoomOutText,F.zoomOutTitle,b+"-out",E,this._zoomOut),this._updateDisabled(),d.on("zoomend zoomlevelschange",this._updateDisabled,this),E},onRemove:function(d){d.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(d){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(d.shiftKey?3:1))},_zoomOut:function(d){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(d.shiftKey?3:1))},_createButton:function(d,b,E,F,X){var le=br("a",E,F);return le.innerHTML=d,le.href="#",le.title=b,le.setAttribute("role","button"),le.setAttribute("aria-label",b),Wn(le),mr(le,"click",ns),mr(le,"click",X,this),mr(le,"click",this._refocusOnMap,this),le},_updateDisabled:function(){var d=this._map,b="leaflet-disabled";Kr(this._zoomInButton,b),Kr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||d._zoom===d.getMinZoom())&&(or(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||d._zoom===d.getMaxZoom())&&(or(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ur.mergeOptions({zoomControl:!0}),Ur.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new el,this.addControl(this.zoomControl))});var tl=function(d){return new el(d)},Ks=Gn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(d){var b="leaflet-control-scale",E=br("div",b),F=this.options;return this._addScales(F,b+"-line",E),d.on(F.updateWhenIdle?"moveend":"move",this._update,this),d.whenReady(this._update,this),E},onRemove:function(d){d.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(d,b,E){d.metric&&(this._mScale=br("div",b,E)),d.imperial&&(this._iScale=br("div",b,E))},_update:function(){var d=this._map,b=d.getSize().y/2,E=d.distance(d.containerPointToLatLng([0,b]),d.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(E)},_updateScales:function(d){this.options.metric&&d&&this._updateMetric(d),this.options.imperial&&d&&this._updateImperial(d)},_updateMetric:function(d){var b=this._getRoundNum(d),E=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,E,b/d)},_updateImperial:function(d){var b=d*3.2808399,E,F,X;b>5280?(E=b/5280,F=this._getRoundNum(E),this._updateScale(this._iScale,F+" mi",F/E)):(X=this._getRoundNum(b),this._updateScale(this._iScale,X+" ft",X/b))},_updateScale:function(d,b,E){d.style.width=Math.round(this.options.maxWidth*E)+"px",d.innerHTML=b},_getRoundNum:function(d){var b=Math.pow(10,(Math.floor(d)+"").length-1),E=d/b;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:1,b*E}}),Bl=function(d){return new Ks(d)},lt='<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>',Tr=Gn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(rr.inlineSvg?lt+" ":"")+"Leaflet</a>"},initialize:function(d){M(this,d),this._attributions={}},onAdd:function(d){d.attributionControl=this,this._container=br("div","leaflet-control-attribution"),Wn(this._container);for(var b in d._layers)d._layers[b].getAttribution&&this.addAttribution(d._layers[b].getAttribution());return this._update(),d.on("layeradd",this._addAttribution,this),this._container},onRemove:function(d){d.off("layeradd",this._addAttribution,this)},_addAttribution:function(d){d.layer.getAttribution&&(this.addAttribution(d.layer.getAttribution()),d.layer.once("remove",function(){this.removeAttribution(d.layer.getAttribution())},this))},setPrefix:function(d){return this.options.prefix=d,this._update(),this},addAttribution:function(d){return d?(this._attributions[d]||(this._attributions[d]=0),this._attributions[d]++,this._update(),this):this},removeAttribution:function(d){return d?(this._attributions[d]&&(this._attributions[d]--,this._update()),this):this},_update:function(){if(this._map){var d=[];for(var b in this._attributions)this._attributions[b]&&d.push(b);var E=[];this.options.prefix&&E.push(this.options.prefix),d.length&&E.push(d.join(", ")),this._container.innerHTML=E.join(' <span aria-hidden="true">|</span> ')}}});Ur.mergeOptions({attributionControl:!0}),Ur.addInitHook(function(){this.options.attributionControl&&new Tr().addTo(this)});var on=function(d){return new Tr(d)};Gn.Layers=wo,Gn.Zoom=el,Gn.Scale=Ks,Gn.Attribution=Tr,qs.layers=Jr,qs.zoom=tl,qs.scale=Bl,qs.attribution=on;var Xn=Oe.extend({initialize:function(d){this._map=d},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}});Xn.addTo=function(d,b){return d.addHandler(b,this),this};var Nc={Events:be},Ul=rr.touch?"touchstart mousedown":"mousedown",gi=re.extend({options:{clickTolerance:3},initialize:function(d,b,E,F){M(this,F),this._element=d,this._dragStartTarget=b||d,this._preventOutline=E},enable:function(){this._enabled||(mr(this._dragStartTarget,Ul,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(gi._dragging===this&&this.finishDrag(!0),qt(this._dragStartTarget,Ul,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(d){if(this._enabled&&(this._moved=!1,!Il(this._element,"leaflet-zoom-anim"))){if(d.touches&&d.touches.length!==1){gi._dragging===this&&this.finishDrag();return}if(!(gi._dragging||d.shiftKey||d.which!==1&&d.button!==1&&!d.touches)&&(gi._dragging=this,this._preventOutline&&mi(this._element),ur(),an(),!this._moving)){this.fire("down");var b=d.touches?d.touches[0]:d,E=eo(this._element);this._startPoint=new de(b.clientX,b.clientY),this._startPos=pa(this._element),this._parentScale=vo(E);var F=d.type==="mousedown";mr(document,F?"mousemove":"touchmove",this._onMove,this),mr(document,F?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(d){if(this._enabled){if(d.touches&&d.touches.length>1){this._moved=!0;return}var b=d.touches&&d.touches.length===1?d.touches[0]:d,E=new de(b.clientX,b.clientY)._subtract(this._startPoint);!E.x&&!E.y||Math.abs(E.x)+Math.abs(E.y)<this.options.clickTolerance||(E.x/=this._parentScale.x,E.y/=this._parentScale.y,Fa(d),this._moved||(this.fire("dragstart"),this._moved=!0,or(document.body,"leaflet-dragging"),this._lastTarget=d.target||d.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),or(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(E),this._moving=!0,this._lastEvent=d,this._updatePosition())}},_updatePosition:function(){var d={originalEvent:this._lastEvent};this.fire("predrag",d),Gt(this._element,this._newPos),this.fire("drag",d)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(d){Kr(document.body,"leaflet-dragging"),this._lastTarget&&(Kr(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),qt(document,"mousemove touchmove",this._onMove,this),qt(document,"mouseup touchend touchcancel",this._onUp,this),da(),Ts();var b=this._moved&&this._moving;this._moving=!1,gi._dragging=!1,b&&this.fire("dragend",{noInertia:d,distance:this._newPos.distanceTo(this._startPos)})}});function Sc(d,b,E){var F,X=[1,4,2,8],le,Me,$e,nt,St,$t,fr,Lr;for(le=0,$t=d.length;le<$t;le++)d[le]._code=Mi(d[le],b);for($e=0;$e<4;$e++){for(fr=X[$e],F=[],le=0,$t=d.length,Me=$t-1;le<$t;Me=le++)nt=d[le],St=d[Me],nt._code&fr?St._code&fr||(Lr=Js(St,nt,fr,b,E),Lr._code=Mi(Lr,b),F.push(Lr)):(St._code&fr&&(Lr=Js(St,nt,fr,b,E),Lr._code=Mi(Lr,b),F.push(Lr)),F.push(nt));d=F}return d}function rl(d,b){var E,F,X,le,Me,$e,nt,St,$t;if(!d||d.length===0)throw new Error("latlngs not passed");Yn(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var fr=pe([0,0]),Lr=se(d),Sn=Lr.getNorthWest().distanceTo(Lr.getSouthWest())*Lr.getNorthEast().distanceTo(Lr.getNorthWest());Sn<1700&&(fr=Ra(d));var qa=d.length,_s=[];for(E=0;E<qa;E++){var ra=pe(d[E]);_s.push(b.project(pe([ra.lat-fr.lat,ra.lng-fr.lng])))}for($e=nt=St=0,E=0,F=qa-1;E<qa;F=E++)X=_s[E],le=_s[F],Me=X.y*le.x-le.y*X.x,nt+=(X.x+le.x)*Me,St+=(X.y+le.y)*Me,$e+=Me*3;$e===0?$t=_s[0]:$t=[nt/$e,St/$e];var aa=b.unproject(_e($t));return pe([aa.lat+fr.lat,aa.lng+fr.lng])}function Ra(d){for(var b=0,E=0,F=0,X=0;X<d.length;X++){var le=pe(d[X]);b+=le.lat,E+=le.lng,F++}return pe([b/F,E/F])}var ko={__proto__:null,clipPolygon:Sc,polygonCenter:rl,centroid:Ra};function Oa(d,b){if(!b||!d.length)return d.slice();var E=b*b;return d=Ud(d,E),d=ta(d,E),d}function No(d,b,E){return Math.sqrt(Ri(d,b,E,!0))}function Oi(d,b,E){return Ri(d,b,E)}function ta(d,b){var E=d.length,F=typeof Uint8Array!="undefined"?Uint8Array:Array,X=new F(E);X[0]=X[E-1]=1,hr(d,X,b,0,E-1);var le,Me=[];for(le=0;le<E;le++)X[le]&&Me.push(d[le]);return Me}function hr(d,b,E,F,X){var le=0,Me,$e,nt;for($e=F+1;$e<=X-1;$e++)nt=Ri(d[$e],d[F],d[X],!0),nt>le&&(Me=$e,le=nt);le>E&&(b[Me]=1,hr(d,b,E,F,Me),hr(d,b,E,Me,X))}function Ud(d,b){for(var E=[d[0]],F=1,X=0,le=d.length;F<le;F++)As(d[F],d[X])>b&&(E.push(d[F]),X=F);return X<le-1&&E.push(d[le-1]),E}var xa;function xi(d,b,E,F,X){var le=F?xa:Mi(d,E),Me=Mi(b,E),$e,nt,St;for(xa=Me;;){if(!(le|Me))return[d,b];if(le&Me)return!1;$e=le||Me,nt=Js(d,b,$e,E,X),St=Mi(nt,E),$e===le?(d=nt,le=St):(b=nt,Me=St)}}function Js(d,b,E,F,X){var le=b.x-d.x,Me=b.y-d.y,$e=F.min,nt=F.max,St,$t;return E&8?(St=d.x+le*(nt.y-d.y)/Me,$t=nt.y):E&4?(St=d.x+le*($e.y-d.y)/Me,$t=$e.y):E&2?(St=nt.x,$t=d.y+Me*(nt.x-d.x)/le):E&1&&(St=$e.x,$t=d.y+Me*($e.x-d.x)/le),new de(St,$t,X)}function Mi(d,b){var E=0;return d.x<b.min.x?E|=1:d.x>b.max.x&&(E|=2),d.y<b.min.y?E|=4:d.y>b.max.y&&(E|=8),E}function As(d,b){var E=b.x-d.x,F=b.y-d.y;return E*E+F*F}function Ri(d,b,E,F){var X=b.x,le=b.y,Me=E.x-X,$e=E.y-le,nt=Me*Me+$e*$e,St;return nt>0&&(St=((d.x-X)*Me+(d.y-le)*$e)/nt,St>1?(X=E.x,le=E.y):St>0&&(X+=Me*St,le+=$e*St)),Me=d.x-X,$e=d.y-le,F?Me*Me+$e*$e:new de(X,le)}function Yn(d){return!U(d[0])||typeof d[0][0]!="object"&&typeof d[0][0]!="undefined"}function to(d){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Yn(d)}function Di(d,b){var E,F,X,le,Me,$e,nt,St;if(!d||d.length===0)throw new Error("latlngs not passed");Yn(d)||(console.warn("latlngs are not flat! Only the first ring will be used"),d=d[0]);var $t=pe([0,0]),fr=se(d),Lr=fr.getNorthWest().distanceTo(fr.getSouthWest())*fr.getNorthEast().distanceTo(fr.getNorthWest());Lr<1700&&($t=Ra(d));var Sn=d.length,qa=[];for(E=0;E<Sn;E++){var _s=pe(d[E]);qa.push(b.project(pe([_s.lat-$t.lat,_s.lng-$t.lng])))}for(E=0,F=0;E<Sn-1;E++)F+=qa[E].distanceTo(qa[E+1])/2;if(F===0)St=qa[0];else for(E=0,le=0;E<Sn-1;E++)if(Me=qa[E],$e=qa[E+1],X=Me.distanceTo($e),le+=X,le>F){nt=(le-F)/X,St=[$e.x-nt*($e.x-Me.x),$e.y-nt*($e.y-Me.y)];break}var ra=b.unproject(_e(St));return pe([ra.lat+$t.lat,ra.lng+$t.lng])}var Ec={__proto__:null,simplify:Oa,pointToSegmentDistance:No,closestPointOnSegment:Oi,clipSegment:xi,_getEdgeIntersection:Js,_getBitCode:Mi,_sqClosestPointOnSegment:Ri,isFlat:Yn,_flat:to,polylineCenter:Di},al={project:function(d){return new de(d.lng,d.lat)},unproject:function(d){return new he(d.y,d.x)},bounds:new K([-180,-90],[180,90])},Qs={R:6378137,R_MINOR:6356752314245179e-9,bounds:new K([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(d){var b=Math.PI/180,E=this.R,F=d.lat*b,X=this.R_MINOR/E,le=Math.sqrt(1-X*X),Me=le*Math.sin(F),$e=Math.tan(Math.PI/4-F/2)/Math.pow((1-Me)/(1+Me),le/2);return F=-E*Math.log(Math.max($e,1e-10)),new de(d.lng*b*E,F)},unproject:function(d){for(var b=180/Math.PI,E=this.R,F=this.R_MINOR/E,X=Math.sqrt(1-F*F),le=Math.exp(-d.y/E),Me=Math.PI/2-2*Math.atan(le),$e=0,nt=.1,St;$e<15&&Math.abs(nt)>1e-7;$e++)St=X*Math.sin(Me),St=Math.pow((1-St)/(1+St),X/2),nt=Math.PI/2-2*Math.atan(le*St)-Me,Me+=nt;return new he(Me*b,d.x*b/E)}},nl={__proto__:null,LonLat:al,Mercator:Qs,SphericalMercator:ot},Cc=o({},Fe,{code:"EPSG:3395",projection:Qs,transformation:(function(){var d=.5/(Math.PI*Qs.R);return zt(d,.5,-d,.5)})()}),Ii=o({},Fe,{code:"EPSG:4326",projection:al,transformation:zt(1/180,1,-1/180,.5)}),ro=o({},Je,{projection:al,transformation:zt(1,0,-1,0),scale:function(d){return Math.pow(2,d)},zoom:function(d){return Math.log(d)/Math.LN2},distance:function(d,b){var E=b.lng-d.lng,F=b.lat-d.lat;return Math.sqrt(E*E+F*F)},infinite:!0});Je.Earth=Fe,Je.EPSG3395=Cc,Je.EPSG3857=Ht,Je.EPSG900913=ht,Je.EPSG4326=Ii,Je.Simple=ro;var $a=re.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(d){return d.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(d){return d&&d.removeLayer(this),this},getPane:function(d){return this._map.getPane(d?this.options[d]||d:this.options.pane)},addInteractiveTarget:function(d){return this._map._targets[v(d)]=this,this},removeInteractiveTarget:function(d){return delete this._map._targets[v(d)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(d){var b=d.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var E=this.getEvents();b.on(E,this),this.once("remove",function(){b.off(E,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});Ur.include({addLayer:function(d){if(!d._layerAdd)throw new Error("The provided object is not a Layer.");var b=v(d);return this._layers[b]?this:(this._layers[b]=d,d._mapToAdd=this,d.beforeAdd&&d.beforeAdd(this),this.whenReady(d._layerAdd,d),this)},removeLayer:function(d){var b=v(d);return this._layers[b]?(this._loaded&&d.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:d}),d.fire("remove")),d._map=d._mapToAdd=null,this):this},hasLayer:function(d){return v(d)in this._layers},eachLayer:function(d,b){for(var E in this._layers)d.call(b,this._layers[E]);return this},_addLayers:function(d){d=d?U(d)?d:[d]:[];for(var b=0,E=d.length;b<E;b++)this.addLayer(d[b])},_addZoomLimit:function(d){(!isNaN(d.options.maxZoom)||!isNaN(d.options.minZoom))&&(this._zoomBoundLayers[v(d)]=d,this._updateZoomLevels())},_removeZoomLimit:function(d){var b=v(d);this._zoomBoundLayers[b]&&(delete this._zoomBoundLayers[b],this._updateZoomLevels())},_updateZoomLevels:function(){var d=1/0,b=-1/0,E=this._getZoomSpan();for(var F in this._zoomBoundLayers){var X=this._zoomBoundLayers[F].options;d=X.minZoom===void 0?d:Math.min(d,X.minZoom),b=X.maxZoom===void 0?b:Math.max(b,X.maxZoom)}this._layersMaxZoom=b===-1/0?void 0:b,this._layersMinZoom=d===1/0?void 0:d,E!==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 ei=$a.extend({initialize:function(d,b){M(this,b),this._layers={};var E,F;if(d)for(E=0,F=d.length;E<F;E++)this.addLayer(d[E])},addLayer:function(d){var b=this.getLayerId(d);return this._layers[b]=d,this._map&&this._map.addLayer(d),this},removeLayer:function(d){var b=d in this._layers?d:this.getLayerId(d);return this._map&&this._layers[b]&&this._map.removeLayer(this._layers[b]),delete this._layers[b],this},hasLayer:function(d){var b=typeof d=="number"?d:this.getLayerId(d);return b in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(d){var b=Array.prototype.slice.call(arguments,1),E,F;for(E in this._layers)F=this._layers[E],F[d]&&F[d].apply(F,b);return this},onAdd:function(d){this.eachLayer(d.addLayer,d)},onRemove:function(d){this.eachLayer(d.removeLayer,d)},eachLayer:function(d,b){for(var E in this._layers)d.call(b,this._layers[E]);return this},getLayer:function(d){return this._layers[d]},getLayers:function(){var d=[];return this.eachLayer(d.push,d),d},setZIndex:function(d){return this.invoke("setZIndex",d)},getLayerId:function(d){return v(d)}}),ss=function(d,b){return new ei(d,b)},ys=ei.extend({addLayer:function(d){return this.hasLayer(d)?this:(d.addEventParent(this),ei.prototype.addLayer.call(this,d),this.fire("layeradd",{layer:d}))},removeLayer:function(d){return this.hasLayer(d)?(d in this._layers&&(d=this._layers[d]),d.removeEventParent(this),ei.prototype.removeLayer.call(this,d),this.fire("layerremove",{layer:d})):this},setStyle:function(d){return this.invoke("setStyle",d)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var d=new ae;for(var b in this._layers){var E=this._layers[b];d.extend(E.getBounds?E.getBounds():E.getLatLng())}return d}}),bs=function(d,b){return new ys(d,b)},js=Oe.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(d){M(this,d)},createIcon:function(d){return this._createIcon("icon",d)},createShadow:function(d){return this._createIcon("shadow",d)},_createIcon:function(d,b){var E=this._getIconUrl(d);if(!E){if(d==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var F=this._createImg(E,b&&b.tagName==="IMG"?b:null);return this._setIconStyles(F,d),(this.options.crossOrigin||this.options.crossOrigin==="")&&(F.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),F},_setIconStyles:function(d,b){var E=this.options,F=E[b+"Size"];typeof F=="number"&&(F=[F,F]);var X=_e(F),le=_e(b==="shadow"&&E.shadowAnchor||E.iconAnchor||X&&X.divideBy(2,!0));d.className="leaflet-marker-"+b+" "+(E.className||""),le&&(d.style.marginLeft=-le.x+"px",d.style.marginTop=-le.y+"px"),X&&(d.style.width=X.x+"px",d.style.height=X.y+"px")},_createImg:function(d,b){return b=b||document.createElement("img"),b.src=d,b},_getIconUrl:function(d){return rr.retina&&this.options[d+"RetinaUrl"]||this.options[d+"Url"]}});function Li(d){return new js(d)}var So=js.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(d){return typeof So.imagePath!="string"&&(So.imagePath=this._detectIconPath()),(this.options.imagePath||So.imagePath)+js.prototype._getIconUrl.call(this,d)},_stripUrl:function(d){var b=function(E,F,X){var le=F.exec(E);return le&&le[X]};return d=b(d,/^url\((['"])?(.+)\1\)$/,2),d&&b(d,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var d=br("div","leaflet-default-icon-path",document.body),b=Nr(d,"background-image")||Nr(d,"backgroundImage");if(document.body.removeChild(d),b=this._stripUrl(b),b)return b;var E=document.querySelector('link[href$="leaflet.css"]');return E?E.href.substring(0,E.href.length-11-1):""}}),ao=Xn.extend({initialize:function(d){this._marker=d},addHooks:function(){var d=this._marker._icon;this._draggable||(this._draggable=new gi(d,d,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),or(d,"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&&Kr(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(d){var b=this._marker,E=b._map,F=this._marker.options.autoPanSpeed,X=this._marker.options.autoPanPadding,le=pa(b._icon),Me=E.getPixelBounds(),$e=E.getPixelOrigin(),nt=W(Me.min._subtract($e).add(X),Me.max._subtract($e).subtract(X));if(!nt.contains(le)){var St=_e((Math.max(nt.max.x,le.x)-nt.max.x)/(Me.max.x-nt.max.x)-(Math.min(nt.min.x,le.x)-nt.min.x)/(Me.min.x-nt.min.x),(Math.max(nt.max.y,le.y)-nt.max.y)/(Me.max.y-nt.max.y)-(Math.min(nt.min.y,le.y)-nt.min.y)/(Me.min.y-nt.min.y)).multiplyBy(F);E.panBy(St,{animate:!1}),this._draggable._newPos._add(St),this._draggable._startPos._add(St),Gt(b._icon,this._draggable._newPos),this._onDrag(d),this._panRequest=je(this._adjustPan.bind(this,d))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(d){this._marker.options.autoPan&&(me(this._panRequest),this._panRequest=je(this._adjustPan.bind(this,d)))},_onDrag:function(d){var b=this._marker,E=b._shadow,F=pa(b._icon),X=b._map.layerPointToLatLng(F);E&&Gt(E,F),b._latlng=X,d.latlng=X,d.oldLatLng=this._oldLatLng,b.fire("move",d).fire("drag",d)},_onDragEnd:function(d){me(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",d)}}),Mn=$a.extend({options:{icon:new So,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(d,b){M(this,b),this._latlng=pe(d)},onAdd:function(d){this._zoomAnimated=this._zoomAnimated&&d.options.markerZoomAnimation,this._zoomAnimated&&d.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(d){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&d.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(d){var b=this._latlng;return this._latlng=pe(d),this.update(),this.fire("move",{oldLatLng:b,latlng:this._latlng})},setZIndexOffset:function(d){return this.options.zIndexOffset=d,this.update()},getIcon:function(){return this.options.icon},setIcon:function(d){return this.options.icon=d,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 d=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(d)}return this},_initIcon:function(){var d=this.options,b="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),E=d.icon.createIcon(this._icon),F=!1;E!==this._icon&&(this._icon&&this._removeIcon(),F=!0,d.title&&(E.title=d.title),E.tagName==="IMG"&&(E.alt=d.alt||"")),or(E,b),d.keyboard&&(E.tabIndex="0",E.setAttribute("role","button")),this._icon=E,d.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&mr(E,"focus",this._panOnFocus,this);var X=d.icon.createShadow(this._shadow),le=!1;X!==this._shadow&&(this._removeShadow(),le=!0),X&&(or(X,b),X.alt=""),this._shadow=X,d.opacity<1&&this._updateOpacity(),F&&this.getPane().appendChild(this._icon),this._initInteraction(),X&&le&&this.getPane(d.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&qt(this._icon,"focus",this._panOnFocus,this),ea(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ea(this._shadow),this._shadow=null},_setPos:function(d){this._icon&&Gt(this._icon,d),this._shadow&&Gt(this._shadow,d),this._zIndex=d.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(d){this._icon&&(this._icon.style.zIndex=this._zIndex+d)},_animateZoom:function(d){var b=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center).round();this._setPos(b)},_initInteraction:function(){if(this.options.interactive&&(or(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ao)){var d=this.options.draggable;this.dragging&&(d=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ao(this),d&&this.dragging.enable()}},setOpacity:function(d){return this.options.opacity=d,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var d=this.options.opacity;this._icon&&pr(this._icon,d),this._shadow&&pr(this._shadow,d)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var d=this._map;if(d){var b=this.options.icon.options,E=b.iconSize?_e(b.iconSize):_e(0,0),F=b.iconAnchor?_e(b.iconAnchor):_e(0,0);d.panInside(this._latlng,{paddingTopLeft:F,paddingBottomRight:E.subtract(F)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Tc(d,b){return new Mn(d,b)}var is=$a.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(d){this._renderer=d.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(d){return M(this,d),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&d&&Object.prototype.hasOwnProperty.call(d,"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)}}),Os=is.extend({options:{fill:!0,radius:10},initialize:function(d,b){M(this,b),this._latlng=pe(d),this._radius=this.options.radius},setLatLng:function(d){var b=this._latlng;return this._latlng=pe(d),this.redraw(),this.fire("move",{oldLatLng:b,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(d){return this.options.radius=this._radius=d,this.redraw()},getRadius:function(){return this._radius},setStyle:function(d){var b=d&&d.radius||this._radius;return is.prototype.setStyle.call(this,d),this.setRadius(b),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var d=this._radius,b=this._radiusY||d,E=this._clickTolerance(),F=[d+E,b+E];this._pxBounds=new K(this._point.subtract(F),this._point.add(F))},_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(d){return d.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function zr(d,b){return new Os(d,b)}var Pi=Os.extend({initialize:function(d,b,E){if(typeof b=="number"&&(b=o({},E,{radius:b})),M(this,b),this._latlng=pe(d),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(d){return this._mRadius=d,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var d=[this._radius,this._radiusY||this._radius];return new ae(this._map.layerPointToLatLng(this._point.subtract(d)),this._map.layerPointToLatLng(this._point.add(d)))},setStyle:is.prototype.setStyle,_project:function(){var d=this._latlng.lng,b=this._latlng.lat,E=this._map,F=E.options.crs;if(F.distance===Fe.distance){var X=Math.PI/180,le=this._mRadius/Fe.R/X,Me=E.project([b+le,d]),$e=E.project([b-le,d]),nt=Me.add($e).divideBy(2),St=E.unproject(nt).lat,$t=Math.acos((Math.cos(le*X)-Math.sin(b*X)*Math.sin(St*X))/(Math.cos(b*X)*Math.cos(St*X)))/X;(isNaN($t)||$t===0)&&($t=le/Math.cos(Math.PI/180*b)),this._point=nt.subtract(E.getPixelOrigin()),this._radius=isNaN($t)?0:nt.x-E.project([St,d-$t]).x,this._radiusY=nt.y-Me.y}else{var fr=F.unproject(F.project(this._latlng).subtract([this._mRadius,0]));this._point=E.latLngToLayerPoint(this._latlng),this._radius=this._point.x-E.latLngToLayerPoint(fr).x}this._updateBounds()}});function ee(d,b,E){return new Pi(d,b,E)}var i=is.extend({options:{smoothFactor:1,noClip:!1},initialize:function(d,b){M(this,b),this._setLatLngs(d)},getLatLngs:function(){return this._latlngs},setLatLngs:function(d){return this._setLatLngs(d),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(d){for(var b=1/0,E=null,F=Ri,X,le,Me=0,$e=this._parts.length;Me<$e;Me++)for(var nt=this._parts[Me],St=1,$t=nt.length;St<$t;St++){X=nt[St-1],le=nt[St];var fr=F(d,X,le,!0);fr<b&&(b=fr,E=F(d,X,le))}return E&&(E.distance=Math.sqrt(b)),E},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Di(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(d,b){return b=b||this._defaultShape(),d=pe(d),b.push(d),this._bounds.extend(d),this.redraw()},_setLatLngs:function(d){this._bounds=new ae,this._latlngs=this._convertLatLngs(d)},_defaultShape:function(){return Yn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(d){for(var b=[],E=Yn(d),F=0,X=d.length;F<X;F++)E?(b[F]=pe(d[F]),this._bounds.extend(b[F])):b[F]=this._convertLatLngs(d[F]);return b},_project:function(){var d=new K;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,d),this._bounds.isValid()&&d.isValid()&&(this._rawPxBounds=d,this._updateBounds())},_updateBounds:function(){var d=this._clickTolerance(),b=new de(d,d);this._rawPxBounds&&(this._pxBounds=new K([this._rawPxBounds.min.subtract(b),this._rawPxBounds.max.add(b)]))},_projectLatlngs:function(d,b,E){var F=d[0]instanceof he,X=d.length,le,Me;if(F){for(Me=[],le=0;le<X;le++)Me[le]=this._map.latLngToLayerPoint(d[le]),E.extend(Me[le]);b.push(Me)}else for(le=0;le<X;le++)this._projectLatlngs(d[le],b,E)},_clipPoints:function(){var d=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}var b=this._parts,E,F,X,le,Me,$e,nt;for(E=0,X=0,le=this._rings.length;E<le;E++)for(nt=this._rings[E],F=0,Me=nt.length;F<Me-1;F++)$e=xi(nt[F],nt[F+1],d,F,!0),$e&&(b[X]=b[X]||[],b[X].push($e[0]),($e[1]!==nt[F+1]||F===Me-2)&&(b[X].push($e[1]),X++))}},_simplifyPoints:function(){for(var d=this._parts,b=this.options.smoothFactor,E=0,F=d.length;E<F;E++)d[E]=Oa(d[E],b)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(d,b){var E,F,X,le,Me,$e,nt=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(E=0,le=this._parts.length;E<le;E++)for($e=this._parts[E],F=0,Me=$e.length,X=Me-1;F<Me;X=F++)if(!(!b&&F===0)&&No(d,$e[X],$e[F])<=nt)return!0;return!1}});function c(d,b){return new i(d,b)}i._flat=to;var h=i.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 rl(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(d){var b=i.prototype._convertLatLngs.call(this,d),E=b.length;return E>=2&&b[0]instanceof he&&b[0].equals(b[E-1])&&b.pop(),b},_setLatLngs:function(d){i.prototype._setLatLngs.call(this,d),Yn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Yn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var d=this._renderer._bounds,b=this.options.weight,E=new de(b,b);if(d=new K(d.min.subtract(E),d.max.add(E)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(d))){if(this.options.noClip){this._parts=this._rings;return}for(var F=0,X=this._rings.length,le;F<X;F++)le=Sc(this._rings[F],d,!0),le.length&&this._parts.push(le)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(d){var b=!1,E,F,X,le,Me,$e,nt,St;if(!this._pxBounds||!this._pxBounds.contains(d))return!1;for(le=0,nt=this._parts.length;le<nt;le++)for(E=this._parts[le],Me=0,St=E.length,$e=St-1;Me<St;$e=Me++)F=E[Me],X=E[$e],F.y>d.y!=X.y>d.y&&d.x<(X.x-F.x)*(d.y-F.y)/(X.y-F.y)+F.x&&(b=!b);return b||i.prototype._containsPoint.call(this,d,!0)}});function x(d,b){return new h(d,b)}var y=ys.extend({initialize:function(d,b){M(this,b),this._layers={},d&&this.addData(d)},addData:function(d){var b=U(d)?d:d.features,E,F,X;if(b){for(E=0,F=b.length;E<F;E++)X=b[E],(X.geometries||X.geometry||X.features||X.coordinates)&&this.addData(X);return this}var le=this.options;if(le.filter&&!le.filter(d))return this;var Me=w(d,le);return Me?(Me.feature=Ce(d),Me.defaultOptions=Me.options,this.resetStyle(Me),le.onEachFeature&&le.onEachFeature(d,Me),this.addLayer(Me)):this},resetStyle:function(d){return d===void 0?this.eachLayer(this.resetStyle,this):(d.options=o({},d.defaultOptions),this._setLayerStyle(d,this.options.style),this)},setStyle:function(d){return this.eachLayer(function(b){this._setLayerStyle(b,d)},this)},_setLayerStyle:function(d,b){d.setStyle&&(typeof b=="function"&&(b=b(d.feature)),d.setStyle(b))}});function w(d,b){var E=d.type==="Feature"?d.geometry:d,F=E?E.coordinates:null,X=[],le=b&&b.pointToLayer,Me=b&&b.coordsToLatLng||A,$e,nt,St,$t;if(!F&&!E)return null;switch(E.type){case"Point":return $e=Me(F),S(le,d,$e,b);case"MultiPoint":for(St=0,$t=F.length;St<$t;St++)$e=Me(F[St]),X.push(S(le,d,$e,b));return new ys(X);case"LineString":case"MultiLineString":return nt=P(F,E.type==="LineString"?0:1,Me),new i(nt,b);case"Polygon":case"MultiPolygon":return nt=P(F,E.type==="Polygon"?1:2,Me),new h(nt,b);case"GeometryCollection":for(St=0,$t=E.geometries.length;St<$t;St++){var fr=w({geometry:E.geometries[St],type:"Feature",properties:d.properties},b);fr&&X.push(fr)}return new ys(X);case"FeatureCollection":for(St=0,$t=E.features.length;St<$t;St++){var Lr=w(E.features[St],b);Lr&&X.push(Lr)}return new ys(X);default:throw new Error("Invalid GeoJSON object.")}}function S(d,b,E,F){return d?d(b,E):new Mn(E,F&&F.markersInheritOptions&&F)}function A(d){return new he(d[1],d[0],d[2])}function P(d,b,E){for(var F=[],X=0,le=d.length,Me;X<le;X++)Me=b?P(d[X],b-1,E):(E||A)(d[X]),F.push(Me);return F}function G(d,b){return d=pe(d),d.alt!==void 0?[C(d.lng,b),C(d.lat,b),C(d.alt,b)]:[C(d.lng,b),C(d.lat,b)]}function te(d,b,E,F){for(var X=[],le=0,Me=d.length;le<Me;le++)X.push(b?te(d[le],Yn(d[le])?0:b-1,E,F):G(d[le],F));return!b&&E&&X.length>0&&X.push(X[0].slice()),X}function oe(d,b){return d.feature?o({},d.feature,{geometry:b}):Ce(b)}function Ce(d){return d.type==="Feature"||d.type==="FeatureCollection"?d:{type:"Feature",properties:{},geometry:d}}var Ie={toGeoJSON:function(d){return oe(this,{type:"Point",coordinates:G(this.getLatLng(),d)})}};Mn.include(Ie),Pi.include(Ie),Os.include(Ie),i.include({toGeoJSON:function(d){var b=!Yn(this._latlngs),E=te(this._latlngs,b?1:0,!1,d);return oe(this,{type:(b?"Multi":"")+"LineString",coordinates:E})}}),h.include({toGeoJSON:function(d){var b=!Yn(this._latlngs),E=b&&!Yn(this._latlngs[0]),F=te(this._latlngs,E?2:b?1:0,!0,d);return b||(F=[F]),oe(this,{type:(E?"Multi":"")+"Polygon",coordinates:F})}}),ei.include({toMultiPoint:function(d){var b=[];return this.eachLayer(function(E){b.push(E.toGeoJSON(d).geometry.coordinates)}),oe(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(d){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(d);var E=b==="GeometryCollection",F=[];return this.eachLayer(function(X){if(X.toGeoJSON){var le=X.toGeoJSON(d);if(E)F.push(le.geometry);else{var Me=Ce(le);Me.type==="FeatureCollection"?F.push.apply(F,Me.features):F.push(Me)}}}),E?oe(this,{geometries:F,type:"GeometryCollection"}):{type:"FeatureCollection",features:F}}});function Pe(d,b){return new y(d,b)}var Ke=Pe,it=$a.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(d,b,E){this._url=d,this._bounds=se(b),M(this,E)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(or(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ea(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(d){return this.options.opacity=d,this._image&&this._updateOpacity(),this},setStyle:function(d){return d.opacity&&this.setOpacity(d.opacity),this},bringToFront:function(){return this._map&&Br(this._image),this},bringToBack:function(){return this._map&&On(this._image),this},setUrl:function(d){return this._url=d,this._image&&(this._image.src=d),this},setBounds:function(d){return this._bounds=se(d),this._map&&this._reset(),this},getEvents:function(){var d={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var d=this._url.tagName==="IMG",b=this._image=d?this._url:br("img");if(or(b,"leaflet-image-layer"),this._zoomAnimated&&or(b,"leaflet-zoom-animated"),this.options.className&&or(b,this.options.className),b.onselectstart=N,b.onmousemove=N,b.onload=f(this.fire,this,"load"),b.onerror=f(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),d){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(d){var b=this._map.getZoomScale(d.zoom),E=this._map._latLngBoundsToNewLayerBounds(this._bounds,d.zoom,d.center).min;we(this._image,E,b)},_reset:function(){var d=this._image,b=new K(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),E=b.getSize();Gt(d,b.min),d.style.width=E.x+"px",d.style.height=E.y+"px"},_updateOpacity:function(){pr(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 d=this.options.errorOverlayUrl;d&&this._url!==d&&(this._url=d,this._image.src=d)},getCenter:function(){return this._bounds.getCenter()}}),Bt=function(d,b,E){return new it(d,b,E)},Pt=it.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var d=this._url.tagName==="VIDEO",b=this._image=d?this._url:br("video");if(or(b,"leaflet-image-layer"),this._zoomAnimated&&or(b,"leaflet-zoom-animated"),this.options.className&&or(b,this.options.className),b.onselectstart=N,b.onmousemove=N,b.onloadeddata=f(this.fire,this,"load"),d){for(var E=b.getElementsByTagName("source"),F=[],X=0;X<E.length;X++)F.push(E[X].src);this._url=E.length>0?F:[b.src];return}U(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var le=0;le<this._url.length;le++){var Me=br("source");Me.src=this._url[le],b.appendChild(Me)}}});function Mt(d,b,E){return new Pt(d,b,E)}var jr=it.extend({_initImage:function(){var d=this._image=this._url;or(d,"leaflet-image-layer"),this._zoomAnimated&&or(d,"leaflet-zoom-animated"),this.options.className&&or(d,this.options.className),d.onselectstart=N,d.onmousemove=N}});function Sr(d,b,E){return new jr(d,b,E)}var Qr=$a.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(d,b){d&&(d instanceof he||U(d))?(this._latlng=pe(d),M(this,b)):(M(this,d),this._source=b),this.options.content&&(this._content=this.options.content)},openOn:function(d){return d=arguments.length?d:this._source._map,d.hasLayer(this)||d.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(d){return this._map?this.close():(arguments.length?this._source=d:d=this._source,this._prepareOpen(),this.openOn(d._map)),this},onAdd:function(d){this._zoomAnimated=d._zoomAnimated,this._container||this._initLayout(),d._fadeAnimated&&pr(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),d._fadeAnimated&&pr(this._container,1),this.bringToFront(),this.options.interactive&&(or(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(d){d._fadeAnimated?(pr(this._container,0),this._removeTimeout=setTimeout(f(ea,void 0,this._container),200)):ea(this._container),this.options.interactive&&(Kr(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(d){return this._latlng=pe(d),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(d){return this._content=d,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 d={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&Br(this._container),this},bringToBack:function(){return this._map&&On(this._container),this},_prepareOpen:function(d){var b=this._source;if(!b._map)return!1;if(b instanceof ys){b=null;var E=this._source._layers;for(var F in E)if(E[F]._map){b=E[F];break}if(!b)return!1;this._source=b}if(!d)if(b.getCenter)d=b.getCenter();else if(b.getLatLng)d=b.getLatLng();else if(b.getBounds)d=b.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(d),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var d=this._contentNode,b=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof b=="string")d.innerHTML=b;else{for(;d.hasChildNodes();)d.removeChild(d.firstChild);d.appendChild(b)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var d=this._map.latLngToLayerPoint(this._latlng),b=_e(this.options.offset),E=this._getAnchor();this._zoomAnimated?Gt(this._container,d.add(E)):b=b.add(d).add(E);var F=this._containerBottom=-b.y,X=this._containerLeft=-Math.round(this._containerWidth/2)+b.x;this._container.style.bottom=F+"px",this._container.style.left=X+"px"}},_getAnchor:function(){return[0,0]}});Ur.include({_initOverlay:function(d,b,E,F){var X=b;return X instanceof d||(X=new d(F).setContent(b)),E&&X.setLatLng(E),X}}),$a.include({_initOverlay:function(d,b,E,F){var X=E;return X instanceof d?(M(X,F),X._source=this):(X=b&&!F?b:new d(F,this),X.setContent(E)),X}});var kn=Qr.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(d){return d=arguments.length?d:this._source._map,!d.hasLayer(this)&&d._popup&&d._popup.options.autoClose&&d.removeLayer(d._popup),d._popup=this,Qr.prototype.openOn.call(this,d)},onAdd:function(d){Qr.prototype.onAdd.call(this,d),d.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof is||this._source.on("preclick",Hn))},onRemove:function(d){Qr.prototype.onRemove.call(this,d),d.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof is||this._source.off("preclick",Hn))},getEvents:function(){var d=Qr.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(d.preclick=this.close),this.options.keepInView&&(d.moveend=this._adjustPan),d},_initLayout:function(){var d="leaflet-popup",b=this._container=br("div",d+" "+(this.options.className||"")+" leaflet-zoom-animated"),E=this._wrapper=br("div",d+"-content-wrapper",b);if(this._contentNode=br("div",d+"-content",E),Wn(b),ps(this._contentNode),mr(b,"contextmenu",Hn),this._tipContainer=br("div",d+"-tip-container",b),this._tip=br("div",d+"-tip",this._tipContainer),this.options.closeButton){var F=this._closeButton=br("a",d+"-close-button",b);F.setAttribute("role","button"),F.setAttribute("aria-label","Close popup"),F.href="#close",F.innerHTML='<span aria-hidden="true">&#215;</span>',mr(F,"click",function(X){Fa(X),this.close()},this)}},_updateLayout:function(){var d=this._contentNode,b=d.style;b.width="",b.whiteSpace="nowrap";var E=d.offsetWidth;E=Math.min(E,this.options.maxWidth),E=Math.max(E,this.options.minWidth),b.width=E+1+"px",b.whiteSpace="",b.height="";var F=d.offsetHeight,X=this.options.maxHeight,le="leaflet-popup-scrolled";X&&F>X?(b.height=X+"px",or(d,le)):Kr(d,le),this._containerWidth=this._container.offsetWidth},_animateZoom:function(d){var b=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center),E=this._getAnchor();Gt(this._container,b.add(E))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var d=this._map,b=parseInt(Nr(this._container,"marginBottom"),10)||0,E=this._container.offsetHeight+b,F=this._containerWidth,X=new de(this._containerLeft,-E-this._containerBottom);X._add(pa(this._container));var le=d.layerPointToContainerPoint(X),Me=_e(this.options.autoPanPadding),$e=_e(this.options.autoPanPaddingTopLeft||Me),nt=_e(this.options.autoPanPaddingBottomRight||Me),St=d.getSize(),$t=0,fr=0;le.x+F+nt.x>St.x&&($t=le.x+F-St.x+nt.x),le.x-$t-$e.x<0&&($t=le.x-$e.x),le.y+E+nt.y>St.y&&(fr=le.y+E-St.y+nt.y),le.y-fr-$e.y<0&&(fr=le.y-$e.y),($t||fr)&&(this.options.keepInView&&(this._autopanning=!0),d.fire("autopanstart").panBy([$t,fr]))}},_getAnchor:function(){return _e(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Nn=function(d,b){return new kn(d,b)};Ur.mergeOptions({closePopupOnClick:!0}),Ur.include({openPopup:function(d,b,E){return this._initOverlay(kn,d,b,E).openOn(this),this},closePopup:function(d){return d=arguments.length?d:this._popup,d&&d.close(),this}}),$a.include({bindPopup:function(d,b){return this._popup=this._initOverlay(kn,this._popup,d,b),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(d){return this._popup&&(this instanceof ys||(this._popup._source=this),this._popup._prepareOpen(d||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(d){return this._popup&&this._popup.setContent(d),this},getPopup:function(){return this._popup},_openPopup:function(d){if(!(!this._popup||!this._map)){ns(d);var b=d.layer||d.target;if(this._popup._source===b&&!(b instanceof is)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(d.latlng);return}this._popup._source=b,this.openPopup(d.latlng)}},_movePopup:function(d){this._popup.setLatLng(d.latlng)},_onKeyPress:function(d){d.originalEvent.keyCode===13&&this._openPopup(d)}});var qr=Qr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(d){Qr.prototype.onAdd.call(this,d),this.setOpacity(this.options.opacity),d.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(d){Qr.prototype.onRemove.call(this,d),d.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var d=Qr.prototype.getEvents.call(this);return this.options.permanent||(d.preclick=this.close),d},_initLayout:function(){var d="leaflet-tooltip",b=d+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=br("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+v(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(d){var b,E,F=this._map,X=this._container,le=F.latLngToContainerPoint(F.getCenter()),Me=F.layerPointToContainerPoint(d),$e=this.options.direction,nt=X.offsetWidth,St=X.offsetHeight,$t=_e(this.options.offset),fr=this._getAnchor();$e==="top"?(b=nt/2,E=St):$e==="bottom"?(b=nt/2,E=0):$e==="center"?(b=nt/2,E=St/2):$e==="right"?(b=0,E=St/2):$e==="left"?(b=nt,E=St/2):Me.x<le.x?($e="right",b=0,E=St/2):($e="left",b=nt+($t.x+fr.x)*2,E=St/2),d=d.subtract(_e(b,E,!0)).add($t).add(fr),Kr(X,"leaflet-tooltip-right"),Kr(X,"leaflet-tooltip-left"),Kr(X,"leaflet-tooltip-top"),Kr(X,"leaflet-tooltip-bottom"),or(X,"leaflet-tooltip-"+$e),Gt(X,d)},_updatePosition:function(){var d=this._map.latLngToLayerPoint(this._latlng);this._setPosition(d)},setOpacity:function(d){this.options.opacity=d,this._container&&pr(this._container,d)},_animateZoom:function(d){var b=this._map._latLngToNewLayerPoint(this._latlng,d.zoom,d.center);this._setPosition(b)},_getAnchor:function(){return _e(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),ln=function(d,b){return new qr(d,b)};Ur.include({openTooltip:function(d,b,E){return this._initOverlay(qr,d,b,E).openOn(this),this},closeTooltip:function(d){return d.close(),this}}),$a.include({bindTooltip:function(d,b){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(qr,this._tooltip,d,b),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(d){if(!(!d&&this._tooltipHandlersAdded)){var b=d?"off":"on",E={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?E.add=this._openTooltip:(E.mouseover=this._openTooltip,E.mouseout=this.closeTooltip,E.click=this._openTooltip,this._map?this._addFocusListeners():E.add=this._addFocusListeners),this._tooltip.options.sticky&&(E.mousemove=this._moveTooltip),this[b](E),this._tooltipHandlersAdded=!d}},openTooltip:function(d){return this._tooltip&&(this instanceof ys||(this._tooltip._source=this),this._tooltip._prepareOpen(d)&&(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(d){return this._tooltip&&this._tooltip.setContent(d),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(d){var b=typeof d.getElement=="function"&&d.getElement();b&&(mr(b,"focus",function(){this._tooltip._source=d,this.openTooltip()},this),mr(b,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(d){var b=typeof d.getElement=="function"&&d.getElement();b&&b.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(d){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var b=this;this._map.once("moveend",function(){b._openOnceFlag=!1,b._openTooltip(d)});return}this._tooltip._source=d.layer||d.target,this.openTooltip(this._tooltip.options.sticky?d.latlng:void 0)}},_moveTooltip:function(d){var b=d.latlng,E,F;this._tooltip.options.sticky&&d.originalEvent&&(E=this._map.mouseEventToContainerPoint(d.originalEvent),F=this._map.containerPointToLayerPoint(E),b=this._map.layerPointToLatLng(F)),this._tooltip.setLatLng(b)}});var Rn=js.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(d){var b=d&&d.tagName==="DIV"?d:document.createElement("div"),E=this.options;if(E.html instanceof Element?(jn(b),b.appendChild(E.html)):b.innerHTML=E.html!==!1?E.html:"",E.bgPos){var F=_e(E.bgPos);b.style.backgroundPosition=-F.x+"px "+-F.y+"px"}return this._setIconStyles(b,"icon"),b},createShadow:function(){return null}});function no(d){return new Rn(d)}js.Default=So;var vs=$a.extend({options:{tileSize:256,opacity:1,updateWhenIdle:rr.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(d){M(this,d)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(d){d._addZoomLimit(this)},onRemove:function(d){this._removeAllTiles(),ea(this._container),d._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Br(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(On(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(d){return this.options.opacity=d,this._updateOpacity(),this},setZIndex:function(d){return this.options.zIndex=d,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var d=this._clampZoom(this._map.getZoom());d!==this._tileZoom&&(this._tileZoom=d,this._updateLevels()),this._update()}return this},getEvents:function(){var d={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=p(this._onMoveEnd,this.options.updateInterval,this)),d.move=this._onMove),this._zoomAnimated&&(d.zoomanim=this._animateZoom),d},createTile:function(){return document.createElement("div")},getTileSize:function(){var d=this.options.tileSize;return d instanceof de?d:new de(d,d)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(d){for(var b=this.getPane().children,E=-d(-1/0,1/0),F=0,X=b.length,le;F<X;F++)le=b[F].style.zIndex,b[F]!==this._container&&le&&(E=d(E,+le));isFinite(E)&&(this.options.zIndex=E+d(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!rr.ielt9){pr(this._container,this.options.opacity);var d=+new Date,b=!1,E=!1;for(var F in this._tiles){var X=this._tiles[F];if(!(!X.current||!X.loaded)){var le=Math.min(1,(d-X.loaded)/200);pr(X.el,le),le<1?b=!0:(X.active?E=!0:this._onOpaqueTile(X),X.active=!0)}}E&&!this._noPrune&&this._pruneTiles(),b&&(me(this._fadeFrame),this._fadeFrame=je(this._updateOpacity,this))}},_onOpaqueTile:N,_initContainer:function(){this._container||(this._container=br("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var d=this._tileZoom,b=this.options.maxZoom;if(d!==void 0){for(var E in this._levels)E=Number(E),this._levels[E].el.children.length||E===d?(this._levels[E].el.style.zIndex=b-Math.abs(d-E),this._onUpdateLevel(E)):(ea(this._levels[E].el),this._removeTilesAtZoom(E),this._onRemoveLevel(E),delete this._levels[E]);var F=this._levels[d],X=this._map;return F||(F=this._levels[d]={},F.el=br("div","leaflet-tile-container leaflet-zoom-animated",this._container),F.el.style.zIndex=b,F.origin=X.project(X.unproject(X.getPixelOrigin()),d).round(),F.zoom=d,this._setZoomTransform(F,X.getCenter(),X.getZoom()),N(F.el.offsetWidth),this._onCreateLevel(F)),this._level=F,F}},_onUpdateLevel:N,_onRemoveLevel:N,_onCreateLevel:N,_pruneTiles:function(){if(this._map){var d,b,E=this._map.getZoom();if(E>this.options.maxZoom||E<this.options.minZoom){this._removeAllTiles();return}for(d in this._tiles)b=this._tiles[d],b.retain=b.current;for(d in this._tiles)if(b=this._tiles[d],b.current&&!b.active){var F=b.coords;this._retainParent(F.x,F.y,F.z,F.z-5)||this._retainChildren(F.x,F.y,F.z,F.z+2)}for(d in this._tiles)this._tiles[d].retain||this._removeTile(d)}},_removeTilesAtZoom:function(d){for(var b in this._tiles)this._tiles[b].coords.z===d&&this._removeTile(b)},_removeAllTiles:function(){for(var d in this._tiles)this._removeTile(d)},_invalidateAll:function(){for(var d in this._levels)ea(this._levels[d].el),this._onRemoveLevel(Number(d)),delete this._levels[d];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(d,b,E,F){var X=Math.floor(d/2),le=Math.floor(b/2),Me=E-1,$e=new de(+X,+le);$e.z=+Me;var nt=this._tileCoordsToKey($e),St=this._tiles[nt];return St&&St.active?(St.retain=!0,!0):(St&&St.loaded&&(St.retain=!0),Me>F?this._retainParent(X,le,Me,F):!1)},_retainChildren:function(d,b,E,F){for(var X=2*d;X<2*d+2;X++)for(var le=2*b;le<2*b+2;le++){var Me=new de(X,le);Me.z=E+1;var $e=this._tileCoordsToKey(Me),nt=this._tiles[$e];if(nt&&nt.active){nt.retain=!0;continue}else nt&&nt.loaded&&(nt.retain=!0);E+1<F&&this._retainChildren(X,le,E+1,F)}},_resetView:function(d){var b=d&&(d.pinch||d.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),b,b)},_animateZoom:function(d){this._setView(d.center,d.zoom,!0,d.noUpdate)},_clampZoom:function(d){var b=this.options;return b.minNativeZoom!==void 0&&d<b.minNativeZoom?b.minNativeZoom:b.maxNativeZoom!==void 0&&b.maxNativeZoom<d?b.maxNativeZoom:d},_setView:function(d,b,E,F){var X=Math.round(b);this.options.maxZoom!==void 0&&X>this.options.maxZoom||this.options.minZoom!==void 0&&X<this.options.minZoom?X=void 0:X=this._clampZoom(X);var le=this.options.updateWhenZooming&&X!==this._tileZoom;(!F||le)&&(this._tileZoom=X,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),X!==void 0&&this._update(d),E||this._pruneTiles(),this._noPrune=!!E),this._setZoomTransforms(d,b)},_setZoomTransforms:function(d,b){for(var E in this._levels)this._setZoomTransform(this._levels[E],d,b)},_setZoomTransform:function(d,b,E){var F=this._map.getZoomScale(E,d.zoom),X=d.origin.multiplyBy(F).subtract(this._map._getNewPixelOrigin(b,E)).round();rr.any3d?we(d.el,X,F):Gt(d.el,X)},_resetGrid:function(){var d=this._map,b=d.options.crs,E=this._tileSize=this.getTileSize(),F=this._tileZoom,X=this._map.getPixelWorldBounds(this._tileZoom);X&&(this._globalTileRange=this._pxBoundsToTileRange(X)),this._wrapX=b.wrapLng&&!this.options.noWrap&&[Math.floor(d.project([0,b.wrapLng[0]],F).x/E.x),Math.ceil(d.project([0,b.wrapLng[1]],F).x/E.y)],this._wrapY=b.wrapLat&&!this.options.noWrap&&[Math.floor(d.project([b.wrapLat[0],0],F).y/E.x),Math.ceil(d.project([b.wrapLat[1],0],F).y/E.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(d){var b=this._map,E=b._animatingZoom?Math.max(b._animateToZoom,b.getZoom()):b.getZoom(),F=b.getZoomScale(E,this._tileZoom),X=b.project(d,this._tileZoom).floor(),le=b.getSize().divideBy(F*2);return new K(X.subtract(le),X.add(le))},_update:function(d){var b=this._map;if(b){var E=this._clampZoom(b.getZoom());if(d===void 0&&(d=b.getCenter()),this._tileZoom!==void 0){var F=this._getTiledPixelBounds(d),X=this._pxBoundsToTileRange(F),le=X.getCenter(),Me=[],$e=this.options.keepBuffer,nt=new K(X.getBottomLeft().subtract([$e,-$e]),X.getTopRight().add([$e,-$e]));if(!(isFinite(X.min.x)&&isFinite(X.min.y)&&isFinite(X.max.x)&&isFinite(X.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var St in this._tiles){var $t=this._tiles[St].coords;($t.z!==this._tileZoom||!nt.contains(new de($t.x,$t.y)))&&(this._tiles[St].current=!1)}if(Math.abs(E-this._tileZoom)>1){this._setView(d,E);return}for(var fr=X.min.y;fr<=X.max.y;fr++)for(var Lr=X.min.x;Lr<=X.max.x;Lr++){var Sn=new de(Lr,fr);if(Sn.z=this._tileZoom,!!this._isValidTile(Sn)){var qa=this._tiles[this._tileCoordsToKey(Sn)];qa?qa.current=!0:Me.push(Sn)}}if(Me.sort(function(ra,aa){return ra.distanceTo(le)-aa.distanceTo(le)}),Me.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var _s=document.createDocumentFragment();for(Lr=0;Lr<Me.length;Lr++)this._addTile(Me[Lr],_s);this._level.el.appendChild(_s)}}}},_isValidTile:function(d){var b=this._map.options.crs;if(!b.infinite){var E=this._globalTileRange;if(!b.wrapLng&&(d.x<E.min.x||d.x>E.max.x)||!b.wrapLat&&(d.y<E.min.y||d.y>E.max.y))return!1}if(!this.options.bounds)return!0;var F=this._tileCoordsToBounds(d);return se(this.options.bounds).overlaps(F)},_keyToBounds:function(d){return this._tileCoordsToBounds(this._keyToTileCoords(d))},_tileCoordsToNwSe:function(d){var b=this._map,E=this.getTileSize(),F=d.scaleBy(E),X=F.add(E),le=b.unproject(F,d.z),Me=b.unproject(X,d.z);return[le,Me]},_tileCoordsToBounds:function(d){var b=this._tileCoordsToNwSe(d),E=new ae(b[0],b[1]);return this.options.noWrap||(E=this._map.wrapLatLngBounds(E)),E},_tileCoordsToKey:function(d){return d.x+":"+d.y+":"+d.z},_keyToTileCoords:function(d){var b=d.split(":"),E=new de(+b[0],+b[1]);return E.z=+b[2],E},_removeTile:function(d){var b=this._tiles[d];b&&(ea(b.el),delete this._tiles[d],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(d)}))},_initTile:function(d){or(d,"leaflet-tile");var b=this.getTileSize();d.style.width=b.x+"px",d.style.height=b.y+"px",d.onselectstart=N,d.onmousemove=N,rr.ielt9&&this.options.opacity<1&&pr(d,this.options.opacity)},_addTile:function(d,b){var E=this._getTilePos(d),F=this._tileCoordsToKey(d),X=this.createTile(this._wrapCoords(d),f(this._tileReady,this,d));this._initTile(X),this.createTile.length<2&&je(f(this._tileReady,this,d,null,X)),Gt(X,E),this._tiles[F]={el:X,coords:d,current:!0},b.appendChild(X),this.fire("tileloadstart",{tile:X,coords:d})},_tileReady:function(d,b,E){b&&this.fire("tileerror",{error:b,tile:E,coords:d});var F=this._tileCoordsToKey(d);E=this._tiles[F],E&&(E.loaded=+new Date,this._map._fadeAnimated?(pr(E.el,0),me(this._fadeFrame),this._fadeFrame=je(this._updateOpacity,this)):(E.active=!0,this._pruneTiles()),b||(or(E.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:E.el,coords:d})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),rr.ielt9||!this._map._fadeAnimated?je(this._pruneTiles,this):setTimeout(f(this._pruneTiles,this),250)))},_getTilePos:function(d){return d.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(d){var b=new de(this._wrapX?k(d.x,this._wrapX):d.x,this._wrapY?k(d.y,this._wrapY):d.y);return b.z=d.z,b},_pxBoundsToTileRange:function(d){var b=this.getTileSize();return new K(d.min.unscaleBy(b).floor(),d.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var d in this._tiles)if(!this._tiles[d].loaded)return!1;return!0}});function Ac(d){return new vs(d)}var pi=vs.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(d,b){this._url=d,b=M(this,b),b.detectRetina&&rr.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(d,b){return this._url===d&&b===void 0&&(b=!0),this._url=d,b||this.redraw(),this},createTile:function(d,b){var E=document.createElement("img");return mr(E,"load",f(this._tileOnLoad,this,b,E)),mr(E,"error",f(this._tileOnError,this,b,E)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(E.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(E.referrerPolicy=this.options.referrerPolicy),E.alt="",E.src=this.getTileUrl(d),E},getTileUrl:function(d){var b={r:rr.retina?"@2x":"",s:this._getSubdomain(d),x:d.x,y:d.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var E=this._globalTileRange.max.y-d.y;this.options.tms&&(b.y=E),b["-y"]=E}return B(this._url,o(b,this.options))},_tileOnLoad:function(d,b){rr.ielt9?setTimeout(f(d,this,null,b),0):d(null,b)},_tileOnError:function(d,b,E){var F=this.options.errorTileUrl;F&&b.getAttribute("src")!==F&&(b.src=F),d(E,b)},_onTileRemove:function(d){d.tile.onload=null},_getZoomForUrl:function(){var d=this._tileZoom,b=this.options.maxZoom,E=this.options.zoomReverse,F=this.options.zoomOffset;return E&&(d=b-d),d+F},_getSubdomain:function(d){var b=Math.abs(d.x+d.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var d,b;for(d in this._tiles)if(this._tiles[d].coords.z!==this._tileZoom&&(b=this._tiles[d].el,b.onload=N,b.onerror=N,!b.complete)){b.src=q;var E=this._tiles[d].coords;ea(b),delete this._tiles[d],this.fire("tileabort",{tile:b,coords:E})}},_removeTile:function(d){var b=this._tiles[d];if(b)return b.el.setAttribute("src",q),vs.prototype._removeTile.call(this,d)},_tileReady:function(d,b,E){if(!(!this._map||E&&E.getAttribute("src")===q))return vs.prototype._tileReady.call(this,d,b,E)}});function Ms(d,b){return new pi(d,b)}var zl=pi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(d,b){this._url=d;var E=o({},this.defaultWmsParams);for(var F in b)F in this.options||(E[F]=b[F]);b=M(this,b);var X=b.detectRetina&&rr.retina?2:1,le=this.getTileSize();E.width=le.x*X,E.height=le.y*X,this.wmsParams=E},onAdd:function(d){this._crs=this.options.crs||d.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,pi.prototype.onAdd.call(this,d)},getTileUrl:function(d){var b=this._tileCoordsToNwSe(d),E=this._crs,F=W(E.project(b[0]),E.project(b[1])),X=F.min,le=F.max,Me=(this._wmsVersion>=1.3&&this._crs===Ii?[X.y,X.x,le.y,le.x]:[X.x,X.y,le.x,le.y]).join(","),$e=pi.prototype.getTileUrl.call(this,d);return $e+D(this.wmsParams,$e,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Me},setParams:function(d,b){return o(this.wmsParams,d),b||this.redraw(),this}});function Rs(d,b){return new zl(d,b)}pi.WMS=zl,Ms.wms=Rs;var os=$a.extend({options:{padding:.1},initialize:function(d){M(this,d),v(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),or(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 d={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(d.zoomanim=this._onAnimZoom),d},_onAnimZoom:function(d){this._updateTransform(d.center,d.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(d,b){var E=this._map.getZoomScale(b,this._zoom),F=this._map.getSize().multiplyBy(.5+this.options.padding),X=this._map.project(this._center,b),le=F.multiplyBy(-E).add(X).subtract(this._map._getNewPixelOrigin(d,b));rr.any3d?we(this._container,le,E):Gt(this._container,le)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var d in this._layers)this._layers[d]._reset()},_onZoomEnd:function(){for(var d in this._layers)this._layers[d]._project()},_updatePaths:function(){for(var d in this._layers)this._layers[d]._update()},_update:function(){var d=this.options.padding,b=this._map.getSize(),E=this._map.containerPointToLayerPoint(b.multiplyBy(-d)).round();this._bounds=new K(E,E.add(b.multiplyBy(1+d*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),jc=os.extend({options:{tolerance:0},getEvents:function(){var d=os.prototype.getEvents.call(this);return d.viewprereset=this._onViewPreReset,d},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){os.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var d=this._container=document.createElement("canvas");mr(d,"mousemove",this._onMouseMove,this),mr(d,"click dblclick mousedown mouseup contextmenu",this._onClick,this),mr(d,"mouseout",this._handleMouseOut,this),d._leaflet_disable_events=!0,this._ctx=d.getContext("2d")},_destroyContainer:function(){me(this._redrawRequest),delete this._ctx,ea(this._container),qt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var d;this._redrawBounds=null;for(var b in this._layers)d=this._layers[b],d._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){os.prototype._update.call(this);var d=this._bounds,b=this._container,E=d.getSize(),F=rr.retina?2:1;Gt(b,d.min),b.width=F*E.x,b.height=F*E.y,b.style.width=E.x+"px",b.style.height=E.y+"px",rr.retina&&this._ctx.scale(2,2),this._ctx.translate(-d.min.x,-d.min.y),this.fire("update")}},_reset:function(){os.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(d){this._updateDashArray(d),this._layers[v(d)]=d;var b=d._order={layer:d,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(d){this._requestRedraw(d)},_removePath:function(d){var b=d._order,E=b.next,F=b.prev;E?E.prev=F:this._drawLast=F,F?F.next=E:this._drawFirst=E,delete d._order,delete this._layers[v(d)],this._requestRedraw(d)},_updatePath:function(d){this._extendRedrawBounds(d),d._project(),d._update(),this._requestRedraw(d)},_updateStyle:function(d){this._updateDashArray(d),this._requestRedraw(d)},_updateDashArray:function(d){if(typeof d.options.dashArray=="string"){var b=d.options.dashArray.split(/[, ]+/),E=[],F,X;for(X=0;X<b.length;X++){if(F=Number(b[X]),isNaN(F))return;E.push(F)}d.options._dashArray=E}else d.options._dashArray=d.options.dashArray},_requestRedraw:function(d){this._map&&(this._extendRedrawBounds(d),this._redrawRequest=this._redrawRequest||je(this._redraw,this))},_extendRedrawBounds:function(d){if(d._pxBounds){var b=(d.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new K,this._redrawBounds.extend(d._pxBounds.min.subtract([b,b])),this._redrawBounds.extend(d._pxBounds.max.add([b,b]))}},_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 d=this._redrawBounds;if(d){var b=d.getSize();this._ctx.clearRect(d.min.x,d.min.y,b.x,b.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 d,b=this._redrawBounds;if(this._ctx.save(),b){var E=b.getSize();this._ctx.beginPath(),this._ctx.rect(b.min.x,b.min.y,E.x,E.y),this._ctx.clip()}this._drawing=!0;for(var F=this._drawFirst;F;F=F.next)d=F.layer,(!b||d._pxBounds&&d._pxBounds.intersects(b))&&d._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(d,b){if(this._drawing){var E,F,X,le,Me=d._parts,$e=Me.length,nt=this._ctx;if($e){for(nt.beginPath(),E=0;E<$e;E++){for(F=0,X=Me[E].length;F<X;F++)le=Me[E][F],nt[F?"lineTo":"moveTo"](le.x,le.y);b&&nt.closePath()}this._fillStroke(nt,d)}}},_updateCircle:function(d){if(!(!this._drawing||d._empty())){var b=d._point,E=this._ctx,F=Math.max(Math.round(d._radius),1),X=(Math.max(Math.round(d._radiusY),1)||F)/F;X!==1&&(E.save(),E.scale(1,X)),E.beginPath(),E.arc(b.x,b.y/X,F,0,Math.PI*2,!1),X!==1&&E.restore(),this._fillStroke(E,d)}},_fillStroke:function(d,b){var E=b.options;E.fill&&(d.globalAlpha=E.fillOpacity,d.fillStyle=E.fillColor||E.color,d.fill(E.fillRule||"evenodd")),E.stroke&&E.weight!==0&&(d.setLineDash&&d.setLineDash(b.options&&b.options._dashArray||[]),d.globalAlpha=E.opacity,d.lineWidth=E.weight,d.strokeStyle=E.color,d.lineCap=E.lineCap,d.lineJoin=E.lineJoin,d.stroke())},_onClick:function(d){for(var b=this._map.mouseEventToLayerPoint(d),E,F,X=this._drawFirst;X;X=X.next)E=X.layer,E.options.interactive&&E._containsPoint(b)&&(!(d.type==="click"||d.type==="preclick")||!this._map._draggableMoved(E))&&(F=E);this._fireEvent(F?[F]:!1,d)},_onMouseMove:function(d){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var b=this._map.mouseEventToLayerPoint(d);this._handleMouseHover(d,b)}},_handleMouseOut:function(d){var b=this._hoveredLayer;b&&(Kr(this._container,"leaflet-interactive"),this._fireEvent([b],d,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(d,b){if(!this._mouseHoverThrottled){for(var E,F,X=this._drawFirst;X;X=X.next)E=X.layer,E.options.interactive&&E._containsPoint(b)&&(F=E);F!==this._hoveredLayer&&(this._handleMouseOut(d),F&&(or(this._container,"leaflet-interactive"),this._fireEvent([F],d,"mouseover"),this._hoveredLayer=F)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,d),this._mouseHoverThrottled=!0,setTimeout(f(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(d,b,E){this._map._fireDOMEvent(b,E||b.type,d)},_bringToFront:function(d){var b=d._order;if(b){var E=b.next,F=b.prev;if(E)E.prev=F;else return;F?F.next=E:E&&(this._drawFirst=E),b.prev=this._drawLast,this._drawLast.next=b,b.next=null,this._drawLast=b,this._requestRedraw(d)}},_bringToBack:function(d){var b=d._order;if(b){var E=b.next,F=b.prev;if(F)F.next=E;else return;E?E.prev=F:F&&(this._drawLast=F),b.prev=null,b.next=this._drawFirst,this._drawFirst.prev=b,this._drawFirst=b,this._requestRedraw(d)}}});function Hl(d){return rr.canvas?new jc(d):null}var so=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(d){return document.createElement("<lvml:"+d+' class="lvml">')}}catch(d){}return function(d){return document.createElement("<"+d+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),zd={_initContainer:function(){this._container=br("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(os.prototype._update.call(this),this.fire("update"))},_initPath:function(d){var b=d._container=so("shape");or(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",d._path=so("path"),b.appendChild(d._path),this._updateStyle(d),this._layers[v(d)]=d},_addPath:function(d){var b=d._container;this._container.appendChild(b),d.options.interactive&&d.addInteractiveTarget(b)},_removePath:function(d){var b=d._container;ea(b),d.removeInteractiveTarget(b),delete this._layers[v(d)]},_updateStyle:function(d){var b=d._stroke,E=d._fill,F=d.options,X=d._container;X.stroked=!!F.stroke,X.filled=!!F.fill,F.stroke?(b||(b=d._stroke=so("stroke")),X.appendChild(b),b.weight=F.weight+"px",b.color=F.color,b.opacity=F.opacity,F.dashArray?b.dashStyle=U(F.dashArray)?F.dashArray.join(" "):F.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=F.lineCap.replace("butt","flat"),b.joinstyle=F.lineJoin):b&&(X.removeChild(b),d._stroke=null),F.fill?(E||(E=d._fill=so("fill")),X.appendChild(E),E.color=F.fillColor||F.color,E.opacity=F.fillOpacity):E&&(X.removeChild(E),d._fill=null)},_updateCircle:function(d){var b=d._point.round(),E=Math.round(d._radius),F=Math.round(d._radiusY||E);this._setPath(d,d._empty()?"M0 0":"AL "+b.x+","+b.y+" "+E+","+F+" 0,"+65535*360)},_setPath:function(d,b){d._path.v=b},_bringToFront:function(d){Br(d._container)},_bringToBack:function(d){On(d._container)}},yi=rr.vml?so:tr,sl=os.extend({_initContainer:function(){this._container=yi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=yi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ea(this._container),qt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){os.prototype._update.call(this);var d=this._bounds,b=d.getSize(),E=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,E.setAttribute("width",b.x),E.setAttribute("height",b.y)),Gt(E,d.min),E.setAttribute("viewBox",[d.min.x,d.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(d){var b=d._path=yi("path");d.options.className&&or(b,d.options.className),d.options.interactive&&or(b,"leaflet-interactive"),this._updateStyle(d),this._layers[v(d)]=d},_addPath:function(d){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(d._path),d.addInteractiveTarget(d._path)},_removePath:function(d){ea(d._path),d.removeInteractiveTarget(d._path),delete this._layers[v(d)]},_updatePath:function(d){d._project(),d._update()},_updateStyle:function(d){var b=d._path,E=d.options;b&&(E.stroke?(b.setAttribute("stroke",E.color),b.setAttribute("stroke-opacity",E.opacity),b.setAttribute("stroke-width",E.weight),b.setAttribute("stroke-linecap",E.lineCap),b.setAttribute("stroke-linejoin",E.lineJoin),E.dashArray?b.setAttribute("stroke-dasharray",E.dashArray):b.removeAttribute("stroke-dasharray"),E.dashOffset?b.setAttribute("stroke-dashoffset",E.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),E.fill?(b.setAttribute("fill",E.fillColor||E.color),b.setAttribute("fill-opacity",E.fillOpacity),b.setAttribute("fill-rule",E.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(d,b){this._setPath(d,Kt(d._parts,b))},_updateCircle:function(d){var b=d._point,E=Math.max(Math.round(d._radius),1),F=Math.max(Math.round(d._radiusY),1)||E,X="a"+E+","+F+" 0 1,0 ",le=d._empty()?"M0 0":"M"+(b.x-E)+","+b.y+X+E*2+",0 "+X+-E*2+",0 ";this._setPath(d,le)},_setPath:function(d,b){d._path.setAttribute("d",b)},_bringToFront:function(d){Br(d._path)},_bringToBack:function(d){On(d._path)}});rr.vml&&sl.include(zd);function Wl(d){return rr.svg||rr.vml?new sl(d):null}Ur.include({getRenderer:function(d){var b=d.options.renderer||this._getPaneRenderer(d.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(d){if(d==="overlayPane"||d===void 0)return!1;var b=this._paneRenderers[d];return b===void 0&&(b=this._createRenderer({pane:d}),this._paneRenderers[d]=b),b},_createRenderer:function(d){return this.options.preferCanvas&&Hl(d)||Wl(d)}});var Eo=h.extend({initialize:function(d,b){h.prototype.initialize.call(this,this._boundsToLatLngs(d),b)},setBounds:function(d){return this.setLatLngs(this._boundsToLatLngs(d))},_boundsToLatLngs:function(d){return d=se(d),[d.getSouthWest(),d.getNorthWest(),d.getNorthEast(),d.getSouthEast()]}});function zh(d,b){return new Eo(d,b)}sl.create=yi,sl.pointsToPath=Kt,y.geometryToLayer=w,y.coordsToLatLng=A,y.coordsToLatLngs=P,y.latLngToCoords=G,y.latLngsToCoords=te,y.getFeature=oe,y.asFeature=Ce,Ur.mergeOptions({boxZoom:!0});var ls=Xn.extend({initialize:function(d){this._map=d,this._container=d._container,this._pane=d._panes.overlayPane,this._resetStateTimeout=0,d.on("unload",this._destroy,this)},addHooks:function(){mr(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){qt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ea(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(d){if(!d.shiftKey||d.which!==1&&d.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),an(),ur(),this._startPoint=this._map.mouseEventToContainerPoint(d),mr(document,{contextmenu:ns,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(d){this._moved||(this._moved=!0,this._box=br("div","leaflet-zoom-box",this._container),or(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(d);var b=new K(this._point,this._startPoint),E=b.getSize();Gt(this._box,b.min),this._box.style.width=E.x+"px",this._box.style.height=E.y+"px"},_finish:function(){this._moved&&(ea(this._box),Kr(this._container,"leaflet-crosshair")),Ts(),da(),qt(document,{contextmenu:ns,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(d){if(!(d.which!==1&&d.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(f(this._resetState,this),0);var b=new ae(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(d){d.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Ur.addInitHook("addHandler","boxZoom",ls),Ur.mergeOptions({doubleClickZoom:!0});var Oc=Xn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(d){var b=this._map,E=b.getZoom(),F=b.options.zoomDelta,X=d.originalEvent.shiftKey?E-F:E+F;b.options.doubleClickZoom==="center"?b.setZoom(X):b.setZoomAround(d.containerPoint,X)}});Ur.addInitHook("addHandler","doubleClickZoom",Oc),Ur.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var bi=Xn.extend({addHooks:function(){if(!this._draggable){var d=this._map;this._draggable=new gi(d._mapPane,d._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),d.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),d.on("zoomend",this._onZoomEnd,this),d.whenReady(this._onZoomEnd,this))}or(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Kr(this._map._container,"leaflet-grab"),Kr(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 d=this._map;if(d._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=se(this._map.options.maxBounds);this._offsetLimit=W(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;d.fire("movestart").fire("dragstart"),d.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(d){if(this._map.options.inertia){var b=this._lastTime=+new Date,E=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(E),this._times.push(b),this._prunePositions(b)}this._map.fire("move",d).fire("drag",d)},_prunePositions:function(d){for(;this._positions.length>1&&d-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var d=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(d).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(d,b){return d-(d-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var d=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;d.x<b.min.x&&(d.x=this._viscousLimit(d.x,b.min.x)),d.y<b.min.y&&(d.y=this._viscousLimit(d.y,b.min.y)),d.x>b.max.x&&(d.x=this._viscousLimit(d.x,b.max.x)),d.y>b.max.y&&(d.y=this._viscousLimit(d.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(d)}},_onPreDragWrap:function(){var d=this._worldWidth,b=Math.round(d/2),E=this._initialWorldOffset,F=this._draggable._newPos.x,X=(F-b+E)%d+b-E,le=(F+b+E)%d-b-E,Me=Math.abs(X+E)<Math.abs(le+E)?X:le;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=Me},_onDragEnd:function(d){var b=this._map,E=b.options,F=!E.inertia||d.noInertia||this._times.length<2;if(b.fire("dragend",d),F)b.fire("moveend");else{this._prunePositions(+new Date);var X=this._lastPos.subtract(this._positions[0]),le=(this._lastTime-this._times[0])/1e3,Me=E.easeLinearity,$e=X.multiplyBy(Me/le),nt=$e.distanceTo([0,0]),St=Math.min(E.inertiaMaxSpeed,nt),$t=$e.multiplyBy(St/nt),fr=St/(E.inertiaDeceleration*Me),Lr=$t.multiplyBy(-fr/2).round();!Lr.x&&!Lr.y?b.fire("moveend"):(Lr=b._limitOffset(Lr,b.options.maxBounds),je(function(){b.panBy(Lr,{duration:fr,easeLinearity:Me,noMoveStart:!0,animate:!0})}))}}});Ur.addInitHook("addHandler","dragging",bi),Ur.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Hd=Xn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(d){this._map=d,this._setPanDelta(d.options.keyboardPanDelta),this._setZoomDelta(d.options.zoomDelta)},addHooks:function(){var d=this._map._container;d.tabIndex<=0&&(d.tabIndex="0"),mr(d,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),qt(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 d=document.body,b=document.documentElement,E=d.scrollTop||b.scrollTop,F=d.scrollLeft||b.scrollLeft;this._map._container.focus(),window.scrollTo(F,E)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(d){var b=this._panKeys={},E=this.keyCodes,F,X;for(F=0,X=E.left.length;F<X;F++)b[E.left[F]]=[-1*d,0];for(F=0,X=E.right.length;F<X;F++)b[E.right[F]]=[d,0];for(F=0,X=E.down.length;F<X;F++)b[E.down[F]]=[0,d];for(F=0,X=E.up.length;F<X;F++)b[E.up[F]]=[0,-1*d]},_setZoomDelta:function(d){var b=this._zoomKeys={},E=this.keyCodes,F,X;for(F=0,X=E.zoomIn.length;F<X;F++)b[E.zoomIn[F]]=d;for(F=0,X=E.zoomOut.length;F<X;F++)b[E.zoomOut[F]]=-d},_addHooks:function(){mr(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){qt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(d){if(!(d.altKey||d.ctrlKey||d.metaKey)){var b=d.keyCode,E=this._map,F;if(b in this._panKeys){if(!E._panAnim||!E._panAnim._inProgress)if(F=this._panKeys[b],d.shiftKey&&(F=_e(F).multiplyBy(3)),E.options.maxBounds&&(F=E._limitOffset(_e(F),E.options.maxBounds)),E.options.worldCopyJump){var X=E.wrapLatLng(E.unproject(E.project(E.getCenter()).add(F)));E.panTo(X)}else E.panBy(F)}else if(b in this._zoomKeys)E.setZoom(E.getZoom()+(d.shiftKey?3:1)*this._zoomKeys[b]);else if(b===27&&E._popup&&E._popup.options.closeOnEscapeKey)E.closePopup();else return;ns(d)}}});Ur.addInitHook("addHandler","keyboard",Hd),Ur.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Vl=Xn.extend({addHooks:function(){mr(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){qt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(d){var b=Va(d),E=this._map.options.wheelDebounceTime;this._delta+=b,this._lastMousePos=this._map.mouseEventToContainerPoint(d),this._startTime||(this._startTime=+new Date);var F=Math.max(E-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(f(this._performZoom,this),F),ns(d)},_performZoom:function(){var d=this._map,b=d.getZoom(),E=this._map.options.zoomSnap||0;d._stop();var F=this._delta/(this._map.options.wheelPxPerZoomLevel*4),X=4*Math.log(2/(1+Math.exp(-Math.abs(F))))/Math.LN2,le=E?Math.ceil(X/E)*E:X,Me=d._limitZoom(b+(this._delta>0?le:-le))-b;this._delta=0,this._startTime=null,Me&&(d.options.scrollWheelZoom==="center"?d.setZoom(b+Me):d.setZoomAround(this._lastMousePos,b+Me))}});Ur.addInitHook("addHandler","scrollWheelZoom",Vl);var Co=600;Ur.mergeOptions({tapHold:rr.touchNative&&rr.safari&&rr.mobile,tapTolerance:15});var Mc=Xn.extend({addHooks:function(){mr(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){qt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(d){if(clearTimeout(this._holdTimeout),d.touches.length===1){var b=d.touches[0];this._startPos=this._newPos=new de(b.clientX,b.clientY),this._holdTimeout=setTimeout(f(function(){this._cancel(),this._isTapValid()&&(mr(document,"touchend",Fa),mr(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),Co),mr(document,"touchend touchcancel contextmenu",this._cancel,this),mr(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function d(){qt(document,"touchend",Fa),qt(document,"touchend touchcancel",d)},_cancel:function(){clearTimeout(this._holdTimeout),qt(document,"touchend touchcancel contextmenu",this._cancel,this),qt(document,"touchmove",this._onMove,this)},_onMove:function(d){var b=d.touches[0];this._newPos=new de(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(d,b){var E=new MouseEvent(d,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});E._simulated=!0,b.target.dispatchEvent(E)}});Ur.addInitHook("addHandler","tapHold",Mc),Ur.mergeOptions({touchZoom:rr.touch,bounceAtZoomLimits:!0});var Wd=Xn.extend({addHooks:function(){or(this._map._container,"leaflet-touch-zoom"),mr(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Kr(this._map._container,"leaflet-touch-zoom"),qt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(d){var b=this._map;if(!(!d.touches||d.touches.length!==2||b._animatingZoom||this._zooming)){var E=b.mouseEventToContainerPoint(d.touches[0]),F=b.mouseEventToContainerPoint(d.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(E.add(F)._divideBy(2))),this._startDist=E.distanceTo(F),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),mr(document,"touchmove",this._onTouchMove,this),mr(document,"touchend touchcancel",this._onTouchEnd,this),Fa(d)}},_onTouchMove:function(d){if(!(!d.touches||d.touches.length!==2||!this._zooming)){var b=this._map,E=b.mouseEventToContainerPoint(d.touches[0]),F=b.mouseEventToContainerPoint(d.touches[1]),X=E.distanceTo(F)/this._startDist;if(this._zoom=b.getScaleZoom(X,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoom<b.getMinZoom()&&X<1||this._zoom>b.getMaxZoom()&&X>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,X===1)return}else{var le=E._add(F)._divideBy(2)._subtract(this._centerPoint);if(X===1&&le.x===0&&le.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(le),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),me(this._animRequest);var Me=f(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=je(Me,this,!0),Fa(d)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,me(this._animRequest),qt(document,"touchmove",this._onTouchMove,this),qt(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))}});Ur.addInitHook("addHandler","touchZoom",Wd),Ur.BoxZoom=ls,Ur.DoubleClickZoom=Oc,Ur.Drag=bi,Ur.Keyboard=Hd,Ur.ScrollWheelZoom=Vl,Ur.TapHold=Mc,Ur.TouchZoom=Wd,t.Bounds=K,t.Browser=rr,t.CRS=Je,t.Canvas=jc,t.Circle=Pi,t.CircleMarker=Os,t.Class=Oe,t.Control=Gn,t.DivIcon=Rn,t.DivOverlay=Qr,t.DomEvent=sn,t.DomUtil=ja,t.Draggable=gi,t.Evented=re,t.FeatureGroup=ys,t.GeoJSON=y,t.GridLayer=vs,t.Handler=Xn,t.Icon=js,t.ImageOverlay=it,t.LatLng=he,t.LatLngBounds=ae,t.Layer=$a,t.LayerGroup=ei,t.LineUtil=Ec,t.Map=Ur,t.Marker=Mn,t.Mixin=Nc,t.Path=is,t.Point=de,t.PolyUtil=ko,t.Polygon=h,t.Polyline=i,t.Popup=kn,t.PosAnimation=ji,t.Projection=nl,t.Rectangle=Eo,t.Renderer=os,t.SVG=sl,t.SVGOverlay=jr,t.TileLayer=pi,t.Tooltip=qr,t.Transformation=Lt,t.Util=Se,t.VideoOverlay=Pt,t.bind=f,t.bounds=W,t.canvas=Hl,t.circle=ee,t.circleMarker=zr,t.control=qs,t.divIcon=no,t.extend=o,t.featureGroup=bs,t.geoJSON=Pe,t.geoJson=Ke,t.gridLayer=Ac,t.icon=Li,t.imageOverlay=Bt,t.latLng=pe,t.latLngBounds=se,t.layerGroup=ss,t.map=Qo,t.marker=Tc,t.point=_e,t.polygon=x,t.polyline=c,t.popup=Nn,t.rectangle=zh,t.setOptions=M,t.stamp=v,t.svg=Wl,t.svgOverlay=Sr,t.tileLayer=Ms,t.tooltip=ln,t.transformation=zt,t.version=n,t.videoOverlay=Mt;var Vd=window.L;t.noConflict=function(){return window.L=Vd,this},window.L=t}))})(M0,M0.exports)),M0.exports}var Bd=XR();const pp=Sx(Bd);function Uh(e,r,t){return Object.freeze({instance:e,context:r,container:t})}function yp(e,r){return r==null?function(n,o){const u=R.useRef(void 0);return u.current||(u.current=e(n,o)),u}:function(n,o){const u=R.useRef(void 0);u.current||(u.current=e(n,o));const f=R.useRef(n),{instance:g}=u.current;return R.useEffect(function(){f.current!==n&&(r(g,n,f.current),f.current=n)},[g,n,r]),u}}function YR(e,r){R.useEffect(function(){var o;return((o=r.layerContainer)!=null?o:r.map).addLayer(e.instance),function(){var f;(f=r.layerContainer)==null||f.removeLayer(e.instance),r.map.removeLayer(e.instance)}},[r,e])}function U4(e){return function(t){const n=gp(),o=e(xp(t,n),n);return F4(n.map,t.attribution),B4(o.current,t.eventHandlers),YR(o.current,n),o}}function ZR(e,r){const t=yp(e,r),n=U4(t);return zR(n)}function z4(e,r){const t=yp(e),n=VR(t,r);return HR(n)}function $R(e,r){const t=yp(e,r),n=U4(t);return WR(n)}function qR(e,r,t){const{opacity:n,zIndex:o}=r;n!=null&&n!==t.opacity&&e.setOpacity(n),o!=null&&o!==t.zIndex&&e.setZIndex(o)}function KR(){return gp().map}function JR(C,N){var O=C,{bounds:e,boundsOptions:r,center:t,children:n,className:o,id:u,placeholder:f,style:g,whenReady:v,zoom:p}=O,k=Us(O,["bounds","boundsOptions","center","children","className","id","placeholder","style","whenReady","zoom"]);const[I]=R.useState({className:o,id:u,style:g}),[M,D]=R.useState(null),z=R.useRef(void 0);R.useImperativeHandle(N,()=>{var H;return(H=M==null?void 0:M.map)!=null?H:null},[M]);const B=R.useCallback(H=>{if(H!==null&&!z.current){const q=new Bd.Map(H,k);z.current=q,t!=null&&p!=null?q.setView(t,p):e!=null&&q.fitBounds(e,r),v!=null&&q.whenReady(v),D(BR(q))}},[]);R.useEffect(()=>()=>{M==null||M.map.remove()},[M]);const U=M?Zr.createElement(mp,{value:M},n):f!=null?f:null;return Zr.createElement("div",Ve(ke({},I),{ref:B}),U)}const QR=R.forwardRef(JR),eD=ZR(function(o,n){var u=o,{position:r}=u,t=Us(u,["position"]);const f=new Bd.Marker(r,t);return Uh(f,UR(n,{overlayContainer:f}))},function(r,t,n){t.position!==n.position&&r.setLatLng(t.position),t.icon!=null&&t.icon!==n.icon&&r.setIcon(t.icon),t.zIndexOffset!=null&&t.zIndexOffset!==n.zIndexOffset&&r.setZIndexOffset(t.zIndexOffset),t.opacity!=null&&t.opacity!==n.opacity&&r.setOpacity(t.opacity),r.dragging!=null&&t.draggable!==n.draggable&&(t.draggable===!0?r.dragging.enable():r.dragging.disable())}),tD=z4(function(r,t){const n=new Bd.Popup(r,t.overlayContainer);return Uh(n,t)},function(r,t,{position:n},o){R.useEffect(function(){const{instance:f}=r;function g(p){p.popup===f&&(f.update(),o(!0))}function v(p){p.popup===f&&o(!1)}return t.map.on({popupopen:g,popupclose:v}),t.overlayContainer==null?(n!=null&&f.setLatLng(n),f.openOn(t.map)):t.overlayContainer.bindPopup(f),function(){var k;t.map.off({popupopen:g,popupclose:v}),(k=t.overlayContainer)==null||k.unbindPopup(),t.map.removeLayer(f)}},[r,t,o,n])}),rD=$R(function(o,n){var u=o,{url:r}=u,t=Us(u,["url"]);const f=new Bd.TileLayer(r,xp(t,n));return Uh(f,n)},function(r,t,n){qR(r,t,n);const{url:o}=t;o!=null&&o!==n.url&&r.setUrl(o)}),aD=z4(function(r,t){const n=new Bd.Tooltip(r,t.overlayContainer);return Uh(n,t)},function(r,t,{position:n},o){R.useEffect(function(){const f=t.overlayContainer;if(f==null)return;const{instance:g}=r,v=k=>{k.tooltip===g&&(n!=null&&g.setLatLng(n),g.update(),o(!0))},p=k=>{k.tooltip===g&&o(!1)};return f.on({tooltipopen:v,tooltipclose:p}),f.bindTooltip(g),function(){f.off({tooltipopen:v,tooltipclose:p}),f._map!=null&&f.unbindTooltip()}},[r,t,o,n])}),nD="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=",sD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",iD=pp.icon({iconUrl:nD,shadowUrl:sD,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]});pp.Marker.prototype.options.icon=iD;const oD=({locations:e})=>{const r=KR();return R.useEffect(()=>{if(e.length>0&&e.some(t=>t.latitude&&t.longitude)){const t=pp.latLngBounds(e.filter(n=>n.latitude&&n.longitude).map(n=>[n.latitude,n.longitude]));r.fitBounds(t,{padding:[30,30],maxZoom:8})}else r.setView([24.8,45.5],6)},[e,r]),null},lD=()=>{const e=ma(),[r,t]=R.useState(""),[n,o]=R.useState(""),[u,f]=R.useState([]),[g,v]=R.useState(!0),p=R.useRef({}),k=(D,z)=>Ne(null,null,function*(){var ne,V,J,Q,Te,je,me,Se,Oe,ue,be,re;const B=z==="phcc",U=B?"custom_site":"company",H=B?"site_name":"company",q={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 de=yield jt.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(JSON.stringify({[U]:D.name}))}&fields=["name"]&limit_page_length=0`),Ae=(de==null?void 0:de.data)||[];q.assets=Ae.length,B&&(q.phcc_asset_names=Ae.map(pe=>pe.name));const _e=yield jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,custom_priority_:"Normal",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);q.normal_work_orders=((ne=_e==null?void 0:_e.data)==null?void 0:ne.length)||0;const K=yield jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,custom_priority_:"Urgent",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);q.urgent_work_orders=((V=K==null?void 0:K.data)==null?void 0:V.length)||0;const[W,ae,se,he]=yield Promise.all([jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,repair_status:"Open"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,repair_status:"Work In Progress"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,repair_status:"Pending Review"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[H]:D.name,repair_status:"Completed"}))}&fields=["name"]`)]);if(q.wo_open=((J=W==null?void 0:W.data)==null?void 0:J.length)||0,q.wo_progress=((Q=ae==null?void 0:ae.data)==null?void 0:Q.length)||0,q.wo_review=((Te=se==null?void 0:se.data)==null?void 0:Te.length)||0,q.wo_completed=((je=he==null?void 0:he.data)==null?void 0:je.length)||0,B&&q.phcc_asset_names&&q.phcc_asset_names.length>0){const[pe,Je,Fe]=yield Promise.all([jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",q.phcc_asset_names],maintenance_status:"Planned"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",q.phcc_asset_names],maintenance_status:"Completed"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",q.phcc_asset_names],maintenance_status:"Overdue"}))}&fields=["name"]`)]);q.planned_maintenance=((me=pe==null?void 0:pe.data)==null?void 0:me.length)||0,q.completed_maintenance=((Se=Je==null?void 0:Je.data)==null?void 0:Se.length)||0,q.overdue_maintenance=((Oe=Fe==null?void 0:Fe.data)==null?void 0:Oe.length)||0}else if(!B){const[pe,Je,Fe]=yield Promise.all([jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:D.name,maintenance_status:"Planned"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:D.name,maintenance_status:"Completed"}))}&fields=["name"]`),jt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:D.name,maintenance_status:"Overdue"}))}&fields=["name"]`)]);q.planned_maintenance=((ue=pe==null?void 0:pe.data)==null?void 0:ue.length)||0,q.completed_maintenance=((be=Je==null?void 0:Je.data)==null?void 0:be.length)||0,q.overdue_maintenance=((re=Fe==null?void 0:Fe.data)==null?void 0:re.length)||0}}catch(de){console.error(`Error fetching counts for ${D.name}:`,de)}return ke({name:D.name,latitude:parseFloat(D.latitude),longitude:parseFloat(D.longitude),location_type:z},q)}),N=()=>Ne(null,null,function*(){v(!0);try{let D=[];const z=[];if(!n||r){const U={latitude:["!=",""],longitude:["!=",""],custom_is_hospital:1};r&&(U.name=r),z.push(Ne(null,null,function*(){const H=yield jt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(U))}&fields=["name","latitude","longitude"]&limit_page_length=0`),ne=((H==null?void 0:H.data)||[]).map(V=>k(V,"hospital"));return Promise.all(ne)}))}if(!r||n){const U={latitude:["!=",""],longitude:["!=",""],custom_is_phcc:1};n&&(U.name=n),z.push(Ne(null,null,function*(){const H=yield jt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(U))}&fields=["name","latitude","longitude"]&limit_page_length=0`),ne=((H==null?void 0:H.data)||[]).map(V=>k(V,"phcc"));return Promise.all(ne)}))}D=(yield Promise.all(z)).flat().filter(U=>!isNaN(U.latitude)&&!isNaN(U.longitude)),f(D)}catch(D){console.error("Error fetching map data:",D)}finally{v(!1)}});R.useEffect(()=>{N()},[r,n]);const C=(D,z,B)=>{const U=new URLSearchParams,H=D.location_type==="phcc"?"site_name":"company";U.set(H,D.name),z&&U.set("priority",z),B&&U.set("status",B),e(`/work-orders?${U.toString()}`)},O=D=>{const z=new URLSearchParams,B=D.location_type==="phcc"?"custom_site":"company";z.set(B,D.name),e(`/assets?${z.toString()}`)},I=(D,z)=>{const B=new URLSearchParams;D.location_type==="phcc"?B.set("phcc",D.name):B.set("hospital",D.name),z&&B.set("status",z),e(`/maintenance-calendar?${B.toString()}`)},M=D=>{const B=D.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:[D.name,B]}),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:D.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:()=>C(D,"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: ",D.normal_work_orders]}),a.jsxs("button",{onClick:()=>C(D,"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: ",D.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:()=>C(D,void 0,"Open"),className:"text-red-700 dark:text-red-400 font-bold hover:underline cursor-pointer",children:D.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:()=>C(D,void 0,"Work In Progress"),className:"text-yellow-700 dark:text-yellow-400 font-bold hover:underline cursor-pointer",children:D.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:()=>C(D,void 0,"Pending Review"),className:"text-blue-700 dark:text-blue-400 font-bold hover:underline cursor-pointer",children:D.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:()=>C(D,void 0,"Completed"),className:"text-green-700 dark:text-green-400 font-bold hover:underline cursor-pointer",children:D.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:()=>I(D,"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: ",D.planned_maintenance]}),a.jsxs("button",{onClick:()=>I(D,"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: ",D.completed_maintenance]}),a.jsxs("button",{onClick:()=>I(D,"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: ",D.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:()=>O(D),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:()=>C(D),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(er,{label:"Hospital",doctype:"Location",value:r,onChange:t,filters:{custom_is_hospital:1},placeholder:"Select hospital"})}),a.jsx("div",{className:"w-64 relative z-[1000]",children:a.jsx(er,{label:"PHCC",doctype:"Location",value:n,onChange:o,filters:{custom_is_phcc:1},placeholder:"Select PHCC"})})]})}),a.jsxs("div",{className:"flex-1 relative",style:{zIndex:1},children:[g&&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(QR,{center:[24.8,45.5],zoom:6,style:{height:"100%",width:"100%"},zoomControl:!0,children:[a.jsx(rD,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),a.jsx(oD,{locations:u}),u.map(D=>{const z=D.urgent_work_orders>0?"🚨 URGENT! ":"",B=D.location_type==="phcc",U=B?"🏥 PHCC":"🏨 Hospital",H=`${D.name}-${D.latitude}-${D.longitude}`;return a.jsxs(eD,{position:[D.latitude,D.longitude],ref:q=>{q&&(p.current[H]=q,setTimeout(()=>{const ne=q.getElement();ne&&(ne.classList.remove("urgent-marker","red-marker","phcc-marker"),D.urgent_work_orders>0?ne.classList.add("urgent-marker","red-marker"):B&&ne.classList.add("phcc-marker"))},100))},children:[a.jsx(aD,{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:[z,D.name]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:U}),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:D.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:D.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:D.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:D.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:D.completed_maintenance})]})]})]})}),a.jsx(tD,{className:B?"phcc-popup-container":"hospital-popup-container",maxWidth:320,maxHeight:450,autoPan:!0,keepInView:!0,closeButton:!0,autoClose:!1,children:M(D)})]},H)})]})]}),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 cD{getItems(r,t,n=20,o=0){return Ne(this,null,function*(){var u;try{const f=new URLSearchParams;r&&f.append("filters",JSON.stringify(r)),t&&f.append("fields",JSON.stringify(t)),f.append("limit_page_length",n.toString()),f.append("limit_start",o.toString());const g=yield jt.apiCall(`/api/resource/Item?${f.toString()}`),v=((u=g.data)==null?void 0:u.length)||0;return{data:g.data||[],total:v}}catch(f){throw console.error("Error fetching items:",f),f}})}getItem(r){return Ne(this,null,function*(){try{return(yield jt.apiCall(`/api/resource/Item/${r}`)).data}catch(t){throw console.error("Error fetching item:",t),t}})}createItem(r){return Ne(this,null,function*(){try{return(yield jt.apiCall("/api/resource/Item",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).data}catch(t){throw console.error("Error creating item:",t),t}})}updateItem(r,t){return Ne(this,null,function*(){try{return(yield jt.apiCall(`/api/resource/Item/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).data}catch(n){throw console.error("Error updating item:",n),n}})}deleteItem(r){return Ne(this,null,function*(){try{yield jt.apiCall(`/api/resource/Item/${r}`,{method:"DELETE"})}catch(t){throw console.error("Error deleting item:",t),t}})}submitItem(r){return Ne(this,null,function*(){try{return(yield jt.apiCall(`/api/resource/Item/${r}/submit`,{method:"POST"})).data}catch(t){throw console.error("Error submitting item:",t),t}})}cancelItem(r){return Ne(this,null,function*(){try{return(yield jt.apiCall(`/api/resource/Item/${r}/cancel`,{method:"POST"})).data}catch(t){throw console.error("Error cancelling item:",t),t}})}}const pd=new cD;function dD(e,r=20,t=0,n){const[o,u]=R.useState([]),[f,g]=R.useState(0),[v,p]=R.useState(!1),[k,N]=R.useState(!0),[C,O]=R.useState(null),[I,M]=R.useState(0),D=R.useRef(!1),z=JSON.stringify(e);R.useEffect(()=>{if(D.current&&C)return;let U=!1;return D.current=!0,Ne(null,null,function*(){try{N(!0);const q=["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"],ne=yield pd.getItems(e,q,r,t);U||(u(ne.data),g(ne.total),p(ne.data.length===r),O(null))}catch(q){if(!U){const ne=q instanceof Error?q.message:"Failed to fetch items";O(ne),u([]),g(0),p(!1)}}finally{U||N(!1)}}),()=>{U=!0}},[z,r,t,n,I]);const B=R.useCallback(()=>{D.current=!1,M(U=>U+1)},[]);return{items:o,totalCount:f,hasMore:v,loading:k,error:C,refetch:B}}function uD(e){const[r,t]=R.useState(null),[n,o]=R.useState(!0),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null),o(!1);return}try{o(!0),f(null);const p=yield pd.getItem(e);t(p)}catch(p){f(p instanceof Error?p.message:"Failed to fetch item details")}finally{o(!1)}}),[e]);R.useEffect(()=>{g()},[g]);const v=R.useCallback(()=>{g()},[g]);return{item:r,loading:n,error:u,refetch:v}}function H4(){const[e,r]=R.useState(!1),[t,n]=R.useState(null),o=R.useCallback(v=>Ne(null,null,function*(){try{return r(!0),n(null),yield pd.createItem(v)}catch(p){const k=p instanceof Error?p.message:"Failed to create item";throw n(k),p}finally{r(!1)}}),[]),u=R.useCallback((v,p)=>Ne(null,null,function*(){try{return r(!0),n(null),yield pd.updateItem(v,p)}catch(k){const N=k instanceof Error?k.message:"Failed to update item";throw n(N),k}finally{r(!1)}}),[]),f=R.useCallback(v=>Ne(null,null,function*(){try{r(!0),n(null),yield pd.deleteItem(v)}catch(p){const k=p instanceof Error?p.message:"Failed to delete item";throw n(k),p}finally{r(!1)}}),[]),g=R.useCallback(v=>Ne(null,null,function*(){try{return r(!0),n(null),yield pd.submitItem(v)}catch(p){const k=p instanceof Error?p.message:"Failed to submit item";throw n(k),p}finally{r(!1)}}),[]);return{createItem:o,updateItem:u,deleteItem:f,submitItem:g,loading:e,error:t}}const fD=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const{t:v}=Xa(),[p,k]=R.useState(t>0?"selected":"all_with_filters"),[N,C]=R.useState("csv"),[O,I]=R.useState(g.filter(B=>B.default).map(B=>B.key));R.useEffect(()=>{t>0?k("selected"):k("all_with_filters")},[t]);const M=B=>{I(U=>U.includes(B)?U.filter(H=>H!==B):[...U,B])},D=()=>{I(g.map(B=>B.key))},z=()=>{I(g.filter(B=>B.default).map(B=>B.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(Cs,{className:"text-white text-xl"}),a.jsxs("h3",{className:"text-lg font-semibold text-white",children:[v("listPages.export")," Items"]})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>k("selected"),disabled:t===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 ",t," selected item",t!==1?"s":""]})]}),t>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:[t," 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:()=>k("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 ",o," item",o!==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:[o," 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:()=>k("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 ",n," item",n!==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:[n," 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 ${N==="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:N==="csv",onChange:()=>C("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{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 ${N==="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:N==="excel",onChange:()=>C("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{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:D,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:z,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:g.map(B=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${O.includes(B.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:O.includes(B.key),onChange:()=>M(B.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:B.label})]},B.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[O.length," column",O.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 ${t} selected row${t!==1?"s":""}`,p==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(p,N,O),disabled:O.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},hD=()=>{const{t:e}=Xa(),r=ma(),[t,n]=R.useState(0),[o,u]=R.useState(null),f=20,g=[{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}],[v,p]=R.useState(!1),[k,N]=R.useState(new Set),[C,O]=R.useState(!1),[I,M]=R.useState(!1),[D,z]=R.useState(""),[B,U]=R.useState(""),[H,q]=R.useState(""),[ne,V]=R.useState(""),[J,Q]=R.useState(!0),[Te,je]=R.useState(0),[me,Se]=R.useState([]),[Oe,ue]=R.useState(!1),[be,re]=R.useState(""),[de,Ae]=R.useState(""),_e=R.useRef(null);R.useEffect(()=>{const He=localStorage.getItem("itemFilterPresets");He&&Se(JSON.parse(He))},[]),R.useEffect(()=>{const He=[D,B,H,ne].filter(Boolean).length;je(He)},[D,B,H,ne]);const K={};D&&(K.name=D),B&&(K.item_group=B),H&&(K.custom_hospital_name=H),ne&&(K.item_name=["like",`%${ne}%`]);const{items:W,totalCount:ae,hasMore:se,loading:he,error:pe,refetch:Je}=dD(Object.keys(K).length>0?K:void 0,f,t*f,"creation desc"),{deleteItem:Fe,loading:ft}=H4();R.useEffect(()=>{!he&&!v&&p(!0)},[he,v]),R.useEffect(()=>{t!==0&&n(0)},[D,B,H,ne]),R.useEffect(()=>{N(new Set)},[D,B,H,ne,t]);const ot=He=>{Ae(He),_e.current&&clearTimeout(_e.current),_e.current=window.setTimeout(()=>{V(He)},800)},Lt=He=>{He.key==="Enter"&&(He.preventDefault(),_e.current&&clearTimeout(_e.current),V(de))},zt=()=>{if(!be.trim()){alert("Please enter a filter name");return}const He={id:Date.now(),name:be,filters:{filterItemId:D,filterItemGroup:B,filterCompany:H,filterItemName:ne}},It=[...me,He];Se(It),re(""),ue(!1),localStorage.setItem("itemFilterPresets",JSON.stringify(It))},Ht=He=>{const It=He.filters;z(It.filterItemId||""),U(It.filterItemGroup||""),q(It.filterCompany||""),V(It.filterItemName||""),Ae(It.filterItemName||"")},ht=He=>{const It=me.filter(Zt=>Zt.id!==He);Se(It),localStorage.setItem("itemFilterPresets",JSON.stringify(It))};R.useEffect(()=>()=>{_e.current&&clearTimeout(_e.current)},[]);const tr=()=>{z(""),U(""),q(""),V(""),Ae(""),_e.current&&clearTimeout(_e.current)},Kt=D||B||H||ne,gt=He=>He?new Date(He).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",ve=He=>{N(It=>{const Zt=new Set(It);return Zt.has(He)?Zt.delete(He):Zt.add(He),Zt})},Le=()=>{k.size===W.length?N(new Set):N(new Set(W.map(He=>He.name)))},ut=W.length>0&&k.size===W.length,tt=k.size>0&&k.size<W.length,Wt=R.useCallback(()=>Ne(null,null,function*(){const He=[];let It=0;const Zt=100;let yr=!0;for(;yr;)try{const Ct=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Item",filters:K,fields:["*"],limit_start:It*Zt,limit_page_length:Zt,order_by:"creation desc"})})).json()).message||[];He.push(...Ct),Ct.length<Zt?yr=!1:It++,It>100&&(console.warn("Export safety limit reached"),yr=!1)}catch(Ye){throw console.error("Error fetching items for export:",Ye),Ye}return He}),[K]),pt=(He,It,Zt)=>Ne(null,null,function*(){M(!0);try{let yr=[];switch(He){case"selected":yr=W.filter(Ge=>k.has(Ge.name));break;case"all_on_page":yr=W;break;case"all_with_filters":yr=yield Wt();break}if(yr.length===0){alert("No data to export");return}const Ye=Zt.map(Ge=>{const Ct=g.find(Ft=>Ft.key===Ge);return(Ct==null?void 0:Ct.label)||Ge});if(It==="csv"){const Ge=[Ye.join(","),...yr.map(Dr=>Zt.map(kt=>{let Re=Dr[kt]||"";return typeof Re=="string"&&(Re.includes(",")||Re.includes('"')||Re.includes(`
`))&&(Re=`"${Re.replace(/"/g,'""')}"`),Re}).join(","))].join(`
`),Ct=new Blob(["\uFEFF"+Ge],{type:"text/csv;charset=utf-8;"}),Ft=URL.createObjectURL(Ct),Jt=document.createElement("a");Jt.href=Ft,Jt.download=`items_export_${new Date().toISOString().split("T")[0]}.csv`,Jt.click(),URL.revokeObjectURL(Ft)}else if(It==="excel"){const Ge=[Ye,...yr.map(Jt=>Zt.map(Dr=>Jt[Dr]||""))],Ct=Un.aoa_to_sheet(Ge),Ft=Un.book_new();Un.book_append_sheet(Ft,Ct,"Items"),Fd(Ft,`items_export_${new Date().toISOString().split("T")[0]}.xlsx`)}O(!1),N(new Set)}catch(yr){console.error("Export failed:",yr),alert(`Export failed: ${yr instanceof Error?yr.message:"Unknown error"}`)}finally{M(!1)}}),We=()=>{r("/inventory/new")},Nt=He=>{r(`/inventory/${He}`)},At=He=>{r(`/inventory/${He}`)},Qt=He=>Ne(null,null,function*(){try{yield Fe(He),u(null),Je(),alert("Item deleted successfully!")}catch(It){alert(`Failed to delete: ${It instanceof Error?It.message:"Unknown error"}`)}}),cr=He=>{r(`/inventory/new?duplicate=${He}`)};return he&&!v?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..."})]})}):pe?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:()=>r("/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:Je,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:"})," ",pe]})})]})}):a.jsxs("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 dark:text-white break-words",children:"Inventory"}),a.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",ae," item",ae!==1?"s":"",k.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",k.size," selected"]}),he&&v&&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:ae===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:e("listPages.export")}),k.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:k.size})]}),a.jsxs("button",{onClick:We,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(Ei,{}),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:()=>Q(!J),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:J?a.jsx(ru,{size:14}):a.jsx(Td,{size:14})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($i,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),Te>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:Te})]}),Kt&&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:[D&&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:"})," ",D,a.jsx("button",{onClick:He=>{He.stopPropagation(),z("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),ne&&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:"})," ",ne,a.jsx("button",{onClick:He=>{He.stopPropagation(),V(""),Ae("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),H&&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:"})," ",H,a.jsx("button",{onClick:He=>{He.stopPropagation(),q("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]}),B&&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:"})," ",B,a.jsx("button",{onClick:He=>{He.stopPropagation(),U("")},className:"hover:text-red-500 transition-colors",children:a.jsx(Yt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Te>0&&a.jsxs("button",{onClick:()=>ue(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[a.jsx(Tn,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Kt&&a.jsxs("button",{onClick:tr,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(Yt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),J&&a.jsxs("div",{className:"p-4",children:[me.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(nu,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:me.map(He=>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:()=>Ht(He),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:He.name}),a.jsx("button",{onClick:()=>ht(He.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(la,{size:10})})]},He.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(er,{label:"Item",doctype:"Item",value:D,onChange:He=>z(He),placeholder:"Select Item",disabled:!1,compact:!0}),D&&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(Yt,{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:de,onChange:He=>ot(He.target.value),onKeyDown:Lt,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"}),de&&de!==ne&&a.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),ne&&a.jsx("button",{onClick:()=>{V(""),Ae("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(er,{label:"Hospital",doctype:"Company",value:H,onChange:He=>q(He),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),H&&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(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(er,{label:"Item Group",doctype:"Item Group",value:B,onChange:He=>U(He),placeholder:"Select Item Group",disabled:!1,compact:!0}),B&&a.jsx("button",{onClick:()=>U(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]})]})})})]})]}),Oe&&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:be,onChange:He=>re(He.target.value),onKeyDown:He=>{He.key==="Enter"&&(He.preventDefault(),zt())},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:()=>{ue(!1),re("")},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:zt,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(Tn,{size:12}),"Save Filter"]})]})]})}),a.jsx(fD,{isOpen:C,onClose:()=>O(!1),selectedCount:k.size,totalCount:ae,pageCount:W.length,onExport:pt,isExporting:I,exportColumns:g}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[he&&v&&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:Le,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:ut?"Deselect all":"Select all",children:ut?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):tt?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:W.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(qS,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No items found"}),Kt?a.jsx("button",{onClick:tr,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:We,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"})]})})}):W.map(He=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer ${k.has(He.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>Nt(He.name),children:[a.jsx("td",{className:"px-4 py-4",onClick:It=>It.stopPropagation(),children:a.jsx("button",{onClick:()=>ve(He.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:k.has(He.name)?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Bn,{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:He.item_code||He.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.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:He.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:He.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:gt(He.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:()=>Nt(He.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(Yi,{})}),a.jsx("button",{onClick:()=>At(He.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(rs,{})}),a.jsx("button",{onClick:()=>cr(He.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(Ad,{})}),a.jsx("button",{onClick:()=>u(He.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:ft,children:a.jsx(la,{})})]})})]},He.name))})]})}),(se||t>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 ",t*f+1," to ",Math.min((t+1)*f,ae)," of ",ae," results"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>n(Math.max(0,t-1)),disabled:t===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:()=>n(t+1),disabled:!se,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"})]})]})]}),o&&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(la,{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:"})," ",o]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>u(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:ft,children:"Cancel"}),a.jsx("button",{onClick:()=>Qt(o),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:ft,children:ft?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(la,{}),"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;
}
`})]})},mD=()=>{var Se;const{itemName:e}=Ml(),r=ma(),[t]=Rl(),n=t.get("duplicate"),o=e==="new",u=o&&!!n,[f,g]=R.useState(0),[v,p]=R.useState(!1),[k,N]=R.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:C,loading:O,error:I,refetch:M}=uD(u?n:o?null:e||null),{createItem:D,updateItem:z,loading:B}=H4(),[U,H]=R.useState(o),q=(Se=C==null?void 0:C.docstatus)!=null?Se:0,ne=q===1,V=q===2,J=q===0,Q=k.item_group==="Tools",Te=R.useCallback(Oe=>Ne(null,null,function*(){var ue;if(Oe){p(!0);try{let be=null;typeof window!="undefined"&&window.csrf_token&&(be=window.csrf_token);const re=JSON.stringify([["item_code","=",Oe]]),de=JSON.stringify(["actual_qty","warehouse"]),Ae=`${wr.BASE_URL}/api/resource/Bin?filters=${encodeURIComponent(re)}&fields=${encodeURIComponent(de)}&limit_page_length=0`,_e={Accept:"application/json","Content-Type":"application/json"};be&&(_e["X-Frappe-CSRF-Token"]=be);const K=yield fetch(Ae,{method:"GET",headers:_e,credentials:"include"});if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);const ae=((ue=(yield K.json()).data)==null?void 0:ue.reduce((se,he)=>se+(he.actual_qty||0),0))||0;g(ae)}catch(be){console.error("Failed to fetch balance qty:",be),g(0)}finally{p(!1)}}}),[]);R.useEffect(()=>{!o&&(C!=null&&C.item_code)&&Te(C.item_code)},[o,C==null?void 0:C.item_code,Te]),R.useEffect(()=>{var Oe,ue,be,re,de,Ae;C&&!u?(N({item_code:C.item_code||"",item_name:C.item_name||"",item_group:C.item_group||"",custom_hospital_name:C.custom_hospital_name||"",custom_part_description:C.custom_part_description||"",stock_uom:C.stock_uom||"Nos",custom_item_cost_per_unit:C.custom_item_cost_per_unit||0,disabled:C.disabled||0,is_stock_item:(Oe=C.is_stock_item)!=null?Oe:1,opening_stock:C.opening_stock||0,valuation_rate:C.valuation_rate||0,standard_rate:C.standard_rate||0,custom_last_calibration_date:C.custom_last_calibration_date||"",custom_next_due_calibration_date:C.custom_next_due_calibration_date||"",description:C.description||"",brand:C.brand||"",custom_warranty_in_months:C.custom_warranty_in_months||"",valuation_method:C.valuation_method||"",has_batch_no:C.has_batch_no||0,has_serial_no:C.has_serial_no||0,is_purchase_item:(ue=C.is_purchase_item)!=null?ue:1,is_sales_item:(be=C.is_sales_item)!=null?be:1,country_of_origin:C.country_of_origin||"Saudi Arabia",uoms:C.uoms||[],item_defaults:C.item_defaults||[]}),H(!1)):u&&C&&N({item_code:"",item_name:C.item_name||"",item_group:C.item_group||"",custom_hospital_name:C.custom_hospital_name||"",custom_part_description:C.custom_part_description||"",stock_uom:C.stock_uom||"Nos",custom_item_cost_per_unit:C.custom_item_cost_per_unit||0,disabled:0,is_stock_item:(re=C.is_stock_item)!=null?re:1,opening_stock:C.opening_stock||0,valuation_rate:C.valuation_rate||0,standard_rate:C.standard_rate||0,custom_last_calibration_date:C.custom_last_calibration_date||"",custom_next_due_calibration_date:C.custom_next_due_calibration_date||"",description:C.description||"",brand:C.brand||"",custom_warranty_in_months:C.custom_warranty_in_months||"",valuation_method:C.valuation_method||"",has_batch_no:C.has_batch_no||0,has_serial_no:C.has_serial_no||0,is_purchase_item:(de=C.is_purchase_item)!=null?de:1,is_sales_item:(Ae=C.is_sales_item)!=null?Ae:1,country_of_origin:C.country_of_origin||"Saudi Arabia",uoms:C.uoms||[],item_defaults:C.item_defaults||[]})},[C,u]);const je=()=>Ne(null,null,function*(){try{if(o){const Oe=yield D(k);r(`/inventory/${Oe.name}`)}else yield z(e,k),yield M(),k.item_code&&Te(k.item_code),H(!1),alert("Item updated successfully!")}catch(Oe){alert(`Failed to save: ${Oe instanceof Error?Oe.message:"Unknown error"}`)}}),me=R.useCallback(Oe=>!!(!U||V||ne),[U,V,ne]);return O?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..."})]})}):I&&!o?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:I}),a.jsx("button",{onClick:()=>r("/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-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>r("/inventory"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ki,{size:20})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:o?"New Item":(C==null?void 0:C.item_name)||(C==null?void 0:C.item_code)||"Item"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:o?"Create a new item":`Item Code: ${(C==null?void 0:C.item_code)||e}`})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!o&&!U&&J&&a.jsxs("button",{onClick:()=>H(!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(rs,{}),"Edit"]}),U&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{o?r("/inventory"):(H(!1),M())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:"Cancel"}),a.jsxs("button",{onClick:je,disabled:B,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(Tn,{}),B?"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:k.item_code,onChange:Oe=>N(Ve(ke({},k),{item_code:Oe.target.value})),disabled:me("item_code")||!o,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(er,{label:"Hospital",doctype:"Company",value:k.custom_hospital_name||"",onChange:Oe=>N(Ve(ke({},k),{custom_hospital_name:Oe})),disabled:me("custom_hospital_name"),placeholder:"Select Hospital",filters:{domain:"Healthcare"}})}),a.jsx("div",{children:a.jsx(er,{label:"Item Group",doctype:"Item Group",value:k.item_group||"",onChange:Oe=>N(Ve(ke({},k),{item_group:Oe})),disabled:me("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:k.stock_uom,onChange:Oe=>N(Ve(ke({},k),{stock_uom:Oe.target.value})),disabled:me("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:k.custom_part_description,onChange:Oe=>N(Ve(ke({},k),{custom_part_description:Oe.target.value})),disabled:me("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:k.is_stock_item===1,onChange:Oe=>N(Ve(ke({},k),{is_stock_item:Oe.target.checked?1:0})),disabled:me("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"})]}),o&&k.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:k.opening_stock,onChange:Oe=>N(Ve(ke({},k),{opening_stock:parseFloat(Oe.target.value)||0})),disabled:me("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"})]}),o&&k.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:k.valuation_rate,onChange:Oe=>N(Ve(ke({},k),{valuation_rate:parseFloat(Oe.target.value)||0})),disabled:me("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"})]}),!o&&k.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:f,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:()=>k.item_code&&Te(k.item_code),disabled:v,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(Lx,{className:v?"animate-spin":""})})]})]})]})}),Q&&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:k.custom_last_calibration_date,onChange:Oe=>N(Ve(ke({},k),{custom_last_calibration_date:Oe.target.value})),disabled:me("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:k.custom_next_due_calibration_date,onChange:Oe=>N(Ve(ke({},k),{custom_next_due_calibration_date:Oe.target.value})),disabled:me("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:k.description,onChange:Oe=>N(Ve(ke({},k),{description:Oe.target.value})),disabled:me("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:k.custom_warranty_in_months,onChange:Oe=>N(Ve(ke({},k),{custom_warranty_in_months:Oe.target.value})),disabled:me("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 gD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,t,n)=>n?n.toUpperCase():t.toLowerCase()),Cv=e=>{const r=xD(e);return r.charAt(0).toUpperCase()+r.slice(1)},W4=(...e)=>e.filter((r,t,n)=>!!r&&r.trim()!==""&&n.indexOf(r)===t).join(" ").trim(),pD=e=>{for(const r in e)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};var yD={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 bD=R.forwardRef((p,v)=>{var k=p,{color:e="currentColor",size:r=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:o="",children:u,iconNode:f}=k,g=Us(k,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return R.createElement("svg",ke(ke(Ve(ke({ref:v},yD),{width:r,height:r,stroke:e,strokeWidth:n?Number(t)*24/Number(r):t,className:W4("lucide",o)}),!u&&!pD(g)&&{"aria-hidden":"true"}),g),[...f.map(([N,C])=>R.createElement(N,C)),...Array.isArray(u)?u:[u]])});const An=(e,r)=>{const t=R.forwardRef((f,u)=>{var g=f,{className:n}=g,o=Us(g,["className"]);return R.createElement(bD,ke({ref:u,iconNode:r,className:W4(`lucide-${gD(Cv(e))}`,`lucide-${e}`,n)},o))});return t.displayName=Cv(e),t};const vD=[["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"}]],_D=An("bell",vD);const wD=[["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"}]],kD=An("calendar-check",wD);const ND=[["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"}]],SD=An("calendar",ND);const ED=[["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"}]],CD=An("circle-question-mark",ED);const TD=[["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"}]],AD=An("circle-user",TD);const jD=[["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"}]],OD=An("clipboard-list",jD);const MD=[["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"}]],RD=An("construction",MD);const DD=[["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"}]],ID=An("file-text",DD);const LD=[["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"}]],PD=An("languages",LD);const FD=[["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"}]],BD=An("layout-dashboard",FD);const UD=[["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"}]],zD=An("log-out",UD);const HD=[["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"}]],WD=An("map",HD);const VD=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],GD=An("menu",VD);const XD=[["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"}]],YD=An("moon",XD);const ZD=[["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"}]],Tv=An("package",ZD);const $D=[["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"}]],qD=An("shopping-cart",$D);const KD=[["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"}]],JD=An("sun",KD);const QD=[["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"}]],eI=An("users",QD);const tI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rI=An("x",tI),Av=({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(RD,{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!"})})]})}),V4=R.createContext(void 0),aI=({children:e})=>{const{i18n:r}=Xa(),[t,n]=R.useState(()=>localStorage.getItem("i18nextLng")==="ar"?"ar":"en"),o=t==="ar";R.useEffect(()=>{const f=document.documentElement,g=document.documentElement;r.changeLanguage(t),g.setAttribute("lang",t),o?(g.setAttribute("dir","rtl"),f.classList.add("rtl"),f.classList.remove("ltr")):(g.setAttribute("dir","ltr"),f.classList.add("ltr"),f.classList.remove("rtl"))},[t,r,o]);const u=f=>Ne(null,null,function*(){n(f),localStorage.setItem("i18nextLng",f),yield I0()});return a.jsx(V4.Provider,{value:{language:t,changeLanguage:u,isRTL:o},children:e})},G4=()=>{const e=R.useContext(V4);if(!e)throw new Error("useLanguage must be used within LanguageProvider");return e},nI=({userEmail:e})=>{const[r,t]=R.useState(!1),n=Ti(),{isRTL:o}=G4(),{t:u}=Xa(),f="/assets/asm_ui_app/asm_app/",g="?v=1765196376",v="?v=1765198405",p=f.endsWith("/")?`${f}sidebar-background.jpg${g}`:`${f}/sidebar-background.jpg${g}`,k=e==="financemanager@gmail.com",N=e&&(e.startsWith("enduser1-kash")||e.startsWith("enduser1-dajh")||e.startsWith("enduser1-th")),C=!k&&!N,O=!k&&!N,I=!k&&!N,D=[{id:"dashboard",title:u("common.dashboard"),icon:a.jsx(BD,{size:20}),path:"/dashboard",visible:!0},{id:"assets",title:u("common.assets"),icon:a.jsx(Tv,{size:20}),path:"/assets",visible:C},{id:"inventory",title:"Inventory",icon:a.jsx(Tv,{size:20}),path:"/inventory",visible:!0},{id:"work-orders",title:u("common.workOrders"),icon:a.jsx(OD,{size:20}),path:"/work-orders",visible:I},{id:"ppm-planner",title:"PPM Planner",icon:a.jsx(kD,{size:20}),path:"/ppm-planner",visible:O},{id:"maintenance-calendar",title:"Maintenance Calendar",icon:a.jsx(SD,{size:20}),path:"/maintenance-calendar",visible:O},{id:"active-map",title:"Active Map",icon:a.jsx(WD,{size:20}),path:"/active-map",visible:!0},{id:"maintenance-teams",title:"Maintenance Team",icon:a.jsx(eI,{size:20}),path:"/maintenance-teams",visible:!0},{id:"procurement",title:"Procurement",icon:a.jsx(qD,{size:20}),path:"/procurement",visible:!0},{id:"sla",title:"Service Level Agreement (SLA)",icon:a.jsx(ID,{size:20}),path:"/sla",visible:!0},{id:"support",title:"Support",icon:a.jsx(CD,{size:20}),path:"/support",visible:!0}].filter(B=>B.visible),z=B=>n.pathname===B;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
${r?"w-16":"w-64"}
`,style:{backgroundImage:`url(${p})`,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:[!r&&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:`${f}${f.endsWith("/")?"":"/"}seera-logo.png${v}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:B=>{var U;B.currentTarget.style.display="none",(U=B.currentTarget.nextElementSibling)==null||U.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:u("sidebar.title")})]}),r&&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:`${f}${f.endsWith("/")?"":"/"}seera-logo.png?v=1765198405${v}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:B=>{var U;B.currentTarget.style.display="none",(U=B.currentTarget.nextElementSibling)==null||U.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:()=>t(!r),className:"text-white dark:text-white hover:bg-white/20 dark:hover:bg-white/20 p-2 rounded-lg transition-colors",children:r?a.jsx(GD,{size:20}):a.jsx(rI,{size:20})})]}),a.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:D.map(B=>a.jsxs(Rx,{to:B.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
${z(B.path)?"bg-white/30 dark:bg-white/30 text-white dark:text-white border-l-4 border-white":""}
${r?"justify-center":""}
`,title:r?B.title:"",children:[a.jsx("span",{children:B.icon}),!r&&a.jsx("span",{className:`${o?"mr-4":"ml-4"} font-medium`,children:B.title})]},B.id))}),a.jsx("div",{className:`${r?"p-2":"p-4"} border-t border-white/10 backdrop-blur-sm bg-white/5 relative z-10`,children:!r&&a.jsx("div",{className:"text-xs text-white/70 dark:text-white/70 text-center",children:u("sidebar.version")})})]})]})},X4=R.createContext(void 0),sI=({children:e})=>{const[r,t]=R.useState(()=>localStorage.getItem("theme")||"light");R.useEffect(()=>{const o=document.documentElement;localStorage.setItem("theme",r),r==="dark"?o.classList.add("dark"):o.classList.remove("dark")},[r]);const n=()=>{t(o=>o==="light"?"dark":"light")};return a.jsx(X4.Provider,{value:{theme:r,toggleTheme:n},children:e})},iI=()=>{const e=R.useContext(X4);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e};class oI{getNotifications(r=50,t=0){return Ne(this,null,function*(){var u,f,g,v;const n=localStorage.getItem("user"),o=n?JSON.parse(n).email:"";if(!o)return[];try{const p=JSON.stringify([["for_user","=",o]]),k=JSON.stringify(["name","subject","email_content","document_type","document_name","read","creation","from_user","type"]),N=yield jt.apiCall(`/api/resource/Notification Log?filters=${encodeURIComponent(p)}&fields=${encodeURIComponent(k)}&order_by=creation desc&limit=${r}&offset=${t}`);return console.log("[NotificationService] Fetched notifications:",N==null?void 0:N.data),((u=N==null?void 0:N.data)==null?void 0:u.length)>0&&console.log("[NotificationService] First notification sample:",N.data[0]),(N==null?void 0:N.data)||[]}catch(p){return(f=p==null?void 0:p.message)!=null&&f.includes("417")||(g=p==null?void 0:p.message)!=null&&g.includes("EXPECTATION FAILED")?[]:((v=p==null?void 0:p.message)!=null&&v.includes("417")||console.warn("Notifications API not available:",(p==null?void 0:p.message)||"Unknown error"),[])}})}markAsRead(r){return Ne(this,null,function*(){var t,n,o,u;try{return yield jt.apiCall(`/api/resource/Notification Log/${r}`,{method:"PUT",body:JSON.stringify({read:1})})}catch(f){if((t=f==null?void 0:f.message)!=null&&t.includes("417")||(n=f==null?void 0:f.message)!=null&&n.includes("EXPECTATION FAILED")||(o=f==null?void 0:f.message)!=null&&o.includes("PermissionError")||(u=f==null?void 0:f.message)!=null&&u.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:",(f==null?void 0:f.message)||"Unknown error"),f}})}markAllAsRead(){return Ne(this,null,function*(){try{const t=(yield this.getNotifications(1e3)).filter(o=>!o.read);let n=0;for(const o of t)try{const u=yield this.markAsRead(o.name);(u==null?void 0:u.success)!==!1&&n++}catch(u){console.error(`Error marking notification ${o.name} as read:`,u)}return{success:!0,marked:n,total:t.length}}catch(r){return console.error("Error marking all notifications as read:",r),{success:!1,marked:0,total:0}}})}getUnreadCount(){return Ne(this,null,function*(){try{return(yield this.getNotifications(1e3)).filter(t=>!t.read).length}catch(r){return console.error("Error getting unread count:",r),0}})}}const Jg=new oI;function lI(){const[e,r]=R.useState([]),[t,n]=R.useState(0),[o,u]=R.useState(!0),[f,g]=R.useState(null),v=R.useCallback(()=>Ne(null,null,function*(){var N,C;try{u(!0),g(null);const O=yield Jg.getNotifications();r(O),n(O.filter(I=>!I.read).length)}catch(O){if((N=O==null?void 0:O.message)!=null&&N.includes("417")||(C=O==null?void 0:O.message)!=null&&C.includes("EXPECTATION FAILED"))r([]),n(0),g(null);else{const I=O instanceof Error?O.message:"Failed to fetch notifications";g(I),console.warn("Error fetching notifications:",O)}}finally{u(!1)}}),[]);R.useEffect(()=>{v();const N=setInterval(v,3e4);return()=>clearInterval(N)},[v]);const p=R.useCallback(N=>Ne(null,null,function*(){try{yield Jg.markAsRead(N),r(C=>C.map(O=>O.name===N?Ve(ke({},O),{read:1}):O)),n(C=>Math.max(0,C-1))}catch(C){throw console.error("Error marking notification as read:",C),C}}),[]),k=R.useCallback(()=>Ne(null,null,function*(){try{yield Jg.markAllAsRead(),r(N=>N.map(C=>Ve(ke({},C),{read:1}))),n(0)}catch(N){throw console.error("Error marking all notifications as read:",N),N}}),[]);return{notifications:e,unreadCount:t,loading:o,error:f,markAsRead:p,markAllAsRead:k,refetch:v}}const cI=()=>{const{notifications:e,unreadCount:r,markAsRead:t,markAllAsRead:n}=lI(),[o,u]=R.useState(!1),f=R.useRef(null),g=ma();R.useEffect(()=>{const C=O=>{f.current&&!f.current.contains(O.target)&&u(!1)};return o&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[o]);const v=C=>Ne(null,null,function*(){if(console.log("[NotificationBell] Clicked notification:",C),console.log("[NotificationBell] document_type:",C.document_type),console.log("[NotificationBell] document_name:",C.document_name),!C.read)try{yield t(C.name)}catch(O){console.warn("[NotificationBell] Could not mark as read (permission issue):",O)}if(C.document_type&&C.document_name){const O=C.document_type,I=C.document_name,M=O.replace(/_/g," ").trim();if(console.log("[NotificationBell] Normalized type:",M),console.log("[NotificationBell] Document name:",I),M==="Asset Maintenance Log"||M==="Asset Maintenance")console.log("[NotificationBell] Navigating to maintenance:",`/maintenance/${I}`),g(`/maintenance/${I}`);else if(M==="Work Order"||M==="Asset Repair")console.log("[NotificationBell] Navigating to work order:",`/work-orders/${I}`),g(`/work-orders/${I}`);else if(M==="Asset")console.log("[NotificationBell] Navigating to asset:",`/assets/${I}`),g(`/assets/${I}`);else if(M==="PM Schedule Generator"||M==="PM Schedule")console.log("[NotificationBell] Navigating to PPM planner:",`/ppm-planner/${I}`),g(`/ppm-planner/${I}`);else if(M==="PPM")console.log("[NotificationBell] Navigating to PPM:",`/ppm/${I}`),g(`/ppm/${I}`);else if(M==="Item")console.log("[NotificationBell] Navigating to inventory:",`/inventory/${I}`),g(`/inventory/${I}`);else{console.warn(`[NotificationBell] Unknown document type: ${O}, opening in Frappe`);const D=O.toLowerCase().replace(/\s+/g,"-").replace(/_/g,"-");window.open(`/app/${D}/${I}`,"_blank")}}else console.warn("[NotificationBell] No document_type or document_name found:",{document_type:C.document_type,document_name:C.document_name,notification:C});u(!1)}),p=C=>{const O=new Date(C),M=new Date().getTime()-O.getTime(),D=Math.floor(M/6e4),z=Math.floor(M/36e5),B=Math.floor(M/864e5);return D<1?"Just now":D<60?`${D}m ago`:z<24?`${z}h ago`:B<7?`${B}d ago`:O.toLocaleDateString()},k=e.filter(C=>!C.read),N=e.filter(C=>C.read).slice(0,10);return a.jsxs("div",{className:"relative",ref:f,children:[a.jsxs("button",{onClick:()=>u(!o),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(_D,{size:20}),r>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:r>9?"9+":r})]}),o&&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(nb,{}),"Notifications",r>0&&a.jsxs("span",{className:"text-xs bg-red-500 text-white px-2 py-0.5 rounded-full",children:[r," new"]})]}),r>0&&a.jsx("button",{onClick:n,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(nb,{className:"mx-auto text-3xl mb-2 opacity-50"}),a.jsx("p",{children:"No notifications"})]}):a.jsxs(a.Fragment,{children:[k.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"}),k.map(C=>a.jsx("div",{onClick:()=>v(C),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:C.subject||C.document_type||"Notification"}),C.email_content&&a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 line-clamp-2",children:C.email_content}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:p(C.creation)})]}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0 mt-1"})]})},C.name))]}),N.length>0&&a.jsxs("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700",children:[k.length>0&&a.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"EARLIER"}),N.map(C=>a.jsx("div",{onClick:()=>v(C),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:C.subject||C.document_type||"Notification"}),C.email_content&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-2",children:C.email_content}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:p(C.creation)})]})})},C.name))]})]})})]})]})},dI=({userEmail:e})=>{const r=ma(),t=Ti(),{theme:n,toggleTheme:o}=iI(),{language:u,changeLanguage:f}=G4(),{t:g}=Xa(),[v,p]=R.useState("");R.useEffect(()=>{Ne(null,null,function*(){var O;try{const D=(yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json()).message;if(D){const B=yield(yield fetch(`/api/resource/User/${encodeURIComponent(D)}?fields=["full_name"]`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json();p(((O=B.data)==null?void 0:O.full_name)||D);return}}catch(I){console.error("Error fetching user display name:",I)}e&&p(e)})},[e]);const k=()=>Ne(null,null,function*(){var C;localStorage.removeItem("user"),localStorage.removeItem("sid");try{const O=((C=document.cookie.split("; ").find(I=>I.startsWith("X-Frappe-CSRF-Token=")))==null?void 0:C.split("=")[1])||"";yield fetch("/api/method/frappe.auth.logout",{method:"POST",headers:{"Content-Type":"application/json","X-Frappe-CSRF-Token":O},credentials:"include"}),yield fetch("/?cmd=web_logout",{credentials:"include"})}catch(O){console.error("Logout error:",O)}finally{window.location.href="/asm_app/login"}}),N=t.pathname==="/user-profile";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("button",{type:"button",onClick:()=>r("/user-profile"),className:`
p-2 rounded-lg transition-colors text-white
${N?"bg-indigo-700 ring-2 ring-indigo-300 dark:ring-indigo-500":"bg-indigo-600 hover:bg-indigo-700"}
`,title:v||g("common.userProfile",{defaultValue:"User Profile"}),"aria-label":v||g("common.userProfile",{defaultValue:"User Profile"}),children:a.jsx(AD,{size:20})}),a.jsx("div",{className:"relative",children:a.jsx(cI,{})}),a.jsx("button",{onClick:()=>f(u==="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:g("common.language"),children:a.jsx(PD,{size:20})}),a.jsx("button",{onClick:o,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:g(n==="light"?"common.darkMode":"common.lightMode"),children:n==="light"?a.jsx(YD,{size:20}):a.jsx(JD,{size:20})}),a.jsx("button",{onClick:k,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:g("common.logout"),children:a.jsx(zD,{size:20})})]})};class uI{constructor(){ki(this,"baseURL");this.baseURL=wr.BASE_URL}getCSRFToken(){return Ne(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(r){return null}})}getHeaders(){return Ne(this,null,function*(){const r={Accept:"application/json","Content-Type":"application/json"},t=yield this.getCSRFToken();return t&&(r["X-Frappe-CSRF-Token"]=t),r})}getIssues(){return Ne(this,arguments,function*(r={}){const{filters:t={},fields:n=["name","subject","raised_by","status","priority","issue_type","opening_date","company","contact","creation","modified","first_responded_on","resolution_date","resolution_by"],limit_start:o=0,limit_page_length:u=20,order_by:f="creation desc"}=r,g=new URLSearchParams;if(g.append("fields",JSON.stringify(n)),g.append("limit_start",o.toString()),g.append("limit_page_length",u.toString()),g.append("order_by",f),Object.keys(t).length>0){const k=Object.entries(t).map(([N,C])=>[N,"=",C]);g.append("filters",JSON.stringify(k))}const v=yield fetch(`${this.baseURL}/api/resource/Issue?${g.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);return{data:(yield v.json()).data||[]}})}getIssue(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(r)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return(yield t.json()).data})}createIssue(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Issue`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(r)});if(!t.ok){const o=yield t.json().catch(()=>({}));throw new Error(o.message||`HTTP error! status: ${t.status}`)}return(yield t.json()).data})}updateIssue(r,t){return Ne(this,null,function*(){const n=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(r)}`,{method:"PUT",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!n.ok){const u=yield n.json().catch(()=>({}));throw new Error(u.message||`HTTP error! status: ${n.status}`)}return(yield n.json()).data})}deleteIssue(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(r)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`)})}getIssueCount(){return Ne(this,arguments,function*(r={}){var u,f;const t=new URLSearchParams;if(t.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(r).length>0){const g=Object.entries(r).map(([v,p])=>[v,"=",p]);t.append("filters",JSON.stringify(g))}const n=yield fetch(`${this.baseURL}/api/resource/Issue?${t.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return((f=(u=(yield n.json()).data)==null?void 0:u[0])==null?void 0:f.count)||0})}}const wd=new uI,fI=(e={})=>{const[r,t]=R.useState([]),[n,o]=R.useState(!0),[u,f]=R.useState(null),[g,v]=R.useState(0),p=R.useCallback(()=>Ne(null,null,function*(){try{o(!0),f(null);const k=yield wd.getIssues(e);t(k.data);const N=yield wd.getIssueCount(e.filters);v(N)}catch(k){f(k instanceof Error?k.message:"Failed to fetch issues")}finally{o(!1)}}),[JSON.stringify(e)]);return R.useEffect(()=>{p()},[p]),{issues:r,loading:n,error:u,totalCount:g,refetch:p}},hI=e=>{const[r,t]=R.useState(null),[n,o]=R.useState(!1),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null);return}try{o(!0),f(null);const v=yield wd.getIssue(e);t(v)}catch(v){f(v instanceof Error?v.message:"Failed to fetch issue details")}finally{o(!1)}}),[e]);return R.useEffect(()=>{g()},[g]),{issue:r,loading:n,error:u,refetch:g}},mI=()=>{const[e,r]=R.useState(!1),[t,n]=R.useState(null);return{createIssue:g=>Ne(null,null,function*(){try{return r(!0),n(null),yield wd.createIssue(g)}catch(v){const p=v instanceof Error?v.message:"Failed to create issue";throw n(p),v}finally{r(!1)}}),updateIssue:(g,v)=>Ne(null,null,function*(){try{return r(!0),n(null),yield wd.updateIssue(g,v)}catch(p){const k=p instanceof Error?p.message:"Failed to update issue";throw n(k),p}finally{r(!1)}}),deleteIssue:g=>Ne(null,null,function*(){try{r(!0),n(null),yield wd.deleteIssue(g)}catch(v){const p=v instanceof Error?v.message:"Failed to delete issue";throw n(p),v}finally{r(!1)}}),loading:e,error:t}},gI=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const[v,p]=R.useState(t>0?"selected":"all_with_filters"),[k,N]=R.useState("csv"),[C,O]=R.useState(g.filter(z=>z.default).map(z=>z.key));R.useEffect(()=>{t>0?p("selected"):p("all_with_filters")},[t]);const I=z=>{O(B=>B.includes(z)?B.filter(U=>U!==z):[...B,z])},M=()=>O(g.map(z=>z.key)),D=()=>O(g.filter(z=>z.default).map(z=>z.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(Cs,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Issues"})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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 ${v==="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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:v==="selected",onChange:()=>p("selected"),disabled:t===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 ",t," selected issue",t!==1?"s":""]})]}),t>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:[t," selected"]})]}),a.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="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:v==="all_on_page",onChange:()=>p("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 ",o," issue",o!==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:[o," rows"]})]}),a.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="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:v==="all_with_filters",onChange:()=>p("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 ",n," issue",n!==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:[n," 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 ${k==="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:k==="csv",onChange:()=>N("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{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 ${k==="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:k==="excel",onChange:()=>N("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{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:M,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:D,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:g.map(z=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${C.includes(z.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:C.includes(z.key),onChange:()=>I(z.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:z.label})]},z.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[C.length," column",C.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:[v==="selected"&&`Exporting ${t} selected row${t!==1?"s":""}`,v==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,v==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(v,k,C),disabled:C.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},xI=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"}},pI=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"}},yI=()=>{const{t:e}=Xa(),r=ma(),t=[{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}],[n,o]=R.useState(1),[u]=R.useState(20),[f,g]=R.useState(!1),[v,p]=R.useState(new Set),[k,N]=R.useState(!1),[C,O]=R.useState(!1),[I,M]=R.useState(null),[D,z]=R.useState(""),[B,U]=R.useState(""),[H,q]=R.useState(""),[ne,V]=R.useState(""),[J,Q]=R.useState(!1),[Te,je]=R.useState(0),[me,Se]=R.useState([]),[Oe,ue]=R.useState(!1),[be,re]=R.useState("");R.useEffect(()=>{const ve=localStorage.getItem("issueFilterPresets");ve&&Se(JSON.parse(ve))},[]),R.useEffect(()=>{const ve=[D,B,H,ne].filter(Boolean).length;je(ve)},[D,B,H,ne]);const de=R.useMemo(()=>{const ve={};return D&&(ve.status=D),B&&(ve.priority=B),H&&(ve.company=H),ne&&(ve.name=ne),ve},[D,B,H,ne]),{issues:Ae,loading:_e,error:K,totalCount:W,refetch:ae}=fI({filters:de,limit_start:(n-1)*u,limit_page_length:u,order_by:"creation desc"});R.useEffect(()=>{!_e&&!f&&g(!0)},[_e,f]),R.useEffect(()=>{n!==1&&o(1)},[D,B,H,ne]),R.useEffect(()=>{p(new Set)},[D,B,H,ne,n]);const se=Math.ceil(W/u),he=ve=>ve?new Date(ve).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",pe=()=>{z(""),U(""),q(""),V(""),o(1)},Je=D||B||H||ne,Fe=()=>{if(!be.trim()){alert("Please enter a filter name");return}const ve={id:Date.now(),name:be,filters:{statusFilter:D,priorityFilter:B,companyFilter:H,issueIdFilter:ne}},Le=[...me,ve];Se(Le),re(""),ue(!1),localStorage.setItem("issueFilterPresets",JSON.stringify(Le))},ft=ve=>{const Le=ve.filters;z(Le.statusFilter||""),U(Le.priorityFilter||""),q(Le.companyFilter||""),V(Le.issueIdFilter||"")},ot=ve=>{const Le=me.filter(ut=>ut.id!==ve);Se(Le),localStorage.setItem("issueFilterPresets",JSON.stringify(Le))},Lt=ve=>{p(Le=>{const ut=new Set(Le);return ut.has(ve)?ut.delete(ve):ut.add(ve),ut})},zt=()=>{v.size===Ae.length?p(new Set):p(new Set(Ae.map(ve=>ve.name)))},Ht=Ae.length>0&&v.size===Ae.length,ht=v.size>0&&v.size<Ae.length,tr=R.useCallback(()=>Ne(null,null,function*(){const ve=[];let Le=0;const ut=100;let tt=!0;for(;tt;)try{const We=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Issue",filters:de,fields:["*"],limit_start:Le*ut,limit_page_length:ut,order_by:"creation desc"})})).json()).message||[];ve.push(...We),We.length<ut?tt=!1:Le++,Le>100&&(console.warn("Export safety limit reached"),tt=!1)}catch(Wt){throw console.error("Error fetching issues for export:",Wt),Wt}return ve}),[de]),Kt=(ve,Le,ut)=>Ne(null,null,function*(){O(!0);try{let tt=[];switch(ve){case"selected":tt=Ae.filter(pt=>v.has(pt.name));break;case"all_on_page":tt=Ae;break;case"all_with_filters":tt=yield tr();break}if(tt.length===0){alert("No data to export");return}const Wt=ut.map(pt=>{var We;return((We=t.find(Nt=>Nt.key===pt))==null?void 0:We.label)||pt});if(Le==="csv"){const pt=[Wt.join(","),...tt.map(Qt=>ut.map(cr=>{let He=Qt[cr]||"";return typeof He=="string"&&(He.includes(",")||He.includes('"')||He.includes(`
`))&&(He=`"${He.replace(/"/g,'""')}"`),He}).join(","))].join(`
`),We=new Blob(["\uFEFF"+pt],{type:"text/csv;charset=utf-8;"}),Nt=URL.createObjectURL(We),At=document.createElement("a");At.href=Nt,At.download=`issues_export_${new Date().toISOString().split("T")[0]}.csv`,At.click(),URL.revokeObjectURL(Nt)}else if(Le==="excel"){const pt=[Wt,...tt.map(At=>ut.map(Qt=>At[Qt]||""))],We=Un.aoa_to_sheet(pt),Nt=Un.book_new();Un.book_append_sheet(Nt,We,"Issues"),Fd(Nt,`issues_export_${new Date().toISOString().split("T")[0]}.xlsx`)}N(!1),p(new Set)}catch(tt){console.error("Export failed:",tt),alert(`Export failed: ${tt instanceof Error?tt.message:"Unknown error"}`)}finally{O(!1)}}),gt=ve=>Ne(null,null,function*(){try{if(!(yield fetch(`/api/resource/Issue/${ve}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");M(null),ae(),alert("Issue deleted successfully!")}catch(Le){alert(`Failed to delete: ${Le instanceof Error?Le.message:"Unknown error"}`)}});return _e&&!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 issues..."})]})}):K?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:K}),a.jsx("button",{onClick:ae,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):a.jsxs("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ib,{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: ",W," issue",W!==1?"s":"",v.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",v.size," selected"]}),_e&&f&&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:()=>Q(!J),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${J||Je?"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($i,{}),"Filters",Te>0&&a.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:Te})]}),a.jsxs("button",{onClick:ae,disabled:_e,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(Lx,{className:_e?"animate-spin":""}),"Refresh"]}),a.jsxs("button",{onClick:()=>N(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:W===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:"Export"}),v.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:v.size})]}),a.jsxs("button",{onClick:()=>r("/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(Ei,{}),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:W})]}),a.jsx(e5,{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:Ae.filter(ve=>ve.status==="Open").length})]}),a.jsx(Tl,{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:Ae.filter(ve=>ve.status==="Resolved").length})]}),a.jsx(Ua,{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:Ae.filter(ve=>ve.status==="Closed").length})]}),a.jsx(In,{className:"text-3xl text-gray-500"})]})})]}),J&&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($i,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),Te>0&&a.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:Te})]}),Je&&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:[ne&&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:"})," ",ne,a.jsx("button",{onClick:()=>V(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]}),D&&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:"})," ",D,a.jsx("button",{onClick:()=>z(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]}),B&&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:"})," ",B,a.jsx("button",{onClick:()=>U(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]}),H&&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:"})," ",H,a.jsx("button",{onClick:()=>q(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Te>0&&a.jsxs("button",{onClick:()=>ue(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[a.jsx(Tn,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),Je&&a.jsxs("button",{onClick:pe,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(Yt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),a.jsxs("div",{className:"p-4",children:[me.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(nu,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:me.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-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:()=>ft(ve),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:ve.name}),a.jsx("button",{onClick:()=>ot(ve.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(la,{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 lg:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"relative z-[60]",children:[a.jsx(er,{label:"Issue",doctype:"Issue",value:ne,onChange:ve=>{V(ve),o(1)},placeholder:"Select Issue",disabled:!1,compact:!0}),ne&&a.jsx("button",{onClick:()=>V(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{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:D,onChange:ve=>{z(ve.target.value),o(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(er,{label:e("commonFields.priority"),doctype:"Issue Priority",value:B,onChange:ve=>{U(ve),o(1)},placeholder:e("issues.allPriorities"),disabled:!1,compact:!0}),B&&a.jsx("button",{onClick:()=>U(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[58]",children:[a.jsx(er,{label:e("commonFields.company"),doctype:"Company",value:H,onChange:ve=>{q(ve),o(1)},placeholder:e("issues.allCompanies"),disabled:!1,compact:!0}),H&&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(Yt,{size:10})})]})]})})]})]}),Oe&&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:be,onChange:ve=>re(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),Fe())},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:()=>{ue(!1),re("")},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:Fe,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(Tn,{size:12}),"Save Filter"]})]})]})}),a.jsx(gI,{isOpen:k,onClose:()=>N(!1),selectedCount:v.size,totalCount:W,pageCount:Ae.length,onExport:Kt,isExporting:C,exportColumns:t}),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:[_e&&f&&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:zt,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:e(Ht?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:Ht?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):ht?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:Ae.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(ib,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:"No issues found"}),Je?a.jsx("button",{onClick:pe,className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Clear filters"}):a.jsx("button",{onClick:()=>r("/support/new"),className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Create your first issue"})]})})}):Ae.map(ve=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${v.has(ve.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>r(`/support/${ve.name}`),children:[a.jsx("td",{className:"px-4 py-3",onClick:Le=>Le.stopPropagation(),children:a.jsx("button",{onClick:()=>Lt(ve.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:v.has(ve.name)?a.jsx(fi,{className:"text-blue-600 dark:text-blue-400",size:18}):a.jsx(Bn,{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:ve.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:ve.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 ${xI(ve.status)}`,children:ve.status||"-"})}),a.jsx("td",{className:"px-4 py-3",children:ve.priority?a.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-medium rounded-full ${pI(ve.priority)}`,children:ve.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:ve.company||"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:he(ve.opening_date)})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:Le=>Le.stopPropagation(),children:[a.jsx("button",{onClick:()=>r(`/support/${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("issues.viewDetails"),children:a.jsx(Yi,{})}),a.jsx("button",{onClick:()=>r(`/support/${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("issues.editIssue"),children:a.jsx(rs,{})}),a.jsx("button",{onClick:()=>M(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("issues.deleteIssue"),children:a.jsx(la,{})})]})})]},ve.name))})]})}),se>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 ",(n-1)*u+1," to ",Math.min(n*u,W)," of ",W," issues"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>o(ve=>Math.max(1,ve-1)),disabled:n===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(yh,{})}),a.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",n," of ",se]}),a.jsx("button",{onClick:()=>o(ve=>Math.min(se,ve+1)),disabled:n===se,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50 dark:hover:bg-gray-700",children:a.jsx(bh,{})})]})]})]}),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(la,{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:"})," ",I]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>M(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:()=>gt(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",children:[a.jsx(la,{}),"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; }
`})]})},bI=()=>new Date().toISOString().split("T")[0],vI=()=>new Date().toTimeString().split(" ")[0],_I=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"}}},wI=()=>{const{t:e}=Xa(),{issueName:r}=Ml(),t=ma(),n=r==="new",[o,u]=R.useState({subject:"",raised_by:"",status:"Open",priority:"",issue_type:"",description:"",contact:"",company:"",customer:"",project:"",resolution_details:"",opening_date:n?bI():"",opening_time:n?vI():"",first_responded_on:"",resolution_date:"",resolution_by:""}),{issue:f,loading:g,error:v,refetch:p}=hI(n?null:r||null),{createIssue:k,updateIssue:N,deleteIssue:C,loading:O}=mI(),[I,M]=R.useState(n),[D,z]=R.useState(!1);R.useEffect(()=>{f&&!n&&(u({subject:f.subject||"",raised_by:f.raised_by||"",status:f.status||"Open",priority:f.priority||"",issue_type:f.issue_type||"",description:f.description||"",contact:f.contact||"",company:f.company||"",customer:f.customer||"",project:f.project||"",resolution_details:f.resolution_details||"",opening_date:f.opening_date||"",opening_time:f.opening_time||"",first_responded_on:f.first_responded_on?f.first_responded_on.split(" ")[0]:"",resolution_date:f.resolution_date?f.resolution_date.split(" ")[0]:"",resolution_by:f.resolution_by||""}),M(!1))},[f,n]);const B=Q=>{const{name:Te,value:je}=Q.target;u(me=>Ve(ke({},me),{[Te]:je}))},U=()=>Ne(null,null,function*(){if(!o.subject){ar.error("Please enter a subject",{position:"top-right",autoClose:4e3,icon:a.jsx(In,{})});return}try{if(n){const Q=yield k(o);ar.success("Issue created successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),t(`/support/${Q.name}`)}else yield N(r,o),ar.success("Issue updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),M(!1),p()}catch(Q){const Te=Q instanceof Error?Q.message:"Unknown error";ar.error(`Failed to save: ${Te}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}}),H=()=>Ne(null,null,function*(){try{yield C(r),ar.success("Issue deleted successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),t("/support")}catch(Q){const Te=Q instanceof Error?Q.message:"Unknown error";ar.error(`Failed to delete: ${Te}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}}),q=R.useCallback(Q=>!!(!I||["opening_date","opening_time"].includes(Q)&&!n),[I,n]),ne=Q=>Q?new Date(Q).toLocaleString():"-";if(g)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(v&&!n)return a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:v}),a.jsx("button",{onClick:()=>t("/support"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Issues"})]})});const V=(f==null?void 0:f.status)||o.status||"Open",J=_I(V);return a.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-4 sm:p-6 min-w-0 overflow-x-hidden",children:[a.jsx(Bh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:pu}),a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>t("/support"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ki,{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:[n?e("issues.newIssue"):(f==null?void 0:f.name)||e("issues.issueDetails"),!n&&a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${J.bg} ${J.text} ${J.border} border`,children:V})]}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:n?e("issues.createNewIssue"):o.subject})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!n&&!I&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>M(!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(rs,{}),e("common.edit")]}),a.jsxs("button",{onClick:()=>z(!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(la,{}),e("common.delete")]})]}),I&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{n?t("/support"):(M(!1),p())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:e("common.cancel")}),a.jsxs("button",{onClick:U,disabled:O,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(Tn,{}),e(O?"common.saving":"common.save")]})]})]})]}),D&&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(en,{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:()=>z(!1),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),a.jsx("button",{onClick:H,disabled:O,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg disabled:opacity-50",children:O?"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(QS,{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:o.subject,onChange:B,disabled:q("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:o.status,onChange:B,disabled:q("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(er,{label:e("commonFields.priority"),doctype:"Issue Priority",value:o.priority||"",onChange:Q=>u(Ve(ke({},o),{priority:Q})),disabled:q("priority"),placeholder:e("issues.selectPriority")})})]}),a.jsx("div",{children:a.jsx(er,{label:e("issues.issueType"),doctype:"Issue Type",value:o.issue_type||"",onChange:Q=>u(Ve(ke({},o),{issue_type:Q})),disabled:q("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:o.description,onChange:B,disabled:q("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(Gf,{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(c_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),a.jsx("input",{type:"email",name:"raised_by",value:o.raised_by,onChange:B,disabled:q("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(er,{label:e("commonFields.company"),doctype:"Company",value:o.company||"",onChange:Q=>u(Ve(ke({},o),{company:Q})),disabled:q("company"),placeholder:e("issues.selectCompany")})})]})]}),!n&&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(Ua,{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:o.first_responded_on||"",onChange:B,disabled:q("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:o.resolution_date||"",onChange:B,disabled:q("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(er,{label:e("issues.resolvedBy"),doctype:"User",value:o.resolution_by||"",onChange:Q=>u(Ve(ke({},o),{resolution_by:Q})),disabled:q("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:o.resolution_details,onChange:B,disabled:q("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(o5,{className:"text-orange-500"}),e("issues.statusInformation")]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`p-4 rounded-lg border ${J.bg} ${J.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 ${J.text}`,children:V})]}),o.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:o.priority})]}),o.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:o.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(Yo,{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:o.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:o.opening_time||"-"})]}),!n&&f&&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:ne(f.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:ne(f.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:f.modified_by||"-"})]})]})]})]}),o.company&&!n&&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(Ix,{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:o.company})})]})]})]})]})};class kI{constructor(){ki(this,"baseURL");this.baseURL=wr.BASE_URL}getCSRFToken(){return Ne(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(r){return null}})}getHeaders(){return Ne(this,null,function*(){const r={Accept:"application/json","Content-Type":"application/json"},t=yield this.getCSRFToken();return t&&(r["X-Frappe-CSRF-Token"]=t),r})}getMaintenanceTeams(){return Ne(this,arguments,function*(r={}){const{filters:t={},fields:n=["name","maintenance_team_name","maintenance_manager","maintenance_manager_name","company","custom_expertise","creation","modified"],limit_start:o=0,limit_page_length:u=20,order_by:f="creation desc"}=r,g=new URLSearchParams;if(g.append("fields",JSON.stringify(n)),g.append("limit_start",o.toString()),g.append("limit_page_length",u.toString()),g.append("order_by",f),Object.keys(t).length>0){const k=Object.entries(t).map(([N,C])=>[N,"=",C]);g.append("filters",JSON.stringify(k))}const v=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${g.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);return{data:(yield v.json()).data||[]}})}getMaintenanceTeam(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(r)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return(yield t.json()).data})}createMaintenanceTeam(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(r)});if(!t.ok){const o=yield t.json().catch(()=>({}));throw new Error(o.message||`HTTP error! status: ${t.status}`)}return(yield t.json()).data})}updateMaintenanceTeam(r,t){return Ne(this,null,function*(){const n=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(r)}`,{method:"PUT",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!n.ok){const u=yield n.json().catch(()=>({}));throw new Error(u.message||`HTTP error! status: ${n.status}`)}return(yield n.json()).data})}deleteMaintenanceTeam(r){return Ne(this,null,function*(){const t=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(r)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`)})}getMaintenanceTeamCount(){return Ne(this,arguments,function*(r={}){var u,f;const t=new URLSearchParams;if(t.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(r).length>0){const g=Object.entries(r).map(([v,p])=>[v,"=",p]);t.append("filters",JSON.stringify(g))}const n=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${t.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return((f=(u=(yield n.json()).data)==null?void 0:u[0])==null?void 0:f.count)||0})}getUserFullName(r){return Ne(this,null,function*(){var t;try{const n=yield fetch(`${this.baseURL}/api/resource/User/${encodeURIComponent(r)}?fields=["full_name"]`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});return n.ok&&((t=(yield n.json()).data)==null?void 0:t.full_name)||""}catch(n){return""}})}}const oc=new kI,NI=(e={})=>{const[r,t]=R.useState([]),[n,o]=R.useState(!0),[u,f]=R.useState(null),[g,v]=R.useState(0),p=R.useCallback(()=>Ne(null,null,function*(){try{o(!0),f(null);const k=yield oc.getMaintenanceTeams(e);t(k.data);const N=yield oc.getMaintenanceTeamCount(e.filters);v(N)}catch(k){f(k instanceof Error?k.message:"Failed to fetch maintenance teams")}finally{o(!1)}}),[JSON.stringify(e)]);return R.useEffect(()=>{p()},[p]),{teams:r,loading:n,error:u,totalCount:g,refetch:p}},SI=e=>{const[r,t]=R.useState(null),[n,o]=R.useState(!1),[u,f]=R.useState(null),g=R.useCallback(()=>Ne(null,null,function*(){if(!e){t(null);return}try{o(!0),f(null);const v=yield oc.getMaintenanceTeam(e);t(v)}catch(v){f(v instanceof Error?v.message:"Failed to fetch maintenance team details")}finally{o(!1)}}),[e]);return R.useEffect(()=>{g()},[g]),{team:r,loading:n,error:u,refetch:g}},EI=()=>{const[e,r]=R.useState(!1),[t,n]=R.useState(null);return{createTeam:v=>Ne(null,null,function*(){try{return r(!0),n(null),yield oc.createMaintenanceTeam(v)}catch(p){const k=p instanceof Error?p.message:"Failed to create maintenance team";throw n(k),p}finally{r(!1)}}),updateTeam:(v,p)=>Ne(null,null,function*(){try{return r(!0),n(null),yield oc.updateMaintenanceTeam(v,p)}catch(k){const N=k instanceof Error?k.message:"Failed to update maintenance team";throw n(N),k}finally{r(!1)}}),deleteTeam:v=>Ne(null,null,function*(){try{r(!0),n(null),yield oc.deleteMaintenanceTeam(v)}catch(p){const k=p instanceof Error?p.message:"Failed to delete maintenance team";throw n(k),p}finally{r(!1)}}),getUserFullName:v=>Ne(null,null,function*(){return yield oc.getUserFullName(v)}),loading:e,error:t}},CI=({isOpen:e,onClose:r,selectedCount:t,totalCount:n,pageCount:o,onExport:u,isExporting:f,exportColumns:g})=>{const[v,p]=R.useState(t>0?"selected":"all_with_filters"),[k,N]=R.useState("csv"),[C,O]=R.useState(g.filter(z=>z.default).map(z=>z.key));R.useEffect(()=>{p(t>0?"selected":"all_with_filters")},[t]);const I=z=>O(B=>B.includes(z)?B.filter(U=>U!==z):[...B,z]),M=()=>O(g.map(z=>z.key)),D=()=>O(g.filter(z=>z.default).map(z=>z.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(Cs,{className:"text-white text-xl"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Maintenance Teams"})]}),a.jsx("button",{onClick:r,className:"text-white/80 hover:text-white transition-colors",disabled:f,children:a.jsx(Yt,{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 ${v==="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"} ${t===0?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx("input",{type:"radio",name:"scope",value:"selected",checked:v==="selected",onChange:()=>p("selected"),disabled:t===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 ",t," selected team",t!==1?"s":""]})]}),t>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:[t," selected"]})]}),a.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="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:v==="all_on_page",onChange:()=>p("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 ",o," team",o!==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:[o," rows"]})]}),a.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${v==="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:v==="all_with_filters",onChange:()=>p("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 ",n," team",n!==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:[n," 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 ${k==="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:k==="csv",onChange:()=>N("csv"),className:"text-green-600 focus:ring-green-500"}),a.jsx(jd,{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 ${k==="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:k==="excel",onChange:()=>N("excel"),className:"text-green-600 focus:ring-green-500"}),a.jsx(Od,{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:M,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:D,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:g.map(z=>a.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${C.includes(z.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:C.includes(z.key),onChange:()=>I(z.key),className:"rounded text-green-600 focus:ring-green-500"}),a.jsx("span",{className:"text-sm truncate",children:z.label})]},z.key))}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[C.length," column",C.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:[v==="selected"&&`Exporting ${t} selected row${t!==1?"s":""}`,v==="all_on_page"&&`Exporting ${o} row${o!==1?"s":""} from current page`,v==="all_with_filters"&&`Exporting all ${n} row${n!==1?"s":""}`]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,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:f,children:"Cancel"}),a.jsx("button",{onClick:()=>u(v,k,C),disabled:C.length===0||f,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:f?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(yc,{}),"Export"]})})]})]})]})}):null},TI=()=>{const{t:e}=Xa(),r=ma(),t=[{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}],[n,o]=R.useState(1),[u]=R.useState(20),[f,g]=R.useState(!1),[v,p]=R.useState(new Set),[k,N]=R.useState(!1),[C,O]=R.useState(!1),[I,M]=R.useState(null),[D,z]=R.useState(""),[B,U]=R.useState(""),[H,q]=R.useState(!1),[ne,V]=R.useState(0),[J,Q]=R.useState([]),[Te,je]=R.useState(!1),[me,Se]=R.useState("");R.useEffect(()=>{const ht=localStorage.getItem("maintenanceTeamFilterPresets");ht&&Q(JSON.parse(ht))},[]),R.useEffect(()=>{const ht=[D,B].filter(Boolean).length;V(ht)},[D,B]);const Oe=R.useMemo(()=>{const ht={};return D&&(ht.company=D),B&&(ht.name=B),ht},[D,B]),{teams:ue,loading:be,error:re,totalCount:de,refetch:Ae}=NI({filters:Oe,limit_start:(n-1)*u,limit_page_length:u,order_by:"creation desc"});R.useEffect(()=>{!be&&!f&&g(!0)},[be,f]),R.useEffect(()=>{n!==1&&o(1)},[D,B]),R.useEffect(()=>{p(new Set)},[D,B,n]);const _e=Math.ceil(de/u),K=ht=>ht?new Date(ht).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",W=()=>{z(""),U(""),o(1)},ae=D||B,se=()=>{if(!me.trim()){alert("Please enter a filter name");return}const ht={id:Date.now(),name:me,filters:{companyFilter:D,teamNameFilter:B}},tr=[...J,ht];Q(tr),Se(""),je(!1),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(tr))},he=ht=>{const tr=ht.filters;z(tr.companyFilter||""),U(tr.teamNameFilter||"")},pe=ht=>{const tr=J.filter(Kt=>Kt.id!==ht);Q(tr),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(tr))},Je=ht=>{p(tr=>{const Kt=new Set(tr);return Kt.has(ht)?Kt.delete(ht):Kt.add(ht),Kt})},Fe=()=>{v.size===ue.length?p(new Set):p(new Set(ue.map(ht=>ht.name)))},ft=ue.length>0&&v.size===ue.length,ot=v.size>0&&v.size<ue.length,Lt=R.useCallback(()=>Ne(null,null,function*(){const ht=[];let tr=0;const Kt=100;let gt=!0;for(;gt;)try{const ut=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset Maintenance Team",filters:Oe,fields:["*"],limit_start:tr*Kt,limit_page_length:Kt,order_by:"creation desc"})})).json()).message||[];ht.push(...ut),ut.length<Kt?gt=!1:tr++,tr>100&&(console.warn("Export safety limit reached"),gt=!1)}catch(ve){throw console.error("Error fetching teams for export:",ve),ve}return ht}),[Oe]),zt=(ht,tr,Kt)=>Ne(null,null,function*(){O(!0);try{let gt=[];switch(ht){case"selected":gt=ue.filter(Le=>v.has(Le.name));break;case"all_on_page":gt=ue;break;case"all_with_filters":gt=yield Lt();break}if(gt.length===0){alert("No data to export");return}const ve=Kt.map(Le=>{var ut;return((ut=t.find(tt=>tt.key===Le))==null?void 0:ut.label)||Le});if(tr==="csv"){const Le=[ve.join(","),...gt.map(pt=>Kt.map(We=>{let Nt=pt[We]||"";return typeof Nt=="string"&&(Nt.includes(",")||Nt.includes('"')||Nt.includes(`
`))&&(Nt=`"${Nt.replace(/"/g,'""')}"`),Nt}).join(","))].join(`
`),ut=new Blob(["\uFEFF"+Le],{type:"text/csv;charset=utf-8;"}),tt=URL.createObjectURL(ut),Wt=document.createElement("a");Wt.href=tt,Wt.download=`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.csv`,Wt.click(),URL.revokeObjectURL(tt)}else if(tr==="excel"){const Le=[ve,...gt.map(Wt=>Kt.map(pt=>Wt[pt]||""))],ut=Un.aoa_to_sheet(Le),tt=Un.book_new();Un.book_append_sheet(tt,ut,"Maintenance Teams"),Fd(tt,`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.xlsx`)}N(!1),p(new Set)}catch(gt){console.error("Export failed:",gt),alert(`Export failed: ${gt instanceof Error?gt.message:"Unknown error"}`)}finally{O(!1)}}),Ht=ht=>Ne(null,null,function*(){try{if(!(yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(ht)}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");M(null),Ae(),alert("Maintenance Team deleted successfully!")}catch(tr){alert(`Failed to delete: ${tr instanceof Error?tr.message:"Unknown error"}`)}});return be&&!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 maintenance teams..."})]})}):re?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:re}),a.jsx("button",{onClick:Ae,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):a.jsxs("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",children:[a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(L0,{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: ",de," team",de!==1?"s":"",v.size>0&&a.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",v.size," selected"]}),be&&f&&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:()=>q(!H),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${H||ae?"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($i,{}),"Filters",ne>0&&a.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:ne})]}),a.jsxs("button",{onClick:Ae,disabled:be,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(Lx,{className:be?"animate-spin":""}),"Refresh"]}),a.jsxs("button",{onClick:()=>N(!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:de===0,children:[a.jsx(Cs,{}),a.jsx("span",{className:"font-medium",children:"Export"}),v.size>0&&a.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:v.size})]}),a.jsxs("button",{onClick:()=>r("/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(Ei,{}),a.jsx("span",{className:"font-medium",children:"New Team"})]})]})]}),H&&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($i,{className:"text-white",size:16}),a.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),ne>0&&a.jsx("span",{className:"bg-white text-indigo-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ne})]}),ae&&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:[D&&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:"})," ",D,a.jsx("button",{onClick:()=>z(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]}),B&&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:"})," ",B,a.jsx("button",{onClick:()=>U(""),className:"hover:text-red-500",children:a.jsx(Yt,{className:"text-[9px]"})})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ne>0&&a.jsxs("button",{onClick:()=>je(!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(Tn,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),ae&&a.jsxs("button",{onClick:W,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(Yt,{size:12}),a.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),a.jsxs("div",{className:"p-4",children:[J.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(nu,{className:"text-yellow-500",size:12}),"Saved Filters"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(ht=>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:()=>he(ht),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:ht.name}),a.jsx("button",{onClick:()=>pe(ht.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:a.jsx(la,{size:10})})]},ht.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(er,{label:"Hospital",doctype:"Company",value:D,onChange:ht=>{z(ht),o(1)},placeholder:"Select Hospital",disabled:!1,compact:!0}),D&&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(Yt,{size:10})})]}),a.jsxs("div",{className:"relative z-[59]",children:[a.jsx(er,{label:e("maintenance.teamName"),doctype:"Asset Maintenance Team",value:B,onChange:ht=>{U(ht),o(1)},placeholder:e("maintenance.selectTeam"),disabled:!1,compact:!0}),B&&a.jsx("button",{onClick:()=>U(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:a.jsx(Yt,{size:10})})]})]})})]})]}),Te&&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:me,onChange:ht=>Se(ht.target.value),onKeyDown:ht=>{ht.key==="Enter"&&(ht.preventDefault(),se())},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:()=>{je(!1),Se("")},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:se,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(Tn,{size:12}),e("listPages.saveFilter")]})]})]})}),a.jsx(CI,{isOpen:k,onClose:()=>N(!1),selectedCount:v.size,totalCount:de,pageCount:ue.length,onExport:zt,isExporting:C,exportColumns:t}),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:[be&&f&&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:Fe,className:"text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",title:e(ft?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:ft?a.jsx(fi,{className:"text-indigo-600 dark:text-indigo-400",size:18}):ot?a.jsxs("div",{className:"relative",children:[a.jsx(Bn,{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(Bn,{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:ue.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(L0,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),a.jsx("p",{children:e("listPages.noMaintenanceTeamsFound")}),ae?a.jsx("button",{onClick:W,className:"mt-4 text-indigo-600 dark:text-indigo-400 hover:underline",children:e("listPages.clearFilters")}):a.jsx("button",{onClick:()=>r("/maintenance-teams/new"),className:"mt-4 text-indigo-600 dark:text-indigo-400 hover:underline",children:e("listPages.createFirstTeam")})]})})}):ue.map(ht=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${v.has(ht.name)?"bg-indigo-50 dark:bg-indigo-900/20":""}`,onClick:()=>r(`/maintenance-teams/${ht.name}`),children:[a.jsx("td",{className:"px-4 py-3",onClick:tr=>tr.stopPropagation(),children:a.jsx("button",{onClick:()=>Je(ht.name),className:"text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",children:v.has(ht.name)?a.jsx(fi,{className:"text-indigo-600 dark:text-indigo-400",size:18}):a.jsx(Bn,{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:ht.maintenance_team_name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:ht.name})]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:ht.maintenance_manager_name||"-"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:ht.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:ht.company||"-"})}),a.jsx("td",{className:"px-4 py-3",children:ht.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:ht.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:K(ht.creation)})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",onClick:tr=>tr.stopPropagation(),children:[a.jsx("button",{onClick:()=>r(`/maintenance-teams/${ht.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(Yi,{})}),a.jsx("button",{onClick:()=>r(`/maintenance-teams/${ht.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(rs,{})}),a.jsx("button",{onClick:()=>r(`/maintenance-teams/new?duplicate=${ht.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(Ad,{})}),a.jsx("button",{onClick:()=>M(ht.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(la,{})})]})})]},ht.name))})]})}),_e>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 ",(n-1)*u+1," to ",Math.min(n*u,de)," of ",de," teams"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>o(ht=>Math.max(1,ht-1)),disabled:n===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(yh,{})}),a.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",n," of ",_e]}),a.jsx("button",{onClick:()=>o(ht=>Math.min(_e,ht+1)),disabled:n===_e,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(bh,{})})]})]})]}),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(la,{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:"})," ",I]})}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>M(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:()=>Ht(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",children:[a.jsx(la,{}),"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; }
`})]})},AI=()=>{var _e;const{t:e}=Xa(),{teamName:r}=Ml(),[t]=Rl(),n=ma(),o=r==="new",u=t.get("duplicate"),[f,g]=R.useState({maintenance_team_name:"",maintenance_manager:"",maintenance_manager_name:"",company:"",custom_expertise:"",maintenance_team_members:[]}),{team:v,loading:p,error:k,refetch:N}=SI(o?u||null:r||null),{createTeam:C,updateTeam:O,deleteTeam:I,getUserFullName:M,loading:D}=EI(),[z,B]=R.useState(o),[U,H]=R.useState(!1),[q,ne]=R.useState(null),[V,J]=R.useState(null),Q=K=>Ne(null,null,function*(){if(!K)return{exists:!1};try{const W=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(!W.ok)return yield Te(K);const se=(yield W.json()).message||[];for(const he of se)if(!(he.name===r||he.name===(v==null?void 0:v.name))&&he["maintenance_team_members.team_member"]===K)return{exists:!0,teamName:he.maintenance_team_name||he.name};return yield Te(K)}catch(W){return console.error("Error checking member in other teams:",W),yield Te(K)}}),Te=K=>Ne(null,null,function*(){var W,ae;try{const se=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(!se.ok)return{exists:!1};const pe=(yield se.json()).data||[];for(const Je of pe){if(Je.name===r||Je.name===(v==null?void 0:v.name))continue;const Fe=yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(Je.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!Fe.ok)continue;const ft=yield Fe.json();if((((W=ft.data)==null?void 0:W.maintenance_team_members)||[]).some(zt=>zt.team_member===K))return{exists:!0,teamName:((ae=ft.data)==null?void 0:ae.maintenance_team_name)||Je.name}}return{exists:!1}}catch(se){return console.error("Fallback check failed:",se),{exists:!1}}});R.useEffect(()=>{var K;v&&(g({maintenance_team_name:o&&u?`${v.maintenance_team_name} (Copy)`:v.maintenance_team_name||"",maintenance_manager:v.maintenance_manager||"",maintenance_manager_name:v.maintenance_manager_name||"",company:v.company||"",custom_expertise:v.custom_expertise||"",maintenance_team_members:((K=v.maintenance_team_members)==null?void 0:K.map((W,ae)=>Ve(ke({},W),{idx:ae+1,name:o?void 0:W.name})))||[]}),o||B(!1))},[v,o,u]);const je=K=>{const{name:W,value:ae}=K.target;g(se=>Ve(ke({},se),{[W]:ae}))},me=K=>Ne(null,null,function*(){if(g(W=>Ve(ke({},W),{maintenance_manager:K})),K){const W=yield M(K);g(ae=>Ve(ke({},ae),{maintenance_manager_name:W}))}else g(W=>Ve(ke({},W),{maintenance_manager_name:""}))}),Se=(K,W,ae)=>Ne(null,null,function*(){var se;if(W==="team_member"&&ae){if((se=f.maintenance_team_members)==null?void 0:se.some((ot,Lt)=>Lt!==K&&ot.team_member===ae)){ar.error("This member is already added to this team!",{position:"top-right",autoClose:4e3,icon:a.jsx(In,{})});return}J(K),ar.info("Checking member availability...",{position:"top-right",autoClose:2e3,icon:()=>a.jsx("span",{children:"🔍"})});const{exists:pe,teamName:Je}=yield Q(ae);if(J(null),pe){ar.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:Je})]})]}),{position:"top-right",autoClose:5e3,icon:a.jsx(In,{})});return}const Fe=yield M(ae),ft=[...f.maintenance_team_members||[]];ft[K]=Ve(ke({},ft[K]),{team_member:ae,full_name:Fe}),g(ot=>Ve(ke({},ot),{maintenance_team_members:ft})),ar.success("Member added successfully!",{position:"top-right",autoClose:2e3,icon:a.jsx(Ua,{})})}else{const he=[...f.maintenance_team_members||[]];he[K]=Ve(ke({},he[K]),{[W]:ae}),g(pe=>Ve(ke({},pe),{maintenance_team_members:he}))}}),Oe=()=>{var W;const K={team_member:"",full_name:"",maintenance_role:"",idx:(((W=f.maintenance_team_members)==null?void 0:W.length)||0)+1};g(ae=>Ve(ke({},ae),{maintenance_team_members:[...ae.maintenance_team_members||[],K]}))},ue=K=>{var ae;const W=((ae=f.maintenance_team_members)==null?void 0:ae.filter((se,he)=>he!==K))||[];W.forEach((se,he)=>{se.idx=he+1}),g(se=>Ve(ke({},se),{maintenance_team_members:W})),ne(null)},be=()=>Ne(null,null,function*(){var K;if(!f.maintenance_team_name){ar.error("Please enter a team name",{position:"top-right",autoClose:4e3,icon:a.jsx(In,{})});return}try{const W=Ve(ke({},f),{maintenance_team_members:(K=f.maintenance_team_members)==null?void 0:K.map(ae=>({team_member:ae.team_member,full_name:ae.full_name,maintenance_role:ae.maintenance_role})).filter(ae=>ae.team_member)});if(o){const ae=yield C(W);ar.success("Maintenance Team created successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),n(`/maintenance-teams/${ae.name}`)}else yield O(r,W),ar.success("Maintenance Team updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),B(!1),N()}catch(W){const ae=W instanceof Error?W.message:"Unknown error";ar.error(`Failed to save: ${ae}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}}),re=()=>Ne(null,null,function*(){try{yield I(r),ar.success("Maintenance Team deleted successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),n("/maintenance-teams")}catch(K){const W=K instanceof Error?K.message:"Unknown error";ar.error(`Failed to delete: ${W}`,{position:"top-right",autoClose:6e3,icon:a.jsx(In,{})})}}),de=R.useCallback(K=>!z,[z]),Ae=K=>K?new Date(K).toLocaleString():"-";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-indigo-500 mx-auto"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance team..."})]})}):k&&!o?a.jsx("div",{className:"p-4 sm:p-6 bg-gray-50 dark:bg-gray-900 min-h-screen min-w-0 overflow-x-hidden",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:k}),a.jsx("button",{onClick:()=>n("/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-4 sm:p-6 min-w-0 overflow-x-hidden",children:[a.jsx(Bh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:pu}),a.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between lg:items-center flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>n("/maintenance-teams"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:a.jsx(Ki,{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(L0,{className:"text-indigo-500"}),o?"New Maintenance Team":(v==null?void 0:v.maintenance_team_name)||"Maintenance Team"]}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:o?"Create a new maintenance team":v==null?void 0:v.name})]})]}),a.jsxs("div",{className:"flex gap-3",children:[!o&&!z&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>B(!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(rs,{}),e("common.edit")]}),a.jsxs("button",{onClick:()=>H(!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(la,{}),e("common.delete")]})]}),z&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{o?n("/maintenance-teams"):(B(!1),N())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:e("common.cancel")}),a.jsxs("button",{onClick:be,disabled:D,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(Tn,{}),e(D?"common.saving":"common.save")]})]})]})]}),U&&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(en,{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:()=>H(!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:re,disabled:D,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg disabled:opacity-50",children:e(D?"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(L0,{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:f.maintenance_team_name,onChange:je,disabled:de("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(er,{label:e("commonFields.hospital"),doctype:"Company",value:f.company||"",onChange:K=>g(Ve(ke({},f),{company:K})),disabled:de("company"),placeholder:e("maintenance.selectHospital")})}),a.jsx("div",{children:a.jsx(er,{label:e("maintenance.expertise"),doctype:"Issue Type",value:f.custom_expertise||"",onChange:K=>g(Ve(ke({},f),{custom_expertise:K})),disabled:de("custom_expertise"),placeholder:e("maintenance.selectExpertise")})}),a.jsx("div",{children:a.jsx(er,{label:e("maintenance.manager"),doctype:"User",value:f.maintenance_manager||"",onChange:me,disabled:de("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:f.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(c5,{className:"text-green-500"}),"Team Members"]}),z&&a.jsxs("button",{onClick:Oe,disabled:V!==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(Ei,{size:12}),"Add Member"]})]}),f.maintenance_team_members&&f.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:"*"})]}),z&&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:f.maintenance_team_members.map((K,W)=>a.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${V===W?"opacity-70":""}`,children:[a.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400",children:W+1}),a.jsx("td",{className:"px-3 py-2",children:z?a.jsxs("div",{className:"relative",children:[a.jsx(er,{label:"",doctype:"User",value:K.team_member||"",onChange:ae=>Se(W,"team_member",ae),disabled:V!==null,placeholder:e("maintenance.selectUser"),compact:!0}),V===W&&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:K.team_member||"-"})}),a.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-300",children:K.full_name||"-"}),a.jsx("td",{className:"px-3 py-2",children:z?a.jsx(er,{label:"",doctype:"Role",value:K.maintenance_role||"",onChange:ae=>Se(W,"maintenance_role",ae),disabled:V!==null,placeholder:e("maintenance.selectRole"),compact:!0}):a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:K.maintenance_role||"-"})}),z&&a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("button",{onClick:()=>ne(W),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(la,{size:14})})})]},W))})]})}):a.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[a.jsx(L0,{className:"text-4xl mx-auto mb-2 text-gray-300 dark:text-gray-600"}),a.jsx("p",{children:e("maintenance.noTeamMembersYet")}),z&&a.jsxs("button",{onClick:Oe,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(u5,{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:((_e=f.maintenance_team_members)==null?void 0:_e.filter(K=>K.team_member).length)||0})]}),f.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:f.maintenance_manager_name})]}),f.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:f.company})]}),f.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:f.custom_expertise})]})]})]}),!o&&v&&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(Ix,{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:Ae(v.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:Ae(v.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:v.modified_by||"-"})]})]})]})]})]}),q!==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(en,{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:()=>ne(null),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),a.jsx("button",{onClick:()=>ue(q),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg",children:"Remove"})]})]})})]})},jI=()=>Ne(null,null,function*(){var e;try{const n=(yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json()).message;if(!n)throw new Error("No user logged in");const u=yield(yield fetch("/api/method/frappe.client.get",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({doctype:"User",name:n})})).json();if(console.log("frappe.client.get response:",u),console.log("role_profile_name:",(e=u.message)==null?void 0:e.role_profile_name),u.message){const f=u.message;return f.roles||(f.roles=[]),f}throw new Error("Failed to fetch user profile")}catch(r){throw console.error("Error fetching user profile:",r),r}}),OI=(e,r)=>Ne(null,null,function*(){try{const t=yield fetch(`/api/resource/User/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r)}),n=yield t.json();if(!t.ok)throw new Error(n.exc||n.message||"Failed to update profile");return n.data}catch(t){throw console.error("Error updating user profile:",t),t}}),MI=(e,r)=>Ne(null,null,function*(){try{const t=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:r})}),n=yield t.json();if(!t.ok){let o="Failed to change password";if(n.exc){if(n.exc.includes("Incorrect Old Password"))o="Incorrect old password";else if(n.exc.includes("Password cannot be same"))o="New password cannot be the same as old password";else if(n._server_messages)try{const u=JSON.parse(n._server_messages);o=JSON.parse(u[0]).message||o}catch(u){}}throw new Error(o)}return{message:"Password changed successfully"}}catch(t){throw console.error("Error changing password:",t),t}}),RI=()=>{const e=ma(),[r,t]=R.useState(!0),[n,o]=R.useState(!1),[u,f]=R.useState(!1),[g,v]=R.useState(!1),[p,k]=R.useState(null),[N,C]=R.useState(null),[O,I]=R.useState({first_name:"",middle_name:"",last_name:"",role_profile_name:"",custom_user_id:""}),[M,D]=R.useState(!1),[z,B]=R.useState({old_password:"",new_password:"",confirm_password:""}),[U,H]=R.useState(!1),[q,ne]=R.useState(!1),[V,J]=R.useState(!1);R.useEffect(()=>{Ne(null,null,function*(){var Oe;try{t(!0);const re=((Oe=(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:Oe.has_role)||!1;f(re),console.log("Is System Manager:",re);const de=yield jI();console.log("Full profile data:",JSON.stringify(de,null,2)),console.log("role_profile_name:",de.role_profile_name),console.log("All keys:",Object.keys(de)),k(de),I({first_name:de.first_name||"",middle_name:de.middle_name||"",last_name:de.last_name||"",role_profile_name:de.role_profile_name||"",custom_user_id:de.custom_user_id||""}),console.log("FormData role_profile_name:",de.role_profile_name||"")}catch(ue){const be=ue instanceof Error?ue.message:"Failed to load profile";C(be),ar.error(be,{position:"top-right",autoClose:5e3,icon:a.jsx(In,{})})}finally{t(!1)}})},[]);const Q=Se=>{const{name:Oe,value:ue}=Se.target;I(be=>Ve(ke({},be),{[Oe]:ue}))},Te=Se=>{const{name:Oe,value:ue}=Se.target;B(be=>Ve(ke({},be),{[Oe]:ue}))},je=()=>Ne(null,null,function*(){if(p!=null&&p.email)try{o(!0);const Se={first_name:O.first_name,middle_name:O.middle_name,last_name:O.last_name};u&&(Se.role_profile_name=O.role_profile_name);const Oe=yield OI(p.email,Se);k(ue=>ue?ke(ke({},ue),Oe):Oe),ar.success("Profile updated successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})})}catch(Se){const Oe=Se instanceof Error?Se.message:"Failed to update profile";ar.error(Oe,{position:"top-right",autoClose:5e3,icon:a.jsx(In,{})})}finally{o(!1)}}),me=()=>Ne(null,null,function*(){if(!z.old_password){ar.error("Please enter your current password",{position:"top-right",autoClose:3e3,icon:a.jsx(en,{})});return}if(!z.new_password){ar.error("Please enter a new password",{position:"top-right",autoClose:3e3,icon:a.jsx(en,{})});return}if(z.new_password.length<8){ar.error("Password must be at least 8 characters long",{position:"top-right",autoClose:3e3,icon:a.jsx(en,{})});return}if(z.new_password!==z.confirm_password){ar.error("New passwords do not match",{position:"top-right",autoClose:3e3,icon:a.jsx(en,{})});return}try{v(!0),yield MI(z.new_password,z.old_password),ar.success("Password changed successfully!",{position:"top-right",autoClose:3e3,icon:a.jsx(Ua,{})}),B({old_password:"",new_password:"",confirm_password:""}),D(!1)}catch(Se){const Oe=Se instanceof Error?Se.message:"Failed to change password";ar.error(Oe,{position:"top-right",autoClose:5e3,icon:a.jsx(In,{})})}finally{v(!1)}});return r?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(fs,{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..."})]})}):N&&!p?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(In,{className:"inline mr-2"}),"Error Loading Profile"]}),a.jsx("p",{className:"text-red-700 dark:text-red-400",children:N}),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(Bh,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:pu}),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(Ki,{}),a.jsx("span",{className:"text-gray-900 dark:text-white text-xl font-semibold",children:"User Profile"})]})}),a.jsx("button",{onClick:je,disabled:n,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:n?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Tn,{}),"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:p!=null&&p.user_image?a.jsx("img",{src:p.user_image,alt:"Profile",className:"w-20 h-20 rounded-full object-cover"}):a.jsx(Gf,{className:"text-white text-4xl"})}),a.jsx("h2",{className:"text-xl font-bold text-white",children:(p==null?void 0:p.full_name)||"User"}),a.jsx("p",{className:"text-white/80 text-sm mt-1",children:p==null?void 0:p.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(r5,{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:(p==null?void 0:p.username)||"-"})]})]}),a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx(d5,{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:(p==null?void 0:p.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(s5,{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 ${p!=null&&p.enabled?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:p!=null&&p.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(Gf,{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(c_,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:14}),a.jsx("input",{type:"email",value:(p==null?void 0:p.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:(p==null?void 0:p.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:O.first_name,onChange:Q,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:O.middle_name,onChange:Q,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:O.last_name,onChange:Q,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:O.custom_user_id,onChange:Q,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:u?a.jsx(er,{label:"Role Profile",doctype:"Role Profile",value:O.role_profile_name,onChange:Se=>I(Oe=>Ve(ke({},Oe),{role_profile_name:Se})),placeholder:"Select Role Profile"}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Role Profile",a.jsx("span",{className:"ml-1 text-gray-400",children:"(Read-only)"})]}),a.jsx("input",{type:"text",value:O.role_profile_name||"-",readOnly:!0,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",{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(Lg,{className:"text-orange-500"}),"Change Password"]}),a.jsx("button",{onClick:()=>D(!M),className:"text-sm text-blue-600 dark:text-blue-400 hover:underline",children:M?"Cancel":"Change Password"})]}),M?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:U?"text":"password",name:"old_password",value:z.old_password,onChange:Te,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:()=>H(!U),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:U?a.jsx(Ig,{size:14}):a.jsx(Yi,{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:q?"text":"password",name:"new_password",value:z.new_password,onChange:Te,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:()=>ne(!q),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:q?a.jsx(Ig,{size:14}):a.jsx(Yi,{size:14})})]}),z.new_password&&z.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:V?"text":"password",name:"confirm_password",value:z.confirm_password,onChange:Te,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:()=>J(!V),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:V?a.jsx(Ig,{size:14}):a.jsx(Yi,{size:14})})]}),z.confirm_password&&z.new_password!==z.confirm_password&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:"Passwords do not match"}),z.confirm_password&&z.new_password===z.confirm_password&&z.new_password.length>=8&&a.jsxs("p",{className:"mt-1 text-xs text-green-500 flex items-center gap-1",children:[a.jsx(Ua,{size:10})," Passwords match"]})]}),a.jsx("div",{className:"pt-2",children:a.jsx("button",{onClick:me,disabled:g,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:g?a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"animate-spin"}),"Changing Password..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Lg,{}),"Change Password"]})})})]}):a.jsxs("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:[a.jsx(Lg,{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'})]})]})]})]})]})},Ca=({children:e})=>{const r=localStorage.getItem("user"),t=r?JSON.parse(r).email:"";return a.jsxs("div",{className:"flex h-screen overflow-hidden bg-gray-50 dark:bg-gray-900",children:[a.jsx(nI,{userEmail:t}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx(dI,{userEmail:t}),a.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:e})]})]})},Ta=({children:e})=>localStorage.getItem("user")?a.jsx(a.Fragment,{children:e}):a.jsx(nx,{to:"/login",replace:!0}),DI=()=>a.jsx(pS,{basename:"/asm_app",children:a.jsxs(Y6,{children:[a.jsx(ia,{path:"/login",element:a.jsx(CS,{})}),a.jsx(ia,{path:"/dashboard",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(x5,{})})})}),a.jsx(ia,{path:"/assets",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(SM,{})})})}),a.jsx(ia,{path:"/assets/:assetName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(TM,{})})})}),a.jsx(ia,{path:"/work-orders",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(jM,{})})})}),a.jsx(ia,{path:"/work-orders/:workOrderName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(bR,{})})})}),a.jsx(ia,{path:"/maintenance",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(vR,{})})})}),a.jsx(ia,{path:"/maintenance/:logName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(kR,{})})})}),a.jsx(ia,{path:"/ppm",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(CR,{})})})}),a.jsx(ia,{path:"/ppm/:ppmName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(TR,{})})})}),a.jsx(ia,{path:"/ppm-planner",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(DR,{})})})}),a.jsx(ia,{path:"/ppm-planner/new",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(jR,{})})})}),a.jsx(ia,{path:"/ppm-planner/:scheduleName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(IR,{})})})}),a.jsx(ia,{path:"/maintenance-calendar",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(Sv,{})})})}),a.jsx(ia,{path:"/maintenance-calendar/month-view",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(PR,{})})})}),a.jsx(ia,{path:"/yearly-ppm-planner",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(Sv,{})})})}),a.jsx(ia,{path:"/active-map",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(lD,{})})})}),a.jsx(ia,{path:"/inventory",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(hD,{})})})}),a.jsx(ia,{path:"/inventory/:itemName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(mD,{})})})}),a.jsx(ia,{path:"/users",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(Q8,{})})})}),a.jsx(ia,{path:"/events",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(eE,{})})})}),a.jsx(ia,{path:"/old-dashboard",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(IS,{})})})}),a.jsx(ia,{path:"/maintenance-teams",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(TI,{})})})}),a.jsx(ia,{path:"/maintenance-teams/:teamName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(AI,{})})})}),a.jsx(ia,{path:"/procurement",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(Av,{title:"Procurement"})})})}),a.jsx(ia,{path:"/sla",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(Av,{title:"Service Level Agreement (SLA)"})})})}),a.jsx(ia,{path:"/support",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(yI,{})})})}),a.jsx(ia,{path:"/support/:issueName",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(wI,{})})})}),a.jsx(ia,{path:"/user-profile",element:a.jsx(Ta,{children:a.jsx(Ca,{children:a.jsx(RI,{})})})}),a.jsx(ia,{path:"/",element:a.jsx(nx,{to:"/login",replace:!0})}),a.jsx(ia,{path:"*",element:a.jsx(nx,{to:"/login",replace:!0})})]})});kk.createRoot(document.getElementById("root")).render(a.jsx(R.StrictMode,{children:a.jsx(aI,{children:a.jsx(sI,{children:a.jsx(DI,{})})})}))});export default II();