@ambuj.bhaskar/react-component-library 0.24.10-alpha → 0.24.12-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.js +32 -21
- package/dist/index.umd.js +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require('./assets/index.css');var Lj=Object.defineProperty;var Bj=(e,t,n)=>t in e?Lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xn=(e,t,n)=>Bj(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),A2=require("react-dom");function iS(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=iS(R),aS=iS(A2),sS={common:{primary:"#292929",secondary:"#767676",highlight:"#FFCC00",success:"#5DB772",warning:"#FFCC00",error:"#FF2540",info:"#0076B2",disabled:"#DEDEDE",themeColor:"#6F29A9",themeRed:"#ff0000",themeReject:"#ff0000",themeSecondaryButtonColor:"#FF2540",themeSystemAcceptColor:"rgb(93, 183, 114)"},text:{primary:"#292929",secondary:"#767676",tertiary:"#FFFFFF",disabled:"#767676"},background:{primary:"#F3F5F7"},surface:{fill:{primary:"#FFFFFF",secondary:"#F3F5F7",tertiary:"#EAEAEA"},border:{primary:"#EAEBEE",secondary:"#BCBDBF",tertiary:"#909090"}},button:{border:"#ffcc00",background:"#ffcc00",text:"#292929"},badge:{background:"#ff2540",text:"#fff"},input:{border:"#292929",background:"#2929291a",text:"#292929"},multiselect:{icon:"#292929",trigger:{border:"#29292955",background:"#29292929",highlight:"#29292955"},menu:{border:"#29292955",background:{default:"#FFFFFF",hover:"rgba(255, 204, 0, 0.1)",active:"rgba(255, 204, 0, 0.2)"}}},select:{trigger:{border:"#29292955",background:"#29292929"},menu:{border:"#29292955",background:{default:"#FFFFFF",hover:"rgba(255, 204, 0, 0.1)",active:"rgba(255, 204, 0, 0.2)"}}},sidebar:{background:"#292929",text:"#FFFFFF",border:"#292929",button:{background:"#FFCC00",text:"#292929",border:"#FFCC00"},footer:{background:"#FFCC00"}},topbar:{background:"#FFFFFF",text:"#292929",border:"#EAEBEE"},daterangepicker:{trigger:{background:"#29292929",border:"#29292955"},picker:{highlight:"#fc0",range:"#ffcc00bb",background:"#fff",border:"rgb(234, 235, 238)"}},table:{header:{background:"#fff"},body:{background:"#fff",checkbox:"#ffcc00",hover:"#2929291a",selected:"#ffcc001a",selectedhover:"#ffcc002b"},title:{background:"#fff"},footer:{background:"#fff"}},heatmap:{background:"#fff",cell:{border:"#EAEBEE"}},popover:{background:"#fff",border:"#EAEBEE"},refresh:{background:"#29292929",border:"#29292955"},toast:{border:{success:"#5DB772",warning:"#FFCC00",error:"#FF2540",info:"#0076B2"},background:{success:"#5DB77215",warning:"#FFCC0015",error:"#FF254015",info:"#0076B215"}}},Oj={text:{xs:"12px",s:"14px",m:"16px",l:"20px",xl:"22px"}},Rj={text:{s:"400",m:"500",l:"700"}},lS={name:"default",colors:sS,sizes:Oj,weights:Rj},Ij=(e,t)=>{if(typeof e=="object"&&t in e){const n=e[t];return typeof n=="string"?n:void 0}},kj=5,Dj=4,Pj="owl-V2",Nj=.3,Tj=10,Fj=1,Vj=1e3,jj=[{awi_id:"Yolo-World",awi_label:"Yolo-World",value:"Yolo-World"},{awi_id:"owl-V2",awi_label:"owl-V2",value:"owl-V2"}],zj={scale:1,x:0,y:0},Zj=.2,Uj=!1,$j={w:16,h:9},Kj=60,Wj=2*Math.PI,Qj=!1,Gj=30,Yj={approved:"rgba(66, 179, 97,0.60)",rejected:"rgba(184, 33, 44,0.60)",corrected:"rgba(175, 219, 245,0.60)"},I1={MAX_TOASTS_COUNT:kj,DISPLAY_SEARCH_MINIMUM_RECORDS:Dj,SAM_MODEL_NAME:Pj,SAM_MODEL_CONFIDENCE:Nj,SAM_MODEL_MAX_RESULTS:Tj,SAM_MODEL_MAX_RESULTS_MIN:Fj,SAM_MODEL_MAX_RESULTS_MAX:Vj,SAM_MODEL_DATA:jj,INITIAL_ZOOM_PROPERTIES:zj,INITIAL_ZOOM_LEVEL:Zj,HOVER_TO_SELECT_ON_ALREADY_SELECTED:Uj,DEFAULT_CANVAS_RATION:$j,MAX_ANNOTATIONS_TO_HOVER:Kj,TWO_PIE:Wj,POLYGON_POINT_REMOVE_CONFIRM_PROMPT:Qj,MAX_ANNOTATIONS_TO_RUN_FAST:Gj,STATUS_COLOR_MAP:Yj};var Z9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var J6={exports:{}};function qj(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ec={exports:{}};const Xj={},Jj=Object.freeze(Object.defineProperty({__proto__:null,default:Xj},Symbol.toStringTag,{value:"Module"})),ez=cS(Jj);var tz=ec.exports,iv;function E1(){return iv||(iv=1,function(e,t){(function(n,r){e.exports=r()})(tz,function(){var n=n||function(r,o){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Z9<"u"&&Z9.crypto&&(i=Z9.crypto),!i&&typeof qj=="function")try{i=ez}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function w(){}return function(x){var E;return w.prototype=x,E=new w,w.prototype=null,E}}(),c={},u=c.lib={},d=u.Base=function(){return{extend:function(w){var x=s(this);return w&&x.mixIn(w),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var x in w)w.hasOwnProperty(x)&&(this[x]=w[x]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=u.WordArray=d.extend({init:function(w,x){w=this.words=w||[],x!=o?this.sigBytes=x:this.sigBytes=w.length*4},toString:function(w){return(w||m).stringify(this)},concat:function(w){var x=this.words,E=w.words,S=this.sigBytes,M=w.sigBytes;if(this.clamp(),S%4)for(var H=0;H<M;H++){var O=E[H>>>2]>>>24-H%4*8&255;x[S+H>>>2]|=O<<24-(S+H)%4*8}else for(var k=0;k<M;k+=4)x[S+k>>>2]=E[k>>>2];return this.sigBytes+=M,this},clamp:function(){var w=this.words,x=this.sigBytes;w[x>>>2]&=4294967295<<32-x%4*8,w.length=r.ceil(x/4)},clone:function(){var w=d.clone.call(this);return w.words=this.words.slice(0),w},random:function(w){for(var x=[],E=0;E<w;E+=4)x.push(a());return new h.init(x,w)}}),C=c.enc={},m=C.Hex={stringify:function(w){for(var x=w.words,E=w.sigBytes,S=[],M=0;M<E;M++){var H=x[M>>>2]>>>24-M%4*8&255;S.push((H>>>4).toString(16)),S.push((H&15).toString(16))}return S.join("")},parse:function(w){for(var x=w.length,E=[],S=0;S<x;S+=2)E[S>>>3]|=parseInt(w.substr(S,2),16)<<24-S%8*4;return new h.init(E,x/2)}},A=C.Latin1={stringify:function(w){for(var x=w.words,E=w.sigBytes,S=[],M=0;M<E;M++){var H=x[M>>>2]>>>24-M%4*8&255;S.push(String.fromCharCode(H))}return S.join("")},parse:function(w){for(var x=w.length,E=[],S=0;S<x;S++)E[S>>>2]|=(w.charCodeAt(S)&255)<<24-S%4*8;return new h.init(E,x)}},v=C.Utf8={stringify:function(w){try{return decodeURIComponent(escape(A.stringify(w)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(w){return A.parse(unescape(encodeURIComponent(w)))}},p=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(w){typeof w=="string"&&(w=v.parse(w)),this._data.concat(w),this._nDataBytes+=w.sigBytes},_process:function(w){var x,E=this._data,S=E.words,M=E.sigBytes,H=this.blockSize,O=H*4,k=M/O;w?k=r.ceil(k):k=r.max((k|0)-this._minBufferSize,0);var D=k*H,N=r.min(D*4,M);if(D){for(var P=0;P<D;P+=H)this._doProcessBlock(S,P);x=S.splice(0,D),E.sigBytes-=N}return new h.init(x,N)},clone:function(){var w=d.clone.call(this);return w._data=this._data.clone(),w},_minBufferSize:0});u.Hasher=p.extend({cfg:d.extend(),init:function(w){this.cfg=this.cfg.extend(w),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(w){return this._append(w),this._process(),this},finalize:function(w){w&&this._append(w);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(w){return function(x,E){return new w.init(E).finalize(x)}},_createHmacHelper:function(w){return function(x,E){return new _.HMAC.init(w,E).finalize(x)}}});var _=c.algo={};return c}(Math);return n})}(ec)),ec.exports}var tc={exports:{}},nz=tc.exports,av;function C7(){return av||(av=1,function(e,t){(function(n,r){e.exports=r(E1())})(nz,function(n){return function(r){var o=n,i=o.lib,a=i.Base,s=i.WordArray,c=o.x64={};c.Word=a.extend({init:function(u,d){this.high=u,this.low=d}}),c.WordArray=a.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,h=[],C=0;C<d;C++){var m=u[C];h.push(m.high),h.push(m.low)}return s.create(h,this.sigBytes)},clone:function(){for(var u=a.clone.call(this),d=u.words=this.words.slice(0),h=d.length,C=0;C<h;C++)d[C]=d[C].clone();return u}})}(),n})}(tc)),tc.exports}var nc={exports:{}},rz=nc.exports,sv;function oz(){return sv||(sv=1,function(e,t){(function(n,r){e.exports=r(E1())})(rz,function(n){return function(){if(typeof ArrayBuffer=="function"){var r=n,o=r.lib,i=o.WordArray,a=i.init,s=i.init=function(c){if(c instanceof ArrayBuffer&&(c=new Uint8Array(c)),(c instanceof Int8Array||typeof Uint8ClampedArray<"u"&&c instanceof Uint8ClampedArray||c instanceof Int16Array||c instanceof Uint16Array||c instanceof Int32Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array)&&(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),c instanceof Uint8Array){for(var u=c.byteLength,d=[],h=0;h<u;h++)d[h>>>2]|=c[h]<<24-h%4*8;a.call(this,d,u)}else a.apply(this,arguments)};s.prototype=i}}(),n.lib.WordArray})}(nc)),nc.exports}var rc={exports:{}},iz=rc.exports,lv;function az(){return lv||(lv=1,function(e,t){(function(n,r){e.exports=r(E1())})(iz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(c){for(var u=c.words,d=c.sigBytes,h=[],C=0;C<d;C+=2){var m=u[C>>>2]>>>16-C%4*8&65535;h.push(String.fromCharCode(m))}return h.join("")},parse:function(c){for(var u=c.length,d=[],h=0;h<u;h++)d[h>>>1]|=c.charCodeAt(h)<<16-h%2*16;return i.create(d,u*2)}},a.Utf16LE={stringify:function(c){for(var u=c.words,d=c.sigBytes,h=[],C=0;C<d;C+=2){var m=s(u[C>>>2]>>>16-C%4*8&65535);h.push(String.fromCharCode(m))}return h.join("")},parse:function(c){for(var u=c.length,d=[],h=0;h<u;h++)d[h>>>1]|=s(c.charCodeAt(h)<<16-h%2*16);return i.create(d,u*2)}};function s(c){return c<<8&4278255360|c>>>8&16711935}}(),n.enc.Utf16})}(rc)),rc.exports}var oc={exports:{}},sz=oc.exports,cv;function u3(){return cv||(cv=1,function(e,t){(function(n,r){e.exports=r(E1())})(sz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64={stringify:function(c){var u=c.words,d=c.sigBytes,h=this._map;c.clamp();for(var C=[],m=0;m<d;m+=3)for(var A=u[m>>>2]>>>24-m%4*8&255,v=u[m+1>>>2]>>>24-(m+1)%4*8&255,p=u[m+2>>>2]>>>24-(m+2)%4*8&255,_=A<<16|v<<8|p,w=0;w<4&&m+w*.75<d;w++)C.push(h.charAt(_>>>6*(3-w)&63));var x=h.charAt(64);if(x)for(;C.length%4;)C.push(x);return C.join("")},parse:function(c){var u=c.length,d=this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var C=0;C<d.length;C++)h[d.charCodeAt(C)]=C}var m=d.charAt(64);if(m){var A=c.indexOf(m);A!==-1&&(u=A)}return s(c,u,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function s(c,u,d){for(var h=[],C=0,m=0;m<u;m++)if(m%4){var A=d[c.charCodeAt(m-1)]<<m%4*2,v=d[c.charCodeAt(m)]>>>6-m%4*2,p=A|v;h[C>>>2]|=p<<24-C%4*8,C++}return i.create(h,C)}}(),n.enc.Base64})}(oc)),oc.exports}var ic={exports:{}},lz=ic.exports,uv;function cz(){return uv||(uv=1,function(e,t){(function(n,r){e.exports=r(E1())})(lz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64url={stringify:function(c,u){u===void 0&&(u=!0);var d=c.words,h=c.sigBytes,C=u?this._safe_map:this._map;c.clamp();for(var m=[],A=0;A<h;A+=3)for(var v=d[A>>>2]>>>24-A%4*8&255,p=d[A+1>>>2]>>>24-(A+1)%4*8&255,_=d[A+2>>>2]>>>24-(A+2)%4*8&255,w=v<<16|p<<8|_,x=0;x<4&&A+x*.75<h;x++)m.push(C.charAt(w>>>6*(3-x)&63));var E=C.charAt(64);if(E)for(;m.length%4;)m.push(E);return m.join("")},parse:function(c,u){u===void 0&&(u=!0);var d=c.length,h=u?this._safe_map:this._map,C=this._reverseMap;if(!C){C=this._reverseMap=[];for(var m=0;m<h.length;m++)C[h.charCodeAt(m)]=m}var A=h.charAt(64);if(A){var v=c.indexOf(A);v!==-1&&(d=v)}return s(c,d,C)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function s(c,u,d){for(var h=[],C=0,m=0;m<u;m++)if(m%4){var A=d[c.charCodeAt(m-1)]<<m%4*2,v=d[c.charCodeAt(m)]>>>6-m%4*2,p=A|v;h[C>>>2]|=p<<24-C%4*8,C++}return i.create(h,C)}}(),n.enc.Base64url})}(ic)),ic.exports}var ac={exports:{}},uz=ac.exports,dv;function d3(){return dv||(dv=1,function(e,t){(function(n,r){e.exports=r(E1())})(uz,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.algo,u=[];(function(){for(var v=0;v<64;v++)u[v]=r.abs(r.sin(v+1))*4294967296|0})();var d=c.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,p){for(var _=0;_<16;_++){var w=p+_,x=v[w];v[w]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var E=this._hash.words,S=v[p+0],M=v[p+1],H=v[p+2],O=v[p+3],k=v[p+4],D=v[p+5],N=v[p+6],P=v[p+7],F=v[p+8],j=v[p+9],V=v[p+10],T=v[p+11],$=v[p+12],K=v[p+13],q=v[p+14],W=v[p+15],U=E[0],G=E[1],J=E[2],Y=E[3];U=h(U,G,J,Y,S,7,u[0]),Y=h(Y,U,G,J,M,12,u[1]),J=h(J,Y,U,G,H,17,u[2]),G=h(G,J,Y,U,O,22,u[3]),U=h(U,G,J,Y,k,7,u[4]),Y=h(Y,U,G,J,D,12,u[5]),J=h(J,Y,U,G,N,17,u[6]),G=h(G,J,Y,U,P,22,u[7]),U=h(U,G,J,Y,F,7,u[8]),Y=h(Y,U,G,J,j,12,u[9]),J=h(J,Y,U,G,V,17,u[10]),G=h(G,J,Y,U,T,22,u[11]),U=h(U,G,J,Y,$,7,u[12]),Y=h(Y,U,G,J,K,12,u[13]),J=h(J,Y,U,G,q,17,u[14]),G=h(G,J,Y,U,W,22,u[15]),U=C(U,G,J,Y,M,5,u[16]),Y=C(Y,U,G,J,N,9,u[17]),J=C(J,Y,U,G,T,14,u[18]),G=C(G,J,Y,U,S,20,u[19]),U=C(U,G,J,Y,D,5,u[20]),Y=C(Y,U,G,J,V,9,u[21]),J=C(J,Y,U,G,W,14,u[22]),G=C(G,J,Y,U,k,20,u[23]),U=C(U,G,J,Y,j,5,u[24]),Y=C(Y,U,G,J,q,9,u[25]),J=C(J,Y,U,G,O,14,u[26]),G=C(G,J,Y,U,F,20,u[27]),U=C(U,G,J,Y,K,5,u[28]),Y=C(Y,U,G,J,H,9,u[29]),J=C(J,Y,U,G,P,14,u[30]),G=C(G,J,Y,U,$,20,u[31]),U=m(U,G,J,Y,D,4,u[32]),Y=m(Y,U,G,J,F,11,u[33]),J=m(J,Y,U,G,T,16,u[34]),G=m(G,J,Y,U,q,23,u[35]),U=m(U,G,J,Y,M,4,u[36]),Y=m(Y,U,G,J,k,11,u[37]),J=m(J,Y,U,G,P,16,u[38]),G=m(G,J,Y,U,V,23,u[39]),U=m(U,G,J,Y,K,4,u[40]),Y=m(Y,U,G,J,S,11,u[41]),J=m(J,Y,U,G,O,16,u[42]),G=m(G,J,Y,U,N,23,u[43]),U=m(U,G,J,Y,j,4,u[44]),Y=m(Y,U,G,J,$,11,u[45]),J=m(J,Y,U,G,W,16,u[46]),G=m(G,J,Y,U,H,23,u[47]),U=A(U,G,J,Y,S,6,u[48]),Y=A(Y,U,G,J,P,10,u[49]),J=A(J,Y,U,G,q,15,u[50]),G=A(G,J,Y,U,D,21,u[51]),U=A(U,G,J,Y,$,6,u[52]),Y=A(Y,U,G,J,O,10,u[53]),J=A(J,Y,U,G,V,15,u[54]),G=A(G,J,Y,U,M,21,u[55]),U=A(U,G,J,Y,F,6,u[56]),Y=A(Y,U,G,J,W,10,u[57]),J=A(J,Y,U,G,N,15,u[58]),G=A(G,J,Y,U,K,21,u[59]),U=A(U,G,J,Y,k,6,u[60]),Y=A(Y,U,G,J,T,10,u[61]),J=A(J,Y,U,G,H,15,u[62]),G=A(G,J,Y,U,j,21,u[63]),E[0]=E[0]+U|0,E[1]=E[1]+G|0,E[2]=E[2]+J|0,E[3]=E[3]+Y|0},_doFinalize:function(){var v=this._data,p=v.words,_=this._nDataBytes*8,w=v.sigBytes*8;p[w>>>5]|=128<<24-w%32;var x=r.floor(_/4294967296),E=_;p[(w+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,p[(w+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,v.sigBytes=(p.length+1)*4,this._process();for(var S=this._hash,M=S.words,H=0;H<4;H++){var O=M[H];M[H]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}return S},clone:function(){var v=s.clone.call(this);return v._hash=this._hash.clone(),v}});function h(v,p,_,w,x,E,S){var M=v+(p&_|~p&w)+x+S;return(M<<E|M>>>32-E)+p}function C(v,p,_,w,x,E,S){var M=v+(p&w|_&~w)+x+S;return(M<<E|M>>>32-E)+p}function m(v,p,_,w,x,E,S){var M=v+(p^_^w)+x+S;return(M<<E|M>>>32-E)+p}function A(v,p,_,w,x,E,S){var M=v+(_^(p|~w))+x+S;return(M<<E|M>>>32-E)+p}o.MD5=s._createHelper(d),o.HmacMD5=s._createHmacHelper(d)}(Math),n.MD5})}(ac)),ac.exports}var sc={exports:{}},dz=sc.exports,fv;function uS(){return fv||(fv=1,function(e,t){(function(n,r){e.exports=r(E1())})(dz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=o.Hasher,s=r.algo,c=[],u=s.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,h){for(var C=this._hash.words,m=C[0],A=C[1],v=C[2],p=C[3],_=C[4],w=0;w<80;w++){if(w<16)c[w]=d[h+w]|0;else{var x=c[w-3]^c[w-8]^c[w-14]^c[w-16];c[w]=x<<1|x>>>31}var E=(m<<5|m>>>27)+_+c[w];w<20?E+=(A&v|~A&p)+1518500249:w<40?E+=(A^v^p)+1859775393:w<60?E+=(A&v|A&p|v&p)-1894007588:E+=(A^v^p)-899497514,_=p,p=v,v=A<<30|A>>>2,A=m,m=E}C[0]=C[0]+m|0,C[1]=C[1]+A|0,C[2]=C[2]+v|0,C[3]=C[3]+p|0,C[4]=C[4]+_|0},_doFinalize:function(){var d=this._data,h=d.words,C=this._nDataBytes*8,m=d.sigBytes*8;return h[m>>>5]|=128<<24-m%32,h[(m+64>>>9<<4)+14]=Math.floor(C/4294967296),h[(m+64>>>9<<4)+15]=C,d.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA1=a._createHelper(u),r.HmacSHA1=a._createHmacHelper(u)}(),n.SHA1})}(sc)),sc.exports}var lc={exports:{}},fz=lc.exports,hv;function ag(){return hv||(hv=1,function(e,t){(function(n,r){e.exports=r(E1())})(fz,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.algo,u=[],d=[];(function(){function m(_){for(var w=r.sqrt(_),x=2;x<=w;x++)if(!(_%x))return!1;return!0}function A(_){return(_-(_|0))*4294967296|0}for(var v=2,p=0;p<64;)m(v)&&(p<8&&(u[p]=A(r.pow(v,1/2))),d[p]=A(r.pow(v,1/3)),p++),v++})();var h=[],C=c.SHA256=s.extend({_doReset:function(){this._hash=new a.init(u.slice(0))},_doProcessBlock:function(m,A){for(var v=this._hash.words,p=v[0],_=v[1],w=v[2],x=v[3],E=v[4],S=v[5],M=v[6],H=v[7],O=0;O<64;O++){if(O<16)h[O]=m[A+O]|0;else{var k=h[O-15],D=(k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3,N=h[O-2],P=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;h[O]=D+h[O-7]+P+h[O-16]}var F=E&S^~E&M,j=p&_^p&w^_&w,V=(p<<30|p>>>2)^(p<<19|p>>>13)^(p<<10|p>>>22),T=(E<<26|E>>>6)^(E<<21|E>>>11)^(E<<7|E>>>25),$=H+T+F+d[O]+h[O],K=V+j;H=M,M=S,S=E,E=x+$|0,x=w,w=_,_=p,p=$+K|0}v[0]=v[0]+p|0,v[1]=v[1]+_|0,v[2]=v[2]+w|0,v[3]=v[3]+x|0,v[4]=v[4]+E|0,v[5]=v[5]+S|0,v[6]=v[6]+M|0,v[7]=v[7]+H|0},_doFinalize:function(){var m=this._data,A=m.words,v=this._nDataBytes*8,p=m.sigBytes*8;return A[p>>>5]|=128<<24-p%32,A[(p+64>>>9<<4)+14]=r.floor(v/4294967296),A[(p+64>>>9<<4)+15]=v,m.sigBytes=A.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});o.SHA256=s._createHelper(C),o.HmacSHA256=s._createHmacHelper(C)}(Math),n.SHA256})}(lc)),lc.exports}var cc={exports:{}},hz=cc.exports,Cv;function Cz(){return Cv||(Cv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),ag())})(hz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.algo,s=a.SHA256,c=a.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=s._doFinalize.call(this);return u.sigBytes-=4,u}});r.SHA224=s._createHelper(c),r.HmacSHA224=s._createHmacHelper(c)}(),n.SHA224})}(cc)),cc.exports}var uc={exports:{}},gz=uc.exports,gv;function dS(){return gv||(gv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7())})(gz,function(n){return function(){var r=n,o=r.lib,i=o.Hasher,a=r.x64,s=a.Word,c=a.WordArray,u=r.algo;function d(){return s.create.apply(s,arguments)}var h=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],C=[];(function(){for(var A=0;A<80;A++)C[A]=d()})();var m=u.SHA512=i.extend({_doReset:function(){this._hash=new c.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(A,v){for(var p=this._hash.words,_=p[0],w=p[1],x=p[2],E=p[3],S=p[4],M=p[5],H=p[6],O=p[7],k=_.high,D=_.low,N=w.high,P=w.low,F=x.high,j=x.low,V=E.high,T=E.low,$=S.high,K=S.low,q=M.high,W=M.low,U=H.high,G=H.low,J=O.high,Y=O.low,ee=k,re=D,ue=N,se=P,_e=F,xe=j,Ae=V,he=T,le=$,ae=K,ye=q,Re=W,Ie=U,Ce=G,et=J,fe=Y,ne=0;ne<80;ne++){var pe,Ee,Le=C[ne];if(ne<16)Ee=Le.high=A[v+ne*2]|0,pe=Le.low=A[v+ne*2+1]|0;else{var Be=C[ne-15],je=Be.high,We=Be.low,lt=(je>>>1|We<<31)^(je>>>8|We<<24)^je>>>7,tt=(We>>>1|je<<31)^(We>>>8|je<<24)^(We>>>7|je<<25),Qe=C[ne-2],Fe=Qe.high,ot=Qe.low,Ue=(Fe>>>19|ot<<13)^(Fe<<3|ot>>>29)^Fe>>>6,Ve=(ot>>>19|Fe<<13)^(ot<<3|Fe>>>29)^(ot>>>6|Fe<<26),Ge=C[ne-7],dt=Ge.high,qe=Ge.low,ft=C[ne-16],Pt=ft.high,Wt=ft.low;pe=tt+qe,Ee=lt+dt+(pe>>>0<tt>>>0?1:0),pe=pe+Ve,Ee=Ee+Ue+(pe>>>0<Ve>>>0?1:0),pe=pe+Wt,Ee=Ee+Pt+(pe>>>0<Wt>>>0?1:0),Le.high=Ee,Le.low=pe}var an=le&ye^~le&Ie,Dn=ae&Re^~ae&Ce,Gt=ee&ue^ee&_e^ue&_e,An=re&se^re&xe^se&xe,bn=(ee>>>28|re<<4)^(ee<<30|re>>>2)^(ee<<25|re>>>7),Qt=(re>>>28|ee<<4)^(re<<30|ee>>>2)^(re<<25|ee>>>7),Ot=(le>>>14|ae<<18)^(le>>>18|ae<<14)^(le<<23|ae>>>9),Ht=(ae>>>14|le<<18)^(ae>>>18|le<<14)^(ae<<23|le>>>9),_t=h[ne],Zt=_t.high,Cn=_t.low,mt=fe+Ht,pt=et+Ot+(mt>>>0<fe>>>0?1:0),mt=mt+Dn,pt=pt+an+(mt>>>0<Dn>>>0?1:0),mt=mt+Cn,pt=pt+Zt+(mt>>>0<Cn>>>0?1:0),mt=mt+pe,pt=pt+Ee+(mt>>>0<pe>>>0?1:0),Lt=Qt+An,Xe=bn+Gt+(Lt>>>0<Qt>>>0?1:0);et=Ie,fe=Ce,Ie=ye,Ce=Re,ye=le,Re=ae,ae=he+mt|0,le=Ae+pt+(ae>>>0<he>>>0?1:0)|0,Ae=_e,he=xe,_e=ue,xe=se,ue=ee,se=re,re=mt+Lt|0,ee=pt+Xe+(re>>>0<mt>>>0?1:0)|0}D=_.low=D+re,_.high=k+ee+(D>>>0<re>>>0?1:0),P=w.low=P+se,w.high=N+ue+(P>>>0<se>>>0?1:0),j=x.low=j+xe,x.high=F+_e+(j>>>0<xe>>>0?1:0),T=E.low=T+he,E.high=V+Ae+(T>>>0<he>>>0?1:0),K=S.low=K+ae,S.high=$+le+(K>>>0<ae>>>0?1:0),W=M.low=W+Re,M.high=q+ye+(W>>>0<Re>>>0?1:0),G=H.low=G+Ce,H.high=U+Ie+(G>>>0<Ce>>>0?1:0),Y=O.low=Y+fe,O.high=J+et+(Y>>>0<fe>>>0?1:0)},_doFinalize:function(){var A=this._data,v=A.words,p=this._nDataBytes*8,_=A.sigBytes*8;v[_>>>5]|=128<<24-_%32,v[(_+128>>>10<<5)+30]=Math.floor(p/4294967296),v[(_+128>>>10<<5)+31]=p,A.sigBytes=v.length*4,this._process();var w=this._hash.toX32();return w},clone:function(){var A=i.clone.call(this);return A._hash=this._hash.clone(),A},blockSize:1024/32});r.SHA512=i._createHelper(m),r.HmacSHA512=i._createHmacHelper(m)}(),n.SHA512})}(uc)),uc.exports}var dc={exports:{}},mz=dc.exports,mv;function pz(){return mv||(mv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7(),dS())})(mz,function(n){return function(){var r=n,o=r.x64,i=o.Word,a=o.WordArray,s=r.algo,c=s.SHA512,u=s.SHA384=c.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var d=c._doFinalize.call(this);return d.sigBytes-=16,d}});r.SHA384=c._createHelper(u),r.HmacSHA384=c._createHmacHelper(u)}(),n.SHA384})}(dc)),dc.exports}var fc={exports:{}},Az=fc.exports,pv;function vz(){return pv||(pv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7())})(Az,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.x64,u=c.Word,d=o.algo,h=[],C=[],m=[];(function(){for(var p=1,_=0,w=0;w<24;w++){h[p+5*_]=(w+1)*(w+2)/2%64;var x=_%5,E=(2*p+3*_)%5;p=x,_=E}for(var p=0;p<5;p++)for(var _=0;_<5;_++)C[p+5*_]=_+(2*p+3*_)%5*5;for(var S=1,M=0;M<24;M++){for(var H=0,O=0,k=0;k<7;k++){if(S&1){var D=(1<<k)-1;D<32?O^=1<<D:H^=1<<D-32}S&128?S=S<<1^113:S<<=1}m[M]=u.create(H,O)}})();var A=[];(function(){for(var p=0;p<25;p++)A[p]=u.create()})();var v=d.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var p=this._state=[],_=0;_<25;_++)p[_]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(p,_){for(var w=this._state,x=this.blockSize/2,E=0;E<x;E++){var S=p[_+2*E],M=p[_+2*E+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360;var H=w[E];H.high^=M,H.low^=S}for(var O=0;O<24;O++){for(var k=0;k<5;k++){for(var D=0,N=0,P=0;P<5;P++){var H=w[k+5*P];D^=H.high,N^=H.low}var F=A[k];F.high=D,F.low=N}for(var k=0;k<5;k++)for(var j=A[(k+4)%5],V=A[(k+1)%5],T=V.high,$=V.low,D=j.high^(T<<1|$>>>31),N=j.low^($<<1|T>>>31),P=0;P<5;P++){var H=w[k+5*P];H.high^=D,H.low^=N}for(var K=1;K<25;K++){var D,N,H=w[K],q=H.high,W=H.low,U=h[K];U<32?(D=q<<U|W>>>32-U,N=W<<U|q>>>32-U):(D=W<<U-32|q>>>64-U,N=q<<U-32|W>>>64-U);var G=A[C[K]];G.high=D,G.low=N}var J=A[0],Y=w[0];J.high=Y.high,J.low=Y.low;for(var k=0;k<5;k++)for(var P=0;P<5;P++){var K=k+5*P,H=w[K],ee=A[K],re=A[(k+1)%5+5*P],ue=A[(k+2)%5+5*P];H.high=ee.high^~re.high&ue.high,H.low=ee.low^~re.low&ue.low}var H=w[0],se=m[O];H.high^=se.high,H.low^=se.low}},_doFinalize:function(){var p=this._data,_=p.words;this._nDataBytes*8;var w=p.sigBytes*8,x=this.blockSize*32;_[w>>>5]|=1<<24-w%32,_[(r.ceil((w+1)/x)*x>>>5)-1]|=128,p.sigBytes=_.length*4,this._process();for(var E=this._state,S=this.cfg.outputLength/8,M=S/8,H=[],O=0;O<M;O++){var k=E[O],D=k.high,N=k.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,H.push(N),H.push(D)}return new a.init(H,S)},clone:function(){for(var p=s.clone.call(this),_=p._state=this._state.slice(0),w=0;w<25;w++)_[w]=_[w].clone();return p}});o.SHA3=s._createHelper(v),o.HmacSHA3=s._createHmacHelper(v)}(Math),n.SHA3})}(fc)),fc.exports}var hc={exports:{}},bz=hc.exports,Av;function yz(){return Av||(Av=1,function(e,t){(function(n,r){e.exports=r(E1())})(bz,function(n){/** @preserve
|
|
1
|
+
"use strict";require('./assets/index.css');var Lj=Object.defineProperty;var Bj=(e,t,n)=>t in e?Lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xn=(e,t,n)=>Bj(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),A2=require("react-dom");function iS(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=iS(R),aS=iS(A2),sS={common:{primary:"#292929",secondary:"#767676",highlight:"#FFCC00",success:"#5DB772",warning:"#FFCC00",error:"#FF2540",info:"#0076B2",disabled:"#DEDEDE",themeColor:"#6F29A9",themeRed:"#ff0000",themeReject:"#ff0000",themeSecondaryButtonColor:"#FF2540",themeSystemAcceptColor:"rgb(93, 183, 114)"},text:{primary:"#292929",secondary:"#767676",tertiary:"#FFFFFF",disabled:"#767676"},background:{primary:"#F3F5F7"},surface:{fill:{primary:"#FFFFFF",secondary:"#F3F5F7",tertiary:"#EAEAEA"},border:{primary:"#EAEBEE",secondary:"#BCBDBF",tertiary:"#909090"}},button:{border:"#ffcc00",background:"#ffcc00",text:"#292929"},badge:{background:"#ff2540",text:"#fff"},input:{border:"#292929",background:"#2929291a",text:"#292929"},multiselect:{icon:"#292929",trigger:{border:"#29292955",background:"#29292929",highlight:"#29292955"},menu:{border:"#29292955",background:{default:"#FFFFFF",hover:"rgba(255, 204, 0, 0.1)",active:"rgba(255, 204, 0, 0.2)"}}},select:{trigger:{border:"#29292955",background:"#29292929"},menu:{border:"#29292955",background:{default:"#FFFFFF",hover:"rgba(255, 204, 0, 0.1)",active:"rgba(255, 204, 0, 0.2)"}}},sidebar:{background:"#292929",text:"#FFFFFF",border:"#292929",button:{background:"#FFCC00",text:"#292929",border:"#FFCC00"},footer:{background:"#FFCC00"}},topbar:{background:"#FFFFFF",text:"#292929",border:"#EAEBEE"},daterangepicker:{trigger:{background:"#29292929",border:"#29292955"},picker:{highlight:"#fc0",range:"#ffcc00bb",background:"#fff",border:"rgb(234, 235, 238)"}},table:{header:{background:"#fff"},body:{background:"#fff",checkbox:"#ffcc00",hover:"#2929291a",selected:"#ffcc001a",selectedhover:"#ffcc002b"},title:{background:"#fff"},footer:{background:"#fff"}},heatmap:{background:"#fff",cell:{border:"#EAEBEE"}},popover:{background:"#fff",border:"#EAEBEE"},refresh:{background:"#29292929",border:"#29292955"},toast:{border:{success:"#5DB772",warning:"#FFCC00",error:"#FF2540",info:"#0076B2"},background:{success:"#5DB77215",warning:"#FFCC0015",error:"#FF254015",info:"#0076B215"}},compactEventCard:{focusedBorderColor:"#ffcc00",focusedBorderThickness:"2px",borderColor:"#EAEBEE"}},Oj={text:{xs:"12px",s:"14px",m:"16px",l:"20px",xl:"22px"}},Rj={text:{s:"400",m:"500",l:"700"}},lS={name:"default",colors:sS,sizes:Oj,weights:Rj},Ij=(e,t)=>{if(typeof e=="object"&&t in e){const n=e[t];return typeof n=="string"?n:void 0}},kj=5,Dj=4,Pj="owl-V2",Nj=.3,Tj=10,Fj=1,Vj=1e3,jj=[{awi_id:"Yolo-World",awi_label:"Yolo-World",value:"Yolo-World"},{awi_id:"owl-V2",awi_label:"owl-V2",value:"owl-V2"}],zj={scale:1,x:0,y:0},Zj=.2,Uj=!1,$j={w:16,h:9},Kj=60,Wj=2*Math.PI,Qj=!1,Gj=30,Yj={approved:"rgba(66, 179, 97,0.60)",rejected:"rgba(184, 33, 44,0.60)",corrected:"rgba(175, 219, 245,0.60)"},I1={MAX_TOASTS_COUNT:kj,DISPLAY_SEARCH_MINIMUM_RECORDS:Dj,SAM_MODEL_NAME:Pj,SAM_MODEL_CONFIDENCE:Nj,SAM_MODEL_MAX_RESULTS:Tj,SAM_MODEL_MAX_RESULTS_MIN:Fj,SAM_MODEL_MAX_RESULTS_MAX:Vj,SAM_MODEL_DATA:jj,INITIAL_ZOOM_PROPERTIES:zj,INITIAL_ZOOM_LEVEL:Zj,HOVER_TO_SELECT_ON_ALREADY_SELECTED:Uj,DEFAULT_CANVAS_RATION:$j,MAX_ANNOTATIONS_TO_HOVER:Kj,TWO_PIE:Wj,POLYGON_POINT_REMOVE_CONFIRM_PROMPT:Qj,MAX_ANNOTATIONS_TO_RUN_FAST:Gj,STATUS_COLOR_MAP:Yj};var Z9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var J6={exports:{}};function qj(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ec={exports:{}};const Xj={},Jj=Object.freeze(Object.defineProperty({__proto__:null,default:Xj},Symbol.toStringTag,{value:"Module"})),ez=cS(Jj);var tz=ec.exports,iv;function E1(){return iv||(iv=1,function(e,t){(function(n,r){e.exports=r()})(tz,function(){var n=n||function(r,o){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Z9<"u"&&Z9.crypto&&(i=Z9.crypto),!i&&typeof qj=="function")try{i=ez}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function w(){}return function(x){var E;return w.prototype=x,E=new w,w.prototype=null,E}}(),c={},u=c.lib={},d=u.Base=function(){return{extend:function(w){var x=s(this);return w&&x.mixIn(w),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var x in w)w.hasOwnProperty(x)&&(this[x]=w[x]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=u.WordArray=d.extend({init:function(w,x){w=this.words=w||[],x!=o?this.sigBytes=x:this.sigBytes=w.length*4},toString:function(w){return(w||m).stringify(this)},concat:function(w){var x=this.words,E=w.words,S=this.sigBytes,M=w.sigBytes;if(this.clamp(),S%4)for(var H=0;H<M;H++){var O=E[H>>>2]>>>24-H%4*8&255;x[S+H>>>2]|=O<<24-(S+H)%4*8}else for(var k=0;k<M;k+=4)x[S+k>>>2]=E[k>>>2];return this.sigBytes+=M,this},clamp:function(){var w=this.words,x=this.sigBytes;w[x>>>2]&=4294967295<<32-x%4*8,w.length=r.ceil(x/4)},clone:function(){var w=d.clone.call(this);return w.words=this.words.slice(0),w},random:function(w){for(var x=[],E=0;E<w;E+=4)x.push(a());return new h.init(x,w)}}),C=c.enc={},m=C.Hex={stringify:function(w){for(var x=w.words,E=w.sigBytes,S=[],M=0;M<E;M++){var H=x[M>>>2]>>>24-M%4*8&255;S.push((H>>>4).toString(16)),S.push((H&15).toString(16))}return S.join("")},parse:function(w){for(var x=w.length,E=[],S=0;S<x;S+=2)E[S>>>3]|=parseInt(w.substr(S,2),16)<<24-S%8*4;return new h.init(E,x/2)}},A=C.Latin1={stringify:function(w){for(var x=w.words,E=w.sigBytes,S=[],M=0;M<E;M++){var H=x[M>>>2]>>>24-M%4*8&255;S.push(String.fromCharCode(H))}return S.join("")},parse:function(w){for(var x=w.length,E=[],S=0;S<x;S++)E[S>>>2]|=(w.charCodeAt(S)&255)<<24-S%4*8;return new h.init(E,x)}},v=C.Utf8={stringify:function(w){try{return decodeURIComponent(escape(A.stringify(w)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(w){return A.parse(unescape(encodeURIComponent(w)))}},p=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(w){typeof w=="string"&&(w=v.parse(w)),this._data.concat(w),this._nDataBytes+=w.sigBytes},_process:function(w){var x,E=this._data,S=E.words,M=E.sigBytes,H=this.blockSize,O=H*4,k=M/O;w?k=r.ceil(k):k=r.max((k|0)-this._minBufferSize,0);var D=k*H,N=r.min(D*4,M);if(D){for(var P=0;P<D;P+=H)this._doProcessBlock(S,P);x=S.splice(0,D),E.sigBytes-=N}return new h.init(x,N)},clone:function(){var w=d.clone.call(this);return w._data=this._data.clone(),w},_minBufferSize:0});u.Hasher=p.extend({cfg:d.extend(),init:function(w){this.cfg=this.cfg.extend(w),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(w){return this._append(w),this._process(),this},finalize:function(w){w&&this._append(w);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(w){return function(x,E){return new w.init(E).finalize(x)}},_createHmacHelper:function(w){return function(x,E){return new _.HMAC.init(w,E).finalize(x)}}});var _=c.algo={};return c}(Math);return n})}(ec)),ec.exports}var tc={exports:{}},nz=tc.exports,av;function C7(){return av||(av=1,function(e,t){(function(n,r){e.exports=r(E1())})(nz,function(n){return function(r){var o=n,i=o.lib,a=i.Base,s=i.WordArray,c=o.x64={};c.Word=a.extend({init:function(u,d){this.high=u,this.low=d}}),c.WordArray=a.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,h=[],C=0;C<d;C++){var m=u[C];h.push(m.high),h.push(m.low)}return s.create(h,this.sigBytes)},clone:function(){for(var u=a.clone.call(this),d=u.words=this.words.slice(0),h=d.length,C=0;C<h;C++)d[C]=d[C].clone();return u}})}(),n})}(tc)),tc.exports}var nc={exports:{}},rz=nc.exports,sv;function oz(){return sv||(sv=1,function(e,t){(function(n,r){e.exports=r(E1())})(rz,function(n){return function(){if(typeof ArrayBuffer=="function"){var r=n,o=r.lib,i=o.WordArray,a=i.init,s=i.init=function(c){if(c instanceof ArrayBuffer&&(c=new Uint8Array(c)),(c instanceof Int8Array||typeof Uint8ClampedArray<"u"&&c instanceof Uint8ClampedArray||c instanceof Int16Array||c instanceof Uint16Array||c instanceof Int32Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array)&&(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),c instanceof Uint8Array){for(var u=c.byteLength,d=[],h=0;h<u;h++)d[h>>>2]|=c[h]<<24-h%4*8;a.call(this,d,u)}else a.apply(this,arguments)};s.prototype=i}}(),n.lib.WordArray})}(nc)),nc.exports}var rc={exports:{}},iz=rc.exports,lv;function az(){return lv||(lv=1,function(e,t){(function(n,r){e.exports=r(E1())})(iz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(c){for(var u=c.words,d=c.sigBytes,h=[],C=0;C<d;C+=2){var m=u[C>>>2]>>>16-C%4*8&65535;h.push(String.fromCharCode(m))}return h.join("")},parse:function(c){for(var u=c.length,d=[],h=0;h<u;h++)d[h>>>1]|=c.charCodeAt(h)<<16-h%2*16;return i.create(d,u*2)}},a.Utf16LE={stringify:function(c){for(var u=c.words,d=c.sigBytes,h=[],C=0;C<d;C+=2){var m=s(u[C>>>2]>>>16-C%4*8&65535);h.push(String.fromCharCode(m))}return h.join("")},parse:function(c){for(var u=c.length,d=[],h=0;h<u;h++)d[h>>>1]|=s(c.charCodeAt(h)<<16-h%2*16);return i.create(d,u*2)}};function s(c){return c<<8&4278255360|c>>>8&16711935}}(),n.enc.Utf16})}(rc)),rc.exports}var oc={exports:{}},sz=oc.exports,cv;function u3(){return cv||(cv=1,function(e,t){(function(n,r){e.exports=r(E1())})(sz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64={stringify:function(c){var u=c.words,d=c.sigBytes,h=this._map;c.clamp();for(var C=[],m=0;m<d;m+=3)for(var A=u[m>>>2]>>>24-m%4*8&255,v=u[m+1>>>2]>>>24-(m+1)%4*8&255,p=u[m+2>>>2]>>>24-(m+2)%4*8&255,_=A<<16|v<<8|p,w=0;w<4&&m+w*.75<d;w++)C.push(h.charAt(_>>>6*(3-w)&63));var x=h.charAt(64);if(x)for(;C.length%4;)C.push(x);return C.join("")},parse:function(c){var u=c.length,d=this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var C=0;C<d.length;C++)h[d.charCodeAt(C)]=C}var m=d.charAt(64);if(m){var A=c.indexOf(m);A!==-1&&(u=A)}return s(c,u,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function s(c,u,d){for(var h=[],C=0,m=0;m<u;m++)if(m%4){var A=d[c.charCodeAt(m-1)]<<m%4*2,v=d[c.charCodeAt(m)]>>>6-m%4*2,p=A|v;h[C>>>2]|=p<<24-C%4*8,C++}return i.create(h,C)}}(),n.enc.Base64})}(oc)),oc.exports}var ic={exports:{}},lz=ic.exports,uv;function cz(){return uv||(uv=1,function(e,t){(function(n,r){e.exports=r(E1())})(lz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64url={stringify:function(c,u){u===void 0&&(u=!0);var d=c.words,h=c.sigBytes,C=u?this._safe_map:this._map;c.clamp();for(var m=[],A=0;A<h;A+=3)for(var v=d[A>>>2]>>>24-A%4*8&255,p=d[A+1>>>2]>>>24-(A+1)%4*8&255,_=d[A+2>>>2]>>>24-(A+2)%4*8&255,w=v<<16|p<<8|_,x=0;x<4&&A+x*.75<h;x++)m.push(C.charAt(w>>>6*(3-x)&63));var E=C.charAt(64);if(E)for(;m.length%4;)m.push(E);return m.join("")},parse:function(c,u){u===void 0&&(u=!0);var d=c.length,h=u?this._safe_map:this._map,C=this._reverseMap;if(!C){C=this._reverseMap=[];for(var m=0;m<h.length;m++)C[h.charCodeAt(m)]=m}var A=h.charAt(64);if(A){var v=c.indexOf(A);v!==-1&&(d=v)}return s(c,d,C)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function s(c,u,d){for(var h=[],C=0,m=0;m<u;m++)if(m%4){var A=d[c.charCodeAt(m-1)]<<m%4*2,v=d[c.charCodeAt(m)]>>>6-m%4*2,p=A|v;h[C>>>2]|=p<<24-C%4*8,C++}return i.create(h,C)}}(),n.enc.Base64url})}(ic)),ic.exports}var ac={exports:{}},uz=ac.exports,dv;function d3(){return dv||(dv=1,function(e,t){(function(n,r){e.exports=r(E1())})(uz,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.algo,u=[];(function(){for(var v=0;v<64;v++)u[v]=r.abs(r.sin(v+1))*4294967296|0})();var d=c.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,p){for(var _=0;_<16;_++){var w=p+_,x=v[w];v[w]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var E=this._hash.words,S=v[p+0],M=v[p+1],H=v[p+2],O=v[p+3],k=v[p+4],D=v[p+5],N=v[p+6],P=v[p+7],F=v[p+8],j=v[p+9],V=v[p+10],T=v[p+11],$=v[p+12],K=v[p+13],q=v[p+14],W=v[p+15],U=E[0],G=E[1],J=E[2],Y=E[3];U=h(U,G,J,Y,S,7,u[0]),Y=h(Y,U,G,J,M,12,u[1]),J=h(J,Y,U,G,H,17,u[2]),G=h(G,J,Y,U,O,22,u[3]),U=h(U,G,J,Y,k,7,u[4]),Y=h(Y,U,G,J,D,12,u[5]),J=h(J,Y,U,G,N,17,u[6]),G=h(G,J,Y,U,P,22,u[7]),U=h(U,G,J,Y,F,7,u[8]),Y=h(Y,U,G,J,j,12,u[9]),J=h(J,Y,U,G,V,17,u[10]),G=h(G,J,Y,U,T,22,u[11]),U=h(U,G,J,Y,$,7,u[12]),Y=h(Y,U,G,J,K,12,u[13]),J=h(J,Y,U,G,q,17,u[14]),G=h(G,J,Y,U,W,22,u[15]),U=C(U,G,J,Y,M,5,u[16]),Y=C(Y,U,G,J,N,9,u[17]),J=C(J,Y,U,G,T,14,u[18]),G=C(G,J,Y,U,S,20,u[19]),U=C(U,G,J,Y,D,5,u[20]),Y=C(Y,U,G,J,V,9,u[21]),J=C(J,Y,U,G,W,14,u[22]),G=C(G,J,Y,U,k,20,u[23]),U=C(U,G,J,Y,j,5,u[24]),Y=C(Y,U,G,J,q,9,u[25]),J=C(J,Y,U,G,O,14,u[26]),G=C(G,J,Y,U,F,20,u[27]),U=C(U,G,J,Y,K,5,u[28]),Y=C(Y,U,G,J,H,9,u[29]),J=C(J,Y,U,G,P,14,u[30]),G=C(G,J,Y,U,$,20,u[31]),U=m(U,G,J,Y,D,4,u[32]),Y=m(Y,U,G,J,F,11,u[33]),J=m(J,Y,U,G,T,16,u[34]),G=m(G,J,Y,U,q,23,u[35]),U=m(U,G,J,Y,M,4,u[36]),Y=m(Y,U,G,J,k,11,u[37]),J=m(J,Y,U,G,P,16,u[38]),G=m(G,J,Y,U,V,23,u[39]),U=m(U,G,J,Y,K,4,u[40]),Y=m(Y,U,G,J,S,11,u[41]),J=m(J,Y,U,G,O,16,u[42]),G=m(G,J,Y,U,N,23,u[43]),U=m(U,G,J,Y,j,4,u[44]),Y=m(Y,U,G,J,$,11,u[45]),J=m(J,Y,U,G,W,16,u[46]),G=m(G,J,Y,U,H,23,u[47]),U=A(U,G,J,Y,S,6,u[48]),Y=A(Y,U,G,J,P,10,u[49]),J=A(J,Y,U,G,q,15,u[50]),G=A(G,J,Y,U,D,21,u[51]),U=A(U,G,J,Y,$,6,u[52]),Y=A(Y,U,G,J,O,10,u[53]),J=A(J,Y,U,G,V,15,u[54]),G=A(G,J,Y,U,M,21,u[55]),U=A(U,G,J,Y,F,6,u[56]),Y=A(Y,U,G,J,W,10,u[57]),J=A(J,Y,U,G,N,15,u[58]),G=A(G,J,Y,U,K,21,u[59]),U=A(U,G,J,Y,k,6,u[60]),Y=A(Y,U,G,J,T,10,u[61]),J=A(J,Y,U,G,H,15,u[62]),G=A(G,J,Y,U,j,21,u[63]),E[0]=E[0]+U|0,E[1]=E[1]+G|0,E[2]=E[2]+J|0,E[3]=E[3]+Y|0},_doFinalize:function(){var v=this._data,p=v.words,_=this._nDataBytes*8,w=v.sigBytes*8;p[w>>>5]|=128<<24-w%32;var x=r.floor(_/4294967296),E=_;p[(w+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,p[(w+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,v.sigBytes=(p.length+1)*4,this._process();for(var S=this._hash,M=S.words,H=0;H<4;H++){var O=M[H];M[H]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}return S},clone:function(){var v=s.clone.call(this);return v._hash=this._hash.clone(),v}});function h(v,p,_,w,x,E,S){var M=v+(p&_|~p&w)+x+S;return(M<<E|M>>>32-E)+p}function C(v,p,_,w,x,E,S){var M=v+(p&w|_&~w)+x+S;return(M<<E|M>>>32-E)+p}function m(v,p,_,w,x,E,S){var M=v+(p^_^w)+x+S;return(M<<E|M>>>32-E)+p}function A(v,p,_,w,x,E,S){var M=v+(_^(p|~w))+x+S;return(M<<E|M>>>32-E)+p}o.MD5=s._createHelper(d),o.HmacMD5=s._createHmacHelper(d)}(Math),n.MD5})}(ac)),ac.exports}var sc={exports:{}},dz=sc.exports,fv;function uS(){return fv||(fv=1,function(e,t){(function(n,r){e.exports=r(E1())})(dz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=o.Hasher,s=r.algo,c=[],u=s.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,h){for(var C=this._hash.words,m=C[0],A=C[1],v=C[2],p=C[3],_=C[4],w=0;w<80;w++){if(w<16)c[w]=d[h+w]|0;else{var x=c[w-3]^c[w-8]^c[w-14]^c[w-16];c[w]=x<<1|x>>>31}var E=(m<<5|m>>>27)+_+c[w];w<20?E+=(A&v|~A&p)+1518500249:w<40?E+=(A^v^p)+1859775393:w<60?E+=(A&v|A&p|v&p)-1894007588:E+=(A^v^p)-899497514,_=p,p=v,v=A<<30|A>>>2,A=m,m=E}C[0]=C[0]+m|0,C[1]=C[1]+A|0,C[2]=C[2]+v|0,C[3]=C[3]+p|0,C[4]=C[4]+_|0},_doFinalize:function(){var d=this._data,h=d.words,C=this._nDataBytes*8,m=d.sigBytes*8;return h[m>>>5]|=128<<24-m%32,h[(m+64>>>9<<4)+14]=Math.floor(C/4294967296),h[(m+64>>>9<<4)+15]=C,d.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA1=a._createHelper(u),r.HmacSHA1=a._createHmacHelper(u)}(),n.SHA1})}(sc)),sc.exports}var lc={exports:{}},fz=lc.exports,hv;function ag(){return hv||(hv=1,function(e,t){(function(n,r){e.exports=r(E1())})(fz,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.algo,u=[],d=[];(function(){function m(_){for(var w=r.sqrt(_),x=2;x<=w;x++)if(!(_%x))return!1;return!0}function A(_){return(_-(_|0))*4294967296|0}for(var v=2,p=0;p<64;)m(v)&&(p<8&&(u[p]=A(r.pow(v,1/2))),d[p]=A(r.pow(v,1/3)),p++),v++})();var h=[],C=c.SHA256=s.extend({_doReset:function(){this._hash=new a.init(u.slice(0))},_doProcessBlock:function(m,A){for(var v=this._hash.words,p=v[0],_=v[1],w=v[2],x=v[3],E=v[4],S=v[5],M=v[6],H=v[7],O=0;O<64;O++){if(O<16)h[O]=m[A+O]|0;else{var k=h[O-15],D=(k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3,N=h[O-2],P=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;h[O]=D+h[O-7]+P+h[O-16]}var F=E&S^~E&M,j=p&_^p&w^_&w,V=(p<<30|p>>>2)^(p<<19|p>>>13)^(p<<10|p>>>22),T=(E<<26|E>>>6)^(E<<21|E>>>11)^(E<<7|E>>>25),$=H+T+F+d[O]+h[O],K=V+j;H=M,M=S,S=E,E=x+$|0,x=w,w=_,_=p,p=$+K|0}v[0]=v[0]+p|0,v[1]=v[1]+_|0,v[2]=v[2]+w|0,v[3]=v[3]+x|0,v[4]=v[4]+E|0,v[5]=v[5]+S|0,v[6]=v[6]+M|0,v[7]=v[7]+H|0},_doFinalize:function(){var m=this._data,A=m.words,v=this._nDataBytes*8,p=m.sigBytes*8;return A[p>>>5]|=128<<24-p%32,A[(p+64>>>9<<4)+14]=r.floor(v/4294967296),A[(p+64>>>9<<4)+15]=v,m.sigBytes=A.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});o.SHA256=s._createHelper(C),o.HmacSHA256=s._createHmacHelper(C)}(Math),n.SHA256})}(lc)),lc.exports}var cc={exports:{}},hz=cc.exports,Cv;function Cz(){return Cv||(Cv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),ag())})(hz,function(n){return function(){var r=n,o=r.lib,i=o.WordArray,a=r.algo,s=a.SHA256,c=a.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=s._doFinalize.call(this);return u.sigBytes-=4,u}});r.SHA224=s._createHelper(c),r.HmacSHA224=s._createHmacHelper(c)}(),n.SHA224})}(cc)),cc.exports}var uc={exports:{}},gz=uc.exports,gv;function dS(){return gv||(gv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7())})(gz,function(n){return function(){var r=n,o=r.lib,i=o.Hasher,a=r.x64,s=a.Word,c=a.WordArray,u=r.algo;function d(){return s.create.apply(s,arguments)}var h=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],C=[];(function(){for(var A=0;A<80;A++)C[A]=d()})();var m=u.SHA512=i.extend({_doReset:function(){this._hash=new c.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(A,v){for(var p=this._hash.words,_=p[0],w=p[1],x=p[2],E=p[3],S=p[4],M=p[5],H=p[6],O=p[7],k=_.high,D=_.low,N=w.high,P=w.low,F=x.high,j=x.low,V=E.high,T=E.low,$=S.high,K=S.low,q=M.high,W=M.low,U=H.high,G=H.low,J=O.high,Y=O.low,ee=k,re=D,ue=N,se=P,_e=F,xe=j,Ae=V,he=T,le=$,ae=K,ye=q,Re=W,Ie=U,Ce=G,et=J,fe=Y,ne=0;ne<80;ne++){var pe,Ee,Le=C[ne];if(ne<16)Ee=Le.high=A[v+ne*2]|0,pe=Le.low=A[v+ne*2+1]|0;else{var Be=C[ne-15],je=Be.high,We=Be.low,lt=(je>>>1|We<<31)^(je>>>8|We<<24)^je>>>7,tt=(We>>>1|je<<31)^(We>>>8|je<<24)^(We>>>7|je<<25),Qe=C[ne-2],Fe=Qe.high,ot=Qe.low,Ue=(Fe>>>19|ot<<13)^(Fe<<3|ot>>>29)^Fe>>>6,Ve=(ot>>>19|Fe<<13)^(ot<<3|Fe>>>29)^(ot>>>6|Fe<<26),Ge=C[ne-7],dt=Ge.high,qe=Ge.low,ft=C[ne-16],Pt=ft.high,Wt=ft.low;pe=tt+qe,Ee=lt+dt+(pe>>>0<tt>>>0?1:0),pe=pe+Ve,Ee=Ee+Ue+(pe>>>0<Ve>>>0?1:0),pe=pe+Wt,Ee=Ee+Pt+(pe>>>0<Wt>>>0?1:0),Le.high=Ee,Le.low=pe}var an=le&ye^~le&Ie,Dn=ae&Re^~ae&Ce,Gt=ee&ue^ee&_e^ue&_e,An=re&se^re&xe^se&xe,bn=(ee>>>28|re<<4)^(ee<<30|re>>>2)^(ee<<25|re>>>7),Qt=(re>>>28|ee<<4)^(re<<30|ee>>>2)^(re<<25|ee>>>7),Ot=(le>>>14|ae<<18)^(le>>>18|ae<<14)^(le<<23|ae>>>9),Ht=(ae>>>14|le<<18)^(ae>>>18|le<<14)^(ae<<23|le>>>9),_t=h[ne],Zt=_t.high,Cn=_t.low,mt=fe+Ht,pt=et+Ot+(mt>>>0<fe>>>0?1:0),mt=mt+Dn,pt=pt+an+(mt>>>0<Dn>>>0?1:0),mt=mt+Cn,pt=pt+Zt+(mt>>>0<Cn>>>0?1:0),mt=mt+pe,pt=pt+Ee+(mt>>>0<pe>>>0?1:0),Lt=Qt+An,Xe=bn+Gt+(Lt>>>0<Qt>>>0?1:0);et=Ie,fe=Ce,Ie=ye,Ce=Re,ye=le,Re=ae,ae=he+mt|0,le=Ae+pt+(ae>>>0<he>>>0?1:0)|0,Ae=_e,he=xe,_e=ue,xe=se,ue=ee,se=re,re=mt+Lt|0,ee=pt+Xe+(re>>>0<mt>>>0?1:0)|0}D=_.low=D+re,_.high=k+ee+(D>>>0<re>>>0?1:0),P=w.low=P+se,w.high=N+ue+(P>>>0<se>>>0?1:0),j=x.low=j+xe,x.high=F+_e+(j>>>0<xe>>>0?1:0),T=E.low=T+he,E.high=V+Ae+(T>>>0<he>>>0?1:0),K=S.low=K+ae,S.high=$+le+(K>>>0<ae>>>0?1:0),W=M.low=W+Re,M.high=q+ye+(W>>>0<Re>>>0?1:0),G=H.low=G+Ce,H.high=U+Ie+(G>>>0<Ce>>>0?1:0),Y=O.low=Y+fe,O.high=J+et+(Y>>>0<fe>>>0?1:0)},_doFinalize:function(){var A=this._data,v=A.words,p=this._nDataBytes*8,_=A.sigBytes*8;v[_>>>5]|=128<<24-_%32,v[(_+128>>>10<<5)+30]=Math.floor(p/4294967296),v[(_+128>>>10<<5)+31]=p,A.sigBytes=v.length*4,this._process();var w=this._hash.toX32();return w},clone:function(){var A=i.clone.call(this);return A._hash=this._hash.clone(),A},blockSize:1024/32});r.SHA512=i._createHelper(m),r.HmacSHA512=i._createHmacHelper(m)}(),n.SHA512})}(uc)),uc.exports}var dc={exports:{}},mz=dc.exports,mv;function pz(){return mv||(mv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7(),dS())})(mz,function(n){return function(){var r=n,o=r.x64,i=o.Word,a=o.WordArray,s=r.algo,c=s.SHA512,u=s.SHA384=c.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var d=c._doFinalize.call(this);return d.sigBytes-=16,d}});r.SHA384=c._createHelper(u),r.HmacSHA384=c._createHmacHelper(u)}(),n.SHA384})}(dc)),dc.exports}var fc={exports:{}},Az=fc.exports,pv;function vz(){return pv||(pv=1,function(e,t){(function(n,r,o){e.exports=r(E1(),C7())})(Az,function(n){return function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,c=o.x64,u=c.Word,d=o.algo,h=[],C=[],m=[];(function(){for(var p=1,_=0,w=0;w<24;w++){h[p+5*_]=(w+1)*(w+2)/2%64;var x=_%5,E=(2*p+3*_)%5;p=x,_=E}for(var p=0;p<5;p++)for(var _=0;_<5;_++)C[p+5*_]=_+(2*p+3*_)%5*5;for(var S=1,M=0;M<24;M++){for(var H=0,O=0,k=0;k<7;k++){if(S&1){var D=(1<<k)-1;D<32?O^=1<<D:H^=1<<D-32}S&128?S=S<<1^113:S<<=1}m[M]=u.create(H,O)}})();var A=[];(function(){for(var p=0;p<25;p++)A[p]=u.create()})();var v=d.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var p=this._state=[],_=0;_<25;_++)p[_]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(p,_){for(var w=this._state,x=this.blockSize/2,E=0;E<x;E++){var S=p[_+2*E],M=p[_+2*E+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360;var H=w[E];H.high^=M,H.low^=S}for(var O=0;O<24;O++){for(var k=0;k<5;k++){for(var D=0,N=0,P=0;P<5;P++){var H=w[k+5*P];D^=H.high,N^=H.low}var F=A[k];F.high=D,F.low=N}for(var k=0;k<5;k++)for(var j=A[(k+4)%5],V=A[(k+1)%5],T=V.high,$=V.low,D=j.high^(T<<1|$>>>31),N=j.low^($<<1|T>>>31),P=0;P<5;P++){var H=w[k+5*P];H.high^=D,H.low^=N}for(var K=1;K<25;K++){var D,N,H=w[K],q=H.high,W=H.low,U=h[K];U<32?(D=q<<U|W>>>32-U,N=W<<U|q>>>32-U):(D=W<<U-32|q>>>64-U,N=q<<U-32|W>>>64-U);var G=A[C[K]];G.high=D,G.low=N}var J=A[0],Y=w[0];J.high=Y.high,J.low=Y.low;for(var k=0;k<5;k++)for(var P=0;P<5;P++){var K=k+5*P,H=w[K],ee=A[K],re=A[(k+1)%5+5*P],ue=A[(k+2)%5+5*P];H.high=ee.high^~re.high&ue.high,H.low=ee.low^~re.low&ue.low}var H=w[0],se=m[O];H.high^=se.high,H.low^=se.low}},_doFinalize:function(){var p=this._data,_=p.words;this._nDataBytes*8;var w=p.sigBytes*8,x=this.blockSize*32;_[w>>>5]|=1<<24-w%32,_[(r.ceil((w+1)/x)*x>>>5)-1]|=128,p.sigBytes=_.length*4,this._process();for(var E=this._state,S=this.cfg.outputLength/8,M=S/8,H=[],O=0;O<M;O++){var k=E[O],D=k.high,N=k.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,H.push(N),H.push(D)}return new a.init(H,S)},clone:function(){for(var p=s.clone.call(this),_=p._state=this._state.slice(0),w=0;w<25;w++)_[w]=_[w].clone();return p}});o.SHA3=s._createHelper(v),o.HmacSHA3=s._createHmacHelper(v)}(Math),n.SHA3})}(fc)),fc.exports}var hc={exports:{}},bz=hc.exports,Av;function yz(){return Av||(Av=1,function(e,t){(function(n,r){e.exports=r(E1())})(bz,function(n){/** @preserve
|
|
2
2
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
3
3
|
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -336,7 +336,7 @@ __p += '`),_1&&(It+=`' +
|
|
|
336
336
|
function print() { __p += __j.call(arguments, '') }
|
|
337
337
|
`:`;
|
|
338
338
|
`)+It+`return __p
|
|
339
|
-
}`;var i1=nv(function(){return h1(me,Ln+"return "+It).apply(n,Oe)});if(i1.source=It,hd(i1))throw i1;return i1}function PV(g){return z1(g).toLowerCase()}function NV(g){return z1(g).toUpperCase()}function TV(g,y,I){if(g=z1(g),g&&(I||y===n))return x9(g);if(!g||!(y=br(y)))return g;var Q=J0(g),te=J0(y),me=S2(Q,te),Oe=Ur(Q,te)+1;return ka(Q,me,Oe).join("")}function FV(g,y,I){if(g=z1(g),g&&(I||y===n))return g.slice(0,ti(g)+1);if(!g||!(y=br(y)))return g;var Q=J0(g),te=Ur(Q,J0(y))+1;return ka(Q,0,te).join("")}function VV(g,y,I){if(g=z1(g),g&&(I||y===n))return g.replace(pt,"");if(!g||!(y=br(y)))return g;var Q=J0(g),te=S2(Q,J0(y));return ka(Q,te).join("")}function jV(g,y){var I=D,Q=N;if(b0(y)){var te="separator"in y?y.separator:te;I="length"in y?r1(y.length):I,Q="omission"in y?br(y.omission):Q}g=z1(g);var me=g.length;if(Co(g)){var Oe=J0(g);me=Oe.length}if(I>=me)return g;var Pe=I-Z0(Q);if(Pe<1)return Q;var Ke=Oe?ka(Oe,0,Pe).join(""):g.slice(0,Pe);if(te===n)return Ke+Q;if(Oe&&(Pe+=Ke.length-Pe),Cd(te)){if(g.slice(Pe).search(te)){var St,Mt=Ke;for(te.global||(te=mo(te.source,z1(Et.exec(te))+"g")),te.lastIndex=0;St=te.exec(Mt);)var It=St.index;Ke=Ke.slice(0,It===n?Pe:It)}}else if(g.indexOf(br(te),Pe)!=Pe){var ln=Ke.lastIndexOf(te);ln>-1&&(Ke=Ke.slice(0,ln))}return Ke+Q}function zV(g){return g=z1(g),g&&Gt.test(g)?g.replace(an,ki):g}var ZV=N3(function(g,y,I){return g+(I?" ":"")+y.toUpperCase()}),pd=rA("toUpperCase");function tv(g,y,I){return g=z1(g),y=I?n:y,y===n?$r(g)?Di(g):Qo(g):g.match(y)||[]}var nv=d1(function(g,y){try{return s0(g,n,y)}catch(I){return hd(I)?I:new Un(I)}}),UV=Zi(function(g,y){return g0(y,function(I){I=li(I),ji(g,I,dd(g[I],g))}),g});function $V(g){var y=g==null?0:g.length,I=Vn();return g=y?G1(g,function(Q){if(typeof Q[1]!="function")throw new x0(a);return[I(Q[0]),Q[1]]}):[],d1(function(Q){for(var te=-1;++te<y;){var me=g[te];if(s0(me[0],this,Q))return s0(me[1],this,Q)}})}function KV(g){return pP(Xr(g,h))}function Ad(g){return function(){return g}}function WV(g,y){return g==null||g!==g?y:g}var QV=iA(),GV=iA(!0);function ar(g){return g}function vd(g){return Dp(typeof g=="function"?g:Xr(g,h))}function YV(g){return Np(Xr(g,h))}function qV(g,y){return Tp(g,Xr(y,h))}var XV=d1(function(g,y){return function(I){return f4(I,g,y)}}),JV=d1(function(g,y){return function(I){return f4(g,I,y)}});function bd(g,y,I){var Q=r2(y),te=Vl(y,Q);I==null&&!(b0(y)&&(te.length||!Q.length))&&(I=y,y=g,g=this,te=Vl(y,r2(y)));var me=!(b0(I)&&"chain"in I)||!!I.chain,Oe=$i(g);return g0(te,function(Pe){var Ke=y[Pe];g[Pe]=Ke,Oe&&(g.prototype[Pe]=function(){var St=this.__chain__;if(me||St){var Mt=g(this.__wrapped__),It=Mt.__actions__=rr(this.__actions__);return It.push({func:Ke,args:arguments,thisArg:g}),Mt.__chain__=St,Mt}return Ke.apply(g,d2([this.value()],arguments))})}),g}function ej(){return L0._===this&&(L0._=Ma),this}function yd(){}function tj(g){return g=r1(g),d1(function(y){return Fp(y,g)})}var nj=Xu(G1),rj=Xu(Zo),oj=Xu(Ko);function rv(g){return id(g)?Yo(li(g)):kP(g)}function ij(g){return function(y){return g==null?n:H9(g,y)}}var aj=sA(),sj=sA(!0);function wd(){return[]}function xd(){return!1}function lj(){return{}}function cj(){return""}function uj(){return!0}function dj(g,y){if(g=r1(g),g<1||g>K)return[];var I=U,Q=ie(g,U);y=Vn(y),g-=U;for(var te=w9(Q,y);++I<g;)y(I);return te}function fj(g){return Yn(g)?G1(g,li):yr(g)?[g]:rr(xA(z1(g)))}function hj(g){var y=++l4;return z1(g)+y}var Cj=Kl(function(g,y){return g+y},0),gj=Ju("ceil"),mj=Kl(function(g,y){return g/y},1),pj=Ju("floor");function Aj(g){return g&&g.length?Fl(g,ar,Tu):n}function vj(g,y){return g&&g.length?Fl(g,Vn(y,2),Tu):n}function bj(g){return Oi(g,ar)}function yj(g,y){return Oi(g,Vn(y,2))}function wj(g){return g&&g.length?Fl(g,ar,zu):n}function xj(g,y){return g&&g.length?Fl(g,Vn(y,2),zu):n}var _j=Kl(function(g,y){return g*y},1),Ej=Ju("round"),Sj=Kl(function(g,y){return g-y},0);function Mj(g){return g&&g.length?E2(g,ar):0}function Hj(g,y){return g&&g.length?E2(g,Vn(y,2)):0}return ce.after=YT,ce.ary=kA,ce.assign=NF,ce.assignIn=QA,ce.assignInWith=i6,ce.assignWith=TF,ce.at=FF,ce.before=DA,ce.bind=dd,ce.bindAll=UV,ce.bindKey=PA,ce.castArray=lF,ce.chain=OA,ce.chunk=pN,ce.compact=AN,ce.concat=vN,ce.cond=$V,ce.conforms=KV,ce.constant=Ad,ce.countBy=MT,ce.create=VF,ce.curry=NA,ce.curryRight=TA,ce.debounce=FA,ce.defaults=jF,ce.defaultsDeep=zF,ce.defer=qT,ce.delay=XT,ce.difference=bN,ce.differenceBy=yN,ce.differenceWith=wN,ce.drop=xN,ce.dropRight=_N,ce.dropRightWhile=EN,ce.dropWhile=SN,ce.fill=MN,ce.filter=LT,ce.flatMap=RT,ce.flatMapDeep=IT,ce.flatMapDepth=kT,ce.flatten=MA,ce.flattenDeep=HN,ce.flattenDepth=LN,ce.flip=JT,ce.flow=QV,ce.flowRight=GV,ce.fromPairs=BN,ce.functions=GF,ce.functionsIn=YF,ce.groupBy=DT,ce.initial=RN,ce.intersection=IN,ce.intersectionBy=kN,ce.intersectionWith=DN,ce.invert=XF,ce.invertBy=JF,ce.invokeMap=NT,ce.iteratee=vd,ce.keyBy=TT,ce.keys=r2,ce.keysIn=ir,ce.map=Jl,ce.mapKeys=tV,ce.mapValues=nV,ce.matches=YV,ce.matchesProperty=qV,ce.memoize=t6,ce.merge=rV,ce.mergeWith=GA,ce.method=XV,ce.methodOf=JV,ce.mixin=bd,ce.negate=n6,ce.nthArg=tj,ce.omit=oV,ce.omitBy=iV,ce.once=eF,ce.orderBy=FT,ce.over=nj,ce.overArgs=tF,ce.overEvery=rj,ce.overSome=oj,ce.partial=fd,ce.partialRight=VA,ce.partition=VT,ce.pick=aV,ce.pickBy=YA,ce.property=rv,ce.propertyOf=ij,ce.pull=FN,ce.pullAll=LA,ce.pullAllBy=VN,ce.pullAllWith=jN,ce.pullAt=zN,ce.range=aj,ce.rangeRight=sj,ce.rearg=nF,ce.reject=ZT,ce.remove=ZN,ce.rest=rF,ce.reverse=cd,ce.sampleSize=$T,ce.set=lV,ce.setWith=cV,ce.shuffle=KT,ce.slice=UN,ce.sortBy=GT,ce.sortedUniq=qN,ce.sortedUniqBy=XN,ce.split=RV,ce.spread=oF,ce.tail=JN,ce.take=eT,ce.takeRight=tT,ce.takeRightWhile=nT,ce.takeWhile=rT,ce.tap=AT,ce.throttle=iF,ce.thru=Xl,ce.toArray=$A,ce.toPairs=qA,ce.toPairsIn=XA,ce.toPath=fj,ce.toPlainObject=WA,ce.transform=uV,ce.unary=aF,ce.union=oT,ce.unionBy=iT,ce.unionWith=aT,ce.uniq=sT,ce.uniqBy=lT,ce.uniqWith=cT,ce.unset=dV,ce.unzip=ud,ce.unzipWith=BA,ce.update=fV,ce.updateWith=hV,ce.values=V3,ce.valuesIn=CV,ce.without=uT,ce.words=tv,ce.wrap=sF,ce.xor=dT,ce.xorBy=fT,ce.xorWith=hT,ce.zip=CT,ce.zipObject=gT,ce.zipObjectDeep=mT,ce.zipWith=pT,ce.entries=qA,ce.entriesIn=XA,ce.extend=QA,ce.extendWith=i6,bd(ce,ce),ce.add=Cj,ce.attempt=nv,ce.camelCase=AV,ce.capitalize=JA,ce.ceil=gj,ce.clamp=gV,ce.clone=cF,ce.cloneDeep=dF,ce.cloneDeepWith=fF,ce.cloneWith=uF,ce.conformsTo=hF,ce.deburr=ev,ce.defaultTo=WV,ce.divide=mj,ce.endsWith=vV,ce.eq=xo,ce.escape=bV,ce.escapeRegExp=yV,ce.every=HT,ce.find=BT,ce.findIndex=EA,ce.findKey=ZF,ce.findLast=OT,ce.findLastIndex=SA,ce.findLastKey=UF,ce.floor=pj,ce.forEach=RA,ce.forEachRight=IA,ce.forIn=$F,ce.forInRight=KF,ce.forOwn=WF,ce.forOwnRight=QF,ce.get=gd,ce.gt=CF,ce.gte=gF,ce.has=qF,ce.hasIn=md,ce.head=HA,ce.identity=ar,ce.includes=PT,ce.indexOf=ON,ce.inRange=mV,ce.invoke=eV,ce.isArguments=O9,ce.isArray=Yn,ce.isArrayBuffer=mF,ce.isArrayLike=or,ce.isArrayLikeObject=O0,ce.isBoolean=pF,ce.isBuffer=Da,ce.isDate=AF,ce.isElement=vF,ce.isEmpty=bF,ce.isEqual=yF,ce.isEqualWith=wF,ce.isError=hd,ce.isFinite=xF,ce.isFunction=$i,ce.isInteger=jA,ce.isLength=r6,ce.isMap=zA,ce.isMatch=_F,ce.isMatchWith=EF,ce.isNaN=SF,ce.isNative=MF,ce.isNil=LF,ce.isNull=HF,ce.isNumber=ZA,ce.isObject=b0,ce.isObjectLike=E0,ce.isPlainObject=A4,ce.isRegExp=Cd,ce.isSafeInteger=BF,ce.isSet=UA,ce.isString=o6,ce.isSymbol=yr,ce.isTypedArray=F3,ce.isUndefined=OF,ce.isWeakMap=RF,ce.isWeakSet=IF,ce.join=PN,ce.kebabCase=wV,ce.last=eo,ce.lastIndexOf=NN,ce.lowerCase=xV,ce.lowerFirst=_V,ce.lt=kF,ce.lte=DF,ce.max=Aj,ce.maxBy=vj,ce.mean=bj,ce.meanBy=yj,ce.min=wj,ce.minBy=xj,ce.stubArray=wd,ce.stubFalse=xd,ce.stubObject=lj,ce.stubString=cj,ce.stubTrue=uj,ce.multiply=_j,ce.nth=TN,ce.noConflict=ej,ce.noop=yd,ce.now=e6,ce.pad=EV,ce.padEnd=SV,ce.padStart=MV,ce.parseInt=HV,ce.random=pV,ce.reduce=jT,ce.reduceRight=zT,ce.repeat=LV,ce.replace=BV,ce.result=sV,ce.round=Ej,ce.runInContext=Ze,ce.sample=UT,ce.size=WT,ce.snakeCase=OV,ce.some=QT,ce.sortedIndex=$N,ce.sortedIndexBy=KN,ce.sortedIndexOf=WN,ce.sortedLastIndex=QN,ce.sortedLastIndexBy=GN,ce.sortedLastIndexOf=YN,ce.startCase=IV,ce.startsWith=kV,ce.subtract=Sj,ce.sum=Mj,ce.sumBy=Hj,ce.template=DV,ce.times=dj,ce.toFinite=Ki,ce.toInteger=r1,ce.toLength=KA,ce.toLower=PV,ce.toNumber=to,ce.toSafeInteger=PF,ce.toString=z1,ce.toUpper=NV,ce.trim=TV,ce.trimEnd=FV,ce.trimStart=VV,ce.truncate=jV,ce.unescape=zV,ce.uniqueId=hj,ce.upperCase=ZV,ce.upperFirst=pd,ce.each=RA,ce.eachRight=IA,ce.first=HA,bd(ce,function(){var g={};return ai(ce,function(y,I){u1.call(ce.prototype,I)||(g[I]=y)}),g}(),{chain:!1}),ce.VERSION=r,g0(["bind","bindKey","curry","curryRight","partial","partialRight"],function(g){ce[g].placeholder=ce}),g0(["drop","take"],function(g,y){rn.prototype[g]=function(I){I=I===n?1:X(r1(I),0);var Q=this.__filtered__&&!y?new rn(this):this.clone();return Q.__filtered__?Q.__takeCount__=ie(I,Q.__takeCount__):Q.__views__.push({size:ie(I,U),type:g+(Q.__dir__<0?"Right":"")}),Q},rn.prototype[g+"Right"]=function(I){return this.reverse()[g](I).reverse()}}),g0(["filter","map","takeWhile"],function(g,y){var I=y+1,Q=I==j||I==T;rn.prototype[g]=function(te){var me=this.clone();return me.__iteratees__.push({iteratee:Vn(te,3),type:I}),me.__filtered__=me.__filtered__||Q,me}}),g0(["head","last"],function(g,y){var I="take"+(y?"Right":"");rn.prototype[g]=function(){return this[I](1).value()[0]}}),g0(["initial","tail"],function(g,y){var I="drop"+(y?"":"Right");rn.prototype[g]=function(){return this.__filtered__?new rn(this):this[I](1)}}),rn.prototype.compact=function(){return this.filter(ar)},rn.prototype.find=function(g){return this.filter(g).head()},rn.prototype.findLast=function(g){return this.reverse().find(g)},rn.prototype.invokeMap=d1(function(g,y){return typeof g=="function"?new rn(this):this.map(function(I){return f4(I,g,y)})}),rn.prototype.reject=function(g){return this.filter(n6(Vn(g)))},rn.prototype.slice=function(g,y){g=r1(g);var I=this;return I.__filtered__&&(g>0||y<0)?new rn(I):(g<0?I=I.takeRight(-g):g&&(I=I.drop(g)),y!==n&&(y=r1(y),I=y<0?I.dropRight(-y):I.take(y-g)),I)},rn.prototype.takeRightWhile=function(g){return this.reverse().takeWhile(g).reverse()},rn.prototype.toArray=function(){return this.take(U)},ai(rn.prototype,function(g,y){var I=/^(?:filter|find|map|reject)|While$/.test(y),Q=/^(?:head|last)$/.test(y),te=ce[Q?"take"+(y=="last"?"Right":""):y],me=Q||/^find/.test(y);te&&(ce.prototype[y]=function(){var Oe=this.__wrapped__,Pe=Q?[1]:arguments,Ke=Oe instanceof rn,St=Pe[0],Mt=Ke||Yn(Oe),It=function(p1){var _1=te.apply(ce,d2([p1],Pe));return Q&&ln?_1[0]:_1};Mt&&I&&typeof St=="function"&&St.length!=1&&(Ke=Mt=!1);var ln=this.__chain__,Ln=!!this.__actions__.length,zn=me&&!ln,i1=Ke&&!Ln;if(!me&&Mt){Oe=i1?Oe:new rn(this);var Zn=g.apply(Oe,Pe);return Zn.__actions__.push({func:Xl,args:[It],thisArg:n}),new m1(Zn,ln)}return zn&&i1?g.apply(this,Pe):(Zn=this.thru(It),zn?Q?Zn.value()[0]:Zn.value():Zn)})}),g0(["pop","push","shift","sort","splice","unshift"],function(g){var y=po[g],I=/^(?:push|sort|unshift)$/.test(g)?"tap":"thru",Q=/^(?:pop|shift)$/.test(g);ce.prototype[g]=function(){var te=arguments;if(Q&&!this.__chain__){var me=this.value();return y.apply(Yn(me)?me:[],te)}return this[I](function(Oe){return y.apply(Yn(Oe)?Oe:[],te)})}}),ai(rn.prototype,function(g,y){var I=ce[y];if(I){var Q=I.name+"";u1.call(Te,Q)||(Te[Q]=[]),Te[Q].push({name:y,func:I})}}),Te[$l(n,_).name]=[{name:"wrapper",func:n}],rn.prototype.clone=_0,rn.prototype.reverse=t2,rn.prototype.value=j2,ce.prototype.at=vT,ce.prototype.chain=bT,ce.prototype.commit=yT,ce.prototype.next=wT,ce.prototype.plant=_T,ce.prototype.reverse=ET,ce.prototype.toJSON=ce.prototype.valueOf=ce.prototype.value=ST,ce.prototype.first=ce.prototype.head,Gr&&(ce.prototype[Gr]=xT),ce},F2=ni();w2?((w2.exports=F2)._=F2,u2._=F2):L0._=F2}).call(aae)}(W4,W4.exports)),W4.exports}var cl=sae();const bi=uo(cl),Fd="/not_available.svg",lae="/big_size_image.svg",Vd="/user.png",ZM={HARDCODED_FALL_BACK_IMAGE:Fd,HARDCODED_FALL_BACK_BIG_IMAGE:lae,DEFAULT_AVATAR_IMAGE:Vd,generateImageUrl:(e,t=!1)=>e||Fd,getImageKitUrl:(e,t=300,n=300,r=40)=>e||Fd,getUserAvatar:e=>{var t;return!e||!((t=e.awi_personal_info)!=null&&t.awi_avatar)?Vd:e.awi_personal_info.awi_avatar||Vd}};var U3=ug();const jd=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function zd(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),n)}function M4(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on".concat(t),n)}function UM(e,t){const n=t.slice(0,t.length-1);for(let r=0;r<n.length;r++)n[r]=e[n[r].toLowerCase()];return n}function $M(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let n=t.lastIndexOf("");for(;n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function cae(e,t){const n=e.length>=t.length?e:t,r=e.length>=t.length?t:e;let o=!0;for(let i=0;i<n.length;i++)r.indexOf(n[i])===-1&&(o=!1);return o}const Ms={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":jd?173:189,"=":jd?61:187,";":jd?59:186,"'":222,"[":219,"]":221,"\\":220},Io={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Q4={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},m2={16:!1,18:!1,17:!1,91:!1},y0={};for(let e=1;e<20;e++)Ms["f".concat(e)]=111+e;let p0=[],us=null,KM="all";const na=new Map,ul=e=>Ms[e.toLowerCase()]||Io[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),uae=e=>Object.keys(Ms).find(t=>Ms[t]===e),dae=e=>Object.keys(Io).find(t=>Io[t]===e);function WM(e){KM=e||"all"}function Hs(){return KM||"all"}function fae(){return p0.slice(0)}function hae(){return p0.map(e=>uae(e)||dae(e)||String.fromCharCode(e))}function Cae(){const e=[];return Object.keys(y0).forEach(t=>{y0[t].forEach(n=>{let{key:r,scope:o,mods:i,shortcut:a}=n;e.push({scope:o,shortcut:a,mods:i,keys:r.split("+").map(s=>ul(s))})})}),e}function gae(e){const t=e.target||e.srcElement,{tagName:n}=t;let r=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(r=!1),r}function mae(e){return typeof e=="string"&&(e=ul(e)),p0.indexOf(e)!==-1}function pae(e,t){let n,r;e||(e=Hs());for(const o in y0)if(Object.prototype.hasOwnProperty.call(y0,o))for(n=y0[o],r=0;r<n.length;)n[r].scope===e?n.splice(r,1).forEach(a=>{let{element:s}=a;return Mg(s)}):r++;Hs()===e&&WM(t||"all")}function Aae(e){let t=e.keyCode||e.which||e.charCode;const n=p0.indexOf(t);if(n>=0&&p0.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&p0.splice(0,p0.length),(t===93||t===224)&&(t=91),t in m2){m2[t]=!1;for(const r in Io)Io[r]===t&&(ao[r]=!1)}}function QM(e){if(typeof e>"u")Object.keys(y0).forEach(o=>{Array.isArray(y0[o])&&y0[o].forEach(i=>h6(i)),delete y0[o]}),Mg(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&h6(o)});else if(typeof e=="object")e.key&&h6(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let[o,i]=n;typeof o=="function"&&(i=o,o=""),h6({key:e,scope:o,method:i,splitKey:"+"})}}const h6=e=>{let{key:t,scope:n,method:r,splitKey:o="+"}=e;$M(t).forEach(a=>{const s=a.split(o),c=s.length,u=s[c-1],d=u==="*"?"*":ul(u);if(!y0[d])return;n||(n=Hs());const h=c>1?UM(Io,s):[],C=[];y0[d]=y0[d].filter(m=>{const v=(r?m.method===r:!0)&&m.scope===n&&cae(m.mods,h);return v&&C.push(m.element),!v}),C.forEach(m=>Mg(m))})};function Kb(e,t,n,r){if(t.element!==r)return;let o;if(t.scope===n||t.scope==="all"){o=t.mods.length>0;for(const i in m2)Object.prototype.hasOwnProperty.call(m2,i)&&(!m2[i]&&t.mods.indexOf(+i)>-1||m2[i]&&t.mods.indexOf(+i)===-1)&&(o=!1);(t.mods.length===0&&!m2[16]&&!m2[18]&&!m2[17]&&!m2[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(p0),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function Wb(e,t){const n=y0["*"];let r=e.keyCode||e.which||e.charCode;if(!ao.filter.call(this,e))return;if((r===93||r===224)&&(r=91),p0.indexOf(r)===-1&&r!==229&&p0.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(s=>{const c=Q4[s];e[s]&&p0.indexOf(c)===-1?p0.push(c):!e[s]&&p0.indexOf(c)>-1?p0.splice(p0.indexOf(c),1):s==="metaKey"&&e[s]&&(p0=p0.filter(u=>u in Q4||u===r))}),r in m2){m2[r]=!0;for(const s in Io)if(Object.prototype.hasOwnProperty.call(Io,s)){const c=Q4[Io[s]];ao[s]=e[c]}if(!n)return}for(const s in m2)Object.prototype.hasOwnProperty.call(m2,s)&&(m2[s]=e[Q4[s]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(p0.indexOf(17)===-1&&p0.push(17),p0.indexOf(18)===-1&&p0.push(18),m2[17]=!0,m2[18]=!0);const o=Hs();if(n)for(let s=0;s<n.length;s++)n[s].scope===o&&(e.type==="keydown"&&n[s].keydown||e.type==="keyup"&&n[s].keyup)&&Kb(e,n[s],o,t);if(!(r in y0))return;const i=y0[r],a=i.length;for(let s=0;s<a;s++)if((e.type==="keydown"&&i[s].keydown||e.type==="keyup"&&i[s].keyup)&&i[s].key){const c=i[s],{splitKey:u}=c,d=c.key.split(u),h=[];for(let C=0;C<d.length;C++)h.push(ul(d[C]));h.sort().join("")===p0.sort().join("")&&Kb(e,c,o,t)}}function ao(e,t,n){p0=[];const r=$M(e);let o=[],i="all",a=document,s=0,c=!1,u=!0,d="+",h=!1,C=!1;for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(c=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(h=t.capture),typeof t.splitKey=="string"&&(d=t.splitKey),t.single===!0&&(C=!0)),typeof t=="string"&&(i=t),C&&QM(e,i);s<r.length;s++)e=r[s].split(d),o=[],e.length>1&&(o=UM(Io,e)),e=e[e.length-1],e=e==="*"?"*":ul(e),e in y0||(y0[e]=[]),y0[e].push({keyup:c,keydown:u,scope:i,mods:o,shortcut:r[s],method:n,key:r[s],splitKey:d,element:a});if(typeof a<"u"&&window){if(!na.has(a)){const m=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return Wb(v,a)},A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;Wb(v,a),Aae(v)};na.set(a,{keydownListener:m,keyupListenr:A,capture:h}),zd(a,"keydown",m,h),zd(a,"keyup",A,h)}if(!us){const m=()=>{p0=[]};us={listener:m,capture:h},zd(window,"focus",m,h)}}}function vae(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(y0).forEach(n=>{y0[n].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function Mg(e){const t=Object.values(y0).flat();if(t.findIndex(r=>{let{element:o}=r;return o===e})<0){const{keydownListener:r,keyupListenr:o,capture:i}=na.get(e)||{};r&&o&&(M4(e,"keyup",o,i),M4(e,"keydown",r,i),na.delete(e))}if((t.length<=0||na.size<=0)&&(Object.keys(na).forEach(o=>{const{keydownListener:i,keyupListenr:a,capture:s}=na.get(o)||{};i&&a&&(M4(o,"keyup",a,s),M4(o,"keydown",i,s),na.delete(o))}),na.clear(),Object.keys(y0).forEach(o=>delete y0[o]),us)){const{listener:o,capture:i}=us;M4(window,"focus",o,i),us=null}}const Zd={getPressedKeyString:hae,setScope:WM,getScope:Hs,deleteScope:pae,getPressedKeyCodes:fae,getAllKeyCodes:Cae,isPressed:mae,filter:gae,trigger:vae,unbind:QM,keyMap:Ms,modifier:Io,modifierMap:Q4};for(const e in Zd)Object.prototype.hasOwnProperty.call(Zd,e)&&(ao[e]=Zd[e]);if(typeof window<"u"){const e=window.hotkeys;ao.noConflict=t=>(t&&window.hotkeys===ao&&(window.hotkeys=e),ao),window.hotkeys=ao}class Y1 extends R.Component{constructor(t){super(t),this.isKeyDown=!1,this.handle=void 0,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.handleKeyUpEvent=this.handleKeyUpEvent.bind(this),this.handle={}}componentDidMount(){var{filter:t,splitKey:n}=this.props;t&&(ao.filter=t),ao.unbind(this.props.keyName),ao(this.props.keyName,{splitKey:n},this.onKeyDown),document&&document.body.addEventListener("keyup",this.handleKeyUpEvent)}componentWillUnmount(){ao.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document&&document.body.removeEventListener("keyup",this.handleKeyUpEvent)}onKeyUp(t,n){var{onKeyUp:r,disabled:o}=this.props;!o&&r&&r(n.shortcut,t,n)}onKeyDown(t,n){var{onKeyDown:r,allowRepeat:o,disabled:i}=this.props;this.isKeyDown&&!o||(this.isKeyDown=!0,this.handle=n,!i&&r&&r(n.shortcut,t,n))}handleKeyUpEvent(t){this.isKeyDown&&(this.isKeyDown=!1,!(this.props.keyName&&this.props.keyName.indexOf(this.handle.shortcut)<0)&&(this.onKeyUp(t,this.handle),this.handle={}))}render(){return this.props.children||null}}Y1.defaultProps={filter(e){var t=e.target||e.srcElement,n=t.tagName;return!(t.isContentEditable||n==="INPUT"||n==="SELECT"||n==="TEXTAREA")}};Y1.propTypes={keyName:U3.string,filter:U3.func,onKeyDown:U3.func,onKeyUp:U3.func,disabled:U3.bool,splitKey:U3.string};const GM=["shift","alt","meta","mod","ctrl","control"],bae={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function e9(e){return(bae[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function YM(e){return GM.includes(e)}function Ud(e,t=","){return e.toLowerCase().split(t)}function $d(e,t="+",n=">",r=!1,o){let i=[],a=!1;e.includes(n)?(a=!0,i=e.toLocaleLowerCase().split(n).map(u=>e9(u))):i=e.toLocaleLowerCase().split(t).map(u=>e9(u));const s={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},c=i.filter(u=>!GM.includes(u));return{...s,keys:c,description:o,isSequence:a}}typeof document<"u"&&(document.addEventListener("keydown",e=>{e.code!==void 0&&qM([e9(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&XM([e9(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{aa.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{aa.clear()},0)}));const aa=new Set;function Hg(e){return Array.isArray(e)}function yae(e,t=","){return(Hg(e)?e:e.split(t)).every(n=>aa.has(n.trim().toLowerCase()))}function qM(e){const t=Array.isArray(e)?e:[e];aa.has("meta")&&aa.forEach(n=>!YM(n)&&aa.delete(n.toLowerCase())),t.forEach(n=>aa.add(n.toLowerCase()))}function XM(e){const t=Array.isArray(e)?e:[e];e==="meta"?aa.clear():t.forEach(n=>aa.delete(n.toLowerCase()))}function wae(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function xae(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function _ae(e){return JM(e,["input","textarea","select"])}function JM(e,t=!1){const{target:n,composed:r}=e;let o;return Eae(n)&&r?o=e.composedPath()[0]&&e.composedPath()[0].tagName:o=n&&n.tagName,Hg(t)?!!(o&&t&&t.some(i=>i.toLowerCase()===o.toLowerCase())):!!(o&&t&&t)}function Eae(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function Sae(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(n=>t.includes(n))||e.includes("*"):!0}const Mae=(e,t,n=!1)=>{const{alt:r,meta:o,mod:i,shift:a,ctrl:s,keys:c,useKey:u}=t,{code:d,key:h,ctrlKey:C,metaKey:m,shiftKey:A,altKey:v}=e,p=e9(d);if(u&&(c==null?void 0:c.length)===1&&c.includes(h))return!0;if(!(c!=null&&c.includes(p))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(p))return!1;if(!n){if(r!==v&&p!=="alt"||a!==A&&p!=="shift")return!1;if(i){if(!m&&!C)return!1}else if(o!==m&&p!=="meta"&&p!=="os"||s!==C&&p!=="ctrl"&&p!=="control")return!1}return c&&c.length===1&&c.includes(p)?!0:c?yae(c):!c},Hae=R.createContext(void 0),Lae=()=>R.useContext(Hae);function eH(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&eH(e[r],t[r]),!0):e===t}const Bae=R.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),Oae=()=>R.useContext(Bae);function Rae(e){const t=R.useRef(void 0);return eH(t.current,e)||(t.current=e),t.current}const Qb=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Iae=typeof window<"u"?R.useLayoutEffect:R.useEffect;function Gb(e,t,n,r){const o=R.useRef(null),i=R.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,s=Hg(e)?e.join(a==null?void 0:a.delimiter):e,c=n instanceof Array?n:r instanceof Array?r:void 0,u=R.useCallback(t,c??[]),d=R.useRef(u);c?d.current=u:d.current=t;const h=Rae(a),{activeScopes:C}=Oae(),m=Lae();return Iae(()=>{if((h==null?void 0:h.enabled)===!1||!Sae(C,h==null?void 0:h.scopes))return;let A=[],v;const p=(E,S=!1)=>{var M;if(!(_ae(E)&&!JM(E,h==null?void 0:h.enableOnFormTags))){if(o.current!==null){const H=o.current.getRootNode();if((H instanceof Document||H instanceof ShadowRoot)&&H.activeElement!==o.current&&!o.current.contains(H.activeElement)){Qb(E);return}}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ud(s,h==null?void 0:h.delimiter).forEach(H=>{var O,k,D,N;if(H.includes((h==null?void 0:h.splitKey)??"+")&&H.includes((h==null?void 0:h.sequenceSplitKey)??">")){console.warn(`Hotkey ${H} contains both ${(h==null?void 0:h.splitKey)??"+"} and ${(h==null?void 0:h.sequenceSplitKey)??">"} which is not supported.`);return}const P=$d(H,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description);if(P.isSequence){v=setTimeout(()=>{A=[]},(h==null?void 0:h.sequenceTimeoutMs)??1e3);const F=P.useKey?E.key:e9(E.code);if(YM(F.toLowerCase()))return;A.push(F);const j=(O=P.keys)==null?void 0:O[A.length-1];if(F!==j){A=[],v&&clearTimeout(v);return}A.length===((k=P.keys)==null?void 0:k.length)&&(d.current(E,P),v&&clearTimeout(v),A=[])}else if(Mae(E,P,h==null?void 0:h.ignoreModifiers)||(D=P.keys)!=null&&D.includes("*")){if((N=h==null?void 0:h.ignoreEventWhen)!=null&&N.call(h,E)||S&&i.current)return;if(wae(E,P,h==null?void 0:h.preventDefault),!xae(E,P,h==null?void 0:h.enabled)){Qb(E);return}d.current(E,P),S||(i.current=!0)}})}},_=E=>{E.code!==void 0&&(qM(e9(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&p(E))},w=E=>{E.code!==void 0&&(XM(e9(E.code)),i.current=!1,h!=null&&h.keyup&&p(E,!0))},x=o.current||(a==null?void 0:a.document)||document;return x.addEventListener("keyup",w,a==null?void 0:a.eventListenerOptions),x.addEventListener("keydown",_,a==null?void 0:a.eventListenerOptions),m&&Ud(s,h==null?void 0:h.delimiter).forEach(E=>m.addHotkey($d(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),()=>{x.removeEventListener("keyup",w,a==null?void 0:a.eventListenerOptions),x.removeEventListener("keydown",_,a==null?void 0:a.eventListenerOptions),m&&Ud(s,h==null?void 0:h.delimiter).forEach(E=>m.removeHotkey($d(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),A=[],v&&clearTimeout(v)}},[s,h,C]),o}const kae="_table_q0jcp_1",Dae="_table__header_q0jcp_18",Pae="_table__header__th_q0jcp_24",Nae="_table__row_q0jcp_38",Tae="_table__row__row_selected_q0jcp_44",Fae="_table__row__td_q0jcp_47",Vae="_clickable_q0jcp_68",jae="_loadMoreButton_q0jcp_73",zae="_loadMoreButtonDiv_q0jcp_78",Zae="_table_container_q0jcp_84",Uae="_scrollable_table_q0jcp_92",$ae="_pagination_container_q0jcp_104",Kae="_pagination_btn_q0jcp_113",Wae="_active_q0jcp_130",Qae="_pagination_dots_q0jcp_135",Gae="_pagination_input_q0jcp_140",Yae="_nextPrevArrow_q0jcp_165",qae="_pagination_left_q0jcp_179",Xae="_pagination_right_q0jcp_191",Jae="_pagination_loading_q0jcp_204",p2={table:kae,table__header:Dae,table__header__th:Pae,table__row:Nae,table__row__row_selected:Tae,table__row__td:Fae,clickable:Vae,loadMoreButton:jae,loadMoreButtonDiv:zae,table_container:Zae,scrollable_table:Uae,pagination_container:$ae,pagination_btn:Kae,active:Wae,pagination_dots:Qae,pagination_input:Gae,nextPrevArrow:Yae,pagination_left:qae,pagination_right:Xae,pagination_loading:Jae},tH=({children:e,disableOverflowY:t=!1,tableClass:n="",disableFixHeight:r,isPagination:o=!0})=>Z.jsx("div",{className:qn(p2.table_container,n),style:{overflowY:t?"unset":"auto",height:r?"unset":o?"70vh":"78vh",maxHeight:o?"70vh":"85vh"},children:Z.jsx("table",{id:"resizeMe",className:qn(p2.table,p2.scrollable_table),children:e})}),nH=({children:e})=>Z.jsx("tbody",{className:p2.table__body,children:e}),Lg=({children:e,className:t="",title:n="",onclick:r})=>Z.jsx("tr",{className:qn(p2.table__row,{[t]:!!t}),title:n,...r&&{onClick:r},children:e}),G4=({children:e,className:t="",extraClass:n="",title:r="",...o})=>{const i=qn(p2.table__row__td,t,(n==null?void 0:n.length)>0&&p2.clickable);return Z.jsx("td",{className:i,title:r,children:Z.jsx("span",{...o,style:{textAlign:"left"},children:e})})},rH=({children:e,className:t="",title:n=""})=>Z.jsx("th",{className:qn(p2.table__header__th,{[t]:t}),title:n,children:Z.jsxs("span",{children:[e," "]})}),oH=({children:e,className:t=""})=>Z.jsx("thead",{className:qn(p2.table__header,{[t]:!!t}),children:e}),iH=({list:e,headerClass:t="",type:n=""})=>(console.log("AWIHEADER List,",e),Z.jsx(oH,{className:t,children:Z.jsx(Lg,{children:e.map(r=>Z.jsx(rH,{children:r},r))},`row_${n}`)},n)),Ch=({toggleSelectAnnotation:e=()=>{console.log("Not available")},handleLeftKeyDown:t=()=>{console.log("Not available")},handleRightKeyDown:n=()=>{console.log("Not available")},handleUpKeyDown:r=()=>{console.log("Not available")},handleDownKeyDown:o=()=>{console.log("Not available")},handleZoomInClick:i=()=>{console.log("Not available")},handleZoomOutClick:a=()=>{console.log("Not available")},handleCompleteAnnotation:s=()=>{console.log("Not available")},undoAnnotationPoint:c=()=>{console.log("Not available")},reLoadAndReDrawAnnotations:u=()=>{console.log("Not available")},togglePagination:d=()=>{console.log("Not available")},toggleFullscreen:h=()=>{console.log("Not available")},switchToAutoAnnotations:C=()=>{console.log("Not available")},openShortCutRequestDetails:m=()=>{console.log("Not available")},handleRecentAnnotatedVerifiedImages:A=()=>{console.log("Not available")},handleSendToSamFunctionPrompt:v=()=>{console.log("Not available")},samAPIactive:p,request:_,switchToEditMode:w=()=>{console.log("Not available")},switchToCreateMode:x=()=>{console.log("Not available")},goToNextImage:E=()=>{console.log("Not available")},goToPreviousImage:S=()=>{console.log("Not available")},loggedUser:M,handleGoToPendingAnnotations:H=()=>{console.log("Not available")},handleCopyByCtrlC:O=()=>{console.log("Not available")},handlePasteAnnotationsByControlV:k=()=>{console.log("Not available")},openShortCutKeyModal:D,setOpenShortCutKeyModal:N=()=>{console.log("Not available")},setIsAltViaToolPressHandle:P=()=>{console.log("Not available")},isCarousel:F=!1,selectedTool:j="",setCrossHairHandle:V=()=>{console.log("Not available")},controlMinusHotkey:T=()=>{console.log("Not available")},controlPlusHotkey:$=()=>{console.log("Not available")}})=>{const K=Br.isSAMAllowed(_==null?void 0:_.awi_annotation_type,_==null?void 0:_.awi_request_for)&&!p,q=["awi_annotator","awi_verifier","awi_developer"].includes(M.userObj.awi_level),W=()=>{const J=[{action:"next image",key:"next_image",displayKey:"d",title:"Move to the next image",isClose:!0},{action:"previous image",key:"prev_image",displayKey:"a",title:"Move to the previous image",isClose:!0}],Y=[{action:"Go to pending annotation",key:"pending_annotations",displayKey:"p",title:"Go to pending annotation",isClose:!0}],ee=[{action:"Switch to edit",key:"edit_mode",displayKey:"e",title:"Switch to edit mode",isClose:!0},{action:"Switch to create",key:"create_mode",displayKey:"q",title:"Switch to create mode",isClose:!0},{action:"Switch to pan mode",key:"pan_mode",displayKey:"m",title:"Switch to pan mode",isClose:!0},{action:"Show cross hair",key:"cross_hair",displayKey:"w",title:"Show cross hair",isClose:!0},{action:"Copy selected annotation",key:"copy",displayKey:"Ctrl + C",title:"Copy selected annotation",isClose:!1},{action:"Paste all annotations",key:"paste",displayKey:"Ctrl + V",title:"Paste all copied annotations",isClose:!1},{action:"Forward Toggle Annotations",key:"select_forward",displayKey:"T",title:"Forward Toggle annotations visibility, Long press to get next",isClose:!1},{action:"Backward Toggle Annotations",key:"select_backward",displayKey:"U",title:"Backward Toggle annotations visibility, Long press to get previous",isClose:!1},{action:"Go to last updated annotations",key:"select_last_update",displayKey:"L",title:"Go to last updated annotations",isClose:!0},{action:"Undo Annotation point / Last State",key:"undo",displayKey:"Ctrl + Z",title:"Undo last annotation action",isClose:!0},{action:"Complete Annotation / Generate Point Annotations",key:"complete",displayKey:"Enter",title:"Finalize or generate point annotations",isClose:!0},{action:"Switch to Auto Annotations",key:"auto_annotations",displayKey:"S",title:"Enable automatic annotation mode",isClose:!0},{action:"AI prompt popup",key:"send_to_sam",displayKey:"X (if AI is enabled)",title:"AI prompt popup",isClose:!0},{action:"Get request information",key:"open_shortcut_details",displayKey:"V",title:"View request-related information",isClose:!0},{action:"Refetch Annotations",key:"reload",displayKey:"R",title:"Reload annotations",isClose:!0},{action:"Toggle Image Pagination",key:"toggle_pagination",displayKey:"H",title:"Show or hide image pagination",isClose:!1},{action:"Zoom In",key:"zoom_in",displayKey:"I",title:"Zoom into the image, long press for more zoom in",isClose:!1},{action:"Zoom Out",key:"zoom_out",displayKey:"O",title:"Zoom out of the image, long press for more zoom out",isClose:!1},{action:"Moving Zoomed images",key:"",displayKey:"Alt + Mouse Move",title:"Move the zoomed-in image",isClose:!1},{action:"View Recently Annotated Images",key:"recent_verified",displayKey:"Alt + R",title:"Show recently annotated images",isClose:!0},{action:"Delete Annotation",key:"",displayKey:"Ctrl + Delete",title:"Delete the selected annotation",isClose:!1},{action:"Move image to left",key:"move_left",displayKey:"←",title:"Move image to left",isClose:!1},{action:"Move image to right",key:"move_right",displayKey:"→",title:"Move image to right",isClose:!1},{action:"Move image to top",key:"move_up",displayKey:"↑",title:"Move image to top",isClose:!1},{action:"Move image to bottom",key:"move_down",displayKey:"↓",title:"Move image to bottom",isClose:!1},{action:"Enter/Exit Fullscreen",key:"fullscreen",displayKey:"F",title:"Enter/Exit Fullscreen",isClose:!1}];return M.userObj.awi_level==="awi_verifier"?[...J,...ee,...Y]:M.userObj.awi_level==="awi_supervisor"?J:[...J,...ee]},U=J=>{switch(J){case"select_forward":return e("forward");case"select_backward":return e("backward");case"select_last_update":return e("last_update");case"move_left":return t();case"move_right":return n();case"move_up":return r();case"move_down":return o();case"zoom_in":return i();case"zoom_out":return a();case"complete":return s();case"undo":return c();case"reload":return u();case"toggle_pagination":return d(Y=>!Y);case"fullscreen":return h();case"auto_annotations":return C();case"open_shortcut_details":return m();case"recent_verified":return A();case"send_to_sam":if(K)return j!="SAM"&&C(),v();W1.error("SAM is not allowed");return;case"edit_mode":if(w)return w();break;case"create_mode":if(x)return x();break;case"next_image":if(E)return E();break;case"prev_image":if(S)return S();break;case"pending_annotations":if(H)return H();break;case"copy":if(O)return O();break;case"paste":if(k)return k();break;case"pan_mode":P();break;case"cross_hair":V&&typeof V=="function"&&V();break;default:console.warn(`Unhandled hotkey action: ${J}`)}},G=(J,Y)=>{U(J),Y&&N(!1)};return Gb("ctrl+=",J=>{J.preventDefault(),$()}),Gb("ctrl+-, ctrl+subtract, ctrl+minus",J=>{J.preventDefault(),T()}),Z.jsxs(Z.Fragment,{children:[Z.jsx(Y1,{allowRepeat:!0,keyName:"t",onKeyDown:()=>U("select_forward")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"u",onKeyDown:()=>U("select_backward")}),Z.jsx(Y1,{allowRepeat:!1,keyName:"l",onKeyDown:()=>U("select_last_update")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"left",onKeyDown:()=>U("move_left")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"right",onKeyDown:()=>U("move_right")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"up",onKeyDown:()=>U("move_up")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"down",onKeyDown:()=>U("move_down")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"i",onKeyDown:()=>U("zoom_in")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"o",onKeyDown:()=>U("zoom_out")}),Z.jsx(Y1,{keyName:"enter",onKeyDown:()=>U("complete")}),Z.jsx(Y1,{keyName:"ctrl+z",onKeyDown:()=>U("undo")}),Z.jsx(Y1,{keyName:"r",onKeyDown:()=>U("reload")}),Z.jsx(Y1,{keyName:"h",onKeyDown:()=>U("toggle_pagination")}),Z.jsx(Y1,{keyName:"f",onKeyDown:()=>U("fullscreen")}),Z.jsx(Y1,{keyName:"s",onKeyDown:()=>U("auto_annotations")}),Z.jsx(Y1,{keyName:"v",onKeyDown:()=>U("open_shortcut_details")}),Z.jsx(Y1,{keyName:"alt+r",onKeyDown:()=>U("recent_verified")}),K&&Z.jsx(Y1,{keyName:"x",onKeyDown:()=>U("send_to_sam")}),q&&Z.jsxs(Z.Fragment,{children:[Z.jsx(Y1,{keyName:"e",onKeyDown:()=>U("edit_mode")}),Z.jsx(Y1,{keyName:"q",onKeyDown:()=>U("create_mode")})]}),Z.jsx(Y1,{keyName:"d",onKeyDown:()=>U("next_image")}),Z.jsx(Y1,{keyName:"a",onKeyDown:()=>U("prev_image")}),M.userObj.awi_level==="awi_verifier"&&Z.jsx(Y1,{keyName:"p",onKeyDown:()=>U("pending_annotations")}),Z.jsx(Y1,{keyName:"ctrl+c",onKeyDown:()=>U("copy")}),Z.jsx(Y1,{keyName:"ctrl+v",onKeyDown:()=>U("paste")}),Z.jsx(Y1,{keyName:"m",onKeyDown:()=>U("pan_mode")}),Z.jsx(Y1,{keyName:"w",onKeyDown:()=>U("cross_hair")}),D&&!F&&Z.jsx(Z.Fragment,{children:Z.jsxs(v7,{popupPosition:"right",isBackdrop:!0,backdropAction:()=>N(!1),className:"noPadding",children:[Z.jsx(y7,{title:"Shortcut keys",onClose:()=>N(!1)}),Z.jsx(b7,{children:Z.jsxs(tH,{children:[Z.jsx(iH,{list:["S.NO.","Command","Key Binding","Action"]},"short_cut_keys"),Z.jsx(nH,{children:(W()||[]).map((J,Y)=>{var ee;return Z.jsxs(Lg,{title:J.title,children:[Z.jsx(G4,{children:Y+1}),Z.jsx(G4,{children:J.action}),Z.jsx(G4,{children:Z.jsxs("div",{className:"shortcutKey",children:[" ",J.displayKey," "]})}),Z.jsx(G4,{children:((ee=J==null?void 0:J.key)==null?void 0:ee.length)>0&&Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:()=>G(J.key,J.isClose),children:"Press"})})]})})})]})}),Z.jsx(x7,{})]})})]})},e9e=10,t9e=12,Yb=e=>{switch(e){case"rectangle":return X1.rectangleIcon.IconComponent;case"circle":return X1.circleIcon.IconComponent;case"polygon":return X1.polygonIcon.IconComponent;case"dot":return X1.dotIcon.IconComponent;default:return X1.rectangleIcon.IconComponent}},Tc=({isEditing:e,handleSelectTool:t=()=>{console.log("handleSelectTool function is not provided")},handleSAMToggle:n=()=>{console.log("handleSAMToggle function is not provided")},hasAnnotation:r=!1,currentSelectedSAMTool:o="Normal",handleCopyAnnotations:i,setOpenRequestDetails:a=()=>{console.log("setOpenRequestDetails function is not provided")},openRequestDetails:s,show_guidelines_first:c,handleZoomInClick:u,zoomProperties:d,handleReset:h,handleZoomOutClick:C,handleCompleteAnnotation:m,toggleFullscreen:A,selectAnnotationId:v,selectedAnnotationInfo:p,undoLastStateAnnotation:_,usingSamFunction:w,samAPIactive:x,handleSendToSamFunction:E,coordinates:S,handleSendToSamFunctionPrompt:M,reLoadAndReDrawAnnotations:H,showGuidelinesFirst:O,isMobile:k,toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,undoAnnotationPoint:V,togglePagination:T,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,showPagination:Y=!1,loggedUser:ee,isControlViaToolPress:re,isAltViaToolPress:ue,setIsControlViaToolPress:se,setIsAltViaToolPress:_e,isCarousel:xe=!1,allowedToCopyPreview:Ae,classColorMapToSend:he,request:le,parentReqData:ae,RequestInfoModal:ye,setCrossHair:Re,isCrossHair:Ie,annotationViewType:Ce="atom",REACT_APP_SAM_ENABLED:et="no",controlPlusHotkey:fe,controlMinusHotkey:ne,Carousel:pe})=>{var Gt,An,bn,Qt,Ot,Ht,_t,Zt,Cn,mt;(a==null||typeof a!="function")&&(a=pt=>{console.log("setOpenRequestDetails function is not provided",pt)}),t||(t=pt=>{console.log("handleSelectTool function is not provided",pt)}),n||(n=pt=>{console.log("handleSAMToggle function is not provided",pt)});const[Ee,Le]=R.useState(!1),[Be,je]=R.useState(!1),[We,lt]=R.useState(""),[tt,Qe]=R.useState(!1),[Fe,ot]=R.useState(o),Ue=()=>{lt(""),a(!1),je(!1),Le(!0)},Ve=(pt="annotated")=>{lt(pt),a(!1),Le(!1),je(!0)},Ge=()=>{le!=null&&le.total_verified_images_count?Ve("verified"):Ve("annotated")},dt=pt=>{t("annotate"),n(pt),ot(pt)},qe=pt=>{typeof t=="function"&&t("edit"),typeof n=="function"&&n("Normal"),typeof ot=="function"&&ot("Normal")},ft=()=>{if(Fe=="Normal"){if(!Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for))return;dt("SAM")}else dt("Normal")},Pt=()=>{O&&s||typeof a=="function"&&a(pt=>!pt)};R.useEffect(()=>{o&&ot(o)},[o]);const Wt=pt=>{i&&typeof i=="function"&&i(pt,!0)},an=()=>{_e(!ue)},Dn=()=>{Re(!Ie)};return Ae&&xe?null:xe?Z.jsx(Z.Fragment,{children:Z.jsx(Ch,{toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:C,handleCompleteAnnotation:m,undoAnnotationPoint:V,reLoadAndReDrawAnnotations:H,togglePagination:T,toggleFullscreen:A,switchToAutoAnnotations:ft,openShortCutRequestDetails:Pt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:x,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:an,isCarousel:xe,selectedTool:Fe,setCrossHairHandle:Dn,loggedUser:ee,controlMinusHotkey:ne,controlPlusHotkey:fe})}):Z.jsxs("div",{style:{...k||Ce==="library"?{width:"100%",height:"40px"}:{height:"100%",width:"100%",maxHeight:"100%"},overflow:"auto"},children:[Z.jsx(Z.Fragment,{children:Z.jsx(Ch,{toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:C,handleCompleteAnnotation:m,undoAnnotationPoint:V,reLoadAndReDrawAnnotations:H,togglePagination:T,toggleFullscreen:A,switchToAutoAnnotations:ft,openShortCutRequestDetails:Pt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:x,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:an,selectedTool:Fe,setCrossHairHandle:Dn,loggedUser:ee,isCarousel:xe,controlMinusHotkey:ne,controlPlusHotkey:fe})}),Z.jsxs("div",{className:Sn.annotation__tool__icons,style:{display:"flex",justifyContent:k?"center":"space-between",flexDirection:k?"row":"column",backgroundColor:"#fff",width:k?"100%":"auto",...k||Ce=="library"?{maxWidth:"100%",overflowX:"auto",gap:"20px"}:{height:"100%"}},children:[Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[(le==null?void 0:le.awi_request_for)!="attributes"?Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:!e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>{typeof t=="function"&&t("annotate")},title:e?"Create to change from edit to create mode":"Create to start create mode",children:(le==null?void 0:le.awi_annotation_type)&&((Gt=le==null?void 0:le.awi_annotation_type)==null?void 0:Gt.length)>0&&Z.jsx("img",{src:Yb(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}):Z.jsx("div",{className:Sn.annotationIconDiv,children:(le==null?void 0:le.awi_annotation_type)&&((An=le==null?void 0:le.awi_annotation_type)==null?void 0:An.length)>0&&Z.jsx("img",{src:Yb(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}),r&&Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>qe(),title:"Edit - keyboard(E)",children:Z.jsx("img",{src:X1.editIcon.IconComponent,alt:"Edit",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:re},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>se(!re),title:"Control",children:Z.jsx("img",{src:X1.controlIcon.IconComponent,alt:"Control",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:ue},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>_e(!ue),title:"Alt press / Panning mode",children:Z.jsx("img",{src:X1.moveIcon.IconComponent,alt:"Alt",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:Ie},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>Re(!Ie),title:"Cross Hair",children:Z.jsx("img",{src:X1.crosshairIcon.IconComponent,alt:"Cross Hair",className:Sn.annotationIcon})}),!e&&(le==null?void 0:le.awi_annotation_type)==="polygon"&&(le==null?void 0:le.awi_request_for)!="attributes"&&S.length>2?Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:m,title:"Click to complete your polygon annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.filledTickIcon.IconComponent,className:Sn.annotationIcon})})}):Z.jsx(Z.Fragment,{children:(le==null?void 0:le.awi_annotation_type)==="polygon"&&Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{title:"Works for create mode with minimum 3 coordinates",className:Sn.annotationIconDiv,style:{cursor:"not-allowed !important",opacity:"0.5"},children:Z.jsx("img",{src:X1.filledTickIcon.IconComponent,className:qn(Sn.annotationIcon,"not-allowed-pointer")})})})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsxs("div",{onClick:((bn=p==null?void 0:p.past_coords)==null?void 0:bn.length)>0&&e&&v!=="-1"?_:void 0,title:((Qt=p==null?void 0:p.past_coords)==null?void 0:Qt.length)>0&&e&&v!=="-1"?"Click to revert annotation":"No undo available",style:{width:"1.8rem",height:"1.8rem",position:"relative",cursor:((Ot=p==null?void 0:p.past_coords)==null?void 0:Ot.length)>0&&e&&v!=="-1"?"pointer":"not-allowed",opacity:((Ht=p==null?void 0:p.past_coords)==null?void 0:Ht.length)>0&&e&&v!=="-1"?1:.5,pointerEvents:((_t=p==null?void 0:p.past_coords)==null?void 0:_t.length)>0&&e&&v!=="-1"?"auto":"none"},children:[Z.jsx("img",{src:X1.undoAnnotationIcon.IconComponent,alt:"Undo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"0.25rem"}}),((Zt=p==null?void 0:p.past_coords)==null?void 0:Zt.length)>0&&e&&v!=="-1"&&Z.jsx("div",{className:Sn.undoAnnotationCount,children:p.past_coords.length})]})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:u,src:X1.zoomInIcon.IconComponent,className:`cursor-pointer ${d.scale===t9e?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom in - Keyboard(I)"})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("div",{onClick:h,title:`Click to Reset Zoom ${d.scale.toFixed(1)} to default`,className:Sn.annotationIcon,style:{fontSize:"12px",justifyContent:"center",display:"flex"},children:d.scale.toFixed(1)})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:C,src:X1.zoomOutIcon.IconComponent,className:`cursor-pointer ${d.scale===1?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom out - Keyboard(O)"})}),Z.jsx("div",{onClick:()=>A(),className:Sn.annotationIconDiv,style:{display:"flex",alignItems:"center",justifyContent:"center"},title:"Toggle Fullscreen - Keyboard(F)",id:"toggle_full_screen",children:Z.jsx("img",{src:X1.toggleFullscreenIcon.IconComponent,className:Sn.annotationIcon})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[et=="yes"&&Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsx("div",{style:{display:"flex",alignItems:"center"},title:"AI tools - keyboard(S)",children:Z.jsxs("label",{className:Sn.switch,style:{marginLeft:"4px",width:"30px important"},children:[Z.jsx("input",{type:"checkbox",checked:Fe==="SAM",onChange:()=>{dt(Fe==="SAM"?"Normal":"SAM")}}),Z.jsx("span",{className:qn(Sn.slider,Sn.round)})]})}),Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsxs("div",{className:qn({"disabled-class":!w}),style:{justifyContent:"space-between",display:"flex",flexDirection:k?"row":"column",gap:"15px"},children:[(le==null?void 0:le.awi_annotation_type)&&(le==null?void 0:le.awi_annotation_type)!="dot"&&Z.jsx("div",{onClick:()=>{!x&&(S!=null&&S.length)&&E()},className:qn({"disabled-class":!w||x||!(S!=null&&S.length)},Sn.annotationIconDiv,"cursor-pointer"),style:{pointerEvents:x||!w?"none":"auto",opacity:x||!w?.5:1},children:Z.jsx("img",{src:X1.pointAnnotationIcon.IconComponent,title:"Mark some points and then click here and get the power of AI auto annotation",className:Sn.annotationIcon})}),Z.jsx("div",{onClick:x?void 0:M,style:{pointerEvents:x||!w?"none":"auto",opacity:x||!w?.5:1},title:"Give your prompt and get the power of AI auto annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.promptAnnotationIcon.IconComponent,title:"auto annotation prompt - keyboard(X)",className:Sn.annotationIcon})})]}),Z.jsx("div",{onClick:H,title:"Click to refetch saved annotations, hard reset",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.refetchAnnotationIcon.IconComponent,title:"Refetch annotations (Hard Reset) - keyboard(R)",className:Sn.annotationIcon})}),Z.jsx("div",{style:{width:"53%",height:"2px",backgroundColor:"#e4e0e6",margin:"8px auto"}})]}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:()=>{typeof a=="function"&&a(pt=>!pt)},title:"View details - keyboard(V)",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.guidelinesIcon.IconComponent,alt:"info",style:{height:"30px !important",width:"30px !important",cursor:"pointer"}})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{children:Z.jsx("img",{src:X1.keyboardShortcutsIcon.IconComponent,title:"See short-cut keys",className:"cursor-pointer",width:"30px",onClick:()=>Qe(pt=>!pt)})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:T,children:Z.jsx("img",{src:X1.transparentBlackIcon.IconComponent,style:{height:"24px",width:" 24px",cursor:"pointer"},alt:"Previous",title:Y?"Hide Pagination":"Show Pagination"})})})]}),s&&ye&&Z.jsx(ye,{request:le,handleReferenceImageClick:Ue,handleRecentAnnotatedImages:Ve,show_guidelines_first:c,setOpenRequestDetails:a,classColorMapToSend:he}),s&&ye&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{c||typeof a=="function"&&a(!1)}}),s&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{O||typeof a=="function"&&a(!1)}}),pe&&Ee&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Le(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),imageKeys:((Cn=ae==null?void 0:ae.awi_reference_images)==null?void 0:Cn.awi_ids)||((mt=le==null?void 0:le.awi_reference_images)==null?void 0:mt.awi_ids)||[],awi_reference_image:!0,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Wt})}),Ee&&Z.jsx("div",{className:qn(Sn.backdrop,Sn.backdrop__transparent),onClick:()=>Le(!1)}),pe&&Be&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>je(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),awi_reference_image:!1,contentAnnotationType:We||"annotated",primaryLimit:e9e,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Wt})})]})},n9e="_canvas_145op_1",r9e="_canvasContainer_145op_9",o9e="_canvasSubContainer_145op_18",C6={canvas:n9e,canvasContainer:r9e,canvasSubContainer:o9e},Fc=({canvasDimensions:e,zoomProperties:t,isEditing:n,canvasRef:r,bgCanvasRef:o,overlayCanvasRef:i,handleMouseDown:a,handleMouseUp:s,handleMouseMove:c,handleMouseMoveOut:u,handleOnMouseLeave:d,handleWheel:h,handleTouchStart:C,handleTouchMove:m,handleTouchEnd:A,handleTouchCancel:v})=>Z.jsxs("div",{className:C6.canvasSubContainer,style:{display:"flex",flexDirection:"row",width:e.width,height:e.height,position:"relative"},children:[Z.jsx("canvas",{ref:o,className:C6.bgCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,zIndex:0,pointerEvents:"none"}}),Z.jsx("canvas",{ref:r,className:C6.canvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,cursor:n?"default":"crosshair",transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`},onMouseDown:a,onMouseUp:s,onMouseMove:c,onMouseOut:u,onMouseLeave:d,onWheel:h,onTouchStart:C,onTouchMove:m,onTouchEnd:A,onTouchCancel:v}),Z.jsx("canvas",{ref:i,className:C6.overlayCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,pointerEvents:"none",zIndex:2,transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`}})]}),i9e=1e-5,a9e=.99999,s9e=.001,l9e=.005,B8=(e,t)=>e/(t||1),aH=(e,t,n,r)=>Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2)),gh=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),c9e=e=>{let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach(({x:i,y:a})=>{t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i),o=Math.max(o,a)}),{minX:t,minY:n,maxX:r,maxY:o}},mh=(e,t,n=0)=>{let r=0;for(let o=0;o<(t==null?void 0:t.length)-1;o++){const i=t[o],a=t[o+1];i.y<=e.y+n?a.y>e.y+n&&gh(i,a,e)>0&&r++:a.y<=e.y-n&&gh(i,a,e)<0&&r--}return r},Bg=e=>(e==null?void 0:e.length)<2?0:Math.sqrt(Math.pow(Math.abs(e[0].x-e[1].x),2)+Math.pow(Math.abs(e[0].y-e[1].y),2));function u9e(e,t,n=0){const r=Math.min(...t.map(u=>u.x)),o=Math.max(...t.map(u=>u.x)),i=Math.min(...t.map(u=>u.y)),a=Math.max(...t.map(u=>u.y)),{x:s,y:c}=e;return s>=r-n&&s<=o+n&&c>=i-n&&c<=a+n}const d9e=(e,t,n,r,o,i,a=1)=>{if(!(n!=null&&n.length))return!1;let s,c,u,d,h=!1;switch(i==null?void 0:i.awi_annotation_type){case"rectangle":h=u9e({x:e,y:t},n,r);break;case"polygon":h=mh({x:e,y:t},n,r)!==0;break;case"circle":s=Bg(n)/2,c=(n[0].x+r+(n[1].x-o))/2,u=(n[0].y+n[1].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;case"dot":s=B8(.015,a),c=(n[0].x+r+(n[0].x-o))/2,u=(n[0].y+n[0].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;default:h=mh({x:e,y:t},n,r)!==0}return h},f9e=e=>!(!e||e.x>1||e.x<0||e.y1>1||e.y<0),h9e=e=>{if((e==null?void 0:e.length)<3)return!1;for(let t=0;t<e.length;t++)if(!f9e(e[t]))return!1;return!0},C9e=(e,t,n=!1,r=1)=>{var a,s,c,u;const o=e==null?void 0:e.awi_annotation_type;let i=!1;switch(o){case"rectangle":const d=B8(s9e,r);(t==null?void 0:t.length)>3&&Math.abs(((a=t[0])==null?void 0:a.x)-((s=t[1])==null?void 0:s.x))>d&&Math.abs(((c=t[1])==null?void 0:c.y)-((u=t[3])==null?void 0:u.y))>d&&(i=!0);break;case"circle":const h=B8(l9e,r);Bg(t)>h&&(i=!0);break;case"polygon":i=h9e(t);break;case"dot":i=!0;break;default:n&&(i=!0);break}return i},sH=(e,t,n,r,o,i)=>{const a=e-n,s=t-r,c=o-n,u=i-r,d=a*c+s*u,h=c*c+u*u,C=h!==0?d/h:-1;let m,A;C<0?(m=n,A=r):C>1?(m=o,A=i):(m=n+C*c,A=r+C*u);const v=e-m,p=t-A;return Math.sqrt(v*v+p*p)},g9e=(e,t,n)=>{let r=1/0,o=-1;for(let i=0;i<(e==null?void 0:e.length);i++){const a=(i+1)%e.length,{x:s,y:c}=e[i],{x:u,y:d}=e[a],h=sH(t,n,s,c,u,d);h<r&&(r=h,o=a)}return{insertIndex:o,minDistance:r}},lH=(e,t)=>t===0?e:lH(t,e%t),m9e=(e,t,n,r)=>(e>0&&(e=0),Math.abs(e)>n&&(e=-1*n),Math.abs(t)>r&&(t=-1*r),t>0&&(t=0),{newXTransform:e,newYTransform:t}),p9e=function(e){console.log("getBoundingBox called");const t=Math.min(...e.map(i=>i.x)),n=Math.max(...e.map(i=>i.x)),r=Math.min(...e.map(i=>i.y)),o=Math.max(...e.map(i=>i.y));return[{x:t,y:r},{x:n,y:r},{x:n,y:o},{x:t,y:o}]};function A9e(e,t,n){return Math.min(n,Math.max(t,e))}function v9e(e,t=.05,n=null){const r=Math.min(...e.map(h=>h.x)),o=Math.max(...e.map(h=>h.x)),i=Math.min(...e.map(h=>h.y)),a=Math.max(...e.map(h=>h.y)),s=o-r,c=a-i;let u,d;if(n&&(n==null?void 0:n.x)>=0&&(n==null?void 0:n.y)>=0){const h=n.x,C=n.y;u=Math.max(-r,Math.min(1-o,h-(r+s/2))),d=Math.max(-i,Math.min(1-a,C-(i+c/2)))}else u=Math.max(-r,Math.min(1-o,(Math.random()*2-1)*t)),d=Math.max(-i,Math.min(1-a,(Math.random()*2-1)*t));return e.map(h=>({x:h.x+u,y:h.y+d}))}function b9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y));return cH([{x:t,y:r},{x:n,y:o}])}function y9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y)),i=(t+n)/2,a=(r+o)/2;return[{x:i,y:a}]}const Kd=(e,t)=>(e.x-t.x)**2+(e.y-t.y)**2,w9e=(e,t,n)=>{const r=Kd(t,n);if(r===0)return Kd(e,t);let o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;o=Math.max(0,Math.min(1,o));const i={x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)};return Kd(e,i)},x9e=(e,t)=>{let n=1/0;for(let r=0;r<(t==null?void 0:t.length);r++){const o=t[r],i=t[(r+1)%t.length],a=w9e(e,o,i);n=Math.min(n,a)}return Math.sqrt(n)},_9e=(e,t)=>{let n=1/0,r=-1;for(let o=0;o<(t==null?void 0:t.length);o++){const i=t[o],a=aH(e.x,e.y,i.x,i.y);if(a<n){const s=o%t.length;n=a,r=s}}return{minDistance:n,insertIndex:r}},ph=(e=0)=>(e<=0?e=i9e:e>=1&&(e=a9e),e),E9e=e=>e.map(n=>({x:ph(n.x),y:ph(n.y)})),S9e=e=>{const t=new Set,n=[];for(let r=0;r<e.length;r++){const o=`${e[r].x},${e[r].y}`;t.has(o)||(t.add(o),n.push(e[r]))}return n.length>0&&n.push(n[0]),n},M9e=e=>{let t=0;for(let n=0;n<e.length;n++)if(e[n].x<=0){t=t+1;continue}else if(e[n].y<=0){t=t+1;continue}else if(e[n].x>=1){t=t+1;continue}else if(e[n].y>=1){t=t+1;continue}return t};function H9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.min(...e.map(s=>s.y)),r=Math.max(...e.map(s=>s.x)),o=Math.max(...e.map(s=>s.y)),i=t<0?-t:r>1?1-r:0,a=n<0?-n:o>1?1-o:0;return e.map(({x:s,y:c})=>({x:s+i,y:c+a}))}const L9e=(e,t)=>{const n=(e.x+t.x)/2,r=(e.y+t.y)/2,o=Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)/2,i=Math.min(n,1-n),a=Math.min(r,1-r),s=Math.min(o,i,a),c=Math.atan2(t.y-e.y,t.x-e.x),u={x:n-s*Math.cos(c),y:r-s*Math.sin(c)},d={x:n+s*Math.cos(c),y:r+s*Math.sin(c)};return[u,d]},B9e=(e,t)=>{const n=(e[0].x+e[1].x)/2,r=t,i=Math.sqrt(Math.pow(e[1].x-e[0].x,2))/2;let a=0;return n-i<0?a=i-n:n+i>1&&(a=1-(n+i)),e[0].x+=a,e[1].x+=a,e[0].y=r,e[1].y=r,e},cH=e=>{e=L9e(e[0],e[1]);const t=(e[0].x+e[1].x)/2,n=(e[0].y+e[1].y)/2,o=Math.sqrt(Math.pow(e[1].x-e[0].x,2)+Math.pow(e[1].y-e[0].y,2))/2;let i=0;t-o<0?i=o-t:t+o>1&&(i=1-(t+o));let a=0;return n-o<0?a=o-n:n+o>1&&(a=1-(n+o)),e[0].x+=i,e[0].y+=a,e[1].x+=i,e[1].y+=a,B9e(e,n)},O9e=(e,t,n)=>{let{x:r,y:o}=uH(e.current,t);const i=n;r=Math.min(r,1),o=Math.min(o,1);const a=r-i.x,s=o-i.y;let c=[];return a===0||s===0?c=[{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y}]:a>0&&s>0?c=[{x:i.x,y:i.y},{x:r,y:i.y},{x:r,y:o},{x:i.x,y:o}]:a>0&&s<0?c=[{x:i.x,y:o},{x:r,y:o},{x:r,y:i.y},{x:i.x,y:i.y}]:a<0&&s>0?c=[{x:r,y:i.y},{x:i.x,y:i.y},{x:i.x,y:o},{x:r,y:o}]:c=[{x:r,y:o},{x:i.x,y:o},{x:i.x,y:i.y},{x:r,y:i.y}],c},uH=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)}},R9e=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect(),r={x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)};return r.x<=0&&(r.x=1e-4),r.y<=0&&(r.y=1e-4),r.x>=1&&(r.x=1-1e-4),r.y>=1&&(r.y=1-1e-4),r},On={gcd:lH,getDistance:aH,isLeft:gh,windingNumber:mh,getDiameter:Bg,checkPointInsidePolygon:d9e,isAnnotationCoordinatesValid:C9e,distanceToSegment:sH,findClosestSegment:g9e,transformCoordinatesCheck:m9e,getBoundingBox:p9e,translateCoordinatesWithFixedWidth:v9e,clampValue:A9e,calculateCircleFromCoordinates:b9e,calculateCentroid:y9e,minDistanceToPolygon:x9e,closestCoordinates:_9e,fineTuneCoordinates:E9e,zoomLevelValue:B8,createPolygonLoop:S9e,breakPointCount:M9e,getBoundingBoxValues:c9e,shiftPolygon:H9e,getPerfectPointValue:ph,adjustToCircle:cH,getMousePos:uH,getMousePosAbsolute:R9e,getUpdatedCoordinates:O9e},I9e=({imageUrl:e,showAnnotations:t=!1,createAnnotation:n,handleMultipleAnnotations:r,handleUpdateAnnotationCoordinates:o,content_id:i,request_id:a,className:s="",isEditing:c=!1,selectIndex:u="-1",handleSelectAnnotationIndex:d,handleSelectTool:h,showAnnotationType:C="all",loggedUser:m,isCarousel:A=!1,classColorMap:v=null,disableAnnotation:p=!1,SAMToggle:_,imageNumber:w=0,togglePagination:x,handleSAMToggle:E,unSelectedAnnotationIDsSet:S=new Set,setMousePosition:M,allowedToCopyPreview:H=!1,copyCallBackHandler:O,annotationSession:k,SAMToggleValue:D,selectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,handleNextPage:V,handlePreviousPage:T,currentPage:$,handleUpdateImageIndex:K,requestId:q,showPagination:W,isAnnotationCreating:U,contentInfo:G,content_key:J,isAnnotationUpdating:Y,isDeleteAnnotationMutationLoading:ee,showGuidelinesFirst:re,currentImage:ue=0,selectedContent:se=null,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handlePasteAnnotationsByControlV:ae,annotationsResponse:ye,isAnnotationFetching:Re,fetchAnnotationsKey:Ie,request:Ce,parentReqData:et,clearAnnotationCache:fe,RequestInfoModal:ne,getAnnotationFromSAM:pe,getAnnotationsFromSAMPrompt:Ee,fetchAnnotations:Le,pageCount:Be=10,annotationViewType:je="atom",AnnotationPagination:We,REACT_APP_SAM_ENABLED:lt="no",ImageGenerationHelper:tt=ZM,fallbackImageUrl:Qe,activeColor:Fe,Carousel:ot,showTool:Ue=!0})=>{var oi,Ba,f,b,B,z,X,ie,ke,Je,rt,Bt,nn,In,Gn,f0;const Ve=ig().isCtrlPressedFunc,Ge=ig().isAltPressedFunc,[dt,qe]=R.useState(!1),[ft,Pt]=R.useState(!1),Wt=.007,an=.03,Dn=.01,Gt=.005,An=.005,bn=.7,Qt=.005,Ot=.005,Ht=.003,_t=.01,Zt="#40ff00",Cn="#fff",mt="#FFFF00",pt="red",Lt="rgba(0, 255, 255, 1)",Xe="rgba(0, 255, 255, 0.5)",zt="#FF3131",ve=4,it=5,$e={DEFAULT:1.5,SELECTED:4.5,CAROUSAL:2.5,CIRCLE:2},yt=R.useRef(""),Ye=R.useRef(null),Et=R.useRef(null),Rt=R.useRef(null),Vt=BS(),[En,At]=R.useState(!1),[vt,Nt]=R.useState(!1),[nt,Tt]=R.useState([]),[Ut,A1]=R.useState(),[L1,o1]=R.useState(),[Jn,$n]=R.useState({x:-1,y:-1}),[v1,j1]=R.useState(-1),[Jt,Mn]=R.useState({x:0,y:0}),[Dt,cn]=R.useState(u),[jn,D1]=R.useState("-1"),[n1,b1]=R.useState([]),[gn,$t]=R.useState(!1),[yn,Hn]=R.useState(null),[wt,kt]=R.useState({width:0,height:0}),Ft=I1.INITIAL_ZOOM_PROPERTIES,[at,mn]=R.useState(Ft),[Pn,P1]=R.useState(!1),[c1,a0]=R.useState(!1),[un,wn]=R.useState(-1),[tn,jt]=R.useState(!1),Yt=I1.INITIAL_ZOOM_LEVEL,Wn=12,Qn=wt.width*Yt,S1=R.useRef(null),[vn,y2]=R.useState(ye),[Nn,q0]=R.useState(),[pn,fn]=R.useState([]),[Bn,B1]=R.useState(null),r0=I1.SAM_MODEL_NAME,M1=I1.SAM_MODEL_CONFIDENCE,jr=I1.SAM_MODEL_MAX_RESULTS,[P2,Fn]=R.useState(!1),[e1,jo]=R.useState(-1),[A9,ya]=R.useState(null),[zr,wa]=R.useState(null),[v9,b9]=R.useState(null),[f1,L0]=R.useState({modelName:"",modelConfidence:0,modelMaxResults:0,promptMessage:""}),[u2,w2]=R.useState(null),[zo,xa]=R.useState(!1),[v0,S3]=R.useState({x:-1,y:-1}),[X2,M3]=R.useState({left:0,right:0,top:0,bottom:0}),[N2,_a]=R.useState(null),[J2,s0]=R.useState(""),H3={SELECT:2e3,NOT_SELECT:500},[g0,Zr]=R.useState(""),Zo=window.devicePixelRatio,[T1,Uo]=R.useState(window.innerWidth<768*Zo),[y9,G1]=R.useState(window.innerWidth<1200*Zo),d2=R.useRef(null),$o=R.useRef(null),[L3,Ko]=R.useState(!1);R.useEffect(()=>{const be=()=>{Uo(window.innerWidth<768*Zo),G1(window.innerWidth<1200*Zo)};return window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)},[]),R.useEffect(()=>{L3&&Fi()},[L3,at,wt]),R.useEffect(()=>{if(!J2){$o.current=null,Ko(!1);return}const be=new window.Image;be.onload=()=>{$o.current=be,Ko(!0)},be.src=J2},[J2]),R.useEffect(()=>(ht(nt),Yo(),()=>{N2&&clearTimeout(N2)}),[jn]),R.useEffect(()=>{A||document.fullscreenElement||ia.getItem("full_screen")=="yes"&&tr(!1),window.addEventListener("resize",S2)},[]),R.useEffect(()=>{console.log("Change"),Tt([]),Oi(),setTimeout(()=>{ht()},50)},[c]),R.useEffect(()=>{v&&ht(nt)},[v]),R.useEffect(()=>{i&&(i==null?void 0:i.length)>0&&e0()},[i]),R.useEffect(()=>{y2(ye||null)},[ye,i]),R.useEffect(()=>{if(e){const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1));f2(be)}Tt([])},[e]),R.useEffect(()=>{J2&&(yt.current=J2,O1())},[J2]),R.useEffect(()=>{yt.current&&S2()},[yt.current,J2]),R.useEffect(()=>{_=="SAM"?P1(!0):P1(!1),B3()},[_]),R.useEffect(()=>{at.scale==1&&(at.x!=0||at.y!=0)&&e0()},[at.scale]),R.useEffect(()=>{if(((vn==null?void 0:vn.result)||[]).length>=0){const{x:be,y:ge}=On.getMousePos(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});O1(nt,{x:be,y:ge})}},[wt,t,at.scale,jn]),R.useEffect(()=>{Oi(),((vn==null?void 0:vn.result)||[]).length>=0&&ht()},[n1,Dt]),R.useEffect(()=>{if(Ce&&vn&&(vn!=null&&vn.result)&&((vn==null?void 0:vn.result)||[]).length>=0){ht(nt);const be={},ge={};for(let Me=0;Me<vn.result.length;Me++)be[vn.result[Me].awi_id]={...vn.result[Me],index:Me},(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&(ge[vn.result[Me].awi_id]=On.getBoundingBoxValues(vn.result[Me].awi_coords));wa(be),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&B1(ge),(Ce==null?void 0:Ce.awi_request_for)=="attributes"&&vn.result.length>0&&u=="-1"&&typeof d=="function"&&setTimeout(()=>{d(vn.result[0].awi_id)},100)}else wa(null),B1(null);x9()},[Ce,vn]),R.useEffect(()=>{x9()},[S]),R.useEffect(()=>{console.log("Filter annotation change"),O1(nt),setTimeout(()=>{O1(nt)},100)},[pn]),R.useEffect(()=>{u!=="-1"?typeof h=="function"&&(Ce==null?void 0:Ce.awi_request_for)!=="outline"&&h("edit"):b1([]),Pn&&typeof h=="function"&&cn("-1"),cn(u||"-1")},[u]),R.useEffect(()=>{A||w==0&&Pn!==void 0&&(Pn?W1.success("Switched to Auto Annotation mode"):Ce!=null&&Ce.awi_annotation_type&&W1.success(`Switched to ${Ce==null?void 0:Ce.awi_annotation_type} Annotation mode`))},[Pn]),R.useEffect(()=>{if(!M||typeof M!="function")return;qo();const be=setTimeout(()=>{const{x:ge,y:Me}=On.getMousePosAbsolute(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});M({x:ge,y:Me})},30);return()=>clearTimeout(be)},[Ut]),R.useEffect(()=>{c1?qo():ei(-1,-1)},[c1]),R.useEffect(()=>{u!="-1"&&zr&&q0(zr[u])},[u,zr]),R.useEffect(()=>{Go(),qo()},[at,wt]);const a4=be=>{const ge=be.message;Zr(ge)};R.useEffect(()=>{let be="";U?be="Creating Annotation...":ee?be="Deleting Annotation...":Y?be="Updating Annotation...":Re?be="Fetching Annotations...":tn&&(be="Generating AI Annotations..."),a4({message:be})},[U,Y,ee,Re,tn]),R.useEffect(()=>{S2()},[W]);const Wo=pe&&typeof pe=="function"?ob(pe):null,Qo=Ee&&typeof Ee=="function"?ob(Ee):null,x2=()=>!!(dt||Ve()),X0=()=>!!(ft||Ge()),Go=()=>{const be=wt.width*at.scale,ge=wt.height*at.scale;M3({left:Math.abs(at.x),right:Math.max(0,be-wt.width+at.x),top:Math.abs(at.y),bottom:Math.max(0,ge-wt.height+at.y)})},Bi=R.useMemo(()=>{const be=(vn==null?void 0:vn.result)||[];if(be.length>0&&Dt!=="-1"){let ge=null,Me=null;const Te=be.reduce((De,ut)=>{const{awi_id:xt}=ut;return xt===Dt?ge=ut:xt===jn?Me=ut:S.has(xt)||De.push(ut),De},[]);return Me&&Te.push(Me),ge&&Te.push(ge),Te}else return pn},[Dt,jn,pn]),f2=async be=>{pS.checkImageValidity(be,s0,i,je,Qe)},Oi=()=>{jn!="-1"&&(N2&&clearTimeout(N2),D1("-1"))},Yo=()=>{if(jn!=="-1")if(Dt=="-1"||I1.HOVER_TO_SELECT_ON_ALREADY_SELECTED){const be=Dt=="-1"?H3.NOT_SELECT:H3.SELECT;N2&&clearTimeout(N2);const ge=setTimeout(()=>{c&&jn!="-1"&&Dt!=jn&&(Dt=="-1"&&gn?Yo():typeof d=="function"&&(d(jn),W1.success("Annotation selected successfully",jn)))},be);_a(ge)}else N2&&clearTimeout(N2);else N2&&clearTimeout(N2)},qo=()=>{const be=Et.current;if(!be)return;const ge=wt.width*at.scale,Me=wt.height*at.scale;if(be.width=ge,be.height=Me,c1){const{x:Te,y:De}=On.getMousePosAbsolute(Et.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});ei(Te,De)}},_2=()=>{Tt([])},Xo=(be=!1)=>{Vt.invalidateQueries(Ie),be&&Tt([])},E2=be=>{var ge;if(zr&&zr[be])if(c){const Me=zr[be].index,Te=vn==null?void 0:vn.result[Me];return Te||((ge=vn==null?void 0:vn.result)==null?void 0:ge.find(De=>De.awi_id==be))}else return zr[be];else return null},w9=be=>v9&&v9[be]?v9[be].index:-1,B3=()=>{nt.length>0&&(console.log("clearCoordinate"),Tt([]),O1([],{x:0,y:0},!0))},x9=()=>{if(Ce&&((vn==null?void 0:vn.result)||[]).length>=0){let be=[];(S==null?void 0:S.size)>0?be=((vn==null?void 0:vn.result)||[]).filter(Me=>!S.has(Me.awi_id)):be=(vn==null?void 0:vn.result)||[];const ge={};for(let Me=0;Me<be.length;Me++)ge[be[Me].awi_id]={...be[Me],index:Me};b9(ge),fn(be)}else fn([])},t1=be=>(T1&&(be=be*3),On.zoomLevelValue(be,at.scale)),T2=new Map,Ri=be=>{try{if(!be)return Promise.resolve(I1.DEFAULT_CANVAS_RATION);if(T2.has(be))return T2.get(be);const ge=new Promise((Me,Te)=>{const De=new Image;De.onload=()=>{const xt={w:De.width,h:De.height};T2.set(be,Promise.resolve(xt)),Me(xt)},De.onerror=Te;const ut=tt.getImageKitUrl(be,-1,-1,1);ut&&(De.src=ut)});return T2.set(be,ge),ge}catch(ge){return console.error(ge),Promise.resolve(I1.DEFAULT_CANVAS_RATION)}},S2=async()=>{var be,ge,Me,Te,De;if(console.log("updateDimensions called"),((be=yt.current)==null?void 0:be.length)>0){console.log("Canvas true");let ut=I1.DEFAULT_CANVAS_RATION;xa(!0);try{ut=await Ri(yt.current)}catch(Kt){console.error("Error fetching image dimensions:",Kt,yt.current),ut=I1.DEFAULT_CANVAS_RATION}const xt=On.gcd(ut.w,ut.h),Xt={w:ut.w/xt,h:ut.h/xt};let hn=0,Ct=0;if(Ct=((ge=Rt.current)==null?void 0:ge.offsetHeight)||0,hn=Ct*Xt.w/Xt.h,hn>(((Me=Rt.current)==null?void 0:Me.offsetWidth)||0)&&(hn=((Te=Rt.current)==null?void 0:Te.offsetWidth)||0,Ct=hn*Xt.h/Xt.w),(Ye==null?void 0:Ye.current)!=null&&(Ye.current.width=hn,Ye.current.height=Ct,u2==null)){const Kt=(De=Ye.current)==null?void 0:De.getBoundingClientRect();w2({left:Kt==null?void 0:Kt.left,top:Kt==null?void 0:Kt.top})}kt({width:hn,height:Ct}),xa(!1),O1(nt)}},Ur=R.useCallback((be,ge,Me,Te,De,ut)=>On.checkPointInsidePolygon(be,ge,Me,Te,De,ut,at.scale),[]),mr=(be,ge=!0)=>{const{x:Me,y:Te}=On.getMousePos(Ye.current,be);let De="",ut=1/0;if(c&&Jo(Me,Te))return[Dt];const xt=pn||[];if(!ge&&(xt==null?void 0:xt.length)>I1.MAX_ANNOTATIONS_TO_HOVER)return[];switch(Ce==null?void 0:Ce.awi_annotation_type){case"circle":{xt.forEach(({awi_coords:Xt,awi_id:hn})=>{if(Ur(Me,Te,Xt,0,0,Ce)){const Ct=On.minDistanceToPolygon({x:Me,y:Te},Xt);Ct<ut&&(De=hn,ut=Ct)}});break}case"dot":{const Xt=t1(An);xt.forEach(({awi_coords:hn,awi_id:Ct})=>{if(Ur(Me,Te,hn,Xt,Xt,Ce)){const Kt=On.minDistanceToPolygon({x:Me,y:Te},hn);Kt<ut&&(De=Ct,ut=Kt)}});break}case"rectangle":{const Xt=t1(Qt)/2;for(let hn=0;hn<xt.length;hn++){const{awi_coords:Ct,awi_id:Kt}=xt[hn];if(Ur(Me,Te,Ct,Xt,0,Ce)){const x1=On.minDistanceToPolygon({x:Me,y:Te},Ct);x1<ut&&(De=Kt,ut=x1)}}break}case"polygon":{for(let Xt=0;Xt<xt.length;Xt++){const{awi_coords:hn,awi_id:Ct}=xt[Xt];if(Bn){const Kt=Bn[Ct];if(Kt){const{minX:x1,minY:ce,maxX:h0,maxY:B0}=Kt;if(Me<x1||Me>h0||Te<ce||Te>B0)continue}}if(Ur(Me,Te,hn,0,0,Ce)){const Kt=On.minDistanceToPolygon({x:Me,y:Te},hn);Kt<ut&&(De=Ct,ut=Kt)}}break}default:console.warn(`Unknown annotation type: ${Ce==null?void 0:Ce.awi_annotation_type}`);break}return De&&De.length>0?(ge&&cn(De),[De]):(ge&&(console.log("setSelectAnnotationId "),typeof d=="function"&&u!="-1"&&d("-1",!1)),[])},s4=cl.throttle(mr,50),Jo=(be,ge)=>{const Me=E2(u);if(Me){const Te=Me.awi_coords;if((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"){const De=On.minDistanceToPolygon({x:be,y:ge},Te),ut=t1(Ot);return De<=ut}else if((Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"){const{insertIndex:De,minDistance:ut}=On.closestCoordinates({x:be,y:ge},Te),xt=t1(Ot);return console.log(De),ut<=xt}}else return!1},O3=(be,ge)=>{const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=E2(ge);if(console.log("selectAnnotation",De),De){const{awi_coords:ut}=De;if(ut.length===1){const Ct=t1(Gt);Ur(Me,Te,ut,Ct,Ct,Ce)&&(Nt(!0),$t(!0),o1({x:Me,y:Te}),Tt(ut));return}if(ut.length===2){const{x:Ct,y:Kt}=ut[0],{x:x1,y:ce}=ut[1],h0=On.getDiameter([{x:Ct,y:Kt},{x:x1,y:ce}])/2,B0=(Ct+x1)/2,m1=(Kt+ce)/2;Nt(!0),$t(!0),o1({x:Me,y:Te}),$n({x:Me,y:Te}),Tt(ut);const rn=(Me-B0)*(Me-B0)+(Te-m1)*(Te-m1),_0=t1(bn);rn>_0*_0*h0*h0&&$t(!1);return}const xt=x2()?0:t1(Wt),Xt=Ur(Me,Te,ut,xt,0,Ce),hn=Jo(Me,Te);if(!Xt&&!hn)$n({x:-1,y:-1}),o1({x:0,y:0}),$t(!1);else{if(o1({x:Me,y:Te}),Nt(!0),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon")if(x2())$t(!0);else if(Ur(Me,Te,ut,xt,0,Ce)){const{minDistance:Kt}=On.findClosestSegment(ut,Me,Te),x1=t1(_t);Kt>=x1?$t(!0):$t(!1)}else $t(!1);else $t(!0);Tt(ut),$n({x:-1,y:-1}),x2()||ut.forEach((Ct,Kt)=>{if(Me<=Ct.x+xt&&Me>=Ct.x&&Te<=Ct.y+xt&&Te>=Ct.y||Me>=Ct.x-xt&&Me<=Ct.x&&Te>=Ct.y-xt&&Te<=Ct.y||Me<=Ct.x+xt&&Me>=Ct.x&&Te>=Ct.y-xt&&Te<=Ct.y||Me>=Ct.x-xt&&Me<=Ct.x&&Te<=Ct.y+xt&&Te>=Ct.y){if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon")c?($n({x:Me,y:Te}),j1(Kt)):(j1(Kt),$n(ut[Kt])),console.log("setSelectCornerCoordinates");else if((Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"&&!Pn){const x1=ut[(Kt+2)%4];$n(x1)}else if(c){const x1=ut[(Kt+2)%4];$n(x1)}else j1(Kt),$n(ut[Kt]);$t(!1),Tt([])}})}}},Ii=(be="all")=>{const ge=window.devicePixelRatio;if(be!="cross"&&Ye.current)if(at.scale==1){const Me=+getComputedStyle(Ye.current).getPropertyValue("height").slice(0,-2),Te=+getComputedStyle(Ye.current).getPropertyValue("width").slice(0,-2);Ye.current.setAttribute("height",(Me*ge).toString()),Ye.current.setAttribute("width",(Te*ge).toString())}else{const Me=wt.height*at.scale,Te=wt.width*at.scale;Ye.current.setAttribute("height",(Me*ge).toString()),Ye.current.setAttribute("width",(Te*ge).toString())}if(Et.current)if(at.scale==1){const Me=+getComputedStyle(Et.current).getPropertyValue("height").slice(0,-2),Te=+getComputedStyle(Et.current).getPropertyValue("width").slice(0,-2);Et.current.setAttribute("height",(Me*ge).toString()),Et.current.setAttribute("width",(Te*ge).toString())}else{const Me=wt.height*at.scale,Te=wt.width*at.scale;Et.current.setAttribute("height",(Me*ge).toString()),Et.current.setAttribute("width",(Te*ge).toString())}},Co=(be,ge)=>{const Me=On.getDistance(be.x,be.y,ge.x,ge.y),Te=t1(Wt),De=t1(Dn);if(Me<=De){let ut=!1;return Me<=Te?ut=!1:Me<=De&&(ut=!0),{success:!0,distance:Me,zoomClosePoint:Te,zoomPointAnnotationValue:De,isExtraPointNeeded:ut}}else return{success:!1,distance:Me,zoomClosePoint:Te,zoomPointAnnotationValue:De,isExtraPointNeeded:!1}},$r=(be=[],ge={x:0,y:0},Me=!1,Te=!1,De)=>{if((be||[]).length>0){De.beginPath();const ut=M2(be);if((Ce==null?void 0:Ce.awi_annotation_type)==="rectangle")if(Pn){if(c){De.moveTo(ut[0].x,ut[0].y);for(let xt=1;xt<ut.length;xt++)De.lineTo(ut[xt].x,ut[xt].y);De.closePath()}else if(Pn){console.log("Sam function");const xt=M2(be);De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,xt.forEach(Xt=>{De.beginPath(),De.arc(Xt.x,Xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}}else{De.moveTo(ut[0].x,ut[0].y);for(let xt=1;xt<ut.length;xt++)De.lineTo(ut[xt].x,ut[xt].y);De.closePath()}else if((Ce==null?void 0:Ce.awi_annotation_type)==="circle")if(Pn&&!c){const xt=M2(be);console.log("coordinatesVal ",xt),De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,xt.forEach(Xt=>{De.beginPath(),De.arc(Xt.x,Xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}else{const xt=On.getDiameter(ut);De.arc((ut[0].x+ut[1].x)/2,(ut[0].y+ut[1].y)/2,Math.floor(xt/2),0,I1.TWO_PIE)}De.save(),De.lineWidth=$e.DEFAULT,De.strokeStyle=Zt,De.stroke()}if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&(nt||[]).length>0&&!Me&&!c){if(!Pn){const ut=M2(nt);if(De.beginPath(),De.lineWidth=$e.DEFAULT,De.strokeStyle=Zt,ut.forEach((xt,Xt)=>{if(Xt>0){const hn=ut[Xt-1];De.moveTo(hn.x,hn.y),De.lineTo(xt.x,xt.y)}}),De.stroke(),ut.forEach((xt,Xt)=>{De.beginPath(),De.arc(xt.x,xt.y,it,0,I1.TWO_PIE,!0),De.fillStyle=Xt===0?mt:Zt,De.fill()}),!X0()&&!Te&&ge&&ge.x>0&&ge.y>0&&!(ge.x>.998||ge.y>.998||ge.x<.002||ge.y<.002)){const xt=M2([ge]);De.beginPath();const Xt=Co(nt[0],ge);Xt!=null&&Xt.success&&(nt==null?void 0:nt.length)>2?Xt.isExtraPointNeeded?(De.beginPath(),De.rect(xt[0].x-ve*3,xt[0].y-ve*3,ve*6,ve*6),De.fillStyle=pt,De.fill(),De.lineWidth=4,De.strokeStyle=pt,De.stroke()):(De.beginPath(),De.rect(xt[0].x-ve*3,xt[0].y-ve*3,ve*6,ve*6),De.fillStyle=mt,De.fill(),De.lineWidth=2,De.strokeStyle=mt,De.stroke()):De.arc(xt[0].x,xt[0].y,ve,0,I1.TWO_PIE,!0),De.fillStyle="rgba(0,0,0,0.35)",De.fill(),De.strokeStyle=Zt,De.stroke();const hn=ut[ut.length-1];De.beginPath(),De.moveTo(hn.x,hn.y),De.lineTo(xt[0].x,xt[0].y),De.strokeStyle="#ff0000",De.setLineDash([5,5]),De.lineWidth=$e.DEFAULT,De.stroke(),De.setLineDash([])}De.closePath(),De.lineWidth=$e.DEFAULT,De.stroke(),De.save()}if(Pn){const ut=M2(be);De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,ut.forEach(xt=>{De.beginPath(),De.arc(xt.x,xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}}},ei=(be,ge)=>{const Me=Et.current;if(!Me)return;const Te=Me.getContext("2d");if(!Te||(Te.clearRect(0,0,Me.width,Me.height),be==-1&&ge==-1))return;Ii("cross");const De=M2([{x:be,y:ge}])[0],ut=De.x,xt=De.y;Te.strokeStyle="#800080",Te.lineWidth=$e.CAROUSAL,Te.setLineDash([3,3]),Te.beginPath(),Te.moveTo(ut,0),Te.lineTo(ut,Me.height),Te.stroke(),Te.beginPath(),Te.moveTo(0,xt),Te.lineTo(Me.width,xt),Te.stroke(),Te.setLineDash([])},O1=(be=[],ge={x:0,y:0},Me=!1,Te=!1,De=0)=>{var ut,xt,Xt,hn;if(Ce&&!zo){const Ct=(ut=Ye.current)==null?void 0:ut.getContext("2d");if(Ii(),Ct!=null){Ct.imageSmoothingEnabled=!1,Ct.clearRect(0,0,wt.width,wt.height),!c&&(Ce==null?void 0:Ce.awi_request_for)!="attributes"&&$r(be,ge,Me,Te,Ct);const Kt=Bi||[];for(let x1=0;x1<Kt.length;x1++){const ce=Kt[x1],{awi_coords:h0,awi_id:B0,awi_status:m1}=ce;if(h0.length===0)return;const rn=M2(h0);Ct.beginPath(),Ct.lineJoin="round";let _0=!1,t2="",j2="";if(C==="all"||m1===C){ce.awi_status==="pending"?t2=ce.awi_outline_status==="approved"?"rgba(214, 204, 60, 0.3)":"rgba(0, 0, 0,0)":t2=I1.STATUS_COLOR_MAP[ce.awi_status]||"rgba(0, 0, 0,0)",j2=t2;let Yr=!1;if(B0===Dt?(Ct.lineWidth=$e.SELECTED,Ct.strokeStyle=Zt,Ct.fillStyle="rgba(0,0,0,0.40)",Yr=!0):B0===jn&&(Ct.lineWidth=$e.DEFAULT,Ct.strokeStyle=Lt,Ct.fillStyle=Xe,Yr=!0),!Yr)if(Ct.fillStyle=t2,A?Ct.lineWidth=$e.CAROUSAL:Ct.lineWidth=$e.DEFAULT,v){const n2=v[ce.awi_classes[0].awi_id];n2?(j2=n2,Ct.strokeStyle=n2):(j2=ce.awi_classes[0].awi_color,Ct.strokeStyle=ce.awi_classes[0].awi_color)}else j2=ce.awi_classes[0].awi_color,Ct.strokeStyle=ce.awi_classes[0].awi_color;switch(Ce==null?void 0:Ce.awi_annotation_type){case"circle":{const n2=(rn[0].x+rn[1].x)/2,ii=(rn[0].y+rn[1].y)/2,D3=Math.sqrt(Math.pow(rn[1].x-rn[0].x,2)+Math.pow(rn[1].y-rn[0].y,2));Ct.beginPath(),Ct.arc(n2,ii,D3/2,0,I1.TWO_PIE),Ct.stroke(),Ct.closePath(),_0=!0;break}case"dot":{Ct.beginPath(),Ct.moveTo(rn[0].x,rn[0].y),Ct.arc(rn[0].x,rn[0].y,ve,0,I1.TWO_PIE,!0),Ct.stroke(),Ct.closePath(),_0=!0;break}case"rectangle":{Ct.beginPath(),Ct.moveTo((xt=rn[0])==null?void 0:xt.x,(Xt=rn[0])==null?void 0:Xt.y);for(let n2=1;n2<rn.length;n2++)Ct.lineTo(rn[n2].x,rn[n2].y);Ct.closePath(),Ct.stroke(),_0=!0;break}case"polygon":{_0=!0,Ct.moveTo(rn[0].x,rn[0].y);const n2=rn.length;for(let ii=0;ii<n2;ii++)Ct.lineTo(rn[ii].x,rn[ii].y);break}}if(Ct.fill(),Ct.save(),Ct.stroke(),_0){Ct.save();const n2=B0===Dt,ii=B0===jn,D3=ce.sam_status==="yes";rn.forEach((Nl,c4)=>{Ct.beginPath();let H2=ve,qr="";n2?rn.length==1&&(Ce==null?void 0:Ce.awi_annotation_type)=="dot"||Te&&c4%(rn.length-1)==De?(H2=ve*2,qr=Zt):(qr=Zt,H2=ve):ii?(qr=Lt,H2=ve):(qr=j2,H2=ve),(Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?c4%(rn.length-1)==0&&(D3?qr=zt:qr=mt):c4==0&&rn.length>1&&D3&&(qr=zt),Ct.arc(Nl.x,Nl.y,H2,0,2*Math.PI,!0),Ct.fillStyle=qr,Ct.strokeStyle=qr,Ct.fill(),Ct.stroke(),Ct.restore()})}else console.log("Error")}}}qo()}if(at.scale==1&&(Ye!=null&&Ye.current)){const Ct=(hn=Ye==null?void 0:Ye.current)==null?void 0:hn.getBoundingClientRect();w2({top:Ct==null?void 0:Ct.top,left:Ct==null?void 0:Ct.left})}},M2=be=>be.map(Me=>({x:Me.x*Ye.current.width,y:Me.y*Ye.current.height})),Kr=be=>{const{x:ge,y:Me}=On.getMousePos(Ye.current,be);Tt(Te=>{const De=[...Te];return De[1].x=ge,De[1].y=Me,On.adjustToCircle(De)})},l0=be=>{if(be.length===0)return!1;const ge=On.isAnnotationCoordinatesValid(Ce,be,Pn,at.scale);return ge||O1(),ge},R3=(be,ge)=>(console.log("Has Moved checking"),Math.abs(be.x-ge.x)>0||Math.abs(be.y-ge.y)>0),go=()=>{if((nt==null?void 0:nt.length)>1){const be=nt[nt.length-1],ge=[];let Me=!1;for(let Te=0;Te<nt.length-1;Te++){const De=nt[Te],ut=t1(Gt);if(Math.abs(be.x-De.x)<=ut&&Math.abs(be.y-De.y)<=ut){Me=!0;continue}else ge.push({x:De.x,y:De.y})}return Me||ge.push(nt[nt.length-1]),Tt(ge),ge}else return nt},I3=()=>{if(typeof n=="function")if(nt.length>3){const be=Co(nt[0],nt[nt.length-1]);let ge=[];be.success&&(be.isExtraPointNeeded==!1?(nt[nt.length-1].x=nt[0].x,nt[nt.length-1].y=nt[0].y,ge=nt):be.isExtraPointNeeded&&(ge=[...nt,{x:nt[0].x,y:nt[0].y}])),(ge==null?void 0:ge.length)>0?(Tt([]),n(ge,null,!1,()=>{_2()})):O1(nt)}else O1(nt)},Z0=(be,ge)=>{console.log("deletePolygonPoint"),console.log("selectIndex ",ge);const Me=[];for(let Te=0;Te<be.length;Te++)Te!=ge&&Me.push(be[Te]);ge==0&&(Me[Me.length-1]=Me[0]),Tt(Me),(Me==null?void 0:Me.length)>3?(O1(Me),typeof o=="function"&&l0(Me)&&!p&&(W1.success("Point deleted successfully"),o(Me,u,()=>{_2()}))):W1.error("Point can not be deleted, as polygon need minimum of three points"),jo(-1),ya(null)};function J0(be,ge){console.log("handleAddAnnotationPoint");const Me=be.target;if(!(Me!=null&&Me.getBoundingClientRect))return;const Te=Me.getBoundingClientRect(),De=(be.clientX-Te.left)/Te.width,ut=(be.clientY-Te.top)/Te.height,{insertIndex:xt,minDistance:Xt}=On.closestCoordinates({x:De,y:ut},ge),hn=t1(Wt);if(Xt<hn){console.log("Very close point to insert"),console.log("minDistanceMin",Xt);const ce=t1(an);if(Xt<ce&&x2())console.log("We can remove this"),(ge==null?void 0:ge.length)>3&&(ya(ge),I1.POLYGON_POINT_REMOVE_CONFIRM_PROMPT?jo(xt):Z0(ge,xt));else{if(Xt<ce)W1.error("Press CTRL and then click to prompt for point deletion");else{const h0=(Xt*100).toFixed(1);W1.error("Very close point to draw "+h0+" it should be more than "+Wt*100)}jo(-1),ya(null)}return}if(x2())return;jo(-1),ya(null);const{insertIndex:Ct,minDistance:Kt}=On.findClosestSegment(ge,De,ut),x1=t1(_t);Kt>=x1||(ge.splice(Ct,0,{x:De,y:ut}),Tt(ge),O1(ge),typeof o=="function"&&l0(nt)&&!p&&o(nt,u,()=>{_2()}))}const ti=be=>{M&&typeof M<"u"&&typeof M=="function"&&(M({x:-1,y:-1}),ei(-1,-1)),Di(be,!0),jn!="-1"?Oi():(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&!c&&!A&&!Pn&&nt.length>0&&setTimeout(()=>{O1(nt)},200)},ki=be=>{if(!Pn){if((gn||vt&&Jn.x!==-1&&Jn.y!==-1)&&R3(L1,On.getMousePos(Ye.current,be))){const ge=E2(u);if(ge){const Me=l0(ge.awi_coords);if(typeof o=="function"&&Me)if(Jn.x!==-1&&Jn.y!==-1)if((Ce==null?void 0:Ce.awi_annotation_type)=="polygon")o(ge.awi_coords,Dt);else{const Te=On.getUpdatedCoordinates(Ye,be,Jn);o(Te,Dt)}else o(ge.awi_coords,Dt);else Me||((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&F2(ge.awi_coords,be),Xo(!0))}}En?(At(!1),typeof n=="function"&&l0(nt)&&((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?I3():n(nt,null,!1,()=>{_2()}))):vt&&(Nt(!1),cn("-1"),b1([]),typeof d=="function"&&d("-1"))}},Ea=be=>{if(!(Ye!=null&&Ye.current))return;const ge=s4(be,!1);(ge==null?void 0:ge.length)>0&&ge[0]!=Dt?(Yo(),D1(ge[0]),Ye.current.style.cursor="pointer"):jn!="-1"&&(D1("-1"),Dt=="-1"&&(Ye.current.style.cursor="default"))},_9=(be,ge=!1)=>{if(ge){ht(nt);return}const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=E2(u);if(De){const ut=De.awi_coords,{minDistance:xt,insertIndex:Xt}=On.closestCoordinates({x:Me,y:Te},ut),hn=t1(Qt);if(xt<=hn&&Ye.current){const Ct=Ye.current.getContext("2d");if(!Ct||Xt==un)return;Ye.current.style.cursor="pointer",wn(Xt),Ye.current.title="Point "+(Xt+1);const Kt=M2([ut[Xt]])[0];Ct.fillStyle=Cn,Ct.beginPath(),Ct.arc(Kt.x,Kt.y,ve*2.5,0,I1.TWO_PIE),Ct.strokeStyle="black",Ct.lineWidth=$e.SELECTED,Ct.stroke(),Ct.fill()}else if(Ye.current){if(!Ye.current.getContext("2d"))return;const Kt=t1(Ht);un!==-1&&(ht(),wn(-1)),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&On.findClosestSegment(ut,Me,Te).minDistance<=Kt?(Ye.current.style.cursor="pointer",Ye.current.title="Add point"):(Ye.current.style.cursor="default",Ye.current.title="")}}},Di=Br.useThrottle(_9,100),ni=Br.useThrottle(Ea,100),F2=(be,ge)=>{if(On.breakPointCount(be)>0){console.log("================================BREAK================================"),$t(!1),ge&&ge.stopPropagation&&(ge==null||ge.stopPropagation());const Te=On.shiftPolygon(be);if(typeof o=="function"&&l0(Te)){const De=u;o(Te,u,()=>{Dt!=De&&cn(De),_2()})}}},Ze=()=>pn.length>I1.MAX_ANNOTATIONS_TO_RUN_FAST?ht:O1,ht=Br.useThrottle((be,ge,Me=!1,Te=!1,De=-1)=>{O1(be,ge,Me,Te,De)},50),st=(be="forward")=>{if((pn||[]).length!=0)if(be=="last_update"){const ge=pn==null?void 0:pn.reduce((Me,Te)=>{const De=new Date(Me.awi_last_updation).getTime();return new Date(Te.awi_last_updation).getTime()>De?Te:Me});ge&&(cn(ge.awi_id),typeof d=="function"&&d(ge.awi_id))}else if(u==="-1")(pn||[]).length>0&&(cn(pn[0].awi_id),typeof d=="function"&&d(pn[0].awi_id));else{const ge=w9(u);be=="backward"?ge!==-1?ge>0?(cn(pn[ge-1].awi_id),typeof d=="function"&&d(pn[ge-1].awi_id)):(cn(pn[pn.length-1].awi_id),typeof d=="function"&&d(pn[pn.length-1].awi_id)):(pn||[]).length>0&&(cn(pn[pn.length-1].awi_id),typeof d=="function"&&d(pn[pn.length-1].awi_id)):ge!==-1?(pn||[]).length>ge+1?(cn((pn||[])[ge+1].awi_id),typeof d=="function"&&d((pn||[])[ge+1].awi_id)):(cn((pn||[])[0].awi_id),typeof d=="function"&&d((pn||[])[0].awi_id)):(pn||[]).length>0&&(cn(pn[0].awi_id),typeof d=="function"&&d(pn[0].awi_id))}},sn=()=>{if(console.log("handleCompleteAnnotation"),!(!Ce||c))if(_==="SAM"){vo();return}else{if((Ce==null?void 0:Ce.awi_annotation_type)!="polygon")return;if(typeof n=="function"&&l0(nt))if((nt==null?void 0:nt.length)>2){const be=[...nt,{x:nt[0].x,y:nt[0].y}];Tt([]),n(be,null,!1,()=>{_2()})}else{W1.error("Polygon requires minimum of three coordinates");return}else W1.error("Invalid coordinates, please create valid coordinates")}},Un=be=>{console.log("handle Complete Multiple Annotation SAM");const ge=[];for(let Me=0;Me<(be==null?void 0:be.length);Me++){const Te=be[Me].outline,De=be[Me].classId;if(l0(Te)){const xt={coords:(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?On.createPolygonLoop(Te):Te,classId:De,isSam:!0};ge.push(xt)}}(ge==null?void 0:ge.length)>0&&typeof r=="function"&&(Tt([]),r(ge,()=>{(ge==null?void 0:ge.length)>0&&Xo()}))},h1=()=>{if(console.log("undoAnnotationPoint"),console.log("coordinates ------>",nt),u!="-1"){Ma();return}if(nt.length>0&&(Ce==null?void 0:Ce.awi_annotation_type)==="polygon")nt.pop(),Tt([...nt]),O1(nt);else if(nt.length>0&&Pn)nt.pop(),Tt([...nt]),O1(nt);else return},e0=()=>{mn(Ft)},R1=(be,ge="zoom-in")=>{if(Ye.current&&Ye)if(ge=="zoom-in"){const Me=Yt,Te=at.scale+Me,De=Ye.current.getBoundingClientRect(),ut=be.clientX-De.left,xt=be.clientY-De.top,Xt=Te/at.scale,hn=at.x-ut*(Xt-1),Ct=at.y-xt*(Xt-1),Kt={scale:+Te.toFixed(2),x:hn,y:Ct};mn(Kt),S3({x:be.clientX,y:be.clientY})}else{const Me=Yt,Te=at.scale-Me;if(Te==1)e0();else{const De=Ye.current.getBoundingClientRect();(v0.x==-1||v0.y==-1)&&console.log("zoomTimeMousePoint");const ut=v0.x!=-1?v0.x:be.clientX,xt=v0.y!=-1?v0.y:be.clientY,Xt=ut-De.left,hn=xt-De.top,Ct=Te/at.scale,Kt=-Math.abs(at.x+Xt*(1-Ct)),x1=-Math.abs(at.y+hn*(1-Ct)),ce=wt.width*(at.scale+Yt-1),h0=wt.height*(at.scale+Yt-1),{newXTransform:B0,newYTransform:m1}=On.transformCoordinatesCheck(Kt,x1,ce,h0),rn={scale:+Te.toFixed(2),x:B0,y:m1};mn(rn)}}},mo=(be=null)=>{if(at.scale!==Wn&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const ge=wt.width*(at.scale+Yt-1),Me=wt.height*(at.scale+Yt-1),Te=at.x-wt.width*Yt/2,De=at.y-wt.height*Yt/2,{newXTransform:ut,newYTransform:xt}=On.transformCoordinatesCheck(Te,De,ge,Me),Xt={scale:+(at.scale+Yt).toFixed(2),x:ut,y:xt};mn(Xt)}else R1(be,"zoom-in")},e2=(be=null)=>{if(at.scale!==1&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const ge=wt.width*(at.scale-Yt-1),Me=wt.height*(at.scale-Yt-1),Te=at.x+wt.width*Yt/2,De=at.y+wt.height*Yt/2,{newXTransform:ut,newYTransform:xt}=On.transformCoordinatesCheck(Te,De,ge,Me);mn({scale:+(at.scale-Yt).toFixed(2),x:ut,y:xt})}else R1(be,"zoom-out")},x0=be=>{be.deltaY<0?mo(be):e2(be)},po=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x+Qn,Te=at.y,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},Ao=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x-Qn,Te=at.y,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},pr=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x,Te=at.y+Qn,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},Wr=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x,Te=at.y-Qn,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})};if(!e||!i)return null;const vo=()=>{if(tn){W1.error("Request already in progress");return}if(!(nt!=null&&nt.length)){W1.error("No points to send");return}const be={};be.image_url=e,be.coords=nt,console.log("Sent to SAM",be),Pi(),typeof h=="function"&&h("annotate")},u1=()=>{if(P2?Fn(!1):P2||Fn(!0),tn){W1.error("Request already in progress");return}typeof h=="function"&&h("annotate")},l4=be=>{console.log("Submitted data from SAMModal:",be),bo(be),typeof h=="function"&&h("annotate")},bo=be=>{if(!Qo||!(Qo!=null&&Qo.mutate)){W1.error("SAM Prompt is not available");return}console.log("getSAMAnnotationsPrompt");const ge=be.awi_annotation_prompt,Me=be.model_confidence,Te=be.model_name,De=be.model_max_results;L0({modelName:Te,modelConfidence:Me,modelMaxResults:De,promptMessage:ge});const ut=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Xt={requestId:a||0,contents:[{url:J2||ut,contentKey:i,directPrompt:ge||""}],confidence:Me||M1,modelName:Te||r0,modelMaxResults:De||jr};jt(!0),Qo.mutate(Xt,{onSuccess:hn=>{var Ct,Kt,x1,ce,h0;if(jt(!1),!hn.success)W1.error(hn.message);else{Fn(!1);const B0=((x1=(Kt=(Ct=hn.data)==null?void 0:Ct[0])==null?void 0:Kt.contours)==null?void 0:x1[0])??null;if(B0){const m1=B0.coordinates;if((m1==null?void 0:m1.length)==0||!((h0=(ce=m1[0])==null?void 0:ce.box)!=null&&h0.length))W1.error("No auto annotation is possible to create");else{const rn=[];(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?(console.log("coordinates",m1),m1.forEach(_0=>{var t2;(t2=_0==null?void 0:_0.mask_polygon)==null||t2.forEach(j2=>{const n2={outline:j2.outline,classId:m1.classId};rn.push(n2)})})):(Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"?m1.forEach(_0=>{const t2=On.getBoundingBox(_0.box);Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}):(Ce==null?void 0:Ce.awi_annotation_type)=="circle"?m1.forEach(_0=>{const t2=On.calculateCircleFromCoordinates(On.getBoundingBox(_0.box));Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}):(Ce==null?void 0:Ce.awi_annotation_type)=="dot"&&m1.forEach(_0=>{const t2=On.calculateCentroid(_0.box);Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}),Un(rn),typeof E=="function"&&E("Normal")}}else W1.error("No Auto Annotation found")}},onError:hn=>{W1.exception(hn),jt(!1)}})},Pi=()=>{if(!Wo||!(Wo!=null&&Wo.mutate)){W1.error("SAM is not available");return}const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),ge=J2||be,Me=Br.chunkArray(nt),Te={img_url:ge,coords:nt,coordinates:Me};jt(!0),Wo.mutate(Te,{onSuccess:De=>{var ut;if(jt(!1),!De.success)W1.error(De.message);else if(console.log("this is the SAM data",De),((ut=De==null?void 0:De.data)==null?void 0:ut.length)>0){const xt=[];(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?De.data.forEach(Xt=>{Xt.contours.forEach(hn=>{Tt(hn.outline);const Kt={outline:hn.outline,classId:null};xt.push(Kt)})}):(Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"?De.data.forEach(Xt=>{Tt(Xt.bbox),console.log("this si the bbox",Xt.bbox);const Ct={outline:Xt.bbox,classId:null};xt.push(Ct)}):(Ce==null?void 0:Ce.awi_annotation_type)=="circle"?De.data.forEach(Xt=>{const hn=On.calculateCircleFromCoordinates(Xt.bbox);Tt(hn);const Ct={outline:hn,classId:null};xt.push(Ct)}):(Ce==null?void 0:Ce.awi_annotation_type)=="dot"&&De.data.forEach(Xt=>{const hn=On.calculateCentroid(Xt.bbox);Tt(hn);const Ct={outline:hn,classId:null};xt.push(Ct)}),Un(xt)}else W1.error("No annotations found from SAM")},onError:De=>{W1.exception(De),jt(!1)}})},Sa=async()=>{if(fe&&typeof fe=="function"){W1.success("Loading Annotations...");const be=await fe();console.log("cacheRemoveAnnotationResponse ",be),be!=null&&be.success?(W1.success((be==null?void 0:be.message)+" and now loading final annotations..."),Xo(!0)):W1.error(be==null?void 0:be.message)}},Ma=()=>{var ge;console.log("Undo last state annotation");const be=E2(u);if(((ge=be.past_coords)==null?void 0:ge.length)>0){const Me=be.past_coords[be.past_coords.length-1];typeof o=="function"&&l0(Me)&&!p&&o(Me,u,()=>{_2()})}},Ar=be=>{console.log("Control p"),Ye.current&&mo(be)},Ni=be=>{console.log("Control m"),e2(be)},V2=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};Ar(be)},er=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};Ni(be)},k3=()=>{console.log("Copying annotations"),O&&typeof O=="function"&&O((vn==null?void 0:vn.result)||[])},tr=(be=!0)=>{try{document.fullscreenElement?(document.exitFullscreen().then(()=>{console.log("Fullscreen exited")}).catch(ge=>{console.log(ge)}),be&&ia.setItem("full_screen","no")):(document.documentElement.requestFullscreen().then(()=>{console.log("Fullscreen entered")}).catch(ge=>{console.log(ge)}),be&&ia.setItem("full_screen","yes"))}catch(ge){console.log(ge)}},vr=be=>{var ge;if(!(!A&&!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))){if((Ce==null?void 0:Ce.awi_request_for)=="attributes"){const Me=mr(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(b1(Me),typeof d=="function"&&d(Me[0]),O1()),gn&&$t(!1),Nt(!1);return}if(En)if(At(!1),Pn){if(nt&&(nt==null?void 0:nt.length)>0){let Me=[];T1?x2()?Me=go():Me=nt:Me=go(),O1(Me)}}else console.log("creating new annotation"),typeof n=="function"&&l0(nt)&&((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?I3():(Tt([]),n(nt,null,!1,()=>{_2()})));else if(c&&Dt!=="-1"||A){if((gn||Jn.x!==-1&&Jn.y!==-1)&&R3(L1,On.getMousePos(Ye.current,be))){const Me=E2(Dt);if(Me){const Te=[...Me.awi_coords],De=l0(Te);typeof o=="function"&&De&&!p?o(Te,u,()=>{_2()}):De||((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?F2(Te,be):Xo(!0))}}else{const Me=mr(be)||[];if(Me.length>0)if(Me.every(Te=>n1.includes(Te))&&n1.every(Te=>Me.includes(Te))){if(cn(Te=>(typeof d=="function"&&d(n1[(n1.indexOf(Te)+1)%n1.length]),ht(),n1[(n1.indexOf(Te)+1)%n1.length]==="-1"&&(o1({x:0,y:0}),$n({x:-1,y:-1})),n1[(n1.indexOf(Te)+1)%n1.length])),(!gn||x2())&&(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"){const Te=(ge=E2(u))==null?void 0:ge.awi_coords;J0(be,Te)}}else console.log("Selecting first temp"),cn(Me[0]),typeof d=="function"&&d(Me[0]),O1();else cn("-1"),O1();b1(Me)}gn&&$t(!1),Nt(!1)}else if(c){const Me=mr(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(b1(Me),typeof d=="function"&&d(Me[0]),O1()),Nt(!1)}}},ri=be=>{if(console.log("Handle Mouse Down"),be.button==0&&!X0()){if(!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))return;if(!c&&!A){At(!0),console.log("Mouse down");const{x:ge,y:Me}=On.getMousePosAbsolute(Ye.current,be);Mn({x:ge,y:Me}),Pn?T1&&x2()||Tt(Te=>[...Te||[],{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"?Tt([{x:ge,y:Me},{x:ge,y:Me},{x:ge,y:Me},{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="circle"?Tt([{x:ge,y:Me},{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="dot"?Tt([{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&Tt(Te=>[...Te,{x:ge,y:Me}])}else A||(O3(be,Dt),Nt(!0))}else if(be.button===1||be.button==0){const{clientX:ge,clientY:Me}=be,{x:Te,y:De}=at,ut=Xt=>{console.log("PANNING!!!!!");const hn=Xt.clientX-ge,Ct=Xt.clientY-Me,Kt=Te+hn,x1=De+Ct,ce=Math.max(Math.min(Kt,0),wt.width-wt.width*at.scale),h0=Math.max(Math.min(x1,0),wt.height-wt.height*at.scale);mn({scale:at.scale,x:ce,y:h0})},xt=()=>{window.removeEventListener("mousemove",ut),window.removeEventListener("mouseup",xt),window.addEventListener("touchmove",ut,{passive:!1}),window.addEventListener("touchend",xt)};at.scale>1&&(window.addEventListener("mousemove",ut),window.addEventListener("touchmove",ut,{passive:!1})),window.addEventListener("mouseup",xt),window.addEventListener("touchend",xt)}},Qr=be=>{if(Ye!=null&&Ye.current&&A1({x:be.clientX,y:be.clientY}),c&&(Dt!="-1"&&(pn==null?void 0:pn.length)<=I1.MAX_ANNOTATIONS_TO_HOVER&&Di(be),!gn&&!vt?(pn==null?void 0:pn.length)<=I1.MAX_ANNOTATIONS_TO_HOVER&&ni(be):jn!="-1"&&D1("-1")),p)return;let ge=[];if(En){Pn?(ge.length==0&&(ge=[Jt]),Tt(Me=>Me.length==0?[Jt]:Me),O1(nt)):(Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"?(ge=On.getUpdatedCoordinates(Ye,be,Jt),Tt(ge),O1(ge)):(Ce==null?void 0:Ce.awi_annotation_type)==="circle"?(Kr(be),O1(nt)):(Ce==null||Ce.awi_annotation_type,O1(nt));return}else if(c&&Dt!=="-1"&&vt){if(console.log("isDrawingAnnotation",En),gn){const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=Me-(L1.x||0),ut=Te-(L1.y||0);if(u!=="-1"){ge=[...nt].map(hn=>({x:hn.x+De,y:hn.y+ut}));const xt=E2(u);if(xt)switch(xt.awi_coords=[...ge],Ce==null?void 0:Ce.awi_annotation_type){case"dot":{ge.length===1&&(ge[0].x=On.getPerfectPointValue(ge[0].x),ge[0].y=On.getPerfectPointValue(ge[0].y));break}case"circle":{ge.length===2&&(ge=[...On.adjustToCircle(ge)],xt.awi_coords=[...ge]);break}case"rectangle":{if(ge.length===4){const hn=Math.abs(ge[1].x-ge[0].x),Ct=Math.abs(ge[3].y-ge[1].y);for(let Kt=0;Kt<ge.length;Kt++)ge[Kt].x<0?(ge[1].x=hn,ge[2].x=hn,ge[0].x=1e-4,ge[3].x=1e-4):ge[Kt].y<0?(ge[2].y=Ct,ge[3].y=Ct,ge[0].y=1e-4,ge[1].y=1e-4):ge[Kt].x>1?(ge[0].x=1-hn,ge[3].x=1-hn,ge[1].x=1-1e-4,ge[2].x=1-1e-4):ge[Kt].y>1&&(ge[0].y=1-Ct,ge[1].y=1-Ct,ge[2].y=1-1e-4,ge[3].y=1-1e-4)}break}case"polygon":{ge.length>1&&F2(ge,be);break}default:{console.log("Unknown request type");break}}Ze()(ge)}}else if(Jn.x!==-1&&Jn.y!==-1&&u!=="-1"){console.log("Corner coordinates");const Me=E2(u);if((Ce==null?void 0:Ce.awi_annotation_type)==="circle"){const Te=On.getMousePos(Ye.current,be);if(Me){ge=Me.awi_coords;const De=(ge[0].x+ge[1].x)/2,ut=(ge[0].y+ge[1].y)/2,xt=On.getDistance(Te.x,Te.y,De,ut);De-xt<0?(ge[0]={x:0,y:ut},ge[1]={x:2*xt,y:ut}):De+xt>1?(ge[0]={x:1-2*xt,y:ut},ge[1]={x:1,y:ut}):ut-xt<0?(ge[0]={x:De,y:0},ge[1]={x:De,y:2*xt}):ut+xt>1?(ge[0]={x:De,y:1-2*xt},ge[1]={x:De,y:1}):(ge[0]={x:De-xt,y:ut},ge[1]={x:De+xt,y:ut}),ge=[...On.adjustToCircle(ge)]}}else if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&!Pn){const Te=On.getMousePos(Ye.current,be);Me!=null&&Me.awi_coords&&(ge=[...Me.awi_coords],v1>-1&&(v1===0||v1===ge.length-1?(ge[0]={x:Te.x,y:Te.y},ge[ge.length-1]={x:Te.x,y:Te.y}):ge[v1]={x:Te.x,y:Te.y},$n({x:Te.x,y:Te.y})))}else ge=On.getUpdatedCoordinates(Ye,be,Jn);if(l0(ge)){Tt([...ge]);const Te=E2(u);Te&&(Te.awi_coords=ge,O1(ge))}}}else if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&!c&&(nt==null?void 0:nt.length)>1){const{x:Me,y:Te}=On.getMousePos(Ye.current,be);ht(nt,{x:Me,y:Te})}},Ha=be=>{if(be.touches.length===1){const ge=be.touches[0];if(X0()){if(at.scale==1)return;S1.current||(S1.current={x:ge.clientX,y:ge.clientY})}else{const Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget,button:0};ri(Me)}}},Gr=be=>{if(be.preventDefault(),be.touches.length>=2){const[ge,Me]=[be.touches[0],be.touches[1]],Te=Me.clientX-ge.clientX,De=Me.clientY-ge.clientY,ut=Math.hypot(Te,De);if(yn!==null){const xt=ut-yn,Xt=(ge.clientX+Me.clientX)/2,hn=(ge.clientY+Me.clientY)/2;x0({deltaY:-xt,clientX:Xt,clientY:hn,currentTarget:be.currentTarget})}Hn(ut)}if(be.touches.length===1){const ge=be.touches[0];if(X0()){if(S1.current){console.log("PANNING!!!!!");const Me=ge.clientX-S1.current.x,Te=ge.clientY-S1.current.y,{x:De,y:ut}=at,xt=De+Me,Xt=ut+Te,hn=Math.max(Math.min(xt,0),wt.width-wt.width*at.scale),Ct=Math.max(Math.min(Xt,0),wt.height-wt.height*at.scale);mn({scale:at.scale,x:hn,y:Ct}),S1.current={x:ge.clientX,y:ge.clientY}}}else{S1.current&&(S1.current=null);const Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};Qr(Me)}}},nr=be=>{if(S1.current&&(S1.current=null),be.touches.length<2&&Hn(null),X0()){be.preventDefault();return}const ge=be.touches[0]||be.changedTouches[0],Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};vr(Me)},yo=be=>{const ge=be.touches[0]||be.changedTouches[0],Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};ti(Me)},Ti=(be="")=>{switch(be){case"left":po();break;case"right":Ao();break;case"top":pr();break;case"bottom":Wr();break;default:console.warn(`Unknown pan direction: ${be}`)}},La=()=>{typeof x=="function"&&x(be=>!be)},E9=()=>{if(!u||u=="-1"){W1.error("Control copy will be work only when you have a selected annotation");return}else P&&typeof P=="function"&&P(vn==null?void 0:vn.result,!1)},Fi=()=>{if(!d2.current||!$o.current)return;const be=d2.current,ge=be.getContext("2d");if(!ge)return;const Me=wt.width*at.scale,Te=wt.height*at.scale;!Me||!Te||(be.width=Me,be.height=Te,ge.clearRect(0,0,Me,Te),ge.save(),ge.setTransform(1,0,0,1,0,0),ge.clearRect(0,0,Me,Te),ge.translate(at.x,at.y),ge.scale(at.scale,at.scale),ge.drawImage($o.current,0,0,wt.width,wt.height),ge.restore())};return Z.jsxs(Z.Fragment,{children:[P2&&Z.jsx(WS,{closeSAMPromptModal:()=>Fn(!1),onSubmit:l4,directPrompt:f1,isLoading:tn,requestInfo:Ce}),A&&H&&(vn==null?void 0:vn.success)&&Z.jsx(Z.Fragment,{children:Z.jsx("div",{style:{margin:"4px",display:"flex",justifyContent:"center"},children:Z.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"max-content"},children:Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:k3,children:"Copy Annotations"})})})}),A&&Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{minHeight:T1?"50vh":"unset",touchAction:"none !important",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((f=(Ba=(oi=k==null?void 0:k.result)==null?void 0:oi.annotatorInfo)==null?void 0:Ba.awi_personal_info)==null?void 0:f.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:T1,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i),Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})]})}),!A&&je=="atom"&&Z.jsxs("div",{style:{display:"flex",flexDirection:T1?"column":"row"},children:[Z.jsx("div",{style:{height:T1?"unset":"100%",width:T1?"100%":"5.4%",border:"1px solid #E4E0E6",backgroundColor:"white"},children:["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level)&&Z.jsx("div",{style:{width:"100%",gap:"10px",marginTop:"2px",height:"100% ",display:"flex",justifyContent:"space-between",alignItems:"center",flexDirection:T1?"row":"column"},children:Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((z=(B=(b=k==null?void 0:k.result)==null?void 0:b.annotatorInfo)==null?void 0:B.awi_personal_info)==null?void 0:z.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:T1,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i)})}),Z.jsxs("div",{style:T1?{height:"100%",width:"100%"}:{width:"94.6%"},children:[!T1&&Z.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",height:T1?"8%":"3%",border:"1px solid #E4E0E6",background:"white",justifyContent:"space-between"},children:[Z.jsxs("div",{style:{display:"flex",flexDirection:"row",height:"100%",alignItems:"center"},children:[Z.jsxs("div",{className:"color-black",style:{width:"4.8rem",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:[Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:" rgba(111, 41, 169, 0.20)",height:"100%"},children:ue+1}),Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:Fe||"rgba(111, 41, 169, 0.1)",height:"100%"},children:(((X=k==null?void 0:k.result)==null?void 0:X.awi_contents)||[]).length})]}),Z.jsxs("p",{className:"color-black",style:{marginLeft:"1rem"},title:((ie=G==null?void 0:G.awi_label)==null?void 0:ie.length)>20?G.awi_label:J.length>20?J:"",children:["Image -"," ",((ke=G==null?void 0:G.awi_label)==null?void 0:ke.length)>0?G.awi_label.length>20?G.awi_label.substring(0,20)+"...":G.awi_label:J.length>20?J.substring(0,20)+"...":J]}),Z.jsx("p",{className:"color-black",style:{marginLeft:"1rem"},children:((ye==null?void 0:ye.result)||[]).length>0&&`Annotations - ${((ye==null?void 0:ye.result)||[]).length} (Recent First) ${S.size?`Selected - ${((ye==null?void 0:ye.result)||[]).length-S.size}`:""}`})]}),Z.jsx("div",{children:Z.jsxs("div",{style:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},className:"color-black",children:[Z.jsx("div",{children:g0}),(g0==null?void 0:g0.length)>0&&Z.jsx(w7,{color:"#000"})]})})]}),Z.jsx("div",{children:W&&T1&&We&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(We,{handleNextPage:V,handlePreviousPage:T,currentPage:$,images:(Je=k==null?void 0:k.result)==null?void 0:Je.awi_contents,handleIndexUpdate:K,currentIndex:ue,request_id:q,requestFor:(rt=k==null?void 0:k.result)==null?void 0:rt.awi_request_for,imagePagination:W,showImages:!0,fetchAnnotations:Le,pageCount:Be})})}),Z.jsx("div",{style:{height:T1||y9?"25px":"3%",border:"1px solid #E4E0E6",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px",backgroundColor:"#fff"},children:T1&&(g0==null?void 0:g0.length)>0?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center",fontWeight:"bold"},children:g0})}):Z.jsx(Z.Fragment,{children:at.scale>1?Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"space-between",alignItems:"center"},children:[Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("left"),children:"Left"}),Z.jsx("progress",{value:X2.left,max:wt.width,title:X2.left==0?"You can not move left more":"Showing how much you can move left more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("right"),children:"Right"}),Z.jsx("progress",{value:X2.right,max:wt.width,title:X2.right==0?"You can not move right more":"Showing how much you can move right more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("top"),children:"Top"}),Z.jsx("progress",{value:X2.top,max:wt.height,title:X2.top==0?"You can not move top more":"Showing how much you can move top more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("bottom"),children:"Bottom"}),Z.jsx("progress",{value:X2.bottom,max:wt.height,title:X2.bottom==0?"You can not move bottom more":"Showing how much you can move bottom more"})]})}):Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center"},children:"Zoom in to see image pan progress"})})}),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{height:W?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:T1?"50vh":"unset",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})}),W&&!T1&&We&&Z.jsx("div",{children:W&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(We,{handleNextPage:V,handlePreviousPage:T,currentPage:$,images:(Bt=k==null?void 0:k.result)==null?void 0:Bt.awi_contents,handleIndexUpdate:K,currentIndex:ue,request_id:q,requestFor:(nn=k==null?void 0:k.result)==null?void 0:nn.awi_request_for,imagePagination:W,showImages:!0,fetchAnnotations:Le,pageCount:Be})})})]})]}),!A&&je=="library"&&Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((f0=(Gn=(In=k==null?void 0:k.result)==null?void 0:In.annotatorInfo)==null?void 0:Gn.awi_personal_info)==null?void 0:f0.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:!0,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{height:W?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:T1?"50vh":"unset",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})})]}),e1!=-1&&A9&&Z.jsx(zM,{callback:()=>Z0(A9,e1),cancelCallBack:()=>{jo(-1)},trigger:"REMOVE_POLYGON_POINT",fireOnMount:!0,children:Z.jsx(Z.Fragment,{})})]})},k9e="_message__container_u7nyp_1",D9e="_message__container__icon_u7nyp_15",P9e="_message__container__title_u7nyp_19",N9e="_message__container__title__success_u7nyp_24",T9e="_message__container__description_u7nyp_27",F9e="_message__container__loading_u7nyp_31",V9e="_pulse_u7nyp_1",_r={message__container:k9e,message__container__icon:D9e,message__container__title:P9e,message__container__title__success:N9e,message__container__description:T9e,message__container__loading:F9e,pulse:V9e},Vc=({iconUrl:e,title:t,description:n,messageType:r="information",isLoading:o=!1,textClass:i="",noPadding:a,iconName:s=""})=>{var c,u;return o?Z.jsxs("div",{className:qn(_r.message__container,_r.message__container__loading),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(c=X1[s])==null?void 0:c.IconComponent,className:_r.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_r.message__container__icon}),Z.jsx("h1",{className:qn(_r.message__container__title,{[_r.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_r.message__container__description,i),children:n})]}):Z.jsxs("div",{className:qn(_r.message__container,{noPadding:a}),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(u=X1[s])==null?void 0:u.IconComponent,className:_r.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_r.message__container__icon}),Z.jsx("h1",{className:qn(_r.message__container__title,{[_r.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_r.message__container__description,i),children:n})]})},qb={ATTRIBUTES:{labelValue:"Attributes",src:"noAttributes",description:"No attributes are available. Start by adding or configuring attributes.",messageType:"information",loadingMessage:"Loading attributes...",notFoundMessage:"No attributes found"},ORGANISATIONS:{labelValue:"Organisations",src:"noOrganisations",description:"There are no organisations available. Add a new organisation to get started.",messageType:"information",loadingMessage:"Loading organizations...",notFoundMessage:"No organisations found"},REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available. Raised requests will be displayed here.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},USERS:{labelValue:"Users",src:"noUsers",description:"No users have been added yet. Start by inviting or creating users.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},USERS_IN_REQUEST:{labelValue:"Users",src:"noUsers",description:"No users found.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},CLASSES:{labelValue:"Classes",src:"noClasses",description:"There are no classes available. Add a new class to begin.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},IMAGES:{labelValue:"Images",src:"noImages",description:"No images are currently available. Upload images to view them here.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},ANNOTATOR_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Annotator Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},VERIFIER_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Verifier Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},MODELS:{labelValue:"Models",src:"noModels",description:"There are no models available. Run jobs and train models to get started.",messageType:"information",loadingMessage:"Loading models...",notFoundMessage:"No models found"},JOBS:{labelValue:"Jobs",src:"noJobs",description:"No jobs are currently scheduled or running. Create a job to see it listed here.",messageType:"information",loadingMessage:"Loading jobs...",notFoundMessage:"No jobs found"},MODEL_LOGS:{labelValue:"Model Logs",src:"noJobLogs",description:"There are no logs available for the models. Generate or upload logs to view them.",messageType:"information",loadingMessage:"Loading model logs...",notFoundMessage:"No model logs found"},DATASETS:{labelValue:"Datasets",src:"noDatasets",description:"No datasets are available. Upload or create datasets to start working.",messageType:"information",loadingMessage:"Loading datasets...",notFoundMessage:"No datasets found"},BILLS:{labelValue:"Bills",src:"noBills",description:"No bills are currently available. Generated bills will be listed here.",messageType:"information",loadingMessage:"Loading bills...",notFoundMessage:"No bills found"},MODEL_METRICS:{labelValue:"Model Metrics",src:"noModelMetrics",description:"No metrics are available for the models. Generated metrics for analyzing performance will be listed here.",messageType:"information",loadingMessage:"Loading model metrics...",notFoundMessage:"No model metrics found"},MODEL_DETAILS:{labelValue:"Model Details",src:"noModelDetails",description:"Details for the models are not available. Add or update model details to view them.",messageType:"information",loadingMessage:"Loading model details...",notFoundMessage:"No model details found"},MODEL_RESOURCES:{labelValue:"Model Resources",src:"noModelResources",description:"No resources are available for the models. Add resources to start utilizing them.",messageType:"information",loadingMessage:"Loading model resources...",notFoundMessage:"No model resources found"},NOTIFICATIONS:{labelValue:"Notifications",src:"noNotifications",description:"No notifications are available. New notifications will be displayed here.",messageType:"information",loadingMessage:"Loading notifications...",notFoundMessage:"No notifications found"},REQUEST_IMAGES:{labelValue:"Request Images",src:"noRequestImages",description:"No request images are currently available.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No request images found"},REQUEST_PRICING:{labelValue:"Request Pricing",src:"noPrices",description:"No request pricing are currently available.",messageType:"information",loadingMessage:"Loading pricing...",notFoundMessage:"No request pricing found"},ANNOTATION_GRAPH:{labelValue:"Annotation Graph",src:"noAnnotationGraph",description:"No annotation analytics are available for the given date",messageType:"information",loadingMessage:"Loading annotation graph...",notFoundMessage:"No annotations"},LOADING_CAROUSAL:{labelValue:"Images",src:"noImages",description:"No images is available to load",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},TAGS:{labelValue:"Tags",src:"noTags",description:"No tags are available. Start by adding or configuring tags.",messageType:"information",loadingMessage:"Loading tags...",notFoundMessage:"No tags found"},NO_CSV_REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},NO_CSV_CLASS:{labelValue:"Classes",src:"noClasses",description:"There are no classes available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},CLASS_PROPORTION:{labelValue:"Class proportion",src:"noClasses",description:"No class proportion available.",messageType:"information",loadingMessage:"Loading class proportion...",notFoundMessage:"No class proportion found"},SINGLE_CLASS:{labelValue:"Class",src:"noClasses",description:"No class available.",messageType:"information",loadingMessage:"Loading class...",notFoundMessage:"No classes found"},LOADING_FILTER:{labelValue:"Filter",src:"noClasses",description:"No filter configuration.",messageType:"information",loadingMessage:"Loading filter information...",notFoundMessage:"No filter configuration found"},LOADING_ANNOTATION:{labelValue:"Annotation Loading",src:"noImages",description:"No annotation found",messageType:"information",loadingMessage:"Please wait, loading annotation...",notFoundMessage:"No annotations"},LOADING_REQUEST:{labelValue:"Request Loading",src:"noRequests",description:"No request found",messageType:"information",loadingMessage:"Please wait, loading request info...",notFoundMessage:"No request"},NOT_FOUND_GENERAL:{labelValue:"Data Loading",src:"notFoundGeneral",description:"No data found",messageType:"information",loadingMessage:"Please wait, loading data...",notFoundMessage:"No data"}},j9e=({stateKey:e="NOT_FOUND_GENERAL",loadState:t=!1,stateDescription:n=null,stateLoadDescription:r=null,showImage:o=!1,textClass:i="",noPadding:a=!1,stateTitle:s=""})=>{const c=qb[e]||qb.NOT_FOUND_GENERAL;if(!c)return Z.jsx(Z.Fragment,{});const{labelValue:u,src:d,messageType:h,description:C,notFoundMessage:m}=c;if(t)return Z.jsxs("div",{style:{width:"100%"},children:[o&&Z.jsx(Vc,{title:c.loadingMessage,iconName:d,description:r||"",isLoading:!0,noPadding:a}),!o&&Z.jsx(Vc,{title:c.loadingMessage,description:r||"",isLoading:!0,noPadding:a})]});{const A=(s==null?void 0:s.length)>0?s:m?m||`No ${u} Found`:"",v=n||C;return Z.jsx("div",{style:{width:"100%"},children:Z.jsx(Vc,{title:A,iconName:d,description:v,messageType:h,textClass:i,noPadding:a})})}},z9e="_tableBar_103oy_1",Z9e="_buttonGroup_103oy_13",U9e="_btnIcon_103oy_34",$9e="_searchBar_103oy_41",K9e="_searchInput_103oy_53",W9e="_searchIcon_103oy_58",Q9e="_removeBorder_103oy_63",G9e="_button_103oy_13",Y9e="_isSelected_103oy_74",q9e="_isDisabled_103oy_80",X9e="_isActive_103oy_85",J9e="_isText_103oy_92",sr={tableBar:z9e,buttonGroup:Z9e,btnIcon:U9e,searchBar:$9e,searchInput:K9e,searchIcon:W9e,removeBorder:Q9e,button:G9e,isSelected:Y9e,isDisabled:q9e,isActive:X9e,isText:J9e},e3e=({showSearch:e=!1,leftButtons:t=[],rightButtons:n=[],searchFunction:r,searchDelay:o=300,onSearchClick:i,searchPlaceHolder:a="Search...",showSearchEye:s=!0,borderRequired:c=!0,borderColor:u})=>{const d=R.useCallback(cl.debounce((A,v)=>{typeof v=="function"&&v(A)},o),[o]),h=A=>{const v=A.currentTarget.value.trim();d(v,r)},C=()=>{typeof i=="function"&&i()};if(!t.length&&!n.length&&!e)return null;const m=(A,v)=>{const p=A.type==="text";return Z.jsxs("button",{onClick:!p&&!A.isDisabled?A.onClick:void 0,title:A.title||"",disabled:A.isDisabled,className:qn(sr.button,{[sr.isText]:p,[sr.isSelected]:A.isSelected,[sr.isDisabled]:A.isDisabled,[sr.isActive]:A.isActive&&!A.isSelected}),children:[A.icon&&Z.jsx("img",{src:A.icon,alt:A.name,className:sr.btnIcon}),Z.jsx("div",{children:A.name})]},v)};return Z.jsxs("div",{className:qn(sr.tableBar,!c&&sr.removeBorder),style:{borderColor:c?u||"#909090":void 0},children:[Z.jsxs("div",{className:sr.buttonGroup,children:[t.map(m)," "]}),Z.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"10px"},children:[Z.jsx("div",{className:sr.buttonGroup,children:n.map(m)}),e&&Z.jsx("div",{className:sr.searchBar,title:a,children:Z.jsxs("form",{autoComplete:"off",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",position:"relative"},children:[Z.jsx("input",{type:"text",name:"userSearchInput",autoComplete:"off",placeholder:a,className:sr.searchInput,onKeyUp:h}),s&&Z.jsx("img",{src:X1.searchUrl.IconComponent,alt:a,className:qn(sr.btnIcon,"cursor-pointer",sr.searchIcon),onClick:C})]})})]})]})},dH=({currentPage:e,totalPages:t,onPageChange:n,isLoading:r=!1})=>{const[o,i]=R.useState(`${e}`);R.useEffect(()=>{i(`${e}`)},[e]);const a=()=>{const s=Number(o);s>=1&&s<=t&&n(s),i("")};return Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:p2.pagination_container,children:[Z.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",maxHeight:"2vh"},children:r?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:p2.pagination_loading,children:"Loading..."})}):Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{className:p2.pagination_left,children:Z.jsx("input",{type:"number",min:"1",max:t,value:o,onChange:s=>{i(s.target.value)},onBlur:()=>{if(o==""){i(`${e}`);return}const s=parseInt(o,10);if(!isNaN(s)){let c=Math.max(1,Math.min(t,s)).toString();c!=null&&c.length||(c="1"),i(c),a()}},onKeyDown:s=>{if(s.key==="Enter"){s==null||s.preventDefault(),s==null||s.stopPropagation();const c=parseInt(o,10);if(!isNaN(c)){const u=Math.max(1,Math.min(t,c)).toString();i(u),a()}}},placeholder:o,style:{background:"transparent",border:"0",width:"100%",height:"100%"}})}),Z.jsx("div",{className:p2.pagination_right,children:t})]})}),Z.jsxs("div",{style:{gap:"20px",display:"flex"},children:[Z.jsx("img",{src:X1.backArrow.IconComponent,onClick:()=>e>1&&n(e-1),style:{cursor:e>1?"pointer":"not-allowed"},className:p2.nextPrevArrow,title:e>1?`Go to page number ${e-1} `:"Go to previous page is not allowed"}),Z.jsx("img",{src:X1.forwardArrow.IconComponent,onClick:()=>e<t&&n(e+1),style:{cursor:e<t?"pointer":"not-allowed"},className:p2.nextPrevArrow,title:e<t?`Go to page number ${e+1}`:"Go to next page is not allowed"})]})]})})},t3e=({hasNextPage:e,isFetchingNextPage:t=!1,fetchNextPage:n,isLoading:r=!1,totalResults:o=0,totalFetchedResults:i=0,currentPage:a=1,totalPages:s=10,onPageChange:c,isPagination:u=!1,loadText:d=""})=>{let h="Load More";return i+1===o?h="Load last results":r||t?u?a==1?h="Loading...":h=`Loading page number ${a}`:o===0?h="Loading...":i+1===o?h="Loading last results...":h=`Loading ${i+1} to ${o}`:i===0?(d==null?void 0:d.length)==0?h="Load":h=d:h=`Load ${i+1} to ${o}`,u&&c?Z.jsx(dH,{currentPage:a,totalPages:s,onPageChange:c,isLoading:r||t}):Z.jsx("div",{className:p2.loadMoreButtonDiv,style:{display:"flex",justifyContent:"center",marginTop:"16px"},children:e&&!t&&Z.jsx("div",{className:p2.loadMoreButtonContainer,children:Z.jsx("button",{onClick:()=>n?n():void 0,className:"modalButton modalButton__purpleColor",disabled:r||t,children:h})})})},n3e=({items:e,listType:t="ul",maxHeight:n="100px"})=>{const r=t;return!e||e.length===0?Z.jsx("div",{style:{minWidth:"30px"},children:"N/A"}):Z.jsx(r,{style:{maxHeight:n,overflow:"auto",paddingLeft:"20px"},children:e.map((o,i)=>Z.jsx("li",{style:{minWidth:"10vw"},children:o},i))})};var fH=(e=>(e.LARGE="l",e.MEDIUM="m",e))(fH||{});const r3e=({badgeContent:e,variant:t=fH.LARGE,backgroundColor:n,textColor:r,className:o,style:i,...a})=>Z.jsx("span",{className:`badge badge_${t} ${o} ${e?"":"badge_dot"}`,style:{"--c_background":n,"--c_text":r,...i},...a,children:e}),o3e=({items:e,value:t,onChange:n=()=>{},color:r,width:o,gap:i})=>Z.jsx("div",{className:"button_group",style:{gap:i},children:e==null?void 0:e.map((a,s)=>Z.jsx(i2,{variant:"primary",content:a.label,onClick:()=>n(a.value),width:o,className:`button_group_button ${s==0?"first":""} ${s==e.length-1?"last":""} ${a.value==t?"active":""}`,backgroundColor:r,borderColor:r},a.value))});/*!
|
|
339
|
+
}`;var i1=nv(function(){return h1(me,Ln+"return "+It).apply(n,Oe)});if(i1.source=It,hd(i1))throw i1;return i1}function PV(g){return z1(g).toLowerCase()}function NV(g){return z1(g).toUpperCase()}function TV(g,y,I){if(g=z1(g),g&&(I||y===n))return x9(g);if(!g||!(y=br(y)))return g;var Q=J0(g),te=J0(y),me=S2(Q,te),Oe=Ur(Q,te)+1;return ka(Q,me,Oe).join("")}function FV(g,y,I){if(g=z1(g),g&&(I||y===n))return g.slice(0,ti(g)+1);if(!g||!(y=br(y)))return g;var Q=J0(g),te=Ur(Q,J0(y))+1;return ka(Q,0,te).join("")}function VV(g,y,I){if(g=z1(g),g&&(I||y===n))return g.replace(pt,"");if(!g||!(y=br(y)))return g;var Q=J0(g),te=S2(Q,J0(y));return ka(Q,te).join("")}function jV(g,y){var I=D,Q=N;if(b0(y)){var te="separator"in y?y.separator:te;I="length"in y?r1(y.length):I,Q="omission"in y?br(y.omission):Q}g=z1(g);var me=g.length;if(Co(g)){var Oe=J0(g);me=Oe.length}if(I>=me)return g;var Pe=I-Z0(Q);if(Pe<1)return Q;var Ke=Oe?ka(Oe,0,Pe).join(""):g.slice(0,Pe);if(te===n)return Ke+Q;if(Oe&&(Pe+=Ke.length-Pe),Cd(te)){if(g.slice(Pe).search(te)){var St,Mt=Ke;for(te.global||(te=mo(te.source,z1(Et.exec(te))+"g")),te.lastIndex=0;St=te.exec(Mt);)var It=St.index;Ke=Ke.slice(0,It===n?Pe:It)}}else if(g.indexOf(br(te),Pe)!=Pe){var ln=Ke.lastIndexOf(te);ln>-1&&(Ke=Ke.slice(0,ln))}return Ke+Q}function zV(g){return g=z1(g),g&&Gt.test(g)?g.replace(an,ki):g}var ZV=N3(function(g,y,I){return g+(I?" ":"")+y.toUpperCase()}),pd=rA("toUpperCase");function tv(g,y,I){return g=z1(g),y=I?n:y,y===n?$r(g)?Di(g):Qo(g):g.match(y)||[]}var nv=d1(function(g,y){try{return s0(g,n,y)}catch(I){return hd(I)?I:new Un(I)}}),UV=Zi(function(g,y){return g0(y,function(I){I=li(I),ji(g,I,dd(g[I],g))}),g});function $V(g){var y=g==null?0:g.length,I=Vn();return g=y?G1(g,function(Q){if(typeof Q[1]!="function")throw new x0(a);return[I(Q[0]),Q[1]]}):[],d1(function(Q){for(var te=-1;++te<y;){var me=g[te];if(s0(me[0],this,Q))return s0(me[1],this,Q)}})}function KV(g){return pP(Xr(g,h))}function Ad(g){return function(){return g}}function WV(g,y){return g==null||g!==g?y:g}var QV=iA(),GV=iA(!0);function ar(g){return g}function vd(g){return Dp(typeof g=="function"?g:Xr(g,h))}function YV(g){return Np(Xr(g,h))}function qV(g,y){return Tp(g,Xr(y,h))}var XV=d1(function(g,y){return function(I){return f4(I,g,y)}}),JV=d1(function(g,y){return function(I){return f4(g,I,y)}});function bd(g,y,I){var Q=r2(y),te=Vl(y,Q);I==null&&!(b0(y)&&(te.length||!Q.length))&&(I=y,y=g,g=this,te=Vl(y,r2(y)));var me=!(b0(I)&&"chain"in I)||!!I.chain,Oe=$i(g);return g0(te,function(Pe){var Ke=y[Pe];g[Pe]=Ke,Oe&&(g.prototype[Pe]=function(){var St=this.__chain__;if(me||St){var Mt=g(this.__wrapped__),It=Mt.__actions__=rr(this.__actions__);return It.push({func:Ke,args:arguments,thisArg:g}),Mt.__chain__=St,Mt}return Ke.apply(g,d2([this.value()],arguments))})}),g}function ej(){return L0._===this&&(L0._=Ma),this}function yd(){}function tj(g){return g=r1(g),d1(function(y){return Fp(y,g)})}var nj=Xu(G1),rj=Xu(Zo),oj=Xu(Ko);function rv(g){return id(g)?Yo(li(g)):kP(g)}function ij(g){return function(y){return g==null?n:H9(g,y)}}var aj=sA(),sj=sA(!0);function wd(){return[]}function xd(){return!1}function lj(){return{}}function cj(){return""}function uj(){return!0}function dj(g,y){if(g=r1(g),g<1||g>K)return[];var I=U,Q=ie(g,U);y=Vn(y),g-=U;for(var te=w9(Q,y);++I<g;)y(I);return te}function fj(g){return Yn(g)?G1(g,li):yr(g)?[g]:rr(xA(z1(g)))}function hj(g){var y=++l4;return z1(g)+y}var Cj=Kl(function(g,y){return g+y},0),gj=Ju("ceil"),mj=Kl(function(g,y){return g/y},1),pj=Ju("floor");function Aj(g){return g&&g.length?Fl(g,ar,Tu):n}function vj(g,y){return g&&g.length?Fl(g,Vn(y,2),Tu):n}function bj(g){return Oi(g,ar)}function yj(g,y){return Oi(g,Vn(y,2))}function wj(g){return g&&g.length?Fl(g,ar,zu):n}function xj(g,y){return g&&g.length?Fl(g,Vn(y,2),zu):n}var _j=Kl(function(g,y){return g*y},1),Ej=Ju("round"),Sj=Kl(function(g,y){return g-y},0);function Mj(g){return g&&g.length?E2(g,ar):0}function Hj(g,y){return g&&g.length?E2(g,Vn(y,2)):0}return ce.after=YT,ce.ary=kA,ce.assign=NF,ce.assignIn=QA,ce.assignInWith=i6,ce.assignWith=TF,ce.at=FF,ce.before=DA,ce.bind=dd,ce.bindAll=UV,ce.bindKey=PA,ce.castArray=lF,ce.chain=OA,ce.chunk=pN,ce.compact=AN,ce.concat=vN,ce.cond=$V,ce.conforms=KV,ce.constant=Ad,ce.countBy=MT,ce.create=VF,ce.curry=NA,ce.curryRight=TA,ce.debounce=FA,ce.defaults=jF,ce.defaultsDeep=zF,ce.defer=qT,ce.delay=XT,ce.difference=bN,ce.differenceBy=yN,ce.differenceWith=wN,ce.drop=xN,ce.dropRight=_N,ce.dropRightWhile=EN,ce.dropWhile=SN,ce.fill=MN,ce.filter=LT,ce.flatMap=RT,ce.flatMapDeep=IT,ce.flatMapDepth=kT,ce.flatten=MA,ce.flattenDeep=HN,ce.flattenDepth=LN,ce.flip=JT,ce.flow=QV,ce.flowRight=GV,ce.fromPairs=BN,ce.functions=GF,ce.functionsIn=YF,ce.groupBy=DT,ce.initial=RN,ce.intersection=IN,ce.intersectionBy=kN,ce.intersectionWith=DN,ce.invert=XF,ce.invertBy=JF,ce.invokeMap=NT,ce.iteratee=vd,ce.keyBy=TT,ce.keys=r2,ce.keysIn=ir,ce.map=Jl,ce.mapKeys=tV,ce.mapValues=nV,ce.matches=YV,ce.matchesProperty=qV,ce.memoize=t6,ce.merge=rV,ce.mergeWith=GA,ce.method=XV,ce.methodOf=JV,ce.mixin=bd,ce.negate=n6,ce.nthArg=tj,ce.omit=oV,ce.omitBy=iV,ce.once=eF,ce.orderBy=FT,ce.over=nj,ce.overArgs=tF,ce.overEvery=rj,ce.overSome=oj,ce.partial=fd,ce.partialRight=VA,ce.partition=VT,ce.pick=aV,ce.pickBy=YA,ce.property=rv,ce.propertyOf=ij,ce.pull=FN,ce.pullAll=LA,ce.pullAllBy=VN,ce.pullAllWith=jN,ce.pullAt=zN,ce.range=aj,ce.rangeRight=sj,ce.rearg=nF,ce.reject=ZT,ce.remove=ZN,ce.rest=rF,ce.reverse=cd,ce.sampleSize=$T,ce.set=lV,ce.setWith=cV,ce.shuffle=KT,ce.slice=UN,ce.sortBy=GT,ce.sortedUniq=qN,ce.sortedUniqBy=XN,ce.split=RV,ce.spread=oF,ce.tail=JN,ce.take=eT,ce.takeRight=tT,ce.takeRightWhile=nT,ce.takeWhile=rT,ce.tap=AT,ce.throttle=iF,ce.thru=Xl,ce.toArray=$A,ce.toPairs=qA,ce.toPairsIn=XA,ce.toPath=fj,ce.toPlainObject=WA,ce.transform=uV,ce.unary=aF,ce.union=oT,ce.unionBy=iT,ce.unionWith=aT,ce.uniq=sT,ce.uniqBy=lT,ce.uniqWith=cT,ce.unset=dV,ce.unzip=ud,ce.unzipWith=BA,ce.update=fV,ce.updateWith=hV,ce.values=V3,ce.valuesIn=CV,ce.without=uT,ce.words=tv,ce.wrap=sF,ce.xor=dT,ce.xorBy=fT,ce.xorWith=hT,ce.zip=CT,ce.zipObject=gT,ce.zipObjectDeep=mT,ce.zipWith=pT,ce.entries=qA,ce.entriesIn=XA,ce.extend=QA,ce.extendWith=i6,bd(ce,ce),ce.add=Cj,ce.attempt=nv,ce.camelCase=AV,ce.capitalize=JA,ce.ceil=gj,ce.clamp=gV,ce.clone=cF,ce.cloneDeep=dF,ce.cloneDeepWith=fF,ce.cloneWith=uF,ce.conformsTo=hF,ce.deburr=ev,ce.defaultTo=WV,ce.divide=mj,ce.endsWith=vV,ce.eq=xo,ce.escape=bV,ce.escapeRegExp=yV,ce.every=HT,ce.find=BT,ce.findIndex=EA,ce.findKey=ZF,ce.findLast=OT,ce.findLastIndex=SA,ce.findLastKey=UF,ce.floor=pj,ce.forEach=RA,ce.forEachRight=IA,ce.forIn=$F,ce.forInRight=KF,ce.forOwn=WF,ce.forOwnRight=QF,ce.get=gd,ce.gt=CF,ce.gte=gF,ce.has=qF,ce.hasIn=md,ce.head=HA,ce.identity=ar,ce.includes=PT,ce.indexOf=ON,ce.inRange=mV,ce.invoke=eV,ce.isArguments=O9,ce.isArray=Yn,ce.isArrayBuffer=mF,ce.isArrayLike=or,ce.isArrayLikeObject=O0,ce.isBoolean=pF,ce.isBuffer=Da,ce.isDate=AF,ce.isElement=vF,ce.isEmpty=bF,ce.isEqual=yF,ce.isEqualWith=wF,ce.isError=hd,ce.isFinite=xF,ce.isFunction=$i,ce.isInteger=jA,ce.isLength=r6,ce.isMap=zA,ce.isMatch=_F,ce.isMatchWith=EF,ce.isNaN=SF,ce.isNative=MF,ce.isNil=LF,ce.isNull=HF,ce.isNumber=ZA,ce.isObject=b0,ce.isObjectLike=E0,ce.isPlainObject=A4,ce.isRegExp=Cd,ce.isSafeInteger=BF,ce.isSet=UA,ce.isString=o6,ce.isSymbol=yr,ce.isTypedArray=F3,ce.isUndefined=OF,ce.isWeakMap=RF,ce.isWeakSet=IF,ce.join=PN,ce.kebabCase=wV,ce.last=eo,ce.lastIndexOf=NN,ce.lowerCase=xV,ce.lowerFirst=_V,ce.lt=kF,ce.lte=DF,ce.max=Aj,ce.maxBy=vj,ce.mean=bj,ce.meanBy=yj,ce.min=wj,ce.minBy=xj,ce.stubArray=wd,ce.stubFalse=xd,ce.stubObject=lj,ce.stubString=cj,ce.stubTrue=uj,ce.multiply=_j,ce.nth=TN,ce.noConflict=ej,ce.noop=yd,ce.now=e6,ce.pad=EV,ce.padEnd=SV,ce.padStart=MV,ce.parseInt=HV,ce.random=pV,ce.reduce=jT,ce.reduceRight=zT,ce.repeat=LV,ce.replace=BV,ce.result=sV,ce.round=Ej,ce.runInContext=Ze,ce.sample=UT,ce.size=WT,ce.snakeCase=OV,ce.some=QT,ce.sortedIndex=$N,ce.sortedIndexBy=KN,ce.sortedIndexOf=WN,ce.sortedLastIndex=QN,ce.sortedLastIndexBy=GN,ce.sortedLastIndexOf=YN,ce.startCase=IV,ce.startsWith=kV,ce.subtract=Sj,ce.sum=Mj,ce.sumBy=Hj,ce.template=DV,ce.times=dj,ce.toFinite=Ki,ce.toInteger=r1,ce.toLength=KA,ce.toLower=PV,ce.toNumber=to,ce.toSafeInteger=PF,ce.toString=z1,ce.toUpper=NV,ce.trim=TV,ce.trimEnd=FV,ce.trimStart=VV,ce.truncate=jV,ce.unescape=zV,ce.uniqueId=hj,ce.upperCase=ZV,ce.upperFirst=pd,ce.each=RA,ce.eachRight=IA,ce.first=HA,bd(ce,function(){var g={};return ai(ce,function(y,I){u1.call(ce.prototype,I)||(g[I]=y)}),g}(),{chain:!1}),ce.VERSION=r,g0(["bind","bindKey","curry","curryRight","partial","partialRight"],function(g){ce[g].placeholder=ce}),g0(["drop","take"],function(g,y){rn.prototype[g]=function(I){I=I===n?1:X(r1(I),0);var Q=this.__filtered__&&!y?new rn(this):this.clone();return Q.__filtered__?Q.__takeCount__=ie(I,Q.__takeCount__):Q.__views__.push({size:ie(I,U),type:g+(Q.__dir__<0?"Right":"")}),Q},rn.prototype[g+"Right"]=function(I){return this.reverse()[g](I).reverse()}}),g0(["filter","map","takeWhile"],function(g,y){var I=y+1,Q=I==j||I==T;rn.prototype[g]=function(te){var me=this.clone();return me.__iteratees__.push({iteratee:Vn(te,3),type:I}),me.__filtered__=me.__filtered__||Q,me}}),g0(["head","last"],function(g,y){var I="take"+(y?"Right":"");rn.prototype[g]=function(){return this[I](1).value()[0]}}),g0(["initial","tail"],function(g,y){var I="drop"+(y?"":"Right");rn.prototype[g]=function(){return this.__filtered__?new rn(this):this[I](1)}}),rn.prototype.compact=function(){return this.filter(ar)},rn.prototype.find=function(g){return this.filter(g).head()},rn.prototype.findLast=function(g){return this.reverse().find(g)},rn.prototype.invokeMap=d1(function(g,y){return typeof g=="function"?new rn(this):this.map(function(I){return f4(I,g,y)})}),rn.prototype.reject=function(g){return this.filter(n6(Vn(g)))},rn.prototype.slice=function(g,y){g=r1(g);var I=this;return I.__filtered__&&(g>0||y<0)?new rn(I):(g<0?I=I.takeRight(-g):g&&(I=I.drop(g)),y!==n&&(y=r1(y),I=y<0?I.dropRight(-y):I.take(y-g)),I)},rn.prototype.takeRightWhile=function(g){return this.reverse().takeWhile(g).reverse()},rn.prototype.toArray=function(){return this.take(U)},ai(rn.prototype,function(g,y){var I=/^(?:filter|find|map|reject)|While$/.test(y),Q=/^(?:head|last)$/.test(y),te=ce[Q?"take"+(y=="last"?"Right":""):y],me=Q||/^find/.test(y);te&&(ce.prototype[y]=function(){var Oe=this.__wrapped__,Pe=Q?[1]:arguments,Ke=Oe instanceof rn,St=Pe[0],Mt=Ke||Yn(Oe),It=function(p1){var _1=te.apply(ce,d2([p1],Pe));return Q&&ln?_1[0]:_1};Mt&&I&&typeof St=="function"&&St.length!=1&&(Ke=Mt=!1);var ln=this.__chain__,Ln=!!this.__actions__.length,zn=me&&!ln,i1=Ke&&!Ln;if(!me&&Mt){Oe=i1?Oe:new rn(this);var Zn=g.apply(Oe,Pe);return Zn.__actions__.push({func:Xl,args:[It],thisArg:n}),new m1(Zn,ln)}return zn&&i1?g.apply(this,Pe):(Zn=this.thru(It),zn?Q?Zn.value()[0]:Zn.value():Zn)})}),g0(["pop","push","shift","sort","splice","unshift"],function(g){var y=po[g],I=/^(?:push|sort|unshift)$/.test(g)?"tap":"thru",Q=/^(?:pop|shift)$/.test(g);ce.prototype[g]=function(){var te=arguments;if(Q&&!this.__chain__){var me=this.value();return y.apply(Yn(me)?me:[],te)}return this[I](function(Oe){return y.apply(Yn(Oe)?Oe:[],te)})}}),ai(rn.prototype,function(g,y){var I=ce[y];if(I){var Q=I.name+"";u1.call(Te,Q)||(Te[Q]=[]),Te[Q].push({name:y,func:I})}}),Te[$l(n,_).name]=[{name:"wrapper",func:n}],rn.prototype.clone=_0,rn.prototype.reverse=t2,rn.prototype.value=j2,ce.prototype.at=vT,ce.prototype.chain=bT,ce.prototype.commit=yT,ce.prototype.next=wT,ce.prototype.plant=_T,ce.prototype.reverse=ET,ce.prototype.toJSON=ce.prototype.valueOf=ce.prototype.value=ST,ce.prototype.first=ce.prototype.head,Gr&&(ce.prototype[Gr]=xT),ce},F2=ni();w2?((w2.exports=F2)._=F2,u2._=F2):L0._=F2}).call(aae)}(W4,W4.exports)),W4.exports}var cl=sae();const bi=uo(cl),Fd="/not_available.svg",lae="/big_size_image.svg",Vd="/user.png",ZM={HARDCODED_FALL_BACK_IMAGE:Fd,HARDCODED_FALL_BACK_BIG_IMAGE:lae,DEFAULT_AVATAR_IMAGE:Vd,generateImageUrl:(e,t=!1)=>e||Fd,getImageKitUrl:(e,t=300,n=300,r=40)=>e||Fd,getUserAvatar:e=>{var t;return!e||!((t=e.awi_personal_info)!=null&&t.awi_avatar)?Vd:e.awi_personal_info.awi_avatar||Vd}};var U3=ug();const jd=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function zd(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),n)}function M4(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on".concat(t),n)}function UM(e,t){const n=t.slice(0,t.length-1);for(let r=0;r<n.length;r++)n[r]=e[n[r].toLowerCase()];return n}function $M(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let n=t.lastIndexOf("");for(;n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function cae(e,t){const n=e.length>=t.length?e:t,r=e.length>=t.length?t:e;let o=!0;for(let i=0;i<n.length;i++)r.indexOf(n[i])===-1&&(o=!1);return o}const Ms={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":jd?173:189,"=":jd?61:187,";":jd?59:186,"'":222,"[":219,"]":221,"\\":220},Io={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Q4={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},m2={16:!1,18:!1,17:!1,91:!1},y0={};for(let e=1;e<20;e++)Ms["f".concat(e)]=111+e;let p0=[],us=null,KM="all";const na=new Map,ul=e=>Ms[e.toLowerCase()]||Io[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),uae=e=>Object.keys(Ms).find(t=>Ms[t]===e),dae=e=>Object.keys(Io).find(t=>Io[t]===e);function WM(e){KM=e||"all"}function Hs(){return KM||"all"}function fae(){return p0.slice(0)}function hae(){return p0.map(e=>uae(e)||dae(e)||String.fromCharCode(e))}function Cae(){const e=[];return Object.keys(y0).forEach(t=>{y0[t].forEach(n=>{let{key:r,scope:o,mods:i,shortcut:a}=n;e.push({scope:o,shortcut:a,mods:i,keys:r.split("+").map(s=>ul(s))})})}),e}function gae(e){const t=e.target||e.srcElement,{tagName:n}=t;let r=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(r=!1),r}function mae(e){return typeof e=="string"&&(e=ul(e)),p0.indexOf(e)!==-1}function pae(e,t){let n,r;e||(e=Hs());for(const o in y0)if(Object.prototype.hasOwnProperty.call(y0,o))for(n=y0[o],r=0;r<n.length;)n[r].scope===e?n.splice(r,1).forEach(a=>{let{element:s}=a;return Mg(s)}):r++;Hs()===e&&WM(t||"all")}function Aae(e){let t=e.keyCode||e.which||e.charCode;const n=p0.indexOf(t);if(n>=0&&p0.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&p0.splice(0,p0.length),(t===93||t===224)&&(t=91),t in m2){m2[t]=!1;for(const r in Io)Io[r]===t&&(ao[r]=!1)}}function QM(e){if(typeof e>"u")Object.keys(y0).forEach(o=>{Array.isArray(y0[o])&&y0[o].forEach(i=>h6(i)),delete y0[o]}),Mg(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&h6(o)});else if(typeof e=="object")e.key&&h6(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let[o,i]=n;typeof o=="function"&&(i=o,o=""),h6({key:e,scope:o,method:i,splitKey:"+"})}}const h6=e=>{let{key:t,scope:n,method:r,splitKey:o="+"}=e;$M(t).forEach(a=>{const s=a.split(o),c=s.length,u=s[c-1],d=u==="*"?"*":ul(u);if(!y0[d])return;n||(n=Hs());const h=c>1?UM(Io,s):[],C=[];y0[d]=y0[d].filter(m=>{const v=(r?m.method===r:!0)&&m.scope===n&&cae(m.mods,h);return v&&C.push(m.element),!v}),C.forEach(m=>Mg(m))})};function Kb(e,t,n,r){if(t.element!==r)return;let o;if(t.scope===n||t.scope==="all"){o=t.mods.length>0;for(const i in m2)Object.prototype.hasOwnProperty.call(m2,i)&&(!m2[i]&&t.mods.indexOf(+i)>-1||m2[i]&&t.mods.indexOf(+i)===-1)&&(o=!1);(t.mods.length===0&&!m2[16]&&!m2[18]&&!m2[17]&&!m2[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(p0),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function Wb(e,t){const n=y0["*"];let r=e.keyCode||e.which||e.charCode;if(!ao.filter.call(this,e))return;if((r===93||r===224)&&(r=91),p0.indexOf(r)===-1&&r!==229&&p0.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(s=>{const c=Q4[s];e[s]&&p0.indexOf(c)===-1?p0.push(c):!e[s]&&p0.indexOf(c)>-1?p0.splice(p0.indexOf(c),1):s==="metaKey"&&e[s]&&(p0=p0.filter(u=>u in Q4||u===r))}),r in m2){m2[r]=!0;for(const s in Io)if(Object.prototype.hasOwnProperty.call(Io,s)){const c=Q4[Io[s]];ao[s]=e[c]}if(!n)return}for(const s in m2)Object.prototype.hasOwnProperty.call(m2,s)&&(m2[s]=e[Q4[s]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(p0.indexOf(17)===-1&&p0.push(17),p0.indexOf(18)===-1&&p0.push(18),m2[17]=!0,m2[18]=!0);const o=Hs();if(n)for(let s=0;s<n.length;s++)n[s].scope===o&&(e.type==="keydown"&&n[s].keydown||e.type==="keyup"&&n[s].keyup)&&Kb(e,n[s],o,t);if(!(r in y0))return;const i=y0[r],a=i.length;for(let s=0;s<a;s++)if((e.type==="keydown"&&i[s].keydown||e.type==="keyup"&&i[s].keyup)&&i[s].key){const c=i[s],{splitKey:u}=c,d=c.key.split(u),h=[];for(let C=0;C<d.length;C++)h.push(ul(d[C]));h.sort().join("")===p0.sort().join("")&&Kb(e,c,o,t)}}function ao(e,t,n){p0=[];const r=$M(e);let o=[],i="all",a=document,s=0,c=!1,u=!0,d="+",h=!1,C=!1;for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(c=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(h=t.capture),typeof t.splitKey=="string"&&(d=t.splitKey),t.single===!0&&(C=!0)),typeof t=="string"&&(i=t),C&&QM(e,i);s<r.length;s++)e=r[s].split(d),o=[],e.length>1&&(o=UM(Io,e)),e=e[e.length-1],e=e==="*"?"*":ul(e),e in y0||(y0[e]=[]),y0[e].push({keyup:c,keydown:u,scope:i,mods:o,shortcut:r[s],method:n,key:r[s],splitKey:d,element:a});if(typeof a<"u"&&window){if(!na.has(a)){const m=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return Wb(v,a)},A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;Wb(v,a),Aae(v)};na.set(a,{keydownListener:m,keyupListenr:A,capture:h}),zd(a,"keydown",m,h),zd(a,"keyup",A,h)}if(!us){const m=()=>{p0=[]};us={listener:m,capture:h},zd(window,"focus",m,h)}}}function vae(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(y0).forEach(n=>{y0[n].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function Mg(e){const t=Object.values(y0).flat();if(t.findIndex(r=>{let{element:o}=r;return o===e})<0){const{keydownListener:r,keyupListenr:o,capture:i}=na.get(e)||{};r&&o&&(M4(e,"keyup",o,i),M4(e,"keydown",r,i),na.delete(e))}if((t.length<=0||na.size<=0)&&(Object.keys(na).forEach(o=>{const{keydownListener:i,keyupListenr:a,capture:s}=na.get(o)||{};i&&a&&(M4(o,"keyup",a,s),M4(o,"keydown",i,s),na.delete(o))}),na.clear(),Object.keys(y0).forEach(o=>delete y0[o]),us)){const{listener:o,capture:i}=us;M4(window,"focus",o,i),us=null}}const Zd={getPressedKeyString:hae,setScope:WM,getScope:Hs,deleteScope:pae,getPressedKeyCodes:fae,getAllKeyCodes:Cae,isPressed:mae,filter:gae,trigger:vae,unbind:QM,keyMap:Ms,modifier:Io,modifierMap:Q4};for(const e in Zd)Object.prototype.hasOwnProperty.call(Zd,e)&&(ao[e]=Zd[e]);if(typeof window<"u"){const e=window.hotkeys;ao.noConflict=t=>(t&&window.hotkeys===ao&&(window.hotkeys=e),ao),window.hotkeys=ao}class Y1 extends R.Component{constructor(t){super(t),this.isKeyDown=!1,this.handle=void 0,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.handleKeyUpEvent=this.handleKeyUpEvent.bind(this),this.handle={}}componentDidMount(){var{filter:t,splitKey:n}=this.props;t&&(ao.filter=t),ao.unbind(this.props.keyName),ao(this.props.keyName,{splitKey:n},this.onKeyDown),document&&document.body.addEventListener("keyup",this.handleKeyUpEvent)}componentWillUnmount(){ao.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document&&document.body.removeEventListener("keyup",this.handleKeyUpEvent)}onKeyUp(t,n){var{onKeyUp:r,disabled:o}=this.props;!o&&r&&r(n.shortcut,t,n)}onKeyDown(t,n){var{onKeyDown:r,allowRepeat:o,disabled:i}=this.props;this.isKeyDown&&!o||(this.isKeyDown=!0,this.handle=n,!i&&r&&r(n.shortcut,t,n))}handleKeyUpEvent(t){this.isKeyDown&&(this.isKeyDown=!1,!(this.props.keyName&&this.props.keyName.indexOf(this.handle.shortcut)<0)&&(this.onKeyUp(t,this.handle),this.handle={}))}render(){return this.props.children||null}}Y1.defaultProps={filter(e){var t=e.target||e.srcElement,n=t.tagName;return!(t.isContentEditable||n==="INPUT"||n==="SELECT"||n==="TEXTAREA")}};Y1.propTypes={keyName:U3.string,filter:U3.func,onKeyDown:U3.func,onKeyUp:U3.func,disabled:U3.bool,splitKey:U3.string};const GM=["shift","alt","meta","mod","ctrl","control"],bae={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function e9(e){return(bae[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function YM(e){return GM.includes(e)}function Ud(e,t=","){return e.toLowerCase().split(t)}function $d(e,t="+",n=">",r=!1,o){let i=[],a=!1;e.includes(n)?(a=!0,i=e.toLocaleLowerCase().split(n).map(u=>e9(u))):i=e.toLocaleLowerCase().split(t).map(u=>e9(u));const s={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},c=i.filter(u=>!GM.includes(u));return{...s,keys:c,description:o,isSequence:a}}typeof document<"u"&&(document.addEventListener("keydown",e=>{e.code!==void 0&&qM([e9(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&XM([e9(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{aa.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{aa.clear()},0)}));const aa=new Set;function Hg(e){return Array.isArray(e)}function yae(e,t=","){return(Hg(e)?e:e.split(t)).every(n=>aa.has(n.trim().toLowerCase()))}function qM(e){const t=Array.isArray(e)?e:[e];aa.has("meta")&&aa.forEach(n=>!YM(n)&&aa.delete(n.toLowerCase())),t.forEach(n=>aa.add(n.toLowerCase()))}function XM(e){const t=Array.isArray(e)?e:[e];e==="meta"?aa.clear():t.forEach(n=>aa.delete(n.toLowerCase()))}function wae(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function xae(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function _ae(e){return JM(e,["input","textarea","select"])}function JM(e,t=!1){const{target:n,composed:r}=e;let o;return Eae(n)&&r?o=e.composedPath()[0]&&e.composedPath()[0].tagName:o=n&&n.tagName,Hg(t)?!!(o&&t&&t.some(i=>i.toLowerCase()===o.toLowerCase())):!!(o&&t&&t)}function Eae(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function Sae(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(n=>t.includes(n))||e.includes("*"):!0}const Mae=(e,t,n=!1)=>{const{alt:r,meta:o,mod:i,shift:a,ctrl:s,keys:c,useKey:u}=t,{code:d,key:h,ctrlKey:C,metaKey:m,shiftKey:A,altKey:v}=e,p=e9(d);if(u&&(c==null?void 0:c.length)===1&&c.includes(h))return!0;if(!(c!=null&&c.includes(p))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(p))return!1;if(!n){if(r!==v&&p!=="alt"||a!==A&&p!=="shift")return!1;if(i){if(!m&&!C)return!1}else if(o!==m&&p!=="meta"&&p!=="os"||s!==C&&p!=="ctrl"&&p!=="control")return!1}return c&&c.length===1&&c.includes(p)?!0:c?yae(c):!c},Hae=R.createContext(void 0),Lae=()=>R.useContext(Hae);function eH(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&eH(e[r],t[r]),!0):e===t}const Bae=R.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),Oae=()=>R.useContext(Bae);function Rae(e){const t=R.useRef(void 0);return eH(t.current,e)||(t.current=e),t.current}const Qb=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Iae=typeof window<"u"?R.useLayoutEffect:R.useEffect;function Gb(e,t,n,r){const o=R.useRef(null),i=R.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,s=Hg(e)?e.join(a==null?void 0:a.delimiter):e,c=n instanceof Array?n:r instanceof Array?r:void 0,u=R.useCallback(t,c??[]),d=R.useRef(u);c?d.current=u:d.current=t;const h=Rae(a),{activeScopes:C}=Oae(),m=Lae();return Iae(()=>{if((h==null?void 0:h.enabled)===!1||!Sae(C,h==null?void 0:h.scopes))return;let A=[],v;const p=(E,S=!1)=>{var M;if(!(_ae(E)&&!JM(E,h==null?void 0:h.enableOnFormTags))){if(o.current!==null){const H=o.current.getRootNode();if((H instanceof Document||H instanceof ShadowRoot)&&H.activeElement!==o.current&&!o.current.contains(H.activeElement)){Qb(E);return}}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ud(s,h==null?void 0:h.delimiter).forEach(H=>{var O,k,D,N;if(H.includes((h==null?void 0:h.splitKey)??"+")&&H.includes((h==null?void 0:h.sequenceSplitKey)??">")){console.warn(`Hotkey ${H} contains both ${(h==null?void 0:h.splitKey)??"+"} and ${(h==null?void 0:h.sequenceSplitKey)??">"} which is not supported.`);return}const P=$d(H,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description);if(P.isSequence){v=setTimeout(()=>{A=[]},(h==null?void 0:h.sequenceTimeoutMs)??1e3);const F=P.useKey?E.key:e9(E.code);if(YM(F.toLowerCase()))return;A.push(F);const j=(O=P.keys)==null?void 0:O[A.length-1];if(F!==j){A=[],v&&clearTimeout(v);return}A.length===((k=P.keys)==null?void 0:k.length)&&(d.current(E,P),v&&clearTimeout(v),A=[])}else if(Mae(E,P,h==null?void 0:h.ignoreModifiers)||(D=P.keys)!=null&&D.includes("*")){if((N=h==null?void 0:h.ignoreEventWhen)!=null&&N.call(h,E)||S&&i.current)return;if(wae(E,P,h==null?void 0:h.preventDefault),!xae(E,P,h==null?void 0:h.enabled)){Qb(E);return}d.current(E,P),S||(i.current=!0)}})}},_=E=>{E.code!==void 0&&(qM(e9(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&p(E))},w=E=>{E.code!==void 0&&(XM(e9(E.code)),i.current=!1,h!=null&&h.keyup&&p(E,!0))},x=o.current||(a==null?void 0:a.document)||document;return x.addEventListener("keyup",w,a==null?void 0:a.eventListenerOptions),x.addEventListener("keydown",_,a==null?void 0:a.eventListenerOptions),m&&Ud(s,h==null?void 0:h.delimiter).forEach(E=>m.addHotkey($d(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),()=>{x.removeEventListener("keyup",w,a==null?void 0:a.eventListenerOptions),x.removeEventListener("keydown",_,a==null?void 0:a.eventListenerOptions),m&&Ud(s,h==null?void 0:h.delimiter).forEach(E=>m.removeHotkey($d(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),A=[],v&&clearTimeout(v)}},[s,h,C]),o}const kae="_table_q0jcp_1",Dae="_table__header_q0jcp_18",Pae="_table__header__th_q0jcp_24",Nae="_table__row_q0jcp_38",Tae="_table__row__row_selected_q0jcp_44",Fae="_table__row__td_q0jcp_47",Vae="_clickable_q0jcp_68",jae="_loadMoreButton_q0jcp_73",zae="_loadMoreButtonDiv_q0jcp_78",Zae="_table_container_q0jcp_84",Uae="_scrollable_table_q0jcp_92",$ae="_pagination_container_q0jcp_104",Kae="_pagination_btn_q0jcp_113",Wae="_active_q0jcp_130",Qae="_pagination_dots_q0jcp_135",Gae="_pagination_input_q0jcp_140",Yae="_nextPrevArrow_q0jcp_165",qae="_pagination_left_q0jcp_179",Xae="_pagination_right_q0jcp_191",Jae="_pagination_loading_q0jcp_204",p2={table:kae,table__header:Dae,table__header__th:Pae,table__row:Nae,table__row__row_selected:Tae,table__row__td:Fae,clickable:Vae,loadMoreButton:jae,loadMoreButtonDiv:zae,table_container:Zae,scrollable_table:Uae,pagination_container:$ae,pagination_btn:Kae,active:Wae,pagination_dots:Qae,pagination_input:Gae,nextPrevArrow:Yae,pagination_left:qae,pagination_right:Xae,pagination_loading:Jae},tH=({children:e,disableOverflowY:t=!1,tableClass:n="",disableFixHeight:r,isPagination:o=!0})=>Z.jsx("div",{className:qn(p2.table_container,n),style:{overflowY:t?"unset":"auto",height:r?"unset":o?"70vh":"78vh",maxHeight:o?"70vh":"85vh"},children:Z.jsx("table",{id:"resizeMe",className:qn(p2.table,p2.scrollable_table),children:e})}),nH=({children:e})=>Z.jsx("tbody",{className:p2.table__body,children:e}),Lg=({children:e,className:t="",title:n="",onclick:r})=>Z.jsx("tr",{className:qn(p2.table__row,{[t]:!!t}),title:n,...r&&{onClick:r},children:e}),G4=({children:e,className:t="",extraClass:n="",title:r="",...o})=>{const i=qn(p2.table__row__td,t,(n==null?void 0:n.length)>0&&p2.clickable);return Z.jsx("td",{className:i,title:r,children:Z.jsx("span",{...o,style:{textAlign:"left"},children:e})})},rH=({children:e,className:t="",title:n=""})=>Z.jsx("th",{className:qn(p2.table__header__th,{[t]:t}),title:n,children:Z.jsxs("span",{children:[e," "]})}),oH=({children:e,className:t=""})=>Z.jsx("thead",{className:qn(p2.table__header,{[t]:!!t}),children:e}),iH=({list:e,headerClass:t="",type:n=""})=>(console.log("AWIHEADER List,",e),Z.jsx(oH,{className:t,children:Z.jsx(Lg,{children:e.map(r=>Z.jsx(rH,{children:r},r))},`row_${n}`)},n)),Ch=({toggleSelectAnnotation:e=()=>{console.log("Not available")},handleLeftKeyDown:t=()=>{console.log("Not available")},handleRightKeyDown:n=()=>{console.log("Not available")},handleUpKeyDown:r=()=>{console.log("Not available")},handleDownKeyDown:o=()=>{console.log("Not available")},handleZoomInClick:i=()=>{console.log("Not available")},handleZoomOutClick:a=()=>{console.log("Not available")},handleCompleteAnnotation:s=()=>{console.log("Not available")},undoAnnotationPoint:c=()=>{console.log("Not available")},reLoadAndReDrawAnnotations:u=()=>{console.log("Not available")},togglePagination:d=()=>{console.log("Not available")},toggleFullscreen:h=()=>{console.log("Not available")},switchToAutoAnnotations:C=()=>{console.log("Not available")},openShortCutRequestDetails:m=()=>{console.log("Not available")},handleRecentAnnotatedVerifiedImages:A=()=>{console.log("Not available")},handleSendToSamFunctionPrompt:v=()=>{console.log("Not available")},samAPIactive:p,request:_,switchToEditMode:w=()=>{console.log("Not available")},switchToCreateMode:x=()=>{console.log("Not available")},goToNextImage:E=()=>{console.log("Not available")},goToPreviousImage:S=()=>{console.log("Not available")},loggedUser:M,handleGoToPendingAnnotations:H=()=>{console.log("Not available")},handleCopyByCtrlC:O=()=>{console.log("Not available")},handlePasteAnnotationsByControlV:k=()=>{console.log("Not available")},openShortCutKeyModal:D,setOpenShortCutKeyModal:N=()=>{console.log("Not available")},setIsAltViaToolPressHandle:P=()=>{console.log("Not available")},isCarousel:F=!1,selectedTool:j="",setCrossHairHandle:V=()=>{console.log("Not available")},controlMinusHotkey:T=()=>{console.log("Not available")},controlPlusHotkey:$=()=>{console.log("Not available")}})=>{const K=Br.isSAMAllowed(_==null?void 0:_.awi_annotation_type,_==null?void 0:_.awi_request_for)&&!p,q=["awi_annotator","awi_verifier","awi_developer"].includes(M.userObj.awi_level),W=()=>{const J=[{action:"next image",key:"next_image",displayKey:"d",title:"Move to the next image",isClose:!0},{action:"previous image",key:"prev_image",displayKey:"a",title:"Move to the previous image",isClose:!0}],Y=[{action:"Go to pending annotation",key:"pending_annotations",displayKey:"p",title:"Go to pending annotation",isClose:!0}],ee=[{action:"Switch to edit",key:"edit_mode",displayKey:"e",title:"Switch to edit mode",isClose:!0},{action:"Switch to create",key:"create_mode",displayKey:"q",title:"Switch to create mode",isClose:!0},{action:"Switch to pan mode",key:"pan_mode",displayKey:"m",title:"Switch to pan mode",isClose:!0},{action:"Show cross hair",key:"cross_hair",displayKey:"w",title:"Show cross hair",isClose:!0},{action:"Copy selected annotation",key:"copy",displayKey:"Ctrl + C",title:"Copy selected annotation",isClose:!1},{action:"Paste all annotations",key:"paste",displayKey:"Ctrl + V",title:"Paste all copied annotations",isClose:!1},{action:"Forward Toggle Annotations",key:"select_forward",displayKey:"T",title:"Forward Toggle annotations visibility, Long press to get next",isClose:!1},{action:"Backward Toggle Annotations",key:"select_backward",displayKey:"U",title:"Backward Toggle annotations visibility, Long press to get previous",isClose:!1},{action:"Go to last updated annotations",key:"select_last_update",displayKey:"L",title:"Go to last updated annotations",isClose:!0},{action:"Undo Annotation point / Last State",key:"undo",displayKey:"Ctrl + Z",title:"Undo last annotation action",isClose:!0},{action:"Complete Annotation / Generate Point Annotations",key:"complete",displayKey:"Enter",title:"Finalize or generate point annotations",isClose:!0},{action:"Switch to Auto Annotations",key:"auto_annotations",displayKey:"S",title:"Enable automatic annotation mode",isClose:!0},{action:"AI prompt popup",key:"send_to_sam",displayKey:"X (if AI is enabled)",title:"AI prompt popup",isClose:!0},{action:"Get request information",key:"open_shortcut_details",displayKey:"V",title:"View request-related information",isClose:!0},{action:"Refetch Annotations",key:"reload",displayKey:"R",title:"Reload annotations",isClose:!0},{action:"Toggle Image Pagination",key:"toggle_pagination",displayKey:"H",title:"Show or hide image pagination",isClose:!1},{action:"Zoom In",key:"zoom_in",displayKey:"I",title:"Zoom into the image, long press for more zoom in",isClose:!1},{action:"Zoom Out",key:"zoom_out",displayKey:"O",title:"Zoom out of the image, long press for more zoom out",isClose:!1},{action:"Moving Zoomed images",key:"",displayKey:"Alt + Mouse Move",title:"Move the zoomed-in image",isClose:!1},{action:"View Recently Annotated Images",key:"recent_verified",displayKey:"Alt + R",title:"Show recently annotated images",isClose:!0},{action:"Delete Annotation",key:"",displayKey:"Ctrl + Delete",title:"Delete the selected annotation",isClose:!1},{action:"Move image to left",key:"move_left",displayKey:"←",title:"Move image to left",isClose:!1},{action:"Move image to right",key:"move_right",displayKey:"→",title:"Move image to right",isClose:!1},{action:"Move image to top",key:"move_up",displayKey:"↑",title:"Move image to top",isClose:!1},{action:"Move image to bottom",key:"move_down",displayKey:"↓",title:"Move image to bottom",isClose:!1},{action:"Enter/Exit Fullscreen",key:"fullscreen",displayKey:"F",title:"Enter/Exit Fullscreen",isClose:!1}];return M.userObj.awi_level==="awi_verifier"?[...J,...ee,...Y]:M.userObj.awi_level==="awi_supervisor"?J:[...J,...ee]},U=J=>{switch(J){case"select_forward":return e("forward");case"select_backward":return e("backward");case"select_last_update":return e("last_update");case"move_left":return t();case"move_right":return n();case"move_up":return r();case"move_down":return o();case"zoom_in":return i();case"zoom_out":return a();case"complete":return s();case"undo":return c();case"reload":return u();case"toggle_pagination":return d(Y=>!Y);case"fullscreen":return h();case"auto_annotations":return C();case"open_shortcut_details":return m();case"recent_verified":return A();case"send_to_sam":if(K)return j!="SAM"&&C(),v();W1.error("SAM is not allowed");return;case"edit_mode":if(w)return w();break;case"create_mode":if(x)return x();break;case"next_image":if(E)return E();break;case"prev_image":if(S)return S();break;case"pending_annotations":if(H)return H();break;case"copy":if(O)return O();break;case"paste":if(k)return k();break;case"pan_mode":P();break;case"cross_hair":V&&typeof V=="function"&&V();break;default:console.warn(`Unhandled hotkey action: ${J}`)}},G=(J,Y)=>{U(J),Y&&N(!1)};return Gb("ctrl+=",J=>{J.preventDefault(),$()}),Gb("ctrl+-, ctrl+subtract, ctrl+minus",J=>{J.preventDefault(),T()}),Z.jsxs(Z.Fragment,{children:[Z.jsx(Y1,{allowRepeat:!0,keyName:"t",onKeyDown:()=>U("select_forward")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"u",onKeyDown:()=>U("select_backward")}),Z.jsx(Y1,{allowRepeat:!1,keyName:"l",onKeyDown:()=>U("select_last_update")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"left",onKeyDown:()=>U("move_left")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"right",onKeyDown:()=>U("move_right")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"up",onKeyDown:()=>U("move_up")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"down",onKeyDown:()=>U("move_down")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"i",onKeyDown:()=>U("zoom_in")}),Z.jsx(Y1,{allowRepeat:!0,keyName:"o",onKeyDown:()=>U("zoom_out")}),Z.jsx(Y1,{keyName:"enter",onKeyDown:()=>U("complete")}),Z.jsx(Y1,{keyName:"ctrl+z",onKeyDown:()=>U("undo")}),Z.jsx(Y1,{keyName:"r",onKeyDown:()=>U("reload")}),Z.jsx(Y1,{keyName:"h",onKeyDown:()=>U("toggle_pagination")}),Z.jsx(Y1,{keyName:"f",onKeyDown:()=>U("fullscreen")}),Z.jsx(Y1,{keyName:"s",onKeyDown:()=>U("auto_annotations")}),Z.jsx(Y1,{keyName:"v",onKeyDown:()=>U("open_shortcut_details")}),Z.jsx(Y1,{keyName:"alt+r",onKeyDown:()=>U("recent_verified")}),K&&Z.jsx(Y1,{keyName:"x",onKeyDown:()=>U("send_to_sam")}),q&&Z.jsxs(Z.Fragment,{children:[Z.jsx(Y1,{keyName:"e",onKeyDown:()=>U("edit_mode")}),Z.jsx(Y1,{keyName:"q",onKeyDown:()=>U("create_mode")})]}),Z.jsx(Y1,{keyName:"d",onKeyDown:()=>U("next_image")}),Z.jsx(Y1,{keyName:"a",onKeyDown:()=>U("prev_image")}),M.userObj.awi_level==="awi_verifier"&&Z.jsx(Y1,{keyName:"p",onKeyDown:()=>U("pending_annotations")}),Z.jsx(Y1,{keyName:"ctrl+c",onKeyDown:()=>U("copy")}),Z.jsx(Y1,{keyName:"ctrl+v",onKeyDown:()=>U("paste")}),Z.jsx(Y1,{keyName:"m",onKeyDown:()=>U("pan_mode")}),Z.jsx(Y1,{keyName:"w",onKeyDown:()=>U("cross_hair")}),D&&!F&&Z.jsx(Z.Fragment,{children:Z.jsxs(v7,{popupPosition:"right",isBackdrop:!0,backdropAction:()=>N(!1),className:"noPadding",children:[Z.jsx(y7,{title:"Shortcut keys",onClose:()=>N(!1)}),Z.jsx(b7,{children:Z.jsxs(tH,{children:[Z.jsx(iH,{list:["S.NO.","Command","Key Binding","Action"]},"short_cut_keys"),Z.jsx(nH,{children:(W()||[]).map((J,Y)=>{var ee;return Z.jsxs(Lg,{title:J.title,children:[Z.jsx(G4,{children:Y+1}),Z.jsx(G4,{children:J.action}),Z.jsx(G4,{children:Z.jsxs("div",{className:"shortcutKey",children:[" ",J.displayKey," "]})}),Z.jsx(G4,{children:((ee=J==null?void 0:J.key)==null?void 0:ee.length)>0&&Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:()=>G(J.key,J.isClose),children:"Press"})})]})})})]})}),Z.jsx(x7,{})]})})]})},e9e=10,t9e=12,Yb=e=>{switch(e){case"rectangle":return X1.rectangleIcon.IconComponent;case"circle":return X1.circleIcon.IconComponent;case"polygon":return X1.polygonIcon.IconComponent;case"dot":return X1.dotIcon.IconComponent;default:return X1.rectangleIcon.IconComponent}},Tc=({isEditing:e,handleSelectTool:t=()=>{console.log("handleSelectTool function is not provided")},handleSAMToggle:n=()=>{console.log("handleSAMToggle function is not provided")},hasAnnotation:r=!1,currentSelectedSAMTool:o="Normal",handleCopyAnnotations:i,setOpenRequestDetails:a=()=>{console.log("setOpenRequestDetails function is not provided")},openRequestDetails:s,show_guidelines_first:c,handleZoomInClick:u,zoomProperties:d,handleReset:h,handleZoomOutClick:C,handleCompleteAnnotation:m,toggleFullscreen:A,selectAnnotationId:v,selectedAnnotationInfo:p,undoLastStateAnnotation:_,usingSamFunction:w,samAPIactive:x,handleSendToSamFunction:E,coordinates:S,handleSendToSamFunctionPrompt:M,reLoadAndReDrawAnnotations:H,showGuidelinesFirst:O,isMobile:k,toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,undoAnnotationPoint:V,togglePagination:T,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,showPagination:Y=!1,loggedUser:ee,isControlViaToolPress:re,isAltViaToolPress:ue,setIsControlViaToolPress:se,setIsAltViaToolPress:_e,isCarousel:xe=!1,allowedToCopyPreview:Ae,classColorMapToSend:he,request:le,parentReqData:ae,RequestInfoModal:ye,setCrossHair:Re,isCrossHair:Ie,annotationViewType:Ce="atom",REACT_APP_SAM_ENABLED:et="no",controlPlusHotkey:fe,controlMinusHotkey:ne,Carousel:pe})=>{var Gt,An,bn,Qt,Ot,Ht,_t,Zt,Cn,mt;(a==null||typeof a!="function")&&(a=pt=>{console.log("setOpenRequestDetails function is not provided",pt)}),t||(t=pt=>{console.log("handleSelectTool function is not provided",pt)}),n||(n=pt=>{console.log("handleSAMToggle function is not provided",pt)});const[Ee,Le]=R.useState(!1),[Be,je]=R.useState(!1),[We,lt]=R.useState(""),[tt,Qe]=R.useState(!1),[Fe,ot]=R.useState(o),Ue=()=>{lt(""),a(!1),je(!1),Le(!0)},Ve=(pt="annotated")=>{lt(pt),a(!1),Le(!1),je(!0)},Ge=()=>{le!=null&&le.total_verified_images_count?Ve("verified"):Ve("annotated")},dt=pt=>{t("annotate"),n(pt),ot(pt)},qe=pt=>{typeof t=="function"&&t("edit"),typeof n=="function"&&n("Normal"),typeof ot=="function"&&ot("Normal")},ft=()=>{if(Fe=="Normal"){if(!Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for))return;dt("SAM")}else dt("Normal")},Pt=()=>{O&&s||typeof a=="function"&&a(pt=>!pt)};R.useEffect(()=>{o&&ot(o)},[o]);const Wt=pt=>{i&&typeof i=="function"&&i(pt,!0)},an=()=>{_e(!ue)},Dn=()=>{Re(!Ie)};return Ae&&xe?null:xe?Z.jsx(Z.Fragment,{children:Z.jsx(Ch,{toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:C,handleCompleteAnnotation:m,undoAnnotationPoint:V,reLoadAndReDrawAnnotations:H,togglePagination:T,toggleFullscreen:A,switchToAutoAnnotations:ft,openShortCutRequestDetails:Pt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:x,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:an,isCarousel:xe,selectedTool:Fe,setCrossHairHandle:Dn,loggedUser:ee,controlMinusHotkey:ne,controlPlusHotkey:fe})}):Z.jsxs("div",{style:{...k||Ce==="library"?{width:"100%",height:"40px"}:{height:"100%",width:"100%",maxHeight:"100%"},overflow:"auto"},children:[Z.jsx(Z.Fragment,{children:Z.jsx(Ch,{toggleSelectAnnotation:D,handleLeftKeyDown:N,handleRightKeyDown:P,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:C,handleCompleteAnnotation:m,undoAnnotationPoint:V,reLoadAndReDrawAnnotations:H,togglePagination:T,toggleFullscreen:A,switchToAutoAnnotations:ft,openShortCutRequestDetails:Pt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:x,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:K,goToNextImage:q,goToPreviousImage:W,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:an,selectedTool:Fe,setCrossHairHandle:Dn,loggedUser:ee,isCarousel:xe,controlMinusHotkey:ne,controlPlusHotkey:fe})}),Z.jsxs("div",{className:Sn.annotation__tool__icons,style:{display:"flex",justifyContent:k?"center":"space-between",flexDirection:k?"row":"column",backgroundColor:"#fff",width:k?"100%":"auto",...k||Ce=="library"?{maxWidth:"100%",overflowX:"auto",gap:"20px"}:{height:"100%"}},children:[Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[(le==null?void 0:le.awi_request_for)!="attributes"?Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:!e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>{typeof t=="function"&&t("annotate")},title:e?"Create to change from edit to create mode":"Create to start create mode",children:(le==null?void 0:le.awi_annotation_type)&&((Gt=le==null?void 0:le.awi_annotation_type)==null?void 0:Gt.length)>0&&Z.jsx("img",{src:Yb(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}):Z.jsx("div",{className:Sn.annotationIconDiv,children:(le==null?void 0:le.awi_annotation_type)&&((An=le==null?void 0:le.awi_annotation_type)==null?void 0:An.length)>0&&Z.jsx("img",{src:Yb(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}),r&&Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>qe(),title:"Edit - keyboard(E)",children:Z.jsx("img",{src:X1.editIcon.IconComponent,alt:"Edit",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:re},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>se(!re),title:"Control",children:Z.jsx("img",{src:X1.controlIcon.IconComponent,alt:"Control",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:ue},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>_e(!ue),title:"Alt press / Panning mode",children:Z.jsx("img",{src:X1.moveIcon.IconComponent,alt:"Alt",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:Ie},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>Re(!Ie),title:"Cross Hair",children:Z.jsx("img",{src:X1.crosshairIcon.IconComponent,alt:"Cross Hair",className:Sn.annotationIcon})}),!e&&(le==null?void 0:le.awi_annotation_type)==="polygon"&&(le==null?void 0:le.awi_request_for)!="attributes"&&S.length>2?Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:m,title:"Click to complete your polygon annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.filledTickIcon.IconComponent,className:Sn.annotationIcon})})}):Z.jsx(Z.Fragment,{children:(le==null?void 0:le.awi_annotation_type)==="polygon"&&Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{title:"Works for create mode with minimum 3 coordinates",className:Sn.annotationIconDiv,style:{cursor:"not-allowed !important",opacity:"0.5"},children:Z.jsx("img",{src:X1.filledTickIcon.IconComponent,className:qn(Sn.annotationIcon,"not-allowed-pointer")})})})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsxs("div",{onClick:((bn=p==null?void 0:p.past_coords)==null?void 0:bn.length)>0&&e&&v!=="-1"?_:void 0,title:((Qt=p==null?void 0:p.past_coords)==null?void 0:Qt.length)>0&&e&&v!=="-1"?"Click to revert annotation":"No undo available",style:{width:"1.8rem",height:"1.8rem",position:"relative",cursor:((Ot=p==null?void 0:p.past_coords)==null?void 0:Ot.length)>0&&e&&v!=="-1"?"pointer":"not-allowed",opacity:((Ht=p==null?void 0:p.past_coords)==null?void 0:Ht.length)>0&&e&&v!=="-1"?1:.5,pointerEvents:((_t=p==null?void 0:p.past_coords)==null?void 0:_t.length)>0&&e&&v!=="-1"?"auto":"none"},children:[Z.jsx("img",{src:X1.undoAnnotationIcon.IconComponent,alt:"Undo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"0.25rem"}}),((Zt=p==null?void 0:p.past_coords)==null?void 0:Zt.length)>0&&e&&v!=="-1"&&Z.jsx("div",{className:Sn.undoAnnotationCount,children:p.past_coords.length})]})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:u,src:X1.zoomInIcon.IconComponent,className:`cursor-pointer ${d.scale===t9e?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom in - Keyboard(I)"})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("div",{onClick:h,title:`Click to Reset Zoom ${d.scale.toFixed(1)} to default`,className:Sn.annotationIcon,style:{fontSize:"12px",justifyContent:"center",display:"flex"},children:d.scale.toFixed(1)})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:C,src:X1.zoomOutIcon.IconComponent,className:`cursor-pointer ${d.scale===1?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom out - Keyboard(O)"})}),Z.jsx("div",{onClick:()=>A(),className:Sn.annotationIconDiv,style:{display:"flex",alignItems:"center",justifyContent:"center"},title:"Toggle Fullscreen - Keyboard(F)",id:"toggle_full_screen",children:Z.jsx("img",{src:X1.toggleFullscreenIcon.IconComponent,className:Sn.annotationIcon})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[et=="yes"&&Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsx("div",{style:{display:"flex",alignItems:"center"},title:"AI tools - keyboard(S)",children:Z.jsxs("label",{className:Sn.switch,style:{marginLeft:"4px",width:"30px important"},children:[Z.jsx("input",{type:"checkbox",checked:Fe==="SAM",onChange:()=>{dt(Fe==="SAM"?"Normal":"SAM")}}),Z.jsx("span",{className:qn(Sn.slider,Sn.round)})]})}),Br.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsxs("div",{className:qn({"disabled-class":!w}),style:{justifyContent:"space-between",display:"flex",flexDirection:k?"row":"column",gap:"15px"},children:[(le==null?void 0:le.awi_annotation_type)&&(le==null?void 0:le.awi_annotation_type)!="dot"&&Z.jsx("div",{onClick:()=>{!x&&(S!=null&&S.length)&&E()},className:qn({"disabled-class":!w||x||!(S!=null&&S.length)},Sn.annotationIconDiv,"cursor-pointer"),style:{pointerEvents:x||!w?"none":"auto",opacity:x||!w?.5:1},children:Z.jsx("img",{src:X1.pointAnnotationIcon.IconComponent,title:"Mark some points and then click here and get the power of AI auto annotation",className:Sn.annotationIcon})}),Z.jsx("div",{onClick:x?void 0:M,style:{pointerEvents:x||!w?"none":"auto",opacity:x||!w?.5:1},title:"Give your prompt and get the power of AI auto annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.promptAnnotationIcon.IconComponent,title:"auto annotation prompt - keyboard(X)",className:Sn.annotationIcon})})]}),Z.jsx("div",{onClick:H,title:"Click to refetch saved annotations, hard reset",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.refetchAnnotationIcon.IconComponent,title:"Refetch annotations (Hard Reset) - keyboard(R)",className:Sn.annotationIcon})}),Z.jsx("div",{style:{width:"53%",height:"2px",backgroundColor:"#e4e0e6",margin:"8px auto"}})]}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:()=>{typeof a=="function"&&a(pt=>!pt)},title:"View details - keyboard(V)",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:X1.guidelinesIcon.IconComponent,alt:"info",style:{height:"30px !important",width:"30px !important",cursor:"pointer"}})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{children:Z.jsx("img",{src:X1.keyboardShortcutsIcon.IconComponent,title:"See short-cut keys",className:"cursor-pointer",width:"30px",onClick:()=>Qe(pt=>!pt)})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:k?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:T,children:Z.jsx("img",{src:X1.transparentBlackIcon.IconComponent,style:{height:"24px",width:" 24px",cursor:"pointer"},alt:"Previous",title:Y?"Hide Pagination":"Show Pagination"})})})]}),s&&ye&&Z.jsx(ye,{request:le,handleReferenceImageClick:Ue,handleRecentAnnotatedImages:Ve,show_guidelines_first:c,setOpenRequestDetails:a,classColorMapToSend:he}),s&&ye&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{c||typeof a=="function"&&a(!1)}}),s&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{O||typeof a=="function"&&a(!1)}}),pe&&Ee&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Le(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),imageKeys:((Cn=ae==null?void 0:ae.awi_reference_images)==null?void 0:Cn.awi_ids)||((mt=le==null?void 0:le.awi_reference_images)==null?void 0:mt.awi_ids)||[],awi_reference_image:!0,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Wt})}),Ee&&Z.jsx("div",{className:qn(Sn.backdrop,Sn.backdrop__transparent),onClick:()=>Le(!1)}),pe&&Be&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>je(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),awi_reference_image:!1,contentAnnotationType:We||"annotated",primaryLimit:e9e,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Wt})})]})},n9e="_canvas_145op_1",r9e="_canvasContainer_145op_9",o9e="_canvasSubContainer_145op_18",C6={canvas:n9e,canvasContainer:r9e,canvasSubContainer:o9e},Fc=({canvasDimensions:e,zoomProperties:t,isEditing:n,canvasRef:r,bgCanvasRef:o,overlayCanvasRef:i,handleMouseDown:a,handleMouseUp:s,handleMouseMove:c,handleMouseMoveOut:u,handleOnMouseLeave:d,handleWheel:h,handleTouchStart:C,handleTouchMove:m,handleTouchEnd:A,handleTouchCancel:v})=>Z.jsxs("div",{className:C6.canvasSubContainer,style:{display:"flex",flexDirection:"row",width:e.width,height:e.height,position:"relative"},children:[Z.jsx("canvas",{ref:o,className:C6.bgCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,zIndex:0,pointerEvents:"none"}}),Z.jsx("canvas",{ref:r,className:C6.canvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,cursor:n?"default":"crosshair",transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`},onMouseDown:a,onMouseUp:s,onMouseMove:c,onMouseOut:u,onMouseLeave:d,onWheel:h,onTouchStart:C,onTouchMove:m,onTouchEnd:A,onTouchCancel:v}),Z.jsx("canvas",{ref:i,className:C6.overlayCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,pointerEvents:"none",zIndex:2,transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`}})]}),i9e=1e-5,a9e=.99999,s9e=.001,l9e=.005,B8=(e,t)=>e/(t||1),aH=(e,t,n,r)=>Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2)),gh=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),c9e=e=>{let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach(({x:i,y:a})=>{t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i),o=Math.max(o,a)}),{minX:t,minY:n,maxX:r,maxY:o}},mh=(e,t,n=0)=>{let r=0;for(let o=0;o<(t==null?void 0:t.length)-1;o++){const i=t[o],a=t[o+1];i.y<=e.y+n?a.y>e.y+n&&gh(i,a,e)>0&&r++:a.y<=e.y-n&&gh(i,a,e)<0&&r--}return r},Bg=e=>(e==null?void 0:e.length)<2?0:Math.sqrt(Math.pow(Math.abs(e[0].x-e[1].x),2)+Math.pow(Math.abs(e[0].y-e[1].y),2));function u9e(e,t,n=0){const r=Math.min(...t.map(u=>u.x)),o=Math.max(...t.map(u=>u.x)),i=Math.min(...t.map(u=>u.y)),a=Math.max(...t.map(u=>u.y)),{x:s,y:c}=e;return s>=r-n&&s<=o+n&&c>=i-n&&c<=a+n}const d9e=(e,t,n,r,o,i,a=1)=>{if(!(n!=null&&n.length))return!1;let s,c,u,d,h=!1;switch(i==null?void 0:i.awi_annotation_type){case"rectangle":h=u9e({x:e,y:t},n,r);break;case"polygon":h=mh({x:e,y:t},n,r)!==0;break;case"circle":s=Bg(n)/2,c=(n[0].x+r+(n[1].x-o))/2,u=(n[0].y+n[1].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;case"dot":s=B8(.015,a),c=(n[0].x+r+(n[0].x-o))/2,u=(n[0].y+n[0].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;default:h=mh({x:e,y:t},n,r)!==0}return h},f9e=e=>!(!e||e.x>1||e.x<0||e.y1>1||e.y<0),h9e=e=>{if((e==null?void 0:e.length)<3)return!1;for(let t=0;t<e.length;t++)if(!f9e(e[t]))return!1;return!0},C9e=(e,t,n=!1,r=1)=>{var a,s,c,u;const o=e==null?void 0:e.awi_annotation_type;let i=!1;switch(o){case"rectangle":const d=B8(s9e,r);(t==null?void 0:t.length)>3&&Math.abs(((a=t[0])==null?void 0:a.x)-((s=t[1])==null?void 0:s.x))>d&&Math.abs(((c=t[1])==null?void 0:c.y)-((u=t[3])==null?void 0:u.y))>d&&(i=!0);break;case"circle":const h=B8(l9e,r);Bg(t)>h&&(i=!0);break;case"polygon":i=h9e(t);break;case"dot":i=!0;break;default:n&&(i=!0);break}return i},sH=(e,t,n,r,o,i)=>{const a=e-n,s=t-r,c=o-n,u=i-r,d=a*c+s*u,h=c*c+u*u,C=h!==0?d/h:-1;let m,A;C<0?(m=n,A=r):C>1?(m=o,A=i):(m=n+C*c,A=r+C*u);const v=e-m,p=t-A;return Math.sqrt(v*v+p*p)},g9e=(e,t,n)=>{let r=1/0,o=-1;for(let i=0;i<(e==null?void 0:e.length);i++){const a=(i+1)%e.length,{x:s,y:c}=e[i],{x:u,y:d}=e[a],h=sH(t,n,s,c,u,d);h<r&&(r=h,o=a)}return{insertIndex:o,minDistance:r}},lH=(e,t)=>t===0?e:lH(t,e%t),m9e=(e,t,n,r)=>(e>0&&(e=0),Math.abs(e)>n&&(e=-1*n),Math.abs(t)>r&&(t=-1*r),t>0&&(t=0),{newXTransform:e,newYTransform:t}),p9e=function(e){console.log("getBoundingBox called");const t=Math.min(...e.map(i=>i.x)),n=Math.max(...e.map(i=>i.x)),r=Math.min(...e.map(i=>i.y)),o=Math.max(...e.map(i=>i.y));return[{x:t,y:r},{x:n,y:r},{x:n,y:o},{x:t,y:o}]};function A9e(e,t,n){return Math.min(n,Math.max(t,e))}function v9e(e,t=.05,n=null){const r=Math.min(...e.map(h=>h.x)),o=Math.max(...e.map(h=>h.x)),i=Math.min(...e.map(h=>h.y)),a=Math.max(...e.map(h=>h.y)),s=o-r,c=a-i;let u,d;if(n&&(n==null?void 0:n.x)>=0&&(n==null?void 0:n.y)>=0){const h=n.x,C=n.y;u=Math.max(-r,Math.min(1-o,h-(r+s/2))),d=Math.max(-i,Math.min(1-a,C-(i+c/2)))}else u=Math.max(-r,Math.min(1-o,(Math.random()*2-1)*t)),d=Math.max(-i,Math.min(1-a,(Math.random()*2-1)*t));return e.map(h=>({x:h.x+u,y:h.y+d}))}function b9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y));return cH([{x:t,y:r},{x:n,y:o}])}function y9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y)),i=(t+n)/2,a=(r+o)/2;return[{x:i,y:a}]}const Kd=(e,t)=>(e.x-t.x)**2+(e.y-t.y)**2,w9e=(e,t,n)=>{const r=Kd(t,n);if(r===0)return Kd(e,t);let o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;o=Math.max(0,Math.min(1,o));const i={x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)};return Kd(e,i)},x9e=(e,t)=>{let n=1/0;for(let r=0;r<(t==null?void 0:t.length);r++){const o=t[r],i=t[(r+1)%t.length],a=w9e(e,o,i);n=Math.min(n,a)}return Math.sqrt(n)},_9e=(e,t)=>{let n=1/0,r=-1;for(let o=0;o<(t==null?void 0:t.length);o++){const i=t[o],a=aH(e.x,e.y,i.x,i.y);if(a<n){const s=o%t.length;n=a,r=s}}return{minDistance:n,insertIndex:r}},ph=(e=0)=>(e<=0?e=i9e:e>=1&&(e=a9e),e),E9e=e=>e.map(n=>({x:ph(n.x),y:ph(n.y)})),S9e=e=>{const t=new Set,n=[];for(let r=0;r<e.length;r++){const o=`${e[r].x},${e[r].y}`;t.has(o)||(t.add(o),n.push(e[r]))}return n.length>0&&n.push(n[0]),n},M9e=e=>{let t=0;for(let n=0;n<e.length;n++)if(e[n].x<=0){t=t+1;continue}else if(e[n].y<=0){t=t+1;continue}else if(e[n].x>=1){t=t+1;continue}else if(e[n].y>=1){t=t+1;continue}return t};function H9e(e){const t=Math.min(...e.map(s=>s.x)),n=Math.min(...e.map(s=>s.y)),r=Math.max(...e.map(s=>s.x)),o=Math.max(...e.map(s=>s.y)),i=t<0?-t:r>1?1-r:0,a=n<0?-n:o>1?1-o:0;return e.map(({x:s,y:c})=>({x:s+i,y:c+a}))}const L9e=(e,t)=>{const n=(e.x+t.x)/2,r=(e.y+t.y)/2,o=Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)/2,i=Math.min(n,1-n),a=Math.min(r,1-r),s=Math.min(o,i,a),c=Math.atan2(t.y-e.y,t.x-e.x),u={x:n-s*Math.cos(c),y:r-s*Math.sin(c)},d={x:n+s*Math.cos(c),y:r+s*Math.sin(c)};return[u,d]},B9e=(e,t)=>{const n=(e[0].x+e[1].x)/2,r=t,i=Math.sqrt(Math.pow(e[1].x-e[0].x,2))/2;let a=0;return n-i<0?a=i-n:n+i>1&&(a=1-(n+i)),e[0].x+=a,e[1].x+=a,e[0].y=r,e[1].y=r,e},cH=e=>{e=L9e(e[0],e[1]);const t=(e[0].x+e[1].x)/2,n=(e[0].y+e[1].y)/2,o=Math.sqrt(Math.pow(e[1].x-e[0].x,2)+Math.pow(e[1].y-e[0].y,2))/2;let i=0;t-o<0?i=o-t:t+o>1&&(i=1-(t+o));let a=0;return n-o<0?a=o-n:n+o>1&&(a=1-(n+o)),e[0].x+=i,e[0].y+=a,e[1].x+=i,e[1].y+=a,B9e(e,n)},O9e=(e,t,n)=>{let{x:r,y:o}=uH(e.current,t);const i=n;r=Math.min(r,1),o=Math.min(o,1);const a=r-i.x,s=o-i.y;let c=[];return a===0||s===0?c=[{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y}]:a>0&&s>0?c=[{x:i.x,y:i.y},{x:r,y:i.y},{x:r,y:o},{x:i.x,y:o}]:a>0&&s<0?c=[{x:i.x,y:o},{x:r,y:o},{x:r,y:i.y},{x:i.x,y:i.y}]:a<0&&s>0?c=[{x:r,y:i.y},{x:i.x,y:i.y},{x:i.x,y:o},{x:r,y:o}]:c=[{x:r,y:o},{x:i.x,y:o},{x:i.x,y:i.y},{x:r,y:i.y}],c},uH=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)}},R9e=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect(),r={x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)};return r.x<=0&&(r.x=1e-4),r.y<=0&&(r.y=1e-4),r.x>=1&&(r.x=1-1e-4),r.y>=1&&(r.y=1-1e-4),r},On={gcd:lH,getDistance:aH,isLeft:gh,windingNumber:mh,getDiameter:Bg,checkPointInsidePolygon:d9e,isAnnotationCoordinatesValid:C9e,distanceToSegment:sH,findClosestSegment:g9e,transformCoordinatesCheck:m9e,getBoundingBox:p9e,translateCoordinatesWithFixedWidth:v9e,clampValue:A9e,calculateCircleFromCoordinates:b9e,calculateCentroid:y9e,minDistanceToPolygon:x9e,closestCoordinates:_9e,fineTuneCoordinates:E9e,zoomLevelValue:B8,createPolygonLoop:S9e,breakPointCount:M9e,getBoundingBoxValues:c9e,shiftPolygon:H9e,getPerfectPointValue:ph,adjustToCircle:cH,getMousePos:uH,getMousePosAbsolute:R9e,getUpdatedCoordinates:O9e},I9e=({imageUrl:e,showAnnotations:t=!1,createAnnotation:n,handleMultipleAnnotations:r,handleUpdateAnnotationCoordinates:o,content_id:i,request_id:a,className:s="",isEditing:c=!1,selectIndex:u="-1",handleSelectAnnotationIndex:d,handleSelectTool:h,showAnnotationType:C="all",loggedUser:m,isCarousel:A=!1,classColorMap:v=null,disableAnnotation:p=!1,SAMToggle:_,imageNumber:w=0,togglePagination:x,handleSAMToggle:E,unSelectedAnnotationIDsSet:S=new Set,setMousePosition:M,allowedToCopyPreview:H=!1,copyCallBackHandler:O,annotationSession:k,SAMToggleValue:D,selectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,handleNextPage:V,handlePreviousPage:T,currentPage:$,handleUpdateImageIndex:K,requestId:q,showPagination:W,isAnnotationCreating:U,contentInfo:G,content_key:J,isAnnotationUpdating:Y,isDeleteAnnotationMutationLoading:ee,showGuidelinesFirst:re,currentImage:ue=0,selectedContent:se=null,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handlePasteAnnotationsByControlV:ae,annotationsResponse:ye,isAnnotationFetching:Re,fetchAnnotationsKey:Ie,request:Ce,parentReqData:et,clearAnnotationCache:fe,RequestInfoModal:ne,getAnnotationFromSAM:pe,getAnnotationsFromSAMPrompt:Ee,fetchAnnotations:Le,pageCount:Be=10,annotationViewType:je="atom",AnnotationPagination:We,REACT_APP_SAM_ENABLED:lt="no",ImageGenerationHelper:tt=ZM,fallbackImageUrl:Qe,activeColor:Fe,Carousel:ot,showTool:Ue=!0})=>{var oi,Ba,f,b,B,z,X,ie,ke,Je,rt,Bt,nn,In,Gn,f0;const Ve=ig().isCtrlPressedFunc,Ge=ig().isAltPressedFunc,[dt,qe]=R.useState(!1),[ft,Pt]=R.useState(!1),Wt=.007,an=.03,Dn=.01,Gt=.005,An=.005,bn=.7,Qt=.005,Ot=.005,Ht=.003,_t=.01,Zt="#40ff00",Cn="#fff",mt="#FFFF00",pt="red",Lt="rgba(0, 255, 255, 1)",Xe="rgba(0, 255, 255, 0.5)",zt="#FF3131",ve=4,it=5,$e={DEFAULT:1.5,SELECTED:4.5,CAROUSAL:2.5,CIRCLE:2},yt=R.useRef(""),Ye=R.useRef(null),Et=R.useRef(null),Rt=R.useRef(null),Vt=BS(),[En,At]=R.useState(!1),[vt,Nt]=R.useState(!1),[nt,Tt]=R.useState([]),[Ut,A1]=R.useState(),[L1,o1]=R.useState(),[Jn,$n]=R.useState({x:-1,y:-1}),[v1,j1]=R.useState(-1),[Jt,Mn]=R.useState({x:0,y:0}),[Dt,cn]=R.useState(u),[jn,D1]=R.useState("-1"),[n1,b1]=R.useState([]),[gn,$t]=R.useState(!1),[yn,Hn]=R.useState(null),[wt,kt]=R.useState({width:0,height:0}),Ft=I1.INITIAL_ZOOM_PROPERTIES,[at,mn]=R.useState(Ft),[Pn,P1]=R.useState(!1),[c1,a0]=R.useState(!1),[un,wn]=R.useState(-1),[tn,jt]=R.useState(!1),Yt=I1.INITIAL_ZOOM_LEVEL,Wn=12,Qn=wt.width*Yt,S1=R.useRef(null),[vn,y2]=R.useState(ye),[Nn,q0]=R.useState(),[pn,fn]=R.useState([]),[Bn,B1]=R.useState(null),r0=I1.SAM_MODEL_NAME,M1=I1.SAM_MODEL_CONFIDENCE,jr=I1.SAM_MODEL_MAX_RESULTS,[P2,Fn]=R.useState(!1),[e1,jo]=R.useState(-1),[A9,ya]=R.useState(null),[zr,wa]=R.useState(null),[v9,b9]=R.useState(null),[f1,L0]=R.useState({modelName:"",modelConfidence:0,modelMaxResults:0,promptMessage:""}),[u2,w2]=R.useState(null),[zo,xa]=R.useState(!1),[v0,S3]=R.useState({x:-1,y:-1}),[X2,M3]=R.useState({left:0,right:0,top:0,bottom:0}),[N2,_a]=R.useState(null),[J2,s0]=R.useState(""),H3={SELECT:2e3,NOT_SELECT:500},[g0,Zr]=R.useState(""),Zo=window.devicePixelRatio,[T1,Uo]=R.useState(window.innerWidth<768*Zo),[y9,G1]=R.useState(window.innerWidth<1200*Zo),d2=R.useRef(null),$o=R.useRef(null),[L3,Ko]=R.useState(!1);R.useEffect(()=>{const be=()=>{Uo(window.innerWidth<768*Zo),G1(window.innerWidth<1200*Zo)};return window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)},[]),R.useEffect(()=>{L3&&Fi()},[L3,at,wt]),R.useEffect(()=>{if(!J2){$o.current=null,Ko(!1);return}const be=new window.Image;be.onload=()=>{$o.current=be,Ko(!0)},be.src=J2},[J2]),R.useEffect(()=>(ht(nt),Yo(),()=>{N2&&clearTimeout(N2)}),[jn]),R.useEffect(()=>{A||document.fullscreenElement||ia.getItem("full_screen")=="yes"&&tr(!1),window.addEventListener("resize",S2)},[]),R.useEffect(()=>{console.log("Change"),Tt([]),Oi(),setTimeout(()=>{ht()},50)},[c]),R.useEffect(()=>{v&&ht(nt)},[v]),R.useEffect(()=>{i&&(i==null?void 0:i.length)>0&&e0()},[i]),R.useEffect(()=>{y2(ye||null)},[ye,i]),R.useEffect(()=>{if(e){const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1));f2(be)}Tt([])},[e]),R.useEffect(()=>{J2&&(yt.current=J2,O1())},[J2]),R.useEffect(()=>{yt.current&&S2()},[yt.current,J2]),R.useEffect(()=>{_=="SAM"?P1(!0):P1(!1),B3()},[_]),R.useEffect(()=>{at.scale==1&&(at.x!=0||at.y!=0)&&e0()},[at.scale]),R.useEffect(()=>{if(((vn==null?void 0:vn.result)||[]).length>=0){const{x:be,y:ge}=On.getMousePos(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});O1(nt,{x:be,y:ge})}},[wt,t,at.scale,jn]),R.useEffect(()=>{Oi(),((vn==null?void 0:vn.result)||[]).length>=0&&ht()},[n1,Dt]),R.useEffect(()=>{if(Ce&&vn&&(vn!=null&&vn.result)&&((vn==null?void 0:vn.result)||[]).length>=0){ht(nt);const be={},ge={};for(let Me=0;Me<vn.result.length;Me++)be[vn.result[Me].awi_id]={...vn.result[Me],index:Me},(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&(ge[vn.result[Me].awi_id]=On.getBoundingBoxValues(vn.result[Me].awi_coords));wa(be),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&B1(ge),(Ce==null?void 0:Ce.awi_request_for)=="attributes"&&vn.result.length>0&&u=="-1"&&typeof d=="function"&&setTimeout(()=>{d(vn.result[0].awi_id)},100)}else wa(null),B1(null);x9()},[Ce,vn]),R.useEffect(()=>{x9()},[S]),R.useEffect(()=>{console.log("Filter annotation change"),O1(nt),setTimeout(()=>{O1(nt)},100)},[pn]),R.useEffect(()=>{u!=="-1"?typeof h=="function"&&(Ce==null?void 0:Ce.awi_request_for)!=="outline"&&h("edit"):b1([]),Pn&&typeof h=="function"&&cn("-1"),cn(u||"-1")},[u]),R.useEffect(()=>{A||w==0&&Pn!==void 0&&(Pn?W1.success("Switched to Auto Annotation mode"):Ce!=null&&Ce.awi_annotation_type&&W1.success(`Switched to ${Ce==null?void 0:Ce.awi_annotation_type} Annotation mode`))},[Pn]),R.useEffect(()=>{if(!M||typeof M!="function")return;qo();const be=setTimeout(()=>{const{x:ge,y:Me}=On.getMousePosAbsolute(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});M({x:ge,y:Me})},30);return()=>clearTimeout(be)},[Ut]),R.useEffect(()=>{c1?qo():ei(-1,-1)},[c1]),R.useEffect(()=>{u!="-1"&&zr&&q0(zr[u])},[u,zr]),R.useEffect(()=>{Go(),qo()},[at,wt]);const a4=be=>{const ge=be.message;Zr(ge)};R.useEffect(()=>{let be="";U?be="Creating Annotation...":ee?be="Deleting Annotation...":Y?be="Updating Annotation...":Re?be="Fetching Annotations...":tn&&(be="Generating AI Annotations..."),a4({message:be})},[U,Y,ee,Re,tn]),R.useEffect(()=>{S2()},[W]);const Wo=pe&&typeof pe=="function"?ob(pe):null,Qo=Ee&&typeof Ee=="function"?ob(Ee):null,x2=()=>!!(dt||Ve()),X0=()=>!!(ft||Ge()),Go=()=>{const be=wt.width*at.scale,ge=wt.height*at.scale;M3({left:Math.abs(at.x),right:Math.max(0,be-wt.width+at.x),top:Math.abs(at.y),bottom:Math.max(0,ge-wt.height+at.y)})},Bi=R.useMemo(()=>{const be=(vn==null?void 0:vn.result)||[];if(be.length>0&&Dt!=="-1"){let ge=null,Me=null;const Te=be.reduce((De,ut)=>{const{awi_id:xt}=ut;return xt===Dt?ge=ut:xt===jn?Me=ut:S.has(xt)||De.push(ut),De},[]);return Me&&Te.push(Me),ge&&Te.push(ge),Te}else return pn},[Dt,jn,pn]),f2=async be=>{pS.checkImageValidity(be,s0,i,je,Qe)},Oi=()=>{jn!="-1"&&(N2&&clearTimeout(N2),D1("-1"))},Yo=()=>{if(jn!=="-1")if(Dt=="-1"||I1.HOVER_TO_SELECT_ON_ALREADY_SELECTED){const be=Dt=="-1"?H3.NOT_SELECT:H3.SELECT;N2&&clearTimeout(N2);const ge=setTimeout(()=>{c&&jn!="-1"&&Dt!=jn&&(Dt=="-1"&&gn?Yo():typeof d=="function"&&(d(jn),W1.success("Annotation selected successfully",jn)))},be);_a(ge)}else N2&&clearTimeout(N2);else N2&&clearTimeout(N2)},qo=()=>{const be=Et.current;if(!be)return;const ge=wt.width*at.scale,Me=wt.height*at.scale;if(be.width=ge,be.height=Me,c1){const{x:Te,y:De}=On.getMousePosAbsolute(Et.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});ei(Te,De)}},_2=()=>{Tt([])},Xo=(be=!1)=>{Vt.invalidateQueries(Ie),be&&Tt([])},E2=be=>{var ge;if(zr&&zr[be])if(c){const Me=zr[be].index,Te=vn==null?void 0:vn.result[Me];return Te||((ge=vn==null?void 0:vn.result)==null?void 0:ge.find(De=>De.awi_id==be))}else return zr[be];else return null},w9=be=>v9&&v9[be]?v9[be].index:-1,B3=()=>{nt.length>0&&(console.log("clearCoordinate"),Tt([]),O1([],{x:0,y:0},!0))},x9=()=>{if(Ce&&((vn==null?void 0:vn.result)||[]).length>=0){let be=[];(S==null?void 0:S.size)>0?be=((vn==null?void 0:vn.result)||[]).filter(Me=>!S.has(Me.awi_id)):be=(vn==null?void 0:vn.result)||[];const ge={};for(let Me=0;Me<be.length;Me++)ge[be[Me].awi_id]={...be[Me],index:Me};b9(ge),fn(be)}else fn([])},t1=be=>(T1&&(be=be*3),On.zoomLevelValue(be,at.scale)),T2=new Map,Ri=be=>{try{if(!be)return Promise.resolve(I1.DEFAULT_CANVAS_RATION);if(T2.has(be))return T2.get(be);const ge=new Promise((Me,Te)=>{const De=new Image;De.onload=()=>{const xt={w:De.width,h:De.height};T2.set(be,Promise.resolve(xt)),Me(xt)},De.onerror=Te;const ut=tt.getImageKitUrl(be,-1,-1,1);ut&&(De.src=ut)});return T2.set(be,ge),ge}catch(ge){return console.error(ge),Promise.resolve(I1.DEFAULT_CANVAS_RATION)}},S2=async()=>{var be,ge,Me,Te,De;if(console.log("updateDimensions called"),((be=yt.current)==null?void 0:be.length)>0){console.log("Canvas true");let ut=I1.DEFAULT_CANVAS_RATION;xa(!0);try{ut=await Ri(yt.current)}catch(Kt){console.error("Error fetching image dimensions:",Kt,yt.current),ut=I1.DEFAULT_CANVAS_RATION}const xt=On.gcd(ut.w,ut.h),Xt={w:ut.w/xt,h:ut.h/xt};let hn=0,Ct=0;if(Ct=((ge=Rt.current)==null?void 0:ge.offsetHeight)||0,hn=Ct*Xt.w/Xt.h,hn>(((Me=Rt.current)==null?void 0:Me.offsetWidth)||0)&&(hn=((Te=Rt.current)==null?void 0:Te.offsetWidth)||0,Ct=hn*Xt.h/Xt.w),(Ye==null?void 0:Ye.current)!=null&&(Ye.current.width=hn,Ye.current.height=Ct,u2==null)){const Kt=(De=Ye.current)==null?void 0:De.getBoundingClientRect();w2({left:Kt==null?void 0:Kt.left,top:Kt==null?void 0:Kt.top})}kt({width:hn,height:Ct}),xa(!1),O1(nt)}},Ur=R.useCallback((be,ge,Me,Te,De,ut)=>On.checkPointInsidePolygon(be,ge,Me,Te,De,ut,at.scale),[]),mr=(be,ge=!0)=>{const{x:Me,y:Te}=On.getMousePos(Ye.current,be);let De="",ut=1/0;if(c&&Jo(Me,Te))return[Dt];const xt=pn||[];if(!ge&&(xt==null?void 0:xt.length)>I1.MAX_ANNOTATIONS_TO_HOVER)return[];switch(Ce==null?void 0:Ce.awi_annotation_type){case"circle":{xt.forEach(({awi_coords:Xt,awi_id:hn})=>{if(Ur(Me,Te,Xt,0,0,Ce)){const Ct=On.minDistanceToPolygon({x:Me,y:Te},Xt);Ct<ut&&(De=hn,ut=Ct)}});break}case"dot":{const Xt=t1(An);xt.forEach(({awi_coords:hn,awi_id:Ct})=>{if(Ur(Me,Te,hn,Xt,Xt,Ce)){const Kt=On.minDistanceToPolygon({x:Me,y:Te},hn);Kt<ut&&(De=Ct,ut=Kt)}});break}case"rectangle":{const Xt=t1(Qt)/2;for(let hn=0;hn<xt.length;hn++){const{awi_coords:Ct,awi_id:Kt}=xt[hn];if(Ur(Me,Te,Ct,Xt,0,Ce)){const x1=On.minDistanceToPolygon({x:Me,y:Te},Ct);x1<ut&&(De=Kt,ut=x1)}}break}case"polygon":{for(let Xt=0;Xt<xt.length;Xt++){const{awi_coords:hn,awi_id:Ct}=xt[Xt];if(Bn){const Kt=Bn[Ct];if(Kt){const{minX:x1,minY:ce,maxX:h0,maxY:B0}=Kt;if(Me<x1||Me>h0||Te<ce||Te>B0)continue}}if(Ur(Me,Te,hn,0,0,Ce)){const Kt=On.minDistanceToPolygon({x:Me,y:Te},hn);Kt<ut&&(De=Ct,ut=Kt)}}break}default:console.warn(`Unknown annotation type: ${Ce==null?void 0:Ce.awi_annotation_type}`);break}return De&&De.length>0?(ge&&cn(De),[De]):(ge&&(console.log("setSelectAnnotationId "),typeof d=="function"&&u!="-1"&&d("-1",!1)),[])},s4=cl.throttle(mr,50),Jo=(be,ge)=>{const Me=E2(u);if(Me){const Te=Me.awi_coords;if((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"){const De=On.minDistanceToPolygon({x:be,y:ge},Te),ut=t1(Ot);return De<=ut}else if((Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"){const{insertIndex:De,minDistance:ut}=On.closestCoordinates({x:be,y:ge},Te),xt=t1(Ot);return console.log(De),ut<=xt}}else return!1},O3=(be,ge)=>{const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=E2(ge);if(console.log("selectAnnotation",De),De){const{awi_coords:ut}=De;if(ut.length===1){const Ct=t1(Gt);Ur(Me,Te,ut,Ct,Ct,Ce)&&(Nt(!0),$t(!0),o1({x:Me,y:Te}),Tt(ut));return}if(ut.length===2){const{x:Ct,y:Kt}=ut[0],{x:x1,y:ce}=ut[1],h0=On.getDiameter([{x:Ct,y:Kt},{x:x1,y:ce}])/2,B0=(Ct+x1)/2,m1=(Kt+ce)/2;Nt(!0),$t(!0),o1({x:Me,y:Te}),$n({x:Me,y:Te}),Tt(ut);const rn=(Me-B0)*(Me-B0)+(Te-m1)*(Te-m1),_0=t1(bn);rn>_0*_0*h0*h0&&$t(!1);return}const xt=x2()?0:t1(Wt),Xt=Ur(Me,Te,ut,xt,0,Ce),hn=Jo(Me,Te);if(!Xt&&!hn)$n({x:-1,y:-1}),o1({x:0,y:0}),$t(!1);else{if(o1({x:Me,y:Te}),Nt(!0),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon")if(x2())$t(!0);else if(Ur(Me,Te,ut,xt,0,Ce)){const{minDistance:Kt}=On.findClosestSegment(ut,Me,Te),x1=t1(_t);Kt>=x1?$t(!0):$t(!1)}else $t(!1);else $t(!0);Tt(ut),$n({x:-1,y:-1}),x2()||ut.forEach((Ct,Kt)=>{if(Me<=Ct.x+xt&&Me>=Ct.x&&Te<=Ct.y+xt&&Te>=Ct.y||Me>=Ct.x-xt&&Me<=Ct.x&&Te>=Ct.y-xt&&Te<=Ct.y||Me<=Ct.x+xt&&Me>=Ct.x&&Te>=Ct.y-xt&&Te<=Ct.y||Me>=Ct.x-xt&&Me<=Ct.x&&Te<=Ct.y+xt&&Te>=Ct.y){if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon")c?($n({x:Me,y:Te}),j1(Kt)):(j1(Kt),$n(ut[Kt])),console.log("setSelectCornerCoordinates");else if((Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"&&!Pn){const x1=ut[(Kt+2)%4];$n(x1)}else if(c){const x1=ut[(Kt+2)%4];$n(x1)}else j1(Kt),$n(ut[Kt]);$t(!1),Tt([])}})}}},Ii=(be="all")=>{const ge=window.devicePixelRatio;if(be!="cross"&&Ye.current)if(at.scale==1){const Me=+getComputedStyle(Ye.current).getPropertyValue("height").slice(0,-2),Te=+getComputedStyle(Ye.current).getPropertyValue("width").slice(0,-2);Ye.current.setAttribute("height",(Me*ge).toString()),Ye.current.setAttribute("width",(Te*ge).toString())}else{const Me=wt.height*at.scale,Te=wt.width*at.scale;Ye.current.setAttribute("height",(Me*ge).toString()),Ye.current.setAttribute("width",(Te*ge).toString())}if(Et.current)if(at.scale==1){const Me=+getComputedStyle(Et.current).getPropertyValue("height").slice(0,-2),Te=+getComputedStyle(Et.current).getPropertyValue("width").slice(0,-2);Et.current.setAttribute("height",(Me*ge).toString()),Et.current.setAttribute("width",(Te*ge).toString())}else{const Me=wt.height*at.scale,Te=wt.width*at.scale;Et.current.setAttribute("height",(Me*ge).toString()),Et.current.setAttribute("width",(Te*ge).toString())}},Co=(be,ge)=>{const Me=On.getDistance(be.x,be.y,ge.x,ge.y),Te=t1(Wt),De=t1(Dn);if(Me<=De){let ut=!1;return Me<=Te?ut=!1:Me<=De&&(ut=!0),{success:!0,distance:Me,zoomClosePoint:Te,zoomPointAnnotationValue:De,isExtraPointNeeded:ut}}else return{success:!1,distance:Me,zoomClosePoint:Te,zoomPointAnnotationValue:De,isExtraPointNeeded:!1}},$r=(be=[],ge={x:0,y:0},Me=!1,Te=!1,De)=>{if((be||[]).length>0){De.beginPath();const ut=M2(be);if((Ce==null?void 0:Ce.awi_annotation_type)==="rectangle")if(Pn){if(c){De.moveTo(ut[0].x,ut[0].y);for(let xt=1;xt<ut.length;xt++)De.lineTo(ut[xt].x,ut[xt].y);De.closePath()}else if(Pn){console.log("Sam function");const xt=M2(be);De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,xt.forEach(Xt=>{De.beginPath(),De.arc(Xt.x,Xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}}else{De.moveTo(ut[0].x,ut[0].y);for(let xt=1;xt<ut.length;xt++)De.lineTo(ut[xt].x,ut[xt].y);De.closePath()}else if((Ce==null?void 0:Ce.awi_annotation_type)==="circle")if(Pn&&!c){const xt=M2(be);console.log("coordinatesVal ",xt),De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,xt.forEach(Xt=>{De.beginPath(),De.arc(Xt.x,Xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}else{const xt=On.getDiameter(ut);De.arc((ut[0].x+ut[1].x)/2,(ut[0].y+ut[1].y)/2,Math.floor(xt/2),0,I1.TWO_PIE)}De.save(),De.lineWidth=$e.DEFAULT,De.strokeStyle=Zt,De.stroke()}if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&(nt||[]).length>0&&!Me&&!c){if(!Pn){const ut=M2(nt);if(De.beginPath(),De.lineWidth=$e.DEFAULT,De.strokeStyle=Zt,ut.forEach((xt,Xt)=>{if(Xt>0){const hn=ut[Xt-1];De.moveTo(hn.x,hn.y),De.lineTo(xt.x,xt.y)}}),De.stroke(),ut.forEach((xt,Xt)=>{De.beginPath(),De.arc(xt.x,xt.y,it,0,I1.TWO_PIE,!0),De.fillStyle=Xt===0?mt:Zt,De.fill()}),!X0()&&!Te&&ge&&ge.x>0&&ge.y>0&&!(ge.x>.998||ge.y>.998||ge.x<.002||ge.y<.002)){const xt=M2([ge]);De.beginPath();const Xt=Co(nt[0],ge);Xt!=null&&Xt.success&&(nt==null?void 0:nt.length)>2?Xt.isExtraPointNeeded?(De.beginPath(),De.rect(xt[0].x-ve*3,xt[0].y-ve*3,ve*6,ve*6),De.fillStyle=pt,De.fill(),De.lineWidth=4,De.strokeStyle=pt,De.stroke()):(De.beginPath(),De.rect(xt[0].x-ve*3,xt[0].y-ve*3,ve*6,ve*6),De.fillStyle=mt,De.fill(),De.lineWidth=2,De.strokeStyle=mt,De.stroke()):De.arc(xt[0].x,xt[0].y,ve,0,I1.TWO_PIE,!0),De.fillStyle="rgba(0,0,0,0.35)",De.fill(),De.strokeStyle=Zt,De.stroke();const hn=ut[ut.length-1];De.beginPath(),De.moveTo(hn.x,hn.y),De.lineTo(xt[0].x,xt[0].y),De.strokeStyle="#ff0000",De.setLineDash([5,5]),De.lineWidth=$e.DEFAULT,De.stroke(),De.setLineDash([])}De.closePath(),De.lineWidth=$e.DEFAULT,De.stroke(),De.save()}if(Pn){const ut=M2(be);De.clearRect(0,0,De.canvas.width,De.canvas.height),De.fillStyle="rgba(0, 0, 0, 0.35)",De.strokeStyle=Zt,De.lineWidth=$e.DEFAULT,ut.forEach(xt=>{De.beginPath(),De.arc(xt.x,xt.y,it,0,I1.TWO_PIE,!0),De.fill(),De.stroke()})}}},ei=(be,ge)=>{const Me=Et.current;if(!Me)return;const Te=Me.getContext("2d");if(!Te||(Te.clearRect(0,0,Me.width,Me.height),be==-1&&ge==-1))return;Ii("cross");const De=M2([{x:be,y:ge}])[0],ut=De.x,xt=De.y;Te.strokeStyle="#800080",Te.lineWidth=$e.CAROUSAL,Te.setLineDash([3,3]),Te.beginPath(),Te.moveTo(ut,0),Te.lineTo(ut,Me.height),Te.stroke(),Te.beginPath(),Te.moveTo(0,xt),Te.lineTo(Me.width,xt),Te.stroke(),Te.setLineDash([])},O1=(be=[],ge={x:0,y:0},Me=!1,Te=!1,De=0)=>{var ut,xt,Xt,hn;if(Ce&&!zo){const Ct=(ut=Ye.current)==null?void 0:ut.getContext("2d");if(Ii(),Ct!=null){Ct.imageSmoothingEnabled=!1,Ct.clearRect(0,0,wt.width,wt.height),!c&&(Ce==null?void 0:Ce.awi_request_for)!="attributes"&&$r(be,ge,Me,Te,Ct);const Kt=Bi||[];for(let x1=0;x1<Kt.length;x1++){const ce=Kt[x1],{awi_coords:h0,awi_id:B0,awi_status:m1}=ce;if(h0.length===0)return;const rn=M2(h0);Ct.beginPath(),Ct.lineJoin="round";let _0=!1,t2="",j2="";if(C==="all"||m1===C){ce.awi_status==="pending"?t2=ce.awi_outline_status==="approved"?"rgba(214, 204, 60, 0.3)":"rgba(0, 0, 0,0)":t2=I1.STATUS_COLOR_MAP[ce.awi_status]||"rgba(0, 0, 0,0)",j2=t2;let Yr=!1;if(B0===Dt?(Ct.lineWidth=$e.SELECTED,Ct.strokeStyle=Zt,Ct.fillStyle="rgba(0,0,0,0.40)",Yr=!0):B0===jn&&(Ct.lineWidth=$e.DEFAULT,Ct.strokeStyle=Lt,Ct.fillStyle=Xe,Yr=!0),!Yr)if(Ct.fillStyle=t2,A?Ct.lineWidth=$e.CAROUSAL:Ct.lineWidth=$e.DEFAULT,v){const n2=v[ce.awi_classes[0].awi_id];n2?(j2=n2,Ct.strokeStyle=n2):(j2=ce.awi_classes[0].awi_color,Ct.strokeStyle=ce.awi_classes[0].awi_color)}else j2=ce.awi_classes[0].awi_color,Ct.strokeStyle=ce.awi_classes[0].awi_color;switch(Ce==null?void 0:Ce.awi_annotation_type){case"circle":{const n2=(rn[0].x+rn[1].x)/2,ii=(rn[0].y+rn[1].y)/2,D3=Math.sqrt(Math.pow(rn[1].x-rn[0].x,2)+Math.pow(rn[1].y-rn[0].y,2));Ct.beginPath(),Ct.arc(n2,ii,D3/2,0,I1.TWO_PIE),Ct.stroke(),Ct.closePath(),_0=!0;break}case"dot":{Ct.beginPath(),Ct.moveTo(rn[0].x,rn[0].y),Ct.arc(rn[0].x,rn[0].y,ve,0,I1.TWO_PIE,!0),Ct.stroke(),Ct.closePath(),_0=!0;break}case"rectangle":{Ct.beginPath(),Ct.moveTo((xt=rn[0])==null?void 0:xt.x,(Xt=rn[0])==null?void 0:Xt.y);for(let n2=1;n2<rn.length;n2++)Ct.lineTo(rn[n2].x,rn[n2].y);Ct.closePath(),Ct.stroke(),_0=!0;break}case"polygon":{_0=!0,Ct.moveTo(rn[0].x,rn[0].y);const n2=rn.length;for(let ii=0;ii<n2;ii++)Ct.lineTo(rn[ii].x,rn[ii].y);break}}if(Ct.fill(),Ct.save(),Ct.stroke(),_0){Ct.save();const n2=B0===Dt,ii=B0===jn,D3=ce.sam_status==="yes";rn.forEach((Nl,c4)=>{Ct.beginPath();let H2=ve,qr="";n2?rn.length==1&&(Ce==null?void 0:Ce.awi_annotation_type)=="dot"||Te&&c4%(rn.length-1)==De?(H2=ve*2,qr=Zt):(qr=Zt,H2=ve):ii?(qr=Lt,H2=ve):(qr=j2,H2=ve),(Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?c4%(rn.length-1)==0&&(D3?qr=zt:qr=mt):c4==0&&rn.length>1&&D3&&(qr=zt),Ct.arc(Nl.x,Nl.y,H2,0,2*Math.PI,!0),Ct.fillStyle=qr,Ct.strokeStyle=qr,Ct.fill(),Ct.stroke(),Ct.restore()})}else console.log("Error")}}}qo()}if(at.scale==1&&(Ye!=null&&Ye.current)){const Ct=(hn=Ye==null?void 0:Ye.current)==null?void 0:hn.getBoundingClientRect();w2({top:Ct==null?void 0:Ct.top,left:Ct==null?void 0:Ct.left})}},M2=be=>be.map(Me=>({x:Me.x*Ye.current.width,y:Me.y*Ye.current.height})),Kr=be=>{const{x:ge,y:Me}=On.getMousePos(Ye.current,be);Tt(Te=>{const De=[...Te];return De[1].x=ge,De[1].y=Me,On.adjustToCircle(De)})},l0=be=>{if(be.length===0)return!1;const ge=On.isAnnotationCoordinatesValid(Ce,be,Pn,at.scale);return ge||O1(),ge},R3=(be,ge)=>(console.log("Has Moved checking"),Math.abs(be.x-ge.x)>0||Math.abs(be.y-ge.y)>0),go=()=>{if((nt==null?void 0:nt.length)>1){const be=nt[nt.length-1],ge=[];let Me=!1;for(let Te=0;Te<nt.length-1;Te++){const De=nt[Te],ut=t1(Gt);if(Math.abs(be.x-De.x)<=ut&&Math.abs(be.y-De.y)<=ut){Me=!0;continue}else ge.push({x:De.x,y:De.y})}return Me||ge.push(nt[nt.length-1]),Tt(ge),ge}else return nt},I3=()=>{if(typeof n=="function")if(nt.length>3){const be=Co(nt[0],nt[nt.length-1]);let ge=[];be.success&&(be.isExtraPointNeeded==!1?(nt[nt.length-1].x=nt[0].x,nt[nt.length-1].y=nt[0].y,ge=nt):be.isExtraPointNeeded&&(ge=[...nt,{x:nt[0].x,y:nt[0].y}])),(ge==null?void 0:ge.length)>0?(Tt([]),n(ge,null,!1,()=>{_2()})):O1(nt)}else O1(nt)},Z0=(be,ge)=>{console.log("deletePolygonPoint"),console.log("selectIndex ",ge);const Me=[];for(let Te=0;Te<be.length;Te++)Te!=ge&&Me.push(be[Te]);ge==0&&(Me[Me.length-1]=Me[0]),Tt(Me),(Me==null?void 0:Me.length)>3?(O1(Me),typeof o=="function"&&l0(Me)&&!p&&(W1.success("Point deleted successfully"),o(Me,u,()=>{_2()}))):W1.error("Point can not be deleted, as polygon need minimum of three points"),jo(-1),ya(null)};function J0(be,ge){console.log("handleAddAnnotationPoint");const Me=be.target;if(!(Me!=null&&Me.getBoundingClientRect))return;const Te=Me.getBoundingClientRect(),De=(be.clientX-Te.left)/Te.width,ut=(be.clientY-Te.top)/Te.height,{insertIndex:xt,minDistance:Xt}=On.closestCoordinates({x:De,y:ut},ge),hn=t1(Wt);if(Xt<hn){console.log("Very close point to insert"),console.log("minDistanceMin",Xt);const ce=t1(an);if(Xt<ce&&x2())console.log("We can remove this"),(ge==null?void 0:ge.length)>3&&(ya(ge),I1.POLYGON_POINT_REMOVE_CONFIRM_PROMPT?jo(xt):Z0(ge,xt));else{if(Xt<ce)W1.error("Press CTRL and then click to prompt for point deletion");else{const h0=(Xt*100).toFixed(1);W1.error("Very close point to draw "+h0+" it should be more than "+Wt*100)}jo(-1),ya(null)}return}if(x2())return;jo(-1),ya(null);const{insertIndex:Ct,minDistance:Kt}=On.findClosestSegment(ge,De,ut),x1=t1(_t);Kt>=x1||(ge.splice(Ct,0,{x:De,y:ut}),Tt(ge),O1(ge),typeof o=="function"&&l0(nt)&&!p&&o(nt,u,()=>{_2()}))}const ti=be=>{M&&typeof M<"u"&&typeof M=="function"&&(M({x:-1,y:-1}),ei(-1,-1)),Di(be,!0),jn!="-1"?Oi():(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&!c&&!A&&!Pn&&nt.length>0&&setTimeout(()=>{O1(nt)},200)},ki=be=>{if(!Pn){if((gn||vt&&Jn.x!==-1&&Jn.y!==-1)&&R3(L1,On.getMousePos(Ye.current,be))){const ge=E2(u);if(ge){const Me=l0(ge.awi_coords);if(typeof o=="function"&&Me)if(Jn.x!==-1&&Jn.y!==-1)if((Ce==null?void 0:Ce.awi_annotation_type)=="polygon")o(ge.awi_coords,Dt);else{const Te=On.getUpdatedCoordinates(Ye,be,Jn);o(Te,Dt)}else o(ge.awi_coords,Dt);else Me||((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&F2(ge.awi_coords,be),Xo(!0))}}En?(At(!1),typeof n=="function"&&l0(nt)&&((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?I3():n(nt,null,!1,()=>{_2()}))):vt&&(Nt(!1),cn("-1"),b1([]),typeof d=="function"&&d("-1"))}},Ea=be=>{if(!(Ye!=null&&Ye.current))return;const ge=s4(be,!1);(ge==null?void 0:ge.length)>0&&ge[0]!=Dt?(Yo(),D1(ge[0]),Ye.current.style.cursor="pointer"):jn!="-1"&&(D1("-1"),Dt=="-1"&&(Ye.current.style.cursor="default"))},_9=(be,ge=!1)=>{if(ge){ht(nt);return}const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=E2(u);if(De){const ut=De.awi_coords,{minDistance:xt,insertIndex:Xt}=On.closestCoordinates({x:Me,y:Te},ut),hn=t1(Qt);if(xt<=hn&&Ye.current){const Ct=Ye.current.getContext("2d");if(!Ct||Xt==un)return;Ye.current.style.cursor="pointer",wn(Xt),Ye.current.title="Point "+(Xt+1);const Kt=M2([ut[Xt]])[0];Ct.fillStyle=Cn,Ct.beginPath(),Ct.arc(Kt.x,Kt.y,ve*2.5,0,I1.TWO_PIE),Ct.strokeStyle="black",Ct.lineWidth=$e.SELECTED,Ct.stroke(),Ct.fill()}else if(Ye.current){if(!Ye.current.getContext("2d"))return;const Kt=t1(Ht);un!==-1&&(ht(),wn(-1)),(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"&&On.findClosestSegment(ut,Me,Te).minDistance<=Kt?(Ye.current.style.cursor="pointer",Ye.current.title="Add point"):(Ye.current.style.cursor="default",Ye.current.title="")}}},Di=Br.useThrottle(_9,100),ni=Br.useThrottle(Ea,100),F2=(be,ge)=>{if(On.breakPointCount(be)>0){console.log("================================BREAK================================"),$t(!1),ge&&ge.stopPropagation&&(ge==null||ge.stopPropagation());const Te=On.shiftPolygon(be);if(typeof o=="function"&&l0(Te)){const De=u;o(Te,u,()=>{Dt!=De&&cn(De),_2()})}}},Ze=()=>pn.length>I1.MAX_ANNOTATIONS_TO_RUN_FAST?ht:O1,ht=Br.useThrottle((be,ge,Me=!1,Te=!1,De=-1)=>{O1(be,ge,Me,Te,De)},50),st=(be="forward")=>{if((pn||[]).length!=0)if(be=="last_update"){const ge=pn==null?void 0:pn.reduce((Me,Te)=>{const De=new Date(Me.awi_last_updation).getTime();return new Date(Te.awi_last_updation).getTime()>De?Te:Me});ge&&(cn(ge.awi_id),typeof d=="function"&&d(ge.awi_id))}else if(u==="-1")(pn||[]).length>0&&(cn(pn[0].awi_id),typeof d=="function"&&d(pn[0].awi_id));else{const ge=w9(u);be=="backward"?ge!==-1?ge>0?(cn(pn[ge-1].awi_id),typeof d=="function"&&d(pn[ge-1].awi_id)):(cn(pn[pn.length-1].awi_id),typeof d=="function"&&d(pn[pn.length-1].awi_id)):(pn||[]).length>0&&(cn(pn[pn.length-1].awi_id),typeof d=="function"&&d(pn[pn.length-1].awi_id)):ge!==-1?(pn||[]).length>ge+1?(cn((pn||[])[ge+1].awi_id),typeof d=="function"&&d((pn||[])[ge+1].awi_id)):(cn((pn||[])[0].awi_id),typeof d=="function"&&d((pn||[])[0].awi_id)):(pn||[]).length>0&&(cn(pn[0].awi_id),typeof d=="function"&&d(pn[0].awi_id))}},sn=()=>{if(console.log("handleCompleteAnnotation"),!(!Ce||c))if(_==="SAM"){vo();return}else{if((Ce==null?void 0:Ce.awi_annotation_type)!="polygon")return;if(typeof n=="function"&&l0(nt))if((nt==null?void 0:nt.length)>2){const be=[...nt,{x:nt[0].x,y:nt[0].y}];Tt([]),n(be,null,!1,()=>{_2()})}else{W1.error("Polygon requires minimum of three coordinates");return}else W1.error("Invalid coordinates, please create valid coordinates")}},Un=be=>{console.log("handle Complete Multiple Annotation SAM");const ge=[];for(let Me=0;Me<(be==null?void 0:be.length);Me++){const Te=be[Me].outline,De=be[Me].classId;if(l0(Te)){const xt={coords:(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?On.createPolygonLoop(Te):Te,classId:De,isSam:!0};ge.push(xt)}}(ge==null?void 0:ge.length)>0&&typeof r=="function"&&(Tt([]),r(ge,()=>{(ge==null?void 0:ge.length)>0&&Xo()}))},h1=()=>{if(console.log("undoAnnotationPoint"),console.log("coordinates ------>",nt),u!="-1"){Ma();return}if(nt.length>0&&(Ce==null?void 0:Ce.awi_annotation_type)==="polygon")nt.pop(),Tt([...nt]),O1(nt);else if(nt.length>0&&Pn)nt.pop(),Tt([...nt]),O1(nt);else return},e0=()=>{mn(Ft)},R1=(be,ge="zoom-in")=>{if(Ye.current&&Ye)if(ge=="zoom-in"){const Me=Yt,Te=at.scale+Me,De=Ye.current.getBoundingClientRect(),ut=be.clientX-De.left,xt=be.clientY-De.top,Xt=Te/at.scale,hn=at.x-ut*(Xt-1),Ct=at.y-xt*(Xt-1),Kt={scale:+Te.toFixed(2),x:hn,y:Ct};mn(Kt),S3({x:be.clientX,y:be.clientY})}else{const Me=Yt,Te=at.scale-Me;if(Te==1)e0();else{const De=Ye.current.getBoundingClientRect();(v0.x==-1||v0.y==-1)&&console.log("zoomTimeMousePoint");const ut=v0.x!=-1?v0.x:be.clientX,xt=v0.y!=-1?v0.y:be.clientY,Xt=ut-De.left,hn=xt-De.top,Ct=Te/at.scale,Kt=-Math.abs(at.x+Xt*(1-Ct)),x1=-Math.abs(at.y+hn*(1-Ct)),ce=wt.width*(at.scale+Yt-1),h0=wt.height*(at.scale+Yt-1),{newXTransform:B0,newYTransform:m1}=On.transformCoordinatesCheck(Kt,x1,ce,h0),rn={scale:+Te.toFixed(2),x:B0,y:m1};mn(rn)}}},mo=(be=null)=>{if(at.scale!==Wn&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const ge=wt.width*(at.scale+Yt-1),Me=wt.height*(at.scale+Yt-1),Te=at.x-wt.width*Yt/2,De=at.y-wt.height*Yt/2,{newXTransform:ut,newYTransform:xt}=On.transformCoordinatesCheck(Te,De,ge,Me),Xt={scale:+(at.scale+Yt).toFixed(2),x:ut,y:xt};mn(Xt)}else R1(be,"zoom-in")},e2=(be=null)=>{if(at.scale!==1&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const ge=wt.width*(at.scale-Yt-1),Me=wt.height*(at.scale-Yt-1),Te=at.x+wt.width*Yt/2,De=at.y+wt.height*Yt/2,{newXTransform:ut,newYTransform:xt}=On.transformCoordinatesCheck(Te,De,ge,Me);mn({scale:+(at.scale-Yt).toFixed(2),x:ut,y:xt})}else R1(be,"zoom-out")},x0=be=>{be.deltaY<0?mo(be):e2(be)},po=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x+Qn,Te=at.y,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},Ao=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x-Qn,Te=at.y,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},pr=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x,Te=at.y+Qn,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})},Wr=()=>{const be=wt.width*(at.scale-1),ge=wt.height*(at.scale-1),Me=at.x,Te=at.y-Qn,{newXTransform:De,newYTransform:ut}=On.transformCoordinatesCheck(Me,Te,be,ge);mn({...at,x:De,y:ut})};if(!e||!i)return null;const vo=()=>{if(tn){W1.error("Request already in progress");return}if(!(nt!=null&&nt.length)){W1.error("No points to send");return}const be={};be.image_url=e,be.coords=nt,console.log("Sent to SAM",be),Pi(),typeof h=="function"&&h("annotate")},u1=()=>{if(P2?Fn(!1):P2||Fn(!0),tn){W1.error("Request already in progress");return}typeof h=="function"&&h("annotate")},l4=be=>{console.log("Submitted data from SAMModal:",be),bo(be),typeof h=="function"&&h("annotate")},bo=be=>{if(!Qo||!(Qo!=null&&Qo.mutate)){W1.error("SAM Prompt is not available");return}console.log("getSAMAnnotationsPrompt");const ge=be.awi_annotation_prompt,Me=be.model_confidence,Te=be.model_name,De=be.model_max_results;L0({modelName:Te,modelConfidence:Me,modelMaxResults:De,promptMessage:ge});const ut=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Xt={requestId:a||0,contents:[{url:J2||ut,contentKey:i,directPrompt:ge||""}],confidence:Me||M1,modelName:Te||r0,modelMaxResults:De||jr};jt(!0),Qo.mutate(Xt,{onSuccess:hn=>{var Ct,Kt,x1,ce,h0;if(jt(!1),!hn.success)W1.error(hn.message);else{Fn(!1);const B0=((x1=(Kt=(Ct=hn.data)==null?void 0:Ct[0])==null?void 0:Kt.contours)==null?void 0:x1[0])??null;if(B0){const m1=B0.coordinates;if((m1==null?void 0:m1.length)==0||!((h0=(ce=m1[0])==null?void 0:ce.box)!=null&&h0.length))W1.error("No auto annotation is possible to create");else{const rn=[];(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?(console.log("coordinates",m1),m1.forEach(_0=>{var t2;(t2=_0==null?void 0:_0.mask_polygon)==null||t2.forEach(j2=>{const n2={outline:j2.outline,classId:m1.classId};rn.push(n2)})})):(Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"?m1.forEach(_0=>{const t2=On.getBoundingBox(_0.box);Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}):(Ce==null?void 0:Ce.awi_annotation_type)=="circle"?m1.forEach(_0=>{const t2=On.calculateCircleFromCoordinates(On.getBoundingBox(_0.box));Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}):(Ce==null?void 0:Ce.awi_annotation_type)=="dot"&&m1.forEach(_0=>{const t2=On.calculateCentroid(_0.box);Tt(t2);const j2={outline:t2,classId:m1.classId};rn.push(j2)}),Un(rn),typeof E=="function"&&E("Normal")}}else W1.error("No Auto Annotation found")}},onError:hn=>{W1.exception(hn),jt(!1)}})},Pi=()=>{if(!Wo||!(Wo!=null&&Wo.mutate)){W1.error("SAM is not available");return}const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),ge=J2||be,Me=Br.chunkArray(nt),Te={img_url:ge,coords:nt,coordinates:Me};jt(!0),Wo.mutate(Te,{onSuccess:De=>{var ut;if(jt(!1),!De.success)W1.error(De.message);else if(console.log("this is the SAM data",De),((ut=De==null?void 0:De.data)==null?void 0:ut.length)>0){const xt=[];(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?De.data.forEach(Xt=>{Xt.contours.forEach(hn=>{Tt(hn.outline);const Kt={outline:hn.outline,classId:null};xt.push(Kt)})}):(Ce==null?void 0:Ce.awi_annotation_type)=="rectangle"?De.data.forEach(Xt=>{Tt(Xt.bbox),console.log("this si the bbox",Xt.bbox);const Ct={outline:Xt.bbox,classId:null};xt.push(Ct)}):(Ce==null?void 0:Ce.awi_annotation_type)=="circle"?De.data.forEach(Xt=>{const hn=On.calculateCircleFromCoordinates(Xt.bbox);Tt(hn);const Ct={outline:hn,classId:null};xt.push(Ct)}):(Ce==null?void 0:Ce.awi_annotation_type)=="dot"&&De.data.forEach(Xt=>{const hn=On.calculateCentroid(Xt.bbox);Tt(hn);const Ct={outline:hn,classId:null};xt.push(Ct)}),Un(xt)}else W1.error("No annotations found from SAM")},onError:De=>{W1.exception(De),jt(!1)}})},Sa=async()=>{if(fe&&typeof fe=="function"){W1.success("Loading Annotations...");const be=await fe();console.log("cacheRemoveAnnotationResponse ",be),be!=null&&be.success?(W1.success((be==null?void 0:be.message)+" and now loading final annotations..."),Xo(!0)):W1.error(be==null?void 0:be.message)}},Ma=()=>{var ge;console.log("Undo last state annotation");const be=E2(u);if(((ge=be.past_coords)==null?void 0:ge.length)>0){const Me=be.past_coords[be.past_coords.length-1];typeof o=="function"&&l0(Me)&&!p&&o(Me,u,()=>{_2()})}},Ar=be=>{console.log("Control p"),Ye.current&&mo(be)},Ni=be=>{console.log("Control m"),e2(be)},V2=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};Ar(be)},er=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};Ni(be)},k3=()=>{console.log("Copying annotations"),O&&typeof O=="function"&&O((vn==null?void 0:vn.result)||[])},tr=(be=!0)=>{try{document.fullscreenElement?(document.exitFullscreen().then(()=>{console.log("Fullscreen exited")}).catch(ge=>{console.log(ge)}),be&&ia.setItem("full_screen","no")):(document.documentElement.requestFullscreen().then(()=>{console.log("Fullscreen entered")}).catch(ge=>{console.log(ge)}),be&&ia.setItem("full_screen","yes"))}catch(ge){console.log(ge)}},vr=be=>{var ge;if(!(!A&&!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))){if((Ce==null?void 0:Ce.awi_request_for)=="attributes"){const Me=mr(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(b1(Me),typeof d=="function"&&d(Me[0]),O1()),gn&&$t(!1),Nt(!1);return}if(En)if(At(!1),Pn){if(nt&&(nt==null?void 0:nt.length)>0){let Me=[];T1?x2()?Me=go():Me=nt:Me=go(),O1(Me)}}else console.log("creating new annotation"),typeof n=="function"&&l0(nt)&&((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"?I3():(Tt([]),n(nt,null,!1,()=>{_2()})));else if(c&&Dt!=="-1"||A){if((gn||Jn.x!==-1&&Jn.y!==-1)&&R3(L1,On.getMousePos(Ye.current,be))){const Me=E2(Dt);if(Me){const Te=[...Me.awi_coords],De=l0(Te);typeof o=="function"&&De&&!p?o(Te,u,()=>{_2()}):De||((Ce==null?void 0:Ce.awi_annotation_type)=="polygon"?F2(Te,be):Xo(!0))}}else{const Me=mr(be)||[];if(Me.length>0)if(Me.every(Te=>n1.includes(Te))&&n1.every(Te=>Me.includes(Te))){if(cn(Te=>(typeof d=="function"&&d(n1[(n1.indexOf(Te)+1)%n1.length]),ht(),n1[(n1.indexOf(Te)+1)%n1.length]==="-1"&&(o1({x:0,y:0}),$n({x:-1,y:-1})),n1[(n1.indexOf(Te)+1)%n1.length])),(!gn||x2())&&(Ce==null?void 0:Ce.awi_annotation_type)=="polygon"){const Te=(ge=E2(u))==null?void 0:ge.awi_coords;J0(be,Te)}}else console.log("Selecting first temp"),cn(Me[0]),typeof d=="function"&&d(Me[0]),O1();else cn("-1"),O1();b1(Me)}gn&&$t(!1),Nt(!1)}else if(c){const Me=mr(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(b1(Me),typeof d=="function"&&d(Me[0]),O1()),Nt(!1)}}},ri=be=>{if(console.log("Handle Mouse Down"),be.button==0&&!X0()){if(!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))return;if(!c&&!A){At(!0),console.log("Mouse down");const{x:ge,y:Me}=On.getMousePosAbsolute(Ye.current,be);Mn({x:ge,y:Me}),Pn?T1&&x2()||Tt(Te=>[...Te||[],{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"?Tt([{x:ge,y:Me},{x:ge,y:Me},{x:ge,y:Me},{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="circle"?Tt([{x:ge,y:Me},{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="dot"?Tt([{x:ge,y:Me}]):(Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&Tt(Te=>[...Te,{x:ge,y:Me}])}else A||(O3(be,Dt),Nt(!0))}else if(be.button===1||be.button==0){const{clientX:ge,clientY:Me}=be,{x:Te,y:De}=at,ut=Xt=>{console.log("PANNING!!!!!");const hn=Xt.clientX-ge,Ct=Xt.clientY-Me,Kt=Te+hn,x1=De+Ct,ce=Math.max(Math.min(Kt,0),wt.width-wt.width*at.scale),h0=Math.max(Math.min(x1,0),wt.height-wt.height*at.scale);mn({scale:at.scale,x:ce,y:h0})},xt=()=>{window.removeEventListener("mousemove",ut),window.removeEventListener("mouseup",xt),window.addEventListener("touchmove",ut,{passive:!1}),window.addEventListener("touchend",xt)};at.scale>1&&(window.addEventListener("mousemove",ut),window.addEventListener("touchmove",ut,{passive:!1})),window.addEventListener("mouseup",xt),window.addEventListener("touchend",xt)}},Qr=be=>{if(Ye!=null&&Ye.current&&A1({x:be.clientX,y:be.clientY}),c&&(Dt!="-1"&&(pn==null?void 0:pn.length)<=I1.MAX_ANNOTATIONS_TO_HOVER&&Di(be),!gn&&!vt?(pn==null?void 0:pn.length)<=I1.MAX_ANNOTATIONS_TO_HOVER&&ni(be):jn!="-1"&&D1("-1")),p)return;let ge=[];if(En){Pn?(ge.length==0&&(ge=[Jt]),Tt(Me=>Me.length==0?[Jt]:Me),O1(nt)):(Ce==null?void 0:Ce.awi_annotation_type)==="rectangle"?(ge=On.getUpdatedCoordinates(Ye,be,Jt),Tt(ge),O1(ge)):(Ce==null?void 0:Ce.awi_annotation_type)==="circle"?(Kr(be),O1(nt)):(Ce==null||Ce.awi_annotation_type,O1(nt));return}else if(c&&Dt!=="-1"&&vt){if(console.log("isDrawingAnnotation",En),gn){const{x:Me,y:Te}=On.getMousePos(Ye.current,be),De=Me-(L1.x||0),ut=Te-(L1.y||0);if(u!=="-1"){ge=[...nt].map(hn=>({x:hn.x+De,y:hn.y+ut}));const xt=E2(u);if(xt)switch(xt.awi_coords=[...ge],Ce==null?void 0:Ce.awi_annotation_type){case"dot":{ge.length===1&&(ge[0].x=On.getPerfectPointValue(ge[0].x),ge[0].y=On.getPerfectPointValue(ge[0].y));break}case"circle":{ge.length===2&&(ge=[...On.adjustToCircle(ge)],xt.awi_coords=[...ge]);break}case"rectangle":{if(ge.length===4){const hn=Math.abs(ge[1].x-ge[0].x),Ct=Math.abs(ge[3].y-ge[1].y);for(let Kt=0;Kt<ge.length;Kt++)ge[Kt].x<0?(ge[1].x=hn,ge[2].x=hn,ge[0].x=1e-4,ge[3].x=1e-4):ge[Kt].y<0?(ge[2].y=Ct,ge[3].y=Ct,ge[0].y=1e-4,ge[1].y=1e-4):ge[Kt].x>1?(ge[0].x=1-hn,ge[3].x=1-hn,ge[1].x=1-1e-4,ge[2].x=1-1e-4):ge[Kt].y>1&&(ge[0].y=1-Ct,ge[1].y=1-Ct,ge[2].y=1-1e-4,ge[3].y=1-1e-4)}break}case"polygon":{ge.length>1&&F2(ge,be);break}default:{console.log("Unknown request type");break}}Ze()(ge)}}else if(Jn.x!==-1&&Jn.y!==-1&&u!=="-1"){console.log("Corner coordinates");const Me=E2(u);if((Ce==null?void 0:Ce.awi_annotation_type)==="circle"){const Te=On.getMousePos(Ye.current,be);if(Me){ge=Me.awi_coords;const De=(ge[0].x+ge[1].x)/2,ut=(ge[0].y+ge[1].y)/2,xt=On.getDistance(Te.x,Te.y,De,ut);De-xt<0?(ge[0]={x:0,y:ut},ge[1]={x:2*xt,y:ut}):De+xt>1?(ge[0]={x:1-2*xt,y:ut},ge[1]={x:1,y:ut}):ut-xt<0?(ge[0]={x:De,y:0},ge[1]={x:De,y:2*xt}):ut+xt>1?(ge[0]={x:De,y:1-2*xt},ge[1]={x:De,y:1}):(ge[0]={x:De-xt,y:ut},ge[1]={x:De+xt,y:ut}),ge=[...On.adjustToCircle(ge)]}}else if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&!Pn){const Te=On.getMousePos(Ye.current,be);Me!=null&&Me.awi_coords&&(ge=[...Me.awi_coords],v1>-1&&(v1===0||v1===ge.length-1?(ge[0]={x:Te.x,y:Te.y},ge[ge.length-1]={x:Te.x,y:Te.y}):ge[v1]={x:Te.x,y:Te.y},$n({x:Te.x,y:Te.y})))}else ge=On.getUpdatedCoordinates(Ye,be,Jn);if(l0(ge)){Tt([...ge]);const Te=E2(u);Te&&(Te.awi_coords=ge,O1(ge))}}}else if((Ce==null?void 0:Ce.awi_annotation_type)==="polygon"&&!c&&(nt==null?void 0:nt.length)>1){const{x:Me,y:Te}=On.getMousePos(Ye.current,be);ht(nt,{x:Me,y:Te})}},Ha=be=>{if(be.touches.length===1){const ge=be.touches[0];if(X0()){if(at.scale==1)return;S1.current||(S1.current={x:ge.clientX,y:ge.clientY})}else{const Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget,button:0};ri(Me)}}},Gr=be=>{if(be.preventDefault(),be.touches.length>=2){const[ge,Me]=[be.touches[0],be.touches[1]],Te=Me.clientX-ge.clientX,De=Me.clientY-ge.clientY,ut=Math.hypot(Te,De);if(yn!==null){const xt=ut-yn,Xt=(ge.clientX+Me.clientX)/2,hn=(ge.clientY+Me.clientY)/2;x0({deltaY:-xt,clientX:Xt,clientY:hn,currentTarget:be.currentTarget})}Hn(ut)}if(be.touches.length===1){const ge=be.touches[0];if(X0()){if(S1.current){console.log("PANNING!!!!!");const Me=ge.clientX-S1.current.x,Te=ge.clientY-S1.current.y,{x:De,y:ut}=at,xt=De+Me,Xt=ut+Te,hn=Math.max(Math.min(xt,0),wt.width-wt.width*at.scale),Ct=Math.max(Math.min(Xt,0),wt.height-wt.height*at.scale);mn({scale:at.scale,x:hn,y:Ct}),S1.current={x:ge.clientX,y:ge.clientY}}}else{S1.current&&(S1.current=null);const Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};Qr(Me)}}},nr=be=>{if(S1.current&&(S1.current=null),be.touches.length<2&&Hn(null),X0()){be.preventDefault();return}const ge=be.touches[0]||be.changedTouches[0],Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};vr(Me)},yo=be=>{const ge=be.touches[0]||be.changedTouches[0],Me={...ge,clientX:ge.clientX,clientY:ge.clientY,currentTarget:be.currentTarget};ti(Me)},Ti=(be="")=>{switch(be){case"left":po();break;case"right":Ao();break;case"top":pr();break;case"bottom":Wr();break;default:console.warn(`Unknown pan direction: ${be}`)}},La=()=>{typeof x=="function"&&x(be=>!be)},E9=()=>{if(!u||u=="-1"){W1.error("Control copy will be work only when you have a selected annotation");return}else P&&typeof P=="function"&&P(vn==null?void 0:vn.result,!1)},Fi=()=>{if(!d2.current||!$o.current)return;const be=d2.current,ge=be.getContext("2d");if(!ge)return;const Me=wt.width*at.scale,Te=wt.height*at.scale;!Me||!Te||(be.width=Me,be.height=Te,ge.clearRect(0,0,Me,Te),ge.save(),ge.setTransform(1,0,0,1,0,0),ge.clearRect(0,0,Me,Te),ge.translate(at.x,at.y),ge.scale(at.scale,at.scale),ge.drawImage($o.current,0,0,wt.width,wt.height),ge.restore())};return Z.jsxs(Z.Fragment,{children:[P2&&Z.jsx(WS,{closeSAMPromptModal:()=>Fn(!1),onSubmit:l4,directPrompt:f1,isLoading:tn,requestInfo:Ce}),A&&H&&(vn==null?void 0:vn.success)&&Z.jsx(Z.Fragment,{children:Z.jsx("div",{style:{margin:"4px",display:"flex",justifyContent:"center"},children:Z.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"max-content"},children:Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:k3,children:"Copy Annotations"})})})}),A&&Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{minHeight:T1?"50vh":"unset",touchAction:"none !important",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((f=(Ba=(oi=k==null?void 0:k.result)==null?void 0:oi.annotatorInfo)==null?void 0:Ba.awi_personal_info)==null?void 0:f.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:T1,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i),Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})]})}),!A&&je=="atom"&&Z.jsxs("div",{style:{display:"flex",flexDirection:T1?"column":"row"},children:[Z.jsx("div",{style:{height:T1?"unset":"100%",width:T1?"100%":"5.4%",border:"1px solid #E4E0E6",backgroundColor:"white"},children:["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level)&&Z.jsx("div",{style:{width:"100%",gap:"10px",marginTop:"2px",height:"100% ",display:"flex",justifyContent:"space-between",alignItems:"center",flexDirection:T1?"row":"column"},children:Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((z=(B=(b=k==null?void 0:k.result)==null?void 0:b.annotatorInfo)==null?void 0:B.awi_personal_info)==null?void 0:z.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:T1,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i)})}),Z.jsxs("div",{style:T1?{height:"100%",width:"100%"}:{width:"94.6%"},children:[!T1&&Z.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",height:T1?"8%":"3%",border:"1px solid #E4E0E6",background:"white",justifyContent:"space-between"},children:[Z.jsxs("div",{style:{display:"flex",flexDirection:"row",height:"100%",alignItems:"center"},children:[Z.jsxs("div",{className:"color-black",style:{width:"4.8rem",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:[Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:" rgba(111, 41, 169, 0.20)",height:"100%"},children:ue+1}),Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:Fe||"rgba(111, 41, 169, 0.1)",height:"100%"},children:(((X=k==null?void 0:k.result)==null?void 0:X.awi_contents)||[]).length})]}),Z.jsxs("p",{className:"color-black",style:{marginLeft:"1rem"},title:((ie=G==null?void 0:G.awi_label)==null?void 0:ie.length)>20?G.awi_label:J.length>20?J:"",children:["Image -"," ",((ke=G==null?void 0:G.awi_label)==null?void 0:ke.length)>0?G.awi_label.length>20?G.awi_label.substring(0,20)+"...":G.awi_label:J.length>20?J.substring(0,20)+"...":J]}),Z.jsx("p",{className:"color-black",style:{marginLeft:"1rem"},children:((ye==null?void 0:ye.result)||[]).length>0&&`Annotations - ${((ye==null?void 0:ye.result)||[]).length} (Recent First) ${S.size?`Selected - ${((ye==null?void 0:ye.result)||[]).length-S.size}`:""}`})]}),Z.jsx("div",{children:Z.jsxs("div",{style:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},className:"color-black",children:[Z.jsx("div",{children:g0}),(g0==null?void 0:g0.length)>0&&Z.jsx(w7,{color:"#000"})]})})]}),Z.jsx("div",{children:W&&T1&&We&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(We,{handleNextPage:V,handlePreviousPage:T,currentPage:$,images:(Je=k==null?void 0:k.result)==null?void 0:Je.awi_contents,handleIndexUpdate:K,currentIndex:ue,request_id:q,requestFor:(rt=k==null?void 0:k.result)==null?void 0:rt.awi_request_for,imagePagination:W,showImages:!0,fetchAnnotations:Le,pageCount:Be})})}),Z.jsx("div",{style:{height:T1||y9?"25px":"3%",border:"1px solid #E4E0E6",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px",backgroundColor:"#fff"},children:T1&&(g0==null?void 0:g0.length)>0?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center",fontWeight:"bold"},children:g0})}):Z.jsx(Z.Fragment,{children:at.scale>1?Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"space-between",alignItems:"center"},children:[Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("left"),children:"Left"}),Z.jsx("progress",{value:X2.left,max:wt.width,title:X2.left==0?"You can not move left more":"Showing how much you can move left more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("right"),children:"Right"}),Z.jsx("progress",{value:X2.right,max:wt.width,title:X2.right==0?"You can not move right more":"Showing how much you can move right more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("top"),children:"Top"}),Z.jsx("progress",{value:X2.top,max:wt.height,title:X2.top==0?"You can not move top more":"Showing how much you can move top more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>Ti("bottom"),children:"Bottom"}),Z.jsx("progress",{value:X2.bottom,max:wt.height,title:X2.bottom==0?"You can not move bottom more":"Showing how much you can move bottom more"})]})}):Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center"},children:"Zoom in to see image pan progress"})})}),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{height:W?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:T1?"50vh":"unset",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})}),W&&!T1&&We&&Z.jsx("div",{children:W&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(We,{handleNextPage:V,handlePreviousPage:T,currentPage:$,images:(Bt=k==null?void 0:k.result)==null?void 0:Bt.awi_contents,handleIndexUpdate:K,currentIndex:ue,request_id:q,requestFor:(nn=k==null?void 0:k.result)==null?void 0:nn.awi_request_for,imagePagination:W,showImages:!0,fetchAnnotations:Le,pageCount:Be})})})]})]}),!A&&je=="library"&&Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(Tc,{isEditing:c,handleSelectTool:h,annotator_name:((f0=(Gn=(In=k==null?void 0:k.result)==null?void 0:In.annotatorInfo)==null?void 0:Gn.awi_personal_info)==null?void 0:f0.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:vn,SAMToggleValue:D,currentSelectedSAMTool:N,handleCopyAnnotations:P,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:re,handleZoomInClick:mo,zoomProperties:at,handleReset:e0,handleZoomOutClick:e2,handleCompleteAnnotation:sn,toggleFullscreen:tr,selectAnnotationId:Dt,selectedAnnotationInfo:Nn,undoLastStateAnnotation:Ma,usingSamFunction:Pn,samAPIactive:tn,handleSendToSamFunction:vo,coordinates:nt,reLoadAndReDrawAnnotations:Sa,showGuidelinesFirst:re,handleSendToSamFunctionPrompt:u1,isMobile:!0,toggleSelectAnnotation:st,handleLeftKeyDown:po,handleRightKeyDown:Ao,handleUpKeyDown:pr,handleDownKeyDown:Wr,undoAnnotationPoint:h1,togglePagination:La,switchToEditMode:_e,switchToCreateMode:xe,goToNextImage:Ae,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:E9,handlePasteAnnotationsByControlV:ae,showPagination:W,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Pt,isCarousel:A,allowedToCopyPreview:H,classColorMapToSend:v,request:Ce,parentReqData:et,RequestInfoModal:ne,setCrossHair:a0,isCrossHair:c1,annotationViewType:je,REACT_APP_SAM_ENABLED:lt,loggedUser:m,controlMinusHotkey:er,controlPlusHotkey:V2,Carousel:ot},i),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Rt,style:{height:W?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:T1?"50vh":"unset",position:"relative"},children:zo?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",Br.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",ue+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",ue+1," is loading..."]}):Z.jsx(Fc,{canvasDimensions:wt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:d2,overlayCanvasRef:Et,handleMouseDown:ri,handleMouseUp:vr,handleMouseMove:Qr,handleMouseMoveOut:ki,handleOnMouseLeave:ti,handleWheel:x0,handleTouchStart:Ha,handleTouchMove:Gr,handleTouchEnd:nr,handleTouchCancel:yo})})]}),e1!=-1&&A9&&Z.jsx(zM,{callback:()=>Z0(A9,e1),cancelCallBack:()=>{jo(-1)},trigger:"REMOVE_POLYGON_POINT",fireOnMount:!0,children:Z.jsx(Z.Fragment,{})})]})},k9e="_message__container_u7nyp_1",D9e="_message__container__icon_u7nyp_15",P9e="_message__container__title_u7nyp_19",N9e="_message__container__title__success_u7nyp_24",T9e="_message__container__description_u7nyp_27",F9e="_message__container__loading_u7nyp_31",V9e="_pulse_u7nyp_1",_r={message__container:k9e,message__container__icon:D9e,message__container__title:P9e,message__container__title__success:N9e,message__container__description:T9e,message__container__loading:F9e,pulse:V9e},Vc=({iconUrl:e,title:t,description:n,messageType:r="information",isLoading:o=!1,textClass:i="",noPadding:a,iconName:s=""})=>{var c,u;return o?Z.jsxs("div",{className:qn(_r.message__container,_r.message__container__loading),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(c=X1[s])==null?void 0:c.IconComponent,className:_r.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_r.message__container__icon}),Z.jsx("h1",{className:qn(_r.message__container__title,{[_r.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_r.message__container__description,i),children:n})]}):Z.jsxs("div",{className:qn(_r.message__container,{noPadding:a}),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(u=X1[s])==null?void 0:u.IconComponent,className:_r.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_r.message__container__icon}),Z.jsx("h1",{className:qn(_r.message__container__title,{[_r.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_r.message__container__description,i),children:n})]})},qb={ATTRIBUTES:{labelValue:"Attributes",src:"noAttributes",description:"No attributes are available. Start by adding or configuring attributes.",messageType:"information",loadingMessage:"Loading attributes...",notFoundMessage:"No attributes found"},ORGANISATIONS:{labelValue:"Organisations",src:"noOrganisations",description:"There are no organisations available. Add a new organisation to get started.",messageType:"information",loadingMessage:"Loading organizations...",notFoundMessage:"No organisations found"},REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available. Raised requests will be displayed here.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},USERS:{labelValue:"Users",src:"noUsers",description:"No users have been added yet. Start by inviting or creating users.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},USERS_IN_REQUEST:{labelValue:"Users",src:"noUsers",description:"No users found.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},CLASSES:{labelValue:"Classes",src:"noClasses",description:"There are no classes available. Add a new class to begin.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},IMAGES:{labelValue:"Images",src:"noImages",description:"No images are currently available. Upload images to view them here.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},ANNOTATOR_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Annotator Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},VERIFIER_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Verifier Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},MODELS:{labelValue:"Models",src:"noModels",description:"There are no models available. Run jobs and train models to get started.",messageType:"information",loadingMessage:"Loading models...",notFoundMessage:"No models found"},JOBS:{labelValue:"Jobs",src:"noJobs",description:"No jobs are currently scheduled or running. Create a job to see it listed here.",messageType:"information",loadingMessage:"Loading jobs...",notFoundMessage:"No jobs found"},MODEL_LOGS:{labelValue:"Model Logs",src:"noJobLogs",description:"There are no logs available for the models. Generate or upload logs to view them.",messageType:"information",loadingMessage:"Loading model logs...",notFoundMessage:"No model logs found"},DATASETS:{labelValue:"Datasets",src:"noDatasets",description:"No datasets are available. Upload or create datasets to start working.",messageType:"information",loadingMessage:"Loading datasets...",notFoundMessage:"No datasets found"},BILLS:{labelValue:"Bills",src:"noBills",description:"No bills are currently available. Generated bills will be listed here.",messageType:"information",loadingMessage:"Loading bills...",notFoundMessage:"No bills found"},MODEL_METRICS:{labelValue:"Model Metrics",src:"noModelMetrics",description:"No metrics are available for the models. Generated metrics for analyzing performance will be listed here.",messageType:"information",loadingMessage:"Loading model metrics...",notFoundMessage:"No model metrics found"},MODEL_DETAILS:{labelValue:"Model Details",src:"noModelDetails",description:"Details for the models are not available. Add or update model details to view them.",messageType:"information",loadingMessage:"Loading model details...",notFoundMessage:"No model details found"},MODEL_RESOURCES:{labelValue:"Model Resources",src:"noModelResources",description:"No resources are available for the models. Add resources to start utilizing them.",messageType:"information",loadingMessage:"Loading model resources...",notFoundMessage:"No model resources found"},NOTIFICATIONS:{labelValue:"Notifications",src:"noNotifications",description:"No notifications are available. New notifications will be displayed here.",messageType:"information",loadingMessage:"Loading notifications...",notFoundMessage:"No notifications found"},REQUEST_IMAGES:{labelValue:"Request Images",src:"noRequestImages",description:"No request images are currently available.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No request images found"},REQUEST_PRICING:{labelValue:"Request Pricing",src:"noPrices",description:"No request pricing are currently available.",messageType:"information",loadingMessage:"Loading pricing...",notFoundMessage:"No request pricing found"},ANNOTATION_GRAPH:{labelValue:"Annotation Graph",src:"noAnnotationGraph",description:"No annotation analytics are available for the given date",messageType:"information",loadingMessage:"Loading annotation graph...",notFoundMessage:"No annotations"},LOADING_CAROUSAL:{labelValue:"Images",src:"noImages",description:"No images is available to load",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},TAGS:{labelValue:"Tags",src:"noTags",description:"No tags are available. Start by adding or configuring tags.",messageType:"information",loadingMessage:"Loading tags...",notFoundMessage:"No tags found"},NO_CSV_REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},NO_CSV_CLASS:{labelValue:"Classes",src:"noClasses",description:"There are no classes available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},CLASS_PROPORTION:{labelValue:"Class proportion",src:"noClasses",description:"No class proportion available.",messageType:"information",loadingMessage:"Loading class proportion...",notFoundMessage:"No class proportion found"},SINGLE_CLASS:{labelValue:"Class",src:"noClasses",description:"No class available.",messageType:"information",loadingMessage:"Loading class...",notFoundMessage:"No classes found"},LOADING_FILTER:{labelValue:"Filter",src:"noClasses",description:"No filter configuration.",messageType:"information",loadingMessage:"Loading filter information...",notFoundMessage:"No filter configuration found"},LOADING_ANNOTATION:{labelValue:"Annotation Loading",src:"noImages",description:"No annotation found",messageType:"information",loadingMessage:"Please wait, loading annotation...",notFoundMessage:"No annotations"},LOADING_REQUEST:{labelValue:"Request Loading",src:"noRequests",description:"No request found",messageType:"information",loadingMessage:"Please wait, loading request info...",notFoundMessage:"No request"},NOT_FOUND_GENERAL:{labelValue:"Data Loading",src:"notFoundGeneral",description:"No data found",messageType:"information",loadingMessage:"Please wait, loading data...",notFoundMessage:"No data"}},j9e=({stateKey:e="NOT_FOUND_GENERAL",loadState:t=!1,stateDescription:n=null,stateLoadDescription:r=null,showImage:o=!1,textClass:i="",noPadding:a=!1,stateTitle:s=""})=>{const c=qb[e]||qb.NOT_FOUND_GENERAL;if(!c)return Z.jsx(Z.Fragment,{});const{labelValue:u,src:d,messageType:h,description:C,notFoundMessage:m}=c;if(t)return Z.jsxs("div",{style:{width:"100%"},children:[o&&Z.jsx(Vc,{title:c.loadingMessage,iconName:d,description:r||"",isLoading:!0,noPadding:a}),!o&&Z.jsx(Vc,{title:c.loadingMessage,description:r||"",isLoading:!0,noPadding:a})]});{const A=(s==null?void 0:s.length)>0?s:m?m||`No ${u} Found`:"",v=n||C;return Z.jsx("div",{style:{width:"100%"},children:Z.jsx(Vc,{title:A,iconName:d,description:v,messageType:h,textClass:i,noPadding:a})})}},z9e="_tableBar_103oy_1",Z9e="_buttonGroup_103oy_13",U9e="_btnIcon_103oy_34",$9e="_searchBar_103oy_41",K9e="_searchInput_103oy_53",W9e="_searchIcon_103oy_58",Q9e="_removeBorder_103oy_63",G9e="_button_103oy_13",Y9e="_isSelected_103oy_74",q9e="_isDisabled_103oy_80",X9e="_isActive_103oy_85",J9e="_isText_103oy_92",sr={tableBar:z9e,buttonGroup:Z9e,btnIcon:U9e,searchBar:$9e,searchInput:K9e,searchIcon:W9e,removeBorder:Q9e,button:G9e,isSelected:Y9e,isDisabled:q9e,isActive:X9e,isText:J9e},e3e=({showSearch:e=!1,leftButtons:t=[],rightButtons:n=[],searchFunction:r,searchDelay:o=300,onSearchClick:i,searchPlaceHolder:a="Search...",showSearchEye:s=!0,borderRequired:c=!0,borderColor:u})=>{const d=R.useCallback(cl.debounce((A,v)=>{typeof v=="function"&&v(A)},o),[o]),h=A=>{const v=A.currentTarget.value.trim();d(v,r)},C=()=>{typeof i=="function"&&i()};if(!t.length&&!n.length&&!e)return null;const m=(A,v)=>{const p=A.type==="text";return Z.jsxs("button",{onClick:!p&&!A.isDisabled?A.onClick:void 0,title:A.title||"",disabled:A.isDisabled,className:qn(sr.button,{[sr.isText]:p,[sr.isSelected]:A.isSelected,[sr.isDisabled]:A.isDisabled,[sr.isActive]:A.isActive&&!A.isSelected}),children:[A.icon&&Z.jsx("img",{src:A.icon,alt:A.name,className:sr.btnIcon}),Z.jsx("div",{children:A.name})]},v)};return Z.jsxs("div",{className:qn(sr.tableBar,!c&&sr.removeBorder),style:{borderColor:c?u||"#909090":void 0},children:[Z.jsxs("div",{className:sr.buttonGroup,children:[t.map(m)," "]}),Z.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"10px"},children:[Z.jsx("div",{className:sr.buttonGroup,children:n.map(m)}),e&&Z.jsx("div",{className:sr.searchBar,title:a,children:Z.jsxs("form",{autoComplete:"off",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",position:"relative"},children:[Z.jsx("input",{type:"text",name:"userSearchInput",autoComplete:"off",placeholder:a,className:sr.searchInput,onKeyUp:h}),s&&Z.jsx("img",{src:X1.searchUrl.IconComponent,alt:a,className:qn(sr.btnIcon,"cursor-pointer",sr.searchIcon),onClick:C})]})})]})]})},dH=({currentPage:e,totalPages:t,onPageChange:n,isLoading:r=!1})=>{const[o,i]=R.useState(`${e}`);R.useEffect(()=>{i(`${e}`)},[e]);const a=()=>{const s=Number(o);s>=1&&s<=t&&n(s),i("")};return Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:p2.pagination_container,children:[Z.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",maxHeight:"2vh"},children:r?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:p2.pagination_loading,children:"Loading..."})}):Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{className:p2.pagination_left,children:Z.jsx("input",{type:"number",min:"1",max:t,value:o,onChange:s=>{i(s.target.value)},onBlur:()=>{if(o==""){i(`${e}`);return}const s=parseInt(o,10);if(!isNaN(s)){let c=Math.max(1,Math.min(t,s)).toString();c!=null&&c.length||(c="1"),i(c),a()}},onKeyDown:s=>{if(s.key==="Enter"){s==null||s.preventDefault(),s==null||s.stopPropagation();const c=parseInt(o,10);if(!isNaN(c)){const u=Math.max(1,Math.min(t,c)).toString();i(u),a()}}},placeholder:o,style:{background:"transparent",border:"0",width:"100%",height:"100%"}})}),Z.jsx("div",{className:p2.pagination_right,children:t})]})}),Z.jsxs("div",{style:{gap:"20px",display:"flex"},children:[Z.jsx("img",{src:X1.backArrow.IconComponent,onClick:()=>e>1&&n(e-1),style:{cursor:e>1?"pointer":"not-allowed"},className:p2.nextPrevArrow,title:e>1?`Go to page number ${e-1} `:"Go to previous page is not allowed"}),Z.jsx("img",{src:X1.forwardArrow.IconComponent,onClick:()=>e<t&&n(e+1),style:{cursor:e<t?"pointer":"not-allowed"},className:p2.nextPrevArrow,title:e<t?`Go to page number ${e+1}`:"Go to next page is not allowed"})]})]})})},t3e=({hasNextPage:e,isFetchingNextPage:t=!1,fetchNextPage:n,isLoading:r=!1,totalResults:o=0,totalFetchedResults:i=0,currentPage:a=1,totalPages:s=10,onPageChange:c,isPagination:u=!1,loadText:d=""})=>{let h="Load More";return i+1===o?h="Load last results":r||t?u?a==1?h="Loading...":h=`Loading page number ${a}`:o===0?h="Loading...":i+1===o?h="Loading last results...":h=`Loading ${i+1} to ${o}`:i===0?(d==null?void 0:d.length)==0?h="Load":h=d:h=`Load ${i+1} to ${o}`,u&&c?Z.jsx(dH,{currentPage:a,totalPages:s,onPageChange:c,isLoading:r||t}):Z.jsx("div",{className:p2.loadMoreButtonDiv,style:{display:"flex",justifyContent:"center",marginTop:"16px"},children:e&&!t&&Z.jsx("div",{className:p2.loadMoreButtonContainer,children:Z.jsx("button",{onClick:()=>n?n():void 0,className:"modalButton modalButton__purpleColor",disabled:r||t,children:h})})})},n3e=({items:e,listType:t="ul",maxHeight:n="100px"})=>{const r=t;return!e||e.length===0?Z.jsx("div",{style:{minWidth:"30px"},children:"N/A"}):Z.jsx(r,{style:{maxHeight:n,overflow:"auto",paddingLeft:"20px"},children:e.map((o,i)=>Z.jsx("li",{style:{minWidth:"10vw"},children:o},i))})};var fH=(e=>(e.LARGE="l",e.MEDIUM="m",e))(fH||{});const r3e=({badgeContent:e,variant:t=fH.LARGE,backgroundColor:n,textColor:r,className:o,style:i,...a})=>Z.jsx("span",{className:`badge badge_${t} ${o} ${e?"":"badge_dot"}`,style:{"--c_background":n,"--c_text":r,...i},...a,children:e}),o3e=({items:e,value:t,onChange:n=()=>{},color:r,width:o,size:i="s",gap:a})=>Z.jsx("div",{className:"button_group",style:{gap:a},children:e==null?void 0:e.map((s,c)=>Z.jsx(i2,{variant:"primary",content:s==null?void 0:s.label,icon:s==null?void 0:s.icon,iconPosition:(s==null?void 0:s.iconPosition)??"before",textColor:s==null?void 0:s.contentColor,iconColor:s==null?void 0:s.contentColor,onClick:()=>n(s.value),width:o,className:`button_group_button ${c==0?"first":""} ${c==e.length-1?"last":""} ${s.value==t?"active":""}`,backgroundColor:r,borderColor:r,disabled:s.disabled,size:i},s.value))});/*!
|
|
340
340
|
* @kurkle/color v0.3.4
|
|
341
341
|
* https://github.com/kurkle/color#readme
|
|
342
342
|
* (c) 2024 Jukka Kurkela
|
|
@@ -353,7 +353,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
353
353
|
* Released under the MIT License
|
|
354
354
|
*/class G5e{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,o){const i=n.listeners[o],a=n.duration;i.forEach(s=>s({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(r-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=wH.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,o)=>{if(!r.running||!r.items.length)return;const i=r.items;let a=i.length-1,s=!1,c;for(;a>=0;--a)c=i[a],c._active?(c._total>r.duration&&(r.duration=c._total),c.tick(t),s=!0):(i[a]=i[i.length-1],i.pop());s&&(o.draw(),this._notify(o,r,t,"progress")),i.length||(r.running=!1,this._notify(o,r,t,"complete"),r.initial=!1),n+=i.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,o)=>Math.max(r,o._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let o=r.length-1;for(;o>=0;--o)r[o].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Xi=new G5e;const yy="transparent",Y5e={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=uy(e||yy),o=r.valid&&uy(t||yy);return o&&o.valid?o.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class q5e{constructor(t,n,r,o){const i=n[r];o=v6([t.to,o,i,t.from]);const a=v6([t.from,i,o]);this._active=!0,this._fn=t.fn||Y5e[t.type||typeof a],this._easing=hs[t.easing]||hs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=a,this._to=o,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const o=this._target[this._prop],i=r-this._start,a=this._duration-i;this._start=r,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=v6([t.to,n,o,t.from]),this._from=v6([t.from,o,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,o=this._prop,i=this._from,a=this._loop,s=this._to;let c;if(this._active=i!==s&&(a||n<r),!this._active){this._target[o]=s,this._notify(!0);return}if(n<0){this._target[o]=i;return}c=n/r%2,c=a&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[o]=this._fn(i,s,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let o=0;o<r.length;o++)r[o][n]()}}class VH{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!y1(t))return;const n=Object.keys(N0.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(o=>{const i=t[o];if(!y1(i))return;const a={};for(const s of n)a[s]=i[s];(K0(i.properties)&&i.properties||[o]).forEach(s=>{(s===o||!r.has(s))&&r.set(s,a)})})}_animateOptions(t,n){const r=n.options,o=J5e(t,r);if(!o)return[];const i=this._createAnimations(o,r);return r.$shared&&X5e(t.options.$animations,r).then(()=>{t.options=r},()=>{}),i}_createAnimations(t,n){const r=this._properties,o=[],i=t.$animations||(t.$animations={}),a=Object.keys(n),s=Date.now();let c;for(c=a.length-1;c>=0;--c){const u=a[c];if(u.charAt(0)==="$")continue;if(u==="options"){o.push(...this._animateOptions(t,n));continue}const d=n[u];let h=i[u];const C=r.get(u);if(h)if(C&&h.active()){h.update(C,d,s);continue}else h.cancel();if(!C||!C.duration){t[u]=d;continue}i[u]=h=new q5e(C,t,u,d),o.push(h)}return o}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Xi.add(this._chart,r),!0}}function X5e(e,t){const n=[],r=Object.keys(t);for(let o=0;o<r.length;o++){const i=e[r[o]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function J5e(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function wy(e,t){const n=e&&e.options||{},r=n.reverse,o=n.min===void 0?t:0,i=n.max===void 0?t:0;return{start:r?i:o,end:r?o:i}}function e4e(e,t,n){if(n===!1)return!1;const r=wy(e,n),o=wy(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}function t4e(e){let t,n,r,o;return y1(e)?(t=e.top,n=e.right,r=e.bottom,o=e.left):t=n=r=o=e,{top:t,right:n,bottom:r,left:o,disabled:e===!1}}function jH(e,t){const n=[],r=e._getSortedDatasetMetas(t);let o,i;for(o=0,i=r.length;o<i;++o)n.push(r[o].index);return n}function xy(e,t,n,r={}){const o=e.keys,i=r.mode==="single";let a,s,c,u;if(t===null)return;let d=!1;for(a=0,s=o.length;a<s;++a){if(c=+o[a],c===n){if(d=!0,r.all)continue;break}u=e.values[c],D2(u)&&(i||t===0||yi(t)===yi(u))&&(t+=u)}return!d&&!r.all?0:t}function n4e(e,t){const{iScale:n,vScale:r}=t,o=n.axis==="x"?"x":"y",i=r.axis==="x"?"x":"y",a=Object.keys(e),s=new Array(a.length);let c,u,d;for(c=0,u=a.length;c<u;++c)d=a[c],s[c]={[o]:d,[i]:e[d]};return s}function Yd(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function r4e(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function o4e(e){const{min:t,max:n,minDefined:r,maxDefined:o}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:o?n:Number.POSITIVE_INFINITY}}function i4e(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function _y(e,t,n,r){for(const o of t.getMatchingVisibleMetas(r).reverse()){const i=e[o.index];if(n&&i>0||!n&&i<0)return o.index}return null}function Ey(e,t){const{chart:n,_cachedMeta:r}=e,o=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:s}=r,c=i.axis,u=a.axis,d=r4e(i,a,r),h=t.length;let C;for(let m=0;m<h;++m){const A=t[m],{[c]:v,[u]:p}=A,_=A._stacks||(A._stacks={});C=_[u]=i4e(o,d,v),C[s]=p,C._top=_y(C,a,!0,r.type),C._bottom=_y(C,a,!1,r.type);const w=C._visualValues||(C._visualValues={});w[s]=p}}function qd(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function a4e(e,t){return g3(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function s4e(e,t,n){return g3(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function H4(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const o of t){const i=o._stacks;if(!i||i[r]===void 0||i[r][n]===void 0)return;delete i[r][n],i[r]._visualValues!==void 0&&i[r]._visualValues[n]!==void 0&&delete i[r]._visualValues[n]}}}const Xd=e=>e==="reset"||e==="none",Sy=(e,t)=>t?e:Object.assign({},e),l4e=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:jH(n,!0),values:null};class X9{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Yd(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&H4(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),o=(h,C,m,A)=>h==="x"?C:h==="r"?A:m,i=n.xAxisID=C1(r.xAxisID,qd(t,"x")),a=n.yAxisID=C1(r.yAxisID,qd(t,"y")),s=n.rAxisID=C1(r.rAxisID,qd(t,"r")),c=n.indexAxis,u=n.iAxisID=o(c,i,a,s),d=n.vAxisID=o(c,a,i,s);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(s),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&sy(this._data,this),t._stacked&&H4(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(y1(n)){const o=this._cachedMeta;this._data=n4e(n,o)}else if(r!==n){if(r){sy(r,this);const o=this._cachedMeta;H4(o),o._parsed=[]}n&&Object.isExtensible(n)&&$3e(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let o=!1;this._dataCheck();const i=n._stacked;n._stacked=Yd(n.vScale,n),n.stack!==r.stack&&(o=!0,H4(n),n.stack=r.stack),this._resyncElements(t),(o||i!==n._stacked)&&(Ey(this,n._parsed),n._stacked=Yd(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:o}=this,{iScale:i,_stacked:a}=r,s=i.axis;let c=t===0&&n===o.length?!0:r._sorted,u=t>0&&r._parsed[t-1],d,h,C;if(this._parsing===!1)r._parsed=o,r._sorted=!0,C=o;else{K0(o[t])?C=this.parseArrayData(r,o,t,n):y1(o[t])?C=this.parseObjectData(r,o,t,n):C=this.parsePrimitiveData(r,o,t,n);const m=()=>h[s]===null||u&&h[s]<u[s];for(d=0;d<n;++d)r._parsed[d+t]=h=C[d],c&&(m()&&(c=!1),u=h);r._sorted=c}a&&Ey(this,C)}parsePrimitiveData(t,n,r,o){const{iScale:i,vScale:a}=t,s=i.axis,c=a.axis,u=i.getLabels(),d=i===a,h=new Array(o);let C,m,A;for(C=0,m=o;C<m;++C)A=C+r,h[C]={[s]:d||i.parse(u[A],A),[c]:a.parse(n[A],A)};return h}parseArrayData(t,n,r,o){const{xScale:i,yScale:a}=t,s=new Array(o);let c,u,d,h;for(c=0,u=o;c<u;++c)d=c+r,h=n[d],s[c]={x:i.parse(h[0],d),y:a.parse(h[1],d)};return s}parseObjectData(t,n,r,o){const{xScale:i,yScale:a}=t,{xAxisKey:s="x",yAxisKey:c="y"}=this._parsing,u=new Array(o);let d,h,C,m;for(d=0,h=o;d<h;++d)C=d+r,m=n[C],u[d]={x:i.parse(t3(m,s),C),y:a.parse(t3(m,c),C)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const o=this.chart,i=this._cachedMeta,a=n[t.axis],s={keys:jH(o,!0),values:n._stacks[t.axis]._visualValues};return xy(s,a,i.index,{mode:r})}updateRangeFromParsed(t,n,r,o){const i=r[n.axis];let a=i===null?NaN:i;const s=o&&r._stacks[n.axis];o&&s&&(o.values=s,a=xy(o,i,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){const r=this._cachedMeta,o=r._parsed,i=r._sorted&&t===r.iScale,a=o.length,s=this._getOtherScale(t),c=l4e(n,r,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=o4e(s);let C,m;function A(){m=o[C];const v=m[s.axis];return!D2(m[t.axis])||d>v||h<v}for(C=0;C<a&&!(!A()&&(this.updateRangeFromParsed(u,t,m,c),i));++C);if(i){for(C=a-1;C>=0;--C)if(!A()){this.updateRangeFromParsed(u,t,m,c);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let o,i,a;for(o=0,i=n.length;o<i;++o)a=n[o][t.axis],D2(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,o=n.vScale,i=this.getParsed(t);return{label:r?""+r.getLabelForValue(i[r.axis]):"",value:o?""+o.getLabelForValue(i[o.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=t4e(C1(this.options.clip,e4e(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,o=r.data||[],i=n.chartArea,a=[],s=this._drawStart||0,c=this._drawCount||o.length-s,u=this.options.drawActiveElementsOnTop;let d;for(r.dataset&&r.dataset.draw(t,i,s,c),d=s;d<s+c;++d){const h=o[d];h.hidden||(h.active&&u?a.push(h):h.draw(t,i))}for(d=0;d<a.length;++d)a[d].draw(t,i)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const o=this.getDataset();let i;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];i=a.$context||(a.$context=s4e(this.getContext(),t,a)),i.parsed=this.getParsed(t),i.raw=o.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=a4e(this.chart.getContext(),this.index)),i.dataset=o,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=r,i}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const o=n==="active",i=this._cachedDataOpts,a=t+"-"+n,s=i[a],c=this.enableOptionSharing&&Bs(r);if(s)return Sy(s,c);const u=this.chart.config,d=u.datasetElementScopeKeys(this._type,t),h=o?[`${t}Hover`,"hover",t,""]:[t,""],C=u.getOptionScopes(this.getDataset(),d),m=Object.keys(N0.elements[t]),A=()=>this.getContext(r,o,n),v=u.resolveNamedOptions(C,m,A,h);return v.$shared&&(v.$shared=c,i[a]=Object.freeze(Sy(v,c))),v}_resolveAnimations(t,n,r){const o=this.chart,i=this._cachedDataOpts,a=`animation-${n}`,s=i[a];if(s)return s;let c;if(o.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),C=d.getOptionScopes(this.getDataset(),h);c=d.createResolver(C,this.getContext(t,r,n))}const u=new VH(o,c&&c.animations);return c&&c._cacheable&&(i[a]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Xd(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),o=this._sharedOptions,i=this.getSharedOptions(r),a=this.includeOptions(n,i)||i!==o;return this.updateSharedOptions(i,n,r),{sharedOptions:i,includeOptions:a}}updateElement(t,n,r,o){Xd(o)?Object.assign(t,r):this._resolveAnimations(n,o).update(t,r)}updateSharedOptions(t,n,r){t&&!Xd(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,o){t.active=o;const i=this.getStyle(n,o);this._resolveAnimations(n,r,o).update(t,{options:!o&&this.getSharedOptions(i)||i})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[s,c,u]of this._syncList)this[s](c,u);this._syncList=[];const o=r.length,i=n.length,a=Math.min(i,o);a&&this.parse(0,a),i>o?this._insertElements(o,i-o,t):i<o&&this._removeElements(i,o-i)}_insertElements(t,n,r=!0){const o=this._cachedMeta,i=o.data,a=t+n;let s;const c=u=>{for(u.length+=n,s=u.length-1;s>=a;s--)u[s]=u[s-n]};for(c(i),s=t;s<a;++s)i[s]=new this.dataElementType;this._parsing&&c(o._parsed),this.parse(t,n),r&&this.updateElements(i,t,n,"reset")}updateElements(t,n,r,o){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const o=r._parsed.splice(t,n);r._stacked&&H4(r,o)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,o]=t;this[n](r,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}xn(X9,"defaults",{}),xn(X9,"datasetElementType",null),xn(X9,"dataElementType",null);function c4e(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let o=0,i=n.length;o<i;o++)r=r.concat(n[o].controller.getAllParsedValues(e));e._cache.$bar=yH(r.sort((o,i)=>o-i))}return e._cache.$bar}function u4e(e){const t=e.iScale,n=c4e(t,e.type);let r=t._length,o,i,a,s;const c=()=>{a===32767||a===-32768||(Bs(s)&&(r=Math.min(r,Math.abs(a-s)||r)),s=a)};for(o=0,i=n.length;o<i;++o)a=t.getPixelForValue(n[o]),c();for(s=void 0,o=0,i=t.ticks.length;o<i;++o)a=t.getPixelForTick(o),c();return r}function d4e(e,t,n,r){const o=n.barThickness;let i,a;return Q1(o)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=o*r,a=1),{chunk:i/r,ratio:a,start:t.pixels[e]-i/2}}function f4e(e,t,n,r){const o=t.pixels,i=o[e];let a=e>0?o[e-1]:null,s=e<o.length-1?o[e+1]:null;const c=n.categoryPercentage;a===null&&(a=i-(s===null?t.end-t.start:s-i)),s===null&&(s=i+i-a);const u=i-(i-Math.min(a,s))/2*c;return{chunk:Math.abs(s-a)/2*c/r,ratio:n.barPercentage,start:u}}function h4e(e,t,n,r){const o=n.parse(e[0],r),i=n.parse(e[1],r),a=Math.min(o,i),s=Math.max(o,i);let c=a,u=s;Math.abs(a)>Math.abs(s)&&(c=s,u=a),t[n.axis]=u,t._custom={barStart:c,barEnd:u,start:o,end:i,min:a,max:s}}function zH(e,t,n,r){return K0(e)?h4e(e,t,n,r):t[n.axis]=n.parse(e,r),t}function My(e,t,n,r){const o=e.iScale,i=e.vScale,a=o.getLabels(),s=o===i,c=[];let u,d,h,C;for(u=n,d=n+r;u<d;++u)C=t[u],h={},h[o.axis]=s||o.parse(a[u],u),c.push(zH(C,h,i,u));return c}function Jd(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function C4e(e,t,n){return e!==0?yi(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function g4e(e){let t,n,r,o,i;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(o="end",i="start"):(o="start",i="end"),{start:n,end:r,reverse:t,top:o,bottom:i}}function m4e(e,t,n,r){let o=t.borderSkipped;const i={};if(!o){e.borderSkipped=i;return}if(o===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:s,reverse:c,top:u,bottom:d}=g4e(e);o==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=u:(n._bottom||0)===r?o=d:(i[Hy(d,a,s,c)]=!0,o=u)),i[Hy(o,a,s,c)]=!0,e.borderSkipped=i}function Hy(e,t,n,r){return r?(e=p4e(e,t,n),e=Ly(e,n,t)):e=Ly(e,t,n),e}function p4e(e,t,n){return e===t?n:e===n?t:e}function Ly(e,t,n){return e==="start"?t:e==="end"?n:e}function A4e(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class jc extends X9{parsePrimitiveData(t,n,r,o){return My(t,n,r,o)}parseArrayData(t,n,r,o){return My(t,n,r,o)}parseObjectData(t,n,r,o){const{iScale:i,vScale:a}=t,{xAxisKey:s="x",yAxisKey:c="y"}=this._parsing,u=i.axis==="x"?s:c,d=a.axis==="x"?s:c,h=[];let C,m,A,v;for(C=r,m=r+o;C<m;++C)v=n[C],A={},A[i.axis]=i.parse(t3(v,u),C),h.push(zH(t3(v,d),A,a,C));return h}updateRangeFromParsed(t,n,r,o){super.updateRangeFromParsed(t,n,r,o);const i=r._custom;i&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,i.min),t.max=Math.max(t.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:o}=n,i=this.getParsed(t),a=i._custom,s=Jd(a)?"["+a.start+", "+a.end+"]":""+o.getLabelForValue(i[o.axis]);return{label:""+r.getLabelForValue(i[r.axis]),value:s}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,o){const i=o==="reset",{index:a,_cachedMeta:{vScale:s}}=this,c=s.getBasePixel(),u=s.isHorizontal(),d=this._getRuler(),{sharedOptions:h,includeOptions:C}=this._getSharedOptions(n,o);for(let m=n;m<n+r;m++){const A=this.getParsed(m),v=i||Q1(A[s.axis])?{base:c,head:c}:this._calculateBarValuePixels(m),p=this._calculateBarIndexPixels(m,d),_=(A._stacks||{})[s.axis],w={horizontal:u,base:v.base,enableBorderRadius:!_||Jd(A._custom)||a===_._top||a===_._bottom,x:u?v.head:p.center,y:u?p.center:v.head,height:u?p.size:Math.abs(v.size),width:u?Math.abs(v.size):p.size};C&&(w.options=h||this.resolveDataElementOptions(m,t[m].active?"active":o));const x=w.options||t[m].options;m4e(w,x,_,a),A4e(w,x,d.ratio),this.updateElement(t[m],m,w,o)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,o=r.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),i=r.options.stacked,a=[],s=this._cachedMeta.controller.getParsed(n),c=s&&s[r.axis],u=d=>{const h=d._parsed.find(m=>m[r.axis]===c),C=h&&h[d.vScale.axis];if(Q1(C)||isNaN(C))return!0};for(const d of o)if(!(n!==void 0&&u(d))&&((i===!1||a.indexOf(d.stack)===-1||i===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,n,r){const o=this._getStacks(t,r),i=n!==void 0?o.indexOf(n):-1;return i===-1?o.length-1:i}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,o=[];let i,a;for(i=0,a=n.data.length;i<a;++i)o.push(r.getPixelForValue(this.getParsed(i)[r.axis],i));const s=t.barThickness;return{min:s||u4e(n),pixels:o,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:s?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:o},options:{base:i,minBarLength:a}}=this,s=i||0,c=this.getParsed(t),u=c._custom,d=Jd(u);let h=c[n.axis],C=0,m=r?this.applyStack(n,c,r):h,A,v;m!==h&&(C=m-h,m=h),d&&(h=u.barStart,m=u.barEnd-u.barStart,h!==0&&yi(h)!==yi(u.barEnd)&&(C=0),C+=h);const p=!Q1(i)&&!d?i:C;let _=n.getPixelForValue(p);if(this.chart.getDataVisibility(t)?A=n.getPixelForValue(C+m):A=_,v=A-_,Math.abs(v)<a){v=C4e(v,n,s)*a,h===s&&(_-=v/2);const w=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),E=Math.min(w,x),S=Math.max(w,x);_=Math.max(Math.min(_,S),E),A=_+v,r&&!d&&(c._stacks[n.axis]._visualValues[o]=n.getValueForPixel(A)-n.getValueForPixel(_))}if(_===n.getPixelForValue(s)){const w=yi(v)*n.getLineWidthForValue(s)/2;_+=w,v-=w}return{size:v,base:_,head:A,center:A+v/2}}_calculateBarIndexPixels(t,n){const r=n.scale,o=this.options,i=o.skipNull,a=C1(o.maxBarThickness,1/0);let s,c;if(n.grouped){const u=i?this._getStackCount(t):n.stackCount,d=o.barThickness==="flex"?f4e(t,n,o,u):d4e(t,n,o,u),h=this._getStackIndex(this.index,this._cachedMeta.stack,i?t:void 0);s=d.start+d.chunk*h+d.chunk/2,c=Math.min(a,d.chunk*d.ratio)}else s=r.getPixelForValue(this.getParsed(t)[r.axis],t),c=Math.min(a,n.min*n.ratio);return{base:s-c/2,head:s+c/2,center:s,size:c}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,o=r.length;let i=0;for(;i<o;++i)this.getParsed(i)[n.axis]!==null&&!r[i].hidden&&r[i].draw(this._ctx)}}xn(jc,"id","bar"),xn(jc,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),xn(jc,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function v4e(e,t,n){let r=1,o=1,i=0,a=0;if(t<w0){const s=e,c=s+t,u=Math.cos(s),d=Math.sin(s),h=Math.cos(c),C=Math.sin(c),m=(x,E,S)=>Rs(x,s,c,!0)?1:Math.max(E,E*n,S,S*n),A=(x,E,S)=>Rs(x,s,c,!0)?-1:Math.min(E,E*n,S,S*n),v=m(0,u,h),p=m(W0,d,C),_=A(z0,u,h),w=A(z0+W0,d,C);r=(v-_)/2,o=(p-w)/2,i=-(v+_)/2,a=-(p+w)/2}return{ratioX:r,ratioY:o,offsetX:i,offsetY:a}}class i5 extends X9{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=r;else{let i=c=>+r[c];if(y1(r[t])){const{key:c="value"}=this._parsing;i=u=>+t3(r[u],c)}let a,s;for(a=t,s=t+n;a<s;++a)o._parsed[a]=i(a)}}_getRotation(){return sa(this.options.rotation-90)}_getCircumference(){return sa(this.options.circumference)}_getRotationExtents(){let t=w0,n=-w0;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const o=this.chart.getDatasetMeta(r).controller,i=o._getRotation(),a=o._getCircumference();t=Math.min(t,i),n=Math.max(n,i+a)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,o=this._cachedMeta,i=o.data,a=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,s=Math.max((Math.min(r.width,r.height)-a)/2,0),c=Math.min(H3e(this.options.cutout,s),1),u=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:C,ratioY:m,offsetX:A,offsetY:v}=v4e(h,d,c),p=(r.width-a)/C,_=(r.height-a)/m,w=Math.max(Math.min(p,_)/2,0),x=pH(this.options.radius,w),E=Math.max(x*c,0),S=(x-E)/this._getVisibleDatasetWeightTotal();this.offsetX=A*x,this.offsetY=v*x,o.total=this.calculateTotal(),this.outerRadius=x-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*u,0),this.updateElements(i,0,i.length,t)}_circumference(t,n){const r=this.options,o=this._cachedMeta,i=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||o._parsed[t]===null||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*i/w0)}updateElements(t,n,r,o){const i=o==="reset",a=this.chart,s=a.chartArea,u=a.options.animation,d=(s.left+s.right)/2,h=(s.top+s.bottom)/2,C=i&&u.animateScale,m=C?0:this.innerRadius,A=C?0:this.outerRadius,{sharedOptions:v,includeOptions:p}=this._getSharedOptions(n,o);let _=this._getRotation(),w;for(w=0;w<n;++w)_+=this._circumference(w,i);for(w=n;w<n+r;++w){const x=this._circumference(w,i),E=t[w],S={x:d+this.offsetX,y:h+this.offsetY,startAngle:_,endAngle:_+x,circumference:x,outerRadius:A,innerRadius:m};p&&(S.options=v||this.resolveDataElementOptions(w,E.active?"active":o)),_+=x,this.updateElement(E,w,S,o)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,o;for(o=0;o<n.length;o++){const i=t._parsed[o];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(o)&&!n[o].hidden&&(r+=Math.abs(i))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?w0*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,o=r.data.labels||[],i=Ng(n._parsed[t],r.options.locale);return{label:o[t]||"",value:i}}getMaxBorderWidth(t){let n=0;const r=this.chart;let o,i,a,s,c;if(!t){for(o=0,i=r.data.datasets.length;o<i;++o)if(r.isDatasetVisible(o)){a=r.getDatasetMeta(o),t=a.data,s=a.controller;break}}if(!t)return 0;for(o=0,i=t.length;o<i;++o)c=s.resolveDataElementOptions(o),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,o=t.length;r<o;++r){const i=this.resolveDataElementOptions(r);n=Math.max(n,i.offset||0,i.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(C1(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}xn(i5,"id","doughnut"),xn(i5,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),xn(i5,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),xn(i5,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:o}}=t.legend.options;return n.labels.map((i,a)=>{const c=t.getDatasetMeta(0).controller.getStyle(a);return{text:i,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class zc extends X9{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:o=[],_dataset:i}=n,a=this.chart._animationsDisabled;let{start:s,count:c}=Q3e(n,o,a);this._drawStart=s,this._drawCount=c,G3e(n)&&(s=0,c=o.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!i._decimated,r.points=o;const u=this.resolveDatasetElementOptions(t);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(r,void 0,{animated:!a,options:u},t),this.updateElements(o,s,c,t)}updateElements(t,n,r,o){const i=o==="reset",{iScale:a,vScale:s,_stacked:c,_dataset:u}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,o),C=a.axis,m=s.axis,{spanGaps:A,segment:v}=this.options,p=Os(A)?A:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||i||o==="none",w=n+r,x=t.length;let E=n>0&&this.getParsed(n-1);for(let S=0;S<x;++S){const M=t[S],H=_?M:{};if(S<n||S>=w){H.skip=!0;continue}const O=this.getParsed(S),k=Q1(O[m]),D=H[C]=a.getPixelForValue(O[C],S),N=H[m]=i||k?s.getBasePixel():s.getPixelForValue(c?this.applyStack(s,O,c):O[m],S);H.skip=isNaN(D)||isNaN(N)||k,H.stop=S>0&&Math.abs(O[C]-E[C])>p,v&&(H.parsed=O,H.raw=u.data[S]),h&&(H.options=d||this.resolveDataElementOptions(S,M.active?"active":o)),_||this.updateElement(M,S,H,o),E=O}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,o=t.data||[];if(!o.length)return r;const i=o[0].size(this.resolveDataElementOptions(0)),a=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(r,i,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}xn(zc,"id","line"),xn(zc,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),xn(zc,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class _h extends i5{}xn(_h,"id","pie"),xn(_h,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function D9(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ug{constructor(t){xn(this,"options");this.options=t||{}}static override(t){Object.assign(Ug.prototype,t)}init(){}formats(){return D9()}parse(){return D9()}format(){return D9()}add(){return D9()}diff(){return D9()}startOf(){return D9()}endOf(){return D9()}}var b4e={_date:Ug};function y4e(e,t,n,r){const{controller:o,data:i,_sorted:a}=e,s=o._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!=="r"&&a&&i.length){const u=s._reversePixels?Z3e:K9;if(r){if(o._sharedOptions){const d=i[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const C=u(i,t,n-h),m=u(i,t,n+h);return{lo:C.lo,hi:m.hi}}}}else{const d=u(i,t,n);if(c){const{vScale:h}=o._cachedMeta,{_parsed:C}=e,m=C.slice(0,d.lo+1).reverse().findIndex(v=>!Q1(v[h.axis]));d.lo-=Math.max(0,m);const A=C.slice(d.hi).findIndex(v=>!Q1(v[h.axis]));d.hi+=Math.max(0,A)}return d}}return{lo:0,hi:i.length-1}}function fl(e,t,n,r,o){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let s=0,c=i.length;s<c;++s){const{index:u,data:d}=i[s],{lo:h,hi:C}=y4e(i[s],t,a,o);for(let m=h;m<=C;++m){const A=d[m];A.skip||r(A,u,m)}}}function w4e(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,o){const i=t?Math.abs(r.x-o.x):0,a=n?Math.abs(r.y-o.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(a,2))}}function ef(e,t,n,r,o){const i=[];return!o&&!e.isPointInArea(t)||fl(e,n,t,function(s,c,u){!o&&!Is(s,e.chartArea,0)||s.inRange(t.x,t.y,r)&&i.push({element:s,datasetIndex:c,index:u})},!0),i}function x4e(e,t,n,r){let o=[];function i(a,s,c){const{startAngle:u,endAngle:d}=a.getProps(["startAngle","endAngle"],r),{angle:h}=vH(a,{x:t.x,y:t.y});Rs(h,u,d)&&o.push({element:a,datasetIndex:s,index:c})}return fl(e,n,t,i),o}function _4e(e,t,n,r,o,i){let a=[];const s=w4e(n);let c=Number.POSITIVE_INFINITY;function u(d,h,C){const m=d.inRange(t.x,t.y,o);if(r&&!m)return;const A=d.getCenterPoint(o);if(!(!!i||e.isPointInArea(A))&&!m)return;const p=s(t,A);p<c?(a=[{element:d,datasetIndex:h,index:C}],c=p):p===c&&a.push({element:d,datasetIndex:h,index:C})}return fl(e,n,t,u),a}function tf(e,t,n,r,o,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!r?x4e(e,t,n,o):_4e(e,t,n,r,o,i)}function By(e,t,n,r,o){const i=[],a=n==="x"?"inXRange":"inYRange";let s=!1;return fl(e,n,t,(c,u,d)=>{c[a]&&c[a](t[n],o)&&(i.push({element:c,datasetIndex:u,index:d}),s=s||c.inRange(t.x,t.y,o))}),r&&!s?[]:i}var E4e={evaluateInteractionItems:fl,modes:{index(e,t,n,r){const o=V9(t,e),i=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?ef(e,o,i,r,a):tf(e,o,i,!1,r,a),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const d=s[0].index,h=u.data[d];h&&!h.skip&&c.push({element:h,datasetIndex:u.index,index:d})}),c):[]},dataset(e,t,n,r){const o=V9(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?ef(e,o,i,r,a):tf(e,o,i,!1,r,a);if(s.length>0){const c=s[0].datasetIndex,u=e.getDatasetMeta(c).data;s=[];for(let d=0;d<u.length;++d)s.push({element:u[d],datasetIndex:c,index:d})}return s},point(e,t,n,r){const o=V9(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return ef(e,o,i,r,a)},nearest(e,t,n,r){const o=V9(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return tf(e,o,i,n.intersect,r,a)},x(e,t,n,r){const o=V9(t,e);return By(e,o,"x",n.intersect,r)},y(e,t,n,r){const o=V9(t,e);return By(e,o,"y",n.intersect,r)}}};const ZH=["left","top","right","bottom"];function L4(e,t){return e.filter(n=>n.pos===t)}function Oy(e,t){return e.filter(n=>ZH.indexOf(n.pos)===-1&&n.box.axis===t)}function B4(e,t){return e.sort((n,r)=>{const o=t?r:n,i=t?n:r;return o.weight===i.weight?o.index-i.index:o.weight-i.weight})}function S4e(e){const t=[];let n,r,o,i,a,s;for(n=0,r=(e||[]).length;n<r;++n)o=e[n],{position:i,options:{stack:a,stackWeight:s=1}}=o,t.push({index:n,box:o,pos:i,horizontal:o.isHorizontal(),weight:o.weight,stack:a&&i+a,stackWeight:s});return t}function M4e(e){const t={};for(const n of e){const{stack:r,pos:o,stackWeight:i}=n;if(!r||!ZH.includes(o))continue;const a=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function H4e(e,t){const n=M4e(e),{vBoxMaxWidth:r,hBoxMaxHeight:o}=t;let i,a,s;for(i=0,a=e.length;i<a;++i){s=e[i];const{fullSize:c}=s.box,u=n[s.stack],d=u&&s.stackWeight/u.weight;s.horizontal?(s.width=d?d*r:c&&t.availableWidth,s.height=o):(s.width=r,s.height=d?d*o:c&&t.availableHeight)}return n}function L4e(e){const t=S4e(e),n=B4(t.filter(u=>u.box.fullSize),!0),r=B4(L4(t,"left"),!0),o=B4(L4(t,"right")),i=B4(L4(t,"top"),!0),a=B4(L4(t,"bottom")),s=Oy(t,"x"),c=Oy(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(c).concat(a).concat(s),chartArea:L4(t,"chartArea"),vertical:r.concat(o).concat(c),horizontal:i.concat(a).concat(s)}}function Ry(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function UH(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function B4e(e,t,n,r){const{pos:o,box:i}=n,a=e.maxPadding;if(!y1(o)){n.size&&(e[o]-=n.size);const h=r[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?i.height:i.width),n.size=h.size/h.count,e[o]+=n.size}i.getPadding&&UH(a,i.getPadding());const s=Math.max(0,t.outerWidth-Ry(a,e,"left","right")),c=Math.max(0,t.outerHeight-Ry(a,e,"top","bottom")),u=s!==e.w,d=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:u,other:d}:{same:d,other:u}}function O4e(e){const t=e.maxPadding;function n(r){const o=Math.max(t[r]-e[r],0);return e[r]+=o,o}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function R4e(e,t){const n=t.maxPadding;function r(o){const i={left:0,top:0,right:0,bottom:0};return o.forEach(a=>{i[a]=Math.max(t[a],n[a])}),i}return r(e?["left","right"]:["top","bottom"])}function q4(e,t,n,r){const o=[];let i,a,s,c,u,d;for(i=0,a=e.length,u=0;i<a;++i){s=e[i],c=s.box,c.update(s.width||t.w,s.height||t.h,R4e(s.horizontal,t));const{same:h,other:C}=B4e(t,n,s,r);u|=h&&o.length,d=d||C,c.fullSize||o.push(s)}return u&&q4(o,t,n,r)||d}function x6(e,t,n,r,o){e.top=n,e.left=t,e.right=t+r,e.bottom=n+o,e.width=r,e.height=o}function Iy(e,t,n,r){const o=n.padding;let{x:i,y:a}=t;for(const s of e){const c=s.box,u=r[s.stack]||{count:1,placed:0,weight:1},d=s.stackWeight/u.weight||1;if(s.horizontal){const h=t.w*d,C=u.size||c.height;Bs(u.start)&&(a=u.start),c.fullSize?x6(c,o.left,a,n.outerWidth-o.right-o.left,C):x6(c,t.left+u.placed,a,h,C),u.start=a,u.placed+=h,a=c.bottom}else{const h=t.h*d,C=u.size||c.width;Bs(u.start)&&(i=u.start),c.fullSize?x6(c,i,o.top,C,n.outerHeight-o.bottom-o.top):x6(c,i,t.top+u.placed,C,h),u.start=i,u.placed+=h,i=c.right}}t.x=i,t.y=a}var Ga={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const o=No(e.options.layout.padding),i=Math.max(t-o.width,0),a=Math.max(n-o.height,0),s=L4e(e.boxes),c=s.vertical,u=s.horizontal;J1(e.boxes,v=>{typeof v.beforeLayout=="function"&&v.beforeLayout()});const d=c.reduce((v,p)=>p.box.options&&p.box.options.display===!1?v:v+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/d,hBoxMaxHeight:a/2}),C=Object.assign({},o);UH(C,No(r));const m=Object.assign({maxPadding:C,w:i,h:a,x:o.left,y:o.top},o),A=H4e(c.concat(u),h);q4(s.fullSize,m,h,A),q4(c,m,h,A),q4(u,m,h,A)&&q4(c,m,h,A),O4e(m),Iy(s.leftAndTop,m,h,A),m.x+=m.w,m.y+=m.h,Iy(s.rightAndBottom,m,h,A),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},J1(s.chartArea,v=>{const p=v.box;Object.assign(p,e.chartArea),p.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class $H{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,o){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,o?Math.floor(n/o):r)}}isAttached(t){return!0}updateConfig(t){}}class I4e extends $H{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Zc="$chartjs",k4e={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ky=e=>e===null||e==="";function D4e(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[Zc]={initial:{height:r,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",ky(o)){const i=py(e,"width");i!==void 0&&(e.width=i)}if(ky(r))if(e.style.height==="")e.height=e.width/(t||2);else{const i=py(e,"height");i!==void 0&&(e.height=i)}return e}const KH=N5e?{passive:!0}:!1;function P4e(e,t,n){e&&e.addEventListener(t,n,KH)}function N4e(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,KH)}function T4e(e,t){const n=k4e[e.type]||e.type,{x:r,y:o}=V9(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:o!==void 0?o:null}}function N8(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function F4e(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let a=!1;for(const s of i)a=a||N8(s.addedNodes,r),a=a&&!N8(s.removedNodes,r);a&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function V4e(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let a=!1;for(const s of i)a=a||N8(s.removedNodes,r),a=a&&!N8(s.addedNodes,r);a&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const ks=new Map;let Dy=0;function WH(){const e=window.devicePixelRatio;e!==Dy&&(Dy=e,ks.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function j4e(e,t){ks.size||window.addEventListener("resize",WH),ks.set(e,t)}function z4e(e){ks.delete(e),ks.size||window.removeEventListener("resize",WH)}function Z4e(e,t,n){const r=e.canvas,o=r&&Zg(r);if(!o)return;const i=xH((s,c)=>{const u=o.clientWidth;n(s,c),u<o.clientWidth&&n()},window),a=new ResizeObserver(s=>{const c=s[0],u=c.contentRect.width,d=c.contentRect.height;u===0&&d===0||i(u,d)});return a.observe(o),j4e(e,i),a}function nf(e,t,n){n&&n.disconnect(),t==="resize"&&z4e(e)}function U4e(e,t,n){const r=e.canvas,o=xH(i=>{e.ctx!==null&&n(T4e(i,e))},e);return P4e(r,t,o),o}class $4e extends $H{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(D4e(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Zc])return!1;const r=n[Zc].initial;["height","width"].forEach(i=>{const a=r[i];Q1(a)?n.removeAttribute(i):n.setAttribute(i,a)});const o=r.style||{};return Object.keys(o).forEach(i=>{n.style[i]=o[i]}),n.width=n.width,delete n[Zc],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),a={attach:F4e,detach:V4e,resize:Z4e}[n]||U4e;o[n]=a(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),o=r[n];if(!o)return;({attach:nf,detach:nf,resize:nf}[n]||N4e)(t,n,o),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,o){return P5e(t,n,r,o)}isAttached(t){const n=t&&Zg(t);return!!(n&&n.isConnected)}}function K4e(e){return!zg()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?I4e:$4e}var X6;let g9=(X6=class{constructor(){xn(this,"x");xn(this,"y");xn(this,"active",!1);xn(this,"options");xn(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return Os(this.x)&&Os(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const o={};return t.forEach(i=>{o[i]=r[i]&&r[i].active()?r[i]._to:this[i]}),o}},xn(X6,"defaults",{}),xn(X6,"defaultRoutes"),X6);function W4e(e,t){const n=e.options.ticks,r=Q4e(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?Y4e(t):[],a=i.length,s=i[0],c=i[a-1],u=[];if(a>o)return q4e(t,u,i,a/o),u;const d=G4e(i,t,o);if(a>0){let h,C;const m=a>1?Math.round((c-s)/(a-1)):null;for(_6(t,u,d,Q1(m)?0:s-m,s),h=0,C=a-1;h<C;h++)_6(t,u,d,i[h],i[h+1]);return _6(t,u,d,c,Q1(m)?t.length:c+m),u}return _6(t,u,d),u}function Q4e(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),o=e._maxLength/n;return Math.floor(Math.min(r,o))}function G4e(e,t,n){const r=X4e(e),o=t.length/n;if(!r)return Math.max(o,1);const i=P3e(r);for(let a=0,s=i.length-1;a<s;a++){const c=i[a];if(c>o)return c}return Math.max(o,1)}function Y4e(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function q4e(e,t,n,r){let o=0,i=n[0],a;for(r=Math.ceil(r),a=0;a<e.length;a++)a===i&&(t.push(e[a]),o++,i=n[o*r])}function _6(e,t,n,r,o){const i=C1(r,0),a=Math.min(C1(o,e.length),e.length);let s=0,c,u,d;for(n=Math.ceil(n),o&&(c=o-r,n=c/Math.floor(c/n)),d=i;d<0;)s++,d=Math.round(i+s*n);for(u=Math.max(i,0);u<a;u++)u===d&&(t.push(e[u]),s++,d=Math.round(i+s*n))}function X4e(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const J4e=e=>e==="left"?"right":e==="right"?"left":e,Py=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Ny=(e,t)=>Math.min(t||e,e);function Ty(e,t){const n=[],r=e.length/t,o=e.length;let i=0;for(;i<o;i+=r)n.push(e[Math.floor(i)]);return n}function ese(e,t,n){const r=e.ticks.length,o=Math.min(t,r-1),i=e._startPixel,a=e._endPixel,s=1e-6;let c=e.getPixelForTick(o),u;if(!(n&&(r===1?u=Math.max(c-i,a-c):t===0?u=(e.getPixelForTick(1)-c)/2:u=(c-e.getPixelForTick(o-1))/2,c+=o<t?u:-u,c<i-s||c>a+s)))return c}function tse(e,t){J1(e,n=>{const r=n.gc,o=r.length/2;let i;if(o>t){for(i=0;i<o;++i)delete n.data[r[i]];r.splice(0,o)}})}function O4(e){return e.drawTicks?e.tickLength:0}function Fy(e,t){if(!e.display)return 0;const n=fr(e.font,t),r=No(e.padding);return(K0(e.text)?e.text.length:1)*n.lineHeight+r.height}function nse(e,t){return g3(e,{scale:t,type:"scale"})}function rse(e,t,n){return g3(e,{tick:n,index:t,type:"tick"})}function ose(e,t,n){let r=_H(e);return(n&&t!=="right"||!n&&t==="right")&&(r=J4e(r)),r}function ise(e,t,n,r){const{top:o,left:i,bottom:a,right:s,chart:c}=e,{chartArea:u,scales:d}=c;let h=0,C,m,A;const v=a-o,p=s-i;if(e.isHorizontal()){if(m=Lr(r,i,s),y1(n)){const _=Object.keys(n)[0],w=n[_];A=d[_].getPixelForValue(w)+v-t}else n==="center"?A=(u.bottom+u.top)/2+v-t:A=Py(e,n,t);C=s-i}else{if(y1(n)){const _=Object.keys(n)[0],w=n[_];m=d[_].getPixelForValue(w)-p+t}else n==="center"?m=(u.left+u.right)/2-p+t:m=Py(e,n,t);A=Lr(r,a,o),h=n==="left"?-W0:W0}return{titleX:m,titleY:A,maxWidth:C,rotation:h}}class U5 extends g9{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:o}=this;return t=ui(t,Number.POSITIVE_INFINITY),n=ui(n,Number.NEGATIVE_INFINITY),r=ui(r,Number.POSITIVE_INFINITY),o=ui(o,Number.NEGATIVE_INFINITY),{min:ui(t,r),max:ui(n,o),minDefined:D2(t),maxDefined:D2(n)}}getMinMax(t){let{min:n,max:r,minDefined:o,maxDefined:i}=this.getUserBounds(),a;if(o&&i)return{min:n,max:r};const s=this.getMatchingVisibleMetas();for(let c=0,u=s.length;c<u;++c)a=s[c].controller.getMinMax(this,t),o||(n=Math.min(n,a.min)),i||(r=Math.max(r,a.max));return n=i&&n>r?r:n,r=o&&n>r?n:r,{min:ui(n,ui(r,n)),max:ui(r,ui(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){C0(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:o,grace:i,ticks:a}=this.options,s=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=C5e(this,i,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=s<this.ticks.length;this._convertTicksToLabels(c?Ty(this.ticks,s):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=W4e(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){C0(this.options.afterUpdate,[this])}beforeSetDimensions(){C0(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){C0(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),C0(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){C0(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,o,i;for(r=0,o=t.length;r<o;r++)i=t[r],i.label=C0(n.callback,[i.value,r,t],this)}afterTickToLabelConversion(){C0(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){C0(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=Ny(this.ticks.length,t.ticks.maxTicksLimit),o=n.minRotation||0,i=n.maxRotation;let a=o,s,c,u;if(!this._isVisible()||!n.display||o>=i||r<=1||!this.isHorizontal()){this.labelRotation=o;return}const d=this._getLabelSizes(),h=d.widest.width,C=d.highest.height,m=R2(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/r:m/(r-1),h+6>s&&(s=m/(r-(t.offset?.5:1)),c=this.maxHeight-O4(t.grid)-n.padding-Fy(t.title,this.chart.options.font),u=Math.sqrt(h*h+C*C),a=V3e(Math.min(Math.asin(R2((d.highest.height+6)/s,-1,1)),Math.asin(R2(c/u,-1,1))-Math.asin(R2(C/u,-1,1)))),a=Math.max(o,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){C0(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){C0(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:o,grid:i}}=this,a=this._isVisible(),s=this.isHorizontal();if(a){const c=Fy(o,n.options.font);if(s?(t.width=this.maxWidth,t.height=O4(i)+c):(t.height=this.maxHeight,t.width=O4(i)+c),r.display&&this.ticks.length){const{first:u,last:d,widest:h,highest:C}=this._getLabelSizes(),m=r.padding*2,A=sa(this.labelRotation),v=Math.cos(A),p=Math.sin(A);if(s){const _=r.mirror?0:p*h.width+v*C.height;t.height=Math.min(this.maxHeight,t.height+_+m)}else{const _=r.mirror?0:v*h.width+p*C.height;t.width=Math.min(this.maxWidth,t.width+_+m)}this._calculatePadding(u,d,p,v)}}this._handleMargins(),s?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,o){const{ticks:{align:i,padding:a},position:s}=this.options,c=this.labelRotation!==0,u=s!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let C=0,m=0;c?u?(C=o*t.width,m=r*n.height):(C=r*t.height,m=o*n.width):i==="start"?m=n.width:i==="end"?C=t.width:i!=="inner"&&(C=t.width/2,m=n.width/2),this.paddingLeft=Math.max((C-d+a)*this.width/(this.width-d),0),this.paddingRight=Math.max((m-h+a)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;i==="start"?(d=0,h=t.height):i==="end"&&(d=n.height,h=0),this.paddingTop=d+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){C0(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n<r;n++)Q1(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=Ty(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:o,_longestTextCache:i}=this,a=[],s=[],c=Math.floor(n/Ny(n,r));let u=0,d=0,h,C,m,A,v,p,_,w,x,E,S;for(h=0;h<n;h+=c){if(A=t[h].label,v=this._resolveTickFontOptions(h),o.font=p=v.string,_=i[p]=i[p]||{data:{},gc:[]},w=v.lineHeight,x=E=0,!Q1(A)&&!K0(A))x=fy(o,_.data,_.gc,x,A),E=w;else if(K0(A))for(C=0,m=A.length;C<m;++C)S=A[C],!Q1(S)&&!K0(S)&&(x=fy(o,_.data,_.gc,x,S),E+=w);a.push(x),s.push(E),u=Math.max(x,u),d=Math.max(E,d)}tse(i,n);const M=a.indexOf(u),H=s.indexOf(d),O=k=>({width:a[k]||0,height:s[k]||0});return{first:O(0),last:O(n-1),widest:O(M),highest:O(H),widths:a,heights:s}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return z3e(this._alignToPixels?k9(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const r=n[t];return r.$context||(r.$context=rse(this.getContext(),t,r))}return this.$context||(this.$context=nse(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=sa(this.labelRotation),r=Math.abs(Math.cos(n)),o=Math.abs(Math.sin(n)),i=this._getLabelSizes(),a=t.autoSkipPadding||0,s=i?i.widest.width+a:0,c=i?i.highest.height+a:0;return this.isHorizontal()?c*r>s*o?s/r:c/o:c*o<s*r?c/r:s/o}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,r=this.chart,o=this.options,{grid:i,position:a,border:s}=o,c=i.offset,u=this.isHorizontal(),h=this.ticks.length+(c?1:0),C=O4(i),m=[],A=s.setContext(this.getContext()),v=A.display?A.width:0,p=v/2,_=function(T){return k9(r,T,v)};let w,x,E,S,M,H,O,k,D,N,P,F;if(a==="top")w=_(this.bottom),H=this.bottom-C,k=w-p,N=_(t.top)+p,F=t.bottom;else if(a==="bottom")w=_(this.top),N=t.top,F=_(t.bottom)-p,H=w+p,k=this.top+C;else if(a==="left")w=_(this.right),M=this.right-C,O=w-p,D=_(t.left)+p,P=t.right;else if(a==="right")w=_(this.left),D=t.left,P=_(t.right)-p,M=w+p,O=this.left+C;else if(n==="x"){if(a==="center")w=_((t.top+t.bottom)/2+.5);else if(y1(a)){const T=Object.keys(a)[0],$=a[T];w=_(this.chart.scales[T].getPixelForValue($))}N=t.top,F=t.bottom,H=w+p,k=H+C}else if(n==="y"){if(a==="center")w=_((t.left+t.right)/2);else if(y1(a)){const T=Object.keys(a)[0],$=a[T];w=_(this.chart.scales[T].getPixelForValue($))}M=w-p,O=M-C,D=t.left,P=t.right}const j=C1(o.ticks.maxTicksLimit,h),V=Math.max(1,Math.ceil(h/j));for(x=0;x<h;x+=V){const T=this.getContext(x),$=i.setContext(T),K=s.setContext(T),q=$.lineWidth,W=$.color,U=K.dash||[],G=K.dashOffset,J=$.tickWidth,Y=$.tickColor,ee=$.tickBorderDash||[],re=$.tickBorderDashOffset;E=ese(this,x,c),E!==void 0&&(S=k9(r,E,q),u?M=O=D=P=S:H=k=N=F=S,m.push({tx1:M,ty1:H,tx2:O,ty2:k,x1:D,y1:N,x2:P,y2:F,width:q,color:W,borderDash:U,borderDashOffset:G,tickWidth:J,tickColor:Y,tickBorderDash:ee,tickBorderDashOffset:re}))}return this._ticksLength=h,this._borderValue=w,m}_computeLabelItems(t){const n=this.axis,r=this.options,{position:o,ticks:i}=r,a=this.isHorizontal(),s=this.ticks,{align:c,crossAlign:u,padding:d,mirror:h}=i,C=O4(r.grid),m=C+d,A=h?-d:m,v=-sa(this.labelRotation),p=[];let _,w,x,E,S,M,H,O,k,D,N,P,F="middle";if(o==="top")M=this.bottom-A,H=this._getXAxisLabelAlignment();else if(o==="bottom")M=this.top+A,H=this._getXAxisLabelAlignment();else if(o==="left"){const V=this._getYAxisLabelAlignment(C);H=V.textAlign,S=V.x}else if(o==="right"){const V=this._getYAxisLabelAlignment(C);H=V.textAlign,S=V.x}else if(n==="x"){if(o==="center")M=(t.top+t.bottom)/2+m;else if(y1(o)){const V=Object.keys(o)[0],T=o[V];M=this.chart.scales[V].getPixelForValue(T)+m}H=this._getXAxisLabelAlignment()}else if(n==="y"){if(o==="center")S=(t.left+t.right)/2-m;else if(y1(o)){const V=Object.keys(o)[0],T=o[V];S=this.chart.scales[V].getPixelForValue(T)}H=this._getYAxisLabelAlignment(C).textAlign}n==="y"&&(c==="start"?F="top":c==="end"&&(F="bottom"));const j=this._getLabelSizes();for(_=0,w=s.length;_<w;++_){x=s[_],E=x.label;const V=i.setContext(this.getContext(_));O=this.getPixelForTick(_)+i.labelOffset,k=this._resolveTickFontOptions(_),D=k.lineHeight,N=K0(E)?E.length:1;const T=N/2,$=V.color,K=V.textStrokeColor,q=V.textStrokeWidth;let W=H;a?(S=O,H==="inner"&&(_===w-1?W=this.options.reverse?"left":"right":_===0?W=this.options.reverse?"right":"left":W="center"),o==="top"?u==="near"||v!==0?P=-N*D+D/2:u==="center"?P=-j.highest.height/2-T*D+D:P=-j.highest.height+D/2:u==="near"||v!==0?P=D/2:u==="center"?P=j.highest.height/2-T*D:P=j.highest.height-N*D,h&&(P*=-1),v!==0&&!V.showLabelBackdrop&&(S+=D/2*Math.sin(v))):(M=O,P=(1-N)*D/2);let U;if(V.showLabelBackdrop){const G=No(V.backdropPadding),J=j.heights[_],Y=j.widths[_];let ee=P-G.top,re=0-G.left;switch(F){case"middle":ee-=J/2;break;case"bottom":ee-=J;break}switch(H){case"center":re-=Y/2;break;case"right":re-=Y;break;case"inner":_===w-1?re-=Y:_>0&&(re-=Y/2);break}U={left:re,top:ee,width:Y+G.width,height:J+G.height,color:V.backdropColor}}p.push({label:E,font:k,textOffset:P,options:{rotation:v,color:$,strokeColor:K,strokeWidth:q,textAlign:W,textBaseline:F,translation:[S,M],backdrop:U}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-sa(this.labelRotation))return t==="top"?"left":"right";let o="center";return n.align==="start"?o="left":n.align==="end"?o="right":n.align==="inner"&&(o="inner"),o}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:o,padding:i}}=this.options,a=this._getLabelSizes(),s=t+i,c=a.widest.width;let u,d;return n==="left"?o?(d=this.right+i,r==="near"?u="left":r==="center"?(u="center",d+=c/2):(u="right",d+=c)):(d=this.right-s,r==="near"?u="right":r==="center"?(u="center",d-=c/2):(u="left",d=this.left)):n==="right"?o?(d=this.left+i,r==="near"?u="right":r==="center"?(u="center",d-=c/2):(u="left",d-=c)):(d=this.left+s,r==="near"?u="left":r==="center"?(u="center",d+=c/2):(u="right",d=this.right)):u="right",{textAlign:u,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:o,width:i,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,o,i,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const o=this.ticks.findIndex(i=>i.value===t);return o>=0?n.setContext(this.getContext(o)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let i,a;const s=(c,u,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(c.x,c.y),r.lineTo(u.x,u.y),r.stroke(),r.restore())};if(n.display)for(i=0,a=o.length;i<a;++i){const c=o[i];n.drawOnChartArea&&s({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&s({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:o}}=this,i=r.setContext(this.getContext()),a=r.display?i.width:0;if(!a)return;const s=o.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let u,d,h,C;this.isHorizontal()?(u=k9(t,this.left,a)-a/2,d=k9(t,this.right,s)+s/2,h=C=c):(h=k9(t,this.top,a)-a/2,C=k9(t,this.bottom,s)+s/2,u=d=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(u,h),n.lineTo(d,C),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,o=this._computeLabelArea();o&&L7(r,o);const i=this.getLabelItems(t);for(const a of i){const s=a.options,c=a.font,u=a.label,d=a.textOffset;k8(r,u,0,d,c,s)}o&&B7(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:o}}=this;if(!r.display)return;const i=fr(r.font),a=No(r.padding),s=r.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||y1(n)?(c+=a.bottom,K0(r.text)&&(c+=i.lineHeight*(r.text.length-1))):c+=a.top;const{titleX:u,titleY:d,maxWidth:h,rotation:C}=ise(this,c,n,s);k8(t,r.text,0,0,i,{color:r.color,maxWidth:h,rotation:C,textAlign:ose(s,n,o),textBaseline:"middle",translation:[u,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=C1(t.grid&&t.grid.z,-1),o=C1(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==U5.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:r,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",o=[];let i,a;for(i=0,a=n.length;i<a;++i){const s=n[i];s[r]===this.id&&(!t||s.type===t)&&o.push(s)}return o}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return fr(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class E6{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;lse(n)&&(r=this.register(n));const o=this.items,i=t.id,a=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in o||(o[i]=t,ase(t,a,r),this.override&&N0.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,o=this.scope;r in n&&delete n[r],o&&r in N0[o]&&(delete N0[o][r],this.override&&delete n3[r])}}function ase(e,t,n){const r=Ls(Object.create(null),[n?N0.get(n):{},N0.get(t),e.defaults]);N0.set(t,r),e.defaultRoutes&&sse(t,e.defaultRoutes),e.descriptors&&N0.describe(t,e.descriptors)}function sse(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),o=r.pop(),i=[e].concat(r).join("."),a=t[n].split("."),s=a.pop(),c=a.join(".");N0.route(i,o,c,s)})}function lse(e){return"id"in e&&"defaults"in e}class cse{constructor(){this.controllers=new E6(X9,"datasets",!0),this.elements=new E6(g9,"elements"),this.plugins=new E6(Object,"plugins"),this.scales=new E6(U5,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(o=>{const i=r||this._getRegistryForType(o);r||i.isForType(o)||i===this.plugins&&o.id?this._exec(t,i,o):J1(o,a=>{const s=r||this._getRegistryForType(a);this._exec(t,s,a)})})}_exec(t,n,r){const o=kg(t);C0(r["before"+o],[],r),n[t](r),C0(r["after"+o],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const o=n.get(t);if(o===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return o}}var Ci=new cse;class use{constructor(){this._init=[]}notify(t,n,r,o){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const i=o?this._descriptors(t).filter(o):this._descriptors(t),a=this._notify(i,t,n,r);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,n,r,o){o=o||{};for(const i of t){const a=i.plugin,s=a[r],c=[n,o,i.options];if(C0(s,c,a)===!1&&o.cancelable)return!1}return!0}invalidate(){Q1(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,o=C1(r.options&&r.options.plugins,{}),i=dse(r);return o===!1&&!n?[]:hse(t,i,o,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,o=(i,a)=>i.filter(s=>!a.some(c=>s.plugin.id===c.plugin.id));this._notify(o(n,r),t,"stop"),this._notify(o(r,n),t,"start")}}function dse(e){const t={},n=[],r=Object.keys(Ci.plugins.items);for(let i=0;i<r.length;i++)n.push(Ci.getPlugin(r[i]));const o=e.plugins||[];for(let i=0;i<o.length;i++){const a=o[i];n.indexOf(a)===-1&&(n.push(a),t[a.id]=!0)}return{plugins:n,localIds:t}}function fse(e,t){return!t&&e===!1?null:e===!0?{}:e}function hse(e,{plugins:t,localIds:n},r,o){const i=[],a=e.getContext();for(const s of t){const c=s.id,u=fse(r[c],o);u!==null&&i.push({plugin:s,options:Cse(e.config,{plugin:s,local:n[c]},u,a)})}return i}function Cse(e,{plugin:t,local:n},r,o){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(r,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Eh(e,t){const n=N0.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function gse(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function mse(e,t){return e===t?"_index_":"_value_"}function Vy(e){if(e==="x"||e==="y"||e==="r")return e}function pse(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Sh(e,...t){if(Vy(e))return e;for(const n of t){const r=n.axis||pse(n.position)||e.length>1&&Vy(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function jy(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Ase(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return jy(e,"x",n[0])||jy(e,"y",n[0])}return{}}function vse(e,t){const n=n3[e.type]||{scales:{}},r=t.scales||{},o=Eh(e.type,t),i=Object.create(null);return Object.keys(r).forEach(a=>{const s=r[a];if(!y1(s))return console.error(`Invalid scale configuration for scale: ${a}`);if(s._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=Sh(a,s,Ase(a,e),N0.scales[s.type]),u=mse(c,o),d=n.scales||{};i[a]=ds(Object.create(null),[{axis:c},s,d[c],d[u]])}),e.data.datasets.forEach(a=>{const s=a.type||e.type,c=a.indexAxis||Eh(s,t),d=(n3[s]||{}).scales||{};Object.keys(d).forEach(h=>{const C=gse(h,c),m=a[C+"AxisID"]||C;i[m]=i[m]||Object.create(null),ds(i[m],[{axis:C},r[m],d[h]])})}),Object.keys(i).forEach(a=>{const s=i[a];ds(s,[N0.scales[s.type],N0.scale])}),i}function QH(e){const t=e.options||(e.options={});t.plugins=C1(t.plugins,{}),t.scales=vse(e,t)}function GH(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function bse(e){return e=e||{},e.data=GH(e.data),QH(e),e}const zy=new Map,YH=new Set;function S6(e,t){let n=zy.get(e);return n||(n=t(),zy.set(e,n),YH.add(n)),n}const R4=(e,t,n)=>{const r=t3(t,n);r!==void 0&&e.add(r)};class yse{constructor(t){this._config=bse(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=GH(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),QH(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return S6(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return S6(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return S6(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return S6(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let o=r.get(t);return(!o||n)&&(o=new Map,r.set(t,o)),o}getOptionScopes(t,n,r){const{options:o,type:i}=this,a=this._cachedScopes(t,r),s=a.get(n);if(s)return s;const c=new Set;n.forEach(d=>{t&&(c.add(t),d.forEach(h=>R4(c,t,h))),d.forEach(h=>R4(c,o,h)),d.forEach(h=>R4(c,n3[i]||{},h)),d.forEach(h=>R4(c,N0,h)),d.forEach(h=>R4(c,wh,h))});const u=Array.from(c);return u.length===0&&u.push(Object.create(null)),YH.has(n)&&a.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,n3[n]||{},N0.datasets[n]||{},{type:n},N0,wh]}resolveNamedOptions(t,n,r,o=[""]){const i={$shared:!0},{resolver:a,subPrefixes:s}=Zy(this._resolverCache,t,o);let c=a;if(xse(a,n)){i.$shared=!1,r=o9(r)?r():r;const u=this.createResolver(t,r,s);c=E5(a,r,u)}for(const u of n)i[u]=c[u];return i}createResolver(t,n,r=[""],o){const{resolver:i}=Zy(this._resolverCache,t,r);return y1(n)?E5(i,n,void 0,o):i}}function Zy(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const o=n.join();let i=r.get(o);return i||(i={resolver:Fg(t,n),subPrefixes:n.filter(s=>!s.toLowerCase().includes("hover"))},r.set(o,i)),i}const wse=e=>y1(e)&&Object.getOwnPropertyNames(e).some(t=>o9(e[t]));function xse(e,t){const{isScriptable:n,isIndexable:r}=LH(e);for(const o of t){const i=n(o),a=r(o),s=(a||i)&&e[o];if(i&&(o9(s)||wse(s))||a&&K0(s))return!0}return!1}var _se="4.4.9";const Ese=["top","bottom","left","right","chartArea"];function Uy(e,t){return e==="top"||e==="bottom"||Ese.indexOf(e)===-1&&t==="x"}function $y(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ky(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),C0(n&&n.onComplete,[e],t)}function Sse(e){const t=e.chart,n=t.options.animation;C0(n&&n.onProgress,[e],t)}function qH(e){return zg()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Uc={},Wy=e=>{const t=qH(e);return Object.values(Uc).filter(n=>n.canvas===t).pop()};function Mse(e,t,n){const r=Object.keys(e);for(const o of r){const i=+o;if(i>=t){const a=e[o];delete e[o],(n>0||i>t)&&(e[i+n]=a)}}}function Hse(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}var ja;let $5=(ja=class{static register(...t){Ci.add(...t),Qy()}static unregister(...t){Ci.remove(...t),Qy()}constructor(t,n){const r=this.config=new yse(n),o=qH(t),i=Wy(o);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||K4e(o)),this.platform.updateConfig(r);const s=this.platform.acquireContext(o,a.aspectRatio),c=s&&s.canvas,u=c&&c.height,d=c&&c.width;if(this.id=M3e(),this.ctx=s,this.canvas=c,this.width=d,this.height=u,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new use,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=K3e(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Uc[this.id]=this,!s||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Xi.listen(this,"complete",Ky),Xi.listen(this,"progress",Sse),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:o,_aspectRatio:i}=this;return Q1(t)?n&&i?i:o?r/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ci}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():my(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return hy(this.canvas,this.ctx),this}stop(){return Xi.stop(this),this}resize(t,n){Xi.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,o=this.canvas,i=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(o,t,n,i),s=r.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,my(this,s,!0)&&(this.notifyPlugins("resize",{size:a}),C0(r.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};J1(n,(r,o)=>{r.id=o})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,o=Object.keys(r).reduce((a,s)=>(a[s]=!1,a),{});let i=[];n&&(i=i.concat(Object.keys(n).map(a=>{const s=n[a],c=Sh(a,s),u=c==="r",d=c==="x";return{options:s,dposition:u?"chartArea":d?"bottom":"left",dtype:u?"radialLinear":d?"category":"linear"}}))),J1(i,a=>{const s=a.options,c=s.id,u=Sh(c,s),d=C1(s.type,a.dtype);(s.position===void 0||Uy(s.position,u)!==Uy(a.dposition))&&(s.position=a.dposition),o[c]=!0;let h=null;if(c in r&&r[c].type===d)h=r[c];else{const C=Ci.getScale(d);h=new C({id:c,type:d,ctx:this.ctx,chart:this}),r[h.id]=h}h.init(s,t)}),J1(o,(a,s)=>{a||delete r[s]}),J1(r,a=>{Ga.configure(this,a,a.options),Ga.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((o,i)=>o.index-i.index),r>n){for(let o=n;o<r;++o)this._destroyDatasetMeta(o);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort($y("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,o)=>{n.filter(i=>i===r._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,o;for(this._removeUnreferencedMetasets(),r=0,o=n.length;r<o;r++){const i=n[r];let a=this.getDatasetMeta(r);const s=i.type||this.config.type;if(a.type&&a.type!==s&&(this._destroyDatasetMeta(r),a=this.getDatasetMeta(r)),a.type=s,a.indexAxis=i.indexAxis||Eh(s,this.options),a.order=i.order||0,a.index=r,a.label=""+i.label,a.visible=this.isDatasetVisible(r),a.controller)a.controller.updateIndex(r),a.controller.linkScales();else{const c=Ci.getController(s),{datasetElementType:u,dataElementType:d}=N0.datasets[s];Object.assign(c,{dataElementType:Ci.getElement(d),datasetElementType:u&&Ci.getElement(u)}),a.controller=new c(this,r),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){J1(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let u=0,d=this.data.datasets.length;u<d;u++){const{controller:h}=this.getDatasetMeta(u),C=!o&&i.indexOf(h)===-1;h.buildOrUpdateElements(C),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=r.layout.autoPadding?a:0,this._updateLayout(a),o||J1(i,u=>{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort($y("z","_idx"));const{_active:s,_lastEvent:c}=this;c?this._eventHandler(c,!0):s.length&&this._updateHoverStyles(s,s,!0),this.render()}_updateScales(){J1(this.scales,t=>{Ga.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!ry(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:o,count:i}of n){const a=r==="_removeElements"?-i:i;Mse(t,o,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=i=>new Set(t.filter(a=>a[0]===i).map((a,s)=>s+","+a.splice(1).join(","))),o=r(0);for(let i=1;i<n;i++)if(!ry(o,r(i)))return;return Array.from(o).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ga.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],J1(this.boxes,o=>{r&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,i)=>{o._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,o9(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),o={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",o)!==!1&&(r.controller._update(n),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Xi.has(this)?this.attached&&!Xi.running(this)&&Xi.start(this):(this.draw(),Ky({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:r,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,o)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let o,i;for(o=0,i=n.length;o<i;++o){const a=n[o];(!t||a.visible)&&r.push(a)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},o=FH(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(o&&L7(n,o),t.controller.draw(),o&&B7(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Is(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,o){const i=E4e.modes[n];return typeof i=="function"?i(this,t,r,o):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let o=r.filter(i=>i&&i._dataset===n).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(o)),o}getContext(){return this.$context||(this.$context=g3(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const o=r?"show":"hide",i=this.getDatasetMeta(t),a=i.controller._resolveAnimations(void 0,o);Bs(n)?(i.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),a.update(i,{visible:r}),this.update(s=>s.datasetIndex===t?o:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Xi.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),hy(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Uc[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(i,a)=>{n.addEventListener(this,i,a),t[i]=a},o=(i,a,s)=>{i.offsetX=a,i.offsetY=s,this._eventHandler(i)};J1(this.options.events,i=>r(i,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(c,u)=>{n.addEventListener(this,c,u),t[c]=u},o=(c,u)=>{t[c]&&(n.removeEventListener(this,c,u),delete t[c])},i=(c,u)=>{this.canvas&&this.resize(c,u)};let a;const s=()=>{o("attach",s),this.attached=!0,this.resize(),r("resize",i),r("detach",a)};a=()=>{this.attached=!1,o("resize",i),this._stop(),this._resize(0,0),r("attach",s)},n.isAttached(this.canvas)?s():a()}unbindEvents(){J1(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},J1(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const o=r?"set":"remove";let i,a,s,c;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+o+"DatasetHoverStyle"]()),s=0,c=t.length;s<c;++s){a=t[s];const u=a&&this.getDatasetMeta(a.datasetIndex).controller;u&&u[o+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:i,index:a})=>{const s=this.getDatasetMeta(i);if(!s)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:s.data[a],index:a}});!O8(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const o=this.options.hover,i=(c,u)=>c.filter(d=>!u.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),a=i(n,t),s=r?t:i(t,n);a.length&&this.updateHoverStyle(a,o.mode,!1),s.length&&o.mode&&this.updateHoverStyle(s,o.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},o=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,o)===!1)return;const i=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,o),(i||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:o=[],options:i}=this,a=n,s=this._getActiveElements(t,o,r,a),c=I3e(t),u=Hse(t,this._lastEvent,r,c);r&&(this._lastEvent=null,C0(i.onHover,[t,s,this],this),c&&C0(i.onClick,[t,s,this],this));const d=!O8(s,o);return(d||n)&&(this._active=s,this._updateHoverStyles(s,o,n)),this._lastEvent=u,d}_getActiveElements(t,n,r,o){if(t.type==="mouseout")return[];if(!r)return n;const i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,o)}},xn(ja,"defaults",N0),xn(ja,"instances",Uc),xn(ja,"overrides",n3),xn(ja,"registry",Ci),xn(ja,"version",_se),xn(ja,"getChart",Wy),ja);function Qy(){return J1($5.instances,e=>e._plugins.invalidate())}function Lse(e,t,n){const{startAngle:r,pixelMargin:o,x:i,y:a,outerRadius:s,innerRadius:c}=t;let u=o/s;e.beginPath(),e.arc(i,a,s,r-u,n+u),c>o?(u=o/c,e.arc(i,a,c,n+u,r-u,!0)):e.arc(i,a,o,n+W0,r-W0),e.closePath(),e.clip()}function Bse(e){return Tg(e,["outerStart","outerEnd","innerStart","innerEnd"])}function Ose(e,t,n,r){const o=Bse(e.options.borderRadius),i=(n-t)/2,a=Math.min(i,r*t/2),s=c=>{const u=(n-Math.min(i,c))*r/2;return R2(c,0,Math.min(i,u))};return{outerStart:s(o.outerStart),outerEnd:s(o.outerEnd),innerStart:R2(o.innerStart,0,a),innerEnd:R2(o.innerEnd,0,a)}}function K3(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function T8(e,t,n,r,o,i){const{x:a,y:s,startAngle:c,pixelMargin:u,innerRadius:d}=t,h=Math.max(t.outerRadius+r+n-u,0),C=d>0?d+r+n+u:0;let m=0;const A=o-c;if(r){const V=d>0?d-r:0,T=h>0?h-r:0,$=(V+T)/2,K=$!==0?A*$/($+r):A;m=(A-K)/2}const v=Math.max(.001,A*h-n/z0)/h,p=(A-v)/2,_=c+p+m,w=o-p-m,{outerStart:x,outerEnd:E,innerStart:S,innerEnd:M}=Ose(t,C,h,w-_),H=h-x,O=h-E,k=_+x/H,D=w-E/O,N=C+S,P=C+M,F=_+S/N,j=w-M/P;if(e.beginPath(),i){const V=(k+D)/2;if(e.arc(a,s,h,k,V),e.arc(a,s,h,V,D),E>0){const q=K3(O,D,a,s);e.arc(q.x,q.y,E,D,w+W0)}const T=K3(P,w,a,s);if(e.lineTo(T.x,T.y),M>0){const q=K3(P,j,a,s);e.arc(q.x,q.y,M,w+W0,j+Math.PI)}const $=(w-M/C+(_+S/C))/2;if(e.arc(a,s,C,w-M/C,$,!0),e.arc(a,s,C,$,_+S/C,!0),S>0){const q=K3(N,F,a,s);e.arc(q.x,q.y,S,F+Math.PI,_-W0)}const K=K3(H,_,a,s);if(e.lineTo(K.x,K.y),x>0){const q=K3(H,k,a,s);e.arc(q.x,q.y,x,_-W0,k)}}else{e.moveTo(a,s);const V=Math.cos(k)*h+a,T=Math.sin(k)*h+s;e.lineTo(V,T);const $=Math.cos(D)*h+a,K=Math.sin(D)*h+s;e.lineTo($,K)}e.closePath()}function Rse(e,t,n,r,o){const{fullCircles:i,startAngle:a,circumference:s}=t;let c=t.endAngle;if(i){T8(e,t,n,r,c,o);for(let u=0;u<i;++u)e.fill();isNaN(s)||(c=a+(s%w0||w0))}return T8(e,t,n,r,c,o),e.fill(),c}function Ise(e,t,n,r,o){const{fullCircles:i,startAngle:a,circumference:s,options:c}=t,{borderWidth:u,borderJoinStyle:d,borderDash:h,borderDashOffset:C}=c,m=c.borderAlign==="inner";if(!u)return;e.setLineDash(h||[]),e.lineDashOffset=C,m?(e.lineWidth=u*2,e.lineJoin=d||"round"):(e.lineWidth=u,e.lineJoin=d||"bevel");let A=t.endAngle;if(i){T8(e,t,n,r,A,o);for(let v=0;v<i;++v)e.stroke();isNaN(s)||(A=a+(s%w0||w0))}m&&Lse(e,t,A),i||(T8(e,t,n,r,A,o),e.stroke())}class X4 extends g9{constructor(n){super();xn(this,"circumference");xn(this,"endAngle");xn(this,"fullCircles");xn(this,"innerRadius");xn(this,"outerRadius");xn(this,"pixelMargin");xn(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,o){const i=this.getProps(["x","y"],o),{angle:a,distance:s}=vH(i,{x:n,y:r}),{startAngle:c,endAngle:u,innerRadius:d,outerRadius:h,circumference:C}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],o),m=(this.options.spacing+this.options.borderWidth)/2,A=C1(C,u-c),v=Rs(a,c,u)&&c!==u,p=A>=w0||v,_=la(s,d+m,h+m);return p&&_}getCenterPoint(n){const{x:r,y:o,startAngle:i,endAngle:a,innerRadius:s,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:u,spacing:d}=this.options,h=(i+a)/2,C=(s+c+d+u)/2;return{x:r+Math.cos(h)*C,y:o+Math.sin(h)*C}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:o}=this,i=(r.offset||0)/4,a=(r.spacing||0)/2,s=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=o>w0?Math.floor(o/w0):0,o===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const c=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(c)*i,Math.sin(c)*i);const u=1-Math.sin(Math.min(z0,o||0)),d=i*u;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,Rse(n,this,d,a,s),Ise(n,this,d,a,s),n.restore()}}xn(X4,"id","arc"),xn(X4,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),xn(X4,"defaultRoutes",{backgroundColor:"backgroundColor"}),xn(X4,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function XH(e,t,n=t){e.lineCap=C1(n.borderCapStyle,t.borderCapStyle),e.setLineDash(C1(n.borderDash,t.borderDash)),e.lineDashOffset=C1(n.borderDashOffset,t.borderDashOffset),e.lineJoin=C1(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=C1(n.borderWidth,t.borderWidth),e.strokeStyle=C1(n.borderColor,t.borderColor)}function kse(e,t,n){e.lineTo(n.x,n.y)}function Dse(e){return e.stepped?i5e:e.tension||e.cubicInterpolationMode==="monotone"?a5e:kse}function JH(e,t,n={}){const r=e.length,{start:o=0,end:i=r-1}=n,{start:a,end:s}=t,c=Math.max(o,a),u=Math.min(i,s),d=o<a&&i<a||o>s&&i>s;return{count:r,start:c,loop:t.loop,ilen:u<c&&!d?r+u-c:u-c}}function Pse(e,t,n,r){const{points:o,options:i}=t,{count:a,start:s,loop:c,ilen:u}=JH(o,n,r),d=Dse(i);let{move:h=!0,reverse:C}=r||{},m,A,v;for(m=0;m<=u;++m)A=o[(s+(C?u-m:m))%a],!A.skip&&(h?(e.moveTo(A.x,A.y),h=!1):d(e,v,A,C,i.stepped),v=A);return c&&(A=o[(s+(C?u:0))%a],d(e,v,A,C,i.stepped)),!!c}function Nse(e,t,n,r){const o=t.points,{count:i,start:a,ilen:s}=JH(o,n,r),{move:c=!0,reverse:u}=r||{};let d=0,h=0,C,m,A,v,p,_;const w=E=>(a+(u?s-E:E))%i,x=()=>{v!==p&&(e.lineTo(d,p),e.lineTo(d,v),e.lineTo(d,_))};for(c&&(m=o[w(0)],e.moveTo(m.x,m.y)),C=0;C<=s;++C){if(m=o[w(C)],m.skip)continue;const E=m.x,S=m.y,M=E|0;M===A?(S<v?v=S:S>p&&(p=S),d=(h*d+E)/++h):(x(),e.lineTo(E,S),A=M,h=0,v=p=S),_=S}x()}function Mh(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Nse:Pse}function Tse(e){return e.stepped?T5e:e.tension||e.cubicInterpolationMode==="monotone"?F5e:j9}function Fse(e,t,n,r){let o=t._path;o||(o=t._path=new Path2D,t.path(o,n,r)&&o.closePath()),XH(e,t.options),e.stroke(o)}function Vse(e,t,n,r){const{segments:o,options:i}=t,a=Mh(t);for(const s of o)XH(e,i,s.style),e.beginPath(),a(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const jse=typeof Path2D=="function";function zse(e,t,n,r){jse&&!t.options.segment?Fse(e,t,n,r):Vse(e,t,n,r)}class Ya extends g9{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const o=r.spanGaps?this._loop:this._fullLoop;B5e(this._points,r,t,o,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=$5e(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,o=t[n],i=this.points,a=TH(this,{property:n,start:o,end:o});if(!a.length)return;const s=[],c=Tse(r);let u,d;for(u=0,d=a.length;u<d;++u){const{start:h,end:C}=a[u],m=i[h],A=i[C];if(m===A){s.push(m);continue}const v=Math.abs((o-m[n])/(A[n]-m[n])),p=c(m,A,v,r.stepped);p[n]=t[n],s.push(p)}return s.length===1?s[0]:s}pathSegment(t,n,r){return Mh(this)(t,this,n,r)}path(t,n,r){const o=this.segments,i=Mh(this);let a=this._loop;n=n||0,r=r||this.points.length-n;for(const s of o)a&=i(t,this,s,{start:n,end:n+r-1});return!!a}draw(t,n,r,o){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),zse(t,this,r,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}xn(Ya,"id","line"),xn(Ya,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),xn(Ya,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),xn(Ya,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Gy(e,t,n,r){const o=e.options,{[n]:i}=e.getProps([n],r);return Math.abs(t-i)<o.radius+o.hitRadius}class $c extends g9{constructor(n){super();xn(this,"parsed");xn(this,"skip");xn(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,o){const i=this.options,{x:a,y:s}=this.getProps(["x","y"],o);return Math.pow(n-a,2)+Math.pow(r-s,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,r){return Gy(this,n,"x",r)}inYRange(n,r){return Gy(this,n,"y",r)}getCenterPoint(n){const{x:r,y:o}=this.getProps(["x","y"],n);return{x:r,y:o}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const o=r&&n.borderWidth||0;return(r+o)*2}draw(n,r){const o=this.options;this.skip||o.radius<.1||!Is(this,r,this.size(o)/2)||(n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.fillStyle=o.backgroundColor,xh(n,o,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}xn($c,"id","point"),xn($c,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),xn($c,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function eL(e,t){const{x:n,y:r,base:o,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let s,c,u,d,h;return e.horizontal?(h=a/2,s=Math.min(n,o),c=Math.max(n,o),u=r-h,d=r+h):(h=i/2,s=n-h,c=n+h,u=Math.min(r,o),d=Math.max(r,o)),{left:s,top:u,right:c,bottom:d}}function qa(e,t,n,r){return e?0:R2(t,n,r)}function Zse(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=HH(r);return{t:qa(o.top,i.top,0,n),r:qa(o.right,i.right,0,t),b:qa(o.bottom,i.bottom,0,n),l:qa(o.left,i.left,0,t)}}function Use(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=f5(o),a=Math.min(t,n),s=e.borderSkipped,c=r||y1(o);return{topLeft:qa(!c||s.top||s.left,i.topLeft,0,a),topRight:qa(!c||s.top||s.right,i.topRight,0,a),bottomLeft:qa(!c||s.bottom||s.left,i.bottomLeft,0,a),bottomRight:qa(!c||s.bottom||s.right,i.bottomRight,0,a)}}function $se(e){const t=eL(e),n=t.right-t.left,r=t.bottom-t.top,o=Zse(e,n/2,r/2),i=Use(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:i},inner:{x:t.left+o.l,y:t.top+o.t,w:n-o.l-o.r,h:r-o.t-o.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,i.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(o.b,o.r))}}}}function rf(e,t,n,r){const o=t===null,i=n===null,s=e&&!(o&&i)&&eL(e,r);return s&&(o||la(t,s.left,s.right))&&(i||la(n,s.top,s.bottom))}function Kse(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Wse(e,t){e.rect(t.x,t.y,t.w,t.h)}function of(e,t,n={}){const r=e.x!==n.x?-t:0,o=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-r,a=(e.y+e.h!==n.y+n.h?t:0)-o;return{x:e.x+r,y:e.y+o,w:e.w+i,h:e.h+a,radius:e.radius}}class Kc extends g9{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:o}}=this,{inner:i,outer:a}=$se(this),s=Kse(a.radius)?D8:Wse;t.save(),(a.w!==i.w||a.h!==i.h)&&(t.beginPath(),s(t,of(a,n,i)),t.clip(),s(t,of(i,-n,a)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),s(t,of(i,n)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,n,r){return rf(this,t,n,r)}inXRange(t,n){return rf(this,t,null,n)}inYRange(t,n){return rf(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:o,horizontal:i}=this.getProps(["x","y","base","horizontal"],t);return{x:i?(n+o)/2:n,y:i?r:(r+o)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}xn(Kc,"id","bar"),xn(Kc,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),xn(Kc,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Qse(e,t,n){const r=e.segments,o=e.points,i=t.points,a=[];for(const s of r){let{start:c,end:u}=s;u=$g(c,u,o);const d=Hh(n,o[c],o[u],s.loop);if(!t.segments){a.push({source:s,target:d,start:o[c],end:o[u]});continue}const h=TH(t,d);for(const C of h){const m=Hh(n,i[C.start],i[C.end],C.loop),A=NH(s,o,m);for(const v of A)a.push({source:v,target:C,start:{[n]:Yy(d,m,"start",Math.max)},end:{[n]:Yy(d,m,"end",Math.min)}})}}return a}function Hh(e,t,n,r){if(r)return;let o=t[e],i=n[e];return e==="angle"&&(o=mi(o),i=mi(i)),{property:e,start:o,end:i}}function Gse(e,t){const{x:n=null,y:r=null}=e||{},o=t.points,i=[];return t.segments.forEach(({start:a,end:s})=>{s=$g(a,s,o);const c=o[a],u=o[s];r!==null?(i.push({x:c.x,y:r}),i.push({x:u.x,y:r})):n!==null&&(i.push({x:n,y:c.y}),i.push({x:n,y:u.y}))}),i}function $g(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function Yy(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function tL(e,t){let n=[],r=!1;return K0(e)?(r=!0,n=e):n=Gse(e,t),n.length?new Ya({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function qy(e){return e&&e.fill!==!1}function Yse(e,t,n){let o=e[t].fill;const i=[t];let a;if(!n)return o;for(;o!==!1&&i.indexOf(o)===-1;){if(!D2(o))return o;if(a=e[o],!a)return!1;if(a.visible)return o;i.push(o),o=a.fill}return!1}function qse(e,t,n){const r=tle(e);if(y1(r))return isNaN(r.value)?!1:r;let o=parseFloat(r);return D2(o)&&Math.floor(o)===o?Xse(r[0],t,o,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function Xse(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function Jse(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:y1(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function ele(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:y1(e)?r=e.value:r=t.getBaseValue(),r}function tle(e){const t=e.options,n=t.fill;let r=C1(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function nle(e){const{scale:t,index:n,line:r}=e,o=[],i=r.segments,a=r.points,s=rle(t,n);s.push(tL({x:null,y:t.bottom},r));for(let c=0;c<i.length;c++){const u=i[c];for(let d=u.start;d<=u.end;d++)ole(o,a[d],s)}return new Ya({points:o,options:{}})}function rle(e,t){const n=[],r=e.getMatchingVisibleMetas("line");for(let o=0;o<r.length;o++){const i=r[o];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function ole(e,t,n){const r=[];for(let o=0;o<n.length;o++){const i=n[o],{first:a,last:s,point:c}=ile(i,t,"x");if(!(!c||a&&s)){if(a)r.unshift(c);else if(e.push(c),!s)break}}e.push(...r)}function ile(e,t,n){const r=e.interpolate(t,n);if(!r)return{};const o=r[n],i=e.segments,a=e.points;let s=!1,c=!1;for(let u=0;u<i.length;u++){const d=i[u],h=a[d.start][n],C=a[d.end][n];if(la(o,h,C)){s=o===h,c=o===C;break}}return{first:s,last:c,point:r}}class nL{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,r){const{x:o,y:i,radius:a}=this;return n=n||{start:0,end:w0},t.arc(o,i,a,n.end,n.start,!0),!r.bounds}interpolate(t){const{x:n,y:r,radius:o}=this,i=t.angle;return{x:n+Math.cos(i)*o,y:r+Math.sin(i)*o,angle:i}}}function ale(e){const{chart:t,fill:n,line:r}=e;if(D2(n))return sle(t,n);if(n==="stack")return nle(e);if(n==="shape")return!0;const o=lle(e);return o instanceof nL?o:tL(o,r)}function sle(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function lle(e){return(e.scale||{}).getPointPositionForValue?ule(e):cle(e)}function cle(e){const{scale:t={},fill:n}=e,r=Jse(n,t);if(D2(r)){const o=t.isHorizontal();return{x:o?r:null,y:o?null:r}}return null}function ule(e){const{scale:t,fill:n}=e,r=t.options,o=t.getLabels().length,i=r.reverse?t.max:t.min,a=ele(n,t,i),s=[];if(r.grid.circular){const c=t.getPointPositionForValue(0,i);return new nL({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(a)})}for(let c=0;c<o;++c)s.push(t.getPointPositionForValue(c,a));return s}function af(e,t,n){const r=ale(t),{chart:o,index:i,line:a,scale:s,axis:c}=t,u=a.options,d=u.fill,h=u.backgroundColor,{above:C=h,below:m=h}=d||{},A=o.getDatasetMeta(i),v=FH(o,A);r&&a.points.length&&(L7(e,n),dle(e,{line:a,target:r,above:C,below:m,area:n,scale:s,axis:c,clip:v}),B7(e))}function dle(e,t){const{line:n,target:r,above:o,below:i,area:a,scale:s,clip:c}=t,u=n._loop?"angle":t.axis;e.save(),u==="x"&&i!==o&&(Xy(e,r,a.top),Jy(e,{line:n,target:r,color:o,scale:s,property:u,clip:c}),e.restore(),e.save(),Xy(e,r,a.bottom)),Jy(e,{line:n,target:r,color:i,scale:s,property:u,clip:c}),e.restore()}function Xy(e,t,n){const{segments:r,points:o}=t;let i=!0,a=!1;e.beginPath();for(const s of r){const{start:c,end:u}=s,d=o[c],h=o[$g(c,u,o)];i?(e.moveTo(d.x,d.y),i=!1):(e.lineTo(d.x,n),e.lineTo(d.x,d.y)),a=!!t.pathSegment(e,s,{move:a}),a?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Jy(e,t){const{line:n,target:r,property:o,color:i,scale:a,clip:s}=t,c=Qse(n,r,o);for(const{source:u,target:d,start:h,end:C}of c){const{style:{backgroundColor:m=i}={}}=u,A=r!==!0;e.save(),e.fillStyle=m,fle(e,a,s,A&&Hh(o,h,C)),e.beginPath();const v=!!n.pathSegment(e,u);let p;if(A){v?e.closePath():ew(e,r,C,o);const _=!!r.pathSegment(e,d,{move:v,reverse:!0});p=v&&_,p||ew(e,r,h,o)}e.closePath(),e.fill(p?"evenodd":"nonzero"),e.restore()}}function fle(e,t,n,r){const o=t.chart.chartArea,{property:i,start:a,end:s}=r||{};if(i==="x"||i==="y"){let c,u,d,h;i==="x"?(c=a,u=o.top,d=s,h=o.bottom):(c=o.left,u=a,d=o.right,h=s),e.beginPath(),n&&(c=Math.max(c,n.left),d=Math.min(d,n.right),u=Math.max(u,n.top),h=Math.min(h,n.bottom)),e.rect(c,u,d-c,h-u),e.clip()}}function ew(e,t,n,r){const o=t.interpolate(n,r);o&&e.lineTo(o.x,o.y)}var hle={id:"filler",afterDatasetsUpdate(e,t,n){const r=(e.data.datasets||[]).length,o=[];let i,a,s,c;for(a=0;a<r;++a)i=e.getDatasetMeta(a),s=i.dataset,c=null,s&&s.options&&s instanceof Ya&&(c={visible:e.isDatasetVisible(a),index:a,fill:qse(s,a,r),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:s}),i.$filler=c,o.push(c);for(a=0;a<r;++a)c=o[a],!(!c||c.fill===!1)&&(c.fill=Yse(o,a,n.propagate))},beforeDraw(e,t,n){const r=n.drawTime==="beforeDraw",o=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let a=o.length-1;a>=0;--a){const s=o[a].$filler;s&&(s.line.updateControlPoints(i,s.axis),r&&s.fill&&af(e.ctx,s,i))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let o=r.length-1;o>=0;--o){const i=r[o].$filler;qy(i)&&af(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!qy(r)||n.drawTime!=="beforeDatasetDraw"||af(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const tw=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},Cle=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class nw extends g9{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=C0(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,o)=>t.sort(r,o,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,o=fr(r.font),i=o.size,a=this._computeTitleHeight(),{boxWidth:s,itemHeight:c}=tw(r,i);let u,d;n.font=o.string,this.isHorizontal()?(u=this.maxWidth,d=this._fitRows(a,i,s,c)+10):(d=this.maxHeight,u=this._fitCols(a,o,s,c)+10),this.width=Math.min(u,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,o){const{ctx:i,maxWidth:a,options:{labels:{padding:s}}}=this,c=this.legendHitBoxes=[],u=this.lineWidths=[0],d=o+s;let h=t;i.textAlign="left",i.textBaseline="middle";let C=-1,m=-d;return this.legendItems.forEach((A,v)=>{const p=r+n/2+i.measureText(A.text).width;(v===0||u[u.length-1]+p+2*s>a)&&(h+=d,u[u.length-(v>0?0:1)]=0,m+=d,C++),c[v]={left:0,top:m,row:C,width:p,height:o},u[u.length-1]+=p+s}),h}_fitCols(t,n,r,o){const{ctx:i,maxHeight:a,options:{labels:{padding:s}}}=this,c=this.legendHitBoxes=[],u=this.columnSizes=[],d=a-t;let h=s,C=0,m=0,A=0,v=0;return this.legendItems.forEach((p,_)=>{const{itemWidth:w,itemHeight:x}=gle(r,n,i,p,o);_>0&&m+x+2*s>d&&(h+=C+s,u.push({width:C,height:m}),A+=C+s,v++,C=m=0),c[_]={left:A,top:m,col:v,width:w,height:x},C=Math.max(C,w),m+=x+s}),h+=C,u.push({width:C,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:o},rtl:i}}=this,a=h5(i,this.left,this.width);if(this.isHorizontal()){let s=0,c=Lr(r,this.left+o,this.right-this.lineWidths[s]);for(const u of n)s!==u.row&&(s=u.row,c=Lr(r,this.left+o,this.right-this.lineWidths[s])),u.top+=this.top+t+o,u.left=a.leftForLtr(a.x(c),u.width),c+=u.width+o}else{let s=0,c=Lr(r,this.top+t+o,this.bottom-this.columnSizes[s].height);for(const u of n)u.col!==s&&(s=u.col,c=Lr(r,this.top+t+o,this.bottom-this.columnSizes[s].height)),u.top=c,u.left+=this.left+o,u.left=a.leftForLtr(a.x(u.left),u.width),c+=u.height+o}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;L7(t,this),this._draw(),B7(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:o}=this,{align:i,labels:a}=t,s=N0.color,c=h5(t.rtl,this.left,this.width),u=fr(a.font),{padding:d}=a,h=u.size,C=h/2;let m;this.drawTitle(),o.textAlign=c.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=u.string;const{boxWidth:A,boxHeight:v,itemHeight:p}=tw(a,h),_=function(M,H,O){if(isNaN(A)||A<=0||isNaN(v)||v<0)return;o.save();const k=C1(O.lineWidth,1);if(o.fillStyle=C1(O.fillStyle,s),o.lineCap=C1(O.lineCap,"butt"),o.lineDashOffset=C1(O.lineDashOffset,0),o.lineJoin=C1(O.lineJoin,"miter"),o.lineWidth=k,o.strokeStyle=C1(O.strokeStyle,s),o.setLineDash(C1(O.lineDash,[])),a.usePointStyle){const D={radius:v*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:k},N=c.xPlus(M,A/2),P=H+C;MH(o,D,N,P,a.pointStyleWidth&&A)}else{const D=H+Math.max((h-v)/2,0),N=c.leftForLtr(M,A),P=f5(O.borderRadius);o.beginPath(),Object.values(P).some(F=>F!==0)?D8(o,{x:N,y:D,w:A,h:v,radius:P}):o.rect(N,D,A,v),o.fill(),k!==0&&o.stroke()}o.restore()},w=function(M,H,O){k8(o,O.text,M,H+p/2,u,{strikethrough:O.hidden,textAlign:c.textAlign(O.textAlign)})},x=this.isHorizontal(),E=this._computeTitleHeight();x?m={x:Lr(i,this.left+d,this.right-r[0]),y:this.top+d+E,line:0}:m={x:this.left+d,y:Lr(i,this.top+E+d,this.bottom-n[0].height),line:0},kH(this.ctx,t.textDirection);const S=p+d;this.legendItems.forEach((M,H)=>{o.strokeStyle=M.fontColor,o.fillStyle=M.fontColor;const O=o.measureText(M.text).width,k=c.textAlign(M.textAlign||(M.textAlign=a.textAlign)),D=A+C+O;let N=m.x,P=m.y;c.setWidth(this.width),x?H>0&&N+D+d>this.right&&(P=m.y+=S,m.line++,N=m.x=Lr(i,this.left+d,this.right-r[m.line])):H>0&&P+S>this.bottom&&(N=m.x=N+n[m.line].width+d,m.line++,P=m.y=Lr(i,this.top+E+d,this.bottom-n[m.line].height));const F=c.x(N);if(_(F,P,M),N=W3e(k,N+A+C,x?N+D:this.right,t.rtl),w(c.x(N),P,M),x)m.x+=D+d;else if(typeof M.text!="string"){const j=u.lineHeight;m.y+=rL(M,j)+d}else m.y+=S}),DH(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=fr(n.font),o=No(n.padding);if(!n.display)return;const i=h5(t.rtl,this.left,this.width),a=this.ctx,s=n.position,c=r.size/2,u=o.top+c;let d,h=this.left,C=this.width;if(this.isHorizontal())C=Math.max(...this.lineWidths),d=this.top+u,h=Lr(t.align,h,this.right-C);else{const A=this.columnSizes.reduce((v,p)=>Math.max(v,p.height),0);d=u+Lr(t.align,this.top,this.bottom-A-t.labels.padding-this._computeTitleHeight())}const m=Lr(s,h,h+C);a.textAlign=i.textAlign(_H(s)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=r.string,k8(a,n.text,m,d,r)}_computeTitleHeight(){const t=this.options.title,n=fr(t.font),r=No(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,o,i;if(la(t,this.left,this.right)&&la(n,this.top,this.bottom)){for(i=this.legendHitBoxes,r=0;r<i.length;++r)if(o=i[r],la(t,o.left,o.left+o.width)&&la(n,o.top,o.top+o.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!Ale(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const o=this._hoveredItem,i=Cle(o,r);o&&!i&&C0(n.onLeave,[t,o,this],this),this._hoveredItem=r,r&&!i&&C0(n.onHover,[t,r,this],this)}else r&&C0(n.onClick,[t,r,this],this)}}function gle(e,t,n,r,o){const i=mle(r,e,t,n),a=ple(o,r,t.lineHeight);return{itemWidth:i,itemHeight:a}}function mle(e,t,n,r){let o=e.text;return o&&typeof o!="string"&&(o=o.reduce((i,a)=>i.length>a.length?i:a)),t+n.size/2+r.measureText(o).width}function ple(e,t,n){let r=e;return typeof t.text!="string"&&(r=rL(t,n)),r}function rL(e,t){const n=e.text?e.text.length:0;return t*n}function Ale(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Kg={id:"legend",_element:nw,start(e,t,n){const r=e.legend=new nw({ctx:e.ctx,options:n,chart:e});Ga.configure(e,r,n),Ga.addBox(e,r)},stop(e){Ga.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;Ga.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,o=n.chart;o.isDatasetVisible(r)?(o.hide(r),t.hidden=!0):(o.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:o,color:i,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const u=c.controller.getStyle(n?0:void 0),d=No(u.borderWidth);return{text:t[c.index].label,fillStyle:u.backgroundColor,fontColor:i,hidden:!c.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:u.borderColor,pointStyle:r||u.pointStyle,rotation:u.rotation,textAlign:o||u.textAlign,borderRadius:a&&(s||u.borderRadius),datasetIndex:c.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const J4={average(e){if(!e.length)return!1;let t,n,r=new Set,o=0,i=0;for(t=0,n=e.length;t<n;++t){const s=e[t].element;if(s&&s.hasValue()){const c=s.tooltipPosition();r.add(c.x),o+=c.y,++i}}return i===0||r.size===0?!1:{x:[...r].reduce((s,c)=>s+c)/r.size,y:o/i}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,o=Number.POSITIVE_INFINITY,i,a,s;for(i=0,a=e.length;i<a;++i){const c=e[i].element;if(c&&c.hasValue()){const u=c.getCenterPoint(),d=yh(t,u);d<o&&(o=d,s=c)}}if(s){const c=s.tooltipPosition();n=c.x,r=c.y}return{x:n,y:r}}};function di(e,t){return t&&(K0(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ji(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
355
355
|
`)>-1?e.split(`
|
|
356
|
-
`):e}function vle(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:a,value:s}=i.getLabelAndValue(o);return{chart:e,label:a,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:s,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function rw(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:a,boxHeight:s}=t,c=fr(t.bodyFont),u=fr(t.titleFont),d=fr(t.footerFont),h=i.length,C=o.length,m=r.length,A=No(t.padding);let v=A.height,p=0,_=r.reduce((E,S)=>E+S.before.length+S.lines.length+S.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,h&&(v+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),_){const E=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;v+=m*E+(_-m)*c.lineHeight+(_-1)*t.bodySpacing}C&&(v+=t.footerMarginTop+C*d.lineHeight+(C-1)*t.footerSpacing);let w=0;const x=function(E){p=Math.max(p,n.measureText(E).width+w)};return n.save(),n.font=u.string,J1(e.title,x),n.font=c.string,J1(e.beforeBody.concat(e.afterBody),x),w=t.displayColors?a+2+t.boxPadding:0,J1(r,E=>{J1(E.before,x),J1(E.lines,x),J1(E.after,x)}),w=0,n.font=d.string,J1(e.footer,x),n.restore(),p+=A.width,{width:p,height:v}}function ble(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function yle(e,t,n,r){const{x:o,width:i}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&o+i+a>t.width||e==="right"&&o-i-a<0)return!0}function wle(e,t,n,r){const{x:o,width:i}=n,{width:a,chartArea:{left:s,right:c}}=e;let u="center";return r==="center"?u=o<=(s+c)/2?"left":"right":o<=i/2?u="left":o>=a-i/2&&(u="right"),yle(u,e,t,n)&&(u="center"),u}function ow(e,t,n){const r=n.yAlign||t.yAlign||ble(e,n);return{xAlign:n.xAlign||t.xAlign||wle(e,t,n,r),yAlign:r}}function xle(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function _le(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function iw(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:c}=n,u=o+i,{topLeft:d,topRight:h,bottomLeft:C,bottomRight:m}=f5(a);let A=xle(t,s);const v=_le(t,c,u);return c==="center"?s==="left"?A+=u:s==="right"&&(A-=u):s==="left"?A-=Math.max(d,C)+o:s==="right"&&(A+=Math.max(h,m)+o),{x:R2(A,0,r.width-t.width),y:R2(v,0,r.height-t.height)}}function M6(e,t,n){const r=No(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function aw(e){return di([],Ji(e))}function Ele(e,t,n){return g3(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function sw(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const oL={beforeTitle:Gi,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:Gi,beforeBody:Gi,beforeLabel:Gi,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Q1(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Gi,afterBody:Gi,beforeFooter:Gi,footer:Gi,afterFooter:Gi};function lr(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?oL[t].call(n,r):o}var sh;let lw=(sh=class extends g9{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),o=r.enabled&&n.options.animation&&r.animations,i=new VH(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=Ele(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=lr(r,"beforeTitle",this,t),i=lr(r,"title",this,t),a=lr(r,"afterTitle",this,t);let s=[];return s=di(s,Ji(o)),s=di(s,Ji(i)),s=di(s,Ji(a)),s}getBeforeBody(t,n){return aw(lr(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return J1(t,i=>{const a={before:[],lines:[],after:[]},s=sw(r,i);di(a.before,Ji(lr(s,"beforeLabel",this,i))),di(a.lines,lr(s,"label",this,i)),di(a.after,Ji(lr(s,"afterLabel",this,i))),o.push(a)}),o}getAfterBody(t,n){return aw(lr(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=lr(r,"beforeFooter",this,t),i=lr(r,"footer",this,t),a=lr(r,"afterFooter",this,t);let s=[];return s=di(s,Ji(o)),s=di(s,Ji(i)),s=di(s,Ji(a)),s}_createItems(t){const n=this._active,r=this.chart.data,o=[],i=[],a=[];let s=[],c,u;for(c=0,u=n.length;c<u;++c)s.push(vle(this.chart,n[c]));return t.filter&&(s=s.filter((d,h,C)=>t.filter(d,h,C,r))),t.itemSort&&(s=s.sort((d,h)=>t.itemSort(d,h,r))),J1(s,d=>{const h=sw(t.callbacks,d);o.push(lr(h,"labelColor",this,d)),i.push(lr(h,"labelPointStyle",this,d)),a.push(lr(h,"labelTextColor",this,d))}),this.labelColors=o,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),o=this._active;let i,a=[];if(!o.length)this.opacity!==0&&(i={opacity:0});else{const s=J4[r.position].call(this,o,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const c=this._size=rw(this,r),u=Object.assign({},s,c),d=ow(this.chart,r,u),h=iw(r,u,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,i={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,o){const i=this.getCaretPosition(t,r,o);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,r){const{xAlign:o,yAlign:i}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:c,topRight:u,bottomLeft:d,bottomRight:h}=f5(s),{x:C,y:m}=t,{width:A,height:v}=n;let p,_,w,x,E,S;return i==="center"?(E=m+v/2,o==="left"?(p=C,_=p-a,x=E+a,S=E-a):(p=C+A,_=p+a,x=E-a,S=E+a),w=p):(o==="left"?_=C+Math.max(c,d)+a:o==="right"?_=C+A-Math.max(u,h)-a:_=this.caretX,i==="top"?(x=m,E=x-a,p=_-a,w=_+a):(x=m+v,E=x+a,p=_+a,w=_-a),S=x),{x1:p,x2:_,x3:w,y1:x,y2:E,y3:S}}drawTitle(t,n,r){const o=this.title,i=o.length;let a,s,c;if(i){const u=h5(r.rtl,this.x,this.width);for(t.x=M6(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",a=fr(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(o[c],u.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s,c+1===i&&(t.y+=r.titleMarginBottom-s)}}_drawColorBox(t,n,r,o,i){const a=this.labelColors[r],s=this.labelPointStyles[r],{boxHeight:c,boxWidth:u}=i,d=fr(i.bodyFont),h=M6(this,"left",i),C=o.x(h),m=c<d.lineHeight?(d.lineHeight-c)/2:0,A=n.y+m;if(i.usePointStyle){const v={radius:Math.min(u,c)/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:1},p=o.leftForLtr(C,u)+u/2,_=A+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,xh(t,v,p,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,xh(t,v,p,_)}else{t.lineWidth=y1(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const v=o.leftForLtr(C,u),p=o.leftForLtr(o.xPlus(C,1),u-2),_=f5(a.borderRadius);Object.values(_).some(w=>w!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,D8(t,{x:v,y:A,w:u,h:c,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),D8(t,{x:p,y:A+1,w:u-2,h:c-2,radius:_}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(v,A,u,c),t.strokeRect(v,A,u,c),t.fillStyle=a.backgroundColor,t.fillRect(p,A+1,u-2,c-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:o}=this,{bodySpacing:i,bodyAlign:a,displayColors:s,boxHeight:c,boxWidth:u,boxPadding:d}=r,h=fr(r.bodyFont);let C=h.lineHeight,m=0;const A=h5(r.rtl,this.x,this.width),v=function(O){n.fillText(O,A.x(t.x+m),t.y+C/2),t.y+=C+i},p=A.textAlign(a);let _,w,x,E,S,M,H;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,t.x=M6(this,p,r),n.fillStyle=r.bodyColor,J1(this.beforeBody,v),m=s&&p!=="right"?a==="center"?u/2+d:u+2+d:0,E=0,M=o.length;E<M;++E){for(_=o[E],w=this.labelTextColors[E],n.fillStyle=w,J1(_.before,v),x=_.lines,s&&x.length&&(this._drawColorBox(n,t,E,A,r),C=Math.max(h.lineHeight,c)),S=0,H=x.length;S<H;++S)v(x[S]),C=h.lineHeight;J1(_.after,v)}m=0,C=h.lineHeight,J1(this.afterBody,v),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let a,s;if(i){const c=h5(r.rtl,this.x,this.width);for(t.x=M6(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=c.textAlign(r.footerAlign),n.textBaseline="middle",a=fr(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,s=0;s<i;++s)n.fillText(o[s],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r.footerSpacing}}drawBackground(t,n,r,o){const{xAlign:i,yAlign:a}=this,{x:s,y:c}=t,{width:u,height:d}=r,{topLeft:h,topRight:C,bottomLeft:m,bottomRight:A}=f5(o.cornerRadius);n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.beginPath(),n.moveTo(s+h,c),a==="top"&&this.drawCaret(t,n,r,o),n.lineTo(s+u-C,c),n.quadraticCurveTo(s+u,c,s+u,c+C),a==="center"&&i==="right"&&this.drawCaret(t,n,r,o),n.lineTo(s+u,c+d-A),n.quadraticCurveTo(s+u,c+d,s+u-A,c+d),a==="bottom"&&this.drawCaret(t,n,r,o),n.lineTo(s+m,c+d),n.quadraticCurveTo(s,c+d,s,c+d-m),a==="center"&&i==="left"&&this.drawCaret(t,n,r,o),n.lineTo(s,c+h),n.quadraticCurveTo(s,c,s+h,c),n.closePath(),n.fill(),o.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,o=r&&r.x,i=r&&r.y;if(o||i){const a=J4[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=rw(this,t),c=Object.assign({},a,this._size),u=ow(n,t,c),d=iw(t,c,u,n);(o._to!==d.x||i._to!==d.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=No(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(i,t,o,n),kH(t,n.textDirection),i.y+=a.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),DH(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,o=t.map(({datasetIndex:s,index:c})=>{const u=this.chart.getDatasetMeta(s);if(!u)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:u.data[c],index:c}}),i=!O8(r,o),a=this._positionChanged(o,n);(i||a)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,i=this._active||[],a=this._getActiveElements(t,i,n,r),s=this._positionChanged(a,t),c=n||!O8(a,i)||s;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,r,o){const i=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,i.mode,i,r);return i.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:o,options:i}=this,a=J4[i.position].call(this,t,n);return a!==!1&&(r!==a.x||o!==a.y)}},xn(sh,"positioners",J4),sh);var Wg={id:"tooltip",_element:lw,positioners:J4,afterInit(e,t,n){n&&(e.tooltip=new lw({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:oL},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Sle=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Mle(e,t,n,r){const o=e.indexOf(t);if(o===-1)return Sle(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const Hle=(e,t)=>e===null?null:R2(Math.round(e),0,t);function cw(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Ds extends U5{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:o,label:i}of n)r[o]===i&&r.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Q1(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:Mle(r,t,C1(n,t),this._addedLabels),Hle(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(o=this.getLabels().length-1)),this.min=r,this.max=o}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,o=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=t;a<=n;a++)o.push({value:a});return o}getLabelForValue(t){return cw.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}xn(Ds,"id","category"),xn(Ds,"defaults",{ticks:{callback:cw}});function Lle(e,t){const n=[],{bounds:o,step:i,min:a,max:s,precision:c,count:u,maxTicks:d,maxDigits:h,includeBounds:C}=e,m=i||1,A=d-1,{min:v,max:p}=t,_=!Q1(a),w=!Q1(s),x=!Q1(u),E=(p-v)/(h+1);let S=iy((p-v)/A/m)*m,M,H,O,k;if(S<1e-14&&!_&&!w)return[{value:v},{value:p}];k=Math.ceil(p/S)-Math.floor(v/S),k>A&&(S=iy(k*S/A/m)*m),Q1(c)||(M=Math.pow(10,c),S=Math.ceil(S*M)/M),o==="ticks"?(H=Math.floor(v/S)*S,O=Math.ceil(p/S)*S):(H=v,O=p),_&&w&&i&&T3e((s-a)/i,S/1e3)?(k=Math.round(Math.min((s-a)/S,d)),S=(s-a)/k,H=a,O=s):x?(H=_?a:H,O=w?s:O,k=u-1,S=(O-H)/k):(k=(O-H)/S,fs(k,Math.round(k),S/1e3)?k=Math.round(k):k=Math.ceil(k));const D=Math.max(ay(S),ay(H));M=Math.pow(10,Q1(c)?D:c),H=Math.round(H*M)/M,O=Math.round(O*M)/M;let N=0;for(_&&(C&&H!==a?(n.push({value:a}),H<a&&N++,fs(Math.round((H+N*S)*M)/M,a,uw(a,E,e))&&N++):H<a&&N++);N<k;++N){const P=Math.round((H+N*S)*M)/M;if(w&&P>s)break;n.push({value:P})}return w&&C&&O!==s?n.length&&fs(n[n.length-1].value,s,uw(s,E,e))?n[n.length-1].value=s:n.push({value:s}):(!w||O===s)&&n.push({value:O}),n}function uw(e,t,{horizontal:n,minRotation:r}){const o=sa(r),i=(n?Math.sin(o):Math.cos(o))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class Ble extends U5{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Q1(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:o,max:i}=this;const a=c=>o=n?o:c,s=c=>i=r?i:c;if(t){const c=yi(o),u=yi(i);c<0&&u<0?s(0):c>0&&u>0&&a(0)}if(o===i){let c=i===0?1:Math.abs(i*.05);s(i+c),t||a(o-c)}this.min=o,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,o;return r?(o=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const o={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,a=Lle(o,i);return t.bounds==="ticks"&&F3e(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const o=(r-n)/Math.max(t.length-1,1)/2;n-=o,r+=o}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Ng(t,this.chart.options.locale,this.options.ticks.format)}}class Ps extends Ble{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=D2(t)?t:0,this.max=D2(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=sa(this.options.ticks.minRotation),o=(t?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}xn(Ps,"id","linear"),xn(Ps,"defaults",{ticks:{callback:SH.formatters.numeric}});const R7={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},dr=Object.keys(R7);function dw(e,t){return e-t}function fw(e,t){if(Q1(t))return null;const n=e._adapter,{parser:r,round:o,isoWeekday:i}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),D2(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(o&&(a=o==="week"&&(Os(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,o)),+a)}function hw(e,t,n,r){const o=dr.length;for(let i=dr.indexOf(e);i<o-1;++i){const a=R7[dr[i]],s=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(s*a.size))<=r)return dr[i]}return dr[o-1]}function Ole(e,t,n,r,o){for(let i=dr.length-1;i>=dr.indexOf(n);i--){const a=dr[i];if(R7[a].common&&e._adapter.diff(o,r,a)>=t-1)return a}return dr[n?dr.indexOf(n):0]}function Rle(e){for(let t=dr.indexOf(e)+1,n=dr.length;t<n;++t)if(R7[dr[t]].common)return dr[t]}function Cw(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=Dg(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function Ile(e,t,n,r){const o=e._adapter,i=+o.startOf(t[0].value,r),a=t[t.length-1].value;let s,c;for(s=i;s<=a;s=+o.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function gw(e,t,n){const r=[],o={},i=t.length;let a,s;for(a=0;a<i;++a)s=t[a],o[s]=a,r.push({value:s,major:!1});return i===0||!n?r:Ile(e,r,o,n)}class F8 extends U5{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),o=this._adapter=new b4e._date(t.adapters.date);o.init(n),ds(r.displayFormats,o.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:fw(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:o,max:i,minDefined:a,maxDefined:s}=this.getUserBounds();function c(u){!a&&!isNaN(u.min)&&(o=Math.min(o,u.min)),!s&&!isNaN(u.max)&&(i=Math.max(i,u.max))}(!a||!s)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),o=D2(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=D2(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(o,i-1),this.max=Math.max(o+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,o=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const i=this.min,a=this.max,s=U3e(o,i,a);return this._unit=n.unit||(r.autoSkip?hw(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):Ole(this,s.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:Rle(this._unit),this.initOffsets(o),t.reverse&&s.reverse(),gw(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,o,i;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?r=i:r=(i-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=R2(n,0,a),r=R2(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,o=this.options,i=o.time,a=i.unit||hw(i.minUnit,n,r,this._getLabelCapacity(n)),s=C1(o.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,u=Os(c)||c===!0,d={};let h=n,C,m;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const A=o.ticks.source==="data"&&this.getDataTimestamps();for(C=h,m=0;C<r;C=+t.add(C,s,a),m++)Cw(d,C,A);return(C===r||o.bounds==="ticks"||m===1)&&Cw(d,C,A),Object.keys(d).sort(dw).map(v=>+v)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,i=this._unit,a=n||o[i];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,o){const i=this.options,a=i.ticks.callback;if(a)return C0(a,[t,n,r],this);const s=i.time.displayFormats,c=this._unit,u=this._majorUnit,d=c&&s[c],h=u&&s[u],C=r[n],m=u&&h&&C&&C.major;return this._adapter.format(t,o||(m?h:d))}generateTickLabels(t){let n,r,o;for(n=0,r=t.length;n<r;++n)o=t[n],o.label=this._tickFormatFunction(o.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,o=sa(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(o),a=Math.sin(o),s=this._resolveTickFontOptions(0).size;return{w:r*i+s*a,h:r*a+s*i}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,o=r[n.unit]||r.millisecond,i=this._tickFormatFunction(t,0,gw(this,[t],this._majorUnit),o),a=this._getLabelSize(i),s=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return s>0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,r=o.length;n<r;++n)t=t.concat(o[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const o=this.getLabels();for(n=0,r=o.length;n<r;++n)t.push(fw(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return yH(t.sort(dw))}}xn(F8,"id","time"),xn(F8,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function H6(e,t,n){let r=0,o=e.length-1,i,a,s,c;n?(t>=e[r].pos&&t<=e[o].pos&&({lo:r,hi:o}=K9(e,"pos",t)),{pos:i,time:s}=e[r],{pos:a,time:c}=e[o]):(t>=e[r].time&&t<=e[o].time&&({lo:r,hi:o}=K9(e,"time",t)),{time:i,pos:s}=e[r],{time:a,pos:c}=e[o]);const u=a-i;return u?s+(c-s)*(t-i)/u:s}class mw extends F8{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=H6(n,this.min),this._tableRange=H6(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,o=[],i=[];let a,s,c,u,d;for(a=0,s=t.length;a<s;++a)u=t[a],u>=n&&u<=r&&o.push(u);if(o.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=o.length;a<s;++a)d=o[a+1],c=o[a-1],u=o[a],Math.round((d+c)/2)!==u&&i.push({time:u,pos:a/(s-1)});return i}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((o,i)=>o-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(H6(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return H6(this._table,r*this._tableRange+this._minPos,!0)}}xn(mw,"id","timeseries"),xn(mw,"defaults",F8.defaults);const iL="label";function pw(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function kle(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function aL(e,t){e.labels=t}function sL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:iL;const r=[];e.datasets=t.map(o=>{const i=e.datasets.find(a=>a[n]===o[n]);return!i||!o.data||r.includes(i)?{...o}:(r.push(i),Object.assign(i,o),i)})}function Dle(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:iL;const n={labels:[],datasets:[]};return aL(n,e.labels),sL(n,e.datasets,t),n}function Ple(e,t){const{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:i,type:a,data:s,options:c,plugins:u=[],fallbackContent:d,updateMode:h,...C}=e,m=R.useRef(null),A=R.useRef(null),v=()=>{m.current&&(A.current=new $5(m.current,{type:a,data:Dle(s,i),options:c&&{...c},plugins:u}),pw(t,A.current))},p=()=>{pw(t,null),A.current&&(A.current.destroy(),A.current=null)};return R.useEffect(()=>{!o&&A.current&&c&&kle(A.current,c)},[o,c]),R.useEffect(()=>{!o&&A.current&&aL(A.current.config.data,s.labels)},[o,s.labels]),R.useEffect(()=>{!o&&A.current&&s.datasets&&sL(A.current.config.data,s.datasets,i)},[o,s.datasets]),R.useEffect(()=>{A.current&&(o?(p(),setTimeout(v)):A.current.update(h))},[o,c,s.labels,s.datasets,h]),R.useEffect(()=>{A.current&&(p(),setTimeout(v))},[a]),R.useEffect(()=>(v(),()=>p()),[]),R.createElement("canvas",{ref:m,role:"img",height:n,width:r,...C},d)}const Nle=R.forwardRef(Ple);function I7(e,t){return $5.register(t),R.forwardRef((n,r)=>R.createElement(Nle,{...n,ref:r,type:e}))}const Tle=I7("line",zc),Fle=I7("bar",jc),Vle=I7("doughnut",i5),jle=I7("pie",_h);function zle({input:e,type:t,lineVariant:n,lineTension:r,opacity:o,lineStroke:i,colors:a}){const s=a,c=t==="doughnut"||t==="pie";return{labels:e.labels,datasets:e.datasets.map((u,d)=>{var h;return c?{label:u.label,data:u.data,backgroundColor:u.colors&&u.colors.length===u.data.length?(h=u.colors)==null?void 0:h.map(C=>sf(C,o)):u.data.map((C,m)=>sf(s[m%s.length],o)),borderColor:u.colors&&u.colors.length===u.data.length?u.colors:u.data.map((C,m)=>s[m%s.length]),borderWidth:2}:{label:u.label,data:u.data,backgroundColor:sf(u.color||s[d%s.length],o),borderColor:u.color||s[d%s.length],borderWidth:t==="line"?i:1,fill:n=="fill",tension:r??.4}})}}function Zle({barVariant:e,type:t}){const r={responsive:!0,plugins:{legend:{position:"bottom",labels:{font:{family:"Inter"},usePointStyle:!0,pointStyle:"circle",textAlign:"center"}},tooltip:{bodyFont:{family:"Inter"},titleFont:{family:"Inter"}}},scales:t==="doughnut"||t==="pie"?{}:{x:{ticks:{font:{family:"DM Mono"}},title:{font:{size:12,family:"Inter"}}},y:{ticks:{font:{family:"DM Mono"}},title:{font:{size:12,family:"Inter"}}}}};return t==="bar"&&e=="stacked"?cl.merge({},r,{scales:{x:{stacked:!0},y:{stacked:!0}}}):r}function sf(e,t=.1){if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)){let r=e.substring(1);r.length===3&&(r=r.split("").map(s=>s+s).join(""));const o=parseInt(r.substring(0,2),16),i=parseInt(r.substring(2,4),16),a=parseInt(r.substring(4,6),16);return`rgba(${o}, ${i}, ${a}, ${t})`}else if(e.startsWith("rgba")){const[r,o,i]=e.substring(5,e.length-1).split(",").map(a=>a.trim()).slice(0,3);return`rgba(${r}, ${o}, ${i}, ${t})`}else if(e.startsWith("rgb")){const[r,o,i]=e.substring(4,e.length-1).split(",").map(a=>a.trim());return`rgba(${r}, ${o}, ${i}, ${t})`}else throw new Error(`Unsupported color format: ${e}`)}let Aw=!1;function Ule(){Aw||($5.register(Ds,Ps,Kc,Wg,Kg),Aw=!0)}let vw=!1;function $le(){vw||($5.register(X4,Wg,Kg,Ds,Ps),vw=!0)}let bw=!1;function Kle(){bw||($5.register(Ds,Ps,$c,Ya,Wg,Kg,hle),bw=!0)}const Wle=({type:e,data:t,options:n,barVariant:r,lineVariant:o,lineTension:i,opacity:a=.1,lineStroke:s,width:c,height:u,backgroundColor:d,className:h="",colors:C=["#4e79a7","#f28e2b","#e15759","#76b7b2"]})=>{e==="line"?Kle():e==="bar"?Ule():(e==="doughnut"||e==="pie")&&$le();const m=zle({input:t,type:e,lineVariant:o,lineTension:i,opacity:a,lineStroke:s,colors:C}),A=cl.merge({maintainAspectRatio:!1},Zle({type:e,barVariant:r}),n),p={line:Tle,bar:Fle,doughnut:Vle,pie:jle}[e];return Z.jsx(p,{data:m,options:A,style:{width:c,height:u,backgroundColor:d},className:`awi-chart ${h}`})},a5=(e,t)=>{const n=e;return isNaN(n.getTime())?"":t==="date"?n.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric"}):n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})},I4={app:"cube",source:"source",severity:"warning_triangle",date:"calendar",time:"clock"},Qle={app:"appName",source:"location",severity:"severity",date:"timeStamp",time:"timeStamp"},yw=(e,t,n)=>{const r=t==null?void 0:t[Qle[e]];switch(e){case"app":return Z.jsxs("section",{className:"app_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"source":return Z.jsxs("section",{className:"source_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"severity":return Z.jsxs("section",{className:"severity_section event_element",style:n,children:[Z.jsx("span",{className:"status_indicator",style:{background:t==null?void 0:t.color}}),Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"date":{const o=a5(r,"date");return Z.jsxs("section",{className:"date_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:o,children:o})]})}case"time":{const o=a5(r,"time");return Z.jsxs("section",{className:"time_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:o,children:o})]})}}},lL=({variant:e="new",data:t,width:n="100%",height:r="100%",className:o,sidePanelItems:i=["source","severity","date","time"],headerItem:a,headerHeight:s="20%",imageFit:c="cover",imageWidth:u="50%",isFocused:d=!1,focusedBorderColor:h="#ffcc00",focusedBorderThickness:C="2px",surfaceColor:m="#fff",surfaceBorderColor:A="#eaebee",surfaceSecondaryColor:v="#f3f5f7",textPrimaryColor:p="#292929",textSecondaryColor:_="#474747",fontSize:w="14px"})=>{switch(a==null&&(s="0%"),e){case"new":return Z.jsxs("div",{className:"compact_event_card_new "+(o||"")+" "+(d?"focused":""),style:{width:n,height:r,"--c_focused_border_color":h,"--c_focused_border_thickness":C,"--c_surface_primary":m,"--c_surface_primary_border":A,"--c_surface_secondary":v,"--c_data_color":t==null?void 0:t.color,"--c_text_primary":p,"--c_text_secondary":_,"--font_s":w},children:[a!=null?yw(a,t,{height:s,minHeight:s,maxHeight:s}):Z.jsx(Z.Fragment,{}),Z.jsx("img",{src:t==null?void 0:t.frameUrl,alt:"Alert",style:{objectFit:c,width:u,minWidth:u,maxWidth:u,height:`calc(100% - ${s})`,minHeight:`calc(100% - ${s})`,maxHeight:`calc(100% - ${s})`}}),Z.jsx("span",{className:"compact_event_card_content",style:{width:`calc(100% - ${u})`,minWidth:`calc(100% - ${u})`,maxWidth:`calc(100% - ${u})`,height:`calc(100% - ${s})`,minHeight:`calc(100% - ${s})`,maxHeight:`calc(100% - ${s})`},children:i.map(x=>yw(x,t))})]});case"old":return Z.jsxs("div",{className:"compact_event_card "+(o||"")+" "+(d?"focused":""),style:{width:n,height:r,"--c_focused_border_color":h,"--c_focused_border_thickness":C,"--c_surface_primary":m,"--c_surface_primary_border":A,"--c_surface_secondary":v,"--c_data_color":t==null?void 0:t.color,"--c_text_primary":p,"--c_text_secondary":_,"--font_s":w},children:[Z.jsx("img",{src:t==null?void 0:t.frameUrl,alt:"Alert"}),Z.jsxs("span",{className:"compact_event_card_content",children:[Z.jsx("header",{children:Z.jsx("h6",{children:t.appName})}),Z.jsxs("section",{className:"compact_event_card_details",children:[Z.jsx("h6",{children:t.location}),Z.jsxs("span",{children:[Z.jsx("p",{children:"Date"}),Z.jsx("h6",{title:a5(t==null?void 0:t.timeStamp,"date"),children:a5(t==null?void 0:t.timeStamp,"date")})]}),Z.jsxs("span",{children:[Z.jsx("p",{children:"Time"}),Z.jsx("h6",{title:a5(t==null?void 0:t.timeStamp,"time"),className:"font_secondary",children:a5(t==null?void 0:t.timeStamp,"time")})]})]}),Z.jsxs("footer",{children:[Z.jsx("span",{className:"status_indicator",style:{background:`linear-gradient(90deg, rgba(0,0,0,0), ${t==null?void 0:t.color})`}}),Z.jsx("p",{className:"font_secondary",children:t==null?void 0:t.severity})]})]})]})}},Gle={s:"18.75rem",m:"25rem",l:"31.25rem"},r3=({className:e="",value:t=void 0,height:n="m",width:r="24rem",placement:o="flex-start",icon:i,backgroundColor:a,textColor:s,borderColor:c,disabledColor:u,iconPosition:d="after",iconColor:h="#292929",disabled:C=!1,onChange:m=()=>{},...A})=>(r=r||Gle[n],Z.jsxs("div",{className:`input_wrapper h_${n} ${C?"disabled":""} icon_${d}`,style:{width:r,minWidth:r,justifyContent:o,"--c_input_text":s,"--c_input_border":c,"--c_input_background":a,"--c_input_background_disabled":u},children:[i&&Z.jsx(W2,{name:i,color:h}),Z.jsx("input",{disabled:C,className:`input ${e}`,value:t,onChange:m,...A})]}));var lf={exports:{}};/*!
|
|
356
|
+
`):e}function vle(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:a,value:s}=i.getLabelAndValue(o);return{chart:e,label:a,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:s,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function rw(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:a,boxHeight:s}=t,c=fr(t.bodyFont),u=fr(t.titleFont),d=fr(t.footerFont),h=i.length,C=o.length,m=r.length,A=No(t.padding);let v=A.height,p=0,_=r.reduce((E,S)=>E+S.before.length+S.lines.length+S.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,h&&(v+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),_){const E=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;v+=m*E+(_-m)*c.lineHeight+(_-1)*t.bodySpacing}C&&(v+=t.footerMarginTop+C*d.lineHeight+(C-1)*t.footerSpacing);let w=0;const x=function(E){p=Math.max(p,n.measureText(E).width+w)};return n.save(),n.font=u.string,J1(e.title,x),n.font=c.string,J1(e.beforeBody.concat(e.afterBody),x),w=t.displayColors?a+2+t.boxPadding:0,J1(r,E=>{J1(E.before,x),J1(E.lines,x),J1(E.after,x)}),w=0,n.font=d.string,J1(e.footer,x),n.restore(),p+=A.width,{width:p,height:v}}function ble(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function yle(e,t,n,r){const{x:o,width:i}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&o+i+a>t.width||e==="right"&&o-i-a<0)return!0}function wle(e,t,n,r){const{x:o,width:i}=n,{width:a,chartArea:{left:s,right:c}}=e;let u="center";return r==="center"?u=o<=(s+c)/2?"left":"right":o<=i/2?u="left":o>=a-i/2&&(u="right"),yle(u,e,t,n)&&(u="center"),u}function ow(e,t,n){const r=n.yAlign||t.yAlign||ble(e,n);return{xAlign:n.xAlign||t.xAlign||wle(e,t,n,r),yAlign:r}}function xle(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function _le(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function iw(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:c}=n,u=o+i,{topLeft:d,topRight:h,bottomLeft:C,bottomRight:m}=f5(a);let A=xle(t,s);const v=_le(t,c,u);return c==="center"?s==="left"?A+=u:s==="right"&&(A-=u):s==="left"?A-=Math.max(d,C)+o:s==="right"&&(A+=Math.max(h,m)+o),{x:R2(A,0,r.width-t.width),y:R2(v,0,r.height-t.height)}}function M6(e,t,n){const r=No(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function aw(e){return di([],Ji(e))}function Ele(e,t,n){return g3(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function sw(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const oL={beforeTitle:Gi,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:Gi,beforeBody:Gi,beforeLabel:Gi,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Q1(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Gi,afterBody:Gi,beforeFooter:Gi,footer:Gi,afterFooter:Gi};function lr(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?oL[t].call(n,r):o}var sh;let lw=(sh=class extends g9{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),o=r.enabled&&n.options.animation&&r.animations,i=new VH(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=Ele(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=lr(r,"beforeTitle",this,t),i=lr(r,"title",this,t),a=lr(r,"afterTitle",this,t);let s=[];return s=di(s,Ji(o)),s=di(s,Ji(i)),s=di(s,Ji(a)),s}getBeforeBody(t,n){return aw(lr(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return J1(t,i=>{const a={before:[],lines:[],after:[]},s=sw(r,i);di(a.before,Ji(lr(s,"beforeLabel",this,i))),di(a.lines,lr(s,"label",this,i)),di(a.after,Ji(lr(s,"afterLabel",this,i))),o.push(a)}),o}getAfterBody(t,n){return aw(lr(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=lr(r,"beforeFooter",this,t),i=lr(r,"footer",this,t),a=lr(r,"afterFooter",this,t);let s=[];return s=di(s,Ji(o)),s=di(s,Ji(i)),s=di(s,Ji(a)),s}_createItems(t){const n=this._active,r=this.chart.data,o=[],i=[],a=[];let s=[],c,u;for(c=0,u=n.length;c<u;++c)s.push(vle(this.chart,n[c]));return t.filter&&(s=s.filter((d,h,C)=>t.filter(d,h,C,r))),t.itemSort&&(s=s.sort((d,h)=>t.itemSort(d,h,r))),J1(s,d=>{const h=sw(t.callbacks,d);o.push(lr(h,"labelColor",this,d)),i.push(lr(h,"labelPointStyle",this,d)),a.push(lr(h,"labelTextColor",this,d))}),this.labelColors=o,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),o=this._active;let i,a=[];if(!o.length)this.opacity!==0&&(i={opacity:0});else{const s=J4[r.position].call(this,o,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const c=this._size=rw(this,r),u=Object.assign({},s,c),d=ow(this.chart,r,u),h=iw(r,u,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,i={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,o){const i=this.getCaretPosition(t,r,o);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,r){const{xAlign:o,yAlign:i}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:c,topRight:u,bottomLeft:d,bottomRight:h}=f5(s),{x:C,y:m}=t,{width:A,height:v}=n;let p,_,w,x,E,S;return i==="center"?(E=m+v/2,o==="left"?(p=C,_=p-a,x=E+a,S=E-a):(p=C+A,_=p+a,x=E-a,S=E+a),w=p):(o==="left"?_=C+Math.max(c,d)+a:o==="right"?_=C+A-Math.max(u,h)-a:_=this.caretX,i==="top"?(x=m,E=x-a,p=_-a,w=_+a):(x=m+v,E=x+a,p=_+a,w=_-a),S=x),{x1:p,x2:_,x3:w,y1:x,y2:E,y3:S}}drawTitle(t,n,r){const o=this.title,i=o.length;let a,s,c;if(i){const u=h5(r.rtl,this.x,this.width);for(t.x=M6(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",a=fr(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(o[c],u.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s,c+1===i&&(t.y+=r.titleMarginBottom-s)}}_drawColorBox(t,n,r,o,i){const a=this.labelColors[r],s=this.labelPointStyles[r],{boxHeight:c,boxWidth:u}=i,d=fr(i.bodyFont),h=M6(this,"left",i),C=o.x(h),m=c<d.lineHeight?(d.lineHeight-c)/2:0,A=n.y+m;if(i.usePointStyle){const v={radius:Math.min(u,c)/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:1},p=o.leftForLtr(C,u)+u/2,_=A+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,xh(t,v,p,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,xh(t,v,p,_)}else{t.lineWidth=y1(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const v=o.leftForLtr(C,u),p=o.leftForLtr(o.xPlus(C,1),u-2),_=f5(a.borderRadius);Object.values(_).some(w=>w!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,D8(t,{x:v,y:A,w:u,h:c,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),D8(t,{x:p,y:A+1,w:u-2,h:c-2,radius:_}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(v,A,u,c),t.strokeRect(v,A,u,c),t.fillStyle=a.backgroundColor,t.fillRect(p,A+1,u-2,c-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:o}=this,{bodySpacing:i,bodyAlign:a,displayColors:s,boxHeight:c,boxWidth:u,boxPadding:d}=r,h=fr(r.bodyFont);let C=h.lineHeight,m=0;const A=h5(r.rtl,this.x,this.width),v=function(O){n.fillText(O,A.x(t.x+m),t.y+C/2),t.y+=C+i},p=A.textAlign(a);let _,w,x,E,S,M,H;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,t.x=M6(this,p,r),n.fillStyle=r.bodyColor,J1(this.beforeBody,v),m=s&&p!=="right"?a==="center"?u/2+d:u+2+d:0,E=0,M=o.length;E<M;++E){for(_=o[E],w=this.labelTextColors[E],n.fillStyle=w,J1(_.before,v),x=_.lines,s&&x.length&&(this._drawColorBox(n,t,E,A,r),C=Math.max(h.lineHeight,c)),S=0,H=x.length;S<H;++S)v(x[S]),C=h.lineHeight;J1(_.after,v)}m=0,C=h.lineHeight,J1(this.afterBody,v),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let a,s;if(i){const c=h5(r.rtl,this.x,this.width);for(t.x=M6(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=c.textAlign(r.footerAlign),n.textBaseline="middle",a=fr(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,s=0;s<i;++s)n.fillText(o[s],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r.footerSpacing}}drawBackground(t,n,r,o){const{xAlign:i,yAlign:a}=this,{x:s,y:c}=t,{width:u,height:d}=r,{topLeft:h,topRight:C,bottomLeft:m,bottomRight:A}=f5(o.cornerRadius);n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.beginPath(),n.moveTo(s+h,c),a==="top"&&this.drawCaret(t,n,r,o),n.lineTo(s+u-C,c),n.quadraticCurveTo(s+u,c,s+u,c+C),a==="center"&&i==="right"&&this.drawCaret(t,n,r,o),n.lineTo(s+u,c+d-A),n.quadraticCurveTo(s+u,c+d,s+u-A,c+d),a==="bottom"&&this.drawCaret(t,n,r,o),n.lineTo(s+m,c+d),n.quadraticCurveTo(s,c+d,s,c+d-m),a==="center"&&i==="left"&&this.drawCaret(t,n,r,o),n.lineTo(s,c+h),n.quadraticCurveTo(s,c,s+h,c),n.closePath(),n.fill(),o.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,o=r&&r.x,i=r&&r.y;if(o||i){const a=J4[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=rw(this,t),c=Object.assign({},a,this._size),u=ow(n,t,c),d=iw(t,c,u,n);(o._to!==d.x||i._to!==d.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=No(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(i,t,o,n),kH(t,n.textDirection),i.y+=a.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),DH(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,o=t.map(({datasetIndex:s,index:c})=>{const u=this.chart.getDatasetMeta(s);if(!u)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:u.data[c],index:c}}),i=!O8(r,o),a=this._positionChanged(o,n);(i||a)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,i=this._active||[],a=this._getActiveElements(t,i,n,r),s=this._positionChanged(a,t),c=n||!O8(a,i)||s;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,r,o){const i=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,i.mode,i,r);return i.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:o,options:i}=this,a=J4[i.position].call(this,t,n);return a!==!1&&(r!==a.x||o!==a.y)}},xn(sh,"positioners",J4),sh);var Wg={id:"tooltip",_element:lw,positioners:J4,afterInit(e,t,n){n&&(e.tooltip=new lw({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:oL},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Sle=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Mle(e,t,n,r){const o=e.indexOf(t);if(o===-1)return Sle(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const Hle=(e,t)=>e===null?null:R2(Math.round(e),0,t);function cw(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Ds extends U5{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:o,label:i}of n)r[o]===i&&r.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Q1(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:Mle(r,t,C1(n,t),this._addedLabels),Hle(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(o=this.getLabels().length-1)),this.min=r,this.max=o}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,o=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=t;a<=n;a++)o.push({value:a});return o}getLabelForValue(t){return cw.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}xn(Ds,"id","category"),xn(Ds,"defaults",{ticks:{callback:cw}});function Lle(e,t){const n=[],{bounds:o,step:i,min:a,max:s,precision:c,count:u,maxTicks:d,maxDigits:h,includeBounds:C}=e,m=i||1,A=d-1,{min:v,max:p}=t,_=!Q1(a),w=!Q1(s),x=!Q1(u),E=(p-v)/(h+1);let S=iy((p-v)/A/m)*m,M,H,O,k;if(S<1e-14&&!_&&!w)return[{value:v},{value:p}];k=Math.ceil(p/S)-Math.floor(v/S),k>A&&(S=iy(k*S/A/m)*m),Q1(c)||(M=Math.pow(10,c),S=Math.ceil(S*M)/M),o==="ticks"?(H=Math.floor(v/S)*S,O=Math.ceil(p/S)*S):(H=v,O=p),_&&w&&i&&T3e((s-a)/i,S/1e3)?(k=Math.round(Math.min((s-a)/S,d)),S=(s-a)/k,H=a,O=s):x?(H=_?a:H,O=w?s:O,k=u-1,S=(O-H)/k):(k=(O-H)/S,fs(k,Math.round(k),S/1e3)?k=Math.round(k):k=Math.ceil(k));const D=Math.max(ay(S),ay(H));M=Math.pow(10,Q1(c)?D:c),H=Math.round(H*M)/M,O=Math.round(O*M)/M;let N=0;for(_&&(C&&H!==a?(n.push({value:a}),H<a&&N++,fs(Math.round((H+N*S)*M)/M,a,uw(a,E,e))&&N++):H<a&&N++);N<k;++N){const P=Math.round((H+N*S)*M)/M;if(w&&P>s)break;n.push({value:P})}return w&&C&&O!==s?n.length&&fs(n[n.length-1].value,s,uw(s,E,e))?n[n.length-1].value=s:n.push({value:s}):(!w||O===s)&&n.push({value:O}),n}function uw(e,t,{horizontal:n,minRotation:r}){const o=sa(r),i=(n?Math.sin(o):Math.cos(o))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class Ble extends U5{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Q1(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:o,max:i}=this;const a=c=>o=n?o:c,s=c=>i=r?i:c;if(t){const c=yi(o),u=yi(i);c<0&&u<0?s(0):c>0&&u>0&&a(0)}if(o===i){let c=i===0?1:Math.abs(i*.05);s(i+c),t||a(o-c)}this.min=o,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,o;return r?(o=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const o={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,a=Lle(o,i);return t.bounds==="ticks"&&F3e(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const o=(r-n)/Math.max(t.length-1,1)/2;n-=o,r+=o}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Ng(t,this.chart.options.locale,this.options.ticks.format)}}class Ps extends Ble{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=D2(t)?t:0,this.max=D2(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=sa(this.options.ticks.minRotation),o=(t?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}xn(Ps,"id","linear"),xn(Ps,"defaults",{ticks:{callback:SH.formatters.numeric}});const R7={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},dr=Object.keys(R7);function dw(e,t){return e-t}function fw(e,t){if(Q1(t))return null;const n=e._adapter,{parser:r,round:o,isoWeekday:i}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),D2(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(o&&(a=o==="week"&&(Os(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,o)),+a)}function hw(e,t,n,r){const o=dr.length;for(let i=dr.indexOf(e);i<o-1;++i){const a=R7[dr[i]],s=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(s*a.size))<=r)return dr[i]}return dr[o-1]}function Ole(e,t,n,r,o){for(let i=dr.length-1;i>=dr.indexOf(n);i--){const a=dr[i];if(R7[a].common&&e._adapter.diff(o,r,a)>=t-1)return a}return dr[n?dr.indexOf(n):0]}function Rle(e){for(let t=dr.indexOf(e)+1,n=dr.length;t<n;++t)if(R7[dr[t]].common)return dr[t]}function Cw(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=Dg(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function Ile(e,t,n,r){const o=e._adapter,i=+o.startOf(t[0].value,r),a=t[t.length-1].value;let s,c;for(s=i;s<=a;s=+o.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function gw(e,t,n){const r=[],o={},i=t.length;let a,s;for(a=0;a<i;++a)s=t[a],o[s]=a,r.push({value:s,major:!1});return i===0||!n?r:Ile(e,r,o,n)}class F8 extends U5{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),o=this._adapter=new b4e._date(t.adapters.date);o.init(n),ds(r.displayFormats,o.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:fw(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:o,max:i,minDefined:a,maxDefined:s}=this.getUserBounds();function c(u){!a&&!isNaN(u.min)&&(o=Math.min(o,u.min)),!s&&!isNaN(u.max)&&(i=Math.max(i,u.max))}(!a||!s)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),o=D2(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=D2(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(o,i-1),this.max=Math.max(o+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,o=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const i=this.min,a=this.max,s=U3e(o,i,a);return this._unit=n.unit||(r.autoSkip?hw(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):Ole(this,s.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:Rle(this._unit),this.initOffsets(o),t.reverse&&s.reverse(),gw(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,o,i;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?r=i:r=(i-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=R2(n,0,a),r=R2(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,o=this.options,i=o.time,a=i.unit||hw(i.minUnit,n,r,this._getLabelCapacity(n)),s=C1(o.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,u=Os(c)||c===!0,d={};let h=n,C,m;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const A=o.ticks.source==="data"&&this.getDataTimestamps();for(C=h,m=0;C<r;C=+t.add(C,s,a),m++)Cw(d,C,A);return(C===r||o.bounds==="ticks"||m===1)&&Cw(d,C,A),Object.keys(d).sort(dw).map(v=>+v)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,i=this._unit,a=n||o[i];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,o){const i=this.options,a=i.ticks.callback;if(a)return C0(a,[t,n,r],this);const s=i.time.displayFormats,c=this._unit,u=this._majorUnit,d=c&&s[c],h=u&&s[u],C=r[n],m=u&&h&&C&&C.major;return this._adapter.format(t,o||(m?h:d))}generateTickLabels(t){let n,r,o;for(n=0,r=t.length;n<r;++n)o=t[n],o.label=this._tickFormatFunction(o.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,o=sa(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(o),a=Math.sin(o),s=this._resolveTickFontOptions(0).size;return{w:r*i+s*a,h:r*a+s*i}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,o=r[n.unit]||r.millisecond,i=this._tickFormatFunction(t,0,gw(this,[t],this._majorUnit),o),a=this._getLabelSize(i),s=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return s>0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,r=o.length;n<r;++n)t=t.concat(o[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const o=this.getLabels();for(n=0,r=o.length;n<r;++n)t.push(fw(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return yH(t.sort(dw))}}xn(F8,"id","time"),xn(F8,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function H6(e,t,n){let r=0,o=e.length-1,i,a,s,c;n?(t>=e[r].pos&&t<=e[o].pos&&({lo:r,hi:o}=K9(e,"pos",t)),{pos:i,time:s}=e[r],{pos:a,time:c}=e[o]):(t>=e[r].time&&t<=e[o].time&&({lo:r,hi:o}=K9(e,"time",t)),{time:i,pos:s}=e[r],{time:a,pos:c}=e[o]);const u=a-i;return u?s+(c-s)*(t-i)/u:s}class mw extends F8{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=H6(n,this.min),this._tableRange=H6(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,o=[],i=[];let a,s,c,u,d;for(a=0,s=t.length;a<s;++a)u=t[a],u>=n&&u<=r&&o.push(u);if(o.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=o.length;a<s;++a)d=o[a+1],c=o[a-1],u=o[a],Math.round((d+c)/2)!==u&&i.push({time:u,pos:a/(s-1)});return i}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((o,i)=>o-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(H6(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return H6(this._table,r*this._tableRange+this._minPos,!0)}}xn(mw,"id","timeseries"),xn(mw,"defaults",F8.defaults);const iL="label";function pw(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function kle(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function aL(e,t){e.labels=t}function sL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:iL;const r=[];e.datasets=t.map(o=>{const i=e.datasets.find(a=>a[n]===o[n]);return!i||!o.data||r.includes(i)?{...o}:(r.push(i),Object.assign(i,o),i)})}function Dle(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:iL;const n={labels:[],datasets:[]};return aL(n,e.labels),sL(n,e.datasets,t),n}function Ple(e,t){const{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:i,type:a,data:s,options:c,plugins:u=[],fallbackContent:d,updateMode:h,...C}=e,m=R.useRef(null),A=R.useRef(null),v=()=>{m.current&&(A.current=new $5(m.current,{type:a,data:Dle(s,i),options:c&&{...c},plugins:u}),pw(t,A.current))},p=()=>{pw(t,null),A.current&&(A.current.destroy(),A.current=null)};return R.useEffect(()=>{!o&&A.current&&c&&kle(A.current,c)},[o,c]),R.useEffect(()=>{!o&&A.current&&aL(A.current.config.data,s.labels)},[o,s.labels]),R.useEffect(()=>{!o&&A.current&&s.datasets&&sL(A.current.config.data,s.datasets,i)},[o,s.datasets]),R.useEffect(()=>{A.current&&(o?(p(),setTimeout(v)):A.current.update(h))},[o,c,s.labels,s.datasets,h]),R.useEffect(()=>{A.current&&(p(),setTimeout(v))},[a]),R.useEffect(()=>(v(),()=>p()),[]),R.createElement("canvas",{ref:m,role:"img",height:n,width:r,...C},d)}const Nle=R.forwardRef(Ple);function I7(e,t){return $5.register(t),R.forwardRef((n,r)=>R.createElement(Nle,{...n,ref:r,type:e}))}const Tle=I7("line",zc),Fle=I7("bar",jc),Vle=I7("doughnut",i5),jle=I7("pie",_h);function zle({input:e,type:t,lineVariant:n,lineTension:r,opacity:o,lineStroke:i,colors:a}){const s=a,c=t==="doughnut"||t==="pie";return{labels:e.labels,datasets:e.datasets.map((u,d)=>{var h;return c?{label:u.label,data:u.data,backgroundColor:u.colors&&u.colors.length===u.data.length?(h=u.colors)==null?void 0:h.map(C=>sf(C,o)):u.data.map((C,m)=>sf(s[m%s.length],o)),borderColor:u.colors&&u.colors.length===u.data.length?u.colors:u.data.map((C,m)=>s[m%s.length]),borderWidth:2}:{label:u.label,data:u.data,backgroundColor:sf(u.color||s[d%s.length],o),borderColor:u.color||s[d%s.length],borderWidth:t==="line"?i:1,fill:n=="fill",tension:r??.4}})}}function Zle({barVariant:e,type:t}){const r={responsive:!0,plugins:{legend:{position:"bottom",labels:{font:{family:"Inter"},usePointStyle:!0,pointStyle:"circle",textAlign:"center"}},tooltip:{bodyFont:{family:"Inter"},titleFont:{family:"Inter"}}},scales:t==="doughnut"||t==="pie"?{}:{x:{ticks:{font:{family:"DM Mono"}},title:{font:{size:12,family:"Inter"}}},y:{ticks:{font:{family:"DM Mono"}},title:{font:{size:12,family:"Inter"}}}}};return t==="bar"&&e=="stacked"?cl.merge({},r,{scales:{x:{stacked:!0},y:{stacked:!0}}}):r}function sf(e,t=.1){if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)){let r=e.substring(1);r.length===3&&(r=r.split("").map(s=>s+s).join(""));const o=parseInt(r.substring(0,2),16),i=parseInt(r.substring(2,4),16),a=parseInt(r.substring(4,6),16);return`rgba(${o}, ${i}, ${a}, ${t})`}else if(e.startsWith("rgba")){const[r,o,i]=e.substring(5,e.length-1).split(",").map(a=>a.trim()).slice(0,3);return`rgba(${r}, ${o}, ${i}, ${t})`}else if(e.startsWith("rgb")){const[r,o,i]=e.substring(4,e.length-1).split(",").map(a=>a.trim());return`rgba(${r}, ${o}, ${i}, ${t})`}else throw new Error(`Unsupported color format: ${e}`)}let Aw=!1;function Ule(){Aw||($5.register(Ds,Ps,Kc,Wg,Kg),Aw=!0)}let vw=!1;function $le(){vw||($5.register(X4,Wg,Kg,Ds,Ps),vw=!0)}let bw=!1;function Kle(){bw||($5.register(Ds,Ps,$c,Ya,Wg,Kg,hle),bw=!0)}const Wle=({type:e,data:t,options:n,barVariant:r,lineVariant:o,lineTension:i,opacity:a=.1,lineStroke:s,width:c,height:u,backgroundColor:d,className:h="",colors:C=["#4e79a7","#f28e2b","#e15759","#76b7b2"]})=>{e==="line"?Kle():e==="bar"?Ule():(e==="doughnut"||e==="pie")&&$le();const m=zle({input:t,type:e,lineVariant:o,lineTension:i,opacity:a,lineStroke:s,colors:C}),A=cl.merge({maintainAspectRatio:!1},Zle({type:e,barVariant:r}),n),p={line:Tle,bar:Fle,doughnut:Vle,pie:jle}[e];return Z.jsx(p,{data:m,options:A,style:{width:c,height:u,backgroundColor:d},className:`awi-chart ${h}`})},a5=(e,t)=>{const n=e;return isNaN(n.getTime())?"":t==="date"?n.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric"}):n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})},I4={app:"cube",source:"source",severity:"warning_triangle",date:"calendar",time:"clock"},Qle={app:"appName",source:"location",severity:"severity",date:"timeStamp",time:"timeStamp"},yw=(e,t,n)=>{const r=t==null?void 0:t[Qle[e]];switch(e){case"app":return Z.jsxs("section",{className:"app_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"source":return Z.jsxs("section",{className:"source_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"severity":return Z.jsxs("section",{className:"severity_section event_element",style:n,children:[Z.jsx("span",{className:"status_indicator",style:{background:t==null?void 0:t.color}}),Z.jsx(W2,{name:I4[e],color:t==null?void 0:t.color}),Z.jsx("p",{className:"font_secondary",title:r,children:r})]});case"date":{const o=a5(r,"date");return Z.jsxs("section",{className:"date_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:o,children:o})]})}case"time":{const o=a5(r,"time");return Z.jsxs("section",{className:"time_section event_element",style:n,children:[Z.jsx(W2,{name:I4[e]}),Z.jsx("p",{className:"font_secondary",title:o,children:o})]})}}},lL=({variant:e="new",data:t,width:n="100%",height:r="100%",className:o,sidePanelItems:i=["source","severity","date","time"],headerItem:a,headerHeight:s="20%",imageFit:c="cover",imageWidth:u="50%",isFocused:d=!1,focusedBorderColor:h,focusedBorderThickness:C,surfaceColor:m,surfaceBorderColor:A,surfaceSecondaryColor:v,textPrimaryColor:p,fontSize:_})=>{switch(a==null&&(s="0%"),e){case"new":return Z.jsxs("div",{className:"compact_event_card_new "+(o||"")+" "+(d?"focused":""),style:{width:n,height:r,"--c_focused_border_color":h,"--c_focused_border_thickness":C,"--c_surface_primary":m,"--c_surface_primary_border":A,"--c_surface_secondary":v,"--c_data_color":t==null?void 0:t.color,"--c_text_primary":p,"--font_s":_},children:[a!=null?yw(a,t,{height:s,minHeight:s,maxHeight:s}):Z.jsx(Z.Fragment,{}),Z.jsx("img",{src:t==null?void 0:t.frameUrl,alt:"Alert",style:{objectFit:c,width:u,minWidth:u,maxWidth:u,height:`calc(100% - ${s})`,minHeight:`calc(100% - ${s})`,maxHeight:`calc(100% - ${s})`}}),Z.jsx("span",{className:"compact_event_card_content",style:{width:`calc(100% - ${u})`,minWidth:`calc(100% - ${u})`,maxWidth:`calc(100% - ${u})`,height:`calc(100% - ${s})`,minHeight:`calc(100% - ${s})`,maxHeight:`calc(100% - ${s})`},children:i.map(w=>yw(w,t,{height:`calc(100%/${i==null?void 0:i.length})`}))})]});case"old":return Z.jsxs("div",{className:"compact_event_card "+(o||"")+" "+(d?"focused":""),style:{width:n,height:r,"--c_focused_border_color":h,"--c_focused_border_thickness":C,"--c_surface_primary":m,"--c_surface_primary_border":A,"--c_surface_secondary":v,"--c_data_color":t==null?void 0:t.color,"--c_text_primary":p,"--font_s":_},children:[Z.jsx("img",{src:t==null?void 0:t.frameUrl,alt:"Alert"}),Z.jsxs("span",{className:"compact_event_card_content",children:[Z.jsx("header",{children:Z.jsx("h6",{children:t.appName})}),Z.jsxs("section",{className:"compact_event_card_details",children:[Z.jsx("h6",{children:t.location}),Z.jsxs("span",{children:[Z.jsx("p",{children:"Date"}),Z.jsx("h6",{title:a5(t==null?void 0:t.timeStamp,"date"),children:a5(t==null?void 0:t.timeStamp,"date")})]}),Z.jsxs("span",{children:[Z.jsx("p",{children:"Time"}),Z.jsx("h6",{title:a5(t==null?void 0:t.timeStamp,"time"),className:"font_secondary",children:a5(t==null?void 0:t.timeStamp,"time")})]})]}),Z.jsxs("footer",{children:[Z.jsx("span",{className:"status_indicator",style:{background:`linear-gradient(90deg, rgba(0,0,0,0), ${t==null?void 0:t.color})`}}),Z.jsx("p",{className:"font_secondary",children:t==null?void 0:t.severity})]})]})]})}},Gle={s:"18.75rem",m:"25rem",l:"31.25rem"},r3=({className:e="",value:t=void 0,height:n="m",width:r="24rem",placement:o="flex-start",icon:i,backgroundColor:a,textColor:s,borderColor:c,disabledColor:u,iconPosition:d="after",iconColor:h="#292929",disabled:C=!1,onChange:m=()=>{},...A})=>(r=r||Gle[n],Z.jsxs("div",{className:`input_wrapper h_${n} ${C?"disabled":""} icon_${d}`,style:{width:r,minWidth:r,justifyContent:o,"--c_input_text":s,"--c_input_border":c,"--c_input_background":a,"--c_input_background_disabled":u},children:[i&&Z.jsx(W2,{name:i,color:h}),Z.jsx("input",{disabled:C,className:`input ${e}`,value:t,onChange:m,...A})]}));var lf={exports:{}};/*!
|
|
357
357
|
Copyright (c) 2018 Jed Watson.
|
|
358
358
|
Licensed under the MIT License (MIT), see
|
|
359
359
|
http://jedwatson.github.io/classnames
|