2025-01-09 13:42:21 +08:00
|
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deleteConfiguration-CDDjc2aM.js","assets/index-BQ9jnFZu.js","assets/index-D2eeEsuX.css","assets/localeText-BzleuEA0.js","assets/configurationBackupRestore-IlZWSA6I.js","assets/dayjs.min-BjPotxO2.js","assets/configurationBackupRestore-BeBqyCqt.css","assets/selectPeers-FlktfhPi.js","assets/selectPeers-Wjnh8YUZ.css","assets/editConfiguration-BPTq-Pcd.js","assets/editConfiguration-Oqrarw_V.css","assets/peerShareLinkModal-CoP9VdXS.js","assets/vue-datepicker-BkkJgrai.js","assets/peerJobsLogsModal-B1T9uUyG.js","assets/peerJobsAllModal-Bu72tdBY.js","assets/schedulePeerJob-C54E7DJS.js","assets/schedulePeerJob--V7cpve7.css","assets/peerJobs-e3ReowHD.js","assets/peerJobs-voXURBEt.css","assets/peerCreate-C_kVczbb.js","assets/peerCreate-zJfMKvAE.css","assets/peerQRCode-Xd6Fqm3i.js","assets/browser-CjSdxGTc.js","assets/peerConfigurationFile-Cva7fl3y.js","assets/peerConfigurationFile-CNB9RKjb.css","assets/peerSettings-DveZUgmk.js","assets/peerSettings-Cm-ugvIi.css"])))=>i.map(i=>d[i]);
|
|
|
|
import{_ as rs,D as Hs,W as Dn,G as _t,q as me,g as ve,a as D,c as $,b as p,d as P,w as G,m as On,s as No,F as qt,h as ks,t as K,e as V,T as tt,j as W,I as Ho,J as Wo,B as Vo,E as An,f as Wt,n as Vt,i as H,r as Qe,K as Tn,L as Ln,M as Ms,N as jo,o as Uo,O as Yo,P as Ps,Q as Ko,R as In,U as ot,v as Xo,k as Go,V as rt}from"./index-BQ9jnFZu.js";import{L as as}from"./localeText-BzleuEA0.js";import{d as oi}from"./dayjs.min-BjPotxO2.js";const Jo={name:"peerSearch",components:{LocaleText:as},setup(){const s=Hs(),t=Dn();return{store:s,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:_t("Status"),name:_t("Name"),allowed_ip:_t("Allowed IPs"),restricted:_t("Restricted")},interval:{5e3:_t("5 Seconds"),1e4:_t("10 Seconds"),3e4:_t("30 Seconds"),6e4:_t("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){me("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:s},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(s){me("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:s},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){ve(`/api/downloadAllPeers/${this.configuration.Name}`,{},s=>{console.log(s),window.wireguard.generateZipFiles(s,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return _t("Search Peers...")}}},qo={class:"mb-3"},Qo={class:"d-flex gap-2 z-3 peerSearchContainer"},Zo={class:"mt-3 mt-md-0 flex-grow-1"},tr=["placeholder"],er={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},sr={class:"container-md d-flex h-100 w-100"},ir={class:"m-auto modal-dialog-centered dashboardModal"},nr={class:"card rounded-3 shadow w-100"},or={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},rr={class:"mb-0 fw-normal"},ar={class:"card-body px-4 pb-4 d-flex gap-3 flex-column"},lr={class:"text-muted fw-bold mb-2"},cr={class:"list-group"},hr=["onClick"],dr={class:"me-auto"},ur={key:0,class:"bi bi-check text-primary"},fr={class:"text-muted fw-bold mb-2"},gr={class:"list-group"},pr=["onClick"],mr={class:"me-auto"},br={key:0,class:"bi bi-check text-primary"},_r={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},xr={class:"container-md d-flex h-100 w-100"},yr={class:"m-auto modal-dialog-centered dashboardModal"},vr={class:"card rounded-3 shadow w-100"},Sr={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},wr={class:"mb-0"},kr={class:"card-body px-4 pb-4 d-flex gap-3 flex-column pt-0"},Mr={class:"text-muted fw-bold mb-2"},Pr={class:"list-group"},Cr={class:"text-muted fw-bold mb-2"},Dr={class:"list-group"};function Or(s,t,e,i,n,o){const r=W("LocaleText"),a=W("RouterLink");return D(),$("div",qo,[p("div",Qo,[P(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]=p("i",{class:"bi bi-plus-lg me-2"},null,-1)),P(r,{t:"Peer"})]),_:1}),p("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]=p("i",{class:"bi bi-download me-2"},null,-1)),P(r,{t:"Download All"})]),p("div",Zo,[On(p("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:modelValue":t[2]||(t[2]=l=>this.searchString=l)},null,40,tr),[[No,this.searchString]])]),p("button",{onClick:t[3]||(t[3]=l=>this.showDispl
|
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-06 23:21:53 +08:00
|
|
|
*/function Oe(s){return s+.5|0}const Mt=(s,t,e)=>Math.max(Math.min(s,e),t);function fe(s){return Mt(Oe(s*2.55),0,255)}function Ct(s){return Mt(Oe(s*255),0,255)}function St(s){return Mt(Oe(s/2.55)/100,0,1)}function ai(s){return Mt(Oe(s*100),0,100)}const at={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},Cs=[..."0123456789ABCDEF"],pa=s=>Cs[s&15],ma=s=>Cs[(s&240)>>4]+Cs[s&15],Re=s=>(s&240)>>4===(s&15),ba=s=>Re(s.r)&&Re(s.g)&&Re(s.b)&&Re(s.a);function _a(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&at[s[1]]*17,g:255&at[s[2]]*17,b:255&at[s[3]]*17,a:t===5?at[s[4]]*17:255}:(t===7||t===9)&&(e={r:at[s[1]]<<4|at[s[2]],g:at[s[3]]<<4|at[s[4]],b:at[s[5]]<<4|at[s[6]],a:t===9?at[s[7]]<<4|at[s[8]]:255})),e}const xa=(s,t)=>s<255?t(s):"";function ya(s){var t=ba(s)?pa:ma;return s?"#"+t(s.r)+t(s.g)+t(s.b)+xa(s.a,t):void 0}const va=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function zn(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 Sa(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 wa(s,t,e){const i=zn(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 ka(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 Ws(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,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=ka(e,i,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Vs(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(Ct)}function js(s,t,e){return Vs(zn,s,t,e)}function Ma(s,t,e){return Vs(wa,s,t,e)}function Pa(s,t,e){return Vs(Sa,s,t,e)}function Bn(s){return(s%360+360)%360}function Ca(s){const t=va.exec(s);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?fe(+t[5]):Ct(+t[5]));const n=Bn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Ma(n,o,r):t[1]==="hsv"?i=Pa(n,o,r):i=js(n,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function Da(s,t){var e=Ws(s);e[0]=Bn(e[0]+t),e=js(e),s.r=e[0],s.g=e[1],s.b=e[2]}function Oa(s){if(!s)return;const t=Ws(s),e=t[0],i=ai(t[1]),n=ai(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${St(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}const li={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"},ci={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-06 23:21:53 +08:00
|
|
|
*/function xt(){}const za=(()=>{let s=0;return()=>s++})();function z(s){return s===null||typeof s>"u"}function Y(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 R(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function ct(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function ut(s,t){return ct(s)?s:t}function L(s,t){return typeof s>"u"?t:s}const Ba=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function B(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function E(s,t,e,i){let n,o,r;if(Y(s))for(o=s.length,n=0;n<o;n++)t.call(e,s[n],n);else if(R(s))for(r=Object.keys(s),o=r.length,n=0;n<o;n++)t.call(e,s[r[n]],r[n])}function Ze(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 ts(s){if(Y(s))return s.map(ts);if(R(s)){const t=Object.create(null),e=Object.keys(s),i=e.length;let n=0;for(;n<i;++n)t[e[n]]=ts(s[e[n]]);return t}return s}function Nn(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function $a(s,t,e,i){if(!Nn(s))return;const n=t[s],o=e[s];R(n)&&R(o)?we(n,o,i):t[s]=ts(o)}function we(s,t,e){const i=Y(t)?t:[t],n=i.length;if(!R(s))return s;e=e||{};const o=e.merger||$a;let r;for(let a=0;a<n;++a){if(r=i[a],!R(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],s,r,e)}return s}function be(s,t){return we(s,t,{merger:Na})}function Na(s,t,e){if(!Nn(s))return;const i=t[s],n=e[s];R(i)&&R(n)?be(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=ts(n))}const di={"":s=>s,x:s=>s.x,y:s=>s.y};function Ha(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 Wa(s){const t=Ha(s);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function te(s,t){return(di[t]||(di[t]=Wa(t)))(s)}function Us(s){return s.charAt(0).toUpperCase()+s.slice(1)}const ke=s=>typeof s<"u",Dt=s=>typeof s=="function",ui=(s,t)=>{if(s.size!==t.size)return!1;for(const e of s)if(!t.has(e))return!1;return!0};function Va(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const X=Math.PI,mt=2*X,ja=mt+X,es=Number.POSITIVE_INFINITY,Ua=X/180,dt=X/2,It=X/4,fi=X*2/3,Ds=Math.log10,bt=Math.sign;function _e(s,t,e){return Math.abs(s-t)<e}function gi(s){const t=Math.round(s);s=_e(s,t,s/1e3)?t:s;const e=Math.pow(10,Math.floor(Ds(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Ya(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 Me(s){return!isNaN(parseFloat(s))&&isFinite(s)}function Ka(s,t){const e=Math.round(s);return e-t<=s&&e+t>=s}function Xa(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 $t(s){return s*(X/180)}function Ga(s){return s*(180/X)}function pi(s){if(!ct(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function Ja(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*X&&(o+=mt),{angle:o,distance:n}}function Os(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function qa(s,t){return(s-t+ja)%mt-X}function kt(s){return(s%mt+mt)%mt}function Hn(s,t,e,i){const n=kt(s),o=kt(t),r=kt(e),a=kt(o-n),l=kt(r-n),c=kt(n-o),h=kt(n-r);return n===o||n===r||i&&o===r||a>l&&c<h}function it(s,t,e){return Math.max(t,Math.min(e,s))}function Qa(s){return it(s,-32768,32767)}function Nt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function Ys(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 Ht=(s,t,e,i)=>Ys(s,e,i?n=>{const o=s[n][t];return o<e||o===e&&s[n+1][t]===e}:n=>s[n][t]<e),Za=(s,t,e)=>Ys(s,e,i=>s[i][t]>=e);function tl(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.slice(i,n):s}c
|
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-06 23:21:53 +08:00
|
|
|
*/class rc{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=jn.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 yt=new rc;const Ai="transparent",ac={boolean(s,t,e){return e>.5?t:s},color(s,t,e){const i=xi(s||Ai),n=i.valid&&xi(t||Ai);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}};class lc{constructor(t,e,i,n){const o=e[i];n=Be([t.to,n,o,t.from]);const r=Be([t.from,o,n]);this._active=!0,this._fn=t.fn||ac[t.type||typeof r],this._easing=xe[t.easing]||xe.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=Be([t.to,e,n,t.from]),this._from=Be([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 ro{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!R(t))return;const e=Object.keys(j.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!R(o))return;const r={};for(const a of e)r[a]=o[a];(Y(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,n=hc(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&cc(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 h=e[c];let d=o[c];const u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new lc(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0
|
2024-11-03 18:35:21 +08:00
|
|
|
`)>-1?s.split(`
|
2025-01-09 13:42:21 +08:00
|
|
|
`):s}function dd(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 cn(s,t){const e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=t,l=q(t.bodyFont),c=q(t.titleFont),h=q(t.footerFont),d=o.length,u=n.length,f=i.length,g=ht(t.padding);let m=g.height,b=0,_=i.reduce((M,v)=>M+v.before.length+v.lines.length+v.after.length,0);if(_+=s.beforeBody.length+s.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){const M=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*M+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let y=0;const S=function(M){b=Math.max(b,e.measureText(M).width+y)};return e.save(),e.font=c.string,E(s.title,S),e.font=l.string,E(s.beforeBody.concat(s.afterBody),S),y=t.displayColors?r+2+t.boxPadding:0,E(i,M=>{E(M.before,S),E(M.lines,S),E(M.after,S)}),y=0,e.font=h.string,E(s.footer,S),e.restore(),b+=g.width,{width:b,height:m}}function ud(s,t){const{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function fd(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 gd(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"),fd(c,s,t,e)&&(c="center"),c}function hn(s,t,e){const i=e.yAlign||t.yAlign||ud(s,e);return{xAlign:e.xAlign||t.xAlign||gd(s,t,e,i),yAlign:i}}function pd(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function md(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function dn(s,t,e,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Qt(r);let g=pd(t,a);const m=md(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,u)+n:a==="right"&&(g+=Math.max(d,f)+n),{x:it(g,0,i.width-t.width),y:it(m,0,i.height-t.height)}}function Ye(s,t,e){const i=ht(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function un(s){return ft([],vt(s))}function bd(s,t,e){return Yt(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function fn(s,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}const Po={beforeTitle:xt,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:xt,beforeBody:xt,beforeLabel:xt,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 z(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:xt,afterBody:xt,beforeFooter:xt,footer:xt,afterFooter:xt};function Z(s,t,e,i){const n=s[t].call(e,i);return typeof n>"u"?Po[t].call(e,i):n}class gn extends Ot{static positioners=pe;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.after
|