2024-11-03 20:45:59 +08:00
|
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peerJobsLogsModal.js","assets/dayjs.min.js","assets/index.js","assets/index.css","assets/localeText.js","assets/peerJobsAllModal.js","assets/browser.js","assets/peerCreate.js","assets/wireguard.js","assets/peerCreate.css","assets/vue-datepicker.js"])))=>i.map(i=>d[i]);
|
|
|
|
import{_ as ut,D as Pt,W as us,G as Mt,m as nt,f as At,o as w,c as $,a as h,b as y,w as G,k as K,p as Z,F as lt,r as Zt,t as B,j as I,h as rt,e as z,I as qo,J as Qo,B as ns,E as fs,d as et,n as Q,g as H,q as j,K as Bn,L as zn,M as As,N as Zo,A as Xs,O as tr,P as Ls,Q as er,R as Nn,U as sr,l as ir,T as Gs,C as Ts,V as Is,v as Hn,s as jn,X as gs,u as nr,H as or,Y as gi,Z as pi}from"./index.js";import{L as D}from"./localeText.js";import{d as qt}from"./dayjs.min.js";import{b as rr}from"./browser.js";import ar from"./peerCreate.js";import{V as Vn}from"./vue-datepicker.js";const lr={name:"peerSearch",components:{LocaleText:D},setup(){const s=Pt(),t=us();return{store:s,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:Mt("Status"),name:Mt("Name"),allowed_ip:Mt("Allowed IPs"),restricted:Mt("Restricted")},interval:{5e3:Mt("5 Seconds"),1e4:Mt("10 Seconds"),3e4:Mt("30 Seconds"),6e4:Mt("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(s){nt("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:s},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(s){nt("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:s},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){At(`/api/downloadAllPeers/${this.configuration.Name}`,{},s=>{console.log(s),window.wireguard.generateZipFiles(s,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return Mt("Search Peers...")}}},cr={class:"mb-3"},dr={class:"d-flex gap-2 z-3 peerSearchContainer"},hr={class:"mt-3 mt-md-0 flex-grow-1"},ur=["placeholder"],fr={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},gr={class:"container-md d-flex h-100 w-100"},pr={class:"m-auto modal-dialog-centered dashboardModal"},mr={class:"card rounded-3 shadow w-100"},br={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},_r={class:"mb-0 fw-normal"},xr={class:"card-body px-4 pb-4 d-flex gap-3 flex-column"},yr={class:"text-muted fw-bold mb-2"},vr={class:"list-group"},wr=["onClick"],Sr={class:"me-auto"},kr={key:0,class:"bi bi-check text-primary"},Pr={class:"text-muted fw-bold mb-2"},Mr={class:"list-group"},Cr=["onClick"],$r={class:"me-auto"},Dr={key:0,class:"bi bi-check text-primary"},Or={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},Ar={class:"container-md d-flex h-100 w-100"},Lr={class:"m-auto modal-dialog-centered dashboardModal"},Tr={class:"card rounded-3 shadow w-100"},Ir={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},Rr={class:"mb-0"},Er={class:"card-body px-4 pb-4 d-flex gap-3 flex-column pt-0"},Fr={class:"text-muted fw-bold mb-2"},Br={class:"list-group"},zr={class:"text-muted fw-bold mb-2"},Nr={class:"list-group"};function Hr(s,t,e,i,n,o){const r=z("LocaleText"),a=z("RouterLink");return w(),$("div",cr,[h("div",dr,[y(a,{to:"create",class:"text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle shadow-sm"},{default:G(()=>[t[13]||(t[13]=h("i",{class:"bi bi-plus-lg me-2"},null,-1)),y(r,{t:"Peer"})]),_:1}),h("button",{class:"btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle shadow-sm",onClick:t[0]||(t[0]=l=>this.downloadAllPeer())},[t[14]||(t[14]=h("i",{class:"bi bi-download me-2"},null,-1)),y(r,{t:"Download All"})]),h("div",hr,[K(h("input",{class:"form-control rounded-3 bg-secondary-subtle border-1 border-secondary-subtle shadow-sm w-100",placeholder:o.searchBarPlaceholder,id:"searchPeers",onKeyup:t[1]||(t[1]=l=>this.debounce()),"onUpdate:m
|
2024-11-03 18:35:21 +08:00
|
|
|
* @kurkle/color v0.3.2
|
|
|
|
* https://github.com/kurkle/color#readme
|
|
|
|
* (c) 2023 Jukka Kurkela
|
|
|
|
* Released under the MIT License
|
2024-11-03 20:45:59 +08:00
|
|
|
*/function Re(s){return s+.5|0}const It=(s,t,e)=>Math.max(Math.min(s,e),t);function ve(s){return It(Re(s*2.55),0,255)}function Et(s){return It(Re(s*255),0,255)}function Ot(s){return It(Re(s/2.55)/100,0,1)}function bi(s){return It(Re(s*100),0,100)}const gt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Rs=[..."0123456789ABCDEF"],Ca=s=>Rs[s&15],$a=s=>Rs[(s&240)>>4]+Rs[s&15],Ne=s=>(s&240)>>4===(s&15),Da=s=>Ne(s.r)&&Ne(s.g)&&Ne(s.b)&&Ne(s.a);function Oa(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255>[s[1]]*17,g:255>[s[2]]*17,b:255>[s[3]]*17,a:t===5?gt[s[4]]*17:255}:(t===7||t===9)&&(e={r:gt[s[1]]<<4|gt[s[2]],g:gt[s[3]]<<4|gt[s[4]],b:gt[s[5]]<<4|gt[s[6]],a:t===9?gt[s[7]]<<4|gt[s[8]]:255})),e}const Aa=(s,t)=>s<255?t(s):"";function La(s){var t=Da(s)?Ca:$a;return s?"#"+t(s.r)+t(s.g)+t(s.b)+Aa(s.a,t):void 0}const Ta=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Kn(s,t,e){const i=t*Math.min(e,1-e),n=(o,r=(o+s/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function Ia(s,t,e){const i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Ra(s,t,e){const i=Kn(s,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function Ea(s,t,e,i,n){return s===n?(t-e)/i+(t<e?6:0):t===n?(e-s)/i+2:(s-t)/i+4}function qs(s){const e=s.r/255,i=s.g/255,n=s.b/255,o=Math.max(e,i,n),r=Math.min(e,i,n),a=(o+r)/2;let l,c,d;return o!==r&&(d=o-r,c=a>.5?d/(2-o-r):d/(o+r),l=Ea(e,i,n,d,o),l=l*60+.5),[l|0,c||0,a]}function Qs(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(Et)}function Zs(s,t,e){return Qs(Kn,s,t,e)}function Fa(s,t,e){return Qs(Ra,s,t,e)}function Ba(s,t,e){return Qs(Ia,s,t,e)}function Jn(s){return(s%360+360)%360}function za(s){const t=Ta.exec(s);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?ve(+t[5]):Et(+t[5]));const n=Jn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Fa(n,o,r):t[1]==="hsv"?i=Ba(n,o,r):i=Zs(n,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function Na(s,t){var e=qs(s);e[0]=Jn(e[0]+t),e=Zs(e),s.r=e[0],s.g=e[1],s.b=e[2]}function Ha(s){if(!s)return;const t=qs(s),e=t[0],i=bi(t[1]),n=bi(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Ot(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}const _i={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},xi={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"
|
2024-11-03 18:35:21 +08:00
|
|
|
* Chart.js v4.4.4
|
|
|
|
* https://www.chartjs.org
|
|
|
|
* (c) 2024 Chart.js Contributors
|
|
|
|
* Released under the MIT License
|
2024-11-03 20:45:59 +08:00
|
|
|
*/function Ct(){}const Xa=(()=>{let s=0;return()=>s++})();function W(s){return s===null||typeof s>"u"}function q(s){if(Array.isArray&&Array.isArray(s))return!0;const t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function F(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function mt(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function xt(s,t){return mt(s)?s:t}function R(s,t){return typeof s>"u"?t:s}const Ga=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function U(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function N(s,t,e,i){let n,o,r;if(q(s))for(o=s.length,n=0;n<o;n++)t.call(e,s[n],n);else if(F(s))for(r=Object.keys(s),o=r.length,n=0;n<o;n++)t.call(e,s[r[n]],r[n])}function os(s,t){let e,i,n,o;if(!s||!t||s.length!==t.length)return!1;for(e=0,i=s.length;e<i;++e)if(n=s[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function rs(s){if(q(s))return s.map(rs);if(F(s)){const t=Object.create(null),e=Object.keys(s),i=e.length;let n=0;for(;n<i;++n)t[e[n]]=rs(s[e[n]]);return t}return s}function Gn(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function qa(s,t,e,i){if(!Gn(s))return;const n=t[s],o=e[s];F(n)&&F(o)?De(n,o,i):t[s]=rs(o)}function De(s,t,e){const i=q(t)?t:[t],n=i.length;if(!F(s))return s;e=e||{};const o=e.merger||qa;let r;for(let a=0;a<n;++a){if(r=i[a],!F(r))continue;const l=Object.keys(r);for(let c=0,d=l.length;c<d;++c)o(l[c],s,r,e)}return s}function ke(s,t){return De(s,t,{merger:Qa})}function Qa(s,t,e){if(!Gn(s))return;const i=t[s],n=e[s];F(i)&&F(n)?ke(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=rs(n))}const vi={"":s=>s,x:s=>s.x,y:s=>s.y};function Za(s){const t=s.split("."),e=[];let i="";for(const n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function tl(s){const t=Za(s);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function le(s,t){return(vi[t]||(vi[t]=tl(t)))(s)}function ti(s){return s.charAt(0).toUpperCase()+s.slice(1)}const Oe=s=>typeof s<"u",Ft=s=>typeof s=="function",wi=(s,t)=>{if(s.size!==t.size)return!1;for(const e of s)if(!t.has(e))return!1;return!0};function el(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const tt=Math.PI,St=2*tt,sl=St+tt,as=Number.POSITIVE_INFINITY,il=tt/180,_t=tt/2,jt=tt/4,Si=tt*2/3,Es=Math.log10,kt=Math.sign;function Pe(s,t,e){return Math.abs(s-t)<e}function ki(s){const t=Math.round(s);s=Pe(s,t,s/1e3)?t:s;const e=Math.pow(10,Math.floor(Es(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function nl(s){const t=[],e=Math.sqrt(s);let i;for(i=1;i<e;i++)s%i===0&&(t.push(i),t.push(s/i));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function Ae(s){return!isNaN(parseFloat(s))&&isFinite(s)}function ol(s,t){const e=Math.round(s);return e-t<=s&&e+t>=s}function rl(s,t,e){let i,n,o;for(i=0,n=s.length;i<n;i++)o=s[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Jt(s){return s*(tt/180)}function al(s){return s*(180/tt)}function Pi(s){if(!mt(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function ll(s,t){const e=t.x-s.x,i=t.y-s.y,n=Math.sqrt(e*e+i*i);let o=Math.atan2(i,e);return o<-.5*tt&&(o+=St),{angle:o,distance:n}}function Fs(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function cl(s,t){return(s-t+sl)%St-tt}function Tt(s){return(s%St+St)%St}function qn(s,t,e,i){const n=Tt(s),o=Tt(t),r=Tt(e),a=Tt(o-n),l=Tt(r-n),c=Tt(n-o),d=Tt(n-r);return n===o||n===r||i&&o===r||a>l&&c<d}function ht(s,t,e){return Math.max(t,Math.min(e,s))}function dl(s){return ht(s,-32768,32767)}function Xt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function ei(s,t,e){e=e||(r=>s[r]<t);let i=s.length-1,n=0,o;for(;i-n>1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}const Gt=(s,t,e,i)=>ei(s,e,i?n=>{const o=s[n][t];return o<e||o===e&&s[n+1][t]===e}:n=>s[n][t]<e),hl=(s,t,e)=>ei(s,e,i=>s[i][t]>=e);function ul(s,t,e){let i=0,n=s.length;for(;i<n&&s[i]<t;)i++;for(;n>i&&s[n-1]>e;)n--;return i>0||n<s.length?s.sli
|
2024-11-03 18:35:21 +08:00
|
|
|
* Chart.js v4.4.4
|
|
|
|
* https://www.chartjs.org
|
|
|
|
* (c) 2024 Chart.js Contributors
|
|
|
|
* Released under the MIT License
|
2024-11-03 20:45:59 +08:00
|
|
|
*/class _c{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=to.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var $t=new _c;const Ni="transparent",xc={boolean(s,t,e){return e>.5?t:s},color(s,t,e){const i=Di(s||Ni),n=i.valid&&Di(t||Ni);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}};class yc{constructor(t,e,i,n){const o=e[i];n=We([t.to,n,o,t.from]);const r=We([t.from,o,n]);this._active=!0,this._fn=t.fn||xc[t.type||typeof r],this._easing=Me[t.easing]||Me.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=We([t.to,e,n,t.from]),this._from=We([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<i),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let n=0;n<i.length;n++)i[n][e]()}}class bo{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!F(t))return;const e=Object.keys(J.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!F(o))return;const r={};for(const a of e)r[a]=o[a];(q(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,n=wc(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&vc(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const d=e[c];let u=o[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=u=new yc(f,t,c,d),n.push(u)}return n}update(t,e){if(this._properties.size===0
|
2024-11-03 18:35:21 +08:00
|
|
|
`)>-1?s.split(`
|
2024-11-03 20:45:59 +08:00
|
|
|
`):s}function Sh(s,t){const{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function xn(s,t){const e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=t,l=it(t.bodyFont),c=it(t.titleFont),d=it(t.footerFont),u=o.length,f=n.length,g=i.length,p=bt(t.padding);let m=p.height,b=0,_=i.reduce((v,x)=>v+x.before.length+x.lines.length+x.after.length,0);if(_+=s.beforeBody.length+s.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=g*v+(_-g)*l.lineHeight+(_-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let k=0;const S=function(v){b=Math.max(b,e.measureText(v).width+k)};return e.save(),e.font=c.string,N(s.title,S),e.font=l.string,N(s.beforeBody.concat(s.afterBody),S),k=t.displayColors?r+2+t.boxPadding:0,N(i,v=>{N(v.before,S),N(v.lines,S),N(v.after,S)}),k=0,e.font=d.string,N(s.footer,S),e.restore(),b+=p.width,{width:b,height:m}}function kh(s,t){const{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function Ph(s,t,e,i){const{x:n,width:o}=i,r=e.caretSize+e.caretPadding;if(s==="left"&&n+o+r>t.width||s==="right"&&n-o-r<0)return!0}function Mh(s,t,e,i){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=s;let c="center";return i==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Ph(c,s,t,e)&&(c="center"),c}function yn(s,t,e){const i=e.yAlign||t.yAlign||kh(s,e);return{xAlign:e.xAlign||t.xAlign||Mh(s,t,e,i),yAlign:i}}function Ch(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function $h(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function vn(s,t,e,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=re(r);let p=Ch(t,a);const m=$h(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(d,f)+n:a==="right"&&(p+=Math.max(u,g)+n),{x:ht(p,0,i.width-t.width),y:ht(m,0,i.height-t.height)}}function Qe(s,t,e){const i=bt(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function wn(s){return yt([],Dt(s))}function Dh(s,t,e){return ee(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Sn(s,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}const Eo={beforeTitle:Ct,title(s){if(s.length>0){const t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Ct,beforeBody:Ct,beforeLabel:Ct,label(s){if(this&&this.options&&this.options.mode==="dataset")return s.label+": "+s.formattedValue||s.formattedValue;let t=s.dataset.label||"";t&&(t+=": ");const e=s.formattedValue;return W(e)||(t+=e),t},labelColor(s){const e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(s){const e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ct,afterBody:Ct,beforeFooter:Ct,footer:Ct,afterFooter:Ct};function at(s,t,e,i){const n=s[t].call(e,i);return typeof n>"u"?Eo[t].call(e,i):n}class kn extends Bt{static positioners=Se;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.a
|