diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..ab6d8aeb --- /dev/null +++ b/404.html @@ -0,0 +1,21 @@ + + + + + + 404 | js-lib + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/adminService.html b/adminService.html new file mode 100644 index 00000000..464b653e --- /dev/null +++ b/adminService.html @@ -0,0 +1,34 @@ + + + + + + AdminService | js-lib + + + + + + + + + + + + + + + + + +
Skip to content

AdminService experimental

Admin Mode

Admin mode is activated by a combination of keys on a keyboard (no mobile support), visualized with the RedDot™ on the page.

Function startListening() enables listening for a key combination (Ctrl+Shift+L by default).

Example:

ts
const admin = new AdminService({
+  onEnter: () => console.log('Entered Admin mode'),
+  onExit: () => console.log('Exited Admin mode'),
+  onRedDotClick: () => alert('RedDot clicked'),
+})
+
+admin.startListening()

Try pressing Ctrl+Shift+L on the keyboard to see the RedDot™ in action.

+ + + + \ No newline at end of file diff --git a/analytics.html b/analytics.html new file mode 100644 index 00000000..deafe6d2 --- /dev/null +++ b/analytics.html @@ -0,0 +1,27 @@ + + + + + + Analytics | js-lib + + + + + + + + + + + + + +
Skip to content

Analytics

loadGTag

Example:

ts
await loadGTag('UA-634xxxx-xx')
+// gtag is loaded now

loadGTM

Example:

ts
await loadGTM('GTM-WJ6xxx')
+// GTM is loaded now

loadHotjar

Example:

ts
await loadHotjar('19xxxxx')
+// Hotjar is loaded now
+ + + + \ No newline at end of file diff --git a/array.html b/array.html new file mode 100644 index 00000000..c85f61bc --- /dev/null +++ b/array.html @@ -0,0 +1,139 @@ + + + + + + Array | js-lib + + + + + + + + + + + + + +
Skip to content

Array

_range

Quickly generate an incremental array of numbers.

  • Starts with 0, unless specified differently
  • Step is 1, unless specified differently
  • Lower bound is inclusive, higher-bound is exclusive.
ts
_range(3)
+// [0, 1, 2]
+
+_range(3, 6)
+// [3, 4, 5]
+
+_range(1, 10, 2)
+// [1, 3, 5, 7, 9]

_chunk

Splits an input array into "chunks" of defined size. Last/remaining chunk may be of "incomplete" size. Returns array-of-arrays.

ts
const a = [1, 2, 3, 4, 5, 6]
+
+_chunk(a, 2)
+// [[1, 2], [3, 4], [5, 6]]
+
+_chunk(a, 3)
+// [[1, 2, 3], [4, 5, 6]]
+
+_chunk(a, 4)
+// [[1, 2, 3, 4], [5, 6]]]

_flatten

Polyfill to Array.flat() with depth=1. From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

ts
_flatten([
+  [1, 2],
+  [3, 4],
+])
+// [1, 2, 3, 4]

_flattenDeep

Based on https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep

Recursive Array.flat(), with infinite depth.

ts
_flattenDeep([
+  [
+    [1, 2],
+    [3, 4],
+  ],
+  [5, 6],
+  [7],
+])
+// [1, 2, 3, 4, 5, 6, 7]

_uniq

Convenience function to remove duplicates from an array of primitives.

ts
const a = [1, 2, 2, 3]
+_uniq(a)
+// [1, 2, 3]

_uniqBy

Remove duplicates from array of objects, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 18 }]
+_uniqBy(a, obj => obj.age)
+// [{ age: 18 }, { age: 20 }]

_by

ts
const a = [
+  { id: 'id1', a: 'a1' },
+  { id: 'id2', b: 'b1' },
+]
+
+_by(a, r => r.id)
+// {
+//  id1: {id: 'id1', a: 'a1'},
+//  id2: {id: 'id2', b: 'b1'},
+//}

_groupBy

ts
const a = [1, 2, 3, 4, 5]
+
+_groupBy(a, r => (r % 2 ? 'even' : 'odd'))
+// {
+//  odd: [1, 3, 5],
+//  even: [2, 4],
+// }

Returning undefined from the Mapper will EXCLUDE the item.

_sortBy

Sort an array of object, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 19 }]
+_sortBy(a, obj => obj.age)
+// [{ age: 18 }, {age: 19 }, { age: 20 }]

_sortNumbers

Sort an array of numbers. Needs a special treatment because of a caveat, that a default comparator function compares things as Strings (even Numbers), so '21' > '100'.

ts
const a = [1, 3, 2]
+_sortNumbers(a)
+// [1, 2, 3]

_findLast

Like .find(), but tries to find an element from the END of the array.

ts
const a = [1, 2, 3, 4, 5]
+_findLast(a, n => n % 2 === 0)
+// 4

_takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile

ts
const a = [1, 2, 3, 4, 5, 2, 1]
+
+_takeWhile(a, r => r <= 3)
+// [1, 2, 3]
+
+_takeRightWhile(a, r => r <= 3)
+// [1, 2]
+// Note that the order is reversed when taking from Right!
+
+_dropWhile(a, r => r <= 3)
+// [4, 5, 2, 1]
+
+_dropRightWhile(a, r => r <= 3)
+// [5, 4, 3, 2, 1]
+// Note that the order is reversed when dropping from Right!

_countBy

ts
_countBy(['a', 'aa', 'aaa', 'aaa', 'aaaa'], r => r.length)
+// {
+//   1: 1,
+//   2: 1,
+//   3: 2,
+//   4: 1,
+// })

_intersection

Inspired by Lodash's _.intersection.

ts
_intersection([2, 1], [2, 3])
+// [2]
+
+_intersection([1], [2])
+// []
+
+_intersection()
+// []
+
+_intersection([1])
+// [1]

_difference

Inspired by Lodash's _.difference

ts
_difference([2, 1], [2, 3])
+// [1]
+
+_difference([1], [2])
+// [1]
+
+_difference([1], [1])
+// []
+
+_difference([1])
+// [1]

_sum

Inspired by Lodash's _.sum

Same as Lodash, sum of empty array returns 0 (not NaN, not error)

ts
_sum([]) // 0
+_sum([1]) // 1
+_sum([1, 2]) // 3

_sumBy

Inspired by Lodash's _.sumBy

ts
const items = [
+  { a: 1 },
+  { a: 2 },
+  { b: 3 }, // `a` is undefined (not a number) here, will be treated as 0
+]
+
+_sumBy(items, i => i.a) // 1 + 2 + 0 == 3

_mapToObject

Map an array of T to a StringMap<V>, by returning a tuple of [key, value] from a mapper function.

Return undefined/null/false/0/void to filter out (not include) a value.

Similar to reduce, but with subjectively cleaner syntax of returning "entries".

Similar to mapping to "entries" and passing to Object.fromEntries().

ts
_mapToObject([1, 2, 3], n => [n, n * 2])
+// { '1': 2, '2': 4, '3': 6 }
+
+_mapToObject([1, 2, 3], n => [n, `id${n}`])
+// { '1': 'id1, '2': 'id2', '3': 'id3' }

_shuffle

Randomly shuffle an array values.

Uses Fisher–Yates algorithm.

Based on: https://stackoverflow.com/a/12646864/4919972

ts
const a = [1, 2, 3, 4, 5]
+const b = _shuffle(a)
+// [3, 1, 2, 5, 4]
+
+// Mutating example
+_shuffle(a)
+// a == [4, 2, 3, 1, 5]

_last

Returns last element of the array, or undefined if the array is empty.

Very simple semantic convenience method (lodash-inspired).

ts
const a = [1, 2, 3]
+_last(a) // 3
+
+const a = []
+_last(a) // undefined
+ + + + \ No newline at end of file diff --git a/assets/adminService.md.DEX8Z_en.js b/assets/adminService.md.DEX8Z_en.js new file mode 100644 index 00000000..1888d4ea --- /dev/null +++ b/assets/adminService.md.DEX8Z_en.js @@ -0,0 +1,7 @@ +import{d as b,v as C,c as D,j as c,a as k,G as g,a0 as S,B as x,o as M}from"./chunks/framework.K5DDegrV.js";import{_ as w}from"./chunks/types.C-9dMxxX.js";import{_ as B}from"./chunks/is.util.BDVbkSgX.js";import{i as m}from"./chunks/env.bTBnF6u3.js";import{_ as A}from"./chunks/stringify.CRXUkG82.js";function R(t,e){return`${t.constructor.name}.${e}`}const L=t=>{if(t.length!==0)return t.length===1&&B(t[0])?t[0]:JSON.stringify(t)};class O{constructor(){this.m=new Map}has(e){return this.m.has(e)}get(e){return this.m.get(e)}set(e,i){this.m.set(e,i)}clear(){this.m.clear()}}const P=(t={})=>(e,i,n)=>{if(typeof n.value!="function")throw new TypeError("Memoization can be applied only to methods");const a=n.value,s=new Map,{logger:l=console,cacheFactory:u=()=>new O,cacheKeyFn:f=L}=t,v=String(i),_=R(e,v);return n.value=function(...o){const h=this,d=f(o);let r=s.get(h);if(r||(r=u(),s.set(h,r)),r.has(d))return r.get(d);const p=a.apply(h,o);try{r.set(d,p)}catch(F){l.error(F)}return p},w(n.value,{clear:()=>{l.log(`${_} @_Memo.clear()`),s.forEach(o=>o.clear()),s.clear()},getInstanceCache:()=>s,getCache:o=>s.get(o)}),n};var T=Object.defineProperty,N=Object.getOwnPropertyDescriptor,V=(t,e,i,n)=>{for(var a=N(e,i),s=t.length-1,l;s>=0;s--)(l=t[s])&&(a=l(e,i,a)||a);return a&&T(e,i,a),a};const j="__red-dot__",E=()=>{};class y{constructor(e){this.adminMode=!1,this.listening=!1,this.cfg={predicate:i=>i.ctrlKey&&i.key==="L",persistToLocalStorage:!0,localStorageKey:"__adminMode__",onRedDotClick:E,onChange:E,beforeEnter:()=>!0,beforeExit:()=>!0,...e}}startListening(){this.listening||m()||(this.adminMode=!!localStorage.getItem(this.cfg.localStorageKey),this.adminMode&&this.toggleRedDotVisibility(),document.addEventListener("keydown",this.keydownListener.bind(this),{passive:!0}),this.listening=!0)}stopListening(){m()||(document.removeEventListener("keydown",this.keydownListener),this.listening=!1)}async keydownListener(e){this.cfg.predicate(e)&&await this.toggleRedDot()}async toggleRedDot(){try{if(!await this.cfg[this.adminMode?"beforeExit":"beforeEnter"]())return}catch(e){console.error(e),alert(A(e));return}if(this.adminMode=!this.adminMode,this.toggleRedDotVisibility(),this.cfg.persistToLocalStorage){const{localStorageKey:e}=this.cfg;this.adminMode?localStorage.setItem(e,"1"):localStorage.removeItem(e)}this.cfg.onChange(this.adminMode)}toggleRedDotVisibility(){this.getRedDotElement().style.display=this.adminMode?"block":"none"}getRedDotElement(){const e=document.createElement("div");return e.id=j,e.style.cssText="position:fixed;width:24px;height:24px;margin-top:-12px;background-color:red;opacity:0.5;top:50%;left:0;z-index:9999999;cursor:pointer;border-radius:0 3px 3px 0",e.addEventListener("click",()=>this.cfg.onRedDotClick()),document.body.append(e),e}}V([P()],y.prototype,"getRedDotElement");const K=b({__name:"AdminModeDemo",setup(t){const e=new y({onChange:i=>console.log({adminMode:i}),onRedDotClick:()=>alert("RedDot clicked")});return C(()=>{e.startListening()}),(i,n)=>null}}),I={id:"adminservice",tabindex:"-1"},Q=JSON.parse('{"title":"AdminService","description":"","frontmatter":{},"headers":[],"relativePath":"adminService.md","filePath":"adminService.md"}'),z={name:"adminService.md"},U=Object.assign(z,{setup(t){return(e,i)=>{const n=x("Badge");return M(),D("div",null,[c("h1",I,[i[0]||(i[0]=k("AdminService ")),g(n,{text:"experimental",type:"warning"}),i[1]||(i[1]=k()),i[2]||(i[2]=c("a",{class:"header-anchor",href:"#adminservice","aria-label":'Permalink to "AdminService "'},"​",-1))]),i[3]||(i[3]=S(`

Admin Mode

Admin mode is activated by a combination of keys on a keyboard (no mobile support), visualized with the RedDot™ on the page.

Function startListening() enables listening for a key combination (Ctrl+Shift+L by default).

Example:

ts
const admin = new AdminService({
+  onEnter: () => console.log('Entered Admin mode'),
+  onExit: () => console.log('Exited Admin mode'),
+  onRedDotClick: () => alert('RedDot clicked'),
+})
+
+admin.startListening()

Try pressing Ctrl+Shift+L on the keyboard to see the RedDot™ in action.

`,6)),g(K)])}}});export{Q as __pageData,U as default}; diff --git a/assets/adminService.md.DEX8Z_en.lean.js b/assets/adminService.md.DEX8Z_en.lean.js new file mode 100644 index 00000000..1888d4ea --- /dev/null +++ b/assets/adminService.md.DEX8Z_en.lean.js @@ -0,0 +1,7 @@ +import{d as b,v as C,c as D,j as c,a as k,G as g,a0 as S,B as x,o as M}from"./chunks/framework.K5DDegrV.js";import{_ as w}from"./chunks/types.C-9dMxxX.js";import{_ as B}from"./chunks/is.util.BDVbkSgX.js";import{i as m}from"./chunks/env.bTBnF6u3.js";import{_ as A}from"./chunks/stringify.CRXUkG82.js";function R(t,e){return`${t.constructor.name}.${e}`}const L=t=>{if(t.length!==0)return t.length===1&&B(t[0])?t[0]:JSON.stringify(t)};class O{constructor(){this.m=new Map}has(e){return this.m.has(e)}get(e){return this.m.get(e)}set(e,i){this.m.set(e,i)}clear(){this.m.clear()}}const P=(t={})=>(e,i,n)=>{if(typeof n.value!="function")throw new TypeError("Memoization can be applied only to methods");const a=n.value,s=new Map,{logger:l=console,cacheFactory:u=()=>new O,cacheKeyFn:f=L}=t,v=String(i),_=R(e,v);return n.value=function(...o){const h=this,d=f(o);let r=s.get(h);if(r||(r=u(),s.set(h,r)),r.has(d))return r.get(d);const p=a.apply(h,o);try{r.set(d,p)}catch(F){l.error(F)}return p},w(n.value,{clear:()=>{l.log(`${_} @_Memo.clear()`),s.forEach(o=>o.clear()),s.clear()},getInstanceCache:()=>s,getCache:o=>s.get(o)}),n};var T=Object.defineProperty,N=Object.getOwnPropertyDescriptor,V=(t,e,i,n)=>{for(var a=N(e,i),s=t.length-1,l;s>=0;s--)(l=t[s])&&(a=l(e,i,a)||a);return a&&T(e,i,a),a};const j="__red-dot__",E=()=>{};class y{constructor(e){this.adminMode=!1,this.listening=!1,this.cfg={predicate:i=>i.ctrlKey&&i.key==="L",persistToLocalStorage:!0,localStorageKey:"__adminMode__",onRedDotClick:E,onChange:E,beforeEnter:()=>!0,beforeExit:()=>!0,...e}}startListening(){this.listening||m()||(this.adminMode=!!localStorage.getItem(this.cfg.localStorageKey),this.adminMode&&this.toggleRedDotVisibility(),document.addEventListener("keydown",this.keydownListener.bind(this),{passive:!0}),this.listening=!0)}stopListening(){m()||(document.removeEventListener("keydown",this.keydownListener),this.listening=!1)}async keydownListener(e){this.cfg.predicate(e)&&await this.toggleRedDot()}async toggleRedDot(){try{if(!await this.cfg[this.adminMode?"beforeExit":"beforeEnter"]())return}catch(e){console.error(e),alert(A(e));return}if(this.adminMode=!this.adminMode,this.toggleRedDotVisibility(),this.cfg.persistToLocalStorage){const{localStorageKey:e}=this.cfg;this.adminMode?localStorage.setItem(e,"1"):localStorage.removeItem(e)}this.cfg.onChange(this.adminMode)}toggleRedDotVisibility(){this.getRedDotElement().style.display=this.adminMode?"block":"none"}getRedDotElement(){const e=document.createElement("div");return e.id=j,e.style.cssText="position:fixed;width:24px;height:24px;margin-top:-12px;background-color:red;opacity:0.5;top:50%;left:0;z-index:9999999;cursor:pointer;border-radius:0 3px 3px 0",e.addEventListener("click",()=>this.cfg.onRedDotClick()),document.body.append(e),e}}V([P()],y.prototype,"getRedDotElement");const K=b({__name:"AdminModeDemo",setup(t){const e=new y({onChange:i=>console.log({adminMode:i}),onRedDotClick:()=>alert("RedDot clicked")});return C(()=>{e.startListening()}),(i,n)=>null}}),I={id:"adminservice",tabindex:"-1"},Q=JSON.parse('{"title":"AdminService","description":"","frontmatter":{},"headers":[],"relativePath":"adminService.md","filePath":"adminService.md"}'),z={name:"adminService.md"},U=Object.assign(z,{setup(t){return(e,i)=>{const n=x("Badge");return M(),D("div",null,[c("h1",I,[i[0]||(i[0]=k("AdminService ")),g(n,{text:"experimental",type:"warning"}),i[1]||(i[1]=k()),i[2]||(i[2]=c("a",{class:"header-anchor",href:"#adminservice","aria-label":'Permalink to "AdminService "'},"​",-1))]),i[3]||(i[3]=S(`

Admin Mode

Admin mode is activated by a combination of keys on a keyboard (no mobile support), visualized with the RedDot™ on the page.

Function startListening() enables listening for a key combination (Ctrl+Shift+L by default).

Example:

ts
const admin = new AdminService({
+  onEnter: () => console.log('Entered Admin mode'),
+  onExit: () => console.log('Exited Admin mode'),
+  onRedDotClick: () => alert('RedDot clicked'),
+})
+
+admin.startListening()

Try pressing Ctrl+Shift+L on the keyboard to see the RedDot™ in action.

`,6)),g(K)])}}});export{Q as __pageData,U as default}; diff --git a/assets/analytics.md.CGSkOmQW.js b/assets/analytics.md.CGSkOmQW.js new file mode 100644 index 00000000..a319d5ee --- /dev/null +++ b/assets/analytics.md.CGSkOmQW.js @@ -0,0 +1,4 @@ +import{_ as s,c as i,a0 as t,o as l}from"./chunks/framework.K5DDegrV.js";const c=JSON.parse('{"title":"Analytics","description":"","frontmatter":{},"headers":[],"relativePath":"analytics.md","filePath":"analytics.md"}'),e={name:"analytics.md"};function n(h,a,p,d,o,r){return l(),i("div",null,a[0]||(a[0]=[t(`

Analytics

loadGTag

Example:

ts
await loadGTag('UA-634xxxx-xx')
+// gtag is loaded now

loadGTM

Example:

ts
await loadGTM('GTM-WJ6xxx')
+// GTM is loaded now

loadHotjar

Example:

ts
await loadHotjar('19xxxxx')
+// Hotjar is loaded now
`,10)]))}const g=s(e,[["render",n]]);export{c as __pageData,g as default}; diff --git a/assets/analytics.md.CGSkOmQW.lean.js b/assets/analytics.md.CGSkOmQW.lean.js new file mode 100644 index 00000000..a319d5ee --- /dev/null +++ b/assets/analytics.md.CGSkOmQW.lean.js @@ -0,0 +1,4 @@ +import{_ as s,c as i,a0 as t,o as l}from"./chunks/framework.K5DDegrV.js";const c=JSON.parse('{"title":"Analytics","description":"","frontmatter":{},"headers":[],"relativePath":"analytics.md","filePath":"analytics.md"}'),e={name:"analytics.md"};function n(h,a,p,d,o,r){return l(),i("div",null,a[0]||(a[0]=[t(`

Analytics

loadGTag

Example:

ts
await loadGTag('UA-634xxxx-xx')
+// gtag is loaded now

loadGTM

Example:

ts
await loadGTM('GTM-WJ6xxx')
+// GTM is loaded now

loadHotjar

Example:

ts
await loadHotjar('19xxxxx')
+// Hotjar is loaded now
`,10)]))}const g=s(e,[["render",n]]);export{c as __pageData,g as default}; diff --git a/assets/app.Cx4Vz-5I.js b/assets/app.Cx4Vz-5I.js new file mode 100644 index 00000000..736ef5c4 --- /dev/null +++ b/assets/app.Cx4Vz-5I.js @@ -0,0 +1 @@ +import{t as i}from"./chunks/theme.Tglf3ptl.js";import{R as o,a3 as u,a4 as c,a5 as l,a6 as f,a7 as d,a8 as m,a9 as h,aa as g,ab as A,ac as v,d as P,u as y,v as C,s as b,ad as w,ae as R,af as E,ag as S}from"./chunks/framework.K5DDegrV.js";function p(e){if(e.extends){const a=p(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const s=p(i),T=P({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=y();return C(()=>{b(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&w(),R(),E(),s.setup&&s.setup(),()=>S(s.Layout)}});async function D(){globalThis.__VITEPRESS__=!0;const e=j(),a=_();a.provide(c,e);const t=l(e.route);return a.provide(f,t),a.component("Content",d),a.component("ClientOnly",m),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),s.enhanceApp&&await s.enhanceApp({app:a,router:e,siteData:h}),{app:a,router:e,data:t}}function _(){return g(T)}function j(){let e=o,a;return A(t=>{let n=v(t),r=null;return n&&(e&&(a=n),(e||a===n)&&(n=n.replace(/\.js$/,".lean.js")),r=import(n)),o&&(e=!1),r},s.NotFound)}o&&D().then(({app:e,router:a,data:t})=>{a.go().then(()=>{u(a.route,t.site),e.mount("#app")})});export{D as createApp}; diff --git a/assets/array.md.8RfkJEQT.js b/assets/array.md.8RfkJEQT.js new file mode 100644 index 00000000..298edd51 --- /dev/null +++ b/assets/array.md.8RfkJEQT.js @@ -0,0 +1,116 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Array","description":"","frontmatter":{},"headers":[],"relativePath":"array.md","filePath":"array.md"}'),t={name:"array.md"};function l(p,s,k,e,r,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Array

_range

Quickly generate an incremental array of numbers.

ts
_range(3)
+// [0, 1, 2]
+
+_range(3, 6)
+// [3, 4, 5]
+
+_range(1, 10, 2)
+// [1, 3, 5, 7, 9]

_chunk

Splits an input array into "chunks" of defined size. Last/remaining chunk may be of "incomplete" size. Returns array-of-arrays.

ts
const a = [1, 2, 3, 4, 5, 6]
+
+_chunk(a, 2)
+// [[1, 2], [3, 4], [5, 6]]
+
+_chunk(a, 3)
+// [[1, 2, 3], [4, 5, 6]]
+
+_chunk(a, 4)
+// [[1, 2, 3, 4], [5, 6]]]

_flatten

Polyfill to Array.flat() with depth=1. From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

ts
_flatten([
+  [1, 2],
+  [3, 4],
+])
+// [1, 2, 3, 4]

_flattenDeep

Based on https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep

Recursive Array.flat(), with infinite depth.

ts
_flattenDeep([
+  [
+    [1, 2],
+    [3, 4],
+  ],
+  [5, 6],
+  [7],
+])
+// [1, 2, 3, 4, 5, 6, 7]

_uniq

Convenience function to remove duplicates from an array of primitives.

ts
const a = [1, 2, 2, 3]
+_uniq(a)
+// [1, 2, 3]

_uniqBy

Remove duplicates from array of objects, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 18 }]
+_uniqBy(a, obj => obj.age)
+// [{ age: 18 }, { age: 20 }]

_by

ts
const a = [
+  { id: 'id1', a: 'a1' },
+  { id: 'id2', b: 'b1' },
+]
+
+_by(a, r => r.id)
+// {
+//  id1: {id: 'id1', a: 'a1'},
+//  id2: {id: 'id2', b: 'b1'},
+//}

_groupBy

ts
const a = [1, 2, 3, 4, 5]
+
+_groupBy(a, r => (r % 2 ? 'even' : 'odd'))
+// {
+//  odd: [1, 3, 5],
+//  even: [2, 4],
+// }

Returning undefined from the Mapper will EXCLUDE the item.

_sortBy

Sort an array of object, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 19 }]
+_sortBy(a, obj => obj.age)
+// [{ age: 18 }, {age: 19 }, { age: 20 }]

_sortNumbers

Sort an array of numbers. Needs a special treatment because of a caveat, that a default comparator function compares things as Strings (even Numbers), so '21' > '100'.

ts
const a = [1, 3, 2]
+_sortNumbers(a)
+// [1, 2, 3]

_findLast

Like .find(), but tries to find an element from the END of the array.

ts
const a = [1, 2, 3, 4, 5]
+_findLast(a, n => n % 2 === 0)
+// 4

_takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile

ts
const a = [1, 2, 3, 4, 5, 2, 1]
+
+_takeWhile(a, r => r <= 3)
+// [1, 2, 3]
+
+_takeRightWhile(a, r => r <= 3)
+// [1, 2]
+// Note that the order is reversed when taking from Right!
+
+_dropWhile(a, r => r <= 3)
+// [4, 5, 2, 1]
+
+_dropRightWhile(a, r => r <= 3)
+// [5, 4, 3, 2, 1]
+// Note that the order is reversed when dropping from Right!

_countBy

ts
_countBy(['a', 'aa', 'aaa', 'aaa', 'aaaa'], r => r.length)
+// {
+//   1: 1,
+//   2: 1,
+//   3: 2,
+//   4: 1,
+// })

_intersection

Inspired by Lodash's _.intersection.

ts
_intersection([2, 1], [2, 3])
+// [2]
+
+_intersection([1], [2])
+// []
+
+_intersection()
+// []
+
+_intersection([1])
+// [1]

_difference

Inspired by Lodash's _.difference

ts
_difference([2, 1], [2, 3])
+// [1]
+
+_difference([1], [2])
+// [1]
+
+_difference([1], [1])
+// []
+
+_difference([1])
+// [1]

_sum

Inspired by Lodash's _.sum

Same as Lodash, sum of empty array returns 0 (not NaN, not error)

ts
_sum([]) // 0
+_sum([1]) // 1
+_sum([1, 2]) // 3

_sumBy

Inspired by Lodash's _.sumBy

ts
const items = [
+  { a: 1 },
+  { a: 2 },
+  { b: 3 }, // \`a\` is undefined (not a number) here, will be treated as 0
+]
+
+_sumBy(items, i => i.a) // 1 + 2 + 0 == 3

_mapToObject

Map an array of T to a StringMap<V>, by returning a tuple of [key, value] from a mapper function.

Return undefined/null/false/0/void to filter out (not include) a value.

Similar to reduce, but with subjectively cleaner syntax of returning "entries".

Similar to mapping to "entries" and passing to Object.fromEntries().

ts
_mapToObject([1, 2, 3], n => [n, n * 2])
+// { '1': 2, '2': 4, '3': 6 }
+
+_mapToObject([1, 2, 3], n => [n, \`id\${n}\`])
+// { '1': 'id1, '2': 'id2', '3': 'id3' }

_shuffle

Randomly shuffle an array values.

Uses Fisher–Yates algorithm.

Based on: https://stackoverflow.com/a/12646864/4919972

ts
const a = [1, 2, 3, 4, 5]
+const b = _shuffle(a)
+// [3, 1, 2, 5, 4]
+
+// Mutating example
+_shuffle(a)
+// a == [4, 2, 3, 1, 5]

_last

Returns last element of the array, or undefined if the array is empty.

Very simple semantic convenience method (lodash-inspired).

ts
const a = [1, 2, 3]
+_last(a) // 3
+
+const a = []
+_last(a) // undefined
`,67)]))}const y=i(t,[["render",l]]);export{g as __pageData,y as default}; diff --git a/assets/array.md.8RfkJEQT.lean.js b/assets/array.md.8RfkJEQT.lean.js new file mode 100644 index 00000000..298edd51 --- /dev/null +++ b/assets/array.md.8RfkJEQT.lean.js @@ -0,0 +1,116 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Array","description":"","frontmatter":{},"headers":[],"relativePath":"array.md","filePath":"array.md"}'),t={name:"array.md"};function l(p,s,k,e,r,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Array

_range

Quickly generate an incremental array of numbers.

ts
_range(3)
+// [0, 1, 2]
+
+_range(3, 6)
+// [3, 4, 5]
+
+_range(1, 10, 2)
+// [1, 3, 5, 7, 9]

_chunk

Splits an input array into "chunks" of defined size. Last/remaining chunk may be of "incomplete" size. Returns array-of-arrays.

ts
const a = [1, 2, 3, 4, 5, 6]
+
+_chunk(a, 2)
+// [[1, 2], [3, 4], [5, 6]]
+
+_chunk(a, 3)
+// [[1, 2, 3], [4, 5, 6]]
+
+_chunk(a, 4)
+// [[1, 2, 3, 4], [5, 6]]]

_flatten

Polyfill to Array.flat() with depth=1. From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

ts
_flatten([
+  [1, 2],
+  [3, 4],
+])
+// [1, 2, 3, 4]

_flattenDeep

Based on https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep

Recursive Array.flat(), with infinite depth.

ts
_flattenDeep([
+  [
+    [1, 2],
+    [3, 4],
+  ],
+  [5, 6],
+  [7],
+])
+// [1, 2, 3, 4, 5, 6, 7]

_uniq

Convenience function to remove duplicates from an array of primitives.

ts
const a = [1, 2, 2, 3]
+_uniq(a)
+// [1, 2, 3]

_uniqBy

Remove duplicates from array of objects, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 18 }]
+_uniqBy(a, obj => obj.age)
+// [{ age: 18 }, { age: 20 }]

_by

ts
const a = [
+  { id: 'id1', a: 'a1' },
+  { id: 'id2', b: 'b1' },
+]
+
+_by(a, r => r.id)
+// {
+//  id1: {id: 'id1', a: 'a1'},
+//  id2: {id: 'id2', b: 'b1'},
+//}

_groupBy

ts
const a = [1, 2, 3, 4, 5]
+
+_groupBy(a, r => (r % 2 ? 'even' : 'odd'))
+// {
+//  odd: [1, 3, 5],
+//  even: [2, 4],
+// }

Returning undefined from the Mapper will EXCLUDE the item.

_sortBy

Sort an array of object, providing a comparator function.

ts
const a = [{ age: 18 }, { age: 20 }, { age: 19 }]
+_sortBy(a, obj => obj.age)
+// [{ age: 18 }, {age: 19 }, { age: 20 }]

_sortNumbers

Sort an array of numbers. Needs a special treatment because of a caveat, that a default comparator function compares things as Strings (even Numbers), so '21' > '100'.

ts
const a = [1, 3, 2]
+_sortNumbers(a)
+// [1, 2, 3]

_findLast

Like .find(), but tries to find an element from the END of the array.

ts
const a = [1, 2, 3, 4, 5]
+_findLast(a, n => n % 2 === 0)
+// 4

_takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile

ts
const a = [1, 2, 3, 4, 5, 2, 1]
+
+_takeWhile(a, r => r <= 3)
+// [1, 2, 3]
+
+_takeRightWhile(a, r => r <= 3)
+// [1, 2]
+// Note that the order is reversed when taking from Right!
+
+_dropWhile(a, r => r <= 3)
+// [4, 5, 2, 1]
+
+_dropRightWhile(a, r => r <= 3)
+// [5, 4, 3, 2, 1]
+// Note that the order is reversed when dropping from Right!

_countBy

ts
_countBy(['a', 'aa', 'aaa', 'aaa', 'aaaa'], r => r.length)
+// {
+//   1: 1,
+//   2: 1,
+//   3: 2,
+//   4: 1,
+// })

_intersection

Inspired by Lodash's _.intersection.

ts
_intersection([2, 1], [2, 3])
+// [2]
+
+_intersection([1], [2])
+// []
+
+_intersection()
+// []
+
+_intersection([1])
+// [1]

_difference

Inspired by Lodash's _.difference

ts
_difference([2, 1], [2, 3])
+// [1]
+
+_difference([1], [2])
+// [1]
+
+_difference([1], [1])
+// []
+
+_difference([1])
+// [1]

_sum

Inspired by Lodash's _.sum

Same as Lodash, sum of empty array returns 0 (not NaN, not error)

ts
_sum([]) // 0
+_sum([1]) // 1
+_sum([1, 2]) // 3

_sumBy

Inspired by Lodash's _.sumBy

ts
const items = [
+  { a: 1 },
+  { a: 2 },
+  { b: 3 }, // \`a\` is undefined (not a number) here, will be treated as 0
+]
+
+_sumBy(items, i => i.a) // 1 + 2 + 0 == 3

_mapToObject

Map an array of T to a StringMap<V>, by returning a tuple of [key, value] from a mapper function.

Return undefined/null/false/0/void to filter out (not include) a value.

Similar to reduce, but with subjectively cleaner syntax of returning "entries".

Similar to mapping to "entries" and passing to Object.fromEntries().

ts
_mapToObject([1, 2, 3], n => [n, n * 2])
+// { '1': 2, '2': 4, '3': 6 }
+
+_mapToObject([1, 2, 3], n => [n, \`id\${n}\`])
+// { '1': 'id1, '2': 'id2', '3': 'id3' }

_shuffle

Randomly shuffle an array values.

Uses Fisher–Yates algorithm.

Based on: https://stackoverflow.com/a/12646864/4919972

ts
const a = [1, 2, 3, 4, 5]
+const b = _shuffle(a)
+// [3, 1, 2, 5, 4]
+
+// Mutating example
+_shuffle(a)
+// a == [4, 2, 3, 1, 5]

_last

Returns last element of the array, or undefined if the array is empty.

Very simple semantic convenience method (lodash-inspired).

ts
const a = [1, 2, 3]
+_last(a) // 3
+
+const a = []
+_last(a) // undefined
`,67)]))}const y=i(t,[["render",l]]);export{g as __pageData,y as default}; diff --git a/assets/bot.md.Ca1yqwEI.js b/assets/bot.md.Ca1yqwEI.js new file mode 100644 index 00000000..165cdcc0 --- /dev/null +++ b/assets/bot.md.Ca1yqwEI.js @@ -0,0 +1,11 @@ +import{c as p,j as n,a as o,G as c,a0 as d,t as i,k as a,B as k,o as g}from"./chunks/framework.K5DDegrV.js";import{i as r}from"./chunks/env.bTBnF6u3.js";class u{constructor(s={}){this.cfg=s}isBotOrCDP(){return!!this.getBotReason()||this.isCDP()}isBot(){return!!this.getBotReason()}getBotReason(){return this.cfg.memoizeResults&&this.botReason!==void 0?this.botReason:(this.botReason=this.detectBotReason(),this.botReason)}detectBotReason(){if(r())return null;const{navigator:s}=globalThis;if(!s)return 1;const{userAgent:e}=s;return e?/bot|headless|electron|phantom|slimer/i.test(e)?3:s.webdriver?4:s.languages===""?6:this.cfg.treatCDPAsBotReason&&this.detectCDP()?8:null:2}isCDP(){return this.cfg.memoizeResults&&this.cdp!==void 0?this.cdp:(this.cdp=this.detectCDP(),this.cdp)}detectCDP(){if(r())return!1;let s=!1;try{const e=new window.Error;window.Object.defineProperty(e,"stack",{configurable:!1,enumerable:!1,get:function(){return s=!0,""}}),window.console.debug(e)}catch{}return s}}const D={id:"botdetectionservice",tabindex:"-1"},b=JSON.parse('{"title":"BotDetectionService","description":"","frontmatter":{},"headers":[],"relativePath":"bot.md","filePath":"bot.md"}'),E={name:"bot.md"},f=Object.assign(E,{setup(l){const s=new u;return(e,t)=>{const h=k("Badge");return g(),p("div",null,[n("h1",D,[t[0]||(t[0]=o("BotDetectionService ")),c(h,{text:"experimental",type:"warning"}),t[1]||(t[1]=o()),t[2]||(t[2]=n("a",{class:"header-anchor",href:"#botdetectionservice","aria-label":'Permalink to "BotDetectionService "'},"​",-1))]),t[3]||(t[3]=d(`

Allows to detect simple (non-sophisticated) bots.

Example usage:

ts
import { BotDetectionService } from '@naturalcycles/js-lib'
+
+const botDetectionService = new BotDetectionService()
+
+botDetectionService.isBot() // true/false
+botDetectionService.isCDP() // true/false
+botDetectionService.getBotReason() // BotReason enum

Demo

`,4)),n("pre",null,"isBot: "+i(a(s).isBot())+` +isCDP: `+i(a(s).isCDP())+` +isBotOrCDP: `+i(a(s).isBotOrCDP())+` +botReason: `+i(a(s).getBotReason()||"null")+` +`,1)])}}});export{b as __pageData,f as default}; diff --git a/assets/bot.md.Ca1yqwEI.lean.js b/assets/bot.md.Ca1yqwEI.lean.js new file mode 100644 index 00000000..165cdcc0 --- /dev/null +++ b/assets/bot.md.Ca1yqwEI.lean.js @@ -0,0 +1,11 @@ +import{c as p,j as n,a as o,G as c,a0 as d,t as i,k as a,B as k,o as g}from"./chunks/framework.K5DDegrV.js";import{i as r}from"./chunks/env.bTBnF6u3.js";class u{constructor(s={}){this.cfg=s}isBotOrCDP(){return!!this.getBotReason()||this.isCDP()}isBot(){return!!this.getBotReason()}getBotReason(){return this.cfg.memoizeResults&&this.botReason!==void 0?this.botReason:(this.botReason=this.detectBotReason(),this.botReason)}detectBotReason(){if(r())return null;const{navigator:s}=globalThis;if(!s)return 1;const{userAgent:e}=s;return e?/bot|headless|electron|phantom|slimer/i.test(e)?3:s.webdriver?4:s.languages===""?6:this.cfg.treatCDPAsBotReason&&this.detectCDP()?8:null:2}isCDP(){return this.cfg.memoizeResults&&this.cdp!==void 0?this.cdp:(this.cdp=this.detectCDP(),this.cdp)}detectCDP(){if(r())return!1;let s=!1;try{const e=new window.Error;window.Object.defineProperty(e,"stack",{configurable:!1,enumerable:!1,get:function(){return s=!0,""}}),window.console.debug(e)}catch{}return s}}const D={id:"botdetectionservice",tabindex:"-1"},b=JSON.parse('{"title":"BotDetectionService","description":"","frontmatter":{},"headers":[],"relativePath":"bot.md","filePath":"bot.md"}'),E={name:"bot.md"},f=Object.assign(E,{setup(l){const s=new u;return(e,t)=>{const h=k("Badge");return g(),p("div",null,[n("h1",D,[t[0]||(t[0]=o("BotDetectionService ")),c(h,{text:"experimental",type:"warning"}),t[1]||(t[1]=o()),t[2]||(t[2]=n("a",{class:"header-anchor",href:"#botdetectionservice","aria-label":'Permalink to "BotDetectionService "'},"​",-1))]),t[3]||(t[3]=d(`

Allows to detect simple (non-sophisticated) bots.

Example usage:

ts
import { BotDetectionService } from '@naturalcycles/js-lib'
+
+const botDetectionService = new BotDetectionService()
+
+botDetectionService.isBot() // true/false
+botDetectionService.isCDP() // true/false
+botDetectionService.getBotReason() // BotReason enum

Demo

`,4)),n("pre",null,"isBot: "+i(a(s).isBot())+` +isCDP: `+i(a(s).isCDP())+` +isBotOrCDP: `+i(a(s).isBotOrCDP())+` +botReason: `+i(a(s).getBotReason()||"null")+` +`,1)])}}});export{b as __pageData,f as default}; diff --git a/assets/chunks/env.bTBnF6u3.js b/assets/chunks/env.bTBnF6u3.js new file mode 100644 index 00000000..16e5d4a6 --- /dev/null +++ b/assets/chunks/env.bTBnF6u3.js @@ -0,0 +1 @@ +function e(){return typeof window>"u"}export{e as i}; diff --git a/assets/chunks/framework.K5DDegrV.js b/assets/chunks/framework.K5DDegrV.js new file mode 100644 index 00000000..e9513057 --- /dev/null +++ b/assets/chunks/framework.K5DDegrV.js @@ -0,0 +1,18 @@ +/** +* @vue/shared v3.5.12 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**//*! #__NO_SIDE_EFFECTS__ */function Rs(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Z={},xt=[],Ue=()=>{},Co=()=>!1,Xt=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Os=e=>e.startsWith("onUpdate:"),oe=Object.assign,Ms=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},To=Object.prototype.hasOwnProperty,z=(e,t)=>To.call(e,t),U=Array.isArray,Et=e=>Tn(e)==="[object Map]",Br=e=>Tn(e)==="[object Set]",q=e=>typeof e=="function",re=e=>typeof e=="string",Ge=e=>typeof e=="symbol",ne=e=>e!==null&&typeof e=="object",kr=e=>(ne(e)||q(e))&&q(e.then)&&q(e.catch),Wr=Object.prototype.toString,Tn=e=>Wr.call(e),Ao=e=>Tn(e).slice(8,-1),Kr=e=>Tn(e)==="[object Object]",Is=e=>re(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ct=Rs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),An=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Ro=/-(\w)/g,Pe=An(e=>e.replace(Ro,(t,n)=>n?n.toUpperCase():"")),Oo=/\B([A-Z])/g,st=An(e=>e.replace(Oo,"-$1").toLowerCase()),Rn=An(e=>e.charAt(0).toUpperCase()+e.slice(1)),dn=An(e=>e?`on${Rn(e)}`:""),et=(e,t)=>!Object.is(e,t),hn=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},hs=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Mo=e=>{const t=re(e)?Number(e):NaN;return isNaN(t)?e:t};let zs;const On=()=>zs||(zs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ps(e){if(U(e)){const t={};for(let n=0;n{if(n){const s=n.split(Po);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function Ls(e){let t="";if(re(e))t=e;else if(U(e))for(let n=0;n!!(e&&e.__v_isRef===!0),$o=e=>re(e)?e:e==null?"":U(e)||ne(e)&&(e.toString===Wr||!q(e.toString))?Yr(e)?$o(e.value):JSON.stringify(e,Xr,2):String(e),Xr=(e,t)=>Yr(t)?Xr(e,t.value):Et(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],i)=>(n[qn(s,i)+" =>"]=r,n),{})}:Br(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>qn(n))}:Ge(t)?qn(t):ne(t)&&!U(t)&&!Kr(t)?String(t):t,qn=(e,t="")=>{var n;return Ge(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/** +* @vue/reactivity v3.5.12 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let be;class Do{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=be,!t&&be&&(this.index=(be.scopes||(be.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0)return;if($t){let t=$t;for($t=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ht;){let t=Ht;for(Ht=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function ei(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ti(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),Hs(s),Vo(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function ps(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ni(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ni(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ut))return;e.globalVersion=Ut;const t=e.dep;if(e.flags|=2,t.version>0&&!e.isSSR&&e.deps&&!ps(e)){e.flags&=-3;return}const n=te,s=Ne;te=e,Ne=!0;try{ei(e);const r=e.fn(e._value);(t.version===0||et(r,e._value))&&(e._value=r,t.version++)}catch(r){throw t.version++,r}finally{te=n,Ne=s,ti(e),e.flags&=-3}}function Hs(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Hs(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Vo(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Ne=!0;const si=[];function rt(){si.push(Ne),Ne=!1}function it(){const e=si.pop();Ne=e===void 0?!0:e}function Qs(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=te;te=void 0;try{t()}finally{te=n}}}let Ut=0;class Uo{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Mn{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(t){if(!te||!Ne||te===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==te)n=this.activeLink=new Uo(te,this),te.deps?(n.prevDep=te.depsTail,te.depsTail.nextDep=n,te.depsTail=n):te.deps=te.depsTail=n,ri(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=te.depsTail,n.nextDep=void 0,te.depsTail.nextDep=n,te.depsTail=n,te.deps===n&&(te.deps=s)}return n}trigger(t){this.version++,Ut++,this.notify(t)}notify(t){Ns();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Fs()}}}function ri(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)ri(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const vn=new WeakMap,dt=Symbol(""),gs=Symbol(""),Bt=Symbol("");function me(e,t,n){if(Ne&&te){let s=vn.get(e);s||vn.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new Mn),r.map=s,r.key=n),r.track()}}function We(e,t,n,s,r,i){const o=vn.get(e);if(!o){Ut++;return}const l=c=>{c&&c.trigger()};if(Ns(),t==="clear")o.forEach(l);else{const c=U(e),u=c&&Is(n);if(c&&n==="length"){const f=Number(s);o.forEach((h,y)=>{(y==="length"||y===Bt||!Ge(y)&&y>=f)&&l(h)})}else switch((n!==void 0||o.has(void 0))&&l(o.get(n)),u&&l(o.get(Bt)),t){case"add":c?u&&l(o.get("length")):(l(o.get(dt)),Et(e)&&l(o.get(gs)));break;case"delete":c||(l(o.get(dt)),Et(e)&&l(o.get(gs)));break;case"set":Et(e)&&l(o.get(dt));break}}Fs()}function Bo(e,t){const n=vn.get(e);return n&&n.get(t)}function _t(e){const t=J(e);return t===e?t:(me(t,"iterate",Bt),Ie(e)?t:t.map(ye))}function In(e){return me(e=J(e),"iterate",Bt),e}const ko={__proto__:null,[Symbol.iterator](){return Yn(this,Symbol.iterator,ye)},concat(...e){return _t(this).concat(...e.map(t=>U(t)?_t(t):t))},entries(){return Yn(this,"entries",e=>(e[1]=ye(e[1]),e))},every(e,t){return Be(this,"every",e,t,void 0,arguments)},filter(e,t){return Be(this,"filter",e,t,n=>n.map(ye),arguments)},find(e,t){return Be(this,"find",e,t,ye,arguments)},findIndex(e,t){return Be(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Be(this,"findLast",e,t,ye,arguments)},findLastIndex(e,t){return Be(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Be(this,"forEach",e,t,void 0,arguments)},includes(...e){return Xn(this,"includes",e)},indexOf(...e){return Xn(this,"indexOf",e)},join(e){return _t(this).join(e)},lastIndexOf(...e){return Xn(this,"lastIndexOf",e)},map(e,t){return Be(this,"map",e,t,void 0,arguments)},pop(){return Lt(this,"pop")},push(...e){return Lt(this,"push",e)},reduce(e,...t){return Zs(this,"reduce",e,t)},reduceRight(e,...t){return Zs(this,"reduceRight",e,t)},shift(){return Lt(this,"shift")},some(e,t){return Be(this,"some",e,t,void 0,arguments)},splice(...e){return Lt(this,"splice",e)},toReversed(){return _t(this).toReversed()},toSorted(e){return _t(this).toSorted(e)},toSpliced(...e){return _t(this).toSpliced(...e)},unshift(...e){return Lt(this,"unshift",e)},values(){return Yn(this,"values",ye)}};function Yn(e,t,n){const s=In(e),r=s[t]();return s!==e&&!Ie(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.value&&(i.value=n(i.value)),i}),r}const Wo=Array.prototype;function Be(e,t,n,s,r,i){const o=In(e),l=o!==e&&!Ie(e),c=o[t];if(c!==Wo[t]){const h=c.apply(e,i);return l?ye(h):h}let u=n;o!==e&&(l?u=function(h,y){return n.call(this,ye(h),y,e)}:n.length>2&&(u=function(h,y){return n.call(this,h,y,e)}));const f=c.call(o,u,s);return l&&r?r(f):f}function Zs(e,t,n,s){const r=In(e);let i=n;return r!==e&&(Ie(e)?n.length>3&&(i=function(o,l,c){return n.call(this,o,l,c,e)}):i=function(o,l,c){return n.call(this,o,ye(l),c,e)}),r[t](i,...s)}function Xn(e,t,n){const s=J(e);me(s,"iterate",Bt);const r=s[t](...n);return(r===-1||r===!1)&&js(n[0])?(n[0]=J(n[0]),s[t](...n)):r}function Lt(e,t,n=[]){rt(),Ns();const s=J(e)[t].apply(e,n);return Fs(),it(),s}const Ko=Rs("__proto__,__v_isRef,__isVue"),ii=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ge));function qo(e){Ge(e)||(e=String(e));const t=J(this);return me(t,"has",e),t.hasOwnProperty(e)}class oi{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(r?i?nl:fi:i?ai:ci).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=U(t);if(!r){let c;if(o&&(c=ko[n]))return c;if(n==="hasOwnProperty")return qo}const l=Reflect.get(t,n,ae(t)?t:s);return(Ge(n)?ii.has(n):Ko(n))||(r||me(t,"get",n),i)?l:ae(l)?o&&Is(n)?l:l.value:ne(l)?r?Ln(l):Pn(l):l}}class li extends oi{constructor(t=!1){super(!1,t)}set(t,n,s,r){let i=t[n];if(!this._isShallow){const c=yt(i);if(!Ie(s)&&!yt(s)&&(i=J(i),s=J(s)),!U(t)&&ae(i)&&!ae(s))return c?!1:(i.value=s,!0)}const o=U(t)&&Is(n)?Number(n)e,en=e=>Reflect.getPrototypeOf(e);function zo(e,t,n){return function(...s){const r=this.__v_raw,i=J(r),o=Et(i),l=e==="entries"||e===Symbol.iterator&&o,c=e==="keys"&&o,u=r[e](...s),f=n?ms:t?ys:ye;return!t&&me(i,"iterate",c?gs:dt),{next(){const{value:h,done:y}=u.next();return y?{value:h,done:y}:{value:l?[f(h[0]),f(h[1])]:f(h),done:y}},[Symbol.iterator](){return this}}}}function tn(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Qo(e,t){const n={get(r){const i=this.__v_raw,o=J(i),l=J(r);e||(et(r,l)&&me(o,"get",r),me(o,"get",l));const{has:c}=en(o),u=t?ms:e?ys:ye;if(c.call(o,r))return u(i.get(r));if(c.call(o,l))return u(i.get(l));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&me(J(r),"iterate",dt),Reflect.get(r,"size",r)},has(r){const i=this.__v_raw,o=J(i),l=J(r);return e||(et(r,l)&&me(o,"has",r),me(o,"has",l)),r===l?i.has(r):i.has(r)||i.has(l)},forEach(r,i){const o=this,l=o.__v_raw,c=J(l),u=t?ms:e?ys:ye;return!e&&me(c,"iterate",dt),l.forEach((f,h)=>r.call(i,u(f),u(h),o))}};return oe(n,e?{add:tn("add"),set:tn("set"),delete:tn("delete"),clear:tn("clear")}:{add(r){!t&&!Ie(r)&&!yt(r)&&(r=J(r));const i=J(this);return en(i).has.call(i,r)||(i.add(r),We(i,"add",r,r)),this},set(r,i){!t&&!Ie(i)&&!yt(i)&&(i=J(i));const o=J(this),{has:l,get:c}=en(o);let u=l.call(o,r);u||(r=J(r),u=l.call(o,r));const f=c.call(o,r);return o.set(r,i),u?et(i,f)&&We(o,"set",r,i):We(o,"add",r,i),this},delete(r){const i=J(this),{has:o,get:l}=en(i);let c=o.call(i,r);c||(r=J(r),c=o.call(i,r)),l&&l.call(i,r);const u=i.delete(r);return c&&We(i,"delete",r,void 0),u},clear(){const r=J(this),i=r.size!==0,o=r.clear();return i&&We(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=zo(r,e,t)}),n}function $s(e,t){const n=Qo(e,t);return(s,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(z(n,r)&&r in s?n:s,r,i)}const Zo={get:$s(!1,!1)},el={get:$s(!1,!0)},tl={get:$s(!0,!1)};const ci=new WeakMap,ai=new WeakMap,fi=new WeakMap,nl=new WeakMap;function sl(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function rl(e){return e.__v_skip||!Object.isExtensible(e)?0:sl(Ao(e))}function Pn(e){return yt(e)?e:Ds(e,!1,Yo,Zo,ci)}function il(e){return Ds(e,!1,Jo,el,ai)}function Ln(e){return Ds(e,!0,Xo,tl,fi)}function Ds(e,t,n,s,r){if(!ne(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=r.get(e);if(i)return i;const o=rl(e);if(o===0)return e;const l=new Proxy(e,o===2?s:n);return r.set(e,l),l}function ht(e){return yt(e)?ht(e.__v_raw):!!(e&&e.__v_isReactive)}function yt(e){return!!(e&&e.__v_isReadonly)}function Ie(e){return!!(e&&e.__v_isShallow)}function js(e){return e?!!e.__v_raw:!1}function J(e){const t=e&&e.__v_raw;return t?J(t):e}function pn(e){return!z(e,"__v_skip")&&Object.isExtensible(e)&&qr(e,"__v_skip",!0),e}const ye=e=>ne(e)?Pn(e):e,ys=e=>ne(e)?Ln(e):e;function ae(e){return e?e.__v_isRef===!0:!1}function de(e){return di(e,!1)}function ui(e){return di(e,!0)}function di(e,t){return ae(e)?e:new ol(e,t)}class ol{constructor(t,n){this.dep=new Mn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:J(t),this._value=n?t:ye(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||Ie(t)||yt(t);t=s?t:J(t),et(t,n)&&(this._rawValue=t,this._value=s?t:ye(t),this.dep.trigger())}}function hi(e){return ae(e)?e.value:e}const ll={get:(e,t,n)=>t==="__v_raw"?e:hi(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return ae(r)&&!ae(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function pi(e){return ht(e)?e:new Proxy(e,ll)}class cl{constructor(t){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Mn,{get:s,set:r}=t(n.track.bind(n),n.trigger.bind(n));this._get=s,this._set=r}get value(){return this._value=this._get()}set value(t){this._set(t)}}function al(e){return new cl(e)}class fl{constructor(t,n,s){this._object=t,this._key=n,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return Bo(J(this._object),this._key)}}class ul{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function dl(e,t,n){return ae(e)?e:q(e)?new ul(e):ne(e)&&arguments.length>1?hl(e,t,n):de(e)}function hl(e,t,n){const s=e[t];return ae(s)?s:new fl(e,t,n)}class pl{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Mn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ut-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&te!==this)return Zr(this,!0),!0}get value(){const t=this.dep.track();return ni(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function gl(e,t,n=!1){let s,r;return q(e)?s=e:(s=e.get,r=e.set),new pl(s,r,n)}const nn={},_n=new WeakMap;let ft;function ml(e,t=!1,n=ft){if(n){let s=_n.get(n);s||_n.set(n,s=[]),s.push(e)}}function yl(e,t,n=Z){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:l,call:c}=n,u=p=>r?p:Ie(p)||r===!1||r===0?Ke(p,1):Ke(p);let f,h,y,b,P=!1,O=!1;if(ae(e)?(h=()=>e.value,P=Ie(e)):ht(e)?(h=()=>u(e),P=!0):U(e)?(O=!0,P=e.some(p=>ht(p)||Ie(p)),h=()=>e.map(p=>{if(ae(p))return p.value;if(ht(p))return u(p);if(q(p))return c?c(p,2):p()})):q(e)?t?h=c?()=>c(e,2):e:h=()=>{if(y){rt();try{y()}finally{it()}}const p=ft;ft=f;try{return c?c(e,3,[b]):e(b)}finally{ft=p}}:h=Ue,t&&r){const p=h,R=r===!0?1/0:r;h=()=>Ke(p(),R)}const G=Jr(),B=()=>{f.stop(),G&&Ms(G.effects,f)};if(i&&t){const p=t;t=(...R)=>{p(...R),B()}}let W=O?new Array(e.length).fill(nn):nn;const g=p=>{if(!(!(f.flags&1)||!f.dirty&&!p))if(t){const R=f.run();if(r||P||(O?R.some((D,j)=>et(D,W[j])):et(R,W))){y&&y();const D=ft;ft=f;try{const j=[R,W===nn?void 0:O&&W[0]===nn?[]:W,b];c?c(t,3,j):t(...j),W=R}finally{ft=D}}}else f.run()};return l&&l(g),f=new zr(h),f.scheduler=o?()=>o(g,!1):g,b=p=>ml(p,!1,f),y=f.onStop=()=>{const p=_n.get(f);if(p){if(c)c(p,4);else for(const R of p)R();_n.delete(f)}},t?s?g(!0):W=f.run():o?o(g.bind(null,!0),!0):f.run(),B.pause=f.pause.bind(f),B.resume=f.resume.bind(f),B.stop=B,B}function Ke(e,t=1/0,n){if(t<=0||!ne(e)||e.__v_skip||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,ae(e))Ke(e.value,t,n);else if(U(e))for(let s=0;s{Ke(s,t,n)});else if(Kr(e)){for(const s in e)Ke(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&Ke(e[s],t,n)}return e}/** +* @vue/runtime-core v3.5.12 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Jt(e,t,n,s){try{return s?e(...s):e()}catch(r){Nn(r,t,n)}}function He(e,t,n,s){if(q(e)){const r=Jt(e,t,n,s);return r&&kr(r)&&r.catch(i=>{Nn(i,t,n)}),r}if(U(e)){const r=[];for(let i=0;i>>1,r=we[s],i=kt(r);i=kt(n)?we.push(e):we.splice(_l(t),0,e),e.flags|=1,mi()}}function mi(){bn||(bn=gi.then(yi))}function bl(e){U(e)?Tt.push(...e):ze&&e.id===-1?ze.splice(wt+1,0,e):e.flags&1||(Tt.push(e),e.flags|=1),mi()}function er(e,t,n=je+1){for(;nkt(n)-kt(s));if(Tt.length=0,ze){ze.push(...t);return}for(ze=t,wt=0;wte.id==null?e.flags&2?-1:1/0:e.id;function yi(e){try{for(je=0;je{s._d&&dr(-1);const i=Sn(t);let o;try{o=e(...r)}finally{Sn(i),s._d&&dr(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function ef(e,t){if(ce===null)return e;const n=Bn(ce),s=e.dirs||(e.dirs=[]);for(let r=0;re.__isTeleport,Qe=Symbol("_leaveCb"),sn=Symbol("_enterCb");function xl(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Mt(()=>{e.isMounted=!0}),Ri(()=>{e.isUnmounting=!0}),e}const Re=[Function,Array],bi={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Re,onEnter:Re,onAfterEnter:Re,onEnterCancelled:Re,onBeforeLeave:Re,onLeave:Re,onAfterLeave:Re,onLeaveCancelled:Re,onBeforeAppear:Re,onAppear:Re,onAfterAppear:Re,onAppearCancelled:Re},wi=e=>{const t=e.subTree;return t.component?wi(t.component):t},El={name:"BaseTransition",props:bi,setup(e,{slots:t}){const n=Un(),s=xl();return()=>{const r=t.default&&Ei(t.default(),!0);if(!r||!r.length)return;const i=Si(r),o=J(e),{mode:l}=o;if(s.isLeaving)return Jn(i);const c=tr(i);if(!c)return Jn(i);let u=vs(c,o,s,n,y=>u=y);c.type!==ve&&Wt(c,u);const f=n.subTree,h=f&&tr(f);if(h&&h.type!==ve&&!ut(c,h)&&wi(n).type!==ve){const y=vs(h,o,s,n);if(Wt(h,y),l==="out-in"&&c.type!==ve)return s.isLeaving=!0,y.afterLeave=()=>{s.isLeaving=!1,n.job.flags&8||n.update(),delete y.afterLeave},Jn(i);l==="in-out"&&c.type!==ve&&(y.delayLeave=(b,P,O)=>{const G=xi(s,h);G[String(h.key)]=h,b[Qe]=()=>{P(),b[Qe]=void 0,delete u.delayedLeave},u.delayedLeave=O})}return i}}};function Si(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==ve){t=n;break}}return t}const Cl=El;function xi(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function vs(e,t,n,s,r){const{appear:i,mode:o,persisted:l=!1,onBeforeEnter:c,onEnter:u,onAfterEnter:f,onEnterCancelled:h,onBeforeLeave:y,onLeave:b,onAfterLeave:P,onLeaveCancelled:O,onBeforeAppear:G,onAppear:B,onAfterAppear:W,onAppearCancelled:g}=t,p=String(e.key),R=xi(n,e),D=(I,_)=>{I&&He(I,s,9,_)},j=(I,_)=>{const L=_[1];D(I,_),U(I)?I.every(S=>S.length<=1)&&L():I.length<=1&&L()},K={mode:o,persisted:l,beforeEnter(I){let _=c;if(!n.isMounted)if(i)_=G||c;else return;I[Qe]&&I[Qe](!0);const L=R[p];L&&ut(e,L)&&L.el[Qe]&&L.el[Qe](),D(_,[I])},enter(I){let _=u,L=f,S=h;if(!n.isMounted)if(i)_=B||u,L=W||f,S=g||h;else return;let V=!1;const se=I[sn]=le=>{V||(V=!0,le?D(S,[I]):D(L,[I]),K.delayedLeave&&K.delayedLeave(),I[sn]=void 0)};_?j(_,[I,se]):se()},leave(I,_){const L=String(e.key);if(I[sn]&&I[sn](!0),n.isUnmounting)return _();D(y,[I]);let S=!1;const V=I[Qe]=se=>{S||(S=!0,_(),se?D(O,[I]):D(P,[I]),I[Qe]=void 0,R[L]===e&&delete R[L])};R[L]=e,b?j(b,[I,V]):V()},clone(I){const _=vs(I,t,n,s,r);return r&&r(_),_}};return K}function Jn(e){if(Hn(e))return e=nt(e),e.children=null,e}function tr(e){if(!Hn(e))return _i(e.type)&&e.children?Si(e.children):e;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&q(n.default))return n.default()}}function Wt(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Wt(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Ei(e,t=!1,n){let s=[],r=0;for(let i=0;i1)for(let i=0;ixn(P,t&&(U(t)?t[O]:t),n,s,r));return}if(pt(s)&&!r)return;const i=s.shapeFlag&4?Bn(s.component):s.el,o=r?null:i,{i:l,r:c}=e,u=t&&t.r,f=l.refs===Z?l.refs={}:l.refs,h=l.setupState,y=J(h),b=h===Z?()=>!1:P=>z(y,P);if(u!=null&&u!==c&&(re(u)?(f[u]=null,b(u)&&(h[u]=null)):ae(u)&&(u.value=null)),q(c))Jt(c,l,12,[o,f]);else{const P=re(c),O=ae(c);if(P||O){const G=()=>{if(e.f){const B=P?b(c)?h[c]:f[c]:c.value;r?U(B)&&Ms(B,i):U(B)?B.includes(i)||B.push(i):P?(f[c]=[i],b(c)&&(h[c]=f[c])):(c.value=[i],e.k&&(f[e.k]=c.value))}else P?(f[c]=o,b(c)&&(h[c]=o)):O&&(c.value=o,e.k&&(f[e.k]=o))};o?(G.id=-1,Te(G,n)):G()}}}let nr=!1;const bt=()=>{nr||(console.error("Hydration completed but contains mismatches."),nr=!0)},Tl=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",Al=e=>e.namespaceURI.includes("MathML"),rn=e=>{if(e.nodeType===1){if(Tl(e))return"svg";if(Al(e))return"mathml"}},on=e=>e.nodeType===8;function Rl(e){const{mt:t,p:n,o:{patchProp:s,createText:r,nextSibling:i,parentNode:o,remove:l,insert:c,createComment:u}}=e,f=(g,p)=>{if(!p.hasChildNodes()){n(null,g,p),wn(),p._vnode=g;return}h(p.firstChild,g,null,null,null),wn(),p._vnode=g},h=(g,p,R,D,j,K=!1)=>{K=K||!!p.dynamicChildren;const I=on(g)&&g.data==="[",_=()=>O(g,p,R,D,j,I),{type:L,ref:S,shapeFlag:V,patchFlag:se}=p;let le=g.nodeType;p.el=g,se===-2&&(K=!1,p.dynamicChildren=null);let H=null;switch(L){case gt:le!==3?p.children===""?(c(p.el=r(""),o(g),g),H=g):H=_():(g.data!==p.children&&(bt(),g.data=p.children),H=i(g));break;case ve:W(g)?(H=i(g),B(p.el=g.content.firstChild,g,R)):le!==8||I?H=_():H=i(g);break;case jt:if(I&&(g=i(g),le=g.nodeType),le===1||le===3){H=g;const Y=!p.children.length;for(let F=0;F{K=K||!!p.dynamicChildren;const{type:I,props:_,patchFlag:L,shapeFlag:S,dirs:V,transition:se}=p,le=I==="input"||I==="option";if(le||L!==-1){V&&Ve(p,null,R,"created");let H=!1;if(W(g)){H=Wi(null,se)&&R&&R.vnode.props&&R.vnode.props.appear;const F=g.content.firstChild;H&&se.beforeEnter(F),B(F,g,R),p.el=g=F}if(S&16&&!(_&&(_.innerHTML||_.textContent))){let F=b(g.firstChild,p,g,R,D,j,K);for(;F;){ln(g,1)||bt();const fe=F;F=F.nextSibling,l(fe)}}else if(S&8){let F=p.children;F[0]===` +`&&(g.tagName==="PRE"||g.tagName==="TEXTAREA")&&(F=F.slice(1)),g.textContent!==F&&(ln(g,0)||bt(),g.textContent=p.children)}if(_){if(le||!K||L&48){const F=g.tagName.includes("-");for(const fe in _)(le&&(fe.endsWith("value")||fe==="indeterminate")||Xt(fe)&&!Ct(fe)||fe[0]==="."||F)&&s(g,fe,null,_[fe],void 0,R)}else if(_.onClick)s(g,"onClick",null,_.onClick,void 0,R);else if(L&4&&ht(_.style))for(const F in _.style)_.style[F]}let Y;(Y=_&&_.onVnodeBeforeMount)&&Oe(Y,R,p),V&&Ve(p,null,R,"beforeMount"),((Y=_&&_.onVnodeMounted)||V||H)&&zi(()=>{Y&&Oe(Y,R,p),H&&se.enter(g),V&&Ve(p,null,R,"mounted")},D)}return g.nextSibling},b=(g,p,R,D,j,K,I)=>{I=I||!!p.dynamicChildren;const _=p.children,L=_.length;for(let S=0;S{const{slotScopeIds:I}=p;I&&(j=j?j.concat(I):I);const _=o(g),L=b(i(g),p,_,R,D,j,K);return L&&on(L)&&L.data==="]"?i(p.anchor=L):(bt(),c(p.anchor=u("]"),_,L),L)},O=(g,p,R,D,j,K)=>{if(ln(g.parentElement,1)||bt(),p.el=null,K){const L=G(g);for(;;){const S=i(g);if(S&&S!==L)l(S);else break}}const I=i(g),_=o(g);return l(g),n(null,p,_,I,R,D,rn(_),j),I},G=(g,p="[",R="]")=>{let D=0;for(;g;)if(g=i(g),g&&on(g)&&(g.data===p&&D++,g.data===R)){if(D===0)return i(g);D--}return g},B=(g,p,R)=>{const D=p.parentNode;D&&D.replaceChild(g,p);let j=R;for(;j;)j.vnode.el===p&&(j.vnode.el=j.subTree.el=g),j=j.parent},W=g=>g.nodeType===1&&g.tagName==="TEMPLATE";return[f,h]}const sr="data-allow-mismatch",Ol={0:"text",1:"children",2:"class",3:"style",4:"attribute"};function ln(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(sr);)e=e.parentElement;const n=e&&e.getAttribute(sr);if(n==null)return!1;if(n==="")return!0;{const s=n.split(",");return t===0&&s.includes("children")?!0:n.split(",").includes(Ol[t])}}On().requestIdleCallback;On().cancelIdleCallback;const pt=e=>!!e.type.__asyncLoader,Hn=e=>e.type.__isKeepAlive;function Ml(e,t){Ai(e,"a",t)}function Il(e,t){Ai(e,"da",t)}function Ai(e,t,n=ue){const s=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if($n(t,s,n),n){let r=n.parent;for(;r&&r.parent;)Hn(r.parent.vnode)&&Pl(s,t,n,r),r=r.parent}}function Pl(e,t,n,s){const r=$n(t,e,s,!0);Dn(()=>{Ms(s[t],r)},n)}function $n(e,t,n=ue,s=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{rt();const l=zt(n),c=He(t,n,e,o);return l(),it(),c});return s?r.unshift(i):r.push(i),i}}const Ye=e=>(t,n=ue)=>{(!Gt||e==="sp")&&$n(e,(...s)=>t(...s),n)},Ll=Ye("bm"),Mt=Ye("m"),Nl=Ye("bu"),Fl=Ye("u"),Ri=Ye("bum"),Dn=Ye("um"),Hl=Ye("sp"),$l=Ye("rtg"),Dl=Ye("rtc");function jl(e,t=ue){$n("ec",e,t)}const Oi="components";function tf(e,t){return Ii(Oi,e,!0,t)||e}const Mi=Symbol.for("v-ndc");function nf(e){return re(e)?Ii(Oi,e,!1)||e:e||Mi}function Ii(e,t,n=!0,s=!1){const r=ce||ue;if(r){const i=r.type;{const l=Ec(i,!1);if(l&&(l===t||l===Pe(t)||l===Rn(Pe(t))))return i}const o=rr(r[e]||i[e],t)||rr(r.appContext[e],t);return!o&&s?i:o}}function rr(e,t){return e&&(e[t]||e[Pe(t)]||e[Rn(Pe(t))])}function sf(e,t,n,s){let r;const i=n,o=U(e);if(o||re(e)){const l=o&&ht(e);let c=!1;l&&(c=!Ie(e),e=In(e)),r=new Array(e.length);for(let u=0,f=e.length;ut(l,c,void 0,i));else{const l=Object.keys(e);r=new Array(l.length);for(let c=0,u=l.length;cqt(t)?!(t.type===ve||t.type===Se&&!Pi(t.children)):!0)?e:null}function of(e,t){const n={};for(const s in e)n[/[A-Z]/.test(s)?`on:${s}`:dn(s)]=e[s];return n}const _s=e=>e?no(e)?Bn(e):_s(e.parent):null,Dt=oe(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>_s(e.parent),$root:e=>_s(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Us(e),$forceUpdate:e=>e.f||(e.f=()=>{Vs(e.update)}),$nextTick:e=>e.n||(e.n=Fn.bind(e.proxy)),$watch:e=>lc.bind(e)}),zn=(e,t)=>e!==Z&&!e.__isScriptSetup&&z(e,t),Vl={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:r,props:i,accessCache:o,type:l,appContext:c}=e;let u;if(t[0]!=="$"){const b=o[t];if(b!==void 0)switch(b){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(zn(s,t))return o[t]=1,s[t];if(r!==Z&&z(r,t))return o[t]=2,r[t];if((u=e.propsOptions[0])&&z(u,t))return o[t]=3,i[t];if(n!==Z&&z(n,t))return o[t]=4,n[t];bs&&(o[t]=0)}}const f=Dt[t];let h,y;if(f)return t==="$attrs"&&me(e.attrs,"get",""),f(e);if((h=l.__cssModules)&&(h=h[t]))return h;if(n!==Z&&z(n,t))return o[t]=4,n[t];if(y=c.config.globalProperties,z(y,t))return y[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:i}=e;return zn(r,t)?(r[t]=n,!0):s!==Z&&z(s,t)?(s[t]=n,!0):z(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,propsOptions:i}},o){let l;return!!n[o]||e!==Z&&z(e,o)||zn(t,o)||(l=i[0])&&z(l,o)||z(s,o)||z(Dt,o)||z(r.config.globalProperties,o)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:z(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function lf(){return Ul().slots}function Ul(){const e=Un();return e.setupContext||(e.setupContext=ro(e))}function ir(e){return U(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let bs=!0;function Bl(e){const t=Us(e),n=e.proxy,s=e.ctx;bs=!1,t.beforeCreate&&or(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:o,watch:l,provide:c,inject:u,created:f,beforeMount:h,mounted:y,beforeUpdate:b,updated:P,activated:O,deactivated:G,beforeDestroy:B,beforeUnmount:W,destroyed:g,unmounted:p,render:R,renderTracked:D,renderTriggered:j,errorCaptured:K,serverPrefetch:I,expose:_,inheritAttrs:L,components:S,directives:V,filters:se}=t;if(u&&kl(u,s,null),o)for(const Y in o){const F=o[Y];q(F)&&(s[Y]=F.bind(n))}if(r){const Y=r.call(n,n);ne(Y)&&(e.data=Pn(Y))}if(bs=!0,i)for(const Y in i){const F=i[Y],fe=q(F)?F.bind(n,n):q(F.get)?F.get.bind(n,n):Ue,Qt=!q(F)&&q(F.set)?F.set.bind(n):Ue,ot=ie({get:fe,set:Qt});Object.defineProperty(s,Y,{enumerable:!0,configurable:!0,get:()=>ot.value,set:$e=>ot.value=$e})}if(l)for(const Y in l)Li(l[Y],s,n,Y);if(c){const Y=q(c)?c.call(n):c;Reflect.ownKeys(Y).forEach(F=>{Xl(F,Y[F])})}f&&or(f,e,"c");function H(Y,F){U(F)?F.forEach(fe=>Y(fe.bind(n))):F&&Y(F.bind(n))}if(H(Ll,h),H(Mt,y),H(Nl,b),H(Fl,P),H(Ml,O),H(Il,G),H(jl,K),H(Dl,D),H($l,j),H(Ri,W),H(Dn,p),H(Hl,I),U(_))if(_.length){const Y=e.exposed||(e.exposed={});_.forEach(F=>{Object.defineProperty(Y,F,{get:()=>n[F],set:fe=>n[F]=fe})})}else e.exposed||(e.exposed={});R&&e.render===Ue&&(e.render=R),L!=null&&(e.inheritAttrs=L),S&&(e.components=S),V&&(e.directives=V),I&&Ti(e)}function kl(e,t,n=Ue){U(e)&&(e=ws(e));for(const s in e){const r=e[s];let i;ne(r)?"default"in r?i=Rt(r.from||s,r.default,!0):i=Rt(r.from||s):i=Rt(r),ae(i)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[s]=i}}function or(e,t,n){He(U(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Li(e,t,n,s){let r=s.includes(".")?Yi(n,s):()=>n[s];if(re(e)){const i=t[e];q(i)&&Fe(r,i)}else if(q(e))Fe(r,e.bind(n));else if(ne(e))if(U(e))e.forEach(i=>Li(i,t,n,s));else{const i=q(e.handler)?e.handler.bind(n):t[e.handler];q(i)&&Fe(r,i,e)}}function Us(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,l=i.get(t);let c;return l?c=l:!r.length&&!n&&!s?c=t:(c={},r.length&&r.forEach(u=>En(c,u,o,!0)),En(c,t,o)),ne(t)&&i.set(t,c),c}function En(e,t,n,s=!1){const{mixins:r,extends:i}=t;i&&En(e,i,n,!0),r&&r.forEach(o=>En(e,o,n,!0));for(const o in t)if(!(s&&o==="expose")){const l=Wl[o]||n&&n[o];e[o]=l?l(e[o],t[o]):t[o]}return e}const Wl={data:lr,props:cr,emits:cr,methods:Ft,computed:Ft,beforeCreate:_e,created:_e,beforeMount:_e,mounted:_e,beforeUpdate:_e,updated:_e,beforeDestroy:_e,beforeUnmount:_e,destroyed:_e,unmounted:_e,activated:_e,deactivated:_e,errorCaptured:_e,serverPrefetch:_e,components:Ft,directives:Ft,watch:ql,provide:lr,inject:Kl};function lr(e,t){return t?e?function(){return oe(q(e)?e.call(this,this):e,q(t)?t.call(this,this):t)}:t:e}function Kl(e,t){return Ft(ws(e),ws(t))}function ws(e){if(U(e)){const t={};for(let n=0;n1)return n&&q(t)?t.call(s&&s.proxy):t}}const Fi={},Hi=()=>Object.create(Fi),$i=e=>Object.getPrototypeOf(e)===Fi;function Jl(e,t,n,s=!1){const r={},i=Hi();e.propsDefaults=Object.create(null),Di(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);n?e.props=s?r:il(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function zl(e,t,n,s){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,l=J(r),[c]=e.propsOptions;let u=!1;if((s||o>0)&&!(o&16)){if(o&8){const f=e.vnode.dynamicProps;for(let h=0;h{c=!0;const[y,b]=ji(h,t,!0);oe(o,y),b&&l.push(...b)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!i&&!c)return ne(e)&&s.set(e,xt),xt;if(U(i))for(let f=0;fe[0]==="_"||e==="$stable",Bs=e=>U(e)?e.map(Me):[Me(e)],Zl=(e,t,n)=>{if(t._n)return t;const s=wl((...r)=>Bs(t(...r)),n);return s._c=!1,s},Ui=(e,t,n)=>{const s=e._ctx;for(const r in e){if(Vi(r))continue;const i=e[r];if(q(i))t[r]=Zl(r,i,s);else if(i!=null){const o=Bs(i);t[r]=()=>o}}},Bi=(e,t)=>{const n=Bs(t);e.slots.default=()=>n},ki=(e,t,n)=>{for(const s in t)(n||s!=="_")&&(e[s]=t[s])},ec=(e,t,n)=>{const s=e.slots=Hi();if(e.vnode.shapeFlag&32){const r=t._;r?(ki(s,t,n),n&&qr(s,"_",r,!0)):Ui(t,s)}else t&&Bi(e,t)},tc=(e,t,n)=>{const{vnode:s,slots:r}=e;let i=!0,o=Z;if(s.shapeFlag&32){const l=t._;l?n&&l===1?i=!1:ki(r,t,n):(i=!t.$stable,Ui(t,r)),o=t}else t&&(Bi(e,t),o={default:1});if(i)for(const l in r)!Vi(l)&&o[l]==null&&delete r[l]},Te=zi;function nc(e){return sc(e,Rl)}function sc(e,t){const n=On();n.__VUE__=!0;const{insert:s,remove:r,patchProp:i,createElement:o,createText:l,createComment:c,setText:u,setElementText:f,parentNode:h,nextSibling:y,setScopeId:b=Ue,insertStaticContent:P}=e,O=(a,d,m,x=null,v=null,w=null,A=void 0,T=null,C=!!d.dynamicChildren)=>{if(a===d)return;a&&!ut(a,d)&&(x=Zt(a),$e(a,v,w,!0),a=null),d.patchFlag===-2&&(C=!1,d.dynamicChildren=null);const{type:E,ref:$,shapeFlag:M}=d;switch(E){case gt:G(a,d,m,x);break;case ve:B(a,d,m,x);break;case jt:a==null&&W(d,m,x,A);break;case Se:S(a,d,m,x,v,w,A,T,C);break;default:M&1?R(a,d,m,x,v,w,A,T,C):M&6?V(a,d,m,x,v,w,A,T,C):(M&64||M&128)&&E.process(a,d,m,x,v,w,A,T,C,vt)}$!=null&&v&&xn($,a&&a.ref,w,d||a,!d)},G=(a,d,m,x)=>{if(a==null)s(d.el=l(d.children),m,x);else{const v=d.el=a.el;d.children!==a.children&&u(v,d.children)}},B=(a,d,m,x)=>{a==null?s(d.el=c(d.children||""),m,x):d.el=a.el},W=(a,d,m,x)=>{[a.el,a.anchor]=P(a.children,d,m,x,a.el,a.anchor)},g=({el:a,anchor:d},m,x)=>{let v;for(;a&&a!==d;)v=y(a),s(a,m,x),a=v;s(d,m,x)},p=({el:a,anchor:d})=>{let m;for(;a&&a!==d;)m=y(a),r(a),a=m;r(d)},R=(a,d,m,x,v,w,A,T,C)=>{d.type==="svg"?A="svg":d.type==="math"&&(A="mathml"),a==null?D(d,m,x,v,w,A,T,C):I(a,d,v,w,A,T,C)},D=(a,d,m,x,v,w,A,T)=>{let C,E;const{props:$,shapeFlag:M,transition:N,dirs:k}=a;if(C=a.el=o(a.type,w,$&&$.is,$),M&8?f(C,a.children):M&16&&K(a.children,C,null,x,v,Qn(a,w),A,T),k&&Ve(a,null,x,"created"),j(C,a,a.scopeId,A,x),$){for(const ee in $)ee!=="value"&&!Ct(ee)&&i(C,ee,null,$[ee],w,x);"value"in $&&i(C,"value",null,$.value,w),(E=$.onVnodeBeforeMount)&&Oe(E,x,a)}k&&Ve(a,null,x,"beforeMount");const X=Wi(v,N);X&&N.beforeEnter(C),s(C,d,m),((E=$&&$.onVnodeMounted)||X||k)&&Te(()=>{E&&Oe(E,x,a),X&&N.enter(C),k&&Ve(a,null,x,"mounted")},v)},j=(a,d,m,x,v)=>{if(m&&b(a,m),x)for(let w=0;w{for(let E=C;E{const T=d.el=a.el;let{patchFlag:C,dynamicChildren:E,dirs:$}=d;C|=a.patchFlag&16;const M=a.props||Z,N=d.props||Z;let k;if(m&<(m,!1),(k=N.onVnodeBeforeUpdate)&&Oe(k,m,d,a),$&&Ve(d,a,m,"beforeUpdate"),m&<(m,!0),(M.innerHTML&&N.innerHTML==null||M.textContent&&N.textContent==null)&&f(T,""),E?_(a.dynamicChildren,E,T,m,x,Qn(d,v),w):A||F(a,d,T,null,m,x,Qn(d,v),w,!1),C>0){if(C&16)L(T,M,N,m,v);else if(C&2&&M.class!==N.class&&i(T,"class",null,N.class,v),C&4&&i(T,"style",M.style,N.style,v),C&8){const X=d.dynamicProps;for(let ee=0;ee{k&&Oe(k,m,d,a),$&&Ve(d,a,m,"updated")},x)},_=(a,d,m,x,v,w,A)=>{for(let T=0;T{if(d!==m){if(d!==Z)for(const w in d)!Ct(w)&&!(w in m)&&i(a,w,d[w],null,v,x);for(const w in m){if(Ct(w))continue;const A=m[w],T=d[w];A!==T&&w!=="value"&&i(a,w,T,A,v,x)}"value"in m&&i(a,"value",d.value,m.value,v)}},S=(a,d,m,x,v,w,A,T,C)=>{const E=d.el=a?a.el:l(""),$=d.anchor=a?a.anchor:l("");let{patchFlag:M,dynamicChildren:N,slotScopeIds:k}=d;k&&(T=T?T.concat(k):k),a==null?(s(E,m,x),s($,m,x),K(d.children||[],m,$,v,w,A,T,C)):M>0&&M&64&&N&&a.dynamicChildren?(_(a.dynamicChildren,N,m,v,w,A,T),(d.key!=null||v&&d===v.subTree)&&Ki(a,d,!0)):F(a,d,m,$,v,w,A,T,C)},V=(a,d,m,x,v,w,A,T,C)=>{d.slotScopeIds=T,a==null?d.shapeFlag&512?v.ctx.activate(d,m,x,A,C):se(d,m,x,v,w,A,C):le(a,d,C)},se=(a,d,m,x,v,w,A)=>{const T=a.component=bc(a,x,v);if(Hn(a)&&(T.ctx.renderer=vt),wc(T,!1,A),T.asyncDep){if(v&&v.registerDep(T,H,A),!a.el){const C=T.subTree=he(ve);B(null,C,d,m)}}else H(T,a,d,m,v,w,A)},le=(a,d,m)=>{const x=d.component=a.component;if(dc(a,d,m))if(x.asyncDep&&!x.asyncResolved){Y(x,d,m);return}else x.next=d,x.update();else d.el=a.el,x.vnode=d},H=(a,d,m,x,v,w,A)=>{const T=()=>{if(a.isMounted){let{next:M,bu:N,u:k,parent:X,vnode:ee}=a;{const Ee=qi(a);if(Ee){M&&(M.el=ee.el,Y(a,M,A)),Ee.asyncDep.then(()=>{a.isUnmounted||T()});return}}let Q=M,xe;lt(a,!1),M?(M.el=ee.el,Y(a,M,A)):M=ee,N&&hn(N),(xe=M.props&&M.props.onVnodeBeforeUpdate)&&Oe(xe,X,M,ee),lt(a,!0);const pe=Zn(a),Le=a.subTree;a.subTree=pe,O(Le,pe,h(Le.el),Zt(Le),a,v,w),M.el=pe.el,Q===null&&hc(a,pe.el),k&&Te(k,v),(xe=M.props&&M.props.onVnodeUpdated)&&Te(()=>Oe(xe,X,M,ee),v)}else{let M;const{el:N,props:k}=d,{bm:X,m:ee,parent:Q,root:xe,type:pe}=a,Le=pt(d);if(lt(a,!1),X&&hn(X),!Le&&(M=k&&k.onVnodeBeforeMount)&&Oe(M,Q,d),lt(a,!0),N&&Kn){const Ee=()=>{a.subTree=Zn(a),Kn(N,a.subTree,a,v,null)};Le&&pe.__asyncHydrate?pe.__asyncHydrate(N,a,Ee):Ee()}else{xe.ce&&xe.ce._injectChildStyle(pe);const Ee=a.subTree=Zn(a);O(null,Ee,m,x,a,v,w),d.el=Ee.el}if(ee&&Te(ee,v),!Le&&(M=k&&k.onVnodeMounted)){const Ee=d;Te(()=>Oe(M,Q,Ee),v)}(d.shapeFlag&256||Q&&pt(Q.vnode)&&Q.vnode.shapeFlag&256)&&a.a&&Te(a.a,v),a.isMounted=!0,d=m=x=null}};a.scope.on();const C=a.effect=new zr(T);a.scope.off();const E=a.update=C.run.bind(C),$=a.job=C.runIfDirty.bind(C);$.i=a,$.id=a.uid,C.scheduler=()=>Vs($),lt(a,!0),E()},Y=(a,d,m)=>{d.component=a;const x=a.vnode.props;a.vnode=d,a.next=null,zl(a,d.props,x,m),tc(a,d.children,m),rt(),er(a),it()},F=(a,d,m,x,v,w,A,T,C=!1)=>{const E=a&&a.children,$=a?a.shapeFlag:0,M=d.children,{patchFlag:N,shapeFlag:k}=d;if(N>0){if(N&128){Qt(E,M,m,x,v,w,A,T,C);return}else if(N&256){fe(E,M,m,x,v,w,A,T,C);return}}k&8?($&16&&It(E,v,w),M!==E&&f(m,M)):$&16?k&16?Qt(E,M,m,x,v,w,A,T,C):It(E,v,w,!0):($&8&&f(m,""),k&16&&K(M,m,x,v,w,A,T,C))},fe=(a,d,m,x,v,w,A,T,C)=>{a=a||xt,d=d||xt;const E=a.length,$=d.length,M=Math.min(E,$);let N;for(N=0;N$?It(a,v,w,!0,!1,M):K(d,m,x,v,w,A,T,C,M)},Qt=(a,d,m,x,v,w,A,T,C)=>{let E=0;const $=d.length;let M=a.length-1,N=$-1;for(;E<=M&&E<=N;){const k=a[E],X=d[E]=C?Ze(d[E]):Me(d[E]);if(ut(k,X))O(k,X,m,null,v,w,A,T,C);else break;E++}for(;E<=M&&E<=N;){const k=a[M],X=d[N]=C?Ze(d[N]):Me(d[N]);if(ut(k,X))O(k,X,m,null,v,w,A,T,C);else break;M--,N--}if(E>M){if(E<=N){const k=N+1,X=k<$?d[k].el:x;for(;E<=N;)O(null,d[E]=C?Ze(d[E]):Me(d[E]),m,X,v,w,A,T,C),E++}}else if(E>N)for(;E<=M;)$e(a[E],v,w,!0),E++;else{const k=E,X=E,ee=new Map;for(E=X;E<=N;E++){const Ce=d[E]=C?Ze(d[E]):Me(d[E]);Ce.key!=null&&ee.set(Ce.key,E)}let Q,xe=0;const pe=N-X+1;let Le=!1,Ee=0;const Pt=new Array(pe);for(E=0;E=pe){$e(Ce,v,w,!0);continue}let De;if(Ce.key!=null)De=ee.get(Ce.key);else for(Q=X;Q<=N;Q++)if(Pt[Q-X]===0&&ut(Ce,d[Q])){De=Q;break}De===void 0?$e(Ce,v,w,!0):(Pt[De-X]=E+1,De>=Ee?Ee=De:Le=!0,O(Ce,d[De],m,null,v,w,A,T,C),xe++)}const Xs=Le?rc(Pt):xt;for(Q=Xs.length-1,E=pe-1;E>=0;E--){const Ce=X+E,De=d[Ce],Js=Ce+1<$?d[Ce+1].el:x;Pt[E]===0?O(null,De,m,Js,v,w,A,T,C):Le&&(Q<0||E!==Xs[Q]?ot(De,m,Js,2):Q--)}}},ot=(a,d,m,x,v=null)=>{const{el:w,type:A,transition:T,children:C,shapeFlag:E}=a;if(E&6){ot(a.component.subTree,d,m,x);return}if(E&128){a.suspense.move(d,m,x);return}if(E&64){A.move(a,d,m,vt);return}if(A===Se){s(w,d,m);for(let M=0;MT.enter(w),v);else{const{leave:M,delayLeave:N,afterLeave:k}=T,X=()=>s(w,d,m),ee=()=>{M(w,()=>{X(),k&&k()})};N?N(w,X,ee):ee()}else s(w,d,m)},$e=(a,d,m,x=!1,v=!1)=>{const{type:w,props:A,ref:T,children:C,dynamicChildren:E,shapeFlag:$,patchFlag:M,dirs:N,cacheIndex:k}=a;if(M===-2&&(v=!1),T!=null&&xn(T,null,m,a,!0),k!=null&&(d.renderCache[k]=void 0),$&256){d.ctx.deactivate(a);return}const X=$&1&&N,ee=!pt(a);let Q;if(ee&&(Q=A&&A.onVnodeBeforeUnmount)&&Oe(Q,d,a),$&6)Eo(a.component,m,x);else{if($&128){a.suspense.unmount(m,x);return}X&&Ve(a,null,d,"beforeUnmount"),$&64?a.type.remove(a,d,m,vt,x):E&&!E.hasOnce&&(w!==Se||M>0&&M&64)?It(E,d,m,!1,!0):(w===Se&&M&384||!v&&$&16)&&It(C,d,m),x&&Gs(a)}(ee&&(Q=A&&A.onVnodeUnmounted)||X)&&Te(()=>{Q&&Oe(Q,d,a),X&&Ve(a,null,d,"unmounted")},m)},Gs=a=>{const{type:d,el:m,anchor:x,transition:v}=a;if(d===Se){xo(m,x);return}if(d===jt){p(a);return}const w=()=>{r(m),v&&!v.persisted&&v.afterLeave&&v.afterLeave()};if(a.shapeFlag&1&&v&&!v.persisted){const{leave:A,delayLeave:T}=v,C=()=>A(m,w);T?T(a.el,w,C):C()}else w()},xo=(a,d)=>{let m;for(;a!==d;)m=y(a),r(a),a=m;r(d)},Eo=(a,d,m)=>{const{bum:x,scope:v,job:w,subTree:A,um:T,m:C,a:E}=a;fr(C),fr(E),x&&hn(x),v.stop(),w&&(w.flags|=8,$e(A,a,d,m)),T&&Te(T,d),Te(()=>{a.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&a.asyncDep&&!a.asyncResolved&&a.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},It=(a,d,m,x=!1,v=!1,w=0)=>{for(let A=w;A{if(a.shapeFlag&6)return Zt(a.component.subTree);if(a.shapeFlag&128)return a.suspense.next();const d=y(a.anchor||a.el),m=d&&d[Sl];return m?y(m):d};let kn=!1;const Ys=(a,d,m)=>{a==null?d._vnode&&$e(d._vnode,null,null,!0):O(d._vnode||null,a,d,null,null,null,m),d._vnode=a,kn||(kn=!0,er(),wn(),kn=!1)},vt={p:O,um:$e,m:ot,r:Gs,mt:se,mc:K,pc:F,pbc:_,n:Zt,o:e};let Wn,Kn;return t&&([Wn,Kn]=t(vt)),{render:Ys,hydrate:Wn,createApp:Yl(Ys,Wn)}}function Qn({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function lt({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Wi(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ki(e,t,n=!1){const s=e.children,r=t.children;if(U(s)&&U(r))for(let i=0;i>1,e[n[l]]0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function qi(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:qi(t)}function fr(e){if(e)for(let t=0;tRt(ic);function Gi(e,t){return jn(e,null,t)}function cf(e,t){return jn(e,null,{flush:"post"})}function Fe(e,t,n){return jn(e,t,n)}function jn(e,t,n=Z){const{immediate:s,deep:r,flush:i,once:o}=n,l=oe({},n),c=t&&s||!t&&i!=="post";let u;if(Gt){if(i==="sync"){const b=oc();u=b.__watcherHandles||(b.__watcherHandles=[])}else if(!c){const b=()=>{};return b.stop=Ue,b.resume=Ue,b.pause=Ue,b}}const f=ue;l.call=(b,P,O)=>He(b,f,P,O);let h=!1;i==="post"?l.scheduler=b=>{Te(b,f&&f.suspense)}:i!=="sync"&&(h=!0,l.scheduler=(b,P)=>{P?b():Vs(b)}),l.augmentJob=b=>{t&&(b.flags|=4),h&&(b.flags|=2,f&&(b.id=f.uid,b.i=f))};const y=yl(e,t,l);return Gt&&(u?u.push(y):c&&y()),y}function lc(e,t,n){const s=this.proxy,r=re(e)?e.includes(".")?Yi(s,e):()=>s[e]:e.bind(s,s);let i;q(t)?i=t:(i=t.handler,n=t);const o=zt(this),l=jn(r,i.bind(s),n);return o(),l}function Yi(e,t){const n=t.split(".");return()=>{let s=e;for(let r=0;rt==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Pe(t)}Modifiers`]||e[`${st(t)}Modifiers`];function ac(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||Z;let r=n;const i=t.startsWith("update:"),o=i&&cc(s,t.slice(7));o&&(o.trim&&(r=n.map(f=>re(f)?f.trim():f)),o.number&&(r=n.map(hs)));let l,c=s[l=dn(t)]||s[l=dn(Pe(t))];!c&&i&&(c=s[l=dn(st(t))]),c&&He(c,e,6,r);const u=s[l+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,He(u,e,6,r)}}function Xi(e,t,n=!1){const s=t.emitsCache,r=s.get(e);if(r!==void 0)return r;const i=e.emits;let o={},l=!1;if(!q(e)){const c=u=>{const f=Xi(u,t,!0);f&&(l=!0,oe(o,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!i&&!l?(ne(e)&&s.set(e,null),null):(U(i)?i.forEach(c=>o[c]=null):oe(o,i),ne(e)&&s.set(e,o),o)}function Vn(e,t){return!e||!Xt(t)?!1:(t=t.slice(2).replace(/Once$/,""),z(e,t[0].toLowerCase()+t.slice(1))||z(e,st(t))||z(e,t))}function Zn(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[i],slots:o,attrs:l,emit:c,render:u,renderCache:f,props:h,data:y,setupState:b,ctx:P,inheritAttrs:O}=e,G=Sn(e);let B,W;try{if(n.shapeFlag&4){const p=r||s,R=p;B=Me(u.call(R,p,f,h,b,y,P)),W=l}else{const p=t;B=Me(p.length>1?p(h,{attrs:l,slots:o,emit:c}):p(h,null)),W=t.props?l:fc(l)}}catch(p){Vt.length=0,Nn(p,e,1),B=he(ve)}let g=B;if(W&&O!==!1){const p=Object.keys(W),{shapeFlag:R}=g;p.length&&R&7&&(i&&p.some(Os)&&(W=uc(W,i)),g=nt(g,W,!1,!0))}return n.dirs&&(g=nt(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&Wt(g,n.transition),B=g,Sn(G),B}const fc=e=>{let t;for(const n in e)(n==="class"||n==="style"||Xt(n))&&((t||(t={}))[n]=e[n]);return t},uc=(e,t)=>{const n={};for(const s in e)(!Os(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function dc(e,t,n){const{props:s,children:r,component:i}=e,{props:o,children:l,patchFlag:c}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return s?ur(s,o,u):!!o;if(c&8){const f=t.dynamicProps;for(let h=0;he.__isSuspense;function zi(e,t){t&&t.pendingBranch?U(e)?t.effects.push(...e):t.effects.push(e):bl(e)}const Se=Symbol.for("v-fgt"),gt=Symbol.for("v-txt"),ve=Symbol.for("v-cmt"),jt=Symbol.for("v-stc"),Vt=[];let Ae=null;function xs(e=!1){Vt.push(Ae=e?null:[])}function pc(){Vt.pop(),Ae=Vt[Vt.length-1]||null}let Kt=1;function dr(e){Kt+=e,e<0&&Ae&&(Ae.hasOnce=!0)}function Qi(e){return e.dynamicChildren=Kt>0?Ae||xt:null,pc(),Kt>0&&Ae&&Ae.push(e),e}function af(e,t,n,s,r,i){return Qi(eo(e,t,n,s,r,i,!0))}function Es(e,t,n,s,r){return Qi(he(e,t,n,s,r,!0))}function qt(e){return e?e.__v_isVNode===!0:!1}function ut(e,t){return e.type===t.type&&e.key===t.key}const Zi=({key:e})=>e??null,gn=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?re(e)||ae(e)||q(e)?{i:ce,r:e,k:t,f:!!n}:e:null);function eo(e,t=null,n=null,s=0,r=null,i=e===Se?0:1,o=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Zi(t),ref:t&&gn(t),scopeId:vi,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ce};return l?(ks(c,n),i&128&&e.normalize(c)):n&&(c.shapeFlag|=re(n)?8:16),Kt>0&&!o&&Ae&&(c.patchFlag>0||i&6)&&c.patchFlag!==32&&Ae.push(c),c}const he=gc;function gc(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===Mi)&&(e=ve),qt(e)){const l=nt(e,t,!0);return n&&ks(l,n),Kt>0&&!i&&Ae&&(l.shapeFlag&6?Ae[Ae.indexOf(e)]=l:Ae.push(l)),l.patchFlag=-2,l}if(Cc(e)&&(e=e.__vccOpts),t){t=mc(t);let{class:l,style:c}=t;l&&!re(l)&&(t.class=Ls(l)),ne(c)&&(js(c)&&!U(c)&&(c=oe({},c)),t.style=Ps(c))}const o=re(e)?1:Ji(e)?128:_i(e)?64:ne(e)?4:q(e)?2:0;return eo(e,t,n,s,r,o,i,!0)}function mc(e){return e?js(e)||$i(e)?oe({},e):e:null}function nt(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:l,transition:c}=e,u=t?yc(r||{},t):r,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Zi(u),ref:t&&t.ref?n&&i?U(i)?i.concat(gn(t)):[i,gn(t)]:gn(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Se?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&nt(e.ssContent),ssFallback:e.ssFallback&&nt(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&s&&Wt(f,c.clone(f)),f}function to(e=" ",t=0){return he(gt,null,e,t)}function ff(e,t){const n=he(jt,null,e);return n.staticCount=t,n}function uf(e="",t=!1){return t?(xs(),Es(ve,null,e)):he(ve,null,e)}function Me(e){return e==null||typeof e=="boolean"?he(ve):U(e)?he(Se,null,e.slice()):qt(e)?Ze(e):he(gt,null,String(e))}function Ze(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:nt(e)}function ks(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(U(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),ks(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!$i(t)?t._ctx=ce:r===3&&ce&&(ce.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else q(t)?(t={default:t,_ctx:ce},n=32):(t=String(t),s&64?(n=16,t=[to(t)]):n=8);e.children=t,e.shapeFlag|=n}function yc(...e){const t={};for(let n=0;nue||ce;let Cn,Cs;{const e=On(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Cn=t("__VUE_INSTANCE_SETTERS__",n=>ue=n),Cs=t("__VUE_SSR_SETTERS__",n=>Gt=n)}const zt=e=>{const t=ue;return Cn(e),e.scope.on(),()=>{e.scope.off(),Cn(t)}},hr=()=>{ue&&ue.scope.off(),Cn(null)};function no(e){return e.vnode.shapeFlag&4}let Gt=!1;function wc(e,t=!1,n=!1){t&&Cs(t);const{props:s,children:r}=e.vnode,i=no(e);Jl(e,s,i,t),ec(e,r,n);const o=i?Sc(e,t):void 0;return t&&Cs(!1),o}function Sc(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Vl);const{setup:s}=n;if(s){rt();const r=e.setupContext=s.length>1?ro(e):null,i=zt(e),o=Jt(s,e,0,[e.props,r]),l=kr(o);if(it(),i(),(l||e.sp)&&!pt(e)&&Ti(e),l){if(o.then(hr,hr),t)return o.then(c=>{pr(e,c,t)}).catch(c=>{Nn(c,e,0)});e.asyncDep=o}else pr(e,o,t)}else so(e,t)}function pr(e,t,n){q(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ne(t)&&(e.setupState=pi(t)),so(e,n)}let gr;function so(e,t,n){const s=e.type;if(!e.render){if(!t&&gr&&!s.render){const r=s.template||Us(e).template;if(r){const{isCustomElement:i,compilerOptions:o}=e.appContext.config,{delimiters:l,compilerOptions:c}=s,u=oe(oe({isCustomElement:i,delimiters:l},o),c);s.render=gr(r,u)}}e.render=s.render||Ue}{const r=zt(e);rt();try{Bl(e)}finally{it(),r()}}}const xc={get(e,t){return me(e,"get",""),e[t]}};function ro(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,xc),slots:e.slots,emit:e.emit,expose:t}}function Bn(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(pi(pn(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Dt)return Dt[n](e)},has(t,n){return n in t||n in Dt}})):e.proxy}function Ec(e,t=!0){return q(e)?e.displayName||e.name:e.name||t&&e.__name}function Cc(e){return q(e)&&"__vccOpts"in e}const ie=(e,t)=>gl(e,t,Gt);function Ts(e,t,n){const s=arguments.length;return s===2?ne(t)&&!U(t)?qt(t)?he(e,null,[t]):he(e,t):he(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&qt(n)&&(n=[n]),he(e,t,n))}const Tc="3.5.12";/** +* @vue/runtime-dom v3.5.12 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let As;const mr=typeof window<"u"&&window.trustedTypes;if(mr)try{As=mr.createPolicy("vue",{createHTML:e=>e})}catch{}const io=As?e=>As.createHTML(e):e=>e,Ac="http://www.w3.org/2000/svg",Rc="http://www.w3.org/1998/Math/MathML",ke=typeof document<"u"?document:null,yr=ke&&ke.createElement("template"),Oc={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?ke.createElementNS(Ac,e):t==="mathml"?ke.createElementNS(Rc,e):n?ke.createElement(e,{is:n}):ke.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>ke.createTextNode(e),createComment:e=>ke.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ke.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{yr.innerHTML=io(s==="svg"?`${e}`:s==="mathml"?`${e}`:e);const l=yr.content;if(s==="svg"||s==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Xe="transition",Nt="animation",Yt=Symbol("_vtc"),oo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Mc=oe({},bi,oo),Ic=e=>(e.displayName="Transition",e.props=Mc,e),df=Ic((e,{slots:t})=>Ts(Cl,Pc(e),t)),ct=(e,t=[])=>{U(e)?e.forEach(n=>n(...t)):e&&e(...t)},vr=e=>e?U(e)?e.some(t=>t.length>1):e.length>1:!1;function Pc(e){const t={};for(const S in e)S in oo||(t[S]=e[S]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=i,appearActiveClass:u=o,appearToClass:f=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:y=`${n}-leave-active`,leaveToClass:b=`${n}-leave-to`}=e,P=Lc(r),O=P&&P[0],G=P&&P[1],{onBeforeEnter:B,onEnter:W,onEnterCancelled:g,onLeave:p,onLeaveCancelled:R,onBeforeAppear:D=B,onAppear:j=W,onAppearCancelled:K=g}=t,I=(S,V,se)=>{at(S,V?f:l),at(S,V?u:o),se&&se()},_=(S,V)=>{S._isLeaving=!1,at(S,h),at(S,b),at(S,y),V&&V()},L=S=>(V,se)=>{const le=S?j:W,H=()=>I(V,S,se);ct(le,[V,H]),_r(()=>{at(V,S?c:i),Je(V,S?f:l),vr(le)||br(V,s,O,H)})};return oe(t,{onBeforeEnter(S){ct(B,[S]),Je(S,i),Je(S,o)},onBeforeAppear(S){ct(D,[S]),Je(S,c),Je(S,u)},onEnter:L(!1),onAppear:L(!0),onLeave(S,V){S._isLeaving=!0;const se=()=>_(S,V);Je(S,h),Je(S,y),Hc(),_r(()=>{S._isLeaving&&(at(S,h),Je(S,b),vr(p)||br(S,s,G,se))}),ct(p,[S,se])},onEnterCancelled(S){I(S,!1),ct(g,[S])},onAppearCancelled(S){I(S,!0),ct(K,[S])},onLeaveCancelled(S){_(S),ct(R,[S])}})}function Lc(e){if(e==null)return null;if(ne(e))return[es(e.enter),es(e.leave)];{const t=es(e);return[t,t]}}function es(e){return Mo(e)}function Je(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Yt]||(e[Yt]=new Set)).add(t)}function at(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Yt];n&&(n.delete(t),n.size||(e[Yt]=void 0))}function _r(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Nc=0;function br(e,t,n,s){const r=e._endId=++Nc,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:l,propCount:c}=Fc(e,t);if(!o)return s();const u=o+"end";let f=0;const h=()=>{e.removeEventListener(u,y),i()},y=b=>{b.target===e&&++f>=c&&h()};setTimeout(()=>{f(n[P]||"").split(", "),r=s(`${Xe}Delay`),i=s(`${Xe}Duration`),o=wr(r,i),l=s(`${Nt}Delay`),c=s(`${Nt}Duration`),u=wr(l,c);let f=null,h=0,y=0;t===Xe?o>0&&(f=Xe,h=o,y=i.length):t===Nt?u>0&&(f=Nt,h=u,y=c.length):(h=Math.max(o,u),f=h>0?o>u?Xe:Nt:null,y=f?f===Xe?i.length:c.length:0);const b=f===Xe&&/\b(transform|all)(,|$)/.test(s(`${Xe}Property`).toString());return{type:f,timeout:h,propCount:y,hasTransform:b}}function wr(e,t){for(;e.lengthSr(n)+Sr(e[s])))}function Sr(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Hc(){return document.body.offsetHeight}function $c(e,t,n){const s=e[Yt];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const xr=Symbol("_vod"),Dc=Symbol("_vsh"),jc=Symbol(""),Vc=/(^|;)\s*display\s*:/;function Uc(e,t,n){const s=e.style,r=re(n);let i=!1;if(n&&!r){if(t)if(re(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();n[l]==null&&mn(s,l,"")}else for(const o in t)n[o]==null&&mn(s,o,"");for(const o in n)o==="display"&&(i=!0),mn(s,o,n[o])}else if(r){if(t!==n){const o=s[jc];o&&(n+=";"+o),s.cssText=n,i=Vc.test(n)}}else t&&e.removeAttribute("style");xr in e&&(e[xr]=i?s.display:"",e[Dc]&&(s.display="none"))}const Er=/\s*!important$/;function mn(e,t,n){if(U(n))n.forEach(s=>mn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Bc(e,t);Er.test(n)?e.setProperty(st(s),n.replace(Er,""),"important"):e[s]=n}}const Cr=["Webkit","Moz","ms"],ts={};function Bc(e,t){const n=ts[t];if(n)return n;let s=Pe(t);if(s!=="filter"&&s in e)return ts[t]=s;s=Rn(s);for(let r=0;rns||(qc.then(()=>ns=0),ns=Date.now());function Yc(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;He(Xc(s,n.value),t,5,[s])};return n.value=e,n.attached=Gc(),n}function Xc(e,t){if(U(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Ir=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Jc=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?$c(e,s,o):t==="style"?Uc(e,n,s):Xt(t)?Os(t)||Wc(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):zc(e,t,s,o))?(Rr(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ar(e,t,s,o,i,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!re(s))?Rr(e,Pe(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Ar(e,t,s,o))};function zc(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ir(t)&&q(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Ir(t)&&re(n)?!1:t in e}const Pr=e=>{const t=e.props["onUpdate:modelValue"]||!1;return U(t)?n=>hn(t,n):t};function Qc(e){e.target.composing=!0}function Lr(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ss=Symbol("_assign"),hf={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[ss]=Pr(r);const i=s||r.props&&r.props.type==="number";St(e,t?"change":"input",o=>{if(o.target.composing)return;let l=e.value;n&&(l=l.trim()),i&&(l=hs(l)),e[ss](l)}),n&&St(e,"change",()=>{e.value=e.value.trim()}),t||(St(e,"compositionstart",Qc),St(e,"compositionend",Lr),St(e,"change",Lr))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[ss]=Pr(o),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?hs(e.value):e.value,c=t??"";l!==c&&(document.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===c)||(e.value=c))}},Zc=["ctrl","shift","alt","meta"],ea={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Zc.some(n=>e[`${n}Key`]&&!t.includes(n))},pf=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const i=st(r.key);if(t.some(o=>o===i||ta[o]===i))return e(r)})},na=oe({patchProp:Jc},Oc);let rs,Nr=!1;function sa(){return rs=Nr?rs:nc(na),Nr=!0,rs}const mf=(...e)=>{const t=sa().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=ia(s);if(r)return n(r,!0,ra(r))},t};function ra(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ia(e){return re(e)?document.querySelector(e):e}const yf=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},oa=window.__VP_SITE_DATA__;function Ws(e){return Jr()?(jo(e),!0):!1}function tt(e){return typeof e=="function"?e():hi(e)}const lo=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const la=Object.prototype.toString,ca=e=>la.call(e)==="[object Object]",co=()=>{},Fr=aa();function aa(){var e,t;return lo&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function fa(e,t){function n(...s){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,s),{fn:t,thisArg:this,args:s})).then(r).catch(i)})}return n}const ao=e=>e();function ua(e=ao){const t=de(!0);function n(){t.value=!1}function s(){t.value=!0}const r=(...i)=>{t.value&&e(...i)};return{isActive:Ln(t),pause:n,resume:s,eventFilter:r}}function da(e){return Un()}function fo(...e){if(e.length!==1)return dl(...e);const t=e[0];return typeof t=="function"?Ln(al(()=>({get:t,set:co}))):de(t)}function ha(e,t,n={}){const{eventFilter:s=ao,...r}=n;return Fe(e,fa(s,t),r)}function pa(e,t,n={}){const{eventFilter:s,...r}=n,{eventFilter:i,pause:o,resume:l,isActive:c}=ua(s);return{stop:ha(e,t,{...r,eventFilter:i}),pause:o,resume:l,isActive:c}}function Ks(e,t=!0,n){da()?Mt(e,n):t?e():Fn(e)}const qe=lo?window:void 0;function uo(e){var t;const n=tt(e);return(t=n==null?void 0:n.$el)!=null?t:n}function Ot(...e){let t,n,s,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,s,r]=e,t=qe):[t,n,s,r]=e,!t)return co;Array.isArray(n)||(n=[n]),Array.isArray(s)||(s=[s]);const i=[],o=()=>{i.forEach(f=>f()),i.length=0},l=(f,h,y,b)=>(f.addEventListener(h,y,b),()=>f.removeEventListener(h,y,b)),c=Fe(()=>[uo(t),tt(r)],([f,h])=>{if(o(),!f)return;const y=ca(h)?{...h}:h;i.push(...n.flatMap(b=>s.map(P=>l(f,b,P,y))))},{immediate:!0,flush:"post"}),u=()=>{c(),o()};return Ws(u),u}function ga(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function vf(...e){let t,n,s={};e.length===3?(t=e[0],n=e[1],s=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],s=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:r=qe,eventName:i="keydown",passive:o=!1,dedupe:l=!1}=s,c=ga(t);return Ot(r,i,f=>{f.repeat&&tt(l)||c(f)&&n(f)},o)}function ma(){const e=de(!1),t=Un();return t&&Mt(()=>{e.value=!0},t),e}function ya(e){const t=ma();return ie(()=>(t.value,!!e()))}function ho(e,t={}){const{window:n=qe}=t,s=ya(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let r;const i=de(!1),o=u=>{i.value=u.matches},l=()=>{r&&("removeEventListener"in r?r.removeEventListener("change",o):r.removeListener(o))},c=Gi(()=>{s.value&&(l(),r=n.matchMedia(tt(e)),"addEventListener"in r?r.addEventListener("change",o):r.addListener(o),i.value=r.matches)});return Ws(()=>{c(),l(),r=void 0}),i}const cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},an="__vueuse_ssr_handlers__",va=_a();function _a(){return an in cn||(cn[an]=cn[an]||{}),cn[an]}function po(e,t){return va[e]||t}function qs(e){return ho("(prefers-color-scheme: dark)",e)}function ba(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const wa={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},Hr="vueuse-storage";function Sa(e,t,n,s={}){var r;const{flush:i="pre",deep:o=!0,listenToStorageChanges:l=!0,writeDefaults:c=!0,mergeDefaults:u=!1,shallow:f,window:h=qe,eventFilter:y,onError:b=_=>{console.error(_)},initOnMounted:P}=s,O=(f?ui:de)(typeof t=="function"?t():t);if(!n)try{n=po("getDefaultStorage",()=>{var _;return(_=qe)==null?void 0:_.localStorage})()}catch(_){b(_)}if(!n)return O;const G=tt(t),B=ba(G),W=(r=s.serializer)!=null?r:wa[B],{pause:g,resume:p}=pa(O,()=>D(O.value),{flush:i,deep:o,eventFilter:y});h&&l&&Ks(()=>{n instanceof Storage?Ot(h,"storage",K):Ot(h,Hr,I),P&&K()}),P||K();function R(_,L){if(h){const S={key:e,oldValue:_,newValue:L,storageArea:n};h.dispatchEvent(n instanceof Storage?new StorageEvent("storage",S):new CustomEvent(Hr,{detail:S}))}}function D(_){try{const L=n.getItem(e);if(_==null)R(L,null),n.removeItem(e);else{const S=W.write(_);L!==S&&(n.setItem(e,S),R(L,S))}}catch(L){b(L)}}function j(_){const L=_?_.newValue:n.getItem(e);if(L==null)return c&&G!=null&&n.setItem(e,W.write(G)),G;if(!_&&u){const S=W.read(L);return typeof u=="function"?u(S,G):B==="object"&&!Array.isArray(S)?{...G,...S}:S}else return typeof L!="string"?L:W.read(L)}function K(_){if(!(_&&_.storageArea!==n)){if(_&&_.key==null){O.value=G;return}if(!(_&&_.key!==e)){g();try{(_==null?void 0:_.newValue)!==W.write(O.value)&&(O.value=j(_))}catch(L){b(L)}finally{_?Fn(p):p()}}}}function I(_){K(_.detail)}return O}const xa="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function Ea(e={}){const{selector:t="html",attribute:n="class",initialValue:s="auto",window:r=qe,storage:i,storageKey:o="vueuse-color-scheme",listenToStorageChanges:l=!0,storageRef:c,emitAuto:u,disableTransition:f=!0}=e,h={auto:"",light:"light",dark:"dark",...e.modes||{}},y=qs({window:r}),b=ie(()=>y.value?"dark":"light"),P=c||(o==null?fo(s):Sa(o,s,i,{window:r,listenToStorageChanges:l})),O=ie(()=>P.value==="auto"?b.value:P.value),G=po("updateHTMLAttrs",(p,R,D)=>{const j=typeof p=="string"?r==null?void 0:r.document.querySelector(p):uo(p);if(!j)return;const K=new Set,I=new Set;let _=null;if(R==="class"){const S=D.split(/\s/g);Object.values(h).flatMap(V=>(V||"").split(/\s/g)).filter(Boolean).forEach(V=>{S.includes(V)?K.add(V):I.add(V)})}else _={key:R,value:D};if(K.size===0&&I.size===0&&_===null)return;let L;f&&(L=r.document.createElement("style"),L.appendChild(document.createTextNode(xa)),r.document.head.appendChild(L));for(const S of K)j.classList.add(S);for(const S of I)j.classList.remove(S);_&&j.setAttribute(_.key,_.value),f&&(r.getComputedStyle(L).opacity,document.head.removeChild(L))});function B(p){var R;G(t,n,(R=h[p])!=null?R:p)}function W(p){e.onChanged?e.onChanged(p,B):B(p)}Fe(O,W,{flush:"post",immediate:!0}),Ks(()=>W(O.value));const g=ie({get(){return u?P.value:O.value},set(p){P.value=p}});try{return Object.assign(g,{store:P,system:b,state:O})}catch{return g}}function Ca(e={}){const{valueDark:t="dark",valueLight:n="",window:s=qe}=e,r=Ea({...e,onChanged:(l,c)=>{var u;e.onChanged?(u=e.onChanged)==null||u.call(e,l==="dark",c,l):c(l)},modes:{dark:t,light:n}}),i=ie(()=>r.system?r.system.value:qs({window:s}).value?"dark":"light");return ie({get(){return r.value==="dark"},set(l){const c=l?"dark":"light";i.value===c?r.value="auto":r.value=c}})}function is(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function go(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth1?!0:(t.preventDefault&&t.preventDefault(),!1)}const os=new WeakMap;function _f(e,t=!1){const n=de(t);let s=null,r="";Fe(fo(e),l=>{const c=is(tt(l));if(c){const u=c;if(os.get(u)||os.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(r=u.style.overflow),u.style.overflow==="hidden")return n.value=!0;if(n.value)return u.style.overflow="hidden"}},{immediate:!0});const i=()=>{const l=is(tt(e));!l||n.value||(Fr&&(s=Ot(l,"touchmove",c=>{Ta(c)},{passive:!1})),l.style.overflow="hidden",n.value=!0)},o=()=>{const l=is(tt(e));!l||!n.value||(Fr&&(s==null||s()),l.style.overflow=r,os.delete(l),n.value=!1)};return Ws(o),ie({get(){return n.value},set(l){l?i():o()}})}function bf(e={}){const{window:t=qe,behavior:n="auto"}=e;if(!t)return{x:de(0),y:de(0)};const s=de(t.scrollX),r=de(t.scrollY),i=ie({get(){return s.value},set(l){scrollTo({left:l,behavior:n})}}),o=ie({get(){return r.value},set(l){scrollTo({top:l,behavior:n})}});return Ot(t,"scroll",()=>{s.value=t.scrollX,r.value=t.scrollY},{capture:!1,passive:!0}),{x:i,y:o}}function wf(e={}){const{window:t=qe,initialWidth:n=Number.POSITIVE_INFINITY,initialHeight:s=Number.POSITIVE_INFINITY,listenOrientation:r=!0,includeScrollbar:i=!0,type:o="inner"}=e,l=de(n),c=de(s),u=()=>{t&&(o==="outer"?(l.value=t.outerWidth,c.value=t.outerHeight):i?(l.value=t.innerWidth,c.value=t.innerHeight):(l.value=t.document.documentElement.clientWidth,c.value=t.document.documentElement.clientHeight))};if(u(),Ks(u),Ot("resize",u,{passive:!0}),r){const f=ho("(orientation: portrait)");Fe(f,()=>u())}return{width:l,height:c}}const ls={BASE_URL:"/js-lib/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};var cs={};const mo=/^(?:[a-z]+:|\/\/)/i,Aa="vitepress-theme-appearance",Ra=/#.*$/,Oa=/[?#].*$/,Ma=/(?:(^|\/)index)?\.(?:md|html)$/,ge=typeof document<"u",yo={relativePath:"404.md",filePath:"",title:"404",description:"Not Found",headers:[],frontmatter:{sidebar:!1,layout:"page"},lastUpdated:0,isNotFound:!0};function Ia(e,t,n=!1){if(t===void 0)return!1;if(e=$r(`/${e}`),n)return new RegExp(t).test(e);if($r(t)!==e)return!1;const s=t.match(Ra);return s?(ge?location.hash:"")===s[0]:!0}function $r(e){return decodeURI(e).replace(Oa,"").replace(Ma,"$1")}function Pa(e){return mo.test(e)}function La(e,t){return Object.keys((e==null?void 0:e.locales)||{}).find(n=>n!=="root"&&!Pa(n)&&Ia(t,`/${n}/`,!0))||"root"}function Na(e,t){var s,r,i,o,l,c,u;const n=La(e,t);return Object.assign({},e,{localeIndex:n,lang:((s=e.locales[n])==null?void 0:s.lang)??e.lang,dir:((r=e.locales[n])==null?void 0:r.dir)??e.dir,title:((i=e.locales[n])==null?void 0:i.title)??e.title,titleTemplate:((o=e.locales[n])==null?void 0:o.titleTemplate)??e.titleTemplate,description:((l=e.locales[n])==null?void 0:l.description)??e.description,head:_o(e.head,((c=e.locales[n])==null?void 0:c.head)??[]),themeConfig:{...e.themeConfig,...(u=e.locales[n])==null?void 0:u.themeConfig}})}function vo(e,t){const n=t.title||e.title,s=t.titleTemplate??e.titleTemplate;if(typeof s=="string"&&s.includes(":title"))return s.replace(/:title/g,n);const r=Fa(e.title,s);return n===r.slice(3)?n:`${n}${r}`}function Fa(e,t){return t===!1?"":t===!0||t===void 0?` | ${e}`:e===t?"":` | ${t}`}function Ha(e,t){const[n,s]=t;if(n!=="meta")return!1;const r=Object.entries(s)[0];return r==null?!1:e.some(([i,o])=>i===n&&o[r[0]]===r[1])}function _o(e,t){return[...e.filter(n=>!Ha(t,n)),...t]}const $a=/[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g,Da=/^[a-z]:/i;function Dr(e){const t=Da.exec(e),n=t?t[0]:"";return n+e.slice(n.length).replace($a,"_").replace(/(^|\/)_+(?=[^/]*$)/,"$1")}const as=new Set;function ja(e){if(as.size===0){const n=typeof process=="object"&&(cs==null?void 0:cs.VITE_EXTRA_EXTENSIONS)||(ls==null?void 0:ls.VITE_EXTRA_EXTENSIONS)||"";("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip"+(n&&typeof n=="string"?","+n:"")).split(",").forEach(s=>as.add(s))}const t=e.split(".").pop();return t==null||!as.has(t.toLowerCase())}const Va=Symbol(),mt=ui(oa);function Sf(e){const t=ie(()=>Na(mt.value,e.data.relativePath)),n=t.value.appearance,s=n==="force-dark"?de(!0):n==="force-auto"?qs():n?Ca({storageKey:Aa,initialValue:()=>n==="dark"?"dark":"auto",...typeof n=="object"?n:{}}):de(!1),r=de(ge?location.hash:"");return ge&&window.addEventListener("hashchange",()=>{r.value=location.hash}),Fe(()=>e.data,()=>{r.value=ge?location.hash:""}),{site:t,theme:ie(()=>t.value.themeConfig),page:ie(()=>e.data),frontmatter:ie(()=>e.data.frontmatter),params:ie(()=>e.data.params),lang:ie(()=>t.value.lang),dir:ie(()=>e.data.frontmatter.dir||t.value.dir),localeIndex:ie(()=>t.value.localeIndex||"root"),title:ie(()=>vo(t.value,e.data)),description:ie(()=>e.data.description||t.value.description),isDark:s,hash:ie(()=>r.value)}}function Ua(){const e=Rt(Va);if(!e)throw new Error("vitepress data not properly injected in app");return e}function Ba(e,t){return`${e}${t}`.replace(/\/+/g,"/")}function jr(e){return mo.test(e)||!e.startsWith("/")?e:Ba(mt.value.base,e)}function ka(e){let t=e.replace(/\.html$/,"");if(t=decodeURIComponent(t),t=t.replace(/\/$/,"/index"),ge){const n="/js-lib/";t=Dr(t.slice(n.length).replace(/\//g,"_")||"index")+".md";let s=__VP_HASH_MAP__[t.toLowerCase()];if(s||(t=t.endsWith("_index.md")?t.slice(0,-9)+".md":t.slice(0,-3)+"_index.md",s=__VP_HASH_MAP__[t.toLowerCase()]),!s)return null;t=`${n}assets/${t}.${s}.js`}else t=`./${Dr(t.slice(1).replace(/\//g,"_"))}.md.js`;return t}let yn=[];function xf(e){yn.push(e),Dn(()=>{yn=yn.filter(t=>t!==e)})}function Wa(){let e=mt.value.scrollOffset,t=0,n=24;if(typeof e=="object"&&"padding"in e&&(n=e.padding,e=e.selector),typeof e=="number")t=e;else if(typeof e=="string")t=Vr(e,n);else if(Array.isArray(e))for(const s of e){const r=Vr(s,n);if(r){t=r;break}}return t}function Vr(e,t){const n=document.querySelector(e);if(!n)return 0;const s=n.getBoundingClientRect().bottom;return s<0?0:s+t}const Ka=Symbol(),bo="http://a.com",qa=()=>({path:"/",component:null,data:yo});function Ef(e,t){const n=Pn(qa()),s={route:n,go:r};async function r(l=ge?location.href:"/"){var c,u;l=fs(l),await((c=s.onBeforeRouteChange)==null?void 0:c.call(s,l))!==!1&&(ge&&l!==fs(location.href)&&(history.replaceState({scrollPosition:window.scrollY},""),history.pushState({},"",l)),await o(l),await((u=s.onAfterRouteChanged)==null?void 0:u.call(s,l)))}let i=null;async function o(l,c=0,u=!1){var y,b;if(await((y=s.onBeforePageLoad)==null?void 0:y.call(s,l))===!1)return;const f=new URL(l,bo),h=i=f.pathname;try{let P=await e(h);if(!P)throw new Error(`Page not found: ${h}`);if(i===h){i=null;const{default:O,__pageData:G}=P;if(!O)throw new Error(`Invalid route component: ${O}`);await((b=s.onAfterPageLoad)==null?void 0:b.call(s,l)),n.path=ge?h:jr(h),n.component=pn(O),n.data=pn(G),ge&&Fn(()=>{let B=mt.value.base+G.relativePath.replace(/(?:(^|\/)index)?\.md$/,"$1");if(!mt.value.cleanUrls&&!B.endsWith("/")&&(B+=".html"),B!==f.pathname&&(f.pathname=B,l=B+f.search+f.hash,history.replaceState({},"",l)),f.hash&&!c){let W=null;try{W=document.getElementById(decodeURIComponent(f.hash).slice(1))}catch(g){console.warn(g)}if(W){Ur(W,f.hash);return}}window.scrollTo(0,c)})}}catch(P){if(!/fetch|Page not found/.test(P.message)&&!/^\/404(\.html|\/)?$/.test(l)&&console.error(P),!u)try{const O=await fetch(mt.value.base+"hashmap.json");window.__VP_HASH_MAP__=await O.json(),await o(l,c,!0);return}catch{}if(i===h){i=null,n.path=ge?h:jr(h),n.component=t?pn(t):null;const O=ge?h.replace(/(^|\/)$/,"$1index").replace(/(\.html)?$/,".md").replace(/^\//,""):"404.md";n.data={...yo,relativePath:O}}}}return ge&&(history.state===null&&history.replaceState({},""),window.addEventListener("click",l=>{if(l.defaultPrevented||!(l.target instanceof Element)||l.target.closest("button")||l.button!==0||l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)return;const c=l.target.closest("a");if(!c||c.closest(".vp-raw")||c.hasAttribute("download")||c.hasAttribute("target"))return;const u=c.getAttribute("href")??(c instanceof SVGAElement?c.getAttribute("xlink:href"):null);if(u==null)return;const{href:f,origin:h,pathname:y,hash:b,search:P}=new URL(u,c.baseURI),O=new URL(location.href);h===O.origin&&ja(y)&&(l.preventDefault(),y===O.pathname&&P===O.search?(b!==O.hash&&(history.pushState({},"",f),window.dispatchEvent(new HashChangeEvent("hashchange",{oldURL:O.href,newURL:f}))),b?Ur(c,b,c.classList.contains("header-anchor")):window.scrollTo(0,0)):r(f))},{capture:!0}),window.addEventListener("popstate",async l=>{var c;l.state!==null&&(await o(fs(location.href),l.state&&l.state.scrollPosition||0),(c=s.onAfterRouteChanged)==null||c.call(s,location.href))}),window.addEventListener("hashchange",l=>{l.preventDefault()})),s}function Ga(){const e=Rt(Ka);if(!e)throw new Error("useRouter() is called without provider.");return e}function wo(){return Ga().route}function Ur(e,t,n=!1){let s=null;try{s=e.classList.contains("header-anchor")?e:document.getElementById(decodeURIComponent(t).slice(1))}catch(r){console.warn(r)}if(s){let r=function(){!n||Math.abs(o-window.scrollY)>window.innerHeight?window.scrollTo(0,o):window.scrollTo({left:0,top:o,behavior:"smooth"})};const i=parseInt(window.getComputedStyle(s).paddingTop,10),o=window.scrollY+s.getBoundingClientRect().top-Wa()+i;requestAnimationFrame(r)}}function fs(e){const t=new URL(e,bo);return t.pathname=t.pathname.replace(/(^|\/)index(\.html)?$/,"$1"),mt.value.cleanUrls?t.pathname=t.pathname.replace(/\.html$/,""):!t.pathname.endsWith("/")&&!t.pathname.endsWith(".html")&&(t.pathname+=".html"),t.pathname+t.search+t.hash}const fn=()=>yn.forEach(e=>e()),Cf=Ci({name:"VitePressContent",props:{as:{type:[Object,String],default:"div"}},setup(e){const t=wo(),{frontmatter:n,site:s}=Ua();return Fe(n,fn,{deep:!0,flush:"post"}),()=>Ts(e.as,s.value.contentProps??{style:{position:"relative"}},[t.component?Ts(t.component,{onVnodeMounted:fn,onVnodeUpdated:fn,onVnodeUnmounted:fn}):"404 Page Not Found"])}}),Tf=Ci({setup(e,{slots:t}){const n=de(!1);return Mt(()=>{n.value=!0}),()=>n.value&&t.default?t.default():null}});function Af(){ge&&window.addEventListener("click",e=>{var n;const t=e.target;if(t.matches(".vp-code-group input")){const s=(n=t.parentElement)==null?void 0:n.parentElement;if(!s)return;const r=Array.from(s.querySelectorAll("input")).indexOf(t);if(r<0)return;const i=s.querySelector(".blocks");if(!i)return;const o=Array.from(i.children).find(u=>u.classList.contains("active"));if(!o)return;const l=i.children[r];if(!l||o===l)return;o.classList.remove("active"),l.classList.add("active");const c=s==null?void 0:s.querySelector(`label[for="${t.id}"]`);c==null||c.scrollIntoView({block:"nearest"})}})}function Rf(){if(ge){const e=new WeakMap;window.addEventListener("click",t=>{var s;const n=t.target;if(n.matches('div[class*="language-"] > button.copy')){const r=n.parentElement,i=(s=n.nextElementSibling)==null?void 0:s.nextElementSibling;if(!r||!i)return;const o=/language-(shellscript|shell|bash|sh|zsh)/.test(r.className),l=[".vp-copy-ignore",".diff.remove"],c=i.cloneNode(!0);c.querySelectorAll(l.join(",")).forEach(f=>f.remove());let u=c.textContent||"";o&&(u=u.replace(/^ *(\$|>) /gm,"").trim()),Ya(u).then(()=>{n.classList.add("copied"),clearTimeout(e.get(n));const f=setTimeout(()=>{n.classList.remove("copied"),n.blur(),e.delete(n)},2e3);e.set(n,f)})}})}}async function Ya(e){try{return navigator.clipboard.writeText(e)}catch{const t=document.createElement("textarea"),n=document.activeElement;t.value=e,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";const s=document.getSelection(),r=s?s.rangeCount>0&&s.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(t),r&&(s.removeAllRanges(),s.addRange(r)),n&&n.focus()}}function Of(e,t){let n=!0,s=[];const r=i=>{if(n){n=!1,i.forEach(l=>{const c=us(l);for(const u of document.head.children)if(u.isEqualNode(c)){s.push(u);return}});return}const o=i.map(us);s.forEach((l,c)=>{const u=o.findIndex(f=>f==null?void 0:f.isEqualNode(l??null));u!==-1?delete o[u]:(l==null||l.remove(),delete s[c])}),o.forEach(l=>l&&document.head.appendChild(l)),s=[...s,...o].filter(Boolean)};Gi(()=>{const i=e.data,o=t.value,l=i&&i.description,c=i&&i.frontmatter.head||[],u=vo(o,i);u!==document.title&&(document.title=u);const f=l||o.description;let h=document.querySelector("meta[name=description]");h?h.getAttribute("content")!==f&&h.setAttribute("content",f):us(["meta",{name:"description",content:f}]),r(_o(o.head,Ja(c)))})}function us([e,t,n]){const s=document.createElement(e);for(const r in t)s.setAttribute(r,t[r]);return n&&(s.innerHTML=n),e==="script"&&t.async==null&&(s.async=!1),s}function Xa(e){return e[0]==="meta"&&e[1]&&e[1].name==="description"}function Ja(e){return e.filter(t=>!Xa(t))}const ds=new Set,So=()=>document.createElement("link"),za=e=>{const t=So();t.rel="prefetch",t.href=e,document.head.appendChild(t)},Qa=e=>{const t=new XMLHttpRequest;t.open("GET",e,t.withCredentials=!0),t.send()};let un;const Za=ge&&(un=So())&&un.relList&&un.relList.supports&&un.relList.supports("prefetch")?za:Qa;function Mf(){if(!ge||!window.IntersectionObserver)return;let e;if((e=navigator.connection)&&(e.saveData||/2g/.test(e.effectiveType)))return;const t=window.requestIdleCallback||setTimeout;let n=null;const s=()=>{n&&n.disconnect(),n=new IntersectionObserver(i=>{i.forEach(o=>{if(o.isIntersecting){const l=o.target;n.unobserve(l);const{pathname:c}=l;if(!ds.has(c)){ds.add(c);const u=ka(c);u&&Za(u)}}})}),t(()=>{document.querySelectorAll("#app a").forEach(i=>{const{hostname:o,pathname:l}=new URL(i.href instanceof SVGAnimatedString?i.href.animVal:i.href,i.baseURI),c=l.match(/\.\w+$/);c&&c[0]!==".html"||i.target!=="_blank"&&o===location.hostname&&(l!==location.pathname?n.observe(i):ds.add(l))})})};Mt(s);const r=wo();Fe(()=>r.path,s),Dn(()=>{n&&n.disconnect()})}export{lf as $,Wa as A,tf as B,sf as C,ui as D,xf as E,Se as F,he as G,nf as H,mo as I,wo as J,yc as K,Rt as L,wf as M,Ps as N,vf as O,Fn as P,bf as Q,ge as R,Ln as S,df as T,_f as U,Xl as V,gf as W,of as X,Ri as Y,pf as Z,yf as _,to as a,ff as a0,ef as a1,hf as a2,Of as a3,Ka as a4,Sf as a5,Va as a6,Cf as a7,Tf as a8,mt as a9,mf as aa,Ef as ab,ka as ac,Mf as ad,Rf as ae,Af as af,Ts as ag,Es as b,af as c,Ci as d,uf as e,ja as f,jr as g,ie as h,Pa as i,eo as j,hi as k,Ia as l,ho as m,Ls as n,xs as o,de as p,Fe as q,rf as r,Gi as s,$o as t,Ua as u,Mt as v,wl as w,Dn as x,cf as y,Fl as z}; diff --git a/assets/chunks/is.util.BDVbkSgX.js b/assets/chunks/is.util.BDVbkSgX.js new file mode 100644 index 00000000..b848a4c9 --- /dev/null +++ b/assets/chunks/is.util.BDVbkSgX.js @@ -0,0 +1 @@ +function e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)||!1}function i(t){return t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string"||typeof t=="bigint"||typeof t=="symbol"}export{i as _,e as a}; diff --git a/assets/chunks/object.util.ThuQ4YBC.js b/assets/chunks/object.util.ThuQ4YBC.js new file mode 100644 index 00000000..27e9aac9 --- /dev/null +++ b/assets/chunks/object.util.ThuQ4YBC.js @@ -0,0 +1 @@ +import{a as s}from"./is.util.BDVbkSgX.js";import{a as c}from"./types.C-9dMxxX.js";function _(n,i,t=!1){if(t){for(const e of Object.keys(n))i.includes(e)||delete n[e];return n}const f={};for(const e of i)e in n&&(f[e]=n[e]);return f}function d(n,i,t=!1){if(t){for(const e of i)delete n[e];return n}const f={};for(const e of Object.keys(n))i.includes(e)||(f[e]=n[e]);return f}function m(n,i=!1){return o(n,(t,f)=>f!=null,i)}function O(n,i=!1){return o(n,(t,f)=>f!==void 0,i)}function o(n,i,t=!1){if(t){for(const[e,r]of c(n))i(e,r,n)||delete n[e];return n}const f={};for(const[e,r]of c(n))i(e,r,n)&&(f[e]=r);return f}function k(n,i){const t={};for(const[f,e]of Object.entries(n))t[i(f,e,n)]=e;return t}function p(n,i){return JSON.parse(JSON.stringify(n),i)}function u(n,...i){return i.forEach(t=>{s(t)&&Object.keys(t).forEach(f=>{s(t[f])?(n[f]||(n[f]={}),u(n[f],t[f])):n[f]=t[f]})}),n}export{p as _,m as a,u as b,d as c,k as d,_ as e,O as f}; diff --git a/assets/chunks/stringify.CRXUkG82.js b/assets/chunks/stringify.CRXUkG82.js new file mode 100644 index 00000000..e24b64f0 --- /dev/null +++ b/assets/chunks/stringify.CRXUkG82.js @@ -0,0 +1,8 @@ +import{i as p}from"./env.bTBnF6u3.js";const h=/^\s*[{["\-\d]/;function d(e,t){if(typeof e=="string"&&e&&h.test(e))try{return JSON.parse(e,t)}catch{}return e}function S(e,t){try{return JSON.parse(e,t)}catch{throw new O({text:e})}}function y(e,t,r="..."){if(!e||e.length<=t)return e;if(t<=r.length)return r;const n=Math.round((t-r.length)/2),s=e.length-Math.floor((t-r.length)/2);return e.slice(0,n)+r+e.slice(s)}function T(e,t=Error,r){let n;if(e instanceof t)n=e;else{const s=l(e);n=E(s,t)}return n}function l(e,t){let r;return o(e)?r=g(e):(e=d(e),m(e)?r=e.error:f(e)?r=e:o(e)?r=g(e):r={name:"Error",message:u(e),data:{}}),Object.assign(r.data,t),r}function g(e){if(!(e instanceof Error)&&f(e))return e;const t={name:e.name,message:e.message,data:{...e.data}};return e.stack&&(t.stack=e.stack),e.cause&&(t.cause=l(e.cause)),t}function E(e,t=Error){if(e instanceof t)return e;const{name:r,cause:n}=e,s=new t(e.message,e.data,{name:r,cause:n});return e.stack&&Object.defineProperty(s,"stack",{value:e.stack}),s instanceof a||(Object.defineProperties(s,{name:{value:r,configurable:!0,writable:!0},data:{value:e.data,writable:!0,configurable:!0,enumerable:!1},cause:{value:n,writable:!0,configurable:!0,enumerable:!0}}),Object.defineProperty(s.constructor,"name",{value:r,configurable:!0,writable:!0})),s}function m(e){return f(e==null?void 0:e.error)}function f(e){return!!e&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&typeof e.data=="object"}function o(e){return!!e&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"}function b(e,t){return t&&(e.data||(e.data={}),Object.assign(e.data,t)),e}class a extends Error{static of(t){return new a(t.message,t.data,{name:t.name,cause:t.cause})}constructor(t,r={},n={}){super(t);const{name:s=p()?this.constructor.name:"AppError",cause:i}=n;Object.defineProperties(this,{name:{value:s,configurable:!0,writable:!0},data:{value:r,writable:!0,configurable:!0,enumerable:!1}}),i&&Object.defineProperty(this,"cause",{value:l(i),writable:!0,configurable:!0,enumerable:!0}),Object.defineProperty(this.constructor,"name",{value:s,configurable:!0,writable:!0})}}class A extends a{constructor(t,r,n){r.response&&Object.defineProperty(r,"response",{enumerable:!1}),super(t,r,{...n,name:"HttpRequestError"})}}class J extends a{constructor(t,r){super(t,r,{name:"AssertionError"})}}class O extends a{constructor(t){const r=["Failed to parse",t.text&&y(t.text,200)].filter(Boolean).join(": ");super(r,t,{name:"JsonParseError"})}}class v extends a{constructor(t,r,n){super(t,r,{...n,name:"TimeoutError"})}}class M extends a{constructor(t){super(t||"expected error was not thrown",{},{name:"UnexpectedPassError"})}}function _(e,t,r,n){try{return JSON.stringify(e,t,r)}catch{return JSON.stringify(e,k(t,n),r)}}function k(e,t){const r=[],n=[];return t??(t=(s,i)=>r[0]===i?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(i)).join(".")+"]"),function(s,i){if(r.length>0){const c=r.indexOf(this);~c?r.splice(c+1):r.push(this),~c?n.splice(c,1/0,s):n.push(s),~r.indexOf(i)&&(i=t.call(this,s,i))}else r.push(i);return e==null?i:e.call(this,s,i)}}const P=typeof globalThis.AggregateError=="function";let w=_;function u(e,t={}){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="function")return"function";if(typeof e=="symbol")return e.toString();let r;if(e=d(e),m(e))return u(e.error,t);if(e instanceof Error||o(e)){const{includeErrorCause:s=!0}=t;if(r=[e.name,e.message].filter(Boolean).join(": "),typeof e.code=="string"&&(r+=` +code: ${e.code}`),t.includeErrorData&&f(e)&&Object.keys(e.data).length&&(r+=` +`+u(e.data,t)),t.includeErrorStack&&e.stack){const i=r.split(` +`).length;r=[r,...e.stack.split(` +`).slice(i)].join(` +`)}P&&e instanceof AggregateError&&e.errors.length&&(r=[r,`${e.errors.length} error(s):`,...e.errors.map((i,c)=>`${c+1}. ${u(i,t)}`)].join(` +`)),e.cause&&s&&(r=r+` +Caused by: `+u(e.cause,t))}else if(typeof e=="string")r=e.trim()||"empty_string";else{e instanceof Map?e=Object.fromEntries(e):e instanceof Set&&(e=[...e]);try{const{stringifyFn:s=w}=t;r=s(e,void 0,2)}catch{r=String(e)}}if(r===void 0)return"undefined";const{maxLen:n=1e4}=t;return n&&r.length>n&&(r=r.slice(0,n)+`... ${Math.ceil(r.length/1024)} KB message truncated`),r}export{J as A,A as H,v as T,M as U,u as _,b as a,T as b,S as c,d,g as e,l as f}; diff --git a/assets/chunks/theme.Tglf3ptl.js b/assets/chunks/theme.Tglf3ptl.js new file mode 100644 index 00000000..50e87b8f --- /dev/null +++ b/assets/chunks/theme.Tglf3ptl.js @@ -0,0 +1 @@ +import{d as m,o as a,c as u,r as c,n as M,a as j,t as N,b as k,w as p,e as h,T as ce,_ as b,u as Ae,i as Be,f as He,g as ue,h as $,j as v,k as r,l as z,m as ae,p as T,q as D,s as Q,v as q,x as de,y as ve,z as Ce,A as Ee,B as W,F as w,C as H,D as ge,E as X,G as _,H as E,I as $e,J as Z,K as U,L as x,M as Fe,N as ye,O as De,P as Oe,Q as Pe,R as ee,S as Ge,U as Le,V as Ve,W as Ue,X as je,Y as ze,Z as qe,$ as We}from"./framework.K5DDegrV.js";const Ke=m({__name:"VPBadge",props:{text:{},type:{default:"tip"}},setup(s){return(e,t)=>(a(),u("span",{class:M(["VPBadge",e.type])},[c(e.$slots,"default",{},()=>[j(N(e.text),1)])],2))}}),Je={key:0,class:"VPBackdrop"},Re=m({__name:"VPBackdrop",props:{show:{type:Boolean}},setup(s){return(e,t)=>(a(),k(ce,{name:"fade"},{default:p(()=>[e.show?(a(),u("div",Je)):h("",!0)]),_:1}))}}),Ye=b(Re,[["__scopeId","data-v-c79a1216"]]),P=Ae;function Qe(s,e){let t,o=!1;return()=>{t&&clearTimeout(t),o?t=setTimeout(s,e):(s(),(o=!0)&&setTimeout(()=>o=!1,e))}}function re(s){return/^\//.test(s)?s:`/${s}`}function pe(s){const{pathname:e,search:t,hash:o,protocol:n}=new URL(s,"http://a.com");if(Be(s)||s.startsWith("#")||!n.startsWith("http")||!He(e))return s;const{site:i}=P(),l=e.endsWith("/")||e.endsWith(".html")?s:s.replace(/(?:(^\.+)\/)?.*$/,`$1${e.replace(/(\.md)?$/,i.value.cleanUrls?"":".html")}${t}${o}`);return ue(l)}function J({correspondingLink:s=!1}={}){const{site:e,localeIndex:t,page:o,theme:n,hash:i}=P(),l=$(()=>{var d,y;return{label:(d=e.value.locales[t.value])==null?void 0:d.label,link:((y=e.value.locales[t.value])==null?void 0:y.link)||(t.value==="root"?"/":`/${t.value}/`)}});return{localeLinks:$(()=>Object.entries(e.value.locales).flatMap(([d,y])=>l.value.label===y.label?[]:{text:y.label,link:Xe(y.link||(d==="root"?"/":`/${d}/`),n.value.i18nRouting!==!1&&s,o.value.relativePath.slice(l.value.link.length-1),!e.value.cleanUrls)+i.value})),currentLang:l}}function Xe(s,e,t,o){return e?s.replace(/\/$/,"")+re(t.replace(/(^|\/)index\.md$/,"$1").replace(/\.md$/,o?".html":"")):s}const Ze={class:"NotFound"},xe={class:"code"},et={class:"title"},tt={class:"quote"},nt={class:"action"},ot=["href","aria-label"],st=m({__name:"NotFound",setup(s){const{theme:e}=P(),{currentLang:t}=J();return(o,n)=>{var i,l,f,d,y;return a(),u("div",Ze,[v("p",xe,N(((i=r(e).notFound)==null?void 0:i.code)??"404"),1),v("h1",et,N(((l=r(e).notFound)==null?void 0:l.title)??"PAGE NOT FOUND"),1),n[0]||(n[0]=v("div",{class:"divider"},null,-1)),v("blockquote",tt,N(((f=r(e).notFound)==null?void 0:f.quote)??"But if you don't change your direction, and if you keep looking, you may end up where you are heading."),1),v("div",nt,[v("a",{class:"link",href:r(ue)(r(t).link),"aria-label":((d=r(e).notFound)==null?void 0:d.linkLabel)??"go to home"},N(((y=r(e).notFound)==null?void 0:y.linkText)??"Take me home"),9,ot)])])}}}),at=b(st,[["__scopeId","data-v-d6be1790"]]);function Se(s,e){if(Array.isArray(s))return R(s);if(s==null)return[];e=re(e);const t=Object.keys(s).sort((n,i)=>i.split("/").length-n.split("/").length).find(n=>e.startsWith(re(n))),o=t?s[t]:[];return Array.isArray(o)?R(o):R(o.items,o.base)}function rt(s){const e=[];let t=0;for(const o in s){const n=s[o];if(n.items){t=e.push(n);continue}e[t]||e.push({items:[]}),e[t].items.push(n)}return e}function it(s){const e=[];function t(o){for(const n of o)n.text&&n.link&&e.push({text:n.text,link:n.link,docFooterText:n.docFooterText}),n.items&&t(n.items)}return t(s),e}function ie(s,e){return Array.isArray(e)?e.some(t=>ie(s,t)):z(s,e.link)?!0:e.items?ie(s,e.items):!1}function R(s,e){return[...s].map(t=>{const o={...t},n=o.base||e;return n&&o.link&&(o.link=n+o.link),o.items&&(o.items=R(o.items,n)),o})}function O(){const{frontmatter:s,page:e,theme:t}=P(),o=ae("(min-width: 960px)"),n=T(!1),i=$(()=>{const B=t.value.sidebar,S=e.value.relativePath;return B?Se(B,S):[]}),l=T(i.value);D(i,(B,S)=>{JSON.stringify(B)!==JSON.stringify(S)&&(l.value=i.value)});const f=$(()=>s.value.sidebar!==!1&&l.value.length>0&&s.value.layout!=="home"),d=$(()=>y?s.value.aside==null?t.value.aside==="left":s.value.aside==="left":!1),y=$(()=>s.value.layout==="home"?!1:s.value.aside!=null?!!s.value.aside:t.value.aside!==!1),L=$(()=>f.value&&o.value),g=$(()=>f.value?rt(l.value):[]);function V(){n.value=!0}function I(){n.value=!1}function A(){n.value?I():V()}return{isOpen:n,sidebar:l,sidebarGroups:g,hasSidebar:f,hasAside:y,leftAside:d,isSidebarEnabled:L,open:V,close:I,toggle:A}}function lt(s,e){let t;Q(()=>{t=s.value?document.activeElement:void 0}),q(()=>{window.addEventListener("keyup",o)}),de(()=>{window.removeEventListener("keyup",o)});function o(n){n.key==="Escape"&&s.value&&(e(),t==null||t.focus())}}function ct(s){const{page:e,hash:t}=P(),o=T(!1),n=$(()=>s.value.collapsed!=null),i=$(()=>!!s.value.link),l=T(!1),f=()=>{l.value=z(e.value.relativePath,s.value.link)};D([e,s,t],f),q(f);const d=$(()=>l.value?!0:s.value.items?ie(e.value.relativePath,s.value.items):!1),y=$(()=>!!(s.value.items&&s.value.items.length));Q(()=>{o.value=!!(n.value&&s.value.collapsed)}),ve(()=>{(l.value||d.value)&&(o.value=!1)});function L(){n.value&&(o.value=!o.value)}return{collapsed:o,collapsible:n,isLink:i,isActiveLink:l,hasActiveLink:d,hasChildren:y,toggle:L}}function ut(){const{hasSidebar:s}=O(),e=ae("(min-width: 960px)"),t=ae("(min-width: 1280px)");return{isAsideEnabled:$(()=>!t.value&&!e.value?!1:s.value?t.value:e.value)}}const le=[];function Te(s){return typeof s.outline=="object"&&!Array.isArray(s.outline)&&s.outline.label||s.outlineTitle||"On this page"}function fe(s){const e=[...document.querySelectorAll(".VPDoc :where(h1,h2,h3,h4,h5,h6)")].filter(t=>t.id&&t.hasChildNodes()).map(t=>{const o=Number(t.tagName[1]);return{element:t,title:dt(t),link:"#"+t.id,level:o}});return vt(e,s)}function dt(s){let e="";for(const t of s.childNodes)if(t.nodeType===1){if(t.classList.contains("VPBadge")||t.classList.contains("header-anchor")||t.classList.contains("ignore-header"))continue;e+=t.textContent}else t.nodeType===3&&(e+=t.textContent);return e.trim()}function vt(s,e){if(e===!1)return[];const t=(typeof e=="object"&&!Array.isArray(e)?e.level:e)||2,[o,n]=typeof t=="number"?[t,t]:t==="deep"?[2,6]:t;return ht(s,o,n)}function pt(s,e){const{isAsideEnabled:t}=ut(),o=Qe(i,100);let n=null;q(()=>{requestAnimationFrame(i),window.addEventListener("scroll",o)}),Ce(()=>{l(location.hash)}),de(()=>{window.removeEventListener("scroll",o)});function i(){if(!t.value)return;const f=window.scrollY,d=window.innerHeight,y=document.body.offsetHeight,L=Math.abs(f+d-y)<1,g=le.map(({element:I,link:A})=>({link:A,top:ft(I)})).filter(({top:I})=>!Number.isNaN(I)).sort((I,A)=>I.top-A.top);if(!g.length){l(null);return}if(f<1){l(null);return}if(L){l(g[g.length-1].link);return}let V=null;for(const{link:I,top:A}of g){if(A>f+Ee()+4)break;V=I}l(V)}function l(f){n&&n.classList.remove("active"),f==null?n=null:n=s.value.querySelector(`a[href="${decodeURIComponent(f)}"]`);const d=n;d?(d.classList.add("active"),e.value.style.top=d.offsetTop+39+"px",e.value.style.opacity="1"):(e.value.style.top="33px",e.value.style.opacity="0")}}function ft(s){let e=0;for(;s!==document.body;){if(s===null)return NaN;e+=s.offsetTop,s=s.offsetParent}return e}function ht(s,e,t){le.length=0;const o=[],n=[];return s.forEach(i=>{const l={...i,children:[]};let f=n[n.length-1];for(;f&&f.level>=l.level;)n.pop(),f=n[n.length-1];if(l.element.classList.contains("ignore-header")||f&&"shouldIgnore"in f){n.push({level:l.level,shouldIgnore:!0});return}l.level>t||l.level{const n=W("VPDocOutlineItem",!0);return a(),u("ul",{class:M(["VPDocOutlineItem",t.root?"root":"nested"])},[(a(!0),u(w,null,H(t.headers,({children:i,link:l,title:f})=>(a(),u("li",null,[v("a",{class:"outline-link",href:l,onClick:e,title:f},N(f),9,mt),i!=null&&i.length?(a(),k(n,{key:0,headers:i},null,8,["headers"])):h("",!0)]))),256))],2)}}}),Ne=b(_t,[["__scopeId","data-v-b933a997"]]),kt={class:"content"},bt={"aria-level":"2",class:"outline-title",id:"doc-outline-aria-label",role:"heading"},gt=m({__name:"VPDocAsideOutline",setup(s){const{frontmatter:e,theme:t}=P(),o=ge([]);X(()=>{o.value=fe(e.value.outline??t.value.outline)});const n=T(),i=T();return pt(n,i),(l,f)=>(a(),u("nav",{"aria-labelledby":"doc-outline-aria-label",class:M(["VPDocAsideOutline",{"has-outline":o.value.length>0}]),ref_key:"container",ref:n},[v("div",kt,[v("div",{class:"outline-marker",ref_key:"marker",ref:i},null,512),v("div",bt,N(r(Te)(r(t))),1),_(Ne,{headers:o.value,root:!0},null,8,["headers"])])],2))}}),$t=b(gt,[["__scopeId","data-v-a5bbad30"]]),yt={class:"VPDocAsideCarbonAds"},Pt=m({__name:"VPDocAsideCarbonAds",props:{carbonAds:{}},setup(s){const e=()=>null;return(t,o)=>(a(),u("div",yt,[_(r(e),{"carbon-ads":t.carbonAds},null,8,["carbon-ads"])]))}}),Lt={class:"VPDocAside"},Vt=m({__name:"VPDocAside",setup(s){const{theme:e}=P();return(t,o)=>(a(),u("div",Lt,[c(t.$slots,"aside-top",{},void 0,!0),c(t.$slots,"aside-outline-before",{},void 0,!0),_($t),c(t.$slots,"aside-outline-after",{},void 0,!0),o[0]||(o[0]=v("div",{class:"spacer"},null,-1)),c(t.$slots,"aside-ads-before",{},void 0,!0),r(e).carbonAds?(a(),k(Pt,{key:0,"carbon-ads":r(e).carbonAds},null,8,["carbon-ads"])):h("",!0),c(t.$slots,"aside-ads-after",{},void 0,!0),c(t.$slots,"aside-bottom",{},void 0,!0)]))}}),St=b(Vt,[["__scopeId","data-v-3f215769"]]);function Tt(){const{theme:s,page:e}=P();return $(()=>{const{text:t="Edit this page",pattern:o=""}=s.value.editLink||{};let n;return typeof o=="function"?n=o(e.value):n=o.replace(/:path/g,e.value.filePath),{url:n,text:t}})}function Nt(){const{page:s,theme:e,frontmatter:t}=P();return $(()=>{var y,L,g,V,I,A,B,S;const o=Se(e.value.sidebar,s.value.relativePath),n=it(o),i=Mt(n,C=>C.link.replace(/[?#].*$/,"")),l=i.findIndex(C=>z(s.value.relativePath,C.link)),f=((y=e.value.docFooter)==null?void 0:y.prev)===!1&&!t.value.prev||t.value.prev===!1,d=((L=e.value.docFooter)==null?void 0:L.next)===!1&&!t.value.next||t.value.next===!1;return{prev:f?void 0:{text:(typeof t.value.prev=="string"?t.value.prev:typeof t.value.prev=="object"?t.value.prev.text:void 0)??((g=i[l-1])==null?void 0:g.docFooterText)??((V=i[l-1])==null?void 0:V.text),link:(typeof t.value.prev=="object"?t.value.prev.link:void 0)??((I=i[l-1])==null?void 0:I.link)},next:d?void 0:{text:(typeof t.value.next=="string"?t.value.next:typeof t.value.next=="object"?t.value.next.text:void 0)??((A=i[l+1])==null?void 0:A.docFooterText)??((B=i[l+1])==null?void 0:B.text),link:(typeof t.value.next=="object"?t.value.next.link:void 0)??((S=i[l+1])==null?void 0:S.link)}}})}function Mt(s,e){const t=new Set;return s.filter(o=>{const n=e(o);return t.has(n)?!1:t.add(n)})}const F=m({__name:"VPLink",props:{tag:{},href:{},noIcon:{type:Boolean},target:{},rel:{}},setup(s){const e=s,t=$(()=>e.tag??(e.href?"a":"span")),o=$(()=>e.href&&$e.test(e.href)||e.target==="_blank");return(n,i)=>(a(),k(E(t.value),{class:M(["VPLink",{link:n.href,"vp-external-link-icon":o.value,"no-icon":n.noIcon}]),href:n.href?r(pe)(n.href):void 0,target:n.target??(o.value?"_blank":void 0),rel:n.rel??(o.value?"noreferrer":void 0)},{default:p(()=>[c(n.$slots,"default")]),_:3},8,["class","href","target","rel"]))}}),It={class:"VPLastUpdated"},wt=["datetime"],At=m({__name:"VPDocFooterLastUpdated",setup(s){const{theme:e,page:t,lang:o}=P(),n=$(()=>new Date(t.value.lastUpdated)),i=$(()=>n.value.toISOString()),l=T("");return q(()=>{Q(()=>{var f,d,y;l.value=new Intl.DateTimeFormat((d=(f=e.value.lastUpdated)==null?void 0:f.formatOptions)!=null&&d.forceLocale?o.value:void 0,((y=e.value.lastUpdated)==null?void 0:y.formatOptions)??{dateStyle:"short",timeStyle:"short"}).format(n.value)})}),(f,d)=>{var y;return a(),u("p",It,[j(N(((y=r(e).lastUpdated)==null?void 0:y.text)||r(e).lastUpdatedText||"Last updated")+": ",1),v("time",{datetime:i.value},N(l.value),9,wt)])}}}),Bt=b(At,[["__scopeId","data-v-e98dd255"]]),Ht={key:0,class:"VPDocFooter"},Ct={key:0,class:"edit-info"},Et={key:0,class:"edit-link"},Ft={key:1,class:"last-updated"},Dt={key:1,class:"prev-next","aria-labelledby":"doc-footer-aria-label"},Ot={class:"pager"},Gt=["innerHTML"],Ut=["innerHTML"],jt={class:"pager"},zt=["innerHTML"],qt=["innerHTML"],Wt=m({__name:"VPDocFooter",setup(s){const{theme:e,page:t,frontmatter:o}=P(),n=Tt(),i=Nt(),l=$(()=>e.value.editLink&&o.value.editLink!==!1),f=$(()=>t.value.lastUpdated),d=$(()=>l.value||f.value||i.value.prev||i.value.next);return(y,L)=>{var g,V,I,A;return d.value?(a(),u("footer",Ht,[c(y.$slots,"doc-footer-before",{},void 0,!0),l.value||f.value?(a(),u("div",Ct,[l.value?(a(),u("div",Et,[_(F,{class:"edit-link-button",href:r(n).url,"no-icon":!0},{default:p(()=>[L[0]||(L[0]=v("span",{class:"vpi-square-pen edit-link-icon"},null,-1)),j(" "+N(r(n).text),1)]),_:1},8,["href"])])):h("",!0),f.value?(a(),u("div",Ft,[_(Bt)])):h("",!0)])):h("",!0),(g=r(i).prev)!=null&&g.link||(V=r(i).next)!=null&&V.link?(a(),u("nav",Dt,[L[1]||(L[1]=v("span",{class:"visually-hidden",id:"doc-footer-aria-label"},"Pager",-1)),v("div",Ot,[(I=r(i).prev)!=null&&I.link?(a(),k(F,{key:0,class:"pager-link prev",href:r(i).prev.link},{default:p(()=>{var B;return[v("span",{class:"desc",innerHTML:((B=r(e).docFooter)==null?void 0:B.prev)||"Previous page"},null,8,Gt),v("span",{class:"title",innerHTML:r(i).prev.text},null,8,Ut)]}),_:1},8,["href"])):h("",!0)]),v("div",jt,[(A=r(i).next)!=null&&A.link?(a(),k(F,{key:0,class:"pager-link next",href:r(i).next.link},{default:p(()=>{var B;return[v("span",{class:"desc",innerHTML:((B=r(e).docFooter)==null?void 0:B.next)||"Next page"},null,8,zt),v("span",{class:"title",innerHTML:r(i).next.text},null,8,qt)]}),_:1},8,["href"])):h("",!0)])])):h("",!0)])):h("",!0)}}}),Kt=b(Wt,[["__scopeId","data-v-e257564d"]]),Jt={class:"container"},Rt={class:"aside-container"},Yt={class:"aside-content"},Qt={class:"content"},Xt={class:"content-container"},Zt={class:"main"},xt=m({__name:"VPDoc",setup(s){const{theme:e}=P(),t=Z(),{hasSidebar:o,hasAside:n,leftAside:i}=O(),l=$(()=>t.path.replace(/[./]+/g,"_").replace(/_html$/,""));return(f,d)=>{const y=W("Content");return a(),u("div",{class:M(["VPDoc",{"has-sidebar":r(o),"has-aside":r(n)}])},[c(f.$slots,"doc-top",{},void 0,!0),v("div",Jt,[r(n)?(a(),u("div",{key:0,class:M(["aside",{"left-aside":r(i)}])},[d[0]||(d[0]=v("div",{class:"aside-curtain"},null,-1)),v("div",Rt,[v("div",Yt,[_(St,null,{"aside-top":p(()=>[c(f.$slots,"aside-top",{},void 0,!0)]),"aside-bottom":p(()=>[c(f.$slots,"aside-bottom",{},void 0,!0)]),"aside-outline-before":p(()=>[c(f.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":p(()=>[c(f.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":p(()=>[c(f.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":p(()=>[c(f.$slots,"aside-ads-after",{},void 0,!0)]),_:3})])])],2)):h("",!0),v("div",Qt,[v("div",Xt,[c(f.$slots,"doc-before",{},void 0,!0),v("main",Zt,[_(y,{class:M(["vp-doc",[l.value,r(e).externalLinkIcon&&"external-link-icon-enabled"]])},null,8,["class"])]),_(Kt,null,{"doc-footer-before":p(()=>[c(f.$slots,"doc-footer-before",{},void 0,!0)]),_:3}),c(f.$slots,"doc-after",{},void 0,!0)])])]),c(f.$slots,"doc-bottom",{},void 0,!0)],2)}}}),en=b(xt,[["__scopeId","data-v-39a288b8"]]),tn=m({__name:"VPButton",props:{tag:{},size:{default:"medium"},theme:{default:"brand"},text:{},href:{},target:{},rel:{}},setup(s){const e=s,t=$(()=>e.href&&$e.test(e.href)),o=$(()=>e.tag||(e.href?"a":"button"));return(n,i)=>(a(),k(E(o.value),{class:M(["VPButton",[n.size,n.theme]]),href:n.href?r(pe)(n.href):void 0,target:e.target??(t.value?"_blank":void 0),rel:e.rel??(t.value?"noreferrer":void 0)},{default:p(()=>[j(N(n.text),1)]),_:1},8,["class","href","target","rel"]))}}),nn=b(tn,[["__scopeId","data-v-fa7799d5"]]),on=["src","alt"],sn=m({inheritAttrs:!1,__name:"VPImage",props:{image:{},alt:{}},setup(s){return(e,t)=>{const o=W("VPImage",!0);return e.image?(a(),u(w,{key:0},[typeof e.image=="string"||"src"in e.image?(a(),u("img",U({key:0,class:"VPImage"},typeof e.image=="string"?e.$attrs:{...e.image,...e.$attrs},{src:r(ue)(typeof e.image=="string"?e.image:e.image.src),alt:e.alt??(typeof e.image=="string"?"":e.image.alt||"")}),null,16,on)):(a(),u(w,{key:1},[_(o,U({class:"dark",image:e.image.dark,alt:e.image.alt},e.$attrs),null,16,["image","alt"]),_(o,U({class:"light",image:e.image.light,alt:e.image.alt},e.$attrs),null,16,["image","alt"])],64))],64)):h("",!0)}}}),Y=b(sn,[["__scopeId","data-v-8426fc1a"]]),an={class:"container"},rn={class:"main"},ln={key:0,class:"name"},cn=["innerHTML"],un=["innerHTML"],dn=["innerHTML"],vn={key:0,class:"actions"},pn={key:0,class:"image"},fn={class:"image-container"},hn=m({__name:"VPHero",props:{name:{},text:{},tagline:{},image:{},actions:{}},setup(s){const e=x("hero-image-slot-exists");return(t,o)=>(a(),u("div",{class:M(["VPHero",{"has-image":t.image||r(e)}])},[v("div",an,[v("div",rn,[c(t.$slots,"home-hero-info-before",{},void 0,!0),c(t.$slots,"home-hero-info",{},()=>[t.name?(a(),u("h1",ln,[v("span",{innerHTML:t.name,class:"clip"},null,8,cn)])):h("",!0),t.text?(a(),u("p",{key:1,innerHTML:t.text,class:"text"},null,8,un)):h("",!0),t.tagline?(a(),u("p",{key:2,innerHTML:t.tagline,class:"tagline"},null,8,dn)):h("",!0)],!0),c(t.$slots,"home-hero-info-after",{},void 0,!0),t.actions?(a(),u("div",vn,[(a(!0),u(w,null,H(t.actions,n=>(a(),u("div",{key:n.link,class:"action"},[_(nn,{tag:"a",size:"medium",theme:n.theme,text:n.text,href:n.link,target:n.target,rel:n.rel},null,8,["theme","text","href","target","rel"])]))),128))])):h("",!0),c(t.$slots,"home-hero-actions-after",{},void 0,!0)]),t.image||r(e)?(a(),u("div",pn,[v("div",fn,[o[0]||(o[0]=v("div",{class:"image-bg"},null,-1)),c(t.$slots,"home-hero-image",{},()=>[t.image?(a(),k(Y,{key:0,class:"image-src",image:t.image},null,8,["image"])):h("",!0)],!0)])])):h("",!0)])],2))}}),mn=b(hn,[["__scopeId","data-v-303bb580"]]),_n=m({__name:"VPHomeHero",setup(s){const{frontmatter:e}=P();return(t,o)=>r(e).hero?(a(),k(mn,{key:0,class:"VPHomeHero",name:r(e).hero.name,text:r(e).hero.text,tagline:r(e).hero.tagline,image:r(e).hero.image,actions:r(e).hero.actions},{"home-hero-info-before":p(()=>[c(t.$slots,"home-hero-info-before")]),"home-hero-info":p(()=>[c(t.$slots,"home-hero-info")]),"home-hero-info-after":p(()=>[c(t.$slots,"home-hero-info-after")]),"home-hero-actions-after":p(()=>[c(t.$slots,"home-hero-actions-after")]),"home-hero-image":p(()=>[c(t.$slots,"home-hero-image")]),_:3},8,["name","text","tagline","image","actions"])):h("",!0)}}),kn={class:"box"},bn={key:0,class:"icon"},gn=["innerHTML"],$n=["innerHTML"],yn=["innerHTML"],Pn={key:4,class:"link-text"},Ln={class:"link-text-value"},Vn=m({__name:"VPFeature",props:{icon:{},title:{},details:{},link:{},linkText:{},rel:{},target:{}},setup(s){return(e,t)=>(a(),k(F,{class:"VPFeature",href:e.link,rel:e.rel,target:e.target,"no-icon":!0,tag:e.link?"a":"div"},{default:p(()=>[v("article",kn,[typeof e.icon=="object"&&e.icon.wrap?(a(),u("div",bn,[_(Y,{image:e.icon,alt:e.icon.alt,height:e.icon.height||48,width:e.icon.width||48},null,8,["image","alt","height","width"])])):typeof e.icon=="object"?(a(),k(Y,{key:1,image:e.icon,alt:e.icon.alt,height:e.icon.height||48,width:e.icon.width||48},null,8,["image","alt","height","width"])):e.icon?(a(),u("div",{key:2,class:"icon",innerHTML:e.icon},null,8,gn)):h("",!0),v("h2",{class:"title",innerHTML:e.title},null,8,$n),e.details?(a(),u("p",{key:3,class:"details",innerHTML:e.details},null,8,yn)):h("",!0),e.linkText?(a(),u("div",Pn,[v("p",Ln,[j(N(e.linkText)+" ",1),t[0]||(t[0]=v("span",{class:"vpi-arrow-right link-text-icon"},null,-1))])])):h("",!0)])]),_:1},8,["href","rel","target","tag"]))}}),Sn=b(Vn,[["__scopeId","data-v-a3976bdc"]]),Tn={key:0,class:"VPFeatures"},Nn={class:"container"},Mn={class:"items"},In=m({__name:"VPFeatures",props:{features:{}},setup(s){const e=s,t=$(()=>{const o=e.features.length;if(o){if(o===2)return"grid-2";if(o===3)return"grid-3";if(o%3===0)return"grid-6";if(o>3)return"grid-4"}else return});return(o,n)=>o.features?(a(),u("div",Tn,[v("div",Nn,[v("div",Mn,[(a(!0),u(w,null,H(o.features,i=>(a(),u("div",{key:i.title,class:M(["item",[t.value]])},[_(Sn,{icon:i.icon,title:i.title,details:i.details,link:i.link,"link-text":i.linkText,rel:i.rel,target:i.target},null,8,["icon","title","details","link","link-text","rel","target"])],2))),128))])])])):h("",!0)}}),wn=b(In,[["__scopeId","data-v-a6181336"]]),An=m({__name:"VPHomeFeatures",setup(s){const{frontmatter:e}=P();return(t,o)=>r(e).features?(a(),k(wn,{key:0,class:"VPHomeFeatures",features:r(e).features},null,8,["features"])):h("",!0)}}),Bn=m({__name:"VPHomeContent",setup(s){const{width:e}=Fe({initialWidth:0,includeScrollbar:!1});return(t,o)=>(a(),u("div",{class:"vp-doc container",style:ye(r(e)?{"--vp-offset":`calc(50% - ${r(e)/2}px)`}:{})},[c(t.$slots,"default",{},void 0,!0)],4))}}),Hn=b(Bn,[["__scopeId","data-v-8e2d4988"]]),Cn={class:"VPHome"},En=m({__name:"VPHome",setup(s){const{frontmatter:e}=P();return(t,o)=>{const n=W("Content");return a(),u("div",Cn,[c(t.$slots,"home-hero-before",{},void 0,!0),_(_n,null,{"home-hero-info-before":p(()=>[c(t.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":p(()=>[c(t.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":p(()=>[c(t.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":p(()=>[c(t.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":p(()=>[c(t.$slots,"home-hero-image",{},void 0,!0)]),_:3}),c(t.$slots,"home-hero-after",{},void 0,!0),c(t.$slots,"home-features-before",{},void 0,!0),_(An),c(t.$slots,"home-features-after",{},void 0,!0),r(e).markdownStyles!==!1?(a(),k(Hn,{key:0},{default:p(()=>[_(n)]),_:1})):(a(),k(n,{key:1}))])}}}),Fn=b(En,[["__scopeId","data-v-686f80a6"]]),Dn={},On={class:"VPPage"};function Gn(s,e){const t=W("Content");return a(),u("div",On,[c(s.$slots,"page-top"),_(t),c(s.$slots,"page-bottom")])}const Un=b(Dn,[["render",Gn]]),jn=m({__name:"VPContent",setup(s){const{page:e,frontmatter:t}=P(),{hasSidebar:o}=O();return(n,i)=>(a(),u("div",{class:M(["VPContent",{"has-sidebar":r(o),"is-home":r(t).layout==="home"}]),id:"VPContent"},[r(e).isNotFound?c(n.$slots,"not-found",{key:0},()=>[_(at)],!0):r(t).layout==="page"?(a(),k(Un,{key:1},{"page-top":p(()=>[c(n.$slots,"page-top",{},void 0,!0)]),"page-bottom":p(()=>[c(n.$slots,"page-bottom",{},void 0,!0)]),_:3})):r(t).layout==="home"?(a(),k(Fn,{key:2},{"home-hero-before":p(()=>[c(n.$slots,"home-hero-before",{},void 0,!0)]),"home-hero-info-before":p(()=>[c(n.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":p(()=>[c(n.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":p(()=>[c(n.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":p(()=>[c(n.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":p(()=>[c(n.$slots,"home-hero-image",{},void 0,!0)]),"home-hero-after":p(()=>[c(n.$slots,"home-hero-after",{},void 0,!0)]),"home-features-before":p(()=>[c(n.$slots,"home-features-before",{},void 0,!0)]),"home-features-after":p(()=>[c(n.$slots,"home-features-after",{},void 0,!0)]),_:3})):r(t).layout&&r(t).layout!=="doc"?(a(),k(E(r(t).layout),{key:3})):(a(),k(en,{key:4},{"doc-top":p(()=>[c(n.$slots,"doc-top",{},void 0,!0)]),"doc-bottom":p(()=>[c(n.$slots,"doc-bottom",{},void 0,!0)]),"doc-footer-before":p(()=>[c(n.$slots,"doc-footer-before",{},void 0,!0)]),"doc-before":p(()=>[c(n.$slots,"doc-before",{},void 0,!0)]),"doc-after":p(()=>[c(n.$slots,"doc-after",{},void 0,!0)]),"aside-top":p(()=>[c(n.$slots,"aside-top",{},void 0,!0)]),"aside-outline-before":p(()=>[c(n.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":p(()=>[c(n.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":p(()=>[c(n.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":p(()=>[c(n.$slots,"aside-ads-after",{},void 0,!0)]),"aside-bottom":p(()=>[c(n.$slots,"aside-bottom",{},void 0,!0)]),_:3}))],2))}}),zn=b(jn,[["__scopeId","data-v-1428d186"]]),qn={class:"container"},Wn=["innerHTML"],Kn=["innerHTML"],Jn=m({__name:"VPFooter",setup(s){const{theme:e,frontmatter:t}=P(),{hasSidebar:o}=O();return(n,i)=>r(e).footer&&r(t).footer!==!1?(a(),u("footer",{key:0,class:M(["VPFooter",{"has-sidebar":r(o)}])},[v("div",qn,[r(e).footer.message?(a(),u("p",{key:0,class:"message",innerHTML:r(e).footer.message},null,8,Wn)):h("",!0),r(e).footer.copyright?(a(),u("p",{key:1,class:"copyright",innerHTML:r(e).footer.copyright},null,8,Kn)):h("",!0)])],2)):h("",!0)}}),Rn=b(Jn,[["__scopeId","data-v-e315a0ad"]]);function Yn(){const{theme:s,frontmatter:e}=P(),t=ge([]),o=$(()=>t.value.length>0);return X(()=>{t.value=fe(e.value.outline??s.value.outline)}),{headers:t,hasLocalNav:o}}const Qn={class:"menu-text"},Xn={class:"header"},Zn={class:"outline"},xn=m({__name:"VPLocalNavOutlineDropdown",props:{headers:{},navHeight:{}},setup(s){const e=s,{theme:t}=P(),o=T(!1),n=T(0),i=T(),l=T();function f(g){var V;(V=i.value)!=null&&V.contains(g.target)||(o.value=!1)}D(o,g=>{if(g){document.addEventListener("click",f);return}document.removeEventListener("click",f)}),De("Escape",()=>{o.value=!1}),X(()=>{o.value=!1});function d(){o.value=!o.value,n.value=window.innerHeight+Math.min(window.scrollY-e.navHeight,0)}function y(g){g.target.classList.contains("outline-link")&&(l.value&&(l.value.style.transition="none"),Oe(()=>{o.value=!1}))}function L(){o.value=!1,window.scrollTo({top:0,left:0,behavior:"smooth"})}return(g,V)=>(a(),u("div",{class:"VPLocalNavOutlineDropdown",style:ye({"--vp-vh":n.value+"px"}),ref_key:"main",ref:i},[g.headers.length>0?(a(),u("button",{key:0,onClick:d,class:M({open:o.value})},[v("span",Qn,N(r(Te)(r(t))),1),V[0]||(V[0]=v("span",{class:"vpi-chevron-right icon"},null,-1))],2)):(a(),u("button",{key:1,onClick:L},N(r(t).returnToTopLabel||"Return to top"),1)),_(ce,{name:"flyout"},{default:p(()=>[o.value?(a(),u("div",{key:0,ref_key:"items",ref:l,class:"items",onClick:y},[v("div",Xn,[v("a",{class:"top-link",href:"#",onClick:L},N(r(t).returnToTopLabel||"Return to top"),1)]),v("div",Zn,[_(Ne,{headers:g.headers},null,8,["headers"])])],512)):h("",!0)]),_:1})],4))}}),eo=b(xn,[["__scopeId","data-v-17a5e62e"]]),to={class:"container"},no=["aria-expanded"],oo={class:"menu-text"},so=m({__name:"VPLocalNav",props:{open:{type:Boolean}},emits:["open-menu"],setup(s){const{theme:e,frontmatter:t}=P(),{hasSidebar:o}=O(),{headers:n}=Yn(),{y:i}=Pe(),l=T(0);q(()=>{l.value=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--vp-nav-height"))}),X(()=>{n.value=fe(t.value.outline??e.value.outline)});const f=$(()=>n.value.length===0),d=$(()=>f.value&&!o.value),y=$(()=>({VPLocalNav:!0,"has-sidebar":o.value,empty:f.value,fixed:d.value}));return(L,g)=>r(t).layout!=="home"&&(!d.value||r(i)>=l.value)?(a(),u("div",{key:0,class:M(y.value)},[v("div",to,[r(o)?(a(),u("button",{key:0,class:"menu","aria-expanded":L.open,"aria-controls":"VPSidebarNav",onClick:g[0]||(g[0]=V=>L.$emit("open-menu"))},[g[1]||(g[1]=v("span",{class:"vpi-align-left menu-icon"},null,-1)),v("span",oo,N(r(e).sidebarMenuLabel||"Menu"),1)],8,no)):h("",!0),_(eo,{headers:r(n),navHeight:l.value},null,8,["headers","navHeight"])])],2)):h("",!0)}}),ao=b(so,[["__scopeId","data-v-a6f0e41e"]]);function ro(){const s=T(!1);function e(){s.value=!0,window.addEventListener("resize",n)}function t(){s.value=!1,window.removeEventListener("resize",n)}function o(){s.value?t():e()}function n(){window.outerWidth>=768&&t()}const i=Z();return D(()=>i.path,t),{isScreenOpen:s,openScreen:e,closeScreen:t,toggleScreen:o}}const io={},lo={class:"VPSwitch",type:"button",role:"switch"},co={class:"check"},uo={key:0,class:"icon"};function vo(s,e){return a(),u("button",lo,[v("span",co,[s.$slots.default?(a(),u("span",uo,[c(s.$slots,"default",{},void 0,!0)])):h("",!0)])])}const po=b(io,[["render",vo],["__scopeId","data-v-1d5665e3"]]),fo=m({__name:"VPSwitchAppearance",setup(s){const{isDark:e,theme:t}=P(),o=x("toggle-appearance",()=>{e.value=!e.value}),n=T("");return ve(()=>{n.value=e.value?t.value.lightModeSwitchTitle||"Switch to light theme":t.value.darkModeSwitchTitle||"Switch to dark theme"}),(i,l)=>(a(),k(po,{title:n.value,class:"VPSwitchAppearance","aria-checked":r(e),onClick:r(o)},{default:p(()=>l[0]||(l[0]=[v("span",{class:"vpi-sun sun"},null,-1),v("span",{class:"vpi-moon moon"},null,-1)])),_:1},8,["title","aria-checked","onClick"]))}}),he=b(fo,[["__scopeId","data-v-5337faa4"]]),ho={key:0,class:"VPNavBarAppearance"},mo=m({__name:"VPNavBarAppearance",setup(s){const{site:e}=P();return(t,o)=>r(e).appearance&&r(e).appearance!=="force-dark"&&r(e).appearance!=="force-auto"?(a(),u("div",ho,[_(he)])):h("",!0)}}),_o=b(mo,[["__scopeId","data-v-6c893767"]]),me=T();let Me=!1,se=0;function ko(s){const e=T(!1);if(ee){!Me&&bo(),se++;const t=D(me,o=>{var n,i,l;o===s.el.value||(n=s.el.value)!=null&&n.contains(o)?(e.value=!0,(i=s.onFocus)==null||i.call(s)):(e.value=!1,(l=s.onBlur)==null||l.call(s))});de(()=>{t(),se--,se||go()})}return Ge(e)}function bo(){document.addEventListener("focusin",Ie),Me=!0,me.value=document.activeElement}function go(){document.removeEventListener("focusin",Ie)}function Ie(){me.value=document.activeElement}const $o={class:"VPMenuLink"},yo=["innerHTML"],Po=m({__name:"VPMenuLink",props:{item:{}},setup(s){const{page:e}=P();return(t,o)=>(a(),u("div",$o,[_(F,{class:M({active:r(z)(r(e).relativePath,t.item.activeMatch||t.item.link,!!t.item.activeMatch)}),href:t.item.link,target:t.item.target,rel:t.item.rel,"no-icon":t.item.noIcon},{default:p(()=>[v("span",{innerHTML:t.item.text},null,8,yo)]),_:1},8,["class","href","target","rel","no-icon"])]))}}),te=b(Po,[["__scopeId","data-v-35975db6"]]),Lo={class:"VPMenuGroup"},Vo={key:0,class:"title"},So=m({__name:"VPMenuGroup",props:{text:{},items:{}},setup(s){return(e,t)=>(a(),u("div",Lo,[e.text?(a(),u("p",Vo,N(e.text),1)):h("",!0),(a(!0),u(w,null,H(e.items,o=>(a(),u(w,null,["link"in o?(a(),k(te,{key:0,item:o},null,8,["item"])):h("",!0)],64))),256))]))}}),To=b(So,[["__scopeId","data-v-69e747b5"]]),No={class:"VPMenu"},Mo={key:0,class:"items"},Io=m({__name:"VPMenu",props:{items:{}},setup(s){return(e,t)=>(a(),u("div",No,[e.items?(a(),u("div",Mo,[(a(!0),u(w,null,H(e.items,o=>(a(),u(w,{key:JSON.stringify(o)},["link"in o?(a(),k(te,{key:0,item:o},null,8,["item"])):"component"in o?(a(),k(E(o.component),U({key:1,ref_for:!0},o.props),null,16)):(a(),k(To,{key:2,text:o.text,items:o.items},null,8,["text","items"]))],64))),128))])):h("",!0),c(e.$slots,"default",{},void 0,!0)]))}}),wo=b(Io,[["__scopeId","data-v-b98bc113"]]),Ao=["aria-expanded","aria-label"],Bo={key:0,class:"text"},Ho=["innerHTML"],Co={key:1,class:"vpi-more-horizontal icon"},Eo={class:"menu"},Fo=m({__name:"VPFlyout",props:{icon:{},button:{},label:{},items:{}},setup(s){const e=T(!1),t=T();ko({el:t,onBlur:o});function o(){e.value=!1}return(n,i)=>(a(),u("div",{class:"VPFlyout",ref_key:"el",ref:t,onMouseenter:i[1]||(i[1]=l=>e.value=!0),onMouseleave:i[2]||(i[2]=l=>e.value=!1)},[v("button",{type:"button",class:"button","aria-haspopup":"true","aria-expanded":e.value,"aria-label":n.label,onClick:i[0]||(i[0]=l=>e.value=!e.value)},[n.button||n.icon?(a(),u("span",Bo,[n.icon?(a(),u("span",{key:0,class:M([n.icon,"option-icon"])},null,2)):h("",!0),n.button?(a(),u("span",{key:1,innerHTML:n.button},null,8,Ho)):h("",!0),i[3]||(i[3]=v("span",{class:"vpi-chevron-down text-icon"},null,-1))])):(a(),u("span",Co))],8,Ao),v("div",Eo,[_(wo,{items:n.items},{default:p(()=>[c(n.$slots,"default",{},void 0,!0)]),_:3},8,["items"])])],544))}}),_e=b(Fo,[["__scopeId","data-v-cf11d7a2"]]),Do=["href","aria-label","innerHTML"],Oo=m({__name:"VPSocialLink",props:{icon:{},link:{},ariaLabel:{}},setup(s){const e=s,t=$(()=>typeof e.icon=="object"?e.icon.svg:``);return(o,n)=>(a(),u("a",{class:"VPSocialLink no-icon",href:o.link,"aria-label":o.ariaLabel??(typeof o.icon=="string"?o.icon:""),target:"_blank",rel:"noopener",innerHTML:t.value},null,8,Do))}}),Go=b(Oo,[["__scopeId","data-v-eee4e7cb"]]),Uo={class:"VPSocialLinks"},jo=m({__name:"VPSocialLinks",props:{links:{}},setup(s){return(e,t)=>(a(),u("div",Uo,[(a(!0),u(w,null,H(e.links,({link:o,icon:n,ariaLabel:i})=>(a(),k(Go,{key:o,icon:n,link:o,ariaLabel:i},null,8,["icon","link","ariaLabel"]))),128))]))}}),ke=b(jo,[["__scopeId","data-v-7bc22406"]]),zo={key:0,class:"group translations"},qo={class:"trans-title"},Wo={key:1,class:"group"},Ko={class:"item appearance"},Jo={class:"label"},Ro={class:"appearance-action"},Yo={key:2,class:"group"},Qo={class:"item social-links"},Xo=m({__name:"VPNavBarExtra",setup(s){const{site:e,theme:t}=P(),{localeLinks:o,currentLang:n}=J({correspondingLink:!0}),i=$(()=>o.value.length&&n.value.label||e.value.appearance||t.value.socialLinks);return(l,f)=>i.value?(a(),k(_e,{key:0,class:"VPNavBarExtra",label:"extra navigation"},{default:p(()=>[r(o).length&&r(n).label?(a(),u("div",zo,[v("p",qo,N(r(n).label),1),(a(!0),u(w,null,H(r(o),d=>(a(),k(te,{key:d.link,item:d},null,8,["item"]))),128))])):h("",!0),r(e).appearance&&r(e).appearance!=="force-dark"&&r(e).appearance!=="force-auto"?(a(),u("div",Wo,[v("div",Ko,[v("p",Jo,N(r(t).darkModeSwitchLabel||"Appearance"),1),v("div",Ro,[_(he)])])])):h("",!0),r(t).socialLinks?(a(),u("div",Yo,[v("div",Qo,[_(ke,{class:"social-links-list",links:r(t).socialLinks},null,8,["links"])])])):h("",!0)]),_:1})):h("",!0)}}),Zo=b(Xo,[["__scopeId","data-v-bb2aa2f0"]]),xo=["aria-expanded"],es=m({__name:"VPNavBarHamburger",props:{active:{type:Boolean}},emits:["click"],setup(s){return(e,t)=>(a(),u("button",{type:"button",class:M(["VPNavBarHamburger",{active:e.active}]),"aria-label":"mobile navigation","aria-expanded":e.active,"aria-controls":"VPNavScreen",onClick:t[0]||(t[0]=o=>e.$emit("click"))},t[1]||(t[1]=[v("span",{class:"container"},[v("span",{class:"top"}),v("span",{class:"middle"}),v("span",{class:"bottom"})],-1)]),10,xo))}}),ts=b(es,[["__scopeId","data-v-e5dd9c1c"]]),ns=["innerHTML"],os=m({__name:"VPNavBarMenuLink",props:{item:{}},setup(s){const{page:e}=P();return(t,o)=>(a(),k(F,{class:M({VPNavBarMenuLink:!0,active:r(z)(r(e).relativePath,t.item.activeMatch||t.item.link,!!t.item.activeMatch)}),href:t.item.link,target:t.item.target,rel:t.item.rel,"no-icon":t.item.noIcon,tabindex:"0"},{default:p(()=>[v("span",{innerHTML:t.item.text},null,8,ns)]),_:1},8,["class","href","target","rel","no-icon"]))}}),ss=b(os,[["__scopeId","data-v-e56f3d57"]]),as=m({__name:"VPNavBarMenuGroup",props:{item:{}},setup(s){const e=s,{page:t}=P(),o=i=>"component"in i?!1:"link"in i?z(t.value.relativePath,i.link,!!e.item.activeMatch):i.items.some(o),n=$(()=>o(e.item));return(i,l)=>(a(),k(_e,{class:M({VPNavBarMenuGroup:!0,active:r(z)(r(t).relativePath,i.item.activeMatch,!!i.item.activeMatch)||n.value}),button:i.item.text,items:i.item.items},null,8,["class","button","items"]))}}),rs={key:0,"aria-labelledby":"main-nav-aria-label",class:"VPNavBarMenu"},is=m({__name:"VPNavBarMenu",setup(s){const{theme:e}=P();return(t,o)=>r(e).nav?(a(),u("nav",rs,[o[0]||(o[0]=v("span",{id:"main-nav-aria-label",class:"visually-hidden"}," Main Navigation ",-1)),(a(!0),u(w,null,H(r(e).nav,n=>(a(),u(w,{key:JSON.stringify(n)},["link"in n?(a(),k(ss,{key:0,item:n},null,8,["item"])):"component"in n?(a(),k(E(n.component),U({key:1,ref_for:!0},n.props),null,16)):(a(),k(as,{key:2,item:n},null,8,["item"]))],64))),128))])):h("",!0)}}),ls=b(is,[["__scopeId","data-v-dc692963"]]);function cs(s){const{localeIndex:e,theme:t}=P();function o(n){var A,B,S;const i=n.split("."),l=(A=t.value.search)==null?void 0:A.options,f=l&&typeof l=="object",d=f&&((S=(B=l.locales)==null?void 0:B[e.value])==null?void 0:S.translations)||null,y=f&&l.translations||null;let L=d,g=y,V=s;const I=i.pop();for(const C of i){let G=null;const K=V==null?void 0:V[C];K&&(G=V=K);const ne=g==null?void 0:g[C];ne&&(G=g=ne);const oe=L==null?void 0:L[C];oe&&(G=L=oe),K||(V=G),ne||(g=G),oe||(L=G)}return(L==null?void 0:L[I])??(g==null?void 0:g[I])??(V==null?void 0:V[I])??""}return o}const us=["aria-label"],ds={class:"DocSearch-Button-Container"},vs={class:"DocSearch-Button-Placeholder"},be=m({__name:"VPNavBarSearchButton",setup(s){const t=cs({button:{buttonText:"Search",buttonAriaLabel:"Search"}});return(o,n)=>(a(),u("button",{type:"button",class:"DocSearch DocSearch-Button","aria-label":r(t)("button.buttonAriaLabel")},[v("span",ds,[n[0]||(n[0]=v("span",{class:"vp-icon DocSearch-Search-Icon"},null,-1)),v("span",vs,N(r(t)("button.buttonText")),1)]),n[1]||(n[1]=v("span",{class:"DocSearch-Button-Keys"},[v("kbd",{class:"DocSearch-Button-Key"}),v("kbd",{class:"DocSearch-Button-Key"},"K")],-1))],8,us))}}),ps={class:"VPNavBarSearch"},fs={id:"local-search"},hs={key:1,id:"docsearch"},ms=m({__name:"VPNavBarSearch",setup(s){const e=()=>null,t=()=>null,{theme:o}=P(),n=T(!1),i=T(!1);q(()=>{});function l(){n.value||(n.value=!0,setTimeout(f,16))}function f(){const L=new Event("keydown");L.key="k",L.metaKey=!0,window.dispatchEvent(L),setTimeout(()=>{document.querySelector(".DocSearch-Modal")||f()},16)}const d=T(!1),y="";return(L,g)=>{var V;return a(),u("div",ps,[r(y)==="local"?(a(),u(w,{key:0},[d.value?(a(),k(r(e),{key:0,onClose:g[0]||(g[0]=I=>d.value=!1)})):h("",!0),v("div",fs,[_(be,{onClick:g[1]||(g[1]=I=>d.value=!0)})])],64)):r(y)==="algolia"?(a(),u(w,{key:1},[n.value?(a(),k(r(t),{key:0,algolia:((V=r(o).search)==null?void 0:V.options)??r(o).algolia,onVnodeBeforeMount:g[2]||(g[2]=I=>i.value=!0)},null,8,["algolia"])):h("",!0),i.value?h("",!0):(a(),u("div",hs,[_(be,{onClick:l})]))],64)):h("",!0)])}}}),_s=m({__name:"VPNavBarSocialLinks",setup(s){const{theme:e}=P();return(t,o)=>r(e).socialLinks?(a(),k(ke,{key:0,class:"VPNavBarSocialLinks",links:r(e).socialLinks},null,8,["links"])):h("",!0)}}),ks=b(_s,[["__scopeId","data-v-0394ad82"]]),bs=["href","rel","target"],gs={key:1},$s={key:2},ys=m({__name:"VPNavBarTitle",setup(s){const{site:e,theme:t}=P(),{hasSidebar:o}=O(),{currentLang:n}=J(),i=$(()=>{var d;return typeof t.value.logoLink=="string"?t.value.logoLink:(d=t.value.logoLink)==null?void 0:d.link}),l=$(()=>{var d;return typeof t.value.logoLink=="string"||(d=t.value.logoLink)==null?void 0:d.rel}),f=$(()=>{var d;return typeof t.value.logoLink=="string"||(d=t.value.logoLink)==null?void 0:d.target});return(d,y)=>(a(),u("div",{class:M(["VPNavBarTitle",{"has-sidebar":r(o)}])},[v("a",{class:"title",href:i.value??r(pe)(r(n).link),rel:l.value,target:f.value},[c(d.$slots,"nav-bar-title-before",{},void 0,!0),r(t).logo?(a(),k(Y,{key:0,class:"logo",image:r(t).logo},null,8,["image"])):h("",!0),r(t).siteTitle?(a(),u("span",gs,N(r(t).siteTitle),1)):r(t).siteTitle===void 0?(a(),u("span",$s,N(r(e).title),1)):h("",!0),c(d.$slots,"nav-bar-title-after",{},void 0,!0)],8,bs)],2))}}),Ps=b(ys,[["__scopeId","data-v-ab179fa1"]]),Ls={class:"items"},Vs={class:"title"},Ss=m({__name:"VPNavBarTranslations",setup(s){const{theme:e}=P(),{localeLinks:t,currentLang:o}=J({correspondingLink:!0});return(n,i)=>r(t).length&&r(o).label?(a(),k(_e,{key:0,class:"VPNavBarTranslations",icon:"vpi-languages",label:r(e).langMenuLabel||"Change language"},{default:p(()=>[v("div",Ls,[v("p",Vs,N(r(o).label),1),(a(!0),u(w,null,H(r(t),l=>(a(),k(te,{key:l.link,item:l},null,8,["item"]))),128))])]),_:1},8,["label"])):h("",!0)}}),Ts=b(Ss,[["__scopeId","data-v-88af2de4"]]),Ns={class:"wrapper"},Ms={class:"container"},Is={class:"title"},ws={class:"content"},As={class:"content-body"},Bs=m({__name:"VPNavBar",props:{isScreenOpen:{type:Boolean}},emits:["toggle-screen"],setup(s){const e=s,{y:t}=Pe(),{hasSidebar:o}=O(),{frontmatter:n}=P(),i=T({});return ve(()=>{i.value={"has-sidebar":o.value,home:n.value.layout==="home",top:t.value===0,"screen-open":e.isScreenOpen}}),(l,f)=>(a(),u("div",{class:M(["VPNavBar",i.value])},[v("div",Ns,[v("div",Ms,[v("div",Is,[_(Ps,null,{"nav-bar-title-before":p(()=>[c(l.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":p(()=>[c(l.$slots,"nav-bar-title-after",{},void 0,!0)]),_:3})]),v("div",ws,[v("div",As,[c(l.$slots,"nav-bar-content-before",{},void 0,!0),_(ms,{class:"search"}),_(ls,{class:"menu"}),_(Ts,{class:"translations"}),_(_o,{class:"appearance"}),_(ks,{class:"social-links"}),_(Zo,{class:"extra"}),c(l.$slots,"nav-bar-content-after",{},void 0,!0),_(ts,{class:"hamburger",active:l.isScreenOpen,onClick:f[0]||(f[0]=d=>l.$emit("toggle-screen"))},null,8,["active"])])])])]),f[1]||(f[1]=v("div",{class:"divider"},[v("div",{class:"divider-line"})],-1))],2))}}),Hs=b(Bs,[["__scopeId","data-v-6aa21345"]]),Cs={key:0,class:"VPNavScreenAppearance"},Es={class:"text"},Fs=m({__name:"VPNavScreenAppearance",setup(s){const{site:e,theme:t}=P();return(o,n)=>r(e).appearance&&r(e).appearance!=="force-dark"&&r(e).appearance!=="force-auto"?(a(),u("div",Cs,[v("p",Es,N(r(t).darkModeSwitchLabel||"Appearance"),1),_(he)])):h("",!0)}}),Ds=b(Fs,[["__scopeId","data-v-b44890b2"]]),Os=["innerHTML"],Gs=m({__name:"VPNavScreenMenuLink",props:{item:{}},setup(s){const e=x("close-screen");return(t,o)=>(a(),k(F,{class:"VPNavScreenMenuLink",href:t.item.link,target:t.item.target,rel:t.item.rel,"no-icon":t.item.noIcon,onClick:r(e)},{default:p(()=>[v("span",{innerHTML:t.item.text},null,8,Os)]),_:1},8,["href","target","rel","no-icon","onClick"]))}}),Us=b(Gs,[["__scopeId","data-v-df37e6dd"]]),js=["innerHTML"],zs=m({__name:"VPNavScreenMenuGroupLink",props:{item:{}},setup(s){const e=x("close-screen");return(t,o)=>(a(),k(F,{class:"VPNavScreenMenuGroupLink",href:t.item.link,target:t.item.target,rel:t.item.rel,"no-icon":t.item.noIcon,onClick:r(e)},{default:p(()=>[v("span",{innerHTML:t.item.text},null,8,js)]),_:1},8,["href","target","rel","no-icon","onClick"]))}}),we=b(zs,[["__scopeId","data-v-3e9c20e4"]]),qs={class:"VPNavScreenMenuGroupSection"},Ws={key:0,class:"title"},Ks=m({__name:"VPNavScreenMenuGroupSection",props:{text:{},items:{}},setup(s){return(e,t)=>(a(),u("div",qs,[e.text?(a(),u("p",Ws,N(e.text),1)):h("",!0),(a(!0),u(w,null,H(e.items,o=>(a(),k(we,{key:o.text,item:o},null,8,["item"]))),128))]))}}),Js=b(Ks,[["__scopeId","data-v-8133b170"]]),Rs=["aria-controls","aria-expanded"],Ys=["innerHTML"],Qs=["id"],Xs={key:0,class:"item"},Zs={key:1,class:"item"},xs={key:2,class:"group"},ea=m({__name:"VPNavScreenMenuGroup",props:{text:{},items:{}},setup(s){const e=s,t=T(!1),o=$(()=>`NavScreenGroup-${e.text.replace(" ","-").toLowerCase()}`);function n(){t.value=!t.value}return(i,l)=>(a(),u("div",{class:M(["VPNavScreenMenuGroup",{open:t.value}])},[v("button",{class:"button","aria-controls":o.value,"aria-expanded":t.value,onClick:n},[v("span",{class:"button-text",innerHTML:i.text},null,8,Ys),l[0]||(l[0]=v("span",{class:"vpi-plus button-icon"},null,-1))],8,Rs),v("div",{id:o.value,class:"items"},[(a(!0),u(w,null,H(i.items,f=>(a(),u(w,{key:JSON.stringify(f)},["link"in f?(a(),u("div",Xs,[_(we,{item:f},null,8,["item"])])):"component"in f?(a(),u("div",Zs,[(a(),k(E(f.component),U({ref_for:!0},f.props,{"screen-menu":""}),null,16))])):(a(),u("div",xs,[_(Js,{text:f.text,items:f.items},null,8,["text","items"])]))],64))),128))],8,Qs)],2))}}),ta=b(ea,[["__scopeId","data-v-b9ab8c58"]]),na={key:0,class:"VPNavScreenMenu"},oa=m({__name:"VPNavScreenMenu",setup(s){const{theme:e}=P();return(t,o)=>r(e).nav?(a(),u("nav",na,[(a(!0),u(w,null,H(r(e).nav,n=>(a(),u(w,{key:JSON.stringify(n)},["link"in n?(a(),k(Us,{key:0,item:n},null,8,["item"])):"component"in n?(a(),k(E(n.component),U({key:1,ref_for:!0},n.props,{"screen-menu":""}),null,16)):(a(),k(ta,{key:2,text:n.text||"",items:n.items},null,8,["text","items"]))],64))),128))])):h("",!0)}}),sa=m({__name:"VPNavScreenSocialLinks",setup(s){const{theme:e}=P();return(t,o)=>r(e).socialLinks?(a(),k(ke,{key:0,class:"VPNavScreenSocialLinks",links:r(e).socialLinks},null,8,["links"])):h("",!0)}}),aa={class:"list"},ra=m({__name:"VPNavScreenTranslations",setup(s){const{localeLinks:e,currentLang:t}=J({correspondingLink:!0}),o=T(!1);function n(){o.value=!o.value}return(i,l)=>r(e).length&&r(t).label?(a(),u("div",{key:0,class:M(["VPNavScreenTranslations",{open:o.value}])},[v("button",{class:"title",onClick:n},[l[0]||(l[0]=v("span",{class:"vpi-languages icon lang"},null,-1)),j(" "+N(r(t).label)+" ",1),l[1]||(l[1]=v("span",{class:"vpi-chevron-down icon chevron"},null,-1))]),v("ul",aa,[(a(!0),u(w,null,H(r(e),f=>(a(),u("li",{key:f.link,class:"item"},[_(F,{class:"link",href:f.link},{default:p(()=>[j(N(f.text),1)]),_:2},1032,["href"])]))),128))])],2)):h("",!0)}}),ia=b(ra,[["__scopeId","data-v-858fe1a4"]]),la={class:"container"},ca=m({__name:"VPNavScreen",props:{open:{type:Boolean}},setup(s){const e=T(null),t=Le(ee?document.body:null);return(o,n)=>(a(),k(ce,{name:"fade",onEnter:n[0]||(n[0]=i=>t.value=!0),onAfterLeave:n[1]||(n[1]=i=>t.value=!1)},{default:p(()=>[o.open?(a(),u("div",{key:0,class:"VPNavScreen",ref_key:"screen",ref:e,id:"VPNavScreen"},[v("div",la,[c(o.$slots,"nav-screen-content-before",{},void 0,!0),_(oa,{class:"menu"}),_(ia,{class:"translations"}),_(Ds,{class:"appearance"}),_(sa,{class:"social-links"}),c(o.$slots,"nav-screen-content-after",{},void 0,!0)])],512)):h("",!0)]),_:3}))}}),ua=b(ca,[["__scopeId","data-v-f2779853"]]),da={key:0,class:"VPNav"},va=m({__name:"VPNav",setup(s){const{isScreenOpen:e,closeScreen:t,toggleScreen:o}=ro(),{frontmatter:n}=P(),i=$(()=>n.value.navbar!==!1);return Ve("close-screen",t),Q(()=>{ee&&document.documentElement.classList.toggle("hide-nav",!i.value)}),(l,f)=>i.value?(a(),u("header",da,[_(Hs,{"is-screen-open":r(e),onToggleScreen:r(o)},{"nav-bar-title-before":p(()=>[c(l.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":p(()=>[c(l.$slots,"nav-bar-title-after",{},void 0,!0)]),"nav-bar-content-before":p(()=>[c(l.$slots,"nav-bar-content-before",{},void 0,!0)]),"nav-bar-content-after":p(()=>[c(l.$slots,"nav-bar-content-after",{},void 0,!0)]),_:3},8,["is-screen-open","onToggleScreen"]),_(ua,{open:r(e)},{"nav-screen-content-before":p(()=>[c(l.$slots,"nav-screen-content-before",{},void 0,!0)]),"nav-screen-content-after":p(()=>[c(l.$slots,"nav-screen-content-after",{},void 0,!0)]),_:3},8,["open"])])):h("",!0)}}),pa=b(va,[["__scopeId","data-v-ae24b3ad"]]),fa=["role","tabindex"],ha={key:1,class:"items"},ma=m({__name:"VPSidebarItem",props:{item:{},depth:{}},setup(s){const e=s,{collapsed:t,collapsible:o,isLink:n,isActiveLink:i,hasActiveLink:l,hasChildren:f,toggle:d}=ct($(()=>e.item)),y=$(()=>f.value?"section":"div"),L=$(()=>n.value?"a":"div"),g=$(()=>f.value?e.depth+2===7?"p":`h${e.depth+2}`:"p"),V=$(()=>n.value?void 0:"button"),I=$(()=>[[`level-${e.depth}`],{collapsible:o.value},{collapsed:t.value},{"is-link":n.value},{"is-active":i.value},{"has-active":l.value}]);function A(S){"key"in S&&S.key!=="Enter"||!e.item.link&&d()}function B(){e.item.link&&d()}return(S,C)=>{const G=W("VPSidebarItem",!0);return a(),k(E(y.value),{class:M(["VPSidebarItem",I.value])},{default:p(()=>[S.item.text?(a(),u("div",U({key:0,class:"item",role:V.value},je(S.item.items?{click:A,keydown:A}:{},!0),{tabindex:S.item.items&&0}),[C[1]||(C[1]=v("div",{class:"indicator"},null,-1)),S.item.link?(a(),k(F,{key:0,tag:L.value,class:"link",href:S.item.link,rel:S.item.rel,target:S.item.target},{default:p(()=>[(a(),k(E(g.value),{class:"text",innerHTML:S.item.text},null,8,["innerHTML"]))]),_:1},8,["tag","href","rel","target"])):(a(),k(E(g.value),{key:1,class:"text",innerHTML:S.item.text},null,8,["innerHTML"])),S.item.collapsed!=null&&S.item.items&&S.item.items.length?(a(),u("div",{key:2,class:"caret",role:"button","aria-label":"toggle section",onClick:B,onKeydown:Ue(B,["enter"]),tabindex:"0"},C[0]||(C[0]=[v("span",{class:"vpi-chevron-right caret-icon"},null,-1)]),32)):h("",!0)],16,fa)):h("",!0),S.item.items&&S.item.items.length?(a(),u("div",ha,[S.depth<5?(a(!0),u(w,{key:0},H(S.item.items,K=>(a(),k(G,{key:K.text,item:K,depth:S.depth+1},null,8,["item","depth"]))),128)):h("",!0)])):h("",!0)]),_:1},8,["class"])}}}),_a=b(ma,[["__scopeId","data-v-b7550ba0"]]),ka=m({__name:"VPSidebarGroup",props:{items:{}},setup(s){const e=T(!0);let t=null;return q(()=>{t=setTimeout(()=>{t=null,e.value=!1},300)}),ze(()=>{t!=null&&(clearTimeout(t),t=null)}),(o,n)=>(a(!0),u(w,null,H(o.items,i=>(a(),u("div",{key:i.text,class:M(["group",{"no-transition":e.value}])},[_(_a,{item:i,depth:0},null,8,["item"])],2))),128))}}),ba=b(ka,[["__scopeId","data-v-c40bc020"]]),ga={class:"nav",id:"VPSidebarNav","aria-labelledby":"sidebar-aria-label",tabindex:"-1"},$a=m({__name:"VPSidebar",props:{open:{type:Boolean}},setup(s){const{sidebarGroups:e,hasSidebar:t}=O(),o=s,n=T(null),i=Le(ee?document.body:null);D([o,n],()=>{var f;o.open?(i.value=!0,(f=n.value)==null||f.focus()):i.value=!1},{immediate:!0,flush:"post"});const l=T(0);return D(e,()=>{l.value+=1},{deep:!0}),(f,d)=>r(t)?(a(),u("aside",{key:0,class:M(["VPSidebar",{open:f.open}]),ref_key:"navEl",ref:n,onClick:d[0]||(d[0]=qe(()=>{},["stop"]))},[d[2]||(d[2]=v("div",{class:"curtain"},null,-1)),v("nav",ga,[d[1]||(d[1]=v("span",{class:"visually-hidden",id:"sidebar-aria-label"}," Sidebar Navigation ",-1)),c(f.$slots,"sidebar-nav-before",{},void 0,!0),(a(),k(ba,{items:r(e),key:l.value},null,8,["items"])),c(f.$slots,"sidebar-nav-after",{},void 0,!0)])],2)):h("",!0)}}),ya=b($a,[["__scopeId","data-v-319d5ca6"]]),Pa=m({__name:"VPSkipLink",setup(s){const e=Z(),t=T();D(()=>e.path,()=>t.value.focus());function o({target:n}){const i=document.getElementById(decodeURIComponent(n.hash).slice(1));if(i){const l=()=>{i.removeAttribute("tabindex"),i.removeEventListener("blur",l)};i.setAttribute("tabindex","-1"),i.addEventListener("blur",l),i.focus(),window.scrollTo(0,0)}}return(n,i)=>(a(),u(w,null,[v("span",{ref_key:"backToTop",ref:t,tabindex:"-1"},null,512),v("a",{href:"#VPContent",class:"VPSkipLink visually-hidden",onClick:o}," Skip to content ")],64))}}),La=b(Pa,[["__scopeId","data-v-0f60ec36"]]),Va=m({__name:"Layout",setup(s){const{isOpen:e,open:t,close:o}=O(),n=Z();D(()=>n.path,o),lt(e,o);const{frontmatter:i}=P(),l=We(),f=$(()=>!!l["home-hero-image"]);return Ve("hero-image-slot-exists",f),(d,y)=>{const L=W("Content");return r(i).layout!==!1?(a(),u("div",{key:0,class:M(["Layout",r(i).pageClass])},[c(d.$slots,"layout-top",{},void 0,!0),_(La),_(Ye,{class:"backdrop",show:r(e),onClick:r(o)},null,8,["show","onClick"]),_(pa,null,{"nav-bar-title-before":p(()=>[c(d.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":p(()=>[c(d.$slots,"nav-bar-title-after",{},void 0,!0)]),"nav-bar-content-before":p(()=>[c(d.$slots,"nav-bar-content-before",{},void 0,!0)]),"nav-bar-content-after":p(()=>[c(d.$slots,"nav-bar-content-after",{},void 0,!0)]),"nav-screen-content-before":p(()=>[c(d.$slots,"nav-screen-content-before",{},void 0,!0)]),"nav-screen-content-after":p(()=>[c(d.$slots,"nav-screen-content-after",{},void 0,!0)]),_:3}),_(ao,{open:r(e),onOpenMenu:r(t)},null,8,["open","onOpenMenu"]),_(ya,{open:r(e)},{"sidebar-nav-before":p(()=>[c(d.$slots,"sidebar-nav-before",{},void 0,!0)]),"sidebar-nav-after":p(()=>[c(d.$slots,"sidebar-nav-after",{},void 0,!0)]),_:3},8,["open"]),_(zn,null,{"page-top":p(()=>[c(d.$slots,"page-top",{},void 0,!0)]),"page-bottom":p(()=>[c(d.$slots,"page-bottom",{},void 0,!0)]),"not-found":p(()=>[c(d.$slots,"not-found",{},void 0,!0)]),"home-hero-before":p(()=>[c(d.$slots,"home-hero-before",{},void 0,!0)]),"home-hero-info-before":p(()=>[c(d.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":p(()=>[c(d.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":p(()=>[c(d.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":p(()=>[c(d.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":p(()=>[c(d.$slots,"home-hero-image",{},void 0,!0)]),"home-hero-after":p(()=>[c(d.$slots,"home-hero-after",{},void 0,!0)]),"home-features-before":p(()=>[c(d.$slots,"home-features-before",{},void 0,!0)]),"home-features-after":p(()=>[c(d.$slots,"home-features-after",{},void 0,!0)]),"doc-footer-before":p(()=>[c(d.$slots,"doc-footer-before",{},void 0,!0)]),"doc-before":p(()=>[c(d.$slots,"doc-before",{},void 0,!0)]),"doc-after":p(()=>[c(d.$slots,"doc-after",{},void 0,!0)]),"doc-top":p(()=>[c(d.$slots,"doc-top",{},void 0,!0)]),"doc-bottom":p(()=>[c(d.$slots,"doc-bottom",{},void 0,!0)]),"aside-top":p(()=>[c(d.$slots,"aside-top",{},void 0,!0)]),"aside-bottom":p(()=>[c(d.$slots,"aside-bottom",{},void 0,!0)]),"aside-outline-before":p(()=>[c(d.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":p(()=>[c(d.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":p(()=>[c(d.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":p(()=>[c(d.$slots,"aside-ads-after",{},void 0,!0)]),_:3}),_(Rn),c(d.$slots,"layout-bottom",{},void 0,!0)],2)):(a(),k(L,{key:1}))}}}),Sa=b(Va,[["__scopeId","data-v-5d98c3a5"]]),Na={Layout:Sa,enhanceApp:({app:s})=>{s.component("Badge",Ke)}};export{Na as t}; diff --git a/assets/chunks/types.C-9dMxxX.js b/assets/chunks/types.C-9dMxxX.js new file mode 100644 index 00000000..995209bd --- /dev/null +++ b/assets/chunks/types.C-9dMxxX.js @@ -0,0 +1 @@ +const s=Symbol("END"),t=Symbol("SKIP"),o=Object.entries,c=Object.assign;export{s as E,t as S,c as _,o as a}; diff --git a/assets/date.md.fBz1xHVA.js b/assets/date.md.fBz1xHVA.js new file mode 100644 index 00000000..19481e15 --- /dev/null +++ b/assets/date.md.fBz1xHVA.js @@ -0,0 +1 @@ +import{_ as e,c as a,a0 as o,o as d}from"./chunks/framework.K5DDegrV.js";const p=JSON.parse('{"title":"LocalDate, LocalTime","description":"","frontmatter":{},"headers":[],"relativePath":"date.md","filePath":"date.md"}'),i={name:"date.md"};function r(l,t,s,n,c,m){return d(),a("div",null,t[0]||(t[0]=[o('

LocalDate, LocalTime

Why?

Serves as an alternative / replacement of Moment.js / Day.js.

It tries to address the shortcomings of Day.js and time-lib.

time-lib was created as a wrapper around Day.js, due to following limitations:

  • Day.js doesn't provide all features that we need without plugins. This creates an "import problem": you cannot just import dayjs, you need to import it from a place that had plugins properly installed and initialized. It immediately creates an "import ambiguity": should I import from dayjs or from my_code/dayjs.ts?
  • Day.js is created as CommonJS module, all plugins has to be explicitly required. There are issues around TypeScript esModuleInterop. Result of it is that we needed to completely fork Day.js types and put it into time-lib.
  • There are more/deeper ESM issues when it's used in ESM context (e.g with Vite).

Next level of reasoning is that we needed our own opinionated API that would use standards that we use, for example:

  • We always use classic Unixtime (in seconds, not milliseconds)
  • We always use classic ISO8601 date without timezone, e.g 1984-06-21

Just the second/millisecond confusion can create serious bugs.

Mixup between similarly-called .toISOString and .toISODate can create very subtle bugs.

So, after multiple issues being accumulated and inability to properly fork Day.js, it was decided to try and simply rewrite Day.js functionality into LocalDate and LocalTime.

Reasons:

  • No milliseconds in the API (not needed)
  • Classic UnixTime, never "millisecond unixtime"
  • No timezone support/confusion, all dates/times are always treated as "local" (inspired by Java LocalDate/LocalDateTime)
  • Ability to parse "timezone-aware ISO8601 string", e.g 1984-06-21T17:15:02+02 into a LocalDate of just 1984-06-21 or LocalTime of 1984-06-21T17:15:02 (try achieving it with Moment.js or Day.js!)
  • .toJSON automatically formats LocalTime as unixtimestamp, LocalDate as ISO8601 date-only string
  • Prevents dayjs(undefined) being dayjs.now()
  • Strict parsing/validation by default. Will validate all input upon creation and will throw parse error on any invalid input. We believe it allows to catch errors sooner.
  • Optimized for performance and code maintenance, not on code size (as Day.js is, which results in its poorer performance in certain cases, and/or in less code maintainability)
  • No arbitrary .format by design. List of well-known format outputs instead.
  • Separate LocalDate class for simplified (and more performant) dealing with "just Dates without time information". Similar to Java's LocalDate. It allows much more simple and robust implementation, compared to dealing with js Date object intricacies (mostly around timezones).

API

API is designed to be closely (but not 100%) compatible with Day.js/Moment.js.

Examples:

day.js (via time-lib)LocalTimeLocalDate
nowdayjs()localTime.now()
todaydayjs().startOf('day')localDate.today()
create from unixtimestampdayjs.unix(ts)localTime(ts)
parse from ISO8601 date stringdayjs(str)localDate(str)
parse from ISO8601 date+time stringdayjs(str)localTime(str)
now plus 1 hourdayjs().add(1, 'hour')localTime().plus(1, 'hour')
today plus 1 daydayjs().startOf('day').add(1, 'day')localDate().plus(1, 'day')
toISODate (just date)dayjs().toISODate()localTime().toISODate()localDate().toISODate()
toISODate with timedayjs().format()localTime().toISODateTime()
diff in daysdayjs().diff(other, 'day')localTime().diff(other, 'day')localDate().diff(other, 'day')
to unixtimestampdayjs().unix()localTime().unix()localDate().unix()
isBeforedayjs().isBefore(other)localTime().isBefore(other)localDate().isBefore(other)

As you can see above - API is kept very similar.

DateInterval

Useful to describe an interval of Dates, e.g [inclusive] interval between 1984-06-21 and 1984-07-11 can be described as 1984-06-21/1984-07-11 (as per ISO8601).

.toJSON automatically stringifies DateInterval into a string.

Create DateInterval: DateInterval.parse('1984-06-21/1984-07-11') or DateInterval.of('1984-06-21', '1984-07-11').

',22)]))}const h=e(i,[["render",r]]);export{p as __pageData,h as default}; diff --git a/assets/date.md.fBz1xHVA.lean.js b/assets/date.md.fBz1xHVA.lean.js new file mode 100644 index 00000000..19481e15 --- /dev/null +++ b/assets/date.md.fBz1xHVA.lean.js @@ -0,0 +1 @@ +import{_ as e,c as a,a0 as o,o as d}from"./chunks/framework.K5DDegrV.js";const p=JSON.parse('{"title":"LocalDate, LocalTime","description":"","frontmatter":{},"headers":[],"relativePath":"date.md","filePath":"date.md"}'),i={name:"date.md"};function r(l,t,s,n,c,m){return d(),a("div",null,t[0]||(t[0]=[o('

LocalDate, LocalTime

Why?

Serves as an alternative / replacement of Moment.js / Day.js.

It tries to address the shortcomings of Day.js and time-lib.

time-lib was created as a wrapper around Day.js, due to following limitations:

  • Day.js doesn't provide all features that we need without plugins. This creates an "import problem": you cannot just import dayjs, you need to import it from a place that had plugins properly installed and initialized. It immediately creates an "import ambiguity": should I import from dayjs or from my_code/dayjs.ts?
  • Day.js is created as CommonJS module, all plugins has to be explicitly required. There are issues around TypeScript esModuleInterop. Result of it is that we needed to completely fork Day.js types and put it into time-lib.
  • There are more/deeper ESM issues when it's used in ESM context (e.g with Vite).

Next level of reasoning is that we needed our own opinionated API that would use standards that we use, for example:

  • We always use classic Unixtime (in seconds, not milliseconds)
  • We always use classic ISO8601 date without timezone, e.g 1984-06-21

Just the second/millisecond confusion can create serious bugs.

Mixup between similarly-called .toISOString and .toISODate can create very subtle bugs.

So, after multiple issues being accumulated and inability to properly fork Day.js, it was decided to try and simply rewrite Day.js functionality into LocalDate and LocalTime.

Reasons:

  • No milliseconds in the API (not needed)
  • Classic UnixTime, never "millisecond unixtime"
  • No timezone support/confusion, all dates/times are always treated as "local" (inspired by Java LocalDate/LocalDateTime)
  • Ability to parse "timezone-aware ISO8601 string", e.g 1984-06-21T17:15:02+02 into a LocalDate of just 1984-06-21 or LocalTime of 1984-06-21T17:15:02 (try achieving it with Moment.js or Day.js!)
  • .toJSON automatically formats LocalTime as unixtimestamp, LocalDate as ISO8601 date-only string
  • Prevents dayjs(undefined) being dayjs.now()
  • Strict parsing/validation by default. Will validate all input upon creation and will throw parse error on any invalid input. We believe it allows to catch errors sooner.
  • Optimized for performance and code maintenance, not on code size (as Day.js is, which results in its poorer performance in certain cases, and/or in less code maintainability)
  • No arbitrary .format by design. List of well-known format outputs instead.
  • Separate LocalDate class for simplified (and more performant) dealing with "just Dates without time information". Similar to Java's LocalDate. It allows much more simple and robust implementation, compared to dealing with js Date object intricacies (mostly around timezones).

API

API is designed to be closely (but not 100%) compatible with Day.js/Moment.js.

Examples:

day.js (via time-lib)LocalTimeLocalDate
nowdayjs()localTime.now()
todaydayjs().startOf('day')localDate.today()
create from unixtimestampdayjs.unix(ts)localTime(ts)
parse from ISO8601 date stringdayjs(str)localDate(str)
parse from ISO8601 date+time stringdayjs(str)localTime(str)
now plus 1 hourdayjs().add(1, 'hour')localTime().plus(1, 'hour')
today plus 1 daydayjs().startOf('day').add(1, 'day')localDate().plus(1, 'day')
toISODate (just date)dayjs().toISODate()localTime().toISODate()localDate().toISODate()
toISODate with timedayjs().format()localTime().toISODateTime()
diff in daysdayjs().diff(other, 'day')localTime().diff(other, 'day')localDate().diff(other, 'day')
to unixtimestampdayjs().unix()localTime().unix()localDate().unix()
isBeforedayjs().isBefore(other)localTime().isBefore(other)localDate().isBefore(other)

As you can see above - API is kept very similar.

DateInterval

Useful to describe an interval of Dates, e.g [inclusive] interval between 1984-06-21 and 1984-07-11 can be described as 1984-06-21/1984-07-11 (as per ISO8601).

.toJSON automatically stringifies DateInterval into a string.

Create DateInterval: DateInterval.parse('1984-06-21/1984-07-11') or DateInterval.of('1984-06-21', '1984-07-11').

',22)]))}const h=e(i,[["render",r]]);export{p as __pageData,h as default}; diff --git a/assets/decorators.md.BMx2znuH.js b/assets/decorators.md.BMx2znuH.js new file mode 100644 index 00000000..08d4b87a --- /dev/null +++ b/assets/decorators.md.BMx2znuH.js @@ -0,0 +1,57 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Decorators","description":"","frontmatter":{},"headers":[],"relativePath":"decorators.md","filePath":"decorators.md"}'),e={name:"decorators.md"};function h(l,s,p,k,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Decorators

@_Debounce

Wrapper around _debounce.

@_Throttle

Wrapper around _throttle.

@_LogMethod

Allows to Log every execution of the method.

Console-logs when method had started, when it finished, time taken and if error happened.

Supports both sync and async methods.

Awaits if method returns a Promise.

Example output:

>> syncMethodSuccess()
+<< syncMethodSuccess() took 124 ms
+
+>> asyncMethod()
+<< asyncMethodThrow() took 10 ms ERROR: MyError
ts
class C {
+  @_LogMethod()
+  async hello() { ... }
+}

@_Memo

Powerful Memoization decorator.

Simplest usage:

ts
class C {
+  @_Memo()
+  async init() { ... }
+}
+
+await c.init() // first time will run the initialization
+
+await c.init() // second time it'll skip it
+// Allows "max 1 execution" pattern

Memoization caches values for each unique set of input parameters. So, e.g, if you want to hit a somewhat slow/expensive endpoint, you may want to cache it in memory like this:

ts
class C {
+  @_Memo()
+  async getExchangeRates(day: string) { ... }
+}
+
+// First time will hit the endpoint
+await c.getExchangeRates('2021-06-21')
+
+// Second time will immediately return cached result, cause the input is the same
+await c.getExchangeRates('2021-06-21')
+
+// Input has changed, so it's a cache-miss, will hit the endpoint
+await c.getExchangeRates('2021-06-22')

Pay attention that the cache of the returned values is kept forever, so, be mindful of possible memory leaks.

nodejs-lib (link pending) has a LRUMemoCache class that impements LRU cache. Example:

ts
@_Memo({ cacheFactory: () => new LRUMemoCache({...}) })
+async someMethod() {}

@_Retry

Wrapper around pRetry.

@_Timeout

Decoratod method will throw TimeoutError if it hasn't finished in given time.

Wrapper around pTimeout.

ts
class C {
+  @_Timeout({ timeout: 1000 })
+  async hello() {
+    // some logic
+  }
+}
+
+const c = new C()
+await c.hello()
+// will throw if not finished in 1000 ms

@_TryCatch

Wraps the method into a try/catch block, console.error(err) on error, but never re-throws (always suppresses the error).

ts
class C {
+  @_TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Wrapper around _tryCatch function.

_createPromiseDecorator

Powerful helper to create your own Decorators around async (Promise-returning) methods.

Example of a @TryCatch decorator that will wrap a method with "try/catch", console.error the error and suppress it (by returning undefined in case of any error).

Example usage:

ts
class C {
+  @TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Example implementation of such a decorator using _createPromiseDecorator:

ts
export const TryCatch = () =>
+  _createPromiseDecorator({
+    decoratorName: 'TryCatch',
+    catchFn: ({ err, target, key }) => {
+      console.error(err)
+      return undefined
+    },
+  })

_createPromiseDecorator allows you to define your "hooks" on different stages of a Promise:

  • beforeFn: before the method execution
  • thenFn: after successful method execution
  • catchFn: after method throws (returns rejected Promise)
  • finallyFn: after method returns resolved or rejected Promise (useful to e.g "hide the blocking loader")

Example of a @BlockingLoader decorator, that wraps the method, shows the BlockingLoader before the method execution and hides it in the end of the execution (regardless if it errored or succeeded):

ts
export const BlockingLoader = () =>
+  _createPromiseDecorator({
+    decoratorName: 'BlockingLoader',
+    beforeFn: () => store.commit('setBlockingLoader'),
+    catchFn: ({ err }) => errorDialog(err),
+    finallyFn: () => store.commit('setBlockingLoader', false),
+  })
`,43)]))}const c=i(e,[["render",h]]);export{E as __pageData,c as default}; diff --git a/assets/decorators.md.BMx2znuH.lean.js b/assets/decorators.md.BMx2znuH.lean.js new file mode 100644 index 00000000..08d4b87a --- /dev/null +++ b/assets/decorators.md.BMx2znuH.lean.js @@ -0,0 +1,57 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Decorators","description":"","frontmatter":{},"headers":[],"relativePath":"decorators.md","filePath":"decorators.md"}'),e={name:"decorators.md"};function h(l,s,p,k,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Decorators

@_Debounce

Wrapper around _debounce.

@_Throttle

Wrapper around _throttle.

@_LogMethod

Allows to Log every execution of the method.

Console-logs when method had started, when it finished, time taken and if error happened.

Supports both sync and async methods.

Awaits if method returns a Promise.

Example output:

>> syncMethodSuccess()
+<< syncMethodSuccess() took 124 ms
+
+>> asyncMethod()
+<< asyncMethodThrow() took 10 ms ERROR: MyError
ts
class C {
+  @_LogMethod()
+  async hello() { ... }
+}

@_Memo

Powerful Memoization decorator.

Simplest usage:

ts
class C {
+  @_Memo()
+  async init() { ... }
+}
+
+await c.init() // first time will run the initialization
+
+await c.init() // second time it'll skip it
+// Allows "max 1 execution" pattern

Memoization caches values for each unique set of input parameters. So, e.g, if you want to hit a somewhat slow/expensive endpoint, you may want to cache it in memory like this:

ts
class C {
+  @_Memo()
+  async getExchangeRates(day: string) { ... }
+}
+
+// First time will hit the endpoint
+await c.getExchangeRates('2021-06-21')
+
+// Second time will immediately return cached result, cause the input is the same
+await c.getExchangeRates('2021-06-21')
+
+// Input has changed, so it's a cache-miss, will hit the endpoint
+await c.getExchangeRates('2021-06-22')

Pay attention that the cache of the returned values is kept forever, so, be mindful of possible memory leaks.

nodejs-lib (link pending) has a LRUMemoCache class that impements LRU cache. Example:

ts
@_Memo({ cacheFactory: () => new LRUMemoCache({...}) })
+async someMethod() {}

@_Retry

Wrapper around pRetry.

@_Timeout

Decoratod method will throw TimeoutError if it hasn't finished in given time.

Wrapper around pTimeout.

ts
class C {
+  @_Timeout({ timeout: 1000 })
+  async hello() {
+    // some logic
+  }
+}
+
+const c = new C()
+await c.hello()
+// will throw if not finished in 1000 ms

@_TryCatch

Wraps the method into a try/catch block, console.error(err) on error, but never re-throws (always suppresses the error).

ts
class C {
+  @_TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Wrapper around _tryCatch function.

_createPromiseDecorator

Powerful helper to create your own Decorators around async (Promise-returning) methods.

Example of a @TryCatch decorator that will wrap a method with "try/catch", console.error the error and suppress it (by returning undefined in case of any error).

Example usage:

ts
class C {
+  @TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Example implementation of such a decorator using _createPromiseDecorator:

ts
export const TryCatch = () =>
+  _createPromiseDecorator({
+    decoratorName: 'TryCatch',
+    catchFn: ({ err, target, key }) => {
+      console.error(err)
+      return undefined
+    },
+  })

_createPromiseDecorator allows you to define your "hooks" on different stages of a Promise:

  • beforeFn: before the method execution
  • thenFn: after successful method execution
  • catchFn: after method throws (returns rejected Promise)
  • finallyFn: after method returns resolved or rejected Promise (useful to e.g "hide the blocking loader")

Example of a @BlockingLoader decorator, that wraps the method, shows the BlockingLoader before the method execution and hides it in the end of the execution (regardless if it errored or succeeded):

ts
export const BlockingLoader = () =>
+  _createPromiseDecorator({
+    decoratorName: 'BlockingLoader',
+    beforeFn: () => store.commit('setBlockingLoader'),
+    catchFn: ({ err }) => errorDialog(err),
+    finallyFn: () => store.commit('setBlockingLoader', false),
+  })
`,43)]))}const c=i(e,[["render",h]]);export{E as __pageData,c as default}; diff --git a/assets/error.md.B7d3forK.js b/assets/error.md.B7d3forK.js new file mode 100644 index 00000000..dc86782e --- /dev/null +++ b/assets/error.md.B7d3forK.js @@ -0,0 +1,28 @@ +import{_ as a,c as i,a0 as e,o as t}from"./chunks/framework.K5DDegrV.js";const c=JSON.parse('{"title":"Error","description":"","frontmatter":{},"headers":[],"relativePath":"error.md","filePath":"error.md"}'),r={name:"error.md"};function n(h,s,o,p,l,d){return t(),i("div",null,s[0]||(s[0]=[e(`

Error

_tryCatch

Wraps/decorates a passed function with "try/catch", so it never throws, but logs the error (if occured).

ts
const someDangerousFunction = () => { ... }
+
+const fn = _tryCatch(someDangerousFunction)
+
+fn()
+// will log on error, but never throw

Allows to pass onError() function hook, that will be called on error.

ErrorObject

Standartized "Error object" that contains arbitrary data object that can hold additional data.

This data object is defined as a Generic type to ErrorObject, so, e.g. HttpError has HttpErrorData, which has a mandatory httpStatusCode: number property.

Usage example of that:

ts
.catch((err: HttpErrorObject) => {
+  console.log(err.data.httpStatusCode)
+})

AppError

The most basic implementation of an Error that complies with ErrorObject specification. Difference is that ErrorObject is purely a TypeScript interface (around any JS object), but AppError is a sub-class of Error. So, with AppError you can do if (err instanceof AppError) ....

Because AppError implements ErrorObject, it guarantees an err.data object.

This basic contract allows to establish a standartized interface between the Frontend (in frontend-lib) and Backend (in backend-lib) and implement error-handling more efficiently.

HttpError

Subclass of AppError that has some additional properties inside data, namely: httpStatusCode: number.

HttpErrorResponse

This is a standartized "Error response from the Backend" (as implemented in backend-lib). You can check/assert it with _isHttpErrorResponse, and then have all the guarantees and types about the containing error object.

Handling these type of errors is done "automatically" in getKy of the frontend-lib, and in getGot of the backend-lib.

_anyToError

Cast any to Error.

_errorToErrorObject

Cast Error to ErrorObject.

_isHttpErrorResponse

Assert if provided value: any is a HttpErrorResponse.

_isHttpErrorObject

Assert if provided value: any is a HttpErrorObject (an HttpError, same as AppError<HttpErrorData>).

_isErrorObject

Assert if provided value: any is an ErrorObject.

_assert

Asserts that a boolean condition is truthy, otherwise throws an Error.

Evaluates the condition (casts it to Boolean). Expects it to be truthy, otherwise throws AppError.

Should be used NOT for "expected" / user-facing errors, but vice-versa - for completely unexpected and 100% buggy "should never happen" cases.

It'll result in http 500 on the server (cause that's the right code for "unexpected" errors). Pass { httpStatusCode: x } at errorData argument to override the http code (will be picked up by backend-lib).

API is similar to Node's assert(), except:

  1. Throws js-lib's AppError
  2. Has a default message, if not provided

Since 2024-07-10 it no longer sets userFriendly: true by default.

ts
function run(err: any) {
+  _assert(err instanceof AppError)
+  // from here TypeScript will know that \`err instanceof AppError === true\`, or \`err: AppError\`
+
+  // Example with custom error message:
+  _assert(err instanceof AppError, 'error should be of type AppError')
+}

_assertEquals

Similar to _assert, but allows to provide 2 values (first 2 arguments) and throws if they are NOT equal.

Does a shallow equality check (!==), use _assertDeepEquals if you need a deep-check.

_assertDeepEquals

Similar to _assertEquals, but does a deep assertion (using _deepEquals).

_assertIsError

Asserts that passed value is instanceof Error.

_assertsIsTypeOf

Asserts that typeof value matches expected type.

_assertsIsString

Asserts that typeof value === 'string

_assertsIsNumber

Asserts that typeof value === 'number

_try

Calls a function, returns a Tuple of [error, value]. Allows to write shorter code that avoids try/catch. Useful e.g. in unit tests.

Similar to pTry, but for sync functions.

ts
const [err, v] = _try(() => someFunction())

pTry

Loosely inspired by await-to-js.

Similar to _try, but for promises.

Async/await wrapper for easy error handling. Wraps async/await calls in try catch blocks and returns a tuple containing the error or the results of the promise

ts
interface ServerResponse {
+  test: number
+}
+
+interface CustomError {
+  code: number
+  data: {
+    title: string
+    body: string
+  }
+}
+
+const p = Promise.resolve({ test: 123 })
+
+const [err, result] = await pTuple<ServerResponse, CustomError>(p)
`,60)]))}const E=a(r,[["render",n]]);export{c as __pageData,E as default}; diff --git a/assets/error.md.B7d3forK.lean.js b/assets/error.md.B7d3forK.lean.js new file mode 100644 index 00000000..dc86782e --- /dev/null +++ b/assets/error.md.B7d3forK.lean.js @@ -0,0 +1,28 @@ +import{_ as a,c as i,a0 as e,o as t}from"./chunks/framework.K5DDegrV.js";const c=JSON.parse('{"title":"Error","description":"","frontmatter":{},"headers":[],"relativePath":"error.md","filePath":"error.md"}'),r={name:"error.md"};function n(h,s,o,p,l,d){return t(),i("div",null,s[0]||(s[0]=[e(`

Error

_tryCatch

Wraps/decorates a passed function with "try/catch", so it never throws, but logs the error (if occured).

ts
const someDangerousFunction = () => { ... }
+
+const fn = _tryCatch(someDangerousFunction)
+
+fn()
+// will log on error, but never throw

Allows to pass onError() function hook, that will be called on error.

ErrorObject

Standartized "Error object" that contains arbitrary data object that can hold additional data.

This data object is defined as a Generic type to ErrorObject, so, e.g. HttpError has HttpErrorData, which has a mandatory httpStatusCode: number property.

Usage example of that:

ts
.catch((err: HttpErrorObject) => {
+  console.log(err.data.httpStatusCode)
+})

AppError

The most basic implementation of an Error that complies with ErrorObject specification. Difference is that ErrorObject is purely a TypeScript interface (around any JS object), but AppError is a sub-class of Error. So, with AppError you can do if (err instanceof AppError) ....

Because AppError implements ErrorObject, it guarantees an err.data object.

This basic contract allows to establish a standartized interface between the Frontend (in frontend-lib) and Backend (in backend-lib) and implement error-handling more efficiently.

HttpError

Subclass of AppError that has some additional properties inside data, namely: httpStatusCode: number.

HttpErrorResponse

This is a standartized "Error response from the Backend" (as implemented in backend-lib). You can check/assert it with _isHttpErrorResponse, and then have all the guarantees and types about the containing error object.

Handling these type of errors is done "automatically" in getKy of the frontend-lib, and in getGot of the backend-lib.

_anyToError

Cast any to Error.

_errorToErrorObject

Cast Error to ErrorObject.

_isHttpErrorResponse

Assert if provided value: any is a HttpErrorResponse.

_isHttpErrorObject

Assert if provided value: any is a HttpErrorObject (an HttpError, same as AppError<HttpErrorData>).

_isErrorObject

Assert if provided value: any is an ErrorObject.

_assert

Asserts that a boolean condition is truthy, otherwise throws an Error.

Evaluates the condition (casts it to Boolean). Expects it to be truthy, otherwise throws AppError.

Should be used NOT for "expected" / user-facing errors, but vice-versa - for completely unexpected and 100% buggy "should never happen" cases.

It'll result in http 500 on the server (cause that's the right code for "unexpected" errors). Pass { httpStatusCode: x } at errorData argument to override the http code (will be picked up by backend-lib).

API is similar to Node's assert(), except:

  1. Throws js-lib's AppError
  2. Has a default message, if not provided

Since 2024-07-10 it no longer sets userFriendly: true by default.

ts
function run(err: any) {
+  _assert(err instanceof AppError)
+  // from here TypeScript will know that \`err instanceof AppError === true\`, or \`err: AppError\`
+
+  // Example with custom error message:
+  _assert(err instanceof AppError, 'error should be of type AppError')
+}

_assertEquals

Similar to _assert, but allows to provide 2 values (first 2 arguments) and throws if they are NOT equal.

Does a shallow equality check (!==), use _assertDeepEquals if you need a deep-check.

_assertDeepEquals

Similar to _assertEquals, but does a deep assertion (using _deepEquals).

_assertIsError

Asserts that passed value is instanceof Error.

_assertsIsTypeOf

Asserts that typeof value matches expected type.

_assertsIsString

Asserts that typeof value === 'string

_assertsIsNumber

Asserts that typeof value === 'number

_try

Calls a function, returns a Tuple of [error, value]. Allows to write shorter code that avoids try/catch. Useful e.g. in unit tests.

Similar to pTry, but for sync functions.

ts
const [err, v] = _try(() => someFunction())

pTry

Loosely inspired by await-to-js.

Similar to _try, but for promises.

Async/await wrapper for easy error handling. Wraps async/await calls in try catch blocks and returns a tuple containing the error or the results of the promise

ts
interface ServerResponse {
+  test: number
+}
+
+interface CustomError {
+  code: number
+  data: {
+    title: string
+    body: string
+  }
+}
+
+const p = Promise.resolve({ test: 123 })
+
+const [err, result] = await pTuple<ServerResponse, CustomError>(p)
`,60)]))}const E=a(r,[["render",n]]);export{c as __pageData,E as default}; diff --git a/assets/fetcher.md.Bbx1Y_i0.js b/assets/fetcher.md.Bbx1Y_i0.js new file mode 100644 index 00000000..a08556af --- /dev/null +++ b/assets/fetcher.md.Bbx1Y_i0.js @@ -0,0 +1,25 @@ +import{_ as i,c as a,a0 as e,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Fetcher","description":"","frontmatter":{},"headers":[],"relativePath":"fetcher.md","filePath":"fetcher.md"}'),n={name:"fetcher.md"};function l(h,s,r,p,k,o){return t(),a("div",null,s[0]||(s[0]=[e(`

Fetcher

Convenient wrapper around fetch.

Features

  • Works in the Browser and on the Server (Node.js)
  • Convenient API, e.g fetcher.get(), fetcher.post(), etc.
  • Throws HttpError automatically, no need to check if (res.ok)
  • Allows to set timeout
  • Conveniently retries on retry-able errors
  • Allows to conveniently log requests/responses, configurable
  • Allows to convert searchParams object into a query string
  • Allows to define beforeRequest/beforeRetry/afterResponse hooks

Comparison

Fetcher:

tsx
const fetcher = getFetcher()
+
+const result = await fetcher.post('https://example.com', {
+  json: { foo: true },
+})

Ky:

tsx
const result = await ky
+  .post('https://example.com/hello', {
+    json: { foo: true },
+  })
+  .json()

Plain fetch:

tsx
class HTTPError extends Error {}
+
+const response = await fetch('https://example.com', {
+  method: 'POST',
+  body: JSON.stringify({ foo: true }),
+  headers: {
+    'content-type': 'application/json',
+  },
+})
+
+if (!response.ok) {
+  throw new HTTPError(\`Fetch error: \${response.statusText}\`)
+}
+
+const json = await response.json()
+
+console.log(json)

Prior art

Heavily inspired by:

Why

Differences from prior projects:

  • Targets both Browser and Node by design, targeting Node with native fetch support. This is similar to ky plus ky-universal.
  • Incorporates everything from getKy and getGot, so you don’t need multiple layers. For example, with ky you would need: ky, ky-for-people, getKy (frontend-lib). With fetcher you need only fetcher (part of js-lib).

Goals

  • Simplicity. It focuses on the most simple and common use cases, and not on the most advanced or edge cases.
  • Assume native fetch support (Browser and Node), no polyfills. Should work equally well in Browser and Node, ideally without platform-specific quirks.
  • Written in TypeScript, with first-class TypeScript support.
`,19)]))}const c=i(n,[["render",l]]);export{E as __pageData,c as default}; diff --git a/assets/fetcher.md.Bbx1Y_i0.lean.js b/assets/fetcher.md.Bbx1Y_i0.lean.js new file mode 100644 index 00000000..a08556af --- /dev/null +++ b/assets/fetcher.md.Bbx1Y_i0.lean.js @@ -0,0 +1,25 @@ +import{_ as i,c as a,a0 as e,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Fetcher","description":"","frontmatter":{},"headers":[],"relativePath":"fetcher.md","filePath":"fetcher.md"}'),n={name:"fetcher.md"};function l(h,s,r,p,k,o){return t(),a("div",null,s[0]||(s[0]=[e(`

Fetcher

Convenient wrapper around fetch.

Features

  • Works in the Browser and on the Server (Node.js)
  • Convenient API, e.g fetcher.get(), fetcher.post(), etc.
  • Throws HttpError automatically, no need to check if (res.ok)
  • Allows to set timeout
  • Conveniently retries on retry-able errors
  • Allows to conveniently log requests/responses, configurable
  • Allows to convert searchParams object into a query string
  • Allows to define beforeRequest/beforeRetry/afterResponse hooks

Comparison

Fetcher:

tsx
const fetcher = getFetcher()
+
+const result = await fetcher.post('https://example.com', {
+  json: { foo: true },
+})

Ky:

tsx
const result = await ky
+  .post('https://example.com/hello', {
+    json: { foo: true },
+  })
+  .json()

Plain fetch:

tsx
class HTTPError extends Error {}
+
+const response = await fetch('https://example.com', {
+  method: 'POST',
+  body: JSON.stringify({ foo: true }),
+  headers: {
+    'content-type': 'application/json',
+  },
+})
+
+if (!response.ok) {
+  throw new HTTPError(\`Fetch error: \${response.statusText}\`)
+}
+
+const json = await response.json()
+
+console.log(json)

Prior art

Heavily inspired by:

Why

Differences from prior projects:

  • Targets both Browser and Node by design, targeting Node with native fetch support. This is similar to ky plus ky-universal.
  • Incorporates everything from getKy and getGot, so you don’t need multiple layers. For example, with ky you would need: ky, ky-for-people, getKy (frontend-lib). With fetcher you need only fetcher (part of js-lib).

Goals

  • Simplicity. It focuses on the most simple and common use cases, and not on the most advanced or edge cases.
  • Assume native fetch support (Browser and Node), no polyfills. Should work equally well in Browser and Node, ideally without platform-specific quirks.
  • Written in TypeScript, with first-class TypeScript support.
`,19)]))}const c=i(n,[["render",l]]);export{E as __pageData,c as default}; diff --git a/assets/httpRequestError.md.Bg54xUI0.js b/assets/httpRequestError.md.Bg54xUI0.js new file mode 100644 index 00000000..deff1285 --- /dev/null +++ b/assets/httpRequestError.md.Bg54xUI0.js @@ -0,0 +1,22 @@ +import{_ as a,c as n,a0 as e,o as p}from"./chunks/framework.K5DDegrV.js";const u=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"httpRequestError.md","filePath":"httpRequestError.md"}'),t={name:"httpRequestError.md"};function r(o,s,l,i,c,h){return p(),n("div",null,s[0]||(s[0]=[e(`
Backend makes a Fetch call to some API
+API returns error1 with 500 and a message1
+Fetcher wraps error1 with error2 which is a FetcherError
+method
+url
+baseUrl?
+statusCode
+millis
+message: 500 GET /someUrl
+causedBy error1
+
+genericErrorHandler needs to return error2
+it wraps error2 (FetchError) with error3: HttpError
+Maybe there's just no need to do that wrapping?! Return ErrorObject as is
+Requester (Fetcher) would always know httpStatusCode of the error they just received
+
+Why is HttpError needed?
+For the Backend to set the right httpStatusCode
+Maybe it's enough to just have it as AppError with httpStatusCode?
+
+Rename HttpError to HttpRequestError, which is the same as FetchError
+HttpErrorResponse becomes BackendErrorResponseObject (detected by name and message)
`,1)]))}const m=a(t,[["render",r]]);export{u as __pageData,m as default}; diff --git a/assets/httpRequestError.md.Bg54xUI0.lean.js b/assets/httpRequestError.md.Bg54xUI0.lean.js new file mode 100644 index 00000000..deff1285 --- /dev/null +++ b/assets/httpRequestError.md.Bg54xUI0.lean.js @@ -0,0 +1,22 @@ +import{_ as a,c as n,a0 as e,o as p}from"./chunks/framework.K5DDegrV.js";const u=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"httpRequestError.md","filePath":"httpRequestError.md"}'),t={name:"httpRequestError.md"};function r(o,s,l,i,c,h){return p(),n("div",null,s[0]||(s[0]=[e(`
Backend makes a Fetch call to some API
+API returns error1 with 500 and a message1
+Fetcher wraps error1 with error2 which is a FetcherError
+method
+url
+baseUrl?
+statusCode
+millis
+message: 500 GET /someUrl
+causedBy error1
+
+genericErrorHandler needs to return error2
+it wraps error2 (FetchError) with error3: HttpError
+Maybe there's just no need to do that wrapping?! Return ErrorObject as is
+Requester (Fetcher) would always know httpStatusCode of the error they just received
+
+Why is HttpError needed?
+For the Backend to set the right httpStatusCode
+Maybe it's enough to just have it as AppError with httpStatusCode?
+
+Rename HttpError to HttpRequestError, which is the same as FetchError
+HttpErrorResponse becomes BackendErrorResponseObject (detected by name and message)
`,1)]))}const m=a(t,[["render",r]]);export{u as __pageData,m as default}; diff --git a/assets/image.md.DuaiQJHx.js b/assets/image.md.DuaiQJHx.js new file mode 100644 index 00000000..6f6cb3e6 --- /dev/null +++ b/assets/image.md.DuaiQJHx.js @@ -0,0 +1 @@ +import{d as k,p as d,v as H,x as B,q as E,o as g,c as h,j as n,t as f,a1 as v,a2 as w,e as C,F as O,C as Y,N as x,a as p,G as b,B as z}from"./chunks/framework.K5DDegrV.js";import{_ as M}from"./chunks/object.util.ThuQ4YBC.js";import"./chunks/is.util.BDVbkSgX.js";import"./chunks/types.C-9dMxxX.js";class S{constructor(a){this.containerWidth=-1,this.cfg={maxHeight:300,margin:8,...a},this.resizeObserver=new ResizeObserver(e=>this.update(e)),this.resizeObserver.observe(a.containerElement)}stop(){this.resizeObserver.disconnect()}update(a){const e=Math.floor(a[0].contentRect.width);e!==this.containerWidth&&(this.containerWidth=e,console.log(`resize ${e}`),this.doLayout(this.cfg.images),this.cfg.onChange(this.cfg.images))}doLayout(a){if(a.length===0)return;const{maxHeight:e}=this.cfg;let t=a.slice(0);e:for(;t.length>0;){let s,r;for(let m=1;m<=t.length;m++)if(s=t.slice(0,m),r=this.getHeigth(s),rt+=s.aspectRatio),e/t}setHeight(a,e){a.forEach(t=>{t.fitWidth=Math.floor(e*t.aspectRatio),t.fitHeight=Math.floor(e)})}}const W={class:"app-content"},D={class:"label"},P={class:"label"},Q={key:0},V=["src"],$=k({__name:"FitImagesDemo",setup(c){const a=["a8ZYS21_Toc","rpxnS9CtEDw","Ck-qAr0qbAI","h5UOgcq1Dkw","Jwhzumwgq9Q","2aLB0aQI5v4","0Q_XPEm2oVQ","bz0H2d753_U","oSIl84tpYYY","cX0Yxw38cx8","Y6Oi_1aGKPg","AqGhEk1khbE","XDvvt_IEH_w","leSvrOiu-nE","lkeBDBTwjWQ","6tJ50mdoyY4","wqJW5B9Q05I","Q2xGYGSu0Qo","Ai-AnKx5bSM","O4TA_kXW9as","aV31XuctrM8","zwoYd0ZiBmc","vMGM9Y48eIY"],e=d(300),t=d(8),s=d([]),r=d();H(async()=>{const l={};await new Promise(i=>{a.forEach(o=>{const u=new Image;u.onload=()=>{const{width:y,height:_,src:I}=u;l[o]={src:I,aspectRatio:y/_},Object.keys(l).length===a.length&&i()},u.src=`https://source.unsplash.com/${o}`})}),s.value=a.map(i=>l[i]),m()}),B(()=>{var l;(l=r.value)==null||l.stop()}),E(()=>t.value+e.value,m);function m(){var i;const l=document.getElementById("imagesContainer");(i=r.value)==null||i.stop(),r.value=new S({containerElement:l,images:s.value,maxHeight:e.value,margin:t.value,onChange:o=>{s.value=M(o)}})}return(l,i)=>(g(),h("div",W,[n("p",null,[n("span",D,"maxHeight: "+f(e.value),1),v(n("input",{type:"range",min:"10",max:"400",step:"10","onUpdate:modelValue":i[0]||(i[0]=o=>e.value=o)},null,512),[[w,e.value]]),i[2]||(i[2]=n("br",null,null,-1)),n("span",P,"margin: "+f(t.value),1),v(n("input",{type:"range",min:"0",max:"20","onUpdate:modelValue":i[1]||(i[1]=o=>t.value=o)},null,512),[[w,t.value]]),i[3]||(i[3]=n("br",null,null,-1))]),s.value.length?C("",!0):(g(),h("p",Q,"Loading images...")),n("div",{id:"imagesContainer",style:x({margin:`-${t.value/2}px`})},[(g(!0),h(O,null,Y(s.value,o=>(g(),h("img",{style:x({width:`${o.fitWidth}px`,height:`${o.fitHeight}px`,margin:`${t.value/2}px`}),src:o.src,alt:"img"},null,12,V))),256))],4)]))}}),q={id:"image",tabindex:"-1"},F=JSON.parse('{"title":"Image","description":"","frontmatter":{},"headers":[],"relativePath":"image.md","filePath":"image.md"}'),G={name:"image.md"},R=Object.assign(G,{setup(c){return(a,e)=>{const t=z("Badge");return g(),h("div",null,[n("h1",q,[e[0]||(e[0]=p("Image ")),b(t,{text:"experimental",type:"warning"}),e[1]||(e[1]=p()),e[2]||(e[2]=n("a",{class:"header-anchor",href:"#image","aria-label":'Permalink to "Image "'},"​",-1))]),e[3]||(e[3]=n("h2",{id:"fitimages",tabindex:"-1"},[p("fitImages "),n("a",{class:"header-anchor",href:"#fitimages","aria-label":'Permalink to "fitImages"'},"​")],-1)),e[4]||(e[4]=n("p",null,"Function to Layout images in a way that they fit the available space. Like Google Photos do.",-1)),e[5]||(e[5]=n("p",null,'It can probably be called "fixed height layout".',-1)),e[6]||(e[6]=n("p",null,"See the demos below. Try resizing the browser window or sliders to see the effect of it.",-1)),b($)])}}});export{F as __pageData,R as default}; diff --git a/assets/image.md.DuaiQJHx.lean.js b/assets/image.md.DuaiQJHx.lean.js new file mode 100644 index 00000000..6f6cb3e6 --- /dev/null +++ b/assets/image.md.DuaiQJHx.lean.js @@ -0,0 +1 @@ +import{d as k,p as d,v as H,x as B,q as E,o as g,c as h,j as n,t as f,a1 as v,a2 as w,e as C,F as O,C as Y,N as x,a as p,G as b,B as z}from"./chunks/framework.K5DDegrV.js";import{_ as M}from"./chunks/object.util.ThuQ4YBC.js";import"./chunks/is.util.BDVbkSgX.js";import"./chunks/types.C-9dMxxX.js";class S{constructor(a){this.containerWidth=-1,this.cfg={maxHeight:300,margin:8,...a},this.resizeObserver=new ResizeObserver(e=>this.update(e)),this.resizeObserver.observe(a.containerElement)}stop(){this.resizeObserver.disconnect()}update(a){const e=Math.floor(a[0].contentRect.width);e!==this.containerWidth&&(this.containerWidth=e,console.log(`resize ${e}`),this.doLayout(this.cfg.images),this.cfg.onChange(this.cfg.images))}doLayout(a){if(a.length===0)return;const{maxHeight:e}=this.cfg;let t=a.slice(0);e:for(;t.length>0;){let s,r;for(let m=1;m<=t.length;m++)if(s=t.slice(0,m),r=this.getHeigth(s),rt+=s.aspectRatio),e/t}setHeight(a,e){a.forEach(t=>{t.fitWidth=Math.floor(e*t.aspectRatio),t.fitHeight=Math.floor(e)})}}const W={class:"app-content"},D={class:"label"},P={class:"label"},Q={key:0},V=["src"],$=k({__name:"FitImagesDemo",setup(c){const a=["a8ZYS21_Toc","rpxnS9CtEDw","Ck-qAr0qbAI","h5UOgcq1Dkw","Jwhzumwgq9Q","2aLB0aQI5v4","0Q_XPEm2oVQ","bz0H2d753_U","oSIl84tpYYY","cX0Yxw38cx8","Y6Oi_1aGKPg","AqGhEk1khbE","XDvvt_IEH_w","leSvrOiu-nE","lkeBDBTwjWQ","6tJ50mdoyY4","wqJW5B9Q05I","Q2xGYGSu0Qo","Ai-AnKx5bSM","O4TA_kXW9as","aV31XuctrM8","zwoYd0ZiBmc","vMGM9Y48eIY"],e=d(300),t=d(8),s=d([]),r=d();H(async()=>{const l={};await new Promise(i=>{a.forEach(o=>{const u=new Image;u.onload=()=>{const{width:y,height:_,src:I}=u;l[o]={src:I,aspectRatio:y/_},Object.keys(l).length===a.length&&i()},u.src=`https://source.unsplash.com/${o}`})}),s.value=a.map(i=>l[i]),m()}),B(()=>{var l;(l=r.value)==null||l.stop()}),E(()=>t.value+e.value,m);function m(){var i;const l=document.getElementById("imagesContainer");(i=r.value)==null||i.stop(),r.value=new S({containerElement:l,images:s.value,maxHeight:e.value,margin:t.value,onChange:o=>{s.value=M(o)}})}return(l,i)=>(g(),h("div",W,[n("p",null,[n("span",D,"maxHeight: "+f(e.value),1),v(n("input",{type:"range",min:"10",max:"400",step:"10","onUpdate:modelValue":i[0]||(i[0]=o=>e.value=o)},null,512),[[w,e.value]]),i[2]||(i[2]=n("br",null,null,-1)),n("span",P,"margin: "+f(t.value),1),v(n("input",{type:"range",min:"0",max:"20","onUpdate:modelValue":i[1]||(i[1]=o=>t.value=o)},null,512),[[w,t.value]]),i[3]||(i[3]=n("br",null,null,-1))]),s.value.length?C("",!0):(g(),h("p",Q,"Loading images...")),n("div",{id:"imagesContainer",style:x({margin:`-${t.value/2}px`})},[(g(!0),h(O,null,Y(s.value,o=>(g(),h("img",{style:x({width:`${o.fitWidth}px`,height:`${o.fitHeight}px`,margin:`${t.value/2}px`}),src:o.src,alt:"img"},null,12,V))),256))],4)]))}}),q={id:"image",tabindex:"-1"},F=JSON.parse('{"title":"Image","description":"","frontmatter":{},"headers":[],"relativePath":"image.md","filePath":"image.md"}'),G={name:"image.md"},R=Object.assign(G,{setup(c){return(a,e)=>{const t=z("Badge");return g(),h("div",null,[n("h1",q,[e[0]||(e[0]=p("Image ")),b(t,{text:"experimental",type:"warning"}),e[1]||(e[1]=p()),e[2]||(e[2]=n("a",{class:"header-anchor",href:"#image","aria-label":'Permalink to "Image "'},"​",-1))]),e[3]||(e[3]=n("h2",{id:"fitimages",tabindex:"-1"},[p("fitImages "),n("a",{class:"header-anchor",href:"#fitimages","aria-label":'Permalink to "fitImages"'},"​")],-1)),e[4]||(e[4]=n("p",null,"Function to Layout images in a way that they fit the available space. Like Google Photos do.",-1)),e[5]||(e[5]=n("p",null,'It can probably be called "fixed height layout".',-1)),e[6]||(e[6]=n("p",null,"See the demos below. Try resizing the browser window or sliders to see the effect of it.",-1)),b($)])}}});export{F as __pageData,R as default}; diff --git a/assets/index.md.DzR66xOe.js b/assets/index.md.DzR66xOe.js new file mode 100644 index 00000000..946281aa --- /dev/null +++ b/assets/index.md.DzR66xOe.js @@ -0,0 +1,9 @@ +import{_ as s,c as a,a0 as t,o as i}from"./chunks/framework.K5DDegrV.js";const u=JSON.parse('{"title":"js-lib","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),n={name:"index.md"};function o(l,e,r,p,d,c){return i(),a("div",null,e[0]||(e[0]=[t(`

js-lib

Standard library for universal (browser + Node.js) javascript

npmmin.gz sizeActionsloc

MaintainabilityTest Coveragecode style: prettier

Design

Inspired by Lodash, bluebird, promise-fun and other useful small packages.

Designed to play well with the rest of opinionated "Natural Cycles JS Platform" (link pending). This package is the lowest-level production dependency (not devDependency) of the Platform. Almost everything else depends on it.

All functions in this package are exported in index.ts (flat), no namespacing is used. So, to avoid conflicts and "global import namespace" pollution , all functions are prefixed with an underscore (e.g _.pick becomes _pick), with some exceptions (later). Promise functions are prefixed with p, e.g pMap.

Decorators are _prefixed and PascalCased (e.g @_Debounce). _is to be consistent with other naming in this package. PascalCase is to distinguish decorators from similar functions that are not decorators. Example:\\_debounceis a function (lodash-based),\\_Debounceis a decorator (used as@\\_Debounce). PascalCase convention follows Angular/Ionic convention (but doesn't follow TypeScript documentation convention; we had to pick one).

Interfaces and Classes are named as usual (no prefix, PascalCase, e.g AppError).

Q: Why not just use lodash?

A:

  • We believe Lodash is outdated (many functions are pre-ES6 / obsolete by ES6).
  • Because it has so many outdated functions - its size is bigger, and solutions to tree-shake exist, but complicated.
  • First-class TypeScript support (all code in this repo is TypeScript).

This package is intended to be 0-dependency (exception: tslib from TypeScript), "not bloated", tree-shakeable. Supported by reasonably modern Browsers and Node.js latest LTS.

To fulfil that requirement it exports ESM version (for Browsers) as es2017.

Exports default CJS version for Node as es2019 (with native async/await, for better performance, async stack-traces, etc).

Mutation

All function does NOT mutate the arguments by default.

Many functions support "mutation flag", which can be set to true to perform a mutation.

For example:

ts
const obj = { a: 'a', b: 'b' }
+
+// Non-mutating (default)
+const obj2 = _pick(obj, ['a'])
+// { a: 'a' }
+
+// Mutating (opt-in)
+_pick(obj, ['a'], true)
+// obj was mutated

Highlights

`,23)]))}const g=s(n,[["render",o]]);export{u as __pageData,g as default}; diff --git a/assets/index.md.DzR66xOe.lean.js b/assets/index.md.DzR66xOe.lean.js new file mode 100644 index 00000000..946281aa --- /dev/null +++ b/assets/index.md.DzR66xOe.lean.js @@ -0,0 +1,9 @@ +import{_ as s,c as a,a0 as t,o as i}from"./chunks/framework.K5DDegrV.js";const u=JSON.parse('{"title":"js-lib","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),n={name:"index.md"};function o(l,e,r,p,d,c){return i(),a("div",null,e[0]||(e[0]=[t(`

js-lib

Standard library for universal (browser + Node.js) javascript

npmmin.gz sizeActionsloc

MaintainabilityTest Coveragecode style: prettier

Design

Inspired by Lodash, bluebird, promise-fun and other useful small packages.

Designed to play well with the rest of opinionated "Natural Cycles JS Platform" (link pending). This package is the lowest-level production dependency (not devDependency) of the Platform. Almost everything else depends on it.

All functions in this package are exported in index.ts (flat), no namespacing is used. So, to avoid conflicts and "global import namespace" pollution , all functions are prefixed with an underscore (e.g _.pick becomes _pick), with some exceptions (later). Promise functions are prefixed with p, e.g pMap.

Decorators are _prefixed and PascalCased (e.g @_Debounce). _is to be consistent with other naming in this package. PascalCase is to distinguish decorators from similar functions that are not decorators. Example:\\_debounceis a function (lodash-based),\\_Debounceis a decorator (used as@\\_Debounce). PascalCase convention follows Angular/Ionic convention (but doesn't follow TypeScript documentation convention; we had to pick one).

Interfaces and Classes are named as usual (no prefix, PascalCase, e.g AppError).

Q: Why not just use lodash?

A:

  • We believe Lodash is outdated (many functions are pre-ES6 / obsolete by ES6).
  • Because it has so many outdated functions - its size is bigger, and solutions to tree-shake exist, but complicated.
  • First-class TypeScript support (all code in this repo is TypeScript).

This package is intended to be 0-dependency (exception: tslib from TypeScript), "not bloated", tree-shakeable. Supported by reasonably modern Browsers and Node.js latest LTS.

To fulfil that requirement it exports ESM version (for Browsers) as es2017.

Exports default CJS version for Node as es2019 (with native async/await, for better performance, async stack-traces, etc).

Mutation

All function does NOT mutate the arguments by default.

Many functions support "mutation flag", which can be set to true to perform a mutation.

For example:

ts
const obj = { a: 'a', b: 'b' }
+
+// Non-mutating (default)
+const obj2 = _pick(obj, ['a'])
+// { a: 'a' }
+
+// Mutating (opt-in)
+_pick(obj, ['a'], true)
+// obj was mutated

Highlights

`,23)]))}const g=s(n,[["render",o]]);export{u as __pageData,g as default}; diff --git a/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 b/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 new file mode 100644 index 00000000..b6b603d5 Binary files /dev/null and b/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 differ diff --git a/assets/inter-italic-cyrillic.By2_1cv3.woff2 b/assets/inter-italic-cyrillic.By2_1cv3.woff2 new file mode 100644 index 00000000..def40a4f Binary files /dev/null and b/assets/inter-italic-cyrillic.By2_1cv3.woff2 differ diff --git a/assets/inter-italic-greek-ext.1u6EdAuj.woff2 b/assets/inter-italic-greek-ext.1u6EdAuj.woff2 new file mode 100644 index 00000000..e070c3d3 Binary files /dev/null and b/assets/inter-italic-greek-ext.1u6EdAuj.woff2 differ diff --git a/assets/inter-italic-greek.DJ8dCoTZ.woff2 b/assets/inter-italic-greek.DJ8dCoTZ.woff2 new file mode 100644 index 00000000..a3c16ca4 Binary files /dev/null and b/assets/inter-italic-greek.DJ8dCoTZ.woff2 differ diff --git a/assets/inter-italic-latin-ext.CN1xVJS-.woff2 b/assets/inter-italic-latin-ext.CN1xVJS-.woff2 new file mode 100644 index 00000000..2210a899 Binary files /dev/null and b/assets/inter-italic-latin-ext.CN1xVJS-.woff2 differ diff --git a/assets/inter-italic-latin.C2AdPX0b.woff2 b/assets/inter-italic-latin.C2AdPX0b.woff2 new file mode 100644 index 00000000..790d62dc Binary files /dev/null and b/assets/inter-italic-latin.C2AdPX0b.woff2 differ diff --git a/assets/inter-italic-vietnamese.BSbpV94h.woff2 b/assets/inter-italic-vietnamese.BSbpV94h.woff2 new file mode 100644 index 00000000..1eec0775 Binary files /dev/null and b/assets/inter-italic-vietnamese.BSbpV94h.woff2 differ diff --git a/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 b/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 new file mode 100644 index 00000000..2cfe6153 Binary files /dev/null and b/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 differ diff --git a/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 b/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 new file mode 100644 index 00000000..e3886dd1 Binary files /dev/null and b/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 differ diff --git a/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 b/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 new file mode 100644 index 00000000..36d67487 Binary files /dev/null and b/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 differ diff --git a/assets/inter-roman-greek.BBVDIX6e.woff2 b/assets/inter-roman-greek.BBVDIX6e.woff2 new file mode 100644 index 00000000..2bed1e85 Binary files /dev/null and b/assets/inter-roman-greek.BBVDIX6e.woff2 differ diff --git a/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 b/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 new file mode 100644 index 00000000..9a8d1e2b Binary files /dev/null and b/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 differ diff --git a/assets/inter-roman-latin.Di8DUHzh.woff2 b/assets/inter-roman-latin.Di8DUHzh.woff2 new file mode 100644 index 00000000..07d3c53a Binary files /dev/null and b/assets/inter-roman-latin.Di8DUHzh.woff2 differ diff --git a/assets/inter-roman-vietnamese.BjW4sHH5.woff2 b/assets/inter-roman-vietnamese.BjW4sHH5.woff2 new file mode 100644 index 00000000..57bdc22a Binary files /dev/null and b/assets/inter-roman-vietnamese.BjW4sHH5.woff2 differ diff --git a/assets/json.md.M2DNLAza.js b/assets/json.md.M2DNLAza.js new file mode 100644 index 00000000..267bf332 --- /dev/null +++ b/assets/json.md.M2DNLAza.js @@ -0,0 +1,21 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Json","description":"","frontmatter":{},"headers":[],"relativePath":"json.md","filePath":"json.md"}'),h={name:"json.md"};function e(p,s,l,k,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Json

_jsonParseIfPossible

Attempts to parse object as JSON.

Returns original object if JSON parse failed (silently).

ts
_jsonParseIfPossible('abc') // 'abc' (no change, not a json string)
+_jsonParseIfPossible(null) // null (no change)
+_jsonParseIfPossible({ a: 'a' }) // {a: 'a'} (same object, not a json string)
+_jsonParseIfPossible('{"a": "a"}') // {a: 'a'} gotcha! parsed json string into an object!

_stringify

Inspired by _inspect from nodejs-lib, which is based on util.inpect that is not available in the Browser.

Transforms any to human-readable string (via JSON.stringify pretty).

Safe (no error throwing).

Correclty prints Error, AppError, ErrorObject: error.message + '\\n' + _stringify(error.data)

Enforces max length (default to 1000, pass 0 to skip it).

Logs numbers as-is (as a String), e.g: 6.

Logs strings as-is (without single quotes around, unlike default util.inspect behavior).

Otherwise - just uses JSON.stringify.

Returns empty_string string if empty string is passed.

Returns undefined (not a string, but actual undefined) if undefined is passed (default util.inspect behavior).

ts
_stringify(undefined) // 'undefined'
+_stringify(null) // 'null'
+_stringify(true) // 'true'
+_stringify(false) // 'false'
+_stringify(NaN) // 'null'
+_stringify(Infinity) // 'null'
+_stringify('') // 'empty_string'
+_stringify(' ') // 'empty_string'
+_stringify('ho ho ho') // 'ho ho ho'
+_stringify(15) // '15'
+_stringify(new Error('some msg')) // 'Error: some msg'
+
+// AppError is stringified with it's Data object
+_stringify(new AppError('some msg', { k1: 'v1' }))
+// 'AppError: some msg\\n
+// {
+//   "k1": "v1"
+// }'
`,17)]))}const g=i(h,[["render",e]]);export{E as __pageData,g as default}; diff --git a/assets/json.md.M2DNLAza.lean.js b/assets/json.md.M2DNLAza.lean.js new file mode 100644 index 00000000..267bf332 --- /dev/null +++ b/assets/json.md.M2DNLAza.lean.js @@ -0,0 +1,21 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const E=JSON.parse('{"title":"Json","description":"","frontmatter":{},"headers":[],"relativePath":"json.md","filePath":"json.md"}'),h={name:"json.md"};function e(p,s,l,k,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Json

_jsonParseIfPossible

Attempts to parse object as JSON.

Returns original object if JSON parse failed (silently).

ts
_jsonParseIfPossible('abc') // 'abc' (no change, not a json string)
+_jsonParseIfPossible(null) // null (no change)
+_jsonParseIfPossible({ a: 'a' }) // {a: 'a'} (same object, not a json string)
+_jsonParseIfPossible('{"a": "a"}') // {a: 'a'} gotcha! parsed json string into an object!

_stringify

Inspired by _inspect from nodejs-lib, which is based on util.inpect that is not available in the Browser.

Transforms any to human-readable string (via JSON.stringify pretty).

Safe (no error throwing).

Correclty prints Error, AppError, ErrorObject: error.message + '\\n' + _stringify(error.data)

Enforces max length (default to 1000, pass 0 to skip it).

Logs numbers as-is (as a String), e.g: 6.

Logs strings as-is (without single quotes around, unlike default util.inspect behavior).

Otherwise - just uses JSON.stringify.

Returns empty_string string if empty string is passed.

Returns undefined (not a string, but actual undefined) if undefined is passed (default util.inspect behavior).

ts
_stringify(undefined) // 'undefined'
+_stringify(null) // 'null'
+_stringify(true) // 'true'
+_stringify(false) // 'false'
+_stringify(NaN) // 'null'
+_stringify(Infinity) // 'null'
+_stringify('') // 'empty_string'
+_stringify(' ') // 'empty_string'
+_stringify('ho ho ho') // 'ho ho ho'
+_stringify(15) // '15'
+_stringify(new Error('some msg')) // 'Error: some msg'
+
+// AppError is stringified with it's Data object
+_stringify(new AppError('some msg', { k1: 'v1' }))
+// 'AppError: some msg\\n
+// {
+//   "k1": "v1"
+// }'
`,17)]))}const g=i(h,[["render",e]]);export{E as __pageData,g as default}; diff --git a/assets/lazy.md.D4-FRRZB.js b/assets/lazy.md.D4-FRRZB.js new file mode 100644 index 00000000..57f7edaa --- /dev/null +++ b/assets/lazy.md.D4-FRRZB.js @@ -0,0 +1,14 @@ +import{_ as a,c as i,a0 as e,o as n}from"./chunks/framework.K5DDegrV.js";const y=JSON.parse('{"title":"Lazy","description":"","frontmatter":{},"headers":[],"relativePath":"lazy.md","filePath":"lazy.md"}'),t={name:"lazy.md"};function l(p,s,h,k,r,d){return n(),i("div",null,s[0]||(s[0]=[e(`

Lazy

_lazyValue

Based on: https://github.com/sindresorhus/lazy-value

ts
const value = _lazyValue(() => expensiveComputation())
+
+value() // calls expensiveComputation() once
+value() // returns cached result
+value() // returns cached result

_defineLazyProperty

Based on: https://github.com/sindresorhus/define-lazy-prop

ts
interface Obj {
+  v: number
+}
+
+const obj = {} as Obj
+
+_defineLazyProperty(obj, 'v', () => expensiveComputation())
+obj.v // runs expensiveComputation() once
+obj.v // cached value
+obj.v // cached value

_defineLazyProps

Like _defineLazyProperty, but allows to define multiple props at once.

`,9)]))}const c=a(t,[["render",l]]);export{y as __pageData,c as default}; diff --git a/assets/lazy.md.D4-FRRZB.lean.js b/assets/lazy.md.D4-FRRZB.lean.js new file mode 100644 index 00000000..57f7edaa --- /dev/null +++ b/assets/lazy.md.D4-FRRZB.lean.js @@ -0,0 +1,14 @@ +import{_ as a,c as i,a0 as e,o as n}from"./chunks/framework.K5DDegrV.js";const y=JSON.parse('{"title":"Lazy","description":"","frontmatter":{},"headers":[],"relativePath":"lazy.md","filePath":"lazy.md"}'),t={name:"lazy.md"};function l(p,s,h,k,r,d){return n(),i("div",null,s[0]||(s[0]=[e(`

Lazy

_lazyValue

Based on: https://github.com/sindresorhus/lazy-value

ts
const value = _lazyValue(() => expensiveComputation())
+
+value() // calls expensiveComputation() once
+value() // returns cached result
+value() // returns cached result

_defineLazyProperty

Based on: https://github.com/sindresorhus/define-lazy-prop

ts
interface Obj {
+  v: number
+}
+
+const obj = {} as Obj
+
+_defineLazyProperty(obj, 'v', () => expensiveComputation())
+obj.v // runs expensiveComputation() once
+obj.v // cached value
+obj.v // cached value

_defineLazyProps

Like _defineLazyProperty, but allows to define multiple props at once.

`,9)]))}const c=a(t,[["render",l]]);export{y as __pageData,c as default}; diff --git a/assets/loadScript.md.DCu6jDSc.js b/assets/loadScript.md.DCu6jDSc.js new file mode 100644 index 00000000..4dfd3b48 --- /dev/null +++ b/assets/loadScript.md.DCu6jDSc.js @@ -0,0 +1,2 @@ +import{i as m}from"./chunks/env.bTBnF6u3.js";import{_ as k}from"./chunks/types.C-9dMxxX.js";import{d as y,p as S,o as p,c as u,j as n,e as _,a0 as f,G as g}from"./chunks/framework.K5DDegrV.js";import{_ as h}from"./chunks/stringify.CRXUkG82.js";async function b(o,a){if(!m())return await new Promise((e,i)=>{const r=k(document.createElement("script"),{src:o,async:!0,...a,onload:e,onerror:(c,l,d,s,t)=>{i(t||new Error(`loadScript failed: ${o}`))}});document.head.append(r)})}async function C(o,a){if(!m())return await new Promise((e,i)=>{const r=k(document.createElement("link"),{href:o,rel:"stylesheet",...a,onload:e,onerror:(c,l,d,s,t)=>{i(t||new Error(`loadCSS failed: ${o}`))}});document.head.append(r)})}const v={class:"app-content"},w={key:0},E=y({__name:"LoadScriptDemo",setup(o){const a=S(!1);async function e(){await l("https://unpkg.com/jquery@3.6.0/dist/jquery.js")}async function i(){await l("https://unpkg.com/jqueryNON_EXISTING")}async function r(){await d("https://cdn.simplecss.org/simple.min.css")}async function c(){await d("https://cdn.simplecss.org/simpleNOTFOUND.min.css")}async function l(s){a.value=!0;try{await b(s),alert("loaded ok")}catch(t){alert(h(t))}finally{a.value=!1}}async function d(s){a.value=!0;try{await C(s),alert("loaded ok")}catch(t){alert(h(t))}finally{a.value=!1}}return(s,t)=>(p(),u("div",v,[n("button",{onClick:e},"Load good script"),n("button",{onClick:i},"Load bad script"),t[0]||(t[0]=n("br",null,null,-1)),t[1]||(t[1]=n("br",null,null,-1)),n("button",{onClick:r},"Load good CSS"),n("button",{onClick:c},"Load bad CSS"),a.value?(p(),u("p",w,"loading...")):_("",!0)]))}}),q=JSON.parse('{"title":"loadScript, loadCSS","description":"","frontmatter":{},"headers":[],"relativePath":"loadScript.md","filePath":"loadScript.md"}'),j={name:"loadScript.md"},x=Object.assign(j,{setup(o){return(a,e)=>(p(),u("div",null,[e[0]||(e[0]=f(`

loadScript, loadCSS

typescript
await loadScript('https://gtm.com/script.js')
+// know that your script is loaded by now

Works in old-school (and reliable) way by injecting a <script> tag into dom and attaching onload event that resolves the promise. onerror rejects the promise.

See console output, but it will also do alert(_stringify(err)).

`,4)),g(E)]))}});export{q as __pageData,x as default}; diff --git a/assets/loadScript.md.DCu6jDSc.lean.js b/assets/loadScript.md.DCu6jDSc.lean.js new file mode 100644 index 00000000..4dfd3b48 --- /dev/null +++ b/assets/loadScript.md.DCu6jDSc.lean.js @@ -0,0 +1,2 @@ +import{i as m}from"./chunks/env.bTBnF6u3.js";import{_ as k}from"./chunks/types.C-9dMxxX.js";import{d as y,p as S,o as p,c as u,j as n,e as _,a0 as f,G as g}from"./chunks/framework.K5DDegrV.js";import{_ as h}from"./chunks/stringify.CRXUkG82.js";async function b(o,a){if(!m())return await new Promise((e,i)=>{const r=k(document.createElement("script"),{src:o,async:!0,...a,onload:e,onerror:(c,l,d,s,t)=>{i(t||new Error(`loadScript failed: ${o}`))}});document.head.append(r)})}async function C(o,a){if(!m())return await new Promise((e,i)=>{const r=k(document.createElement("link"),{href:o,rel:"stylesheet",...a,onload:e,onerror:(c,l,d,s,t)=>{i(t||new Error(`loadCSS failed: ${o}`))}});document.head.append(r)})}const v={class:"app-content"},w={key:0},E=y({__name:"LoadScriptDemo",setup(o){const a=S(!1);async function e(){await l("https://unpkg.com/jquery@3.6.0/dist/jquery.js")}async function i(){await l("https://unpkg.com/jqueryNON_EXISTING")}async function r(){await d("https://cdn.simplecss.org/simple.min.css")}async function c(){await d("https://cdn.simplecss.org/simpleNOTFOUND.min.css")}async function l(s){a.value=!0;try{await b(s),alert("loaded ok")}catch(t){alert(h(t))}finally{a.value=!1}}async function d(s){a.value=!0;try{await C(s),alert("loaded ok")}catch(t){alert(h(t))}finally{a.value=!1}}return(s,t)=>(p(),u("div",v,[n("button",{onClick:e},"Load good script"),n("button",{onClick:i},"Load bad script"),t[0]||(t[0]=n("br",null,null,-1)),t[1]||(t[1]=n("br",null,null,-1)),n("button",{onClick:r},"Load good CSS"),n("button",{onClick:c},"Load bad CSS"),a.value?(p(),u("p",w,"loading...")):_("",!0)]))}}),q=JSON.parse('{"title":"loadScript, loadCSS","description":"","frontmatter":{},"headers":[],"relativePath":"loadScript.md","filePath":"loadScript.md"}'),j={name:"loadScript.md"},x=Object.assign(j,{setup(o){return(a,e)=>(p(),u("div",null,[e[0]||(e[0]=f(`

loadScript, loadCSS

typescript
await loadScript('https://gtm.com/script.js')
+// know that your script is loaded by now

Works in old-school (and reliable) way by injecting a <script> tag into dom and attaching onload event that resolves the promise. onerror rejects the promise.

See console output, but it will also do alert(_stringify(err)).

`,4)),g(E)]))}});export{q as __pageData,x as default}; diff --git a/assets/math.md.CcBuVUXj.js b/assets/math.md.CcBuVUXj.js new file mode 100644 index 00000000..977c1c7a --- /dev/null +++ b/assets/math.md.CcBuVUXj.js @@ -0,0 +1,40 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Math","description":"","frontmatter":{},"headers":[],"relativePath":"math.md","filePath":"math.md"}'),t={name:"math.md"};function e(l,s,k,p,r,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Math

_randomInt

Returns a random integer in the provided range. As usual, lower-bound is inclusing, while higher-bound is exclusive. Unusually, both lower and higher bounds are inclusive.

ts
_randomInt(1, 3)
+// 1
+// 3
+// 2

_randomArrayItem

Returns a random item from the given array.

Don't use it on empty array. It'll return undefined in that case, but that is not reflected in function's output type!

ts
const a = [1, 2, 3]
+_randomArrayItem(a)
+// random of 1, 2 or 3

_createDeterministicRandom

Returns a "deterministic Math.random() function".

Useful to make tests that need to use Math.random() deterministic.

ts
const deterministicRandom = _createDeterministicRandom()
+
+deterministicRandom()
+// => 0.9872818551957607
+
+deterministicRandom()
+// => 0.34880331158638

Based on this gist which is based on Robert Jenkins’ 32 bit integer hash function.

_average

Calculate an average of the array of numbers.

ts
_average([1, 2, 3, 4])
+// 2.5

_averageWeighted

Calculate a "weighted average", given the array of numbers and corresponding array of weights.

ts
const numbers = [1, 2]
+const weights = [3, 1]
+_averageWeighted(numbers, weights)
+// 1.25

_median

Calculate a Median of the array of numbers.

ts
_median([1, 2, 3]) // 2
+_median([1, 2, 3, 4]) // 2.5
+_median([1, 1, 1, 3, 999]) // 1

_percentile

Calculate a Percentile of the array of numbers.

ts
const numbers = [1200, 1400]
+_percentile(numbers, 0) // 1200
+_percentile(numbers, 10) // 1220
+_percentile(numbers, 20) // 1240
+_percentile(numbers, 30) // 1260
+_percentile(numbers, 40) // 1280
+_percentile(numbers, 50) // 1300
+_percentile(numbers, 60) // 1320
+_percentile(numbers, 70) // 1340
+_percentile(numbers, 80) // 1360
+_percentile(numbers, 90) // 1380
+_percentile(numbers, 100) // 1400

SimpleMovingAverage

ts
// SMA with the size of 2:
+const sma = new SimpleMovingAverage(2)
+sma.avg // 0 by default, when no numbers were pushed
+
+sma.push(1) // [1]
+sma.avg // 1
+
+sma.push(2) // [1, 2]
+sma.avg // 1.5
+
+sma.push(3) // [1, 2, 3]
+sma.avg // 2.5
`,27)]))}const y=i(t,[["render",e]]);export{g as __pageData,y as default}; diff --git a/assets/math.md.CcBuVUXj.lean.js b/assets/math.md.CcBuVUXj.lean.js new file mode 100644 index 00000000..977c1c7a --- /dev/null +++ b/assets/math.md.CcBuVUXj.lean.js @@ -0,0 +1,40 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Math","description":"","frontmatter":{},"headers":[],"relativePath":"math.md","filePath":"math.md"}'),t={name:"math.md"};function e(l,s,k,p,r,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Math

_randomInt

Returns a random integer in the provided range. As usual, lower-bound is inclusing, while higher-bound is exclusive. Unusually, both lower and higher bounds are inclusive.

ts
_randomInt(1, 3)
+// 1
+// 3
+// 2

_randomArrayItem

Returns a random item from the given array.

Don't use it on empty array. It'll return undefined in that case, but that is not reflected in function's output type!

ts
const a = [1, 2, 3]
+_randomArrayItem(a)
+// random of 1, 2 or 3

_createDeterministicRandom

Returns a "deterministic Math.random() function".

Useful to make tests that need to use Math.random() deterministic.

ts
const deterministicRandom = _createDeterministicRandom()
+
+deterministicRandom()
+// => 0.9872818551957607
+
+deterministicRandom()
+// => 0.34880331158638

Based on this gist which is based on Robert Jenkins’ 32 bit integer hash function.

_average

Calculate an average of the array of numbers.

ts
_average([1, 2, 3, 4])
+// 2.5

_averageWeighted

Calculate a "weighted average", given the array of numbers and corresponding array of weights.

ts
const numbers = [1, 2]
+const weights = [3, 1]
+_averageWeighted(numbers, weights)
+// 1.25

_median

Calculate a Median of the array of numbers.

ts
_median([1, 2, 3]) // 2
+_median([1, 2, 3, 4]) // 2.5
+_median([1, 1, 1, 3, 999]) // 1

_percentile

Calculate a Percentile of the array of numbers.

ts
const numbers = [1200, 1400]
+_percentile(numbers, 0) // 1200
+_percentile(numbers, 10) // 1220
+_percentile(numbers, 20) // 1240
+_percentile(numbers, 30) // 1260
+_percentile(numbers, 40) // 1280
+_percentile(numbers, 50) // 1300
+_percentile(numbers, 60) // 1320
+_percentile(numbers, 70) // 1340
+_percentile(numbers, 80) // 1360
+_percentile(numbers, 90) // 1380
+_percentile(numbers, 100) // 1400

SimpleMovingAverage

ts
// SMA with the size of 2:
+const sma = new SimpleMovingAverage(2)
+sma.avg // 0 by default, when no numbers were pushed
+
+sma.push(1) // [1]
+sma.avg // 1
+
+sma.push(2) // [1, 2]
+sma.avg // 1.5
+
+sma.push(3) // [1, 2, 3]
+sma.avg // 2.5
`,27)]))}const y=i(t,[["render",e]]);export{g as __pageData,y as default}; diff --git a/assets/number.md.DBV5l2dc.js b/assets/number.md.DBV5l2dc.js new file mode 100644 index 00000000..5f54b3c6 --- /dev/null +++ b/assets/number.md.DBV5l2dc.js @@ -0,0 +1,36 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Number","description":"","frontmatter":{},"headers":[],"relativePath":"number.md","filePath":"number.md"}'),k={name:"number.md"};function t(l,s,p,e,E,r){return h(),a("div",null,s[0]||(s[0]=[n(`

Number

_inRange

Checks if the provided number (1st argument) is withing range of 2nd and 3rd argument. As usual, lower-bound is inclusive, while higher-boung is exclusive.

ts
_inRange(-10, 1, 5)
+// false
+
+_inRange(1, 1, 5)
+// true
+
+_inRange(3, 1, 5)
+// true
+
+_inRange(5, 1, 5)
+// false
+
+_inRange(7, 1, 5)
+// false

_clamp

Inspired by Lodash's _clamp.

"Clamps" (fits) the number (first argument) within the min/max ranges of 2nd/3rd arguments (range inclusive).

ts
// range is always [5, 10] in these cases
+_clamp(3, 5, 10) // 5
+_clamp(4, 5, 10) // 5
+_clamp(5, 5, 10) // 5
+_clamp(6, 5, 10) // 6
+_clamp(9, 5, 10) // 9
+_clamp(10, 5, 10) // 10
+_clamp(11, 5, 10) // 10

_toFixed

Same as Number.toFixed, but conveniently casts the output to Number.

ts
_toFixed(1.2345, 2)
+// 1.23
+
+_toFixed(1.1, 2)
+// 1.1
+// not '1.10' !

_toPrecision

Same as Number.toPrecision(), but conveniently casts the output to Number.

ts
_toPrecision(1634.56, 1)
+// 2000
+
+_toPrecision(1234.56, 2)
+// 1600

_round

Round (like Math.round) the Number to the nearest "discriminator" (2nd argument):

ts
_round(1634, 1000) // 2000
+_round(1634, 500) // 1500
+_round(1634, 100) // 1600
+_round(1634, 10) // 1630
+_round(1634, 1) // 1634
+_round(1634.5678, 0.1) // 1634.6
+_round(1634.5678, 0.01) // 1634.57
`,17)]))}const y=i(k,[["render",t]]);export{g as __pageData,y as default}; diff --git a/assets/number.md.DBV5l2dc.lean.js b/assets/number.md.DBV5l2dc.lean.js new file mode 100644 index 00000000..5f54b3c6 --- /dev/null +++ b/assets/number.md.DBV5l2dc.lean.js @@ -0,0 +1,36 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Number","description":"","frontmatter":{},"headers":[],"relativePath":"number.md","filePath":"number.md"}'),k={name:"number.md"};function t(l,s,p,e,E,r){return h(),a("div",null,s[0]||(s[0]=[n(`

Number

_inRange

Checks if the provided number (1st argument) is withing range of 2nd and 3rd argument. As usual, lower-bound is inclusive, while higher-boung is exclusive.

ts
_inRange(-10, 1, 5)
+// false
+
+_inRange(1, 1, 5)
+// true
+
+_inRange(3, 1, 5)
+// true
+
+_inRange(5, 1, 5)
+// false
+
+_inRange(7, 1, 5)
+// false

_clamp

Inspired by Lodash's _clamp.

"Clamps" (fits) the number (first argument) within the min/max ranges of 2nd/3rd arguments (range inclusive).

ts
// range is always [5, 10] in these cases
+_clamp(3, 5, 10) // 5
+_clamp(4, 5, 10) // 5
+_clamp(5, 5, 10) // 5
+_clamp(6, 5, 10) // 6
+_clamp(9, 5, 10) // 9
+_clamp(10, 5, 10) // 10
+_clamp(11, 5, 10) // 10

_toFixed

Same as Number.toFixed, but conveniently casts the output to Number.

ts
_toFixed(1.2345, 2)
+// 1.23
+
+_toFixed(1.1, 2)
+// 1.1
+// not '1.10' !

_toPrecision

Same as Number.toPrecision(), but conveniently casts the output to Number.

ts
_toPrecision(1634.56, 1)
+// 2000
+
+_toPrecision(1234.56, 2)
+// 1600

_round

Round (like Math.round) the Number to the nearest "discriminator" (2nd argument):

ts
_round(1634, 1000) // 2000
+_round(1634, 500) // 1500
+_round(1634, 100) // 1600
+_round(1634, 10) // 1630
+_round(1634, 1) // 1634
+_round(1634.5678, 0.1) // 1634.6
+_round(1634.5678, 0.01) // 1634.57
`,17)]))}const y=i(k,[["render",t]]);export{g as __pageData,y as default}; diff --git a/assets/object.md.CwS6Z6VH.js b/assets/object.md.CwS6Z6VH.js new file mode 100644 index 00000000..b12823e6 --- /dev/null +++ b/assets/object.md.CwS6Z6VH.js @@ -0,0 +1,281 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Object","description":"","frontmatter":{},"headers":[],"relativePath":"object.md","filePath":"object.md"}'),l={name:"object.md"};function p(t,s,k,e,E,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Object

_pick

Inspired by Lodash's _.pick.

ts
_pick({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { a: 'a', b: 'b' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// { a: 'a' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// {}
+
+_pick({ a: 'a', b: 'b', c: 'c' }, [])
+// {}
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _pick(obj, ['a'], true)
+obj === obj2 // true

_omit

Inspired by Lodash's _.omit. The opposite of _pick.

ts
_omit({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// {  b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// { a: 'a', b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, [])
+// { a: 'a', b: 'b', c: 'c' }
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _omit(obj, ['a', 'b'], true)
+obj === obj2 // true

_mask

Similar to _omit, but supports deep object access via dot-notation (a.b). Supports "mutation flag" argument.

ts
const obj = {
+  a: 'a',
+  b: {
+    b1: 'b1',
+    b2: 'b2',
+  },
+}
+
+_mask(obj, ['b.b1'])
+// { a: 'a', b: { b1: 'b1' }}
+
+_mask(obj, ['b.b1'], true)
+// obj was mutated

_filterFalsyValues

Returns an object with all Falsy values filtered out. Non-mutating by default.

ts
_filterFalsyValues({
+  a: 'a',
+  b: '', // falsy
+  c: 0, // falsy
+  d: [], // not falsy
+})
+// { a: 'a', d: [] }

_filterNullishValues

Returns an object with all Nullish (null or undefined) values filtered out. Non-mutating by default.

ts
_filterNullishValues({
+  a: 'a',
+  b: null, // nullish
+  c: undefined, // nullish
+  d: '', // not nullish
+})
+// { a: 'a', d: '' }

_filterUndefinedValues

Returns an object with all undefined values filtered out. null values are kept.

Non-mutating by default.

ts
_filterUndefinedValues({
+  a: 'a',
+  b: null,
+  c: undefined, // removed
+  d: '',
+})
+// { a: 'a', b: null, d: '' }

_filterEmptyArrays

Returns an object will all empty arrays filtered out. Non-mutating by default.

ts
_filterEmptyArrays({
+  a: 'a',
+  b: [], // empty array
+  c: 'c',
+})
+// { a: 'a', c: 'c' }

_filterEmptyValues

Filters the object by removing all key-value pairs where Value is Empty (according to _isEmpty() specification).

ts
_filterEmptyValues({
+  a: 0,
+  b: '',
+  c: [],
+  d: {},
+  e: {
+    f: [],
+  },
+  g: new Set(),
+  h: 'h',
+})
+// {
+//   a: 0,
+//   e: {
+//     f: [],
+//   },
+//   h: 'h',
+//  })

_filterObject

Returns clone of obj without properties that does not pass predicate. Allows filtering by both key and value.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Predicate to keep only even-numbered values
+_filterObject(obj, (_k, v) => v % 2 === 0)
+// { b: 2 }
+
+// Predicate to only keep keys that start with \`a\`
+_filterObject(obj, (k, _v) => k.startsWith('a'))
+// { a: 1 }

_mapKeys

Returns a clone of obj with modified Keys, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to add \`_odd\` or \`_even\` to the object key, based on its value
+_mapKeys(obj, (k, v) => k + (v % 2 ? '_odd' : '_even'))
+// { a_odd: 1, b_even: 2, c_odd: 3 }

_mapValues

Returns a clone of obj with modified Values, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2
+_mapValues(obj, (_k, v) => v * 2)
+// { a: 2, b: 4, c: 6 }

_mapObject

Returns a clone of obj where both Keys and Values can be modified by a Mapper function. Mapper function needs to return a Tuple [key, value].

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2, and append the value to the end of the key
+_mapObject(obj, (k, v) => {
+  const newValue = v * 2
+  return [k + newValue, newValue]
+})
+// { a2: 2, b4: 4, c6: 6 }

_findKeyByValue

Fiven an object, find a key string for a given value: any.

Inspired by Lodash's _.findKey.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+_findKeyByValue(obj, 1) // 'a'
+_findKeyByValue(obj, 2) // 'b'
+_findKeyByValue(obj, 3) // 'c'
+_findKeyByValue(obj, 4) // undefined

_objectNullValuesToUndefined

Returns a clone of the object where null values are replaced with undefined

ts
const obj = {
+  a: 1, // intact
+  b: null, // replaced with \`undefined\`
+  c: undefined, // intact
+}
+
+_objectNullValuesToUndefined(obj)
+// { a: 1, b: undefined, c: undefined }

_deepCopy

Does a deep copy of an object.

Actually, it is just a semantic function that internally does JSON.parse(JSON.stringify(o)), which is currently the fastest+simplest+relyable way to do a deep copy.

Because it does JSON.parse/stringify - it'll remove undefined values/keys from objects.

ts
const obj = { a: 'a', b: { bb: 'bb' } }
+const obj2 = _deepCopy(obj)
+// Deep copy of obj

_isPrimitive

Returns Boolean indication if passed value is a primitive.

ts
_isPrimitive(5)
+// true
+
+_isPrimitive({ a: 'a' })
+// false

Best specification is the source code:

ts
export function _isPrimitive(v: any): v is null | undefined | number | boolean | string {
+  return (
+    v === null ||
+    v === undefined ||
+    typeof v === 'number' ||
+    typeof v === 'boolean' ||
+    typeof v === 'string'
+  )
+}

_isEmpty

Object is considered empty if it's one of:

  • undefined
  • '' (empty string)
  • [] (empty array)
  • {} (empty object)
  • new Map() (empty Map)
  • new Set() (empty Set)

_undefinedIfEmpty

Returns undefined if it's empty (according to _isEmpty() specification), otherwise returns the original object.

ts
_undefinedIfEmpty('') // undefined, because it's empty
+_undefinedIfEmpty([]) // undefined, because it's empty
+_undefinedIfEmpty(new Map()) // undefined, because it's empty
+_undefinedIfEmpty('a') // 'a', intact
+_undefinedIfEmpty(false) // false, intact

_merge

Deeply merges the second object into the first one. Returns the first object (merged). Mutates the first object!

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb1: 'bb1',
+  },
+}
+
+const obj2 = {
+  b: {
+    bb2: 'bb2',
+  },
+  c: 'c',
+}
+
+_merge(obj1, obj2)
+// {
+//   a: 'a',
+//   b: {
+//     bb1: 'bb1',
+//     bb2: 'bb2',
+//   },
+//   c: 'c',
+// }

_deepTrim

Deeply traverses the object and trims all String values found.

ts
const o = {
+  a: 'abc ',
+  b: 'c',
+  d: 12,
+  e: {
+    f: '  sd a ',
+  },
+}
+
+_deepTrim(o)
+// {
+//   a: 'abc',
+//   b: 'c',
+//   d: 12,
+//   e: {
+//     f: 'sd a',
+//   },
+// }

_sortObjectDeep

Based on IndigoUnited/js-deep-sort-object.

Deeply traverses the object and makes it "sort-stable" (deterministic). Useful for e.g snapshot-testing, or in any place where sort-stable result is expected. Resulting object is still Equal to the original object.

  • Arrays are sorted order-preserved (!), because array order has a meaning and shouldn't be changed (!).
  • Objects are sorted by their key name.
ts
const obj = {
+  b: 'b',
+  c: ['c3', 'c1', 'c2'],
+  a: 'a',
+}
+
+_sortObjectDeep(obj)
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: ['c1', 'c2', 'c3'],
+// }

_sortObject

Allows to sort object by the list of known keys.

Example:

ts
const obj = {
+  b: 'b',
+  c: 'c',
+  extra: 'extra',
+  a: 'a',
+}
+
+_sortObject(obj, ['a', 'b', 'c'])
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: 'c',
+//   extra: 'extra',
+// }

_deepEquals

Based on epoberezkin/fast-deep-equal.

Performance-optimized function to check if objects (values) are deeply-equal to each other.

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+// Different key order, but still equals
+const obj2 = {
+  b: {
+    bb: 'bb',
+  },
+  a: 'a',
+}
+
+const obj3 = {
+  a: 'a',
+  b: {
+    bb: 'bb3', // not equal!
+  },
+}
+
+_deepEquals(obj1, obj2) // true
+_deepEquals(obj1, obj3) // false
+_deepEquals(obj2, obj3) // false

_invert

Returns an Object with "inverted" keys and values.

ts
const obj = {
+  a: '1',
+  b: '2',
+}
+
+_invert(obj)
+// {
+//   '1': 'a',
+//   '2': 'b',
+// }

_invertMap

Returns a Map with "inverted" keys and values.

ts
const map = new Map<string, number>([
+  ['a', 1],
+  ['b', 2],
+])
+
+_invertMap(map)
+// Map
+//   1 => 'a'
+//   2 => 'b'

_get, _has, _set, _unset

Gets the object value via the famous "dot-notation":

ts
const obj = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+_get(obj, 'b.bb') // 'bb'
+_has(obj, 'b.bb') // true
+_has(obj, 'b.bb2') // false
+_set(obj, 'b.bb2', 'bb2value') // sets obj.b.bb2 to 'bb2Value'
+_unset(obj, 'b.bb') // deletes obj.b.bb

_stringMapValues

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const values = Object.values(map)
+// values: (string | undefined)[]

After:

ts
const values = _stringMapValues(map)
+// values: string[]

_stringMapEntries

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const entries = Object.entries(map)
+// entries: [string, string | undefined][]

After:

ts
const entries = _stringMapEntries(map)
+// entries: [string, string][]
`,103)]))}const y=i(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/object.md.CwS6Z6VH.lean.js b/assets/object.md.CwS6Z6VH.lean.js new file mode 100644 index 00000000..b12823e6 --- /dev/null +++ b/assets/object.md.CwS6Z6VH.lean.js @@ -0,0 +1,281 @@ +import{_ as i,c as a,a0 as n,o as h}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Object","description":"","frontmatter":{},"headers":[],"relativePath":"object.md","filePath":"object.md"}'),l={name:"object.md"};function p(t,s,k,e,E,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Object

_pick

Inspired by Lodash's _.pick.

ts
_pick({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { a: 'a', b: 'b' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// { a: 'a' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// {}
+
+_pick({ a: 'a', b: 'b', c: 'c' }, [])
+// {}
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _pick(obj, ['a'], true)
+obj === obj2 // true

_omit

Inspired by Lodash's _.omit. The opposite of _pick.

ts
_omit({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// {  b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// { a: 'a', b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, [])
+// { a: 'a', b: 'b', c: 'c' }
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _omit(obj, ['a', 'b'], true)
+obj === obj2 // true

_mask

Similar to _omit, but supports deep object access via dot-notation (a.b). Supports "mutation flag" argument.

ts
const obj = {
+  a: 'a',
+  b: {
+    b1: 'b1',
+    b2: 'b2',
+  },
+}
+
+_mask(obj, ['b.b1'])
+// { a: 'a', b: { b1: 'b1' }}
+
+_mask(obj, ['b.b1'], true)
+// obj was mutated

_filterFalsyValues

Returns an object with all Falsy values filtered out. Non-mutating by default.

ts
_filterFalsyValues({
+  a: 'a',
+  b: '', // falsy
+  c: 0, // falsy
+  d: [], // not falsy
+})
+// { a: 'a', d: [] }

_filterNullishValues

Returns an object with all Nullish (null or undefined) values filtered out. Non-mutating by default.

ts
_filterNullishValues({
+  a: 'a',
+  b: null, // nullish
+  c: undefined, // nullish
+  d: '', // not nullish
+})
+// { a: 'a', d: '' }

_filterUndefinedValues

Returns an object with all undefined values filtered out. null values are kept.

Non-mutating by default.

ts
_filterUndefinedValues({
+  a: 'a',
+  b: null,
+  c: undefined, // removed
+  d: '',
+})
+// { a: 'a', b: null, d: '' }

_filterEmptyArrays

Returns an object will all empty arrays filtered out. Non-mutating by default.

ts
_filterEmptyArrays({
+  a: 'a',
+  b: [], // empty array
+  c: 'c',
+})
+// { a: 'a', c: 'c' }

_filterEmptyValues

Filters the object by removing all key-value pairs where Value is Empty (according to _isEmpty() specification).

ts
_filterEmptyValues({
+  a: 0,
+  b: '',
+  c: [],
+  d: {},
+  e: {
+    f: [],
+  },
+  g: new Set(),
+  h: 'h',
+})
+// {
+//   a: 0,
+//   e: {
+//     f: [],
+//   },
+//   h: 'h',
+//  })

_filterObject

Returns clone of obj without properties that does not pass predicate. Allows filtering by both key and value.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Predicate to keep only even-numbered values
+_filterObject(obj, (_k, v) => v % 2 === 0)
+// { b: 2 }
+
+// Predicate to only keep keys that start with \`a\`
+_filterObject(obj, (k, _v) => k.startsWith('a'))
+// { a: 1 }

_mapKeys

Returns a clone of obj with modified Keys, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to add \`_odd\` or \`_even\` to the object key, based on its value
+_mapKeys(obj, (k, v) => k + (v % 2 ? '_odd' : '_even'))
+// { a_odd: 1, b_even: 2, c_odd: 3 }

_mapValues

Returns a clone of obj with modified Values, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2
+_mapValues(obj, (_k, v) => v * 2)
+// { a: 2, b: 4, c: 6 }

_mapObject

Returns a clone of obj where both Keys and Values can be modified by a Mapper function. Mapper function needs to return a Tuple [key, value].

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2, and append the value to the end of the key
+_mapObject(obj, (k, v) => {
+  const newValue = v * 2
+  return [k + newValue, newValue]
+})
+// { a2: 2, b4: 4, c6: 6 }

_findKeyByValue

Fiven an object, find a key string for a given value: any.

Inspired by Lodash's _.findKey.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+_findKeyByValue(obj, 1) // 'a'
+_findKeyByValue(obj, 2) // 'b'
+_findKeyByValue(obj, 3) // 'c'
+_findKeyByValue(obj, 4) // undefined

_objectNullValuesToUndefined

Returns a clone of the object where null values are replaced with undefined

ts
const obj = {
+  a: 1, // intact
+  b: null, // replaced with \`undefined\`
+  c: undefined, // intact
+}
+
+_objectNullValuesToUndefined(obj)
+// { a: 1, b: undefined, c: undefined }

_deepCopy

Does a deep copy of an object.

Actually, it is just a semantic function that internally does JSON.parse(JSON.stringify(o)), which is currently the fastest+simplest+relyable way to do a deep copy.

Because it does JSON.parse/stringify - it'll remove undefined values/keys from objects.

ts
const obj = { a: 'a', b: { bb: 'bb' } }
+const obj2 = _deepCopy(obj)
+// Deep copy of obj

_isPrimitive

Returns Boolean indication if passed value is a primitive.

ts
_isPrimitive(5)
+// true
+
+_isPrimitive({ a: 'a' })
+// false

Best specification is the source code:

ts
export function _isPrimitive(v: any): v is null | undefined | number | boolean | string {
+  return (
+    v === null ||
+    v === undefined ||
+    typeof v === 'number' ||
+    typeof v === 'boolean' ||
+    typeof v === 'string'
+  )
+}

_isEmpty

Object is considered empty if it's one of:

  • undefined
  • '' (empty string)
  • [] (empty array)
  • {} (empty object)
  • new Map() (empty Map)
  • new Set() (empty Set)

_undefinedIfEmpty

Returns undefined if it's empty (according to _isEmpty() specification), otherwise returns the original object.

ts
_undefinedIfEmpty('') // undefined, because it's empty
+_undefinedIfEmpty([]) // undefined, because it's empty
+_undefinedIfEmpty(new Map()) // undefined, because it's empty
+_undefinedIfEmpty('a') // 'a', intact
+_undefinedIfEmpty(false) // false, intact

_merge

Deeply merges the second object into the first one. Returns the first object (merged). Mutates the first object!

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb1: 'bb1',
+  },
+}
+
+const obj2 = {
+  b: {
+    bb2: 'bb2',
+  },
+  c: 'c',
+}
+
+_merge(obj1, obj2)
+// {
+//   a: 'a',
+//   b: {
+//     bb1: 'bb1',
+//     bb2: 'bb2',
+//   },
+//   c: 'c',
+// }

_deepTrim

Deeply traverses the object and trims all String values found.

ts
const o = {
+  a: 'abc ',
+  b: 'c',
+  d: 12,
+  e: {
+    f: '  sd a ',
+  },
+}
+
+_deepTrim(o)
+// {
+//   a: 'abc',
+//   b: 'c',
+//   d: 12,
+//   e: {
+//     f: 'sd a',
+//   },
+// }

_sortObjectDeep

Based on IndigoUnited/js-deep-sort-object.

Deeply traverses the object and makes it "sort-stable" (deterministic). Useful for e.g snapshot-testing, or in any place where sort-stable result is expected. Resulting object is still Equal to the original object.

  • Arrays are sorted order-preserved (!), because array order has a meaning and shouldn't be changed (!).
  • Objects are sorted by their key name.
ts
const obj = {
+  b: 'b',
+  c: ['c3', 'c1', 'c2'],
+  a: 'a',
+}
+
+_sortObjectDeep(obj)
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: ['c1', 'c2', 'c3'],
+// }

_sortObject

Allows to sort object by the list of known keys.

Example:

ts
const obj = {
+  b: 'b',
+  c: 'c',
+  extra: 'extra',
+  a: 'a',
+}
+
+_sortObject(obj, ['a', 'b', 'c'])
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: 'c',
+//   extra: 'extra',
+// }

_deepEquals

Based on epoberezkin/fast-deep-equal.

Performance-optimized function to check if objects (values) are deeply-equal to each other.

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+// Different key order, but still equals
+const obj2 = {
+  b: {
+    bb: 'bb',
+  },
+  a: 'a',
+}
+
+const obj3 = {
+  a: 'a',
+  b: {
+    bb: 'bb3', // not equal!
+  },
+}
+
+_deepEquals(obj1, obj2) // true
+_deepEquals(obj1, obj3) // false
+_deepEquals(obj2, obj3) // false

_invert

Returns an Object with "inverted" keys and values.

ts
const obj = {
+  a: '1',
+  b: '2',
+}
+
+_invert(obj)
+// {
+//   '1': 'a',
+//   '2': 'b',
+// }

_invertMap

Returns a Map with "inverted" keys and values.

ts
const map = new Map<string, number>([
+  ['a', 1],
+  ['b', 2],
+])
+
+_invertMap(map)
+// Map
+//   1 => 'a'
+//   2 => 'b'

_get, _has, _set, _unset

Gets the object value via the famous "dot-notation":

ts
const obj = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+_get(obj, 'b.bb') // 'bb'
+_has(obj, 'b.bb') // true
+_has(obj, 'b.bb2') // false
+_set(obj, 'b.bb2', 'bb2value') // sets obj.b.bb2 to 'bb2Value'
+_unset(obj, 'b.bb') // deletes obj.b.bb

_stringMapValues

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const values = Object.values(map)
+// values: (string | undefined)[]

After:

ts
const values = _stringMapValues(map)
+// values: string[]

_stringMapEntries

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const entries = Object.entries(map)
+// entries: [string, string | undefined][]

After:

ts
const entries = _stringMapEntries(map)
+// entries: [string, string][]
`,103)]))}const y=i(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/promise.md.R6l4MSsV.js b/assets/promise.md.R6l4MSsV.js new file mode 100644 index 00000000..89df6ff5 --- /dev/null +++ b/assets/promise.md.R6l4MSsV.js @@ -0,0 +1,57 @@ +import{_ as i,c as a,a0 as t,o as n}from"./chunks/framework.K5DDegrV.js";const o=JSON.parse('{"title":"Promise","description":"","frontmatter":{},"headers":[],"relativePath":"promise.md","filePath":"promise.md"}'),e={name:"promise.md"};function h(p,s,l,k,r,d){return n(),a("div",null,s[0]||(s[0]=[t(`

Promise

Inspired by bluebird and Sindre's promise-fun packages.

"Copy-pasted" (with small adjustments) here, because:

  1. Bluebird is outdated (pre-ES6)

  2. p-* packages are amazing, but not all of them are needed. Some of them are very much needed though.

  3. To fix issues with Types. Here, everything is TypeScript, so, first class support and sync.

  4. To fix issues with IDE auto-imports, which is still quite bad for "default exported" packages.

Downside is that (as every fork) we lose "auto-update" possibility from these packages. We believe it's not as bad, because packages imported here have mature API and stability (example: pMap).

pMap

Based on p-map

Allows to asynchronously map an array of Promises, with options to:

  • control concurrency (default: Infinity)
  • control error behavior (ErrorMode):
    • THROW_IMMEDIATELY (default)
    • THROW_AGGREGATED: throw AggregateError in the end of execution, if at least 1 error happened
    • SUPPRESS: completely suppress (ignore) errors
ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+const results = await pMap(promises, async r => { ... }, {
+  concurrency: 2,
+  errorMode: ErrorMode.SUPPRESS,
+})

pProps

Based on p-props

Syntax-sugar to concurrently execute multiple promises and map their results to named properties.

Before:

ts
const [r1, r2, r3] = await Promise.all([
+  fetch(...),
+  fetch(...),
+  fetch(...),
+])

After:

ts
const {r1, r2, r3} = await pProps({
+  r1: fetch(...),
+  r2: fetch(...),
+  r3: fetch(...),
+})

pFilter

Based on p-filter

Allows to asynchrously filter an array of Promises.

ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+
+const results = await pFilter(promises, async r => (await r.json()).success)

pDefer

Allows to create a "ResolvablePromise", which is a normal native Promise (so, can be awaited, etc), extended with .resolve() and .reject() methods, so you can control it. Similar to jQuery's Deferred, or RxJS's Subject (which is both an Observable and allows to emit values).

Sometimes useful to "promisify" a callback-style API.

ts
async function run(): Promise<string> {
+  const defer = pDefer<string>()
+
+  someOldApi(
+    (result: string) => {
+      defer.resolve(result)
+    },
+    err => defer.reject(err),
+  )
+
+  return await defer.promise
+}

pDelay

Based on p-delay

Just a fancy async/await style setTimeout

Before:

ts
await new Promise(resolve => setTimeout(resolve, 500))

After:

ts
await pDelay(500)

Allows to return a value:

ts
const res = await pDelay(500, 'hello')
+// hello

pRetry

Based on p-retry

Returns a Function (!), enhanced with retry capabilities.

Simplest example:

ts
const save = pRetry(async () => await dao.save())
+
+await save()
+// will retry 3 times, with default delay of 1 second and exponential back-off (x2 delay multiplier)

Advanced example (with options):

ts
const save = pRetry(async () => await dao.save(), {
+  maxAttempts: 5,
+  predicate: err => err?.message.includes('GOAWAY'),
+})
+
+await save()
+// will try up to 5 times, but only if err.message contains GOAWAY

pTimeoutFn

Based on p-timeout

Decorates a Function with a timeout.

Throws an Error if the Function is not resolved in a certain time.

If the Function rejects - passes this rejection further.

ts
const decoratedFn = pTimeout(someFunction, { timeout: 1000 })
+
+await decoratedFn()
+// will throw Timeout error if \`someFunction\` is not finished in 1000 ms.
+// otherwise will pass

pHang

Syntax-sugar for returning a never-resolving ("hung") Promise.

Has semantic meaning, telling us that this Promise is meant to never get resolved or rejected.

Before:

ts
return new Promise()

After:

ts
return pHang()

Useful e.g when you do location.reload() (let's say, you want to reload the page after being logged-in as an Admin) and want your BlockingLoader to never stop spinning:

ts
async function adminLogin(): Promise<void> {
+  location.href = '/admin'
+  return pHang()
+}

pState

Returns Promise's "state" as a String, one of:

  • pending
  • resolved
  • rejected
ts
const p = new Promise()
+await pState(p)
+// 'pending'
+
+const p = new Promise.resolve()
+await pState(p)
+// 'resolved'
`,60)]))}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; diff --git a/assets/promise.md.R6l4MSsV.lean.js b/assets/promise.md.R6l4MSsV.lean.js new file mode 100644 index 00000000..89df6ff5 --- /dev/null +++ b/assets/promise.md.R6l4MSsV.lean.js @@ -0,0 +1,57 @@ +import{_ as i,c as a,a0 as t,o as n}from"./chunks/framework.K5DDegrV.js";const o=JSON.parse('{"title":"Promise","description":"","frontmatter":{},"headers":[],"relativePath":"promise.md","filePath":"promise.md"}'),e={name:"promise.md"};function h(p,s,l,k,r,d){return n(),a("div",null,s[0]||(s[0]=[t(`

Promise

Inspired by bluebird and Sindre's promise-fun packages.

"Copy-pasted" (with small adjustments) here, because:

  1. Bluebird is outdated (pre-ES6)

  2. p-* packages are amazing, but not all of them are needed. Some of them are very much needed though.

  3. To fix issues with Types. Here, everything is TypeScript, so, first class support and sync.

  4. To fix issues with IDE auto-imports, which is still quite bad for "default exported" packages.

Downside is that (as every fork) we lose "auto-update" possibility from these packages. We believe it's not as bad, because packages imported here have mature API and stability (example: pMap).

pMap

Based on p-map

Allows to asynchronously map an array of Promises, with options to:

  • control concurrency (default: Infinity)
  • control error behavior (ErrorMode):
    • THROW_IMMEDIATELY (default)
    • THROW_AGGREGATED: throw AggregateError in the end of execution, if at least 1 error happened
    • SUPPRESS: completely suppress (ignore) errors
ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+const results = await pMap(promises, async r => { ... }, {
+  concurrency: 2,
+  errorMode: ErrorMode.SUPPRESS,
+})

pProps

Based on p-props

Syntax-sugar to concurrently execute multiple promises and map their results to named properties.

Before:

ts
const [r1, r2, r3] = await Promise.all([
+  fetch(...),
+  fetch(...),
+  fetch(...),
+])

After:

ts
const {r1, r2, r3} = await pProps({
+  r1: fetch(...),
+  r2: fetch(...),
+  r3: fetch(...),
+})

pFilter

Based on p-filter

Allows to asynchrously filter an array of Promises.

ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+
+const results = await pFilter(promises, async r => (await r.json()).success)

pDefer

Allows to create a "ResolvablePromise", which is a normal native Promise (so, can be awaited, etc), extended with .resolve() and .reject() methods, so you can control it. Similar to jQuery's Deferred, or RxJS's Subject (which is both an Observable and allows to emit values).

Sometimes useful to "promisify" a callback-style API.

ts
async function run(): Promise<string> {
+  const defer = pDefer<string>()
+
+  someOldApi(
+    (result: string) => {
+      defer.resolve(result)
+    },
+    err => defer.reject(err),
+  )
+
+  return await defer.promise
+}

pDelay

Based on p-delay

Just a fancy async/await style setTimeout

Before:

ts
await new Promise(resolve => setTimeout(resolve, 500))

After:

ts
await pDelay(500)

Allows to return a value:

ts
const res = await pDelay(500, 'hello')
+// hello

pRetry

Based on p-retry

Returns a Function (!), enhanced with retry capabilities.

Simplest example:

ts
const save = pRetry(async () => await dao.save())
+
+await save()
+// will retry 3 times, with default delay of 1 second and exponential back-off (x2 delay multiplier)

Advanced example (with options):

ts
const save = pRetry(async () => await dao.save(), {
+  maxAttempts: 5,
+  predicate: err => err?.message.includes('GOAWAY'),
+})
+
+await save()
+// will try up to 5 times, but only if err.message contains GOAWAY

pTimeoutFn

Based on p-timeout

Decorates a Function with a timeout.

Throws an Error if the Function is not resolved in a certain time.

If the Function rejects - passes this rejection further.

ts
const decoratedFn = pTimeout(someFunction, { timeout: 1000 })
+
+await decoratedFn()
+// will throw Timeout error if \`someFunction\` is not finished in 1000 ms.
+// otherwise will pass

pHang

Syntax-sugar for returning a never-resolving ("hung") Promise.

Has semantic meaning, telling us that this Promise is meant to never get resolved or rejected.

Before:

ts
return new Promise()

After:

ts
return pHang()

Useful e.g when you do location.reload() (let's say, you want to reload the page after being logged-in as an Admin) and want your BlockingLoader to never stop spinning:

ts
async function adminLogin(): Promise<void> {
+  location.href = '/admin'
+  return pHang()
+}

pState

Returns Promise's "state" as a String, one of:

  • pending
  • resolved
  • rejected
ts
const p = new Promise()
+await pState(p)
+// 'pending'
+
+const p = new Promise.resolve()
+await pState(p)
+// 'resolved'
`,60)]))}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; diff --git a/assets/string.md.c0QAifb_.js b/assets/string.md.c0QAifb_.js new file mode 100644 index 00000000..a3e9361e --- /dev/null +++ b/assets/string.md.c0QAifb_.js @@ -0,0 +1,35 @@ +import{_ as i,c as a,a0 as t,o as e}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"String","description":"","frontmatter":{},"headers":[],"relativePath":"string.md","filePath":"string.md"}'),n={name:"string.md"};function l(h,s,p,k,r,d){return e(),a("div",null,s[0]||(s[0]=[t(`

String

_capitalize

Capitalizes first char, lowercases the rest of the string.

ts
_capitalize('hello') // Hello
+_capitalize('HELLO') // HELLO (no change)
+_capitalize('hello world') // Hello world

_upperFirst

Uppercases first char.

ts
_upperFirst('hello') // Hello
+_upperFirst('HELLO') // HELLO (no change)
+_upperFirst('hELLO') // HELLO

_lowerFirst

Lowercases first char.

ts
_lowerFirst('Hello') // hello
+_lowerFirst('hello') // hello (no change)
+_lowerFirst('HELLO') // hELLO

_camelCase 🐪

Transforms the input string to camelCase 🐪. Implementation adapted from Lodash.

ts
_camelCase('la la la')
+_camelCase('la_la_la')
+_camelCase('la-la-la')
+// laLaLa

_snakeCase 🐍

Transforms the input string to snake_case 🐍. Implementation adapted from Lodash.

ts
_snakeCase('la la la')
+_snakeCase('la-la-la')
+_snakeCase('laLaLa')
+// la_la_la

_kebabCase 🥙

Transforms the input string to kebab-case 🥙. Implementation adapted from Lodash.

ts
_kebabCase('la la la')
+_kebabCase('la_la_la')
+_kebabCase('laLaLa')
+// la-la-la

_split

Like String.split, but with the limited number of tokens.

ts
_split('a_b_c', '_', 2)
+// ['a', 'b_c']

_substringBefore

ts
_substringBefore('file1.test.ts', '.')
+// 'file1'
+
+_substringBefore('file1.test.ts', '.ts')
+// 'file1.test'

_substringBeforeLast

ts
_substringBeforeLast('file1.test.ts', '.')
+// 'file1.test'

_substringAfter

ts
_substringAfter('file1.test.ts', '.')
+// 'test.ts'

_substringAfterLast

ts
_substringAfterLast('file1.test.ts', '.')
+// 'ts'

_substringBetweenLast

ts
const s = '/Users/lalala/someFile.test.ts'
+_substringBetweenLast(s, '/', '.'))
+// 'someFile'

_truncate

Truncates the string to the needed length, putting ... (or a custom "ending") in the end, if needed. The maxLen (second argument) includes the "ending string" (3rd argument).

ts
_truncate('Hello World!', 5) // 'He...'
+_truncate('Hello World!', 6) // 'Hel...'
+_truncate('Hello World!', 100) // 'Hello World!' (no truncation needed)
+
+// Custom "ending"
+_truncate('Hello World!', 5, '|') // 'Hell|'

_truncateMiddle

Truncates the string in the middle.

ts
_truncateMiddle('abcdefghijklmnopqrstuvwxyz', 10)
+// 'abcd...xyz'

_replaceAll

Polyfill for String.prototype.replaceAll.

Based on regex implementation (slightly faster than "split/join" implementation).

_nl2br

Converts \\n (aka new-line) to <br>, to be presented in HTML.

Keeps \\n, so if it's printed in non-HTML environment it still looks ok-ish.

_parseQueryString

Parses location.search string (e.g ?a=1&b=2) into a StringMap, e.g: { a: '1', b: '2' }

Pass location.search to it in the Frontend, or any other string on the Backend (where location.search is not available).

Works both with and without leading ? character.

Yes, there's URLSearchParams existing in the Frontend (not in Node yet), but it's API is not as convenient. And the implementation here is super-small.

Goal of this function is to produce exactly same output as URLSearchParams would.

ts
// Assuming url is http://example.com?a=1&b=2
+
+_parseQueryString(location.search)
+// { a: '1', b: '2' }
`,51)]))}const E=i(n,[["render",l]]);export{g as __pageData,E as default}; diff --git a/assets/string.md.c0QAifb_.lean.js b/assets/string.md.c0QAifb_.lean.js new file mode 100644 index 00000000..a3e9361e --- /dev/null +++ b/assets/string.md.c0QAifb_.lean.js @@ -0,0 +1,35 @@ +import{_ as i,c as a,a0 as t,o as e}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"String","description":"","frontmatter":{},"headers":[],"relativePath":"string.md","filePath":"string.md"}'),n={name:"string.md"};function l(h,s,p,k,r,d){return e(),a("div",null,s[0]||(s[0]=[t(`

String

_capitalize

Capitalizes first char, lowercases the rest of the string.

ts
_capitalize('hello') // Hello
+_capitalize('HELLO') // HELLO (no change)
+_capitalize('hello world') // Hello world

_upperFirst

Uppercases first char.

ts
_upperFirst('hello') // Hello
+_upperFirst('HELLO') // HELLO (no change)
+_upperFirst('hELLO') // HELLO

_lowerFirst

Lowercases first char.

ts
_lowerFirst('Hello') // hello
+_lowerFirst('hello') // hello (no change)
+_lowerFirst('HELLO') // hELLO

_camelCase 🐪

Transforms the input string to camelCase 🐪. Implementation adapted from Lodash.

ts
_camelCase('la la la')
+_camelCase('la_la_la')
+_camelCase('la-la-la')
+// laLaLa

_snakeCase 🐍

Transforms the input string to snake_case 🐍. Implementation adapted from Lodash.

ts
_snakeCase('la la la')
+_snakeCase('la-la-la')
+_snakeCase('laLaLa')
+// la_la_la

_kebabCase 🥙

Transforms the input string to kebab-case 🥙. Implementation adapted from Lodash.

ts
_kebabCase('la la la')
+_kebabCase('la_la_la')
+_kebabCase('laLaLa')
+// la-la-la

_split

Like String.split, but with the limited number of tokens.

ts
_split('a_b_c', '_', 2)
+// ['a', 'b_c']

_substringBefore

ts
_substringBefore('file1.test.ts', '.')
+// 'file1'
+
+_substringBefore('file1.test.ts', '.ts')
+// 'file1.test'

_substringBeforeLast

ts
_substringBeforeLast('file1.test.ts', '.')
+// 'file1.test'

_substringAfter

ts
_substringAfter('file1.test.ts', '.')
+// 'test.ts'

_substringAfterLast

ts
_substringAfterLast('file1.test.ts', '.')
+// 'ts'

_substringBetweenLast

ts
const s = '/Users/lalala/someFile.test.ts'
+_substringBetweenLast(s, '/', '.'))
+// 'someFile'

_truncate

Truncates the string to the needed length, putting ... (or a custom "ending") in the end, if needed. The maxLen (second argument) includes the "ending string" (3rd argument).

ts
_truncate('Hello World!', 5) // 'He...'
+_truncate('Hello World!', 6) // 'Hel...'
+_truncate('Hello World!', 100) // 'Hello World!' (no truncation needed)
+
+// Custom "ending"
+_truncate('Hello World!', 5, '|') // 'Hell|'

_truncateMiddle

Truncates the string in the middle.

ts
_truncateMiddle('abcdefghijklmnopqrstuvwxyz', 10)
+// 'abcd...xyz'

_replaceAll

Polyfill for String.prototype.replaceAll.

Based on regex implementation (slightly faster than "split/join" implementation).

_nl2br

Converts \\n (aka new-line) to <br>, to be presented in HTML.

Keeps \\n, so if it's printed in non-HTML environment it still looks ok-ish.

_parseQueryString

Parses location.search string (e.g ?a=1&b=2) into a StringMap, e.g: { a: '1', b: '2' }

Pass location.search to it in the Frontend, or any other string on the Backend (where location.search is not available).

Works both with and without leading ? character.

Yes, there's URLSearchParams existing in the Frontend (not in Node yet), but it's API is not as convenient. And the implementation here is super-small.

Goal of this function is to produce exactly same output as URLSearchParams would.

ts
// Assuming url is http://example.com?a=1&b=2
+
+_parseQueryString(location.search)
+// { a: '1', b: '2' }
`,51)]))}const E=i(n,[["render",l]]);export{g as __pageData,E as default}; diff --git a/assets/style.DKtxVaeI.css b/assets/style.DKtxVaeI.css new file mode 100644 index 00000000..3de26638 --- /dev/null +++ b/assets/style.DKtxVaeI.css @@ -0,0 +1 @@ +#imagesContainer{line-height:0;border:1px solid #888}#imagesContainer img{margin:4px;display:inline-block}.label{display:inline-block;width:160px}input{width:300px}.badges p{display:flex;gap:10px}.app-content button{border:1px solid #aaa;border-radius:4px;background-color:#eee;padding:4px 16px;margin:0 2px;cursor:pointer}.app-content button:hover{background-color:#ddd}.app-content button[disabled]{color:#aaa;cursor:default}.app-content button[disabled]:hover{background-color:#eee}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-cyrillic.C5lxZ8CY.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-greek-ext.CqjqNYQ-.woff2) format("woff2");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-greek.BBVDIX6e.woff2) format("woff2");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-vietnamese.BjW4sHH5.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-latin-ext.4ZJIpNVo.woff2) format("woff2");unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-roman-latin.Di8DUHzh.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-cyrillic-ext.r48I6akx.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-cyrillic.By2_1cv3.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-greek-ext.1u6EdAuj.woff2) format("woff2");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-greek.DJ8dCoTZ.woff2) format("woff2");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-vietnamese.BSbpV94h.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-latin-ext.CN1xVJS-.woff2) format("woff2");unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter;font-style:italic;font-weight:100 900;font-display:swap;src:url(/js-lib/assets/inter-italic-latin.C2AdPX0b.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Punctuation SC;font-weight:400;src:local("PingFang SC Regular"),local("Noto Sans CJK SC"),local("Microsoft YaHei");unicode-range:U+201C,U+201D,U+2018,U+2019,U+2E3A,U+2014,U+2013,U+2026,U+00B7,U+007E,U+002F}@font-face{font-family:Punctuation SC;font-weight:500;src:local("PingFang SC Medium"),local("Noto Sans CJK SC"),local("Microsoft YaHei");unicode-range:U+201C,U+201D,U+2018,U+2019,U+2E3A,U+2014,U+2013,U+2026,U+00B7,U+007E,U+002F}@font-face{font-family:Punctuation SC;font-weight:600;src:local("PingFang SC Semibold"),local("Noto Sans CJK SC Bold"),local("Microsoft YaHei Bold");unicode-range:U+201C,U+201D,U+2018,U+2019,U+2E3A,U+2014,U+2013,U+2026,U+00B7,U+007E,U+002F}@font-face{font-family:Punctuation SC;font-weight:700;src:local("PingFang SC Semibold"),local("Noto Sans CJK SC Bold"),local("Microsoft YaHei Bold");unicode-range:U+201C,U+201D,U+2018,U+2019,U+2E3A,U+2014,U+2013,U+2026,U+00B7,U+007E,U+002F}:root{--vp-c-white: #ffffff;--vp-c-black: #000000;--vp-c-neutral: var(--vp-c-black);--vp-c-neutral-inverse: var(--vp-c-white)}.dark{--vp-c-neutral: var(--vp-c-white);--vp-c-neutral-inverse: var(--vp-c-black)}:root{--vp-c-gray-1: #dddde3;--vp-c-gray-2: #e4e4e9;--vp-c-gray-3: #ebebef;--vp-c-gray-soft: rgba(142, 150, 170, .14);--vp-c-indigo-1: #3451b2;--vp-c-indigo-2: #3a5ccc;--vp-c-indigo-3: #5672cd;--vp-c-indigo-soft: rgba(100, 108, 255, .14);--vp-c-purple-1: #6f42c1;--vp-c-purple-2: #7e4cc9;--vp-c-purple-3: #8e5cd9;--vp-c-purple-soft: rgba(159, 122, 234, .14);--vp-c-green-1: #18794e;--vp-c-green-2: #299764;--vp-c-green-3: #30a46c;--vp-c-green-soft: rgba(16, 185, 129, .14);--vp-c-yellow-1: #915930;--vp-c-yellow-2: #946300;--vp-c-yellow-3: #9f6a00;--vp-c-yellow-soft: rgba(234, 179, 8, .14);--vp-c-red-1: #b8272c;--vp-c-red-2: #d5393e;--vp-c-red-3: #e0575b;--vp-c-red-soft: rgba(244, 63, 94, .14);--vp-c-sponsor: #db2777}.dark{--vp-c-gray-1: #515c67;--vp-c-gray-2: #414853;--vp-c-gray-3: #32363f;--vp-c-gray-soft: rgba(101, 117, 133, .16);--vp-c-indigo-1: #a8b1ff;--vp-c-indigo-2: #5c73e7;--vp-c-indigo-3: #3e63dd;--vp-c-indigo-soft: rgba(100, 108, 255, .16);--vp-c-purple-1: #c8abfa;--vp-c-purple-2: #a879e6;--vp-c-purple-3: #8e5cd9;--vp-c-purple-soft: rgba(159, 122, 234, .16);--vp-c-green-1: #3dd68c;--vp-c-green-2: #30a46c;--vp-c-green-3: #298459;--vp-c-green-soft: rgba(16, 185, 129, .16);--vp-c-yellow-1: #f9b44e;--vp-c-yellow-2: #da8b17;--vp-c-yellow-3: #a46a0a;--vp-c-yellow-soft: rgba(234, 179, 8, .16);--vp-c-red-1: #f66f81;--vp-c-red-2: #f14158;--vp-c-red-3: #b62a3c;--vp-c-red-soft: rgba(244, 63, 94, .16)}:root{--vp-c-bg: #ffffff;--vp-c-bg-alt: #f6f6f7;--vp-c-bg-elv: #ffffff;--vp-c-bg-soft: #f6f6f7}.dark{--vp-c-bg: #1b1b1f;--vp-c-bg-alt: #161618;--vp-c-bg-elv: #202127;--vp-c-bg-soft: #202127}:root{--vp-c-border: #c2c2c4;--vp-c-divider: #e2e2e3;--vp-c-gutter: #e2e2e3}.dark{--vp-c-border: #3c3f44;--vp-c-divider: #2e2e32;--vp-c-gutter: #000000}:root{--vp-c-text-1: rgba(60, 60, 67);--vp-c-text-2: rgba(60, 60, 67, .78);--vp-c-text-3: rgba(60, 60, 67, .56)}.dark{--vp-c-text-1: rgba(255, 255, 245, .86);--vp-c-text-2: rgba(235, 235, 245, .6);--vp-c-text-3: rgba(235, 235, 245, .38)}:root{--vp-c-default-1: var(--vp-c-gray-1);--vp-c-default-2: var(--vp-c-gray-2);--vp-c-default-3: var(--vp-c-gray-3);--vp-c-default-soft: var(--vp-c-gray-soft);--vp-c-brand-1: var(--vp-c-indigo-1);--vp-c-brand-2: var(--vp-c-indigo-2);--vp-c-brand-3: var(--vp-c-indigo-3);--vp-c-brand-soft: var(--vp-c-indigo-soft);--vp-c-brand: var(--vp-c-brand-1);--vp-c-tip-1: var(--vp-c-brand-1);--vp-c-tip-2: var(--vp-c-brand-2);--vp-c-tip-3: var(--vp-c-brand-3);--vp-c-tip-soft: var(--vp-c-brand-soft);--vp-c-note-1: var(--vp-c-brand-1);--vp-c-note-2: var(--vp-c-brand-2);--vp-c-note-3: var(--vp-c-brand-3);--vp-c-note-soft: var(--vp-c-brand-soft);--vp-c-success-1: var(--vp-c-green-1);--vp-c-success-2: var(--vp-c-green-2);--vp-c-success-3: var(--vp-c-green-3);--vp-c-success-soft: var(--vp-c-green-soft);--vp-c-important-1: var(--vp-c-purple-1);--vp-c-important-2: var(--vp-c-purple-2);--vp-c-important-3: var(--vp-c-purple-3);--vp-c-important-soft: var(--vp-c-purple-soft);--vp-c-warning-1: var(--vp-c-yellow-1);--vp-c-warning-2: var(--vp-c-yellow-2);--vp-c-warning-3: var(--vp-c-yellow-3);--vp-c-warning-soft: var(--vp-c-yellow-soft);--vp-c-danger-1: var(--vp-c-red-1);--vp-c-danger-2: var(--vp-c-red-2);--vp-c-danger-3: var(--vp-c-red-3);--vp-c-danger-soft: var(--vp-c-red-soft);--vp-c-caution-1: var(--vp-c-red-1);--vp-c-caution-2: var(--vp-c-red-2);--vp-c-caution-3: var(--vp-c-red-3);--vp-c-caution-soft: var(--vp-c-red-soft)}:root{--vp-font-family-base: "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--vp-font-family-mono: ui-monospace, "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;font-optical-sizing:auto}:root:where(:lang(zh)){--vp-font-family-base: "Punctuation SC", "Inter", ui-sans-serif, system-ui, "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "Heiti SC", "Microsoft YaHei", "DengXian", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}:root{--vp-shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);--vp-shadow-2: 0 3px 12px rgba(0, 0, 0, .07), 0 1px 4px rgba(0, 0, 0, .07);--vp-shadow-3: 0 12px 32px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .08);--vp-shadow-4: 0 14px 44px rgba(0, 0, 0, .12), 0 3px 9px rgba(0, 0, 0, .12);--vp-shadow-5: 0 18px 56px rgba(0, 0, 0, .16), 0 4px 12px rgba(0, 0, 0, .16)}:root{--vp-z-index-footer: 10;--vp-z-index-local-nav: 20;--vp-z-index-nav: 30;--vp-z-index-layout-top: 40;--vp-z-index-backdrop: 50;--vp-z-index-sidebar: 60}@media (min-width: 960px){:root{--vp-z-index-sidebar: 25}}:root{--vp-layout-max-width: 1440px}:root{--vp-header-anchor-symbol: "#"}:root{--vp-code-line-height: 1.7;--vp-code-font-size: .875em;--vp-code-color: var(--vp-c-brand-1);--vp-code-link-color: var(--vp-c-brand-1);--vp-code-link-hover-color: var(--vp-c-brand-2);--vp-code-bg: var(--vp-c-default-soft);--vp-code-block-color: var(--vp-c-text-2);--vp-code-block-bg: var(--vp-c-bg-alt);--vp-code-block-divider-color: var(--vp-c-gutter);--vp-code-lang-color: var(--vp-c-text-3);--vp-code-line-highlight-color: var(--vp-c-default-soft);--vp-code-line-number-color: var(--vp-c-text-3);--vp-code-line-diff-add-color: var(--vp-c-success-soft);--vp-code-line-diff-add-symbol-color: var(--vp-c-success-1);--vp-code-line-diff-remove-color: var(--vp-c-danger-soft);--vp-code-line-diff-remove-symbol-color: var(--vp-c-danger-1);--vp-code-line-warning-color: var(--vp-c-warning-soft);--vp-code-line-error-color: var(--vp-c-danger-soft);--vp-code-copy-code-border-color: var(--vp-c-divider);--vp-code-copy-code-bg: var(--vp-c-bg-soft);--vp-code-copy-code-hover-border-color: var(--vp-c-divider);--vp-code-copy-code-hover-bg: var(--vp-c-bg);--vp-code-copy-code-active-text: var(--vp-c-text-2);--vp-code-copy-copied-text-content: "Copied";--vp-code-tab-divider: var(--vp-code-block-divider-color);--vp-code-tab-text-color: var(--vp-c-text-2);--vp-code-tab-bg: var(--vp-code-block-bg);--vp-code-tab-hover-text-color: var(--vp-c-text-1);--vp-code-tab-active-text-color: var(--vp-c-text-1);--vp-code-tab-active-bar-color: var(--vp-c-brand-1)}:root{--vp-button-brand-border: transparent;--vp-button-brand-text: var(--vp-c-white);--vp-button-brand-bg: var(--vp-c-brand-3);--vp-button-brand-hover-border: transparent;--vp-button-brand-hover-text: var(--vp-c-white);--vp-button-brand-hover-bg: var(--vp-c-brand-2);--vp-button-brand-active-border: transparent;--vp-button-brand-active-text: var(--vp-c-white);--vp-button-brand-active-bg: var(--vp-c-brand-1);--vp-button-alt-border: transparent;--vp-button-alt-text: var(--vp-c-text-1);--vp-button-alt-bg: var(--vp-c-default-3);--vp-button-alt-hover-border: transparent;--vp-button-alt-hover-text: var(--vp-c-text-1);--vp-button-alt-hover-bg: var(--vp-c-default-2);--vp-button-alt-active-border: transparent;--vp-button-alt-active-text: var(--vp-c-text-1);--vp-button-alt-active-bg: var(--vp-c-default-1);--vp-button-sponsor-border: var(--vp-c-text-2);--vp-button-sponsor-text: var(--vp-c-text-2);--vp-button-sponsor-bg: transparent;--vp-button-sponsor-hover-border: var(--vp-c-sponsor);--vp-button-sponsor-hover-text: var(--vp-c-sponsor);--vp-button-sponsor-hover-bg: transparent;--vp-button-sponsor-active-border: var(--vp-c-sponsor);--vp-button-sponsor-active-text: var(--vp-c-sponsor);--vp-button-sponsor-active-bg: transparent}:root{--vp-custom-block-font-size: 14px;--vp-custom-block-code-font-size: 13px;--vp-custom-block-info-border: transparent;--vp-custom-block-info-text: var(--vp-c-text-1);--vp-custom-block-info-bg: var(--vp-c-default-soft);--vp-custom-block-info-code-bg: var(--vp-c-default-soft);--vp-custom-block-note-border: transparent;--vp-custom-block-note-text: var(--vp-c-text-1);--vp-custom-block-note-bg: var(--vp-c-default-soft);--vp-custom-block-note-code-bg: var(--vp-c-default-soft);--vp-custom-block-tip-border: transparent;--vp-custom-block-tip-text: var(--vp-c-text-1);--vp-custom-block-tip-bg: var(--vp-c-tip-soft);--vp-custom-block-tip-code-bg: var(--vp-c-tip-soft);--vp-custom-block-important-border: transparent;--vp-custom-block-important-text: var(--vp-c-text-1);--vp-custom-block-important-bg: var(--vp-c-important-soft);--vp-custom-block-important-code-bg: var(--vp-c-important-soft);--vp-custom-block-warning-border: transparent;--vp-custom-block-warning-text: var(--vp-c-text-1);--vp-custom-block-warning-bg: var(--vp-c-warning-soft);--vp-custom-block-warning-code-bg: var(--vp-c-warning-soft);--vp-custom-block-danger-border: transparent;--vp-custom-block-danger-text: var(--vp-c-text-1);--vp-custom-block-danger-bg: var(--vp-c-danger-soft);--vp-custom-block-danger-code-bg: var(--vp-c-danger-soft);--vp-custom-block-caution-border: transparent;--vp-custom-block-caution-text: var(--vp-c-text-1);--vp-custom-block-caution-bg: var(--vp-c-caution-soft);--vp-custom-block-caution-code-bg: var(--vp-c-caution-soft);--vp-custom-block-details-border: var(--vp-custom-block-info-border);--vp-custom-block-details-text: var(--vp-custom-block-info-text);--vp-custom-block-details-bg: var(--vp-custom-block-info-bg);--vp-custom-block-details-code-bg: var(--vp-custom-block-info-code-bg)}:root{--vp-input-border-color: var(--vp-c-border);--vp-input-bg-color: var(--vp-c-bg-alt);--vp-input-switch-bg-color: var(--vp-c-default-soft)}:root{--vp-nav-height: 64px;--vp-nav-bg-color: var(--vp-c-bg);--vp-nav-screen-bg-color: var(--vp-c-bg);--vp-nav-logo-height: 24px}.hide-nav{--vp-nav-height: 0px}.hide-nav .VPSidebar{--vp-nav-height: 22px}:root{--vp-local-nav-bg-color: var(--vp-c-bg)}:root{--vp-sidebar-width: 272px;--vp-sidebar-bg-color: var(--vp-c-bg-alt)}:root{--vp-backdrop-bg-color: rgba(0, 0, 0, .6)}:root{--vp-home-hero-name-color: var(--vp-c-brand-1);--vp-home-hero-name-background: transparent;--vp-home-hero-image-background-image: none;--vp-home-hero-image-filter: none}:root{--vp-badge-info-border: transparent;--vp-badge-info-text: var(--vp-c-text-2);--vp-badge-info-bg: var(--vp-c-default-soft);--vp-badge-tip-border: transparent;--vp-badge-tip-text: var(--vp-c-tip-1);--vp-badge-tip-bg: var(--vp-c-tip-soft);--vp-badge-warning-border: transparent;--vp-badge-warning-text: var(--vp-c-warning-1);--vp-badge-warning-bg: var(--vp-c-warning-soft);--vp-badge-danger-border: transparent;--vp-badge-danger-text: var(--vp-c-danger-1);--vp-badge-danger-bg: var(--vp-c-danger-soft)}:root{--vp-carbon-ads-text-color: var(--vp-c-text-1);--vp-carbon-ads-poweredby-color: var(--vp-c-text-2);--vp-carbon-ads-bg-color: var(--vp-c-bg-soft);--vp-carbon-ads-hover-text-color: var(--vp-c-brand-1);--vp-carbon-ads-hover-poweredby-color: var(--vp-c-text-1)}:root{--vp-local-search-bg: var(--vp-c-bg);--vp-local-search-result-bg: var(--vp-c-bg);--vp-local-search-result-border: var(--vp-c-divider);--vp-local-search-result-selected-bg: var(--vp-c-bg);--vp-local-search-result-selected-border: var(--vp-c-brand-1);--vp-local-search-highlight-bg: var(--vp-c-brand-1);--vp-local-search-highlight-text: var(--vp-c-neutral-inverse)}@media (prefers-reduced-motion: reduce){*,:before,:after{animation-delay:-1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important;background-attachment:initial!important;scroll-behavior:auto!important;transition-duration:0s!important;transition-delay:0s!important}}*,:before,:after{box-sizing:border-box}html{line-height:1.4;font-size:16px;-webkit-text-size-adjust:100%}html.dark{color-scheme:dark}body{margin:0;width:100%;min-width:320px;min-height:100vh;line-height:24px;font-family:var(--vp-font-family-base);font-size:16px;font-weight:400;color:var(--vp-c-text-1);background-color:var(--vp-c-bg);font-synthesis:style;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}main{display:block}h1,h2,h3,h4,h5,h6{margin:0;line-height:24px;font-size:16px;font-weight:400}p{margin:0}strong,b{font-weight:600}a,area,button,[role=button],input,label,select,summary,textarea{touch-action:manipulation}a{color:inherit;text-decoration:inherit}ol,ul{list-style:none;margin:0;padding:0}blockquote{margin:0}pre,code,kbd,samp{font-family:var(--vp-font-family-mono)}img,svg,video,canvas,audio,iframe,embed,object{display:block}figure{margin:0}img,video{max-width:100%;height:auto}button,input,optgroup,select,textarea{border:0;padding:0;line-height:inherit;color:inherit}button{padding:0;font-family:inherit;background-color:transparent;background-image:none}button:enabled,[role=button]:enabled{cursor:pointer}button:focus,button:focus-visible{outline:1px dotted;outline:4px auto -webkit-focus-ring-color}button:focus:not(:focus-visible){outline:none!important}input:focus,textarea:focus,select:focus{outline:none}table{border-collapse:collapse}input{background-color:transparent}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:var(--vp-c-text-3)}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:var(--vp-c-text-3)}input::placeholder,textarea::placeholder{color:var(--vp-c-text-3)}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}textarea{resize:vertical}select{-webkit-appearance:none}fieldset{margin:0;padding:0}h1,h2,h3,h4,h5,h6,li,p{overflow-wrap:break-word}vite-error-overlay{z-index:9999}mjx-container{overflow-x:auto}mjx-container>svg{display:inline-block;margin:auto}[class^=vpi-],[class*=" vpi-"],.vp-icon{width:1em;height:1em}[class^=vpi-].bg,[class*=" vpi-"].bg,.vp-icon.bg{background-size:100% 100%;background-color:transparent}[class^=vpi-]:not(.bg),[class*=" vpi-"]:not(.bg),.vp-icon:not(.bg){-webkit-mask:var(--icon) no-repeat;mask:var(--icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit}.vpi-align-left{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M21 6H3M15 12H3M17 18H3'/%3E%3C/svg%3E")}.vpi-arrow-right,.vpi-arrow-down,.vpi-arrow-left,.vpi-arrow-up{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E")}.vpi-chevron-right,.vpi-chevron-down,.vpi-chevron-left,.vpi-chevron-up{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")}.vpi-chevron-down,.vpi-arrow-down{transform:rotate(90deg)}.vpi-chevron-left,.vpi-arrow-left{transform:rotate(180deg)}.vpi-chevron-up,.vpi-arrow-up{transform:rotate(-90deg)}.vpi-square-pen{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z'/%3E%3C/svg%3E")}.vpi-plus{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14M12 5v14'/%3E%3C/svg%3E")}.vpi-sun{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/svg%3E")}.vpi-moon{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E")}.vpi-more-horizontal{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/svg%3E")}.vpi-languages{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m5 8 6 6M4 14l6-6 2-3M2 5h12M7 2h1M22 22l-5-10-5 10M14 18h6'/%3E%3C/svg%3E")}.vpi-heart{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E")}.vpi-search{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E")}.vpi-layout-list{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='7' height='7' x='3' y='3' rx='1'/%3E%3Crect width='7' height='7' x='3' y='14' rx='1'/%3E%3Cpath d='M14 4h7M14 9h7M14 15h7M14 20h7'/%3E%3C/svg%3E")}.vpi-delete{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M20 5H9l-7 7 7 7h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2ZM18 9l-6 6M12 9l6 6'/%3E%3C/svg%3E")}.vpi-corner-down-left{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 10-5 5 5 5'/%3E%3Cpath d='M20 4v7a4 4 0 0 1-4 4H4'/%3E%3C/svg%3E")}:root{--vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/svg%3E");--vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='m9 14 2 2 4-4'/%3E%3C/svg%3E")}.vpi-social-discord{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418Z'/%3E%3C/svg%3E")}.vpi-social-facebook{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z'/%3E%3C/svg%3E")}.vpi-social-github{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")}.vpi-social-instagram{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.03.084c-1.277.06-2.149.264-2.91.563a5.874 5.874 0 0 0-2.124 1.388 5.878 5.878 0 0 0-1.38 2.127C.321 4.926.12 5.8.064 7.076.008 8.354-.005 8.764.001 12.023c.007 3.259.021 3.667.083 4.947.061 1.277.264 2.149.563 2.911.308.789.72 1.457 1.388 2.123a5.872 5.872 0 0 0 2.129 1.38c.763.295 1.636.496 2.913.552 1.278.056 1.689.069 4.947.063 3.257-.007 3.668-.021 4.947-.082 1.28-.06 2.147-.265 2.91-.563a5.881 5.881 0 0 0 2.123-1.388 5.881 5.881 0 0 0 1.38-2.129c.295-.763.496-1.636.551-2.912.056-1.28.07-1.69.063-4.948-.006-3.258-.02-3.667-.081-4.947-.06-1.28-.264-2.148-.564-2.911a5.892 5.892 0 0 0-1.387-2.123 5.857 5.857 0 0 0-2.128-1.38C19.074.322 18.202.12 16.924.066 15.647.009 15.236-.006 11.977 0 8.718.008 8.31.021 7.03.084m.14 21.693c-1.17-.05-1.805-.245-2.228-.408a3.736 3.736 0 0 1-1.382-.895 3.695 3.695 0 0 1-.9-1.378c-.165-.423-.363-1.058-.417-2.228-.06-1.264-.072-1.644-.08-4.848-.006-3.204.006-3.583.061-4.848.05-1.169.246-1.805.408-2.228.216-.561.477-.96.895-1.382a3.705 3.705 0 0 1 1.379-.9c.423-.165 1.057-.361 2.227-.417 1.265-.06 1.644-.072 4.848-.08 3.203-.006 3.583.006 4.85.062 1.168.05 1.804.244 2.227.408.56.216.96.475 1.382.895.421.42.681.817.9 1.378.165.422.362 1.056.417 2.227.06 1.265.074 1.645.08 4.848.005 3.203-.006 3.583-.061 4.848-.051 1.17-.245 1.805-.408 2.23-.216.56-.477.96-.896 1.38a3.705 3.705 0 0 1-1.378.9c-.422.165-1.058.362-2.226.418-1.266.06-1.645.072-4.85.079-3.204.007-3.582-.006-4.848-.06m9.783-16.192a1.44 1.44 0 1 0 1.437-1.442 1.44 1.44 0 0 0-1.437 1.442M5.839 12.012a6.161 6.161 0 1 0 12.323-.024 6.162 6.162 0 0 0-12.323.024M8 12.008A4 4 0 1 1 12.008 16 4 4 0 0 1 8 12.008'/%3E%3C/svg%3E")}.vpi-social-linkedin{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z'/%3E%3C/svg%3E")}.vpi-social-mastodon{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z'/%3E%3C/svg%3E")}.vpi-social-npm{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z'/%3E%3C/svg%3E")}.vpi-social-slack{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.122 2.521a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.268 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zm-2.523 10.122a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.268a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z'/%3E%3C/svg%3E")}.vpi-social-twitter,.vpi-social-x{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z'/%3E%3C/svg%3E")}.vpi-social-youtube{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z'/%3E%3C/svg%3E")}.visually-hidden{position:absolute;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden}.custom-block{border:1px solid transparent;border-radius:8px;padding:16px 16px 8px;line-height:24px;font-size:var(--vp-custom-block-font-size);color:var(--vp-c-text-2)}.custom-block.info{border-color:var(--vp-custom-block-info-border);color:var(--vp-custom-block-info-text);background-color:var(--vp-custom-block-info-bg)}.custom-block.info a,.custom-block.info code{color:var(--vp-c-brand-1)}.custom-block.info a:hover,.custom-block.info a:hover>code{color:var(--vp-c-brand-2)}.custom-block.info code{background-color:var(--vp-custom-block-info-code-bg)}.custom-block.note{border-color:var(--vp-custom-block-note-border);color:var(--vp-custom-block-note-text);background-color:var(--vp-custom-block-note-bg)}.custom-block.note a,.custom-block.note code{color:var(--vp-c-brand-1)}.custom-block.note a:hover,.custom-block.note a:hover>code{color:var(--vp-c-brand-2)}.custom-block.note code{background-color:var(--vp-custom-block-note-code-bg)}.custom-block.tip{border-color:var(--vp-custom-block-tip-border);color:var(--vp-custom-block-tip-text);background-color:var(--vp-custom-block-tip-bg)}.custom-block.tip a,.custom-block.tip code{color:var(--vp-c-tip-1)}.custom-block.tip a:hover,.custom-block.tip a:hover>code{color:var(--vp-c-tip-2)}.custom-block.tip code{background-color:var(--vp-custom-block-tip-code-bg)}.custom-block.important{border-color:var(--vp-custom-block-important-border);color:var(--vp-custom-block-important-text);background-color:var(--vp-custom-block-important-bg)}.custom-block.important a,.custom-block.important code{color:var(--vp-c-important-1)}.custom-block.important a:hover,.custom-block.important a:hover>code{color:var(--vp-c-important-2)}.custom-block.important code{background-color:var(--vp-custom-block-important-code-bg)}.custom-block.warning{border-color:var(--vp-custom-block-warning-border);color:var(--vp-custom-block-warning-text);background-color:var(--vp-custom-block-warning-bg)}.custom-block.warning a,.custom-block.warning code{color:var(--vp-c-warning-1)}.custom-block.warning a:hover,.custom-block.warning a:hover>code{color:var(--vp-c-warning-2)}.custom-block.warning code{background-color:var(--vp-custom-block-warning-code-bg)}.custom-block.danger{border-color:var(--vp-custom-block-danger-border);color:var(--vp-custom-block-danger-text);background-color:var(--vp-custom-block-danger-bg)}.custom-block.danger a,.custom-block.danger code{color:var(--vp-c-danger-1)}.custom-block.danger a:hover,.custom-block.danger a:hover>code{color:var(--vp-c-danger-2)}.custom-block.danger code{background-color:var(--vp-custom-block-danger-code-bg)}.custom-block.caution{border-color:var(--vp-custom-block-caution-border);color:var(--vp-custom-block-caution-text);background-color:var(--vp-custom-block-caution-bg)}.custom-block.caution a,.custom-block.caution code{color:var(--vp-c-caution-1)}.custom-block.caution a:hover,.custom-block.caution a:hover>code{color:var(--vp-c-caution-2)}.custom-block.caution code{background-color:var(--vp-custom-block-caution-code-bg)}.custom-block.details{border-color:var(--vp-custom-block-details-border);color:var(--vp-custom-block-details-text);background-color:var(--vp-custom-block-details-bg)}.custom-block.details a{color:var(--vp-c-brand-1)}.custom-block.details a:hover,.custom-block.details a:hover>code{color:var(--vp-c-brand-2)}.custom-block.details code{background-color:var(--vp-custom-block-details-code-bg)}.custom-block-title{font-weight:600}.custom-block p+p{margin:8px 0}.custom-block.details summary{margin:0 0 8px;font-weight:700;cursor:pointer;-webkit-user-select:none;user-select:none}.custom-block.details summary+p{margin:8px 0}.custom-block a{color:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;transition:opacity .25s}.custom-block a:hover{opacity:.75}.custom-block code{font-size:var(--vp-custom-block-code-font-size)}.custom-block.custom-block th,.custom-block.custom-block blockquote>p{font-size:var(--vp-custom-block-font-size);color:inherit}.dark .vp-code span{color:var(--shiki-dark, inherit)}html:not(.dark) .vp-code span{color:var(--shiki-light, inherit)}.vp-code-group{margin-top:16px}.vp-code-group .tabs{position:relative;display:flex;margin-right:-24px;margin-left:-24px;padding:0 12px;background-color:var(--vp-code-tab-bg);overflow-x:auto;overflow-y:hidden;box-shadow:inset 0 -1px var(--vp-code-tab-divider)}@media (min-width: 640px){.vp-code-group .tabs{margin-right:0;margin-left:0;border-radius:8px 8px 0 0}}.vp-code-group .tabs input{position:fixed;opacity:0;pointer-events:none}.vp-code-group .tabs label{position:relative;display:inline-block;border-bottom:1px solid transparent;padding:0 12px;line-height:48px;font-size:14px;font-weight:500;color:var(--vp-code-tab-text-color);white-space:nowrap;cursor:pointer;transition:color .25s}.vp-code-group .tabs label:after{position:absolute;right:8px;bottom:-1px;left:8px;z-index:1;height:2px;border-radius:2px;content:"";background-color:transparent;transition:background-color .25s}.vp-code-group label:hover{color:var(--vp-code-tab-hover-text-color)}.vp-code-group input:checked+label{color:var(--vp-code-tab-active-text-color)}.vp-code-group input:checked+label:after{background-color:var(--vp-code-tab-active-bar-color)}.vp-code-group div[class*=language-],.vp-block{display:none;margin-top:0!important;border-top-left-radius:0!important;border-top-right-radius:0!important}.vp-code-group div[class*=language-].active,.vp-block.active{display:block}.vp-block{padding:20px 24px}.vp-doc h1,.vp-doc h2,.vp-doc h3,.vp-doc h4,.vp-doc h5,.vp-doc h6{position:relative;font-weight:600;outline:none}.vp-doc h1{letter-spacing:-.02em;line-height:40px;font-size:28px}.vp-doc h2{margin:48px 0 16px;border-top:1px solid var(--vp-c-divider);padding-top:24px;letter-spacing:-.02em;line-height:32px;font-size:24px}.vp-doc h3{margin:32px 0 0;letter-spacing:-.01em;line-height:28px;font-size:20px}.vp-doc h4{margin:24px 0 0;letter-spacing:-.01em;line-height:24px;font-size:18px}.vp-doc .header-anchor{position:absolute;top:0;left:0;margin-left:-.87em;font-weight:500;-webkit-user-select:none;user-select:none;opacity:0;text-decoration:none;transition:color .25s,opacity .25s}.vp-doc .header-anchor:before{content:var(--vp-header-anchor-symbol)}.vp-doc h1:hover .header-anchor,.vp-doc h1 .header-anchor:focus,.vp-doc h2:hover .header-anchor,.vp-doc h2 .header-anchor:focus,.vp-doc h3:hover .header-anchor,.vp-doc h3 .header-anchor:focus,.vp-doc h4:hover .header-anchor,.vp-doc h4 .header-anchor:focus,.vp-doc h5:hover .header-anchor,.vp-doc h5 .header-anchor:focus,.vp-doc h6:hover .header-anchor,.vp-doc h6 .header-anchor:focus{opacity:1}@media (min-width: 768px){.vp-doc h1{letter-spacing:-.02em;line-height:40px;font-size:32px}}.vp-doc h2 .header-anchor{top:24px}.vp-doc p,.vp-doc summary{margin:16px 0}.vp-doc p{line-height:28px}.vp-doc blockquote{margin:16px 0;border-left:2px solid var(--vp-c-divider);padding-left:16px;transition:border-color .5s;color:var(--vp-c-text-2)}.vp-doc blockquote>p{margin:0;font-size:16px;transition:color .5s}.vp-doc a{font-weight:500;color:var(--vp-c-brand-1);text-decoration:underline;text-underline-offset:2px;transition:color .25s,opacity .25s}.vp-doc a:hover{color:var(--vp-c-brand-2)}.vp-doc strong{font-weight:600}.vp-doc ul,.vp-doc ol{padding-left:1.25rem;margin:16px 0}.vp-doc ul{list-style:disc}.vp-doc ol{list-style:decimal}.vp-doc li+li{margin-top:8px}.vp-doc li>ol,.vp-doc li>ul{margin:8px 0 0}.vp-doc table{display:block;border-collapse:collapse;margin:20px 0;overflow-x:auto}.vp-doc tr{background-color:var(--vp-c-bg);border-top:1px solid var(--vp-c-divider);transition:background-color .5s}.vp-doc tr:nth-child(2n){background-color:var(--vp-c-bg-soft)}.vp-doc th,.vp-doc td{border:1px solid var(--vp-c-divider);padding:8px 16px}.vp-doc th{text-align:left;font-size:14px;font-weight:600;color:var(--vp-c-text-2);background-color:var(--vp-c-bg-soft)}.vp-doc td{font-size:14px}.vp-doc hr{margin:16px 0;border:none;border-top:1px solid var(--vp-c-divider)}.vp-doc .custom-block{margin:16px 0}.vp-doc .custom-block p{margin:8px 0;line-height:24px}.vp-doc .custom-block p:first-child{margin:0}.vp-doc .custom-block div[class*=language-]{margin:8px 0;border-radius:8px}.vp-doc .custom-block div[class*=language-] code{font-weight:400;background-color:transparent}.vp-doc .custom-block .vp-code-group .tabs{margin:0;border-radius:8px 8px 0 0}.vp-doc :not(pre,h1,h2,h3,h4,h5,h6)>code{font-size:var(--vp-code-font-size);color:var(--vp-code-color)}.vp-doc :not(pre)>code{border-radius:4px;padding:3px 6px;background-color:var(--vp-code-bg);transition:color .25s,background-color .5s}.vp-doc a>code{color:var(--vp-code-link-color)}.vp-doc a:hover>code{color:var(--vp-code-link-hover-color)}.vp-doc h1>code,.vp-doc h2>code,.vp-doc h3>code,.vp-doc h4>code{font-size:.9em}.vp-doc div[class*=language-],.vp-block{position:relative;margin:16px -24px;background-color:var(--vp-code-block-bg);overflow-x:auto;transition:background-color .5s}@media (min-width: 640px){.vp-doc div[class*=language-],.vp-block{border-radius:8px;margin:16px 0}}@media (max-width: 639px){.vp-doc li div[class*=language-]{border-radius:8px 0 0 8px}}.vp-doc div[class*=language-]+div[class*=language-],.vp-doc div[class$=-api]+div[class*=language-],.vp-doc div[class*=language-]+div[class$=-api]>div[class*=language-]{margin-top:-8px}.vp-doc [class*=language-] pre,.vp-doc [class*=language-] code{direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}.vp-doc [class*=language-] pre{position:relative;z-index:1;margin:0;padding:20px 0;background:transparent;overflow-x:auto}.vp-doc [class*=language-] code{display:block;padding:0 24px;width:fit-content;min-width:100%;line-height:var(--vp-code-line-height);font-size:var(--vp-code-font-size);color:var(--vp-code-block-color);transition:color .5s}.vp-doc [class*=language-] code .highlighted{background-color:var(--vp-code-line-highlight-color);transition:background-color .5s;margin:0 -24px;padding:0 24px;width:calc(100% + 48px);display:inline-block}.vp-doc [class*=language-] code .highlighted.error{background-color:var(--vp-code-line-error-color)}.vp-doc [class*=language-] code .highlighted.warning{background-color:var(--vp-code-line-warning-color)}.vp-doc [class*=language-] code .diff{transition:background-color .5s;margin:0 -24px;padding:0 24px;width:calc(100% + 48px);display:inline-block}.vp-doc [class*=language-] code .diff:before{position:absolute;left:10px}.vp-doc [class*=language-] .has-focused-lines .line:not(.has-focus){filter:blur(.095rem);opacity:.4;transition:filter .35s,opacity .35s}.vp-doc [class*=language-] .has-focused-lines .line:not(.has-focus){opacity:.7;transition:filter .35s,opacity .35s}.vp-doc [class*=language-]:hover .has-focused-lines .line:not(.has-focus){filter:blur(0);opacity:1}.vp-doc [class*=language-] code .diff.remove{background-color:var(--vp-code-line-diff-remove-color);opacity:.7}.vp-doc [class*=language-] code .diff.remove:before{content:"-";color:var(--vp-code-line-diff-remove-symbol-color)}.vp-doc [class*=language-] code .diff.add{background-color:var(--vp-code-line-diff-add-color)}.vp-doc [class*=language-] code .diff.add:before{content:"+";color:var(--vp-code-line-diff-add-symbol-color)}.vp-doc div[class*=language-].line-numbers-mode{padding-left:32px}.vp-doc .line-numbers-wrapper{position:absolute;top:0;bottom:0;left:0;z-index:3;border-right:1px solid var(--vp-code-block-divider-color);padding-top:20px;width:32px;text-align:center;font-family:var(--vp-font-family-mono);line-height:var(--vp-code-line-height);font-size:var(--vp-code-font-size);color:var(--vp-code-line-number-color);transition:border-color .5s,color .5s}.vp-doc [class*=language-]>button.copy{direction:ltr;position:absolute;top:12px;right:12px;z-index:3;border:1px solid var(--vp-code-copy-code-border-color);border-radius:4px;width:40px;height:40px;background-color:var(--vp-code-copy-code-bg);opacity:0;cursor:pointer;background-image:var(--vp-icon-copy);background-position:50%;background-size:20px;background-repeat:no-repeat;transition:border-color .25s,background-color .25s,opacity .25s}.vp-doc [class*=language-]:hover>button.copy,.vp-doc [class*=language-]>button.copy:focus{opacity:1}.vp-doc [class*=language-]>button.copy:hover,.vp-doc [class*=language-]>button.copy.copied{border-color:var(--vp-code-copy-code-hover-border-color);background-color:var(--vp-code-copy-code-hover-bg)}.vp-doc [class*=language-]>button.copy.copied,.vp-doc [class*=language-]>button.copy:hover.copied{border-radius:0 4px 4px 0;background-color:var(--vp-code-copy-code-hover-bg);background-image:var(--vp-icon-copied)}.vp-doc [class*=language-]>button.copy.copied:before,.vp-doc [class*=language-]>button.copy:hover.copied:before{position:relative;top:-1px;transform:translate(calc(-100% - 1px));display:flex;justify-content:center;align-items:center;border:1px solid var(--vp-code-copy-code-hover-border-color);border-right:0;border-radius:4px 0 0 4px;padding:0 10px;width:fit-content;height:40px;text-align:center;font-size:12px;font-weight:500;color:var(--vp-code-copy-code-active-text);background-color:var(--vp-code-copy-code-hover-bg);white-space:nowrap;content:var(--vp-code-copy-copied-text-content)}.vp-doc [class*=language-]>span.lang{position:absolute;top:2px;right:8px;z-index:2;font-size:12px;font-weight:500;color:var(--vp-code-lang-color);transition:color .4s,opacity .4s}.vp-doc [class*=language-]:hover>button.copy+span.lang,.vp-doc [class*=language-]>button.copy:focus+span.lang{opacity:0}.vp-doc .VPTeamMembers{margin-top:24px}.vp-doc .VPTeamMembers.small.count-1 .container{margin:0!important;max-width:calc((100% - 24px)/2)!important}.vp-doc .VPTeamMembers.small.count-2 .container,.vp-doc .VPTeamMembers.small.count-3 .container{max-width:100%!important}.vp-doc .VPTeamMembers.medium.count-1 .container{margin:0!important;max-width:calc((100% - 24px)/2)!important}:is(.vp-external-link-icon,.vp-doc a[href*="://"],.vp-doc a[target=_blank]):not(.no-icon):after{display:inline-block;margin-top:-1px;margin-left:4px;width:11px;height:11px;background:currentColor;color:var(--vp-c-text-3);flex-shrink:0;--icon: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M0 0h24v24H0V0z' fill='none' /%3E%3Cpath d='M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z' /%3E%3C/svg%3E");-webkit-mask-image:var(--icon);mask-image:var(--icon)}.vp-external-link-icon:after{content:""}.external-link-icon-enabled :is(.vp-doc a[href*="://"],.vp-doc a[target=_blank]):after{content:"";color:currentColor}.vp-sponsor{border-radius:16px;overflow:hidden}.vp-sponsor.aside{border-radius:12px}.vp-sponsor-section+.vp-sponsor-section{margin-top:4px}.vp-sponsor-tier{margin:0 0 4px!important;text-align:center;letter-spacing:1px!important;line-height:24px;width:100%;font-weight:600;color:var(--vp-c-text-2);background-color:var(--vp-c-bg-soft)}.vp-sponsor.normal .vp-sponsor-tier{padding:13px 0 11px;font-size:14px}.vp-sponsor.aside .vp-sponsor-tier{padding:9px 0 7px;font-size:12px}.vp-sponsor-grid+.vp-sponsor-tier{margin-top:4px}.vp-sponsor-grid{display:flex;flex-wrap:wrap;gap:4px}.vp-sponsor-grid.xmini .vp-sponsor-grid-link{height:64px}.vp-sponsor-grid.xmini .vp-sponsor-grid-image{max-width:64px;max-height:22px}.vp-sponsor-grid.mini .vp-sponsor-grid-link{height:72px}.vp-sponsor-grid.mini .vp-sponsor-grid-image{max-width:96px;max-height:24px}.vp-sponsor-grid.small .vp-sponsor-grid-link{height:96px}.vp-sponsor-grid.small .vp-sponsor-grid-image{max-width:96px;max-height:24px}.vp-sponsor-grid.medium .vp-sponsor-grid-link{height:112px}.vp-sponsor-grid.medium .vp-sponsor-grid-image{max-width:120px;max-height:36px}.vp-sponsor-grid.big .vp-sponsor-grid-link{height:184px}.vp-sponsor-grid.big .vp-sponsor-grid-image{max-width:192px;max-height:56px}.vp-sponsor-grid[data-vp-grid="2"] .vp-sponsor-grid-item{width:calc((100% - 4px)/2)}.vp-sponsor-grid[data-vp-grid="3"] .vp-sponsor-grid-item{width:calc((100% - 4px * 2) / 3)}.vp-sponsor-grid[data-vp-grid="4"] .vp-sponsor-grid-item{width:calc((100% - 12px)/4)}.vp-sponsor-grid[data-vp-grid="5"] .vp-sponsor-grid-item{width:calc((100% - 16px)/5)}.vp-sponsor-grid[data-vp-grid="6"] .vp-sponsor-grid-item{width:calc((100% - 4px * 5) / 6)}.vp-sponsor-grid-item{flex-shrink:0;width:100%;background-color:var(--vp-c-bg-soft);transition:background-color .25s}.vp-sponsor-grid-item:hover{background-color:var(--vp-c-default-soft)}.vp-sponsor-grid-item:hover .vp-sponsor-grid-image{filter:grayscale(0) invert(0)}.vp-sponsor-grid-item.empty:hover{background-color:var(--vp-c-bg-soft)}.dark .vp-sponsor-grid-item:hover{background-color:var(--vp-c-white)}.dark .vp-sponsor-grid-item.empty:hover{background-color:var(--vp-c-bg-soft)}.vp-sponsor-grid-link{display:flex}.vp-sponsor-grid-box{display:flex;justify-content:center;align-items:center;width:100%}.vp-sponsor-grid-image{max-width:100%;filter:grayscale(1);transition:filter .25s}.dark .vp-sponsor-grid-image{filter:grayscale(1) invert(1)}.VPBadge{display:inline-block;margin-left:2px;border:1px solid transparent;border-radius:12px;padding:0 10px;line-height:22px;font-size:12px;font-weight:500;transform:translateY(-2px)}.VPBadge.small{padding:0 6px;line-height:18px;font-size:10px;transform:translateY(-8px)}.VPDocFooter .VPBadge{display:none}.vp-doc h1>.VPBadge{margin-top:4px;vertical-align:top}.vp-doc h2>.VPBadge{margin-top:3px;padding:0 8px;vertical-align:top}.vp-doc h3>.VPBadge{vertical-align:middle}.vp-doc h4>.VPBadge,.vp-doc h5>.VPBadge,.vp-doc h6>.VPBadge{vertical-align:middle;line-height:18px}.VPBadge.info{border-color:var(--vp-badge-info-border);color:var(--vp-badge-info-text);background-color:var(--vp-badge-info-bg)}.VPBadge.tip{border-color:var(--vp-badge-tip-border);color:var(--vp-badge-tip-text);background-color:var(--vp-badge-tip-bg)}.VPBadge.warning{border-color:var(--vp-badge-warning-border);color:var(--vp-badge-warning-text);background-color:var(--vp-badge-warning-bg)}.VPBadge.danger{border-color:var(--vp-badge-danger-border);color:var(--vp-badge-danger-text);background-color:var(--vp-badge-danger-bg)}.VPBackdrop[data-v-c79a1216]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--vp-z-index-backdrop);background:var(--vp-backdrop-bg-color);transition:opacity .5s}.VPBackdrop.fade-enter-from[data-v-c79a1216],.VPBackdrop.fade-leave-to[data-v-c79a1216]{opacity:0}.VPBackdrop.fade-leave-active[data-v-c79a1216]{transition-duration:.25s}@media (min-width: 1280px){.VPBackdrop[data-v-c79a1216]{display:none}}.NotFound[data-v-d6be1790]{padding:64px 24px 96px;text-align:center}@media (min-width: 768px){.NotFound[data-v-d6be1790]{padding:96px 32px 168px}}.code[data-v-d6be1790]{line-height:64px;font-size:64px;font-weight:600}.title[data-v-d6be1790]{padding-top:12px;letter-spacing:2px;line-height:20px;font-size:20px;font-weight:700}.divider[data-v-d6be1790]{margin:24px auto 18px;width:64px;height:1px;background-color:var(--vp-c-divider)}.quote[data-v-d6be1790]{margin:0 auto;max-width:256px;font-size:14px;font-weight:500;color:var(--vp-c-text-2)}.action[data-v-d6be1790]{padding-top:20px}.link[data-v-d6be1790]{display:inline-block;border:1px solid var(--vp-c-brand-1);border-radius:16px;padding:3px 16px;font-size:14px;font-weight:500;color:var(--vp-c-brand-1);transition:border-color .25s,color .25s}.link[data-v-d6be1790]:hover{border-color:var(--vp-c-brand-2);color:var(--vp-c-brand-2)}.root[data-v-b933a997]{position:relative;z-index:1}.nested[data-v-b933a997]{padding-right:16px;padding-left:16px}.outline-link[data-v-b933a997]{display:block;line-height:32px;font-size:14px;font-weight:400;color:var(--vp-c-text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:color .5s}.outline-link[data-v-b933a997]:hover,.outline-link.active[data-v-b933a997]{color:var(--vp-c-text-1);transition:color .25s}.outline-link.nested[data-v-b933a997]{padding-left:13px}.VPDocAsideOutline[data-v-a5bbad30]{display:none}.VPDocAsideOutline.has-outline[data-v-a5bbad30]{display:block}.content[data-v-a5bbad30]{position:relative;border-left:1px solid var(--vp-c-divider);padding-left:16px;font-size:13px;font-weight:500}.outline-marker[data-v-a5bbad30]{position:absolute;top:32px;left:-1px;z-index:0;opacity:0;width:2px;border-radius:2px;height:18px;background-color:var(--vp-c-brand-1);transition:top .25s cubic-bezier(0,1,.5,1),background-color .5s,opacity .25s}.outline-title[data-v-a5bbad30]{line-height:32px;font-size:14px;font-weight:600}.VPDocAside[data-v-3f215769]{display:flex;flex-direction:column;flex-grow:1}.spacer[data-v-3f215769]{flex-grow:1}.VPDocAside[data-v-3f215769] .spacer+.VPDocAsideSponsors,.VPDocAside[data-v-3f215769] .spacer+.VPDocAsideCarbonAds{margin-top:24px}.VPDocAside[data-v-3f215769] .VPDocAsideSponsors+.VPDocAsideCarbonAds{margin-top:16px}.VPLastUpdated[data-v-e98dd255]{line-height:24px;font-size:14px;font-weight:500;color:var(--vp-c-text-2)}@media (min-width: 640px){.VPLastUpdated[data-v-e98dd255]{line-height:32px;font-size:14px;font-weight:500}}.VPDocFooter[data-v-e257564d]{margin-top:64px}.edit-info[data-v-e257564d]{padding-bottom:18px}@media (min-width: 640px){.edit-info[data-v-e257564d]{display:flex;justify-content:space-between;align-items:center;padding-bottom:14px}}.edit-link-button[data-v-e257564d]{display:flex;align-items:center;border:0;line-height:32px;font-size:14px;font-weight:500;color:var(--vp-c-brand-1);transition:color .25s}.edit-link-button[data-v-e257564d]:hover{color:var(--vp-c-brand-2)}.edit-link-icon[data-v-e257564d]{margin-right:8px}.prev-next[data-v-e257564d]{border-top:1px solid var(--vp-c-divider);padding-top:24px;display:grid;grid-row-gap:8px}@media (min-width: 640px){.prev-next[data-v-e257564d]{grid-template-columns:repeat(2,1fr);grid-column-gap:16px}}.pager-link[data-v-e257564d]{display:block;border:1px solid var(--vp-c-divider);border-radius:8px;padding:11px 16px 13px;width:100%;height:100%;transition:border-color .25s}.pager-link[data-v-e257564d]:hover{border-color:var(--vp-c-brand-1)}.pager-link.next[data-v-e257564d]{margin-left:auto;text-align:right}.desc[data-v-e257564d]{display:block;line-height:20px;font-size:12px;font-weight:500;color:var(--vp-c-text-2)}.title[data-v-e257564d]{display:block;line-height:20px;font-size:14px;font-weight:500;color:var(--vp-c-brand-1);transition:color .25s}.VPDoc[data-v-39a288b8]{padding:32px 24px 96px;width:100%}@media (min-width: 768px){.VPDoc[data-v-39a288b8]{padding:48px 32px 128px}}@media (min-width: 960px){.VPDoc[data-v-39a288b8]{padding:48px 32px 0}.VPDoc:not(.has-sidebar) .container[data-v-39a288b8]{display:flex;justify-content:center;max-width:992px}.VPDoc:not(.has-sidebar) .content[data-v-39a288b8]{max-width:752px}}@media (min-width: 1280px){.VPDoc .container[data-v-39a288b8]{display:flex;justify-content:center}.VPDoc .aside[data-v-39a288b8]{display:block}}@media (min-width: 1440px){.VPDoc:not(.has-sidebar) .content[data-v-39a288b8]{max-width:784px}.VPDoc:not(.has-sidebar) .container[data-v-39a288b8]{max-width:1104px}}.container[data-v-39a288b8]{margin:0 auto;width:100%}.aside[data-v-39a288b8]{position:relative;display:none;order:2;flex-grow:1;padding-left:32px;width:100%;max-width:256px}.left-aside[data-v-39a288b8]{order:1;padding-left:unset;padding-right:32px}.aside-container[data-v-39a288b8]{position:fixed;top:0;padding-top:calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + var(--vp-doc-top-height, 0px) + 48px);width:224px;height:100vh;overflow-x:hidden;overflow-y:auto;scrollbar-width:none}.aside-container[data-v-39a288b8]::-webkit-scrollbar{display:none}.aside-curtain[data-v-39a288b8]{position:fixed;bottom:0;z-index:10;width:224px;height:32px;background:linear-gradient(transparent,var(--vp-c-bg) 70%)}.aside-content[data-v-39a288b8]{display:flex;flex-direction:column;min-height:calc(100vh - (var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px));padding-bottom:32px}.content[data-v-39a288b8]{position:relative;margin:0 auto;width:100%}@media (min-width: 960px){.content[data-v-39a288b8]{padding:0 32px 128px}}@media (min-width: 1280px){.content[data-v-39a288b8]{order:1;margin:0;min-width:640px}}.content-container[data-v-39a288b8]{margin:0 auto}.VPDoc.has-aside .content-container[data-v-39a288b8]{max-width:688px}.VPButton[data-v-fa7799d5]{display:inline-block;border:1px solid transparent;text-align:center;font-weight:600;white-space:nowrap;transition:color .25s,border-color .25s,background-color .25s}.VPButton[data-v-fa7799d5]:active{transition:color .1s,border-color .1s,background-color .1s}.VPButton.medium[data-v-fa7799d5]{border-radius:20px;padding:0 20px;line-height:38px;font-size:14px}.VPButton.big[data-v-fa7799d5]{border-radius:24px;padding:0 24px;line-height:46px;font-size:16px}.VPButton.brand[data-v-fa7799d5]{border-color:var(--vp-button-brand-border);color:var(--vp-button-brand-text);background-color:var(--vp-button-brand-bg)}.VPButton.brand[data-v-fa7799d5]:hover{border-color:var(--vp-button-brand-hover-border);color:var(--vp-button-brand-hover-text);background-color:var(--vp-button-brand-hover-bg)}.VPButton.brand[data-v-fa7799d5]:active{border-color:var(--vp-button-brand-active-border);color:var(--vp-button-brand-active-text);background-color:var(--vp-button-brand-active-bg)}.VPButton.alt[data-v-fa7799d5]{border-color:var(--vp-button-alt-border);color:var(--vp-button-alt-text);background-color:var(--vp-button-alt-bg)}.VPButton.alt[data-v-fa7799d5]:hover{border-color:var(--vp-button-alt-hover-border);color:var(--vp-button-alt-hover-text);background-color:var(--vp-button-alt-hover-bg)}.VPButton.alt[data-v-fa7799d5]:active{border-color:var(--vp-button-alt-active-border);color:var(--vp-button-alt-active-text);background-color:var(--vp-button-alt-active-bg)}.VPButton.sponsor[data-v-fa7799d5]{border-color:var(--vp-button-sponsor-border);color:var(--vp-button-sponsor-text);background-color:var(--vp-button-sponsor-bg)}.VPButton.sponsor[data-v-fa7799d5]:hover{border-color:var(--vp-button-sponsor-hover-border);color:var(--vp-button-sponsor-hover-text);background-color:var(--vp-button-sponsor-hover-bg)}.VPButton.sponsor[data-v-fa7799d5]:active{border-color:var(--vp-button-sponsor-active-border);color:var(--vp-button-sponsor-active-text);background-color:var(--vp-button-sponsor-active-bg)}html:not(.dark) .VPImage.dark[data-v-8426fc1a]{display:none}.dark .VPImage.light[data-v-8426fc1a]{display:none}.VPHero[data-v-303bb580]{margin-top:calc((var(--vp-nav-height) + var(--vp-layout-top-height, 0px)) * -1);padding:calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px) 24px 48px}@media (min-width: 640px){.VPHero[data-v-303bb580]{padding:calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 48px 64px}}@media (min-width: 960px){.VPHero[data-v-303bb580]{padding:calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 64px 64px}}.container[data-v-303bb580]{display:flex;flex-direction:column;margin:0 auto;max-width:1152px}@media (min-width: 960px){.container[data-v-303bb580]{flex-direction:row}}.main[data-v-303bb580]{position:relative;z-index:10;order:2;flex-grow:1;flex-shrink:0}.VPHero.has-image .container[data-v-303bb580]{text-align:center}@media (min-width: 960px){.VPHero.has-image .container[data-v-303bb580]{text-align:left}}@media (min-width: 960px){.main[data-v-303bb580]{order:1;width:calc((100% / 3) * 2)}.VPHero.has-image .main[data-v-303bb580]{max-width:592px}}.name[data-v-303bb580],.text[data-v-303bb580]{max-width:392px;letter-spacing:-.4px;line-height:40px;font-size:32px;font-weight:700;white-space:pre-wrap}.VPHero.has-image .name[data-v-303bb580],.VPHero.has-image .text[data-v-303bb580]{margin:0 auto}.name[data-v-303bb580]{color:var(--vp-home-hero-name-color)}.clip[data-v-303bb580]{background:var(--vp-home-hero-name-background);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:var(--vp-home-hero-name-color)}@media (min-width: 640px){.name[data-v-303bb580],.text[data-v-303bb580]{max-width:576px;line-height:56px;font-size:48px}}@media (min-width: 960px){.name[data-v-303bb580],.text[data-v-303bb580]{line-height:64px;font-size:56px}.VPHero.has-image .name[data-v-303bb580],.VPHero.has-image .text[data-v-303bb580]{margin:0}}.tagline[data-v-303bb580]{padding-top:8px;max-width:392px;line-height:28px;font-size:18px;font-weight:500;white-space:pre-wrap;color:var(--vp-c-text-2)}.VPHero.has-image .tagline[data-v-303bb580]{margin:0 auto}@media (min-width: 640px){.tagline[data-v-303bb580]{padding-top:12px;max-width:576px;line-height:32px;font-size:20px}}@media (min-width: 960px){.tagline[data-v-303bb580]{line-height:36px;font-size:24px}.VPHero.has-image .tagline[data-v-303bb580]{margin:0}}.actions[data-v-303bb580]{display:flex;flex-wrap:wrap;margin:-6px;padding-top:24px}.VPHero.has-image .actions[data-v-303bb580]{justify-content:center}@media (min-width: 640px){.actions[data-v-303bb580]{padding-top:32px}}@media (min-width: 960px){.VPHero.has-image .actions[data-v-303bb580]{justify-content:flex-start}}.action[data-v-303bb580]{flex-shrink:0;padding:6px}.image[data-v-303bb580]{order:1;margin:-76px -24px -48px}@media (min-width: 640px){.image[data-v-303bb580]{margin:-108px -24px -48px}}@media (min-width: 960px){.image[data-v-303bb580]{flex-grow:1;order:2;margin:0;min-height:100%}}.image-container[data-v-303bb580]{position:relative;margin:0 auto;width:320px;height:320px}@media (min-width: 640px){.image-container[data-v-303bb580]{width:392px;height:392px}}@media (min-width: 960px){.image-container[data-v-303bb580]{display:flex;justify-content:center;align-items:center;width:100%;height:100%;transform:translate(-32px,-32px)}}.image-bg[data-v-303bb580]{position:absolute;top:50%;left:50%;border-radius:50%;width:192px;height:192px;background-image:var(--vp-home-hero-image-background-image);filter:var(--vp-home-hero-image-filter);transform:translate(-50%,-50%)}@media (min-width: 640px){.image-bg[data-v-303bb580]{width:256px;height:256px}}@media (min-width: 960px){.image-bg[data-v-303bb580]{width:320px;height:320px}}[data-v-303bb580] .image-src{position:absolute;top:50%;left:50%;max-width:192px;max-height:192px;transform:translate(-50%,-50%)}@media (min-width: 640px){[data-v-303bb580] .image-src{max-width:256px;max-height:256px}}@media (min-width: 960px){[data-v-303bb580] .image-src{max-width:320px;max-height:320px}}.VPFeature[data-v-a3976bdc]{display:block;border:1px solid var(--vp-c-bg-soft);border-radius:12px;height:100%;background-color:var(--vp-c-bg-soft);transition:border-color .25s,background-color .25s}.VPFeature.link[data-v-a3976bdc]:hover{border-color:var(--vp-c-brand-1)}.box[data-v-a3976bdc]{display:flex;flex-direction:column;padding:24px;height:100%}.box[data-v-a3976bdc]>.VPImage{margin-bottom:20px}.icon[data-v-a3976bdc]{display:flex;justify-content:center;align-items:center;margin-bottom:20px;border-radius:6px;background-color:var(--vp-c-default-soft);width:48px;height:48px;font-size:24px;transition:background-color .25s}.title[data-v-a3976bdc]{line-height:24px;font-size:16px;font-weight:600}.details[data-v-a3976bdc]{flex-grow:1;padding-top:8px;line-height:24px;font-size:14px;font-weight:500;color:var(--vp-c-text-2)}.link-text[data-v-a3976bdc]{padding-top:8px}.link-text-value[data-v-a3976bdc]{display:flex;align-items:center;font-size:14px;font-weight:500;color:var(--vp-c-brand-1)}.link-text-icon[data-v-a3976bdc]{margin-left:6px}.VPFeatures[data-v-a6181336]{position:relative;padding:0 24px}@media (min-width: 640px){.VPFeatures[data-v-a6181336]{padding:0 48px}}@media (min-width: 960px){.VPFeatures[data-v-a6181336]{padding:0 64px}}.container[data-v-a6181336]{margin:0 auto;max-width:1152px}.items[data-v-a6181336]{display:flex;flex-wrap:wrap;margin:-8px}.item[data-v-a6181336]{padding:8px;width:100%}@media (min-width: 640px){.item.grid-2[data-v-a6181336],.item.grid-4[data-v-a6181336],.item.grid-6[data-v-a6181336]{width:50%}}@media (min-width: 768px){.item.grid-2[data-v-a6181336],.item.grid-4[data-v-a6181336]{width:50%}.item.grid-3[data-v-a6181336],.item.grid-6[data-v-a6181336]{width:calc(100% / 3)}}@media (min-width: 960px){.item.grid-4[data-v-a6181336]{width:25%}}.container[data-v-8e2d4988]{margin:auto;width:100%;max-width:1280px;padding:0 24px}@media (min-width: 640px){.container[data-v-8e2d4988]{padding:0 48px}}@media (min-width: 960px){.container[data-v-8e2d4988]{width:100%;padding:0 64px}}.vp-doc[data-v-8e2d4988] .VPHomeSponsors,.vp-doc[data-v-8e2d4988] .VPTeamPage{margin-left:var(--vp-offset, calc(50% - 50vw) );margin-right:var(--vp-offset, calc(50% - 50vw) )}.vp-doc[data-v-8e2d4988] .VPHomeSponsors h2{border-top:none;letter-spacing:normal}.vp-doc[data-v-8e2d4988] .VPHomeSponsors a,.vp-doc[data-v-8e2d4988] .VPTeamPage a{text-decoration:none}.VPHome[data-v-686f80a6]{margin-bottom:96px}@media (min-width: 768px){.VPHome[data-v-686f80a6]{margin-bottom:128px}}.VPContent[data-v-1428d186]{flex-grow:1;flex-shrink:0;margin:var(--vp-layout-top-height, 0px) auto 0;width:100%}.VPContent.is-home[data-v-1428d186]{width:100%;max-width:100%}.VPContent.has-sidebar[data-v-1428d186]{margin:0}@media (min-width: 960px){.VPContent[data-v-1428d186]{padding-top:var(--vp-nav-height)}.VPContent.has-sidebar[data-v-1428d186]{margin:var(--vp-layout-top-height, 0px) 0 0;padding-left:var(--vp-sidebar-width)}}@media (min-width: 1440px){.VPContent.has-sidebar[data-v-1428d186]{padding-right:calc((100vw - var(--vp-layout-max-width)) / 2);padding-left:calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width))}}.VPFooter[data-v-e315a0ad]{position:relative;z-index:var(--vp-z-index-footer);border-top:1px solid var(--vp-c-gutter);padding:32px 24px;background-color:var(--vp-c-bg)}.VPFooter.has-sidebar[data-v-e315a0ad]{display:none}.VPFooter[data-v-e315a0ad] a{text-decoration-line:underline;text-underline-offset:2px;transition:color .25s}.VPFooter[data-v-e315a0ad] a:hover{color:var(--vp-c-text-1)}@media (min-width: 768px){.VPFooter[data-v-e315a0ad]{padding:32px}}.container[data-v-e315a0ad]{margin:0 auto;max-width:var(--vp-layout-max-width);text-align:center}.message[data-v-e315a0ad],.copyright[data-v-e315a0ad]{line-height:24px;font-size:14px;font-weight:500;color:var(--vp-c-text-2)}.VPLocalNavOutlineDropdown[data-v-17a5e62e]{padding:12px 20px 11px}@media (min-width: 960px){.VPLocalNavOutlineDropdown[data-v-17a5e62e]{padding:12px 36px 11px}}.VPLocalNavOutlineDropdown button[data-v-17a5e62e]{display:block;font-size:12px;font-weight:500;line-height:24px;color:var(--vp-c-text-2);transition:color .5s;position:relative}.VPLocalNavOutlineDropdown button[data-v-17a5e62e]:hover{color:var(--vp-c-text-1);transition:color .25s}.VPLocalNavOutlineDropdown button.open[data-v-17a5e62e]{color:var(--vp-c-text-1)}.icon[data-v-17a5e62e]{display:inline-block;vertical-align:middle;margin-left:2px;font-size:14px;transform:rotate(0);transition:transform .25s}@media (min-width: 960px){.VPLocalNavOutlineDropdown button[data-v-17a5e62e]{font-size:14px}.icon[data-v-17a5e62e]{font-size:16px}}.open>.icon[data-v-17a5e62e]{transform:rotate(90deg)}.items[data-v-17a5e62e]{position:absolute;top:40px;right:16px;left:16px;display:grid;gap:1px;border:1px solid var(--vp-c-border);border-radius:8px;background-color:var(--vp-c-gutter);max-height:calc(var(--vp-vh, 100vh) - 86px);overflow:hidden auto;box-shadow:var(--vp-shadow-3)}@media (min-width: 960px){.items[data-v-17a5e62e]{right:auto;left:calc(var(--vp-sidebar-width) + 32px);width:320px}}.header[data-v-17a5e62e]{background-color:var(--vp-c-bg-soft)}.top-link[data-v-17a5e62e]{display:block;padding:0 16px;line-height:48px;font-size:14px;font-weight:500;color:var(--vp-c-brand-1)}.outline[data-v-17a5e62e]{padding:8px 0;background-color:var(--vp-c-bg-soft)}.flyout-enter-active[data-v-17a5e62e]{transition:all .2s ease-out}.flyout-leave-active[data-v-17a5e62e]{transition:all .15s ease-in}.flyout-enter-from[data-v-17a5e62e],.flyout-leave-to[data-v-17a5e62e]{opacity:0;transform:translateY(-16px)}.VPLocalNav[data-v-a6f0e41e]{position:sticky;top:0;left:0;z-index:var(--vp-z-index-local-nav);border-bottom:1px solid var(--vp-c-gutter);padding-top:var(--vp-layout-top-height, 0px);width:100%;background-color:var(--vp-local-nav-bg-color)}.VPLocalNav.fixed[data-v-a6f0e41e]{position:fixed}@media (min-width: 960px){.VPLocalNav[data-v-a6f0e41e]{top:var(--vp-nav-height)}.VPLocalNav.has-sidebar[data-v-a6f0e41e]{padding-left:var(--vp-sidebar-width)}.VPLocalNav.empty[data-v-a6f0e41e]{display:none}}@media (min-width: 1280px){.VPLocalNav[data-v-a6f0e41e]{display:none}}@media (min-width: 1440px){.VPLocalNav.has-sidebar[data-v-a6f0e41e]{padding-left:calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width))}}.container[data-v-a6f0e41e]{display:flex;justify-content:space-between;align-items:center}.menu[data-v-a6f0e41e]{display:flex;align-items:center;padding:12px 24px 11px;line-height:24px;font-size:12px;font-weight:500;color:var(--vp-c-text-2);transition:color .5s}.menu[data-v-a6f0e41e]:hover{color:var(--vp-c-text-1);transition:color .25s}@media (min-width: 768px){.menu[data-v-a6f0e41e]{padding:0 32px}}@media (min-width: 960px){.menu[data-v-a6f0e41e]{display:none}}.menu-icon[data-v-a6f0e41e]{margin-right:8px;font-size:14px}.VPOutlineDropdown[data-v-a6f0e41e]{padding:12px 24px 11px}@media (min-width: 768px){.VPOutlineDropdown[data-v-a6f0e41e]{padding:12px 32px 11px}}.VPSwitch[data-v-1d5665e3]{position:relative;border-radius:11px;display:block;width:40px;height:22px;flex-shrink:0;border:1px solid var(--vp-input-border-color);background-color:var(--vp-input-switch-bg-color);transition:border-color .25s!important}.VPSwitch[data-v-1d5665e3]:hover{border-color:var(--vp-c-brand-1)}.check[data-v-1d5665e3]{position:absolute;top:1px;left:1px;width:18px;height:18px;border-radius:50%;background-color:var(--vp-c-neutral-inverse);box-shadow:var(--vp-shadow-1);transition:transform .25s!important}.icon[data-v-1d5665e3]{position:relative;display:block;width:18px;height:18px;border-radius:50%;overflow:hidden}.icon[data-v-1d5665e3] [class^=vpi-]{position:absolute;top:3px;left:3px;width:12px;height:12px;color:var(--vp-c-text-2)}.dark .icon[data-v-1d5665e3] [class^=vpi-]{color:var(--vp-c-text-1);transition:opacity .25s!important}.sun[data-v-5337faa4]{opacity:1}.moon[data-v-5337faa4],.dark .sun[data-v-5337faa4]{opacity:0}.dark .moon[data-v-5337faa4]{opacity:1}.dark .VPSwitchAppearance[data-v-5337faa4] .check{transform:translate(18px)}.VPNavBarAppearance[data-v-6c893767]{display:none}@media (min-width: 1280px){.VPNavBarAppearance[data-v-6c893767]{display:flex;align-items:center}}.VPMenuGroup+.VPMenuLink[data-v-35975db6]{margin:12px -12px 0;border-top:1px solid var(--vp-c-divider);padding:12px 12px 0}.link[data-v-35975db6]{display:block;border-radius:6px;padding:0 12px;line-height:32px;font-size:14px;font-weight:500;color:var(--vp-c-text-1);white-space:nowrap;transition:background-color .25s,color .25s}.link[data-v-35975db6]:hover{color:var(--vp-c-brand-1);background-color:var(--vp-c-default-soft)}.link.active[data-v-35975db6]{color:var(--vp-c-brand-1)}.VPMenuGroup[data-v-69e747b5]{margin:12px -12px 0;border-top:1px solid var(--vp-c-divider);padding:12px 12px 0}.VPMenuGroup[data-v-69e747b5]:first-child{margin-top:0;border-top:0;padding-top:0}.VPMenuGroup+.VPMenuGroup[data-v-69e747b5]{margin-top:12px;border-top:1px solid var(--vp-c-divider)}.title[data-v-69e747b5]{padding:0 12px;line-height:32px;font-size:14px;font-weight:600;color:var(--vp-c-text-2);white-space:nowrap;transition:color .25s}.VPMenu[data-v-b98bc113]{border-radius:12px;padding:12px;min-width:128px;border:1px solid var(--vp-c-divider);background-color:var(--vp-c-bg-elv);box-shadow:var(--vp-shadow-3);transition:background-color .5s;max-height:calc(100vh - var(--vp-nav-height));overflow-y:auto}.VPMenu[data-v-b98bc113] .group{margin:0 -12px;padding:0 12px 12px}.VPMenu[data-v-b98bc113] .group+.group{border-top:1px solid var(--vp-c-divider);padding:11px 12px 12px}.VPMenu[data-v-b98bc113] .group:last-child{padding-bottom:0}.VPMenu[data-v-b98bc113] .group+.item{border-top:1px solid var(--vp-c-divider);padding:11px 16px 0}.VPMenu[data-v-b98bc113] .item{padding:0 16px;white-space:nowrap}.VPMenu[data-v-b98bc113] .label{flex-grow:1;line-height:28px;font-size:12px;font-weight:500;color:var(--vp-c-text-2);transition:color .5s}.VPMenu[data-v-b98bc113] .action{padding-left:24px}.VPFlyout[data-v-cf11d7a2]{position:relative}.VPFlyout[data-v-cf11d7a2]:hover{color:var(--vp-c-brand-1);transition:color .25s}.VPFlyout:hover .text[data-v-cf11d7a2]{color:var(--vp-c-text-2)}.VPFlyout:hover .icon[data-v-cf11d7a2]{fill:var(--vp-c-text-2)}.VPFlyout.active .text[data-v-cf11d7a2]{color:var(--vp-c-brand-1)}.VPFlyout.active:hover .text[data-v-cf11d7a2]{color:var(--vp-c-brand-2)}.button[aria-expanded=false]+.menu[data-v-cf11d7a2]{opacity:0;visibility:hidden;transform:translateY(0)}.VPFlyout:hover .menu[data-v-cf11d7a2],.button[aria-expanded=true]+.menu[data-v-cf11d7a2]{opacity:1;visibility:visible;transform:translateY(0)}.button[data-v-cf11d7a2]{display:flex;align-items:center;padding:0 12px;height:var(--vp-nav-height);color:var(--vp-c-text-1);transition:color .5s}.text[data-v-cf11d7a2]{display:flex;align-items:center;line-height:var(--vp-nav-height);font-size:14px;font-weight:500;color:var(--vp-c-text-1);transition:color .25s}.option-icon[data-v-cf11d7a2]{margin-right:0;font-size:16px}.text-icon[data-v-cf11d7a2]{margin-left:4px;font-size:14px}.icon[data-v-cf11d7a2]{font-size:20px;transition:fill .25s}.menu[data-v-cf11d7a2]{position:absolute;top:calc(var(--vp-nav-height) / 2 + 20px);right:0;opacity:0;visibility:hidden;transition:opacity .25s,visibility .25s,transform .25s}.VPSocialLink[data-v-eee4e7cb]{display:flex;justify-content:center;align-items:center;width:36px;height:36px;color:var(--vp-c-text-2);transition:color .5s}.VPSocialLink[data-v-eee4e7cb]:hover{color:var(--vp-c-text-1);transition:color .25s}.VPSocialLink[data-v-eee4e7cb]>svg,.VPSocialLink[data-v-eee4e7cb]>[class^=vpi-social-]{width:20px;height:20px;fill:currentColor}.VPSocialLinks[data-v-7bc22406]{display:flex;justify-content:center}.VPNavBarExtra[data-v-bb2aa2f0]{display:none;margin-right:-12px}@media (min-width: 768px){.VPNavBarExtra[data-v-bb2aa2f0]{display:block}}@media (min-width: 1280px){.VPNavBarExtra[data-v-bb2aa2f0]{display:none}}.trans-title[data-v-bb2aa2f0]{padding:0 24px 0 12px;line-height:32px;font-size:14px;font-weight:700;color:var(--vp-c-text-1)}.item.appearance[data-v-bb2aa2f0],.item.social-links[data-v-bb2aa2f0]{display:flex;align-items:center;padding:0 12px}.item.appearance[data-v-bb2aa2f0]{min-width:176px}.appearance-action[data-v-bb2aa2f0]{margin-right:-2px}.social-links-list[data-v-bb2aa2f0]{margin:-4px -8px}.VPNavBarHamburger[data-v-e5dd9c1c]{display:flex;justify-content:center;align-items:center;width:48px;height:var(--vp-nav-height)}@media (min-width: 768px){.VPNavBarHamburger[data-v-e5dd9c1c]{display:none}}.container[data-v-e5dd9c1c]{position:relative;width:16px;height:14px;overflow:hidden}.VPNavBarHamburger:hover .top[data-v-e5dd9c1c]{top:0;left:0;transform:translate(4px)}.VPNavBarHamburger:hover .middle[data-v-e5dd9c1c]{top:6px;left:0;transform:translate(0)}.VPNavBarHamburger:hover .bottom[data-v-e5dd9c1c]{top:12px;left:0;transform:translate(8px)}.VPNavBarHamburger.active .top[data-v-e5dd9c1c]{top:6px;transform:translate(0) rotate(225deg)}.VPNavBarHamburger.active .middle[data-v-e5dd9c1c]{top:6px;transform:translate(16px)}.VPNavBarHamburger.active .bottom[data-v-e5dd9c1c]{top:6px;transform:translate(0) rotate(135deg)}.VPNavBarHamburger.active:hover .top[data-v-e5dd9c1c],.VPNavBarHamburger.active:hover .middle[data-v-e5dd9c1c],.VPNavBarHamburger.active:hover .bottom[data-v-e5dd9c1c]{background-color:var(--vp-c-text-2);transition:top .25s,background-color .25s,transform .25s}.top[data-v-e5dd9c1c],.middle[data-v-e5dd9c1c],.bottom[data-v-e5dd9c1c]{position:absolute;width:16px;height:2px;background-color:var(--vp-c-text-1);transition:top .25s,background-color .5s,transform .25s}.top[data-v-e5dd9c1c]{top:0;left:0;transform:translate(0)}.middle[data-v-e5dd9c1c]{top:6px;left:0;transform:translate(8px)}.bottom[data-v-e5dd9c1c]{top:12px;left:0;transform:translate(4px)}.VPNavBarMenuLink[data-v-e56f3d57]{display:flex;align-items:center;padding:0 12px;line-height:var(--vp-nav-height);font-size:14px;font-weight:500;color:var(--vp-c-text-1);transition:color .25s}.VPNavBarMenuLink.active[data-v-e56f3d57],.VPNavBarMenuLink[data-v-e56f3d57]:hover{color:var(--vp-c-brand-1)}.VPNavBarMenu[data-v-dc692963]{display:none}@media (min-width: 768px){.VPNavBarMenu[data-v-dc692963]{display:flex}}/*! @docsearch/css 3.6.2 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */:root{--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:rgba(101,108,133,.8);--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 hsla(0,0%,100%,.5),0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px rgba(30,35,90,.4);--docsearch-key-pressed-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 1px 0 rgba(30,35,90,.4);--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 rgba(69,98,155,.12)}html[data-theme=dark]{--docsearch-text-color:#f5f6f7;--docsearch-container-background:rgba(9,10,17,.8);--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 rgba(3,4,9,.3);--docsearch-key-pressed-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 1px 1px 0 rgba(3,4,9,.30196078431372547);--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 rgba(73,76,106,.5),0 -4px 8px 0 rgba(0,0,0,.2);--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}.DocSearch-Button{align-items:center;background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;display:flex;font-weight:500;height:36px;justify-content:space-between;margin:0 0 0 16px;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:none}.DocSearch-Button-Container{align-items:center;display:flex}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;position:relative;padding:0 0 2px;border:0;top:-1px;width:20px}.DocSearch-Button-Key--pressed{transform:translate3d(0,1px,0);box-shadow:var(--docsearch-key-pressed-shadow)}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder{display:none}}.DocSearch--active{overflow:hidden!important}.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Container a{text-decoration:none}.DocSearch-Link{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;font:inherit;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;color:var(--docsearch-text-color);flex:1;font:inherit;font-size:1.2em;height:100%;outline:none;padding:0 0 0 8px;width:80%}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator{display:none}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{animation:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0;stroke-width:var(--docsearch-icon-stroke-width)}}.DocSearch-Reset{animation:fade-in .1s ease-in forwards;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;padding:2px;right:0;stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Cancel{display:none}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:transparent}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{color:var(--docsearch-muted-color);display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--deleting{transition:none}}.DocSearch-Hit--deleting{opacity:0;transition:all .25s linear}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--favoriting{transition:none}}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:all .25s linear;transition-delay:.25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;stroke-width:var(--docsearch-icon-stroke-width);width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit[aria-selected=true] mark{text-decoration:underline}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color);stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:background-color .1s ease-in}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{transition:none}}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:none}}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:none;text-decoration:underline}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:2px;box-shadow:var(--docsearch-key-shadow);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;color:var(--docsearch-muted-color);border:0;width:20px}.DocSearch-VisuallyHiddenForAccessibility{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media (max-width:768px){:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Dropdown{max-height:calc(var(--docsearch-vh, 1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Cancel{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:none;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}[class*=DocSearch]{--docsearch-primary-color: var(--vp-c-brand-1);--docsearch-highlight-color: var(--docsearch-primary-color);--docsearch-text-color: var(--vp-c-text-1);--docsearch-muted-color: var(--vp-c-text-2);--docsearch-searchbox-shadow: none;--docsearch-searchbox-background: transparent;--docsearch-searchbox-focus-background: transparent;--docsearch-key-gradient: transparent;--docsearch-key-shadow: none;--docsearch-modal-background: var(--vp-c-bg-soft);--docsearch-footer-background: var(--vp-c-bg)}.dark [class*=DocSearch]{--docsearch-modal-shadow: none;--docsearch-footer-shadow: none;--docsearch-logo-color: var(--vp-c-text-2);--docsearch-hit-background: var(--vp-c-default-soft);--docsearch-hit-color: var(--vp-c-text-2);--docsearch-hit-shadow: none}.DocSearch-Button{display:flex;justify-content:center;align-items:center;margin:0;padding:0;width:48px;height:55px;background:transparent;transition:border-color .25s}.DocSearch-Button:hover{background:transparent}.DocSearch-Button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.DocSearch-Button-Key--pressed{transform:none;box-shadow:none}.DocSearch-Button:focus:not(:focus-visible){outline:none!important}@media (min-width: 768px){.DocSearch-Button{justify-content:flex-start;border:1px solid transparent;border-radius:8px;padding:0 10px 0 12px;width:100%;height:40px;background-color:var(--vp-c-bg-alt)}.DocSearch-Button:hover{border-color:var(--vp-c-brand-1);background:var(--vp-c-bg-alt)}}.DocSearch-Button .DocSearch-Button-Container{display:flex;align-items:center}.DocSearch-Button .DocSearch-Search-Icon{position:relative;width:16px;height:16px;color:var(--vp-c-text-1);fill:currentColor;transition:color .5s}.DocSearch-Button:hover .DocSearch-Search-Icon{color:var(--vp-c-text-1)}@media (min-width: 768px){.DocSearch-Button .DocSearch-Search-Icon{top:1px;margin-right:8px;width:14px;height:14px;color:var(--vp-c-text-2)}}.DocSearch-Button .DocSearch-Button-Placeholder{display:none;margin-top:2px;padding:0 16px 0 0;font-size:13px;font-weight:500;color:var(--vp-c-text-2);transition:color .5s}.DocSearch-Button:hover .DocSearch-Button-Placeholder{color:var(--vp-c-text-1)}@media (min-width: 768px){.DocSearch-Button .DocSearch-Button-Placeholder{display:inline-block}}.DocSearch-Button .DocSearch-Button-Keys{direction:ltr;display:none;min-width:auto}@media (min-width: 768px){.DocSearch-Button .DocSearch-Button-Keys{display:flex;align-items:center}}.DocSearch-Button .DocSearch-Button-Key{display:block;margin:2px 0 0;border:1px solid var(--vp-c-divider);border-right:none;border-radius:4px 0 0 4px;padding-left:6px;min-width:0;width:auto;height:22px;line-height:22px;font-family:var(--vp-font-family-base);font-size:12px;font-weight:500;transition:color .5s,border-color .5s}.DocSearch-Button .DocSearch-Button-Key+.DocSearch-Button-Key{border-right:1px solid var(--vp-c-divider);border-left:none;border-radius:0 4px 4px 0;padding-left:2px;padding-right:6px}.DocSearch-Button .DocSearch-Button-Key:first-child{font-size:0!important}.DocSearch-Button .DocSearch-Button-Key:first-child:after{content:"Ctrl";font-size:12px;letter-spacing:normal;color:var(--docsearch-muted-color)}.mac .DocSearch-Button .DocSearch-Button-Key:first-child:after{content:"⌘"}.DocSearch-Button .DocSearch-Button-Key:first-child>*{display:none}.DocSearch-Search-Icon{--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke-width='1.6' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='m14.386 14.386 4.088 4.088-4.088-4.088A7.533 7.533 0 1 1 3.733 3.733a7.533 7.533 0 0 1 10.653 10.653z'/%3E%3C/svg%3E")}.VPNavBarSearch{display:flex;align-items:center}@media (min-width: 768px){.VPNavBarSearch{flex-grow:1;padding-left:24px}}@media (min-width: 960px){.VPNavBarSearch{padding-left:32px}}.dark .DocSearch-Footer{border-top:1px solid var(--vp-c-divider)}.DocSearch-Form{border:1px solid var(--vp-c-brand-1);background-color:var(--vp-c-white)}.dark .DocSearch-Form{background-color:var(--vp-c-default-soft)}.DocSearch-Screen-Icon>svg{margin:auto}.VPNavBarSocialLinks[data-v-0394ad82]{display:none}@media (min-width: 1280px){.VPNavBarSocialLinks[data-v-0394ad82]{display:flex;align-items:center}}.title[data-v-ab179fa1]{display:flex;align-items:center;border-bottom:1px solid transparent;width:100%;height:var(--vp-nav-height);font-size:16px;font-weight:600;color:var(--vp-c-text-1);transition:opacity .25s}@media (min-width: 960px){.title[data-v-ab179fa1]{flex-shrink:0}.VPNavBarTitle.has-sidebar .title[data-v-ab179fa1]{border-bottom-color:var(--vp-c-divider)}}[data-v-ab179fa1] .logo{margin-right:8px;height:var(--vp-nav-logo-height)}.VPNavBarTranslations[data-v-88af2de4]{display:none}@media (min-width: 1280px){.VPNavBarTranslations[data-v-88af2de4]{display:flex;align-items:center}}.title[data-v-88af2de4]{padding:0 24px 0 12px;line-height:32px;font-size:14px;font-weight:700;color:var(--vp-c-text-1)}.VPNavBar[data-v-6aa21345]{position:relative;height:var(--vp-nav-height);pointer-events:none;white-space:nowrap;transition:background-color .25s}.VPNavBar.screen-open[data-v-6aa21345]{transition:none;background-color:var(--vp-nav-bg-color);border-bottom:1px solid var(--vp-c-divider)}.VPNavBar[data-v-6aa21345]:not(.home){background-color:var(--vp-nav-bg-color)}@media (min-width: 960px){.VPNavBar[data-v-6aa21345]:not(.home){background-color:transparent}.VPNavBar[data-v-6aa21345]:not(.has-sidebar):not(.home.top){background-color:var(--vp-nav-bg-color)}}.wrapper[data-v-6aa21345]{padding:0 8px 0 24px}@media (min-width: 768px){.wrapper[data-v-6aa21345]{padding:0 32px}}@media (min-width: 960px){.VPNavBar.has-sidebar .wrapper[data-v-6aa21345]{padding:0}}.container[data-v-6aa21345]{display:flex;justify-content:space-between;margin:0 auto;max-width:calc(var(--vp-layout-max-width) - 64px);height:var(--vp-nav-height);pointer-events:none}.container>.title[data-v-6aa21345],.container>.content[data-v-6aa21345]{pointer-events:none}.container[data-v-6aa21345] *{pointer-events:auto}@media (min-width: 960px){.VPNavBar.has-sidebar .container[data-v-6aa21345]{max-width:100%}}.title[data-v-6aa21345]{flex-shrink:0;height:calc(var(--vp-nav-height) - 1px);transition:background-color .5s}@media (min-width: 960px){.VPNavBar.has-sidebar .title[data-v-6aa21345]{position:absolute;top:0;left:0;z-index:2;padding:0 32px;width:var(--vp-sidebar-width);height:var(--vp-nav-height);background-color:transparent}}@media (min-width: 1440px){.VPNavBar.has-sidebar .title[data-v-6aa21345]{padding-left:max(32px,calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));width:calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px)}}.content[data-v-6aa21345]{flex-grow:1}@media (min-width: 960px){.VPNavBar.has-sidebar .content[data-v-6aa21345]{position:relative;z-index:1;padding-right:32px;padding-left:var(--vp-sidebar-width)}}@media (min-width: 1440px){.VPNavBar.has-sidebar .content[data-v-6aa21345]{padding-right:calc((100vw - var(--vp-layout-max-width)) / 2 + 32px);padding-left:calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width))}}.content-body[data-v-6aa21345]{display:flex;justify-content:flex-end;align-items:center;height:var(--vp-nav-height);transition:background-color .5s}@media (min-width: 960px){.VPNavBar:not(.home.top) .content-body[data-v-6aa21345]{position:relative;background-color:var(--vp-nav-bg-color)}.VPNavBar:not(.has-sidebar):not(.home.top) .content-body[data-v-6aa21345]{background-color:transparent}}@media (max-width: 767px){.content-body[data-v-6aa21345]{column-gap:.5rem}}.menu+.translations[data-v-6aa21345]:before,.menu+.appearance[data-v-6aa21345]:before,.menu+.social-links[data-v-6aa21345]:before,.translations+.appearance[data-v-6aa21345]:before,.appearance+.social-links[data-v-6aa21345]:before{margin-right:8px;margin-left:8px;width:1px;height:24px;background-color:var(--vp-c-divider);content:""}.menu+.appearance[data-v-6aa21345]:before,.translations+.appearance[data-v-6aa21345]:before{margin-right:16px}.appearance+.social-links[data-v-6aa21345]:before{margin-left:16px}.social-links[data-v-6aa21345]{margin-right:-8px}.divider[data-v-6aa21345]{width:100%;height:1px}@media (min-width: 960px){.VPNavBar.has-sidebar .divider[data-v-6aa21345]{padding-left:var(--vp-sidebar-width)}}@media (min-width: 1440px){.VPNavBar.has-sidebar .divider[data-v-6aa21345]{padding-left:calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width))}}.divider-line[data-v-6aa21345]{width:100%;height:1px;transition:background-color .5s}.VPNavBar:not(.home) .divider-line[data-v-6aa21345]{background-color:var(--vp-c-gutter)}@media (min-width: 960px){.VPNavBar:not(.home.top) .divider-line[data-v-6aa21345]{background-color:var(--vp-c-gutter)}.VPNavBar:not(.has-sidebar):not(.home.top) .divider[data-v-6aa21345]{background-color:var(--vp-c-gutter)}}.VPNavScreenAppearance[data-v-b44890b2]{display:flex;justify-content:space-between;align-items:center;border-radius:8px;padding:12px 14px 12px 16px;background-color:var(--vp-c-bg-soft)}.text[data-v-b44890b2]{line-height:24px;font-size:12px;font-weight:500;color:var(--vp-c-text-2)}.VPNavScreenMenuLink[data-v-df37e6dd]{display:block;border-bottom:1px solid var(--vp-c-divider);padding:12px 0 11px;line-height:24px;font-size:14px;font-weight:500;color:var(--vp-c-text-1);transition:border-color .25s,color .25s}.VPNavScreenMenuLink[data-v-df37e6dd]:hover{color:var(--vp-c-brand-1)}.VPNavScreenMenuGroupLink[data-v-3e9c20e4]{display:block;margin-left:12px;line-height:32px;font-size:14px;font-weight:400;color:var(--vp-c-text-1);transition:color .25s}.VPNavScreenMenuGroupLink[data-v-3e9c20e4]:hover{color:var(--vp-c-brand-1)}.VPNavScreenMenuGroupSection[data-v-8133b170]{display:block}.title[data-v-8133b170]{line-height:32px;font-size:13px;font-weight:700;color:var(--vp-c-text-2);transition:color .25s}.VPNavScreenMenuGroup[data-v-b9ab8c58]{border-bottom:1px solid var(--vp-c-divider);height:48px;overflow:hidden;transition:border-color .5s}.VPNavScreenMenuGroup .items[data-v-b9ab8c58]{visibility:hidden}.VPNavScreenMenuGroup.open .items[data-v-b9ab8c58]{visibility:visible}.VPNavScreenMenuGroup.open[data-v-b9ab8c58]{padding-bottom:10px;height:auto}.VPNavScreenMenuGroup.open .button[data-v-b9ab8c58]{padding-bottom:6px;color:var(--vp-c-brand-1)}.VPNavScreenMenuGroup.open .button-icon[data-v-b9ab8c58]{transform:rotate(45deg)}.button[data-v-b9ab8c58]{display:flex;justify-content:space-between;align-items:center;padding:12px 4px 11px 0;width:100%;line-height:24px;font-size:14px;font-weight:500;color:var(--vp-c-text-1);transition:color .25s}.button[data-v-b9ab8c58]:hover{color:var(--vp-c-brand-1)}.button-icon[data-v-b9ab8c58]{transition:transform .25s}.group[data-v-b9ab8c58]:first-child{padding-top:0}.group+.group[data-v-b9ab8c58],.group+.item[data-v-b9ab8c58]{padding-top:4px}.VPNavScreenTranslations[data-v-858fe1a4]{height:24px;overflow:hidden}.VPNavScreenTranslations.open[data-v-858fe1a4]{height:auto}.title[data-v-858fe1a4]{display:flex;align-items:center;font-size:14px;font-weight:500;color:var(--vp-c-text-1)}.icon[data-v-858fe1a4]{font-size:16px}.icon.lang[data-v-858fe1a4]{margin-right:8px}.icon.chevron[data-v-858fe1a4]{margin-left:4px}.list[data-v-858fe1a4]{padding:4px 0 0 24px}.link[data-v-858fe1a4]{line-height:32px;font-size:13px;color:var(--vp-c-text-1)}.VPNavScreen[data-v-f2779853]{position:fixed;top:calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));right:0;bottom:0;left:0;padding:0 32px;width:100%;background-color:var(--vp-nav-screen-bg-color);overflow-y:auto;transition:background-color .25s;pointer-events:auto}.VPNavScreen.fade-enter-active[data-v-f2779853],.VPNavScreen.fade-leave-active[data-v-f2779853]{transition:opacity .25s}.VPNavScreen.fade-enter-active .container[data-v-f2779853],.VPNavScreen.fade-leave-active .container[data-v-f2779853]{transition:transform .25s ease}.VPNavScreen.fade-enter-from[data-v-f2779853],.VPNavScreen.fade-leave-to[data-v-f2779853]{opacity:0}.VPNavScreen.fade-enter-from .container[data-v-f2779853],.VPNavScreen.fade-leave-to .container[data-v-f2779853]{transform:translateY(-8px)}@media (min-width: 768px){.VPNavScreen[data-v-f2779853]{display:none}}.container[data-v-f2779853]{margin:0 auto;padding:24px 0 96px;max-width:288px}.menu+.translations[data-v-f2779853],.menu+.appearance[data-v-f2779853],.translations+.appearance[data-v-f2779853]{margin-top:24px}.menu+.social-links[data-v-f2779853]{margin-top:16px}.appearance+.social-links[data-v-f2779853]{margin-top:16px}.VPNav[data-v-ae24b3ad]{position:relative;top:var(--vp-layout-top-height, 0px);left:0;z-index:var(--vp-z-index-nav);width:100%;pointer-events:none;transition:background-color .5s}@media (min-width: 960px){.VPNav[data-v-ae24b3ad]{position:fixed}}.VPSidebarItem.level-0[data-v-b7550ba0]{padding-bottom:24px}.VPSidebarItem.collapsed.level-0[data-v-b7550ba0]{padding-bottom:10px}.item[data-v-b7550ba0]{position:relative;display:flex;width:100%}.VPSidebarItem.collapsible>.item[data-v-b7550ba0]{cursor:pointer}.indicator[data-v-b7550ba0]{position:absolute;top:6px;bottom:6px;left:-17px;width:2px;border-radius:2px;transition:background-color .25s}.VPSidebarItem.level-2.is-active>.item>.indicator[data-v-b7550ba0],.VPSidebarItem.level-3.is-active>.item>.indicator[data-v-b7550ba0],.VPSidebarItem.level-4.is-active>.item>.indicator[data-v-b7550ba0],.VPSidebarItem.level-5.is-active>.item>.indicator[data-v-b7550ba0]{background-color:var(--vp-c-brand-1)}.link[data-v-b7550ba0]{display:flex;align-items:center;flex-grow:1}.text[data-v-b7550ba0]{flex-grow:1;padding:4px 0;line-height:24px;font-size:14px;transition:color .25s}.VPSidebarItem.level-0 .text[data-v-b7550ba0]{font-weight:700;color:var(--vp-c-text-1)}.VPSidebarItem.level-1 .text[data-v-b7550ba0],.VPSidebarItem.level-2 .text[data-v-b7550ba0],.VPSidebarItem.level-3 .text[data-v-b7550ba0],.VPSidebarItem.level-4 .text[data-v-b7550ba0],.VPSidebarItem.level-5 .text[data-v-b7550ba0]{font-weight:500;color:var(--vp-c-text-2)}.VPSidebarItem.level-0.is-link>.item>.link:hover .text[data-v-b7550ba0],.VPSidebarItem.level-1.is-link>.item>.link:hover .text[data-v-b7550ba0],.VPSidebarItem.level-2.is-link>.item>.link:hover .text[data-v-b7550ba0],.VPSidebarItem.level-3.is-link>.item>.link:hover .text[data-v-b7550ba0],.VPSidebarItem.level-4.is-link>.item>.link:hover .text[data-v-b7550ba0],.VPSidebarItem.level-5.is-link>.item>.link:hover .text[data-v-b7550ba0]{color:var(--vp-c-brand-1)}.VPSidebarItem.level-0.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-1.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-2.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-3.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-4.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-5.has-active>.item>.text[data-v-b7550ba0],.VPSidebarItem.level-0.has-active>.item>.link>.text[data-v-b7550ba0],.VPSidebarItem.level-1.has-active>.item>.link>.text[data-v-b7550ba0],.VPSidebarItem.level-2.has-active>.item>.link>.text[data-v-b7550ba0],.VPSidebarItem.level-3.has-active>.item>.link>.text[data-v-b7550ba0],.VPSidebarItem.level-4.has-active>.item>.link>.text[data-v-b7550ba0],.VPSidebarItem.level-5.has-active>.item>.link>.text[data-v-b7550ba0]{color:var(--vp-c-text-1)}.VPSidebarItem.level-0.is-active>.item .link>.text[data-v-b7550ba0],.VPSidebarItem.level-1.is-active>.item .link>.text[data-v-b7550ba0],.VPSidebarItem.level-2.is-active>.item .link>.text[data-v-b7550ba0],.VPSidebarItem.level-3.is-active>.item .link>.text[data-v-b7550ba0],.VPSidebarItem.level-4.is-active>.item .link>.text[data-v-b7550ba0],.VPSidebarItem.level-5.is-active>.item .link>.text[data-v-b7550ba0]{color:var(--vp-c-brand-1)}.caret[data-v-b7550ba0]{display:flex;justify-content:center;align-items:center;margin-right:-7px;width:32px;height:32px;color:var(--vp-c-text-3);cursor:pointer;transition:color .25s;flex-shrink:0}.item:hover .caret[data-v-b7550ba0]{color:var(--vp-c-text-2)}.item:hover .caret[data-v-b7550ba0]:hover{color:var(--vp-c-text-1)}.caret-icon[data-v-b7550ba0]{font-size:18px;transform:rotate(90deg);transition:transform .25s}.VPSidebarItem.collapsed .caret-icon[data-v-b7550ba0]{transform:rotate(0)}.VPSidebarItem.level-1 .items[data-v-b7550ba0],.VPSidebarItem.level-2 .items[data-v-b7550ba0],.VPSidebarItem.level-3 .items[data-v-b7550ba0],.VPSidebarItem.level-4 .items[data-v-b7550ba0],.VPSidebarItem.level-5 .items[data-v-b7550ba0]{border-left:1px solid var(--vp-c-divider);padding-left:16px}.VPSidebarItem.collapsed .items[data-v-b7550ba0]{display:none}.no-transition[data-v-c40bc020] .caret-icon{transition:none}.group+.group[data-v-c40bc020]{border-top:1px solid var(--vp-c-divider);padding-top:10px}@media (min-width: 960px){.group[data-v-c40bc020]{padding-top:10px;width:calc(var(--vp-sidebar-width) - 64px)}}.VPSidebar[data-v-319d5ca6]{position:fixed;top:var(--vp-layout-top-height, 0px);bottom:0;left:0;z-index:var(--vp-z-index-sidebar);padding:32px 32px 96px;width:calc(100vw - 64px);max-width:320px;background-color:var(--vp-sidebar-bg-color);opacity:0;box-shadow:var(--vp-c-shadow-3);overflow-x:hidden;overflow-y:auto;transform:translate(-100%);transition:opacity .5s,transform .25s ease;overscroll-behavior:contain}.VPSidebar.open[data-v-319d5ca6]{opacity:1;visibility:visible;transform:translate(0);transition:opacity .25s,transform .5s cubic-bezier(.19,1,.22,1)}.dark .VPSidebar[data-v-319d5ca6]{box-shadow:var(--vp-shadow-1)}@media (min-width: 960px){.VPSidebar[data-v-319d5ca6]{padding-top:var(--vp-nav-height);width:var(--vp-sidebar-width);max-width:100%;background-color:var(--vp-sidebar-bg-color);opacity:1;visibility:visible;box-shadow:none;transform:translate(0)}}@media (min-width: 1440px){.VPSidebar[data-v-319d5ca6]{padding-left:max(32px,calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));width:calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px)}}@media (min-width: 960px){.curtain[data-v-319d5ca6]{position:sticky;top:-64px;left:0;z-index:1;margin-top:calc(var(--vp-nav-height) * -1);margin-right:-32px;margin-left:-32px;height:var(--vp-nav-height);background-color:var(--vp-sidebar-bg-color)}}.nav[data-v-319d5ca6]{outline:0}.VPSkipLink[data-v-0f60ec36]{top:8px;left:8px;padding:8px 16px;z-index:999;border-radius:8px;font-size:12px;font-weight:700;text-decoration:none;color:var(--vp-c-brand-1);box-shadow:var(--vp-shadow-3);background-color:var(--vp-c-bg)}.VPSkipLink[data-v-0f60ec36]:focus{height:auto;width:auto;clip:auto;clip-path:none}@media (min-width: 1280px){.VPSkipLink[data-v-0f60ec36]{top:14px;left:16px}}.Layout[data-v-5d98c3a5]{display:flex;flex-direction:column;min-height:100vh}.VPHomeSponsors[data-v-3d121b4a]{border-top:1px solid var(--vp-c-gutter);padding-top:88px!important}.VPHomeSponsors[data-v-3d121b4a]{margin:96px 0}@media (min-width: 768px){.VPHomeSponsors[data-v-3d121b4a]{margin:128px 0}}.VPHomeSponsors[data-v-3d121b4a]{padding:0 24px}@media (min-width: 768px){.VPHomeSponsors[data-v-3d121b4a]{padding:0 48px}}@media (min-width: 960px){.VPHomeSponsors[data-v-3d121b4a]{padding:0 64px}}.container[data-v-3d121b4a]{margin:0 auto;max-width:1152px}.love[data-v-3d121b4a]{margin:0 auto;width:fit-content;font-size:28px;color:var(--vp-c-text-3)}.icon[data-v-3d121b4a]{display:inline-block}.message[data-v-3d121b4a]{margin:0 auto;padding-top:10px;max-width:320px;text-align:center;line-height:24px;font-size:16px;font-weight:500;color:var(--vp-c-text-2)}.sponsors[data-v-3d121b4a]{padding-top:32px}.action[data-v-3d121b4a]{padding-top:40px;text-align:center}.VPTeamPage[data-v-7c57f839]{margin:96px 0}@media (min-width: 768px){.VPTeamPage[data-v-7c57f839]{margin:128px 0}}.VPHome .VPTeamPageTitle[data-v-7c57f839-s]{border-top:1px solid var(--vp-c-gutter);padding-top:88px!important}.VPTeamPageSection+.VPTeamPageSection[data-v-7c57f839-s],.VPTeamMembers+.VPTeamPageSection[data-v-7c57f839-s]{margin-top:64px}.VPTeamMembers+.VPTeamMembers[data-v-7c57f839-s]{margin-top:24px}@media (min-width: 768px){.VPTeamPageTitle+.VPTeamPageSection[data-v-7c57f839-s]{margin-top:16px}.VPTeamPageSection+.VPTeamPageSection[data-v-7c57f839-s],.VPTeamMembers+.VPTeamPageSection[data-v-7c57f839-s]{margin-top:96px}}.VPTeamMembers[data-v-7c57f839-s]{padding:0 24px}@media (min-width: 768px){.VPTeamMembers[data-v-7c57f839-s]{padding:0 48px}}@media (min-width: 960px){.VPTeamMembers[data-v-7c57f839-s]{padding:0 64px}}.VPTeamPageTitle[data-v-bf2cbdac]{padding:48px 32px;text-align:center}@media (min-width: 768px){.VPTeamPageTitle[data-v-bf2cbdac]{padding:64px 48px 48px}}@media (min-width: 960px){.VPTeamPageTitle[data-v-bf2cbdac]{padding:80px 64px 48px}}.title[data-v-bf2cbdac]{letter-spacing:0;line-height:44px;font-size:36px;font-weight:500}@media (min-width: 768px){.title[data-v-bf2cbdac]{letter-spacing:-.5px;line-height:56px;font-size:48px}}.lead[data-v-bf2cbdac]{margin:0 auto;max-width:512px;padding-top:12px;line-height:24px;font-size:16px;font-weight:500;color:var(--vp-c-text-2)}@media (min-width: 768px){.lead[data-v-bf2cbdac]{max-width:592px;letter-spacing:.15px;line-height:28px;font-size:20px}}.VPTeamPageSection[data-v-b1a88750]{padding:0 32px}@media (min-width: 768px){.VPTeamPageSection[data-v-b1a88750]{padding:0 48px}}@media (min-width: 960px){.VPTeamPageSection[data-v-b1a88750]{padding:0 64px}}.title[data-v-b1a88750]{position:relative;margin:0 auto;max-width:1152px;text-align:center;color:var(--vp-c-text-2)}.title-line[data-v-b1a88750]{position:absolute;top:16px;left:0;width:100%;height:1px;background-color:var(--vp-c-divider)}.title-text[data-v-b1a88750]{position:relative;display:inline-block;padding:0 24px;letter-spacing:0;line-height:32px;font-size:20px;font-weight:500;background-color:var(--vp-c-bg)}.lead[data-v-b1a88750]{margin:0 auto;max-width:480px;padding-top:12px;text-align:center;line-height:24px;font-size:16px;font-weight:500;color:var(--vp-c-text-2)}.members[data-v-b1a88750]{padding-top:40px}.VPTeamMembersItem[data-v-f3fa364a]{display:flex;flex-direction:column;gap:2px;border-radius:12px;width:100%;height:100%;overflow:hidden}.VPTeamMembersItem.small .profile[data-v-f3fa364a]{padding:32px}.VPTeamMembersItem.small .data[data-v-f3fa364a]{padding-top:20px}.VPTeamMembersItem.small .avatar[data-v-f3fa364a]{width:64px;height:64px}.VPTeamMembersItem.small .name[data-v-f3fa364a]{line-height:24px;font-size:16px}.VPTeamMembersItem.small .affiliation[data-v-f3fa364a]{padding-top:4px;line-height:20px;font-size:14px}.VPTeamMembersItem.small .desc[data-v-f3fa364a]{padding-top:12px;line-height:20px;font-size:14px}.VPTeamMembersItem.small .links[data-v-f3fa364a]{margin:0 -16px -20px;padding:10px 0 0}.VPTeamMembersItem.medium .profile[data-v-f3fa364a]{padding:48px 32px}.VPTeamMembersItem.medium .data[data-v-f3fa364a]{padding-top:24px;text-align:center}.VPTeamMembersItem.medium .avatar[data-v-f3fa364a]{width:96px;height:96px}.VPTeamMembersItem.medium .name[data-v-f3fa364a]{letter-spacing:.15px;line-height:28px;font-size:20px}.VPTeamMembersItem.medium .affiliation[data-v-f3fa364a]{padding-top:4px;font-size:16px}.VPTeamMembersItem.medium .desc[data-v-f3fa364a]{padding-top:16px;max-width:288px;font-size:16px}.VPTeamMembersItem.medium .links[data-v-f3fa364a]{margin:0 -16px -12px;padding:16px 12px 0}.profile[data-v-f3fa364a]{flex-grow:1;background-color:var(--vp-c-bg-soft)}.data[data-v-f3fa364a]{text-align:center}.avatar[data-v-f3fa364a]{position:relative;flex-shrink:0;margin:0 auto;border-radius:50%;box-shadow:var(--vp-shadow-3)}.avatar-img[data-v-f3fa364a]{position:absolute;top:0;right:0;bottom:0;left:0;border-radius:50%;object-fit:cover}.name[data-v-f3fa364a]{margin:0;font-weight:600}.affiliation[data-v-f3fa364a]{margin:0;font-weight:500;color:var(--vp-c-text-2)}.org.link[data-v-f3fa364a]{color:var(--vp-c-text-2);transition:color .25s}.org.link[data-v-f3fa364a]:hover{color:var(--vp-c-brand-1)}.desc[data-v-f3fa364a]{margin:0 auto}.desc[data-v-f3fa364a] a{font-weight:500;color:var(--vp-c-brand-1);text-decoration-style:dotted;transition:color .25s}.links[data-v-f3fa364a]{display:flex;justify-content:center;height:56px}.sp-link[data-v-f3fa364a]{display:flex;justify-content:center;align-items:center;text-align:center;padding:16px;font-size:14px;font-weight:500;color:var(--vp-c-sponsor);background-color:var(--vp-c-bg-soft);transition:color .25s,background-color .25s}.sp .sp-link.link[data-v-f3fa364a]:hover,.sp .sp-link.link[data-v-f3fa364a]:focus{outline:none;color:var(--vp-c-white);background-color:var(--vp-c-sponsor)}.sp-icon[data-v-f3fa364a]{margin-right:8px;font-size:16px}.VPTeamMembers.small .container[data-v-6cb0dbc4]{grid-template-columns:repeat(auto-fit,minmax(224px,1fr))}.VPTeamMembers.small.count-1 .container[data-v-6cb0dbc4]{max-width:276px}.VPTeamMembers.small.count-2 .container[data-v-6cb0dbc4]{max-width:576px}.VPTeamMembers.small.count-3 .container[data-v-6cb0dbc4]{max-width:876px}.VPTeamMembers.medium .container[data-v-6cb0dbc4]{grid-template-columns:repeat(auto-fit,minmax(256px,1fr))}@media (min-width: 375px){.VPTeamMembers.medium .container[data-v-6cb0dbc4]{grid-template-columns:repeat(auto-fit,minmax(288px,1fr))}}.VPTeamMembers.medium.count-1 .container[data-v-6cb0dbc4]{max-width:368px}.VPTeamMembers.medium.count-2 .container[data-v-6cb0dbc4]{max-width:760px}.container[data-v-6cb0dbc4]{display:grid;gap:24px;margin:0 auto;max-width:1152px} diff --git a/assets/time.md.CBkLAgvW.js b/assets/time.md.CBkLAgvW.js new file mode 100644 index 00000000..3d163b26 --- /dev/null +++ b/assets/time.md.CBkLAgvW.js @@ -0,0 +1,15 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Time","description":"","frontmatter":{},"headers":[],"relativePath":"time.md","filePath":"time.md"}'),h={name:"time.md"};function l(e,s,k,p,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Time

_ms

Prints a human-string for a given number of milliseconds.

ts
_ms(1) // '1 ms'
+_ms(10) // '10 ms'
+_ms(1005) // '1.005 sec'
+_ms(49123) // '49 sec'
+_ms(60000) // '1m0s'
+_ms(60912) // '1m0s'
+_ms(69123) // '1m9s'
+_ms(3292100) // '54m52s'
+_ms(69642430) // '19h20m'
+_ms(101963481) // '28h'

_since

Useful to measure and human-print the "time elapsed since".

ts
const started = Date.now()
+
+// ... do stuff!
+
+console.log(\`Took \${_since(started)}\`)
+// Took 19m13s

Uses _ms for pretty-printing.

_debounce

Debounce function from Lodash.

See the typescript declaration for Options.

ts
const fn = _debounce(originalFn, 100, { leading: false, trailing: false, maxWait: 300 })

_throttle

Throttle function from Lodash.

See the typescript declaration for Options.

ts
const fn = _throttle(originalFn, 100)
`,16)]))}const o=i(h,[["render",l]]);export{g as __pageData,o as default}; diff --git a/assets/time.md.CBkLAgvW.lean.js b/assets/time.md.CBkLAgvW.lean.js new file mode 100644 index 00000000..3d163b26 --- /dev/null +++ b/assets/time.md.CBkLAgvW.lean.js @@ -0,0 +1,15 @@ +import{_ as i,c as a,a0 as n,o as t}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Time","description":"","frontmatter":{},"headers":[],"relativePath":"time.md","filePath":"time.md"}'),h={name:"time.md"};function l(e,s,k,p,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`

Time

_ms

Prints a human-string for a given number of milliseconds.

ts
_ms(1) // '1 ms'
+_ms(10) // '10 ms'
+_ms(1005) // '1.005 sec'
+_ms(49123) // '49 sec'
+_ms(60000) // '1m0s'
+_ms(60912) // '1m0s'
+_ms(69123) // '1m9s'
+_ms(3292100) // '54m52s'
+_ms(69642430) // '19h20m'
+_ms(101963481) // '28h'

_since

Useful to measure and human-print the "time elapsed since".

ts
const started = Date.now()
+
+// ... do stuff!
+
+console.log(\`Took \${_since(started)}\`)
+// Took 19m13s

Uses _ms for pretty-printing.

_debounce

Debounce function from Lodash.

See the typescript declaration for Options.

ts
const fn = _debounce(originalFn, 100, { leading: false, trailing: false, maxWait: 300 })

_throttle

Throttle function from Lodash.

See the typescript declaration for Options.

ts
const fn = _throttle(originalFn, 100)
`,16)]))}const o=i(h,[["render",l]]);export{g as __pageData,o as default}; diff --git a/assets/translation.md.sdEI0Jge.js b/assets/translation.md.sdEI0Jge.js new file mode 100644 index 00000000..027d42f4 --- /dev/null +++ b/assets/translation.md.sdEI0Jge.js @@ -0,0 +1,16 @@ +import{E as S,S as b}from"./chunks/types.C-9dMxxX.js";import{i as D}from"./chunks/env.bTBnF6u3.js";import{A as W,T as N,a as j,U as V,b as L,c as Y,d as z,e as J,f as K,H as F,_ as Q}from"./chunks/stringify.CRXUkG82.js";import{a as U,b as $,c as P,d as B,e as X,f as O}from"./chunks/object.util.ThuQ4YBC.js";import{d as Z,p as q,h as C,v as ee,o as k,c as w,a as v,F as te,C as se,t as T,j as M,G as I,a0 as re,B as ae}from"./chunks/framework.K5DDegrV.js";import"./chunks/is.util.BDVbkSgX.js";function ne(a,e=Error){if(!(a instanceof e))throw new W(`Expected to be instanceof ${e.name}, actual typeof: ${typeof a}`)}function ie(a,e){if(!(a instanceof e))throw a}async function oe(a=0,e){return await new Promise((t,s)=>setTimeout(e instanceof Error?s:t,a,e))}class le{constructor(e){this.fetcher=e}async load(e){return await this.fetcher.get(`${e}.json`)}}async function ce(a,e,t={}){const s=[...a],r=s.length;if(r===0)return[];const{concurrency:n=1/0,errorMode:o=E.THROW_IMMEDIATELY,logger:l=console}=t;if(n===1)return await he(s,e,o,l);if(s.length<=n)return await ue(s,e,o,l);const c=[],h=[];let i=!1,d=0,y=0;return await new Promise((g,f)=>{const u=()=>{if(i)return;const R=s[y],A=y++;if(y>r){if(d===0){i=!0;const p=c.filter(x=>x!==b);h.length?f(new AggregateError(h,`pMap resulted in ${h.length} error(s)`)):g(p)}return}d++,Promise.resolve(R).then(async p=>await e(p,A)).then(p=>{if(p===S)return i=!0,g(c.filter(x=>x!==b));c[A]=p,d--,u()},p=>{o===E.THROW_IMMEDIATELY?(i=!0,f(p)):(o===E.THROW_AGGREGATED?h.push(p):l==null||l.error(p),d--,u())})};for(let R=0;Re(o,l)))).filter(o=>o!==b&&o!==S);const r=[],n=[];for(const o of await Promise.allSettled(a.map((l,c)=>e(l,c))))if(o.status==="fulfilled"){if(o.value===S)break;o.value!==b&&r.push(o.value)}else t===E.THROW_AGGREGATED?n.push(o.reason):s==null||s.error(o.reason);if(n.length)throw new AggregateError(n,`pMap resulted in ${n.length} error(s)`);return r}const fe=a=>(console.warn(`[tr] missing: ${a}`),`[${a}]`);class de{constructor(e,t={}){this.cfg={...e,missingTranslationHandler:fe},this.locales={...t},this.currentLocale=e.currentLocale||e.defaultLocale}setLocale(e,t){this.locales[e]=t}getLocale(e){return this.locales[e]}async loadLocale(e){const t=Array.isArray(e)?e:[e];await ce(t,async s=>{this.locales[s]||(this.locales[s]=await this.cfg.translationLoader.load(s))})}translate(e,t){return this.translateIfExists(e,t)||this.cfg.missingTranslationHandler(e,t)}translateIfExists(e,t){var s,r;return((s=this.locales[this.currentLocale])==null?void 0:s[e])||((r=this.locales[this.cfg.defaultLocale])==null?void 0:r[e])}}function H(a,e=Date.now()){return G(e-a)}function G(a){if(a<1e3)return`${Math.round(a)} ms`;if(a<5e3){const n=a/1e3;return`${Math.trunc(n)===n?n:n.toFixed(3)} sec`}const e=Math.floor(a/1e3)%60,t=Math.floor(a/(60*1e3))%60,s=Math.floor(a/(3600*1e3));return s===0?t===0?`${e} sec`:`${t}m${e}s`:s<24?`${s}h${t}m`:s<48?`${Math.round(s+t/60)}h`:`${Math.floor(s/24)} days`}async function pe(a,e){if(!e.timeout)return await a();const{timeout:t,name:s=a.name||"pTimeout function",onTimeout:r}=e,n=e.fakeError||new Error("TimeoutError");return await new Promise(async(o,l)=>{const c=setTimeout(()=>{const h=new N(`"${s}" timed out after ${t} ms`,e.errorData);if(h.stack=n.stack.replace("Error: TimeoutError","TimeoutError: "+h.message),r){try{o(r(h))}catch(i){i.stack=n.stack.replace("Error: TimeoutError",i.name+": "+i.message),l(j(i,e.errorData))}return}l(h)},t);try{o(await a())}catch(h){l(h)}finally{clearTimeout(c)}})}var E=(a=>(a.THROW_IMMEDIATELY="THROW_IMMEDIATELY",a.THROW_AGGREGATED="THROW_AGGREGATED",a.SUPPRESS="SUPPRESS",a))(E||{});function ye(a,e,t){return a<=e?e:a>=t?t:a}const ge=["GET","POST","PUT","PATCH","DELETE","HEAD"],me={text:"text/plain",json:"application/json",void:"*/*",readableStream:"application/octet-stream",arrayBuffer:"application/octet-stream",blob:"application/octet-stream"},Ee={count:2,timeout:1e3,timeoutMax:3e4,timeoutMultiplier:2},m=class m{constructor(e={}){if(typeof globalThis.fetch!="function")throw new TypeError("globalThis.fetch is not available");this.cfg=this.normalizeCfg(e);for(const t of ge){const s=t.toLowerCase();if(this[`${s}Void`]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"void",...n}),t==="HEAD")return;this[`${s}Text`]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"text",...n}),this[s]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"json",...n})}}onBeforeRequest(e){var t;return((t=this.cfg.hooks).beforeRequest||(t.beforeRequest=[])).push(e),this}onAfterResponse(e){var t;return((t=this.cfg.hooks).afterResponse||(t.afterResponse=[])).push(e),this}onBeforeRetry(e){var t;return((t=this.cfg.hooks).beforeRetry||(t.beforeRetry=[])).push(e),this}onError(e){var t;return((t=this.cfg.hooks).onError||(t.onError=[])).push(e),this}static create(e={}){return new m(e)}async getReadableStream(e,t){return await this.fetch({url:e,responseType:"readableStream",...t})}async fetch(e){const t=await this.doFetch(e);if(t.err)throw t.err;return t.body}async expectError(e){const t=await this.doFetch(e);if(!t.err)throw new V("Fetch was expected to error");return ne(t.err,F),t.err}async tryFetch(e){const t=await this.doFetch(e);return t.err?(ie(t.err,F),[t.err,null]):[null,t.body]}async doFetch(e){var d,y,g;const t=this.normalizeOptions(e),{logger:s}=this.cfg,{timeoutSeconds:r,init:{method:n}}=t;for(const f of this.cfg.hooks.beforeRequest||[])await f(t);const l=t.fullUrl.includes("://")?new URL(t.fullUrl):void 0,c=l?this.getShortUrl(l):t.fullUrl,h=[n,c].join(" "),i={req:t,retryStatus:{retryAttempt:0,retryStopped:!1,retryTimeout:t.retry.timeout},signature:h};for(;!i.retryStatus.retryStopped;){t.started=Date.now();let f;if(r){const u=new AbortController;t.init.signal=u.signal,f=setTimeout(()=>{u.abort(new N(`request timed out after ${r} sec`))},r*1e3)}if(t.logRequest){const{retryAttempt:u}=i.retryStatus;s.log([" >>",h,u&&`try#${u+1}/${t.retry.count+1}`].filter(Boolean).join(" ")),t.logRequestBody&&t.init.body&&s.log(t.init.body)}try{i.fetchResponse=await(this.cfg.fetchFn||m.callNativeFetch)(t.fullUrl,t.init),i.ok=i.fetchResponse.ok,i.err=void 0}catch(u){i.err=L(u),i.ok=!1,i.fetchResponse=void 0}finally{clearTimeout(f)}if(i.statusFamily=this.getStatusFamily(i),i.statusCode=(d=i.fetchResponse)==null?void 0:d.status,(y=i.fetchResponse)!=null&&y.ok||!t.throwHttpErrors)try{await pe(async()=>await this.onOkResponse(i),{timeout:r*1e3||Number.POSITIVE_INFINITY,name:"Fetcher.downloadBody"})}catch(u){i.err=L(u),i.ok=!1,await this.onNotOkResponse(i)}else await this.onNotOkResponse(i)}if(i.err){j(i.err,t.errorData),(g=t.onError)==null||g.call(t,i.err);for(const f of this.cfg.hooks.onError||[])await f(i.err)}for(const f of this.cfg.hooks.afterResponse||[])await f(i);return i}async onOkResponse(e){const{req:t}=e,{responseType:s}=e.req;if(s==="json")if(e.fetchResponse.body){const r=await e.fetchResponse.text();r?(e.body=r,e.body=Y(r,t.jsonReviver)):e.body={}}else e.body={};else if(s==="text")e.body=e.fetchResponse.body?await e.fetchResponse.text():"";else if(s==="arrayBuffer")e.body=e.fetchResponse.body?await e.fetchResponse.arrayBuffer():{};else if(s==="blob")e.body=e.fetchResponse.body?await e.fetchResponse.blob():{};else if(s==="readableStream"&&(e.body=e.fetchResponse.body,e.body===null))throw new Error("fetchResponse.body is null");if(e.retryStatus.retryStopped=!0,(!e.err||!t.throwHttpErrors)&&t.logResponse){const{retryAttempt:r}=e.retryStatus,{logger:n}=this.cfg;n.log([" <<",e.fetchResponse.status,e.signature,r&&`try#${r+1}/${t.retry.count+1}`,H(e.req.started)].filter(Boolean).join(" ")),t.logResponseBody&&e.body!==void 0&&n.log(e.body)}}static async callNativeFetch(e,t){return await globalThis.fetch(e,t)}async onNotOkResponse(e){var n;let t;if(!e.body&&e.fetchResponse)try{e.body=z(await e.fetchResponse.text())}catch{}e.err?t=J(e.err):e.body?t=K(e.body):t={name:"Error",message:"Fetch failed",data:{}};let s=((n=e.fetchResponse)==null?void 0:n.status)||0;e.statusFamily===2&&(e.statusFamily=void 0,e.statusCode=void 0,s=0);const r=[e.statusCode,e.signature].filter(Boolean).join(" ");e.err=new F(r,U({response:e.fetchResponse,responseStatusCode:s,requestUrl:e.req.fullUrl,requestBaseUrl:this.cfg.baseUrl||void 0,requestMethod:e.req.init.method,requestSignature:e.signature,requestDuration:Date.now()-e.req.started}),{cause:t}),await this.processRetry(e)}async processRetry(e){var l;const{retryStatus:t}=e;this.shouldRetry(e)||(t.retryStopped=!0);for(const c of this.cfg.hooks.beforeRetry||[])await c(e);const{count:s,timeoutMultiplier:r,timeoutMax:n}=e.req.retry;if(t.retryAttempt>=s&&(t.retryStopped=!0),e.err&&(!t.retryStopped||e.req.logResponse)&&this.cfg.logger.error([" <<",((l=e.fetchResponse)==null?void 0:l.status)||0,e.signature,s&&(t.retryAttempt||!t.retryStopped)&&`try#${t.retryAttempt+1}/${s+1}`,H(e.req.started)].filter(Boolean).join(" ")+` +`,Q(e.err.cause||e.err)),t.retryStopped)return;t.retryAttempt++,t.retryTimeout=ye(t.retryTimeout*r,0,n);const o=this.getRetryTimeout(e);e.req.debug&&this.cfg.logger.log(` .. ${e.signature} waiting ${G(o)}`),await oe(o)}getRetryTimeout(e){let t=0;if(e.fetchResponse&&[429,503].includes(e.fetchResponse.status)){const s=e.fetchResponse.headers.get("retry-after")??e.fetchResponse.headers.get("x-ratelimit-reset");if(s){if(Number(s))t=Number(s)*1e3;else{const r=new Date(s);Number.isNaN(r)||(t=Number(r)-Date.now())}this.cfg.logger.log(`retry-after: ${s}`),t||this.cfg.logger.warn("retry-after could not be parsed")}}if(!t){const s=Math.random()*500;t=e.retryStatus.retryTimeout+s}return t}shouldRetry(e){var h,i,d,y,g;const{retryPost:t,retry3xx:s,retry4xx:r,retry5xx:n}=e.req,{method:o}=e.req.init;if(o==="POST"&&!t)return!1;const{statusFamily:l}=e,c=((h=e.fetchResponse)==null?void 0:h.status)||0;return l===5&&!n?!1:[408,429].includes(c)?!0:!(l===4&&!r||l===3&&!s||(g=(y=(d=(i=e.err)==null?void 0:i.cause)==null?void 0:d.cause)==null?void 0:y.message)!=null&&g.includes("unexpected redirect"))}getStatusFamily(e){var s;const t=(s=e.fetchResponse)==null?void 0:s.status;if(t){if(t>=500)return 5;if(t>=400)return 4;if(t>=300)return 3;if(t>=200)return 2;if(t>=100)return 1}}getShortUrl(e){const{baseUrl:t}=this.cfg;e.password&&(e=new URL(e.toString()),e.password="[redacted]");let s=e.toString();return this.cfg.logWithSearchParams||(s=s.split("?")[0]),!this.cfg.logWithBaseUrl&&t&&s.startsWith(t)&&(s=s.slice(t.length)),s}normalizeCfg(e){var r;(r=e.baseUrl)!=null&&r.endsWith("/")&&(console.warn(`Fetcher: baseUrl should not end with slash: ${e.baseUrl}`),e.baseUrl=e.baseUrl.slice(0,e.baseUrl.length-1));const{debug:t=!1}=e,s=$({baseUrl:"",inputUrl:"",responseType:"json",searchParams:{},timeoutSeconds:30,retryPost:!1,retry3xx:!1,retry4xx:!1,retry5xx:!0,logger:e.logger||console,debug:t,logRequest:t,logRequestBody:t,logResponse:t,logResponseBody:t,logWithBaseUrl:D(),logWithSearchParams:!0,retry:{...Ee},init:{method:e.method||"GET",headers:U({"user-agent":m.userAgent,...e.headers}),credentials:e.credentials,redirect:e.redirect},hooks:{},throwHttpErrors:!0,errorData:{}},P(e,["method","credentials","headers","redirect","logger"]));return s.init.headers=B(s.init.headers,n=>n.toLowerCase()),s}normalizeOptions(e){var n;const t={...X(this.cfg,["timeoutSeconds","retryPost","retry4xx","retry5xx","responseType","jsonReviver","logRequest","logRequestBody","logResponse","logResponseBody","debug","throwHttpErrors","errorData"]),started:Date.now(),...P(e,["method","headers","credentials"]),inputUrl:e.url||"",fullUrl:e.url||"",retry:{...this.cfg.retry,...O(e.retry||{})},init:$({...this.cfg.init,headers:{...this.cfg.init.headers},method:e.method||this.cfg.init.method,credentials:e.credentials||this.cfg.init.credentials,redirect:e.redirect||this.cfg.init.redirect||"follow"},{headers:B(e.headers||{},o=>o.toLowerCase())})};U(t.init.headers,!0);const s=e.baseUrl||this.cfg.baseUrl;s&&(t.fullUrl.startsWith("/")&&(console.warn("Fetcher: url should not start with / when baseUrl is specified"),t.fullUrl=t.fullUrl.slice(1)),t.fullUrl=`${s}/${t.inputUrl}`);const r=O({...this.cfg.searchParams,...e.searchParams});if(Object.keys(r).length){const o=new URLSearchParams(r).toString();t.fullUrl+=(t.fullUrl.includes("?")?"&":"?")+o}return e.json!==void 0?(t.init.body=JSON.stringify(e.json),t.init.headers["content-type"]="application/json"):e.text!==void 0?(t.init.body=e.text,t.init.headers["content-type"]="text/plain"):e.form?e.form instanceof URLSearchParams||e.form instanceof FormData?t.init.body=e.form:(t.init.body=new URLSearchParams(e.form),t.init.headers["content-type"]="application/x-www-form-urlencoded"):e.body!==void 0&&(t.init.body=e.body),(n=t.init.headers).accept||(n.accept=me[t.responseType]),t}};m.VERSION=2,m.userAgent=D()?`fetcher${m.VERSION}`:void 0;let _=m;function ke(a={}){return _.create(a)}const we={class:"app-content"},be={key:0},Re={key:1},Te=["disabled","onClick"],Se=Z({__name:"TranslationDemo",setup(a){const e=q(new de({defaultLocale:"en",currentLocale:"en",supportedLocales:["en","ru"],translationLoader:new le(ke({baseUrl:"lang"}))})),t=q(!0),s=C(()=>e.value.translate("key1")),r=C(()=>e.value.translate("key2"));return ee(async()=>{await e.value.loadLocale(["en","ru"]),t.value=!1}),(n,o)=>(k(),w("div",we,[t.value?(k(),w("div",be,"Loading...")):(k(),w("pre",Re,[o[0]||(o[0]=v("translationService.currentLocale == ")),(k(!0),w(te,null,se(e.value.cfg.supportedLocales,l=>(k(),w("button",{disabled:e.value.currentLocale===l,onClick:c=>e.value.currentLocale=l},T(l),9,Te))),256)),v(` +key1: "`+T(s.value)+`" +key2: "`+T(r.value)+`" + +translationService.locales: `+T(e.value.locales)+` +`,1)]))]))}}),ve={id:"translationservice",tabindex:"-1"},$e=JSON.parse('{"title":"TranslationService","description":"","frontmatter":{},"headers":[],"relativePath":"translation.md","filePath":"translation.md"}'),xe={name:"translation.md"},Pe=Object.assign(xe,{setup(a){return(e,t)=>{const s=ae("Badge");return k(),w("div",null,[M("h1",ve,[t[0]||(t[0]=v("TranslationService ")),I(s,{text:"experimental",type:"warning"}),t[1]||(t[1]=v()),t[2]||(t[2]=M("a",{class:"header-anchor",href:"#translationservice","aria-label":'Permalink to "TranslationService "'},"​",-1))]),t[3]||(t[3]=re(`

Demo

ts
const translationService = new TranslationService({
+  defaultLocale: 'en',
+  supportedLocales: ['en', 'ru'],
+  translationLoader: new FetchTranslationLoader({
+    prefixUrl: 'lang',
+  }),
+})
+
+translationService.translate('key1')
+// value 1 en
`,2)),I(Se)])}}});export{$e as __pageData,Pe as default}; diff --git a/assets/translation.md.sdEI0Jge.lean.js b/assets/translation.md.sdEI0Jge.lean.js new file mode 100644 index 00000000..027d42f4 --- /dev/null +++ b/assets/translation.md.sdEI0Jge.lean.js @@ -0,0 +1,16 @@ +import{E as S,S as b}from"./chunks/types.C-9dMxxX.js";import{i as D}from"./chunks/env.bTBnF6u3.js";import{A as W,T as N,a as j,U as V,b as L,c as Y,d as z,e as J,f as K,H as F,_ as Q}from"./chunks/stringify.CRXUkG82.js";import{a as U,b as $,c as P,d as B,e as X,f as O}from"./chunks/object.util.ThuQ4YBC.js";import{d as Z,p as q,h as C,v as ee,o as k,c as w,a as v,F as te,C as se,t as T,j as M,G as I,a0 as re,B as ae}from"./chunks/framework.K5DDegrV.js";import"./chunks/is.util.BDVbkSgX.js";function ne(a,e=Error){if(!(a instanceof e))throw new W(`Expected to be instanceof ${e.name}, actual typeof: ${typeof a}`)}function ie(a,e){if(!(a instanceof e))throw a}async function oe(a=0,e){return await new Promise((t,s)=>setTimeout(e instanceof Error?s:t,a,e))}class le{constructor(e){this.fetcher=e}async load(e){return await this.fetcher.get(`${e}.json`)}}async function ce(a,e,t={}){const s=[...a],r=s.length;if(r===0)return[];const{concurrency:n=1/0,errorMode:o=E.THROW_IMMEDIATELY,logger:l=console}=t;if(n===1)return await he(s,e,o,l);if(s.length<=n)return await ue(s,e,o,l);const c=[],h=[];let i=!1,d=0,y=0;return await new Promise((g,f)=>{const u=()=>{if(i)return;const R=s[y],A=y++;if(y>r){if(d===0){i=!0;const p=c.filter(x=>x!==b);h.length?f(new AggregateError(h,`pMap resulted in ${h.length} error(s)`)):g(p)}return}d++,Promise.resolve(R).then(async p=>await e(p,A)).then(p=>{if(p===S)return i=!0,g(c.filter(x=>x!==b));c[A]=p,d--,u()},p=>{o===E.THROW_IMMEDIATELY?(i=!0,f(p)):(o===E.THROW_AGGREGATED?h.push(p):l==null||l.error(p),d--,u())})};for(let R=0;Re(o,l)))).filter(o=>o!==b&&o!==S);const r=[],n=[];for(const o of await Promise.allSettled(a.map((l,c)=>e(l,c))))if(o.status==="fulfilled"){if(o.value===S)break;o.value!==b&&r.push(o.value)}else t===E.THROW_AGGREGATED?n.push(o.reason):s==null||s.error(o.reason);if(n.length)throw new AggregateError(n,`pMap resulted in ${n.length} error(s)`);return r}const fe=a=>(console.warn(`[tr] missing: ${a}`),`[${a}]`);class de{constructor(e,t={}){this.cfg={...e,missingTranslationHandler:fe},this.locales={...t},this.currentLocale=e.currentLocale||e.defaultLocale}setLocale(e,t){this.locales[e]=t}getLocale(e){return this.locales[e]}async loadLocale(e){const t=Array.isArray(e)?e:[e];await ce(t,async s=>{this.locales[s]||(this.locales[s]=await this.cfg.translationLoader.load(s))})}translate(e,t){return this.translateIfExists(e,t)||this.cfg.missingTranslationHandler(e,t)}translateIfExists(e,t){var s,r;return((s=this.locales[this.currentLocale])==null?void 0:s[e])||((r=this.locales[this.cfg.defaultLocale])==null?void 0:r[e])}}function H(a,e=Date.now()){return G(e-a)}function G(a){if(a<1e3)return`${Math.round(a)} ms`;if(a<5e3){const n=a/1e3;return`${Math.trunc(n)===n?n:n.toFixed(3)} sec`}const e=Math.floor(a/1e3)%60,t=Math.floor(a/(60*1e3))%60,s=Math.floor(a/(3600*1e3));return s===0?t===0?`${e} sec`:`${t}m${e}s`:s<24?`${s}h${t}m`:s<48?`${Math.round(s+t/60)}h`:`${Math.floor(s/24)} days`}async function pe(a,e){if(!e.timeout)return await a();const{timeout:t,name:s=a.name||"pTimeout function",onTimeout:r}=e,n=e.fakeError||new Error("TimeoutError");return await new Promise(async(o,l)=>{const c=setTimeout(()=>{const h=new N(`"${s}" timed out after ${t} ms`,e.errorData);if(h.stack=n.stack.replace("Error: TimeoutError","TimeoutError: "+h.message),r){try{o(r(h))}catch(i){i.stack=n.stack.replace("Error: TimeoutError",i.name+": "+i.message),l(j(i,e.errorData))}return}l(h)},t);try{o(await a())}catch(h){l(h)}finally{clearTimeout(c)}})}var E=(a=>(a.THROW_IMMEDIATELY="THROW_IMMEDIATELY",a.THROW_AGGREGATED="THROW_AGGREGATED",a.SUPPRESS="SUPPRESS",a))(E||{});function ye(a,e,t){return a<=e?e:a>=t?t:a}const ge=["GET","POST","PUT","PATCH","DELETE","HEAD"],me={text:"text/plain",json:"application/json",void:"*/*",readableStream:"application/octet-stream",arrayBuffer:"application/octet-stream",blob:"application/octet-stream"},Ee={count:2,timeout:1e3,timeoutMax:3e4,timeoutMultiplier:2},m=class m{constructor(e={}){if(typeof globalThis.fetch!="function")throw new TypeError("globalThis.fetch is not available");this.cfg=this.normalizeCfg(e);for(const t of ge){const s=t.toLowerCase();if(this[`${s}Void`]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"void",...n}),t==="HEAD")return;this[`${s}Text`]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"text",...n}),this[s]=async(r,n)=>await this.fetch({url:r,method:t,responseType:"json",...n})}}onBeforeRequest(e){var t;return((t=this.cfg.hooks).beforeRequest||(t.beforeRequest=[])).push(e),this}onAfterResponse(e){var t;return((t=this.cfg.hooks).afterResponse||(t.afterResponse=[])).push(e),this}onBeforeRetry(e){var t;return((t=this.cfg.hooks).beforeRetry||(t.beforeRetry=[])).push(e),this}onError(e){var t;return((t=this.cfg.hooks).onError||(t.onError=[])).push(e),this}static create(e={}){return new m(e)}async getReadableStream(e,t){return await this.fetch({url:e,responseType:"readableStream",...t})}async fetch(e){const t=await this.doFetch(e);if(t.err)throw t.err;return t.body}async expectError(e){const t=await this.doFetch(e);if(!t.err)throw new V("Fetch was expected to error");return ne(t.err,F),t.err}async tryFetch(e){const t=await this.doFetch(e);return t.err?(ie(t.err,F),[t.err,null]):[null,t.body]}async doFetch(e){var d,y,g;const t=this.normalizeOptions(e),{logger:s}=this.cfg,{timeoutSeconds:r,init:{method:n}}=t;for(const f of this.cfg.hooks.beforeRequest||[])await f(t);const l=t.fullUrl.includes("://")?new URL(t.fullUrl):void 0,c=l?this.getShortUrl(l):t.fullUrl,h=[n,c].join(" "),i={req:t,retryStatus:{retryAttempt:0,retryStopped:!1,retryTimeout:t.retry.timeout},signature:h};for(;!i.retryStatus.retryStopped;){t.started=Date.now();let f;if(r){const u=new AbortController;t.init.signal=u.signal,f=setTimeout(()=>{u.abort(new N(`request timed out after ${r} sec`))},r*1e3)}if(t.logRequest){const{retryAttempt:u}=i.retryStatus;s.log([" >>",h,u&&`try#${u+1}/${t.retry.count+1}`].filter(Boolean).join(" ")),t.logRequestBody&&t.init.body&&s.log(t.init.body)}try{i.fetchResponse=await(this.cfg.fetchFn||m.callNativeFetch)(t.fullUrl,t.init),i.ok=i.fetchResponse.ok,i.err=void 0}catch(u){i.err=L(u),i.ok=!1,i.fetchResponse=void 0}finally{clearTimeout(f)}if(i.statusFamily=this.getStatusFamily(i),i.statusCode=(d=i.fetchResponse)==null?void 0:d.status,(y=i.fetchResponse)!=null&&y.ok||!t.throwHttpErrors)try{await pe(async()=>await this.onOkResponse(i),{timeout:r*1e3||Number.POSITIVE_INFINITY,name:"Fetcher.downloadBody"})}catch(u){i.err=L(u),i.ok=!1,await this.onNotOkResponse(i)}else await this.onNotOkResponse(i)}if(i.err){j(i.err,t.errorData),(g=t.onError)==null||g.call(t,i.err);for(const f of this.cfg.hooks.onError||[])await f(i.err)}for(const f of this.cfg.hooks.afterResponse||[])await f(i);return i}async onOkResponse(e){const{req:t}=e,{responseType:s}=e.req;if(s==="json")if(e.fetchResponse.body){const r=await e.fetchResponse.text();r?(e.body=r,e.body=Y(r,t.jsonReviver)):e.body={}}else e.body={};else if(s==="text")e.body=e.fetchResponse.body?await e.fetchResponse.text():"";else if(s==="arrayBuffer")e.body=e.fetchResponse.body?await e.fetchResponse.arrayBuffer():{};else if(s==="blob")e.body=e.fetchResponse.body?await e.fetchResponse.blob():{};else if(s==="readableStream"&&(e.body=e.fetchResponse.body,e.body===null))throw new Error("fetchResponse.body is null");if(e.retryStatus.retryStopped=!0,(!e.err||!t.throwHttpErrors)&&t.logResponse){const{retryAttempt:r}=e.retryStatus,{logger:n}=this.cfg;n.log([" <<",e.fetchResponse.status,e.signature,r&&`try#${r+1}/${t.retry.count+1}`,H(e.req.started)].filter(Boolean).join(" ")),t.logResponseBody&&e.body!==void 0&&n.log(e.body)}}static async callNativeFetch(e,t){return await globalThis.fetch(e,t)}async onNotOkResponse(e){var n;let t;if(!e.body&&e.fetchResponse)try{e.body=z(await e.fetchResponse.text())}catch{}e.err?t=J(e.err):e.body?t=K(e.body):t={name:"Error",message:"Fetch failed",data:{}};let s=((n=e.fetchResponse)==null?void 0:n.status)||0;e.statusFamily===2&&(e.statusFamily=void 0,e.statusCode=void 0,s=0);const r=[e.statusCode,e.signature].filter(Boolean).join(" ");e.err=new F(r,U({response:e.fetchResponse,responseStatusCode:s,requestUrl:e.req.fullUrl,requestBaseUrl:this.cfg.baseUrl||void 0,requestMethod:e.req.init.method,requestSignature:e.signature,requestDuration:Date.now()-e.req.started}),{cause:t}),await this.processRetry(e)}async processRetry(e){var l;const{retryStatus:t}=e;this.shouldRetry(e)||(t.retryStopped=!0);for(const c of this.cfg.hooks.beforeRetry||[])await c(e);const{count:s,timeoutMultiplier:r,timeoutMax:n}=e.req.retry;if(t.retryAttempt>=s&&(t.retryStopped=!0),e.err&&(!t.retryStopped||e.req.logResponse)&&this.cfg.logger.error([" <<",((l=e.fetchResponse)==null?void 0:l.status)||0,e.signature,s&&(t.retryAttempt||!t.retryStopped)&&`try#${t.retryAttempt+1}/${s+1}`,H(e.req.started)].filter(Boolean).join(" ")+` +`,Q(e.err.cause||e.err)),t.retryStopped)return;t.retryAttempt++,t.retryTimeout=ye(t.retryTimeout*r,0,n);const o=this.getRetryTimeout(e);e.req.debug&&this.cfg.logger.log(` .. ${e.signature} waiting ${G(o)}`),await oe(o)}getRetryTimeout(e){let t=0;if(e.fetchResponse&&[429,503].includes(e.fetchResponse.status)){const s=e.fetchResponse.headers.get("retry-after")??e.fetchResponse.headers.get("x-ratelimit-reset");if(s){if(Number(s))t=Number(s)*1e3;else{const r=new Date(s);Number.isNaN(r)||(t=Number(r)-Date.now())}this.cfg.logger.log(`retry-after: ${s}`),t||this.cfg.logger.warn("retry-after could not be parsed")}}if(!t){const s=Math.random()*500;t=e.retryStatus.retryTimeout+s}return t}shouldRetry(e){var h,i,d,y,g;const{retryPost:t,retry3xx:s,retry4xx:r,retry5xx:n}=e.req,{method:o}=e.req.init;if(o==="POST"&&!t)return!1;const{statusFamily:l}=e,c=((h=e.fetchResponse)==null?void 0:h.status)||0;return l===5&&!n?!1:[408,429].includes(c)?!0:!(l===4&&!r||l===3&&!s||(g=(y=(d=(i=e.err)==null?void 0:i.cause)==null?void 0:d.cause)==null?void 0:y.message)!=null&&g.includes("unexpected redirect"))}getStatusFamily(e){var s;const t=(s=e.fetchResponse)==null?void 0:s.status;if(t){if(t>=500)return 5;if(t>=400)return 4;if(t>=300)return 3;if(t>=200)return 2;if(t>=100)return 1}}getShortUrl(e){const{baseUrl:t}=this.cfg;e.password&&(e=new URL(e.toString()),e.password="[redacted]");let s=e.toString();return this.cfg.logWithSearchParams||(s=s.split("?")[0]),!this.cfg.logWithBaseUrl&&t&&s.startsWith(t)&&(s=s.slice(t.length)),s}normalizeCfg(e){var r;(r=e.baseUrl)!=null&&r.endsWith("/")&&(console.warn(`Fetcher: baseUrl should not end with slash: ${e.baseUrl}`),e.baseUrl=e.baseUrl.slice(0,e.baseUrl.length-1));const{debug:t=!1}=e,s=$({baseUrl:"",inputUrl:"",responseType:"json",searchParams:{},timeoutSeconds:30,retryPost:!1,retry3xx:!1,retry4xx:!1,retry5xx:!0,logger:e.logger||console,debug:t,logRequest:t,logRequestBody:t,logResponse:t,logResponseBody:t,logWithBaseUrl:D(),logWithSearchParams:!0,retry:{...Ee},init:{method:e.method||"GET",headers:U({"user-agent":m.userAgent,...e.headers}),credentials:e.credentials,redirect:e.redirect},hooks:{},throwHttpErrors:!0,errorData:{}},P(e,["method","credentials","headers","redirect","logger"]));return s.init.headers=B(s.init.headers,n=>n.toLowerCase()),s}normalizeOptions(e){var n;const t={...X(this.cfg,["timeoutSeconds","retryPost","retry4xx","retry5xx","responseType","jsonReviver","logRequest","logRequestBody","logResponse","logResponseBody","debug","throwHttpErrors","errorData"]),started:Date.now(),...P(e,["method","headers","credentials"]),inputUrl:e.url||"",fullUrl:e.url||"",retry:{...this.cfg.retry,...O(e.retry||{})},init:$({...this.cfg.init,headers:{...this.cfg.init.headers},method:e.method||this.cfg.init.method,credentials:e.credentials||this.cfg.init.credentials,redirect:e.redirect||this.cfg.init.redirect||"follow"},{headers:B(e.headers||{},o=>o.toLowerCase())})};U(t.init.headers,!0);const s=e.baseUrl||this.cfg.baseUrl;s&&(t.fullUrl.startsWith("/")&&(console.warn("Fetcher: url should not start with / when baseUrl is specified"),t.fullUrl=t.fullUrl.slice(1)),t.fullUrl=`${s}/${t.inputUrl}`);const r=O({...this.cfg.searchParams,...e.searchParams});if(Object.keys(r).length){const o=new URLSearchParams(r).toString();t.fullUrl+=(t.fullUrl.includes("?")?"&":"?")+o}return e.json!==void 0?(t.init.body=JSON.stringify(e.json),t.init.headers["content-type"]="application/json"):e.text!==void 0?(t.init.body=e.text,t.init.headers["content-type"]="text/plain"):e.form?e.form instanceof URLSearchParams||e.form instanceof FormData?t.init.body=e.form:(t.init.body=new URLSearchParams(e.form),t.init.headers["content-type"]="application/x-www-form-urlencoded"):e.body!==void 0&&(t.init.body=e.body),(n=t.init.headers).accept||(n.accept=me[t.responseType]),t}};m.VERSION=2,m.userAgent=D()?`fetcher${m.VERSION}`:void 0;let _=m;function ke(a={}){return _.create(a)}const we={class:"app-content"},be={key:0},Re={key:1},Te=["disabled","onClick"],Se=Z({__name:"TranslationDemo",setup(a){const e=q(new de({defaultLocale:"en",currentLocale:"en",supportedLocales:["en","ru"],translationLoader:new le(ke({baseUrl:"lang"}))})),t=q(!0),s=C(()=>e.value.translate("key1")),r=C(()=>e.value.translate("key2"));return ee(async()=>{await e.value.loadLocale(["en","ru"]),t.value=!1}),(n,o)=>(k(),w("div",we,[t.value?(k(),w("div",be,"Loading...")):(k(),w("pre",Re,[o[0]||(o[0]=v("translationService.currentLocale == ")),(k(!0),w(te,null,se(e.value.cfg.supportedLocales,l=>(k(),w("button",{disabled:e.value.currentLocale===l,onClick:c=>e.value.currentLocale=l},T(l),9,Te))),256)),v(` +key1: "`+T(s.value)+`" +key2: "`+T(r.value)+`" + +translationService.locales: `+T(e.value.locales)+` +`,1)]))]))}}),ve={id:"translationservice",tabindex:"-1"},$e=JSON.parse('{"title":"TranslationService","description":"","frontmatter":{},"headers":[],"relativePath":"translation.md","filePath":"translation.md"}'),xe={name:"translation.md"},Pe=Object.assign(xe,{setup(a){return(e,t)=>{const s=ae("Badge");return k(),w("div",null,[M("h1",ve,[t[0]||(t[0]=v("TranslationService ")),I(s,{text:"experimental",type:"warning"}),t[1]||(t[1]=v()),t[2]||(t[2]=M("a",{class:"header-anchor",href:"#translationservice","aria-label":'Permalink to "TranslationService "'},"​",-1))]),t[3]||(t[3]=re(`

Demo

ts
const translationService = new TranslationService({
+  defaultLocale: 'en',
+  supportedLocales: ['en', 'ru'],
+  translationLoader: new FetchTranslationLoader({
+    prefixUrl: 'lang',
+  }),
+})
+
+translationService.translate('key1')
+// value 1 en
`,2)),I(Se)])}}});export{$e as __pageData,Pe as default}; diff --git a/assets/types.md.DeneRag6.js b/assets/types.md.DeneRag6.js new file mode 100644 index 00000000..db7d142a --- /dev/null +++ b/assets/types.md.DeneRag6.js @@ -0,0 +1,11 @@ +import{_ as i,c as a,a0 as t,o as e}from"./chunks/framework.K5DDegrV.js";const o=JSON.parse('{"title":"Types","description":"","frontmatter":{},"headers":[],"relativePath":"types.md","filePath":"types.md"}'),h={name:"types.md"};function n(p,s,l,k,r,d){return e(),a("div",null,s[0]||(s[0]=[t(`

Types

Things that should exist in type-fest, but don't (yet).

Some types are copy-pasted from type-fest, because:

  1. To not introduce (another) dependency of this 0-dep lib
  2. To avoid multiple type-fest versions conflicts (that happened many times in the past)

StringMap

ts
const m: StringMap = { a: 'a' }
+// Same as:
+// const m: { [a: string]: string | undefined }
+
+const m: StringMap<number> = { a: 5 }
+// Same as:
+// const m: { [a: string]: number | undefined }

The | undefined part is important!

It allows to set undefined values to StringMap, e.g:

ts
m.name = name1 // where \`name1\` can be undefined

Mapper

ts
export type Mapper<IN = any, OUT = any> = (input: IN, index: number) => OUT

AsyncMapper

ts
export type AsyncMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT | PromiseLike<OUT>

Predicate

ts
export type Predicate<T> = (item: T, index: number) => boolean

Async Predicate

ts
export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>

_passthroughPredicate

Predicate that passes everything (returns true for every item).

ts
_passthroughPredicate(anything) // true
+  [(1, 2, 3)].filter(_passthroughPredicate)
+// [1, 2, 3]

_passNothingPredicate

Predicate that passes nothing (returns false for every item).

ts
_passNothingPredicate(anything) // false
+  [(1, 2, 3)].filter(_passNothingPredicate)
+// []

_noop

Function that takes any arguments and returns undefined. Literally does nothing.

Can be useful to replace some real world functions with mocks.

ts
element.click = _noop

Merge

ReadonlyDeep

Promisable

PromiseValue

`,31)]))}const y=i(h,[["render",n]]);export{o as __pageData,y as default}; diff --git a/assets/types.md.DeneRag6.lean.js b/assets/types.md.DeneRag6.lean.js new file mode 100644 index 00000000..db7d142a --- /dev/null +++ b/assets/types.md.DeneRag6.lean.js @@ -0,0 +1,11 @@ +import{_ as i,c as a,a0 as t,o as e}from"./chunks/framework.K5DDegrV.js";const o=JSON.parse('{"title":"Types","description":"","frontmatter":{},"headers":[],"relativePath":"types.md","filePath":"types.md"}'),h={name:"types.md"};function n(p,s,l,k,r,d){return e(),a("div",null,s[0]||(s[0]=[t(`

Types

Things that should exist in type-fest, but don't (yet).

Some types are copy-pasted from type-fest, because:

  1. To not introduce (another) dependency of this 0-dep lib
  2. To avoid multiple type-fest versions conflicts (that happened many times in the past)

StringMap

ts
const m: StringMap = { a: 'a' }
+// Same as:
+// const m: { [a: string]: string | undefined }
+
+const m: StringMap<number> = { a: 5 }
+// Same as:
+// const m: { [a: string]: number | undefined }

The | undefined part is important!

It allows to set undefined values to StringMap, e.g:

ts
m.name = name1 // where \`name1\` can be undefined

Mapper

ts
export type Mapper<IN = any, OUT = any> = (input: IN, index: number) => OUT

AsyncMapper

ts
export type AsyncMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT | PromiseLike<OUT>

Predicate

ts
export type Predicate<T> = (item: T, index: number) => boolean

Async Predicate

ts
export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>

_passthroughPredicate

Predicate that passes everything (returns true for every item).

ts
_passthroughPredicate(anything) // true
+  [(1, 2, 3)].filter(_passthroughPredicate)
+// [1, 2, 3]

_passNothingPredicate

Predicate that passes nothing (returns false for every item).

ts
_passNothingPredicate(anything) // false
+  [(1, 2, 3)].filter(_passNothingPredicate)
+// []

_noop

Function that takes any arguments and returns undefined. Literally does nothing.

Can be useful to replace some real world functions with mocks.

ts
element.click = _noop

Merge

ReadonlyDeep

Promisable

PromiseValue

`,31)]))}const y=i(h,[["render",n]]);export{o as __pageData,y as default}; diff --git a/assets/units.md.DvaOJ7Hr.js b/assets/units.md.DvaOJ7Hr.js new file mode 100644 index 00000000..016cd119 --- /dev/null +++ b/assets/units.md.DvaOJ7Hr.js @@ -0,0 +1,8 @@ +import{_ as i,c as a,a0 as h,o as n}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Units","description":"","frontmatter":{},"headers":[],"relativePath":"units.md","filePath":"units.md"}'),t={name:"units.md"};function k(l,s,p,e,r,d){return n(),a("div",null,s[0]||(s[0]=[h(`

Units

_kb, _mb, _gb, _hb

Human-prints byte number into kilobytes, megabytes, gigabutes and "human-bytes" (_hb):

ts
_hb(0) // '0 byte(s)'
+_hb(500) // '500 byte(s)'
+_hb(1000) // '1 Kb'
+_hb(1024 ** 2) // '1 Mb'
+_hb(1024 ** 3) // '1 Gb'
+_kb(1000) // 1
+_mb(1024 ** 2) // 1
+_gb(1024 ** 3) // 1
`,4)]))}const y=i(t,[["render",k]]);export{g as __pageData,y as default}; diff --git a/assets/units.md.DvaOJ7Hr.lean.js b/assets/units.md.DvaOJ7Hr.lean.js new file mode 100644 index 00000000..016cd119 --- /dev/null +++ b/assets/units.md.DvaOJ7Hr.lean.js @@ -0,0 +1,8 @@ +import{_ as i,c as a,a0 as h,o as n}from"./chunks/framework.K5DDegrV.js";const g=JSON.parse('{"title":"Units","description":"","frontmatter":{},"headers":[],"relativePath":"units.md","filePath":"units.md"}'),t={name:"units.md"};function k(l,s,p,e,r,d){return n(),a("div",null,s[0]||(s[0]=[h(`

Units

_kb, _mb, _gb, _hb

Human-prints byte number into kilobytes, megabytes, gigabutes and "human-bytes" (_hb):

ts
_hb(0) // '0 byte(s)'
+_hb(500) // '500 byte(s)'
+_hb(1000) // '1 Kb'
+_hb(1024 ** 2) // '1 Mb'
+_hb(1024 ** 3) // '1 Gb'
+_kb(1000) // 1
+_mb(1024 ** 2) // 1
+_gb(1024 ** 3) // 1
`,4)]))}const y=i(t,[["render",k]]);export{g as __pageData,y as default}; diff --git a/bot.html b/bot.html new file mode 100644 index 00000000..1323179b --- /dev/null +++ b/bot.html @@ -0,0 +1,35 @@ + + + + + + BotDetectionService | js-lib + + + + + + + + + + + + + + +
Skip to content

BotDetectionService experimental

Allows to detect simple (non-sophisticated) bots.

Example usage:

ts
import { BotDetectionService } from '@naturalcycles/js-lib'
+
+const botDetectionService = new BotDetectionService()
+
+botDetectionService.isBot() // true/false
+botDetectionService.isCDP() // true/false
+botDetectionService.getBotReason() // BotReason enum

Demo

isBot: false
+isCDP: false
+isBotOrCDP: false
+botReason: null
+
+ + + + \ No newline at end of file diff --git a/custom.css b/custom.css new file mode 100644 index 00000000..ccb09df6 --- /dev/null +++ b/custom.css @@ -0,0 +1,21 @@ +.app-content button { + border: 1px solid #aaa; + border-radius: 4px; + background-color: #eee; + padding: 4px 16px; + margin: 0 2px; + cursor: pointer; +} + +.app-content button:hover { + background-color: #ddd; +} + +.app-content button[disabled] { + color: #aaa; + cursor: default; +} + +.app-content button[disabled]:hover { + background-color: #eee; +} diff --git a/date.html b/date.html new file mode 100644 index 00000000..be6e6cea --- /dev/null +++ b/date.html @@ -0,0 +1,24 @@ + + + + + + LocalDate, LocalTime | js-lib + + + + + + + + + + + + + +
Skip to content

LocalDate, LocalTime

Why?

Serves as an alternative / replacement of Moment.js / Day.js.

It tries to address the shortcomings of Day.js and time-lib.

time-lib was created as a wrapper around Day.js, due to following limitations:

  • Day.js doesn't provide all features that we need without plugins. This creates an "import problem": you cannot just import dayjs, you need to import it from a place that had plugins properly installed and initialized. It immediately creates an "import ambiguity": should I import from dayjs or from my_code/dayjs.ts?
  • Day.js is created as CommonJS module, all plugins has to be explicitly required. There are issues around TypeScript esModuleInterop. Result of it is that we needed to completely fork Day.js types and put it into time-lib.
  • There are more/deeper ESM issues when it's used in ESM context (e.g with Vite).

Next level of reasoning is that we needed our own opinionated API that would use standards that we use, for example:

  • We always use classic Unixtime (in seconds, not milliseconds)
  • We always use classic ISO8601 date without timezone, e.g 1984-06-21

Just the second/millisecond confusion can create serious bugs.

Mixup between similarly-called .toISOString and .toISODate can create very subtle bugs.

So, after multiple issues being accumulated and inability to properly fork Day.js, it was decided to try and simply rewrite Day.js functionality into LocalDate and LocalTime.

Reasons:

  • No milliseconds in the API (not needed)
  • Classic UnixTime, never "millisecond unixtime"
  • No timezone support/confusion, all dates/times are always treated as "local" (inspired by Java LocalDate/LocalDateTime)
  • Ability to parse "timezone-aware ISO8601 string", e.g 1984-06-21T17:15:02+02 into a LocalDate of just 1984-06-21 or LocalTime of 1984-06-21T17:15:02 (try achieving it with Moment.js or Day.js!)
  • .toJSON automatically formats LocalTime as unixtimestamp, LocalDate as ISO8601 date-only string
  • Prevents dayjs(undefined) being dayjs.now()
  • Strict parsing/validation by default. Will validate all input upon creation and will throw parse error on any invalid input. We believe it allows to catch errors sooner.
  • Optimized for performance and code maintenance, not on code size (as Day.js is, which results in its poorer performance in certain cases, and/or in less code maintainability)
  • No arbitrary .format by design. List of well-known format outputs instead.
  • Separate LocalDate class for simplified (and more performant) dealing with "just Dates without time information". Similar to Java's LocalDate. It allows much more simple and robust implementation, compared to dealing with js Date object intricacies (mostly around timezones).

API

API is designed to be closely (but not 100%) compatible with Day.js/Moment.js.

Examples:

day.js (via time-lib)LocalTimeLocalDate
nowdayjs()localTime.now()
todaydayjs().startOf('day')localDate.today()
create from unixtimestampdayjs.unix(ts)localTime(ts)
parse from ISO8601 date stringdayjs(str)localDate(str)
parse from ISO8601 date+time stringdayjs(str)localTime(str)
now plus 1 hourdayjs().add(1, 'hour')localTime().plus(1, 'hour')
today plus 1 daydayjs().startOf('day').add(1, 'day')localDate().plus(1, 'day')
toISODate (just date)dayjs().toISODate()localTime().toISODate()localDate().toISODate()
toISODate with timedayjs().format()localTime().toISODateTime()
diff in daysdayjs().diff(other, 'day')localTime().diff(other, 'day')localDate().diff(other, 'day')
to unixtimestampdayjs().unix()localTime().unix()localDate().unix()
isBeforedayjs().isBefore(other)localTime().isBefore(other)localDate().isBefore(other)

As you can see above - API is kept very similar.

DateInterval

Useful to describe an interval of Dates, e.g [inclusive] interval between 1984-06-21 and 1984-07-11 can be described as 1984-06-21/1984-07-11 (as per ISO8601).

.toJSON automatically stringifies DateInterval into a string.

Create DateInterval: DateInterval.parse('1984-06-21/1984-07-11') or DateInterval.of('1984-06-21', '1984-07-11').

+ + + + \ No newline at end of file diff --git a/decorators.html b/decorators.html new file mode 100644 index 00000000..91e7ac5b --- /dev/null +++ b/decorators.html @@ -0,0 +1,80 @@ + + + + + + Decorators | js-lib + + + + + + + + + + + + + +
Skip to content

Decorators

@_Debounce

Wrapper around _debounce.

@_Throttle

Wrapper around _throttle.

@_LogMethod

Allows to Log every execution of the method.

Console-logs when method had started, when it finished, time taken and if error happened.

Supports both sync and async methods.

Awaits if method returns a Promise.

Example output:

>> syncMethodSuccess()
+<< syncMethodSuccess() took 124 ms
+
+>> asyncMethod()
+<< asyncMethodThrow() took 10 ms ERROR: MyError
ts
class C {
+  @_LogMethod()
+  async hello() { ... }
+}

@_Memo

Powerful Memoization decorator.

Simplest usage:

ts
class C {
+  @_Memo()
+  async init() { ... }
+}
+
+await c.init() // first time will run the initialization
+
+await c.init() // second time it'll skip it
+// Allows "max 1 execution" pattern

Memoization caches values for each unique set of input parameters. So, e.g, if you want to hit a somewhat slow/expensive endpoint, you may want to cache it in memory like this:

ts
class C {
+  @_Memo()
+  async getExchangeRates(day: string) { ... }
+}
+
+// First time will hit the endpoint
+await c.getExchangeRates('2021-06-21')
+
+// Second time will immediately return cached result, cause the input is the same
+await c.getExchangeRates('2021-06-21')
+
+// Input has changed, so it's a cache-miss, will hit the endpoint
+await c.getExchangeRates('2021-06-22')

Pay attention that the cache of the returned values is kept forever, so, be mindful of possible memory leaks.

nodejs-lib (link pending) has a LRUMemoCache class that impements LRU cache. Example:

ts
@_Memo({ cacheFactory: () => new LRUMemoCache({...}) })
+async someMethod() {}

@_Retry

Wrapper around pRetry.

@_Timeout

Decoratod method will throw TimeoutError if it hasn't finished in given time.

Wrapper around pTimeout.

ts
class C {
+  @_Timeout({ timeout: 1000 })
+  async hello() {
+    // some logic
+  }
+}
+
+const c = new C()
+await c.hello()
+// will throw if not finished in 1000 ms

@_TryCatch

Wraps the method into a try/catch block, console.error(err) on error, but never re-throws (always suppresses the error).

ts
class C {
+  @_TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Wrapper around _tryCatch function.

_createPromiseDecorator

Powerful helper to create your own Decorators around async (Promise-returning) methods.

Example of a @TryCatch decorator that will wrap a method with "try/catch", console.error the error and suppress it (by returning undefined in case of any error).

Example usage:

ts
class C {
+  @TryCatch() // fine if it fails
+  async logSomeAnalytics() {}
+}

Example implementation of such a decorator using _createPromiseDecorator:

ts
export const TryCatch = () =>
+  _createPromiseDecorator({
+    decoratorName: 'TryCatch',
+    catchFn: ({ err, target, key }) => {
+      console.error(err)
+      return undefined
+    },
+  })

_createPromiseDecorator allows you to define your "hooks" on different stages of a Promise:

  • beforeFn: before the method execution
  • thenFn: after successful method execution
  • catchFn: after method throws (returns rejected Promise)
  • finallyFn: after method returns resolved or rejected Promise (useful to e.g "hide the blocking loader")

Example of a @BlockingLoader decorator, that wraps the method, shows the BlockingLoader before the method execution and hides it in the end of the execution (regardless if it errored or succeeded):

ts
export const BlockingLoader = () =>
+  _createPromiseDecorator({
+    decoratorName: 'BlockingLoader',
+    beforeFn: () => store.commit('setBlockingLoader'),
+    catchFn: ({ err }) => errorDialog(err),
+    finallyFn: () => store.commit('setBlockingLoader', false),
+  })
+ + + + \ No newline at end of file diff --git a/error.html b/error.html new file mode 100644 index 00000000..939aeec7 --- /dev/null +++ b/error.html @@ -0,0 +1,51 @@ + + + + + + Error | js-lib + + + + + + + + + + + + + +
Skip to content

Error

_tryCatch

Wraps/decorates a passed function with "try/catch", so it never throws, but logs the error (if occured).

ts
const someDangerousFunction = () => { ... }
+
+const fn = _tryCatch(someDangerousFunction)
+
+fn()
+// will log on error, but never throw

Allows to pass onError() function hook, that will be called on error.

ErrorObject

Standartized "Error object" that contains arbitrary data object that can hold additional data.

This data object is defined as a Generic type to ErrorObject, so, e.g. HttpError has HttpErrorData, which has a mandatory httpStatusCode: number property.

Usage example of that:

ts
.catch((err: HttpErrorObject) => {
+  console.log(err.data.httpStatusCode)
+})

AppError

The most basic implementation of an Error that complies with ErrorObject specification. Difference is that ErrorObject is purely a TypeScript interface (around any JS object), but AppError is a sub-class of Error. So, with AppError you can do if (err instanceof AppError) ....

Because AppError implements ErrorObject, it guarantees an err.data object.

This basic contract allows to establish a standartized interface between the Frontend (in frontend-lib) and Backend (in backend-lib) and implement error-handling more efficiently.

HttpError

Subclass of AppError that has some additional properties inside data, namely: httpStatusCode: number.

HttpErrorResponse

This is a standartized "Error response from the Backend" (as implemented in backend-lib). You can check/assert it with _isHttpErrorResponse, and then have all the guarantees and types about the containing error object.

Handling these type of errors is done "automatically" in getKy of the frontend-lib, and in getGot of the backend-lib.

_anyToError

Cast any to Error.

_errorToErrorObject

Cast Error to ErrorObject.

_isHttpErrorResponse

Assert if provided value: any is a HttpErrorResponse.

_isHttpErrorObject

Assert if provided value: any is a HttpErrorObject (an HttpError, same as AppError<HttpErrorData>).

_isErrorObject

Assert if provided value: any is an ErrorObject.

_assert

Asserts that a boolean condition is truthy, otherwise throws an Error.

Evaluates the condition (casts it to Boolean). Expects it to be truthy, otherwise throws AppError.

Should be used NOT for "expected" / user-facing errors, but vice-versa - for completely unexpected and 100% buggy "should never happen" cases.

It'll result in http 500 on the server (cause that's the right code for "unexpected" errors). Pass { httpStatusCode: x } at errorData argument to override the http code (will be picked up by backend-lib).

API is similar to Node's assert(), except:

  1. Throws js-lib's AppError
  2. Has a default message, if not provided

Since 2024-07-10 it no longer sets userFriendly: true by default.

ts
function run(err: any) {
+  _assert(err instanceof AppError)
+  // from here TypeScript will know that `err instanceof AppError === true`, or `err: AppError`
+
+  // Example with custom error message:
+  _assert(err instanceof AppError, 'error should be of type AppError')
+}

_assertEquals

Similar to _assert, but allows to provide 2 values (first 2 arguments) and throws if they are NOT equal.

Does a shallow equality check (!==), use _assertDeepEquals if you need a deep-check.

_assertDeepEquals

Similar to _assertEquals, but does a deep assertion (using _deepEquals).

_assertIsError

Asserts that passed value is instanceof Error.

_assertsIsTypeOf

Asserts that typeof value matches expected type.

_assertsIsString

Asserts that typeof value === 'string

_assertsIsNumber

Asserts that typeof value === 'number

_try

Calls a function, returns a Tuple of [error, value]. Allows to write shorter code that avoids try/catch. Useful e.g. in unit tests.

Similar to pTry, but for sync functions.

ts
const [err, v] = _try(() => someFunction())

pTry

Loosely inspired by await-to-js.

Similar to _try, but for promises.

Async/await wrapper for easy error handling. Wraps async/await calls in try catch blocks and returns a tuple containing the error or the results of the promise

ts
interface ServerResponse {
+  test: number
+}
+
+interface CustomError {
+  code: number
+  data: {
+    title: string
+    body: string
+  }
+}
+
+const p = Promise.resolve({ test: 123 })
+
+const [err, result] = await pTuple<ServerResponse, CustomError>(p)
+ + + + \ No newline at end of file diff --git a/fetcher.html b/fetcher.html new file mode 100644 index 00000000..b4ab76f8 --- /dev/null +++ b/fetcher.html @@ -0,0 +1,48 @@ + + + + + + Fetcher | js-lib + + + + + + + + + + + + + +
Skip to content

Fetcher

Convenient wrapper around fetch.

Features

  • Works in the Browser and on the Server (Node.js)
  • Convenient API, e.g fetcher.get(), fetcher.post(), etc.
  • Throws HttpError automatically, no need to check if (res.ok)
  • Allows to set timeout
  • Conveniently retries on retry-able errors
  • Allows to conveniently log requests/responses, configurable
  • Allows to convert searchParams object into a query string
  • Allows to define beforeRequest/beforeRetry/afterResponse hooks

Comparison

Fetcher:

tsx
const fetcher = getFetcher()
+
+const result = await fetcher.post('https://example.com', {
+  json: { foo: true },
+})

Ky:

tsx
const result = await ky
+  .post('https://example.com/hello', {
+    json: { foo: true },
+  })
+  .json()

Plain fetch:

tsx
class HTTPError extends Error {}
+
+const response = await fetch('https://example.com', {
+  method: 'POST',
+  body: JSON.stringify({ foo: true }),
+  headers: {
+    'content-type': 'application/json',
+  },
+})
+
+if (!response.ok) {
+  throw new HTTPError(`Fetch error: ${response.statusText}`)
+}
+
+const json = await response.json()
+
+console.log(json)

Prior art

Heavily inspired by:

Why

Differences from prior projects:

  • Targets both Browser and Node by design, targeting Node with native fetch support. This is similar to ky plus ky-universal.
  • Incorporates everything from getKy and getGot, so you don’t need multiple layers. For example, with ky you would need: ky, ky-for-people, getKy (frontend-lib). With fetcher you need only fetcher (part of js-lib).

Goals

  • Simplicity. It focuses on the most simple and common use cases, and not on the most advanced or edge cases.
  • Assume native fetch support (Browser and Node), no polyfills. Should work equally well in Browser and Node, ideally without platform-specific quirks.
  • Written in TypeScript, with first-class TypeScript support.
+ + + + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json new file mode 100644 index 00000000..1cfa6c8a --- /dev/null +++ b/hashmap.json @@ -0,0 +1 @@ +{"adminservice.md":"DEX8Z_en","analytics.md":"CGSkOmQW","array.md":"8RfkJEQT","bot.md":"Ca1yqwEI","date.md":"fBz1xHVA","decorators.md":"BMx2znuH","error.md":"B7d3forK","fetcher.md":"Bbx1Y_i0","httprequesterror.md":"Bg54xUI0","image.md":"DuaiQJHx","index.md":"DzR66xOe","json.md":"M2DNLAza","lazy.md":"D4-FRRZB","loadscript.md":"DCu6jDSc","math.md":"CcBuVUXj","number.md":"DBV5l2dc","object.md":"CwS6Z6VH","promise.md":"R6l4MSsV","string.md":"c0QAifb_","time.md":"CBkLAgvW","translation.md":"sdEI0Jge","types.md":"DeneRag6","units.md":"DvaOJ7Hr"} diff --git a/httpRequestError.html b/httpRequestError.html new file mode 100644 index 00000000..c434f036 --- /dev/null +++ b/httpRequestError.html @@ -0,0 +1,45 @@ + + + + + + js-lib + + + + + + + + + + + + + +
Skip to content
Backend makes a Fetch call to some API
+API returns error1 with 500 and a message1
+Fetcher wraps error1 with error2 which is a FetcherError
+method
+url
+baseUrl?
+statusCode
+millis
+message: 500 GET /someUrl
+causedBy error1
+
+genericErrorHandler needs to return error2
+it wraps error2 (FetchError) with error3: HttpError
+Maybe there's just no need to do that wrapping?! Return ErrorObject as is
+Requester (Fetcher) would always know httpStatusCode of the error they just received
+
+Why is HttpError needed?
+For the Backend to set the right httpStatusCode
+Maybe it's enough to just have it as AppError with httpStatusCode?
+
+Rename HttpError to HttpRequestError, which is the same as FetchError
+HttpErrorResponse becomes BackendErrorResponseObject (detected by name and message)
+ + + + \ No newline at end of file diff --git a/image.html b/image.html new file mode 100644 index 00000000..a69fade9 --- /dev/null +++ b/image.html @@ -0,0 +1,27 @@ + + + + + + Image | js-lib + + + + + + + + + + + + + + + + +
Skip to content

Image experimental

fitImages

Function to Layout images in a way that they fit the available space. Like Google Photos do.

It can probably be called "fixed height layout".

See the demos below. Try resizing the browser window or sliders to see the effect of it.

maxHeight: 300
margin: 8

Loading images...

+ + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 00000000..ee9b252c --- /dev/null +++ b/index.html @@ -0,0 +1,32 @@ + + + + + + js-lib + + + + + + + + + + + + + +
Skip to content

js-lib

Standard library for universal (browser + Node.js) javascript

npmmin.gz sizeActionsloc

MaintainabilityTest Coveragecode style: prettier

Design

Inspired by Lodash, bluebird, promise-fun and other useful small packages.

Designed to play well with the rest of opinionated "Natural Cycles JS Platform" (link pending). This package is the lowest-level production dependency (not devDependency) of the Platform. Almost everything else depends on it.

All functions in this package are exported in index.ts (flat), no namespacing is used. So, to avoid conflicts and "global import namespace" pollution , all functions are prefixed with an underscore (e.g _.pick becomes _pick), with some exceptions (later). Promise functions are prefixed with p, e.g pMap.

Decorators are _prefixed and PascalCased (e.g @_Debounce). _is to be consistent with other naming in this package. PascalCase is to distinguish decorators from similar functions that are not decorators. Example:\_debounceis a function (lodash-based),\_Debounceis a decorator (used as@\_Debounce). PascalCase convention follows Angular/Ionic convention (but doesn't follow TypeScript documentation convention; we had to pick one).

Interfaces and Classes are named as usual (no prefix, PascalCase, e.g AppError).

Q: Why not just use lodash?

A:

  • We believe Lodash is outdated (many functions are pre-ES6 / obsolete by ES6).
  • Because it has so many outdated functions - its size is bigger, and solutions to tree-shake exist, but complicated.
  • First-class TypeScript support (all code in this repo is TypeScript).

This package is intended to be 0-dependency (exception: tslib from TypeScript), "not bloated", tree-shakeable. Supported by reasonably modern Browsers and Node.js latest LTS.

To fulfil that requirement it exports ESM version (for Browsers) as es2017.

Exports default CJS version for Node as es2019 (with native async/await, for better performance, async stack-traces, etc).

Mutation

All function does NOT mutate the arguments by default.

Many functions support "mutation flag", which can be set to true to perform a mutation.

For example:

ts
const obj = { a: 'a', b: 'b' }
+
+// Non-mutating (default)
+const obj2 = _pick(obj, ['a'])
+// { a: 'a' }
+
+// Mutating (opt-in)
+_pick(obj, ['a'], true)
+// obj was mutated

Highlights

+ + + + \ No newline at end of file diff --git a/json.html b/json.html new file mode 100644 index 00000000..ee5aabad --- /dev/null +++ b/json.html @@ -0,0 +1,44 @@ + + + + + + Json | js-lib + + + + + + + + + + + + + +
Skip to content

Json

_jsonParseIfPossible

Attempts to parse object as JSON.

Returns original object if JSON parse failed (silently).

ts
_jsonParseIfPossible('abc') // 'abc' (no change, not a json string)
+_jsonParseIfPossible(null) // null (no change)
+_jsonParseIfPossible({ a: 'a' }) // {a: 'a'} (same object, not a json string)
+_jsonParseIfPossible('{"a": "a"}') // {a: 'a'} gotcha! parsed json string into an object!

_stringify

Inspired by _inspect from nodejs-lib, which is based on util.inpect that is not available in the Browser.

Transforms any to human-readable string (via JSON.stringify pretty).

Safe (no error throwing).

Correclty prints Error, AppError, ErrorObject: error.message + '\n' + _stringify(error.data)

Enforces max length (default to 1000, pass 0 to skip it).

Logs numbers as-is (as a String), e.g: 6.

Logs strings as-is (without single quotes around, unlike default util.inspect behavior).

Otherwise - just uses JSON.stringify.

Returns empty_string string if empty string is passed.

Returns undefined (not a string, but actual undefined) if undefined is passed (default util.inspect behavior).

ts
_stringify(undefined) // 'undefined'
+_stringify(null) // 'null'
+_stringify(true) // 'true'
+_stringify(false) // 'false'
+_stringify(NaN) // 'null'
+_stringify(Infinity) // 'null'
+_stringify('') // 'empty_string'
+_stringify(' ') // 'empty_string'
+_stringify('ho ho ho') // 'ho ho ho'
+_stringify(15) // '15'
+_stringify(new Error('some msg')) // 'Error: some msg'
+
+// AppError is stringified with it's Data object
+_stringify(new AppError('some msg', { k1: 'v1' }))
+// 'AppError: some msg\n
+// {
+//   "k1": "v1"
+// }'
+ + + + \ No newline at end of file diff --git a/lang/en.json b/lang/en.json new file mode 100644 index 00000000..e3e2a236 --- /dev/null +++ b/lang/en.json @@ -0,0 +1,4 @@ +{ + "key1": "value 1 en", + "key2": "value 2 en" +} diff --git a/lang/ru.json b/lang/ru.json new file mode 100644 index 00000000..56cd520b --- /dev/null +++ b/lang/ru.json @@ -0,0 +1,4 @@ +{ + "key1": "value 1 ru", + "key2": "value 2 ru" +} diff --git a/lazy.html b/lazy.html new file mode 100644 index 00000000..6bfdaf00 --- /dev/null +++ b/lazy.html @@ -0,0 +1,37 @@ + + + + + + Lazy | js-lib + + + + + + + + + + + + + +
Skip to content

Lazy

_lazyValue

Based on: https://github.com/sindresorhus/lazy-value

ts
const value = _lazyValue(() => expensiveComputation())
+
+value() // calls expensiveComputation() once
+value() // returns cached result
+value() // returns cached result

_defineLazyProperty

Based on: https://github.com/sindresorhus/define-lazy-prop

ts
interface Obj {
+  v: number
+}
+
+const obj = {} as Obj
+
+_defineLazyProperty(obj, 'v', () => expensiveComputation())
+obj.v // runs expensiveComputation() once
+obj.v // cached value
+obj.v // cached value

_defineLazyProps

Like _defineLazyProperty, but allows to define multiple props at once.

+ + + + \ No newline at end of file diff --git a/loadScript.html b/loadScript.html new file mode 100644 index 00000000..e986db64 --- /dev/null +++ b/loadScript.html @@ -0,0 +1,28 @@ + + + + + + loadScript, loadCSS | js-lib + + + + + + + + + + + + + + + + +
Skip to content

loadScript, loadCSS

typescript
await loadScript('https://gtm.com/script.js')
+// know that your script is loaded by now

Works in old-school (and reliable) way by injecting a <script> tag into dom and attaching onload event that resolves the promise. onerror rejects the promise.

See console output, but it will also do alert(_stringify(err)).



+ + + + \ No newline at end of file diff --git a/math.html b/math.html new file mode 100644 index 00000000..143505c0 --- /dev/null +++ b/math.html @@ -0,0 +1,63 @@ + + + + + + Math | js-lib + + + + + + + + + + + + + +
Skip to content

Math

_randomInt

Returns a random integer in the provided range. As usual, lower-bound is inclusing, while higher-bound is exclusive. Unusually, both lower and higher bounds are inclusive.

ts
_randomInt(1, 3)
+// 1
+// 3
+// 2

_randomArrayItem

Returns a random item from the given array.

Don't use it on empty array. It'll return undefined in that case, but that is not reflected in function's output type!

ts
const a = [1, 2, 3]
+_randomArrayItem(a)
+// random of 1, 2 or 3

_createDeterministicRandom

Returns a "deterministic Math.random() function".

Useful to make tests that need to use Math.random() deterministic.

ts
const deterministicRandom = _createDeterministicRandom()
+
+deterministicRandom()
+// => 0.9872818551957607
+
+deterministicRandom()
+// => 0.34880331158638

Based on this gist which is based on Robert Jenkins’ 32 bit integer hash function.

_average

Calculate an average of the array of numbers.

ts
_average([1, 2, 3, 4])
+// 2.5

_averageWeighted

Calculate a "weighted average", given the array of numbers and corresponding array of weights.

ts
const numbers = [1, 2]
+const weights = [3, 1]
+_averageWeighted(numbers, weights)
+// 1.25

_median

Calculate a Median of the array of numbers.

ts
_median([1, 2, 3]) // 2
+_median([1, 2, 3, 4]) // 2.5
+_median([1, 1, 1, 3, 999]) // 1

_percentile

Calculate a Percentile of the array of numbers.

ts
const numbers = [1200, 1400]
+_percentile(numbers, 0) // 1200
+_percentile(numbers, 10) // 1220
+_percentile(numbers, 20) // 1240
+_percentile(numbers, 30) // 1260
+_percentile(numbers, 40) // 1280
+_percentile(numbers, 50) // 1300
+_percentile(numbers, 60) // 1320
+_percentile(numbers, 70) // 1340
+_percentile(numbers, 80) // 1360
+_percentile(numbers, 90) // 1380
+_percentile(numbers, 100) // 1400

SimpleMovingAverage

ts
// SMA with the size of 2:
+const sma = new SimpleMovingAverage(2)
+sma.avg // 0 by default, when no numbers were pushed
+
+sma.push(1) // [1]
+sma.avg // 1
+
+sma.push(2) // [1, 2]
+sma.avg // 1.5
+
+sma.push(3) // [1, 2, 3]
+sma.avg // 2.5
+ + + + \ No newline at end of file diff --git a/number.html b/number.html new file mode 100644 index 00000000..c75a3e1f --- /dev/null +++ b/number.html @@ -0,0 +1,59 @@ + + + + + + Number | js-lib + + + + + + + + + + + + + +
Skip to content

Number

_inRange

Checks if the provided number (1st argument) is withing range of 2nd and 3rd argument. As usual, lower-bound is inclusive, while higher-boung is exclusive.

ts
_inRange(-10, 1, 5)
+// false
+
+_inRange(1, 1, 5)
+// true
+
+_inRange(3, 1, 5)
+// true
+
+_inRange(5, 1, 5)
+// false
+
+_inRange(7, 1, 5)
+// false

_clamp

Inspired by Lodash's _clamp.

"Clamps" (fits) the number (first argument) within the min/max ranges of 2nd/3rd arguments (range inclusive).

ts
// range is always [5, 10] in these cases
+_clamp(3, 5, 10) // 5
+_clamp(4, 5, 10) // 5
+_clamp(5, 5, 10) // 5
+_clamp(6, 5, 10) // 6
+_clamp(9, 5, 10) // 9
+_clamp(10, 5, 10) // 10
+_clamp(11, 5, 10) // 10

_toFixed

Same as Number.toFixed, but conveniently casts the output to Number.

ts
_toFixed(1.2345, 2)
+// 1.23
+
+_toFixed(1.1, 2)
+// 1.1
+// not '1.10' !

_toPrecision

Same as Number.toPrecision(), but conveniently casts the output to Number.

ts
_toPrecision(1634.56, 1)
+// 2000
+
+_toPrecision(1234.56, 2)
+// 1600

_round

Round (like Math.round) the Number to the nearest "discriminator" (2nd argument):

ts
_round(1634, 1000) // 2000
+_round(1634, 500) // 1500
+_round(1634, 100) // 1600
+_round(1634, 10) // 1630
+_round(1634, 1) // 1634
+_round(1634.5678, 0.1) // 1634.6
+_round(1634.5678, 0.01) // 1634.57
+ + + + \ No newline at end of file diff --git a/object.html b/object.html new file mode 100644 index 00000000..4bf30271 --- /dev/null +++ b/object.html @@ -0,0 +1,304 @@ + + + + + + Object | js-lib + + + + + + + + + + + + + +
Skip to content

Object

_pick

Inspired by Lodash's _.pick.

ts
_pick({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { a: 'a', b: 'b' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// { a: 'a' }
+
+_pick({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// {}
+
+_pick({ a: 'a', b: 'b', c: 'c' }, [])
+// {}
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _pick(obj, ['a'], true)
+obj === obj2 // true

_omit

Inspired by Lodash's _.omit. The opposite of _pick.

ts
_omit({ a: 'a', b: 'b', c: 'c' }, ['a', 'b'])
+// { c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['a'])
+// {  b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, ['d'])
+// { a: 'a', b: 'b', c: 'c' }
+
+_omit({ a: 'a', b: 'b', c: 'c' }, [])
+// { a: 'a', b: 'b', c: 'c' }
+
+// Supports "mutation flag" which would mutate the object and return it (same object):
+const obj = { a: 'a', b: 'b', c: 'c' }
+const obj2 = _omit(obj, ['a', 'b'], true)
+obj === obj2 // true

_mask

Similar to _omit, but supports deep object access via dot-notation (a.b). Supports "mutation flag" argument.

ts
const obj = {
+  a: 'a',
+  b: {
+    b1: 'b1',
+    b2: 'b2',
+  },
+}
+
+_mask(obj, ['b.b1'])
+// { a: 'a', b: { b1: 'b1' }}
+
+_mask(obj, ['b.b1'], true)
+// obj was mutated

_filterFalsyValues

Returns an object with all Falsy values filtered out. Non-mutating by default.

ts
_filterFalsyValues({
+  a: 'a',
+  b: '', // falsy
+  c: 0, // falsy
+  d: [], // not falsy
+})
+// { a: 'a', d: [] }

_filterNullishValues

Returns an object with all Nullish (null or undefined) values filtered out. Non-mutating by default.

ts
_filterNullishValues({
+  a: 'a',
+  b: null, // nullish
+  c: undefined, // nullish
+  d: '', // not nullish
+})
+// { a: 'a', d: '' }

_filterUndefinedValues

Returns an object with all undefined values filtered out. null values are kept.

Non-mutating by default.

ts
_filterUndefinedValues({
+  a: 'a',
+  b: null,
+  c: undefined, // removed
+  d: '',
+})
+// { a: 'a', b: null, d: '' }

_filterEmptyArrays

Returns an object will all empty arrays filtered out. Non-mutating by default.

ts
_filterEmptyArrays({
+  a: 'a',
+  b: [], // empty array
+  c: 'c',
+})
+// { a: 'a', c: 'c' }

_filterEmptyValues

Filters the object by removing all key-value pairs where Value is Empty (according to _isEmpty() specification).

ts
_filterEmptyValues({
+  a: 0,
+  b: '',
+  c: [],
+  d: {},
+  e: {
+    f: [],
+  },
+  g: new Set(),
+  h: 'h',
+})
+// {
+//   a: 0,
+//   e: {
+//     f: [],
+//   },
+//   h: 'h',
+//  })

_filterObject

Returns clone of obj without properties that does not pass predicate. Allows filtering by both key and value.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Predicate to keep only even-numbered values
+_filterObject(obj, (_k, v) => v % 2 === 0)
+// { b: 2 }
+
+// Predicate to only keep keys that start with `a`
+_filterObject(obj, (k, _v) => k.startsWith('a'))
+// { a: 1 }

_mapKeys

Returns a clone of obj with modified Keys, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to add `_odd` or `_even` to the object key, based on its value
+_mapKeys(obj, (k, v) => k + (v % 2 ? '_odd' : '_even'))
+// { a_odd: 1, b_even: 2, c_odd: 3 }

_mapValues

Returns a clone of obj with modified Values, based on a Mapper function.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2
+_mapValues(obj, (_k, v) => v * 2)
+// { a: 2, b: 4, c: 6 }

_mapObject

Returns a clone of obj where both Keys and Values can be modified by a Mapper function. Mapper function needs to return a Tuple [key, value].

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+// Mapper to multiply object values by 2, and append the value to the end of the key
+_mapObject(obj, (k, v) => {
+  const newValue = v * 2
+  return [k + newValue, newValue]
+})
+// { a2: 2, b4: 4, c6: 6 }

_findKeyByValue

Fiven an object, find a key string for a given value: any.

Inspired by Lodash's _.findKey.

ts
const obj = {
+  a: 1,
+  b: 2,
+  c: 3,
+}
+
+_findKeyByValue(obj, 1) // 'a'
+_findKeyByValue(obj, 2) // 'b'
+_findKeyByValue(obj, 3) // 'c'
+_findKeyByValue(obj, 4) // undefined

_objectNullValuesToUndefined

Returns a clone of the object where null values are replaced with undefined

ts
const obj = {
+  a: 1, // intact
+  b: null, // replaced with `undefined`
+  c: undefined, // intact
+}
+
+_objectNullValuesToUndefined(obj)
+// { a: 1, b: undefined, c: undefined }

_deepCopy

Does a deep copy of an object.

Actually, it is just a semantic function that internally does JSON.parse(JSON.stringify(o)), which is currently the fastest+simplest+relyable way to do a deep copy.

Because it does JSON.parse/stringify - it'll remove undefined values/keys from objects.

ts
const obj = { a: 'a', b: { bb: 'bb' } }
+const obj2 = _deepCopy(obj)
+// Deep copy of obj

_isPrimitive

Returns Boolean indication if passed value is a primitive.

ts
_isPrimitive(5)
+// true
+
+_isPrimitive({ a: 'a' })
+// false

Best specification is the source code:

ts
export function _isPrimitive(v: any): v is null | undefined | number | boolean | string {
+  return (
+    v === null ||
+    v === undefined ||
+    typeof v === 'number' ||
+    typeof v === 'boolean' ||
+    typeof v === 'string'
+  )
+}

_isEmpty

Object is considered empty if it's one of:

  • undefined
  • '' (empty string)
  • [] (empty array)
  • {} (empty object)
  • new Map() (empty Map)
  • new Set() (empty Set)

_undefinedIfEmpty

Returns undefined if it's empty (according to _isEmpty() specification), otherwise returns the original object.

ts
_undefinedIfEmpty('') // undefined, because it's empty
+_undefinedIfEmpty([]) // undefined, because it's empty
+_undefinedIfEmpty(new Map()) // undefined, because it's empty
+_undefinedIfEmpty('a') // 'a', intact
+_undefinedIfEmpty(false) // false, intact

_merge

Deeply merges the second object into the first one. Returns the first object (merged). Mutates the first object!

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb1: 'bb1',
+  },
+}
+
+const obj2 = {
+  b: {
+    bb2: 'bb2',
+  },
+  c: 'c',
+}
+
+_merge(obj1, obj2)
+// {
+//   a: 'a',
+//   b: {
+//     bb1: 'bb1',
+//     bb2: 'bb2',
+//   },
+//   c: 'c',
+// }

_deepTrim

Deeply traverses the object and trims all String values found.

ts
const o = {
+  a: 'abc ',
+  b: 'c',
+  d: 12,
+  e: {
+    f: '  sd a ',
+  },
+}
+
+_deepTrim(o)
+// {
+//   a: 'abc',
+//   b: 'c',
+//   d: 12,
+//   e: {
+//     f: 'sd a',
+//   },
+// }

_sortObjectDeep

Based on IndigoUnited/js-deep-sort-object.

Deeply traverses the object and makes it "sort-stable" (deterministic). Useful for e.g snapshot-testing, or in any place where sort-stable result is expected. Resulting object is still Equal to the original object.

  • Arrays are sorted order-preserved (!), because array order has a meaning and shouldn't be changed (!).
  • Objects are sorted by their key name.
ts
const obj = {
+  b: 'b',
+  c: ['c3', 'c1', 'c2'],
+  a: 'a',
+}
+
+_sortObjectDeep(obj)
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: ['c1', 'c2', 'c3'],
+// }

_sortObject

Allows to sort object by the list of known keys.

Example:

ts
const obj = {
+  b: 'b',
+  c: 'c',
+  extra: 'extra',
+  a: 'a',
+}
+
+_sortObject(obj, ['a', 'b', 'c'])
+// {
+//   a: 'a',
+//   b: 'b',
+//   c: 'c',
+//   extra: 'extra',
+// }

_deepEquals

Based on epoberezkin/fast-deep-equal.

Performance-optimized function to check if objects (values) are deeply-equal to each other.

ts
const obj1 = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+// Different key order, but still equals
+const obj2 = {
+  b: {
+    bb: 'bb',
+  },
+  a: 'a',
+}
+
+const obj3 = {
+  a: 'a',
+  b: {
+    bb: 'bb3', // not equal!
+  },
+}
+
+_deepEquals(obj1, obj2) // true
+_deepEquals(obj1, obj3) // false
+_deepEquals(obj2, obj3) // false

_invert

Returns an Object with "inverted" keys and values.

ts
const obj = {
+  a: '1',
+  b: '2',
+}
+
+_invert(obj)
+// {
+//   '1': 'a',
+//   '2': 'b',
+// }

_invertMap

Returns a Map with "inverted" keys and values.

ts
const map = new Map<string, number>([
+  ['a', 1],
+  ['b', 2],
+])
+
+_invertMap(map)
+// Map
+//   1 => 'a'
+//   2 => 'b'

_get, _has, _set, _unset

Gets the object value via the famous "dot-notation":

ts
const obj = {
+  a: 'a',
+  b: {
+    bb: 'bb',
+  },
+}
+
+_get(obj, 'b.bb') // 'bb'
+_has(obj, 'b.bb') // true
+_has(obj, 'b.bb2') // false
+_set(obj, 'b.bb2', 'bb2value') // sets obj.b.bb2 to 'bb2Value'
+_unset(obj, 'b.bb') // deletes obj.b.bb

_stringMapValues

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const values = Object.values(map)
+// values: (string | undefined)[]

After:

ts
const values = _stringMapValues(map)
+// values: string[]

_stringMapEntries

Needed due to https://github.com/microsoft/TypeScript/issues/13778
Only affects typings, no runtime effect.

ts
const map: StringMap = {
+  a: 'a',
+  b: 'b',
+}

Before:

ts
const entries = Object.entries(map)
+// entries: [string, string | undefined][]

After:

ts
const entries = _stringMapEntries(map)
+// entries: [string, string][]
+ + + + \ No newline at end of file diff --git a/promise.html b/promise.html new file mode 100644 index 00000000..66c79713 --- /dev/null +++ b/promise.html @@ -0,0 +1,80 @@ + + + + + + Promise | js-lib + + + + + + + + + + + + + +
Skip to content

Promise

Inspired by bluebird and Sindre's promise-fun packages.

"Copy-pasted" (with small adjustments) here, because:

  1. Bluebird is outdated (pre-ES6)

  2. p-* packages are amazing, but not all of them are needed. Some of them are very much needed though.

  3. To fix issues with Types. Here, everything is TypeScript, so, first class support and sync.

  4. To fix issues with IDE auto-imports, which is still quite bad for "default exported" packages.

Downside is that (as every fork) we lose "auto-update" possibility from these packages. We believe it's not as bad, because packages imported here have mature API and stability (example: pMap).

pMap

Based on p-map

Allows to asynchronously map an array of Promises, with options to:

  • control concurrency (default: Infinity)
  • control error behavior (ErrorMode):
    • THROW_IMMEDIATELY (default)
    • THROW_AGGREGATED: throw AggregateError in the end of execution, if at least 1 error happened
    • SUPPRESS: completely suppress (ignore) errors
ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+const results = await pMap(promises, async r => { ... }, {
+  concurrency: 2,
+  errorMode: ErrorMode.SUPPRESS,
+})

pProps

Based on p-props

Syntax-sugar to concurrently execute multiple promises and map their results to named properties.

Before:

ts
const [r1, r2, r3] = await Promise.all([
+  fetch(...),
+  fetch(...),
+  fetch(...),
+])

After:

ts
const {r1, r2, r3} = await pProps({
+  r1: fetch(...),
+  r2: fetch(...),
+  r3: fetch(...),
+})

pFilter

Based on p-filter

Allows to asynchrously filter an array of Promises.

ts
const promises = [
+   fetch(...),
+   fetch(...),
+   fetch(...),
+]
+
+const results = await pFilter(promises, async r => (await r.json()).success)

pDefer

Allows to create a "ResolvablePromise", which is a normal native Promise (so, can be awaited, etc), extended with .resolve() and .reject() methods, so you can control it. Similar to jQuery's Deferred, or RxJS's Subject (which is both an Observable and allows to emit values).

Sometimes useful to "promisify" a callback-style API.

ts
async function run(): Promise<string> {
+  const defer = pDefer<string>()
+
+  someOldApi(
+    (result: string) => {
+      defer.resolve(result)
+    },
+    err => defer.reject(err),
+  )
+
+  return await defer.promise
+}

pDelay

Based on p-delay

Just a fancy async/await style setTimeout

Before:

ts
await new Promise(resolve => setTimeout(resolve, 500))

After:

ts
await pDelay(500)

Allows to return a value:

ts
const res = await pDelay(500, 'hello')
+// hello

pRetry

Based on p-retry

Returns a Function (!), enhanced with retry capabilities.

Simplest example:

ts
const save = pRetry(async () => await dao.save())
+
+await save()
+// will retry 3 times, with default delay of 1 second and exponential back-off (x2 delay multiplier)

Advanced example (with options):

ts
const save = pRetry(async () => await dao.save(), {
+  maxAttempts: 5,
+  predicate: err => err?.message.includes('GOAWAY'),
+})
+
+await save()
+// will try up to 5 times, but only if err.message contains GOAWAY

pTimeoutFn

Based on p-timeout

Decorates a Function with a timeout.

Throws an Error if the Function is not resolved in a certain time.

If the Function rejects - passes this rejection further.

ts
const decoratedFn = pTimeout(someFunction, { timeout: 1000 })
+
+await decoratedFn()
+// will throw Timeout error if `someFunction` is not finished in 1000 ms.
+// otherwise will pass

pHang

Syntax-sugar for returning a never-resolving ("hung") Promise.

Has semantic meaning, telling us that this Promise is meant to never get resolved or rejected.

Before:

ts
return new Promise()

After:

ts
return pHang()

Useful e.g when you do location.reload() (let's say, you want to reload the page after being logged-in as an Admin) and want your BlockingLoader to never stop spinning:

ts
async function adminLogin(): Promise<void> {
+  location.href = '/admin'
+  return pHang()
+}

pState

Returns Promise's "state" as a String, one of:

  • pending
  • resolved
  • rejected
ts
const p = new Promise()
+await pState(p)
+// 'pending'
+
+const p = new Promise.resolve()
+await pState(p)
+// 'resolved'
+ + + + \ No newline at end of file diff --git a/string.html b/string.html new file mode 100644 index 00000000..f12ee100 --- /dev/null +++ b/string.html @@ -0,0 +1,58 @@ + + + + + + String | js-lib + + + + + + + + + + + + + +
Skip to content

String

_capitalize

Capitalizes first char, lowercases the rest of the string.

ts
_capitalize('hello') // Hello
+_capitalize('HELLO') // HELLO (no change)
+_capitalize('hello world') // Hello world

_upperFirst

Uppercases first char.

ts
_upperFirst('hello') // Hello
+_upperFirst('HELLO') // HELLO (no change)
+_upperFirst('hELLO') // HELLO

_lowerFirst

Lowercases first char.

ts
_lowerFirst('Hello') // hello
+_lowerFirst('hello') // hello (no change)
+_lowerFirst('HELLO') // hELLO

_camelCase 🐪

Transforms the input string to camelCase 🐪. Implementation adapted from Lodash.

ts
_camelCase('la la la')
+_camelCase('la_la_la')
+_camelCase('la-la-la')
+// laLaLa

_snakeCase 🐍

Transforms the input string to snake_case 🐍. Implementation adapted from Lodash.

ts
_snakeCase('la la la')
+_snakeCase('la-la-la')
+_snakeCase('laLaLa')
+// la_la_la

_kebabCase 🥙

Transforms the input string to kebab-case 🥙. Implementation adapted from Lodash.

ts
_kebabCase('la la la')
+_kebabCase('la_la_la')
+_kebabCase('laLaLa')
+// la-la-la

_split

Like String.split, but with the limited number of tokens.

ts
_split('a_b_c', '_', 2)
+// ['a', 'b_c']

_substringBefore

ts
_substringBefore('file1.test.ts', '.')
+// 'file1'
+
+_substringBefore('file1.test.ts', '.ts')
+// 'file1.test'

_substringBeforeLast

ts
_substringBeforeLast('file1.test.ts', '.')
+// 'file1.test'

_substringAfter

ts
_substringAfter('file1.test.ts', '.')
+// 'test.ts'

_substringAfterLast

ts
_substringAfterLast('file1.test.ts', '.')
+// 'ts'

_substringBetweenLast

ts
const s = '/Users/lalala/someFile.test.ts'
+_substringBetweenLast(s, '/', '.'))
+// 'someFile'

_truncate

Truncates the string to the needed length, putting ... (or a custom "ending") in the end, if needed. The maxLen (second argument) includes the "ending string" (3rd argument).

ts
_truncate('Hello World!', 5) // 'He...'
+_truncate('Hello World!', 6) // 'Hel...'
+_truncate('Hello World!', 100) // 'Hello World!' (no truncation needed)
+
+// Custom "ending"
+_truncate('Hello World!', 5, '|') // 'Hell|'

_truncateMiddle

Truncates the string in the middle.

ts
_truncateMiddle('abcdefghijklmnopqrstuvwxyz', 10)
+// 'abcd...xyz'

_replaceAll

Polyfill for String.prototype.replaceAll.

Based on regex implementation (slightly faster than "split/join" implementation).

_nl2br

Converts \n (aka new-line) to <br>, to be presented in HTML.

Keeps \n, so if it's printed in non-HTML environment it still looks ok-ish.

_parseQueryString

Parses location.search string (e.g ?a=1&b=2) into a StringMap, e.g: { a: '1', b: '2' }

Pass location.search to it in the Frontend, or any other string on the Backend (where location.search is not available).

Works both with and without leading ? character.

Yes, there's URLSearchParams existing in the Frontend (not in Node yet), but it's API is not as convenient. And the implementation here is super-small.

Goal of this function is to produce exactly same output as URLSearchParams would.

ts
// Assuming url is http://example.com?a=1&b=2
+
+_parseQueryString(location.search)
+// { a: '1', b: '2' }
+ + + + \ No newline at end of file diff --git a/time.html b/time.html new file mode 100644 index 00000000..514ef215 --- /dev/null +++ b/time.html @@ -0,0 +1,38 @@ + + + + + + Time | js-lib + + + + + + + + + + + + + +
Skip to content

Time

_ms

Prints a human-string for a given number of milliseconds.

ts
_ms(1) // '1 ms'
+_ms(10) // '10 ms'
+_ms(1005) // '1.005 sec'
+_ms(49123) // '49 sec'
+_ms(60000) // '1m0s'
+_ms(60912) // '1m0s'
+_ms(69123) // '1m9s'
+_ms(3292100) // '54m52s'
+_ms(69642430) // '19h20m'
+_ms(101963481) // '28h'

_since

Useful to measure and human-print the "time elapsed since".

ts
const started = Date.now()
+
+// ... do stuff!
+
+console.log(`Took ${_since(started)}`)
+// Took 19m13s

Uses _ms for pretty-printing.

_debounce

Debounce function from Lodash.

See the typescript declaration for Options.

ts
const fn = _debounce(originalFn, 100, { leading: false, trailing: false, maxWait: 300 })

_throttle

Throttle function from Lodash.

See the typescript declaration for Options.

ts
const fn = _throttle(originalFn, 100)
+ + + + \ No newline at end of file diff --git a/translation.html b/translation.html new file mode 100644 index 00000000..ff4bc75c --- /dev/null +++ b/translation.html @@ -0,0 +1,38 @@ + + + + + + TranslationService | js-lib + + + + + + + + + + + + + + + + + + +
Skip to content

TranslationService experimental

Demo

ts
const translationService = new TranslationService({
+  defaultLocale: 'en',
+  supportedLocales: ['en', 'ru'],
+  translationLoader: new FetchTranslationLoader({
+    prefixUrl: 'lang',
+  }),
+})
+
+translationService.translate('key1')
+// value 1 en
Loading...
+ + + + \ No newline at end of file diff --git a/types.html b/types.html new file mode 100644 index 00000000..47075466 --- /dev/null +++ b/types.html @@ -0,0 +1,34 @@ + + + + + + Types | js-lib + + + + + + + + + + + + + +
Skip to content

Types

Things that should exist in type-fest, but don't (yet).

Some types are copy-pasted from type-fest, because:

  1. To not introduce (another) dependency of this 0-dep lib
  2. To avoid multiple type-fest versions conflicts (that happened many times in the past)

StringMap

ts
const m: StringMap = { a: 'a' }
+// Same as:
+// const m: { [a: string]: string | undefined }
+
+const m: StringMap<number> = { a: 5 }
+// Same as:
+// const m: { [a: string]: number | undefined }

The | undefined part is important!

It allows to set undefined values to StringMap, e.g:

ts
m.name = name1 // where `name1` can be undefined

Mapper

ts
export type Mapper<IN = any, OUT = any> = (input: IN, index: number) => OUT

AsyncMapper

ts
export type AsyncMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT | PromiseLike<OUT>

Predicate

ts
export type Predicate<T> = (item: T, index: number) => boolean

Async Predicate

ts
export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>

_passthroughPredicate

Predicate that passes everything (returns true for every item).

ts
_passthroughPredicate(anything) // true
+  [(1, 2, 3)].filter(_passthroughPredicate)
+// [1, 2, 3]

_passNothingPredicate

Predicate that passes nothing (returns false for every item).

ts
_passNothingPredicate(anything) // false
+  [(1, 2, 3)].filter(_passNothingPredicate)
+// []

_noop

Function that takes any arguments and returns undefined. Literally does nothing.

Can be useful to replace some real world functions with mocks.

ts
element.click = _noop

Merge

ReadonlyDeep

Promisable

PromiseValue

+ + + + \ No newline at end of file diff --git a/units.html b/units.html new file mode 100644 index 00000000..918827fc --- /dev/null +++ b/units.html @@ -0,0 +1,31 @@ + + + + + + Units | js-lib + + + + + + + + + + + + + +
Skip to content

Units

_kb, _mb, _gb, _hb

Human-prints byte number into kilobytes, megabytes, gigabutes and "human-bytes" (_hb):

ts
_hb(0) // '0 byte(s)'
+_hb(500) // '500 byte(s)'
+_hb(1000) // '1 Kb'
+_hb(1024 ** 2) // '1 Mb'
+_hb(1024 ** 3) // '1 Gb'
+_kb(1000) // 1
+_mb(1024 ** 2) // 1
+_gb(1024 ** 3) // 1
+ + + + \ No newline at end of file