@fusedashlabs/ui9000-mcp 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2444 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>UI9000 Chart</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: light dark;
10
+ --ui9000-bg: var(--color-background-primary, Canvas);
11
+ --ui9000-fg: var(--color-text-primary, CanvasText);
12
+ --ui9000-muted: var(--color-text-secondary, GrayText);
13
+ --ui9000-border: var(--color-border-tertiary, color-mix(in srgb, CanvasText 12%, transparent));
14
+ }
15
+ html,
16
+ body {
17
+ margin: 0;
18
+ padding: 0;
19
+ width: 100%;
20
+ min-height: 320px;
21
+ background: var(--ui9000-bg);
22
+ color: var(--ui9000-fg);
23
+ font-family: var(--font-sans, system-ui, sans-serif);
24
+ }
25
+ #shell {
26
+ display: flex;
27
+ flex-direction: column;
28
+ width: 100%;
29
+ min-height: 320px;
30
+ box-sizing: border-box;
31
+ }
32
+ #status {
33
+ padding: 0.75rem 1rem;
34
+ font-size: 0.875rem;
35
+ color: var(--ui9000-muted);
36
+ text-align: center;
37
+ }
38
+ #status[data-state='error'] {
39
+ color: var(--color-text-danger, #b00020);
40
+ }
41
+ #widget-host {
42
+ width: 100%;
43
+ min-height: 360px;
44
+ padding: 0.5rem;
45
+ box-sizing: border-box;
46
+ background: #fff;
47
+ color-scheme: light;
48
+ }
49
+ #widget-host:not([hidden]) {
50
+ display: block;
51
+ }
52
+ #empty-state {
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: center;
56
+ justify-content: center;
57
+ gap: 0.5rem;
58
+ margin: 1rem;
59
+ padding: 2rem 1.25rem;
60
+ min-height: 280px;
61
+ box-sizing: border-box;
62
+ border: 1px dashed var(--ui9000-border);
63
+ border-radius: 12px;
64
+ text-align: center;
65
+ }
66
+ #empty-state[hidden] {
67
+ display: none;
68
+ }
69
+ #empty-title {
70
+ margin: 0;
71
+ font-size: 1rem;
72
+ font-weight: 600;
73
+ color: var(--ui9000-fg);
74
+ }
75
+ #empty-detail {
76
+ margin: 0;
77
+ max-width: 36rem;
78
+ font-size: 0.875rem;
79
+ line-height: 1.45;
80
+ color: var(--ui9000-muted);
81
+ }
82
+ </style>
83
+ <script type="module" crossorigin>var a2=Object.defineProperty;var s2=(t,e,n)=>e in t?a2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gt=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const l2="modulepreload",c2=function(t,e){return new URL(t,e).href},Uf={},Vt=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){let a=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const s=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=a(n.map(u=>{if(u=c2(u,i),u in Uf)return;Uf[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(!!i)for(let v=s.length-1;v>=0;v--){const b=s[v];if(b.href===u&&(!d||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":l2,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((v,b)=>{m.addEventListener("load",v),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return r.then(a=>{for(const s of a||[])s.status==="rejected"&&o(s.reason);return e().catch(o)})},pd=Object.freeze({status:"aborted"});function Z(t,e,n){function i(s,l){var c;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(c=s._zod).traits??(c.traits=new Set),s._zod.traits.add(t),e(s,l);for(const u in a.prototype)u in s||Object.defineProperty(s,u,{value:a.prototype[u].bind(s)});s._zod.constr=a,s._zod.def=l}const r=(n==null?void 0:n.Parent)??Object;class o extends r{}Object.defineProperty(o,"name",{value:t});function a(s){var l;const c=n!=null&&n.Parent?new o:this;i(c,s),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>{var l,c;return n!=null&&n.Parent&&s instanceof n.Parent?!0:(c=(l=s==null?void 0:s._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}const fd=Symbol("zod_brand");class Ri extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ms={};function $e(t){return t&&Object.assign(ms,t),ms}function u2(t){return t}function d2(t){return t}function h2(t){}function p2(t){throw new Error}function f2(t){}function md(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,r])=>e.indexOf(+i)===-1).map(([i,r])=>r)}function pt(t,e="|"){return t.map(n=>Lt(n)).join(e)}function ev(t,e){return typeof e=="bigint"?e.toString():e}function el(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function ai(t){return t==null}function rl(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function rv(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return o%a/10**r}function Bt(t,e,n){Object.defineProperty(t,e,{get(){{const i=n();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function co(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function m2(t,e){return e?e.reduce((n,i)=>n==null?void 0:n[i],t):t}function g2(t){const e=Object.keys(t),n=e.map(i=>t[i]);return Promise.all(n).then(i=>{const r={};for(let o=0;o<e.length;o++)r[e[o]]=i[o];return r})}function y2(t=10){const e="abcdefghijklmnopqrstuvwxyz";let n="";for(let i=0;i<t;i++)n+=e[Math.floor(Math.random()*e.length)];return n}function Si(t){return JSON.stringify(t)}const gd=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function jo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const nv=el(()=>{var t;if(typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Uo(t){if(jo(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(jo(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function v2(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}const b2=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},gs=new Set(["string","number","symbol"]),iv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function si(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mr(t,e,n){const i=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(i._zod.parent=t),i}function ct(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function x2(t){let e;return new Proxy({},{get(n,i,r){return e??(e=t()),Reflect.get(e,i,r)},set(n,i,r,o){return e??(e=t()),Reflect.set(e,i,r,o)},has(n,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(n,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(n,i,r){return e??(e=t()),Reflect.defineProperty(e,i,r)}})}function Lt(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ov(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const av={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function lv(t,e){const n={},i=t._zod.def;for(const r in e){if(!(r in i.shape))throw new Error(`Unrecognized key: "${r}"`);e[r]&&(n[r]=i.shape[r])}return Mr(t,{...t._zod.def,shape:n,checks:[]})}function cv(t,e){const n={...t._zod.def.shape},i=t._zod.def;for(const r in e){if(!(r in i.shape))throw new Error(`Unrecognized key: "${r}"`);e[r]&&delete n[r]}return Mr(t,{...t._zod.def,shape:n,checks:[]})}function uv(t,e){if(!Uo(e))throw new Error("Invalid input to extend: expected a plain object");const n={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return co(this,"shape",i),i},checks:[]};return Mr(t,n)}function dv(t,e){return Mr(t,{...t._zod.def,get shape(){const n={...t._zod.def.shape,...e._zod.def.shape};return co(this,"shape",n),n},catchall:e._zod.def.catchall,checks:[]})}function hv(t,e,n){const i=e._zod.def.shape,r={...i};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(r[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(const o in i)r[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return Mr(e,{...e._zod.def,shape:r,checks:[]})}function pv(t,e,n){const i=e._zod.def.shape,r={...i};if(n)for(const o in n){if(!(o in r))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(r[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)r[o]=new t({type:"nonoptional",innerType:i[o]});return Mr(e,{...e._zod.def,shape:r,checks:[]})}function Ii(t,e=0){var n;for(let i=e;i<t.issues.length;i++)if(((n=t.issues[i])==null?void 0:n.continue)!==!0)return!0;return!1}function or(t,e){return e.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(t),n})}function ko(t){return typeof t=="string"?t:t==null?void 0:t.message}function Sr(t,e,n){var r,o,a,s,l,c;const i={...t,path:t.path??[]};if(!t.message){const u=ko((a=(o=(r=t.inst)==null?void 0:r._zod.def)==null?void 0:o.error)==null?void 0:a.call(o,t))??ko((s=e==null?void 0:e.error)==null?void 0:s.call(e,t))??ko((l=n.customError)==null?void 0:l.call(n,t))??ko((c=n.localeError)==null?void 0:c.call(n,t))??"Invalid input";i.message=u}return delete i.inst,delete i.continue,e!=null&&e.reportInput||delete i.input,i}function nl(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function il(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ji(...t){const[e,n,i]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:i}:{...e}}function _2(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}class $2{constructor(...e){}}const w2=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:sv,Class:$2,NUMBER_FORMAT_RANGES:av,aborted:Ii,allowsEval:nv,assert:f2,assertEqual:u2,assertIs:h2,assertNever:p2,assertNotEqual:d2,assignProp:co,cached:el,captureStackTrace:gd,cleanEnum:_2,cleanRegex:rl,clone:Mr,createTransparentProxy:x2,defineLazy:Bt,esc:Si,escapeRegex:si,extend:uv,finalizeIssue:Sr,floatSafeRemainder:rv,getElementAtPath:m2,getEnumValues:md,getLengthableOrigin:il,getParsedType:b2,getSizableOrigin:nl,isObject:jo,isPlainObject:Uo,issue:ji,joinValues:pt,jsonStringifyReplacer:ev,merge:dv,normalizeParams:ct,nullish:ai,numKeys:v2,omit:cv,optionalKeys:ov,partial:hv,pick:lv,prefixIssues:or,primitiveTypes:iv,promiseAllObject:g2,propertyKeyTypes:gs,randomString:y2,required:pv,stringifyPrimitive:Lt,unwrapMessage:ko},Symbol.toStringTag,{value:"Module"})),fv=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,ev,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},yd=Z("$ZodError",fv),sa=Z("$ZodError",fv,{Parent:Error});function ol(t,e=n=>n.message){const n={},i=[];for(const r of t.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:n}}function al(t,e){const n=e||function(o){return o.message},i={_errors:[]},r=o=>{for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>r({issues:s}));else if(a.code==="invalid_key")r({issues:a.issues});else if(a.code==="invalid_element")r({issues:a.issues});else if(a.path.length===0)i._errors.push(n(a));else{let s=i,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return r(t),i}function vd(t,e){const n=e||function(o){return o.message},i={errors:[]},r=(o,a=[])=>{var s,l;for(const c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>r({issues:u},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{const u=[...a,...c.path];if(u.length===0){i.errors.push(n(c));continue}let d=i,h=0;for(;h<u.length;){const p=u[h],m=h===u.length-1;typeof p=="string"?(d.properties??(d.properties={}),(s=d.properties)[p]??(s[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(l=d.items)[p]??(l[p]={errors:[]}),d=d.items[p]),m&&d.errors.push(n(c)),h++}}};return r(t),i}function mv(t){const e=[];for(const n of t)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function bd(t){var i;const e=[],n=[...t.issues].sort((r,o)=>r.path.length-o.path.length);for(const r of n)e.push(`✖ ${r.message}`),(i=r.path)!=null&&i.length&&e.push(` → at ${mv(r.path)}`);return e.join(`
84
+ `)}const xd=t=>(e,n,i,r)=>{const o=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Ri;if(a.issues.length){const s=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>Sr(l,o,$e())));throw gd(s,r==null?void 0:r.callee),s}return a.value},vu=xd(sa),_d=t=>async(e,n,i,r)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const s=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>Sr(l,o,$e())));throw gd(s,r==null?void 0:r.callee),s}return a.value},bu=_d(sa),$d=t=>(e,n,i)=>{const r=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Ri;return o.issues.length?{success:!1,error:new(t??yd)(o.issues.map(a=>Sr(a,r,$e())))}:{success:!0,data:o.value}},wd=$d(sa),kd=t=>async(e,n,i)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let o=e._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(a=>Sr(a,r,$e())))}:{success:!0,data:o.value}},gv=kd(sa),yv=/^[cC][^\s-]{8,}$/,vv=/^[0-9a-z]+$/,bv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xv=/^[0-9a-vA-V]{20}$/,_v=/^[A-Za-z0-9]{27}$/,$v=/^[a-zA-Z0-9_-]{21}$/,wv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,k2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,kv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ui=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,S2=Ui(4),A2=Ui(6),z2=Ui(7),Sv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,T2=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,L2=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,C2=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,I2=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Av="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function zv(){return new RegExp(Av,"u")}const Tv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Lv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Cv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Iv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sd=/^[A-Za-z0-9_-]*$/,Nv=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,M2=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Dv=/^\+(?:[0-9]){6,14}[0-9]$/,Ov="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Pv=new RegExp(`^${Ov}$`);function Ev(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fv(t){return new RegExp(`^${Ev(t)}$`)}function Rv(t){const e=Ev({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${n.join("|")})`;return new RegExp(`^${Ov}T(?:${i})$`)}const jv=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Uv=/^\d+n?$/,Bv=/^\d+$/,Hv=/^-?\d+(?:\.\d+)?/i,qv=/true|false/i,Gv=/null/i,Vv=/undefined/i,Zv=/^[^A-Z]*$/,Wv=/^[^a-z]*$/,Ad=Object.freeze(Object.defineProperty({__proto__:null,_emoji:Av,base64:Mv,base64url:Sd,bigint:Uv,boolean:qv,browserEmail:I2,cidrv4:Cv,cidrv6:Iv,cuid:yv,cuid2:vv,date:Pv,datetime:Rv,domain:M2,duration:wv,e164:Dv,email:Sv,emoji:zv,extendedDuration:k2,guid:kv,hostname:Nv,html5Email:T2,integer:Bv,ipv4:Tv,ipv6:Lv,ksuid:_v,lowercase:Zv,nanoid:$v,null:Gv,number:Hv,rfc5322Email:L2,string:jv,time:Fv,ulid:bv,undefined:Vv,unicodeEmail:C2,uppercase:Wv,uuid:Ui,uuid4:S2,uuid6:A2,uuid7:z2,xid:xv},Symbol.toStringTag,{value:"Module"})),le=Z("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Kv={number:"number",bigint:"bigint",object:"date"},zd=Z("$ZodCheckLessThan",(t,e)=>{le.init(t,e);const n=Kv[typeof e.value];t._zod.onattach.push(i=>{const r=i._zod.bag,o=(e.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?r.maximum=e.value:r.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:n,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Td=Z("$ZodCheckGreaterThan",(t,e)=>{le.init(t,e);const n=Kv[typeof e.value];t._zod.onattach.push(i=>{const r=i._zod.bag,o=(e.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?r.minimum=e.value:r.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:n,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Yv=Z("$ZodCheckMultipleOf",(t,e)=>{le.init(t,e),t._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):rv(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Jv=Z("$ZodCheckNumberFormat",(t,e)=>{var a;le.init(t,e),e.format=e.format||"float64";const n=(a=e.format)==null?void 0:a.includes("int"),i=n?"int":"number",[r,o]=av[e.format];t._zod.onattach.push(s=>{const l=s._zod.bag;l.format=e.format,l.minimum=r,l.maximum=o,n&&(l.pattern=Bv)}),t._zod.check=s=>{const l=s.value;if(n){if(!Number.isInteger(l)){s.issues.push({expected:i,format:e.format,code:"invalid_type",input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort});return}}l<r&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inst:t})}}),Xv=Z("$ZodCheckBigIntFormat",(t,e)=>{le.init(t,e);const[n,i]=sv[e.format];t._zod.onattach.push(r=>{const o=r._zod.bag;o.format=e.format,o.minimum=n,o.maximum=i}),t._zod.check=r=>{const o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:t})}}),Qv=Z("$ZodCheckMaxSize",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.size!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{const r=i.value;r.size<=e.maximum||i.issues.push({origin:nl(r),code:"too_big",maximum:e.maximum,input:r,inst:t,continue:!e.abort})}}),tb=Z("$ZodCheckMinSize",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.size!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{const r=i.value;r.size>=e.minimum||i.issues.push({origin:nl(r),code:"too_small",minimum:e.minimum,input:r,inst:t,continue:!e.abort})}}),eb=Z("$ZodCheckSizeEquals",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.size!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag;r.minimum=e.size,r.maximum=e.size,r.size=e.size}),t._zod.check=i=>{const r=i.value,o=r.size;if(o===e.size)return;const a=o>e.size;i.issues.push({origin:nl(r),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),rb=Z("$ZodCheckMaxLength",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.length!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{const r=i.value;if(r.length<=e.maximum)return;const a=il(r);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:r,inst:t,continue:!e.abort})}}),nb=Z("$ZodCheckMinLength",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.length!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{const r=i.value;if(r.length>=e.minimum)return;const a=il(r);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:r,inst:t,continue:!e.abort})}}),ib=Z("$ZodCheckLengthEquals",(t,e)=>{var n;le.init(t,e),(n=t._zod.def).when??(n.when=i=>{const r=i.value;return!ai(r)&&r.length!==void 0}),t._zod.onattach.push(i=>{const r=i._zod.bag;r.minimum=e.length,r.maximum=e.length,r.length=e.length}),t._zod.check=i=>{const r=i.value,o=r.length;if(o===e.length)return;const a=il(r),s=o>e.length;i.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),la=Z("$ZodCheckStringFormat",(t,e)=>{var n,i;le.init(t,e),t._zod.onattach.push(r=>{const o=r._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:e.format,input:r.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),ob=Z("$ZodCheckRegex",(t,e)=>{la.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ab=Z("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Zv),la.init(t,e)}),sb=Z("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Wv),la.init(t,e)}),lb=Z("$ZodCheckIncludes",(t,e)=>{le.init(t,e);const n=si(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=i,t._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),t._zod.check=r=>{r.value.includes(e.includes,e.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:r.value,inst:t,continue:!e.abort})}}),cb=Z("$ZodCheckStartsWith",(t,e)=>{le.init(t,e);const n=new RegExp(`^${si(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(i=>{const r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),ub=Z("$ZodCheckEndsWith",(t,e)=>{le.init(t,e);const n=new RegExp(`.*${si(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(i=>{const r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function Bf(t,e,n){t.issues.length&&e.issues.push(...or(n,t.issues))}const db=Z("$ZodCheckProperty",(t,e)=>{le.init(t,e),t._zod.check=n=>{const i=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>Bf(r,n,e.property));Bf(i,n,e.property)}}),hb=Z("$ZodCheckMimeType",(t,e)=>{le.init(t,e);const n=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,inst:t})}}),pb=Z("$ZodCheckOverwrite",(t,e)=>{le.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class fb{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(`
85
+ `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const e=Function,n=this==null?void 0:this.args,r=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new e(...n,r.join(`
86
+ `))}}const mb={major:4,minor:0,patch:0},St=Z("$ZodType",(t,e)=>{var r;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=mb;const i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(const o of i)for(const a of o._zod.onattach)a(t);if(i.length===0)(n=t._zod).deferred??(n.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const o=(a,s,l)=>{let c=Ii(a),u;for(const d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(c)continue;const h=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Ri;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,a.issues.length!==h&&(c||(c=Ii(a,h)))});else{if(a.issues.length===h)continue;c||(c=Ii(a,h))}}return u?u.then(()=>a):a};t._zod.run=(a,s)=>{const l=t._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new Ri;return l.then(c=>o(c,i,s))}return o(l,i,s)}}t["~standard"]={validate:o=>{var a;try{const s=wd(t,o);return s.success?{value:s.data}:{issues:(a=s.error)==null?void 0:a.issues}}catch{return gv(t,o).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),ca=Z("$ZodString",(t,e)=>{var n;St.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??jv(t._zod.bag),t._zod.parse=(i,r)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),te=Z("$ZodStringFormat",(t,e)=>{la.init(t,e),ca.init(t,e)}),gb=Z("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=kv),te.init(t,e)}),yb=Z("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ui(i))}else e.pattern??(e.pattern=Ui());te.init(t,e)}),vb=Z("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Sv),te.init(t,e)}),bb=Z("$ZodURL",(t,e)=>{te.init(t,e),t._zod.check=n=>{try{const i=n.value,r=new URL(i),o=r.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Nv.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),!i.endsWith("/")&&o.endsWith("/")?n.value=o.slice(0,-1):n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),xb=Z("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=zv()),te.init(t,e)}),_b=Z("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=$v),te.init(t,e)}),$b=Z("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=yv),te.init(t,e)}),wb=Z("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=vv),te.init(t,e)}),kb=Z("$ZodULID",(t,e)=>{e.pattern??(e.pattern=bv),te.init(t,e)}),Sb=Z("$ZodXID",(t,e)=>{e.pattern??(e.pattern=xv),te.init(t,e)}),Ab=Z("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=_v),te.init(t,e)}),zb=Z("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Rv(e)),te.init(t,e)}),Tb=Z("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Pv),te.init(t,e)}),Lb=Z("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Fv(e)),te.init(t,e)}),Cb=Z("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=wv),te.init(t,e)}),Ib=Z("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Tv),te.init(t,e),t._zod.onattach.push(n=>{const i=n._zod.bag;i.format="ipv4"})}),Mb=Z("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Lv),te.init(t,e),t._zod.onattach.push(n=>{const i=n._zod.bag;i.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Nb=Z("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Cv),te.init(t,e)}),Db=Z("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Iv),te.init(t,e),t._zod.check=n=>{const[i,r]=n.value.split("/");try{if(!r)throw new Error;const o=Number(r);if(`${o}`!==r)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Ld(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Ob=Z("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Mv),te.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{Ld(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Pb(t){if(!Sd.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Ld(n)}const Eb=Z("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Sd),te.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{Pb(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Fb=Z("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Dv),te.init(t,e)});function Rb(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const r=JSON.parse(atob(i));return!("typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&(!("alg"in r)||r.alg!==e))}catch{return!1}}const jb=Z("$ZodJWT",(t,e)=>{te.init(t,e),t._zod.check=n=>{Rb(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Ub=Z("$ZodCustomStringFormat",(t,e)=>{te.init(t,e),t._zod.check=n=>{e.fn(n.value)||n.issues.push({code:"invalid_format",format:e.format,input:n.value,inst:t,continue:!e.abort})}}),Cd=Z("$ZodNumber",(t,e)=>{St.init(t,e),t._zod.pattern=t._zod.bag.pattern??Hv,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:t,...o?{received:o}:{}}),n}}),Bb=Z("$ZodNumber",(t,e)=>{Jv.init(t,e),Cd.init(t,e)}),Id=Z("$ZodBoolean",(t,e)=>{St.init(t,e),t._zod.pattern=qv,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:t}),n}}),Md=Z("$ZodBigInt",(t,e)=>{St.init(t,e),t._zod.pattern=Uv,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}}),Hb=Z("$ZodBigInt",(t,e)=>{Xv.init(t,e),Md.init(t,e)}),qb=Z("$ZodSymbol",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:t}),n}}),Gb=Z("$ZodUndefined",(t,e)=>{St.init(t,e),t._zod.pattern=Vv,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(n,i)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:t}),n}}),Vb=Z("$ZodNull",(t,e)=>{St.init(t,e),t._zod.pattern=Gv,t._zod.values=new Set([null]),t._zod.parse=(n,i)=>{const r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:t}),n}}),Zb=Z("$ZodAny",(t,e)=>{St.init(t,e),t._zod.parse=n=>n}),ys=Z("$ZodUnknown",(t,e)=>{St.init(t,e),t._zod.parse=n=>n}),Wb=Z("$ZodNever",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),Kb=Z("$ZodVoid",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:t}),n}}),Yb=Z("$ZodDate",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=new Date(n.value)}catch{}const r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:t}),n}});function Hf(t,e,n){t.issues.length&&e.issues.push(...or(n,t.issues)),e.value[n]=t.value}const Nd=Z("$ZodArray",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:t}),n;n.value=Array(r.length);const o=[];for(let a=0;a<r.length;a++){const s=r[a],l=e.element._zod.run({value:s,issues:[]},i);l instanceof Promise?o.push(l.then(c=>Hf(c,n,a))):Hf(l,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function Ba(t,e,n){t.issues.length&&e.issues.push(...or(n,t.issues)),e.value[n]=t.value}function qf(t,e,n,i){t.issues.length?i[n]===void 0?n in i?e.value[n]=void 0:e.value[n]=t.value:e.issues.push(...or(n,t.issues)):t.value===void 0?n in i&&(e.value[n]=void 0):e.value[n]=t.value}const Jb=Z("$ZodObject",(t,e)=>{St.init(t,e);const n=el(()=>{const d=Object.keys(e.shape);for(const p of d)if(!(e.shape[p]instanceof St))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);const h=ov(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(h)}});Bt(t._zod,"propValues",()=>{const d=e.shape,h={};for(const p in d){const m=d[p]._zod;if(m.values){h[p]??(h[p]=new Set);for(const v of m.values)h[p].add(v)}}return h});const i=d=>{const h=new fb(["shape","payload","ctx"]),p=n.value,m=$=>{const _=Si($);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let b=0;for(const $ of p.keys)v[$]=`key_${b++}`;h.write("const newResult = {}");for(const $ of p.keys)if(p.optionalKeys.has($)){const _=v[$];h.write(`const ${_} = ${m($)};`);const y=Si($);h.write(`
87
+ if (${_}.issues.length) {
88
+ if (input[${y}] === undefined) {
89
+ if (${y} in input) {
90
+ newResult[${y}] = undefined;
91
+ }
92
+ } else {
93
+ payload.issues = payload.issues.concat(
94
+ ${_}.issues.map((iss) => ({
95
+ ...iss,
96
+ path: iss.path ? [${y}, ...iss.path] : [${y}],
97
+ }))
98
+ );
99
+ }
100
+ } else if (${_}.value === undefined) {
101
+ if (${y} in input) newResult[${y}] = undefined;
102
+ } else {
103
+ newResult[${y}] = ${_}.value;
104
+ }
105
+ `)}else{const _=v[$];h.write(`const ${_} = ${m($)};`),h.write(`
106
+ if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
107
+ ...iss,
108
+ path: iss.path ? [${Si($)}, ...iss.path] : [${Si($)}]
109
+ })));`),h.write(`newResult[${Si($)}] = ${_}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const g=h.compile();return($,_)=>g(d,$,_)};let r;const o=jo,a=!ms.jitless,l=a&&nv.value,c=e.catchall;let u;t._zod.parse=(d,h)=>{u??(u=n.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d;const m=[];if(a&&l&&(h==null?void 0:h.async)===!1&&h.jitless!==!0)r||(r=i(e.shape)),d=r(d,h);else{d.value={};const _=u.shape;for(const y of u.keys){const S=_[y],w=S._zod.run({value:p[y],issues:[]},h),L=S._zod.optin==="optional"&&S._zod.optout==="optional";w instanceof Promise?m.push(w.then(N=>L?qf(N,d,y,p):Ba(N,d,y))):L?qf(w,d,y,p):Ba(w,d,y)}}if(!c)return m.length?Promise.all(m).then(()=>d):d;const v=[],b=u.keySet,g=c._zod,$=g.def.type;for(const _ of Object.keys(p)){if(b.has(_))continue;if($==="never"){v.push(_);continue}const y=g.run({value:p[_],issues:[]},h);y instanceof Promise?m.push(y.then(S=>Ba(S,d,_))):Ba(y,d,_)}return v.length&&d.issues.push({code:"unrecognized_keys",keys:v,input:p,inst:t}),m.length?Promise.all(m).then(()=>d):d}});function Gf(t,e,n,i){for(const r of t)if(r.issues.length===0)return e.value=r.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(r=>r.issues.map(o=>Sr(o,i,$e())))}),e}const Dd=Z("$ZodUnion",(t,e)=>{St.init(t,e),Bt(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Bt(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Bt(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),Bt(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){const n=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>rl(i.source)).join("|")})$`)}}),t._zod.parse=(n,i)=>{let r=!1;const o=[];for(const a of e.options){const s=a._zod.run({value:n.value,issues:[]},i);if(s instanceof Promise)o.push(s),r=!0;else{if(s.issues.length===0)return s;o.push(s)}}return r?Promise.all(o).then(a=>Gf(a,n,t,i)):Gf(o,n,t,i)}}),Xb=Z("$ZodDiscriminatedUnion",(t,e)=>{Dd.init(t,e);const n=t._zod.parse;Bt(t._zod,"propValues",()=>{const r={};for(const o of e.options){const a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const[s,l]of Object.entries(a)){r[s]||(r[s]=new Set);for(const c of l)r[s].add(c)}}return r});const i=el(()=>{const r=e.options,o=new Map;for(const a of r){const s=a._zod.propValues[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const l of s){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});t._zod.parse=(r,o)=>{const a=r.value;if(!jo(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),r;const s=i.value.get(a==null?void 0:a[e.discriminator]);return s?s._zod.run(r,o):e.unionFallback?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),r)}}),Qb=Z("$ZodIntersection",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value,o=e.left._zod.run({value:r,issues:[]},i),a=e.right._zod.run({value:r,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,c])=>Vf(n,l,c)):Vf(n,o,a)}});function xu(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Uo(t)&&Uo(e)){const n=Object.keys(e),i=Object.keys(t).filter(o=>n.indexOf(o)!==-1),r={...t,...e};for(const o of i){const a=xu(t[o],e[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r[o]=a.data}return{valid:!0,data:r}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<t.length;i++){const r=t[i],o=e[i],a=xu(r,o);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Vf(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),Ii(t))return t;const i=xu(e.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const sl=Z("$ZodTuple",(t,e)=>{St.init(t,e);const n=e.items,i=n.length-[...n].reverse().findIndex(r=>r._zod.optin!=="optional");t._zod.parse=(r,o)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[];if(!e.rest){const c=a.length>n.length,u=a.length<i-1;if(c||u)return r.issues.push({input:a,inst:t,origin:"array",...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length}}),r}let l=-1;for(const c of n){if(l++,l>=a.length&&l>=i)continue;const u=c._zod.run({value:a[l],issues:[]},o);u instanceof Promise?s.push(u.then(d=>Ha(d,r,l))):Ha(u,r,l)}if(e.rest){const c=a.slice(n.length);for(const u of c){l++;const d=e.rest._zod.run({value:u,issues:[]},o);d instanceof Promise?s.push(d.then(h=>Ha(h,r,l))):Ha(d,r,l)}}return s.length?Promise.all(s).then(()=>r):r}});function Ha(t,e,n){t.issues.length&&e.issues.push(...or(n,t.issues)),e.value[n]=t.value}const t0=Z("$ZodRecord",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;if(!Uo(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:t}),n;const o=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;n.value={};for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=e.valueType._zod.run({value:r[l],issues:[]},i);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&n.issues.push(...or(l,u.issues)),n.value[l]=u.value})):(c.issues.length&&n.issues.push(...or(l,c.issues)),n.value[l]=c.value)}let s;for(const l in r)a.has(l)||(s=s??[],s.push(l));s&&s.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:t,keys:s})}else{n.value={};for(const a of Reflect.ownKeys(r)){if(a==="__proto__")continue;const s=e.keyType._zod.run({value:a,issues:[]},i);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(c=>Sr(c,i,$e())),input:a,path:[a],inst:t}),n.value[s.value]=s.value;continue}const l=e.valueType._zod.run({value:r[a],issues:[]},i);l instanceof Promise?o.push(l.then(c=>{c.issues.length&&n.issues.push(...or(a,c.issues)),n.value[s.value]=c.value})):(l.issues.length&&n.issues.push(...or(a,l.issues)),n.value[s.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),e0=Z("$ZodMap",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:t}),n;const o=[];n.value=new Map;for(const[a,s]of r){const l=e.keyType._zod.run({value:a,issues:[]},i),c=e.valueType._zod.run({value:s,issues:[]},i);l instanceof Promise||c instanceof Promise?o.push(Promise.all([l,c]).then(([u,d])=>{Zf(u,d,n,a,r,t,i)})):Zf(l,c,n,a,r,t,i)}return o.length?Promise.all(o).then(()=>n):n}});function Zf(t,e,n,i,r,o,a){t.issues.length&&(gs.has(typeof i)?n.issues.push(...or(i,t.issues)):n.issues.push({origin:"map",code:"invalid_key",input:r,inst:o,issues:t.issues.map(s=>Sr(s,a,$e()))})),e.issues.length&&(gs.has(typeof i)?n.issues.push(...or(i,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:e.issues.map(s=>Sr(s,a,$e()))})),n.value.set(t.value,e.value)}const r0=Z("$ZodSet",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:t,expected:"set",code:"invalid_type"}),n;const o=[];n.value=new Set;for(const a of r){const s=e.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(l=>Wf(l,n))):Wf(s,n)}return o.length?Promise.all(o).then(()=>n):n}});function Wf(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const n0=Z("$ZodEnum",(t,e)=>{St.init(t,e);const n=md(e.entries);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(i=>gs.has(typeof i)).map(i=>typeof i=="string"?si(i):i.toString()).join("|")})$`),t._zod.parse=(i,r)=>{const o=i.value;return t._zod.values.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),i0=Z("$ZodLiteral",(t,e)=>{St.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?si(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,i)=>{const r=n.value;return t._zod.values.has(r)||n.issues.push({code:"invalid_value",values:e.values,input:r,inst:t}),n}}),o0=Z("$ZodFile",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:t}),n}}),Od=Z("$ZodTransform",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=e.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(a=>(n.value=a,n));if(r instanceof Promise)throw new Ri;return n.value=r,n}}),a0=Z("$ZodOptional",(t,e)=>{St.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Bt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Bt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${rl(n.source)})?$`):void 0}),t._zod.parse=(n,i)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(n,i):n.value===void 0?n:e.innerType._zod.run(n,i)}),s0=Z("$ZodNullable",(t,e)=>{St.init(t,e),Bt(t._zod,"optin",()=>e.innerType._zod.optin),Bt(t._zod,"optout",()=>e.innerType._zod.optout),Bt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${rl(n.source)}|null)$`):void 0}),Bt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,i)=>n.value===null?n:e.innerType._zod.run(n,i)}),l0=Z("$ZodDefault",(t,e)=>{St.init(t,e),t._zod.optin="optional",Bt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>{if(n.value===void 0)return n.value=e.defaultValue,n;const r=e.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Kf(o,e)):Kf(r,e)}});function Kf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const c0=Z("$ZodPrefault",(t,e)=>{St.init(t,e),t._zod.optin="optional",Bt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>(n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,i))}),u0=Z("$ZodNonOptional",(t,e)=>{St.init(t,e),Bt(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),t._zod.parse=(n,i)=>{const r=e.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Yf(o,t)):Yf(r,t)}});function Yf(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const d0=Z("$ZodSuccess",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>{const r=e.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.issues.length===0,n)):(n.value=r.issues.length===0,n)}}),h0=Z("$ZodCatch",(t,e)=>{St.init(t,e),t._zod.optin="optional",Bt(t._zod,"optout",()=>e.innerType._zod.optout),Bt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>{const r=e.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(a=>Sr(a,i,$e()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=e.catchValue({...n,error:{issues:r.issues.map(o=>Sr(o,i,$e()))},input:n.value}),n.issues=[]),n)}}),p0=Z("$ZodNaN",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:t,expected:"nan",code:"invalid_type"}),n)}),Pd=Z("$ZodPipe",(t,e)=>{St.init(t,e),Bt(t._zod,"values",()=>e.in._zod.values),Bt(t._zod,"optin",()=>e.in._zod.optin),Bt(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(n,i)=>{const r=e.in._zod.run(n,i);return r instanceof Promise?r.then(o=>Jf(o,e,i)):Jf(r,e,i)}});function Jf(t,e,n){return Ii(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}const f0=Z("$ZodReadonly",(t,e)=>{St.init(t,e),Bt(t._zod,"propValues",()=>e.innerType._zod.propValues),Bt(t._zod,"values",()=>e.innerType._zod.values),Bt(t._zod,"optin",()=>e.innerType._zod.optin),Bt(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,i)=>{const r=e.innerType._zod.run(n,i);return r instanceof Promise?r.then(Xf):Xf(r)}});function Xf(t){return t.value=Object.freeze(t.value),t}const m0=Z("$ZodTemplateLiteral",(t,e)=>{St.init(t,e);const n=[];for(const i of e.parts)if(i instanceof St){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const o=r.startsWith("^")?1:0,a=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,a))}else if(i===null||iv.has(typeof i))n.push(si(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${n.join("")}$`),t._zod.parse=(i,r)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),g0=Z("$ZodPromise",(t,e)=>{St.init(t,e),t._zod.parse=(n,i)=>Promise.resolve(n.value).then(r=>e.innerType._zod.run({value:r,issues:[]},i))}),y0=Z("$ZodLazy",(t,e)=>{St.init(t,e),Bt(t._zod,"innerType",()=>e.getter()),Bt(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),Bt(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),Bt(t._zod,"optin",()=>t._zod.innerType._zod.optin),Bt(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(n,i)=>t._zod.innerType._zod.run(n,i)}),v0=Z("$ZodCustom",(t,e)=>{le.init(t,e),St.init(t,e),t._zod.parse=(n,i)=>n,t._zod.check=n=>{const i=n.value,r=e.fn(i);if(r instanceof Promise)return r.then(o=>Qf(o,n,i,t));Qf(r,n,i,t)}});function Qf(t,e,n,i){if(!t){const r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),e.issues.push(ji(r))}}const N2=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return r=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":return r.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${Lt(r.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${o} ${r.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${o} ${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${o} ${r.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${o} ${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`:o.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${o.suffix}"`:o.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${o.includes}"`:o.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${o.pattern}`:`${i[o.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${pt(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function D2(){return{localeError:N2()}}const O2=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Yanlış dəyər: gözlənilən ${Lt(r.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${o}${r.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Çox kiçik: gözlənilən ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Yanlış mətn: "${o.prefix}" ilə başlamalıdır`:o.format==="ends_with"?`Yanlış mətn: "${o.suffix}" ilə bitməlidir`:o.format==="includes"?`Yanlış mətn: "${o.includes}" daxil olmalıdır`:o.format==="regex"?`Yanlış mətn: ${o.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[o.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function P2(){return{localeError:O2()}}function tm(t,e,n,i){const r=Math.abs(t),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?e:o>=2&&o<=4?n:i}const E2=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return r=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Няправільны ўвод: чакалася ${Lt(r.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);if(a){const s=Number(r.maximum),l=tm(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${a.verb} ${o}${r.maximum.toString()} ${l}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);if(a){const s=Number(r.minimum),l=tm(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${a.verb} ${o}${r.minimum.toString()} ${l}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${o.prefix}"`:o.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${o.suffix}"`:o.format==="includes"?`Няправільны радок: павінен змяшчаць "${o.includes}"`:o.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${o.pattern}`:`Няправільны ${i[o.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function F2(){return{localeError:E2()}}const R2=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Valor invàlid: s'esperava ${Lt(r.values[0])}`:`Opció invàlida: s'esperava una de ${pt(r.values," o ")}`;case"too_big":{const o=r.inclusive?"com a màxim":"menys de",a=e(r.origin);return a?`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${o} ${r.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?"com a mínim":"més de",a=e(r.origin);return a?`Massa petit: s'esperava que ${r.origin} contingués ${o} ${r.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Format invàlid: ha de començar amb "${o.prefix}"`:o.format==="ends_with"?`Format invàlid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format invàlid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${o.pattern}`:`Format invàlid per a ${i[o.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function j2(){return{localeError:R2()}}const U2=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return r=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neplatný vstup: očekáváno ${Lt(r.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${o}${r.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${o}${r.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Neplatný řetězec: musí začínat na "${o.prefix}"`:o.format==="ends_with"?`Neplatný řetězec: musí končit na "${o.suffix}"`:o.format==="includes"?`Neplatný řetězec: musí obsahovat "${o.includes}"`:o.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${o.pattern}`:`Neplatný formát ${i[o.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${pt(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function B2(){return{localeError:U2()}}const H2=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return r=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ungültige Eingabe: erwartet ${Lt(r.values[0])}`:`Ungültige Option: erwartet eine von ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Zu groß: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Ungültiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ungültiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ungültiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ungültiger String: muss dem Muster ${o.pattern} entsprechen`:`Ungültig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function q2(){return{localeError:H2()}}const G2=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},V2=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${G2(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${Lt(i.values[0])}`:`Invalid option: expected one of ${pt(i.values,"|")}`;case"too_big":{const r=i.inclusive?"<=":"<",o=e(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${r}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${r}${i.maximum.toString()}`}case"too_small":{const r=i.inclusive?">=":">",o=e(i.origin);return o?`Too small: expected ${i.origin} to have ${r}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${r}${i.minimum.toString()}`}case"invalid_format":{const r=i;return r.format==="starts_with"?`Invalid string: must start with "${r.prefix}"`:r.format==="ends_with"?`Invalid string: must end with "${r.suffix}"`:r.format==="includes"?`Invalid string: must include "${r.includes}"`:r.format==="regex"?`Invalid string: must match pattern ${r.pattern}`:`Invalid ${n[r.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${pt(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function b0(){return{localeError:V2()}}const Z2=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},W2=()=>{const t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(i){return t[i]??null}const n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return i=>{switch(i.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${i.expected}, riceviĝis ${Z2(i.input)}`;case"invalid_value":return i.values.length===1?`Nevalida enigo: atendiĝis ${Lt(i.values[0])}`:`Nevalida opcio: atendiĝis unu el ${pt(i.values,"|")}`;case"too_big":{const r=i.inclusive?"<=":"<",o=e(i.origin);return o?`Tro granda: atendiĝis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()}`}case"too_small":{const r=i.inclusive?">=":">",o=e(i.origin);return o?`Tro malgranda: atendiĝis ke ${i.origin} havu ${r}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendiĝis ke ${i.origin} estu ${r}${i.minimum.toString()}`}case"invalid_format":{const r=i;return r.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${n[r.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} ŝlosilo${i.keys.length>1?"j":""}: ${pt(i.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};function K2(){return{localeError:W2()}}const Y2=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"arreglo";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype)return r.constructor.name}}return o},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Entrada inválida: se esperaba ${r.expected}, recibido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inválida: se esperaba ${Lt(r.values[0])}`:`Opción inválida: se esperaba una de ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Demasiado grande: se esperaba que ${r.origin??"valor"} tuviera ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${r.origin??"valor"} fuera ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Demasiado pequeño: se esperaba que ${r.origin} tuviera ${o}${r.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${r.origin} fuera ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Cadena inválida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inválida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inválida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${o.pattern}`:`Inválido ${i[o.format]??r.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Llave inválida en ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${r.origin}`;default:return"Entrada inválida"}}};function J2(){return{localeError:Y2()}}const X2=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return r=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":return r.values.length===1?`ورودی نامعتبر: می‌بایست ${Lt(r.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${pt(r.values,"|")} می‌بود`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`خیلی بزرگ: ${r.origin??"مقدار"} باید ${o}${r.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${r.origin??"مقدار"} باید ${o}${r.maximum.toString()} باشد`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`خیلی کوچک: ${r.origin} باید ${o}${r.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${r.origin} باید ${o}${r.minimum.toString()} باشد`}case"invalid_format":{const o=r;return o.format==="starts_with"?`رشته نامعتبر: باید با "${o.prefix}" شروع شود`:o.format==="ends_with"?`رشته نامعتبر: باید با "${o.suffix}" تمام شود`:o.format==="includes"?`رشته نامعتبر: باید شامل "${o.includes}" باشد`:o.format==="regex"?`رشته نامعتبر: باید با الگوی ${o.pattern} مطابقت داشته باشد`:`${i[o.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${pt(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function Q2(){return{localeError:X2()}}const tA=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return r=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Virheellinen syöte: täytyy olla ${Lt(r.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${o}${r.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${o}${r.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen syöte: täytyy sisältää "${o.includes}"`:o.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${o.pattern}`:`Virheellinen ${i[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${pt(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function eA(){return{localeError:tA()}}const rA=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return r=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":return r.values.length===1?`Entrée invalide : ${Lt(r.values[0])} attendu`:`Option invalide : une valeur parmi ${pt(r.values,"|")} attendue`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Trop grand : ${r.origin??"valeur"} doit ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${r.origin??"valeur"} doit être ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Trop petit : ${r.origin} doit ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : ${r.origin} doit être ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${pt(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function nA(){return{localeError:rA()}}const iA=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return r=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrée invalide : attendu ${Lt(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"≤":"<",a=e(r.origin);return a?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?"≥":">",a=e(r.origin);return a?`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au motif ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${pt(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function oA(){return{localeError:iA()}}const aA=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return r=>{switch(r.code){case"invalid_type":return`קלט לא תקין: צריך ${r.expected}, התקבל ${n(r.input)}`;case"invalid_value":return r.values.length===1?`קלט לא תקין: צריך ${Lt(r.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`גדול מדי: ${r.origin??"value"} צריך להיות ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${r.origin??"value"} צריך להיות ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`קטן מדי: ${r.origin} צריך להיות ${o}${r.minimum.toString()} ${a.unit}`:`קטן מדי: ${r.origin} צריך להיות ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${o.prefix}"`:o.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${o.suffix}"`:o.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${o.includes}"`:o.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${o.pattern}`:`${i[o.format]??r.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${r.divisor}`;case"unrecognized_keys":return`מפתח${r.keys.length>1?"ות":""} לא מזוה${r.keys.length>1?"ים":"ה"}: ${pt(r.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${r.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r.origin}`;default:return"קלט לא תקין"}}};function sA(){return{localeError:aA()}}const lA=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return r=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Érvénytelen bemenet: a várt érték ${Lt(r.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${o}${r.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${o}${r.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Érvénytelen string: "${o.prefix}" értékkel kell kezdődnie`:o.format==="ends_with"?`Érvénytelen string: "${o.suffix}" értékkel kell végződnie`:o.format==="includes"?`Érvénytelen string: "${o.includes}" értéket kell tartalmaznia`:o.format==="regex"?`Érvénytelen string: ${o.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[o.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function cA(){return{localeError:lA()}}const uA=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${Lt(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${i[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function dA(){return{localeError:uA()}}const hA=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input non valido: atteso ${Lt(r.values[0])}`:`Opzione non valida: atteso uno tra ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function pA(){return{localeError:hA()}}const fA=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return r=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":return r.values.length===1?`無効な入力: ${Lt(r.values[0])}が期待されました`:`無効な選択: ${pt(r.values,"、")}のいずれかである必要があります`;case"too_big":{const o=r.inclusive?"以下である":"より小さい",a=e(r.origin);return a?`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${a.unit??"要素"}${o}必要があります`:`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${o}必要があります`}case"too_small":{const o=r.inclusive?"以上である":"より大きい",a=e(r.origin);return a?`小さすぎる値: ${r.origin}は${r.minimum.toString()}${a.unit}${o}必要があります`:`小さすぎる値: ${r.origin}は${r.minimum.toString()}${o}必要があります`}case"invalid_format":{const o=r;return o.format==="starts_with"?`無効な文字列: "${o.prefix}"で始まる必要があります`:o.format==="ends_with"?`無効な文字列: "${o.suffix}"で終わる必要があります`:o.format==="includes"?`無効な文字列: "${o.includes}"を含む必要があります`:o.format==="regex"?`無効な文字列: パターン${o.pattern}に一致する必要があります`:`無効な${i[o.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${pt(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function mA(){return{localeError:fA()}}const gA=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return r=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":return r.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${Lt(r.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${o} ${r.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${o} ${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`តូចពេក៖ ត្រូវការ ${r.origin} ${o} ${r.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${o.prefix}"`:o.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${o.suffix}"`:o.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${o.includes}"`:o.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${o.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[o.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${pt(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function yA(){return{localeError:gA()}}const vA=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return r=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":return r.values.length===1?`잘못된 입력: 값은 ${Lt(r.values[0])} 이어야 합니다`:`잘못된 옵션: ${pt(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const o=r.inclusive?"이하":"미만",a=o==="미만"?"이어야 합니다":"여야 합니다",s=e(r.origin),l=(s==null?void 0:s.unit)??"요소";return s?`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${l} ${o}${a}`:`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${o}${a}`}case"too_small":{const o=r.inclusive?"이상":"초과",a=o==="이상"?"이어야 합니다":"여야 합니다",s=e(r.origin),l=(s==null?void 0:s.unit)??"요소";return s?`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${l} ${o}${a}`:`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${o}${a}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`잘못된 문자열: "${o.prefix}"(으)로 시작해야 합니다`:o.format==="ends_with"?`잘못된 문자열: "${o.suffix}"(으)로 끝나야 합니다`:o.format==="includes"?`잘못된 문자열: "${o.includes}"을(를) 포함해야 합니다`:o.format==="regex"?`잘못된 문자열: 정규식 ${o.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[o.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${pt(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function bA(){return{localeError:vA()}}const xA=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return r=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${Lt(r.values[0])}`:`Грешана опција: се очекува една ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${o}${r.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Премногу мал: се очекува ${r.origin} да има ${o}${r.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${r.origin} да биде ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Неважечка низа: мора да започнува со "${o.prefix}"`:o.format==="ends_with"?`Неважечка низа: мора да завршува со "${o.suffix}"`:o.format==="includes"?`Неважечка низа: мора да вклучува "${o.includes}"`:o.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function _A(){return{localeError:xA()}}const $A=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${Lt(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Terlalu besar: dijangka ${r.origin??"nilai"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Terlalu kecil: dijangka ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${i[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${pt(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function wA(){return{localeError:$A()}}const kA=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return r=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${Lt(r.values[0])}`:`Ongeldige optie: verwacht één van ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function SA(){return{localeError:kA()}}const AA=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${Lt(r.values[0])}`:`Ugyldig valg: forventet en av ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`For stor(t): forventet ${r.origin??"value"} til å ha ${o}${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til å ha ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`For lite(n): forventet ${r.origin} til å ha ${o}${r.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${r.origin} til å ha ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Ugyldig streng: må starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: må ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: må inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: må matche mønsteret ${o.pattern}`:`Ugyldig ${i[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function zA(){return{localeError:AA()}}const TA=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return r=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Fâsit giren: umulan ${Lt(r.values[0])}`:`Fâsit tercih: mûteberler ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Fazla büyük: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmalıydı.`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Fazla küçük: ${r.origin}, ${o}${r.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${r.origin}, ${o}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Fâsit metin: "${o.prefix}" ile başlamalı.`:o.format==="ends_with"?`Fâsit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`Fâsit metin: "${o.includes}" ihtivâ etmeli.`:o.format==="regex"?`Fâsit metin: ${o.pattern} nakşına uymalı.`:`Fâsit ${i[o.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function LA(){return{localeError:TA()}}const CA=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return r=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":return r.values.length===1?`ناسم ورودي: باید ${Lt(r.values[0])} وای`:`ناسم انتخاب: باید یو له ${pt(r.values,"|")} څخه وای`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`ډیر لوی: ${r.origin??"ارزښت"} باید ${o}${r.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${r.origin??"ارزښت"} باید ${o}${r.maximum.toString()} وي`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`ډیر کوچنی: ${r.origin} باید ${o}${r.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${r.origin} باید ${o}${r.minimum.toString()} وي`}case"invalid_format":{const o=r;return o.format==="starts_with"?`ناسم متن: باید د "${o.prefix}" سره پیل شي`:o.format==="ends_with"?`ناسم متن: باید د "${o.suffix}" سره پای ته ورسيږي`:o.format==="includes"?`ناسم متن: باید "${o.includes}" ولري`:o.format==="regex"?`ناسم متن: باید د ${o.pattern} سره مطابقت ولري`:`${i[o.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${pt(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function IA(){return{localeError:CA()}}const MA=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return r=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${Lt(r.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${o}${r.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${o}${r.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${o.prefix}"`:o.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${o.suffix}"`:o.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${o.includes}"`:o.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${o.pattern}`:`Nieprawidłow(y/a/e) ${i[o.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function NA(){return{localeError:MA()}}const DA=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inválida: esperado ${Lt(r.values[0])}`:`Opção inválida: esperada uma das ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Texto inválido: deve começar com "${o.prefix}"`:o.format==="ends_with"?`Texto inválido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inválido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inválido: deve corresponder ao padrão ${o.pattern}`:`${i[o.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function OA(){return{localeError:DA()}}function em(t,e,n,i){const r=Math.abs(t),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?e:o>=2&&o<=4?n:i}const PA=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return r=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Неверный ввод: ожидалось ${Lt(r.values[0])}`:`Неверный вариант: ожидалось одно из ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);if(a){const s=Number(r.maximum),l=em(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${o}${r.maximum.toString()} ${l}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);if(a){const s=Number(r.minimum),l=em(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${o}${r.minimum.toString()} ${l}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Неверная строка: должна начинаться с "${o.prefix}"`:o.format==="ends_with"?`Неверная строка: должна заканчиваться на "${o.suffix}"`:o.format==="includes"?`Неверная строка: должна содержать "${o.includes}"`:o.format==="regex"?`Неверная строка: должна соответствовать шаблону ${o.pattern}`:`Неверный ${i[o.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function EA(){return{localeError:PA()}}const FA=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return r=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neveljaven vnos: pričakovano ${Lt(r.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Premajhno: pričakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Neveljaven niz: mora se začeti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se končati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${i[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function RA(){return{localeError:FA()}}const jA=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return r=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ogiltig inmatning: förväntat ${Lt(r.values[0])}`:`Ogiltigt val: förväntade en av ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`För stor(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${r.origin??"värdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`För lite(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Ogiltig sträng: måste börja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig sträng: måste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig sträng: måste innehålla "${o.includes}"`:o.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${o.pattern}"`:`Ogiltig(t) ${i[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${pt(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function UA(){return{localeError:jA()}}const BA=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":return r.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${Lt(r.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${pt(r.values,"|")} இல் ஒன்று`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${o}${r.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${o}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${o}${r.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${o}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const o=r;return o.format==="starts_with"?`தவறான சரம்: "${o.prefix}" இல் தொடங்க வேண்டும்`:o.format==="ends_with"?`தவறான சரம்: "${o.suffix}" இல் முடிவடைய வேண்டும்`:o.format==="includes"?`தவறான சரம்: "${o.includes}" ஐ உள்ளடக்க வேண்டும்`:o.format==="regex"?`தவறான சரம்: ${o.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[o.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function HA(){return{localeError:BA()}}const qA=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return r=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":return r.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${Lt(r.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"ไม่เกิน":"น้อยกว่า",a=e(r.origin);return a?`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${o} ${r.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${o} ${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?"อย่างน้อย":"มากกว่า",a=e(r.origin);return a?`น้อยกว่ากำหนด: ${r.origin} ควรมี${o} ${r.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${r.origin} ควรมี${o} ${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${o.prefix}"`:o.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${o.suffix}"`:o.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${o.includes}" อยู่ในข้อความ`:o.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${o.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[o.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${pt(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function GA(){return{localeError:qA()}}const VA=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},ZA=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(i){return t[i]??null}const n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${VA(i.input)}`;case"invalid_value":return i.values.length===1?`Geçersiz değer: beklenen ${Lt(i.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${pt(i.values,"|")}`;case"too_big":{const r=i.inclusive?"<=":"<",o=e(i.origin);return o?`Çok büyük: beklenen ${i.origin??"değer"} ${r}${i.maximum.toString()} ${o.unit??"öğe"}`:`Çok büyük: beklenen ${i.origin??"değer"} ${r}${i.maximum.toString()}`}case"too_small":{const r=i.inclusive?">=":">",o=e(i.origin);return o?`Çok küçük: beklenen ${i.origin} ${r}${i.minimum.toString()} ${o.unit}`:`Çok küçük: beklenen ${i.origin} ${r}${i.minimum.toString()}`}case"invalid_format":{const r=i;return r.format==="starts_with"?`Geçersiz metin: "${r.prefix}" ile başlamalı`:r.format==="ends_with"?`Geçersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Geçersiz metin: "${r.includes}" içermeli`:r.format==="regex"?`Geçersiz metin: ${r.pattern} desenine uymalı`:`Geçersiz ${n[r.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${pt(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function WA(){return{localeError:ZA()}}const KA=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return r=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Неправильні вхідні дані: очікується ${Lt(r.values[0])}`:`Неправильна опція: очікується одне з ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Занадто велике: очікується, що ${r.origin??"значення"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${r.origin??"значення"} буде ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Занадто мале: очікується, що ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${r.origin} буде ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Неправильний рядок: повинен починатися з "${o.prefix}"`:o.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${o.suffix}"`:o.format==="includes"?`Неправильний рядок: повинен містити "${o.includes}"`:o.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${o.pattern}`:`Неправильний ${i[o.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${pt(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function YA(){return{localeError:KA()}}const JA=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return r=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":return r.values.length===1?`غلط ان پٹ: ${Lt(r.values[0])} متوقع تھا`:`غلط آپشن: ${pt(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`بہت بڑا: ${r.origin??"ویلیو"} کے ${o}${r.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${r.origin??"ویلیو"} کا ${o}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`بہت چھوٹا: ${r.origin} کے ${o}${r.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${r.origin} کا ${o}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const o=r;return o.format==="starts_with"?`غلط سٹرنگ: "${o.prefix}" سے شروع ہونا چاہیے`:o.format==="ends_with"?`غلط سٹرنگ: "${o.suffix}" پر ختم ہونا چاہیے`:o.format==="includes"?`غلط سٹرنگ: "${o.includes}" شامل ہونا چاہیے`:o.format==="regex"?`غلط سٹرنگ: پیٹرن ${o.pattern} سے میچ ہونا چاہیے`:`غلط ${i[o.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${pt(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function XA(){return{localeError:JA()}}const QA=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return r=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Đầu vào không hợp lệ: mong đợi ${Lt(r.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Quá lớn: mong đợi ${r.origin??"giá trị"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${r.origin??"giá trị"} ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`Quá nhỏ: mong đợi ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${o.prefix}"`:o.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${o.suffix}"`:o.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${o.includes}"`:o.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${o.pattern}`:`${i[o.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${pt(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function tz(){return{localeError:QA()}}const ez=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return r=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`无效输入:期望 ${Lt(r.values[0])}`:`无效选项:期望以下之一 ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`数值过大:期望 ${r.origin??"值"} ${o}${r.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${r.origin??"值"} ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`数值过小:期望 ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`数值过小:期望 ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`无效字符串:必须以 "${o.prefix}" 开头`:o.format==="ends_with"?`无效字符串:必须以 "${o.suffix}" 结尾`:o.format==="includes"?`无效字符串:必须包含 "${o.includes}"`:o.format==="regex"?`无效字符串:必须满足正则表达式 ${o.pattern}`:`无效${i[o.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${pt(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function rz(){return{localeError:ez()}}const nz=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(r){return t[r]??null}const n=r=>{const o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return r=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`無效的輸入值:預期為 ${Lt(r.values[0])}`:`無效的選項:預期為以下其中之一 ${pt(r.values,"|")}`;case"too_big":{const o=r.inclusive?"<=":"<",a=e(r.origin);return a?`數值過大:預期 ${r.origin??"值"} 應為 ${o}${r.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${r.origin??"值"} 應為 ${o}${r.maximum.toString()}`}case"too_small":{const o=r.inclusive?">=":">",a=e(r.origin);return a?`數值過小:預期 ${r.origin} 應為 ${o}${r.minimum.toString()} ${a.unit}`:`數值過小:預期 ${r.origin} 應為 ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`無效的字串:必須以 "${o.prefix}" 開頭`:o.format==="ends_with"?`無效的字串:必須以 "${o.suffix}" 結尾`:o.format==="includes"?`無效的字串:必須包含 "${o.includes}"`:o.format==="regex"?`無效的字串:必須符合格式 ${o.pattern}`:`無效的 ${i[o.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${pt(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function iz(){return{localeError:nz()}}const Ed=Object.freeze(Object.defineProperty({__proto__:null,ar:D2,az:P2,be:F2,ca:j2,cs:B2,de:q2,en:b0,eo:K2,es:J2,fa:Q2,fi:eA,fr:nA,frCA:oA,he:sA,hu:cA,id:dA,it:pA,ja:mA,kh:yA,ko:bA,mk:_A,ms:wA,nl:SA,no:zA,ota:LA,pl:NA,ps:IA,pt:OA,ru:EA,sl:RA,sv:UA,ta:HA,th:GA,tr:WA,ua:YA,ur:XA,vi:tz,zhCN:rz,zhTW:iz},Symbol.toStringTag,{value:"Module"})),Fd=Symbol("ZodOutput"),Rd=Symbol("ZodInput");class jd{constructor(){this._map=new Map,this._idmap=new Map}add(e,...n){const i=n[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const i={...this.get(n)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ll(){return new jd}const vn=ll();function x0(t,e){return new t({type:"string",...ct(e)})}function _0(t,e){return new t({type:"string",coerce:!0,...ct(e)})}function Ud(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ct(e)})}function vs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ct(e)})}function Bd(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ct(e)})}function Hd(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ct(e)})}function qd(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ct(e)})}function Gd(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ct(e)})}function Vd(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ct(e)})}function Zd(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ct(e)})}function Wd(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ct(e)})}function Kd(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ct(e)})}function Yd(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ct(e)})}function Jd(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ct(e)})}function Xd(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ct(e)})}function Qd(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ct(e)})}function th(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ct(e)})}function eh(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ct(e)})}function rh(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ct(e)})}function nh(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ct(e)})}function ih(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ct(e)})}function oh(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ct(e)})}function ah(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ct(e)})}function sh(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ct(e)})}const lh={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function $0(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ct(e)})}function w0(t,e){return new t({type:"string",format:"date",check:"string_format",...ct(e)})}function k0(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ct(e)})}function S0(t,e){return new t({type:"string",format:"duration",check:"string_format",...ct(e)})}function A0(t,e){return new t({type:"number",checks:[],...ct(e)})}function z0(t,e){return new t({type:"number",coerce:!0,checks:[],...ct(e)})}function T0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ct(e)})}function L0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...ct(e)})}function C0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...ct(e)})}function I0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...ct(e)})}function M0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...ct(e)})}function N0(t,e){return new t({type:"boolean",...ct(e)})}function D0(t,e){return new t({type:"boolean",coerce:!0,...ct(e)})}function O0(t,e){return new t({type:"bigint",...ct(e)})}function P0(t,e){return new t({type:"bigint",coerce:!0,...ct(e)})}function E0(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...ct(e)})}function F0(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...ct(e)})}function R0(t,e){return new t({type:"symbol",...ct(e)})}function j0(t,e){return new t({type:"undefined",...ct(e)})}function U0(t,e){return new t({type:"null",...ct(e)})}function B0(t){return new t({type:"any"})}function bs(t){return new t({type:"unknown"})}function H0(t,e){return new t({type:"never",...ct(e)})}function q0(t,e){return new t({type:"void",...ct(e)})}function G0(t,e){return new t({type:"date",...ct(e)})}function V0(t,e){return new t({type:"date",coerce:!0,...ct(e)})}function Z0(t,e){return new t({type:"nan",...ct(e)})}function $n(t,e){return new zd({check:"less_than",...ct(e),value:t,inclusive:!1})}function sr(t,e){return new zd({check:"less_than",...ct(e),value:t,inclusive:!0})}function wn(t,e){return new Td({check:"greater_than",...ct(e),value:t,inclusive:!1})}function Ue(t,e){return new Td({check:"greater_than",...ct(e),value:t,inclusive:!0})}function ch(t){return wn(0,t)}function uh(t){return $n(0,t)}function dh(t){return sr(0,t)}function hh(t){return Ue(0,t)}function Bi(t,e){return new Yv({check:"multiple_of",...ct(e),value:t})}function ua(t,e){return new Qv({check:"max_size",...ct(e),maximum:t})}function Hi(t,e){return new tb({check:"min_size",...ct(e),minimum:t})}function cl(t,e){return new eb({check:"size_equals",...ct(e),size:t})}function da(t,e){return new rb({check:"max_length",...ct(e),maximum:t})}function Jn(t,e){return new nb({check:"min_length",...ct(e),minimum:t})}function ha(t,e){return new ib({check:"length_equals",...ct(e),length:t})}function ul(t,e){return new ob({check:"string_format",format:"regex",...ct(e),pattern:t})}function dl(t){return new ab({check:"string_format",format:"lowercase",...ct(t)})}function hl(t){return new sb({check:"string_format",format:"uppercase",...ct(t)})}function pl(t,e){return new lb({check:"string_format",format:"includes",...ct(e),includes:t})}function fl(t,e){return new cb({check:"string_format",format:"starts_with",...ct(e),prefix:t})}function ml(t,e){return new ub({check:"string_format",format:"ends_with",...ct(e),suffix:t})}function ph(t,e,n){return new db({check:"property",property:t,schema:e,...ct(n)})}function gl(t,e){return new hb({check:"mime_type",mime:t,...ct(e)})}function Sn(t){return new pb({check:"overwrite",tx:t})}function yl(t){return Sn(e=>e.normalize(t))}function vl(){return Sn(t=>t.trim())}function bl(){return Sn(t=>t.toLowerCase())}function xl(){return Sn(t=>t.toUpperCase())}function fh(t,e,n){return new t({type:"array",element:e,...ct(n)})}function oz(t,e,n){return new t({type:"union",options:e,...ct(n)})}function az(t,e,n,i){return new t({type:"union",options:n,discriminator:e,...ct(i)})}function sz(t,e,n){return new t({type:"intersection",left:e,right:n})}function W0(t,e,n,i){const r=n instanceof St,o=r?i:n,a=r?n:null;return new t({type:"tuple",items:e,rest:a,...ct(o)})}function lz(t,e,n,i){return new t({type:"record",keyType:e,valueType:n,...ct(i)})}function cz(t,e,n,i){return new t({type:"map",keyType:e,valueType:n,...ct(i)})}function uz(t,e,n){return new t({type:"set",valueType:e,...ct(n)})}function dz(t,e,n){const i=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new t({type:"enum",entries:i,...ct(n)})}function hz(t,e,n){return new t({type:"enum",entries:e,...ct(n)})}function pz(t,e,n){return new t({type:"literal",values:Array.isArray(e)?e:[e],...ct(n)})}function K0(t,e){return new t({type:"file",...ct(e)})}function fz(t,e){return new t({type:"transform",transform:e})}function mz(t,e){return new t({type:"optional",innerType:e})}function gz(t,e){return new t({type:"nullable",innerType:e})}function yz(t,e,n){return new t({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():n}})}function vz(t,e,n){return new t({type:"nonoptional",innerType:e,...ct(n)})}function bz(t,e){return new t({type:"success",innerType:e})}function xz(t,e,n){return new t({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}function _z(t,e,n){return new t({type:"pipe",in:e,out:n})}function $z(t,e){return new t({type:"readonly",innerType:e})}function wz(t,e,n){return new t({type:"template_literal",parts:e,...ct(n)})}function kz(t,e){return new t({type:"lazy",getter:e})}function Sz(t,e){return new t({type:"promise",innerType:e})}function Y0(t,e,n){const i=ct(n);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function J0(t,e,n){return new t({type:"custom",check:"custom",fn:e,...ct(n)})}function X0(t,e){const n=ct(e);let i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(m=>typeof m=="string"?m.toLowerCase():m),r=r.map(m=>typeof m=="string"?m.toLowerCase():m));const o=new Set(i),a=new Set(r),s=t.Pipe??Pd,l=t.Boolean??Id,c=t.String??ca,u=t.Transform??Od,d=new u({type:"transform",transform:(m,v)=>{let b=m;return n.case!=="sensitive"&&(b=b.toLowerCase()),o.has(b)?!0:a.has(b)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:v.value,inst:d}),{})},error:n.error}),h=new s({type:"pipe",in:new c({type:"string",error:n.error}),out:d,error:n.error});return new s({type:"pipe",in:h,out:new l({type:"boolean",error:n.error}),error:n.error})}function Q0(t,e,n,i={}){const r=ct(i),o={...ct(i),check:"string_format",type:"string",format:e,fn:typeof n=="function"?n:s=>n.test(s),...r};return n instanceof RegExp&&(o.pattern=n),new t(o)}class tx{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const n=(...i)=>{const r=this._def.input?vu(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw new Error("Invalid arguments schema: not an array or tuple schema.");const o=e(...r);return this._def.output?vu(this._def.output,o,void 0,{callee:n}):o};return n}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const n=async(...i)=>{const r=this._def.input?await bu(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw new Error("Invalid arguments schema: not an array or tuple schema.");const o=await e(...r);return this._def.output?bu(this._def.output,o,void 0,{callee:n}):o};return n}input(...e){const n=this.constructor;return Array.isArray(e[0])?new n({type:"function",input:new sl({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new n({type:"function",input:e[0],output:this._def.output})}output(e){const n=this.constructor;return new n({type:"function",input:this._def.input,output:e})}}function mh(t){return new tx({type:"function",input:Array.isArray(t==null?void 0:t.input)?W0(sl,t==null?void 0:t.input):(t==null?void 0:t.input)??fh(Nd,bs(ys)),output:(t==null?void 0:t.output)??bs(ys)})}class _u{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??vn,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){var d,h,p;var i;const r=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,s);const l=(h=(d=e._zod).toJSONSchema)==null?void 0:h.call(d);if(l)s.schema=l;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path},v=e._zod.parent;if(v)s.ref=v,this.process(v,m),this.seen.get(v).isParent=!0;else{const b=s.schema;switch(r.type){case"string":{const g=b;g.type="string";const{minimum:$,maximum:_,format:y,patterns:S,contentEncoding:w}=e._zod.bag;if(typeof $=="number"&&(g.minLength=$),typeof _=="number"&&(g.maxLength=_),y&&(g.format=o[y]??y,g.format===""&&delete g.format),w&&(g.contentEncoding=w),S&&S.size>0){const L=[...S];L.length===1?g.pattern=L[0].source:L.length>1&&(s.schema.allOf=[...L.map(N=>({...this.target==="draft-7"?{type:"string"}:{},pattern:N.source}))])}break}case"number":{const g=b,{minimum:$,maximum:_,format:y,multipleOf:S,exclusiveMaximum:w,exclusiveMinimum:L}=e._zod.bag;typeof y=="string"&&y.includes("int")?g.type="integer":g.type="number",typeof L=="number"&&(g.exclusiveMinimum=L),typeof $=="number"&&(g.minimum=$,typeof L=="number"&&(L>=$?delete g.minimum:delete g.exclusiveMinimum)),typeof w=="number"&&(g.exclusiveMaximum=w),typeof _=="number"&&(g.maximum=_,typeof w=="number"&&(w<=_?delete g.maximum:delete g.exclusiveMaximum)),typeof S=="number"&&(g.multipleOf=S);break}case"boolean":{const g=b;g.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{b.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{b.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const g=b,{minimum:$,maximum:_}=e._zod.bag;typeof $=="number"&&(g.minItems=$),typeof _=="number"&&(g.maxItems=_),g.type="array",g.items=this.process(r.element,{...m,path:[...m.path,"items"]});break}case"object":{const g=b;g.type="object",g.properties={};const $=r.shape;for(const S in $)g.properties[S]=this.process($[S],{...m,path:[...m.path,"properties",S]});const _=new Set(Object.keys($)),y=new Set([..._].filter(S=>{const w=r.shape[S]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));y.size>0&&(g.required=Array.from(y)),((p=r.catchall)==null?void 0:p._zod.def.type)==="never"?g.additionalProperties=!1:r.catchall?r.catchall&&(g.additionalProperties=this.process(r.catchall,{...m,path:[...m.path,"additionalProperties"]})):this.io==="output"&&(g.additionalProperties=!1);break}case"union":{const g=b;g.anyOf=r.options.map(($,_)=>this.process($,{...m,path:[...m.path,"anyOf",_]}));break}case"intersection":{const g=b,$=this.process(r.left,{...m,path:[...m.path,"allOf",0]}),_=this.process(r.right,{...m,path:[...m.path,"allOf",1]}),y=w=>"allOf"in w&&Object.keys(w).length===1,S=[...y($)?$.allOf:[$],...y(_)?_.allOf:[_]];g.allOf=S;break}case"tuple":{const g=b;g.type="array";const $=r.items.map((S,w)=>this.process(S,{...m,path:[...m.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?g.prefixItems=$:g.items=$,r.rest){const S=this.process(r.rest,{...m,path:[...m.path,"items"]});this.target==="draft-2020-12"?g.items=S:g.additionalItems=S}r.rest&&(g.items=this.process(r.rest,{...m,path:[...m.path,"items"]}));const{minimum:_,maximum:y}=e._zod.bag;typeof _=="number"&&(g.minItems=_),typeof y=="number"&&(g.maxItems=y);break}case"record":{const g=b;g.type="object",g.propertyNames=this.process(r.keyType,{...m,path:[...m.path,"propertyNames"]}),g.additionalProperties=this.process(r.valueType,{...m,path:[...m.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const g=b,$=md(r.entries);$.every(_=>typeof _=="number")&&(g.type="number"),$.every(_=>typeof _=="string")&&(g.type="string"),g.enum=$;break}case"literal":{const g=b,$=[];for(const _ of r.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");$.push(Number(_))}else $.push(_);if($.length!==0)if($.length===1){const _=$[0];g.type=_===null?"null":typeof _,g.const=_}else $.every(_=>typeof _=="number")&&(g.type="number"),$.every(_=>typeof _=="string")&&(g.type="string"),$.every(_=>typeof _=="boolean")&&(g.type="string"),$.every(_=>_===null)&&(g.type="null"),g.enum=$;break}case"file":{const g=b,$={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:y,mime:S}=e._zod.bag;_!==void 0&&($.minLength=_),y!==void 0&&($.maxLength=y),S?S.length===1?($.contentMediaType=S[0],Object.assign(g,$)):g.anyOf=S.map(w=>({...$,contentMediaType:w})):Object.assign(g,$);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const g=this.process(r.innerType,m);b.anyOf=[g,{type:"null"}];break}case"nonoptional":{this.process(r.innerType,m),s.ref=r.innerType;break}case"success":{const g=b;g.type="boolean";break}case"default":{this.process(r.innerType,m),s.ref=r.innerType,b.default=JSON.parse(JSON.stringify(r.defaultValue));break}case"prefault":{this.process(r.innerType,m),s.ref=r.innerType,this.io==="input"&&(b._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break}case"catch":{this.process(r.innerType,m),s.ref=r.innerType;let g;try{g=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}b.default=g;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const g=b,$=e._zod.pattern;if(!$)throw new Error("Pattern not found in template literal");g.type="string",g.pattern=$.source;break}case"pipe":{const g=this.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;this.process(g,m),s.ref=g;break}case"readonly":{this.process(r.innerType,m),s.ref=r.innerType,b.readOnly=!0;break}case"promise":{this.process(r.innerType,m),s.ref=r.innerType;break}case"optional":{this.process(r.innerType,m),s.ref=r.innerType;break}case"lazy":{const g=e._zod.innerType;this.process(g,m),s.ref=g;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),this.io==="input"&&pe(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,n){var u,d,h,p,m,v;const i={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},r=this.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=b=>{var S;const g=this.target==="draft-2020-12"?"$defs":"definitions";if(i.external){const w=(S=i.external.registry.get(b[0]))==null?void 0:S.id,L=i.external.uri??(E=>E);if(w)return{ref:L(w)};const N=b[1].defId??b[1].schema.id??`schema${this.counter++}`;return b[1].defId=N,{defId:N,ref:`${L("__shared")}#/${g}/${N}`}}if(b[1]===r)return{ref:"#"};const _=`#/${g}/`,y=b[1].schema.id??`__schema${this.counter++}`;return{defId:y,ref:_+y}},a=b=>{if(b[1].schema.$ref)return;const g=b[1],{ref:$,defId:_}=o(b);g.def={...g.schema},_&&(g.defId=_);const y=g.schema;for(const S in y)delete y[S];y.$ref=$};if(i.cycles==="throw")for(const b of this.seen.entries()){const g=b[1];if(g.cycle)throw new Error(`Cycle detected: #/${(u=g.cycle)==null?void 0:u.join("/")}/<root>
110
+
111
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const b of this.seen.entries()){const g=b[1];if(e===b[0]){a(b);continue}if(i.external){const _=(d=i.external.registry.get(b[0]))==null?void 0:d.id;if(e!==b[0]&&_){a(b);continue}}if((h=this.metadataRegistry.get(b[0]))==null?void 0:h.id){a(b);continue}if(g.cycle){a(b);continue}if(g.count>1&&i.reused==="ref"){a(b);continue}}const s=(b,g)=>{const $=this.seen.get(b),_=$.def??$.schema,y={..._};if($.ref===null)return;const S=$.ref;if($.ref=null,S){s(S,g);const w=this.seen.get(S).schema;w.$ref&&g.target==="draft-7"?(_.allOf=_.allOf??[],_.allOf.push(w)):(Object.assign(_,w),Object.assign(_,y))}$.isParent||this.override({zodSchema:b,jsonSchema:_,path:$.path??[]})};for(const b of[...this.seen.entries()].reverse())s(b[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(p=i.external)!=null&&p.uri){const b=(m=i.external.registry.get(e))==null?void 0:m.id;if(!b)throw new Error("Schema is missing an `id` property");l.$id=i.external.uri(b)}Object.assign(l,r.def);const c=((v=i.external)==null?void 0:v.defs)??{};for(const b of this.seen.entries()){const g=b[1];g.def&&g.defId&&(c[g.defId]=g.def)}i.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function gh(t,e){if(t instanceof jd){const i=new _u(e),r={};for(const s of t._idmap.entries()){const[l,c]=s;i.process(c)}const o={},a={registry:t,uri:e==null?void 0:e.uri,defs:r};for(const s of t._idmap.entries()){const[l,c]=s;o[l]=i.emit(c,{...e,external:a})}if(Object.keys(r).length>0){const s=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[s]:r}}return{schemas:o}}const n=new _u(e);return n.process(t),n.emit(t,e)}function pe(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return pe(r.element,n);case"object":{for(const o in r.shape)if(pe(r.shape[o],n))return!0;return!1}case"union":{for(const o of r.options)if(pe(o,n))return!0;return!1}case"intersection":return pe(r.left,n)||pe(r.right,n);case"tuple":{for(const o of r.items)if(pe(o,n))return!0;return!!(r.rest&&pe(r.rest,n))}case"record":return pe(r.keyType,n)||pe(r.valueType,n);case"map":return pe(r.keyType,n)||pe(r.valueType,n);case"set":return pe(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return pe(r.innerType,n);case"lazy":return pe(r.getter(),n);case"default":return pe(r.innerType,n);case"prefault":return pe(r.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return pe(r.in,n)||pe(r.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${r.type}`)}const Az=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ex=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Zb,$ZodArray:Nd,$ZodAsyncError:Ri,$ZodBase64:Ob,$ZodBase64URL:Eb,$ZodBigInt:Md,$ZodBigIntFormat:Hb,$ZodBoolean:Id,$ZodCIDRv4:Nb,$ZodCIDRv6:Db,$ZodCUID:$b,$ZodCUID2:wb,$ZodCatch:h0,$ZodCheck:le,$ZodCheckBigIntFormat:Xv,$ZodCheckEndsWith:ub,$ZodCheckGreaterThan:Td,$ZodCheckIncludes:lb,$ZodCheckLengthEquals:ib,$ZodCheckLessThan:zd,$ZodCheckLowerCase:ab,$ZodCheckMaxLength:rb,$ZodCheckMaxSize:Qv,$ZodCheckMimeType:hb,$ZodCheckMinLength:nb,$ZodCheckMinSize:tb,$ZodCheckMultipleOf:Yv,$ZodCheckNumberFormat:Jv,$ZodCheckOverwrite:pb,$ZodCheckProperty:db,$ZodCheckRegex:ob,$ZodCheckSizeEquals:eb,$ZodCheckStartsWith:cb,$ZodCheckStringFormat:la,$ZodCheckUpperCase:sb,$ZodCustom:v0,$ZodCustomStringFormat:Ub,$ZodDate:Yb,$ZodDefault:l0,$ZodDiscriminatedUnion:Xb,$ZodE164:Fb,$ZodEmail:vb,$ZodEmoji:xb,$ZodEnum:n0,$ZodError:yd,$ZodFile:o0,$ZodFunction:tx,$ZodGUID:gb,$ZodIPv4:Ib,$ZodIPv6:Mb,$ZodISODate:Tb,$ZodISODateTime:zb,$ZodISODuration:Cb,$ZodISOTime:Lb,$ZodIntersection:Qb,$ZodJWT:jb,$ZodKSUID:Ab,$ZodLazy:y0,$ZodLiteral:i0,$ZodMap:e0,$ZodNaN:p0,$ZodNanoID:_b,$ZodNever:Wb,$ZodNonOptional:u0,$ZodNull:Vb,$ZodNullable:s0,$ZodNumber:Cd,$ZodNumberFormat:Bb,$ZodObject:Jb,$ZodOptional:a0,$ZodPipe:Pd,$ZodPrefault:c0,$ZodPromise:g0,$ZodReadonly:f0,$ZodRealError:sa,$ZodRecord:t0,$ZodRegistry:jd,$ZodSet:r0,$ZodString:ca,$ZodStringFormat:te,$ZodSuccess:d0,$ZodSymbol:qb,$ZodTemplateLiteral:m0,$ZodTransform:Od,$ZodTuple:sl,$ZodType:St,$ZodULID:kb,$ZodURL:bb,$ZodUUID:yb,$ZodUndefined:Gb,$ZodUnion:Dd,$ZodUnknown:ys,$ZodVoid:Kb,$ZodXID:Sb,$brand:fd,$constructor:Z,$input:Rd,$output:Fd,Doc:fb,JSONSchema:Az,JSONSchemaGenerator:_u,NEVER:pd,TimePrecision:lh,_any:B0,_array:fh,_base64:ih,_base64url:oh,_bigint:O0,_boolean:N0,_catch:xz,_cidrv4:rh,_cidrv6:nh,_coercedBigint:P0,_coercedBoolean:D0,_coercedDate:V0,_coercedNumber:z0,_coercedString:_0,_cuid:Kd,_cuid2:Yd,_custom:Y0,_date:G0,_default:yz,_discriminatedUnion:az,_e164:ah,_email:Ud,_emoji:Zd,_endsWith:ml,_enum:dz,_file:K0,_float32:L0,_float64:C0,_gt:wn,_gte:Ue,_guid:vs,_includes:pl,_int:T0,_int32:I0,_int64:E0,_intersection:sz,_ipv4:th,_ipv6:eh,_isoDate:w0,_isoDateTime:$0,_isoDuration:S0,_isoTime:k0,_jwt:sh,_ksuid:Qd,_lazy:kz,_length:ha,_literal:pz,_lowercase:dl,_lt:$n,_lte:sr,_map:cz,_max:sr,_maxLength:da,_maxSize:ua,_mime:gl,_min:Ue,_minLength:Jn,_minSize:Hi,_multipleOf:Bi,_nan:Z0,_nanoid:Wd,_nativeEnum:hz,_negative:uh,_never:H0,_nonnegative:hh,_nonoptional:vz,_nonpositive:dh,_normalize:yl,_null:U0,_nullable:gz,_number:A0,_optional:mz,_overwrite:Sn,_parse:xd,_parseAsync:_d,_pipe:_z,_positive:ch,_promise:Sz,_property:ph,_readonly:$z,_record:lz,_refine:J0,_regex:ul,_safeParse:$d,_safeParseAsync:kd,_set:uz,_size:cl,_startsWith:fl,_string:x0,_stringFormat:Q0,_stringbool:X0,_success:bz,_symbol:R0,_templateLiteral:wz,_toLowerCase:bl,_toUpperCase:xl,_transform:fz,_trim:vl,_tuple:W0,_uint32:M0,_uint64:F0,_ulid:Jd,_undefined:j0,_union:oz,_unknown:bs,_uppercase:hl,_url:Vd,_uuid:Bd,_uuidv4:Hd,_uuidv6:qd,_uuidv7:Gd,_void:q0,_xid:Xd,clone:Mr,config:$e,flattenError:ol,formatError:al,function:mh,globalConfig:ms,globalRegistry:vn,isValidBase64:Ld,isValidBase64URL:Pb,isValidJWT:Rb,locales:Ed,parse:vu,parseAsync:bu,prettifyError:bd,regexes:Ad,registry:ll,safeParse:wd,safeParseAsync:gv,toDotPath:mv,toJSONSchema:gh,treeifyError:vd,util:w2,version:mb},Symbol.toStringTag,{value:"Module"}));function yh(t){return!!t._zod}function rx(t,e){return yh(t)?wd(t,e):t.safeParse(e)}function zz(t){var n,i;if(!t)return;let e;if(yh(t)?e=(i=(n=t._zod)==null?void 0:n.def)==null?void 0:i.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Tz(t){var r;if(yh(t)){const a=(r=t._zod)==null?void 0:r.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const i=t.value;if(i!==void 0)return i}const _l=Z("ZodISODateTime",(t,e)=>{zb.init(t,e),ee.init(t,e)});function vh(t){return $0(_l,t)}const $l=Z("ZodISODate",(t,e)=>{Tb.init(t,e),ee.init(t,e)});function nx(t){return w0($l,t)}const wl=Z("ZodISOTime",(t,e)=>{Lb.init(t,e),ee.init(t,e)});function ix(t){return k0(wl,t)}const kl=Z("ZodISODuration",(t,e)=>{Cb.init(t,e),ee.init(t,e)});function ox(t){return S0(kl,t)}const ax=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$l,ZodISODateTime:_l,ZodISODuration:kl,ZodISOTime:wl,date:nx,datetime:vh,duration:ox,time:ix},Symbol.toStringTag,{value:"Module"})),sx=(t,e)=>{yd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>al(t,n)},flatten:{value:n=>ol(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},lx=Z("ZodError",sx),uo=Z("ZodError",sx,{Parent:Error}),bh=xd(uo),xh=_d(uo),_h=$d(uo),$h=kd(uo),Mt=Z("ZodType",(t,e)=>(St.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(n,i)=>Mr(t,n,i),t.brand=()=>t,t.register=(n,i)=>(n.add(t,i),t),t.parse=(n,i)=>bh(t,n,i,{callee:t.parse}),t.safeParse=(n,i)=>_h(t,n,i),t.parseAsync=async(n,i)=>xh(t,n,i,{callee:t.parseAsync}),t.safeParseAsync=async(n,i)=>$h(t,n,i),t.spa=t.safeParseAsync,t.refine=(n,i)=>t.check(np(n,i)),t.superRefine=n=>t.check(ip(n)),t.overwrite=n=>t.check(Sn(n)),t.optional=()=>Qt(t),t.nullable=()=>qo(t),t.nullish=()=>Qt(qo(t)),t.nonoptional=n=>qh(t,n),t.array=()=>_t(t),t.or=n=>Dt([t,n]),t.and=n=>va(t,n),t.transform=n=>Go(t,Jl(n)),t.default=n=>Uh(t,n),t.prefault=n=>Hh(t,n),t.catch=n=>Zh(t,n),t.pipe=n=>Go(t,n),t.readonly=()=>Yh(t),t.describe=n=>{const i=t.clone();return vn.add(i,{description:n}),i},Object.defineProperty(t,"description",{get(){var n;return(n=vn.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return vn.get(t);const i=t.clone();return vn.add(i,n[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Sl=Z("_ZodString",(t,e)=>{ca.init(t,e),Mt.init(t,e);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...i)=>t.check(ul(...i)),t.includes=(...i)=>t.check(pl(...i)),t.startsWith=(...i)=>t.check(fl(...i)),t.endsWith=(...i)=>t.check(ml(...i)),t.min=(...i)=>t.check(Jn(...i)),t.max=(...i)=>t.check(da(...i)),t.length=(...i)=>t.check(ha(...i)),t.nonempty=(...i)=>t.check(Jn(1,...i)),t.lowercase=i=>t.check(dl(i)),t.uppercase=i=>t.check(hl(i)),t.trim=()=>t.check(vl()),t.normalize=(...i)=>t.check(yl(...i)),t.toLowerCase=()=>t.check(bl()),t.toUpperCase=()=>t.check(xl())}),pa=Z("ZodString",(t,e)=>{ca.init(t,e),Sl.init(t,e),t.email=n=>t.check(Ud(Al,n)),t.url=n=>t.check(Vd(zl,n)),t.jwt=n=>t.check(sh(Bl,n)),t.emoji=n=>t.check(Zd(Tl,n)),t.guid=n=>t.check(vs(Bo,n)),t.uuid=n=>t.check(Bd(jr,n)),t.uuidv4=n=>t.check(Hd(jr,n)),t.uuidv6=n=>t.check(qd(jr,n)),t.uuidv7=n=>t.check(Gd(jr,n)),t.nanoid=n=>t.check(Wd(Ll,n)),t.guid=n=>t.check(vs(Bo,n)),t.cuid=n=>t.check(Kd(Cl,n)),t.cuid2=n=>t.check(Yd(Il,n)),t.ulid=n=>t.check(Jd(Ml,n)),t.base64=n=>t.check(ih(Rl,n)),t.base64url=n=>t.check(oh(jl,n)),t.xid=n=>t.check(Xd(Nl,n)),t.ksuid=n=>t.check(Qd(Dl,n)),t.ipv4=n=>t.check(th(Ol,n)),t.ipv6=n=>t.check(eh(Pl,n)),t.cidrv4=n=>t.check(rh(El,n)),t.cidrv6=n=>t.check(nh(Fl,n)),t.e164=n=>t.check(ah(Ul,n)),t.datetime=n=>t.check(vh(n)),t.date=n=>t.check(nx(n)),t.time=n=>t.check(ix(n)),t.duration=n=>t.check(ox(n))});function q(t){return x0(pa,t)}const ee=Z("ZodStringFormat",(t,e)=>{te.init(t,e),Sl.init(t,e)}),Al=Z("ZodEmail",(t,e)=>{vb.init(t,e),ee.init(t,e)});function cx(t){return Ud(Al,t)}const Bo=Z("ZodGUID",(t,e)=>{gb.init(t,e),ee.init(t,e)});function ux(t){return vs(Bo,t)}const jr=Z("ZodUUID",(t,e)=>{yb.init(t,e),ee.init(t,e)});function dx(t){return Bd(jr,t)}function hx(t){return Hd(jr,t)}function px(t){return qd(jr,t)}function fx(t){return Gd(jr,t)}const zl=Z("ZodURL",(t,e)=>{bb.init(t,e),ee.init(t,e)});function mx(t){return Vd(zl,t)}const Tl=Z("ZodEmoji",(t,e)=>{xb.init(t,e),ee.init(t,e)});function gx(t){return Zd(Tl,t)}const Ll=Z("ZodNanoID",(t,e)=>{_b.init(t,e),ee.init(t,e)});function yx(t){return Wd(Ll,t)}const Cl=Z("ZodCUID",(t,e)=>{$b.init(t,e),ee.init(t,e)});function vx(t){return Kd(Cl,t)}const Il=Z("ZodCUID2",(t,e)=>{wb.init(t,e),ee.init(t,e)});function bx(t){return Yd(Il,t)}const Ml=Z("ZodULID",(t,e)=>{kb.init(t,e),ee.init(t,e)});function xx(t){return Jd(Ml,t)}const Nl=Z("ZodXID",(t,e)=>{Sb.init(t,e),ee.init(t,e)});function _x(t){return Xd(Nl,t)}const Dl=Z("ZodKSUID",(t,e)=>{Ab.init(t,e),ee.init(t,e)});function $x(t){return Qd(Dl,t)}const Ol=Z("ZodIPv4",(t,e)=>{Ib.init(t,e),ee.init(t,e)});function wx(t){return th(Ol,t)}const Pl=Z("ZodIPv6",(t,e)=>{Mb.init(t,e),ee.init(t,e)});function kx(t){return eh(Pl,t)}const El=Z("ZodCIDRv4",(t,e)=>{Nb.init(t,e),ee.init(t,e)});function Sx(t){return rh(El,t)}const Fl=Z("ZodCIDRv6",(t,e)=>{Db.init(t,e),ee.init(t,e)});function Ax(t){return nh(Fl,t)}const Rl=Z("ZodBase64",(t,e)=>{Ob.init(t,e),ee.init(t,e)});function zx(t){return ih(Rl,t)}const jl=Z("ZodBase64URL",(t,e)=>{Eb.init(t,e),ee.init(t,e)});function Tx(t){return oh(jl,t)}const Ul=Z("ZodE164",(t,e)=>{Fb.init(t,e),ee.init(t,e)});function Lx(t){return ah(Ul,t)}const Bl=Z("ZodJWT",(t,e)=>{jb.init(t,e),ee.init(t,e)});function Cx(t){return sh(Bl,t)}const wh=Z("ZodCustomStringFormat",(t,e)=>{Ub.init(t,e),ee.init(t,e)});function Ix(t,e,n={}){return Q0(wh,t,e,n)}const fa=Z("ZodNumber",(t,e)=>{Cd.init(t,e),Mt.init(t,e),t.gt=(i,r)=>t.check(wn(i,r)),t.gte=(i,r)=>t.check(Ue(i,r)),t.min=(i,r)=>t.check(Ue(i,r)),t.lt=(i,r)=>t.check($n(i,r)),t.lte=(i,r)=>t.check(sr(i,r)),t.max=(i,r)=>t.check(sr(i,r)),t.int=i=>t.check(xs(i)),t.safe=i=>t.check(xs(i)),t.positive=i=>t.check(wn(0,i)),t.nonnegative=i=>t.check(Ue(0,i)),t.negative=i=>t.check($n(0,i)),t.nonpositive=i=>t.check(sr(0,i)),t.multipleOf=(i,r)=>t.check(Bi(i,r)),t.step=(i,r)=>t.check(Bi(i,r)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Tt(t){return A0(fa,t)}const li=Z("ZodNumberFormat",(t,e)=>{Bb.init(t,e),fa.init(t,e)});function xs(t){return T0(li,t)}function Mx(t){return L0(li,t)}function Nx(t){return C0(li,t)}function Dx(t){return I0(li,t)}function Ox(t){return M0(li,t)}const ma=Z("ZodBoolean",(t,e)=>{Id.init(t,e),Mt.init(t,e)});function Wt(t){return N0(ma,t)}const ga=Z("ZodBigInt",(t,e)=>{Md.init(t,e),Mt.init(t,e),t.gte=(i,r)=>t.check(Ue(i,r)),t.min=(i,r)=>t.check(Ue(i,r)),t.gt=(i,r)=>t.check(wn(i,r)),t.gte=(i,r)=>t.check(Ue(i,r)),t.min=(i,r)=>t.check(Ue(i,r)),t.lt=(i,r)=>t.check($n(i,r)),t.lte=(i,r)=>t.check(sr(i,r)),t.max=(i,r)=>t.check(sr(i,r)),t.positive=i=>t.check(wn(BigInt(0),i)),t.negative=i=>t.check($n(BigInt(0),i)),t.nonpositive=i=>t.check(sr(BigInt(0),i)),t.nonnegative=i=>t.check(Ue(BigInt(0),i)),t.multipleOf=(i,r)=>t.check(Bi(i,r));const n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null});function Px(t){return O0(ga,t)}const Hl=Z("ZodBigIntFormat",(t,e)=>{Hb.init(t,e),ga.init(t,e)});function Ex(t){return E0(Hl,t)}function Fx(t){return F0(Hl,t)}const kh=Z("ZodSymbol",(t,e)=>{qb.init(t,e),Mt.init(t,e)});function Rx(t){return R0(kh,t)}const Sh=Z("ZodUndefined",(t,e)=>{Gb.init(t,e),Mt.init(t,e)});function Ho(t){return j0(Sh,t)}const Ah=Z("ZodNull",(t,e)=>{Vb.init(t,e),Mt.init(t,e)});function ql(t){return U0(Ah,t)}const zh=Z("ZodAny",(t,e)=>{Zb.init(t,e),Mt.init(t,e)});function Gl(){return B0(zh)}const Th=Z("ZodUnknown",(t,e)=>{ys.init(t,e),Mt.init(t,e)});function Kt(){return bs(Th)}const Lh=Z("ZodNever",(t,e)=>{Wb.init(t,e),Mt.init(t,e)});function Xn(t){return H0(Lh,t)}const Ch=Z("ZodVoid",(t,e)=>{Kb.init(t,e),Mt.init(t,e)});function jx(t){return q0(Ch,t)}const Vl=Z("ZodDate",(t,e)=>{Yb.init(t,e),Mt.init(t,e),t.min=(i,r)=>t.check(Ue(i,r)),t.max=(i,r)=>t.check(sr(i,r));const n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function Ux(t){return G0(Vl,t)}const Ih=Z("ZodArray",(t,e)=>{Nd.init(t,e),Mt.init(t,e),t.element=e.element,t.min=(n,i)=>t.check(Jn(n,i)),t.nonempty=n=>t.check(Jn(1,n)),t.max=(n,i)=>t.check(da(n,i)),t.length=(n,i)=>t.check(ha(n,i)),t.unwrap=()=>t.element});function _t(t,e){return fh(Ih,t,e)}function Bx(t){const e=t._zod.def.shape;return G(Object.keys(e))}const ya=Z("ZodObject",(t,e)=>{Jb.init(t,e),Mt.init(t,e),Bt(t,"shape",()=>e.shape),t.keyof=()=>Fe(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Kt()}),t.loose=()=>t.clone({...t._zod.def,catchall:Kt()}),t.strict=()=>t.clone({...t._zod.def,catchall:Xn()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>uv(t,n),t.merge=n=>dv(t,n),t.pick=n=>lv(t,n),t.omit=n=>cv(t,n),t.partial=(...n)=>hv(Xl,t,n[0]),t.required=(...n)=>pv(Ql,t,n[0])});function Q(t,e){const n={type:"object",get shape(){return co(this,"shape",{...t}),this.shape},...ct(e)};return new ya(n)}function Hx(t,e){return new ya({type:"object",get shape(){return co(this,"shape",{...t}),this.shape},catchall:Xn(),...ct(e)})}function Me(t,e){return new ya({type:"object",get shape(){return co(this,"shape",{...t}),this.shape},catchall:Kt(),...ct(e)})}const Zl=Z("ZodUnion",(t,e)=>{Dd.init(t,e),Mt.init(t,e),t.options=e.options});function Dt(t,e){return new Zl({type:"union",options:t,...ct(e)})}const Mh=Z("ZodDiscriminatedUnion",(t,e)=>{Zl.init(t,e),Xb.init(t,e)});function Wl(t,e,n){return new Mh({type:"union",options:e,discriminator:t,...ct(n)})}const Nh=Z("ZodIntersection",(t,e)=>{Qb.init(t,e),Mt.init(t,e)});function va(t,e){return new Nh({type:"intersection",left:t,right:e})}const Dh=Z("ZodTuple",(t,e)=>{sl.init(t,e),Mt.init(t,e),t.rest=n=>t.clone({...t._zod.def,rest:n})});function qx(t,e,n){const i=e instanceof St,r=i?n:e,o=i?e:null;return new Dh({type:"tuple",items:t,rest:o,...ct(r)})}const Kl=Z("ZodRecord",(t,e)=>{t0.init(t,e),Mt.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Et(t,e,n){return new Kl({type:"record",keyType:t,valueType:e,...ct(n)})}function Gx(t,e,n){return new Kl({type:"record",keyType:Dt([t,Xn()]),valueType:e,...ct(n)})}const Oh=Z("ZodMap",(t,e)=>{e0.init(t,e),Mt.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Vx(t,e,n){return new Oh({type:"map",keyType:t,valueType:e,...ct(n)})}const Ph=Z("ZodSet",(t,e)=>{r0.init(t,e),Mt.init(t,e),t.min=(...n)=>t.check(Hi(...n)),t.nonempty=n=>t.check(Hi(1,n)),t.max=(...n)=>t.check(ua(...n)),t.size=(...n)=>t.check(cl(...n))});function Zx(t,e){return new Ph({type:"set",valueType:t,...ct(e)})}const qi=Z("ZodEnum",(t,e)=>{n0.init(t,e),Mt.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(i,r)=>{const o={};for(const a of i)if(n.has(a))o[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new qi({...e,checks:[],...ct(r),entries:o})},t.exclude=(i,r)=>{const o={...e.entries};for(const a of i)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new qi({...e,checks:[],...ct(r),entries:o})}});function Fe(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new qi({type:"enum",entries:n,...ct(e)})}function Wx(t,e){return new qi({type:"enum",entries:t,...ct(e)})}const Eh=Z("ZodLiteral",(t,e)=>{i0.init(t,e),Mt.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function G(t,e){return new Eh({type:"literal",values:Array.isArray(t)?t:[t],...ct(e)})}const Fh=Z("ZodFile",(t,e)=>{o0.init(t,e),Mt.init(t,e),t.min=(n,i)=>t.check(Hi(n,i)),t.max=(n,i)=>t.check(ua(n,i)),t.mime=(n,i)=>t.check(gl(Array.isArray(n)?n:[n],i))});function Kx(t){return K0(Fh,t)}const Yl=Z("ZodTransform",(t,e)=>{Od.init(t,e),Mt.init(t,e),t._zod.parse=(n,i)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(ji(o,n.value,e));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),n.issues.push(ji(a))}};const r=e.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function Jl(t){return new Yl({type:"transform",transform:t})}const Xl=Z("ZodOptional",(t,e)=>{a0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qt(t){return new Xl({type:"optional",innerType:t})}const Rh=Z("ZodNullable",(t,e)=>{s0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function qo(t){return new Rh({type:"nullable",innerType:t})}function Yx(t){return Qt(qo(t))}const jh=Z("ZodDefault",(t,e)=>{l0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Uh(t,e){return new jh({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Bh=Z("ZodPrefault",(t,e)=>{c0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Hh(t,e){return new Bh({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Ql=Z("ZodNonOptional",(t,e)=>{u0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function qh(t,e){return new Ql({type:"nonoptional",innerType:t,...ct(e)})}const Gh=Z("ZodSuccess",(t,e)=>{d0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Jx(t){return new Gh({type:"success",innerType:t})}const Vh=Z("ZodCatch",(t,e)=>{h0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Zh(t,e){return new Vh({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Wh=Z("ZodNaN",(t,e)=>{p0.init(t,e),Mt.init(t,e)});function Xx(t){return Z0(Wh,t)}const tc=Z("ZodPipe",(t,e)=>{Pd.init(t,e),Mt.init(t,e),t.in=e.in,t.out=e.out});function Go(t,e){return new tc({type:"pipe",in:t,out:e})}const Kh=Z("ZodReadonly",(t,e)=>{f0.init(t,e),Mt.init(t,e)});function Yh(t){return new Kh({type:"readonly",innerType:t})}const Jh=Z("ZodTemplateLiteral",(t,e)=>{m0.init(t,e),Mt.init(t,e)});function Qx(t,e){return new Jh({type:"template_literal",parts:t,...ct(e)})}const Xh=Z("ZodLazy",(t,e)=>{y0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.getter()});function Qh(t){return new Xh({type:"lazy",getter:t})}const tp=Z("ZodPromise",(t,e)=>{g0.init(t,e),Mt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function t_(t){return new tp({type:"promise",innerType:t})}const ba=Z("ZodCustom",(t,e)=>{v0.init(t,e),Mt.init(t,e)});function ep(t){const e=new le({check:"custom"});return e._zod.check=t,e}function rp(t,e){return Y0(ba,t??(()=>!0),e)}function np(t,e={}){return J0(ba,t,e)}function ip(t){const e=ep(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(ji(i,n.value,e._zod.def));else{const r=i;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),r.continue??(r.continue=!e._zod.def.abort),n.issues.push(ji(r))}},t(n.value,n)));return e}function e_(t,e={error:`Input not instance of ${t.name}`}){const n=new ba({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...ct(e)});return n._zod.bag.Class=t,n}const r_=(...t)=>X0({Pipe:tc,Boolean:ma,String:pa,Transform:Yl},...t);function n_(t){const e=Qh(()=>Dt([q(t),Tt(),Wt(),ql(),_t(e),Et(q(),e)]));return e}function ec(t,e){return Go(Jl(t),e)}const i_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function o_(t){$e({customError:t})}function a_(){return $e().customError}function Lz(t){return _0(pa,t)}function Cz(t){return z0(fa,t)}function Iz(t){return D0(ma,t)}function Mz(t){return P0(ga,t)}function Nz(t){return V0(Vl,t)}const s_=Object.freeze(Object.defineProperty({__proto__:null,bigint:Mz,boolean:Iz,date:Nz,number:Cz,string:Lz},Symbol.toStringTag,{value:"Module"}));$e(b0());const rm=Object.freeze(Object.defineProperty({__proto__:null,$brand:fd,$input:Rd,$output:Fd,NEVER:pd,TimePrecision:lh,ZodAny:zh,ZodArray:Ih,ZodBase64:Rl,ZodBase64URL:jl,ZodBigInt:ga,ZodBigIntFormat:Hl,ZodBoolean:ma,ZodCIDRv4:El,ZodCIDRv6:Fl,ZodCUID:Cl,ZodCUID2:Il,ZodCatch:Vh,ZodCustom:ba,ZodCustomStringFormat:wh,ZodDate:Vl,ZodDefault:jh,ZodDiscriminatedUnion:Mh,ZodE164:Ul,ZodEmail:Al,ZodEmoji:Tl,ZodEnum:qi,ZodError:lx,ZodFile:Fh,ZodGUID:Bo,ZodIPv4:Ol,ZodIPv6:Pl,ZodISODate:$l,ZodISODateTime:_l,ZodISODuration:kl,ZodISOTime:wl,ZodIntersection:Nh,ZodIssueCode:i_,ZodJWT:Bl,ZodKSUID:Dl,ZodLazy:Xh,ZodLiteral:Eh,ZodMap:Oh,ZodNaN:Wh,ZodNanoID:Ll,ZodNever:Lh,ZodNonOptional:Ql,ZodNull:Ah,ZodNullable:Rh,ZodNumber:fa,ZodNumberFormat:li,ZodObject:ya,ZodOptional:Xl,ZodPipe:tc,ZodPrefault:Bh,ZodPromise:tp,ZodReadonly:Kh,ZodRealError:uo,ZodRecord:Kl,ZodSet:Ph,ZodString:pa,ZodStringFormat:ee,ZodSuccess:Gh,ZodSymbol:kh,ZodTemplateLiteral:Jh,ZodTransform:Yl,ZodTuple:Dh,ZodType:Mt,ZodULID:Ml,ZodURL:zl,ZodUUID:jr,ZodUndefined:Sh,ZodUnion:Zl,ZodUnknown:Th,ZodVoid:Ch,ZodXID:Nl,_ZodString:Sl,_default:Uh,any:Gl,array:_t,base64:zx,base64url:Tx,bigint:Px,boolean:Wt,catch:Zh,check:ep,cidrv4:Sx,cidrv6:Ax,clone:Mr,coerce:s_,config:$e,core:ex,cuid:vx,cuid2:bx,custom:rp,date:Ux,discriminatedUnion:Wl,e164:Lx,email:cx,emoji:gx,endsWith:ml,enum:Fe,file:Kx,flattenError:ol,float32:Mx,float64:Nx,formatError:al,function:mh,getErrorMap:a_,globalRegistry:vn,gt:wn,gte:Ue,guid:ux,includes:pl,instanceof:e_,int:xs,int32:Dx,int64:Ex,intersection:va,ipv4:wx,ipv6:kx,iso:ax,json:n_,jwt:Cx,keyof:Bx,ksuid:$x,lazy:Qh,length:ha,literal:G,locales:Ed,looseObject:Me,lowercase:dl,lt:$n,lte:sr,map:Vx,maxLength:da,maxSize:ua,mime:gl,minLength:Jn,minSize:Hi,multipleOf:Bi,nan:Xx,nanoid:yx,nativeEnum:Wx,negative:uh,never:Xn,nonnegative:hh,nonoptional:qh,nonpositive:dh,normalize:yl,null:ql,nullable:qo,nullish:Yx,number:Tt,object:Q,optional:Qt,overwrite:Sn,parse:bh,parseAsync:xh,partialRecord:Gx,pipe:Go,positive:ch,prefault:Hh,preprocess:ec,prettifyError:bd,promise:t_,property:ph,readonly:Yh,record:Et,refine:np,regex:ul,regexes:Ad,registry:ll,safeParse:_h,safeParseAsync:$h,set:Zx,setErrorMap:o_,size:cl,startsWith:fl,strictObject:Hx,string:q,stringFormat:Ix,stringbool:r_,success:Jx,superRefine:ip,symbol:Rx,templateLiteral:Qx,toJSONSchema:gh,toLowerCase:bl,toUpperCase:xl,transform:Jl,treeifyError:vd,trim:vl,tuple:qx,uint32:Ox,uint64:Fx,ulid:xx,undefined:Ho,union:Dt,unknown:Kt,uppercase:hl,url:mx,uuid:dx,uuidv4:hx,uuidv6:px,uuidv7:fx,void:jx,xid:_x},Symbol.toStringTag,{value:"Module"})),Dz=Object.freeze(Object.defineProperty({__proto__:null,$brand:fd,$input:Rd,$output:Fd,NEVER:pd,TimePrecision:lh,ZodAny:zh,ZodArray:Ih,ZodBase64:Rl,ZodBase64URL:jl,ZodBigInt:ga,ZodBigIntFormat:Hl,ZodBoolean:ma,ZodCIDRv4:El,ZodCIDRv6:Fl,ZodCUID:Cl,ZodCUID2:Il,ZodCatch:Vh,ZodCustom:ba,ZodCustomStringFormat:wh,ZodDate:Vl,ZodDefault:jh,ZodDiscriminatedUnion:Mh,ZodE164:Ul,ZodEmail:Al,ZodEmoji:Tl,ZodEnum:qi,ZodError:lx,ZodFile:Fh,ZodGUID:Bo,ZodIPv4:Ol,ZodIPv6:Pl,ZodISODate:$l,ZodISODateTime:_l,ZodISODuration:kl,ZodISOTime:wl,ZodIntersection:Nh,ZodIssueCode:i_,ZodJWT:Bl,ZodKSUID:Dl,ZodLazy:Xh,ZodLiteral:Eh,ZodMap:Oh,ZodNaN:Wh,ZodNanoID:Ll,ZodNever:Lh,ZodNonOptional:Ql,ZodNull:Ah,ZodNullable:Rh,ZodNumber:fa,ZodNumberFormat:li,ZodObject:ya,ZodOptional:Xl,ZodPipe:tc,ZodPrefault:Bh,ZodPromise:tp,ZodReadonly:Kh,ZodRealError:uo,ZodRecord:Kl,ZodSet:Ph,ZodString:pa,ZodStringFormat:ee,ZodSuccess:Gh,ZodSymbol:kh,ZodTemplateLiteral:Jh,ZodTransform:Yl,ZodTuple:Dh,ZodType:Mt,ZodULID:Ml,ZodURL:zl,ZodUUID:jr,ZodUndefined:Sh,ZodUnion:Zl,ZodUnknown:Th,ZodVoid:Ch,ZodXID:Nl,_ZodString:Sl,_default:Uh,any:Gl,array:_t,base64:zx,base64url:Tx,bigint:Px,boolean:Wt,catch:Zh,check:ep,cidrv4:Sx,cidrv6:Ax,clone:Mr,coerce:s_,config:$e,core:ex,cuid:vx,cuid2:bx,custom:rp,date:Ux,default:rm,discriminatedUnion:Wl,e164:Lx,email:cx,emoji:gx,endsWith:ml,enum:Fe,file:Kx,flattenError:ol,float32:Mx,float64:Nx,formatError:al,function:mh,getErrorMap:a_,globalRegistry:vn,gt:wn,gte:Ue,guid:ux,includes:pl,instanceof:e_,int:xs,int32:Dx,int64:Ex,intersection:va,ipv4:wx,ipv6:kx,iso:ax,json:n_,jwt:Cx,keyof:Bx,ksuid:$x,lazy:Qh,length:ha,literal:G,locales:Ed,looseObject:Me,lowercase:dl,lt:$n,lte:sr,map:Vx,maxLength:da,maxSize:ua,mime:gl,minLength:Jn,minSize:Hi,multipleOf:Bi,nan:Xx,nanoid:yx,nativeEnum:Wx,negative:uh,never:Xn,nonnegative:hh,nonoptional:qh,nonpositive:dh,normalize:yl,null:ql,nullable:qo,nullish:Yx,number:Tt,object:Q,optional:Qt,overwrite:Sn,parse:bh,parseAsync:xh,partialRecord:Gx,pipe:Go,positive:ch,prefault:Hh,preprocess:ec,prettifyError:bd,promise:t_,property:ph,readonly:Yh,record:Et,refine:np,regex:ul,regexes:Ad,registry:ll,safeParse:_h,safeParseAsync:$h,set:Zx,setErrorMap:o_,size:cl,startsWith:fl,strictObject:Hx,string:q,stringFormat:Ix,stringbool:r_,success:Jx,superRefine:ip,symbol:Rx,templateLiteral:Qx,toJSONSchema:gh,toLowerCase:bl,toUpperCase:xl,transform:Jl,treeifyError:vd,trim:vl,tuple:qx,uint32:Ox,uint64:Fx,ulid:xx,undefined:Ho,union:Dt,unknown:Kt,uppercase:hl,url:mx,uuid:dx,uuidv4:hx,uuidv6:px,uuidv7:fx,void:jx,xid:_x,z:rm},Symbol.toStringTag,{value:"Module"})),Fn="io.modelcontextprotocol/related-task",rc="2.0",fe=rp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),l_=Dt([q(),Tt().int()]),c_=q();Me({ttl:Tt().optional(),pollInterval:Tt().optional()});const Oz=Q({ttl:Tt().optional()}),Pz=Q({taskId:q()}),op=Me({progressToken:l_.optional(),[Fn]:Pz.optional()}),Qe=Q({_meta:op.optional()}),xa=Qe.extend({task:Oz.optional()}),Ez=t=>xa.safeParse(t).success,Ae=Q({method:q(),params:Qe.loose().optional()}),yr=Q({_meta:op.optional()}),vr=Q({method:q(),params:yr.loose().optional()}),ze=Me({_meta:op.optional()}),_a=Dt([q(),Tt().int()]),u_=Q({jsonrpc:G(rc),id:_a,...Ae.shape}).strict(),nm=t=>u_.safeParse(t).success,d_=Q({jsonrpc:G(rc),...vr.shape}).strict(),Fz=t=>d_.safeParse(t).success,ap=Q({jsonrpc:G(rc),id:_a,result:ze}).strict(),qa=t=>ap.safeParse(t).success;var Zt;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Zt||(Zt={}));const sp=Q({jsonrpc:G(rc),id:_a.optional(),error:Q({code:Tt().int(),message:q(),data:Kt().optional()})}).strict(),Rz=t=>sp.safeParse(t).success,jz=Dt([u_,d_,ap,sp]);Dt([ap,sp]);const lp=ze.strict(),Uz=yr.extend({requestId:_a.optional(),reason:q().optional()}),cp=vr.extend({method:G("notifications/cancelled"),params:Uz}),Bz=Q({src:q(),mimeType:q().optional(),sizes:_t(q()).optional(),theme:Fe(["light","dark"]).optional()}),$a=Q({icons:_t(Bz).optional()}),Gi=Q({name:q(),title:q().optional()}),nc=Gi.extend({...Gi.shape,...$a.shape,version:q(),websiteUrl:q().optional(),description:q().optional()}),Hz=va(Q({applyDefaults:Wt().optional()}),Et(q(),Kt())),qz=ec(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,va(Q({form:Hz.optional(),url:fe.optional()}),Et(q(),Kt()).optional())),Gz=Me({list:fe.optional(),cancel:fe.optional(),requests:Me({sampling:Me({createMessage:fe.optional()}).optional(),elicitation:Me({create:fe.optional()}).optional()}).optional()}),Vz=Me({list:fe.optional(),cancel:fe.optional(),requests:Me({tools:Me({call:fe.optional()}).optional()}).optional()}),Zz=Q({experimental:Et(q(),fe).optional(),sampling:Q({context:fe.optional(),tools:fe.optional()}).optional(),elicitation:qz.optional(),roots:Q({listChanged:Wt().optional()}).optional(),tasks:Gz.optional(),extensions:Et(q(),fe).optional()}),Wz=Qe.extend({protocolVersion:q(),capabilities:Zz,clientInfo:nc}),Kz=Ae.extend({method:G("initialize"),params:Wz}),Yz=Q({experimental:Et(q(),fe).optional(),logging:fe.optional(),completions:fe.optional(),prompts:Q({listChanged:Wt().optional()}).optional(),resources:Q({subscribe:Wt().optional(),listChanged:Wt().optional()}).optional(),tools:Q({listChanged:Wt().optional()}).optional(),tasks:Vz.optional(),extensions:Et(q(),fe).optional()}),Jz=ze.extend({protocolVersion:q(),capabilities:Yz,serverInfo:nc,instructions:q().optional()}),Xz=vr.extend({method:G("notifications/initialized"),params:yr.optional()}),ic=Ae.extend({method:G("ping"),params:Qe.optional()}),Qz=Q({progress:Tt(),total:Qt(Tt()),message:Qt(q())}),tT=Q({...yr.shape,...Qz.shape,progressToken:l_}),up=vr.extend({method:G("notifications/progress"),params:tT}),eT=Qe.extend({cursor:c_.optional()}),wa=Ae.extend({params:eT.optional()}),ka=ze.extend({nextCursor:c_.optional()}),rT=Fe(["working","input_required","completed","failed","cancelled"]),Sa=Q({taskId:q(),status:rT,ttl:Dt([Tt(),ql()]),createdAt:q(),lastUpdatedAt:q(),pollInterval:Qt(Tt()),statusMessage:Qt(q())}),dp=ze.extend({task:Sa}),nT=yr.merge(Sa),_s=vr.extend({method:G("notifications/tasks/status"),params:nT}),hp=Ae.extend({method:G("tasks/get"),params:Qe.extend({taskId:q()})}),pp=ze.merge(Sa),fp=Ae.extend({method:G("tasks/result"),params:Qe.extend({taskId:q()})});ze.loose();const mp=wa.extend({method:G("tasks/list")}),gp=ka.extend({tasks:_t(Sa)}),yp=Ae.extend({method:G("tasks/cancel"),params:Qe.extend({taskId:q()})}),iT=ze.merge(Sa),h_=Q({uri:q(),mimeType:Qt(q()),_meta:Et(q(),Kt()).optional()}),p_=h_.extend({text:q()}),vp=q().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),f_=h_.extend({blob:vp}),Aa=Fe(["user","assistant"]),ho=Q({audience:_t(Aa).optional(),priority:Tt().min(0).max(1).optional(),lastModified:vh({offset:!0}).optional()}),m_=Q({...Gi.shape,...$a.shape,uri:q(),description:Qt(q()),mimeType:Qt(q()),size:Qt(Tt()),annotations:ho.optional(),_meta:Qt(Me({}))}),oT=Q({...Gi.shape,...$a.shape,uriTemplate:q(),description:Qt(q()),mimeType:Qt(q()),annotations:ho.optional(),_meta:Qt(Me({}))}),aT=wa.extend({method:G("resources/list")}),g_=ka.extend({resources:_t(m_)}),sT=wa.extend({method:G("resources/templates/list")}),lT=ka.extend({resourceTemplates:_t(oT)}),bp=Qe.extend({uri:q()}),cT=bp,uT=Ae.extend({method:G("resources/read"),params:cT}),y_=ze.extend({contents:_t(Dt([p_,f_]))}),dT=vr.extend({method:G("notifications/resources/list_changed"),params:yr.optional()}),hT=bp,pT=Ae.extend({method:G("resources/subscribe"),params:hT}),fT=bp,mT=Ae.extend({method:G("resources/unsubscribe"),params:fT}),gT=yr.extend({uri:q()}),yT=vr.extend({method:G("notifications/resources/updated"),params:gT}),vT=Q({name:q(),description:Qt(q()),required:Qt(Wt())}),bT=Q({...Gi.shape,...$a.shape,description:Qt(q()),arguments:Qt(_t(vT)),_meta:Qt(Me({}))}),xT=wa.extend({method:G("prompts/list")}),_T=ka.extend({prompts:_t(bT)}),$T=Qe.extend({name:q(),arguments:Et(q(),q()).optional()}),wT=Ae.extend({method:G("prompts/get"),params:$T}),xp=Q({type:G("text"),text:q(),annotations:ho.optional(),_meta:Et(q(),Kt()).optional()}),_p=Q({type:G("image"),data:vp,mimeType:q(),annotations:ho.optional(),_meta:Et(q(),Kt()).optional()}),$p=Q({type:G("audio"),data:vp,mimeType:q(),annotations:ho.optional(),_meta:Et(q(),Kt()).optional()}),kT=Q({type:G("tool_use"),name:q(),id:q(),input:Et(q(),Kt()),_meta:Et(q(),Kt()).optional()}),v_=Q({type:G("resource"),resource:Dt([p_,f_]),annotations:ho.optional(),_meta:Et(q(),Kt()).optional()}),b_=m_.extend({type:G("resource_link")}),za=Dt([xp,_p,$p,b_,v_]),ST=Q({role:Aa,content:za}),AT=ze.extend({description:q().optional(),messages:_t(ST)}),zT=vr.extend({method:G("notifications/prompts/list_changed"),params:yr.optional()}),TT=Q({title:q().optional(),readOnlyHint:Wt().optional(),destructiveHint:Wt().optional(),idempotentHint:Wt().optional(),openWorldHint:Wt().optional()}),LT=Q({taskSupport:Fe(["required","optional","forbidden"]).optional()}),wp=Q({...Gi.shape,...$a.shape,description:q().optional(),inputSchema:Q({type:G("object"),properties:Et(q(),fe).optional(),required:_t(q()).optional()}).catchall(Kt()),outputSchema:Q({type:G("object"),properties:Et(q(),fe).optional(),required:_t(q()).optional()}).catchall(Kt()).optional(),annotations:TT.optional(),execution:LT.optional(),_meta:Et(q(),Kt()).optional()}),x_=wa.extend({method:G("tools/list")}),CT=ka.extend({tools:_t(wp)}),oc=ze.extend({content:_t(za).default([]),structuredContent:Et(q(),Kt()).optional(),isError:Wt().optional()});oc.or(ze.extend({toolResult:Kt()}));const IT=xa.extend({name:q(),arguments:Et(q(),Kt()).optional()}),__=Ae.extend({method:G("tools/call"),params:IT}),MT=vr.extend({method:G("notifications/tools/list_changed"),params:yr.optional()});Q({autoRefresh:Wt().default(!0),debounceMs:Tt().int().nonnegative().default(300)});const $_=Fe(["debug","info","notice","warning","error","critical","alert","emergency"]),NT=Qe.extend({level:$_}),DT=Ae.extend({method:G("logging/setLevel"),params:NT}),OT=yr.extend({level:$_,logger:q().optional(),data:Kt()}),PT=vr.extend({method:G("notifications/message"),params:OT}),ET=Q({name:q().optional()}),FT=Q({hints:_t(ET).optional(),costPriority:Tt().min(0).max(1).optional(),speedPriority:Tt().min(0).max(1).optional(),intelligencePriority:Tt().min(0).max(1).optional()}),RT=Q({mode:Fe(["auto","required","none"]).optional()}),jT=Q({type:G("tool_result"),toolUseId:q().describe("The unique identifier for the corresponding tool call."),content:_t(za).default([]),structuredContent:Q({}).loose().optional(),isError:Wt().optional(),_meta:Et(q(),Kt()).optional()}),UT=Wl("type",[xp,_p,$p]),$s=Wl("type",[xp,_p,$p,kT,jT]),BT=Q({role:Aa,content:Dt([$s,_t($s)]),_meta:Et(q(),Kt()).optional()}),HT=xa.extend({messages:_t(BT),modelPreferences:FT.optional(),systemPrompt:q().optional(),includeContext:Fe(["none","thisServer","allServers"]).optional(),temperature:Tt().optional(),maxTokens:Tt().int(),stopSequences:_t(q()).optional(),metadata:fe.optional(),tools:_t(wp).optional(),toolChoice:RT.optional()}),qT=Ae.extend({method:G("sampling/createMessage"),params:HT}),w_=ze.extend({model:q(),stopReason:Qt(Fe(["endTurn","stopSequence","maxTokens"]).or(q())),role:Aa,content:UT}),k_=ze.extend({model:q(),stopReason:Qt(Fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(q())),role:Aa,content:Dt([$s,_t($s)])}),GT=Q({type:G("boolean"),title:q().optional(),description:q().optional(),default:Wt().optional()}),VT=Q({type:G("string"),title:q().optional(),description:q().optional(),minLength:Tt().optional(),maxLength:Tt().optional(),format:Fe(["email","uri","date","date-time"]).optional(),default:q().optional()}),ZT=Q({type:Fe(["number","integer"]),title:q().optional(),description:q().optional(),minimum:Tt().optional(),maximum:Tt().optional(),default:Tt().optional()}),WT=Q({type:G("string"),title:q().optional(),description:q().optional(),enum:_t(q()),default:q().optional()}),KT=Q({type:G("string"),title:q().optional(),description:q().optional(),oneOf:_t(Q({const:q(),title:q()})),default:q().optional()}),YT=Q({type:G("string"),title:q().optional(),description:q().optional(),enum:_t(q()),enumNames:_t(q()).optional(),default:q().optional()}),JT=Dt([WT,KT]),XT=Q({type:G("array"),title:q().optional(),description:q().optional(),minItems:Tt().optional(),maxItems:Tt().optional(),items:Q({type:G("string"),enum:_t(q())}),default:_t(q()).optional()}),QT=Q({type:G("array"),title:q().optional(),description:q().optional(),minItems:Tt().optional(),maxItems:Tt().optional(),items:Q({anyOf:_t(Q({const:q(),title:q()}))}),default:_t(q()).optional()}),tL=Dt([XT,QT]),eL=Dt([YT,JT,tL]),rL=Dt([eL,GT,VT,ZT]),nL=xa.extend({mode:G("form").optional(),message:q(),requestedSchema:Q({type:G("object"),properties:Et(q(),rL),required:_t(q()).optional()})}),iL=xa.extend({mode:G("url"),message:q(),elicitationId:q(),url:q().url()}),oL=Dt([nL,iL]),aL=Ae.extend({method:G("elicitation/create"),params:oL}),sL=yr.extend({elicitationId:q()}),lL=vr.extend({method:G("notifications/elicitation/complete"),params:sL}),cL=ze.extend({action:Fe(["accept","decline","cancel"]),content:ec(t=>t===null?void 0:t,Et(q(),Dt([q(),Tt(),Wt(),_t(q())])).optional())}),uL=Q({type:G("ref/resource"),uri:q()}),dL=Q({type:G("ref/prompt"),name:q()}),hL=Qe.extend({ref:Dt([dL,uL]),argument:Q({name:q(),value:q()}),context:Q({arguments:Et(q(),q()).optional()}).optional()}),pL=Ae.extend({method:G("completion/complete"),params:hL}),fL=ze.extend({completion:Me({values:_t(q()).max(100),total:Qt(Tt().int()),hasMore:Qt(Wt())})}),mL=Q({uri:q().startsWith("file://"),name:q().optional(),_meta:Et(q(),Kt()).optional()}),gL=Ae.extend({method:G("roots/list"),params:Qe.optional()}),yL=ze.extend({roots:_t(mL)}),vL=vr.extend({method:G("notifications/roots/list_changed"),params:yr.optional()});Dt([ic,Kz,pL,DT,wT,xT,aT,sT,uT,pT,mT,__,x_,hp,fp,mp,yp]);Dt([cp,up,Xz,vL,_s]);Dt([lp,w_,k_,cL,yL,pp,gp,dp]);Dt([ic,qT,aL,gL,hp,fp,mp,yp]);Dt([cp,up,PT,yT,dT,MT,zT,_s,lL]);Dt([lp,Jz,fL,AT,_T,g_,lT,y_,oc,CT,pp,gp,dp]);class jt extends Error{constructor(e,n,i){super(`MCP error ${e}: ${n}`),this.code=e,this.data=i,this.name="McpError"}static fromError(e,n,i){if(e===Zt.UrlElicitationRequired&&i){const r=i;if(r.elicitations)return new bL(r.elicitations,n)}return new jt(e,n,i)}}class bL extends jt{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(Zt.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){var e;return((e=this.data)==null?void 0:e.elicitations)??[]}}function Nn(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function im(t){const e=zz(t),n=e==null?void 0:e.method;if(!n)throw new Error("Schema is missing a method literal");const i=Tz(n);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function om(t,e){const n=rx(t,e);if(!n.success)throw n.error;return n.data}const xL=6e4;class _L{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(cp,n=>{this._oncancel(n)}),this.setNotificationHandler(up,n=>{this._onprogress(n)}),this.setRequestHandler(ic,n=>({})),this._taskStore=e==null?void 0:e.taskStore,this._taskMessageQueue=e==null?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(hp,async(n,i)=>{const r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new jt(Zt.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(fp,async(n,i)=>{const r=async()=>{var s;const o=n.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(l.type==="response"||l.type==="error"){const c=l.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),l.type==="response")d(c);else{const h=c,p=new jt(h.error.code,h.error.message,h.error.data);d(p)}else{const h=l.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${u}`))}continue}await((s=this._transport)==null?void 0:s.send(l.message,{relatedRequestId:i.requestId}))}}const a=await this._taskStore.getTask(o,i.sessionId);if(!a)throw new jt(Zt.InvalidParams,`Task not found: ${o}`);if(!Nn(a.status))return await this._waitForTaskUpdate(o,i.signal),await r();if(Nn(a.status)){const l=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...l,_meta:{...l._meta,[Fn]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(mp,async(n,i)=>{var r;try{const{tasks:o,nextCursor:a}=await this._taskStore.listTasks((r=n.params)==null?void 0:r.cursor,i.sessionId);return{tasks:o,nextCursor:a,_meta:{}}}catch(o){throw new jt(Zt.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(yp,async(n,i)=>{try{const r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new jt(Zt.InvalidParams,`Task not found: ${n.params.taskId}`);if(Nn(r.status))throw new jt(Zt.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(n.params.taskId);const o=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!o)throw new jt(Zt.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof jt?r:new jt(Zt.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;const n=this._requestHandlerAbortControllers.get(e.params.requestId);n==null||n.abort(e.params.reason)}_setupTimeout(e,n,i,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const n=this._timeoutInfo.get(e);if(!n)return!1;const i=Date.now()-n.startTime;if(n.maxTotalTimeout&&i>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),jt.fromError(Zt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:i});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){const n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var o,a,s;if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const n=(o=this.transport)==null?void 0:o.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const i=(a=this.transport)==null?void 0:a.onerror;this._transport.onerror=l=>{i==null||i(l),this._onerror(l)};const r=(s=this._transport)==null?void 0:s.onmessage;this._transport.onmessage=(l,c)=>{r==null||r(l,c),qa(l)||Rz(l)?this._onresponse(l):nm(l)?this._onrequest(l,c):Fz(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var i;const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const n=jt.fromError(Zt.ConnectionClosed,"Connection closed");this._transport=void 0,(i=this.onclose)==null||i.call(this);for(const r of e.values())r(n)}_onerror(e){var n;(n=this.onerror)==null||n.call(this,e)}_onnotification(e){const n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,n){var u,d,h,p;const i=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=(h=(d=(u=e.params)==null?void 0:u._meta)==null?void 0:d[Fn])==null?void 0:h.taskId;if(i===void 0){const m={jsonrpc:"2.0",id:e.id,error:{code:Zt.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:m,timestamp:Date.now()},r==null?void 0:r.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):r==null||r.send(m).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}const a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);const s=Ez(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,r==null?void 0:r.sessionId):void 0,c={signal:a.signal,sessionId:r==null?void 0:r.sessionId,_meta:(p=e.params)==null?void 0:p._meta,sendNotification:async m=>{if(a.signal.aborted)return;const v={relatedRequestId:e.id};o&&(v.relatedTask={taskId:o}),await this.notification(m,v)},sendRequest:async(m,v,b)=>{var _;if(a.signal.aborted)throw new jt(Zt.ConnectionClosed,"Request was cancelled");const g={...b,relatedRequestId:e.id};o&&!g.relatedTask&&(g.relatedTask={taskId:o});const $=((_=g.relatedTask)==null?void 0:_.taskId)??o;return $&&l&&await l.updateTaskStatus($,"input_required"),await this.request(m,v,g)},authInfo:n==null?void 0:n.authInfo,requestId:e.id,requestInfo:n==null?void 0:n.requestInfo,taskId:o,taskStore:l,taskRequestedTtl:s==null?void 0:s.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>i(e,c)).then(async m=>{if(a.signal.aborted)return;const v={result:m,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:v,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(v))},async m=>{if(a.signal.aborted)return;const v={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(m.code)?m.code:Zt.InternalError,message:m.message??"Internal error",...m.data!==void 0&&{data:m.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:v,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(v))}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:n,...i}=e.params,r=Number(n),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(l);return}o(i)}_onresponse(e){const n=Number(e.id),i=this._requestResolvers.get(n);if(i){if(this._requestResolvers.delete(n),qa(e))i(e);else{const a=new jt(e.error.code,e.error.message,e.error.data);i(a)}return}const r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let o=!1;if(qa(e)&&e.result&&typeof e.result=="object"){const a=e.result;if(a.task&&typeof a.task=="object"){const s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,n))}}if(o||this._progressHandlers.delete(n),qa(e))r(e);else{const a=jt.fromError(e.error.code,e.error.message,e.error.data);r(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)==null?void 0:e.close())}async*requestStream(e,n,i){var a,s;const{task:r}=i??{};if(!r){try{yield{type:"result",result:await this.request(e,n,i)}}catch(l){yield{type:"error",error:l instanceof jt?l:new jt(Zt.InternalError,String(l))}}return}let o;try{const l=await this.request(e,dp,i);if(l.task)o=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new jt(Zt.InternalError,"Task creation did not return a task");for(;;){const c=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:c},Nn(c.status)){c.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)}:c.status==="failed"?yield{type:"error",error:new jt(Zt.InternalError,`Task ${o} failed`)}:c.status==="cancelled"&&(yield{type:"error",error:new jt(Zt.InternalError,`Task ${o} was cancelled`)});return}if(c.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)};return}const u=c.pollInterval??((a=this._options)==null?void 0:a.defaultTaskPollInterval)??1e3;await new Promise(d=>setTimeout(d,u)),(s=i==null?void 0:i.signal)==null||s.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof jt?l:new jt(Zt.InternalError,String(l))}}}request(e,n,i){const{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:l}=i??{};return new Promise((c,u)=>{var $,_,y,S,w;const d=L=>{u(L)};if(!this._transport){d(new Error("Not connected"));return}if((($=this._options)==null?void 0:$.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(L){d(L);return}(_=i==null?void 0:i.signal)==null||_.throwIfAborted();const h=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:h};i!=null&&i.onprogress&&(this._progressHandlers.set(h,i.onprogress),p.params={...e.params,_meta:{...((y=e.params)==null?void 0:y._meta)||{},progressToken:h}}),s&&(p.params={...p.params,task:s}),l&&(p.params={...p.params,_meta:{...((S=p.params)==null?void 0:S._meta)||{},[Fn]:l}});const m=L=>{var E;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(E=this._transport)==null||E.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(L)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(H=>this._onerror(new Error(`Failed to send cancellation: ${H}`)));const N=L instanceof jt?L:new jt(Zt.RequestTimeout,String(L));u(N)};this._responseHandlers.set(h,L=>{var N;if(!((N=i==null?void 0:i.signal)!=null&&N.aborted)){if(L instanceof Error)return u(L);try{const E=rx(n,L.result);E.success?c(E.data):u(E.error)}catch(E){u(E)}}}),(w=i==null?void 0:i.signal)==null||w.addEventListener("abort",()=>{var L;m((L=i==null?void 0:i.signal)==null?void 0:L.reason)});const v=(i==null?void 0:i.timeout)??xL,b=()=>m(jt.fromError(Zt.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(h,v,i==null?void 0:i.maxTotalTimeout,b,(i==null?void 0:i.resetTimeoutOnProgress)??!1);const g=l==null?void 0:l.taskId;if(g){const L=N=>{const E=this._responseHandlers.get(h);E?E(N):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,L),this._enqueueTaskMessage(g,{type:"request",message:p,timestamp:Date.now()}).catch(N=>{this._cleanupTimeout(h),u(N)})}else this._transport.send(p,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(L=>{this._cleanupTimeout(h),u(L)})})}async getTask(e,n){return this.request({method:"tasks/get",params:e},pp,n)}async getTaskResult(e,n,i){return this.request({method:"tasks/result",params:e},n,i)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},gp,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},iT,n)}async notification(e,n){var s,l,c,u;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const i=(s=n==null?void 0:n.relatedTask)==null?void 0:s.taskId;if(i){const d={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((l=e.params)==null?void 0:l._meta)||{},[Fn]:n.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:d,timestamp:Date.now()});return}if((((c=this._options)==null?void 0:c.debouncedNotificationMethods)??[]).includes(e.method)&&!e.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var h,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let d={...e,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(d={...d,params:{...d.params,_meta:{...((h=d.params)==null?void 0:h._meta)||{},[Fn]:n.relatedTask}}}),(p=this._transport)==null||p.send(d,n).catch(m=>this._onerror(m))});return}let a={...e,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(a={...a,params:{...a.params,_meta:{...((u=a.params)==null?void 0:u._meta)||{},[Fn]:n.relatedTask}}}),await this._transport.send(a,n)}setRequestHandler(e,n){const i=im(e);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(r,o)=>{const a=om(e,r);return Promise.resolve(n(a,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){const i=im(e);this._notificationHandlers.set(i,r=>{const o=om(e,r);return Promise.resolve(n(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,n,i){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=(o=this._options)==null?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,i,r)}async _clearTaskQueue(e,n){if(this._taskMessageQueue){const i=await this._taskMessageQueue.dequeueAll(e,n);for(const r of i)if(r.type==="request"&&nm(r.message)){const o=r.message.id,a=this._requestResolvers.get(o);a?(a(new jt(Zt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,n){var r,o;let i=((r=this._options)==null?void 0:r.defaultTaskPollInterval)??1e3;try{const a=await((o=this._taskStore)==null?void 0:o.getTask(e));a!=null&&a.pollInterval&&(i=a.pollInterval)}catch{}return new Promise((a,s)=>{if(n.aborted){s(new jt(Zt.InvalidRequest,"Request cancelled"));return}const l=setTimeout(a,i);n.addEventListener("abort",()=>{clearTimeout(l),s(new jt(Zt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,n){const i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await i.createTask(r,e.id,{method:e.method,params:e.params},n)},getTask:async r=>{const o=await i.getTask(r,n);if(!o)throw new jt(Zt.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,a)=>{await i.storeTaskResult(r,o,a,n);const s=await i.getTask(r,n);if(s){const l=_s.parse({method:"notifications/tasks/status",params:s});await this.notification(l),Nn(s.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>i.getTaskResult(r,n),updateTaskStatus:async(r,o,a)=>{const s=await i.getTask(r,n);if(!s)throw new jt(Zt.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Nn(s.status))throw new jt(Zt.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(r,o,a,n);const l=await i.getTask(r,n);if(l){const c=_s.parse({method:"notifications/tasks/status",params:l});await this.notification(c),Nn(l.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>i.listTasks(r,n)}}}function am(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function $L(t,e){const n={...t};for(const i in e){const r=i,o=e[r];if(o===void 0)continue;const a=n[r];am(a)&&am(o)?n[r]={...a,...o}:n[r]=o}return n}(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});let wL=class extends _L{constructor(){super(...arguments);Gt(this,"_registeredMethods",new Set);Gt(this,"_eventSlots",new Map);Gt(this,"setRequestHandler",(n,i)=>{this._assertMethodNotRegistered(n,"setRequestHandler"),super.setRequestHandler(n,i)});Gt(this,"setNotificationHandler",(n,i)=>{this._assertMethodNotRegistered(n,"setNotificationHandler"),super.setNotificationHandler(n,i)});Gt(this,"replaceRequestHandler",(n,i)=>{let r=n.shape.method.value;this._registeredMethods.add(r),super.setRequestHandler(n,i)})}onEventDispatch(n,i){}_ensureEventSlot(n){let i=this._eventSlots.get(n);if(!i){let r=this.eventSchemas[n];if(!r)throw Error(`Unknown event: ${String(n)}`);i={listeners:[]},this._eventSlots.set(n,i);let o=r.shape.method.value;this._registeredMethods.add(o);let a=i;super.setNotificationHandler(r,s=>{var c;let l=s.params;this.onEventDispatch(n,l),(c=a.onHandler)==null||c.call(a,l);for(let u of[...a.listeners])u(l)})}return i}setEventHandler(n,i){let r=this._ensureEventSlot(n);r.onHandler&&i&&console.warn(`[MCP Apps] on${String(n)} handler replaced. Use addEventListener("${String(n)}", …) to add multiple listeners without replacing.`),r.onHandler=i}getEventHandler(n){var i;return(i=this._eventSlots.get(n))==null?void 0:i.onHandler}addEventListener(n,i){this._ensureEventSlot(n).listeners.push(i)}removeEventListener(n,i){let r=this._eventSlots.get(n);if(!r)return;let o=r.listeners.indexOf(i);o!==-1&&r.listeners.splice(o,1)}warnIfRequestHandlerReplaced(n,i,r){i&&r&&console.warn(`[MCP Apps] ${n} handler replaced. Previous handler will no longer be called.`)}_assertMethodNotRegistered(n,i){let r=n.shape.method.value;if(this._registeredMethods.has(r))throw Error(`Handler for "${r}" already registered (via ${i}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(r)}};var kL="2026-01-26",SL="ui/notifications/tool-input-partial";class AL{constructor(e=window.parent,n){Gt(this,"eventTarget");Gt(this,"eventSource");Gt(this,"messageListener");Gt(this,"onclose");Gt(this,"onerror");Gt(this,"onmessage");Gt(this,"sessionId");Gt(this,"setProtocolVersion");this.eventTarget=e,this.eventSource=n,this.messageListener=i=>{var o,a,s;if(n&&i.source!==this.eventSource){console.debug("Ignoring message from unknown source",i);return}let r=jz.safeParse(i.data);r.success?(console.debug("Parsed message",r.data),(o=this.onmessage)==null||o.call(this,r.data)):((a=i.data)==null?void 0:a.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,i):(console.error("Failed to parse message",r.error.message,i),(s=this.onerror)==null||s.call(this,Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,n){e.method!==SL&&console.debug("Sending message",e),this.eventTarget.postMessage(e,"*")}async close(){var e;window.removeEventListener("message",this.messageListener),(e=this.onclose)==null||e.call(this)}}var zL=Dt([G("light"),G("dark")]).describe("Color theme preference for the host environment."),Vo=Dt([G("inline"),G("fullscreen"),G("pip")]).describe("Display mode for UI presentation."),TL=Dt([G("--color-background-primary"),G("--color-background-secondary"),G("--color-background-tertiary"),G("--color-background-inverse"),G("--color-background-ghost"),G("--color-background-info"),G("--color-background-danger"),G("--color-background-success"),G("--color-background-warning"),G("--color-background-disabled"),G("--color-text-primary"),G("--color-text-secondary"),G("--color-text-tertiary"),G("--color-text-inverse"),G("--color-text-ghost"),G("--color-text-info"),G("--color-text-danger"),G("--color-text-success"),G("--color-text-warning"),G("--color-text-disabled"),G("--color-border-primary"),G("--color-border-secondary"),G("--color-border-tertiary"),G("--color-border-inverse"),G("--color-border-ghost"),G("--color-border-info"),G("--color-border-danger"),G("--color-border-success"),G("--color-border-warning"),G("--color-border-disabled"),G("--color-ring-primary"),G("--color-ring-secondary"),G("--color-ring-inverse"),G("--color-ring-info"),G("--color-ring-danger"),G("--color-ring-success"),G("--color-ring-warning"),G("--font-sans"),G("--font-mono"),G("--font-weight-normal"),G("--font-weight-medium"),G("--font-weight-semibold"),G("--font-weight-bold"),G("--font-text-xs-size"),G("--font-text-sm-size"),G("--font-text-md-size"),G("--font-text-lg-size"),G("--font-heading-xs-size"),G("--font-heading-sm-size"),G("--font-heading-md-size"),G("--font-heading-lg-size"),G("--font-heading-xl-size"),G("--font-heading-2xl-size"),G("--font-heading-3xl-size"),G("--font-text-xs-line-height"),G("--font-text-sm-line-height"),G("--font-text-md-line-height"),G("--font-text-lg-line-height"),G("--font-heading-xs-line-height"),G("--font-heading-sm-line-height"),G("--font-heading-md-line-height"),G("--font-heading-lg-line-height"),G("--font-heading-xl-line-height"),G("--font-heading-2xl-line-height"),G("--font-heading-3xl-line-height"),G("--border-radius-xs"),G("--border-radius-sm"),G("--border-radius-md"),G("--border-radius-lg"),G("--border-radius-xl"),G("--border-radius-full"),G("--border-width-regular"),G("--shadow-hairline"),G("--shadow-sm"),G("--shadow-md"),G("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),LL=Et(TL.describe(`Style variables for theming MCP apps.
112
+
113
+ Individual style keys are optional - hosts may provide any subset of these values.
114
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
115
+
116
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
117
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Dt([q(),Ho()]).describe(`Style variables for theming MCP apps.
118
+
119
+ Individual style keys are optional - hosts may provide any subset of these values.
120
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
121
+
122
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
123
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
124
+
125
+ Individual style keys are optional - hosts may provide any subset of these values.
126
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
127
+
128
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
129
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);Q({method:G("ui/open-link"),params:Q({url:q().describe("URL to open in the host's browser")})});var CL=Q({isError:Wt().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),IL=Q({isError:Wt().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),ML=Q({isError:Wt().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();Q({method:G("ui/notifications/sandbox-proxy-ready"),params:Q({})});var kp=Q({connectDomains:_t(q()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
130
+
131
+ - Maps to CSP \`connect-src\` directive
132
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:_t(q()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:_t(q()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:_t(q()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Sp=Q({camera:Q({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:Q({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:Q({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:Q({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});Q({method:G("ui/notifications/size-changed"),params:Q({width:Tt().optional().describe("New width in pixels."),height:Tt().optional().describe("New height in pixels.")})});var NL=Q({method:G("ui/notifications/tool-input"),params:Q({arguments:Et(q(),Kt().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),DL=Q({method:G("ui/notifications/tool-input-partial"),params:Q({arguments:Et(q(),Kt().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),OL=Q({method:G("ui/notifications/tool-cancelled"),params:Q({reason:q().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),PL=Q({fonts:q().optional()}),EL=Q({variables:LL.optional().describe("CSS variables for theming the app."),css:PL.optional().describe("CSS blocks that apps can inject.")}),FL=Q({method:G("ui/resource-teardown"),params:Q({})});Et(q(),Kt());var sm=Q({text:Q({}).optional().describe("Host supports text content blocks."),image:Q({}).optional().describe("Host supports image content blocks."),audio:Q({}).optional().describe("Host supports audio content blocks."),resource:Q({}).optional().describe("Host supports resource content blocks."),resourceLink:Q({}).optional().describe("Host supports resource link content blocks."),structuredContent:Q({}).optional().describe("Host supports structured content.")});Q({method:G("ui/notifications/request-teardown"),params:Q({}).optional()});var RL=Q({experimental:Et(q(),Et(q(),Gl()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:Q({}).optional().describe("Host supports opening external URLs."),downloadFile:Q({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:Q({listChanged:Wt().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:Q({listChanged:Wt().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:Q({}).optional().describe("Host accepts log messages."),sandbox:Q({permissions:Sp.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:kp.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:sm.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:sm.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:Q({tools:Q({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),jL=Q({experimental:Et(q(),Et(q(),Gl()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:Q({listChanged:Wt().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:_t(Vo).optional().describe("Display modes the app supports.")});Q({method:G("ui/notifications/initialized"),params:Q({}).optional()});Q({csp:kp.optional().describe("Content Security Policy configuration for UI resources."),permissions:Sp.optional().describe("Sandbox permissions requested by the UI resource."),domain:q().optional().describe(`Dedicated origin for view sandbox.
133
+
134
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
135
+
136
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
137
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
138
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
139
+
140
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:Wt().optional().describe(`Visual boundary preference - true if view prefers a visible border.
141
+
142
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
143
+
144
+ - \`true\`: request visible border + background
145
+ - \`false\`: request no visible border + background
146
+ - omitted: host decides border`)});Q({method:G("ui/request-display-mode"),params:Q({mode:Vo.describe("The display mode being requested.")})});var UL=Q({mode:Vo.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),BL=Dt([G("model"),G("app")]).describe("Tool visibility scope - who can access the tool.");Q({resourceUri:q().optional(),visibility:_t(BL).optional().describe(`Who can access this tool. Default: ["model", "app"]
147
+ - "model": Tool visible to and callable by the agent
148
+ - "app": Tool callable by the app from this server only`),csp:Xn().optional(),permissions:Xn().optional()});Q({mimeTypes:_t(q()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});Q({method:G("ui/download-file"),params:Q({contents:_t(Dt([v_,b_])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});Q({method:G("ui/message"),params:Q({role:G("user").describe('Message role, currently only "user" is supported.'),content:_t(za).describe("Message content blocks (text, image, etc.).")})});Q({method:G("ui/notifications/sandbox-resource-ready"),params:Q({html:q().describe("HTML content to load into the inner iframe."),sandbox:q().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:kp.optional().describe("CSP configuration from resource metadata."),permissions:Sp.optional().describe("Sandbox permissions from resource metadata.")})});var HL=Q({method:G("ui/notifications/tool-result"),params:oc.describe("Standard MCP tool execution result.")}),S_=Q({toolInfo:Q({id:_a.optional().describe("JSON-RPC id of the tools/call request."),tool:wp.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:zL.optional().describe("Current color theme preference."),styles:EL.optional().describe("Style configuration for theming the app."),displayMode:Vo.optional().describe("How the UI is currently displayed."),availableDisplayModes:_t(Vo).optional().describe("Display modes the host supports."),containerDimensions:Dt([Q({height:Tt().describe("Fixed container height in pixels.")}),Q({maxHeight:Dt([Tt(),Ho()]).optional().describe("Maximum container height in pixels.")})]).and(Dt([Q({width:Tt().describe("Fixed container width in pixels.")}),Q({maxWidth:Dt([Tt(),Ho()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
149
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:q().optional().describe("User's language and region preference in BCP 47 format."),timeZone:q().optional().describe("User's timezone in IANA format."),userAgent:q().optional().describe("Host application identifier."),platform:Dt([G("web"),G("desktop"),G("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:Q({touch:Wt().optional().describe("Whether the device supports touch input."),hover:Wt().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:Q({top:Tt().describe("Top safe area inset in pixels."),right:Tt().describe("Right safe area inset in pixels."),bottom:Tt().describe("Bottom safe area inset in pixels."),left:Tt().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),qL=Q({method:G("ui/notifications/host-context-changed"),params:S_.describe("Partial context update containing only changed fields.")});Q({method:G("ui/update-model-context"),params:Q({content:_t(za).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Et(q(),Kt().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});Q({method:G("ui/initialize"),params:Q({appInfo:nc.describe("App identification (name and version)."),appCapabilities:jL.describe("Features and capabilities this app provides."),protocolVersion:q().describe("Protocol version this app supports.")})});var GL=Q({protocolVersion:q().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:nc.describe("Host application identification and version."),hostCapabilities:RL.describe("Features and capabilities provided by the host."),hostContext:S_.describe("Rich context about the host environment.")}).passthrough(),VL={target:"draft-2020-12"};async function lm(t,e){let n=t["~standard"];if(n.jsonSchema)return n.jsonSchema[e](VL);if(n.vendor==="zod"){let{z:i}=await Vt(()=>Promise.resolve().then(()=>Dz),void 0,import.meta.url);return i.toJSONSchema(t,{io:e})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function cm(t,e,n=""){let i=await t["~standard"].validate(e);if(i.issues){let r=i.issues.map(o=>{var s;let a=(s=o.path)==null?void 0:s.map(l=>typeof l=="object"?l.key:l).join(".");return a?`${a}: ${o.message}`:o.message}).join("; ");throw Error(n+r)}return i.value}function ZL(t){let e=document.documentElement;e.setAttribute("data-theme",t),e.style.colorScheme=t}function WL(t,e=document.documentElement){for(let[n,i]of Object.entries(t))i!==void 0&&e.style.setProperty(n,i)}function KL(t){if(document.getElementById("__mcp-host-fonts"))return;let e=document.createElement("style");e.id="__mcp-host-fonts",e.textContent=t,document.head.appendChild(e)}var qn;let YL=(qn=class extends wL{constructor(n,i={},r={autoResize:!0}){super(r);Gt(this,"_appInfo");Gt(this,"_capabilities");Gt(this,"options");Gt(this,"_hostCapabilities");Gt(this,"_hostInfo");Gt(this,"_hostContext");Gt(this,"_registeredTools",{});Gt(this,"_initializedSent",!1);Gt(this,"eventSchemas",{toolinput:NL,toolinputpartial:DL,toolresult:HL,toolcancelled:OL,hostcontextchanged:qL});Gt(this,"_everHadListener",new Set);Gt(this,"_toolHandlersInitialized",!1);Gt(this,"_onteardown");Gt(this,"_oncalltool");Gt(this,"_onlisttools");Gt(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=i,this.options=r,r.allowUnsafeEval||$e({jitless:!0}),this.setRequestHandler(ic,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}_assertInitialized(n){var r;if(this._initializedSent)return;let i=`[ext-apps] App.${n}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if((r=this.options)!=null&&r.strict)throw Error(i);console.warn(`${i}. This will throw in a future release.`)}_assertHandlerTiming(n){var r;if(!qn.ONE_SHOT_EVENTS.has(n)||this._everHadListener.has(n)||(this._everHadListener.add(n),!this._initializedSent))return;let i=`[ext-apps] "${String(n)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if((r=this.options)!=null&&r.strict)throw Error(i);console.warn(i)}setEventHandler(n,i){i&&this._assertHandlerTiming(n),super.setEventHandler(n,i)}addEventListener(n,i){this._assertHandlerTiming(n),super.addEventListener(n,i)}onEventDispatch(n,i){n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...i})}registerCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=$L(this._capabilities,n)}registerTool(n,i,r){if(this._registeredTools[n])throw Error(`Tool ${n} is already registered`);let o=this,a=()=>{var c;o._initializedSent&&((c=o._capabilities.tools)!=null&&c.listChanged)&&o.sendToolListChanged()},s=i.inputSchema!==void 0,l={title:i.title,description:i.description,inputSchema:i.inputSchema,outputSchema:i.outputSchema,annotations:i.annotations,_meta:i._meta,enabled:!0,enable(){this.enabled=!0,a()},disable(){this.enabled=!1,a()},update(c){Object.assign(this,c),a()},remove(){o._registeredTools[n]===l&&(delete o._registeredTools[n],a())},handler:async(c,u)=>{if(!l.enabled)throw Error(`Tool ${n} is disabled`);let d;if(s){let h=l.inputSchema,p=h?await cm(h,c??{},`Invalid input for tool ${n}: `):c??{};d=await r(p,u)}else d=await r(u);return l.outputSchema&&!d.isError&&(d.structuredContent=await cm(l.outputSchema,d.structuredContent,`Invalid output for tool ${n}: `)),d}};return this._registeredTools[n]=l,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),a(),l}ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(n,i)=>{let r=this._registeredTools[n.name];if(!r)throw Error(`Tool ${n.name} not found`);return r.handler(n.arguments,i)},this.onlisttools=async(n,i)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,o])=>o.enabled).map(async([r,o])=>{let a={name:r,title:o.title,description:o.description,inputSchema:o.inputSchema?await lm(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(a.outputSchema=await lm(o.outputSchema,"output")),o.annotations&&(a.annotations=o.annotations),o._meta&&(a._meta=o._meta),a}))}))}async sendToolListChanged(n={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:n})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler(FL,(i,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(i.params,r)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(__,(i,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(i.params,r)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler(x_,(i,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(i.params,r)})}assertCapabilityForMethod(n){var i;switch(n){case"sampling/createMessage":if(!((i=this._hostCapabilities)!=null&&i.sampling))throw Error(`Host does not support sampling (required for ${n})`);break}}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,i){if(this._assertInitialized("callServerTool"),typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},oc,{onprogress:()=>{},resetTimeoutOnProgress:!0,...i})}async readServerResource(n,i){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:n},y_,i)}async listServerResources(n,i){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:n},g_,i)}async createSamplingMessage(n,i){this._assertInitialized("createSamplingMessage");let r=n.tools?k_:w_;return await this.request({method:"sampling/createMessage",params:n},r,i)}sendMessage(n,i){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:n},ML,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:n},lp,i)}openLink(n,i){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:n},CL,i)}downloadFile(n,i){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:n},IL,i)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,i){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:n},UL,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,r=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,l=s.style.height;s.style.height="max-content";let c=Math.ceil(s.getBoundingClientRect().height);s.style.height=l;let u=Math.ceil(window.innerWidth);(u!==i||c!==r)&&(i=u,r=c,this.sendSizeChanged({width:u,height:c}))}))};o();let a=new ResizeObserver(o);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(n=new AL(window.parent,window.parent),i){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(n);try{let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:kL}},GL,i);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}},Gt(qn,"ONE_SHOT_EVENTS",new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"])),qn);const JL={"line-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>X6),void 0,import.meta.url)).registerLineChart}),"area-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>pU),void 0,import.meta.url)).registerAreaChart}),"area-grouped-bar-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>$U),void 0,import.meta.url)).registerAreaGroupedBarChart}),lollipop:async()=>({register:(await Vt(()=>Promise.resolve().then(()=>TU),void 0,import.meta.url)).registerLollipop}),"step-line-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>DU),void 0,import.meta.url)).registerStepLineChart}),"spark-line-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>FU),void 0,import.meta.url)).registerSparkLineChart}),"spark-area-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>UU),void 0,import.meta.url)).registerSparkAreaChart}),"scatter-sparkline-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>KU),void 0,import.meta.url)).registerScatterSparklineChart}),"chart-renderer":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>bE),void 0,import.meta.url)).registerChartRenderer}),"bar-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>cB),void 0,import.meta.url)).registerBarChart}),"donut-group-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>gB),void 0,import.meta.url)).registerDonutGroupChart}),"histogram-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>zB),void 0,import.meta.url)).registerHistogramChart}),"punchcard-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>EB),void 0,import.meta.url)).registerPunchcardChart}),"box-plot-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>XB),void 0,import.meta.url)).registerBoxPlotChart}),"violin-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>pH),void 0,import.meta.url)).registerViolinChart}),"waterfall-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>OH),void 0,import.meta.url)).registerWaterfallChart}),"sankey-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>XH),void 0,import.meta.url)).registerSankeyChart}),"parallel-coordinates-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>f9),void 0,import.meta.url)).registerParallelCoordinatesChart}),"pie-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>w9),void 0,import.meta.url)).registerPieChart}),"donut-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>A9),void 0,import.meta.url)).registerDonutChart}),"polar-area-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>H9),void 0,import.meta.url)).registerPolarAreaChart}),"scatter-plot-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>X9),void 0,import.meta.url)).registerScatterPlot}),"network-graph":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>H5),void 0,import.meta.url)).registerNetworkGraph}),"bias-variance-tradeoff-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>X5),void 0,import.meta.url)).registerBiasVarianceTradeoffChart}),"bubble-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>aG),void 0,import.meta.url)).registerBubbleChart}),"radar-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>mG),void 0,import.meta.url)).registerRadarChart}),"radial-bar-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>AG),void 0,import.meta.url)).registerRadialBarChart}),"kpi-widget":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>ZG),void 0,import.meta.url)).registerKpiWidget}),"gini-impurity-entropy-chart":async()=>({register:(await Vt(()=>Promise.resolve().then(()=>nV),void 0,import.meta.url)).registerGiniImpurityEntropyChart})},um=new Set;async function XL(t){if(um.has(t))return{register:()=>{}};const e=await JL[t]();return e.register(),um.add(t),e}const Dn={primary:"#473DD9",secondary:"#36C4A5",background:"transparent",grid:"#afb3bb",text:"#111827",textMuted:"#6c7584",fontFamily:"system-ui, -apple-system, sans-serif"},kn={compact:8,default:16,comfortable:24},f={gridStroke:"#afb3bb",gridDash:"1 2",axisLabelFill:"#6c7584",axisLabelSize:11,axisStroke:"#afb3bb",hoverGuideLight:"#6c7584",hoverGuideDark:"#ffffff",series:["#473DD9","#938CFF","#36C4A5","#ADF4E5","#BDBCC8","#56546D","#FF8C47","#FFCEB0","#FF4781","#FFB0C9","#47B0FF","#B0DDFF"],lineMargin:{top:10,right:1,bottom:21,left:40},lollipopMargin:{top:10,right:3,bottom:21,left:40},radarMargin:{top:25,right:5,bottom:25,left:5},radarScaleSteps:5,radarDomainPadFactor:1.1,radarMarkerSize:50,radarMarkerHoverSize:70,radarSpokeDash:"2,2",radarCapRadius:3,radarLabelOffset:12,radarGradientEdgeOpacity:.3,radarStrokeWidth:2,radarTickLabelFill:"#f1f4f7",punchcardMargin:{top:0,right:0,bottom:21,left:80},stepLineMargin:{top:10,right:1,bottom:21,left:40},sparkLineMargin:{top:10,right:1,bottom:21,left:40},sparkLineStrokeWidth:1.5,sparkDomainPadFactor:1.2,sparkGuideDash:"5,2",sparkHoverDotRadius:4,boxPlotMargin:{top:10,right:1,bottom:21,left:40},histogramMargin:{top:10,right:1,bottom:21,left:40},waterfallVerticalMargin:{top:10,right:0,bottom:21,left:40},waterfallHorizontalMargin:{top:10,right:1,bottom:21,left:40},waterfallBarThickness:16,waterfallBarRadius:2,waterfallArrow:5,waterfallDomainPadFactor:1.2,waterfallPositive:"#938CFF",waterfallNegative:"#FF8C47",waterfallTotal:"#BDBCC8",waterfallHoverDim:.2,violinVerticalMargin:{top:10,right:16,bottom:28,left:44},violinHorizontalMargin:{top:10,right:24,bottom:28,left:44},lineStrokeWidth:2,lineStrokeAlphaPct:80,areaGradientTopOpacity:.6,areaGradientBottomOpacity:.1,lollipopStemWidth:3,lollipopStemAlphaPct:50,markerRadius:4,stepStrokeWidth:1.5,stepDomainPadFactor:1.2,stepIdealColor:"#2ecc71",stepIdealWidth:3,stepGuessWidth:2,stepGuessDash:"5,5",stepDeviationFill:"#2c2d33",stepGuideDash:"5,2",stepHoverDotRadius:4,barMargin:{top:10,right:1,bottom:21,left:40},barCornerRadius:4,barFadeOpacity:.6,barBandFraction:.4,barMaxWidth:40,barMinHeight:6,barGroupMinWidth:4,barGroupMaxWidth:24,barGroupGap:1,barStackedBandFraction:.85,barRowThickness:24,barRowSpacing:16,barMinWidth:6,barDomainPadFactor:1.2,barHorizontalPadFactor:1.1,barStackedPadFraction:.1,barCumulativeColor:"#6d6df7",barCumulativeWidth:2,barCumulativeDotRadius:3,barHoverDotFill:"#CFD2D6",barHoverGuideWidth:2,donutMargin:{top:10,right:8,bottom:10,left:8},donutThickness:16,donutMinThickness:4,donutCellPadding:6,donutMinCellWidth:140,donutDefaultMax:100,donutArcOpacity:.8,donutArcOpacityDimmed:.2,pieMargin:{top:0,right:0,bottom:0,left:0},pieMinArcLengthPx:5,polarAreaMargin:{top:25,right:5,bottom:25,left:5},polarRadialSteps:5,polarGridStroke:"#939ba7",polarGridStepOpacity:.2,polarSpokeDash:"2,2",polarSpokeCapRadius:3,polarCategoryLabelFill:"#5f6877",polarCategoryLabelSize:12,polarCategoryLabelOffset:12,polarLabelCharWidth:.55,polarLabelGutterMin:40,polarLabelGutterMax:120,polarLabelGutterMaxFraction:.28,polarMinLabelRadius:40,polarSectorOpacity:.8,polarSectorOpacityDimmed:.2,polarTickPillRowHeight:21,polarTickPillPadX:7,polarTickPillPadY:3,polarTickPillRadius:4,polarTickPill:"#ffffff",polarTickPillDark:"#1a1b1f",radialBarMargin:{top:25,right:5,bottom:25,left:5},radialBarInnerRadiusRatio:.2,radialBarSweepDeg:270,radialBarTicks:5,radialBarMinArcWidth:4,radialBarMaxArcWidth:24,radialBarArcCornerRadius:1,radialBarArcOpacity:.8,radialBarArcOpacityDimmed:.2,radialBarGridStroke:"#939ba7",radialBarTickDash:"4,4",radialBarLabelFill:"#5f6877",radialBarTickLabelSize:12,radialBarRingLabelSize:11,radialBarTickLabelOffset:12,radialBarLabelCharWidth:8,scatterMargin:{top:10,right:5,bottom:21,left:40},areaGroupedBarMargin:{top:10,right:5,bottom:21,left:40},areaGroupedBarGradientTopOpacity:.35,areaGroupedBarGradientBottomOpacity:0,areaGroupedBarMarkerRadius:3,areaGroupedBarDimOpacity:.3,areaGroupedBarBarOpacity:.85,bubbleBaseMargin:{top:10,right:1,bottom:21,left:40},bubbleMaxRadius:30,bubbleNegativeFill:"#DADAE1",scatterMarkerSize:40,scatterReferenceLine:"#56546D",biasVarianceMargin:{top:24,right:24,bottom:36,left:48},biasVarianceSeries:["#6366f1","#22c55e","#f59e0b","#06b6d4","#ef4444"],biasVarianceGridStroke:"#d1d5db",biasVarianceGridDash:"2,4",biasVarianceAxisStroke:"#9ca3af",biasVarianceLabelFill:"#6b7280",biasVarianceLineWidth:2,biasVarianceLineOpacity:.95,biasVarianceLineOpacityDimmed:.2,biasVarianceDomainPadFactor:1.1,biasVarianceXTicks:8,biasVarianceYTicks:6,domainLimitColor:"#6C8CF5",domainLimitFillOpacity:.12,domainLimitDash:"4,4",domainLimitArrow:8,domainLimitLabelFill:"#141c2ce6",domainLimitLabelText:"#ffffff",domainLimitLabelSize:10,donutSliceStroke:"#ffffff",donutSliceStrokeDark:"#1a1b1f",donutSliceStrokeWidth:2,donutTrackFill:"#EAECF0",donutTrackFillDark:"#2C2D33",donutDivider:"#E4E6EA",donutDividerDark:"#2C2D33",donutValueSize:30,donutValueWeight:600,donutLabelSize:12,donutStatusColors:{positive:{background:"#E6F6EF",text:"#067647"},negative:{background:"#FEE4E2",text:"#B42318"},neutral:{background:"#F2F4F7",text:"#475467"}},donutStatusColorsDark:{positive:{background:"#0C2C21",text:"#4ED8A6"},negative:{background:"#3B1513",text:"#F5817A"},neutral:{background:"#2C2D33",text:"#C3C7CE"}},sankeyPadding:4.5,sankeyNodePadding:14,sankeyNodeWidth:70,sankeyNodeWidthSmall:65,sankeyNodeRule:"#D3DBE3",sankeyNodeRuleActive:"#939BA7",sankeyLinkAlphaPct:50,sankeyLinkInset:3,sankeyDimOpacity:.5,parallelMargin:{top:10,right:1,bottom:8,left:1},parallelVerticalMargin:{top:10,right:1,bottom:1,left:1},parallelAxisSpacing:72,parallelColorScaleHeight:44,parallelLegendOffsetRight:20,parallelLegendWidth:10,parallelLegendTickLabelWidth:44,parallelLegendRadius:6,parallelLineWidth:1,parallelLineWidthHovered:5,parallelLineOpacity:.4,parallelLineOpacityDimmed:.05,parallelAxisStroke:"#939ba7",parallelAxisLabelFill:"#5f6877",parallelTitleSize:11,parallelTitleSizeActive:13,giniMargin:{top:20,right:24,bottom:28,left:44},giniCurveAlpha:.5,giniOverlayColor:"#4c6ef5",giniOverlayBandOpacity:.08,giniOverlayDash:"5,5",giniSplitMarkerFill:"#12b886",giniSplitMarkerStroke:"#ffffff",giniSplitMarkerRadius:4,giniSplitLabelOffset:8,giniCurveDimOpacity:.2},ac=["#D6D3FF","#B5B0FF","#938CFF","#7369FF","#5448FF","#473DD9","#3C33B5"];function A_(t,e){let n=t.replace("#","");if(n.length===3&&(n=n.split("").map(u=>u+u).join("")),!/^[0-9A-Fa-f]{6}$/.test(n))return t;const i=Math.max(0,Math.min(1,e)),r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16),s=Math.round(r+(255-r)*i),l=Math.round(o+(255-o)*i),c=Math.round(a+(255-a)*i);return`#${s.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}`}function ws(t,e){let n=t.replace("#","").toUpperCase();if(n.length===3&&(n=n.split("").map(r=>r+r).join("")),!/^[0-9A-F]{6}$/.test(n))return t;const i=Math.round(Math.max(0,Math.min(100,e))/100*255).toString(16).padStart(2,"0").toUpperCase();return`#${n}${i}`}function Gr(t){if(!t.length)return[0,1];let e=1/0,n=-1/0;for(const i of t)Number.isFinite(i)&&(i<e&&(e=i),i>n&&(n=i));if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e<0&&n>0){const i=Math.max(Math.abs(e),Math.abs(n));return[-i,i]}return[Math.min(0,e),Math.max(0,n)]}function Pt(t,e=2){const n=Math.abs(t);return n>=1e9?`${(t/1e9).toFixed(1)}B`:n>=1e6?`${(t/1e6).toFixed(1)}M`:n>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)&&n<1e3?String(t):t.toFixed(e)}function tr(t,e){return f.series[t%f.series.length]}function QL(t,e,n="light"){const i=n==="dark"?"#000":"#fff";return t==="donut"||t==="disabled"?{fill:i,stroke:e}:{fill:e,stroke:i}}function Ap(t,e="ui9000-glow"){let n=t.select("defs");if(n.empty()&&(n=t.append("defs")),n.select(`#${e}`).empty()){const i=n.append("filter").attr("id",e).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%");i.append("feGaussianBlur").attr("stdDeviation",3).attr("result","coloredBlur");const r=i.append("feMerge");r.append("feMergeNode").attr("in","coloredBlur"),r.append("feMergeNode").attr("in","SourceGraphic")}return`url(#${e})`}function ge(t){return t<120?3:t<220?4:t<360?5:6}function zp(t,e){const{shape:n,color:i,cx:r,cy:o,r:a=f.markerRadius,themeMode:s="light",hovered:l=!1}=e;if(n==="disabled")return;const{fill:c,stroke:u}=QL(n,i,s),d=l?3:1;if(n==="square"){t.append("rect").attr("x",r-7/2).attr("y",o-7/2).attr("width",7).attr("height",7).attr("fill",c).attr("stroke",u).attr("stroke-width",d);return}if(n==="rhombus"){t.append("rect").attr("x",r-9/2).attr("y",o-9/2).attr("width",9).attr("height",9).attr("fill",c).attr("stroke",u).attr("stroke-width",d).attr("transform",`rotate(45, ${r}, ${o})`);return}if(n==="triangle"){t.append("polygon").attr("points",`${r},${o-4} ${r-4},${o+4} ${r+4},${o+4}`).attr("fill",c).attr("stroke",u).attr("stroke-width",d);return}t.append("circle").attr("cx",r).attr("cy",o).attr("r",a).attr("fill",c).attr("stroke",u).attr("stroke-width",d)}function dm(t,e){const{shape:n,color:i,cx:r,cy:o}=e;if(n!=="disabled"){if(n==="donut"){t.append("path").attr("d",`M ${r}, ${o-5} a 5,5 0 1,0 0,10 a 5,5 0 1,0 0,-10 M ${r}, ${o-2} a 2,2 0 1,1 0,4 a 2,2 0 1,1 0,-4`).attr("fill",i).attr("stroke","#fff").attr("stroke-width",1),t.append("circle").attr("cx",r).attr("cy",o).attr("r",2).attr("fill","#fff");return}if(n==="circle"){t.append("path").attr("d",`M ${r}, ${o-5} a 5,5 0 1,0 0,10 a 5,5 0 1,0 0,-10`).attr("fill",i).attr("stroke","#fff").attr("stroke-width",1);return}if(n==="square"){t.append("path").attr("d",`M${r-5}, ${o+5} L${r+5}, ${o+5} L${r+5}, ${o-5} L${r-5}, ${o-5} Z`).attr("fill",i).attr("stroke","#fff").attr("stroke-width",1);return}if(n==="triangle"){t.append("path").attr("d",`M${r}, ${o-5} L${r-5}, ${o+5} L${r+5}, ${o+5} Z`).attr("fill",i).attr("stroke","#fff").attr("stroke-width",1);return}t.append("path").attr("d",`M${r}, ${o+5} L${r+5}, ${o} L${r}, ${o-5} L${r-5}, ${o}Z`).attr("fill",i).attr("stroke","#fff").attr("stroke-width",1)}}function Ot(t,e){if(!t)return e;try{return JSON.parse(t)}catch{return e}}function z_(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.lineMargin}}}function tC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.radarMargin}}}function eC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.lollipopMargin}}}function rC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.punchcardMargin}}}function nC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.stepLineMargin}}}function Tp(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.sparkLineMargin}}}function iC(t,e="default"){const n=kn[e]-kn.default,i=f.barMargin;return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{top:Math.max(i.top+n,0),right:i.right,bottom:Math.max(i.bottom+n,8),left:Math.max(i.left+n,24)}}}function oC(t,e="default"){const n=kn[e]-kn.default,i=f.donutMargin;return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{top:Math.max(i.top+n,0),right:Math.max(i.right+n,0),bottom:Math.max(i.bottom+n,0),left:Math.max(i.left+n,0)}}}function aC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.boxPlotMargin}}}function sC(t,e="vertical"){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...e==="horizontal"?f.violinHorizontalMargin:f.violinVerticalMargin}}}function lC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.histogramMargin}}}function cC(t,e="horizontal"){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:e==="vertical"?{...f.parallelVerticalMargin}:{...f.parallelMargin}}}function uC(t,e="horizontal"){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...e==="vertical"?f.waterfallVerticalMargin:f.waterfallHorizontalMargin}}}function dC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.scatterMargin}}}function hC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.biasVarianceMargin}}}function pC(t){const e=f.bubbleMaxRadius/2+1,n=f.bubbleBaseMargin;return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{top:n.top+e,right:n.right+e,bottom:n.bottom,left:n.left}}}function fC(t,e="default"){const n=kn[e]-kn.default,i=f.radialBarMargin;return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{top:Math.max(i.top+n,0),right:Math.max(i.right+n,0),bottom:Math.max(i.bottom+n,0),left:Math.max(i.left+n,0)}}}function T_(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.pieMargin}}}function mC(t,e="default"){const n=kn[e]-kn.default,i=f.polarAreaMargin;return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{top:Math.max(i.top+n,0),right:Math.max(i.right+n,0),bottom:Math.max(i.bottom+n,0),left:Math.max(i.left+n,0)}}}function gC(t){return z_(t)}function yC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.areaGroupedBarMargin}}}function vC(t){return{width:t.clientWidth||400,height:t.clientHeight||300,margin:{...f.giniMargin}}}function bC(t){return{width:t.clientWidth||400,height:t.clientHeight||300}}/**
150
+ * @license
151
+ * Copyright 2019 Google LLC
152
+ * SPDX-License-Identifier: BSD-3-Clause
153
+ */const ss=globalThis,Lp=ss.ShadowRoot&&(ss.ShadyCSS===void 0||ss.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cp=Symbol(),hm=new WeakMap;let L_=class{constructor(e,n,i){if(this._$cssResult$=!0,i!==Cp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(Lp&&e===void 0){const i=n!==void 0&&n.length===1;i&&(e=hm.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&hm.set(n,e))}return e}toString(){return this.cssText}};const xC=t=>new L_(typeof t=="string"?t:t+"",void 0,Cp),ie=(t,...e)=>{const n=t.length===1?t[0]:e.reduce((i,r,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[o+1],t[0]);return new L_(n,t,Cp)},_C=(t,e)=>{if(Lp)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of e){const i=document.createElement("style"),r=ss.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=n.cssText,t.appendChild(i)}},pm=Lp?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(const i of e.cssRules)n+=i.cssText;return xC(n)})(t):t;/**
154
+ * @license
155
+ * Copyright 2017 Google LLC
156
+ * SPDX-License-Identifier: BSD-3-Clause
157
+ */const{is:$C,defineProperty:wC,getOwnPropertyDescriptor:kC,getOwnPropertyNames:SC,getOwnPropertySymbols:AC,getPrototypeOf:zC}=Object,_n=globalThis,fm=_n.trustedTypes,TC=fm?fm.emptyScript:"",Mc=_n.reactiveElementPolyfillSupport,No=(t,e)=>t,ks={toAttribute(t,e){switch(e){case Boolean:t=t?TC:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Ip=(t,e)=>!$C(t,e),mm={attribute:!0,type:String,converter:ks,reflect:!1,useDefault:!1,hasChanged:Ip};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_n.litPropertyMetadata??(_n.litPropertyMetadata=new WeakMap);let Ai=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=mm){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,n);r!==void 0&&wC(this.prototype,e,r)}}static getPropertyDescriptor(e,n,i){const{get:r,set:o}=kC(this.prototype,e)??{get(){return this[n]},set(a){this[n]=a}};return{get:r,set(a){const s=r==null?void 0:r.call(this);o==null||o.call(this,a),this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??mm}static _$Ei(){if(this.hasOwnProperty(No("elementProperties")))return;const e=zC(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(No("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(No("properties"))){const n=this.properties,i=[...SC(n),...AC(n)];for(const r of i)this.createProperty(r,n[r])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[i,r]of n)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const r=this._$Eu(n,i);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)n.unshift(pm(r))}else e!==void 0&&n.push(pm(e));return n}static _$Eu(e,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(n=>n(this))}addController(e){var n;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)==null||n.call(e))}removeController(e){var n;(n=this._$EO)==null||n.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _C(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(e,n,i){this._$AK(e,i)}_$ET(e,n){var o;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const a=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:ks).toAttribute(n,i.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,n){var o,a;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const s=i.getPropertyOptions(r),l=typeof s.converter=="function"?{fromAttribute:s.converter}:((o=s.converter)==null?void 0:o.fromAttribute)!==void 0?s.converter:ks;this._$Em=r;const c=l.fromAttribute(n,s.type);this[r]=c??((a=this._$Ej)==null?void 0:a.get(r))??c,this._$Em=null}}requestUpdate(e,n,i,r=!1,o){var a;if(e!==void 0){const s=this.constructor;if(r===!1&&(o=this[e]),i??(i=s.getPropertyOptions(e)),!((i.hasChanged??Ip)(o,n)||i.useDefault&&i.reflect&&o===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:i,reflect:r,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??n??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(n=void 0),this._$AL.set(e,n)),r===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[o,a]of r){const{wrapped:s}=a,l=this[o];s!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,a,l)}}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(r=>{var o;return(o=r.hostUpdate)==null?void 0:o.call(r)}),this.update(n)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(n)}willUpdate(e){}_$AE(e){var n;(n=this._$EO)==null||n.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(e){}firstUpdated(e){}};Ai.elementStyles=[],Ai.shadowRootOptions={mode:"open"},Ai[No("elementProperties")]=new Map,Ai[No("finalized")]=new Map,Mc==null||Mc({ReactiveElement:Ai}),(_n.reactiveElementVersions??(_n.reactiveElementVersions=[])).push("2.1.2");/**
158
+ * @license
159
+ * Copyright 2017 Google LLC
160
+ * SPDX-License-Identifier: BSD-3-Clause
161
+ */const Do=globalThis,gm=t=>t,Ss=Do.trustedTypes,ym=Ss?Ss.createPolicy("lit-html",{createHTML:t=>t}):void 0,C_="$lit$",mn=`lit$${Math.random().toFixed(9).slice(2)}$`,I_="?"+mn,LC=`<${I_}>`,Qn=document,Zo=()=>Qn.createComment(""),Wo=t=>t===null||typeof t!="object"&&typeof t!="function",Mp=Array.isArray,CC=t=>Mp(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",Nc=`[
162
+ \f\r]`,yo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vm=/-->/g,bm=/>/g,On=RegExp(`>|${Nc}(?:([^\\s"'>=/]+)(${Nc}*=${Nc}*(?:[^
163
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),xm=/'/g,_m=/"/g,M_=/^(?:script|style|textarea|title)$/i,IC=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),ot=IC(1),Vi=Symbol.for("lit-noChange"),st=Symbol.for("lit-nothing"),$m=new WeakMap,jn=Qn.createTreeWalker(Qn,129);function N_(t,e){if(!Mp(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return ym!==void 0?ym.createHTML(e):e}const MC=(t,e)=>{const n=t.length-1,i=[];let r,o=e===2?"<svg>":e===3?"<math>":"",a=yo;for(let s=0;s<n;s++){const l=t[s];let c,u,d=-1,h=0;for(;h<l.length&&(a.lastIndex=h,u=a.exec(l),u!==null);)h=a.lastIndex,a===yo?u[1]==="!--"?a=vm:u[1]!==void 0?a=bm:u[2]!==void 0?(M_.test(u[2])&&(r=RegExp("</"+u[2],"g")),a=On):u[3]!==void 0&&(a=On):a===On?u[0]===">"?(a=r??yo,d=-1):u[1]===void 0?d=-2:(d=a.lastIndex-u[2].length,c=u[1],a=u[3]===void 0?On:u[3]==='"'?_m:xm):a===_m||a===xm?a=On:a===vm||a===bm?a=yo:(a=On,r=void 0);const p=a===On&&t[s+1].startsWith("/>")?" ":"";o+=a===yo?l+LC:d>=0?(i.push(c),l.slice(0,d)+C_+l.slice(d)+mn+p):l+mn+(d===-2?s:p)}return[N_(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let $u=class D_{constructor({strings:e,_$litType$:n},i){let r;this.parts=[];let o=0,a=0;const s=e.length-1,l=this.parts,[c,u]=MC(e,n);if(this.el=D_.createElement(c,i),jn.currentNode=this.el.content,n===2||n===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=jn.nextNode())!==null&&l.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(const d of r.getAttributeNames())if(d.endsWith(C_)){const h=u[a++],p=r.getAttribute(d).split(mn),m=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:m[2],strings:p,ctor:m[1]==="."?DC:m[1]==="?"?OC:m[1]==="@"?PC:sc}),r.removeAttribute(d)}else d.startsWith(mn)&&(l.push({type:6,index:o}),r.removeAttribute(d));if(M_.test(r.tagName)){const d=r.textContent.split(mn),h=d.length-1;if(h>0){r.textContent=Ss?Ss.emptyScript:"";for(let p=0;p<h;p++)r.append(d[p],Zo()),jn.nextNode(),l.push({type:2,index:++o});r.append(d[h],Zo())}}}else if(r.nodeType===8)if(r.data===I_)l.push({type:2,index:o});else{let d=-1;for(;(d=r.data.indexOf(mn,d+1))!==-1;)l.push({type:7,index:o}),d+=mn.length-1}o++}}static createElement(e,n){const i=Qn.createElement("template");return i.innerHTML=e,i}};function Zi(t,e,n=t,i){var a,s;if(e===Vi)return e;let r=i!==void 0?(a=n._$Co)==null?void 0:a[i]:n._$Cl;const o=Wo(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==o&&((s=r==null?void 0:r._$AO)==null||s.call(r,!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=r:n._$Cl=r),r!==void 0&&(e=Zi(t,r._$AS(t,e.values),r,i)),e}let NC=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Qn).importNode(n,!0);jn.currentNode=r;let o=jn.nextNode(),a=0,s=0,l=i[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new Np(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new EC(o,this,e)),this._$AV.push(c),l=i[++s]}a!==(l==null?void 0:l.index)&&(o=jn.nextNode(),a++)}return jn.currentNode=Qn,r}p(e){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,n),n+=i.strings.length-2):i._$AI(e[n])),n++}},Np=class O_{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,n,i,r){this.type=2,this._$AH=st,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zi(this,e,n),Wo(e)?e===st||e==null||e===""?(this._$AH!==st&&this._$AR(),this._$AH=st):e!==this._$AH&&e!==Vi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):CC(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==st&&Wo(this._$AH)?this._$AA.nextSibling.data=e:this.T(Qn.createTextNode(e)),this._$AH=e}$(e){var o;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=$u.createElement(N_(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===r)this._$AH.p(n);else{const a=new NC(r,this),s=a.u(this.options);a.p(n),this.T(s),this._$AH=a}}_$AC(e){let n=$m.get(e.strings);return n===void 0&&$m.set(e.strings,n=new $u(e)),n}k(e){Mp(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,r=0;for(const o of e)r===n.length?n.push(i=new O_(this.O(Zo()),this.O(Zo()),this,this.options)):i=n[r],i._$AI(o),r++;r<n.length&&(this._$AR(i&&i._$AB.nextSibling,r),n.length=r)}_$AR(e=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);e!==this._$AB;){const r=gm(e).nextSibling;gm(e).remove(),e=r}}setConnected(e){var n;this._$AM===void 0&&(this._$Cv=e,(n=this._$AP)==null||n.call(this,e))}},sc=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,i,r,o){this.type=1,this._$AH=st,this._$AN=void 0,this.element=e,this.name=n,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=st}_$AI(e,n=this,i,r){const o=this.strings;let a=!1;if(o===void 0)e=Zi(this,e,n,0),a=!Wo(e)||e!==this._$AH&&e!==Vi,a&&(this._$AH=e);else{const s=e;let l,c;for(e=o[0],l=0;l<o.length-1;l++)c=Zi(this,s[i+l],n,l),c===Vi&&(c=this._$AH[l]),a||(a=!Wo(c)||c!==this._$AH[l]),c===st?e=st:e!==st&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===st?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},DC=class extends sc{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===st?void 0:e}},OC=class extends sc{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==st)}},PC=class extends sc{constructor(e,n,i,r,o){super(e,n,i,r,o),this.type=5}_$AI(e,n=this){if((e=Zi(this,e,n,0)??st)===Vi)return;const i=this._$AH,r=e===st&&i!==st||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==st&&(i===st||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,e):this._$AH.handleEvent(e)}},EC=class{constructor(e,n,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Zi(this,e)}};const Dc=Do.litHtmlPolyfillSupport;Dc==null||Dc($u,Np),(Do.litHtmlVersions??(Do.litHtmlVersions=[])).push("3.3.3");const FC=(t,e,n)=>{const i=(n==null?void 0:n.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const o=(n==null?void 0:n.renderBefore)??null;i._$litPart$=r=new Np(e.insertBefore(Zo(),o),o,void 0,n??{})}return r._$AI(t),r};/**
164
+ * @license
165
+ * Copyright 2017 Google LLC
166
+ * SPDX-License-Identifier: BSD-3-Clause
167
+ */const Gn=globalThis;let Vn=class extends Ai{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const e=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=e.firstChild),e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=FC(n,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Vi}};var tv;Vn._$litElement$=!0,Vn.finalized=!0,(tv=Gn.litElementHydrateSupport)==null||tv.call(Gn,{LitElement:Vn});const Oc=Gn.litElementPolyfillSupport;Oc==null||Oc({LitElement:Vn});(Gn.litElementVersions??(Gn.litElementVersions=[])).push("4.2.2");const RC=ie`
168
+ :host {
169
+ display: block;
170
+ position: relative;
171
+ width: 100%;
172
+ height: 100%;
173
+ min-height: 220px;
174
+ box-sizing: border-box;
175
+ }
176
+ .host {
177
+ display: block;
178
+ width: 100%;
179
+ height: 100%;
180
+ min-height: inherit;
181
+ }
182
+ .empty {
183
+ display: grid;
184
+ place-items: center;
185
+ height: 100%;
186
+ min-height: inherit;
187
+ padding: 1rem;
188
+ text-align: center;
189
+ color: var(--ui9000-color-text-muted, #6b7280);
190
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
191
+ font-size: 0.875rem;
192
+ line-height: 1.4;
193
+ }
194
+ .empty strong {
195
+ display: block;
196
+ margin-bottom: 0.25rem;
197
+ color: var(--ui9000-color-text, #111827);
198
+ font-weight: 600;
199
+ }
200
+ `;function P_(t,e){const n=e==null?void 0:e.trim();if(n)return n;const i=Ot(t,null);if(!(!i||typeof i!="object"))return i.isCustom?"customWidget":typeof i.chartType=="string"?i.chartType.trim():void 0}const jC="area-chart",UC="ui9000-area-chart",BC="Area Chart",HC="Chat-optimized area chart (grouped + stacked). FuseDash AreaChart Visx → D3.",qC=["areaChart","areaStackedChart"],GC="client/libs/shared/components/src/Widgets/AreaChart/",VC="d3",ZC="@ui9000/widgets/lazy/area-chart",WC="@ui9000/widgets/area-chart",KC={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},YC=["hover","resize"],JC={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{description:"FuseDash WidgetItem or { layout, series } chat shape"},scale:{type:"string",enum:["compact","default","comfortable"]},"show-points":{type:"boolean"},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"}}},E_={id:jC,tag:UC,title:BC,description:HC,chartTypeKeys:qC,source:GC,stack:VC,lazyImport:ZC,entry:WC,usageConditions:KC,allowedActions:YC,propsSchema:JC},XC="area-grouped-bar-chart",QC="ui9000-area-grouped-bar-chart",tI="Area Grouped Bar Chart",eI="Chat-optimized combo chart: grouped bars + area/line overlay. Vertical only, no Redux.",rI=["areaGroupedBarChart"],nI="client/libs/shared/components/src/Widgets/AreaGroupedBarChart/",iI="d3",oI="@ui9000/widgets/lazy/area-grouped-bar-chart",aI="@ui9000/widgets/area-grouped-bar-chart",sI={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},lI=["hover","resize"],cI={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{type:"object",description:"FuseDash WidgetItem-shaped payload (xAxe, yAxe[0]=line, yAxe[1]=bars, groupBy)"},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},F_={id:XC,tag:QC,title:tI,description:eI,chartTypeKeys:rI,source:nI,stack:iI,lazyImport:oI,entry:aI,usageConditions:sI,allowedActions:lI,propsSchema:cI},uI="bar-chart",dI="ui9000-bar-chart",hI="Bar Chart",pI="Chat-optimized bar chart rewritten in D3 (Visx → D3). Covers all six FuseDash Barchart variants: vertical/horizontal × plain/grouped/stacked, with an optional cumulative overlay. No Redux.",fI=["barChart","barGrouped","barStacked","cumulativeBar","barHorizontal","barHorizontalGrouped","barHorizontalStacked"],mI={barChart:{orientation:"vertical"},barGrouped:{orientation:"vertical",layout:"grouped"},barStacked:{orientation:"vertical",layout:"stacked"},cumulativeBar:{orientation:"vertical",cumulativeLine:!0},barHorizontal:{orientation:"horizontal"},barHorizontalGrouped:{orientation:"horizontal",layout:"grouped"},barHorizontalStacked:{orientation:"horizontal",layout:"stacked"}},gI="client/libs/shared/components/src/Widgets/Barchart/",yI="d3",vI="@ui9000/widgets/lazy/bar-chart",bI="@ui9000/widgets/bar-chart",xI={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0,context:"theme, scale, and mode come from WidgetContext CSS custom properties; series colors from widget formatting"},_I=["hover","resize"],$I={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},orientation:{type:"string",enum:["vertical","horizontal"],default:"vertical",description:"FuseDash `orientation` — picks the vertical or horizontal variant family."},layout:{type:"string",enum:["grouped","stacked"],default:"grouped",description:"FuseDash `stacked`. Only applies with more than one series; a single series always renders as the plain bar chart."},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},cumulativeLine:{type:"boolean",default:!1,description:"FuseDash `cumulativeLine` — running-total overlay. Vertical single-series only."},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},R_={id:uI,tag:dI,title:hI,description:pI,chartTypeKeys:fI,chartTypeMap:mI,source:gI,stack:yI,lazyImport:vI,entry:bI,usageConditions:xI,allowedActions:_I,propsSchema:$I},wI="bias-variance-tradeoff-chart",kI="ui9000-bias-variance-tradeoff-chart",SI="Bias-Variance Tradeoff Chart",AI="Chat-optimized bias-variance tradeoff curves. FuseDash BiasVarianceTradeoffChart Visx → D3.",zI=["biasVarianceTradeoffChart"],TI="client/libs/shared/components/src/Widgets/BiasVarianceTradeoffChart/",LI="d3",CI="@fusedashlabs/widgets/lazy/bias-variance-tradeoff-chart",II="@fusedashlabs/widgets/bias-variance-tradeoff-chart",MI={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},NI=["hover","resize"],DI={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"object",description:"FuseDash WidgetItem-shaped payload (numeric xAxe / yAxe, groupBy series, optional domainsLimits)"},{type:"object",description:"Chat shape: { series: [{ id, name, color, points: [{ x, y }] }], domainsLimits }"}]},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"}}},j_={id:wI,tag:kI,title:SI,description:AI,chartTypeKeys:zI,source:TI,stack:LI,lazyImport:CI,entry:II,usageConditions:MI,allowedActions:NI,propsSchema:DI},OI="box-plot-chart",PI="ui9000-box-plot-chart",EI="Box Plot Chart",FI="Chat-optimized box plot rewritten in D3 (Visx → D3). Vertical/horizontal, quartiles, whiskers, outliers, no Redux.",RI=["boxplotChart"],jI="client/libs/shared/components/src/Widgets/VerticalBoxPlotChart/",UI="d3",BI="@ui9000/widgets/lazy/box-plot-chart",HI="@ui9000/widgets/box-plot-chart",qI={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},GI=["hover","resize"],VI={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","q1","median","q3","smallestNonOutlier","biggestNonOutlier"],properties:{label:{type:"string"},group:{type:"string"},color:{type:"string"},q1:{type:"number"},median:{type:"number"},q3:{type:"number"},smallestNonOutlier:{type:"number"},biggestNonOutlier:{type:"number"},outliers:{type:"array",items:{type:"number"}}}}},{type:"object",properties:{orientation:{type:"string",enum:["vertical","horizontal"]},boxes:{type:"array"},xAxe:{type:["string","array"]},groupBy:{type:["string","array"]},data:{type:"array"}}}]},orientation:{type:"string",enum:["vertical","horizontal"],default:"vertical"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},U_={id:OI,tag:PI,title:EI,description:FI,chartTypeKeys:RI,source:jI,stack:UI,lazyImport:BI,entry:HI,usageConditions:qI,allowedActions:GI,propsSchema:VI},ZI="bubble-chart",WI="ui9000-bubble-chart",KI="Bubble Chart",YI="Chat-optimized bubble chart rewritten in D3. Numeric X/Y with abs(y) radius bands, optional groupBy colors, no Redux.",JI=["bubbleChart"],XI="client/libs/shared/components/src/Widgets/BubbleChart/",QI="d3",tM="@ui9000/widgets/lazy/bubble-chart",eM="@ui9000/widgets/bubble-chart",rM={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},nM=["hover","resize"],iM={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"number"},y:{type:"number"},group:{type:"string"},color:{type:"string"}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload"}]},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},B_={id:ZI,tag:WI,title:KI,description:YI,chartTypeKeys:JI,source:XI,stack:QI,lazyImport:tM,entry:eM,usageConditions:rM,allowedActions:nM,propsSchema:iM},oM="donut-chart",aM="ui9000-donut-chart",sM="Donut Chart",lM="Chat-optimized donut chart (FuseDash PieChart + inner hole). Same data as pieChart; ring thickness matches DonutChart.",cM=["donutChart"],uM="client/libs/shared/components/src/Widgets/DonutChart/",dM="d3",hM="@ui9000/widgets/lazy/donut-chart",pM="@ui9000/widgets/donut-chart",fM={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},mM=["hover","resize"],gM={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload (chartType donutChart)",properties:{chartType:{const:"donutChart"},xAxe:{type:"array",items:{type:"string"}},yAxe:{type:"array",items:{type:"string"}},uniqueValues:{type:"object"},formatting:{type:"array"},data:{type:"array"}}}]},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},H_={id:oM,tag:aM,title:sM,description:lM,chartTypeKeys:cM,source:uM,stack:dM,lazyImport:hM,entry:pM,usageConditions:fM,allowedActions:mM,propsSchema:gM},yM="donut-group-chart",vM="ui9000-donut-group-chart",bM="Donut Group Chart",xM="Chat-optimized donut group rewritten in D3 (Visx → D3). A row of KPI donuts: each entry is a gauge filled to value / max over a neutral track, or a breakdown donut when the entry carries several slices. No Redux.",_M=["donutGroupChart"],$M={donutGroupChart:{showValue:!0,showStatus:!0,showLabel:!0}},wM="client/libs/shared/components/src/Widgets/DonutGroupChart/",kM="d3",SM="@ui9000/widgets/lazy/donut-group-chart",AM="@ui9000/widgets/donut-group-chart",zM={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0,context:"theme, scale, styleId and mode come from WidgetContext CSS custom properties, not props"},TM=["hover","resize"],LM={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"array",items:{type:"object",required:["label","value"],properties:{id:{type:"string"},label:{type:"string"},value:{type:"number"},max:{type:"number",description:"FuseDash `maximalValue` — the gauge's full scale."},statusLabel:{type:"string"},status:{type:"string",enum:["positive","negative","neutral"]},color:{type:"string"},slices:{type:"array",description:"More than one slice renders a breakdown donut instead of a gauge.",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}}}}},{type:"object",properties:{items:{type:"array",items:{type:"object"}},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},max:{type:"number",default:100,description:"Gauge full scale for entries without their own `max`."},showValue:{type:"boolean",default:!0},showStatus:{type:"boolean",default:!0},showLabel:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0}},required:["data"]},q_={id:yM,tag:vM,title:bM,description:xM,chartTypeKeys:_M,chartTypeMap:$M,source:wM,stack:kM,lazyImport:SM,entry:AM,usageConditions:zM,allowedActions:TM,propsSchema:LM},CM="gini-impurity-entropy-chart",IM="ui9000-gini-impurity-entropy-chart",MM="Gini Impurity & Entropy Chart",NM="Chat-optimized decision-tree impurity chart rewritten in D3. Entropy / Gini / misclassification curves over the class probability p, with optional p-hat, confidence-interval and split annotations.",DM=["giniImpurityEntropyChart"],OM="client/libs/shared/components/src/Widgets/GiniImpurityEntropyChart/",PM="d3",EM="@ui9000/widgets/lazy/gini-impurity-entropy-chart",FM="@ui9000/widgets/gini-impurity-entropy-chart",RM={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},jM=["hover","resize"],UM={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:["string","number"]},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:["number","string"]},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},dash:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:["number","string"]},y:{type:"number"}}}}}}},xLabel:{type:"string"},yLabel:{type:"string"},meta:{type:"object",properties:{pHat:{type:"number",minimum:0,maximum:1},ci:{type:"array",items:{type:"number"},minItems:2,maxItems:2},split:{type:"object",required:["pLeft","pRight"],properties:{pLeft:{type:"number"},nLeft:{type:"number"},pRight:{type:"number"},nRight:{type:"number"}}},showPHat:{type:"boolean"},showCI:{type:"boolean"},showSplit:{type:"boolean"}}}}}]},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},showPHat:{type:"boolean",default:!1},showCI:{type:"boolean",default:!1},showSplit:{type:"boolean",default:!1}},required:["data"]},G_={id:CM,tag:IM,title:MM,description:NM,chartTypeKeys:DM,source:OM,stack:PM,lazyImport:EM,entry:FM,usageConditions:RM,allowedActions:jM,propsSchema:UM},BM="histogram-chart",HM="ui9000-histogram-chart",qM="Histogram Chart",GM="Chat-optimized histogram rewritten in D3. Stacked bins, linear x-axis, no Redux.",VM=["histogramChart"],ZM="client/libs/shared/components/src/Widgets/HistogramChart/",WM="d3",KM="@ui9000/widgets/lazy/histogram-chart",YM="@ui9000/widgets/histogram-chart",JM={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},XM=["hover","resize"],QM={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",properties:{bins:{type:"array",items:{type:"object",required:["x0","x1","stacks"],properties:{x0:{type:"number"},x1:{type:"number"},stacks:{type:"array",items:{type:"object",required:["group","count"],properties:{group:{type:"string"},count:{type:"number"},color:{type:"string"}}}}}}},xMin:{type:"number"},xMax:{type:"number"}},required:["bins"]},{type:"object",properties:{xMin:{type:"number"},xMax:{type:"number"},groups:{type:"array",items:{type:"string"}},data:{type:"array",items:{type:"object",required:["bucketIndex","count"],properties:{bucketIndex:{type:"number"},count:{type:"number"},group:{type:"string"},color:{type:"string"}}}}},required:["xMin","xMax","data"]}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},V_={id:BM,tag:HM,title:qM,description:GM,chartTypeKeys:VM,source:ZM,stack:WM,lazyImport:KM,entry:YM,usageConditions:JM,allowedActions:XM,propsSchema:QM},tN="kpi-widget",eN="ui9000-kpi-widget",rN="KPI Widget",nN="Chat-optimized KPI cards (single_value grid and high/low_overall) — HTML/Lit, no Redux.",iN=["KPI","KPIs"],oN="client/libs/shared/components/src/Widgets/CustomWidget/components/KPIWidget/",aN="lit",sN="@ui9000/widgets/lazy/kpi-widget",lN="@ui9000/widgets/kpi-widget",cN={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},uN=["resize"],dN={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"object",description:"Multi-KPI dashboard (chartType KPIs)",properties:{chartType:{const:"KPIs"},items:{type:"array"}}},{type:"object",description:"Single FuseDash KPI item (chartType KPI)",properties:{chartType:{const:"KPI"},type:{type:"string"},data:{type:"array"}}},{type:"array",description:"Array of KPI items from MCP tool output"}]},scale:{type:"string",enum:["compact","default","comfortable"]}}},Z_={id:tN,tag:eN,title:rN,description:nN,chartTypeKeys:iN,source:oN,stack:aN,lazyImport:sN,entry:lN,usageConditions:cN,allowedActions:uN,propsSchema:dN},hN="line-chart",pN="ui9000-line-chart",fN="Line Chart",mN="Chat-optimized line chart rewritten in D3 (Visx → D3). Single or multi-series, no Redux.",gN=["lineChart","lineGroupedChart"],yN="client/libs/shared/components/src/Widgets/LineChart/",vN="d3",bN="@ui9000/widgets/lazy/line-chart",xN="@ui9000/widgets/line-chart",_N={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},$N=["hover","resize"],wN={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},curve:{type:"string",enum:["linear","monotone","step"],default:"monotone"},showPoints:{type:"boolean",default:!0},showArea:{type:"boolean",default:!1},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},W_={id:hN,tag:pN,title:fN,description:mN,chartTypeKeys:gN,source:yN,stack:vN,lazyImport:bN,entry:xN,usageConditions:_N,allowedActions:$N,propsSchema:wN},kN="lollipop",SN="ui9000-lollipop",AN="Lollipop Chart",zN="Chat-optimized lollipop rewritten in D3 (Visx → D3). Vertical/horizontal, stem + head, no Redux.",TN=["lollipopChart","lollipopGroupedChart","lollipopStackedChart"],LN="client/libs/shared/components/src/Widgets/Lollipop/",CN="d3",IN="@ui9000/widgets/lazy/lollipop",MN="@ui9000/widgets/lollipop",NN={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},DN=["hover","resize"],ON={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}}}}}}}]},orientation:{type:"string",enum:["vertical","horizontal"],default:"vertical"},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},K_={id:kN,tag:SN,title:AN,description:zN,chartTypeKeys:TN,source:LN,stack:CN,lazyImport:IN,entry:MN,usageConditions:NN,allowedActions:DN,propsSchema:ON},PN="network-graph",EN="ui9000-network-graph",FN="Network Graph",RN="Chat-optimized FuseDash NetworkGraph rewritten in D3 (d3-force/-drag/-zoom). Value-sized nodes, category colours, click-to-focus links, and a size-bucket legend filter. No Redux.",jN=["networkGraphChart"],UN="client/libs/shared/components/src/Widgets/NetworkGraph/",BN="d3",HN="@fusedashlabs/widgets/lazy/network-graph",qN="@fusedashlabs/widgets/network-graph",GN={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},VN=["hover","select","drag","zoom","filter","resize"],ZN={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"object",description:"FuseDash WidgetItem-shaped payload — the graph lives in data[0].",required:["data"],properties:{name:{type:"string"},data:{type:"array",items:{type:"object",properties:{nodes:{type:"array",items:{$ref:"#/$defs/node"}},links:{type:"array",items:{$ref:"#/$defs/link"}}}}}}},{type:"object",description:"Graph payload from chat.",properties:{nodes:{type:"array",items:{$ref:"#/$defs/node"}},links:{type:"array",items:{$ref:"#/$defs/link"}}}},{type:"array",description:"Links only — node ids are derived from the endpoints.",items:{$ref:"#/$defs/link"}}]},"chart-title":{type:"string"},"show-header":{type:"boolean",default:!0},"show-legend":{type:"boolean",default:!0},"show-tooltip":{type:"boolean",default:!0}},required:["data"],$defs:{node:{type:"object",required:["id"],properties:{id:{type:"string"},label:{type:"string"},value:{type:"number",description:"Drives the size bucket."},type:{type:"string",description:"Category key → node colour."},color:{type:"string"},img:{type:"string",description:"Avatar URL clipped to the node circle."}}},link:{type:"object",required:["source","target"],properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},value:{type:"number"},type:{type:"string",enum:["primary","neutral","secondary"]}}}}},Y_={id:PN,tag:EN,title:FN,description:RN,chartTypeKeys:jN,source:UN,stack:BN,lazyImport:HN,entry:qN,usageConditions:GN,allowedActions:VN,propsSchema:ZN},WN="parallel-coordinates-chart",KN="ui9000-parallel-coordinates-chart",YN="Parallel Coordinates Chart",JN="Chat-optimized parallel coordinates rewritten in D3 (client d3-axis/d3-scale + Redux → props-only Lit element). One linear axis per dimension, a polyline per record, coloured by the active axis; click an axis to move the colour ramp onto it.",XN=["parallelCoordinatesChart"],QN="client/libs/shared/components/src/Widgets/ParallelCoordinatesChart/",tD="d3",eD="@fusedashlabs/widgets/lazy/parallel-coordinates-chart",rD="@fusedashlabs/widgets/parallel-coordinates-chart",nD={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},iD=["hover","select","resize"],oD=[{rule:"Legend is HTML in the shell, above the plot",deviation:"The colour ramp renders as an SVG gutter legend inside the plot's reserved bottom (horizontal) or right (vertical) band, not as HTML above it.",why:"The ramp is a continuous scale keyed to the active axis and reads as part of the axis furniture; the client draws it the same way, so keeping it in SVG preserves the layout hosts already expect. Discrete series legends still follow the house rule."},{rule:"Ports match the client 1:1",deviation:"Vertical orientation maps the axis maximum to the top of the plot; the client's VerticalParallelCoordinatesChart maps it to the bottom.",why:"The client transposed the horizontal variant without flipping the SVG y range, leaving its axes inverted and contradicting its own colour ramp. Horizontal is the acceptance path; the vertical fix is deliberate."}],aD={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object"},description:"Plain rows; every key holding a finite number becomes an axis."},{type:"object",required:["rows"],properties:{rows:{type:"array",items:{type:"object"}},axes:{type:"array",items:{type:"string"}},idKey:{type:"string"},orientation:{enum:["horizontal","vertical"]}}},{type:"object",required:["data"],properties:{data:{type:"array",items:{type:"object"}},orientation:{enum:["horizontal","vertical"]},xAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Identity field — rows sort by it and tooltips label by it."},yAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Colour axis hint; used only when it names one of the dimensions."},uniqueValues:{type:"object",description:"Flattened values supply the dimension axes, in order.",additionalProperties:{type:"array",items:{type:"string"}}},formatting:{type:"array",items:{type:"object",properties:{key:{type:"string"},color:{type:["string","number"]}}},description:"`defaultMin` / `defaultMax` set the two ends of the colour ramp."}}}]},orientation:{enum:["horizontal","vertical"]},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},colorKey:{type:"string"}},required:["data"]},J_={id:WN,tag:KN,title:YN,description:JN,chartTypeKeys:XN,source:QN,stack:tD,lazyImport:eD,entry:rD,usageConditions:nD,allowedActions:iD,divergences:oD,propsSchema:aD},sD="pie-chart",lD="ui9000-pie-chart",cD="Pie Chart",uD="Chat-optimized pie chart rewritten in D3. Full disc or donut via inner-radius-ratio, no Redux.",dD=["pieChart"],hD="client/libs/shared/components/src/Widgets/PieChart/",pD="d3",fD="@ui9000/widgets/lazy/pie-chart",mD="@ui9000/widgets/pie-chart",gD={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},yD=["hover","resize"],vD={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload",properties:{chartType:{type:"string"},xAxe:{type:"array",items:{type:"string"}},yAxe:{type:"array",items:{type:"string"}},uniqueValues:{type:"object"},formatting:{type:"array"},data:{type:"array"}}}]},"inner-radius-ratio":{type:"number",minimum:0,maximum:1,description:"0 = pie, >0 = donut hole size relative to outer radius"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},X_={id:sD,tag:lD,title:cD,description:uD,chartTypeKeys:dD,source:hD,stack:pD,lazyImport:fD,entry:mD,usageConditions:gD,allowedActions:yD,propsSchema:vD},bD="polar-area-chart",xD="ui9000-polar-area-chart",_D="Polar Area Chart",$D="Chat-optimized polar area (coxcomb) chart rewritten in D3. Equal-angle wedges scaled by value, no Redux.",wD=["polarAreaChart"],kD="client/libs/shared/components/src/Widgets/PolarAreaChart/",SD="d3",AD="@fusedashlabs/widgets/lazy/polar-area-chart",zD="@fusedashlabs/widgets/polar-area-chart",TD={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},LD=["hover","resize"],CD={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",description:"Chat points payload",required:["points"],properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:["string","number"]},y:{type:"number"}}}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload",properties:{chartType:{type:"string"},xAxe:{type:"array",items:{type:"string"}},yAxe:{type:"array",items:{type:"string"}},uniqueValues:{type:"object"},formatting:{type:"array"},data:{type:"array"}}}]},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},Q_={id:bD,tag:xD,title:_D,description:$D,chartTypeKeys:wD,source:kD,stack:SD,lazyImport:AD,entry:zD,usageConditions:TD,allowedActions:LD,propsSchema:CD},ID="punchcard-chart",MD="ui9000-punchcard-chart",ND="Punchcard Chart",DD="Chat-optimized punchcard rewritten in D3 (Visx → D3). Bubble matrix by x/y categories, no Redux.",OD=["punchcardChart"],PD="client/libs/shared/components/src/Widgets/PunchcardChart/",ED="d3",FD="@ui9000/widgets/lazy/punchcard-chart",RD="@ui9000/widgets/punchcard-chart",jD={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},UD=["hover","resize"],BD={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["x","y","value"],properties:{x:{type:"string"},y:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",required:["cells"],properties:{cells:{type:"array",items:{type:"object",required:["x","y","value"],properties:{x:{type:"string"},y:{type:"string"},value:{type:"number"},color:{type:"string"}}}},xDomain:{type:"array",items:{type:"string"}},yDomain:{type:"array",items:{type:"string"}}}},{type:"object",required:["data"],properties:{data:{type:"array",items:{type:"object"}},xAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},yAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},groupBy:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},t$={id:ID,tag:MD,title:ND,description:DD,chartTypeKeys:OD,source:PD,stack:ED,lazyImport:FD,entry:RD,usageConditions:jD,allowedActions:UD,propsSchema:BD},HD="radar-chart",qD="ui9000-radar-chart",GD="Radar Chart",VD="Chat-optimized radar chart rewritten in D3 (Visx → D3). Single + grouped series, polar grid, marker hover.",ZD=["radarChart","radarGroupedChart"],WD="client/libs/shared/components/src/Widgets/RadarChart/",KD="d3",YD="@ui9000/widgets/lazy/radar-chart",JD="@ui9000/widgets/radar-chart",XD={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},QD=["hover","resize"],tO={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{categories:{type:"array",items:{type:"string"}},points:{type:"array",items:{type:"object",properties:{category:{type:"string"},label:{type:"string"},value:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},marker:{type:"string"},points:{type:"array",items:{type:"object",properties:{category:{type:"string"},label:{type:"string"},value:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0}},required:["data"]},e$={id:HD,tag:qD,title:GD,description:VD,chartTypeKeys:ZD,source:WD,stack:KD,lazyImport:YD,entry:JD,usageConditions:XD,allowedActions:QD,propsSchema:tO},eO="radial-bar-chart",rO="ui9000-radial-bar-chart",nO="Radial Bar Chart",iO="Chat-optimized radial bar chart rewritten in D3. One ring per category over a 270° sweep, no Redux.",oO=["radialBarChart"],aO="client/libs/shared/components/src/Widgets/RadialBarChart/",sO="d3",lO="@fusedashlabs/widgets/lazy/radial-bar-chart",cO="@fusedashlabs/widgets/radial-bar-chart",uO={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},dO=["hover","resize"],hO={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},color:{type:"string"}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload",properties:{chartType:{type:"string"},xAxe:{type:"array",items:{type:"string"}},yAxe:{type:"array",items:{type:"string"}},uniqueValues:{type:"object"},formatting:{type:"array"},axisDetails:{type:"object"},data:{type:"array"}}}]},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},r$={id:eO,tag:rO,title:nO,description:iO,chartTypeKeys:oO,source:aO,stack:sO,lazyImport:lO,entry:cO,usageConditions:uO,allowedActions:dO,propsSchema:hO},pO="sankey-chart",fO="ui9000-sankey-chart",mO="Sankey Chart",gO="Chat-optimized Sankey rewritten in D3 (Visx + d3-sankey → d3-sankey + d3-shape). Two dimension columns joined by value-coloured ribbons, no Redux.",yO=["sankeyChart"],vO="client/libs/shared/components/src/Widgets/Sankey/",bO="d3",xO="@ui9000/widgets/lazy/sankey-chart",_O="@ui9000/widgets/sankey-chart",$O={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},wO=["hover","select","resize"],kO={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["source","target","value"],properties:{source:{type:"string"},target:{type:"string"},value:{type:"number"}}}},{type:"object",required:["links"],properties:{nodes:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},label:{type:"string"}}}},links:{type:"array",items:{type:"object",required:["source","target","value"],properties:{source:{type:"string"},target:{type:"string"},value:{type:"number"}}}},sourceLabel:{type:"string"},targetLabel:{type:"string"},valueLabel:{type:"string"}}},{type:"object",required:["data"],properties:{data:{type:"array",items:{type:"object"}},xAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},yAxe:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},groupBy:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},arrangeBy:{type:"array",items:{type:"string"},description:"Editor-built Sankeys keep [sourceField, targetField] here."},display:{type:"array",items:{type:"string"},description:"Editor-built Sankeys keep [measureField] here."},axisDetails:{type:"object"},palette:{type:"object",properties:{customColors:{type:"array",items:{type:"object",required:["hex"],properties:{hex:{type:"string"}}}}}}}}]},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},sourceLabel:{type:"string"},targetLabel:{type:"string"}},required:["data"]},n$={id:pO,tag:fO,title:mO,description:gO,chartTypeKeys:yO,source:vO,stack:bO,lazyImport:xO,entry:_O,usageConditions:$O,allowedActions:wO,propsSchema:kO},SO="scatter-plot-chart",AO="ui9000-scatter-plot",zO="Scatter Plot",TO="Chat-optimized scatter plot rewritten in D3. Numeric X/Y, optional groupBy markers, no Redux.",LO=["scatterplotChart","qqPlot"],CO="client/libs/shared/components/src/Widgets/ScatterPlot/",IO="d3",MO="@ui9000/widgets/lazy/scatter-plot-chart",NO="@ui9000/widgets/scatter-plot-chart",DO={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},OO=["hover","resize"],PO={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"number"},y:{type:"number"},group:{type:"string"},color:{type:"string"}}}},{type:"object",description:"FuseDash WidgetItem-shaped payload"}]},"show-grid":{type:"boolean"},"show-legend":{type:"boolean"},"show-tooltip":{type:"boolean"},"show-reference-line":{type:"boolean"},scale:{type:"string",enum:["compact","default","comfortable"]}}},i$={id:SO,tag:AO,title:zO,description:TO,chartTypeKeys:LO,source:CO,stack:IO,lazyImport:MO,entry:NO,usageConditions:DO,allowedActions:OO,propsSchema:PO},EO="scatter-sparkline-chart",FO="ui9000-scatter-sparkline-chart",RO="Scatter Sparkline Chart",jO="FuseDash ScatterSparklineChart — datetime aggregated line with gradient fill plus jittered scatter markers. D3 rewrite, no Redux.",UO=["scatterSparklineChart"],BO="client/libs/shared/components/src/Widgets/ScatterSparklineChart/",HO="d3",qO="@ui9000/widgets/lazy/scatter-sparkline-chart",GO="@ui9000/widgets/scatter-sparkline-chart",VO={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},ZO=["hover","resize"],WO={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{type:"object",description:"FuseDash WidgetItem or normalized scatter-sparkline model"},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0}},required:["data"]},o$={id:EO,tag:FO,title:RO,description:jO,chartTypeKeys:UO,source:BO,stack:HO,lazyImport:qO,entry:GO,usageConditions:VO,allowedActions:ZO,propsSchema:WO},KO="spark-area-chart",YO="ui9000-spark-area-chart",JO="Spark Area Chart",XO="Chat-optimized spark area chart rewritten in D3 (Visx → D3). SparkLine + filled area to y=0. Datetime x, multi-series via groupBy, full axes + crosshair hover. No Redux.",QO=["sparkAreaChart"],tP="client/libs/shared/components/src/Widgets/SparkAreaChart/",eP="d3",rP="@ui9000/widgets/lazy/spark-area-chart",nP="@ui9000/widgets/spark-area-chart",iP={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},oP=["hover","resize"],aP={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},a$={id:KO,tag:YO,title:JO,description:XO,chartTypeKeys:QO,source:tP,stack:eP,lazyImport:rP,entry:nP,usageConditions:iP,allowedActions:oP,propsSchema:aP},sP="spark-line-chart",lP="ui9000-spark-line-chart",cP="Spark Line Chart",uP="Chat-optimized spark line chart rewritten in D3 (Visx → D3). Datetime x, multi-series via groupBy, full axes + crosshair hover. No Redux.",dP=["sparkLineChart"],hP="client/libs/shared/components/src/Widgets/SparkLineChart/",pP="d3",fP="@ui9000/widgets/lazy/spark-line-chart",mP="@ui9000/widgets/spark-line-chart",gP={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},yP=["hover","resize"],vP={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},s$={id:sP,tag:lP,title:cP,description:uP,chartTypeKeys:dP,source:hP,stack:pP,lazyImport:fP,entry:mP,usageConditions:gP,allowedActions:yP,propsSchema:vP},bP="step-line-chart",xP="ui9000-step-line-chart",_P="Step Line Chart",$P="Chat-optimized step line chart rewritten in D3 (Visx → D3). Categorical or time x, multi-series, optional KS / ROC reference overlay. No Redux.",wP=["stepLineChart","ksPlotChart","rocCurveChart"],kP="client/libs/shared/components/src/Widgets/StepLineChart/",SP="d3",AP="@ui9000/widgets/lazy/step-line-chart",zP="@ui9000/widgets/step-line-chart",TP={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},LP=["hover","resize"],CP={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"}}}},{type:"object",properties:{points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}},series:{type:"array",items:{type:"object",required:["id","points"],properties:{id:{type:"string"},name:{type:"string"},color:{type:"string"},points:{type:"array",items:{type:"object",required:["x","y"],properties:{x:{type:"string"},y:{type:"number"}}}}}}}}}]},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},grafType:{type:"string",enum:["none","curve","line"],default:"none",description:"Reference overlay: 'curve' draws the KS-plot Ideal curve plus the max-deviation marker, 'line' draws the ROC random-guessing diagonal."},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},l$={id:bP,tag:xP,title:_P,description:$P,chartTypeKeys:wP,source:kP,stack:SP,lazyImport:AP,entry:zP,usageConditions:TP,allowedActions:LP,propsSchema:CP},IP="violin-chart",MP="ui9000-violin-chart",NP="Violin Chart",DP="Chat-optimized violin chart rewritten in D3 (Visx → D3). Horizontal/vertical KDE density + box overlay, no Redux.",OP=["violinChart"],PP="client/libs/shared/components/src/Widgets/ViolinChart/",EP="d3",FP="@ui9000/widgets/lazy/violin-chart",RP="@ui9000/widgets/violin-chart",jP={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},UP=["resize"],BP={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"object",properties:{orientation:{type:"string",enum:["vertical","horizontal"]},groups:{type:"array",items:{type:"object",required:["samples"],properties:{id:{type:"string"},label:{type:"string"},samples:{type:"array",items:{type:"number"}},color:{type:"string"}}}},xAxe:{type:["string","array"]},yAxe:{type:["string","array"]},uniqueValues:{type:"object"},data:{type:"array"}}},{type:"array",items:{type:"object",required:["id","samples"],properties:{id:{type:"string"},samples:{type:"array",items:{type:"number"}},color:{type:"string"}}}}]},orientation:{type:"string",enum:["vertical","horizontal"],default:"vertical"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!1},showTooltip:{type:"boolean",default:!1},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},c$={id:IP,tag:MP,title:NP,description:DP,chartTypeKeys:OP,source:PP,stack:EP,lazyImport:FP,entry:RP,usageConditions:jP,allowedActions:UP,propsSchema:BP},HP="waterfall-chart",qP="ui9000-waterfall-chart",GP="Waterfall Chart",VP="Chat-optimized waterfall rewritten in D3. Dual orientation, cumulative levels / delta flags, no Redux.",ZP=["waterfallChart"],WP="client/libs/shared/components/src/Widgets/WaterfallChart/",KP="d3",YP="@ui9000/widgets/lazy/waterfall-chart",JP="@ui9000/widgets/waterfall-chart",XP={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},QP=["hover","resize"],tE={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{oneOf:[{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},kind:{type:"string",enum:["total","increase","decrease"]}}}},{type:"object",properties:{steps:{type:"array",items:{type:"object",required:["label","value"],properties:{label:{type:"string"},value:{type:"number"},kind:{type:"string",enum:["total","increase","decrease"]}}}},orientation:{type:"string",enum:["horizontal","vertical"]}}}]},orientation:{type:"string",enum:["horizontal","vertical"],default:"horizontal"},showGrid:{type:"boolean",default:!0},showLegend:{type:"boolean",default:!0},showTooltip:{type:"boolean",default:!0},xLabel:{type:"string"},yLabel:{type:"string"}},required:["data"]},u$={id:HP,tag:qP,title:GP,description:VP,chartTypeKeys:ZP,source:WP,stack:KP,lazyImport:YP,entry:JP,usageConditions:XP,allowedActions:QP,propsSchema:tE},d$={barGroupedChart:"barGrouped",barStackedChart:"barStacked",cumulativeBarChart:"cumulativeBar",barHorizontalChart:"barHorizontal",barHorizontalGroupedChart:"barHorizontalGrouped",barHorizontalStackedChart:"barHorizontalStacked",lollipopGroupedChart:"lollipopGroupedChart",lollipopStackedChart:"lollipopStackedChart",lineGroupedChart:"lineGroupedChart",areaStackedChart:"areaStackedChart",qqPlot:"qqPlot",radarChartGrouped:"radarGroupedChart",rocPlotChart:"rocCurveChart"},eE=[E_,F_,R_,j_,U_,B_,H_,q_,G_,V_,Z_,W_,K_,Y_,J_,X_,Q_,t$,e$,r$,n$,i$,o$,a$,s$,l$,c$,u$];function rE(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function nE(t){if(!t)return;const e={};for(const[n,i]of Object.entries(t))(typeof i=="string"||typeof i=="boolean"||typeof i=="number")&&(e[rE(n)]=i);return Object.keys(e).length?e:void 0}function iE(t){var e;const n=t.id,i={};for(const r of t.chartTypeKeys??[])i[r]={kind:n,tag:t.tag,attrs:nE((e=t.chartTypeMap)==null?void 0:e[r])};return i}const Wi=eE.reduce((t,e)=>Object.assign(t,iE(e)),{});Wi.ksPlotChart={...Wi.ksPlotChart,attrs:{"graf-type":"curve"}};Wi.rocCurveChart={...Wi.rocCurveChart,attrs:{"graf-type":"line"}};const h$=Object.freeze(Object.keys(Wi).sort());function p$(t){if(!(t!=null&&t.trim()))return;const e=t.trim();return d$[e]??e}function Dp(t){const e=p$(t);return e?Wi[e]??null:null}function f$(t){return Dp(t)!=null}function oE(t,e){if(e)for(const[n,i]of Object.entries(e))typeof i=="boolean"?i?t.setAttribute(n,""):t.removeAttribute(n):t.setAttribute(n,String(i))}class m$ extends HTMLElement{constructor(){super(...arguments),this._host=null,this._empty=null,this._mountToken=0}static get observedAttributes(){return["data","chart-type","scale","show-grid","show-legend","show-tooltip","chart-title"]}connectedCallback(){if(this._host)return;const e=this.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=RC.cssText,e.appendChild(n),this._host=document.createElement("div"),this._host.className="host",this._host.part="chart",e.appendChild(this._host),this._empty=document.createElement("div"),this._empty.className="empty",this._empty.part="empty",this._empty.hidden=!0,e.appendChild(this._empty),this.mountChart()}attributeChangedCallback(){this._host&&this.mountChart()}get dataJson(){return this.getAttribute("data")??"{}"}get chartTypeAttr(){return this.getAttribute("chart-type")??""}get scale(){return this.getAttribute("scale")||"default"}boolAttr(e){if(this.hasAttribute(e))return this.getAttribute(e)!=="false"}showEmpty(e,n){if(!this._empty||!this._host)return;this._host.replaceChildren(),this._host.hidden=!0,this._empty.hidden=!1,this._empty.replaceChildren();const i=document.createElement("strong");if(i.textContent=e,this._empty.appendChild(i),n){const r=document.createElement("span");r.textContent=n,this._empty.appendChild(r)}}async mountChart(){var e,n;if(!this._host||!this._empty)return;const i=++this._mountToken,r=P_(this.dataJson,this.chartTypeAttr);if(!r){this.showEmpty("No chart type","Pass chart-type or a widget payload with chartType.");return}const o=Dp(r);if(!o){this.showEmpty("Unsupported chart type",`"${r}" is not available in @ui9000/widgets yet.`);return}try{await XL(o.kind)}catch{if(i!==this._mountToken)return;this.showEmpty("Failed to load chart",o.kind);return}if(i!==this._mountToken)return;const a=Ot(this.dataJson,null),s=((e=this.getAttribute("chart-title"))==null?void 0:e.trim())||(a&&typeof a=="object"?(n=a.name)==null?void 0:n.trim():"")||"";let l=this._host.firstElementChild;(!l||l.tagName.toLowerCase()!==o.tag)&&(this._host.replaceChildren(),l=document.createElement(o.tag),this._host.appendChild(l)),l.setAttribute("data",this.dataJson),l.setAttribute("scale",this.scale),s?l.setAttribute("chart-title",s):l.removeAttribute("chart-title");const c=this.boolAttr("show-grid"),u=this.boolAttr("show-legend"),d=this.boolAttr("show-tooltip");c!==void 0&&(c?l.setAttribute("show-grid",""):l.setAttribute("show-grid","false")),u!==void 0&&(u?l.setAttribute("show-legend",""):l.setAttribute("show-legend","false")),d!==void 0&&(d?l.setAttribute("show-tooltip",""):l.setAttribute("show-tooltip","false")),oE(l,o.attrs),l.style.display="block",l.style.width="100%",l.style.height="100%",this._empty.hidden=!0,this._host.hidden=!1}}function Op(){customElements.get("ui9000-chart-renderer")||customElements.define("ui9000-chart-renderer",m$)}Op();const aE="chart-renderer",sE="ui9000-chart-renderer",lE="Chart Renderer",cE="FuseDash ChartRenderer dispatcher — resolves chartType from a WidgetItem payload, lazy-loads the matching @ui9000/widgets chart, and mounts it. No Redux.",uE=["*"],dE="client/libs/shared/components/src/Widgets/ChartRenderer/",hE="d3",pE="@ui9000/widgets/lazy/chart-renderer",fE="@ui9000/widgets/chart-renderer",mE={host:"mcp-chat",notFor:"fusedash-editor",mapsExcluded:!0},gE=["resize"],yE={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{data:{type:"object",description:"FuseDash WidgetItem JSON (must include chartType unless chart-type attribute is set)"},chartType:{type:"string",description:"Optional override — wins over widget.chartType (matches FuseDash ChartRenderer chartType prop)"},scale:{type:"string",enum:["compact","default","comfortable"],default:"default"},showGrid:{type:"boolean"},showLegend:{type:"boolean"},showTooltip:{type:"boolean"},chartTitle:{type:"string"}},required:["data"]},vE={id:aE,tag:sE,title:lE,description:cE,chartTypeKeys:uE,source:dE,stack:hE,lazyImport:pE,entry:fE,usageConditions:mE,allowedActions:gE,propsSchema:yE},bE=Object.freeze(Object.defineProperty({__proto__:null,CHART_TYPE_ALIASES:d$,SUPPORTED_CHART_TYPES:h$,Ui9000ChartRenderer:m$,canRenderChartType:f$,chartRendererMetadata:vE,registerChartRenderer:Op,resolveChartTarget:Dp,resolveRegistryKey:p$,resolveWidgetChartType:P_},Symbol.toStringTag,{value:"Module"})),wm="ui9000-meta:";function xE(t){for(const e of t.split(/\r?\n/)){const n=e.trim();if(!n.startsWith(wm))continue;const i=n.slice(wm.length);try{const r=JSON.parse(i);return{chartType:typeof r.chartType=="string"?r.chartType:void 0,chartUrl:typeof r.chartUrl=="string"?r.chartUrl:void 0,dataUrl:typeof r.dataUrl=="string"?r.dataUrl:void 0,chartId:typeof r.chartId=="string"?r.chartId:void 0}}catch{return{}}}return{}}function _E(t){return Array.isArray(t.data)||Array.isArray(t.histogramResults)||Array.isArray(t.boxes)||Array.isArray(t.cells)||Array.isArray(t.series)||Array.isArray(t.points)}function $E(t){if(!t||typeof t!="object")return t;const e=t;if(e.data&&typeof e.data=="object"&&!Array.isArray(e.data)){const n=e.data;if(_E(n))return{...n,chartType:e.chartType??n.chartType}}return e.config&&typeof e.config=="object"?{...e.config,...e}:e}function Pc(t){return t?{chartUrl:typeof t.chartUrl=="string"?t.chartUrl.trim():void 0,dataUrl:typeof t.dataUrl=="string"?t.dataUrl.trim():void 0,chartType:typeof t.chartType=="string"?t.chartType.trim():void 0}:{}}function km(...t){const e={};for(const n of t)n.chartUrl&&(e.chartUrl=n.chartUrl),n.dataUrl&&(e.dataUrl=n.dataUrl),n.chartType&&(e.chartType=n.chartType);return e}function wE(t){if(t!=null&&t.isError)return{};const e=Pc((t==null?void 0:t._meta)??void 0),n=Pc((t==null?void 0:t.structuredContent)??void 0);let i={};const r=t==null?void 0:t.content;if(Array.isArray(r))for(const o of r)(o==null?void 0:o.type)==="text"&&typeof o.text=="string"&&(i=km(i,Pc(xE(o.text))));return km(i,n,e)}function kE(t){if(t.dataUrl&&Sm(t.dataUrl))return t.dataUrl;if(t.chartUrl)try{const n=new URL(t.chartUrl).searchParams.get("dataUrl");if(n&&Sm(n))return n}catch{}}const SE=h$;function AE(t){return f$(t)}function Sm(t){const e=t.trim();return e.startsWith("http://")||e.startsWith("https://")}Op();const Zn=document.getElementById("status"),As=document.getElementById("empty-state"),g$=document.getElementById("empty-title"),y$=document.getElementById("empty-detail"),Ko=document.getElementById("widget-host"),zE=document.getElementById("shell");function v$(t){var e,n,i;t&&(t.theme&&ZL(t.theme),(e=t.styles)!=null&&e.variables&&WL(t.styles.variables),(i=(n=t.styles)==null?void 0:n.css)!=null&&i.fonts&&KL(t.styles.css.fonts))}function lc(){Ko.replaceChildren(),Ko.hidden=!0}function Pp(){As.hidden=!0,g$.textContent="",y$.textContent=""}function Ep(t,e="pending"){Pp(),lc(),Zn.hidden=!1,Zn.textContent=t,Zn.dataset.state=e}function zs(t){Ep(t,"error")}function TE(t){lc(),Zn.hidden=!0,Zn.textContent="",As.hidden=!1;const e=(t==null?void 0:t.trim())||"unknown";g$.textContent="Chart type not available yet",y$.textContent=`"${e}" is not in @fusedashlabs/widgets yet. Supported now: ${SE.join(", ")}.`,As.dataset.chartType=e}function LE(t){Pp(),lc(),Zn.hidden=!0,Zn.dataset.state="ok",t.style.display="block",t.style.width="100%",t.style.height="360px",t.style.minHeight="360px",Ko.appendChild(t),Ko.hidden=!1}function CE(t,e){const n=e&&typeof e=="object"?{...e,chartType:typeof e.chartType=="string"?e.chartType:t}:{chartType:t,data:e},i=document.createElement("ui9000-chart-renderer");i.setAttribute("data",JSON.stringify(n)),i.setAttribute("chart-type",t),i.setAttribute("show-grid",""),i.setAttribute("show-legend",""),i.setAttribute("show-tooltip","");const r=n.name;typeof r=="string"&&r.trim()&&i.setAttribute("chart-title",r.trim()),LE(i)}async function IE(t){const e=kE(t);if(!e)throw new Error("Missing dataUrl for widget render.");const n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch chart data (HTTP ${n.status}). Link may be expired.`);const i=await n.json(),r=t.chartType||"lineChart",o=$E(i);CE(r,o)}async function ME(t){var i;const e=wu(t);if(e.isError){const r=(i=e.content)==null?void 0:i.find(a=>a.type==="text"&&"text"in a),o=r&&r.type==="text"?r.text:"Chart tool failed. Check data size, TTL, or map validation.";zs(o);return}const n=wE(e);if(!AE(n.chartType)){TE(n.chartType);return}try{await IE(n)}catch(r){const o=r instanceof Error?r.message:String(r);zs(o)}}function wu(t){if(!t||typeof t!="object")return{content:[]};const e=t;return Array.isArray(e.content)||e._meta||e.structuredContent||e.isError?e:e.result&&typeof e.result=="object"?wu(e.result):e.params&&typeof e.params=="object"?wu(e.params):e}const Ki=new YL({name:"UI9000 Chart",version:"1.0.0"},{},{autoResize:!0});Ki.ontoolresult=t=>{ME(t)};Ki.ontoolcancelled=t=>{zs(t.reason?`Cancelled: ${t.reason}`:"Chart tool was cancelled.")};Ki.onhostcontextchanged=t=>{v$(t)};Ki.onteardown=async()=>(lc(),Pp(),{});Ep("Connecting…","pending");Ki.connect().then(()=>{v$(Ki.getHostContext()),zE.dataset.connected="true",Ko.hidden&&As.hidden&&Ep("Waiting for chart…","pending")}).catch(t=>{const e=t instanceof Error?t.message:String(t);zs(`MCP Apps handshake failed: ${e}`)});/**
201
+ * @license
202
+ * Copyright 2017 Google LLC
203
+ * SPDX-License-Identifier: BSD-3-Clause
204
+ */const Xt=t=>(e,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};/**
205
+ * @license
206
+ * Copyright 2017 Google LLC
207
+ * SPDX-License-Identifier: BSD-3-Clause
208
+ */const NE={attribute:!0,type:String,converter:ks,reflect:!1,hasChanged:Ip},DE=(t=NE,e,n)=>{const{kind:i,metadata:r}=n;let o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),i==="setter"&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),i==="accessor"){const{name:a}=n;return{set(s){const l=e.get.call(this);e.set.call(this,s),this.requestUpdate(a,l,t,!0,s)},init(s){return s!==void 0&&this.C(a,void 0,t,s),s}}}if(i==="setter"){const{name:a}=n;return function(s){const l=this[a];e.call(this,s),this.requestUpdate(a,l,t,!0,s)}}throw Error("Unsupported decorator location: "+i)};function Y(t){return(e,n)=>typeof n=="object"?DE(t,e,n):((i,r,o)=>{const a=r.hasOwnProperty(o);return r.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(r,o):void 0})(t,e,n)}/**
209
+ * @license
210
+ * Copyright 2017 Google LLC
211
+ * SPDX-License-Identifier: BSD-3-Clause
212
+ */function yt(t){return Y({...t,state:!0,attribute:!1})}function Fp(t,e=1/0){const n=String(t);return!Number.isFinite(e)||e===1/0||n.length<=e?n:`${n.slice(0,e)}...`}function OE(t,e=11,n=25){return!Number.isFinite(t)||t<=0?n:Math.max(3,Math.floor(t/(e*.55)))}function b$(t,e=25,n=11){return t==null?e:Math.min(e,OE(t,n,e))}function PE(t,e){const n=e==null?void 0:e.trim();if(n)return n;const i=Ot(t,null);if(i&&typeof i=="object"&&!Array.isArray(i)){const r=i.name;if(typeof r=="string"&&r.trim())return r.trim()}return""}function EE(t,e,n){return n?PE(e,t):""}function FE(t,e){return{onAxisLabelHover:(n,i)=>{const r=t.getBoundingClientRect();e({x:i.clientX-r.left,y:i.clientY-r.top,text:n})},onAxisLabelLeave:()=>{e(null)}}}function RE(t,e=48){return Fp(t,e)}function jE(t){const e=RE(t.title);return ot`
213
+ <div class="widget-header" part="header">
214
+ <div class="widget-title" part="title" title=${t.title}>
215
+ ${e}
216
+ </div>
217
+ <div class="widget-actions">
218
+ <button
219
+ class="menu-btn"
220
+ part="menu-button"
221
+ type="button"
222
+ aria-label="Chart menu"
223
+ aria-expanded=${t.menuOpen?"true":"false"}
224
+ @click=${t.onMenuToggle}
225
+ >
226
+
227
+ </button>
228
+ ${t.menuOpen?ot`<div class="menu-dropdown" part="menu">
229
+ <button
230
+ class="menu-item"
231
+ type="button"
232
+ @click=${n=>{var i;n.stopPropagation(),(i=t.onDownload)==null||i.call(t),t.onMenuClose()}}
233
+ >
234
+ Download image
235
+ </button>
236
+ </div>`:st}
237
+ </div>
238
+ </div>
239
+ `}function UE(t){return t?ot`<div
240
+ class="label-tooltip"
241
+ part="label-tooltip"
242
+ style="left:${t.x}px;top:${t.y}px"
243
+ >
244
+ ${t.text}
245
+ </div>`:st}function BE(t){t.dispatchEvent(new CustomEvent("ui9000-download",{bubbles:!0,composed:!0}))}var HE=Object.defineProperty,Ta=(t,e,n,i)=>{for(var r=void 0,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=a(e,n,r)||r);return r&&HE(e,n,r),r};class qt extends Vn{constructor(){super(...arguments),this.dataJson="[]",this.chartTitle="",this.showHeader=!0,this._labelTooltip=null,this._menuOpen=!1,this._onDocClick=()=>{this._menuOpen=!1}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._onDocClick)}disconnectedCallback(){document.removeEventListener("click",this._onDocClick),super.disconnectedCallback()}headerTitle(){return EE(this.chartTitle,this.dataJson,this.showHeader)}axisLabelHandlers(){return FE(this,e=>{this._labelTooltip=e})}renderShellHeader(e){return e?jE({title:e,menuOpen:this._menuOpen,onMenuToggle:n=>{n.stopPropagation(),this._menuOpen=!this._menuOpen},onMenuClose:()=>{this._menuOpen=!1},onDownload:()=>BE(this)}):st}renderShellLabelTooltip(){return UE(this._labelTooltip)}}Ta([Y({type:String,attribute:"data"})],qt.prototype,"dataJson");Ta([Y({type:String,attribute:"chart-title"})],qt.prototype,"chartTitle");Ta([Y({type:Boolean,attribute:"show-header"})],qt.prototype,"showHeader");Ta([yt()],qt.prototype,"_labelTooltip");Ta([yt()],qt.prototype,"_menuOpen");function qE(t){if(t.kind==="swatch"){const e=t.opacity??1;return ot`<span
246
+ class="legend-swatch"
247
+ style="background:${t.color};opacity:${e}"
248
+ ></span>`}return t.kind==="dashed-line"?ot`<span
249
+ class="legend-line legend-line--dashed"
250
+ style="--legend-color:${t.color}"
251
+ ></span>`:ot`<span
252
+ class="legend-line"
253
+ style="--legend-color:${t.color}"
254
+ ><span class="legend-dot" style="background:${t.color}"></span></span>`}function ce(t){return t.length?ot`
255
+ <div class="chart-legend" part="legend">
256
+ ${t.map(e=>ot`
257
+ <span class="legend-item">
258
+ ${qE(e.swatch)}
259
+ <span class="legend-label">${e.label}</span>
260
+ </span>
261
+ `)}
262
+ </div>
263
+ `:st}const Fr={primary:"--ui9000-color-primary",secondary:"--ui9000-color-secondary",background:"--ui9000-color-background",grid:"--ui9000-color-grid",text:"--ui9000-color-text",textMuted:"--ui9000-color-text-muted",fontFamily:"--ui9000-font-family",styleId:"--ui9000-style-id",mode:"--ui9000-mode"};function Rr(t,e,n){return getComputedStyle(t).getPropertyValue(e).trim()||n}function wt(t){return{primary:Rr(t,Fr.primary,Dn.primary),secondary:Rr(t,Fr.secondary,Dn.secondary),background:Rr(t,Fr.background,Dn.background),grid:Rr(t,Fr.grid,Dn.grid),text:Rr(t,Fr.text,Dn.text),textMuted:Rr(t,Fr.textMuted,Dn.textMuted),fontFamily:Rr(t,Fr.fontFamily,Dn.fontFamily)}}function ft(t){if(Array.isArray(t)){const e=t[0];return e!=null&&String(e)!==""?String(e):void 0}if(!(t==null||t===""))return String(t)}function Ht(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return Array.isArray(e.data)}function x$(t){const e=ft(t.groupBy??void 0);return e||(t.uniqueValues?Object.keys(t.uniqueValues):[])[0]}function se(t){return Array.isArray(t.data)?t.data.filter(e=>!!e&&typeof e=="object"&&!Array.isArray(e)):[]}function ci(t){return t.filter(e=>e!=null&&e!==""&&e!=="null"&&e!=="undefined")}function me(t,e,n){var i;const r=new Set(t),o=n&&((i=e==null?void 0:e[n])!=null&&i.length)?ci(e[n].map(String)):null;if(o!=null&&o.length){const l=o.filter(c=>r.has(c));for(const c of r)l.includes(c)||l.push(c);return l}const a=new Set,s=[];for(const l of t)a.has(l)||(a.add(l),s.push(l));return s}function an(t){var e,n;const i=ft(t.xAxe??void 0);if(!(!i||!((n=(e=t.uniqueValues)==null?void 0:e[i])!=null&&n.length)))return ci(t.uniqueValues[i].map(String))}function po(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function ui(t,e){return t.map((n,i)=>({label:n.name??n.id,swatch:{kind:"line",color:po(n,i,e)}}))}function Nr(t,e,n){return t.map((i,r)=>({label:i,swatch:{kind:"swatch",color:(n==null?void 0:n(i,r))??po({},r,e),opacity:.8}}))}function re(t){for(const e of t.keys())if(!(typeof e=="string"&&e.startsWith("_")))return!0;return!1}function GE(t){return t}var Ec=1,ls=2,ku=3,So=4,Am=1e-6;function VE(t){return"translate("+t+",0)"}function ZE(t){return"translate(0,"+t+")"}function WE(t){return e=>+t(e)}function KE(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function YE(){return!this.__axis}function Rp(t,e){var n=[],i=null,r=null,o=6,a=6,s=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=t===Ec||t===So?-1:1,u=t===So||t===ls?"x":"y",d=t===Ec||t===ku?VE:ZE;function h(p){var m=i??(e.ticks?e.ticks.apply(e,n):e.domain()),v=r??(e.tickFormat?e.tickFormat.apply(e,n):GE),b=Math.max(o,0)+s,g=e.range(),$=+g[0]+l,_=+g[g.length-1]+l,y=(e.bandwidth?KE:WE)(e.copy(),l),S=p.selection?p.selection():p,w=S.selectAll(".domain").data([null]),L=S.selectAll(".tick").data(m,e).order(),N=L.exit(),E=L.enter().append("g").attr("class","tick"),H=L.select("line"),F=L.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),L=L.merge(E),H=H.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),F=F.merge(E.append("text").attr("fill","currentColor").attr(u,c*b).attr("dy",t===Ec?"0em":t===ku?"0.71em":"0.32em")),p!==S&&(w=w.transition(p),L=L.transition(p),H=H.transition(p),F=F.transition(p),N=N.transition(p).attr("opacity",Am).attr("transform",function(W){return isFinite(W=y(W))?d(W+l):this.getAttribute("transform")}),E.attr("opacity",Am).attr("transform",function(W){var M=this.parentNode.__axis;return d((M&&isFinite(M=M(W))?M:y(W))+l)})),N.remove(),w.attr("d",t===So||t===ls?a?"M"+c*a+","+$+"H"+l+"V"+_+"H"+c*a:"M"+l+","+$+"V"+_:a?"M"+$+","+c*a+"V"+l+"H"+_+"V"+c*a:"M"+$+","+l+"H"+_),L.attr("opacity",1).attr("transform",function(W){return d(y(W)+l)}),H.attr(u+"2",c*o),F.attr(u,c*b).text(v),S.filter(YE).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===ls?"start":t===So?"end":"middle"),S.each(function(){this.__axis=y})}return h.scale=function(p){return arguments.length?(e=p,h):e},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(p){return arguments.length?(n=p==null?[]:Array.from(p),h):n.slice()},h.tickValues=function(p){return arguments.length?(i=p==null?null:Array.from(p),h):i&&i.slice()},h.tickFormat=function(p){return arguments.length?(r=p,h):r},h.tickSize=function(p){return arguments.length?(o=a=+p,h):o},h.tickSizeInner=function(p){return arguments.length?(o=+p,h):o},h.tickSizeOuter=function(p){return arguments.length?(a=+p,h):a},h.tickPadding=function(p){return arguments.length?(s=+p,h):s},h.offset=function(p){return arguments.length?(l=+p,h):l},h}function zm(t){return Rp(ls,t)}function ae(t){return Rp(ku,t)}function Jt(t){return Rp(So,t)}function cs(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function JE(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function jp(t){let e,n,i;t.length!==2?(e=cs,n=(s,l)=>cs(t(s),l),i=(s,l)=>t(s)-l):(e=t===cs||t===JE?t:XE,n=t,i=t);function r(s,l,c=0,u=s.length){if(c<u){if(e(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<0?c=d+1:u=d}while(c<u)}return c}function o(s,l,c=0,u=s.length){if(c<u){if(e(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<=0?c=d+1:u=d}while(c<u)}return c}function a(s,l,c=0,u=s.length){const d=r(s,l,c,u-1);return d>c&&i(s[d-1],l)>-i(s[d],l)?d-1:d}return{left:r,center:a,right:o}}function XE(){return 0}function QE(t){return t===null?NaN:+t}const tF=jp(cs),eF=tF.right;jp(QE).center;class Tm extends Map{constructor(e,n=iF){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[i,r]of e)this.set(i,r)}get(e){return super.get(Lm(this,e))}has(e){return super.has(Lm(this,e))}set(e,n){return super.set(rF(this,e),n)}delete(e){return super.delete(nF(this,e))}}function Lm({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function rF({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}function nF({_intern:t,_key:e},n){const i=e(n);return t.has(i)&&(n=t.get(i),t.delete(i)),n}function iF(t){return t!==null&&typeof t=="object"?t.valueOf():t}const oF=Math.sqrt(50),aF=Math.sqrt(10),sF=Math.sqrt(2);function Ts(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=oF?10:o>=aF?5:o>=sF?2:1;let s,l,c;return r<0?(c=Math.pow(10,-r)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?Ts(t,e,n*2):[s,l,c]}function lF(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const i=e<t,[r,o,a]=i?Ts(e,t,n):Ts(t,e,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let c=0;c<s;++c)l[c]=(o-c)/-a;else for(let c=0;c<s;++c)l[c]=(o-c)*a;else if(a<0)for(let c=0;c<s;++c)l[c]=(r+c)/-a;else for(let c=0;c<s;++c)l[c]=(r+c)*a;return l}function Su(t,e,n){return e=+e,t=+t,n=+n,Ts(t,e,n)[2]}function Au(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?Su(e,t,n):Su(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function cF(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(r);++i<r;)o[i]=t+i*n;return o}function cc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}const Cm=Symbol("implicit");function _$(){var t=new Tm,e=[],n=[],i=Cm;function r(o){let a=t.get(o);if(a===void 0){if(i!==Cm)return i;t.set(o,a=e.push(o)-1)}return n[a%n.length]}return r.domain=function(o){if(!arguments.length)return e.slice();e=[],t=new Tm;for(const a of o)t.has(a)||t.set(a,e.push(a)-1);return r},r.range=function(o){return arguments.length?(n=Array.from(o),r):n.slice()},r.unknown=function(o){return arguments.length?(i=o,r):i},r.copy=function(){return _$(e,n).unknown(i)},cc.apply(r,arguments),r}function de(){var t=_$().unknown(void 0),e=t.domain,n=t.range,i=0,r=1,o,a,s=!1,l=0,c=0,u=.5;delete t.unknown;function d(){var h=e().length,p=r<i,m=p?r:i,v=p?i:r;o=(v-m)/Math.max(1,h-l+c*2),s&&(o=Math.floor(o)),m+=(v-m-o*(h-l))*u,a=o*(1-l),s&&(m=Math.round(m),a=Math.round(a));var b=cF(h).map(function(g){return m+o*g});return n(p?b.reverse():b)}return t.domain=function(h){return arguments.length?(e(h),d()):e()},t.range=function(h){return arguments.length?([i,r]=h,i=+i,r=+r,d()):[i,r]},t.rangeRound=function(h){return[i,r]=h,i=+i,r=+r,s=!0,d()},t.bandwidth=function(){return a},t.step=function(){return o},t.round=function(h){return arguments.length?(s=!!h,d()):s},t.padding=function(h){return arguments.length?(l=Math.min(1,c=+h),d()):l},t.paddingInner=function(h){return arguments.length?(l=Math.min(1,h),d()):l},t.paddingOuter=function(h){return arguments.length?(c=+h,d()):c},t.align=function(h){return arguments.length?(u=Math.max(0,Math.min(1,h)),d()):u},t.copy=function(){return de(e(),[i,r]).round(s).paddingInner(l).paddingOuter(c).align(u)},cc.apply(d(),arguments)}function $$(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return $$(e())},t}function uF(){return $$(de.apply(null,arguments).paddingInner(1))}function Up(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function w$(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function La(){}var Yo=.7,Ls=1/Yo,Mi="\\s*([+-]?\\d+)\\s*",Jo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ur="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dF=/^#([0-9a-f]{3,8})$/,hF=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),pF=new RegExp(`^rgb\\(${Ur},${Ur},${Ur}\\)$`),fF=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${Jo}\\)$`),mF=new RegExp(`^rgba\\(${Ur},${Ur},${Ur},${Jo}\\)$`),gF=new RegExp(`^hsl\\(${Jo},${Ur},${Ur}\\)$`),yF=new RegExp(`^hsla\\(${Jo},${Ur},${Ur},${Jo}\\)$`),Im={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Up(La,ti,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mm,formatHex:Mm,formatHex8:vF,formatHsl:bF,formatRgb:Nm,toString:Nm});function Mm(){return this.rgb().formatHex()}function vF(){return this.rgb().formatHex8()}function bF(){return k$(this).formatHsl()}function Nm(){return this.rgb().formatRgb()}function ti(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=dF.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Dm(e):n===3?new Be(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Ga(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Ga(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=hF.exec(t))?new Be(e[1],e[2],e[3],1):(e=pF.exec(t))?new Be(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fF.exec(t))?Ga(e[1],e[2],e[3],e[4]):(e=mF.exec(t))?Ga(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=gF.exec(t))?Em(e[1],e[2]/100,e[3]/100,1):(e=yF.exec(t))?Em(e[1],e[2]/100,e[3]/100,e[4]):Im.hasOwnProperty(t)?Dm(Im[t]):t==="transparent"?new Be(NaN,NaN,NaN,0):null}function Dm(t){return new Be(t>>16&255,t>>8&255,t&255,1)}function Ga(t,e,n,i){return i<=0&&(t=e=n=NaN),new Be(t,e,n,i)}function xF(t){return t instanceof La||(t=ti(t)),t?(t=t.rgb(),new Be(t.r,t.g,t.b,t.opacity)):new Be}function zu(t,e,n,i){return arguments.length===1?xF(t):new Be(t,e,n,i??1)}function Be(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Up(Be,zu,w$(La,{brighter(t){return t=t==null?Ls:Math.pow(Ls,t),new Be(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Yo:Math.pow(Yo,t),new Be(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Be(Wn(this.r),Wn(this.g),Wn(this.b),Cs(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Om,formatHex:Om,formatHex8:_F,formatRgb:Pm,toString:Pm}));function Om(){return`#${Un(this.r)}${Un(this.g)}${Un(this.b)}`}function _F(){return`#${Un(this.r)}${Un(this.g)}${Un(this.b)}${Un((isNaN(this.opacity)?1:this.opacity)*255)}`}function Pm(){const t=Cs(this.opacity);return`${t===1?"rgb(":"rgba("}${Wn(this.r)}, ${Wn(this.g)}, ${Wn(this.b)}${t===1?")":`, ${t})`}`}function Cs(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Wn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Un(t){return t=Wn(t),(t<16?"0":"")+t.toString(16)}function Em(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new $r(t,e,n,i)}function k$(t){if(t instanceof $r)return new $r(t.h,t.s,t.l,t.opacity);if(t instanceof La||(t=ti(t)),!t)return new $r;if(t instanceof $r)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(e===o?a=(n-i)/s+(n<i)*6:n===o?a=(i-e)/s+2:a=(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new $r(a,s,l,t.opacity)}function $F(t,e,n,i){return arguments.length===1?k$(t):new $r(t,e,n,i??1)}function $r(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Up($r,$F,w$(La,{brighter(t){return t=t==null?Ls:Math.pow(Ls,t),new $r(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Yo:Math.pow(Yo,t),new $r(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Be(Fc(t>=240?t-240:t+120,r,i),Fc(t,r,i),Fc(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new $r(Fm(this.h),Va(this.s),Va(this.l),Cs(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Cs(this.opacity);return`${t===1?"hsl(":"hsla("}${Fm(this.h)}, ${Va(this.s)*100}%, ${Va(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Fm(t){return t=(t||0)%360,t<0?t+360:t}function Va(t){return Math.max(0,Math.min(1,t||0))}function Fc(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Bp=t=>()=>t;function wF(t,e){return function(n){return t+n*e}}function kF(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function SF(t){return(t=+t)==1?S$:function(e,n){return n-e?kF(e,n,t):Bp(isNaN(e)?n:e)}}function S$(t,e){var n=e-t;return n?wF(t,n):Bp(isNaN(t)?e:t)}const Is=function t(e){var n=SF(e);function i(r,o){var a=n((r=zu(r)).r,(o=zu(o)).r),s=n(r.g,o.g),l=n(r.b,o.b),c=S$(r.opacity,o.opacity);return function(u){return r.r=a(u),r.g=s(u),r.b=l(u),r.opacity=c(u),r+""}}return i.gamma=t,i}(1);function AF(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function zF(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function TF(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n),a;for(a=0;a<i;++a)r[a]=Hp(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(s){for(a=0;a<i;++a)o[a]=r[a](s);return o}}function LF(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function _r(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function CF(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=Hp(t[r],e[r]):i[r]=e[r];return function(o){for(r in n)i[r]=n[r](o);return i}}var Tu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rc=new RegExp(Tu.source,"g");function IF(t){return function(){return t}}function MF(t){return function(e){return t(e)+""}}function A$(t,e){var n=Tu.lastIndex=Rc.lastIndex=0,i,r,o,a=-1,s=[],l=[];for(t=t+"",e=e+"";(i=Tu.exec(t))&&(r=Rc.exec(e));)(o=r.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(i=i[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:_r(i,r)})),n=Rc.lastIndex;return n<e.length&&(o=e.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?l[0]?MF(l[0].x):IF(e):(e=l.length,function(c){for(var u=0,d;u<e;++u)s[(d=l[u]).i]=d.x(c);return s.join("")})}function Hp(t,e){var n=typeof e,i;return e==null||n==="boolean"?Bp(e):(n==="number"?_r:n==="string"?(i=ti(e))?(e=i,Is):A$:e instanceof ti?Is:e instanceof Date?LF:zF(e)?AF:Array.isArray(e)?TF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?CF:_r)(t,e)}function NF(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Rm=180/Math.PI,Lu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function z$(t,e,n,i,r,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,l/=s),t*i<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:r,translateY:o,rotate:Math.atan2(e,t)*Rm,skewX:Math.atan(l)*Rm,scaleX:a,scaleY:s}}var Za;function DF(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Lu:z$(e.a,e.b,e.c,e.d,e.e,e.f)}function OF(t){return t==null||(Za||(Za=document.createElementNS("http://www.w3.org/2000/svg","g")),Za.setAttribute("transform",t),!(t=Za.transform.baseVal.consolidate()))?Lu:(t=t.matrix,z$(t.a,t.b,t.c,t.d,t.e,t.f))}function T$(t,e,n,i){function r(c){return c.length?c.pop()+" ":""}function o(c,u,d,h,p,m){if(c!==d||u!==h){var v=p.push("translate(",null,e,null,n);m.push({i:v-4,x:_r(c,d)},{i:v-2,x:_r(u,h)})}else(d||h)&&p.push("translate("+d+e+h+n)}function a(c,u,d,h){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),h.push({i:d.push(r(d)+"rotate(",null,i)-2,x:_r(c,u)})):u&&d.push(r(d)+"rotate("+u+i)}function s(c,u,d,h){c!==u?h.push({i:d.push(r(d)+"skewX(",null,i)-2,x:_r(c,u)}):u&&d.push(r(d)+"skewX("+u+i)}function l(c,u,d,h,p,m){if(c!==d||u!==h){var v=p.push(r(p)+"scale(",null,",",null,")");m.push({i:v-4,x:_r(c,d)},{i:v-2,x:_r(u,h)})}else(d!==1||h!==1)&&p.push(r(p)+"scale("+d+","+h+")")}return function(c,u){var d=[],h=[];return c=t(c),u=t(u),o(c.translateX,c.translateY,u.translateX,u.translateY,d,h),a(c.rotate,u.rotate,d,h),s(c.skewX,u.skewX,d,h),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,h),c=u=null,function(p){for(var m=-1,v=h.length,b;++m<v;)d[(b=h[m]).i]=b.x(p);return d.join("")}}}var PF=T$(DF,"px, ","px)","deg)"),EF=T$(OF,", ",")",")"),FF=1e-12;function jm(t){return((t=Math.exp(t))+1/t)/2}function RF(t){return((t=Math.exp(t))-1/t)/2}function jF(t){return((t=Math.exp(2*t))-1)/(t+1)}const UF=function t(e,n,i){function r(o,a){var s=o[0],l=o[1],c=o[2],u=a[0],d=a[1],h=a[2],p=u-s,m=d-l,v=p*p+m*m,b,g;if(v<FF)g=Math.log(h/c)/e,b=function(L){return[s+L*p,l+L*m,c*Math.exp(e*L*g)]};else{var $=Math.sqrt(v),_=(h*h-c*c+i*v)/(2*c*n*$),y=(h*h-c*c-i*v)/(2*h*n*$),S=Math.log(Math.sqrt(_*_+1)-_),w=Math.log(Math.sqrt(y*y+1)-y);g=(w-S)/e,b=function(L){var N=L*g,E=jm(S),H=c/(n*$)*(E*jF(e*N+S)-RF(S));return[s+H*p,l+H*m,c*E/jm(e*N+S)]}}return b.duration=g*1e3*e/Math.SQRT2,b}return r.rho=function(o){var a=Math.max(.001,+o),s=a*a,l=s*s;return t(a,s,l)},r}(Math.SQRT2,2,4);function BF(t){return function(){return t}}function HF(t){return+t}var Um=[0,1];function Ti(t){return t}function Cu(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:BF(isNaN(e)?NaN:.5)}function qF(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function GF(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r<i?(i=Cu(r,i),o=n(a,o)):(i=Cu(i,r),o=n(o,a)),function(s){return o(i(s))}}function VF(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Cu(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(s){var l=eF(t,s,1,i)-1;return o[l](r[l](s))}}function L$(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ZF(){var t=Um,e=Um,n=Hp,i,r,o,a=Ti,s,l,c;function u(){var h=Math.min(t.length,e.length);return a!==Ti&&(a=qF(t[0],t[h-1])),s=h>2?VF:GF,l=c=null,d}function d(h){return h==null||isNaN(h=+h)?o:(l||(l=s(t.map(i),e,n)))(i(a(h)))}return d.invert=function(h){return a(r((c||(c=s(e,t.map(i),_r)))(h)))},d.domain=function(h){return arguments.length?(t=Array.from(h,HF),u()):t.slice()},d.range=function(h){return arguments.length?(e=Array.from(h),u()):e.slice()},d.rangeRound=function(h){return e=Array.from(h),n=NF,u()},d.clamp=function(h){return arguments.length?(a=h?!0:Ti,u()):a!==Ti},d.interpolate=function(h){return arguments.length?(n=h,u()):n},d.unknown=function(h){return arguments.length?(o=h,d):o},function(h,p){return i=h,r=p,u()}}function C$(){return ZF()(Ti,Ti)}function WF(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ms(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Yi(t){return t=Ms(Math.abs(t)),t?t[1]:NaN}function KF(t,e){return function(n,i){for(var r=n.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(n.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(e)}}function YF(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var JF=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ns(t){if(!(e=JF.exec(t)))throw new Error("invalid format: "+t);var e;return new qp({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Ns.prototype=qp.prototype;function qp(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}qp.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function XF(t){t:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break t;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var I$;function QF(t,e){var n=Ms(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(I$=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Ms(t,Math.max(0,e+o-1))[0]}function Bm(t,e){var n=Ms(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const Hm={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:WF,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Bm(t*100,e),r:Bm,s:QF,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function qm(t){return t}var Gm=Array.prototype.map,Vm=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tR(t){var e=t.grouping===void 0||t.thousands===void 0?qm:KF(Gm.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?qm:YF(Gm.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(d){d=Ns(d);var h=d.fill,p=d.align,m=d.sign,v=d.symbol,b=d.zero,g=d.width,$=d.comma,_=d.precision,y=d.trim,S=d.type;S==="n"?($=!0,S="g"):Hm[S]||(_===void 0&&(_=12),y=!0,S="g"),(b||h==="0"&&p==="=")&&(b=!0,h="0",p="=");var w=v==="$"?n:v==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",L=v==="$"?i:/[%p]/.test(S)?a:"",N=Hm[S],E=/[defgprs%]/.test(S);_=_===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function H(F){var W=w,M=L,z,T,C;if(S==="c")M=N(F)+M,F="";else{F=+F;var k=F<0||1/F<0;if(F=isNaN(F)?l:N(Math.abs(F),_),y&&(F=XF(F)),k&&+F==0&&m!=="+"&&(k=!1),W=(k?m==="("?m:s:m==="-"||m==="("?"":m)+W,M=(S==="s"?Vm[8+I$/3]:"")+M+(k&&m==="("?")":""),E){for(z=-1,T=F.length;++z<T;)if(C=F.charCodeAt(z),48>C||C>57){M=(C===46?r+F.slice(z+1):F.slice(z))+M,F=F.slice(0,z);break}}}$&&!b&&(F=e(F,1/0));var x=W.length+F.length+M.length,A=x<g?new Array(g-x+1).join(h):"";switch($&&b&&(F=e(A+F,A.length?g-M.length:1/0),A=""),p){case"<":F=W+F+M+A;break;case"=":F=W+A+F+M;break;case"^":F=A.slice(0,x=A.length>>1)+W+F+M+A.slice(x);break;default:F=A+W+F+M;break}return o(F)}return H.toString=function(){return d+""},H}function u(d,h){var p=c((d=Ns(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(Yi(h)/3)))*3,v=Math.pow(10,-m),b=Vm[8+m/3];return function(g){return p(v*g)+b}}return{format:c,formatPrefix:u}}var Wa,M$,N$;eR({thousands:",",grouping:[3],currency:["$",""]});function eR(t){return Wa=tR(t),M$=Wa.format,N$=Wa.formatPrefix,Wa}function rR(t){return Math.max(0,-Yi(Math.abs(t)))}function nR(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Yi(e)/3)))*3-Yi(Math.abs(t)))}function iR(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Yi(e)-Yi(t))+1}function oR(t,e,n,i){var r=Au(t,e,n),o;switch(i=Ns(i??",f"),i.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(o=nR(r,a))&&(i.precision=o),N$(i,a)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=iR(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=rR(r))&&(i.precision=o-(i.type==="%")*2);break}}return M$(i)}function aR(t){var e=t.domain;return t.ticks=function(n){var i=e();return lF(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return oR(r[0],r[r.length-1],n??10,i)},t.nice=function(n){n==null&&(n=10);var i=e(),r=0,o=i.length-1,a=i[r],s=i[o],l,c,u=10;for(s<a&&(c=a,a=s,s=c,c=r,r=o,o=c);u-- >0;){if(c=Su(a,s,n),c===l)return i[r]=a,i[o]=s,e(i);if(c>0)a=Math.floor(a/c)*c,s=Math.ceil(s/c)*c;else if(c<0)a=Math.ceil(a*c)/c,s=Math.floor(s*c)/c;else break;l=c}return t},t}function Ft(){var t=C$();return t.copy=function(){return L$(t,Ft())},cc.apply(t,arguments),aR(t)}function sR(t,e){t=t.slice();var n=0,i=t.length-1,r=t[n],o=t[i],a;return o<r&&(a=n,n=i,i=a,a=r,r=o,o=a),t[n]=e.floor(r),t[i]=e.ceil(o),t}const jc=new Date,Uc=new Date;function ye(t,e,n,i){function r(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return r.floor=o=>(t(o=new Date(+o)),o),r.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),r.round=o=>{const a=r(o),s=r.ceil(o);return o-a<s-o?a:s},r.offset=(o,a)=>(e(o=new Date(+o),a==null?1:Math.floor(a)),o),r.range=(o,a,s)=>{const l=[];if(o=r.ceil(o),s=s==null?1:Math.floor(s),!(o<a)||!(s>0))return l;let c;do l.push(c=new Date(+o)),e(o,s),t(o);while(c<o&&o<a);return l},r.filter=o=>ye(a=>{if(a>=a)for(;t(a),!o(a);)a.setTime(a-1)},(a,s)=>{if(a>=a)if(s<0)for(;++s<=0;)for(;e(a,-1),!o(a););else for(;--s>=0;)for(;e(a,1),!o(a););}),n&&(r.count=(o,a)=>(jc.setTime(+o),Uc.setTime(+a),t(jc),t(Uc),Math.floor(n(jc,Uc))),r.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?r.filter(i?a=>i(a)%o===0:a=>r.count(0,a)%o===0):r)),r}const Ds=ye(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ds.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ye(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Ds);Ds.range;const Xr=1e3,ar=Xr*60,Qr=ar*60,en=Qr*24,Gp=en*7,Zm=en*30,Bc=en*365,Li=ye(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Xr)},(t,e)=>(e-t)/Xr,t=>t.getUTCSeconds());Li.range;const Vp=ye(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Xr)},(t,e)=>{t.setTime(+t+e*ar)},(t,e)=>(e-t)/ar,t=>t.getMinutes());Vp.range;const lR=ye(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ar)},(t,e)=>(e-t)/ar,t=>t.getUTCMinutes());lR.range;const Zp=ye(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Xr-t.getMinutes()*ar)},(t,e)=>{t.setTime(+t+e*Qr)},(t,e)=>(e-t)/Qr,t=>t.getHours());Zp.range;const cR=ye(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Qr)},(t,e)=>(e-t)/Qr,t=>t.getUTCHours());cR.range;const Ca=ye(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ar)/en,t=>t.getDate()-1);Ca.range;const Wp=ye(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/en,t=>t.getUTCDate()-1);Wp.range;const uR=ye(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/en,t=>Math.floor(t/en));uR.range;function di(t){return ye(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ar)/Gp)}const uc=di(0),Os=di(1),dR=di(2),hR=di(3),Ji=di(4),pR=di(5),fR=di(6);uc.range;Os.range;dR.range;hR.range;Ji.range;pR.range;fR.range;function hi(t){return ye(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Gp)}const D$=hi(0),Ps=hi(1),mR=hi(2),gR=hi(3),Xi=hi(4),yR=hi(5),vR=hi(6);D$.range;Ps.range;mR.range;gR.range;Xi.range;yR.range;vR.range;const Kp=ye(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Kp.range;const bR=ye(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());bR.range;const rn=ye(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());rn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ye(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});rn.range;const ei=ye(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ei.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ye(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});ei.range;function xR(t,e,n,i,r,o){const a=[[Li,1,Xr],[Li,5,5*Xr],[Li,15,15*Xr],[Li,30,30*Xr],[o,1,ar],[o,5,5*ar],[o,15,15*ar],[o,30,30*ar],[r,1,Qr],[r,3,3*Qr],[r,6,6*Qr],[r,12,12*Qr],[i,1,en],[i,2,2*en],[n,1,Gp],[e,1,Zm],[e,3,3*Zm],[t,1,Bc]];function s(c,u,d){const h=u<c;h&&([c,u]=[u,c]);const p=d&&typeof d.range=="function"?d:l(c,u,d),m=p?p.range(c,+u+1):[];return h?m.reverse():m}function l(c,u,d){const h=Math.abs(u-c)/d,p=jp(([,,b])=>b).right(a,h);if(p===a.length)return t.every(Au(c/Bc,u/Bc,d));if(p===0)return Ds.every(Math.max(Au(c,u,d),1));const[m,v]=a[h/a[p-1][2]<a[p][2]/h?p-1:p];return m.every(v)}return[s,l]}const[_R,$R]=xR(rn,Kp,uc,Ca,Zp,Vp);function Hc(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function qc(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function vo(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function wR(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=bo(r),u=xo(r),d=bo(o),h=xo(o),p=bo(a),m=xo(a),v=bo(s),b=xo(s),g=bo(l),$=xo(l),_={a:k,A:x,b:A,B:D,c:null,d:Qm,e:Qm,f:VR,g:r4,G:i4,H:HR,I:qR,j:GR,L:O$,m:ZR,M:WR,p:R,q:B,Q:rg,s:ng,S:KR,u:YR,U:JR,V:XR,w:QR,W:t4,x:null,X:null,y:e4,Y:n4,Z:o4,"%":eg},y={a:X,A:et,b:K,B:at,c:null,d:tg,e:tg,f:c4,g:b4,G:_4,H:a4,I:s4,j:l4,L:E$,m:u4,M:d4,p:nt,q:tt,Q:rg,s:ng,S:h4,u:p4,U:f4,V:m4,w:g4,W:y4,x:null,X:null,y:v4,Y:x4,Z:$4,"%":eg},S={a:H,A:F,b:W,B:M,c:z,d:Jm,e:Jm,f:RR,g:Ym,G:Km,H:Xm,I:Xm,j:OR,L:FR,m:DR,M:PR,p:E,q:NR,Q:UR,s:BR,S:ER,u:TR,U:LR,V:CR,w:zR,W:IR,x:T,X:C,y:Ym,Y:Km,Z:MR,"%":jR};_.x=w(n,_),_.X=w(i,_),_.c=w(e,_),y.x=w(n,y),y.X=w(i,y),y.c=w(e,y);function w(j,I){return function(V){var U=[],O=-1,P=0,J=j.length,rt,it,lt;for(V instanceof Date||(V=new Date(+V));++O<J;)j.charCodeAt(O)===37&&(U.push(j.slice(P,O)),(it=Wm[rt=j.charAt(++O)])!=null?rt=j.charAt(++O):it=rt==="e"?" ":"0",(lt=I[rt])&&(rt=lt(V,it)),U.push(rt),P=O+1);return U.push(j.slice(P,O)),U.join("")}}function L(j,I){return function(V){var U=vo(1900,void 0,1),O=N(U,j,V+="",0),P,J;if(O!=V.length)return null;if("Q"in U)return new Date(U.Q);if("s"in U)return new Date(U.s*1e3+("L"in U?U.L:0));if(I&&!("Z"in U)&&(U.Z=0),"p"in U&&(U.H=U.H%12+U.p*12),U.m===void 0&&(U.m="q"in U?U.q:0),"V"in U){if(U.V<1||U.V>53)return null;"w"in U||(U.w=1),"Z"in U?(P=qc(vo(U.y,0,1)),J=P.getUTCDay(),P=J>4||J===0?Ps.ceil(P):Ps(P),P=Wp.offset(P,(U.V-1)*7),U.y=P.getUTCFullYear(),U.m=P.getUTCMonth(),U.d=P.getUTCDate()+(U.w+6)%7):(P=Hc(vo(U.y,0,1)),J=P.getDay(),P=J>4||J===0?Os.ceil(P):Os(P),P=Ca.offset(P,(U.V-1)*7),U.y=P.getFullYear(),U.m=P.getMonth(),U.d=P.getDate()+(U.w+6)%7)}else("W"in U||"U"in U)&&("w"in U||(U.w="u"in U?U.u%7:"W"in U?1:0),J="Z"in U?qc(vo(U.y,0,1)).getUTCDay():Hc(vo(U.y,0,1)).getDay(),U.m=0,U.d="W"in U?(U.w+6)%7+U.W*7-(J+5)%7:U.w+U.U*7-(J+6)%7);return"Z"in U?(U.H+=U.Z/100|0,U.M+=U.Z%100,qc(U)):Hc(U)}}function N(j,I,V,U){for(var O=0,P=I.length,J=V.length,rt,it;O<P;){if(U>=J)return-1;if(rt=I.charCodeAt(O++),rt===37){if(rt=I.charAt(O++),it=S[rt in Wm?I.charAt(O++):rt],!it||(U=it(j,V,U))<0)return-1}else if(rt!=V.charCodeAt(U++))return-1}return U}function E(j,I,V){var U=c.exec(I.slice(V));return U?(j.p=u.get(U[0].toLowerCase()),V+U[0].length):-1}function H(j,I,V){var U=p.exec(I.slice(V));return U?(j.w=m.get(U[0].toLowerCase()),V+U[0].length):-1}function F(j,I,V){var U=d.exec(I.slice(V));return U?(j.w=h.get(U[0].toLowerCase()),V+U[0].length):-1}function W(j,I,V){var U=g.exec(I.slice(V));return U?(j.m=$.get(U[0].toLowerCase()),V+U[0].length):-1}function M(j,I,V){var U=v.exec(I.slice(V));return U?(j.m=b.get(U[0].toLowerCase()),V+U[0].length):-1}function z(j,I,V){return N(j,e,I,V)}function T(j,I,V){return N(j,n,I,V)}function C(j,I,V){return N(j,i,I,V)}function k(j){return a[j.getDay()]}function x(j){return o[j.getDay()]}function A(j){return l[j.getMonth()]}function D(j){return s[j.getMonth()]}function R(j){return r[+(j.getHours()>=12)]}function B(j){return 1+~~(j.getMonth()/3)}function X(j){return a[j.getUTCDay()]}function et(j){return o[j.getUTCDay()]}function K(j){return l[j.getUTCMonth()]}function at(j){return s[j.getUTCMonth()]}function nt(j){return r[+(j.getUTCHours()>=12)]}function tt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var I=w(j+="",_);return I.toString=function(){return j},I},parse:function(j){var I=L(j+="",!1);return I.toString=function(){return j},I},utcFormat:function(j){var I=w(j+="",y);return I.toString=function(){return j},I},utcParse:function(j){var I=L(j+="",!0);return I.toString=function(){return j},I}}}var Wm={"-":"",_:" ",0:"0"},_e=/^\s*\d+/,kR=/^%/,SR=/[\\^$*+?|[\]().{}]/g;function Ut(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function AR(t){return t.replace(SR,"\\$&")}function bo(t){return new RegExp("^(?:"+t.map(AR).join("|")+")","i")}function xo(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function zR(t,e,n){var i=_e.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function TR(t,e,n){var i=_e.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function LR(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function CR(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function IR(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Km(t,e,n){var i=_e.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Ym(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function MR(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function NR(t,e,n){var i=_e.exec(e.slice(n,n+1));return i?(t.q=i[0]*3-3,n+i[0].length):-1}function DR(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Jm(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function OR(t,e,n){var i=_e.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function Xm(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function PR(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function ER(t,e,n){var i=_e.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function FR(t,e,n){var i=_e.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function RR(t,e,n){var i=_e.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function jR(t,e,n){var i=kR.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function UR(t,e,n){var i=_e.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function BR(t,e,n){var i=_e.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function Qm(t,e){return Ut(t.getDate(),e,2)}function HR(t,e){return Ut(t.getHours(),e,2)}function qR(t,e){return Ut(t.getHours()%12||12,e,2)}function GR(t,e){return Ut(1+Ca.count(rn(t),t),e,3)}function O$(t,e){return Ut(t.getMilliseconds(),e,3)}function VR(t,e){return O$(t,e)+"000"}function ZR(t,e){return Ut(t.getMonth()+1,e,2)}function WR(t,e){return Ut(t.getMinutes(),e,2)}function KR(t,e){return Ut(t.getSeconds(),e,2)}function YR(t){var e=t.getDay();return e===0?7:e}function JR(t,e){return Ut(uc.count(rn(t)-1,t),e,2)}function P$(t){var e=t.getDay();return e>=4||e===0?Ji(t):Ji.ceil(t)}function XR(t,e){return t=P$(t),Ut(Ji.count(rn(t),t)+(rn(t).getDay()===4),e,2)}function QR(t){return t.getDay()}function t4(t,e){return Ut(Os.count(rn(t)-1,t),e,2)}function e4(t,e){return Ut(t.getFullYear()%100,e,2)}function r4(t,e){return t=P$(t),Ut(t.getFullYear()%100,e,2)}function n4(t,e){return Ut(t.getFullYear()%1e4,e,4)}function i4(t,e){var n=t.getDay();return t=n>=4||n===0?Ji(t):Ji.ceil(t),Ut(t.getFullYear()%1e4,e,4)}function o4(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ut(e/60|0,"0",2)+Ut(e%60,"0",2)}function tg(t,e){return Ut(t.getUTCDate(),e,2)}function a4(t,e){return Ut(t.getUTCHours(),e,2)}function s4(t,e){return Ut(t.getUTCHours()%12||12,e,2)}function l4(t,e){return Ut(1+Wp.count(ei(t),t),e,3)}function E$(t,e){return Ut(t.getUTCMilliseconds(),e,3)}function c4(t,e){return E$(t,e)+"000"}function u4(t,e){return Ut(t.getUTCMonth()+1,e,2)}function d4(t,e){return Ut(t.getUTCMinutes(),e,2)}function h4(t,e){return Ut(t.getUTCSeconds(),e,2)}function p4(t){var e=t.getUTCDay();return e===0?7:e}function f4(t,e){return Ut(D$.count(ei(t)-1,t),e,2)}function F$(t){var e=t.getUTCDay();return e>=4||e===0?Xi(t):Xi.ceil(t)}function m4(t,e){return t=F$(t),Ut(Xi.count(ei(t),t)+(ei(t).getUTCDay()===4),e,2)}function g4(t){return t.getUTCDay()}function y4(t,e){return Ut(Ps.count(ei(t)-1,t),e,2)}function v4(t,e){return Ut(t.getUTCFullYear()%100,e,2)}function b4(t,e){return t=F$(t),Ut(t.getUTCFullYear()%100,e,2)}function x4(t,e){return Ut(t.getUTCFullYear()%1e4,e,4)}function _4(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Xi(t):Xi.ceil(t),Ut(t.getUTCFullYear()%1e4,e,4)}function $4(){return"+0000"}function eg(){return"%"}function rg(t){return+t}function ng(t){return Math.floor(+t/1e3)}var _i,R$;w4({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function w4(t){return _i=wR(t),R$=_i.format,_i.parse,_i.utcFormat,_i.utcParse,_i}function k4(t){return new Date(t)}function S4(t){return t instanceof Date?+t:+new Date(+t)}function j$(t,e,n,i,r,o,a,s,l,c){var u=C$(),d=u.invert,h=u.domain,p=c(".%L"),m=c(":%S"),v=c("%I:%M"),b=c("%I %p"),g=c("%a %d"),$=c("%b %d"),_=c("%B"),y=c("%Y");function S(w){return(l(w)<w?p:s(w)<w?m:a(w)<w?v:o(w)<w?b:i(w)<w?r(w)<w?g:$:n(w)<w?_:y)(w)}return u.invert=function(w){return new Date(d(w))},u.domain=function(w){return arguments.length?h(Array.from(w,S4)):h().map(k4)},u.ticks=function(w){var L=h();return t(L[0],L[L.length-1],w??10)},u.tickFormat=function(w,L){return L==null?S:c(L)},u.nice=function(w){var L=h();return(!w||typeof w.range!="function")&&(w=e(L[0],L[L.length-1],w??10)),w?h(sR(L,w)):u},u.copy=function(){return L$(u,j$(t,e,n,i,r,o,a,s,l,c))},u}function Yp(){return cc.apply(j$(_R,$R,rn,Kp,uc,Ca,Zp,Vp,Li,R$).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var Iu="http://www.w3.org/1999/xhtml";const ig={svg:"http://www.w3.org/2000/svg",xhtml:Iu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function dc(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ig.hasOwnProperty(e)?{space:ig[e],local:t}:t}function A4(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Iu&&e.documentElement.namespaceURI===Iu?e.createElement(t):e.createElementNS(n,t)}}function z4(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function U$(t){var e=dc(t);return(e.local?z4:A4)(e)}function T4(){}function Jp(t){return t==null?T4:function(){return this.querySelector(t)}}function L4(t){typeof t!="function"&&(t=Jp(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],a=o.length,s=i[r]=new Array(a),l,c,u=0;u<a;++u)(l=o[u])&&(c=t.call(l,l.__data__,u,o))&&("__data__"in l&&(c.__data__=l.__data__),s[u]=c);return new Ve(i,this._parents)}function C4(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function I4(){return[]}function B$(t){return t==null?I4:function(){return this.querySelectorAll(t)}}function M4(t){return function(){return C4(t.apply(this,arguments))}}function N4(t){typeof t=="function"?t=M4(t):t=B$(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var a=e[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(i.push(t.call(l,l.__data__,c,a)),r.push(l));return new Ve(i,r)}function H$(t){return function(){return this.matches(t)}}function q$(t){return function(e){return e.matches(t)}}var D4=Array.prototype.find;function O4(t){return function(){return D4.call(this.children,t)}}function P4(){return this.firstElementChild}function E4(t){return this.select(t==null?P4:O4(typeof t=="function"?t:q$(t)))}var F4=Array.prototype.filter;function R4(){return Array.from(this.children)}function j4(t){return function(){return F4.call(this.children,t)}}function U4(t){return this.selectAll(t==null?R4:j4(typeof t=="function"?t:q$(t)))}function B4(t){typeof t!="function"&&(t=H$(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],a=o.length,s=i[r]=[],l,c=0;c<a;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&s.push(l);return new Ve(i,this._parents)}function G$(t){return new Array(t.length)}function H4(){return new Ve(this._enter||this._groups.map(G$),this._parents)}function Es(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Es.prototype={constructor:Es,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function q4(t){return function(){return t}}function G4(t,e,n,i,r,o){for(var a=0,s,l=e.length,c=o.length;a<c;++a)(s=e[a])?(s.__data__=o[a],i[a]=s):n[a]=new Es(t,o[a]);for(;a<l;++a)(s=e[a])&&(r[a]=s)}function V4(t,e,n,i,r,o,a){var s,l,c=new Map,u=e.length,d=o.length,h=new Array(u),p;for(s=0;s<u;++s)(l=e[s])&&(h[s]=p=a.call(l,l.__data__,s,e)+"",c.has(p)?r[s]=l:c.set(p,l));for(s=0;s<d;++s)p=a.call(t,o[s],s,o)+"",(l=c.get(p))?(i[s]=l,l.__data__=o[s],c.delete(p)):n[s]=new Es(t,o[s]);for(s=0;s<u;++s)(l=e[s])&&c.get(h[s])===l&&(r[s]=l)}function Z4(t){return t.__data__}function W4(t,e){if(!arguments.length)return Array.from(this,Z4);var n=e?V4:G4,i=this._parents,r=this._groups;typeof t!="function"&&(t=q4(t));for(var o=r.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=i[c],d=r[c],h=d.length,p=K4(t.call(u,u&&u.__data__,c,i)),m=p.length,v=s[c]=new Array(m),b=a[c]=new Array(m),g=l[c]=new Array(h);n(u,d,v,b,g,p,e);for(var $=0,_=0,y,S;$<m;++$)if(y=v[$]){for($>=_&&(_=$+1);!(S=b[_])&&++_<m;);y._next=S||null}}return a=new Ve(a,i),a._enter=s,a._exit=l,a}function K4(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Y4(){return new Ve(this._exit||this._groups.map(G$),this._parents)}function J4(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function X4(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,a=Math.min(r,o),s=new Array(r),l=0;l<a;++l)for(var c=n[l],u=i[l],d=c.length,h=s[l]=new Array(d),p,m=0;m<d;++m)(p=c[m]||u[m])&&(h[m]=p);for(;l<r;++l)s[l]=n[l];return new Ve(s,this._parents)}function Q4(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],a;--r>=0;)(a=i[r])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function tj(t){t||(t=ej);function e(d,h){return d&&h?t(d.__data__,h.__data__):!d-!h}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var a=n[o],s=a.length,l=r[o]=new Array(s),c,u=0;u<s;++u)(c=a[u])&&(l[u]=c);l.sort(e)}return new Ve(r,this._parents).order()}function ej(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function rj(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function nj(){return Array.from(this)}function ij(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var a=i[r];if(a)return a}return null}function oj(){let t=0;for(const e of this)++t;return t}function aj(){return!this.node()}function sj(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,a=r.length,s;o<a;++o)(s=r[o])&&t.call(s,s.__data__,o,r);return this}function lj(t){return function(){this.removeAttribute(t)}}function cj(t){return function(){this.removeAttributeNS(t.space,t.local)}}function uj(t,e){return function(){this.setAttribute(t,e)}}function dj(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function hj(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function pj(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fj(t,e){var n=dc(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?cj:lj:typeof e=="function"?n.local?pj:hj:n.local?dj:uj)(n,e))}function V$(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mj(t){return function(){this.style.removeProperty(t)}}function gj(t,e,n){return function(){this.style.setProperty(t,e,n)}}function yj(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function vj(t,e,n){return arguments.length>1?this.each((e==null?mj:typeof e=="function"?yj:gj)(t,e,n??"")):Qi(this.node(),t)}function Qi(t,e){return t.style.getPropertyValue(e)||V$(t).getComputedStyle(t,null).getPropertyValue(e)}function bj(t){return function(){delete this[t]}}function xj(t,e){return function(){this[t]=e}}function _j(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function $j(t,e){return arguments.length>1?this.each((e==null?bj:typeof e=="function"?_j:xj)(t,e)):this.node()[t]}function Z$(t){return t.trim().split(/^|\s+/)}function Xp(t){return t.classList||new W$(t)}function W$(t){this._node=t,this._names=Z$(t.getAttribute("class")||"")}W$.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function K$(t,e){for(var n=Xp(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function Y$(t,e){for(var n=Xp(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function wj(t){return function(){K$(this,t)}}function kj(t){return function(){Y$(this,t)}}function Sj(t,e){return function(){(e.apply(this,arguments)?K$:Y$)(this,t)}}function Aj(t,e){var n=Z$(t+"");if(arguments.length<2){for(var i=Xp(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Sj:e?wj:kj)(n,e))}function zj(){this.textContent=""}function Tj(t){return function(){this.textContent=t}}function Lj(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Cj(t){return arguments.length?this.each(t==null?zj:(typeof t=="function"?Lj:Tj)(t)):this.node().textContent}function Ij(){this.innerHTML=""}function Mj(t){return function(){this.innerHTML=t}}function Nj(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Dj(t){return arguments.length?this.each(t==null?Ij:(typeof t=="function"?Nj:Mj)(t)):this.node().innerHTML}function Oj(){this.nextSibling&&this.parentNode.appendChild(this)}function Pj(){return this.each(Oj)}function Ej(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fj(){return this.each(Ej)}function Rj(t){var e=typeof t=="function"?t:U$(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function jj(){return null}function Uj(t,e){var n=typeof t=="function"?t:U$(t),i=e==null?jj:typeof e=="function"?e:Jp(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Bj(){var t=this.parentNode;t&&t.removeChild(this)}function Hj(){return this.each(Bj)}function qj(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Gj(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Vj(t){return this.select(t?Gj:qj)}function Zj(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Wj(t){return function(e){t.call(this,e,this.__data__)}}function Kj(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function Yj(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function Jj(t,e,n){return function(){var i=this.__on,r,o=Wj(e);if(i){for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function Xj(t,e,n){var i=Kj(t+""),r,o=i.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,u;l<c;++l)for(r=0,u=s[l];r<o;++r)if((a=i[r]).type===u.type&&a.name===u.name)return u.value}return}for(s=e?Jj:Yj,r=0;r<o;++r)this.each(s(i[r],e,n));return this}function J$(t,e,n){var i=V$(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Qj(t,e){return function(){return J$(this,t,e)}}function t6(t,e){return function(){return J$(this,t,e.apply(this,arguments))}}function e6(t,e){return this.each((typeof e=="function"?t6:Qj)(t,e))}function*r6(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,a;r<o;++r)(a=i[r])&&(yield a)}var X$=[null];function Ve(t,e){this._groups=t,this._parents=e}function Ia(){return new Ve([[document.documentElement]],X$)}function n6(){return this}Ve.prototype=Ia.prototype={constructor:Ve,select:L4,selectAll:N4,selectChild:E4,selectChildren:U4,filter:B4,data:W4,enter:H4,exit:Y4,join:J4,merge:X4,selection:n6,order:Q4,sort:tj,call:rj,nodes:nj,node:ij,size:oj,empty:aj,each:sj,attr:fj,style:vj,property:$j,classed:Aj,text:Cj,html:Dj,raise:Pj,lower:Fj,append:Rj,insert:Uj,remove:Hj,clone:Vj,datum:Zj,on:Xj,dispatch:e6,[Symbol.iterator]:r6};function ht(t){return typeof t=="string"?new Ve([[document.querySelector(t)]],[document.documentElement]):new Ve([[t]],X$)}function i6(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Ie(t,e){if(t=i6(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}function At(t){return function(){return t}}const og=Math.abs,Te=Math.atan2,Pn=Math.cos,o6=Math.max,Gc=Math.min,Er=Math.sin,wr=Math.sqrt,Le=1e-12,to=Math.PI,Fs=to/2,Oo=2*to;function a6(t){return t>1?0:t<-1?to:Math.acos(t)}function ag(t){return t>=1?Fs:t<=-1?-Fs:Math.asin(t)}const Mu=Math.PI,Nu=2*Mu,Rn=1e-6,s6=Nu-Rn;function Q$(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function l6(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Q$;const n=10**e;return function(i){this._+=i[0];for(let r=1,o=i.length;r<o;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class c6{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Q$:l6(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,i,r){this._append`Q${+e},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(e,n,i,r,o,a){this._append`C${+e},${+n},${+i},${+r},${this._x1=+o},${this._y1=+a}`}arcTo(e,n,i,r,o){if(e=+e,n=+n,i=+i,r=+r,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,l=i-e,c=r-n,u=a-e,d=s-n,h=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(h>Rn)if(!(Math.abs(d*l-c*u)>Rn)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=i-a,m=r-s,v=l*l+c*c,b=p*p+m*m,g=Math.sqrt(v),$=Math.sqrt(h),_=o*Math.tan((Mu-Math.acos((v+h-b)/(2*g*$)))/2),y=_/$,S=_/g;Math.abs(y-1)>Rn&&this._append`L${e+y*u},${n+y*d}`,this._append`A${o},${o},0,0,${+(d*p>u*m)},${this._x1=e+S*l},${this._y1=n+S*c}`}}arc(e,n,i,r,o,a){if(e=+e,n=+n,i=+i,a=!!a,i<0)throw new Error(`negative radius: ${i}`);let s=i*Math.cos(r),l=i*Math.sin(r),c=e+s,u=n+l,d=1^a,h=a?r-o:o-r;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Rn||Math.abs(this._y1-u)>Rn)&&this._append`L${c},${u}`,i&&(h<0&&(h=h%Nu+Nu),h>s6?this._append`A${i},${i},0,1,${d},${e-s},${n-l}A${i},${i},0,1,${d},${this._x1=c},${this._y1=u}`:h>Rn&&this._append`A${i},${i},0,${+(h>=Mu)},${d},${this._x1=e+i*Math.cos(o)},${this._y1=n+i*Math.sin(o)}`)}rect(e,n,i,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function Ma(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);e=i}return t},()=>new c6(e)}function u6(t){return t.innerRadius}function d6(t){return t.outerRadius}function h6(t){return t.startAngle}function p6(t){return t.endAngle}function f6(t){return t&&t.padAngle}function m6(t,e,n,i,r,o,a,s){var l=n-t,c=i-e,u=a-r,d=s-o,h=d*l-u*c;if(!(h*h<Le))return h=(u*(e-o)-d*(t-r))/h,[t+h*l,e+h*c]}function Ka(t,e,n,i,r,o,a){var s=t-n,l=e-i,c=(a?o:-o)/wr(s*s+l*l),u=c*l,d=-c*s,h=t+u,p=e+d,m=n+u,v=i+d,b=(h+m)/2,g=(p+v)/2,$=m-h,_=v-p,y=$*$+_*_,S=r-o,w=h*v-m*p,L=(_<0?-1:1)*wr(o6(0,S*S*y-w*w)),N=(w*_-$*L)/y,E=(-w*$-_*L)/y,H=(w*_+$*L)/y,F=(-w*$+_*L)/y,W=N-b,M=E-g,z=H-b,T=F-g;return W*W+M*M>z*z+T*T&&(N=H,E=F),{cx:N,cy:E,x01:-u,y01:-d,x11:N*(r/S-1),y11:E*(r/S-1)}}function Na(){var t=u6,e=d6,n=At(0),i=null,r=h6,o=p6,a=f6,s=null,l=Ma(c);function c(){var u,d,h=+t.apply(this,arguments),p=+e.apply(this,arguments),m=r.apply(this,arguments)-Fs,v=o.apply(this,arguments)-Fs,b=og(v-m),g=v>m;if(s||(s=u=l()),p<h&&(d=p,p=h,h=d),!(p>Le))s.moveTo(0,0);else if(b>Oo-Le)s.moveTo(p*Pn(m),p*Er(m)),s.arc(0,0,p,m,v,!g),h>Le&&(s.moveTo(h*Pn(v),h*Er(v)),s.arc(0,0,h,v,m,g));else{var $=m,_=v,y=m,S=v,w=b,L=b,N=a.apply(this,arguments)/2,E=N>Le&&(i?+i.apply(this,arguments):wr(h*h+p*p)),H=Gc(og(p-h)/2,+n.apply(this,arguments)),F=H,W=H,M,z;if(E>Le){var T=ag(E/h*Er(N)),C=ag(E/p*Er(N));(w-=T*2)>Le?(T*=g?1:-1,y+=T,S-=T):(w=0,y=S=(m+v)/2),(L-=C*2)>Le?(C*=g?1:-1,$+=C,_-=C):(L=0,$=_=(m+v)/2)}var k=p*Pn($),x=p*Er($),A=h*Pn(S),D=h*Er(S);if(H>Le){var R=p*Pn(_),B=p*Er(_),X=h*Pn(y),et=h*Er(y),K;if(b<to)if(K=m6(k,x,X,et,R,B,A,D)){var at=k-K[0],nt=x-K[1],tt=R-K[0],j=B-K[1],I=1/Er(a6((at*tt+nt*j)/(wr(at*at+nt*nt)*wr(tt*tt+j*j)))/2),V=wr(K[0]*K[0]+K[1]*K[1]);F=Gc(H,(h-V)/(I-1)),W=Gc(H,(p-V)/(I+1))}else F=W=0}L>Le?W>Le?(M=Ka(X,et,k,x,p,W,g),z=Ka(R,B,A,D,p,W,g),s.moveTo(M.cx+M.x01,M.cy+M.y01),W<H?s.arc(M.cx,M.cy,W,Te(M.y01,M.x01),Te(z.y01,z.x01),!g):(s.arc(M.cx,M.cy,W,Te(M.y01,M.x01),Te(M.y11,M.x11),!g),s.arc(0,0,p,Te(M.cy+M.y11,M.cx+M.x11),Te(z.cy+z.y11,z.cx+z.x11),!g),s.arc(z.cx,z.cy,W,Te(z.y11,z.x11),Te(z.y01,z.x01),!g))):(s.moveTo(k,x),s.arc(0,0,p,$,_,!g)):s.moveTo(k,x),!(h>Le)||!(w>Le)?s.lineTo(A,D):F>Le?(M=Ka(A,D,R,B,h,-F,g),z=Ka(k,x,X,et,h,-F,g),s.lineTo(M.cx+M.x01,M.cy+M.y01),F<H?s.arc(M.cx,M.cy,F,Te(M.y01,M.x01),Te(z.y01,z.x01),!g):(s.arc(M.cx,M.cy,F,Te(M.y01,M.x01),Te(M.y11,M.x11),!g),s.arc(0,0,h,Te(M.cy+M.y11,M.cx+M.x11),Te(z.cy+z.y11,z.cx+z.x11),g),s.arc(z.cx,z.cy,F,Te(z.y11,z.x11),Te(z.y01,z.x01),!g))):s.arc(0,0,h,S,y,g)}if(s.closePath(),u)return s=null,u+""||null}return c.centroid=function(){var u=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,d=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-to/2;return[Pn(d)*u,Er(d)*u]},c.innerRadius=function(u){return arguments.length?(t=typeof u=="function"?u:At(+u),c):t},c.outerRadius=function(u){return arguments.length?(e=typeof u=="function"?u:At(+u),c):e},c.cornerRadius=function(u){return arguments.length?(n=typeof u=="function"?u:At(+u),c):n},c.padRadius=function(u){return arguments.length?(i=u==null?null:typeof u=="function"?u:At(+u),c):i},c.startAngle=function(u){return arguments.length?(r=typeof u=="function"?u:At(+u),c):r},c.endAngle=function(u){return arguments.length?(o=typeof u=="function"?u:At(+u),c):o},c.padAngle=function(u){return arguments.length?(a=typeof u=="function"?u:At(+u),c):a},c.context=function(u){return arguments.length?(s=u??null,c):s},c}var g6=Array.prototype.slice;function hc(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function tw(t){this._context=t}tw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function eo(t){return new tw(t)}function Qp(t){return t[0]}function tf(t){return t[1]}function lr(t,e){var n=At(!0),i=null,r=eo,o=null,a=Ma(s);t=typeof t=="function"?t:t===void 0?Qp:At(t),e=typeof e=="function"?e:e===void 0?tf:At(e);function s(l){var c,u=(l=hc(l)).length,d,h=!1,p;for(i==null&&(o=r(p=a())),c=0;c<=u;++c)!(c<u&&n(d=l[c],c,l))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(d,c,l),+e(d,c,l));if(p)return o=null,p+""||null}return s.x=function(l){return arguments.length?(t=typeof l=="function"?l:At(+l),s):t},s.y=function(l){return arguments.length?(e=typeof l=="function"?l:At(+l),s):e},s.defined=function(l){return arguments.length?(n=typeof l=="function"?l:At(!!l),s):n},s.curve=function(l){return arguments.length?(r=l,i!=null&&(o=r(i)),s):r},s.context=function(l){return arguments.length?(l==null?i=o=null:o=r(i=l),s):i},s}function ro(t,e,n){var i=null,r=At(!0),o=null,a=eo,s=null,l=Ma(c);t=typeof t=="function"?t:t===void 0?Qp:At(+t),e=typeof e=="function"?e:At(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?tf:At(+n);function c(d){var h,p,m,v=(d=hc(d)).length,b,g=!1,$,_=new Array(v),y=new Array(v);for(o==null&&(s=a($=l())),h=0;h<=v;++h){if(!(h<v&&r(b=d[h],h,d))===g)if(g=!g)p=h,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),m=h-1;m>=p;--m)s.point(_[m],y[m]);s.lineEnd(),s.areaEnd()}g&&(_[h]=+t(b,h,d),y[h]=+e(b,h,d),s.point(i?+i(b,h,d):_[h],n?+n(b,h,d):y[h]))}if($)return s=null,$+""||null}function u(){return lr().defined(r).curve(a).context(o)}return c.x=function(d){return arguments.length?(t=typeof d=="function"?d:At(+d),i=null,c):t},c.x0=function(d){return arguments.length?(t=typeof d=="function"?d:At(+d),c):t},c.x1=function(d){return arguments.length?(i=d==null?null:typeof d=="function"?d:At(+d),c):i},c.y=function(d){return arguments.length?(e=typeof d=="function"?d:At(+d),n=null,c):e},c.y0=function(d){return arguments.length?(e=typeof d=="function"?d:At(+d),c):e},c.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:At(+d),c):n},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(n)},c.lineX1=function(){return u().x(i).y(e)},c.defined=function(d){return arguments.length?(r=typeof d=="function"?d:At(!!d),c):r},c.curve=function(d){return arguments.length?(a=d,o!=null&&(s=a(o)),c):a},c.context=function(d){return arguments.length?(d==null?o=s=null:s=a(o=d),c):o},c}function y6(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function v6(t){return t}function ew(){var t=v6,e=y6,n=null,i=At(0),r=At(Oo),o=At(0);function a(s){var l,c=(s=hc(s)).length,u,d,h=0,p=new Array(c),m=new Array(c),v=+i.apply(this,arguments),b=Math.min(Oo,Math.max(-Oo,r.apply(this,arguments)-v)),g,$=Math.min(Math.abs(b)/c,o.apply(this,arguments)),_=$*(b<0?-1:1),y;for(l=0;l<c;++l)(y=m[p[l]=l]=+t(s[l],l,s))>0&&(h+=y);for(e!=null?p.sort(function(S,w){return e(m[S],m[w])}):n!=null&&p.sort(function(S,w){return n(s[S],s[w])}),l=0,d=h?(b-c*_)/h:0;l<c;++l,v=g)u=p[l],y=m[u],g=v+(y>0?y*d:0)+_,m[u]={data:s[u],index:l,value:y,startAngle:v,endAngle:g,padAngle:$};return m}return a.value=function(s){return arguments.length?(t=typeof s=="function"?s:At(+s),a):t},a.sortValues=function(s){return arguments.length?(e=s,n=null,a):e},a.sort=function(s){return arguments.length?(n=s,e=null,a):n},a.startAngle=function(s){return arguments.length?(i=typeof s=="function"?s:At(+s),a):i},a.endAngle=function(s){return arguments.length?(r=typeof s=="function"?s:At(+s),a):r},a.padAngle=function(s){return arguments.length?(o=typeof s=="function"?s:At(+s),a):o},a}var b6=nw(eo);function rw(t){this._curve=t}rw.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function nw(t){function e(n){return new rw(t(n))}return e._curve=t,e}function x6(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(n){return arguments.length?e(nw(n)):e()._curve},t}function _6(){return x6(lr().curve(b6))}class $6{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function w6(t){return new $6(t,!0)}function k6(t){return t.source}function S6(t){return t.target}function A6(t){let e=k6,n=S6,i=Qp,r=tf,o=null,a=null,s=Ma(l);function l(){let c;const u=g6.call(arguments),d=e.apply(this,u),h=n.apply(this,u);if(o==null&&(a=t(c=s())),a.lineStart(),u[0]=d,a.point(+i.apply(this,u),+r.apply(this,u)),u[0]=h,a.point(+i.apply(this,u),+r.apply(this,u)),a.lineEnd(),c)return a=null,c+""||null}return l.source=function(c){return arguments.length?(e=c,l):e},l.target=function(c){return arguments.length?(n=c,l):n},l.x=function(c){return arguments.length?(i=typeof c=="function"?c:At(+c),l):i},l.y=function(c){return arguments.length?(r=typeof c=="function"?c:At(+c),l):r},l.context=function(c){return arguments.length?(c==null?o=a=null:a=t(o=c),l):o},l}function z6(){return A6(w6)}const pc={draw(t,e){const n=wr(e/to);t.moveTo(n,0),t.arc(0,0,n,0,Oo)}},ef={draw(t,e){const n=wr(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},rf={draw(t,e){const n=wr(e),i=-n/2;t.rect(i,i,n,n)}},Vc=wr(3),nf={draw(t,e){const n=-wr(e/(Vc*3));t.moveTo(0,n*2),t.lineTo(-Vc*n,-n),t.lineTo(Vc*n,-n),t.closePath()}};function Po(t,e){let n=null,i=Ma(r);t=typeof t=="function"?t:At(t||pc),e=typeof e=="function"?e:At(e===void 0?64:+e);function r(){let o;if(n||(n=o=i()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return r.type=function(o){return arguments.length?(t=typeof o=="function"?o:At(o),r):t},r.size=function(o){return arguments.length?(e=typeof o=="function"?o:At(+o),r):e},r.context=function(o){return arguments.length?(n=o??null,r):n},r}function sg(){}function lg(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function of(t,e){this._context=t,this._k=(1-e)/6}of.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:lg(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:lg(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(i){return new of(i,e)}return n.tension=function(i){return t(+i)},n})(0);function T6(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Le){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Le){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}function iw(t,e){this._context=t,this._alpha=e}iw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:T6(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Rs=function t(e){function n(i){return e?new iw(i,e):new of(i,0)}return n.alpha=function(i){return t(+i)},n}(.5);function ow(t){this._context=t}ow.prototype={areaStart:sg,areaEnd:sg,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function L6(t){return new ow(t)}function cg(t){return t<0?-1:1}function ug(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(cg(o)+cg(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function dg(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Zc(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function js(t){this._context=t}js.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Zc(this,this._t0,dg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Zc(this,dg(this,n=ug(this,t,e)),n);break;default:Zc(this,this._t0,n=ug(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};Object.create(js.prototype).point=function(t,e){js.prototype.point.call(this,e,t)};function aw(t){return new js(t)}function sw(t,e){this._context=t,this._t=e}sw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function lw(t){return new sw(t,1)}function hg(t,e){if((a=t.length)>1)for(var n=1,i,r,o=t[e[0]],a,s=o.length;n<a;++n)for(r=o,o=t[e[n]],i=0;i<s;++i)o[i][1]+=o[i][0]=isNaN(r[i][1])?r[i][0]:r[i][1]}function pg(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function C6(t,e){return t[e]}function I6(t){const e=[];return e.key=t,e}function M6(){var t=At([]),e=pg,n=hg,i=C6;function r(o){var a=Array.from(t.apply(this,arguments),I6),s,l=a.length,c=-1,u;for(const d of o)for(s=0,++c;s<l;++s)(a[s][c]=[0,+i(d,a[s].key,c,o)]).data=d;for(s=0,u=hc(e(a));s<l;++s)a[u[s]].index=s;return n(a,u),a}return r.keys=function(o){return arguments.length?(t=typeof o=="function"?o:At(Array.from(o)),r):t},r.value=function(o){return arguments.length?(i=typeof o=="function"?o:At(+o),r):i},r.order=function(o){return arguments.length?(e=o==null?pg:typeof o=="function"?o:At(Array.from(o)),r):e},r.offset=function(o){return arguments.length?(n=o??hg,r):n},r}const N6=56,D6=4,O6=8;function er(t){return Math.max(t,N6)}function P6(t){return t-O6}function cw(t,e,n,i){!n||!(i!=null&&i.onAxisLabelHover)||(t.style("cursor","default"),t.on("mouseenter",r=>{var o;(o=i.onAxisLabelHover)==null||o.call(i,e,r)}),t.on("mouseleave",()=>{var r;(r=i.onAxisLabelLeave)==null||r.call(i)}))}function cr(t,e={}){const n=e.fontSize??f.axisLabelSize,i=b$(e.slotWidth,e.maxLength??25,n);t.selectAll("text").each(function(){const r=ht(this),o=r.text(),a=Fp(o,i),s=a!==o;r.text(a),cw(r,o,s,e)})}function fo(t,e,n={}){const i=n.fontSize??f.axisLabelSize,r=b$(n.slotWidth,n.maxLength??25,i),o=Fp(e,r),a=o!==e;return t.text(o),cw(t,e,a,n),o}function E6(t,e,n=D6){t.selectAll("text").attr("text-anchor","start").attr("x",0).attr("dx",-e+n).style("dominant-baseline","middle")}function F6(t,e,n=10){t.selectAll("text").attr("text-anchor","start").attr("x",0).attr("dx",-e+n).style("dominant-baseline","middle")}function we(t,e,n){t.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize),n&&cr(t,{...n,slotWidth:n.slotWidth??P6(e)}),E6(t,e)}function fc(t,e){const n=new Set,i=[];for(const r of t)for(const o of r.points)n.has(o.x)||(n.add(o.x),i.push(o.x));if(e!=null&&e.length){const r=e.filter(o=>n.has(o));for(const o of i)r.includes(o)||r.push(o);return r}return i}function R6(t){let e=1/0,n=-1/0;for(const i of t)for(const r of i.points)r.y<e&&(e=r.y),r.y>n&&(n=r.y);if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e===n){const i=Math.abs(e)*.1||1;return[e-i,n+i]}return[e,n]}function j6(t){switch(t){case"step":return lw;case"monotone":return aw;default:return eo}}function U6(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function uw(t,e){const{series:n,width:i,height:r,margin:o={...f.lineMargin},theme:a,curve:s="linear",marker:l="donut",showPoints:c=!0,showGrid:u=!0,xDomainHint:d,showGlow:h=!0,themeMode:p="light",xLabel:m,yLabel:v,onPointHover:b,onPointLeave:g,onAxisLabelHover:$,onAxisLabelLeave:_}=e,y={onAxisLabelHover:$,onAxisLabelLeave:_};if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const S={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,1)},w=S.top,L=r-S.bottom,N=S.left,E=i-S.right;if(E-N<8||L-w<8)return;const H=fc(n,d),F=[];for(const nt of n)for(const tt of nt.points)Number.isFinite(tt.y)&&F.push(tt.y);const[W,M]=Gr(F),z=ge(r),T=n.length>1,C=de().domain(H).range([N,E]).padding(-1),k=Ft().domain([W,M]).range([L,w]),x=k.ticks(z),A=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Line chart").style("display","block").style("font-family",a.fontFamily),D=h?Ap(A):"",R=A.append("g").attr("class","plot");if(u){const nt=R.append("g").attr("class","grid");for(const tt of H){const j=C(tt);if(j==null)continue;const I=j+C.bandwidth()/2;nt.append("line").attr("x1",I).attr("x2",I).attr("y1",w).attr("y2",L).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges")}for(const tt of x)nt.append("line").attr("x1",N).attr("x2",E).attr("y1",k(tt)).attr("y2",k(tt)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges");nt.append("line").attr("x1",E).attr("x2",E).attr("y1",w).attr("y2",L).attr("stroke",f.gridStroke).attr("stroke-dasharray","1, 2").attr("shape-rendering","crispEdges")}const B=lr().defined(nt=>Number.isFinite(nt.y)&&C(nt.x)!=null).x(nt=>(C(nt.x)??0)+C.bandwidth()/2).y(nt=>k(nt.y)).curve(j6(s)),X=R.append("line").attr("class","hover-guide").attr("stroke",p==="dark"?f.hoverGuideDark:f.hoverGuideLight).attr("stroke-width",2).attr("opacity",0).attr("pointer-events","none");n.forEach((nt,tt)=>{const j=U6(nt,tt,a),I=R.append("g").attr("class",`series series-${nt.id}`),V=T?j:ws(j,f.lineStrokeAlphaPct);if(I.append("path").datum(nt.points).attr("fill","none").attr("stroke",V).attr("stroke-width",f.lineStrokeWidth).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("filter",D||null).attr("d",B),c&&l!=="disabled"){const U=I.append("g").attr("class","markers");for(const O of nt.points){if(!Number.isFinite(O.y)||C(O.x)==null)continue;const P=(C(O.x)??0)+C.bandwidth()/2,J=k(O.y),rt=U.append("g").attr("class","marker").style("cursor",b?"pointer":"default");zp(rt,{shape:l,color:j,cx:P,cy:J,r:f.markerRadius,themeMode:p}),rt.append("circle").attr("cx",P).attr("cy",J).attr("r",10).attr("fill","transparent").attr("stroke","none"),b&&rt.on("mouseenter",it=>{X.attr("x1",P).attr("x2",P).attr("y1",w).attr("y2",L).attr("opacity",.8),T&&(R.selectAll(".series").attr("opacity",.2),I.attr("opacity",1)),b({seriesId:nt.id,seriesName:nt.name??nt.id,point:O,event:it})}).on("mouseleave",()=>{X.attr("opacity",0),T&&R.selectAll(".series").attr("opacity",1),g==null||g()})}}});const et=R.append("g").attr("class","x-axis").attr("transform",`translate(0,${L})`).call(ae(C).tickSize(0).tickPadding(8).tickFormat(nt=>String(nt)));et.select(".domain").attr("stroke",f.axisStroke),et.selectAll("line").attr("stroke","none"),et.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const K=et.selectAll("text").nodes();K.length>0&&(ht(K[0]).attr("text-anchor","start"),K.length>1&&ht(K[K.length-1]).attr("text-anchor","end")),cr(et,{slotWidth:C.bandwidth(),...y});const at=R.append("g").attr("class","y-axis").attr("transform",`translate(${N},0)`).call(Jt(k).tickValues(x).tickSize(5).tickPadding(6).tickFormat(nt=>{const tt=Number(nt),j=Number.isInteger(tt)&&Math.abs(tt)<1e3?0:2;return Pt(tt,j)}));at.select(".domain").attr("stroke","none"),at.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray","1 2"),we(at,N),m&&R.append("text").attr("x",(N+E)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(m),v&&R.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(v)}const af=ie`
264
+ :host {
265
+ display: block;
266
+ position: relative;
267
+ width: 100%;
268
+ height: 100%;
269
+ min-height: 220px;
270
+ color: var(--ui9000-color-text, #111827);
271
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
272
+ box-sizing: border-box;
273
+ }
274
+ .chart-root {
275
+ flex: 1 1 auto;
276
+ width: 100%;
277
+ min-height: 240px;
278
+ }
279
+ .tooltip {
280
+ position: absolute;
281
+ pointer-events: none;
282
+ z-index: 2;
283
+ padding: 6px 10px;
284
+ border-radius: 6px;
285
+ font-size: 12px;
286
+ line-height: 1.35;
287
+ background: var(--ui9000-color-text, #111827);
288
+ color: #fff;
289
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
290
+ transform: translate(-50%, calc(-100% - 10px));
291
+ white-space: nowrap;
292
+ }
293
+ .tooltip .name {
294
+ font-weight: 600;
295
+ }
296
+ .empty {
297
+ display: grid;
298
+ place-items: center;
299
+ height: 100%;
300
+ min-height: inherit;
301
+ color: var(--ui9000-color-text-muted, #6b7280);
302
+ font-size: 0.875rem;
303
+ }
304
+ `,sf=["#473DD9","#36C4A5"],B6=["#473DD9","#36C4A5","#FF8C47","#56546D"],H6=["#473DD9","#938CFF","#36C4A5","#ADF4E5","#BDBCC8","#56546D","#FF8C47","#FFCEB0","#FF4781","#FFB0C9","#47B0FF","#B0DDFF"],lf=["#D6D3FF","#B5B0FF","#938CFF","#7369FF","#5448FF","#473DD9","#3C33B5"],Ni=[5,10,14,17,20,24,26],fg=30,Wc=8,dw=16,q6=21,Du=10;function G6(t,e=11){const n=t.reduce((r,o)=>Math.max(r,String(o).length),0),i=Math.max(n,3);return Math.ceil(i*e*.6)+Du+8}function V6(t,e,n,i){if(n<=0||i<=0)return fg;const r=t/n/2,o=e/i/2;return Math.min(fg,r,o)}function Da(t,e=1){const n=t>0?t:e;return n>4?H6:n>2?B6:sf}function zt(t,e,n=1){var i;const r=t!=null&&t.length?t:[{key:"default",color:"1"}],o=Da(r.length,n),a=r.find(d=>String(d.key)===String(e)),s=(a==null?void 0:a.color)??((i=r[0])==null?void 0:i.color)??1,l=Number(s),c=Number.isFinite(l)?l:1,u=o[c-1];return u||o[((c-1)%o.length+o.length)%o.length]}function hw(t,e=7){const n=t.map(r=>typeof r=="number"?r:Number(r)).filter(r=>Number.isFinite(r)).slice().sort((r,o)=>r-o);if(!n.length||e<2)return[];const i=[];for(let r=0;r<e;r++){const o=r/(e-1)*(n.length-1),a=Math.max(0,Math.floor(o)),s=Math.min(n.length-1,Math.ceil(o)),l=o-a;i.push(n[a]*(1-l)+n[s]*l)}return i}function Z6(t,e=lf){if(!e.length||!t.length)return[];const n=[...new Set(t.map(Math.abs))].sort((r,o)=>r-o),i=hw(n);return i.length?i.map((r,o)=>({color:e[o]??e[e.length-1]??"#473DD9",radius:Ni[o]??Ni[Ni.length-1],start:-Math.ceil(o===i.length-1?n[n.length-1]:i[o+1])-1,end:Math.ceil(o===i.length-1?n[n.length-1]:i[o+1])+1})):[]}function mg(t,e){if(!e.length)return lf[0];if(!t)return e[0].color;const n=e.find(i=>t>=i.start&&t<=i.end);return(n==null?void 0:n.color)??e[0].color}function pw(t,e){if(!e.length)return 5;const n=Math.abs(t),i=e.find(r=>n>=r.start&&n<=r.end);return(i==null?void 0:i.radius)??5}function fw(t,e){if(!t.length)return[];const n=[...new Set(t.map(Math.abs))].sort((o,a)=>o-a),i=n.length,r=e!=null&&e.length?e:hw(n);return r.length?r.map((o,a)=>({color:"transparent",radius:Ni[a]??Ni[Ni.length-1],start:o,end:a===r.length-1?i>0?n[i-1]:0:r[a+1]})):[]}const mw=pw;function W6(t,e,n){const i=pw(t,e),r=Math.max(...e.map(a=>a.radius),Wc),o=n/Math.max(r,Wc);return Math.max(Wc,Math.min(n,i*Math.min(1,o)))}function gg(t){const e=se(t),n=ft(t.xAxe)??"x",i=ft(t.yAxe)??"y",r=ft(t.groupBy),o=t.formatting;if(r){const s=new Map;for(const c of e){const u=c[n],d=Number(c[i]);if(u==null||!Number.isFinite(d))continue;const h=String(c[r]??"default"),p=s.get(h)??[];p.push({x:String(u),y:d}),s.set(h,p)}const l=me(s.keys(),t.uniqueValues,r);return l.map(c=>({id:c,name:c,color:zt(o,c,l.length),points:s.get(c)}))}const a=[];for(const s of e){const l=s[n],c=Number(s[i]);l==null||!Number.isFinite(c)||a.push({x:String(l),y:c})}return a.length?[{id:"default",name:"Series",color:zt(o,"default",1),points:a}]:[]}function gw(t){var e,n;if(!t)return[];if(Array.isArray(t)){if(t.length===0)return[];const r=t[0];return"points"in r&&Array.isArray(r.points)?t:[{id:"default",name:"Series",points:t.map(o=>({x:String(o.label),y:Number(o.value)}))}]}if(Ht(t)&&!("series"in t)&&!("points"in t))return gg(t);const i=t;return(e=i.series)!=null&&e.length?i.series.map((r,o)=>({id:r.id||`series-${o}`,name:r.name??r.id??`Series ${o+1}`,color:r.color,points:r.points.filter(a=>Number.isFinite(a.y)).map(a=>({x:String(a.x),y:Number(a.y)}))})):(n=i.points)!=null&&n.length?[{id:"default",name:"Series",points:i.points.filter(r=>Number.isFinite(r.y)).map(r=>({x:String(r.x),y:Number(r.y)}))}]:Ht(t)?gg(t):[]}const ne=ie`
305
+ .widget-shell {
306
+ display: flex;
307
+ flex-direction: column;
308
+ width: 100%;
309
+ height: 100%;
310
+ min-height: inherit;
311
+ box-sizing: border-box;
312
+ padding: 12px 16px;
313
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
314
+ border-radius: 8px;
315
+ background: var(--ui9000-color-surface, #ffffff);
316
+ }
317
+
318
+ .widget-header {
319
+ display: flex;
320
+ align-items: flex-start;
321
+ justify-content: space-between;
322
+ gap: 8px;
323
+ flex-shrink: 0;
324
+ margin-bottom: 8px;
325
+ min-width: 0;
326
+ }
327
+
328
+ .widget-title {
329
+ flex: 1;
330
+ min-width: 0;
331
+ font-size: 14px;
332
+ font-weight: 500;
333
+ line-height: 20px;
334
+ color: var(--ui9000-color-text, #111827);
335
+ white-space: nowrap;
336
+ overflow: hidden;
337
+ text-overflow: ellipsis;
338
+ }
339
+
340
+ .widget-actions {
341
+ position: relative;
342
+ flex-shrink: 0;
343
+ }
344
+
345
+ .menu-btn {
346
+ display: inline-flex;
347
+ align-items: center;
348
+ justify-content: center;
349
+ width: 32px;
350
+ height: 32px;
351
+ padding: 0;
352
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
353
+ border-radius: 8px;
354
+ background: rgba(255, 255, 255, 0.92);
355
+ color: var(--ui9000-color-text-muted, #6b7280);
356
+ font-size: 18px;
357
+ line-height: 1;
358
+ cursor: pointer;
359
+ }
360
+
361
+ .menu-btn:hover {
362
+ background: #fff;
363
+ border-color: var(--ui9000-color-border-strong, #d1d5db);
364
+ }
365
+
366
+ .menu-dropdown {
367
+ position: absolute;
368
+ top: 36px;
369
+ right: 0;
370
+ z-index: 5;
371
+ min-width: 170px;
372
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
373
+ border-radius: 10px;
374
+ background: #fff;
375
+ box-shadow:
376
+ 0 10px 15px -3px rgb(0 0 0 / 10%),
377
+ 0 4px 6px -4px rgb(0 0 0 / 10%);
378
+ overflow: hidden;
379
+ }
380
+
381
+ .menu-item {
382
+ display: block;
383
+ width: 100%;
384
+ padding: 10px 14px;
385
+ border: none;
386
+ background: transparent;
387
+ text-align: left;
388
+ font-size: 13px;
389
+ color: var(--ui9000-color-text, #111827);
390
+ cursor: pointer;
391
+ }
392
+
393
+ .menu-item:hover {
394
+ background: var(--ui9000-color-surface-muted, #f3f4f6);
395
+ }
396
+
397
+ .widget-body {
398
+ flex: 1 1 auto;
399
+ /* Chat/MCP hosts often set only min-height on :host; min-height:0 collapses the plot. */
400
+ min-height: 240px;
401
+ position: relative;
402
+ display: flex;
403
+ flex-direction: column;
404
+ }
405
+
406
+ /* Default plot slot — charts may nest further (box/bar scroll). */
407
+ .widget-body > .chart-root {
408
+ flex: 1 1 auto;
409
+ width: 100%;
410
+ min-height: 240px;
411
+ }
412
+
413
+ .widget-body > .chart-body {
414
+ flex: 1 1 auto;
415
+ min-height: 240px;
416
+ }
417
+
418
+ .chart-legend {
419
+ display: flex;
420
+ flex-wrap: wrap;
421
+ align-items: center;
422
+ gap: 8px 16px;
423
+ flex-shrink: 0;
424
+ margin-bottom: 8px;
425
+ font-size: 11px;
426
+ line-height: 1.2;
427
+ color: var(--ui9000-color-text-muted, #6c7584);
428
+ }
429
+
430
+ .legend-item {
431
+ display: inline-flex;
432
+ align-items: center;
433
+ gap: 6px;
434
+ white-space: nowrap;
435
+ }
436
+
437
+ .legend-swatch {
438
+ width: 10px;
439
+ height: 10px;
440
+ border-radius: 2px;
441
+ flex-shrink: 0;
442
+ }
443
+
444
+ .legend-line {
445
+ position: relative;
446
+ display: inline-block;
447
+ width: 14px;
448
+ height: 2px;
449
+ border-radius: 1px;
450
+ background: var(--legend-color, #473dd9);
451
+ flex-shrink: 0;
452
+ }
453
+
454
+ .legend-line--dashed {
455
+ background: transparent;
456
+ border-top: 2px dashed var(--legend-color, #6c7584);
457
+ height: 0;
458
+ }
459
+
460
+ .legend-dot {
461
+ position: absolute;
462
+ left: 50%;
463
+ top: 50%;
464
+ width: 6px;
465
+ height: 6px;
466
+ border-radius: 50%;
467
+ transform: translate(-50%, -50%);
468
+ }
469
+
470
+ .label-tooltip {
471
+ position: absolute;
472
+ pointer-events: none;
473
+ z-index: 4;
474
+ max-width: min(320px, 90vw);
475
+ padding: 2px 5px;
476
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
477
+ border-radius: 5px;
478
+ font-size: 11px;
479
+ line-height: 1.35;
480
+ background: var(--ui9000-color-surface, #fff);
481
+ color: var(--ui9000-color-text-muted, #6c7584);
482
+ box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
483
+ transform: translate(-50%, calc(-100% - 8px));
484
+ white-space: nowrap;
485
+ }
486
+ `;var K6=Object.defineProperty,Y6=Object.getOwnPropertyDescriptor,rr=(t,e,n,i)=>{for(var r=i>1?void 0:i?Y6(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&K6(e,n,r),r};let ke=class extends qt{constructor(){super(...arguments),this.scale="default",this.curve="linear",this.marker="donut",this.showPoints=!0,this.showArea=!1,this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return gw(t)}xDomainHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){if(!this.showLegend||t.length<=1)return st;const e=wt(this);return ce(ui(t,e))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=z_(e);uw(e,{series:n,width:r,height:o,margin:a,theme:i,curve:this.curve,marker:this.marker,showPoints:this.showPoints,showArea:this.showArea,showGrid:this.showGrid,xDomainHint:this.xDomainHint(),xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onPointHover:this.showTooltip?({seriesName:s,point:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,seriesName:s,pointX:l.x,pointY:l.y}}:void 0,onPointLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData();return ot`
487
+ <div class="widget-shell" part="shell">
488
+ ${this.renderShellHeader(t)}
489
+ <div class="widget-body">
490
+ ${this.renderLegend(e)}
491
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
492
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
493
+ ${this._tooltip?ot`<div
494
+ class="tooltip"
495
+ part="tooltip"
496
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
497
+ >
498
+ <div class="name">${this._tooltip.seriesName}</div>
499
+ <div>${this._tooltip.pointX}: ${this._tooltip.pointY}</div>
500
+ </div>`:st}
501
+ ${this.renderShellLabelTooltip()}
502
+ </div>
503
+ </div>
504
+ `}};ke.styles=[af,ne];rr([Y({type:String,attribute:"scale"})],ke.prototype,"scale",2);rr([Y({type:String})],ke.prototype,"curve",2);rr([Y({type:String})],ke.prototype,"marker",2);rr([Y({type:Boolean,attribute:"show-points"})],ke.prototype,"showPoints",2);rr([Y({type:Boolean,attribute:"show-area"})],ke.prototype,"showArea",2);rr([Y({type:Boolean,attribute:"show-grid"})],ke.prototype,"showGrid",2);rr([Y({type:Boolean,attribute:"show-legend"})],ke.prototype,"showLegend",2);rr([Y({type:Boolean,attribute:"show-tooltip"})],ke.prototype,"showTooltip",2);rr([Y({type:String,attribute:"x-label"})],ke.prototype,"xLabel",2);rr([Y({type:String,attribute:"y-label"})],ke.prototype,"yLabel",2);rr([yt()],ke.prototype,"_tooltip",2);rr([yt()],ke.prototype,"_empty",2);ke=rr([Xt("ui9000-line-chart")],ke);function yw(){customElements.get("ui9000-line-chart")||customElements.define("ui9000-line-chart",ke)}yw();function J6(t){const e=Math.abs(t);return e>=1e9?`${(t/1e9).toFixed(1)}B`:e>=1e6?`${(t/1e6).toFixed(1)}M`:e>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?String(t):t.toFixed(1)}const X6=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000LineChart(){return ke},collectXDomain:fc,collectYExtent:R6,formatCompact:J6,lineChartMetadata:W_,normalizeLineData:gw,registerLineChart:yw,renderLineChart:uw},Symbol.toStringTag,{value:"Module"}));function yg(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function vg(t){return`area-gradient-${t.replace(/[^a-zA-Z0-9]/g,"")}`}function Q6(t,e){return t.points.filter(n=>e(n.x)!=null).map(n=>({x:(e(n.x)??0)+e.bandwidth()/2,y0:n.y0,y1:n.y1,category:n.x,value:n.y1-n.y0}))}function vw(t,e){const{model:n,width:i,height:r,margin:o={...f.lineMargin},theme:a,marker:s="donut",showPoints:l=!0,showGrid:c=!0,xDomainHint:u,themeMode:d="light",xLabel:h,yLabel:p,onPointHover:m,onPointLeave:v,onAxisLabelHover:b,onAxisLabelLeave:g}=e,$={onAxisLabelHover:b,onAxisLabelLeave:g};t.replaceChildren();const{series:_}=n;if(!_.length||i<=0||r<=0)return;const y={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,1)},S=y.top,w=r-y.bottom,L=y.left,N=i-y.right;if(N-L<8||w-S<8)return;const E=fc(_.map(tt=>({...tt,points:tt.points.map(j=>({x:j.x,y:j.y1}))})),u),H=[];for(const tt of _)for(const j of tt.points)H.push(j.y0,j.y1);const[F,W]=Gr(H),M=ge(r),z=_.length>1,T=de().domain(E).range([L,N]).padding(-1),C=Ft().domain([F,W]).range([w,S]),k=C.ticks(M),x=C(0),A=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Area chart").style("display","block").style("font-family",a.fontFamily),D=Ap(A),R=A.select("defs");for(const tt of _){const j=yg(tt,_.indexOf(tt),a),I=R.append("linearGradient").attr("id",vg(tt.id)).attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%");I.append("stop").attr("offset","0%").attr("stop-color",j).attr("stop-opacity",f.areaGradientTopOpacity),I.append("stop").attr("offset","100%").attr("stop-color",j).attr("stop-opacity",f.areaGradientBottomOpacity)}const B=A.append("g").attr("class","plot");if(c){const tt=B.append("g").attr("class","grid");for(const j of E){const I=T(j);if(I==null)continue;const V=I+T.bandwidth()/2;tt.append("line").attr("x1",V).attr("x2",V).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges")}for(const j of k)tt.append("line").attr("x1",L).attr("x2",N).attr("y1",C(j)).attr("y2",C(j)).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges");tt.append("line").attr("x1",N).attr("x2",N).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges"),Number.isFinite(x)&&tt.append("line").attr("x1",L).attr("x2",N).attr("y1",x).attr("y2",x).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const X=ro().x(tt=>tt.x).y0(tt=>C(tt.y0)).y1(tt=>C(tt.y1)).curve(eo),et=lr().x(tt=>tt.x).y(tt=>C(tt.y1)).curve(eo);_.forEach((tt,j)=>{const I=yg(tt,j,a),V=Q6(tt,T);if(!V.length)return;const U=B.append("g").attr("class",`series series-${tt.id}`);U.append("path").datum(V).attr("class","area").attr("fill",`url(#${vg(tt.id)})`).attr("pointer-events","none").attr("d",X),U.append("path").datum(V).attr("class","line").attr("fill","none").attr("stroke",I).attr("stroke-width",f.lineStrokeWidth).attr("filter",D||null).attr("pointer-events","none").attr("d",et);const O=tt.marker??s;if(l&&O!=="disabled"){const P=U.append("g").attr("class","markers");for(const J of V){const rt=C(J.y1),it=P.append("g").attr("class","marker").style("cursor",m?"pointer":"default");zp(it,{shape:O,color:I,cx:J.x,cy:rt,r:f.markerRadius,themeMode:d}),it.append("circle").attr("cx",J.x).attr("cy",rt).attr("r",10).attr("fill","transparent"),m&&it.on("mouseenter",lt=>{z&&(B.selectAll(".series").attr("opacity",.2),U.attr("opacity",1)),m({seriesId:tt.id,seriesName:tt.name??tt.id,category:J.category,value:J.value,event:lt})}).on("mouseleave",()=>{z&&B.selectAll(".series").attr("opacity",1),v==null||v()})}}});const K=B.append("g").attr("class","x-axis").attr("transform",`translate(0,${w})`).call(ae(T).tickSize(0).tickPadding(8).tickFormat(tt=>String(tt)));K.select(".domain").attr("stroke",f.axisStroke),K.selectAll("line").attr("stroke","none"),K.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const at=K.selectAll("text").nodes();at.length>0&&(ht(at[0]).attr("text-anchor","start"),at.length>1&&ht(at[at.length-1]).attr("text-anchor","end")),cr(K,{slotWidth:T.bandwidth(),...$});const nt=B.append("g").attr("class","y-axis").attr("transform",`translate(${L},0)`).call(Jt(C).tickValues(k).tickSize(5).tickPadding(6).tickFormat(tt=>{const j=Number(tt),I=Number.isInteger(j)&&Math.abs(j)<1e3?0:2;return Pt(j,I)}));nt.select(".domain").attr("stroke","none"),nt.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray",f.gridDash),we(nt,L),h&&B.append("text").attr("x",(L+N)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(h),p&&B.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(p)}function bw(t){var e,n,i;const{chartType:r,groupByField:o,uniqueValues:a,data:s,xAxeField:l}=t,c=a??{},u=Array.isArray(s)?s:[];if(r==="parallelCoordinatesChart")return["defaultMin","defaultMax"];if(o&&((e=c[o])!=null&&e.length))return c[o].filter(h=>String(h).trim().length>0);if((r==="pieChart"||r==="donutChart")&&l){if((n=c[l])!=null&&n.length)return c[l].filter(h=>String(h).trim().length>0);if(u.length){const h=new Set(u.map(p=>String(p[l]??"").trim()).filter(Boolean));return Array.from(h)}}if(o&&u.length){const h=new Set(u.map(p=>String(p[o]??"").trim()).filter(Boolean));return Array.from(h)}const d=Object.keys(c)[0];return d&&((i=c[d])!=null&&i.length)?c[d].filter(h=>String(h).trim().length>0):[]}const tU=[{key:"default",color:"1"}];function eU(t,e){if(!Array.isArray(t)||t.length!==e.length)return!1;const n=new Set(t.map(i=>i.key));return e.every(i=>n.has(i))}function rU(t){const e=bw(t);if(e.length===0)return tU;const n=t.existingFormatting;return n!=null&&n.length&&eU(n,e)?n:e.map((i,r)=>({key:i,color:String(r%12+1)}))}const nU=new Set(["lineChart","areaChart","lollipopChart","radarChart","scatterplotChart","qqPlot"]),bg=["donut","circle","square","rhombus","triangle","cross"];function iU(t){switch(t){case"scatterplotChart":case"qqPlot":return"circle";case"lollipopChart":return"rhombus";default:return"donut"}}function oU(t,e){if(!Array.isArray(t)||t.length!==e.length)return!1;const n=new Set(t.map(i=>i.key));return e.every(i=>n.has(i))}function aU(t){if(!nU.has(t.chartType))return[];const e=bw(t);if(e.length===0)return[{key:"default",shape:iU(t.chartType)}];const n=t.existingMarkers;return n!=null&&n.length&&oU(n,e)?n:e.map((i,r)=>({key:i,shape:bg[r%bg.length]}))}function xw(t){var e,n;return{chartType:t.chartType??"",groupByField:ft(t.groupBy??void 0)??null,uniqueValues:t.uniqueValues??void 0,data:se(t),xAxeField:ft(t.xAxe??void 0),existingFormatting:(e=t.formatting)==null?void 0:e.map(i=>({key:String(i.key??"default"),color:String(i.color??"1")})),existingMarkers:(n=t.markers)==null?void 0:n.map(i=>({key:String(i.key??"default"),shape:String(i.shape??"donut")}))}}function pi(t){return rU(xw(t))}function Oa(t){const e=xw(t);return aU(e).map(i=>({...i,shape:i.shape}))}const Ya={layout:"grouped",series:[]};function Ou(t,e){var n;return((n=t.find(i=>i.key===e))==null?void 0:n.shape)??"donut"}function sU(t,e){const n=new Set;for(const i of t){const r=String(i[e]??"");r&&n.add(r)}return[...n]}function _w(t,e){var n,i;const r=se(t),o=Array.from(new Set(r.map(s=>String(s[e]??"")))).filter(Boolean),a=(i=(n=t.uniqueValues)==null?void 0:n[e])==null?void 0:i.map(String);if(a!=null&&a.length){const s=a.filter(l=>o.includes(l));return s.length?s:a}return me(o,t.uniqueValues,e)}function $w(t){const e=se(t),n=ft(t.xAxe)??"x",i=ft(t.yAxe)??"y",r=ft(t.groupBy),o=_w(t,n),a=Oa(t),s=t.formatting;if(!r){const u=new Map;for(const h of e){const p=String(h[n]??""),m=Number(h[i]);!p||!Number.isFinite(m)||u.set(p,m)}const d=o.map(h=>{const p=u.get(h)??0;return{x:h,y:p,y0:0,y1:p}});return d.some(h=>h.y!==0)?[{id:"default",name:"Series",color:zt(s,"default",1),marker:Ou(a,"default"),points:d}]:[]}const l=new Map;for(const u of e){const d=String(u[n]??""),h=Number(u[i]),p=String(u[r]??"default");if(!d||!Number.isFinite(h))continue;const m=l.get(p)??new Map;m.set(d,h),l.set(p,m)}const c=me(l.keys(),t.uniqueValues,r);return c.map(u=>{const d=l.get(u)??new Map,h=o.map(p=>{const m=d.get(p)??0;return{x:p,y:m,y0:0,y1:m}});return{id:u,name:u,color:zt(s,u,c.length),marker:Ou(a,u),points:h}})}function lU(t){var e,n;const i=se(t),r=ft(t.xAxe)??"x",o=ft(t.yAxe)??"y",a=ft(t.groupBy);if(!a)return $w(t);const s=_w(t,r),l=(n=(e=t.uniqueValues)==null?void 0:e[a])!=null&&n.length?t.uniqueValues[a]:sU(i,a),c=new Map;for(const m of i){const v=String(m[r]??""),b=String(m[a]??"");if(!v||!b)continue;let g=c.get(v);g||(g=new Map,c.set(v,g)),g.set(b,m)}const u=s.map(m=>[m,c.get(m)??new Map]),d=M6().keys(l).value(([,m],v)=>{const b=m.get(v);return b&&Number(b[o])||0})(u).reverse(),h=Oa(t),p=t.formatting;return d.map(m=>{const v=m.key,b=new Map(m.map($=>[$.data[0],$])),g=s.map($=>{const _=b.get($);if(!_)return null;const y=Number(_[0]),S=Number(_[1]);return{x:$,y:S-y,y0:y,y1:S}}).filter($=>$!=null);return{id:v,name:v,color:zt(p,v,l.length),marker:Ou(h,v),points:g}})}function cU(t){return t.chartType==="areaStackedChart"?!0:!!(t.stacked&&ft(t.groupBy))}function uU(t){const e=cU(t)?"stacked":"grouped",n=e==="stacked"?lU(t):$w(t);return{layout:e,series:n,xField:ft(t.xAxe),yField:ft(t.yAxe),groupField:ft(t.groupBy),axisDetails:t.axisDetails,uniqueValuesHint:an(t)}}function ww(t){if(!t)return Ya;if(Array.isArray(t))return t.length&&"points"in t[0]?{layout:"grouped",series:t}:Ya;if(Ht(t))return uU(t);if(typeof t=="object"){const e=t;if(Array.isArray(e.series))return{layout:e.layout??"grouped",series:e.series,xField:e.xField,yField:e.yField,groupField:e.groupField,axisDetails:e.axisDetails,uniqueValuesHint:e.uniqueValuesHint}}return Ya}var dU=Object.defineProperty,hU=Object.getOwnPropertyDescriptor,sn=(t,e,n,i)=>{for(var r=i>1?void 0:i?hU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&dU(e,n,r),r};let Ze=class extends qt{constructor(){super(...arguments),this.scale="default",this.marker="donut",this.showPoints=!0,this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return ww(t)}xDomainHint(){const t=Ot(this.dataJson,null);return Ht(t)?an(t):this.parseData().uniqueValuesHint}renderLegend(t){if(!this.showLegend||t.series.length<=1)return st;const e=wt(this),n=t.series.map(i=>({id:i.id,name:i.name,color:i.color,points:i.points.map(r=>({x:r.x,y:r.y1}))}));return ce(ui(n,e))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.series.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=gC(e);vw(e,{model:n,width:r,height:o,margin:a,theme:i,marker:this.marker,showPoints:this.showPoints,showGrid:this.showGrid,xDomainHint:this.xDomainHint(),...this.axisLabelHandlers(),onPointHover:this.showTooltip?({seriesName:s,category:l,value:c,event:u})=>{const d=this.getBoundingClientRect();this._tooltip={x:u.clientX-d.left,y:u.clientY-d.top,seriesName:s,category:l,value:c}}:void 0,onPointLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){var t,e,n;const i=this.headerTitle(),r=this._empty?{layout:"grouped",series:[]}:this.parseData(),o=r.yField,a=this._tooltip?o&&((e=(t=r.axisDetails)==null?void 0:t[o])!=null&&e.measure_unit_symbol)?`${this._tooltip.value.toLocaleString()} ${(n=r.axisDetails[o])==null?void 0:n.measure_unit_symbol}`:this._tooltip.value.toLocaleString():"";return ot`
505
+ <div class="widget-shell" part="shell">
506
+ ${this.renderShellHeader(i)}
507
+ <div class="widget-body">
508
+ ${this.renderLegend(r)}
509
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
510
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
511
+ ${this._tooltip?ot`<div
512
+ class="tooltip"
513
+ part="tooltip"
514
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
515
+ >
516
+ <div class="name">${this._tooltip.seriesName}</div>
517
+ <div>${this._tooltip.category}: ${a}</div>
518
+ </div>`:st}
519
+ ${this.renderShellLabelTooltip()}
520
+ </div>
521
+ </div>
522
+ `}};Ze.styles=[af,ne];sn([Y({type:String,attribute:"scale"})],Ze.prototype,"scale",2);sn([Y({type:String})],Ze.prototype,"marker",2);sn([Y({type:Boolean,attribute:"show-points"})],Ze.prototype,"showPoints",2);sn([Y({type:Boolean,attribute:"show-grid"})],Ze.prototype,"showGrid",2);sn([Y({type:Boolean,attribute:"show-legend"})],Ze.prototype,"showLegend",2);sn([Y({type:Boolean,attribute:"show-tooltip"})],Ze.prototype,"showTooltip",2);sn([yt()],Ze.prototype,"_tooltip",2);sn([yt()],Ze.prototype,"_empty",2);Ze=sn([Xt("ui9000-area-chart")],Ze);function kw(){customElements.get("ui9000-area-chart")||customElements.define("ui9000-area-chart",Ze)}kw();const pU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000AreaChart(){return Ze},areaChartMetadata:E_,collectXDomain:fc,normalizeAreaData:ww,registerAreaChart:kw,renderAreaChart:vw},Symbol.toStringTag,{value:"Module"}));function Sw(t){const e=[];for(const n of t.linePoints)Number.isFinite(n.y)&&e.push(n.y);for(const n of t.categories){const i=t.barsByCategory[n]??{};for(const r of t.groups){const o=i[r.key];Number.isFinite(o)&&e.push(o)}}return Gr(e)}function Aw(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function Pu(t){return Number.isFinite(t)?t.toLocaleString(void 0,{maximumFractionDigits:4}):"—"}const xg="ui9000-agb-area-gradient";function zw(t,e){const{model:n,width:i,height:r,margin:o={...f.areaGroupedBarMargin},theme:a,showGrid:s=!0,showTooltip:l=!0,themeMode:c="light",onHover:u,onLeave:d,onAxisLabelHover:h,onAxisLabelLeave:p}=e,m={onAxisLabelHover:h,onAxisLabelLeave:p};t.replaceChildren();const{categories:v,groups:b,barsByCategory:g,linePoints:$,lineColor:_}=n;if(!v.length&&!$.length||i<=0||r<=0)return;const y={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,1)},S=y.top,w=r-y.bottom,L=y.left,N=i-y.right;if(N-L<8||w-S<8)return;const[E,H]=Sw(n),F=ge(w-S),W=ge(N-L),M=de().domain(v).range([L,N]).padding(0),z=de().domain(b.map(J=>J.key)).range([0,M.bandwidth()]).padding(0),T=Ft().domain([E,H]).nice().range([w,S]),C=T.ticks(F),k=T(0),x=f.areaGroupedBarDimOpacity,A=f.areaGroupedBarBarOpacity,D=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Area grouped bar chart").style("display","block").style("font-family",a.fontFamily),B=D.append("defs").append("linearGradient").attr("id",xg).attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%");B.append("stop").attr("offset","0%").attr("stop-color",_).attr("stop-opacity",f.areaGroupedBarGradientTopOpacity),B.append("stop").attr("offset","100%").attr("stop-color",_).attr("stop-opacity",f.areaGroupedBarGradientBottomOpacity);const X=D.append("g").attr("class","plot");if(s){const J=X.append("g").attr("class","grid");for(const rt of v){const it=M(rt);if(it==null)continue;const lt=it+M.bandwidth()/2;J.append("line").attr("x1",lt).attr("x2",lt).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges")}for(const rt of C)J.append("line").attr("x1",L).attr("x2",N).attr("y1",T(rt)).attr("y2",T(rt)).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges");Number.isFinite(k)&&J.append("line").attr("class","zero-baseline").attr("x1",L).attr("x2",N).attr("y1",k).attr("y2",k).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const et=l&&u?X.append("rect").attr("class","hit-area").attr("x",L).attr("y",S).attr("width",N-L).attr("height",w-S).attr("fill","transparent").style("cursor","default"):null,K=X.append("g").attr("class","bars");for(const J of v){const rt=M(J);if(rt==null)continue;const it=g[J]??{},lt=K.append("g").attr("class","bar-category").attr("transform",`translate(${rt},0)`);for(const gt of b){const mt=z(gt.key);if(mt==null)continue;const bt=Number(it[gt.key]??0),dt=T(Math.max(0,bt)),Ct=Math.abs(k-T(bt)),ut=bt>=0?dt:k;lt.append("rect").attr("class","bar").attr("data-x",J).attr("data-g",gt.key).attr("x",mt).attr("y",ut).attr("width",z.bandwidth()).attr("height",Math.max(0,Ct)).attr("fill",gt.color).attr("opacity",A).style("cursor",l&&u?"pointer":"default")}}const at=$.map(J=>{const rt=M(J.x);return rt==null?null:{x:J.x,y:J.y,px:rt+M.bandwidth()/2,py:T(J.y)}}).filter(J=>J!=null),nt=X.append("g").attr("class","line-layer");if(at.length){const J=ro().x(lt=>lt.px).y0(k).y1(lt=>lt.py),rt=lr().x(lt=>lt.px).y(lt=>lt.py);nt.append("path").datum(at).attr("class","area").attr("fill",`url(#${xg})`).attr("pointer-events","none").attr("d",J),nt.append("path").datum(at).attr("class","line").attr("fill","none").attr("stroke",_).attr("stroke-width",f.lineStrokeWidth).attr("stroke-linecap","round").attr("pointer-events","none").attr("d",rt);const it=nt.append("g").attr("class","markers");for(const lt of at)it.append("circle").attr("class","marker").attr("data-x",lt.x).attr("cx",lt.px).attr("cy",lt.py).attr("r",f.areaGroupedBarMarkerRadius).attr("fill","#fff").attr("stroke",_).attr("stroke-width",1.5).attr("pointer-events","none")}const tt=X.append("line").attr("class","hover-guide").attr("y1",S).attr("y2",w).attr("stroke",c==="dark"?f.hoverGuideDark:f.hoverGuideLight).attr("stroke-width",2).attr("opacity",0).attr("pointer-events","none"),j=X.append("g").attr("class","hover-marker").attr("opacity",0).attr("pointer-events","none"),I=()=>{K.selectAll(".bar").attr("opacity",A),nt.attr("opacity",1),nt.selectAll(".marker").attr("opacity",1),tt.attr("opacity",0),j.attr("opacity",0).selectAll("*").remove(),d==null||d()},V=(J,rt)=>{K.selectAll(".bar").attr("opacity",function(){return ht(this).attr("data-x")===J?A:x}),nt.attr("opacity",1),nt.selectAll(".marker").attr("opacity",function(){return ht(this).attr("data-x")===J?1:x});const it=at.find(lt=>lt.x===J);it?(tt.attr("x1",it.px).attr("x2",it.px).attr("opacity",.35),j.selectAll("*").remove(),zp(j,{shape:"circle",color:_,cx:it.px,cy:it.py,r:f.markerRadius,themeMode:c,hovered:!0}),j.attr("opacity",1)):(tt.attr("opacity",0),j.attr("opacity",0).selectAll("*").remove()),u==null||u({category:J,mode:"category",event:rt})},U=(J,rt,it)=>{K.selectAll(".bar").attr("opacity",function(){const lt=ht(this);return lt.attr("data-x")===J&&lt.attr("data-g")===rt?A:x}),nt.attr("opacity",x),tt.attr("opacity",0),j.attr("opacity",0).selectAll("*").remove(),u==null||u({category:J,mode:"bar",groupKey:rt,event:it})};if(l&&u&&et){const J=D.node();et.on("mousemove",rt=>{const[it]=J?Ie(rt,J):[0];let lt=null,gt=Number.POSITIVE_INFINITY;for(const mt of v){const bt=M(mt);if(bt==null)continue;const dt=bt+M.bandwidth()/2,Ct=Math.abs(dt-it);Ct<gt&&(gt=Ct,lt=mt)}if(!lt||!at.some(mt=>mt.x===lt)){I();return}V(lt,rt)}),et.on("mouseleave",()=>I()),K.selectAll(".bar").on("mousemove",function(rt){rt.stopPropagation();const it=ht(this),lt=it.attr("data-x"),gt=it.attr("data-g");!lt||!gt||U(lt,gt,rt)}).on("mouseleave",()=>I())}const O=X.append("g").attr("class","x-axis").attr("transform",`translate(0,${w})`).call(ae(M).tickSize(0).tickPadding(8).tickValues((()=>{if(v.length<=W)return v;const J=[],rt=(v.length-1)/Math.max(1,W-1);for(let it=0;it<W;it++)J.push(v[Math.round(it*rt)]);return[...new Set(J)]})()).tickFormat(J=>String(J)));O.select(".domain").attr("stroke","none"),O.selectAll("line").attr("stroke","none"),O.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle"),cr(O,{slotWidth:M.bandwidth(),...m});const P=X.append("g").attr("class","y-axis").attr("transform",`translate(${L},0)`).call(Jt(T).tickValues(C).tickSize(4).tickPadding(6).tickFormat(J=>Aw(Number(J))));P.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray",f.gridDash),P.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray",f.gridDash),we(P,L)}const Us={categories:[],groups:[],barsByCategory:{},linePoints:[],lineColor:sf[0],lineLabel:"",lineField:"",barField:"",xField:"",groupField:""};function Kc(t){const e=Number(t);return Number.isFinite(e)?e:0}function fU(t){const e=Array.isArray(t.display)?t.display:t.display?[t.display]:[],n=Array.isArray(t.yAxe)?t.yAxe:t.yAxe?[t.yAxe]:[];return(e.length?e:n).map(String).filter(Boolean)}function mU(t,e,n){var i,r;const o=Array.from(new Set(t.map(s=>String(s[n]??"").trim()).filter(Boolean))),a=(r=(i=e.uniqueValues)==null?void 0:i[n])==null?void 0:r.map(String).filter(s=>o.includes(s));return a!=null&&a.length?a:me(o,e.uniqueValues,n)}function gU(t,e,n){var i;const r=(i=e.uniqueValues)==null?void 0:i[n],o=r!=null&&r.length?r.map(String):Array.from(new Set(t.map(a=>String(a[n]??"")).filter(Boolean)));return ci(o)}function yU(t,e,n){return n?zt(t,e,t.length||1):zt([{key:e,color:"1"}],e,1)}function vU(t,e,n,i,r){if(r)return zt(t,e,i);const o=Da(3,i);return o[(n+1)%o.length]??sf[1]}function bU(t){var e,n,i;const r=se(t),o=ft(t.xAxe)??"",a=ft(t.groupBy)??"",s=fU(t),l=s[0]||ft(t.yAxe)||"",c=s[1]||s[0]||"";if(!r.length||!o||!l)return Us;const u=mU(r,t,o),d=a?gU(r,t,a):[],h=pi(t),p=Array.isArray(t.formatting)&&(((e=t.formatting)==null?void 0:e.length)??0)>0,m=d.map((y,S)=>({key:y,label:y,color:vU(h,y,S,d.length,p)})),v=Object.create(null);if(a&&d.length)for(const y of r){const S=String(y[o]??"").trim(),w=String(y[a]??"").trim();if(!S||!w||w==="null"||w==="undefined")continue;const L=s.includes(w)&&y[w]!=null,N=Kc(L?y[w]:y[c]);v[S]||(v[S]=Object.create(null)),v[S][w]=(v[S][w]??0)+N}const b=Object.create(null);for(const y of r){const S=String(y[o]??"").trim();if(!S)continue;b[S]||(b[S]={barsSum:0});const w=Kc(y[l]);Number.isFinite(w)&&(b[S].line=w),b[S].barsSum+=Kc(y[c])}const g=u.map(y=>{const S=b[y];if(!S)return null;const w=Number.isFinite(S.line)?Number(S.line):Number(S.barsSum);return Number.isFinite(w)?{x:y,y:w}:null}).filter(y=>y!=null),$=((i=(n=t.axisDetails)==null?void 0:n[l])==null?void 0:i.label)??l;return g.length>0||Object.keys(v).length>0?{categories:u,groups:m,barsByCategory:v,linePoints:g,lineColor:yU(h,l,p),lineLabel:$,lineField:l,barField:c,xField:o,groupField:a,axisDetails:t.axisDetails??void 0}:Us}function Tw(t){return t?Ht(t)?bU(t):typeof t=="object"&&Array.isArray(t.categories)&&Array.isArray(t.linePoints)?t:Us:Us}var xU=Object.defineProperty,_U=Object.getOwnPropertyDescriptor,fi=(t,e,n,i)=>{for(var r=i>1?void 0:i?_U(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&xU(e,n,r),r};let Ar=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return Tw(t)}legendEntries(t){const e=[];t.lineField&&e.push({label:t.lineLabel||t.lineField,swatch:{kind:"line",color:t.lineColor}});for(const n of t.groups)e.push({label:n.label,swatch:{kind:"swatch",color:n.color,opacity:.85}});return e}renderLegend(t){if(!this.showLegend)return st;const e=this.legendEntries(t);return e.length<=1?st:ce(e)}tooltipLines(t,e){var n,i;const o=[`${((i=(n=t.axisDetails)==null?void 0:n[t.xField])==null?void 0:i.label)??t.xField}: ${e}`],a=t.barsByCategory[e]??{};let s=0;for(const u of t.groups){const d=a[u.key];Number.isFinite(d)&&(s+=d,o.push(`${u.label}: ${Pu(d)}`))}const l=t.linePoints.find(u=>u.x===e),c=(l==null?void 0:l.y)??s;if(Number.isFinite(c)){const u=t.lineLabel||t.lineField;o.push(`${u}: ${Pu(c)}`)}return o}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.categories.length===0&&n.linePoints.length===0&&n.groups.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=yC(e);zw(e,{model:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,showTooltip:this.showTooltip,...this.axisLabelHandlers(),onHover:this.showTooltip?({category:s,event:l})=>{const c=this.getBoundingClientRect();this._tooltip={x:l.clientX-c.left,y:l.clientY-c.top,lines:this.tooltipLines(n,s)}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?null:this.parseData();return ot`
523
+ <div class="widget-shell" part="shell">
524
+ ${this.renderShellHeader(t)}
525
+ <div class="widget-body">
526
+ ${e?this.renderLegend(e):st}
527
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
528
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
529
+ ${this._tooltip?ot`<div
530
+ class="tooltip"
531
+ part="tooltip"
532
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
533
+ >
534
+ ${this._tooltip.lines.map(n=>ot`<div>${n}</div>`)}
535
+ </div>`:st}
536
+ ${this.renderShellLabelTooltip()}
537
+ </div>
538
+ </div>
539
+ `}};Ar.styles=[af,ne];fi([Y({type:String,attribute:"scale"})],Ar.prototype,"scale",2);fi([Y({type:Boolean,attribute:"show-grid"})],Ar.prototype,"showGrid",2);fi([Y({type:Boolean,attribute:"show-legend"})],Ar.prototype,"showLegend",2);fi([Y({type:Boolean,attribute:"show-tooltip"})],Ar.prototype,"showTooltip",2);fi([yt()],Ar.prototype,"_tooltip",2);fi([yt()],Ar.prototype,"_empty",2);Ar=fi([Xt("ui9000-area-grouped-bar-chart")],Ar);function Lw(){customElements.get("ui9000-area-grouped-bar-chart")||customElements.define("ui9000-area-grouped-bar-chart",Ar)}Lw();const $U=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000AreaGroupedBarChart(){return Ar},areaGroupedBarChartMetadata:F_,areaGroupedBarYDomain:Sw,formatAgbAxisTick:Aw,formatAgbValue:Pu,normalizeAreaGroupedBarData:Tw,registerAreaGroupedBarChart:Lw,renderAreaGroupedBarChart:zw},Symbol.toStringTag,{value:"Module"}));function Cw(t,e){const n=new Set,i=[];for(const r of t)for(const o of r.points)n.has(o.label)||(n.add(o.label),i.push(o.label));if(e!=null&&e.length){const r=e.filter(o=>n.has(o));for(const o of i)r.includes(o)||r.push(o);return r}return i}function wU(t){let e=1/0,n=-1/0;for(const i of t)for(const r of i.points)r.value<e&&(e=r.value),r.value>n&&(n=r.value);if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e=Math.min(0,e),n=Math.max(0,n),e===n){const i=Math.abs(e)*.1||1;return[e-i,n+i]}return[e,n]}function _g(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function Iw(t,e){const{series:n,width:i,height:r,margin:o={...f.lollipopMargin},theme:a,orientation:s="vertical",marker:l="rhombus",showGrid:c=!0,labelHint:u,xLabel:d,yLabel:h,onPointHover:p,onPointLeave:m,onAxisLabelHover:v,onAxisLabelLeave:b}=e,g={onAxisLabelHover:v,onAxisLabelLeave:b};if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const $=Cw(n,u),_=s==="vertical",y={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,12)},S=y.top,w=r-y.bottom,L=y.left,N=i-y.right;if(N-L<8||w-S<8)return;const E=[];for(const k of n)for(const x of k.points)Number.isFinite(x.value)&&E.push(x.value);const[H,F]=Gr(E),W=H*1.2,M=F===0&&H===0?1:F*1.2,z=ge(r),C=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Lollipop chart").style("display","block").style("font-family",a.fontFamily).append("g").attr("class","plot");if(_){const k=de().domain($).range([L,N]).padding(0),x=Ft().domain([W,M]).nice().range([w,S]),A=x.ticks(z);if(c){const et=C.append("g").attr("class","grid");for(const K of $){const at=k(K);at!=null&&et.append("line").attr("x1",at).attr("x2",at).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges")}for(const K of A)et.append("line").attr("x1",L).attr("x2",N).attr("y1",x(K)).attr("y2",x(K)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges");et.append("line").attr("x1",N).attr("x2",N).attr("y1",S).attr("y2",w).attr("stroke","#e0e0e0").attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges"),et.append("line").attr("x1",L).attr("x2",N).attr("y1",x(0)).attr("y2",x(0)).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const D=x(0);n.forEach((et,K)=>{const at=_g(et,K,a),nt=C.append("g").attr("class",`series series-${et.id}`),tt=n.length>1?(K-(n.length-1)/2)*k.bandwidth()/Math.max(n.length,1):0;et.points.forEach(j=>{if(k(j.label)==null||!Number.isFinite(j.value))return;const I=(k(j.label)??0)+k.bandwidth()/2+tt,V=x(j.value),U=j.color??at,O=nt.append("g").attr("class","lollipop").style("cursor",p?"pointer":"default");O.append("line").attr("class","stem").attr("x1",I).attr("x2",I).attr("y1",V+2).attr("y2",D).attr("stroke",ws(U,f.lollipopStemAlphaPct)).attr("stroke-width",f.lollipopStemWidth),dm(O,{shape:l,color:U,cx:I,cy:V}),O.append("circle").attr("cx",I).attr("cy",V).attr("r",12).attr("fill","transparent"),p&&O.on("mouseenter",P=>{p({seriesId:et.id,seriesName:et.name??et.id,point:j,event:P})}).on("mouseleave",()=>m==null?void 0:m())})});const R=C.append("g").attr("class","x-axis").attr("transform",`translate(0,${w})`).call(ae(k).tickSize(0).tickPadding(8));R.select(".domain").attr("stroke",f.axisStroke),R.selectAll("line").attr("stroke","none"),R.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const B=R.selectAll("text").nodes();B.length>0&&(ht(B[0]).attr("text-anchor","start"),B.length>1&&ht(B[B.length-1]).attr("text-anchor","end")),cr(R,{slotWidth:k.bandwidth(),...g});const X=C.append("g").attr("class","y-axis").attr("transform",`translate(${L},0)`).call(Jt(x).tickValues(A).tickSize(5).tickPadding(6).tickFormat(et=>{const K=Number(et),at=Number.isInteger(K)&&Math.abs(K)<1e3?0:2;return Pt(K,at)}));X.select(".domain").attr("stroke","none"),X.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray","1 2"),we(X,L)}else{const k=de().domain($).range([S,w]).padding(.2),x=Ft().domain([W,M]).nice().range([L,N]),A=x.ticks(z);if(c){const et=C.append("g").attr("class","grid");for(const K of A)et.append("line").attr("x1",x(K)).attr("x2",x(K)).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges");et.append("line").attr("x1",x(0)).attr("x2",x(0)).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const D=x(0);n.forEach((et,K)=>{const at=_g(et,K,a),nt=C.append("g").attr("class",`series series-${et.id}`),tt=n.length>1?(K-(n.length-1)/2)*k.bandwidth()/Math.max(n.length,1):0;et.points.forEach(j=>{if(k(j.label)==null||!Number.isFinite(j.value))return;const I=(k(j.label)??0)+k.bandwidth()/2+tt,V=x(j.value),U=j.color??at,O=nt.append("g").style("cursor",p?"pointer":"default");O.append("line").attr("x1",D).attr("x2",V-2).attr("y1",I).attr("y2",I).attr("stroke",ws(U,f.lollipopStemAlphaPct)).attr("stroke-width",f.lollipopStemWidth),dm(O,{shape:l,color:U,cx:V,cy:I}),p&&O.on("mouseenter",P=>{p({seriesId:et.id,seriesName:et.name??et.id,point:j,event:P})}).on("mouseleave",()=>m==null?void 0:m())})});const R=C.append("g").attr("transform",`translate(${L},0)`).call(Jt(k).tickSize(0).tickPadding(8));R.select(".domain").attr("stroke",f.axisStroke),R.selectAll("line").attr("stroke","none"),we(R,L,g);const B=C.append("g").attr("transform",`translate(0,${w})`).call(ae(x).tickValues(A).tickSize(5).tickPadding(6).tickFormat(et=>{const K=Number(et),at=Number.isInteger(K)&&Math.abs(K)<1e3?0:2;return Pt(K,at)}));B.select(".domain").attr("stroke",f.axisStroke),B.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const X=B.selectAll("text").nodes();X.length>0&&(ht(X[0]).attr("text-anchor","start"),X.length>1&&ht(X[X.length-1]).attr("text-anchor","end"))}d&&C.append("text").attr("x",(L+N)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(d),h&&C.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(h)}const kU=ie`
540
+ :host {
541
+ display: block;
542
+ position: relative;
543
+ width: 100%;
544
+ height: 100%;
545
+ min-height: 220px;
546
+ color: var(--ui9000-color-text, #111827);
547
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
548
+ box-sizing: border-box;
549
+ }
550
+ .chart-root {
551
+ flex: 1 1 auto;
552
+ width: 100%;
553
+ min-height: 240px;
554
+ }
555
+ .tooltip {
556
+ position: absolute;
557
+ pointer-events: none;
558
+ z-index: 2;
559
+ padding: 6px 10px;
560
+ border-radius: 6px;
561
+ font-size: 12px;
562
+ line-height: 1.35;
563
+ background: var(--ui9000-color-text, #111827);
564
+ color: #fff;
565
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
566
+ transform: translate(-50%, calc(-100% - 10px));
567
+ white-space: nowrap;
568
+ }
569
+ .tooltip .name {
570
+ font-weight: 600;
571
+ }
572
+ .empty {
573
+ display: grid;
574
+ place-items: center;
575
+ height: 100%;
576
+ min-height: inherit;
577
+ color: var(--ui9000-color-text-muted, #6b7280);
578
+ font-size: 0.875rem;
579
+ }
580
+ `;function Ja(t){return"label"in t&&"value"in t?{label:String(t.label),value:Number(t.value),color:"color"in t?t.color:void 0}:{label:"",value:NaN}}function $g(t){const e=se(t),n=ft(t.xAxe)??"label",i=ft(t.yAxe)??"value",r=ft(t.groupBy),o=t.formatting;if(r){const s=new Map;for(const c of e){const u=c[n],d=Number(c[i]);if(u==null||!Number.isFinite(d))continue;const h=String(c[r]??"default"),p=s.get(h)??[];p.push({label:String(u),value:d}),s.set(h,p)}const l=me(s.keys(),t.uniqueValues,r);return l.map(c=>({id:c,name:c,color:zt(o,c,l.length),points:s.get(c)}))}const a=[];for(const s of e){const l=s[n],c=Number(s[i]);if(l==null||!Number.isFinite(c))continue;const u=String(l);a.push({label:u,value:c,color:zt(o,u,e.length)})}return a.length?[{id:"default",name:"Series",points:a}]:[]}function Mw(t){var e,n;if(!t)return[];if(Array.isArray(t)){if(t.length===0)return[];const r=t[0];return"points"in r&&Array.isArray(r.points)?t.map((o,a)=>({id:o.id||`series-${a}`,name:o.name??o.id??`Series ${a+1}`,color:o.color,points:o.points.map(Ja).filter(s=>s.label!==""&&Number.isFinite(s.value))})):[{id:"default",name:"Series",points:t.map(Ja).filter(o=>o.label!==""&&Number.isFinite(o.value))}]}if(Ht(t)&&!("series"in t)&&!("points"in t))return $g(t);const i=t;return(e=i.series)!=null&&e.length?i.series.map((r,o)=>({id:r.id||`series-${o}`,name:r.name??r.id??`Series ${o+1}`,color:r.color,points:r.points.map(Ja).filter(a=>a.label!==""&&Number.isFinite(a.value))})):(n=i.points)!=null&&n.length?[{id:"default",name:"Series",points:i.points.map(Ja).filter(r=>r.label!==""&&Number.isFinite(r.value))}]:Ht(t)?$g(t):[]}var SU=Object.defineProperty,AU=Object.getOwnPropertyDescriptor,Dr=(t,e,n,i)=>{for(var r=i>1?void 0:i?AU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&SU(e,n,r),r};let Pe=class extends qt{constructor(){super(...arguments),this.scale="default",this.orientation="vertical",this.marker="rhombus",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return Mw(t)}labelHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){if(!this.showLegend||t.length<=1)return st;const e=wt(this);return ce(Nr(t.map(n=>n.name??n.id),e,(n,i)=>po(t[i],i,e)))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=eC(e);Iw(e,{series:n,width:r,height:o,margin:a,theme:i,orientation:this.orientation,marker:this.marker,showGrid:this.showGrid,labelHint:this.labelHint(),xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onPointHover:this.showTooltip?({seriesName:s,point:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,seriesName:s,pointLabel:l.label,pointValue:l.value}}:void 0,onPointLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData();return ot`
581
+ <div class="widget-shell" part="shell">
582
+ ${this.renderShellHeader(t)}
583
+ <div class="widget-body">
584
+ ${this.renderLegend(e)}
585
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
586
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
587
+ ${this._tooltip?ot`<div
588
+ class="tooltip"
589
+ part="tooltip"
590
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
591
+ >
592
+ <div class="name">${this._tooltip.seriesName}</div>
593
+ <div>${this._tooltip.pointLabel}: ${this._tooltip.pointValue}</div>
594
+ </div>`:st}
595
+ ${this.renderShellLabelTooltip()}
596
+ </div>
597
+ </div>
598
+ `}};Pe.styles=[kU,ne];Dr([Y({type:String,attribute:"scale"})],Pe.prototype,"scale",2);Dr([Y({type:String})],Pe.prototype,"orientation",2);Dr([Y({type:String})],Pe.prototype,"marker",2);Dr([Y({type:Boolean,attribute:"show-grid"})],Pe.prototype,"showGrid",2);Dr([Y({type:Boolean,attribute:"show-legend"})],Pe.prototype,"showLegend",2);Dr([Y({type:Boolean,attribute:"show-tooltip"})],Pe.prototype,"showTooltip",2);Dr([Y({type:String,attribute:"x-label"})],Pe.prototype,"xLabel",2);Dr([Y({type:String,attribute:"y-label"})],Pe.prototype,"yLabel",2);Dr([yt()],Pe.prototype,"_tooltip",2);Dr([yt()],Pe.prototype,"_empty",2);Pe=Dr([Xt("ui9000-lollipop")],Pe);function Nw(){customElements.get("ui9000-lollipop")||customElements.define("ui9000-lollipop",Pe)}Nw();function zU(t){const e=Math.abs(t);return e>=1e9?`${(t/1e9).toFixed(1)}B`:e>=1e6?`${(t/1e6).toFixed(1)}M`:e>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?String(t):t.toFixed(1)}const TU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000Lollipop(){return Pe},collectLabels:Cw,collectValueExtent:wU,formatCompact:zU,lollipopMetadata:K_,normalizeLollipopData:Mw,registerLollipop:Nw,renderLollipopChart:Iw},Symbol.toStringTag,{value:"Module"})),LU=/^\d{4}-\d{2}-\d{2}$/;function Br(t){if(LU.exec(t)){const[n,i,r]=t.split("-").map(Number);return new Date(n,i-1,r)}return new Date(t)}function Dw(t,e){const n=new Set,i=[];for(const r of t)for(const o of r.points)n.has(o.x)||(n.add(o.x),i.push(o.x));if(e!=null&&e.length){const r=e.filter(o=>n.has(o));for(const o of i)r.includes(o)||r.push(o);return r}return i}function mc(t){if(!t.length)return!1;const e=[];for(const n of t){const i=Br(n).valueOf();if(Number.isNaN(i))return!1;e.push(i)}return new Set(e).size>=2}function Ow(t){return mc(t)?[...t].sort((e,n)=>Br(e).valueOf()-Br(n).valueOf()):t}function Pw(t){const e=[];for(const o of t)for(const a of o.points)Number.isFinite(a.y)&&e.push(a.y);if(!e.length)return[0,1];const[n,i]=Gr(e);if(n===0&&i===0)return[0,1];const r=f.stepDomainPadFactor;return[n*r,i*r]}function Ew(t,e){return e.map(n=>{let i=0,r=0;for(const o of t){const a=o.points.find(l=>l.x===n),s=Number(a==null?void 0:a.y);Number.isFinite(s)&&(i+=s,r+=1)}return r?i/r:NaN})}function cf(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function CU(t){const e=new Set(t.map(o=>o.getFullYear())),n=t.some(o=>o.getHours()||o.getMinutes()||o.getSeconds()),i={month:"short",day:"numeric",...e.size>1?{year:"numeric"}:{}},r={hour:"2-digit",minute:"2-digit"};return o=>{const a=o.toLocaleDateString(void 0,i);return n?`${a} ${o.toLocaleTimeString(void 0,r)}`:a}}function Fw(t,e,n=6.2,i=8){const r=t.length;if(r<=1)return r===1?[0]:[];const o=c=>{const u=t[c].length*n,d=e[c];return c===0?[d,d+u]:c===r-1?[d-u,d]:[d-u/2,d+u/2]},a=[];let s=-1/0;for(let c=0;c<r-1;c++){if(!Number.isFinite(e[c]))continue;const[u,d]=o(c);u>=s+i&&(a.push(c),s=d)}if(!Number.isFinite(e[r-1]))return a;const[l]=o(r-1);for(;a.length&&o(a[a.length-1])[1]+i>l;)a.pop();return a.push(r-1),a}function Yc(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function Rw(t,e){const{series:n,width:i,height:r,margin:o={...f.stepLineMargin},theme:a,grafType:s="none",showGrid:l=!0,xDomainHint:c,showTooltip:u=!0,xLabel:d,yLabel:h,onHover:p,onLeave:m,onAxisLabelHover:v,onAxisLabelLeave:b}=e,g={onAxisLabelHover:v,onAxisLabelLeave:b};if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const $={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,12)},_=$.top+(h?12:0),y=r-$.bottom-(d?12:0),S=$.left,w=i-$.right;if(w-S<8||y-_<8)return;const L=Ow(Dw(n,c)),N=mc(L),E=N?L.map(Br):[],H=N?Yp().domain([E[0],E[E.length-1]]).range([S,w]):null,F=N?null:de().domain(L).range([S,w]).padding(.1),W=P=>{if(H){const rt=Br(P);return Number.isNaN(rt.valueOf())?NaN:H(rt)}const J=F==null?void 0:F(P);return J==null?NaN:J+((F==null?void 0:F.bandwidth())??0)/2},[M,z]=Pw(n),T=Ft().domain([M,z]).nice().range([y,_]),C=T.ticks(ge(r)),k=N?CU(E):null,x=P=>k?k(Br(P)):P,A=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Step line chart").style("display","block").style("font-family",a.fontFamily),D=A.append("g").attr("class","plot");if(l){const P=D.append("g").attr("class","grid");for(const J of L){const rt=W(J);Number.isFinite(rt)&&P.append("line").attr("x1",rt).attr("x2",rt).attr("y1",_).attr("y2",y).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges")}P.append("line").attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",y).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges");for(const J of C)P.append("line").attr("x1",S).attr("x2",w).attr("y1",T(J)).attr("y2",T(J)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges");P.append("line").attr("class","zero-line").attr("x1",S).attr("x2",w).attr("y1",T(0)).attr("y2",T(0)).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const R=new Map(L.map((P,J)=>[P,J])),B=lr().defined(P=>Number.isFinite(P.y)&&Number.isFinite(W(P.x))).x(P=>W(P.x)).y(P=>T(P.y)).curve(lw);n.forEach((P,J)=>{const rt=Yc(P,J,a),it=[...P.points].sort((lt,gt)=>(R.get(lt.x)??0)-(R.get(gt.x)??0));it.length&&D.append("g").attr("class",`series series-${P.id}`).append("path").datum(it).attr("fill","none").attr("stroke",rt).attr("stroke-width",f.stepStrokeWidth).attr("stroke-linecap","round").attr("d",B)});const X=IU(n,L,s,M,z);if(X){const P=L.map((rt,it)=>({x:rt,y:X[it]})).filter(rt=>Number.isFinite(rt.y)),J=lr().x(rt=>W(rt.x)).y(rt=>T(rt.y));s==="curve"&&J.curve(Rs.alpha(.5)),D.append("path").attr("class",`overlay overlay-${s}`).datum(P).attr("fill","none").attr("stroke",s==="line"?a.textMuted:f.stepIdealColor).attr("stroke-width",s==="line"?f.stepGuessWidth:f.stepIdealWidth).attr("stroke-linecap","round").attr("stroke-dasharray",s==="line"?f.stepGuessDash:null).attr("d",J)}if(s==="curve"&&X){const P=n.find(rt=>rt.id==="default")??n[0];let J=null;if(L.forEach((rt,it)=>{var lt;const gt=(lt=P.points.find(dt=>dt.x===rt))==null?void 0:lt.y,mt=X[it];if(!Number.isFinite(gt)||!Number.isFinite(mt))return;const bt=Math.abs(gt-mt);(!J||bt>J.diff)&&(J={x:rt,actual:gt,ideal:mt,diff:bt})}),J){const rt=J,it=W(rt.x),lt=T(rt.actual),gt=T(rt.ideal),mt=Math.min(lt,gt),bt=Math.max(lt,gt),dt=(mt+bt)/2,Ct=cf(rt.diff),ut=Ct.length*7+12,kt=18,It=D.append("g").attr("class","max-deviation").attr("pointer-events","none");It.append("line").attr("x1",it).attr("x2",it).attr("y1",mt).attr("y2",bt).attr("stroke",f.stepDeviationFill).attr("stroke-width",2).attr("stroke-dasharray","4,4").attr("opacity",.95),It.append("path").attr("d",`M ${it} ${mt+8} L ${it-6} ${mt} L ${it+6} ${mt} Z`).attr("fill",f.stepDeviationFill),It.append("path").attr("d",`M ${it} ${bt-8} L ${it-6} ${bt} L ${it+6} ${bt} Z`).attr("fill",f.stepDeviationFill),It.append("rect").attr("x",it-ut/2).attr("y",dt-kt/2).attr("width",ut).attr("height",kt).attr("rx",9).attr("ry",9).attr("fill",f.stepDeviationFill).attr("opacity",.98),It.append("text").attr("x",it).attr("y",dt+5).attr("text-anchor","middle").attr("font-size",12).attr("fill","#ffffff").text(Ct)}}const et=D.append("g").attr("class","x-axis"),K=L.map(x),at=L.map(W);for(const P of Fw(K,at)){const J=P===0,rt=P===L.length-1,it=rt?w:at[P+1],lt=J?S:at[P-1],gt=Math.min(Math.abs(it-at[P]),Math.abs(at[P]-lt)),mt=et.append("text").attr("x",at[P]).attr("y",y+16).attr("text-anchor",J?"start":rt?"end":"middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize);fo(mt,K[P],{slotWidth:gt,...g})}const nt=D.append("g").attr("class","y-axis").attr("transform",`translate(${S},0)`).call(Jt(T).tickValues(C).tickSize(4).tickPadding(6).tickFormat(P=>{const J=Number(P),rt=Number.isInteger(J)&&Math.abs(J)<1e3?0:2;return Pt(J,rt)}));if(nt.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray","1,2"),nt.selectAll(".tick line").attr("stroke",f.axisStroke),we(nt,S),d&&D.append("text").attr("x",(S+w)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(d),h&&D.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(h),!u||!p)return;const tt=Yc(n[0],0,a),j=D.append("g").attr("class","hover").attr("pointer-events","none"),I=j.append("line").attr("stroke",tt).attr("stroke-width",1).attr("stroke-dasharray",f.stepGuideDash).attr("opacity",0),V=j.append("g").attr("class","hover-dots"),U=()=>{I.attr("opacity",0),V.selectAll("*").remove(),m==null||m()},O=P=>{if(H){let lt=0,gt=1/0;for(let mt=0;mt<E.length;mt++){const bt=Math.abs(H(E[mt])-P);bt<gt&&(gt=bt,lt=mt)}return lt}if(!F)return 0;const J=F.step()||1,rt=J*F.paddingInner()/2,it=Math.floor((P-S+rt)/J);return Math.max(0,Math.min(it,L.length-1))};D.append("rect").attr("class","hover-target").attr("x",S).attr("y",_).attr("width",w-S).attr("height",y-_).attr("rx",14).attr("fill","transparent").on("mousemove",P=>{const[J]=Ie(P,A.node()),rt=O(J),it=L[rt];if(it==null)return;const lt=W(it);if(!Number.isFinite(lt))return;I.attr("x1",lt).attr("x2",lt).attr("y1",_).attr("y2",y).attr("opacity",1),V.selectAll("*").remove();const gt=[];n.forEach((mt,bt)=>{const dt=mt.points.find(ut=>ut.x===it);if(!dt||!Number.isFinite(dt.y))return;const Ct=Yc(mt,bt,a);gt.push({seriesId:mt.id,seriesName:mt.name??mt.id,color:Ct,value:dt.y}),V.append("circle").attr("cx",lt).attr("cy",T(dt.y)).attr("r",f.stepHoverDotRadius).attr("fill",Ct).attr("stroke","#fff").attr("stroke-width",2)}),p({x:it,xLabel:x(it),entries:gt,event:P})}).on("mouseleave",U)}function IU(t,e,n,i,r){if(n==="none"||e.length<2)return null;const o=Ew(t,e);let a=o.findIndex(m=>Number.isFinite(m));a<0&&(a=0);let s=o.length-1;for(let m=o.length-1;m>=0;m--)if(Number.isFinite(o[m])){s=m;break}const l=Number.isFinite(o[a])?o[a]:i,c=Number.isFinite(o[s])?o[s]:r;if(n==="line")return e.map((m,v)=>v===0?l:v===e.length-1?c:l+(c-l)*v/(e.length-1));const u=mc(e),d=u?Br(e[0]).valueOf():0,h=u?Br(e[e.length-1]).valueOf():e.length-1,p=Math.max(1,h-d);return e.map((m,v)=>{const g=((u?Br(m).valueOf():v)-d)/p,$=1/(1+Math.exp(-10*(g-.5)));return l+(c-l)*$})}const jw=ie`
599
+ :host {
600
+ display: block;
601
+ position: relative;
602
+ width: 100%;
603
+ height: 100%;
604
+ min-height: 220px;
605
+ color: var(--ui9000-color-text, #111827);
606
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
607
+ box-sizing: border-box;
608
+ }
609
+ .chart-root {
610
+ flex: 1 1 auto;
611
+ width: 100%;
612
+ min-height: 240px;
613
+ }
614
+ .tooltip {
615
+ position: absolute;
616
+ pointer-events: none;
617
+ z-index: 2;
618
+ padding: 6px 10px;
619
+ border-radius: 6px;
620
+ font-size: 12px;
621
+ line-height: 1.35;
622
+ background: var(--ui9000-color-text, #111827);
623
+ color: #fff;
624
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
625
+ transform: translate(-50%, calc(-100% - 12px));
626
+ white-space: nowrap;
627
+ }
628
+ .tooltip .x {
629
+ font-weight: 600;
630
+ margin-bottom: 2px;
631
+ }
632
+ .tooltip .row {
633
+ display: flex;
634
+ align-items: center;
635
+ gap: 6px;
636
+ }
637
+ .tooltip .swatch {
638
+ width: 8px;
639
+ height: 8px;
640
+ border-radius: 2px;
641
+ flex: none;
642
+ }
643
+ .tooltip .value {
644
+ margin-left: auto;
645
+ font-variant-numeric: tabular-nums;
646
+ }
647
+ .empty {
648
+ display: grid;
649
+ place-items: center;
650
+ height: 100%;
651
+ min-height: inherit;
652
+ color: var(--ui9000-color-text-muted, #6b7280);
653
+ font-size: 0.875rem;
654
+ }
655
+ `;function Ao(t){return t.filter(e=>e.x!=null&&e.y!=null&&Number.isFinite(Number(e.y))).map(e=>({x:String(e.x),y:Number(e.y)}))}function wg(t){const e=se(t),n=ft(t.xAxe)??"x",i=ft(t.yAxe)??"y",r=ft(t.groupBy),o=t.formatting;if(r){const s=new Map;for(const c of e){const u=c[n],d=Number(c[i]);if(u==null||!Number.isFinite(d))continue;const h=String(c[r]??"default"),p=s.get(h)??[];p.push({x:String(u),y:d}),s.set(h,p)}const l=me(s.keys(),t.uniqueValues,r);return l.map(c=>({id:c,name:c,color:zt(o,c,l.length),points:s.get(c)}))}const a=Ao(e.map(s=>({x:s[n],y:s[i]})));return a.length?[{id:"default",name:"Series",color:zt(o,"default",1),points:a}]:[]}function Uw(t){var e,n;if(!t)return[];if(Array.isArray(t)){if(t.length===0)return[];const r=t[0];return"points"in r&&Array.isArray(r.points)?t.map((o,a)=>({id:o.id||`series-${a}`,name:o.name??o.id??`Series ${a+1}`,color:o.color,points:Ao(o.points??[])})):[{id:"default",name:"Series",points:Ao(t.map(o=>({x:o.label,y:o.value})))}]}if(Ht(t)&&!("series"in t)&&!("points"in t))return wg(t);const i=t;return(e=i.series)!=null&&e.length?i.series.map((r,o)=>({id:r.id||`series-${o}`,name:r.name??r.id??`Series ${o+1}`,color:r.color,points:Ao(r.points??[])})):(n=i.points)!=null&&n.length?[{id:"default",name:"Series",points:Ao(i.points)}]:Ht(t)?wg(t):[]}var MU=Object.defineProperty,NU=Object.getOwnPropertyDescriptor,Vr=(t,e,n,i)=>{for(var r=i>1?void 0:i?NU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&MU(e,n,r),r};let He=class extends qt{constructor(){super(...arguments),this.scale="default",this.grafType="none",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return Uw(t)}xDomainHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){const e=this.grafType==="curve"?{label:"Ideal",kind:"line",color:f.stepIdealColor}:this.grafType==="line"?{label:"Random guessing",kind:"dashed-line",color:""}:null,n=t.length+(e?1:0);if(!this.showLegend||n<=1)return st;const i=wt(this),r=ui(t,i);return e&&r.push({label:e.label,swatch:e.kind==="dashed-line"?{kind:"dashed-line",color:i.textMuted}:{kind:"line",color:e.color}}),ce(r)}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0||n.every(s=>!s.points.length),this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=nC(e);Rw(e,{series:n,width:r,height:o,margin:a,theme:i,grafType:this.grafType,showGrid:this.showGrid,xDomainHint:this.xDomainHint(),showTooltip:this.showTooltip,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onHover:this.showTooltip?({xLabel:s,entries:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,xLabel:s,entries:l}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData().filter(n=>n.points.length>0);return ot`
656
+ <div class="widget-shell" part="shell">
657
+ ${this.renderShellHeader(t)}
658
+ <div class="widget-body">
659
+ ${this.renderLegend(e)}
660
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
661
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
662
+ ${this._tooltip?ot`<div
663
+ class="tooltip"
664
+ part="tooltip"
665
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
666
+ >
667
+ <div class="x">${this._tooltip.xLabel}</div>
668
+ ${this._tooltip.entries.map(n=>ot`<div class="row">
669
+ <span class="swatch" style="background:${n.color}"></span>
670
+ <span>${n.seriesName}</span>
671
+ <span class="value">${cf(n.value)}</span>
672
+ </div>`)}
673
+ </div>`:st}
674
+ ${this.renderShellLabelTooltip()}
675
+ </div>
676
+ </div>
677
+ `}};He.styles=[jw,ne];Vr([Y({type:String,attribute:"scale"})],He.prototype,"scale",2);Vr([Y({type:String,attribute:"graf-type"})],He.prototype,"grafType",2);Vr([Y({type:Boolean,attribute:"show-grid"})],He.prototype,"showGrid",2);Vr([Y({type:Boolean,attribute:"show-legend"})],He.prototype,"showLegend",2);Vr([Y({type:Boolean,attribute:"show-tooltip"})],He.prototype,"showTooltip",2);Vr([Y({type:String,attribute:"x-label"})],He.prototype,"xLabel",2);Vr([Y({type:String,attribute:"y-label"})],He.prototype,"yLabel",2);Vr([yt()],He.prototype,"_tooltip",2);Vr([yt()],He.prototype,"_empty",2);He=Vr([Xt("ui9000-step-line-chart")],He);function Bw(){customElements.get("ui9000-step-line-chart")||customElements.define("ui9000-step-line-chart",He)}Bw();const DU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000StepLineChart(){return He},averageYByX:Ew,collectStepXDomain:Dw,collectStepYDomain:Pw,formatCompact:cf,isDateXDomain:mc,normalizeStepLineData:Uw,orderStepXDomain:Ow,parseXDate:Br,registerStepLineChart:Bw,renderStepLineChart:Rw,selectTickIndices:Fw,stepLineChartMetadata:l$},Symbol.toStringTag,{value:"Module"})),OU=/^\d{4}-\d{2}-\d{2}$/;function kr(t){if(OU.exec(t)){const[n,i,r]=t.split("-").map(Number);return new Date(n,i-1,r)}return new Date(t)}function gc(t,e){const n=new Set,i=[];for(const r of t)for(const o of r.points)n.has(o.x)||(n.add(o.x),i.push(o.x));if(e!=null&&e.length){const r=e.filter(o=>n.has(o));for(const o of i)r.includes(o)||r.push(o);return r}return i}function yc(t){return[...t].sort((e,n)=>kr(e).valueOf()-kr(n).valueOf())}function uf(t){const e=[];for(const o of t)for(const a of o.points)Number.isFinite(a.y)&&e.push(a.y);if(!e.length)return[0,1];const[n,i]=Gr(e);if(n===0&&i===0)return[0,1];const r=f.sparkDomainPadFactor;return[n*r,i*r]}function no(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function Hw(t){const e=new Set(t.map(o=>o.getFullYear())),n=t.some(o=>o.getHours()||o.getMinutes()||o.getSeconds()),i={month:"short",day:"numeric",...e.size>1?{year:"numeric"}:{}},r={hour:"2-digit",minute:"2-digit"};return o=>{const a=o.toLocaleDateString(void 0,i);return n?`${a} ${o.toLocaleTimeString(void 0,r)}`:a}}function vc(t,e,n=6.2,i=8){const r=t.length;if(r<=1)return r===1?[0]:[];const o=c=>{const u=t[c].length*n,d=e[c];return c===0?[d,d+u]:c===r-1?[d-u,d]:[d-u/2,d+u/2]},a=[];let s=-1/0;for(let c=0;c<r-1;c++){if(!Number.isFinite(e[c]))continue;const[u,d]=o(c);u>=s+i&&(a.push(c),s=d)}if(!Number.isFinite(e[r-1]))return a;const[l]=o(r-1);for(;a.length&&o(a[a.length-1])[1]+i>l;)a.pop();return a.push(r-1),a}function Jc(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function bc(t,e){const{series:n,width:i,height:r,margin:o={...f.sparkLineMargin},theme:a,showGrid:s=!0,showArea:l=!1,xDomainHint:c,showTooltip:u=!0,xLabel:d,yLabel:h,onHover:p,onLeave:m,onAxisLabelHover:v,onAxisLabelLeave:b}=e,g={onAxisLabelHover:v,onAxisLabelLeave:b};if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const $={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,12)},_=$.top+(h?12:0),y=r-$.bottom-(d?12:0),S=$.left,w=i-$.right;if(w-S<8||y-_<8)return;const L=yc(gc(n,c));if(L.length<2)return;const N=L.map(kr),E=Yp().domain([N[0],N[N.length-1]]).range([S,w]),H=P=>{const J=kr(P);return Number.isNaN(J.valueOf())?NaN:E(J)},[F,W]=uf(n),M=Ft().domain([F,W]).nice().range([y,_]),z=M.ticks(ge(r)),T=Hw(N),C=E.ticks(),k=P=>T(P),x=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label",l?"Spark area chart":"Spark line chart").style("display","block").style("font-family",a.fontFamily),A=x.append("g").attr("class","plot");if(s){const P=A.append("g").attr("class","grid");for(const J of C){const rt=E(J);Number.isFinite(rt)&&P.append("line").attr("x1",rt).attr("x2",rt).attr("y1",_).attr("y2",y).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges")}P.append("line").attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",y).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges");for(const J of z)P.append("line").attr("x1",S).attr("x2",w).attr("y1",M(J)).attr("y2",M(J)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges");P.append("line").attr("class","zero-line").attr("x1",S).attr("x2",w).attr("y1",M(0)).attr("y2",M(0)).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const D=new Map(L.map((P,J)=>[P,J])),R=lr().defined(P=>Number.isFinite(P.y)&&Number.isFinite(H(P.x))).x(P=>H(P.x)).y(P=>M(P.y)),B=M(0),X=ro().defined(P=>Number.isFinite(P.y)&&Number.isFinite(H(P.x))).x(P=>H(P.x)).y0(B).y1(P=>M(P.y));n.forEach((P,J)=>{const rt=Jc(P,J,a),it=[...P.points].sort((gt,mt)=>(D.get(gt.x)??0)-(D.get(mt.x)??0));if(!it.length)return;const lt=A.append("g").attr("class",`series series-${P.id}`);l&&lt.append("path").attr("class","area").datum(it).attr("fill",rt).attr("fill-opacity",.1).attr("pointer-events","none").attr("d",X),lt.append("path").attr("class","line").datum(it).attr("fill","none").attr("stroke",rt).attr("stroke-width",f.sparkLineStrokeWidth).attr("stroke-linecap","round").attr("d",R)});const et=A.append("g").attr("class","x-axis"),K=C.map(k),at=C.map(P=>E(P));for(const P of vc(K,at)){const J=P===0,rt=P===C.length-1,it=rt?w:at[P+1],lt=J?S:at[P-1],gt=Math.min(Math.abs(it-at[P]),Math.abs(at[P]-lt)),mt=et.append("text").attr("x",at[P]).attr("y",y+16).attr("text-anchor",J?"start":rt?"end":"middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize);fo(mt,K[P],{slotWidth:gt,...g})}const nt=A.append("g").attr("class","y-axis").attr("transform",`translate(${S},0)`).call(Jt(M).tickValues(z).tickSize(4).tickPadding(6).tickFormat(P=>{const J=Number(P),rt=Number.isInteger(J)&&Math.abs(J)<1e3?0:2;return Pt(J,rt)}));if(nt.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray","1,2"),nt.selectAll(".tick line").attr("stroke",f.axisStroke),we(nt,S),d&&A.append("text").attr("x",(S+w)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(d),h&&A.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(h),!u||!p)return;const tt=Jc(n[0],0,a),j=A.append("g").attr("class","hover").attr("pointer-events","none"),I=j.append("line").attr("stroke",tt).attr("stroke-width",1).attr("stroke-dasharray",f.sparkGuideDash).attr("opacity",0),V=j.append("g").attr("class","hover-dots"),U=()=>{I.attr("opacity",0),V.selectAll("*").remove(),m==null||m()},O=P=>{let J=0,rt=1/0;for(let it=0;it<N.length;it++){const lt=Math.abs(E(N[it])-P);lt<rt&&(rt=lt,J=it)}return J};A.append("rect").attr("class","hover-target").attr("x",S).attr("y",_).attr("width",w-S).attr("height",y-_).attr("rx",14).attr("fill","transparent").on("mousemove",P=>{const[J]=Ie(P,x.node()),rt=O(J),it=L[rt];if(it==null)return;const lt=H(it);if(!Number.isFinite(lt))return;I.attr("x1",lt).attr("x2",lt).attr("y1",_).attr("y2",y).attr("opacity",1),V.selectAll("*").remove();const gt=[];n.forEach((mt,bt)=>{const dt=mt.points.find(ut=>ut.x===it);if(!dt||!Number.isFinite(dt.y))return;const Ct=Jc(mt,bt,a);gt.push({seriesId:mt.id,seriesName:mt.name??mt.id,color:Ct,value:dt.y}),V.append("circle").attr("cx",lt).attr("cy",M(dt.y)).attr("r",f.sparkHoverDotRadius).attr("fill",Ct).attr("stroke","#fff").attr("stroke-width",2)}),p({x:it,xLabel:T(kr(it)),entries:gt,event:P})}).on("mouseleave",U)}const df=ie`
678
+ :host {
679
+ display: block;
680
+ position: relative;
681
+ width: 100%;
682
+ height: 100%;
683
+ min-height: 220px;
684
+ color: var(--ui9000-color-text, #111827);
685
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
686
+ box-sizing: border-box;
687
+ }
688
+ .chart-root {
689
+ flex: 1;
690
+ min-height: 0;
691
+ width: 100%;
692
+ height: 100%;
693
+ min-height: inherit;
694
+ }
695
+ .tooltip {
696
+ position: absolute;
697
+ pointer-events: none;
698
+ z-index: 2;
699
+ padding: 6px 10px;
700
+ border-radius: 6px;
701
+ font-size: 12px;
702
+ line-height: 1.35;
703
+ background: var(--ui9000-color-text, #111827);
704
+ color: #fff;
705
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
706
+ transform: translate(-50%, calc(-100% - 12px));
707
+ white-space: nowrap;
708
+ }
709
+ .tooltip .x {
710
+ font-weight: 600;
711
+ margin-bottom: 2px;
712
+ }
713
+ .tooltip .row {
714
+ display: flex;
715
+ align-items: center;
716
+ gap: 6px;
717
+ }
718
+ .tooltip .swatch {
719
+ width: 8px;
720
+ height: 8px;
721
+ border-radius: 2px;
722
+ flex: none;
723
+ }
724
+ .tooltip .value {
725
+ margin-left: auto;
726
+ font-variant-numeric: tabular-nums;
727
+ }
728
+ .empty {
729
+ display: grid;
730
+ place-items: center;
731
+ height: 100%;
732
+ min-height: inherit;
733
+ color: var(--ui9000-color-text-muted, #6b7280);
734
+ font-size: 0.875rem;
735
+ }
736
+ `;function zo(t){return t.filter(e=>e.x!=null&&e.y!=null&&Number.isFinite(Number(e.y))).map(e=>({x:String(e.x),y:Number(e.y)}))}function kg(t){const e=se(t),n=ft(t.xAxe)??"x",i=ft(t.yAxe)??"y",r=ft(t.groupBy),o=t.formatting;if(r){const s=new Map;for(const c of e){const u=c[n],d=Number(c[i]);if(u==null||!Number.isFinite(d))continue;const h=String(c[r]??"default"),p=s.get(h)??[];p.push({x:String(u),y:d}),s.set(h,p)}const l=me(s.keys(),t.uniqueValues,r);return l.map(c=>({id:c,name:c,color:zt(o,c,l.length),points:s.get(c)}))}const a=zo(e.map(s=>({x:s[n],y:s[i]})));return a.length?[{id:"default",name:"Series",color:zt(o,"default",1),points:a}]:[]}function xc(t){var e,n;if(!t)return[];if(Array.isArray(t)){if(t.length===0)return[];const r=t[0];return"points"in r&&Array.isArray(r.points)?t.map((o,a)=>({id:o.id||`series-${a}`,name:o.name??o.id??`Series ${a+1}`,color:o.color,points:zo(o.points??[])})):[{id:"default",name:"Series",points:zo(t.map(o=>({x:o.label,y:o.value})))}]}if(Ht(t)&&!("series"in t)&&!("points"in t))return kg(t);const i=t;return(e=i.series)!=null&&e.length?i.series.map((r,o)=>({id:r.id||`series-${o}`,name:r.name??r.id??`Series ${o+1}`,color:r.color,points:zo(r.points??[])})):(n=i.points)!=null&&n.length?[{id:"default",name:"Series",points:zo(i.points)}]:Ht(t)?kg(t):[]}var PU=Object.defineProperty,EU=Object.getOwnPropertyDescriptor,ln=(t,e,n,i)=>{for(var r=i>1?void 0:i?EU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&PU(e,n,r),r};let We=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return xc(t)}xDomainHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){if(!this.showLegend||t.length<=1)return st;const e=wt(this),n=ui(t,e);return ce(n)}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0||n.every(s=>!s.points.length),this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=Tp(e);bc(e,{series:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,xDomainHint:this.xDomainHint(),showTooltip:this.showTooltip,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onHover:this.showTooltip?({xLabel:s,entries:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,xLabel:s,entries:l}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData().filter(n=>n.points.length>0);return ot`
737
+ <div class="widget-shell" part="shell">
738
+ ${this.renderShellHeader(t)}
739
+ <div class="widget-body">
740
+ ${this.renderLegend(e)}
741
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
742
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
743
+ ${this._tooltip?ot`<div
744
+ class="tooltip"
745
+ part="tooltip"
746
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
747
+ >
748
+ <div class="x">${this._tooltip.xLabel}</div>
749
+ ${this._tooltip.entries.map(n=>ot`<div class="row">
750
+ <span class="swatch" style="background:${n.color}"></span>
751
+ <span>${n.seriesName}</span>
752
+ <span class="value">${no(n.value)}</span>
753
+ </div>`)}
754
+ </div>`:st}
755
+ ${this.renderShellLabelTooltip()}
756
+ </div>
757
+ </div>
758
+ `}};We.styles=[df,ne];ln([Y({type:String,attribute:"scale"})],We.prototype,"scale",2);ln([Y({type:Boolean,attribute:"show-grid"})],We.prototype,"showGrid",2);ln([Y({type:Boolean,attribute:"show-legend"})],We.prototype,"showLegend",2);ln([Y({type:Boolean,attribute:"show-tooltip"})],We.prototype,"showTooltip",2);ln([Y({type:String,attribute:"x-label"})],We.prototype,"xLabel",2);ln([Y({type:String,attribute:"y-label"})],We.prototype,"yLabel",2);ln([yt()],We.prototype,"_tooltip",2);ln([yt()],We.prototype,"_empty",2);We=ln([Xt("ui9000-spark-line-chart")],We);function qw(){customElements.get("ui9000-spark-line-chart")||customElements.define("ui9000-spark-line-chart",We)}qw();const FU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000SparkLineChart(){return We},collectSparkXDomain:gc,collectSparkYDomain:uf,formatCompact:no,normalizeSparkLineData:xc,orderSparkXDomain:yc,parseXDate:kr,registerSparkLineChart:qw,renderSparkLineChart:bc,selectTickIndices:vc,sparkLineChartMetadata:s$},Symbol.toStringTag,{value:"Module"}));var RU=Object.defineProperty,jU=Object.getOwnPropertyDescriptor,cn=(t,e,n,i)=>{for(var r=i>1?void 0:i?jU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&RU(e,n,r),r};let Ke=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return xc(t)}xDomainHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){if(!this.showLegend||t.length<=1)return st;const e=wt(this),n=ui(t,e);return ce(n)}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0||n.every(s=>!s.points.length),this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=Tp(e);bc(e,{series:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,showArea:!0,xDomainHint:this.xDomainHint(),showTooltip:this.showTooltip,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onHover:this.showTooltip?({xLabel:s,entries:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,xLabel:s,entries:l}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData().filter(n=>n.points.length>0);return ot`
759
+ <div class="widget-shell" part="shell">
760
+ ${this.renderShellHeader(t)}
761
+ <div class="widget-body">
762
+ ${this.renderLegend(e)}
763
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
764
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
765
+ ${this._tooltip?ot`<div
766
+ class="tooltip"
767
+ part="tooltip"
768
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
769
+ >
770
+ <div class="x">${this._tooltip.xLabel}</div>
771
+ ${this._tooltip.entries.map(n=>ot`<div class="row">
772
+ <span class="swatch" style="background:${n.color}"></span>
773
+ <span>${n.seriesName}</span>
774
+ <span class="value">${no(n.value)}</span>
775
+ </div>`)}
776
+ </div>`:st}
777
+ ${this.renderShellLabelTooltip()}
778
+ </div>
779
+ </div>
780
+ `}};Ke.styles=[df,ne];cn([Y({type:String,attribute:"scale"})],Ke.prototype,"scale",2);cn([Y({type:Boolean,attribute:"show-grid"})],Ke.prototype,"showGrid",2);cn([Y({type:Boolean,attribute:"show-legend"})],Ke.prototype,"showLegend",2);cn([Y({type:Boolean,attribute:"show-tooltip"})],Ke.prototype,"showTooltip",2);cn([Y({type:String,attribute:"x-label"})],Ke.prototype,"xLabel",2);cn([Y({type:String,attribute:"y-label"})],Ke.prototype,"yLabel",2);cn([yt()],Ke.prototype,"_tooltip",2);cn([yt()],Ke.prototype,"_empty",2);Ke=cn([Xt("ui9000-spark-area-chart")],Ke);function Gw(){customElements.get("ui9000-spark-area-chart")||customElements.define("ui9000-spark-area-chart",Ke)}Gw();const UU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000SparkAreaChart(){return Ke},collectSparkXDomain:gc,collectSparkYDomain:uf,formatCompact:no,normalizeSparkLineData:xc,orderSparkXDomain:yc,parseXDate:kr,registerSparkAreaChart:Gw,renderSparkLineChart:bc,selectTickIndices:vc,sparkAreaChartMetadata:a$},Symbol.toStringTag,{value:"Module"}));function Vw(t,e){const n=[];for(const o of t)for(const a of o.points)Number.isFinite(a.y)&&n.push(a.y);for(const o of e)Number.isFinite(o.y)&&n.push(o.y);if(!n.length)return[0,1];const[i,r]=Gr(n);return i===0&&r===0?[0,1]:[i*1.1,r*1.1]}const Sg=20;function Xc(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function BU(t){switch(t){case"cross":return ef;case"square":case"rhombus":return rf;case"triangle":return nf;default:return pc}}function HU(t){return t==="rhombus"||t==="cross"?45:0}function qU(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return(e%5-2)*2*60*60*1e3}function Zw(t,e){var n,i;const{model:r,width:o,height:a,margin:s={...f.sparkLineMargin},theme:l,showGrid:c=!0,xDomainHint:u,showTooltip:d=!0,onLineHover:h,onPointHover:p,onLeave:m,onAxisLabelHover:v,onAxisLabelLeave:b}=e,{series:g,scatterPoints:$}=r,_={onAxisLabelHover:v,onAxisLabelLeave:b};if(t.replaceChildren(),!g.length&&!$.length||o<=0||a<=0)return;const y={top:s.top,bottom:s.bottom,left:er(s.left),right:Math.max(s.right,12)},S=y.top,w=a-y.bottom,L=y.left,N=o-y.right;if(N-L<8||w-S<8)return;const E=yc(gc(g,u));if(E.length<1)return;const H=E.map(kr),F=Yp().domain([H[0],H[H.length-1]??H[0]]).range([L,N]),W=ut=>{const kt=kr(ut);return Number.isNaN(kt.valueOf())?NaN:F(kt)},[M,z]=Vw(g,$),T=Ft().domain([M,z]).nice().range([w,S]),C=T.ticks(ge(a)),k=Hw(H),x=F.ticks(),A=ut=>k(ut),D=((i=(n=r.axisDetails)==null?void 0:n[r.xField])==null?void 0:i.type)==="datetime",R=[];for(const ut of g)for(const kt of ut.points)Number.isFinite(kt.y)&&R.push(kt.y);for(const ut of $)Number.isFinite(ut.y)&&R.push(ut.y);const[B]=Gr(R),X=B>0?B:0,et=T(X),K=ht(t).append("svg").attr("width",o).attr("height",a).attr("role","img").attr("aria-label","Scatter sparkline chart").style("display","block").style("font-family",l.fontFamily),at=K.append("g").attr("class","plot");if(c){const ut=at.append("g").attr("class","grid");for(const kt of x){const It=F(kt);Number.isFinite(It)&&ut.append("line").attr("x1",It).attr("x2",It).attr("y1",S).attr("y2",w).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges")}for(const kt of C)ut.append("line").attr("x1",L).attr("x2",N).attr("y1",T(kt)).attr("y2",T(kt)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1,2").attr("shape-rendering","crispEdges");ut.append("line").attr("class","zero-line").attr("x1",L).attr("x2",N).attr("y1",T(0)).attr("y2",T(0)).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const nt=new Map(E.map((ut,kt)=>[ut,kt])),tt=lr().defined(ut=>Number.isFinite(ut.y)&&Number.isFinite(W(ut.x))).x(ut=>W(ut.x)).y(ut=>T(ut.y)),j=ro().defined(ut=>Number.isFinite(ut.y)&&Number.isFinite(W(ut.x))).x(ut=>W(ut.x)).y0(et).y1(ut=>T(ut.y));g.forEach((ut,kt)=>{const It=Xc(ut,kt,l),Nt=[...ut.points].sort((Ge,$t)=>(nt.get(Ge.x)??0)-(nt.get($t.x)??0));if(!Nt.length)return;const ue=at.append("g").attr("class",`series series-${ut.id}`),he=`scatter-sparkline-gradient-${ut.id.replace(/\W/g,"_")}`;ue.append("defs").append("linearGradient").attr("id",he).attr("x1","0").attr("y1","0").attr("x2","0").attr("y2","1").selectAll("stop").data([{offset:"0%",opacity:.25},{offset:"100%",opacity:0}]).enter().append("stop").attr("offset",Ge=>Ge.offset).attr("stop-color",It).attr("stop-opacity",Ge=>Ge.opacity),ue.append("path").attr("class","area").datum(Nt).attr("fill",`url(#${he})`).attr("pointer-events","none").attr("d",j),ue.append("path").attr("class","line").datum(Nt).attr("fill","none").attr("stroke",It).attr("stroke-width",f.sparkLineStrokeWidth).attr("stroke-linecap","round").attr("pointer-events","none").attr("d",tt),ue.append("path").attr("class","line-hit").datum(Nt).attr("fill","none").attr("stroke","rgba(0,0,0,0.001)").attr("stroke-width",22).attr("stroke-linecap","round").attr("d",tt)});const I=at.append("g").attr("class","x-axis"),V=x.map(A),U=x.map(ut=>F(ut));for(const ut of vc(V,U)){const kt=ut===0,It=ut===x.length-1,Nt=It?N:U[ut+1],ue=kt?L:U[ut-1],he=Math.min(Math.abs(Nt-U[ut]),Math.abs(U[ut]-ue)),Ge=I.append("text").attr("x",U[ut]).attr("y",w+16).attr("text-anchor",kt?"start":It?"end":"middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize);fo(Ge,V[ut],{slotWidth:he,..._})}const O=at.append("g").attr("class","y-axis").attr("transform",`translate(${L},0)`).call(Jt(T).tickValues(C).tickSize(4).tickPadding(6).tickFormat(ut=>{const kt=Number(ut),It=Number.isInteger(kt)&&Math.abs(kt)<1e3?0:2;return Pt(kt,It)}));O.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray","1,2"),O.selectAll(".tick line").attr("stroke",f.axisStroke),we(O,L);const P=at.append("g").attr("class","scatter-markers");for(const ut of $){const kt=`${ut.x}-${ut.y}`,It=kr(ut.x),Nt=D?qU(kt):0,ue=new Date(It.getTime()+Nt),he=D?F(ue):W(ut.x),Ge=Math.min(N-Sg,Math.max(L+Sg,he)),$t=T(ut.y),xt=HU(ut.markerShape),vt=ut.markerShape==="donut",Rt=Po().type(BU(ut.markerShape)).size(f.scatterMarkerSize);P.append("g").attr("class","scatter-marker").datum(ut).attr("transform",`translate(${Ge},${$t}) rotate(${xt})`).append("path").attr("d",Rt).attr("fill",vt?"none":ut.color).attr("stroke",ut.color).attr("stroke-width",vt?1.5:0)}if(!d)return;const J=r.lineColor||Xc(g[0],0,l),rt=at.append("g").attr("class","hover").attr("pointer-events","none"),it=rt.append("line").attr("stroke",J).attr("stroke-width",1).attr("stroke-dasharray",f.sparkGuideDash).attr("opacity",0),lt=rt.append("g").attr("class","hover-dots");let gt=!1;const mt=()=>{it.attr("opacity",0),lt.selectAll("*").remove()},bt=()=>{gt||(mt(),m==null||m())},dt=new Map;for(const ut of g){const kt=new Map;for(const It of ut.points)kt.set(It.x,It);dt.set(ut.id,kt)}const Ct=ut=>{let kt=0,It=1/0;for(let Nt=0;Nt<H.length;Nt++){const ue=Math.abs(F(H[Nt])-ut);ue<It&&(It=ue,kt=Nt)}return E[kt]??null};at.selectAll(".line-hit").each(function(){ht(this).style("cursor","crosshair").on("mousemove",ut=>{if(gt||!h)return;const[kt]=Ie(ut,K.node()),It=Ct(kt);if(It==null)return;const Nt=W(It);if(!Number.isFinite(Nt))return;it.attr("x1",Nt).attr("x2",Nt).attr("y1",S).attr("y2",w).attr("opacity",1),lt.selectAll("*").remove();const ue=[];g.forEach((he,Ge)=>{var $t;const xt=($t=dt.get(he.id))==null?void 0:$t.get(It);if(!xt||!Number.isFinite(xt.y))return;const vt=Xc(he,Ge,l);ue.push({seriesId:he.id,seriesName:he.name??he.id,color:vt,value:xt.y}),lt.append("circle").attr("cx",Nt).attr("cy",T(xt.y)).attr("r",f.sparkHoverDotRadius).attr("fill",vt).attr("stroke","#fff").attr("stroke-width",2)}),h({x:It,xLabel:k(kr(It)),entries:ue,event:ut})}).on("mouseleave",bt)}),P.selectAll(".scatter-marker").each(function(){const ut=ht(this);ut.style("cursor","pointer").on("mouseenter",function(kt){gt=!0,mt();const It=ut.datum();p==null||p({point:It,event:kt})}).on("mousemove",function(kt){const It=ut.datum();p==null||p({point:It,event:kt})}).on("mouseleave",()=>{gt=!1,m==null||m()})})}const us={series:[],scatterPoints:[],xField:"",yField:"",lineColor:"#3b82f6",pointLegendColor:"#22c55e",lineLegendLabel:"Line",pointLegendLabel:"Points"},Ag="#22c55e";function Ww(t){return typeof t=="number"?Number.isFinite(t):Number.isFinite(Number(t))}function GU(t,e){var n;return((n=t.find(i=>i.key===e))==null?void 0:n.shape)??"circle"}function VU(t,e,n,i,r,o,a){const s=new Map;for(const u of t){const d=i?String(u[i]??"default"):"default",h=u[e],p=u[n];if(h==null||p==null||!Ww(p))continue;const m=r?new Date(String(h)).getTime():Number(h);if(!Number.isFinite(m))continue;const v=s.get(d)??[];v.push({x:String(h),y:Number(p)}),s.set(d,v)}const l=new Map;for(const[u,d]of s){const h=new Map;for(const m of d){const v=r?new Date(m.x).getTime():Number(m.x);if(!Number.isFinite(v)||!Number.isFinite(m.y))continue;const b=h.get(v);b?(b.sum+=m.y,b.count+=1):h.set(v,{sum:m.y,count:1,xStr:m.x})}const p=Array.from(h.entries()).sort((m,v)=>m[0]-v[0]).map(([,m])=>({x:m.xStr,y:m.count?m.sum/m.count:0}));l.set(u,p)}const c=i?me(l.keys(),a,i):["default"];return c.map(u=>({id:u,name:u==="default"?"Series":u,color:zt(o,u,c.length),points:l.get(u)??[]}))}function zg(t){var e,n,i,r;const o=se(t),a=ft(t.xAxe)??"x",s=ft(t.yAxe)??"y",l=ft(t.groupBy),c=pi(t),u=Oa(t),d=!!((e=t.formatting)!=null&&e.length),h=t.axisDetails,p=((n=h==null?void 0:h[a])==null?void 0:n.type)==="datetime",m=VU(o,a,s,l,p,c,t.uniqueValues),v=[];for(const g of o){const $=g[a],_=g[s];if($==null||!Ww(_))continue;const y=l?String(g[l]??"default"):"default",S=zt(c,y,m.length||1),w=d?S:Ag;v.push({x:String($),y:Number(_),groupKey:y,color:w,markerShape:GU(u,y),row:g})}const b=zt(c,"default",1)??us.lineColor;return{series:m,scatterPoints:v,xField:a,yField:s,groupField:l,lineColor:b,pointLegendColor:Ag,lineLegendLabel:((i=h==null?void 0:h[a])==null?void 0:i.label)??a,pointLegendLabel:((r=h==null?void 0:h[s])==null?void 0:r.label)??s,axisDetails:h}}function Kw(t){var e,n;if(!t)return{...us};if(Ht(t)&&!("scatterPoints"in t))return zg(t);const i=t;return(e=i.series)!=null&&e.length||(n=i.scatterPoints)!=null&&n.length?{...us,series:i.series??[],scatterPoints:i.scatterPoints??[]}:Ht(t)?zg(t):{...us}}var ZU=Object.defineProperty,WU=Object.getOwnPropertyDescriptor,mi=(t,e,n,i)=>{for(var r=i>1?void 0:i?WU(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&ZU(e,n,r),r};let zr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseModel(){const t=Ot(this.dataJson,{});return Kw(t)}xDomainHint(){const t=Ot(this.dataJson,null);if(Ht(t))return an(t)}renderLegend(t){if(!this.showLegend)return st;const e=[{label:t.lineLegendLabel,swatch:{kind:"line",color:t.lineColor}},{label:t.pointLegendLabel,swatch:{kind:"swatch",color:t.pointLegendColor}}];return ce(e)}formatPointTooltip(t,e){var n,i,r,o,a,s;const l=((i=(n=t.axisDetails)==null?void 0:n[t.xField])==null?void 0:i.label)??t.xField,c=((o=(r=t.axisDetails)==null?void 0:r[t.yField])==null?void 0:o.label)??t.yField,u=[{label:l,value:e.x},{label:c,value:no(e.y)}];if(t.groupField&&e.row[t.groupField]!=null){const d=((s=(a=t.axisDetails)==null?void 0:a[t.groupField])==null?void 0:s.label)??t.groupField;u.push({label:d,value:String(e.row[t.groupField])})}return u}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseModel(),i=n.series.some(l=>l.points.length>0);if(this._empty=!i&&n.scatterPoints.length===0,this._empty){e.replaceChildren();return}const r=wt(this),{width:o,height:a,margin:s}=Tp(e);Zw(e,{model:n,width:o,height:a,margin:s,theme:r,showGrid:this.showGrid,xDomainHint:this.xDomainHint(),showTooltip:this.showTooltip,...this.axisLabelHandlers(),onLineHover:this.showTooltip?({xLabel:l,entries:c,event:u})=>{const d=this.getBoundingClientRect();this._tooltip={x:u.clientX-d.left,y:u.clientY-d.top,mode:"line",xLabel:l,entries:c}}:void 0,onPointHover:this.showTooltip?({point:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,mode:"point",rows:this.formatPointTooltip(n,l)}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){var t,e;const n=this.headerTitle(),i=this._empty?null:this.parseModel();return ot`
781
+ <div class="widget-shell" part="shell">
782
+ ${this.renderShellHeader(n)}
783
+ <div class="widget-body">
784
+ ${i?this.renderLegend(i):st}
785
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
786
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
787
+ ${((t=this._tooltip)==null?void 0:t.mode)==="line"?ot`<div
788
+ class="tooltip"
789
+ part="tooltip"
790
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
791
+ >
792
+ <div class="x">${this._tooltip.xLabel}</div>
793
+ ${this._tooltip.entries.map(r=>ot`<div class="row">
794
+ <span class="swatch" style="background:${r.color}"></span>
795
+ <span>${r.seriesName}</span>
796
+ <span class="value">${no(r.value)}</span>
797
+ </div>`)}
798
+ </div>`:st}
799
+ ${((e=this._tooltip)==null?void 0:e.mode)==="point"?ot`<div
800
+ class="tooltip"
801
+ part="tooltip"
802
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
803
+ >
804
+ ${this._tooltip.rows.map(r=>ot`<div class="row">
805
+ <span>${r.label}</span>
806
+ <span class="value">${r.value}</span>
807
+ </div>`)}
808
+ </div>`:st}
809
+ ${this.renderShellLabelTooltip()}
810
+ </div>
811
+ </div>
812
+ `}};zr.styles=[df,ne];mi([Y({type:String,attribute:"scale"})],zr.prototype,"scale",2);mi([Y({type:Boolean,attribute:"show-grid"})],zr.prototype,"showGrid",2);mi([Y({type:Boolean,attribute:"show-legend"})],zr.prototype,"showLegend",2);mi([Y({type:Boolean,attribute:"show-tooltip"})],zr.prototype,"showTooltip",2);mi([yt()],zr.prototype,"_tooltip",2);mi([yt()],zr.prototype,"_empty",2);zr=mi([Xt("ui9000-scatter-sparkline-chart")],zr);function Yw(){customElements.get("ui9000-scatter-sparkline-chart")||customElements.define("ui9000-scatter-sparkline-chart",zr)}Yw();const KU=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000ScatterSparklineChart(){return zr},collectScatterSparklineYDomain:Vw,normalizeScatterSparklineData:Kw,registerScatterSparklineChart:Yw,renderScatterSparklineChart:Zw,scatterSparklineChartMetadata:o$},Symbol.toStringTag,{value:"Module"}));function _c(t){if(!t.length)return[];const e=new Set,n=[];for(const i of t)for(const r of i.points)e.has(r.x)||(e.add(r.x),n.push(r.x));return n}function Di(t,e){const n=t.points.find(i=>i.x===e);return n&&Number.isFinite(n.y)?n.y:void 0}function Jw(t,e){let n=0;return e.map(i=>(n+=Di(t,i)??0,n))}function Xw(t,e){const n=[],i=[];for(const r of e){let o=0,a=0;for(const s of t){const l=Di(s,r);l!=null&&(l>0?o+=l:a+=Math.abs(l))}n.push(o),i.push(a)}return{positive:n,negative:i}}function Qw(t,e){return t==="horizontal"?f.barHorizontalPadFactor:e?1:f.barDomainPadFactor}function tk(t,e={}){const{orientation:n="vertical",layout:i="grouped",cumulativeMax:r}=e,o=_c(t);if(i==="stacked"&&t.length>1){const{positive:p,negative:m}=Xw(t,o),v=p.length?Math.max(...p):0,b=m.length?Math.max(...m):0;if(!v&&!b)return[0,1];const g=Math.max(v,b)*f.barStackedPadFraction;return[b>0?-(b+g):0,v>0?v+g:0]}const s=[];for(const p of t)for(const m of p.points)Number.isFinite(m.y)&&s.push(m.y);if(!s.length)return[0,1];const[l,c]=Gr(s),u=Qw(n,t.length>1),d=Math.max(c*u,r??-1/0),h=l*u;return h===0&&d===0?[0,1]:[h,d]}function ek(t){const[e,n]=t;return n>0&&e<0?0:n>0?e:n}function rk(t,e,n,i=f.barGroupGap){const r=e+1,o=n/2,a=t+i;if(n%2){const s=Math.ceil(o);return r<s?-a*(s-r):r===s?0:a*(r-s)}return r<=o?-(a*(o-r+.5)):a*(r-o-.5)}const Eu=4,Fu=f.barRowSpacing*2;function YU(){return f.barRowThickness+f.barRowSpacing*2}function nk(t){const e=Math.max(t,1);return e*f.barRowThickness+Eu*Math.max(e-1,0)}function JU(t){return t<=0?0:t*YU()+f.barRowSpacing*2}function XU(t,e){return t<=0?0:t*(nk(e)+Fu)}function QU(t){const e=nk(t)+Fu;return e>0?Fu/e:0}function hf(t,e,n="grouped"){return e>1&&n!=="stacked"?XU(t,e):JU(t)}function pf(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function ff(t,e,n=6.2,i=8){const r=t.length;if(r<=1)return r===1?[0]:[];const o=c=>{const u=t[c].length*n,d=e[c];return c===0?[d,d+u]:c===r-1?[d-u,d]:[d-u/2,d+u/2]},a=[];let s=-1/0;for(let c=0;c<r-1;c++){if(!Number.isFinite(e[c]))continue;const[u,d]=o(c);u>=s+i&&(a.push(c),s=d)}if(!Number.isFinite(e[r-1]))return a;const[l]=o(r-1);for(;a.length&&o(a[a.length-1])[1]+i>l;)a.pop();return a.push(r-1),a}function tB(t,e,n){return po(t,e,n)}function bn(t,e,n){return Math.min(Math.max(t,e),n)}function eB(t,e,n,i,r){const o=Math.min(Math.abs(n),Math.abs(i))/2,a=bn(r.topLeft,0,o),s=bn(r.topRight,0,o),l=bn(r.bottomRight,0,o),c=bn(r.bottomLeft,0,o),u=t+n,d=e+i;return[`M ${t+a} ${e}`,`H ${u-s}`,s?`A ${s} ${s} 0 0 1 ${u} ${e+s}`:"",`V ${d-l}`,l?`A ${l} ${l} 0 0 1 ${u-l} ${d}`:"",`H ${t+c}`,c?`A ${c} ${c} 0 0 1 ${t} ${d-c}`:"",`V ${e+a}`,a?`A ${a} ${a} 0 0 1 ${t+a} ${e}`:"","Z"].filter(Boolean).join(" ")}let rB=0;function nB(t,e,n,i,r){const o=`ui9000-bar-grad-${rB+=1}`,a=t.append("linearGradient").attr("id",o);return n==="horizontal"?(a.attr("x1",i?"100%":"0%").attr("y1","0%").attr("x2",i?"0%":"100%").attr("y2","0%"),a.append("stop").attr("offset","0%").attr("stop-color",e).attr("stop-opacity",f.barFadeOpacity),a.append("stop").attr("offset","100%").attr("stop-color",e).attr("stop-opacity",1),`url(#${o})`):(a.attr("x1",r&&i?"100%":"0%").attr("y1",i?"100%":"0%").attr("x2",r&&!i?"100%":"0%").attr("y2",i?"0%":"100%"),a.append("stop").attr("offset","0%").attr("stop-color",e).attr("stop-opacity",1),a.append("stop").attr("offset","100%").attr("stop-color",e).attr("stop-opacity",f.barFadeOpacity),`url(#${o})`)}function Tg(t,e,n,i){for(const r of ff(e,n)){const o=r===0,a=r===e.length-1;t.append("text").attr("x",n[r]).attr("y",i).attr("text-anchor",o?"start":a?"end":"middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(e[r])}}function ik(t,e){const{series:n,width:i,height:r,margin:o={...f.barMargin},theme:a,orientation:s="vertical",layout:l="grouped",showGrid:c=!0,showTooltip:u=!0,cumulativeLine:d=!1,themeMode:h="light",xLabel:p,yLabel:m,xAxisContainer:v=null,onHover:b,onLeave:g,onAxisLabelHover:$,onAxisLabelLeave:_}=e;if(t.replaceChildren(),v==null||v.replaceChildren(),!n.length||i<=0||r<=0)return;const y=_c(n);if(!y.length)return;const S=($t,xt)=>tB($t,xt,a),w=n.length>1,L=w&&l==="stacked",N=w&&!L,E=s==="vertical",H=d&&!w,F={top:o.top,bottom:o.bottom,left:er(E?Math.max(o.left,m?44:40):o.left),right:Math.max(o.right,12)},W=!E&&!!v,M=F.top+(m&&E?12:0),z=p&&!W?12:0,T=E||!W?F.bottom+z:0,C=E?0:hf(y.length,n.length,l),k=r-M-T,x=E?k:Math.max(k,C),A=M+x,D=F.left,R=i-F.right,B=E?r:M+x+(W?0:T),X=!E&&k<C;if(R-D<8||x<8)return;const et=H?Jw(n[0],y):[],K=et.length?Math.max(...et):void 0,at=tk(n,{orientation:s,layout:l,cumulativeMax:K}),nt=N&&!E?bn(QU(n.length),0,.4):0,tt=de().domain(y).range(E?[D,R]:[M,A]).padding(nt).align(.5),j=Ft().domain(at).nice().range(E?[A,M]:[D,R]),I=j.domain(),V=ek(I),U=j(V),O=j.ticks(ge(E?r:i)),P=tt.bandwidth(),J=$t=>{const xt=tt($t);return xt==null?NaN:xt+P/2};E?(t.style.height="",t.style.minHeight=""):(t.style.height=`${B}px`,t.style.minHeight=`${B}px`);const rt=ht(t).append("svg").attr("width",i).attr("height",B).attr("role","img").attr("aria-label",`${s} bar chart`).style("display","block").style("font-family",a.fontFamily),it=rt.append("defs"),lt=rt.append("g").attr("class","plot");if(c){const $t=lt.append("g").attr("class","grid"),xt=(vt,Rt,oe,ve)=>{$t.append("line").attr("x1",vt).attr("y1",Rt).attr("x2",oe).attr("y2",ve).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges")};if(E){for(const vt of y){const Rt=J(vt);Number.isFinite(Rt)&&xt(Rt,M,Rt,A)}xt(R,M,R,A);for(const vt of O)vt!==O[0]&&xt(D,j(vt),R,j(vt))}else for(const vt of O)xt(j(vt),M,j(vt),A);$t.append("line").attr("class","baseline").attr("x1",E?D:U).attr("y1",E?U:M).attr("x2",E?R:U).attr("y2",E?U:A).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}const gt=lt.append("g").attr("class","category-highlight");if(u){const xt=it.append("pattern").attr("id","ui9000-bar-hover-dots").attr("x",0).attr("y",0).attr("width",4).attr("height",4).attr("patternUnits","userSpaceOnUse").append("circle").attr("cx",2).attr("cy",2).attr("r",1.5).attr("fill",f.barHoverDotFill).attr("fill-opacity",.4);xt.append("animate").attr("attributeName","fill-opacity").attr("values","0.2;0.6;0.2").attr("dur","1.5s").attr("repeatCount","indefinite"),xt.append("animate").attr("attributeName","r").attr("values","1.5;1.9;1.5").attr("dur","1.5s").attr("repeatCount","indefinite");const vt=it.append("linearGradient").attr("id","ui9000-bar-hover-fade").attr("x1","0%").attr("y1","0%").attr("x2",E?"0%":"100%").attr("y2",E?"100%":"0%");vt.append("stop").attr("offset","0%").attr("stop-color","#fff").attr("stop-opacity",0),vt.append("stop").attr("offset","15%").attr("stop-color","#fff").attr("stop-opacity",.3),vt.append("stop").attr("offset","100%").attr("stop-color","#fff").attr("stop-opacity",1)}const mt=h==="dark"?f.hoverGuideDark:f.hoverGuideLight,bt=$t=>{gt.selectAll("*").remove(),it.selectAll(".hover-mask").remove();const xt=tt($t);if(xt==null)return;const vt=`ui9000-bar-hover-mask-${$t.replace(/[^\w-]/g,"_")}`;it.append("mask").attr("id",vt).attr("class","hover-mask").append("rect").attr("x",E?xt:D).attr("y",E?M:xt).attr("width",E?P:R-D).attr("height",E?A-M:P).attr("fill","url(#ui9000-bar-hover-fade)"),gt.append("rect").attr("x",E?xt:D).attr("y",E?M:xt).attr("width",E?P:R-D).attr("height",E?A-M:P).attr("fill","url(#ui9000-bar-hover-dots)").attr("mask",`url(#${vt})`);const oe=xt+P/2;gt.append("line").attr("class","hover-guide").attr("x1",E?oe:D).attr("y1",E?M:oe).attr("x2",E?oe:R).attr("y2",E?A:oe).attr("stroke",mt).attr("stroke-width",f.barHoverGuideWidth).attr("shape-rendering","crispEdges")},dt=()=>{gt.selectAll("*").remove(),it.selectAll(".hover-mask").remove()},Ct=f.barRowThickness/(f.barRowThickness+f.barRowSpacing*2);let ut;if(E)L?ut=bn(P*f.barStackedBandFraction,f.barGroupMinWidth,f.barGroupMaxWidth):N?ut=Math.floor(bn((R-D)/y.length/n.length,f.barGroupMinWidth,f.barGroupMaxWidth)):ut=Math.min(P*f.barBandFraction,f.barMaxWidth);else if(N){const $t=Eu;ut=X?f.barRowThickness:Math.max(Math.min(P/n.length-$t,f.barRowThickness),1)}else ut=X?f.barRowThickness:Math.max(P*Ct,1);const kt=lt.append("g").attr("class","bars"),It=L?0:E?w?1:f.barMinHeight:f.barMinWidth,Nt=f.barCornerRadius,ue=$t=>{const{category:xt,seriesIndex:vt,color:Rt,value:oe,offset:ve,size:be,from:je,to:Yt,corners:br}=$t,Kr=oe<V,pn=Math.abs(Yt-je),Yr=Math.max(pn,It);let xi=Math.min(je,Yt);pn<Yr&&(E?xi=Kr?Math.min(je,A-Yr):Math.max(M,je-Yr):xi=Kr?Math.max(D,je-Yr):Math.min(je,R-Yr));const Cc=E?ve:xi,Ic=E?xi:ve,xr=E?be:Yr,o2=E?Yr:be;kt.append("path").attr("class",`bar bar-${vt}`).attr("data-category",xt).attr("data-series",n[vt].id).attr("d",eB(Cc,Ic,xr,o2,br)).attr("fill",nB(it,Rt,s,Kr,$t.diagonalGradient))};if(y.forEach($t=>{const xt=tt($t);if(xt==null)return;const vt=xt+P/2;if(L){const Rt=n.map((Yt,br)=>({series:Yt,index:br,value:Di(Yt,$t)})).filter(Yt=>Yt.value!=null&&Yt.value!==0);if(!Rt.length)return;const oe=Rt.filter(Yt=>Yt.value>0),ve=Rt.filter(Yt=>Yt.value<0),be=vt-ut/2,je=(Yt,br)=>{let Kr=0;Yt.forEach((pn,Yr)=>{const xi=j(V+br*Kr);Kr+=Math.abs(pn.value);const Cc=j(V+br*Kr),Ic=Yr===Yt.length-1,xr={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};Ic&&(E?br===1?(xr.topLeft=Nt,xr.topRight=Nt):(xr.bottomLeft=Nt,xr.bottomRight=Nt):br===1?(xr.topRight=Nt,xr.bottomRight=Nt):(xr.topLeft=Nt,xr.bottomLeft=Nt)),ue({category:$t,seriesIndex:pn.index,color:S(pn.series,pn.index),value:pn.value,offset:be,size:ut,from:xi,to:Cc,corners:xr,diagonalGradient:!1})})};je(oe,1),je(ve,-1);return}n.forEach((Rt,oe)=>{const ve=Di(Rt,$t);if(ve==null||ve===V)return;let be;if(!w)be=vt-ut/2;else if(E)be=vt-ut/2+rk(ut,oe,n.length);else{const br=Eu,Kr=n.length*ut+(n.length-1)*br;be=vt-Kr/2+oe*(ut+br)}const je=ve<V,Yt={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};E?je?(Yt.bottomLeft=Nt,Yt.bottomRight=Nt):(Yt.topLeft=Nt,Yt.topRight=Nt):je?(Yt.topLeft=Nt,Yt.bottomLeft=Nt):(Yt.topRight=Nt,Yt.bottomRight=Nt),ue({category:$t,seriesIndex:oe,color:S(Rt,oe),value:ve,offset:be,size:ut,from:U,to:j(ve),corners:Yt,diagonalGradient:!w&&E})})}),H&&E&&et.length){const $t=y.map((xt,vt)=>({x:J(xt),y:j(et[vt])})).filter(xt=>Number.isFinite(xt.x)&&Number.isFinite(xt.y));if($t.length>1){const xt=lt.append("g").attr("class","cumulative");xt.append("path").attr("fill","none").attr("stroke",f.barCumulativeColor).attr("stroke-width",f.barCumulativeWidth).attr("d",$t.map((vt,Rt)=>`${Rt===0?"M":"L"} ${vt.x} ${vt.y}`).join(" "));for(const vt of $t)xt.append("circle").attr("cx",vt.x).attr("cy",vt.y).attr("r",f.barCumulativeDotRadius).attr("fill",f.barCumulativeColor).attr("stroke","#ffffff").attr("stroke-width",1)}}const he=$t=>pf(Number($t));if(E){const $t=lt.append("g").attr("class","category-axis"),xt=y.map(J);for(const Rt of ff(y,xt)){const oe=Rt===0,ve=Rt===y.length-1;$t.append("text").attr("x",xt[Rt]).attr("y",A+16).attr("text-anchor",oe?"start":ve?"end":"middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(y[Rt])}const vt=lt.append("g").attr("class","value-axis").attr("transform",`translate(${D},0)`).call(Jt(j).tickValues(O).tickSize(4).tickPadding(6).tickFormat(he));vt.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray","1 2"),vt.selectAll(".tick line").attr("stroke",f.axisStroke),we(vt,D,{onAxisLabelHover:$,onAxisLabelLeave:_})}else{const $t=lt.append("g").attr("class","category-axis").attr("transform",`translate(${D},0)`).call(Jt(tt).tickSize(0).tickPadding(8));$t.select(".domain").attr("stroke","none"),we($t,D,{onAxisLabelHover:$,onAxisLabelLeave:_});const xt=O.map(he),vt=O.map(Rt=>j(Rt));if(W&&v){const Rt=ht(v).append("svg").attr("width",i).attr("height",F.bottom+(p?12:0)).attr("role","presentation").style("display","block").style("font-family",a.fontFamily);Tg(Rt.append("g").attr("class","value-axis"),xt,vt,16),p&&Rt.append("text").attr("x",(D+R)/2).attr("y",F.bottom+10).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(p)}else Tg(lt.append("g").attr("class","value-axis"),xt,vt,A+16)}if(p&&!W&&lt.append("text").attr("x",(D+R)/2).attr("y",B-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(p),m&&lt.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(m),!u||!b)return;const Ge=$t=>{const xt=tt.step()||1,Rt=Math.floor(($t-(E?D:M))/xt);return y[bn(Rt,0,y.length-1)]};lt.append("rect").attr("class","hover-target").attr("x",D).attr("y",M).attr("width",R-D).attr("height",A-M).attr("fill","transparent").on("mousemove",function($t){var xt;const vt=(xt=this.ownerSVGElement)==null?void 0:xt.getBoundingClientRect(),Rt=E?$t.clientX-((vt==null?void 0:vt.left)??0):$t.clientY-((vt==null?void 0:vt.top)??0),oe=Ge(Rt);if(oe==null)return;bt(oe);const ve=[];if(n.forEach((be,je)=>{const Yt=Di(be,oe);Yt!=null&&ve.push({seriesId:be.id,seriesName:be.name??be.id,color:S(be,je),value:Yt})}),H){const be=y.indexOf(oe);be>=0&&ve.push({seriesId:"cumulative",seriesName:"Cumulative",color:f.barCumulativeColor,value:et[be]})}b({category:oe,entries:ve,event:$t})}).on("mouseleave",()=>{dt(),g==null||g()})}const iB=ie`
813
+ :host {
814
+ display: block;
815
+ position: relative;
816
+ width: 100%;
817
+ height: 100%;
818
+ min-height: 220px;
819
+ color: var(--ui9000-color-text, #111827);
820
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
821
+ box-sizing: border-box;
822
+ }
823
+ .chart-body {
824
+ flex: 1 1 auto;
825
+ min-height: 240px;
826
+ display: flex;
827
+ flex-direction: column;
828
+ }
829
+ .chart-scroll {
830
+ flex: 1 1 auto;
831
+ min-height: 200px;
832
+ overflow-y: auto;
833
+ overflow-x: hidden;
834
+ position: relative;
835
+ }
836
+ .chart-x-axis {
837
+ flex-shrink: 0;
838
+ width: 100%;
839
+ min-height: 21px;
840
+ overflow: hidden;
841
+ }
842
+ .chart-root {
843
+ width: 100%;
844
+ min-height: 240px;
845
+ }
846
+ .tooltip {
847
+ position: absolute;
848
+ pointer-events: none;
849
+ z-index: 2;
850
+ padding: 6px 10px;
851
+ border-radius: 6px;
852
+ font-size: 12px;
853
+ line-height: 1.35;
854
+ background: var(--ui9000-color-text, #111827);
855
+ color: #fff;
856
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
857
+ transform: translate(-50%, calc(-100% - 12px));
858
+ white-space: nowrap;
859
+ }
860
+ .tooltip .category {
861
+ font-weight: 600;
862
+ margin-bottom: 2px;
863
+ }
864
+ .tooltip .row {
865
+ display: flex;
866
+ align-items: center;
867
+ gap: 6px;
868
+ }
869
+ .tooltip .swatch {
870
+ width: 8px;
871
+ height: 8px;
872
+ border-radius: 2px;
873
+ flex: none;
874
+ }
875
+ .tooltip .value {
876
+ margin-left: auto;
877
+ font-variant-numeric: tabular-nums;
878
+ }
879
+ .empty {
880
+ display: grid;
881
+ place-items: center;
882
+ height: 100%;
883
+ min-height: inherit;
884
+ color: var(--ui9000-color-text-muted, #6b7280);
885
+ font-size: 0.875rem;
886
+ }
887
+ `;function Ru(t){return t.filter(e=>e.x!=null&&e.y!=null&&Number.isFinite(Number(e.y))).map(e=>({x:String(e.x),y:Number(e.y)}))}function Lg(t){return t.map((e,n)=>({id:e.id||`series-${n}`,name:e.name??e.id??`Series ${n+1}`,color:e.color,points:Ru(e.points??[])}))}function Cg(t,e){if(!e.length)return t;const n=new Map(e.map((i,r)=>[i,r]));return[...t].sort((i,r)=>(n.get(i.x)??Number.MAX_SAFE_INTEGER)-(n.get(r.x)??Number.MAX_SAFE_INTEGER))}function oB(t){const e=t.orientation==="horizontal",n=ft(e?t.yAxe:t.xAxe)??"label",i=ft(e?t.xAxe:t.yAxe)??"value";return{categoryKey:n,valueKey:i}}function aB(t){const e=se(t),{categoryKey:n,valueKey:i}=oB(t),r=ft(t.groupBy),o=t.formatting;if(r){const c=new Map;for(const p of e){const m=p[n],v=Number(p[i]);if(m==null||!Number.isFinite(v))continue;const b=String(p[r]??"default"),g=c.get(b)??[];g.push({x:String(m),y:v}),c.set(b,g)}const u=new Set;for(const p of e){const m=p[n];m!=null&&u.add(String(m))}const d=me(u,t.uniqueValues,n),h=me(c.keys(),t.uniqueValues,r);return h.map(p=>({id:p,name:p,color:zt(o,p,h.length),points:Cg(c.get(p)??[],d)}))}const a=[];for(const c of e){const u=c[n],d=Number(c[i]);u==null||!Number.isFinite(d)||a.push({x:String(u),y:d})}const s=me(a.map(c=>c.x),t.uniqueValues,n),l=Cg(a,s);return l.length?[{id:"default",name:"Series",color:zt(o,"default",1),points:l}]:[]}function ok(t){var e,n;if(!t)return[];if(Ht(t))return aB(t);if(Array.isArray(t)){if(t.length===0)return[];const i=t[0];return"points"in i&&Array.isArray(i.points)?Lg(t):[{id:"default",name:"Series",points:Ru(t.map(r=>({x:r.label,y:r.value})))}]}return(e=t.series)!=null&&e.length?Lg(t.series):(n=t.points)!=null&&n.length?[{id:"default",name:"Series",points:Ru(t.points)}]:[]}var sB=Object.defineProperty,lB=Object.getOwnPropertyDescriptor,nr=(t,e,n,i)=>{for(var r=i>1?void 0:i?lB(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&sB(e,n,r),r};let Se=class extends qt{constructor(){super(...arguments),this.scale="default",this.orientation="vertical",this.layout="grouped",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.cumulativeLine=!1,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._fixedXAxis=!1,this._raf=0}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this))}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){var e,n,i,r;if(re(t)&&this.scheduleDraw(),t.has("_fixedXAxis")){const o=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-body"),a=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-scroll");o instanceof HTMLElement&&((i=this._resizeObserver)==null||i.observe(o)),a instanceof HTMLElement&&((r=this._resizeObserver)==null||r.observe(a))}}firstUpdated(){var t,e,n,i,r,o;const a=(t=this.shadowRoot)==null?void 0:t.querySelector(".widget-body"),s=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-body"),l=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-scroll");a instanceof HTMLElement&&((i=this._resizeObserver)==null||i.observe(a)),s instanceof HTMLElement&&((r=this._resizeObserver)==null||r.observe(s)),l instanceof HTMLElement&&((o=this._resizeObserver)==null||o.observe(l))}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return ok(t)}renderLegend(t){var e;if(!this.showLegend)return st;const n=wt(this),i=t.length>1,r=this.cumulativeLine&&!i;if(!i&&!r)return st;const o=i?ui(t,n).map(a=>({...a,swatch:{kind:"swatch",color:a.swatch.color,opacity:.8}})):[{label:((e=t[0])==null?void 0:e.name)??"Series",swatch:{kind:"swatch",color:po(t[0],0,n),opacity:.8}},{label:"Cumulative",swatch:{kind:"line",color:f.barCumulativeColor}}];return ce(o)}draw(){var t,e,n,i;const r=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-body"),o=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-scroll"),a=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-root"),s=(i=this.shadowRoot)==null?void 0:i.querySelector(".chart-x-axis");if(!r||!o||!a)return;const l=this.parseData();if(this._empty=l.length===0||l.every(g=>!g.points.length),this._empty){a.replaceChildren(),s==null||s.replaceChildren(),this._fixedXAxis=!1;return}const c=wt(this),{width:u,margin:d}=iC(r,this.scale),h=o.clientHeight||300,p=_c(l),m=hf(p.length,l.length,this.layout),v=h-d.top,b=this.orientation==="horizontal"&&m>v+1;this._fixedXAxis=b,ik(a,{series:l,width:u,height:h,margin:d,theme:c,orientation:this.orientation,layout:this.layout,showGrid:this.showGrid,showTooltip:this.showTooltip,cumulativeLine:this.cumulativeLine,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,xAxisContainer:b?s:null,...this.axisLabelHandlers(),onHover:this.showTooltip?({category:g,entries:$,event:_})=>{const y=this.getBoundingClientRect();this._tooltip={x:_.clientX-y.left,y:_.clientY-y.top,category:g,entries:$}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0}),s&&!b&&s.replaceChildren()}render(){const t=this.headerTitle(),e=this._empty?[]:this.parseData();return ot`
888
+ <div class="widget-shell" part="shell">
889
+ ${this.renderShellHeader(t)}
890
+ <div class="widget-body">
891
+ <div class="chart-body" part="chart-body">
892
+ ${this.renderLegend(e)}
893
+ <div class="chart-scroll" part="scroll">
894
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
895
+ </div>
896
+ <div
897
+ class="chart-x-axis"
898
+ part="x-axis"
899
+ ?hidden=${!this._fixedXAxis}
900
+ ></div>
901
+ </div>
902
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
903
+ ${this._tooltip?ot`<div
904
+ class="tooltip"
905
+ part="tooltip"
906
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
907
+ >
908
+ <div class="category">${this._tooltip.category}</div>
909
+ ${this._tooltip.entries.map(n=>ot`<div class="row">
910
+ <span class="swatch" style="background:${n.color}"></span>
911
+ <span>${n.seriesName}</span>
912
+ <span class="value">${pf(n.value)}</span>
913
+ </div>`)}
914
+ </div>`:st}
915
+ ${this.renderShellLabelTooltip()}
916
+ </div>
917
+ </div>
918
+ `}};Se.styles=[iB,ne];nr([Y({type:String,attribute:"scale"})],Se.prototype,"scale",2);nr([Y({type:String,attribute:"orientation"})],Se.prototype,"orientation",2);nr([Y({type:String,attribute:"layout"})],Se.prototype,"layout",2);nr([Y({type:Boolean,attribute:"show-grid"})],Se.prototype,"showGrid",2);nr([Y({type:Boolean,attribute:"show-legend"})],Se.prototype,"showLegend",2);nr([Y({type:Boolean,attribute:"show-tooltip"})],Se.prototype,"showTooltip",2);nr([Y({type:Boolean,attribute:"cumulative-line"})],Se.prototype,"cumulativeLine",2);nr([Y({type:String,attribute:"x-label"})],Se.prototype,"xLabel",2);nr([Y({type:String,attribute:"y-label"})],Se.prototype,"yLabel",2);nr([yt()],Se.prototype,"_tooltip",2);nr([yt()],Se.prototype,"_empty",2);nr([yt()],Se.prototype,"_fixedXAxis",2);Se=nr([Xt("ui9000-bar-chart")],Se);function ak(){customElements.get("ui9000-bar-chart")||customElements.define("ui9000-bar-chart",Se)}ak();const cB=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000BarChart(){return Se},barChartMetadata:R_,barHorizontalMinSpan:hf,barPadFactor:Qw,collectBarCategories:_c,collectBarValueDomain:tk,cumulativeValues:Jw,formatCompact:pf,groupedBarOffset:rk,normalizeBarData:ok,registerBarChart:ak,renderBarChart:ik,resolveBaseline:ek,selectTickIndices:ff,stackTotals:Xw,valueAt:Di},Symbol.toStringTag,{value:"Module"}));function mf(t,e=f.donutDefaultMax){var n;if(t.max!=null&&t.max>0)return t.max;if((n=t.slices)!=null&&n.length){const i=t.slices.reduce((r,o)=>r+Math.abs(o.value),0);if(i>0)return i}return e>0?e:f.donutDefaultMax}function sk(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||e<=0?0:Math.min(Math.max(t/e,0),1)}function lk(t,e){const n=t.slices??[];if(n.length>1)return{values:n.map(o=>Math.abs(o.value)),track:!1};const i=mf(t,e),r=Math.min(Math.max(t.value,0),i);return{values:[r,i-r],track:!0}}function ck(t,e,n,i=f.donutMinCellWidth){if(t<=0||e<=0||n<=0)return{columns:0,rows:0,cellWidth:0,cellHeight:0};const r=Math.max(1,Math.floor(e/i)),o=Math.max(1,Math.ceil(t/Math.min(r,t))),a=Math.ceil(t/o);return{columns:a,rows:o,cellWidth:e/a,cellHeight:n/o}}function uk(t,e,n=f.donutCellPadding,i=f.donutThickness){const r=Math.min(t,e)/2-n;if(r<=0)return{outerRadius:0,innerRadius:0};const o=Math.max(Math.min(i,r*.5),f.donutMinThickness);return{outerRadius:r,innerRadius:Math.max(r-o,0)}}function gf(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function dk(t){if(!Number.isFinite(t))return"";const e=t*100;return`${e>=10||e===0||Number.isInteger(e)?Math.round(e):e.toFixed(1)}%`}function ju(t,e){return e<=1?t.slice(0,1):t.length<=e?t:`${t.slice(0,e-1)}…`}function hk(t,e,n){var i;const r=(i=t==null?void 0:t.getComputedTextLength)==null?void 0:i.call(t);return Number.isFinite(r)&&r>0?r:e.length*n*.56}function Ig(t,e,n){return Math.min(Math.max(t,e),n)}function Qc(t,e,n,i,r){if(t)return t;if(!r||r==="default"){if(e===0&&i.primary)return i.primary;if(e===1&&i.secondary)return i.secondary}const a=Da(0,n);return a[e%a.length]}function pk(t,e){const{items:n,width:i,height:r,margin:o={...f.donutMargin},theme:a,themeMode:s="light",styleId:l,showValue:c=!0,showStatus:u=!0,showLabel:d=!0,showLegend:h=!0,showTooltip:p=!0,defaultMax:m=f.donutDefaultMax,onHover:v,onLeave:b}=e;if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const g=s==="dark",$=g?f.donutTrackFillDark:f.donutTrackFill,_=g?f.donutDividerDark:f.donutDivider,y=g?f.donutSliceStrokeDark:f.donutSliceStroke,S=g?f.donutStatusColorsDark:f.donutStatusColors,w=n.reduce((B,X)=>{var et,K;return(((et=X.slices)==null?void 0:et.length)??0)>(((K=B==null?void 0:B.slices)==null?void 0:K.length)??0)?X:B},void 0),L=h?(w==null?void 0:w.slices)??[]:[],N=L.length>1?22:0,E=o.left,H=o.top+N,F=i-o.left-o.right,W=r-H-o.bottom;if(F<=0||W<=0)return;const{columns:M,rows:z,cellWidth:T,cellHeight:C}=ck(n.length,F,W);if(!M||!z)return;const k=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label",`donut group chart, ${n.length} donuts`).style("display","block").style("font-family",a.fontFamily),x=k.append("g").attr("class","donuts");if(L.length>1){const B=k.append("g").attr("class","legend").attr("transform",`translate(${E},${o.top})`);let X=0;L.forEach((et,K)=>{const at=Qc(et.color,K,L.length,a,l),nt=B.append("g").attr("transform",`translate(${X},0)`);nt.append("rect").attr("x",0).attr("y",2).attr("width",10).attr("height",10).attr("rx",2).attr("fill",at);const tt=nt.append("text").attr("x",16).attr("y",11).attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(et.label);X+=hk(tt.node(),et.label,f.axisLabelSize)+30})}const A=B=>{x.selectAll("path.donut-arc").attr("opacity",function(){return this===B?1:f.donutArcOpacityDimmed})},D=()=>{x.selectAll("path.donut-arc").attr("opacity",f.donutArcOpacity)},R=ew().sort(null).value(B=>B);n.forEach((B,X)=>{const et=X%M,K=Math.floor(X/M),at=E+et*T,nt=H+K*C,tt=at+T/2,j=nt+C/2,{outerRadius:I,innerRadius:V}=uk(T,C);if(I<=0)return;et>0&&x.append("line").attr("class","donut-divider").attr("x1",at).attr("x2",at).attr("y1",nt+8).attr("y2",nt+C-8).attr("stroke",_).attr("shape-rendering","crispEdges");const U=x.append("g").attr("class","donut").attr("data-donut",B.id).attr("transform",`translate(${tt},${j})`),O=B.slices??[],P=O.length>1,{values:J,track:rt}=lk(B,m),it=J.reduce((mt,bt)=>mt+bt,0),lt=R(J),gt=Na().innerRadius(V).outerRadius(I);lt.forEach((mt,bt)=>{var dt;if(mt.endAngle-mt.startAngle<=0)return;const Ct=rt&&bt===1,ut=Ct?$:P?Qc((dt=O[bt])==null?void 0:dt.color,bt,O.length,a,l):Qc(B.color,X,n.length,a,l),kt=U.append("path").attr("class",Ct?"donut-track":"donut-arc").attr("d",gt({startAngle:mt.startAngle,endAngle:mt.endAngle})).attr("fill",ut).attr("opacity",Ct?1:f.donutArcOpacity).attr("stroke",y).attr("stroke-width",f.donutSliceStrokeWidth);if(Ct||!p||!v)return;const It=P?O[bt].label:B.label,Nt=P?O[bt].value:B.value,ue=P?it>0?Math.abs(Nt)/it:0:sk(B.value,mf(B,m));kt.style("cursor","pointer").on("mouseenter",function(he){A(this),v({title:B.label,entries:[{itemId:B.id,label:It,color:ut,value:Nt,ratio:ue}],event:he})}).on("mousemove",function(he){v({title:B.label,entries:[{itemId:B.id,label:It,color:ut,value:Nt,ratio:ue}],event:he})}).on("mouseleave",()=>{D(),b==null||b()})}),uB(U,{item:B,innerRadius:V,theme:a,statusColors:S,showValue:c,showStatus:u,showLabel:d})})}function uB(t,e){const{item:n,innerRadius:i,theme:r,statusColors:o,showValue:a,showStatus:s,showLabel:l}=e;if(i<=6)return;const c=i*2,u=Ig(i*.62,9,f.donutValueSize),d=Ig(u*.42,7,f.donutLabelSize),h=Math.max(2,d*.35),p=d*1.6,m=s?n.statusLabel:void 0,v=l?n.label:"",b=a?u*1.15:0,g=d*1.3;let $=!!m,_=!!v;const y=()=>b+($?p+h:0)+(_?g+h:0);y()>c&&_&&(_=!1),y()>c&&$&&($=!1);const S=y();if(!S)return;const w=t.append("g").attr("class","donut-kpi").attr("pointer-events","none");let L=-S/2;if(a&&(w.append("text").attr("class","donut-value").attr("x",0).attr("y",L+b/2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",u).attr("font-weight",f.donutValueWeight).style("dominant-baseline","middle").text(gf(n.value)),L+=b),$&&m){L+=h;const N=o[n.status??"neutral"],E=w.append("g").attr("class","donut-badge"),H=E.append("rect"),F=E.append("text").attr("x",0).attr("y",L+p/2).attr("text-anchor","middle").attr("fill",N.text).attr("font-size",d).style("dominant-baseline","middle").text(ju(m,Math.max(1,Math.floor(c/(d*.56))))),W=hk(F.node(),m,d),M=Math.min(W+d,c);H.attr("x",-M/2).attr("y",L).attr("width",M).attr("height",p).attr("rx",p/2).attr("fill",N.background),L+=p}_&&(L+=h,w.append("text").attr("class","donut-label").attr("x",0).attr("y",L+g/2).attr("text-anchor","middle").attr("fill",r.textMuted).attr("font-size",d).style("dominant-baseline","middle").text(ju(v,Math.max(1,Math.floor(c/(d*.56))))))}const dB=ie`
919
+ :host {
920
+ display: block;
921
+ position: relative;
922
+ width: 100%;
923
+ height: 100%;
924
+ min-height: 180px;
925
+ color: var(--ui9000-color-text, #111827);
926
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
927
+ box-sizing: border-box;
928
+ }
929
+ .chart-root {
930
+ width: 100%;
931
+ height: 100%;
932
+ min-height: inherit;
933
+ }
934
+ .tooltip {
935
+ position: absolute;
936
+ pointer-events: none;
937
+ z-index: 2;
938
+ padding: 6px 10px;
939
+ border-radius: 6px;
940
+ font-size: 12px;
941
+ line-height: 1.35;
942
+ background: var(--ui9000-color-text, #111827);
943
+ color: #fff;
944
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
945
+ transform: translate(-50%, calc(-100% - 12px));
946
+ white-space: nowrap;
947
+ }
948
+ .tooltip .title {
949
+ font-weight: 600;
950
+ margin-bottom: 2px;
951
+ }
952
+ .tooltip .row {
953
+ display: flex;
954
+ align-items: center;
955
+ gap: 6px;
956
+ }
957
+ .tooltip .swatch {
958
+ width: 8px;
959
+ height: 8px;
960
+ border-radius: 2px;
961
+ flex: none;
962
+ }
963
+ .tooltip .value {
964
+ margin-left: auto;
965
+ font-variant-numeric: tabular-nums;
966
+ }
967
+ .tooltip .share {
968
+ opacity: 0.75;
969
+ }
970
+ .empty {
971
+ display: grid;
972
+ place-items: center;
973
+ height: 100%;
974
+ min-height: inherit;
975
+ color: var(--ui9000-color-text-muted, #6b7280);
976
+ font-size: 0.875rem;
977
+ }
978
+ `,hB=["positive","negative","neutral"];function fk(t){return hB.includes(t)?t:void 0}function Kn(t){if(t==null||t==="")return;const e=Number(t);return Number.isFinite(e)?e:void 0}function Ne(t){if(t==null)return;const e=String(t).trim();return e.length?e:void 0}function yf(t,e){return Ne(t.label)??Ne(t.name)??Ne(t.x)??Ne(t.category)??e}function mk(t){return Kn(t.value)??Kn(t.y)??Kn(t.count)}function pB(t){const e=Kn(t.max)??Kn(t.maximalValue)??Kn(t.total);return e!=null&&e>0?e:void 0}function gk(t){return t.map(e=>({row:e,value:mk(e)})).filter(e=>e.value!=null).map(({row:e,value:n},i)=>({label:yf(e,`Slice ${i+1}`),value:n,color:Ne(e.color)}))}function tu(t,e){const n=mk(t);if(n==null)return null;const i=yf(t,`Item ${e+1}`);return{id:Ne(t.id)??i,label:i,value:n,max:pB(t),statusLabel:Ne(t.statusLabel)??Ne(t.badge),status:fk(t.status),color:Ne(t.color)}}function Mg(t){return t.map((e,n)=>{const i=Kn(e.value),r=Array.isArray(e.slices)?gk(e.slices):[],o=r.reduce((s,l)=>s+l.value,0);if(i==null&&!r.length)return null;const a=Ne(e.label)??Ne(e.id)??`Item ${n+1}`;return{id:Ne(e.id)??a,label:a,value:i??o,max:e.max!=null&&e.max>0?e.max:void 0,statusLabel:Ne(e.statusLabel),status:fk(e.status),color:Ne(e.color),slices:r.length?r:void 0}}).filter(e=>e!=null)}function yk(t){var e,n;if(!t)return[];if(Array.isArray(t)){if(!t.length)return[];if(Array.isArray(t[0]))return t.map((r,o)=>{const a=gk(Array.isArray(r)?r:[]);if(!a.length)return null;if(a.length===1)return tu(r[0],o);const s=r[0]??{},l=yf(s,`Item ${o+1}`);return{id:Ne(s.id)??l,label:l,value:a.reduce((c,u)=>c+u.value,0),slices:a}}).filter(r=>r!=null);const i=t[0];return Array.isArray(i.slices)?Mg(t):t.map((r,o)=>tu(r,o)).filter(r=>r!=null)}return(e=t.items)!=null&&e.length?Mg(t.items):(n=t.points)!=null&&n.length?t.points.map((i,r)=>tu(i,r)).filter(i=>i!=null):[]}var fB=Object.defineProperty,mB=Object.getOwnPropertyDescriptor,Or=(t,e,n,i)=>{for(var r=i>1?void 0:i?mB(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&fB(e,n,r),r};let Ee=class extends Vn{constructor(){super(...arguments),this.dataJson="[]",this.scale="default",this.max=100,this.showValue=!0,this.showStatus=!0,this.showLabel=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this))}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(){this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return yk(t)}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.length===0,this._empty){e.replaceChildren();return}const i=wt(this),r=Rr(this,Fr.mode,"light")==="dark"?"dark":"light",o=Rr(this,Fr.styleId,"default"),{width:a,height:s,margin:l}=oC(e,this.scale);pk(e,{items:n,width:a,height:s,margin:l,theme:i,themeMode:r,styleId:o,defaultMax:this.max,showValue:this.showValue,showStatus:this.showStatus,showLabel:this.showLabel,showLegend:this.showLegend,showTooltip:this.showTooltip,onHover:this.showTooltip?({title:c,entries:u,event:d})=>{const h=this.getBoundingClientRect();this._tooltip={x:d.clientX-h.left,y:d.clientY-h.top,title:c,entries:u}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){return ot`
979
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
980
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
981
+ ${this._tooltip?ot`<div
982
+ class="tooltip"
983
+ part="tooltip"
984
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
985
+ >
986
+ <div class="title">${this._tooltip.title}</div>
987
+ ${this._tooltip.entries.map(t=>ot`<div class="row">
988
+ <span class="swatch" style="background:${t.color}"></span>
989
+ <span>${t.label}</span>
990
+ <span class="value">${gf(t.value)}</span>
991
+ <span class="share">${dk(t.ratio)}</span>
992
+ </div>`)}
993
+ </div>`:st}
994
+ `}};Ee.styles=dB;Or([Y({type:String,attribute:"data"})],Ee.prototype,"dataJson",2);Or([Y({type:String,attribute:"scale"})],Ee.prototype,"scale",2);Or([Y({type:Number,attribute:"max"})],Ee.prototype,"max",2);Or([Y({type:Boolean,attribute:"show-value"})],Ee.prototype,"showValue",2);Or([Y({type:Boolean,attribute:"show-status"})],Ee.prototype,"showStatus",2);Or([Y({type:Boolean,attribute:"show-label"})],Ee.prototype,"showLabel",2);Or([Y({type:Boolean,attribute:"show-legend"})],Ee.prototype,"showLegend",2);Or([Y({type:Boolean,attribute:"show-tooltip"})],Ee.prototype,"showTooltip",2);Or([yt()],Ee.prototype,"_tooltip",2);Or([yt()],Ee.prototype,"_empty",2);Ee=Or([Xt("ui9000-donut-group-chart")],Ee);function vk(){customElements.get("ui9000-donut-group-chart")||customElements.define("ui9000-donut-group-chart",Ee)}vk();const gB=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000DonutGroupChart(){return Ee},donutArcValues:lk,donutGridLayout:ck,donutGroupChartMetadata:q_,donutRadii:uk,fitLabel:ju,formatCompact:gf,formatPercent:dk,gaugeRatio:sk,normalizeDonutGroupData:yk,registerDonutGroupChart:vk,renderDonutGroupChart:pk,resolveMax:mf},Symbol.toStringTag,{value:"Module"}));function bk(t){let e=0;for(const n of t.bins){const i=n.stacks.length>0?n.stacks[n.stacks.length-1].end:0;i>e&&(e=i)}return e}function xk(t){return t.bins.map(e=>String(e.index))}function yB(t,e,n,i){if(n)return n;const r=Math.max(0,e.indexOf(t));return r===0&&i.primary?i.primary:r===1&&i.secondary?i.secondary:tr(r)}function _k(t,e){const{model:n,width:i,height:r,margin:o={...f.histogramMargin},theme:a,showGrid:s=!0,xLabel:l,yLabel:c,onStackHover:u,onStackLeave:d}=e;if(t.replaceChildren(),!n.bins.length||i<=0||r<=0)return;const h={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,1)},p=i-h.left-h.right,m=r-h.top-h.bottom;if(p<8||m<8)return;const v=bk(n),b=v===0?1:v*1.2,g=ge(m),$=xk(n),y=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Histogram chart").style("display","block").style("font-family",a.fontFamily).append("g").attr("class","plot").attr("transform",`translate(${h.left},${h.top})`),S=de().domain($).range([0,p]).padding(0),w=Ft().domain([n.xMin,n.xMax]).rangeRound([0,p]).clamp(!0),L=Ft().domain([0,b]).nice().range([m,0]),N=L.ticks(g);if(s){const W=y.append("g").attr("class","y-grid");for(const T of N)W.append("line").attr("x1",0).attr("x2",p).attr("y1",L(T)).attr("y2",L(T)).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1).attr("shape-rendering","crispEdges");const M=w.ticks(Math.min(8,Math.max(2,$.length))),z=y.append("g").attr("class","x-grid");for(const T of M)z.append("line").attr("x1",w(T)).attr("x2",w(T)).attr("y1",0).attr("y2",m).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1).attr("shape-rendering","crispEdges")}for(const W of n.bins){const M=String(W.index),z=S(M)??0,T=S.bandwidth(),C=y.append("g").attr("class",`bin-group bin-${W.index}`);for(const k of W.stacks){const x=L(k.end),A=L(k.start),D=Math.max(0,A-x),R=yB(k.group,n.groups,k.color,a),B=C.append("rect").attr("class","bin").attr("x",z).attr("width",T).attr("y",x).attr("height",D).attr("fill",R).attr("fill-opacity",.8).style("cursor",u?"pointer":"default");u&&B.on("mouseenter",function(X){y.selectAll(".bin").attr("opacity",.2),ht(this).attr("opacity",1),u({binIndex:W.index,x0:W.x0,x1:W.x1,stack:k,event:X})}).on("mousemove",X=>{u({binIndex:W.index,x0:W.x0,x1:W.x1,stack:k,event:X})}).on("mouseleave",()=>{y.selectAll(".bin").attr("opacity",1),d==null||d()})}}const E=y.append("g").attr("class","y-axis").call(Jt(L).tickValues(N).tickSize(0).tickPadding(0).tickFormat(W=>{const M=Number(W),z=Number.isInteger(M)&&Math.abs(M)<1e3?0:2;return Pt(M,z)}));E.select(".domain").attr("stroke",f.axisStroke).attr("stroke-dasharray",f.gridDash),we(E,h.left),E.selectAll(".tick").append("line").attr("class","tick-line").attr("x1",-4).attr("x2",0).attr("y1",0).attr("y2",0).attr("stroke",f.axisStroke).attr("stroke-width",1);const H=y.append("g").attr("class","x-axis").attr("transform",`translate(0,${m})`).call(ae(w).tickSizeOuter(0).tickSize(0).tickPadding(8).tickFormat(W=>{const M=Number(W),z=Number.isInteger(M)&&Math.abs(M)<1e3?0:2;return Pt(M,z)}));H.select(".domain").attr("stroke",f.axisStroke),H.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const F=H.selectAll("text").nodes();F.length>0&&(ht(F[0]).attr("text-anchor","start"),F.length>1&&ht(F[F.length-1]).attr("text-anchor","end")),l&&y.append("text").attr("x",p/2).attr("y",m+h.bottom-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(l),c&&y.append("text").attr("x",4).attr("y",-4).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(c)}const vB=ie`
995
+ :host {
996
+ display: block;
997
+ position: relative;
998
+ width: 100%;
999
+ height: 100%;
1000
+ min-height: 220px;
1001
+ color: var(--ui9000-color-text, #111827);
1002
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1003
+ box-sizing: border-box;
1004
+ }
1005
+ .chart-root {
1006
+ flex: 1 1 auto;
1007
+ width: 100%;
1008
+ min-height: 240px;
1009
+ }
1010
+ .tooltip {
1011
+ position: absolute;
1012
+ pointer-events: none;
1013
+ z-index: 2;
1014
+ padding: 6px 10px;
1015
+ border-radius: 6px;
1016
+ font-size: 12px;
1017
+ line-height: 1.35;
1018
+ background: var(--ui9000-color-text, #111827);
1019
+ color: #fff;
1020
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1021
+ transform: translate(-50%, calc(-100% - 10px));
1022
+ white-space: nowrap;
1023
+ }
1024
+ .tooltip .name {
1025
+ font-weight: 600;
1026
+ }
1027
+ .empty {
1028
+ display: grid;
1029
+ place-items: center;
1030
+ height: 100%;
1031
+ min-height: inherit;
1032
+ color: var(--ui9000-color-text-muted, #6b7280);
1033
+ font-size: 0.875rem;
1034
+ }
1035
+ `;function bB(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!=null&&typeof e=="object"&&"label"in e&&"value"in e}function xB(t){return t!=null&&typeof t=="object"&&Array.isArray(t.bins)}function _B(t){return t!=null&&typeof t=="object"&&Array.isArray(t.data)&&"xMin"in t&&"xMax"in t}function vf(t){let e=0;return t.map(n=>{const i=Number(n.count)||0,r=e,o=r+i;return e=o,{group:n.group,count:i,color:n.color,start:r,end:o}})}function Ng(t,e){if(t.group!=null&&String(t.group)!=="")return String(t.group);if(typeof t._id=="string"&&t._id!=="")return t._id;if(t._id&&typeof t._id=="object"){const n=Object.keys(t._id);if(e!=null&&e.length){for(const i of e)if(i in t._id)return String(t._id[i]??"")}if(n.length===1)return String(t._id[n[0]]??"");for(const i of n)if(i!=="bucketIndex")return String(t._id[i]??"")}return"default"}function $B(t){const e=t.map((n,i)=>{const r=Number(n.value);if(!Number.isFinite(r))return null;const o=vf([{group:"Series",count:r,color:n.color}]);return{index:i,x0:i,x1:i+1,stacks:o}}).filter(n=>n!=null);return{bins:e,groups:e.length?["Series"]:[],xMin:0,xMax:Math.max(e.length,1)}}function wB(t){const e=[],n=new Set,i=(t.bins??[]).map((l,c)=>{const u=(l.stacks??[]).map(d=>({group:String(d.group??"default"),count:Number(d.count)||0,color:d.color})).filter(d=>Number.isFinite(d.count));for(const d of u)n.has(d.group)||(n.add(d.group),e.push(d.group));return{index:c,x0:Number(l.x0),x1:Number(l.x1),stacks:vf(u)}}),r=i.map(l=>l.x0).filter(Number.isFinite),o=i.map(l=>l.x1).filter(Number.isFinite),a=t.xMin!=null&&Number.isFinite(t.xMin)?Number(t.xMin):r.length?Math.min(...r):0,s=t.xMax!=null&&Number.isFinite(t.xMax)?Number(t.xMax):o.length?Math.max(...o):1;return{bins:i,groups:e,xMin:a,xMax:s}}function $k(t){var e;const n=Number(t.xMin),i=Number(t.xMax),r=t.data??[];if(!r.length||!Number.isFinite(n)||!Number.isFinite(i))return{bins:[],groups:[],xMin:0,xMax:1};const o=new Map;let a=-1;for(const h of r){const p=Number(h.bucketIndex);if(!Number.isFinite(p))continue;a=Math.max(a,p);const m=o.get(p)??[];m.push(h),o.set(p,m)}const s=a+1;if(s<=0)return{bins:[],groups:t.groups??[],xMin:n,xMax:i};const l=(i-n)/s,c=[],u=new Set;if((e=t.groups)!=null&&e.length)for(const h of t.groups)u.has(h)||(u.add(h),c.push(h));for(const h of r){const p=Ng(h,t.groups);u.has(p)||(u.add(p),c.push(p))}const d=[];for(let h=0;h<s;h++){const p=o.get(h)??[],m=new Map;for(const b of p)m.set(Ng(b,t.groups),b);const v=[];for(const b of c){const g=m.get(b);g&&v.push({group:b,count:Number(g.count)||0,color:g.color})}d.push({index:h,x0:n+h*l,x1:n+(h+1)*l,stacks:vf(v)})}return{bins:d,groups:c,xMin:n,xMax:i}}function kB(t){const e=t.data;if(!Array.isArray(e)||e.length===0)return null;const n=e[0];if(!n||typeof n!="object")return null;const i=n.histogramResults;if(!Array.isArray(i))return null;const r=t.uniqueValues??{},o=Object.keys(r),s=(Array.isArray(t.groupBy)?String(t.groupBy[0]??""):typeof t.groupBy=="string"?t.groupBy:"")||o[0]||"",l=s&&Array.isArray(r[s])?r[s]:void 0,c=$k({xMin:Number(n.min??t.xMin??0),xMax:Number(n.max??t.xMax??1),data:i,groups:l}),u=Array.isArray(t.formatting)?t.formatting:void 0;if(u!=null&&u.length&&c.groups.length)for(const d of c.bins)for(const h of d.stacks)h.color=zt(u,h.group,c.groups.length);return c}function wk(t){if(!t)return{bins:[],groups:[],xMin:0,xMax:1};if(Array.isArray(t))return t.length===0?{bins:[],groups:[],xMin:0,xMax:1}:bB(t)?$B(t):{bins:[],groups:[],xMin:0,xMax:1};if(xB(t))return wB(t);if(_B(t))return $k(t);if(typeof t=="object"){const e=kB(t);if(e&&e.bins.length)return e}return{bins:[],groups:[],xMin:0,xMax:1}}function Uu(t){const e=Math.abs(t);return e>=1e9?`${(t/1e9).toFixed(1)}B`:e>=1e6?`${(t/1e6).toFixed(1)}M`:e>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?String(t):t.toFixed(1)}function kk(t,e){const n=Uu(t),i=Uu(e);return`${n} – ${i}`}var SB=Object.defineProperty,AB=Object.getOwnPropertyDescriptor,un=(t,e,n,i)=>{for(var r=i>1?void 0:i?AB(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&SB(e,n,r),r};let Ye=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return wk(t)}renderLegend(t){if(!this.showLegend||t.groups.length<=1)return st;const e=wt(this);return ce(Nr(t.groups,e))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.bins.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=lC(e);_k(e,{model:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onStackHover:this.showTooltip?({x0:s,x1:l,stack:c,event:u})=>{const d=this.getBoundingClientRect();this._tooltip={x:u.clientX-d.left,y:u.clientY-d.top,group:c.group,range:kk(s,l),count:c.count}}:void 0,onStackLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?{bins:[],groups:[],xMin:0,xMax:0}:this.parseData();return ot`
1036
+ <div class="widget-shell" part="shell">
1037
+ ${this.renderShellHeader(t)}
1038
+ <div class="widget-body">
1039
+ ${this.renderLegend(e)}
1040
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1041
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1042
+ ${this._tooltip?ot`<div
1043
+ class="tooltip"
1044
+ part="tooltip"
1045
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1046
+ >
1047
+ <div class="name">${this._tooltip.group}</div>
1048
+ <div>Count: ${this._tooltip.count}</div>
1049
+ <div>Range: ${this._tooltip.range}</div>
1050
+ </div>`:st}
1051
+ ${this.renderShellLabelTooltip()}
1052
+ </div>
1053
+ </div>
1054
+ `}};Ye.styles=[vB,ne];un([Y({type:String,attribute:"scale"})],Ye.prototype,"scale",2);un([Y({type:Boolean,attribute:"show-grid"})],Ye.prototype,"showGrid",2);un([Y({type:Boolean,attribute:"show-legend"})],Ye.prototype,"showLegend",2);un([Y({type:Boolean,attribute:"show-tooltip"})],Ye.prototype,"showTooltip",2);un([Y({type:String,attribute:"x-label"})],Ye.prototype,"xLabel",2);un([Y({type:String,attribute:"y-label"})],Ye.prototype,"yLabel",2);un([yt()],Ye.prototype,"_tooltip",2);un([yt()],Ye.prototype,"_empty",2);Ye=un([Xt("ui9000-histogram-chart")],Ye);function Sk(){customElements.get("ui9000-histogram-chart")||customElements.define("ui9000-histogram-chart",Ye)}Sk();const zB=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000HistogramChart(){return Ye},collectBinKeys:xk,collectYMax:bk,formatBinRange:kk,formatCompact:Uu,histogramChartMetadata:V_,normalizeHistogramData:wk,registerHistogramChart:Sk,renderHistogramChart:_k},Symbol.toStringTag,{value:"Module"}));function Ak(t){const e=Math.abs(t);return e>=1e9?`${(t/1e9).toFixed(1)}B`:e>=1e6?`${(t/1e6).toFixed(1)}M`:e>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?String(t):t.toFixed(1)}const TB=6;function zk(t,e){const{model:n,width:i,height:r,margin:o={...f.punchcardMargin},theme:a,showGrid:s=!0,xLabel:l,yLabel:c,onCellHover:u,onCellLeave:d,onAxisLabelHover:h,onAxisLabelLeave:p}=e,m={onAxisLabelHover:h,onAxisLabelLeave:p};if(t.replaceChildren(),!n.cells.length||i<=0||r<=0)return;const v=n.xDomain.length?n.xDomain:[...new Set(n.cells.map(A=>A.x))],b=n.yDomain.length?n.yDomain:[...new Set(n.cells.map(A=>A.y))],g=G6(b),$={top:o.top,bottom:o.bottom||q6,left:g,right:o.right},_=i-$.left-$.right,y=r-$.top-$.bottom;if(_<8||y<8)return;const S=n.cells.map(A=>A.value).filter(Number.isFinite),w=Z6(S,lf),L=V6(_,y,v.length,b.length),N=de().domain(v).range([L,_-L]).paddingInner(0).paddingOuter(-.5),E=de().domain(b).range([L,y-L]).paddingInner(0).paddingOuter(-.5),H=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Punchcard chart").style("display","block").style("font-family",a.fontFamily),F=H.append("defs"),W=new Set;for(const A of n.cells)W.add(mg(A.value,w));for(const A of W){const D=A.replace("#","hex"),R=F.append("linearGradient").attr("id",`bubble-gradient-${D}`).attr("x1","0%").attr("y1","100%").attr("x2","0%").attr("y2","0%");R.append("stop").attr("offset","0%").attr("stop-color",A).attr("stop-opacity","0.3"),R.append("stop").attr("offset","100%").attr("stop-color",A).attr("stop-opacity","0.1")}const M=H.append("g").attr("class","plot").attr("transform",`translate(${$.left},${$.top})`);if(s){const A=M.append("g").attr("class","grid");for(const D of v){const R=N(D);if(R==null)continue;const B=R+N.bandwidth()/2;A.append("line").attr("x1",B).attr("x2",B).attr("y1",0).attr("y2",y).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges")}for(const D of b){const R=E(D);if(R==null)continue;const B=R+E.bandwidth()/2;A.append("line").attr("x1",0).attr("x2",_).attr("y1",B).attr("y2",B).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges")}}const z=M.append("g").attr("class","plot-frame");z.append("line").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",y).attr("stroke",f.axisStroke).attr("shape-rendering","crispEdges"),z.append("line").attr("x1",0).attr("x2",_).attr("y1",y).attr("y2",y).attr("stroke",f.axisStroke).attr("shape-rendering","crispEdges");const T=M.append("g").attr("class","bubbles");for(const A of n.cells){const D=N(A.x),R=E(A.y);if(D==null||R==null||!Number.isFinite(A.value))continue;const B=D+N.bandwidth()/2,X=R+E.bandwidth()/2,et=A.color??mg(A.value,w),K=W6(A.value,w,L),at=et.replace("#","hex"),nt=A.value<0,tt=T.append("g").attr("class","bubble").style("cursor",u?"pointer":"default");tt.append("circle").attr("cx",B).attr("cy",X).attr("r",K).attr("fill",nt?"#DADAE1":`url(#bubble-gradient-${at})`).attr("fill-opacity",nt?.6:1).attr("stroke",nt?"#DADAE1":et).attr("stroke-width",1),K>=dw&&tt.append("text").attr("x",B).attr("y",X).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("fill","#000").attr("font-size",12).attr("pointer-events","none").text(Ak(A.value)),u&&tt.on("mouseenter",function(j){M.selectAll(".bubble").attr("opacity",.2),ht(this).attr("opacity",1),u({cell:A,event:j})}).on("mousemove",j=>{u({cell:A,event:j})}).on("mouseleave",()=>{M.selectAll(".bubble").attr("opacity",1),d==null||d()})}const C=M.append("g").attr("class","y-axis").call(Jt(E).tickSize(0).tickPadding(4));C.select(".domain").remove(),C.selectAll("line").attr("stroke","none"),C.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize),cr(C,{slotWidth:g-Du,...m}),F6(C,g,Du);const k=M.append("g").attr("class","x-axis").attr("transform",`translate(0,${y})`).call(ae(N).tickSize(0).tickPadding(TB));k.select(".domain").remove(),k.selectAll("line").attr("stroke","none"),k.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const x=k.selectAll("text").nodes();x.length>0&&(ht(x[0]).attr("text-anchor","start"),x.length>1&&ht(x[x.length-1]).attr("text-anchor","end")),cr(k,{slotWidth:N.bandwidth(),...m}),l&&H.append("text").attr("x",$.left+_/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(l),c&&H.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(c)}const LB=ie`
1055
+ :host {
1056
+ display: block;
1057
+ position: relative;
1058
+ width: 100%;
1059
+ height: 100%;
1060
+ min-height: 480px;
1061
+ color: var(--ui9000-color-text, #111827);
1062
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1063
+ box-sizing: border-box;
1064
+ }
1065
+ .chart-root {
1066
+ flex: 1 1 auto;
1067
+ width: 100%;
1068
+ min-height: 400px;
1069
+ }
1070
+ .tooltip {
1071
+ position: absolute;
1072
+ pointer-events: none;
1073
+ z-index: 2;
1074
+ padding: 6px 10px;
1075
+ border-radius: 6px;
1076
+ font-size: 12px;
1077
+ line-height: 1.35;
1078
+ background: var(--ui9000-color-text, #111827);
1079
+ color: #fff;
1080
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1081
+ transform: translate(-50%, calc(-100% - 10px));
1082
+ white-space: nowrap;
1083
+ }
1084
+ .tooltip .name {
1085
+ font-weight: 600;
1086
+ }
1087
+ .empty {
1088
+ display: grid;
1089
+ place-items: center;
1090
+ height: 100%;
1091
+ min-height: inherit;
1092
+ color: var(--ui9000-color-text-muted, #6b7280);
1093
+ font-size: 0.875rem;
1094
+ }
1095
+ `;function CB(t){if(!t||typeof t!="object")return!1;const e=t;return"x"in e&&"y"in e&&"value"in e}function IB(t){const e=String(t.x??""),n=String(t.y??""),i=Number(t.value);return!e||!n||!Number.isFinite(i)?null:{x:e,y:n,value:i,color:t.color}}function Dg(t){const e=new Set,n=[];for(const i of t)e.has(i)||(e.add(i),n.push(i));return n}function Bu(t,e,n){const i=t.map(IB).filter(r=>r!=null);return{cells:i,xDomain:e!=null&&e.length?e:Dg(i.map(r=>r.x)),yDomain:n!=null&&n.length?n:Dg(i.map(r=>r.y))}}function MB(t){var e,n;const i=se(t),r=ft(t.xAxe)??"x",o=ft(t.yAxe)??"value",a=x$(t),s=(e=t.uniqueValues)==null?void 0:e[r],l=a?(n=t.uniqueValues)==null?void 0:n[a]:void 0,c=[];for(const u of i){const d=u[r],h=Number(u[o]);if(d==null||!Number.isFinite(h))continue;const p=a?u[a]:"default";p!=null&&c.push({x:String(d),y:String(p),value:h,color:typeof u.color=="string"?u.color:void 0})}return Bu(c,s,l)}function Tk(t){const e={cells:[],xDomain:[],yDomain:[]};if(!t)return e;if(Array.isArray(t))return t.length===0?e:CB(t[0])?Bu(t):e;if("cells"in t&&Array.isArray(t.cells)){const n=t;return Bu(n.cells,n.xDomain,n.yDomain)}return Ht(t)?MB(t):e}var NB=Object.defineProperty,DB=Object.getOwnPropertyDescriptor,An=(t,e,n,i)=>{for(var r=i>1?void 0:i?DB(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&NB(e,n,r),r};let ur=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return Tk(t)}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.cells.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=rC(e);zk(e,{model:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onCellHover:this.showTooltip?({cell:s,event:l})=>{const c=this.getBoundingClientRect();this._tooltip={x:l.clientX-c.left,y:l.clientY-c.top,cellX:s.x,cellY:s.y,cellValue:s.value}}:void 0,onCellLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle();return ot`
1096
+ <div class="widget-shell" part="shell">
1097
+ ${this.renderShellHeader(t)}
1098
+ <div class="widget-body">
1099
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1100
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1101
+ ${this._tooltip?ot`<div
1102
+ class="tooltip"
1103
+ part="tooltip"
1104
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1105
+ >
1106
+ <div class="name">${this._tooltip.cellY}</div>
1107
+ <div>${this._tooltip.cellX}: ${this._tooltip.cellValue}</div>
1108
+ </div>`:st}
1109
+ ${this.renderShellLabelTooltip()}
1110
+ </div>
1111
+ </div>
1112
+ `}};ur.styles=[LB,ne];An([Y({type:String,attribute:"scale"})],ur.prototype,"scale",2);An([Y({type:Boolean,attribute:"show-grid"})],ur.prototype,"showGrid",2);An([Y({type:Boolean,attribute:"show-tooltip"})],ur.prototype,"showTooltip",2);An([Y({type:String,attribute:"x-label"})],ur.prototype,"xLabel",2);An([Y({type:String,attribute:"y-label"})],ur.prototype,"yLabel",2);An([yt()],ur.prototype,"_tooltip",2);An([yt()],ur.prototype,"_empty",2);ur=An([Xt("ui9000-punchcard-chart")],ur);function Lk(){customElements.get("ui9000-punchcard-chart")||customElements.define("ui9000-punchcard-chart",ur)}Lk();function OB(t){let e=1/0,n=-1/0;for(const i of t.cells)Number.isFinite(i.value)&&(i.value<e&&(e=i.value),i.value>n&&(n=i.value));if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e===n){const i=Math.abs(e)*.1||1;return[Math.min(0,e-i),n+i]}return[Math.min(0,e),n]}function PB(t){let e=0;for(const n of t.cells){if(!Number.isFinite(n.value))continue;const i=Math.abs(n.value);i>e&&(e=i)}return e||1}const EB=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000PunchcardChart(){return ur},collectValueExtent:OB,formatCompact:Ak,maxAbsValue:PB,normalizePunchcardData:Tk,punchcardChartMetadata:t$,registerPunchcardChart:Lk,renderPunchcardChart:zk},Symbol.toStringTag,{value:"Module"})),ir=12,FB=4,RB=ir*2,Og=2;function Ck(t){return t<=0?ir:ir*t+FB*Math.max(t-1,0)}function Ik(t,e){if(t<=0)return 0;const n=Ck(e);return t*(n+RB)}function Mk(t){const e=new Set,n=[];for(const i of t.boxes)e.has(i.label)||(e.add(i.label),n.push(i.label));return n}function Nk(t){let e=1/0,n=-1/0;const i=r=>{r==null||!Number.isFinite(r)||(r<e&&(e=r),r>n&&(n=r))};for(const r of t){i(r.smallestNonOutlier),i(r.biggestNonOutlier),i(r.q1),i(r.q3),i(r.median),i(r.min),i(r.max);for(const o of r.outliers??[])i(o)}if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e===n){const r=Math.abs(e)*.1||1;return[e-r,n+r]}return[e,n]}function Dk(t){const[e,n]=Nk(t),i=e<0?e*1.1:0,r=n===0&&e===0?1:n*1.1;return[i,r]}const Pg=3,Eg=f.axisLabelFill,$i=f.axisLabelFill,Fg=2;function Rg(t,e,n){return e.color?e.color:t===0&&n.primary?n.primary:t===1&&n.secondary?n.secondary:tr(t)}function jB(t,e,n,i,r){const o=i/2,a=Math.min(r,o,Math.abs(n-e)/2);return`
1113
+ M${t-o},${e+a}
1114
+ a${a},${a} 0 0 1 ${a},-${a}
1115
+ H${t+o-a}
1116
+ a${a},${a} 0 0 1 ${a},${a}
1117
+ V${n-a}
1118
+ a${a},${a} 0 0 1 -${a},${a}
1119
+ H${t-o+a}
1120
+ a${a},${a} 0 0 1 -${a},-${a}
1121
+ Z
1122
+ `}function UB(t,e,n,i,r){const o=i/2,a=Math.min(r,o,Math.abs(n-e)/2);return`
1123
+ M${e},${t-o+a}
1124
+ a${a},${a} 0 0 1 ${a},-${a}
1125
+ H${n-a}
1126
+ a${a},${a} 0 0 1 ${a},${a}
1127
+ V${t+o-a}
1128
+ a${a},${a} 0 0 1 -${a},${a}
1129
+ H${e+a}
1130
+ a${a},${a} 0 0 1 -${a},-${a}
1131
+ Z
1132
+ `}function jg(t,e,n,i,r){i&&e.style("cursor","pointer").on("mouseenter",function(o){t.selectAll(".bin-container").attr("opacity",.2),ht(this).attr("opacity",1),i({box:n,event:o})}).on("mousemove",o=>{i({box:n,event:o})}).on("mouseleave",()=>{t.selectAll(".bin-container").attr("opacity",1),r==null||r()})}function Ug(t,e,n){t.call(ae(e).tickValues(n).tickSize(0).tickPadding(8).tickFormat(r=>{const o=Number(r),a=Number.isInteger(o)&&Math.abs(o)<1e3?0:2;return Pt(o,a)})).call(r=>r.select(".domain").attr("stroke",f.axisStroke)),t.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle");const i=t.selectAll("text").nodes();i.length>0&&(ht(i[0]).attr("text-anchor","start"),i.length>1&&ht(i[i.length-1]).attr("text-anchor","end"))}function Ok(t,e){var n;const{model:i,width:r,height:o,margin:a={...f.boxPlotMargin},theme:s,orientation:l=i.orientation??"vertical",showGrid:c=!0,xAxisContainer:u=null,xLabel:d,yLabel:h,onBoxHover:p,onBoxLeave:m,onAxisLabelHover:v,onAxisLabelLeave:b}=e,g={onAxisLabelHover:v,onAxisLabelLeave:b};if(t.replaceChildren(),u==null||u.replaceChildren(),!i.boxes.length||r<=0||o<=0)return;const $=i.groups.length?i.groups:["default"],_=(n=i.categoryLabels)!=null&&n.length?i.categoryLabels:Mk(i),y=l==="horizontal",S=y&&!!u,w=$.length,L=Ck(w),N={top:a.top,bottom:a.bottom,left:er(a.left),right:Math.max(a.right,12)},E=r-N.left-N.right,H=S?o-N.top:o-N.top-N.bottom,F=Ik(_.length,w),W=y?E:Math.max(E,F),M=y?S?F:Math.max(H,F):H;if(W<8||M<8)return;const z=y?r:N.left+W+N.right,T=y?S?N.top+M:N.top+M+N.bottom:o,[C,k]=Dk(i.boxes),x=ge(o),A=new Map($.map((et,K)=>[et,K])),D=de().domain($).range([0,L]).padding(0),R=et=>-L/2+(D(et)??0)+ir/2;t.style.height=`${T}px`,t.style.minHeight=`${T}px`;const B=ht(t).append("svg").attr("width",z).attr("height",T).attr("role","img").attr("aria-label","Box plot chart").style("display","block").style("font-family",s.fontFamily),X=B.append("g").attr("class","plot").attr("transform",`translate(${N.left},${N.top})`);if(y){const et=de().domain(_).range([0,M]).padding(0),K=Ft().domain([C,k]).nice().clamp(!0).range([0,W]),at=K.ticks(x);if(c){const tt=X.append("g").attr("class","grid");for(const j of at)tt.append("line").attr("x1",K(j)).attr("x2",K(j)).attr("y1",0).attr("y2",M).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges");C<0&&tt.append("line").attr("x1",K(0)).attr("x2",K(0)).attr("y1",0).attr("y2",M).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges"),X.append("g").attr("class","y-grid").call(Jt(et).tickSize(-W).tickFormat(()=>"")).call(j=>j.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges").attr("transform",`translate(0, ${-et.bandwidth()/2})`)}for(const tt of $){const j=A.get(tt)??0,I=R(tt);for(const V of i.boxes.filter(U=>(U.group??"default")===tt)){if(et(V.label)==null)continue;const U=(et(V.label)??0)+I+et.bandwidth()/2,O=Rg(j,V,s),P=K(V.q1),J=K(V.q3),rt=K(V.median),it=K(V.smallestNonOutlier),lt=K(V.biggestNonOutlier),gt=X.append("g").attr("class","bin-container").attr("opacity",1);gt.append("line").attr("class","bin-range").attr("x1",it).attr("x2",lt).attr("y1",U).attr("y2",U).attr("stroke",$i).attr("stroke-width",1);const mt=ir/2-2;for(const bt of[it,lt])gt.append("line").attr("class","bin-limits-line").attr("x1",bt).attr("x2",bt).attr("y1",U-mt).attr("y2",U+mt).attr("stroke",$i).attr("stroke-width",1);gt.append("path").attr("class","bin-quartile").attr("fill",O).attr("d",UB(U,P,J,ir,Og)),gt.append("line").attr("class","bin-median").attr("x1",rt).attr("x2",rt).attr("y1",U-ir/2+2).attr("y2",U+ir/2-2).attr("stroke",Eg).attr("stroke-width",Fg);for(const bt of V.outliers??[])Number.isFinite(bt)&&gt.append("circle").attr("class","bin-outlier").attr("cx",K(bt)).attr("cy",U).attr("r",Pg).attr("fill","transparent").attr("stroke",$i).attr("stroke-width",1);jg(X,gt,V,p,m)}}const nt=X.append("g").attr("class","y-axis").call(Jt(et).tickSize(0).tickPadding(8));if(nt.select(".domain").attr("stroke",f.axisStroke),we(nt,N.left,g),S&&u){const tt=ht(u).append("svg").attr("width",z).attr("height",N.bottom).attr("role","presentation").style("display","block").style("font-family",s.fontFamily);Ug(tt.append("g").attr("class","x-axis").attr("transform",`translate(${N.left},0)`),K,at),d&&tt.append("text").attr("x",N.left+W/2).attr("y",N.bottom-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(d)}else Ug(X.append("g").attr("class","x-axis").attr("transform",`translate(0,${M})`),K,at)}else{const et=de().domain(_).range([0,W]).padding(0),K=Ft().domain([C,k]).nice().clamp(!0).range([M,0]),at=R,nt=K.ticks(x);if(c){const I=X.append("g").attr("class","grid");for(const V of _){const U=et(V);if(U==null)continue;const O=U+et.bandwidth()/2;I.append("line").attr("x1",O).attr("x2",O).attr("y1",0).attr("y2",M).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges")}for(const V of nt)I.append("line").attr("x1",0).attr("x2",W).attr("y1",K(V)).attr("y2",K(V)).attr("stroke",f.gridStroke).attr("stroke-dasharray","1 2").attr("shape-rendering","crispEdges");C<0&&I.append("line").attr("x1",0).attr("x2",W).attr("y1",K(0)).attr("y2",K(0)).attr("stroke",f.gridStroke).attr("shape-rendering","crispEdges")}for(const I of $){const V=A.get(I)??0,U=at(I);for(const O of i.boxes.filter(P=>(P.group??"default")===I)){if(et(O.label)==null)continue;const P=(et(O.label)??0)+et.bandwidth()/2+U,J=Rg(V,O,s),rt=K(O.q1),it=K(O.q3),lt=K(O.median),gt=K(O.smallestNonOutlier),mt=K(O.biggestNonOutlier),bt=X.append("g").attr("class","bin-container").attr("opacity",1);bt.append("line").attr("class","bin-range").attr("x1",P).attr("x2",P).attr("y1",mt).attr("y2",gt).attr("stroke",$i).attr("stroke-width",1);const dt=ir/2-2;for(const Ct of[gt,mt])bt.append("line").attr("class","bin-limits-line").attr("x1",P-dt).attr("x2",P+dt).attr("y1",Ct).attr("y2",Ct).attr("stroke",$i).attr("stroke-width",1);bt.append("path").attr("class","bin-quartile").attr("fill",J).attr("d",jB(P,it,rt,ir,Og)),bt.append("line").attr("class","bin-median").attr("x1",P-ir/2+2).attr("x2",P+ir/2-2).attr("y1",lt).attr("y2",lt).attr("stroke",Eg).attr("stroke-width",Fg);for(const Ct of O.outliers??[])Number.isFinite(Ct)&&bt.append("circle").attr("class","bin-outlier").attr("cx",P).attr("cy",K(Ct)).attr("r",Pg).attr("fill","transparent").attr("stroke",$i).attr("stroke-width",1);jg(X,bt,O,p,m)}}const tt=X.append("g").attr("class","x-axis").attr("transform",`translate(0,${M})`).call(ae(et).tickSize(0).tickPadding(8));tt.select(".domain").attr("stroke",f.axisStroke),tt.selectAll("line").attr("stroke","none"),tt.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","middle"),cr(tt,{slotWidth:et.bandwidth(),...g});const j=X.append("g").attr("class","y-axis").call(Jt(K).tickValues(nt).tickSize(5).tickPadding(6).tickFormat(I=>{const V=Number(I),U=Number.isInteger(V)&&Math.abs(V)<1e3?0:2;return Pt(V,U)}));j.select(".domain").attr("stroke","none"),j.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray","1 2"),we(j,N.left)}d&&!(y&&S)&&B.append("text").attr("x",N.left+W/2).attr("y",T-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(d),h&&B.append("text").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(h)}const BB=ie`
1133
+ :host {
1134
+ display: block;
1135
+ position: relative;
1136
+ width: 100%;
1137
+ height: 100%;
1138
+ min-height: 220px;
1139
+ color: var(--ui9000-color-text, #111827);
1140
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1141
+ box-sizing: border-box;
1142
+ }
1143
+ .chart-body {
1144
+ flex: 1 1 auto;
1145
+ min-height: 240px;
1146
+ display: flex;
1147
+ flex-direction: column;
1148
+ }
1149
+ .chart-scroll {
1150
+ flex: 1 1 auto;
1151
+ min-height: 200px;
1152
+ overflow-y: auto;
1153
+ overflow-x: hidden;
1154
+ position: relative;
1155
+ }
1156
+ .chart-x-axis {
1157
+ flex-shrink: 0;
1158
+ width: 100%;
1159
+ min-height: 21px;
1160
+ overflow: hidden;
1161
+ }
1162
+ .chart-root {
1163
+ width: 100%;
1164
+ min-height: 240px;
1165
+ }
1166
+ .chart-root svg .bin-quartile {
1167
+ filter: drop-shadow(0 2px 2px rgb(3 4 4 / 6%))
1168
+ drop-shadow(0 2px 4px rgb(3 4 4 / 6%));
1169
+ }
1170
+ .tooltip {
1171
+ position: absolute;
1172
+ pointer-events: none;
1173
+ z-index: 2;
1174
+ padding: 6px 10px;
1175
+ border-radius: 6px;
1176
+ font-size: 12px;
1177
+ line-height: 1.35;
1178
+ background: var(--ui9000-color-text, #111827);
1179
+ color: #fff;
1180
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1181
+ transform: translate(-50%, calc(-100% - 10px));
1182
+ white-space: nowrap;
1183
+ }
1184
+ .tooltip .name {
1185
+ font-weight: 600;
1186
+ }
1187
+ .empty {
1188
+ display: grid;
1189
+ place-items: center;
1190
+ height: 100%;
1191
+ min-height: inherit;
1192
+ color: var(--ui9000-color-text-muted, #6b7280);
1193
+ font-size: 0.875rem;
1194
+ }
1195
+ `;function Bg(t){return Array.isArray(t)?t[0]??"":t??""}function Ce(t){return typeof t=="number"&&Number.isFinite(t)}function HB(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.label=="string"&&Ce(e.q1)&&Ce(e.median)&&Ce(e.q3)&&Ce(e.smallestNonOutlier)&&Ce(e.biggestNonOutlier)}function qB(t){if(!HB(t))return null;const e=Array.isArray(t.outliers)?t.outliers.filter(Ce):[];return{label:String(t.label),group:t.group!=null&&t.group!==""?String(t.group):void 0,color:t.color,min:Ce(t.min)?t.min:void 0,q1:t.q1,median:t.median,q3:t.q3,max:Ce(t.max)?t.max:void 0,smallestNonOutlier:t.smallestNonOutlier,biggestNonOutlier:t.biggestNonOutlier,outliers:e}}function Pk(t){const e=new Set,n=[];for(const i of t){const r=i.group??"default";e.has(r)||(e.add(r),n.push(r))}return n}function Ek(t){return t.filter(e=>e!=null&&e!==""&&e!=="null"&&e!=="undefined")}function GB(t,e,n){var i;const r=e&&((i=n==null?void 0:n[e])!=null&&i.length)?Ek(n[e].map(String)):null;if(r!=null&&r.length){const o=new Set(t.map(a=>a.group??"default"));return r.filter(a=>o.has(a))}return Pk(t)}function Fk(t,e,n){var i;const r=(i=n==null?void 0:n[e])!=null&&i.length?Ek(n[e].map(String)):null;if(r!=null&&r.length){const s=new Set(t.map(l=>l.label));return r.filter(l=>s.has(l))}const o=new Set,a=[];for(const s of t)o.has(s.label)||(o.add(s.label),a.push(s.label));return a}function Hu(t,e="vertical",n){var i,r;const o=t.map(qB).filter(l=>l!=null),a=(i=n==null?void 0:n.groups)!=null&&i.length?n.groups:Pk(o),s=(r=n==null?void 0:n.categoryLabels)!=null&&r.length?n.categoryLabels:Fk(o,"",void 0);return{orientation:e,boxes:o,groups:a,categoryLabels:s}}function VB(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return Array.isArray(e.data)}function ZB(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return Array.isArray(e.boxes)}function WB(t){const e=t.orientation==="horizontal"?"horizontal":"vertical",n=Bg(t.xAxe)||"year",i=Bg(t.groupBy),r=t.formatting,o=[];for(const s of t.data){if(!s)continue;const l=s._id??{},c=String(l[n]??"");if(!c||!Ce(s.q1)||!Ce(s.median)||!Ce(s.q3)||!Ce(s.smallestNonOutlier)||!Ce(s.biggestNonOutlier))continue;const u=i&&l[i]!=null&&String(l[i])!==""?String(l[i]):void 0;o.push({label:c,group:u,min:Ce(s.min)?s.min:void 0,q1:s.q1,median:s.median,q3:s.q3,max:Ce(s.max)?s.max:void 0,smallestNonOutlier:s.smallestNonOutlier,biggestNonOutlier:s.biggestNonOutlier,outliers:Array.isArray(s.outliers)?s.outliers.filter(Ce):[]})}const a=Hu(o,e,{categoryLabels:Fk(o,n,t.uniqueValues),groups:GB(o,i,t.uniqueValues)});if(r!=null&&r.length)for(const s of a.boxes){const l=s.group??"default";s.color=zt(r,l,a.groups.length)}return a}function Rk(t){if(!t)return{orientation:"vertical",boxes:[],groups:[],categoryLabels:[]};if(Array.isArray(t))return Hu(t);if(ZB(t)){const e=t.orientation==="horizontal"?"horizontal":"vertical";return Hu(t.boxes,e)}return VB(t)?WB(t):{orientation:"vertical",boxes:[],groups:[],categoryLabels:[]}}var KB=Object.defineProperty,YB=Object.getOwnPropertyDescriptor,Zr=(t,e,n,i)=>{for(var r=i>1?void 0:i?YB(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&KB(e,n,r),r};let qe=class extends qt{constructor(){super(...arguments),this.orientation="vertical",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._fixedXAxis=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){var e,n,i,r;if(re(t)&&this.scheduleDraw(),t.has("_fixedXAxis")){const o=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-body"),a=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-scroll");o instanceof HTMLElement&&((i=this._resizeObserver)==null||i.observe(o)),a instanceof HTMLElement&&((r=this._resizeObserver)==null||r.observe(a))}}firstUpdated(){var t,e,n,i,r,o;const a=(t=this.shadowRoot)==null?void 0:t.querySelector(".widget-body"),s=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-body"),l=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-scroll");a instanceof HTMLElement&&((i=this._resizeObserver)==null||i.observe(a)),s instanceof HTMLElement&&((r=this._resizeObserver)==null||r.observe(s)),l instanceof HTMLElement&&((o=this._resizeObserver)==null||o.observe(l))}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]),e=Rk(t);return this.orientation==="horizontal"||this.orientation==="vertical"?{...e,orientation:this.orientation}:e}draw(){var t,e,n,i,r;const o=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-body"),a=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-scroll"),s=(n=this.shadowRoot)==null?void 0:n.querySelector(".chart-root"),l=(i=this.shadowRoot)==null?void 0:i.querySelector(".chart-x-axis");if(!o||!a||!s)return;const c=this.parseData();if(this._empty=c.boxes.length===0,this._empty){s.replaceChildren(),l==null||l.replaceChildren(),this._fixedXAxis=!1;return}const u=(r=c.categoryLabels)!=null&&r.length?c.categoryLabels:[...new Set(c.boxes.map(_=>_.label))],d=c.groups.length||1,h=Ik(u.length,d),{width:p,margin:m}=aC(o),v=a.clientHeight||300,b=v-m.top,g=c.orientation==="horizontal"&&h>b+1;this._fixedXAxis=g;const $=wt(this);Ok(s,{model:c,width:p,height:v,margin:m,theme:$,orientation:this.orientation,showGrid:this.showGrid,xAxisContainer:g?l:null,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onBoxHover:this.showTooltip?({box:_,event:y})=>{const S=this.getBoundingClientRect();this._tooltip={x:y.clientX-S.left,y:y.clientY-S.top,label:_.label,group:_.group,q1:_.q1,median:_.median,q3:_.q3,min:_.smallestNonOutlier,max:_.biggestNonOutlier}}:void 0,onBoxLeave:this.showTooltip?()=>{this._tooltip=null}:void 0}),l&&!g&&l.replaceChildren()}renderLegend(t){if(!this.showLegend||t.groups.length<=1)return st;const e=wt(this);return ce(Nr(t.groups,e,(n,i)=>{const r=t.boxes.find(o=>(o.group??"default")===n);return(r==null?void 0:r.color)??tr(i)}))}render(){const t=this.headerTitle(),e=this.parseData();return ot`
1196
+ <div class="widget-shell" part="shell">
1197
+ ${this.renderShellHeader(t)}
1198
+ <div class="widget-body">
1199
+ <div class="chart-body" part="chart-body">
1200
+ ${this.renderLegend(e)}
1201
+ <div class="chart-scroll" part="scroll">
1202
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1203
+ </div>
1204
+ <div
1205
+ class="chart-x-axis"
1206
+ part="x-axis"
1207
+ ?hidden=${!this._fixedXAxis}
1208
+ ></div>
1209
+ </div>
1210
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1211
+ ${this._tooltip?ot`<div
1212
+ class="tooltip"
1213
+ part="tooltip"
1214
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1215
+ >
1216
+ <div class="name">
1217
+ ${this._tooltip.group?`${this._tooltip.group} · ${this._tooltip.label}`:this._tooltip.label}
1218
+ </div>
1219
+ <div>min: ${this._tooltip.min}</div>
1220
+ <div>25%: ${this._tooltip.q1}</div>
1221
+ <div>median: ${this._tooltip.median}</div>
1222
+ <div>75%: ${this._tooltip.q3}</div>
1223
+ <div>max: ${this._tooltip.max}</div>
1224
+ </div>`:st}
1225
+ ${this.renderShellLabelTooltip()}
1226
+ </div>
1227
+ </div>
1228
+ `}};qe.styles=[BB,ne];Zr([Y({type:String})],qe.prototype,"orientation",2);Zr([Y({type:Boolean,attribute:"show-grid"})],qe.prototype,"showGrid",2);Zr([Y({type:Boolean,attribute:"show-legend"})],qe.prototype,"showLegend",2);Zr([Y({type:Boolean,attribute:"show-tooltip"})],qe.prototype,"showTooltip",2);Zr([Y({type:String,attribute:"x-label"})],qe.prototype,"xLabel",2);Zr([Y({type:String,attribute:"y-label"})],qe.prototype,"yLabel",2);Zr([yt()],qe.prototype,"_tooltip",2);Zr([yt()],qe.prototype,"_empty",2);Zr([yt()],qe.prototype,"_fixedXAxis",2);qe=Zr([Xt("ui9000-box-plot-chart")],qe);function jk(){customElements.get("ui9000-box-plot-chart")||customElements.define("ui9000-box-plot-chart",qe)}jk();function JB(t){const e=Math.abs(t);return e>=1e9?`${(t/1e9).toFixed(1)}B`:e>=1e6?`${(t/1e6).toFixed(1)}M`:e>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?String(t):t.toFixed(1)}const XB=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000BoxPlotChart(){return qe},boxPlotChartMetadata:U_,boxPlotLinearDomain:Dk,collectLabels:Mk,collectValueExtent:Nk,formatCompact:JB,normalizeBoxPlotData:Rk,registerBoxPlotChart:jk,renderBoxPlotChart:Ok},Symbol.toStringTag,{value:"Module"}));function Uk(t){let e=1/0,n=-1/0;for(const i of t)for(const r of i.samples)Number.isFinite(r)&&(r<e&&(e=r),r>n&&(n=r));if(!Number.isFinite(e)||!Number.isFinite(n))return[0,1];if(e===n){const i=Math.abs(e)*.1||1;return[e-i,n+i]}return[e,n]}function QB(t){return t.groups.map(e=>e.id)}function qu(t){let e=1/0,n=-1/0;for(const i of t)Number.isFinite(i)&&(i<e&&(e=i),i>n&&(n=i));return!Number.isFinite(e)||!Number.isFinite(n)?null:[e,n]}function Yn(t,e){if(!(t!=null&&t.length))return 0;const n=t.slice().sort((s,l)=>s-l),i=(n.length-1)*e,r=Math.floor(i),o=Math.min(n.length-1,r+1),a=i-r;return n[r]*(1-a)+n[o]*a}function tH(t){return 1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t)}function Gu(t,e,n){const i=t.length||1;return n.map(r=>{let o=0;for(let a=0;a<t.length;a++)o+=tH((r-t[a])/e);return{x:r,y:1/(i*e)*o}})}function Vu(t,e,n){const i=t.length||1,r=t.reduce((a,s)=>a+s,0)/i,o=Math.sqrt(t.reduce((a,s)=>a+(s-r)**2,0)/i);return o>0?1.06*o*Math.pow(i,-1/5):(n-e)/20||1}function Zu(t,e,n=40){if(n<=1)return[t];const i=[];for(let r=0;r<n;r++)i.push(t+(e-t)*r/(n-1));return i}const Hg=.2,qg=.18,Bk=.25,eH="#939ba7",Gg=8,Vg=25,Zg=5;function Wg(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function Kg(t){let e=0;for(const n of t)n.y>e&&(e=n.y);return e||1}function rH(t,e,n,i,r,o){const a=Yn(e,.25),s=Yn(e,.5),l=Yn(e,.75),c=Math.min(...e),u=Math.max(...e),d=Math.min(18,i*.5);t.append("rect").attr("x",n-d/2).attr("width",d).attr("y",r(l)).attr("height",Math.max(1,r(a)-r(l))).attr("fill",o).attr("opacity",Bk).attr("stroke",o),t.append("line").attr("x1",n-d/2+2).attr("x2",n+d/2-2).attr("y1",r(s)).attr("y2",r(s)).attr("stroke",o).attr("stroke-width",1),t.append("line").attr("x1",n).attr("x2",n).attr("y1",r(u)).attr("y2",r(c)).attr("stroke",o).attr("stroke-width",1);const h=Math.min(6,d/2);t.append("line").attr("x1",n-h).attr("x2",n+h).attr("y1",r(u)).attr("y2",r(u)).attr("stroke",o).attr("stroke-width",1),t.append("line").attr("x1",n-h).attr("x2",n+h).attr("y1",r(c)).attr("y2",r(c)).attr("stroke",o).attr("stroke-width",1)}function nH(t,e,n,i,r,o){const a=Yn(e,.25),s=Yn(e,.5),l=Yn(e,.75),c=Math.min(...e),u=Math.max(...e),d=Math.min(18,i*.5);t.append("rect").attr("y",n-d/2).attr("height",d).attr("x",r(a)).attr("width",Math.max(1,r(l)-r(a))).attr("fill",o).attr("opacity",Bk).attr("stroke",o),t.append("line").attr("y1",n-d/2+2).attr("y2",n+d/2-2).attr("x1",r(s)).attr("x2",r(s)).attr("stroke",o).attr("stroke-width",1),t.append("line").attr("y1",n).attr("y2",n).attr("x1",r(c)).attr("x2",r(u)).attr("stroke",o).attr("stroke-width",1);const h=Math.min(6,d/2);t.append("line").attr("x1",r(c)).attr("x2",r(c)).attr("y1",n-h).attr("y2",n+h).attr("stroke",o).attr("stroke-width",1),t.append("line").attr("x1",r(u)).attr("x2",r(u)).attr("y1",n-h).attr("y2",n+h).attr("stroke",o).attr("stroke-width",1)}function Yg(t){t.selectAll(".y-axis .tick").append("line").attr("class","tick-line").attr("x1",-8).attr("x2",0).attr("y1",0).attr("y2",0).attr("stroke",eH).attr("stroke-width","1px")}function Hk(t,e){const{model:n,width:i,height:r,theme:o,orientation:a=n.orientation??"vertical",showGrid:s=!0,onAxisLabelHover:l,onAxisLabelLeave:c}=e,u=a==="horizontal"?f.violinHorizontalMargin:f.violinVerticalMargin,d=e.margin??{...u};if(t.replaceChildren(),!n.groups.length||i<=0||r<=0)return;const h={top:d.top,bottom:d.bottom,left:er(d.left),right:Math.max(d.right,1)},p=i-h.left-h.right,m=r-h.top-h.bottom;if(p<8||m<8)return;const v=n.groups.map(S=>S.id),[b,g]=Uk(n.groups),_=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Violin chart").style("display","block").style("font-family",o.fontFamily).append("g").attr("transform",`translate(${h.left},${h.top})`),y={onAxisLabelHover:l,onAxisLabelLeave:c};if(a==="vertical"){const S=de().domain(v).range([0,p]).padding(Hg),w=Ft().domain([b,g]).nice().range([m,0]),L=Ft().domain([0,1]).range([0,(S.bandwidth()||20)/2]);if(s){const H=Math.max(2,Math.round(m/60));_.append("g").attr("class","grid-y").selectAll("line").data(w.ticks(H)).join("line").attr("x1",0).attr("x2",p).attr("y1",F=>w(F)).attr("y2",F=>w(F)).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges"),_.append("g").attr("class","grid-x").call(ae(S).tickSize(m).tickFormat(()=>"")).call(F=>F.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1).attr("shape-rendering","crispEdges")}const N=_.append("g").attr("class","x-axis").attr("transform",`translate(0,${m})`).call(ae(S).tickSizeOuter(0).tickSize(0).tickPadding(Gg)).call(H=>H.selectAll(".domain").attr("stroke",f.axisStroke));N.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize),cr(N,{maxLength:Vg,slotWidth:S.bandwidth(),...y});const E=_.append("g").attr("class","y-axis").call(Jt(w).ticks(ge(m)).tickSize(0).tickPadding(8).tickFormat(H=>Pt(Number(H)))).call(H=>H.select(".domain").remove());we(E,h.left,{maxLength:Vg,...y}),Yg(_),n.groups.forEach((H,F)=>{const W=Wg(H,F,o),M=H.samples,z=qu(M);if(!z)return;const[T,C]=z,k=Zu(T,C,40),x=Vu(M,T,C),A=Gu(M,x,k),D=Kg(A),R=(S(H.id)||0)+S.bandwidth()/2,B=ro().x0(X=>R-L(X.y/D)).x1(X=>R+L(X.y/D)).y(X=>w(X.x)).curve(Rs.alpha(.6));_.append("path").datum(A).attr("d",B).attr("fill",W).attr("opacity",qg).attr("stroke",W).attr("stroke-width",1),rH(_,M,R,S.bandwidth(),w,W)})}else{const S=de().domain(v).range([0,m]).padding(Hg),w=Ft().domain([b,g]).nice().range([0,p]),L=Ft().domain([0,1]).range([0,(S.bandwidth()||20)/2]);if(s){const H=Math.max(2,Math.round(p/80));_.append("g").attr("class","grid-x").selectAll("line").data(w.ticks(H)).join("line").attr("x1",F=>w(F)).attr("x2",F=>w(F)).attr("y1",0).attr("y2",m).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges"),_.append("g").attr("class","grid-y").call(Jt(S).tickSize(-p).tickFormat(()=>"")).call(F=>F.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1).attr("shape-rendering","crispEdges")}const N=_.append("g").attr("class","x-axis").attr("transform",`translate(0,${m})`).call(ae(w).ticks(ge(p)).tickSizeOuter(0).tickSize(0).tickPadding(Gg).tickFormat(H=>Pt(Number(H)))).call(H=>H.selectAll(".domain").attr("stroke",f.axisStroke));N.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize),cr(N,{maxLength:Zg,...y});const E=_.append("g").attr("class","y-axis").call(Jt(S).tickSize(0).tickPadding(8)).call(H=>H.select(".domain").remove());we(E,h.left,{maxLength:Zg,slotWidth:void 0,...y}),Yg(_),n.groups.forEach((H,F)=>{const W=Wg(H,F,o),M=H.samples,z=qu(M);if(!z)return;const[T,C]=z,k=Zu(T,C,40),x=Vu(M,T,C),A=Gu(M,x,k),D=Kg(A),R=(S(H.id)||0)+S.bandwidth()/2,B=ro().y0(X=>R-L(X.y/D)).y1(X=>R+L(X.y/D)).x(X=>w(X.x)).curve(Rs.alpha(.6));_.append("path").datum(A).attr("d",B).attr("fill",W).attr("opacity",qg).attr("stroke",W).attr("stroke-width",1),nH(_,M,R,S.bandwidth(),w,W)})}}const iH=ie`
1229
+ :host {
1230
+ display: block;
1231
+ position: relative;
1232
+ width: 100%;
1233
+ height: 100%;
1234
+ min-height: 220px;
1235
+ color: var(--ui9000-color-text, #111827);
1236
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1237
+ box-sizing: border-box;
1238
+ }
1239
+ .chart-root {
1240
+ flex: 1;
1241
+ min-height: 0;
1242
+ width: 100%;
1243
+ height: 100%;
1244
+ min-height: inherit;
1245
+ }
1246
+ .empty {
1247
+ display: grid;
1248
+ place-items: center;
1249
+ height: 100%;
1250
+ min-height: inherit;
1251
+ color: var(--ui9000-color-text-muted, #6b7280);
1252
+ font-size: 0.875rem;
1253
+ }
1254
+ `,Xa={orientation:"vertical",groups:[],valueKey:"",categoryKey:""},Jg=.5;function Xg(t,e){let n=0,i=0;for(const r of e){const o=r==null?void 0:r[t];o==null||o===""||(i+=1,Number.isFinite(Number(o))&&(n+=1))}return i?n/i:0}function qk(t,e,n){const i=t||"x",r=e||"y";if(Array.isArray(n)&&n.length){const o=Xg(i,n),a=Xg(r,n);if(o<Jg&&a>=Jg)return{valueKey:r,categoryKey:i}}return{valueKey:i,categoryKey:r}}function Gk(t){return t==="horizontal"?"horizontal":"vertical"}function oH(t){return!t||typeof t!="object"||Array.isArray(t)?!1:Array.isArray(t.groups)}function aH(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.id=="string"&&Array.isArray(e.samples)}function Vk(t,e="vertical",n="value",i="group"){const r=t.map(o=>({id:String(o.id),samples:o.samples.filter(a=>Number.isFinite(a)),color:o.color})).filter(o=>o.samples.length>0);return{orientation:e,groups:r,valueKey:n,categoryKey:i}}function sH(t){const e=Gk(t.orientation),n=[];for(const r of t.groups){const o=String(r.id??r.label??"");if(!o)continue;const a=(r.samples??[]).filter(s=>Number.isFinite(Number(s))).map(Number);a.length&&n.push({id:o,samples:a,color:r.color})}const i=n.length;for(const r of n)r.color||(r.color=zt(void 0,r.id,i));return Vk(n,e)}function lH(t,e,n){const i=new Map;for(const r of t){const o=String(r[e]??"");if(!o||o==="null"||o==="undefined")continue;const a=Number(r[n]);if(!Number.isFinite(a))continue;let s=i.get(o);s||(s=[],i.set(o,s)),s.push(a)}return i}function cH(t){const e=t,n=se(e),i=Gk(t.orientation!=null?String(t.orientation):void 0),{valueKey:r,categoryKey:o}=qk(ft(t.xAxe??void 0),ft(t.yAxe??void 0),n),a=lH(n,o,r),s=me(a.keys(),t.uniqueValues??void 0,o),l=pi(e),c=[];for(const u of s){const d=a.get(u);d!=null&&d.length&&c.push({id:u,samples:d,color:zt(l,u,s.length)})}return{orientation:i,groups:c,valueKey:r,categoryKey:o}}function Zk(t){return t?Array.isArray(t)?t.length?aH(t[0])?Vk(t):{...Xa}:{...Xa}:oH(t)?sH(t):Ht(t)&&Array.isArray(t.data)?cH(t):{...Xa}:{...Xa}}var uH=Object.defineProperty,dH=Object.getOwnPropertyDescriptor,zn=(t,e,n,i)=>{for(var r=i>1?void 0:i?dH(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&uH(e,n,r),r};let dr=class extends qt{constructor(){super(...arguments),this.orientation="vertical",this.showGrid=!0,this.showLegend=!1,this.showTooltip=!1,this.xLabel="",this.yLabel="",this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}firstUpdated(){var t,e;const n=(t=this.shadowRoot)==null?void 0:t.querySelector(".widget-body");n instanceof HTMLElement&&((e=this._resizeObserver)==null||e.observe(n))}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]),e=Zk(t);return this.orientation==="horizontal"||this.orientation==="vertical"?{...e,orientation:this.orientation}:e}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.groups.length===0,this._empty){e.replaceChildren();return}const i=wt(this),r=this.orientation,{width:o,height:a,margin:s}=sC(e,r);Hk(e,{model:n,width:o,height:a,margin:s,theme:i,orientation:r,showGrid:this.showGrid,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers()})}render(){const t=this.headerTitle();return ot`
1255
+ <div class="widget-shell" part="shell">
1256
+ ${this.renderShellHeader(t)}
1257
+ <div class="widget-body">
1258
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1259
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1260
+ ${this.renderShellLabelTooltip()}
1261
+ </div>
1262
+ </div>
1263
+ `}};dr.styles=[iH,ne];zn([Y({type:String})],dr.prototype,"orientation",2);zn([Y({type:Boolean,attribute:"show-grid"})],dr.prototype,"showGrid",2);zn([Y({type:Boolean,attribute:"show-legend"})],dr.prototype,"showLegend",2);zn([Y({type:Boolean,attribute:"show-tooltip"})],dr.prototype,"showTooltip",2);zn([Y({type:String,attribute:"x-label"})],dr.prototype,"xLabel",2);zn([Y({type:String,attribute:"y-label"})],dr.prototype,"yLabel",2);zn([yt()],dr.prototype,"_empty",2);dr=zn([Xt("ui9000-violin-chart")],dr);function Wk(){customElements.get("ui9000-violin-chart")||customElements.define("ui9000-violin-chart",dr)}Wk();function hH(t){return Pt(t)}const pH=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000ViolinChart(){return dr},collectGroupIds:QB,collectValueExtent:Uk,densityGrid:Zu,formatCompact:hH,kde:Gu,normalizeViolinData:Zk,quantile:Yn,registerViolinChart:Wk,renderViolinChart:Hk,resolveViolinAxes:qk,sampleExtent:qu,silvermanBandwidth:Vu,violinChartMetadata:c$},Symbol.toStringTag,{value:"Module"}));function Kk(t){if(!t.length)return[0,0];let e=1/0,n=-1/0;for(const i of t)e=Math.min(e,i.start,i.end),n=Math.max(n,i.start,i.end);return!Number.isFinite(e)||!Number.isFinite(n)?[0,0]:[e,n]}function fH(t){return t.steps.map(e=>e.label)}function Yk(t,e=1.2){const[n,i]=Kk(t),r=Math.min(0,n)*(n<0?e:1),o=Math.max(0,i)*(i>0?e:1);return[r,o]}function mH(t){return Pt(t)}function Wu(t,e){const n=Pt(t);return e==="positive"?`+${n}`:n}const gH=7,yH=9;function vH(t,e){if(t.length<=e)return t;const n=Math.ceil(t.length/e),i=[];for(let o=0;o<t.length;o+=n)i.push(t[o]);const r=t[t.length-1];return i[i.length-1]!==r&&i.push(r),i}function Qg(t){return`${t}-${Math.random().toString(36).slice(2,9)}`}function bH(t,e,n,i,r,o,a){const s=i-n,l=o,c=0;return Math.abs(s)<=l*2?`M ${e} ${n}
1264
+ h ${r}
1265
+ v ${s}
1266
+ h -${r}
1267
+ Z`:t.index===0||Math.abs(s)<a+2*l?`M ${e} ${n-1-l}
1268
+ a ${l} ${l} 0 0 0 ${l} ${l}
1269
+ h ${r-2*l}
1270
+ a ${l} ${l} 0 0 0 ${l} -${l}
1271
+ v ${s+2+2*l}
1272
+ a ${l} ${l} 0 0 0 -${l} -${l}
1273
+ h -${r-2*l}
1274
+ a ${l} ${l} 0 0 0 -${l} ${l}
1275
+ Z`:t.vector==="positive"?`M ${e} ${n-1-l}
1276
+ a ${l} ${l} 0 0 0 ${l} ${l}
1277
+ h ${r-2*l}
1278
+ a ${l} ${l} 0 0 0 ${l} -${l}
1279
+ v ${s+2+2*l+a}
1280
+ a ${c} ${c} 0 0 0 -${l} -${l}
1281
+ l -${r/2-l} -${a}
1282
+ l -${r/2-l} ${a}
1283
+ a ${c} ${c} 0 0 0 -${l} ${l}
1284
+ Z`:`M ${e} ${n-1-l-a}
1285
+ a ${c} ${c} 0 0 0 ${l} ${l}
1286
+ l ${r/2-l} ${a}
1287
+ l ${r/2-l} -${a}
1288
+ a ${c} ${c} 0 0 0 ${l} -${l}
1289
+ v ${s+2+2*l+a}
1290
+ a ${l} ${l} 0 0 0 -${l} -${l}
1291
+ h -${r-2*l}
1292
+ a ${l} ${l} 0 0 0 -${l} ${l}
1293
+ Z`}function xH(t,e,n,i,r,o,a){const s=i-n,l=o,c=0;return Math.abs(s)<=l*2?`M ${n} ${e}
1294
+ h ${s}
1295
+ v ${r}
1296
+ h -${s}
1297
+ Z`:t.index===0||Math.abs(s)<a+2*l+2?`M ${n+1+l} ${e}
1298
+ h ${s-2*l-2}
1299
+ a ${l} ${l} 0 0 1 ${l} ${l}
1300
+ v ${r-2*l}
1301
+ a ${l} ${l} 0 0 1 -${l} ${l}
1302
+ h -${s-2*l-2}
1303
+ a ${l} ${l} 0 0 1 -${l} -${l}
1304
+ v -${r-2*l}
1305
+ a ${l} ${l} 0 0 1 ${l} -${l}
1306
+ Z`:t.vector==="positive"?`M ${n+1+l} ${e}
1307
+ h ${s-2*l-2-a}
1308
+ a ${c} ${c} 0 0 1 ${l} ${l}
1309
+ l ${a} ${r/2-l}
1310
+ l -${a} ${r/2-l}
1311
+ a ${c} ${c} 0 0 1 -${l} ${l}
1312
+ h -${s-2*l-2-a}
1313
+ a ${l} ${l} 0 0 1 -${l} -${l}
1314
+ v -${r-2*l}
1315
+ a ${l} ${l} 0 0 1 ${l} -${l}
1316
+ Z`:`M ${n+1+l+a} ${e}
1317
+ h ${s-2*l-2-a}
1318
+ a ${l} ${l} 0 0 1 ${l} ${l}
1319
+ v ${r-2*l}
1320
+ a ${l} ${l} 0 0 1 -${l} ${l}
1321
+ h -${s-2*l-2-a}
1322
+ a ${c} ${c} 0 0 1 -${l} -${l}
1323
+ l -${a} -${r/2-l}
1324
+ l ${a} -${r/2-l}
1325
+ a ${c} ${c} 0 0 1 ${l} -${l}
1326
+ Z`}function wi(t,e){var n;return t.kind==="total"&&t.index>0?((n=e[t.index-1])==null?void 0:n.level)??t.level:t.start}function Jk(t,e){const{model:n,width:i,height:r,theme:o,orientation:a=n.orientation,showGrid:s=!0,onStepHover:l,onStepLeave:c,onAxisLabelHover:u,onAxisLabelLeave:d}=e;t.replaceChildren();const h=n.steps;if(!h.length||i<=0||r<=0)return;const p=a==="vertical",m=f.waterfallBarThickness,v=f.waterfallBarRadius,b=f.waterfallArrow,g=f.waterfallHoverDim,{positive:$,negative:_,total:y}=n.colors,S=h.map(O=>O.label),w=h[h.length-1];let L=e.margin?{...e.margin}:{...p?f.waterfallVerticalMargin:f.waterfallHorizontalMargin};if(!p){const O=S.reduce((rt,it)=>Math.max(rt,it.length),0),J=8+h.reduce((rt,it)=>{const lt=(it.vector==="positive"&&it.index!==0?"+":"")+Pt(it.difference);return Math.max(rt,lt.length)},0)*6;L={...L,left:Math.max(40,Math.min(70,O*7+10)+J)}}const N=p?L.left:er(L.left),E={top:L.top,right:L.right,bottom:L.bottom,left:N},H=i-E.left-E.right,F=r-E.top-E.bottom;if(H<=0||F<=0)return;const W=ht(t).append("svg").attr("width","100%").attr("height","100%").attr("viewBox",`0 0 ${i} ${r}`).attr("preserveAspectRatio","xMidYMid meet").attr("text-anchor","middle"),M=Qg("wf-pos"),z=Qg("wf-neg"),T=W.append("defs");p?(T.append("linearGradient").attr("id",M).attr("x1","0%").attr("y1","100%").attr("x2","0%").attr("y2","0%").selectAll("stop").data([{offset:"0%",color:$,opacity:.3},{offset:"100%",color:$,opacity:1}]).enter().append("stop").attr("offset",O=>O.offset).attr("stop-color",O=>O.color).attr("stop-opacity",O=>O.opacity),T.append("linearGradient").attr("id",z).attr("x1","0%").attr("y1","100%").attr("x2","0%").attr("y2","0%").selectAll("stop").data([{offset:"0%",color:_,opacity:1},{offset:"100%",color:_,opacity:.3}]).enter().append("stop").attr("offset",O=>O.offset).attr("stop-color",O=>O.color).attr("stop-opacity",O=>O.opacity)):(T.append("linearGradient").attr("id",M).attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%").selectAll("stop").data([{offset:"0%",color:$,opacity:.3},{offset:"100%",color:$,opacity:1}]).enter().append("stop").attr("offset",O=>O.offset).attr("stop-color",O=>O.color).attr("stop-opacity",O=>O.opacity),T.append("linearGradient").attr("id",z).attr("x1","100%").attr("y1","0%").attr("x2","0%").attr("y2","0%").selectAll("stop").data([{offset:"0%",color:_,opacity:.3},{offset:"100%",color:_,opacity:1}]).enter().append("stop").attr("offset",O=>O.offset).attr("stop-color",O=>O.color).attr("stop-opacity",O=>O.opacity));const C=W.append("g").attr("transform",`translate(${E.left},${E.top})`),[k,x]=Yk(h,f.waterfallDomainPadFactor),A=ge(F),D=O=>O.index===0?y:O.vector==="negative"?`url(#${z})`:`url(#${M})`,R={onAxisLabelHover:u,onAxisLabelLeave:d};if(p){const O=de().domain(S).rangeRound([0,H]).padding(0),P=Ft().domain([k,x]).rangeRound([F,0]).nice();s&&(C.append("g").attr("class","y-grid").call(Jt(P).ticks(A).tickSize(-H).tickFormat(()=>"")).call(dt=>dt.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width","1px"),C.append("g").attr("class","x-grid").call(ae(O).tickSize(F).tickFormat(()=>"")).call(dt=>dt.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width","1px").attr("transform",`translate(${O.bandwidth()/2}, 0)`));const J=C.append("g").attr("class","y-axis").call(Jt(P).ticks(A).tickSize(0).tickPadding(8).tickFormat(dt=>Pt(dt))).call(dt=>dt.select(".domain").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash));J.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).attr("text-anchor","start").attr("dx",`-${E.left-12}px`),J.selectAll(".tick").append("line").attr("class","tick-line").attr("x1",-8).attr("x2",0).attr("y1",0).attr("y2",0).attr("stroke",f.axisStroke).attr("stroke-width","1px");const rt=C.append("g").attr("class","x-axis").attr("transform",`translate(0,${F})`).call(ae(O).tickSizeOuter(0).tickSize(0).tickPadding(12)).call(dt=>dt.select(".domain").attr("stroke",f.axisStroke));cr(rt,{maxLength:10,...R}),rt.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize);const it=C.append("g").selectAll("g").data(h).join("g").attr("class","bar-container");it.append("path").attr("class","bar-path").attr("fill",dt=>D(dt)).attr("d",dt=>{const Ct=(O(dt.label)??0)+(O.bandwidth()-m)/2,ut=dt.start<dt.end?P(dt.start):P(dt.end),kt=dt.start>dt.end?P(dt.start):P(dt.end);return bH(dt,Ct,ut,kt,m,v,b)}).style("cursor",l?"pointer":"default").on("mouseenter",function(dt,Ct){l&&(C.selectAll(".bar-path").attr("opacity",g),ht(this).attr("opacity",1),l({step:Ct,event:dt}))}).on("mousemove",(dt,Ct)=>{l==null||l({step:Ct,event:dt})}).on("mouseleave",()=>{C.selectAll(".bar-path").attr("opacity",1),c==null||c()}),it.filter(dt=>dt.index!==0).append("line").attr("class","bar-connector-line").attr("stroke",o.text).attr("stroke-width","1px").attr("x1",dt=>(O(dt.label)??0)-(O.bandwidth()+m)/2-2).attr("x2",dt=>(O(dt.label)??0)+(O.bandwidth()+m)/2+2).attr("y1",dt=>P(wi(dt,h))).attr("y2",dt=>P(wi(dt,h))),w&&it.filter(dt=>dt.index===0).append("line").attr("class","bar-connector-line").attr("stroke",o.text).attr("stroke-width","1px").attr("x1",(O(w.label)??0)+(O.bandwidth()-m)/2-2).attr("x2",(O(w.label)??0)+O.bandwidth()).attr("y1",P(w.end)).attr("y2",P(w.end));const lt=10,gt=F-10,mt=10,bt=26;it.filter(dt=>dt.index!==0).append("text").attr("class","bar-difference-text").attr("x",dt=>(O(dt.label)??0)+O.bandwidth()/2).attr("y",dt=>{const Ct=dt.vector==="positive"?P(dt.end)-mt:P(dt.end)+bt;return Math.max(lt,Math.min(gt,Ct))}).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("fill",f.axisLabelFill).attr("font-size","10px").attr("pointer-events","none").text(dt=>Wu(dt.difference,dt.vector)),it.filter(dt=>dt.index===0).append("text").attr("class","bar-difference-text").attr("x",dt=>(O(dt.label)??0)+O.bandwidth()/2).attr("y",dt=>{const Ct=P(dt.start)-(P(dt.start)-P(dt.end))-10;return Math.max(lt,Math.min(gt,Ct))}).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("fill",f.axisLabelFill).attr("font-size","10px").attr("pointer-events","none").text(dt=>Pt(dt.difference));return}const B=Ft().domain([k,x]).rangeRound([0,H]).nice(),X=de().domain(S).rangeRound([F,0]).padding(0),et=vH(S,gH);if(s){const O=Jt(X).tickSize(-H).tickFormat(()=>"");O.tickValues(et),C.append("g").attr("class","y-grid").call(O).call(P=>P.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width","1px").attr("transform",`translate(0, -${X.bandwidth()/2})`),C.append("g").attr("class","x-grid").call(ae(B).ticks(A).tickSize(F).tickFormat(()=>"")).call(P=>P.select(".domain").remove()).selectAll("line").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("stroke-width","1px")}const K=Jt(X).tickSizeOuter(0).tickSize(0).tickPadding(12);K.tickValues(et);const at=C.append("g").attr("class","y-axis").call(K).call(O=>O.select(".domain").attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash));we(at,E.left,{maxLength:yH,...R});const tt=C.append("g").attr("class","x-axis").attr("transform",`translate(0,${F})`).call(ae(B).ticks(A).tickSize(0).tickPadding(8).tickFormat(O=>Pt(O))).call(O=>O.select(".domain").attr("stroke",f.axisStroke)).selectAll("text");tt.attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize);const j=tt.nodes().at(-1);j&&ht(j).attr("dx",-5);const I=C.append("g").selectAll("g").data(h).join("g").attr("class","bar-container");I.append("path").attr("class","bar-path").attr("fill",O=>D(O)).attr("d",O=>{const P=(X(O.label)??0)+(X.bandwidth()-m)/2,J=(O.start<O.end?B(O.start):B(O.end))||0,rt=(O.start>O.end?B(O.start):B(O.end))||0;return xH(O,P,J,rt,m,v,b)}).style("cursor",l?"pointer":"default").on("mouseenter",function(O,P){l&&(C.selectAll(".bar-path").attr("opacity",g),ht(this).attr("opacity",1),l({step:P,event:O}))}).on("mousemove",(O,P)=>{l==null||l({step:P,event:O})}).on("mouseleave",()=>{C.selectAll(".bar-path").attr("opacity",1),c==null||c()}),I.filter(O=>O.index!==0).append("line").attr("class","bar-connector-line").attr("stroke",o.text).attr("stroke-width","1px").attr("x1",O=>B(wi(O,h))).attr("x2",O=>B(wi(O,h))).attr("y1",O=>(X(O.label)??0)+(X.bandwidth()-m)/2-2).attr("y2",O=>(X(O.label)??0)+X.bandwidth()+(X.bandwidth()+m)/2+2),w&&I.filter(O=>O.index===0).append("line").attr("class","bar-connector-line").attr("stroke",o.text).attr("stroke-width","1px").attr("x1",B(w.end)).attr("x2",B(w.end)).attr("y1",X(w.label)??0).attr("y2",(X(w.label)??0)+(X.bandwidth()+m)/2+2);const V=8,U=8;I.filter(O=>O.index!==0).append("text").attr("class","bar-difference-text").attr("x",O=>O.vector==="positive"?B(wi(O,h))-V:B(wi(O,h))+U).attr("y",O=>(X(O.label)??0)+X.bandwidth()/2).attr("text-anchor",O=>O.vector==="positive"?"end":"start").attr("dominant-baseline","middle").attr("fill",f.axisLabelFill).attr("font-size","10px").attr("pointer-events","none").text(O=>Wu(O.difference,O.vector)),I.filter(O=>O.index===0).append("text").attr("class","bar-difference-text").attr("x",O=>B(O.start)-(B(O.start)-B(O.end))+20).attr("y",O=>(X(O.label)??0)+X.bandwidth()/2).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("fill",f.axisLabelFill).attr("font-size","10px").attr("pointer-events","none").text(O=>Pt(O.difference))}const _H=ie`
1327
+ :host {
1328
+ display: block;
1329
+ position: relative;
1330
+ width: 100%;
1331
+ height: 100%;
1332
+ min-height: 220px;
1333
+ color: var(--ui9000-color-text, #111827);
1334
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1335
+ box-sizing: border-box;
1336
+ }
1337
+ .chart-root {
1338
+ flex: 1;
1339
+ min-height: 0;
1340
+ width: 100%;
1341
+ height: 100%;
1342
+ min-height: inherit;
1343
+ }
1344
+ .tooltip {
1345
+ position: absolute;
1346
+ pointer-events: none;
1347
+ z-index: 2;
1348
+ padding: 6px 10px;
1349
+ border-radius: 6px;
1350
+ font-size: 12px;
1351
+ line-height: 1.35;
1352
+ background: var(--ui9000-color-text, #111827);
1353
+ color: #fff;
1354
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1355
+ transform: translate(-50%, calc(-100% - 10px));
1356
+ white-space: nowrap;
1357
+ }
1358
+ .tooltip .name {
1359
+ font-weight: 600;
1360
+ }
1361
+ .empty {
1362
+ display: grid;
1363
+ place-items: center;
1364
+ height: 100%;
1365
+ min-height: inherit;
1366
+ color: var(--ui9000-color-text-muted, #6b7280);
1367
+ font-size: 0.875rem;
1368
+ }
1369
+ `;function Eo(t,e=!1){const n={positive:f.waterfallPositive,negative:f.waterfallNegative,total:f.waterfallTotal};if(e)return n;const i=(r,o)=>{var a;const s=(a=t==null?void 0:t.find(l=>String(l.key)===r))==null?void 0:a.color;return typeof s=="string"&&/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(s)?s:o};return{positive:i("positive",n.positive),negative:i("negative",n.negative),total:i("total",n.total)}}const Qa={steps:[],orientation:"horizontal",colors:Eo(void 0,!0),sourcePath:"client-levels"};function $H(t){return t>=0?"positive":"negative"}function wH(t,e){return e?"total":t==="positive"?"increase":"decrease"}function kH(t){return"isTotal"in t||"isPositive"in t||"isNegative"in t}function Bs(t,e){const n=[];let i=0;for(let r=0;r<t.length;r++){const{label:o,level:a,kind:s}=t[r],l=s==="total"||r===0&&s==null;let c,u;e.totalsFromZero&&s==="total"||r===0?(c=0,u=a):(c=i,u=a);const d=u-c,h=$H(d),p=s??wH(h,l&&r===0);n.push({label:o,start:c,end:u,difference:d,vector:h,kind:p,level:a,index:r}),i=a}return n}function SH(t){let e=0;return t.map(n=>n.kind==="total"?(e=n.value,{label:n.label,level:e,kind:"total"}):(e+=n.value,{label:n.label,level:e,kind:n.kind}))}function AH(t,e){return t.isTotal===!0?"total":t.isPositive===!0?"increase":t.isNegative===!0?"decrease":e>=0?"increase":"decrease"}function zH(t){let e=0;return t.map(n=>{const i=Number(n.value),r=n.kind??(i>=0?"increase":"decrease");return r==="total"?(e=i,{label:String(n.label),level:e,kind:r}):(e+=i,{label:String(n.label),level:e,kind:r})})}function Xk(t,e="horizontal"){return t==="vertical"?"vertical":t==="horizontal"?"horizontal":e}function Hs(t,e,n,i){return{steps:t,orientation:e,colors:n,sourcePath:i}}function TH(t,e,n){const i=t.map(r=>({label:String(r.label),level:Number(r.value)})).filter(r=>r.label!==""&&Number.isFinite(r.level));return Hs(Bs(i,{totalsFromZero:!1}),e,n,"label-value")}function ty(t,e){const n=(t.steps??[]).filter(r=>r&&Number.isFinite(Number(r.value))&&r.label!=null),i=zH(n);return Hs(Bs(i,{totalsFromZero:!0}),Xk(t.orientation),e,"steps-payload")}function LH(t){const e=se(t),n=ft(t.xAxe)??"category",i=ft(t.yAxe)??"value",r=Xk(t.orientation,"horizontal"),o=Eo(t.formatting??void 0,!0),a=e.some(kH),s=me(e.map(u=>String(u[n]??"")),t.uniqueValues,n),l=s.length>0?s.map(u=>e.find(d=>String(d[n]??"")===u)).filter(u=>u!=null):e;if(a){const u=l.map(h=>{const p=String(h[n]??""),m=Number(h[i]);return!p||!Number.isFinite(m)?null:{label:p,value:m,kind:AH(h,m)}}).filter(h=>h!=null),d=SH(u);return Hs(Bs(d,{totalsFromZero:!0}),r,o,"delta-flags")}const c=l.map(u=>{const d=String(u[n]??""),h=Number(u[i]);return!d||!Number.isFinite(h)?null:{label:d,level:h}}).filter(u=>u!=null);return Hs(Bs(c,{totalsFromZero:!1}),r,o,"client-levels")}function CH(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)&&Array.isArray(t.steps)}function IH(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!=null&&typeof e=="object"&&"label"in e&&"value"in e&&!("kind"in e&&"isTotal"in e)}function MH(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!=null&&typeof e=="object"&&"label"in e&&"value"in e&&"kind"in e}function Qk(t){return t?Array.isArray(t)?t.length===0?{...Qa}:MH(t)?ty({steps:t},Eo(void 0)):IH(t)?TH(t,"horizontal",Eo(void 0)):{...Qa}:CH(t)?ty(t,Eo(void 0)):Ht(t)?LH(t):{...Qa}:{...Qa}}var NH=Object.defineProperty,DH=Object.getOwnPropertyDescriptor,dn=(t,e,n,i)=>{for(var r=i>1?void 0:i?DH(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&NH(e,n,r),r};let Je=class extends qt{constructor(){super(...arguments),this.orientation="horizontal",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.xLabel="",this.yLabel="",this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}firstUpdated(){var t,e;const n=(t=this.shadowRoot)==null?void 0:t.querySelector(".widget-body");n instanceof HTMLElement&&((e=this._resizeObserver)==null||e.observe(n))}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]),e=Qk(t);return this.orientation==="horizontal"||this.orientation==="vertical"?{...e,orientation:this.orientation}:e}renderLegend(t){if(!this.showLegend||t.steps.length===0)return st;const e=wt(this),n=["positive","negative"],i=[t.colors.positive,t.colors.negative];return ce(Nr(n,e,(r,o)=>i[o]))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.steps.length===0,this._empty){e.replaceChildren();return}const i=wt(this),r=this.orientation,{width:o,height:a,margin:s}=uC(e,r);Jk(e,{model:n,width:o,height:a,margin:s,theme:i,orientation:r,showGrid:this.showGrid,xLabel:this.xLabel||void 0,yLabel:this.yLabel||void 0,...this.axisLabelHandlers(),onStepHover:this.showTooltip?({step:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,label:l.label,start:l.start,end:l.end,difference:l.difference,vector:l.vector}}:void 0,onStepLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this.parseData();return ot`
1370
+ <div class="widget-shell" part="shell">
1371
+ ${this.renderShellHeader(t)}
1372
+ <div class="widget-body">
1373
+ ${this.renderLegend(e)}
1374
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1375
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1376
+ ${this._tooltip?ot`<div
1377
+ class="tooltip"
1378
+ part="tooltip"
1379
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1380
+ >
1381
+ <div class="name">${this._tooltip.label}</div>
1382
+ <div>Start: ${this._tooltip.start}</div>
1383
+ <div>End: ${this._tooltip.end}</div>
1384
+ <div>Difference: ${this._tooltip.difference}</div>
1385
+ <div>Vector: ${this._tooltip.vector}</div>
1386
+ </div>`:st}
1387
+ ${this.renderShellLabelTooltip()}
1388
+ </div>
1389
+ </div>
1390
+ `}};Je.styles=[_H,ne];dn([Y({type:String})],Je.prototype,"orientation",2);dn([Y({type:Boolean,attribute:"show-grid"})],Je.prototype,"showGrid",2);dn([Y({type:Boolean,attribute:"show-legend"})],Je.prototype,"showLegend",2);dn([Y({type:Boolean,attribute:"show-tooltip"})],Je.prototype,"showTooltip",2);dn([Y({type:String,attribute:"x-label"})],Je.prototype,"xLabel",2);dn([Y({type:String,attribute:"y-label"})],Je.prototype,"yLabel",2);dn([yt()],Je.prototype,"_tooltip",2);dn([yt()],Je.prototype,"_empty",2);Je=dn([Xt("ui9000-waterfall-chart")],Je);function t1(){customElements.get("ui9000-waterfall-chart")||customElements.define("ui9000-waterfall-chart",Je)}t1();const OH=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000WaterfallChart(){return Je},collectLabels:fH,collectValueExtent:Kk,formatCompact:mH,formatSignedDiff:Wu,normalizeWaterfallData:Qk,registerWaterfallChart:t1,renderWaterfallChart:Jk,waterfallChartMetadata:u$,waterfallLinearDomain:Yk},Symbol.toStringTag,{value:"Module"}));function ey(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function PH(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}return n}function eu(t,e){let n=0;if(e===void 0)for(let i of t)(i=+i)&&(n+=i);else{let i=-1;for(let r of t)(r=+e(r,++i,t))&&(n+=r)}return n}function EH(t,e){return t.sourceLinks.length?t.depth:e-1}function ts(t){return function(){return t}}function ry(t,e){return qs(t.source,e.source)||t.index-e.index}function ny(t,e){return qs(t.target,e.target)||t.index-e.index}function qs(t,e){return t.y0-e.y0}function ru(t){return t.value}function FH(t){return t.index}function RH(t){return t.nodes}function jH(t){return t.links}function iy(t,e){const n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function oy({nodes:t}){for(const e of t){let n=e.y0,i=n;for(const r of e.sourceLinks)r.y0=n+r.width/2,n+=r.width;for(const r of e.targetLinks)r.y1=i+r.width/2,i+=r.width}}function UH(){let t=0,e=0,n=1,i=1,r=24,o=8,a,s=FH,l=EH,c,u,d=RH,h=jH,p=6;function m(){const T={nodes:d.apply(null,arguments),links:h.apply(null,arguments)};return v(T),b(T),g(T),$(T),S(T),oy(T),T}m.update=function(T){return oy(T),T},m.nodeId=function(T){return arguments.length?(s=typeof T=="function"?T:ts(T),m):s},m.nodeAlign=function(T){return arguments.length?(l=typeof T=="function"?T:ts(T),m):l},m.nodeSort=function(T){return arguments.length?(c=T,m):c},m.nodeWidth=function(T){return arguments.length?(r=+T,m):r},m.nodePadding=function(T){return arguments.length?(o=a=+T,m):o},m.nodes=function(T){return arguments.length?(d=typeof T=="function"?T:ts(T),m):d},m.links=function(T){return arguments.length?(h=typeof T=="function"?T:ts(T),m):h},m.linkSort=function(T){return arguments.length?(u=T,m):u},m.size=function(T){return arguments.length?(t=e=0,n=+T[0],i=+T[1],m):[n-t,i-e]},m.extent=function(T){return arguments.length?(t=+T[0][0],n=+T[1][0],e=+T[0][1],i=+T[1][1],m):[[t,e],[n,i]]},m.iterations=function(T){return arguments.length?(p=+T,m):p};function v({nodes:T,links:C}){for(const[x,A]of T.entries())A.index=x,A.sourceLinks=[],A.targetLinks=[];const k=new Map(T.map((x,A)=>[s(x,A,T),x]));for(const[x,A]of C.entries()){A.index=x;let{source:D,target:R}=A;typeof D!="object"&&(D=A.source=iy(k,D)),typeof R!="object"&&(R=A.target=iy(k,R)),D.sourceLinks.push(A),R.targetLinks.push(A)}if(u!=null)for(const{sourceLinks:x,targetLinks:A}of T)x.sort(u),A.sort(u)}function b({nodes:T}){for(const C of T)C.value=C.fixedValue===void 0?Math.max(eu(C.sourceLinks,ru),eu(C.targetLinks,ru)):C.fixedValue}function g({nodes:T}){const C=T.length;let k=new Set(T),x=new Set,A=0;for(;k.size;){for(const D of k){D.depth=A;for(const{target:R}of D.sourceLinks)x.add(R)}if(++A>C)throw new Error("circular link");k=x,x=new Set}}function $({nodes:T}){const C=T.length;let k=new Set(T),x=new Set,A=0;for(;k.size;){for(const D of k){D.height=A;for(const{source:R}of D.targetLinks)x.add(R)}if(++A>C)throw new Error("circular link");k=x,x=new Set}}function _({nodes:T}){const C=ey(T,A=>A.depth)+1,k=(n-t-r)/(C-1),x=new Array(C);for(const A of T){const D=Math.max(0,Math.min(C-1,Math.floor(l.call(null,A,C))));A.layer=D,A.x0=t+D*k,A.x1=A.x0+r,x[D]?x[D].push(A):x[D]=[A]}if(c)for(const A of x)A.sort(c);return x}function y(T){const C=PH(T,k=>(i-e-(k.length-1)*a)/eu(k,ru));for(const k of T){let x=e;for(const A of k){A.y0=x,A.y1=x+A.value*C,x=A.y1+a;for(const D of A.sourceLinks)D.width=D.value*C}x=(i-x+a)/(k.length+1);for(let A=0;A<k.length;++A){const D=k[A];D.y0+=x*(A+1),D.y1+=x*(A+1)}W(k)}}function S(T){const C=_(T);a=Math.min(o,(i-e)/(ey(C,k=>k.length)-1)),y(C);for(let k=0;k<p;++k){const x=Math.pow(.99,k),A=Math.max(1-x,(k+1)/p);L(C,x,A),w(C,x,A)}}function w(T,C,k){for(let x=1,A=T.length;x<A;++x){const D=T[x];for(const R of D){let B=0,X=0;for(const{source:K,value:at}of R.targetLinks){let nt=at*(R.layer-K.layer);B+=M(K,R)*nt,X+=nt}if(!(X>0))continue;let et=(B/X-R.y0)*C;R.y0+=et,R.y1+=et,F(R)}c===void 0&&D.sort(qs),N(D,k)}}function L(T,C,k){for(let x=T.length,A=x-2;A>=0;--A){const D=T[A];for(const R of D){let B=0,X=0;for(const{target:K,value:at}of R.sourceLinks){let nt=at*(K.layer-R.layer);B+=z(R,K)*nt,X+=nt}if(!(X>0))continue;let et=(B/X-R.y0)*C;R.y0+=et,R.y1+=et,F(R)}c===void 0&&D.sort(qs),N(D,k)}}function N(T,C){const k=T.length>>1,x=T[k];H(T,x.y0-a,k-1,C),E(T,x.y1+a,k+1,C),H(T,i,T.length-1,C),E(T,e,0,C)}function E(T,C,k,x){for(;k<T.length;++k){const A=T[k],D=(C-A.y0)*x;D>1e-6&&(A.y0+=D,A.y1+=D),C=A.y1+a}}function H(T,C,k,x){for(;k>=0;--k){const A=T[k],D=(A.y1-C)*x;D>1e-6&&(A.y0-=D,A.y1-=D),C=A.y0-a}}function F({sourceLinks:T,targetLinks:C}){if(u===void 0){for(const{source:{sourceLinks:k}}of C)k.sort(ny);for(const{target:{targetLinks:k}}of T)k.sort(ry)}}function W(T){if(u===void 0)for(const{sourceLinks:C,targetLinks:k}of T)C.sort(ny),k.sort(ry)}function M(T,C){let k=T.y0-(T.sourceLinks.length-1)*a/2;for(const{target:x,width:A}of T.sourceLinks){if(x===C)break;k+=A+a}for(const{source:x,width:A}of C.targetLinks){if(x===T)break;k-=A}return k}function z(T,C){let k=C.y0-(C.targetLinks.length-1)*a/2;for(const{source:x,width:A}of C.targetLinks){if(x===T)break;k+=A+a}for(const{target:x,width:A}of T.sourceLinks){if(x===C)break;k-=A}return k}return m}function bf(t,e=7){const n=t.filter(r=>Number.isFinite(r)).slice().sort((r,o)=>r-o);if(!n.length||e<2)return[];const i=[];for(let r=0;r<e;r++){const o=r/(e-1)*(n.length-1),a=Math.max(0,Math.floor(o)),s=Math.min(n.length-1,Math.ceil(o)),l=o-a;i.push(n[a]*(1-l)+n[s]*l)}return i}function e1(t,e){if(!e.length)return[];const n=[...new Set(t.filter(r=>Number.isFinite(r)))],i=bf(n,e.length);return i.map((r,o)=>({color:e[o],start:Math.trunc(r),end:Math.trunc(o===i.length-1?r*3:i[o+1])}))}function r1(t,e,n){return t.length?(t.find(r=>r.start<=e&&r.end>=e)??t[t.length-1]).color:n}function n1(t){return Number.isFinite(t)?Intl.NumberFormat("en-US",{maximumFractionDigits:3}).format(t):""}function io(t){return t?Number.isNaN(Number(t))?t.replace(/[_-]/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):t:""}function i1(t,e){if(!e)return t;const{measure_unit_type:n,measure_unit_symbol:i,measure_unit:r}=e;if(n==="currency")return`${(i==null?void 0:i.trim())??""}${t}`;if(n==="percentage"){const a=(i??r??"").trim();return a?`${t} ${a}`:t}const o=(r==null?void 0:r.trim())??"";return o?`${t} ${o}`:t}function o1(t){return n1(t)}const xf=7;function a1(t,e=xf){return t.length<=e?t:`${t.slice(0,e)}...`}const BH=120,HH=60,qH=20;function ay(t,e){return!e||!t.linkKeys.length?!1:t.linkKeys.every(n=>e.has(n))}function s1(t,e){const{model:n,colorRanges:i,width:r,height:o,theme:a,onLinkHover:s,onLinkLeave:l,onLabelHover:c,onLabelLeave:u}=e;if(t.replaceChildren(),!n.links.length||r<BH||o<HH)return;const d=f.sankeyPadding,h=r>400&&o>270,p=Math.max(qH,Math.min(h?f.sankeyNodeWidth:f.sankeyNodeWidthSmall,(r-d*2-24)/2)),m=UH().nodeId(x=>x.name).nodeWidth(p).nodePadding(f.sankeyNodePadding).nodeSort(null).extent([[d,d],[r-d,o-d*2]])({nodes:n.nodes.map(x=>({...x})),links:n.links.map(x=>({...x}))}),v=z6(),b=n.colors[n.colors.length-1]??f.series[0],g=new Map,$=[];if(m.links.forEach((x,A)=>{const D=x,R=D.source,B=D.target,X=`${R.name.trim()}-${B.name.trim()}-${A}`,et=v({source:[R.x1??0,D.y0??0],target:[B.x0??0,D.y1??0]});if(et){$.push({key:X,path:et,color:r1(i,D.value,b),strokeWidth:Math.max((D.width??0)-f.sankeyLinkInset,1),sourceId:R.name,targetId:B.name,sourceLabel:R.label,targetLabel:B.label,value:D.value});for(const K of[R.name,B.name]){const at=g.get(K);at?at.push(X):g.set(K,[X])}}}),!$.length)return;const _=m.nodes.reduce((x,A)=>Math.max(x,A.depth??0),0),y=m.nodes.map(x=>({id:x.name,label:x.label,x0:x.x0??0,x1:x.x1??0,y0:x.y0??0,atMaxDepth:(x.depth??0)===_,linkKeys:g.get(x.name)??[]})),S=Math.floor(o/35)+1,w=Math.min(10,S+o/30),L=S-(o>270?0:.5),N=h?0:.355,E=Math.floor(o/15)>4,H=ht(t).append("svg").attr("width",r).attr("height",o).attr("viewBox",`0 0 ${r} ${o}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Sankey chart").style("display","block").style("font-family",a.fontFamily),F=H.append("g").attr("class","links").selectAll("path").data($).join("path").attr("d",x=>x.path).attr("fill","none").attr("stroke-width",x=>x.strokeWidth).style("transition","opacity 0.3s, stroke 0.3s"),W=H.append("g").attr("class","node-labels").selectAll("text").data(y).join("text").attr("x",x=>x.atMaxDepth?x.x1:x.x0).attr("y",x=>x.y0+L).attr("dy",`${N}em`).attr("text-anchor",x=>x.atMaxDepth?"end":"start").attr("font-size",w).attr("fill",a.text).style("cursor","pointer").text(x=>a1(x.label)),M=E?H.append("g").attr("class","node-rules").selectAll("line").data(y).join("line").attr("x1",x=>x.x0).attr("y1",x=>x.y0).attr("x2",x=>x.x1).attr("y2",x=>x.y0):null;let z=null,T=null,C=null;const k=()=>{const x=T;F.attr("opacity",A=>C?A.key===C?1:f.sankeyDimOpacity:x&&!x.has(A.key)?f.sankeyDimOpacity:1).attr("stroke",A=>x!=null&&x.has(A.key)||A.key===C?A.color:ws(A.color,f.sankeyLinkAlphaPct)),W.attr("font-weight",A=>ay(A,x)?600:400),M==null||M.attr("stroke",A=>ay(A,x)?f.sankeyNodeRuleActive:f.sankeyNodeRule)};F.style("cursor","pointer").on("mouseenter",(x,A)=>{C=A.key,k(),s==null||s({sourceLabel:A.sourceLabel,targetLabel:A.targetLabel,value:A.value,event:x})}).on("mousemove",(x,A)=>{s==null||s({sourceLabel:A.sourceLabel,targetLabel:A.targetLabel,value:A.value,event:x})}).on("mouseleave",()=>{C=null,k(),l==null||l()}),W.on("click",(x,A)=>{z=z===A.id?null:A.id,T=z?new Set($.filter(D=>D.sourceId===z||D.targetId===z).map(D=>D.key)):null,k()}).on("mouseenter",(x,A)=>{A.label.length>xf&&(c==null||c({label:A.label,event:x}))}).on("mouseleave",()=>u==null?void 0:u()),k()}const GH=ie`
1391
+ :host {
1392
+ display: flex;
1393
+ flex-direction: column;
1394
+ position: relative;
1395
+ width: 100%;
1396
+ height: 100%;
1397
+ min-height: 220px;
1398
+ color: var(--ui9000-color-text, #111827);
1399
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1400
+ box-sizing: border-box;
1401
+ }
1402
+ .axis-labels {
1403
+ display: flex;
1404
+ flex-direction: row;
1405
+ justify-content: space-between;
1406
+ margin: 0 3px 8px 3px;
1407
+ font-size: 12px;
1408
+ font-weight: 500;
1409
+ line-height: 14px;
1410
+ color: var(--ui9000-color-text-muted, #6c7584);
1411
+ }
1412
+ .chart-root {
1413
+ flex: 1 1 auto;
1414
+ min-height: 0;
1415
+ width: 100%;
1416
+ }
1417
+ .legend {
1418
+ display: flex;
1419
+ align-items: center;
1420
+ gap: 8px;
1421
+ padding-top: 8px;
1422
+ font-size: 12px;
1423
+ color: var(--ui9000-color-text-muted, #6c7584);
1424
+ }
1425
+ .swatches {
1426
+ display: flex;
1427
+ align-items: center;
1428
+ }
1429
+ .swatch {
1430
+ width: 14px;
1431
+ height: 8px;
1432
+ }
1433
+ .swatch:first-child {
1434
+ border-top-left-radius: 8px;
1435
+ border-bottom-left-radius: 8px;
1436
+ }
1437
+ .swatch:last-child {
1438
+ border-top-right-radius: 8px;
1439
+ border-bottom-right-radius: 8px;
1440
+ }
1441
+ .tooltip {
1442
+ position: absolute;
1443
+ pointer-events: none;
1444
+ z-index: 2;
1445
+ padding: 6px 10px;
1446
+ border-radius: 6px;
1447
+ font-size: 12px;
1448
+ line-height: 1.35;
1449
+ background: var(--ui9000-color-text, #111827);
1450
+ color: #fff;
1451
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1452
+ transform: translate(-50%, calc(-100% - 10px));
1453
+ white-space: nowrap;
1454
+ }
1455
+ .tooltip .key {
1456
+ font-weight: 600;
1457
+ }
1458
+ .empty {
1459
+ display: grid;
1460
+ place-items: center;
1461
+ flex: 1 1 auto;
1462
+ padding: 20px;
1463
+ text-align: center;
1464
+ color: var(--ui9000-color-text-muted, #6b7280);
1465
+ font-size: 0.875rem;
1466
+ }
1467
+ `,Ku=2e3,VH={nodes:[],links:[],sourceLabel:"",targetLabel:"",valueLabel:"",colors:[...ac],circular:!1};function Xo(t={}){return{...VH,colors:[...ac],...t}}function nu(t){return Array.isArray(t)?typeof t[0]=="string"?t[0]:"":typeof t=="string"?t:""}function iu(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}function ZH(t){const e=new Map;for(const o of t){let a=e.get(o.source);a||(a=new Set,e.set(o.source,a)),a.add(o.target)}const n=new Set,i=new Set,r=o=>{if(i.has(o))return!0;if(n.has(o))return!1;n.add(o),i.add(o);for(const a of e.get(o)??[])if(r(a))return!0;return i.delete(o),!1};for(const o of e.keys())if(!n.has(o)&&r(o))return!0;return!1}function l1(t,e,n,i){const r=new Set(t.map(s=>s.name));let o=e.filter(s=>r.has(s.source)&&r.has(s.target)&&s.source!==s.target&&Number.isFinite(s.value));if(o.length>Ku&&(o=o.slice().sort((s,l)=>l.value-s.value).slice(0,Ku)),!o.length)return Xo({...n,colors:i});if(ZH(o))return Xo({...n,colors:i,circular:!0});const a=new Set;for(const s of o)a.add(s.source),a.add(s.target);return{nodes:t.filter(s=>a.has(s.name)),links:o,...n,colors:i,circular:!1}}function WH(t){var e,n,i,r,o;const a=t.data??[],s=t.axisDetails??void 0,l=((e=t.palette)==null?void 0:e.customColors)??void 0,c=l!=null&&l.length?l.map(_=>_.hex):[...ac],u=t.arrangeBy??[],d=nu(t.xAxe)||u[0]||"",h=nu(t.yAxe)||((n=t.display)==null?void 0:n[0])||"";let p=nu(t.groupBy)||u[1]||"";p||(p=Object.keys(a[0]??{}).find(_=>_!==d&&_!==h)??"");const m={sourceLabel:((i=s==null?void 0:s[d])==null?void 0:i.label)||iu(d),targetLabel:((r=s==null?void 0:s[p])==null?void 0:r.label)||iu(p),valueLabel:((o=s==null?void 0:s[h])==null?void 0:o.label)||iu(h)};if(!a.length||!d||!p||!h)return Xo({...m,colors:c});const v=new Set,b=new Set,g=[];for(const _ of a){const y=String(_[d]??""),S=String(_[p]??"").trim(),w=Number(_[h]);!y||!S||!Number.isFinite(w)||(v.add(y),b.add(S),g.push({source:`${y} `,target:S,value:w}))}const $=[...[...v].sort().map(_=>({name:`${_} `,label:_})),...[...b].sort().map(_=>({name:_,label:_}))];return l1($,g,m,c)}function sy(t){var e;const n=(t.links??[]).map(r=>({source:String(r.source??""),target:String(r.target??""),value:Number(r.value)})).filter(r=>r.source&&r.target),i=(e=t.nodes)!=null&&e.length?t.nodes.map(r=>({name:String(r.name),label:r.label??String(r.name)})):[...new Set([...n.map(r=>r.source),...n.map(r=>r.target)])].map(r=>({name:r,label:r}));return l1(i,n,{sourceLabel:t.sourceLabel??"",targetLabel:t.targetLabel??"",valueLabel:t.valueLabel??""},[...ac])}function c1(t){return t?Array.isArray(t)?sy({links:t}):"links"in t&&Array.isArray(t.links)?sy(t):"data"in t&&Array.isArray(t.data)?WH(t):Xo():Xo()}var KH=Object.defineProperty,YH=Object.getOwnPropertyDescriptor,Tn=(t,e,n,i)=>{for(var r=i>1?void 0:i?YH(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&KH(e,n,r),r};const JH={empty:!0,circular:!1,sourceLabel:"",targetLabel:"",colorRanges:[]};let hr=class extends Vn{constructor(){super(...arguments),this.dataJson="[]",this.showLegend=!0,this.showTooltip=!0,this.sourceLabel="",this.targetLabel="",this._tooltip=null,this._view=JH,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){return c1(Ot(this.dataJson,[]))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData(),i=e1(n.links.map(s=>s.value),n.colors);if(this._view={empty:n.links.length===0,circular:n.circular,sourceLabel:this.sourceLabel||n.sourceLabel,targetLabel:this.targetLabel||n.targetLabel,colorRanges:i},!n.links.length){e.replaceChildren();return}const r=wt(this),{width:o,height:a}=bC(e);s1(e,{model:n,colorRanges:i,width:o,height:a,theme:r,onLinkHover:this.showTooltip?({sourceLabel:s,targetLabel:l,value:c,event:u})=>{this.setTooltip(u,[{key:this._view.sourceLabel,value:io(s)},{key:n.valueLabel,value:o1(c)},{key:this._view.targetLabel,value:io(l)}])}:void 0,onLinkLeave:this.showTooltip?()=>this.clearTooltip():void 0,onLabelHover:this.showTooltip?({label:s,event:l})=>this.setTooltip(l,[{key:"",value:s}]):void 0,onLabelLeave:this.showTooltip?()=>this.clearTooltip():void 0})}setTooltip(t,e){const n=this.getBoundingClientRect();this._tooltip={x:t.clientX-n.left,y:t.clientY-n.top,rows:e}}clearTooltip(){this._tooltip=null}render(){const{empty:t,circular:e,sourceLabel:n,targetLabel:i,colorRanges:r}=this._view;return ot`
1468
+ ${!t&&!!(n||i)?ot`<div class="axis-labels" part="axis-labels">
1469
+ <div>${n}</div>
1470
+ <div>${i}</div>
1471
+ </div>`:st}
1472
+
1473
+ <div class="chart-root" part="chart" ?hidden=${t}></div>
1474
+
1475
+ ${t?ot`<div class="empty" part="empty">
1476
+ ${e?"Circular dependency detected in the data — this cannot be drawn as a Sankey.":"No data"}
1477
+ </div>`:st}
1478
+
1479
+ ${!t&&this.showLegend&&r.length?ot`<div class="legend" part="legend">
1480
+ <span>Low</span>
1481
+ <div class="swatches">
1482
+ ${r.map(a=>ot`<div class="swatch" style="background-color:${a.color}"></div>`)}
1483
+ </div>
1484
+ <span>High</span>
1485
+ </div>`:st}
1486
+
1487
+ ${this._tooltip?ot`<div
1488
+ class="tooltip"
1489
+ part="tooltip"
1490
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1491
+ >
1492
+ ${this._tooltip.rows.map(a=>ot`<div>
1493
+ ${a.key?ot`<span class="key">${a.key}:</span> `:st}${a.value}
1494
+ </div>`)}
1495
+ </div>`:st}
1496
+ `}};hr.styles=GH;Tn([Y({type:String,attribute:"data"})],hr.prototype,"dataJson",2);Tn([Y({type:Boolean,attribute:"show-legend"})],hr.prototype,"showLegend",2);Tn([Y({type:Boolean,attribute:"show-tooltip"})],hr.prototype,"showTooltip",2);Tn([Y({type:String,attribute:"source-label"})],hr.prototype,"sourceLabel",2);Tn([Y({type:String,attribute:"target-label"})],hr.prototype,"targetLabel",2);Tn([yt()],hr.prototype,"_tooltip",2);Tn([yt()],hr.prototype,"_view",2);hr=Tn([Xt("ui9000-sankey-chart")],hr);function u1(){customElements.get("ui9000-sankey-chart")||customElements.define("ui9000-sankey-chart",hr)}u1();const XH=Object.freeze(Object.defineProperty({__proto__:null,MAX_SANKEY_LINKS:Ku,NODE_LABEL_MAX:xf,get Ui9000SankeyChart(){return hr},buildColorRanges:e1,formatCapitalizedWords:io,formatSankeyValue:o1,generateBreakPoints:bf,normalizeSankeyData:c1,pickRangeColor:r1,registerSankeyChart:u1,renderSankeyChart:s1,sankeyChartMetadata:n$,truncateNodeLabel:a1},Symbol.toStringTag,{value:"Module"}));function d1(t,e){let n=1/0,i=-1/0;for(const r of t){const o=r.values[e];o==null||!Number.isFinite(o)||(o<n&&(n=o),o>i&&(i=o))}return!Number.isFinite(n)||!Number.isFinite(i)?[0,1]:n===i?[n,n+1]:[n,i]}function h1(t,e){const n=new Map;for(const i of e)n.set(i,d1(t,i));return n}function Yu(t){return!Number.isFinite(t)||t<=0?2:Math.max(2,Math.min(8,Math.round(t/80)))}const p1=25;function Ju(t){return Pt(t).replace(/\.(\d*?)0+(?=[KMB]?$)/,(e,n)=>n?`.${n}`:"")}function f1(t){return t==null||!Number.isFinite(t)?"—":Number.isInteger(t)?String(t):String(Number(t.toFixed(4)))}const QH=120,t9=60;let e9=0;const r9=`
1497
+ .line-path { pointer-events: visibleStroke; transition: stroke-opacity .2s, stroke-width .2s; }
1498
+ .plot.is-hovering .line-path { stroke-opacity: ${f.parallelLineOpacityDimmed}; }
1499
+ .plot.is-hovering .line-path.is-hovered { stroke-opacity: 1; stroke-width: ${f.parallelLineWidthHovered}px; }
1500
+ .x-axis .tick:first-of-type text { text-anchor: start; }
1501
+ .x-axis .tick:last-of-type text { text-anchor: end; }
1502
+ /* Ticks render in ascending domain order: first is now the bottom edge. */
1503
+ .y-axis .tick:first-of-type text { dominant-baseline: ideographic; }
1504
+ .y-axis .tick:last-of-type text { dominant-baseline: central; }
1505
+ `;function n9(t){t.select(".domain").attr("stroke",f.parallelAxisStroke),t.selectAll(".tick line").attr("stroke",f.parallelAxisStroke),t.selectAll("text").attr("fill",f.parallelAxisLabelFill).attr("font-size",f.axisLabelSize)}function m1(t,e){const{model:n,width:i,height:r,margin:o,theme:a,orientation:s,showLegend:l,onRowHover:c,onRowLeave:u,onColorKeyChange:d}=e;t.replaceChildren();const{axes:h,rows:p}=n;if(!h.length||!p.length||i<QH||r<t9)return;const m=e.colorKey??n.colorKey;let v=h.includes(m)?m:h[0];const b=l?f.parallelLegendOffsetRight+f.parallelLegendWidth+f.parallelLegendTickLabelWidth:0,$=i-o.left-o.right-b,_=Math.max(o.left,$-o.right),y=s==="vertical",S=f.parallelAxisSpacing*h.length,w=r-o.top-o.bottom,L=y?w-o.bottom-f.parallelColorScaleHeight:S-o.bottom,N=y?r:S+o.top+o.bottom*2;if(L<=o.top)return;const E=h1(p,h),H=new Map;for(const I of h)H.set(I,Ft().domain(E.get(I)).range(y?[L,o.top]:[o.left,_]));const F=uF().domain(h).range(y?[o.left,_]:[o.top,L]),W=ht(t).append("svg").attr("width",i).attr("height",N).attr("viewBox",`0 0 ${i} ${N}`).attr("role","img").attr("aria-label","Parallel coordinates chart").style("display","block").style("font-family",a.fontFamily);W.append("style").text(r9);const M=W.append("g").attr("transform",`translate(${o.left},${o.top})`),z=h.length-1,T=y?L-o.top:_-o.left,C=Yu(T),k=h.length>1?Math.abs(Number(F.step())):_,x=y?Math.max(0,k-8):$,A=M.append("g").selectAll("g").data(h).join("g").attr("class",y?"y-axis":"x-axis").attr("transform",I=>y?`translate(${F(I)}, 0)`:`translate(0, ${F(I)})`).style("cursor","pointer").on("click",(I,V)=>j(V));A.each(function(I,V){const U=ht(this),O=H.get(I),P=y?V===z?Jt(O):zm(O):ae(O);U.call(P.ticks(C).tickSize(4).tickPadding(8).tickFormat(J=>Ju(Number(J)))),n9(U)});const D=A.append("text").attr("class","axis-title").attr("x",o.left).attr("y",y?0:-10).attr("text-anchor",(I,V)=>y&&V===z?"end":"start").attr("fill",f.parallelAxisLabelFill);D.each(function(I){fo(ht(this),I,{maxLength:p1,slotWidth:x,onAxisLabelHover:e.onAxisLabelHover,onAxisLabelLeave:e.onAxisLabelLeave})});const R=M.append("g").attr("class","plot").attr("fill","none"),B=([I,V])=>H.get(I)(V??0),X=([I])=>Number(F(I)),et=lr().defined(([,I])=>I!=null).x(y?X:B).y(y?B:X),K=R.selectAll("path").data(p).join("path").attr("class","line-path").attr("stroke-width",f.parallelLineWidth).attr("stroke-opacity",f.parallelLineOpacity).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("d",I=>et(h.map(V=>[V,I.values[V]])));K.on("mouseenter",function(I,V){R.classed("is-hovering",!0),ht(this).classed("is-hovered",!0),c==null||c({row:V,event:I})}).on("mousemove",(I,V)=>c==null?void 0:c({row:V,event:I})).on("mouseleave",function(){R.classed("is-hovering",!1),ht(this).classed("is-hovered",!1),u==null||u()});const at=`ui9000-parallel-ramp-${e9+=1}`,nt=l?M.append("g").attr("class","color-legend"):null;if(nt){const V=W.append("defs").append("linearGradient").attr("id",at).attr("x1","0%").attr("x2","0%").attr("y1","100%").attr("y2","0%");V.append("stop").attr("offset","0%").attr("stop-color",n.minColor),V.append("stop").attr("offset","100%").attr("stop-color",n.maxColor)}function tt(){const V=H.get(v).domain(),U=Ft().domain(V).range([n.minColor,n.maxColor]).clamp(!0);if(K.attr("stroke",it=>{const lt=it.values[v];return lt==null?n.lineColor:U(lt)}),D.attr("font-size",it=>it===v?f.parallelTitleSizeActive:f.parallelTitleSize).attr("font-weight",it=>it===v?600:400),!nt)return;nt.selectAll("*").remove();const O=Math.max(0,$-o.right+f.parallelLegendOffsetRight),P=Math.max(0,L-o.top);nt.append("rect").attr("x",O).attr("y",o.top).attr("width",f.parallelLegendWidth).attr("height",P).attr("rx",f.parallelLegendRadius).attr("fill",`url(#${at})`);const J=Ft().domain(V).range([P,0]),rt=nt.append("g").attr("transform",`translate(${O+f.parallelLegendWidth}, ${o.top})`).call(zm(J).ticks(Yu(P)).tickSize(0).tickPadding(6).tickFormat(it=>Ju(Number(it))));rt.select(".domain").remove(),rt.selectAll(".tick line").remove(),rt.selectAll("text").attr("fill",f.parallelAxisLabelFill).attr("font-size",f.axisLabelSize)}function j(I){I!==v&&(v=I,tt(),d==null||d(I))}tt()}const i9=ie`
1506
+ :host {
1507
+ display: block;
1508
+ position: relative;
1509
+ width: 100%;
1510
+ height: 100%;
1511
+ min-height: 220px;
1512
+ color: var(--ui9000-color-text, #111827);
1513
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1514
+ box-sizing: border-box;
1515
+ }
1516
+ .chart-body {
1517
+ flex: 1;
1518
+ min-height: 0;
1519
+ display: flex;
1520
+ flex-direction: column;
1521
+ }
1522
+ /* Horizontal stacks a 72px band per dimension, so the plot outgrows the frame. */
1523
+ .chart-scroll {
1524
+ flex: 1;
1525
+ min-height: 0;
1526
+ overflow-y: auto;
1527
+ overflow-x: hidden;
1528
+ position: relative;
1529
+ }
1530
+ .chart-scroll[data-orientation='vertical'] {
1531
+ overflow-y: hidden;
1532
+ }
1533
+ .chart-root {
1534
+ width: 100%;
1535
+ min-height: inherit;
1536
+ }
1537
+ .tooltip {
1538
+ position: absolute;
1539
+ pointer-events: none;
1540
+ z-index: 2;
1541
+ padding: 6px 10px;
1542
+ border-radius: 6px;
1543
+ font-size: 12px;
1544
+ line-height: 1.35;
1545
+ background: var(--ui9000-color-text, #111827);
1546
+ color: #fff;
1547
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1548
+ transform: translate(-50%, calc(-100% - 10px));
1549
+ white-space: nowrap;
1550
+ }
1551
+ .tooltip .name {
1552
+ font-weight: 600;
1553
+ }
1554
+ .tooltip .row {
1555
+ display: flex;
1556
+ justify-content: space-between;
1557
+ gap: 12px;
1558
+ }
1559
+ .tooltip .row.is-active {
1560
+ font-weight: 600;
1561
+ }
1562
+ .empty {
1563
+ display: grid;
1564
+ place-items: center;
1565
+ height: 100%;
1566
+ min-height: inherit;
1567
+ color: var(--ui9000-color-text-muted, #6b7280);
1568
+ font-size: 0.875rem;
1569
+ }
1570
+ `,g1=2e3;function y1(t){const e=Array.isArray(t)?t:[];return["defaultMin","defaultMax"].map((n,i)=>e.find(r=>r.key===n)??{key:n,color:String(i+1)})}const Qo={orientation:"horizontal",axes:[],rows:[],idKey:"",colorKey:"",minColor:"#473DD9",maxColor:"#36C4A5",lineColor:"#473DD9"};function v1(t){return t==="vertical"?"vertical":"horizontal"}function b1(t){if(t==null||t==="")return null;const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?e:null}function Pa(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function o9(t,e){return t==null?e==null?0:1:e==null?-1:typeof t=="number"&&typeof e=="number"?t-e:String(t).localeCompare(String(e),void 0,{numeric:!0})}function a9(t){const e=Array.isArray(t)?t[0]:t;if(!Pa(e))return[];const n=new Set,i=[];for(const r of Object.values(e))for(const o of Array.isArray(r)?r:[r])typeof o!="string"||!o||n.has(o)||(n.add(o),i.push(o));return i}function s9(t){const e=new Set,n=[];for(const i of t)for(const[r,o]of Object.entries(i))e.has(r)||b1(o)==null||(e.add(r),n.push(r));return n}function l9(t,e){const n=new Set(e);for(const i of t)for(const r of Object.keys(i))if(!n.has(r))return r;return""}function x1(t,e,n){const i=n?t.slice().sort((o,a)=>o9(o[n],a[n])):t.slice(),r=[];for(const o of i){const a={};let s=!1;for(const l of e){const c=b1(o[l]);a[l]=c,c!=null&&(s=!0)}if(s&&(r.push({id:String(n?o[n]??"":r.length+1),values:a}),r.length>=g1))break}return r}function _1(t){const{orientation:e,axes:n,rows:i,idKey:r}=t;if(!n.length||!i.length)return{...Qo,orientation:e};const o=y1(t.formatting),a=zt(o,"defaultMin",o.length),s=zt(o,"defaultMax",o.length),l=t.colorKeyHint,c=l&&n.includes(l)?l:n[0];return{orientation:e,axes:n,rows:i,idKey:r,colorKey:c,minColor:a,maxColor:s,lineColor:a}}function c9(t){const e=v1(t.orientation),n=a9(t.uniqueValues),i=t.data.filter(Pa),r=ft(t.xAxe??void 0)??"";return n.length?_1({orientation:e,axes:n,rows:x1(i,n,r),idKey:r,colorKeyHint:ft(t.yAxe??void 0),formatting:t.formatting}):{...Qo,orientation:e}}function ly(t){var e;const n=v1(t.orientation),i=t.rows.filter(Pa),r=(e=t.axes)!=null&&e.length?t.axes.map(String):s9(i);if(!r.length)return{...Qo,orientation:n};const o=t.idKey?String(t.idKey):l9(i,r);return _1({orientation:n,axes:r,rows:x1(i,r,o),idKey:o})}function u9(t){return Pa(t)&&Array.isArray(t.data)}function d9(t){return Pa(t)&&Array.isArray(t.rows)}function $1(t){return t?Array.isArray(t)?ly({rows:t}):d9(t)?ly(t):u9(t)?c9(t):{...Qo}:{...Qo}}var h9=Object.defineProperty,p9=Object.getOwnPropertyDescriptor,Ln=(t,e,n,i)=>{for(var r=i>1?void 0:i?p9(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&h9(e,n,r),r};let pr=class extends qt{constructor(){super(...arguments),this.orientation="",this.showLegend=!0,this.showTooltip=!0,this.colorKey="",this._tooltip=null,this._activeColorKey="",this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}firstUpdated(){var t,e,n,i;const r=(t=this.shadowRoot)==null?void 0:t.querySelector(".widget-body"),o=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-scroll");r instanceof HTMLElement&&((n=this._resizeObserver)==null||n.observe(r)),o instanceof HTMLElement&&((i=this._resizeObserver)==null||i.observe(o))}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]),e=$1(t);return this.orientation==="horizontal"||this.orientation==="vertical"?{...e,orientation:this.orientation}:e}draw(){var t,e;const n=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-scroll"),i=(e=this.shadowRoot)==null?void 0:e.querySelector(".chart-root");if(!n||!i)return;const r=this.parseData();if(this._empty=r.axes.length===0||r.rows.length===0,this._empty){i.replaceChildren();return}const{width:o,margin:a}=cC(n,r.orientation),s=wt(this),l=this.colorKey||this._activeColorKey||r.colorKey;m1(i,{model:r,width:o,height:n.clientHeight||300,margin:a,theme:s,orientation:r.orientation,showLegend:this.showLegend,colorKey:l,...this.axisLabelHandlers(),onColorKeyChange:c=>{this._activeColorKey=c},onRowHover:this.showTooltip?({row:c,event:u})=>{const d=this.getBoundingClientRect();this._tooltip={x:u.clientX-d.left,y:u.clientY-d.top,id:r.idKey?`${r.idKey}: ${c.id}`:c.id,rows:r.axes.map(h=>({key:h,value:f1(c.values[h])}))}}:void 0,onRowLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this.parseData().orientation;return ot`
1571
+ <div class="widget-shell" part="shell">
1572
+ ${this.renderShellHeader(t)}
1573
+ <div class="widget-body">
1574
+ <div class="chart-body" part="chart-body">
1575
+ <div class="chart-scroll" part="scroll" data-orientation=${e}>
1576
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1577
+ </div>
1578
+ </div>
1579
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1580
+ ${this._tooltip?ot`<div
1581
+ class="tooltip"
1582
+ part="tooltip"
1583
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1584
+ >
1585
+ <div class="name">${this._tooltip.id}</div>
1586
+ ${this._tooltip.rows.map(n=>ot`<div
1587
+ class="row ${n.key===(this.colorKey||this._activeColorKey)?"is-active":""}"
1588
+ >
1589
+ <span>${n.key}</span><span>${n.value}</span>
1590
+ </div>`)}
1591
+ </div>`:st}
1592
+ ${this.renderShellLabelTooltip()}
1593
+ </div>
1594
+ </div>
1595
+ `}};pr.styles=[i9,ne];Ln([Y({type:String})],pr.prototype,"orientation",2);Ln([Y({type:Boolean,attribute:"show-legend"})],pr.prototype,"showLegend",2);Ln([Y({type:Boolean,attribute:"show-tooltip"})],pr.prototype,"showTooltip",2);Ln([Y({type:String,attribute:"color-key"})],pr.prototype,"colorKey",2);Ln([yt()],pr.prototype,"_tooltip",2);Ln([yt()],pr.prototype,"_activeColorKey",2);Ln([yt()],pr.prototype,"_empty",2);pr=Ln([Xt("ui9000-parallel-coordinates-chart")],pr);function w1(){customElements.get("ui9000-parallel-coordinates-chart")||customElements.define("ui9000-parallel-coordinates-chart",pr)}w1();const f9=Object.freeze(Object.defineProperty({__proto__:null,AXIS_TITLE_MAX:p1,MAX_PARALLEL_LINES:g1,get Ui9000ParallelCoordinatesChart(){return pr},axisExtent:d1,axisExtents:h1,formatAxisTick:Ju,formatTooltipValue:f1,normalizeParallelCoordinatesData:$1,parallelCoordinatesChartMetadata:J_,registerParallelCoordinatesChart:w1,renderParallelCoordinatesChart:m1,resolveParallelFormatting:y1,tickCountForSpan:Yu},Symbol.toStringTag,{value:"Module"}));function ri(t,e=2){return Number.isFinite(t)?t.toFixed(e):"0"}function m9(t){return`${ri(t.percentage)}% - ${t.label}`}function g9(t,e){if(!e||!t)return 0;const n=2*Math.PI*e,i=t/n;return Number.isFinite(i)?f.pieMinArcLengthPx*i:0}function $c(t,e){const{slices:n,width:i,height:r,themeMode:o="light",innerRadius:a=0,showTooltip:s=!0,onHover:l,onLeave:c,onLayout:u}=e;if(t.replaceChildren(),!n.length||i<=0||r<=0){u==null||u([]);return}const d=Math.min(i,r),h=d/2,p=Math.max(0,Math.min(h,a)),m=g9(n.reduce((w,L)=>w+L.value,0),h),b=ew().value(w=>w.value<m?m:w.value)(n);u==null||u(b.map(w=>w.data.key));const g=ht(t).append("svg").attr("width",d).attr("height",d).attr("viewBox",`0 0 ${d} ${d}`),$=o==="dark"?f.donutSliceStrokeDark:f.donutSliceStroke,_=Na().innerRadius(p).outerRadius(h),y=g.append("g").attr("transform",`translate(${d/2}, ${d/2})`),S=y.selectAll("path").data(b).enter().append("path").attr("class","pie-path").attr("d",_).attr("opacity",f.donutArcOpacity).attr("fill",w=>w.data.color).attr("stroke",$).attr("stroke-width",f.donutSliceStrokeWidth);s&&l&&S.style("cursor","pointer").on("mouseenter",function(w,L){y.selectAll(".pie-path").attr("opacity",f.donutArcOpacityDimmed),ht(this).attr("opacity",1),l({slice:L.data,event:w})}).on("mousemove",(w,L)=>{l({slice:L.data,event:w})}).on("mouseleave",()=>{y.selectAll(".pie-path").attr("opacity",f.donutArcOpacity),c==null||c()})}const _f=ie`
1596
+ :host {
1597
+ display: block;
1598
+ position: relative;
1599
+ width: 100%;
1600
+ height: 100%;
1601
+ min-height: 220px;
1602
+ color: var(--ui9000-color-text, #111827);
1603
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1604
+ box-sizing: border-box;
1605
+ }
1606
+ .chart-root {
1607
+ flex: 1;
1608
+ min-height: 0;
1609
+ width: 100%;
1610
+ height: 100%;
1611
+ min-height: inherit;
1612
+ display: flex;
1613
+ align-items: center;
1614
+ justify-content: center;
1615
+ }
1616
+ .tooltip {
1617
+ position: absolute;
1618
+ pointer-events: none;
1619
+ z-index: 2;
1620
+ padding: 6px 10px;
1621
+ border-radius: 6px;
1622
+ font-size: 12px;
1623
+ line-height: 1.35;
1624
+ background: var(--ui9000-color-text, #111827);
1625
+ color: #fff;
1626
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1627
+ transform: translate(-50%, calc(-100% - 10px));
1628
+ white-space: nowrap;
1629
+ }
1630
+ .empty {
1631
+ display: grid;
1632
+ place-items: center;
1633
+ height: 100%;
1634
+ min-height: inherit;
1635
+ color: var(--ui9000-color-text-muted, #6b7280);
1636
+ font-size: 0.875rem;
1637
+ }
1638
+ `,Ci={slices:[],total:0};function y9(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!=null&&typeof e=="object"&&"label"in e&&"value"in e}function v9(t,e,n,i){if(!t.length)return Ci;const r=me(t.map(c=>c.key),n,i),o=new Map(t.map(c=>[c.key,c])),a=r.map(c=>o.get(c)).filter(c=>c!=null);for(const c of t)a.some(u=>u.key===c.key)||a.push(c);const s=a.reduce((c,u)=>c+u.value,0);return{slices:a.map(c=>({key:c.key,label:c.label,value:c.value,color:zt(e,c.key,a.length),percentage:s>0?c.value/s*100:0})),total:s}}function b9(t){const e=t.map(r=>({key:String(r.label),label:String(r.label),value:Number(r.value),color:r.color})).filter(r=>r.label&&Number.isFinite(r.value)),n=e.reduce((r,o)=>r+o.value,0);return{slices:e.map(r=>({key:r.key,label:r.label,value:r.value,color:r.color??zt(void 0,r.key,e.length),percentage:n>0?r.value/n*100:0})),total:n}}function x9(t){const e=ft(t.xAxe),n=ft(t.yAxe);if(!e||!n)return Ci;const i=se(t),r=[];for(const s of i){const l=s[e],c=Number(s[n]);l==null||l===""||!Number.isFinite(c)||r.push({key:String(l),label:String(l),value:c})}const o=an(t);return{...v9(r,t.formatting,t.uniqueValues,e),xField:e,yField:n,axisDetails:t.axisDetails,uniqueValuesHint:o}}function wc(t){return t?Array.isArray(t)?t.length&&y9(t)?b9(t):Ci:Ht(t)?x9(t):typeof t=="object"&&Array.isArray(t.slices)?t:Ci:Ci}function kc(t,e){var n;const i=new Map(t.slices.map(s=>[s.key,s])),r=(n=t.uniqueValuesHint)!=null&&n.length?ci(t.uniqueValuesHint):null,o=e.filter(s=>i.has(s));return(r!=null&&r.length?o.filter(s=>r.includes(s)):o).map(s=>i.get(s)).filter(s=>s!=null)}var _9=Object.defineProperty,$9=Object.getOwnPropertyDescriptor,Cn=(t,e,n,i)=>{for(var r=i>1?void 0:i?$9(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&_9(e,n,r),r};let fr=class extends qt{constructor(){super(...arguments),this.scale="default",this.innerRadiusRatio=0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._legendSlices=[],this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return wc(t)}renderLegend(){if(!this.showLegend||!this._legendSlices.length)return st;const t=wt(this);return ce(Nr(this._legendSlices.map(e=>`${ri(e.percentage)}% - ${e.label}`),t,(e,n)=>{var i;return((i=this._legendSlices[n])==null?void 0:i.color)??t.primary}))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.slices.length===0,this._empty){e.replaceChildren(),this._legendSlices=[];return}wt(this);const{width:i,height:r}=T_(e),o=Math.min(i,r),a=Math.max(0,Math.min(1,this.innerRadiusRatio))*(o/2);$c(e,{slices:n.slices,width:i,height:r,innerRadius:a,showTooltip:this.showTooltip,onLayout:s=>{this._legendSlices=kc(n,s)},onHover:this.showTooltip?({slice:s,event:l})=>{var c,u,d,h,p,m;const v=this.getBoundingClientRect(),b=n.xField??"Category",g=n.yField??"Value",$=((u=(c=n.axisDetails)==null?void 0:c[b])==null?void 0:u.label)??b,_=((h=(d=n.axisDetails)==null?void 0:d[g])==null?void 0:h.label)??g,y=((m=(p=n.axisDetails)==null?void 0:p[g])==null?void 0:m.measure_unit_symbol)??"",S=y?`${s.value.toLocaleString()} ${y}`.trim():s.value.toLocaleString();this._tooltip={x:l.clientX-v.left,y:l.clientY-v.top,xLabel:`${$}: ${s.label}`,yLabel:`${_}: ${S} (${ri(s.percentage)}%)`}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle();return ot`
1639
+ <div class="widget-shell" part="shell">
1640
+ ${this.renderShellHeader(t)}
1641
+ <div class="widget-body">
1642
+ ${this.renderLegend()}
1643
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1644
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1645
+ ${this._tooltip?ot`<div
1646
+ class="tooltip"
1647
+ part="tooltip"
1648
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1649
+ >
1650
+ <div>${this._tooltip.xLabel}</div>
1651
+ <div>${this._tooltip.yLabel}</div>
1652
+ </div>`:st}
1653
+ ${this.renderShellLabelTooltip()}
1654
+ </div>
1655
+ </div>
1656
+ `}};fr.styles=[_f,ne];Cn([Y({type:String,attribute:"scale"})],fr.prototype,"scale",2);Cn([Y({type:Number,attribute:"inner-radius-ratio"})],fr.prototype,"innerRadiusRatio",2);Cn([Y({type:Boolean,attribute:"show-legend"})],fr.prototype,"showLegend",2);Cn([Y({type:Boolean,attribute:"show-tooltip"})],fr.prototype,"showTooltip",2);Cn([yt()],fr.prototype,"_tooltip",2);Cn([yt()],fr.prototype,"_empty",2);Cn([yt()],fr.prototype,"_legendSlices",2);fr=Cn([Xt("ui9000-pie-chart")],fr);function k1(){customElements.get("ui9000-pie-chart")||customElements.define("ui9000-pie-chart",fr)}k1();const w9=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000PieChart(){return fr},formatPieLegendLabel:m9,formatPiePercent:ri,legendSlicesFromPieOrder:kc,normalizePieData:wc,pieChartMetadata:X_,registerPieChart:k1,renderPieChart:$c},Symbol.toStringTag,{value:"Module"})),S1=25,A1=.3;function z1(t){if(!Number.isFinite(t)||t<=0)return 0;const e=Math.max(t*A1,S1);return Math.max(0,t-e)}var k9=Object.defineProperty,S9=Object.getOwnPropertyDescriptor,gi=(t,e,n,i)=>{for(var r=i>1?void 0:i?S9(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&k9(e,n,r),r};let Tr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._legendSlices=[],this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return wc(t)}renderLegend(){if(!this.showLegend||!this._legendSlices.length)return st;const t=wt(this);return ce(Nr(this._legendSlices.map(e=>`${ri(e.percentage)}% - ${e.label}`),t,(e,n)=>{var i;return((i=this._legendSlices[n])==null?void 0:i.color)??t.primary}))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.slices.length===0,this._empty){e.replaceChildren(),this._legendSlices=[];return}wt(this);const{width:i,height:r}=T_(e),a=Math.min(i,r)/2,s=z1(a);$c(e,{slices:n.slices,width:i,height:r,innerRadius:s,showTooltip:this.showTooltip,onLayout:l=>{this._legendSlices=kc(n,l)},onHover:this.showTooltip?({slice:l,event:c})=>{var u,d,h,p,m,v;const b=this.getBoundingClientRect(),g=n.xField??"Category",$=n.yField??"Value",_=((d=(u=n.axisDetails)==null?void 0:u[g])==null?void 0:d.label)??g,y=((p=(h=n.axisDetails)==null?void 0:h[$])==null?void 0:p.label)??$,S=((v=(m=n.axisDetails)==null?void 0:m[$])==null?void 0:v.measure_unit_symbol)??"",w=S?`${l.value.toLocaleString()} ${S}`.trim():l.value.toLocaleString();this._tooltip={x:c.clientX-b.left,y:c.clientY-b.top,xLabel:`${_}: ${l.label}`,yLabel:`${y}: ${w} (${ri(l.percentage)}%)`}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle();return ot`
1657
+ <div class="widget-shell" part="shell">
1658
+ ${this.renderShellHeader(t)}
1659
+ <div class="widget-body">
1660
+ ${this.renderLegend()}
1661
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1662
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1663
+ ${this._tooltip?ot`<div
1664
+ class="tooltip"
1665
+ part="tooltip"
1666
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1667
+ >
1668
+ <div>${this._tooltip.xLabel}</div>
1669
+ <div>${this._tooltip.yLabel}</div>
1670
+ </div>`:st}
1671
+ ${this.renderShellLabelTooltip()}
1672
+ </div>
1673
+ </div>
1674
+ `}};Tr.styles=[_f,ne];gi([Y({type:String,attribute:"scale"})],Tr.prototype,"scale",2);gi([Y({type:Boolean,attribute:"show-legend"})],Tr.prototype,"showLegend",2);gi([Y({type:Boolean,attribute:"show-tooltip"})],Tr.prototype,"showTooltip",2);gi([yt()],Tr.prototype,"_tooltip",2);gi([yt()],Tr.prototype,"_empty",2);gi([yt()],Tr.prototype,"_legendSlices",2);Tr=gi([Xt("ui9000-donut-chart")],Tr);function T1(){customElements.get("ui9000-donut-chart")||customElements.define("ui9000-donut-chart",Tr)}T1();const A9=Object.freeze(Object.defineProperty({__proto__:null,DONUT_THICKNESS_RATIO:A1,MIN_DONUT_THICKNESS:S1,get Ui9000DonutChart(){return Tr},computeDonutInnerRadius:z1,donutChartMetadata:H_,formatDonutPercent:ri,legendSlicesFromDonutOrder:kc,normalizeDonutData:wc,registerDonutChart:T1,renderDonutChart:$c},Symbol.toStringTag,{value:"Module"}));function L1(t){return Math.abs(t)===Math.PI/2?"middle":t<Math.PI/2&&t>-Math.PI/2?"start":"end"}function C1(t){if(t<=0)return[];const e=Math.PI*2/t;return Array.from({length:t},(n,i)=>({startAngle:i*e,endAngle:(i+1)*e}))}function I1(t,e){return!Number.isFinite(t)||t<=0||e<=0?[]:Array.from({length:e},(n,i)=>(i+1)*t/e)}function $f(t){let e=0;for(const n of t)n.value>e&&(e=n.value);return e}function z9(t,e){const i=t.reduce((o,a)=>Math.max(o,String(a).length),0)*f.polarCategoryLabelSize*f.polarLabelCharWidth,r=Math.min(f.polarLabelGutterMax,Math.max(0,e)*f.polarLabelGutterMaxFraction);return Math.max(f.polarLabelGutterMin,Math.min(i,r))}function T9(t,e,n){const i=t/2-n-f.polarCategoryLabelOffset,r=e/2-f.polarCategoryLabelOffset-f.polarCategoryLabelSize/2;return Math.max(0,Math.min(i,r))}const cy="polar-area-path",Xu="polar-tick-group";function L9(t,e,n,i,r){var o;const a=(o=t==null?void 0:t.getBBox)==null?void 0:o.call(t);if(a&&a.width>0)return a;const s=e.length*n*.6;return{x:i-s/2,y:r-n/2,width:s,height:n}}function C9(t,e,n){t.selectAll("circle").data(e).enter().append("circle").attr("r",i=>n(i)).attr("fill","none").attr("stroke",f.polarGridStroke).attr("stroke-opacity",(i,r)=>(r+1)*f.polarGridStepOpacity)}function I9(t,e,n){const i=Math.PI*2/e.length;for(let r=0;r<e.length;r+=1){const o=i*r-Math.PI/2,a=n*Math.cos(o),s=n*Math.sin(o);t.append("line").attr("x1",0).attr("y1",0).attr("x2",a).attr("y2",s).attr("stroke",f.polarGridStroke).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-dasharray",f.polarSpokeDash),t.append("circle").attr("cx",a).attr("cy",s).attr("r",f.polarSpokeCapRadius).attr("fill",f.polarGridStroke)}}function M9(t,e,n,i,r){const o=Math.PI*2/e.length,a=n+f.polarCategoryLabelOffset;e.forEach((s,l)=>{const c=o*l-Math.PI/2+o/2,u=a*Math.cos(c),d=L1(c),h=d==="start"?i-u:d==="end"?i+u:2*Math.min(i-u,i+u),p=t.append("text").attr("x",u).attr("y",a*Math.sin(c)).attr("text-anchor",d).attr("font-size",f.polarCategoryLabelSize).attr("dominant-baseline","central").attr("fill",f.polarCategoryLabelFill);fo(p,s,{...r,slotWidth:h,fontSize:f.polarCategoryLabelSize})})}function N9(t,e,n,i,r){const o=i.background&&i.background!=="transparent"?i.background:r==="dark"?f.polarTickPillDark:f.polarTickPill;t.selectAll("g").data(e).enter().append("g").attr("class",Xu).each(function(a){const s=ht(this),l=Pt(a,2),c=-n(a),u=s.append("text").attr("x",0).attr("y",c).attr("font-size",f.polarCategoryLabelSize).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",i.text).text(l),d=L9(u.node(),l,f.polarCategoryLabelSize,0,c);s.insert("rect","text").attr("x",d.x-f.polarTickPillPadX).attr("y",d.y-f.polarTickPillPadY).attr("width",d.width+f.polarTickPillPadX*2).attr("height",d.height+f.polarTickPillPadY*2).attr("rx",f.polarTickPillRadius).attr("ry",f.polarTickPillRadius).attr("fill",o)})}function M1(t,e){const{model:n,width:i,height:r,margin:o,theme:a,themeMode:s="light",showGrid:l=!0,showTooltip:c=!0,onHover:u,onLeave:d,onAxisLabelHover:h,onAxisLabelLeave:p}=e;t.replaceChildren();const m=i-o.left-o.right,v=r-o.top-o.bottom,b=z9(n.categories,m),g=T9(m,v,b);if(!n.sectors.length||g<=0||!n.maxValue)return;const $=Ft().domain([0,n.maxValue]).rangeRound([0,g]).nice(),_=$(n.maxValue),y=I1(n.maxValue,f.polarRadialSteps),w=ht(t).append("svg").attr("width",i).attr("height",r).attr("viewBox",`0 0 ${i} ${r}`).append("g").attr("transform",`translate(${i/2}, ${r/2})`);if(l){const M=w.append("g").attr("class","polar-grid").attr("pointer-events","none");C9(M,y,$),I9(M,n.categories,_)}g>=f.polarMinLabelRadius&&M9(w.append("g").attr("class","polar-category-labels"),n.categories,_,i/2,{onAxisLabelHover:h,onAxisLabelLeave:p});const L=C1(n.sectors.length),N=Na().innerRadius(0).outerRadius(M=>$(M.sector.value)).startAngle(M=>M.startAngle).endAngle(M=>M.endAngle),E=s==="dark"?f.donutSliceStrokeDark:f.donutSliceStroke,H=w.append("g").attr("class","polar-sectors").selectAll("path").data(n.sectors.map((M,z)=>({sector:M,...L[z]}))).enter().append("path").attr("class",cy).attr("d",N).attr("fill",M=>M.sector.color).attr("opacity",f.polarSectorOpacity).attr("stroke",E).attr("stroke-width",f.donutSliceStrokeWidth),F=g>=f.polarRadialSteps*f.polarTickPillRowHeight;if(l&&F&&N9(w.append("g").attr("class","polar-ticks").attr("pointer-events","none"),y,$,a,s),!c||!u)return;const W=w.selectAll(`.${cy}, .${Xu}`);H.style("cursor","pointer").on("mouseenter",function(M,z){W.attr("opacity",f.polarSectorOpacityDimmed),ht(this).attr("opacity",1),u({sector:z.sector,event:M})}).on("mousemove",(M,z)=>{u({sector:z.sector,event:M})}).on("mouseleave",()=>{H.attr("opacity",f.polarSectorOpacity),w.selectAll(`.${Xu}`).attr("opacity",1),d==null||d()})}const Oi={sectors:[],categories:[],legend:[],maxValue:0};function D9(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!=null&&typeof e=="object"&&"label"in e&&"value"in e}function O9(t){return!!t&&typeof t=="object"&&Array.isArray(t.points)}function P9(t){const e=t.uniqueValues??{},n=Object.keys(e)[0];return n?ci((e[n]??[]).map(String)):[]}function E9(t,e){return t.map(n=>({key:n,label:n,color:zt(e,n,t.length)}))}function F9(t,e,n,i){const r=new Map(n.map(s=>[s.key,s.color])),o=zt(i,"default",n.length||1),a=t.map(s=>({key:s.key,label:s.key,value:s.value,color:r.get(s.key)??o}));return{sectors:a,categories:e,legend:n,maxValue:$f(a)}}function R9(t){var e,n;const i=ft(t.xAxe),r=ft(t.yAxe);if(!i||!r)return Oi;const o=[];for(const p of se(t)){const m=p[i],v=Number(p[r]);m==null||m===""||!Number.isFinite(v)||o.push({key:String(m),value:v})}if(!o.length)return Oi;const a=Array.from(new Set(o.map(p=>p.key))),s=(((e=t.uniqueValues)==null?void 0:e[i])??[]).map(String).filter(p=>a.includes(p)),l=s.length?s:a,c=pi(t);let u=o;if((((n=t.formatting)==null?void 0:n.length)??0)>1){const p=new Map;for(const m of o)p.set(m.key,(p.get(m.key)??0)+m.value);u=Array.from(p,([m,v])=>({key:m,value:v}))}const d=l.flatMap(p=>u.filter(m=>m.key===p));return{...F9(d,l,E9(P9(t),c),c),xField:i,yField:r,axisDetails:t.axisDetails??void 0}}function uy(t){const e=t.map(r=>({key:String(r.label),value:Number(r.value),color:r.color})).filter(r=>r.key&&Number.isFinite(r.value));if(!e.length)return Oi;const n=Da(0,e.length),i=e.map((r,o)=>({key:r.key,label:r.key,value:r.value,color:r.color??n[o%n.length]}));return{sectors:i,categories:i.map(r=>r.key),legend:i.map(({key:r,label:o,color:a})=>({key:r,label:o,color:a})),maxValue:$f(i)}}function N1(t){return t?Array.isArray(t)?D9(t)?uy(t):Oi:Ht(t)?R9(t):O9(t)?uy(t.points.map(e=>({label:String(e.x),value:Number(e.y)}))):Array.isArray(t.sectors)?t:Oi:Oi}var j9=Object.defineProperty,U9=Object.getOwnPropertyDescriptor,yi=(t,e,n,i)=>{for(var r=i>1?void 0:i?U9(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&j9(e,n,r),r};const B9={sectors:[],categories:[],legend:[],maxValue:0};let Lr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){return N1(Ot(this.dataJson,null))}renderLegend(t){if(!this.showLegend||!t.legend.length)return st;const e=wt(this);return ce(Nr(t.legend.map(n=>n.label),e,(n,i)=>t.legend[i].color))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.sectors.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=mC(e,this.scale);M1(e,{model:n,width:r,height:o,margin:a,theme:i,showGrid:this.showGrid,showTooltip:this.showTooltip,...this.axisLabelHandlers(),onHover:this.showTooltip?({sector:s,event:l})=>{var c,u,d,h,p,m;const v=this.getBoundingClientRect(),b=n.xField??"Category",g=n.yField??"Value",$=((u=(c=n.axisDetails)==null?void 0:c[g])==null?void 0:u.measure_unit_symbol)??"",_=s.value.toLocaleString();this._tooltip={x:l.clientX-v.left,y:l.clientY-v.top,xLabel:`${((h=(d=n.axisDetails)==null?void 0:d[b])==null?void 0:h.label)??b}: ${s.label}`,yLabel:`${((m=(p=n.axisDetails)==null?void 0:p[g])==null?void 0:m.label)??g}: ${$?`${_} ${$}`:_}`}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this._empty?B9:this.parseData();return ot`
1675
+ <div class="widget-shell" part="shell">
1676
+ ${this.renderShellHeader(this.headerTitle())}
1677
+ <div class="widget-body">
1678
+ ${this.renderLegend(t)}
1679
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1680
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1681
+ ${this._tooltip?ot`<div
1682
+ class="tooltip"
1683
+ part="tooltip"
1684
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1685
+ >
1686
+ <div>${this._tooltip.xLabel}</div>
1687
+ <div>${this._tooltip.yLabel}</div>
1688
+ </div>`:st}
1689
+ ${this.renderShellLabelTooltip()}
1690
+ </div>
1691
+ </div>
1692
+ `}};Lr.styles=[_f,ne];yi([Y({type:String,attribute:"scale"})],Lr.prototype,"scale",2);yi([Y({type:Boolean,attribute:"show-grid"})],Lr.prototype,"showGrid",2);yi([Y({type:Boolean,attribute:"show-legend"})],Lr.prototype,"showLegend",2);yi([Y({type:Boolean,attribute:"show-tooltip"})],Lr.prototype,"showTooltip",2);yi([yt()],Lr.prototype,"_tooltip",2);yi([yt()],Lr.prototype,"_empty",2);Lr=yi([Xt("ui9000-polar-area-chart")],Lr);function D1(){customElements.get("ui9000-polar-area-chart")||customElements.define("ui9000-polar-area-chart",Lr)}D1();const H9=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000PolarAreaChart(){return Lr},normalizePolarAreaData:N1,polarAreaChartMetadata:Q_,polarLabelAnchor:L1,polarMaxValue:$f,polarRadialTicks:I1,polarSectorAngles:C1,registerPolarAreaChart:D1,renderPolarAreaChart:M1},Symbol.toStringTag,{value:"Module"}));function Qu(t,e=.05){const n=t.filter(Number.isFinite);if(!n.length)return[0,1];const i=Math.min(...n),r=Math.max(...n),o=r-i,a=o>0?o*e:1;return[i-a,r+a]}function q9(t){switch(t){case"cross":return ef;case"square":case"rhombus":return rf;case"triangle":return nf;default:return pc}}function G9(t){return t==="rhombus"||t==="cross"?45:0}function dy(t,e,n){const i=n==null?void 0:n[e];return(i==null?void 0:i.measure_unit_type)==="percentage"&&Math.abs(t)<=1?(t*100).toFixed(0):Pt(t)}function O1(t,e){const{points:n,width:i,height:r,margin:o={...f.scatterMargin},xField:a,yField:s,showGrid:l=!0,showReferenceLine:c=!1,axisDetails:u,showTooltip:d=!0,onHover:h,onLeave:p}=e;if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const m=Math.max(0,i-o.left-o.right),v=Math.max(0,r-o.top-o.bottom);if(m<=0||v<=0)return;const b=n.map(k=>k.x),g=n.map(k=>k.y),[$,_]=Qu(b),[y,S]=Qu(g),w=Ft().domain([$,_]).range([0,m]).nice(),L=Ft().domain([y,S]).range([v,0]).nice(),N=ge(v),E=ge(m),H=f.gridStroke,F=f.axisStroke,W=f.axisLabelFill,z=ht(t).append("svg").attr("width",i).attr("height",r).attr("viewBox",`0 0 ${i} ${r}`).append("g").attr("transform",`translate(${o.left},${o.top})`);if(l&&(z.append("g").attr("class","y-grid").call(Jt(L).ticks(N).tickSize(-m).tickFormat(()=>"")).call(k=>k.select(".domain").remove()).selectAll("line").attr("stroke",H).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1),z.append("g").attr("class","x-grid").call(ae(w).ticks(E).tickSize(v).tickFormat(()=>"")).call(k=>k.select(".domain").remove()).selectAll("line").attr("stroke",H).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1)),z.append("g").attr("class","y-axis").call(Jt(L).ticks(N).tickSize(0).tickPadding(8).tickFormat(k=>{const x=typeof k=="number"?k:k.valueOf();return Number.isInteger(x)?dy(x,s,u):""})).call(k=>k.select(".domain").remove()).selectAll("text").attr("dx",`-${o.left-10}px`).attr("fill",W).attr("font-size",f.axisLabelSize).attr("text-anchor","start"),z.selectAll(".y-axis .tick").append("line").attr("x1",-8).attr("x2",0).attr("y1",0).attr("y2",0).attr("stroke",F).attr("stroke-width",1),z.append("g").attr("class","x-axis").attr("transform",`translate(0,${v})`).call(ae(w).ticks(E).tickSizeOuter(0).tickSize(0).tickPadding(8).tickFormat(k=>{const x=typeof k=="number"?k:k.valueOf();return Number.isInteger(x)?dy(x,a,u):""})).call(k=>k.select(".domain").attr("stroke",F)),c){const k=Math.max(w.domain()[0],L.domain()[0]),x=Math.min(w.domain()[1],L.domain()[1]);z.append("line").attr("x1",w(k)).attr("y1",L(k)).attr("x2",w(x)).attr("y2",L(x)).attr("stroke",f.scatterReferenceLine).attr("stroke-dasharray","5,5").attr("stroke-width",2).attr("pointer-events","none")}const T=z.append("g").attr("class","scatter-markers"),C=T.selectAll("path").data(n).enter().append("g").attr("class","scatterplot-marker-container").attr("opacity",1).each(function(k){const x=k.markerShape,A=Po().type(q9(x)).size(f.scatterMarkerSize),D=G9(x),R=x==="donut";ht(this).append("path").attr("class","scatterplot-marker").attr("d",A).attr("transform",`translate(${w(k.x)},${L(k.y)}) rotate(${D})`).attr("fill",R?"none":k.color).attr("stroke",k.color).attr("stroke-width",R?1.5:0)});d&&h&&C.style("cursor","pointer").on("mouseenter",function(k,x){T.selectAll(".scatterplot-marker-container").attr("opacity",f.donutArcOpacityDimmed),ht(this).attr("opacity",1),h({point:x,event:k})}).on("mousemove",(k,x)=>{h({point:x,event:k})}).on("mouseleave",()=>{T.selectAll(".scatterplot-marker-container").attr("opacity",1),p==null||p()})}const V9=ie`
1693
+ :host {
1694
+ display: block;
1695
+ position: relative;
1696
+ width: 100%;
1697
+ height: 100%;
1698
+ min-height: 220px;
1699
+ color: var(--ui9000-color-text, #111827);
1700
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1701
+ box-sizing: border-box;
1702
+ }
1703
+ .chart-root {
1704
+ flex: 1;
1705
+ min-height: 0;
1706
+ width: 100%;
1707
+ height: 100%;
1708
+ min-height: inherit;
1709
+ }
1710
+ .tooltip {
1711
+ position: absolute;
1712
+ pointer-events: none;
1713
+ z-index: 2;
1714
+ padding: 6px 10px;
1715
+ border-radius: 6px;
1716
+ font-size: 12px;
1717
+ line-height: 1.35;
1718
+ background: var(--ui9000-color-text, #111827);
1719
+ color: #fff;
1720
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
1721
+ transform: translate(-50%, calc(-100% - 10px));
1722
+ white-space: nowrap;
1723
+ }
1724
+ .empty {
1725
+ display: grid;
1726
+ place-items: center;
1727
+ height: 100%;
1728
+ min-height: inherit;
1729
+ color: var(--ui9000-color-text-muted, #6b7280);
1730
+ font-size: 0.875rem;
1731
+ text-align: center;
1732
+ padding: 8px;
1733
+ }
1734
+ `,To={points:[],xField:"",yField:"",groups:[]};function hy(t,e){return!!e&&t.some(n=>Number.isFinite(Number(n[e])))}function py(t,e,n,i){if(e&&hy(t,e))return e;if(!t.length)return e??"";for(const r of Object.keys(t[0]??{}))if(!(r===n||r===i)&&hy(t,r))return r;return e??""}function Z9(t,e){var n;return((n=t.find(i=>i.key===e))==null?void 0:n.shape)??"circle"}function W9(t){const e=t.map(r=>{const o=Number(r.x),a=Number(r.y);if(!Number.isFinite(o)||!Number.isFinite(a))return null;const s=r.group!=null?String(r.group):"default";return{x:o,y:a,groupKey:s,color:r.color??zt(void 0,s,t.length),markerShape:"circle",row:{x:o,y:a,group:s}}}).filter(r=>r!=null),n=[...new Set(e.map(r=>r.groupKey))],i=n.map(r=>{var o;return{key:r,label:r,color:((o=e.find(a=>a.groupKey===r))==null?void 0:o.color)??zt(void 0,r,n.length),shape:"circle"}});return{points:e,xField:"x",yField:"y",groupField:e.some(r=>r.groupKey!=="default")?"group":void 0,groups:i}}function K9(t){const e=se(t),n=ft(t.xAxe),i=ft(t.yAxe),r=x$(t),o=py(e,n,i??"",r),a=py(e,i,o,r);if(!o||!a)return To;const s=pi(t),l=Oa(t),c=r?me(e.map(v=>String(v[r]??"")).filter(Boolean),t.uniqueValues,r):["default"],u=r?ci(c):["default"],d=u.map(v=>({key:v,label:v,color:zt(s,v,u.length),shape:Z9(l,v)})),h=new Map(d.map(v=>[v.key,v.color])),p=new Map(d.map(v=>[v.key,v.shape])),m=[];for(const v of e){const b=Number(v[o]),g=Number(v[a]);if(!Number.isFinite(b)||!Number.isFinite(g))continue;const $=r?String(v[r]??"default"):"default";m.push({x:b,y:g,groupKey:$,color:h.get($)??zt(s,$,d.length),markerShape:p.get($)??"circle",row:v})}return{points:m,xField:o,yField:a,groupField:r??void 0,groups:d,axisDetails:t.axisDetails}}function P1(t){return t?Array.isArray(t)?t.length&&"x"in t[0]&&"y"in t[0]?W9(t):To:Ht(t)?K9(t):typeof t=="object"&&Array.isArray(t.points)?t:To:To}var Y9=Object.defineProperty,J9=Object.getOwnPropertyDescriptor,In=(t,e,n,i)=>{for(var r=i>1?void 0:i?J9(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&Y9(e,n,r),r};let mr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.showReferenceLine=!1,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return P1(t)}renderLegend(t){if(!this.showLegend||t.groups.length<=1)return st;const e=wt(this);return ce(Nr(t.groups.map(n=>n.label),e,(n,i)=>{var r;return((r=t.groups[i])==null?void 0:r.color)??e.primary}))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.points.length===0,this._empty){e.replaceChildren();return}wt(this);const{width:i,height:r,margin:o}=dC(e);O1(e,{points:n.points,width:i,height:r,margin:o,xField:n.xField,yField:n.yField,showGrid:this.showGrid,showReferenceLine:this.showReferenceLine,axisDetails:n.axisDetails,showTooltip:this.showTooltip,onHover:this.showTooltip?({point:a,event:s})=>{var l,c,u,d,h,p;const m=this.getBoundingClientRect(),v=((c=(l=n.axisDetails)==null?void 0:l[n.xField])==null?void 0:c.label)??n.xField,b=((d=(u=n.axisDetails)==null?void 0:u[n.yField])==null?void 0:d.label)??n.yField,g=[`${v}: ${a.x}`,`${b}: ${a.y}`];if(n.groupField){const $=((p=(h=n.axisDetails)==null?void 0:h[n.groupField])==null?void 0:p.label)??n.groupField;g.push(`${$}: ${a.groupKey}`)}this._tooltip={x:s.clientX-m.left,y:s.clientY-m.top,lines:g}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?null:this.parseData();return ot`
1735
+ <div class="widget-shell" part="shell">
1736
+ ${this.renderShellHeader(t)}
1737
+ <div class="widget-body">
1738
+ ${e?this.renderLegend(e):st}
1739
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1740
+ ${this._empty?ot`<div class="empty" part="empty">
1741
+ Scatterplot requires two numeric fields. Pick numeric X and Y axes.
1742
+ </div>`:st}
1743
+ ${this._tooltip?ot`<div
1744
+ class="tooltip"
1745
+ part="tooltip"
1746
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1747
+ >
1748
+ ${this._tooltip.lines.map(n=>ot`<div>${n}</div>`)}
1749
+ </div>`:st}
1750
+ ${this.renderShellLabelTooltip()}
1751
+ </div>
1752
+ </div>
1753
+ `}};mr.styles=[V9,ne];In([Y({type:String,attribute:"scale"})],mr.prototype,"scale",2);In([Y({type:Boolean,attribute:"show-grid"})],mr.prototype,"showGrid",2);In([Y({type:Boolean,attribute:"show-legend"})],mr.prototype,"showLegend",2);In([Y({type:Boolean,attribute:"show-tooltip"})],mr.prototype,"showTooltip",2);In([Y({type:Boolean,attribute:"show-reference-line"})],mr.prototype,"showReferenceLine",2);In([yt()],mr.prototype,"_tooltip",2);In([yt()],mr.prototype,"_empty",2);mr=In([Xt("ui9000-scatter-plot")],mr);function E1(){customElements.get("ui9000-scatter-plot")||customElements.define("ui9000-scatter-plot",mr)}E1();const X9=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000ScatterPlot(){return mr},normalizeScatterData:P1,paddedLinearDomain:Qu,registerScatterPlot:E1,renderScatterPlot:O1,scatterPlotChartMetadata:i$},Symbol.toStringTag,{value:"Module"}));var Q9={value:()=>{}};function Ea(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new ds(n)}function ds(t){this._=t}function t3(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}ds.prototype=Ea.prototype={constructor:ds,on:function(t,e){var n=this._,i=t3(t+"",n),r,o=-1,a=i.length;if(arguments.length<2){for(;++o<a;)if((r=(t=i[o]).type)&&(r=e3(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<a;)if(r=(t=i[o]).type)n[r]=fy(n[r],t.name,e);else if(e==null)for(r in n)n[r]=fy(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ds(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function e3(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function fy(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Q9,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}const r3={passive:!1},ta={capture:!0,passive:!1};function ou(t){t.stopImmediatePropagation()}function Pi(t){t.preventDefault(),t.stopImmediatePropagation()}function F1(t){var e=t.document.documentElement,n=ht(t).on("dragstart.drag",Pi,ta);"onselectstart"in e?n.on("selectstart.drag",Pi,ta):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function R1(t,e){var n=t.document.documentElement,i=ht(t).on("dragstart.drag",null);e&&(i.on("click.drag",Pi,ta),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const es=t=>()=>t;function td(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}td.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function n3(t){return!t.ctrlKey&&!t.button}function i3(){return this.parentNode}function o3(t,e){return e??{x:t.x,y:t.y}}function a3(){return navigator.maxTouchPoints||"ontouchstart"in this}function s3(){var t=n3,e=i3,n=o3,i=a3,r={},o=Ea("start","drag","end"),a=0,s,l,c,u,d=0;function h(y){y.on("mousedown.drag",p).filter(i).on("touchstart.drag",b).on("touchmove.drag",g,r3).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(y,S){if(!(u||!t.call(this,y,S))){var w=_(this,e.call(this,y,S),y,S,"mouse");w&&(ht(y.view).on("mousemove.drag",m,ta).on("mouseup.drag",v,ta),F1(y.view),ou(y),c=!1,s=y.clientX,l=y.clientY,w("start",y))}}function m(y){if(Pi(y),!c){var S=y.clientX-s,w=y.clientY-l;c=S*S+w*w>d}r.mouse("drag",y)}function v(y){ht(y.view).on("mousemove.drag mouseup.drag",null),R1(y.view,c),Pi(y),r.mouse("end",y)}function b(y,S){if(t.call(this,y,S)){var w=y.changedTouches,L=e.call(this,y,S),N=w.length,E,H;for(E=0;E<N;++E)(H=_(this,L,y,S,w[E].identifier,w[E]))&&(ou(y),H("start",y,w[E]))}}function g(y){var S=y.changedTouches,w=S.length,L,N;for(L=0;L<w;++L)(N=r[S[L].identifier])&&(Pi(y),N("drag",y,S[L]))}function $(y){var S=y.changedTouches,w=S.length,L,N;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),L=0;L<w;++L)(N=r[S[L].identifier])&&(ou(y),N("end",y,S[L]))}function _(y,S,w,L,N,E){var H=o.copy(),F=Ie(E||w,S),W,M,z;if((z=n.call(y,new td("beforestart",{sourceEvent:w,target:h,identifier:N,active:a,x:F[0],y:F[1],dx:0,dy:0,dispatch:H}),L))!=null)return W=z.x-F[0]||0,M=z.y-F[1]||0,function T(C,k,x){var A=F,D;switch(C){case"start":r[N]=T,D=a++;break;case"end":delete r[N],--a;case"drag":F=Ie(x||k,S),D=a;break}H.call(C,y,new td(C,{sourceEvent:k,subject:z,target:h,identifier:N,active:D,x:F[0]+W,y:F[1]+M,dx:F[0]-A[0],dy:F[1]-A[1],dispatch:H}),L)}}return h.filter=function(y){return arguments.length?(t=typeof y=="function"?y:es(!!y),h):t},h.container=function(y){return arguments.length?(e=typeof y=="function"?y:es(y),h):e},h.subject=function(y){return arguments.length?(n=typeof y=="function"?y:es(y),h):n},h.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:es(!!y),h):i},h.on=function(){var y=o.on.apply(o,arguments);return y===o?h:y},h.clickDistance=function(y){return arguments.length?(d=(y=+y)*y,h):Math.sqrt(d)},h}function l3(t,e){var n,i=1;t==null&&(t=0),e==null&&(e=0);function r(){var o,a=n.length,s,l=0,c=0;for(o=0;o<a;++o)s=n[o],l+=s.x,c+=s.y;for(l=(l/a-t)*i,c=(c/a-e)*i,o=0;o<a;++o)s=n[o],s.x-=l,s.y-=c}return r.initialize=function(o){n=o},r.x=function(o){return arguments.length?(t=+o,r):t},r.y=function(o){return arguments.length?(e=+o,r):e},r.strength=function(o){return arguments.length?(i=+o,r):i},r}function c3(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return j1(this.cover(e,n),e,n,t)}function j1(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o=t._root,a={data:i},s=t._x0,l=t._y0,c=t._x1,u=t._y1,d,h,p,m,v,b,g,$;if(!o)return t._root=a,t;for(;o.length;)if((v=e>=(d=(s+c)/2))?s=d:c=d,(b=n>=(h=(l+u)/2))?l=h:u=h,r=o,!(o=o[g=b<<1|v]))return r[g]=a,t;if(p=+t._x.call(null,o.data),m=+t._y.call(null,o.data),e===p&&n===m)return a.next=o,r?r[g]=a:t._root=a,t;do r=r?r[g]=new Array(4):t._root=new Array(4),(v=e>=(d=(s+c)/2))?s=d:c=d,(b=n>=(h=(l+u)/2))?l=h:u=h;while((g=b<<1|v)===($=(m>=h)<<1|p>=d));return r[$]=o,r[g]=a,t}function u3(t){var e,n,i=t.length,r,o,a=new Array(i),s=new Array(i),l=1/0,c=1/0,u=-1/0,d=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=r,s[n]=o,r<l&&(l=r),r>u&&(u=r),o<c&&(c=o),o>d&&(d=o));if(l>u||c>d)return this;for(this.cover(l,c).cover(u,d),n=0;n<i;++n)j1(this,a[n],s[n],t[n]);return this}function d3(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,o=(i=Math.floor(e))+1;else{for(var a=r-n||1,s=this._root,l,c;n>t||t>=r||i>e||e>=o;)switch(c=(e<i)<<1|t<n,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:r=n+a,o=i+a;break;case 1:n=r-a,o=i+a;break;case 2:r=n+a,i=o-a;break;case 3:n=r-a,i=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this}function h3(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function p3(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function De(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function f3(t,e,n){var i,r=this._x0,o=this._y0,a,s,l,c,u=this._x1,d=this._y1,h=[],p=this._root,m,v;for(p&&h.push(new De(p,r,o,u,d)),n==null?n=1/0:(r=t-n,o=e-n,u=t+n,d=e+n,n*=n);m=h.pop();)if(!(!(p=m.node)||(a=m.x0)>u||(s=m.y0)>d||(l=m.x1)<r||(c=m.y1)<o))if(p.length){var b=(a+l)/2,g=(s+c)/2;h.push(new De(p[3],b,g,l,c),new De(p[2],a,g,b,c),new De(p[1],b,s,l,g),new De(p[0],a,s,b,g)),(v=(e>=g)<<1|t>=b)&&(m=h[h.length-1],h[h.length-1]=h[h.length-1-v],h[h.length-1-v]=m)}else{var $=t-+this._x.call(null,p.data),_=e-+this._y.call(null,p.data),y=$*$+_*_;if(y<n){var S=Math.sqrt(n=y);r=t-S,o=e-S,u=t+S,d=e+S,i=p.data}}return i}function m3(t){if(isNaN(u=+this._x.call(null,t))||isNaN(d=+this._y.call(null,t)))return this;var e,n=this._root,i,r,o,a=this._x0,s=this._y0,l=this._x1,c=this._y1,u,d,h,p,m,v,b,g;if(!n)return this;if(n.length)for(;;){if((m=u>=(h=(a+l)/2))?a=h:l=h,(v=d>=(p=(s+c)/2))?s=p:c=p,e=n,!(n=n[b=v<<1|m]))return this;if(!n.length)break;(e[b+1&3]||e[b+2&3]||e[b+3&3])&&(i=e,g=b)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,r?(o?r.next=o:delete r.next,this):e?(o?e[b]=o:delete e[b],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[g]=n:this._root=n),this):(this._root=o,this)}function g3(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function y3(){return this._root}function v3(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function b3(t){var e=[],n,i=this._root,r,o,a,s,l;for(i&&e.push(new De(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(i=n.node,o=n.x0,a=n.y0,s=n.x1,l=n.y1)&&i.length){var c=(o+s)/2,u=(a+l)/2;(r=i[3])&&e.push(new De(r,c,u,s,l)),(r=i[2])&&e.push(new De(r,o,u,c,l)),(r=i[1])&&e.push(new De(r,c,a,s,u)),(r=i[0])&&e.push(new De(r,o,a,c,u))}return this}function x3(t){var e=[],n=[],i;for(this._root&&e.push(new De(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var o,a=i.x0,s=i.y0,l=i.x1,c=i.y1,u=(a+l)/2,d=(s+c)/2;(o=r[0])&&e.push(new De(o,a,s,u,d)),(o=r[1])&&e.push(new De(o,u,s,l,d)),(o=r[2])&&e.push(new De(o,a,d,u,c)),(o=r[3])&&e.push(new De(o,u,d,l,c))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function _3(t){return t[0]}function $3(t){return arguments.length?(this._x=t,this):this._x}function w3(t){return t[1]}function k3(t){return arguments.length?(this._y=t,this):this._y}function wf(t,e,n){var i=new kf(e??_3,n??w3,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function kf(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function my(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Re=wf.prototype=kf.prototype;Re.copy=function(){var t=new kf(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=my(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=my(i));return t};Re.add=c3;Re.addAll=u3;Re.cover=d3;Re.data=h3;Re.extent=p3;Re.find=f3;Re.remove=m3;Re.removeAll=g3;Re.root=y3;Re.size=v3;Re.visit=b3;Re.visitAfter=x3;Re.x=$3;Re.y=k3;function Oe(t){return function(){return t}}function xn(t){return(t()-.5)*1e-6}function S3(t){return t.x+t.vx}function A3(t){return t.y+t.vy}function z3(t){var e,n,i,r=1,o=1;typeof t!="function"&&(t=Oe(t==null?1:+t));function a(){for(var c,u=e.length,d,h,p,m,v,b,g=0;g<o;++g)for(d=wf(e,S3,A3).visitAfter(s),c=0;c<u;++c)h=e[c],v=n[h.index],b=v*v,p=h.x+h.vx,m=h.y+h.vy,d.visit($);function $(_,y,S,w,L){var N=_.data,E=_.r,H=v+E;if(N){if(N.index>h.index){var F=p-N.x-N.vx,W=m-N.y-N.vy,M=F*F+W*W;M<H*H&&(F===0&&(F=xn(i),M+=F*F),W===0&&(W=xn(i),M+=W*W),M=(H-(M=Math.sqrt(M)))/M*r,h.vx+=(F*=M)*(H=(E*=E)/(b+E)),h.vy+=(W*=M)*H,N.vx-=F*(H=1-H),N.vy-=W*H)}return}return y>p+H||w<p-H||S>m+H||L<m-H}}function s(c){if(c.data)return c.r=n[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function l(){if(e){var c,u=e.length,d;for(n=new Array(u),c=0;c<u;++c)d=e[c],n[d.index]=+t(d,c,e)}}return a.initialize=function(c,u){e=c,i=u,l()},a.iterations=function(c){return arguments.length?(o=+c,a):o},a.strength=function(c){return arguments.length?(r=+c,a):r},a.radius=function(c){return arguments.length?(t=typeof c=="function"?c:Oe(+c),l(),a):t},a}function T3(t){return t.index}function gy(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function L3(t){var e=T3,n=d,i,r=Oe(30),o,a,s,l,c,u=1;t==null&&(t=[]);function d(b){return 1/Math.min(s[b.source.index],s[b.target.index])}function h(b){for(var g=0,$=t.length;g<u;++g)for(var _=0,y,S,w,L,N,E,H;_<$;++_)y=t[_],S=y.source,w=y.target,L=w.x+w.vx-S.x-S.vx||xn(c),N=w.y+w.vy-S.y-S.vy||xn(c),E=Math.sqrt(L*L+N*N),E=(E-o[_])/E*b*i[_],L*=E,N*=E,w.vx-=L*(H=l[_]),w.vy-=N*H,S.vx+=L*(H=1-H),S.vy+=N*H}function p(){if(a){var b,g=a.length,$=t.length,_=new Map(a.map((S,w)=>[e(S,w,a),S])),y;for(b=0,s=new Array(g);b<$;++b)y=t[b],y.index=b,typeof y.source!="object"&&(y.source=gy(_,y.source)),typeof y.target!="object"&&(y.target=gy(_,y.target)),s[y.source.index]=(s[y.source.index]||0)+1,s[y.target.index]=(s[y.target.index]||0)+1;for(b=0,l=new Array($);b<$;++b)y=t[b],l[b]=s[y.source.index]/(s[y.source.index]+s[y.target.index]);i=new Array($),m(),o=new Array($),v()}}function m(){if(a)for(var b=0,g=t.length;b<g;++b)i[b]=+n(t[b],b,t)}function v(){if(a)for(var b=0,g=t.length;b<g;++b)o[b]=+r(t[b],b,t)}return h.initialize=function(b,g){a=b,c=g,p()},h.links=function(b){return arguments.length?(t=b,p(),h):t},h.id=function(b){return arguments.length?(e=b,h):e},h.iterations=function(b){return arguments.length?(u=+b,h):u},h.strength=function(b){return arguments.length?(n=typeof b=="function"?b:Oe(+b),m(),h):n},h.distance=function(b){return arguments.length?(r=typeof b=="function"?b:Oe(+b),v(),h):r},h}var oo=0,Lo=0,_o=0,U1=1e3,Gs,Co,Vs=0,ni=0,Sc=0,ea=typeof performance=="object"&&performance.now?performance:Date,B1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Sf(){return ni||(B1(C3),ni=ea.now()+Sc)}function C3(){ni=0}function Zs(){this._call=this._time=this._next=null}Zs.prototype=Af.prototype={constructor:Zs,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Sf():+n)+(e==null?0:+e),!this._next&&Co!==this&&(Co?Co._next=this:Gs=this,Co=this),this._call=t,this._time=n,ed()},stop:function(){this._call&&(this._call=null,this._time=1/0,ed())}};function Af(t,e,n){var i=new Zs;return i.restart(t,e,n),i}function I3(){Sf(),++oo;for(var t=Gs,e;t;)(e=ni-t._time)>=0&&t._call.call(void 0,e),t=t._next;--oo}function yy(){ni=(Vs=ea.now())+Sc,oo=Lo=0;try{I3()}finally{oo=0,N3(),ni=0}}function M3(){var t=ea.now(),e=t-Vs;e>U1&&(Sc-=e,Vs=t)}function N3(){for(var t,e=Gs,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Gs=n);Co=t,ed(i)}function ed(t){if(!oo){Lo&&(Lo=clearTimeout(Lo));var e=t-ni;e>24?(t<1/0&&(Lo=setTimeout(yy,t-ea.now()-Sc)),_o&&(_o=clearInterval(_o))):(_o||(Vs=ea.now(),_o=setInterval(M3,U1)),oo=1,B1(yy))}}function vy(t,e,n){var i=new Zs;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}const D3=1664525,O3=1013904223,by=4294967296;function P3(){let t=1;return()=>(t=(D3*t+O3)%by)/by}function E3(t){return t.x}function F3(t){return t.y}var R3=10,j3=Math.PI*(3-Math.sqrt(5));function U3(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=Af(d),c=Ea("tick","end"),u=P3();t==null&&(t=[]);function d(){h(),c.call("tick",e),n<i&&(l.stop(),c.call("end",e))}function h(v){var b,g=t.length,$;v===void 0&&(v=1);for(var _=0;_<v;++_)for(n+=(o-n)*r,s.forEach(function(y){y(n)}),b=0;b<g;++b)$=t[b],$.fx==null?$.x+=$.vx*=a:($.x=$.fx,$.vx=0),$.fy==null?$.y+=$.vy*=a:($.y=$.fy,$.vy=0);return e}function p(){for(var v=0,b=t.length,g;v<b;++v){if(g=t[v],g.index=v,g.fx!=null&&(g.x=g.fx),g.fy!=null&&(g.y=g.fy),isNaN(g.x)||isNaN(g.y)){var $=R3*Math.sqrt(.5+v),_=v*j3;g.x=$*Math.cos(_),g.y=$*Math.sin(_)}(isNaN(g.vx)||isNaN(g.vy))&&(g.vx=g.vy=0)}}function m(v){return v.initialize&&v.initialize(t,u),v}return p(),e={tick:h,restart:function(){return l.restart(d),e},stop:function(){return l.stop(),e},nodes:function(v){return arguments.length?(t=v,p(),s.forEach(m),e):t},alpha:function(v){return arguments.length?(n=+v,e):n},alphaMin:function(v){return arguments.length?(i=+v,e):i},alphaDecay:function(v){return arguments.length?(r=+v,e):+r},alphaTarget:function(v){return arguments.length?(o=+v,e):o},velocityDecay:function(v){return arguments.length?(a=1-v,e):1-a},randomSource:function(v){return arguments.length?(u=v,s.forEach(m),e):u},force:function(v,b){return arguments.length>1?(b==null?s.delete(v):s.set(v,m(b)),e):s.get(v)},find:function(v,b,g){var $=0,_=t.length,y,S,w,L,N;for(g==null?g=1/0:g*=g,$=0;$<_;++$)L=t[$],y=v-L.x,S=b-L.y,w=y*y+S*S,w<g&&(N=L,g=w);return N},on:function(v,b){return arguments.length>1?(c.on(v,b),e):c.on(v)}}}function B3(){var t,e,n,i,r=Oe(-30),o,a=1,s=1/0,l=.81;function c(p){var m,v=t.length,b=wf(t,E3,F3).visitAfter(d);for(i=p,m=0;m<v;++m)e=t[m],b.visit(h)}function u(){if(t){var p,m=t.length,v;for(o=new Array(m),p=0;p<m;++p)v=t[p],o[v.index]=+r(v,p,t)}}function d(p){var m=0,v,b,g=0,$,_,y;if(p.length){for($=_=y=0;y<4;++y)(v=p[y])&&(b=Math.abs(v.value))&&(m+=v.value,g+=b,$+=b*v.x,_+=b*v.y);p.x=$/g,p.y=_/g}else{v=p,v.x=v.data.x,v.y=v.data.y;do m+=o[v.data.index];while(v=v.next)}p.value=m}function h(p,m,v,b){if(!p.value)return!0;var g=p.x-e.x,$=p.y-e.y,_=b-m,y=g*g+$*$;if(_*_/l<y)return y<s&&(g===0&&(g=xn(n),y+=g*g),$===0&&($=xn(n),y+=$*$),y<a&&(y=Math.sqrt(a*y)),e.vx+=g*p.value*i/y,e.vy+=$*p.value*i/y),!0;if(p.length||y>=s)return;(p.data!==e||p.next)&&(g===0&&(g=xn(n),y+=g*g),$===0&&($=xn(n),y+=$*$),y<a&&(y=Math.sqrt(a*y)));do p.data!==e&&(_=o[p.data.index]*i/y,e.vx+=g*_,e.vy+=$*_);while(p=p.next)}return c.initialize=function(p,m){t=p,n=m,u()},c.strength=function(p){return arguments.length?(r=typeof p=="function"?p:Oe(+p),u(),c):r},c.distanceMin=function(p){return arguments.length?(a=p*p,c):Math.sqrt(a)},c.distanceMax=function(p){return arguments.length?(s=p*p,c):Math.sqrt(s)},c.theta=function(p){return arguments.length?(l=p*p,c):Math.sqrt(l)},c}function H3(t){var e=Oe(.1),n,i,r;typeof t!="function"&&(t=Oe(t==null?0:+t));function o(s){for(var l=0,c=n.length,u;l<c;++l)u=n[l],u.vx+=(r[l]-u.x)*i[l]*s}function a(){if(n){var s,l=n.length;for(i=new Array(l),r=new Array(l),s=0;s<l;++s)i[s]=isNaN(r[s]=+t(n[s],s,n))?0:+e(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Oe(+s),a(),o):e},o.x=function(s){return arguments.length?(t=typeof s=="function"?s:Oe(+s),a(),o):t},o}function q3(t){var e=Oe(.1),n,i,r;typeof t!="function"&&(t=Oe(t==null?0:+t));function o(s){for(var l=0,c=n.length,u;l<c;++l)u=n[l],u.vy+=(r[l]-u.y)*i[l]*s}function a(){if(n){var s,l=n.length;for(i=new Array(l),r=new Array(l),s=0;s<l;++s)i[s]=isNaN(r[s]=+t(n[s],s,n))?0:+e(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Oe(+s),a(),o):e},o.y=function(s){return arguments.length?(t=typeof s=="function"?s:Oe(+s),a(),o):t},o}var G3=Ea("start","end","cancel","interrupt"),V3=[],H1=0,xy=1,rd=2,hs=3,_y=4,nd=5,ps=6;function Ac(t,e,n,i,r,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Z3(t,n,{name:e,index:i,group:r,on:G3,tween:V3,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:H1})}function zf(t,e){var n=Pr(t,e);if(n.state>H1)throw new Error("too late; already scheduled");return n}function Wr(t,e){var n=Pr(t,e);if(n.state>hs)throw new Error("too late; already running");return n}function Pr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Z3(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=Af(o,0,n.time);function o(c){n.state=xy,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var u,d,h,p;if(n.state!==xy)return l();for(u in i)if(p=i[u],p.name===n.name){if(p.state===hs)return vy(a);p.state===_y?(p.state=ps,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete i[u]):+u<e&&(p.state=ps,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete i[u])}if(vy(function(){n.state===hs&&(n.state=_y,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=rd,n.on.call("start",t,t.__data__,n.index,n.group),n.state===rd){for(n.state=hs,r=new Array(h=n.tween.length),u=0,d=-1;u<h;++u)(p=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++d]=p);r.length=d+1}}function s(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=nd,1),d=-1,h=r.length;++d<h;)r[d].call(t,u);n.state===nd&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=ps,n.timer.stop(),delete i[e];for(var c in i)return;delete t.__transition}}function fs(t,e){var n=t.__transition,i,r,o=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((i=n[a]).name!==e){o=!1;continue}r=i.state>rd&&i.state<nd,i.state=ps,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[a]}o&&delete t.__transition}}function W3(t){return this.each(function(){fs(this,t)})}function K3(t,e){var n,i;return function(){var r=Wr(this,t),o=r.tween;if(o!==n){i=n=o;for(var a=0,s=i.length;a<s;++a)if(i[a].name===e){i=i.slice(),i.splice(a,1);break}}r.tween=i}}function Y3(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var o=Wr(this,t),a=o.tween;if(a!==i){r=(i=a).slice();for(var s={name:e,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=s;break}l===c&&r.push(s)}o.tween=r}}function J3(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=Pr(this.node(),n).tween,r=0,o=i.length,a;r<o;++r)if((a=i[r]).name===t)return a.value;return null}return this.each((e==null?K3:Y3)(n,t,e))}function Tf(t,e,n){var i=t._id;return t.each(function(){var r=Wr(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return Pr(r,i).value[e]}}function q1(t,e){var n;return(typeof e=="number"?_r:e instanceof ti?Is:(n=ti(e))?(e=n,Is):A$)(t,e)}function X3(t){return function(){this.removeAttribute(t)}}function Q3(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tq(t,e,n){var i,r=n+"",o;return function(){var a=this.getAttribute(t);return a===r?null:a===i?o:o=e(i=a,n)}}function eq(t,e,n){var i,r=n+"",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===r?null:a===i?o:o=e(i=a,n)}}function rq(t,e,n){var i,r,o;return function(){var a,s=n(this),l;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),l=s+"",a===l?null:a===i&&l===r?o:(r=l,o=e(i=a,s)))}}function nq(t,e,n){var i,r,o;return function(){var a,s=n(this),l;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),l=s+"",a===l?null:a===i&&l===r?o:(r=l,o=e(i=a,s)))}}function iq(t,e){var n=dc(t),i=n==="transform"?EF:q1;return this.attrTween(t,typeof e=="function"?(n.local?nq:rq)(n,i,Tf(this,"attr."+t,e)):e==null?(n.local?Q3:X3)(n):(n.local?eq:tq)(n,i,e))}function oq(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function aq(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function sq(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&aq(t,o)),n}return r._value=e,r}function lq(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&oq(t,o)),n}return r._value=e,r}function cq(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=dc(t);return this.tween(n,(i.local?sq:lq)(i,e))}function uq(t,e){return function(){zf(this,t).delay=+e.apply(this,arguments)}}function dq(t,e){return e=+e,function(){zf(this,t).delay=e}}function hq(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?uq:dq)(e,t)):Pr(this.node(),e).delay}function pq(t,e){return function(){Wr(this,t).duration=+e.apply(this,arguments)}}function fq(t,e){return e=+e,function(){Wr(this,t).duration=e}}function mq(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?pq:fq)(e,t)):Pr(this.node(),e).duration}function gq(t,e){if(typeof e!="function")throw new Error;return function(){Wr(this,t).ease=e}}function yq(t){var e=this._id;return arguments.length?this.each(gq(e,t)):Pr(this.node(),e).ease}function vq(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Wr(this,t).ease=n}}function bq(t){if(typeof t!="function")throw new Error;return this.each(vq(this._id,t))}function xq(t){typeof t!="function"&&(t=H$(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],a=o.length,s=i[r]=[],l,c=0;c<a;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&s.push(l);return new nn(i,this._parents,this._name,this._id)}function _q(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),a=new Array(i),s=0;s<o;++s)for(var l=e[s],c=n[s],u=l.length,d=a[s]=new Array(u),h,p=0;p<u;++p)(h=l[p]||c[p])&&(d[p]=h);for(;s<i;++s)a[s]=e[s];return new nn(a,this._parents,this._name,this._id)}function $q(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function wq(t,e,n){var i,r,o=$q(e)?zf:Wr;return function(){var a=o(this,t),s=a.on;s!==i&&(r=(i=s).copy()).on(e,n),a.on=r}}function kq(t,e){var n=this._id;return arguments.length<2?Pr(this.node(),n).on.on(t):this.each(wq(n,t,e))}function Sq(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Aq(){return this.on("end.remove",Sq(this._id))}function zq(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Jp(t));for(var i=this._groups,r=i.length,o=new Array(r),a=0;a<r;++a)for(var s=i[a],l=s.length,c=o[a]=new Array(l),u,d,h=0;h<l;++h)(u=s[h])&&(d=t.call(u,u.__data__,h,s))&&("__data__"in u&&(d.__data__=u.__data__),c[h]=d,Ac(c[h],e,n,h,c,Pr(u,n)));return new nn(o,this._parents,e,n)}function Tq(t){var e=this._name,n=this._id;typeof t!="function"&&(t=B$(t));for(var i=this._groups,r=i.length,o=[],a=[],s=0;s<r;++s)for(var l=i[s],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var h=t.call(u,u.__data__,d,l),p,m=Pr(u,n),v=0,b=h.length;v<b;++v)(p=h[v])&&Ac(p,e,n,v,h,m);o.push(h),a.push(u)}return new nn(o,a,e,n)}var Lq=Ia.prototype.constructor;function Cq(){return new Lq(this._groups,this._parents)}function Iq(t,e){var n,i,r;return function(){var o=Qi(this,t),a=(this.style.removeProperty(t),Qi(this,t));return o===a?null:o===n&&a===i?r:r=e(n=o,i=a)}}function G1(t){return function(){this.style.removeProperty(t)}}function Mq(t,e,n){var i,r=n+"",o;return function(){var a=Qi(this,t);return a===r?null:a===i?o:o=e(i=a,n)}}function Nq(t,e,n){var i,r,o;return function(){var a=Qi(this,t),s=n(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(t),Qi(this,t))),a===l?null:a===i&&l===r?o:(r=l,o=e(i=a,s))}}function Dq(t,e){var n,i,r,o="style."+e,a="end."+o,s;return function(){var l=Wr(this,t),c=l.on,u=l.value[o]==null?s||(s=G1(e)):void 0;(c!==n||r!==u)&&(i=(n=c).copy()).on(a,r=u),l.on=i}}function Oq(t,e,n){var i=(t+="")=="transform"?PF:q1;return e==null?this.styleTween(t,Iq(t,i)).on("end.style."+t,G1(t)):typeof e=="function"?this.styleTween(t,Nq(t,i,Tf(this,"style."+t,e))).each(Dq(this._id,t)):this.styleTween(t,Mq(t,i,e),n).on("end.style."+t,null)}function Pq(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function Eq(t,e,n){var i,r;function o(){var a=e.apply(this,arguments);return a!==r&&(i=(r=a)&&Pq(t,a,n)),i}return o._value=e,o}function Fq(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,Eq(t,e,n??""))}function Rq(t){return function(){this.textContent=t}}function jq(t){return function(){var e=t(this);this.textContent=e??""}}function Uq(t){return this.tween("text",typeof t=="function"?jq(Tf(this,"text",t)):Rq(t==null?"":t+""))}function Bq(t){return function(e){this.textContent=t.call(this,e)}}function Hq(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Bq(r)),e}return i._value=t,i}function qq(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Hq(t))}function Gq(){for(var t=this._name,e=this._id,n=V1(),i=this._groups,r=i.length,o=0;o<r;++o)for(var a=i[o],s=a.length,l,c=0;c<s;++c)if(l=a[c]){var u=Pr(l,e);Ac(l,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new nn(i,this._parents,t,n)}function Vq(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){--r===0&&o()}};n.each(function(){var c=Wr(this,i),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),c.on=e}),r===0&&o()})}var Zq=0;function nn(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function V1(){return++Zq}var Jr=Ia.prototype;nn.prototype={constructor:nn,select:zq,selectAll:Tq,selectChild:Jr.selectChild,selectChildren:Jr.selectChildren,filter:xq,merge:_q,selection:Cq,transition:Gq,call:Jr.call,nodes:Jr.nodes,node:Jr.node,size:Jr.size,empty:Jr.empty,each:Jr.each,on:kq,attr:iq,attrTween:cq,style:Oq,styleTween:Fq,text:Uq,textTween:qq,remove:Aq,tween:J3,delay:hq,duration:mq,ease:yq,easeVarying:bq,end:Vq,[Symbol.iterator]:Jr[Symbol.iterator]};function Wq(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Kq={time:null,delay:0,duration:250,ease:Wq};function Yq(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Jq(t){var e,n;t instanceof nn?(e=t._id,t=t._name):(e=V1(),(n=Kq).time=Sf(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var a=i[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&Ac(l,t,e,c,a,n||Yq(l,e));return new nn(i,this._parents,t,e)}Ia.prototype.interrupt=W3;Ia.prototype.transition=Jq;const rs=t=>()=>t;function Xq(t,{sourceEvent:e,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function tn(t,e,n){this.k=t,this.x=e,this.y=n}tn.prototype={constructor:tn,scale:function(t){return t===1?this:new tn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new tn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Lf=new tn(1,0,0);tn.prototype;function au(t){t.stopImmediatePropagation()}function $o(t){t.preventDefault(),t.stopImmediatePropagation()}function Qq(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function t5(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function $y(){return this.__zoom||Lf}function e5(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function r5(){return navigator.maxTouchPoints||"ontouchstart"in this}function n5(t,e,n){var i=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function i5(){var t=Qq,e=t5,n=n5,i=e5,r=r5,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=UF,c=Ea("start","zoom","end"),u,d,h,p=500,m=150,v=0,b=10;function g(z){z.property("__zoom",$y).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",H).filter(r).on("touchstart.zoom",F).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(z,T,C,k){var x=z.selection?z.selection():z;x.property("__zoom",$y),z!==x?S(z,T,C,k):x.interrupt().each(function(){w(this,arguments).event(k).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(z,T,C,k){g.scaleTo(z,function(){var x=this.__zoom.k,A=typeof T=="function"?T.apply(this,arguments):T;return x*A},C,k)},g.scaleTo=function(z,T,C,k){g.transform(z,function(){var x=e.apply(this,arguments),A=this.__zoom,D=C==null?y(x):typeof C=="function"?C.apply(this,arguments):C,R=A.invert(D),B=typeof T=="function"?T.apply(this,arguments):T;return n(_($(A,B),D,R),x,a)},C,k)},g.translateBy=function(z,T,C,k){g.transform(z,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),a)},null,k)},g.translateTo=function(z,T,C,k,x){g.transform(z,function(){var A=e.apply(this,arguments),D=this.__zoom,R=k==null?y(A):typeof k=="function"?k.apply(this,arguments):k;return n(Lf.translate(R[0],R[1]).scale(D.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),A,a)},k,x)};function $(z,T){return T=Math.max(o[0],Math.min(o[1],T)),T===z.k?z:new tn(T,z.x,z.y)}function _(z,T,C){var k=T[0]-C[0]*z.k,x=T[1]-C[1]*z.k;return k===z.x&&x===z.y?z:new tn(z.k,k,x)}function y(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function S(z,T,C,k){z.on("start.zoom",function(){w(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(k).end()}).tween("zoom",function(){var x=this,A=arguments,D=w(x,A).event(k),R=e.apply(x,A),B=C==null?y(R):typeof C=="function"?C.apply(x,A):C,X=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),et=x.__zoom,K=typeof T=="function"?T.apply(x,A):T,at=l(et.invert(B).concat(X/et.k),K.invert(B).concat(X/K.k));return function(nt){if(nt===1)nt=K;else{var tt=at(nt),j=X/tt[2];nt=new tn(j,B[0]-tt[0]*j,B[1]-tt[1]*j)}D.zoom(null,nt)}})}function w(z,T,C){return!C&&z.__zooming||new L(z,T)}function L(z,T){this.that=z,this.args=T,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,T),this.taps=0}L.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,T){return this.mouse&&z!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var T=ht(this.that).datum();c.call(z,this.that,new Xq(z,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:c}),T)}};function N(z,...T){if(!t.apply(this,arguments))return;var C=w(this,T).event(z),k=this.__zoom,x=Math.max(o[0],Math.min(o[1],k.k*Math.pow(2,i.apply(this,arguments)))),A=Ie(z);if(C.wheel)(C.mouse[0][0]!==A[0]||C.mouse[0][1]!==A[1])&&(C.mouse[1]=k.invert(C.mouse[0]=A)),clearTimeout(C.wheel);else{if(k.k===x)return;C.mouse=[A,k.invert(A)],fs(this),C.start()}$o(z),C.wheel=setTimeout(D,m),C.zoom("mouse",n(_($(k,x),C.mouse[0],C.mouse[1]),C.extent,a));function D(){C.wheel=null,C.end()}}function E(z,...T){if(h||!t.apply(this,arguments))return;var C=z.currentTarget,k=w(this,T,!0).event(z),x=ht(z.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",X,!0),A=Ie(z,C),D=z.clientX,R=z.clientY;F1(z.view),au(z),k.mouse=[A,this.__zoom.invert(A)],fs(this),k.start();function B(et){if($o(et),!k.moved){var K=et.clientX-D,at=et.clientY-R;k.moved=K*K+at*at>v}k.event(et).zoom("mouse",n(_(k.that.__zoom,k.mouse[0]=Ie(et,C),k.mouse[1]),k.extent,a))}function X(et){x.on("mousemove.zoom mouseup.zoom",null),R1(et.view,k.moved),$o(et),k.event(et).end()}}function H(z,...T){if(t.apply(this,arguments)){var C=this.__zoom,k=Ie(z.changedTouches?z.changedTouches[0]:z,this),x=C.invert(k),A=C.k*(z.shiftKey?.5:2),D=n(_($(C,A),k,x),e.apply(this,T),a);$o(z),s>0?ht(this).transition().duration(s).call(S,D,k,z):ht(this).call(g.transform,D,k,z)}}function F(z,...T){if(t.apply(this,arguments)){var C=z.touches,k=C.length,x=w(this,T,z.changedTouches.length===k).event(z),A,D,R,B;for(au(z),D=0;D<k;++D)R=C[D],B=Ie(R,this),B=[B,this.__zoom.invert(B),R.identifier],x.touch0?!x.touch1&&x.touch0[2]!==B[2]&&(x.touch1=B,x.taps=0):(x.touch0=B,A=!0,x.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(x.taps<2&&(d=B[0],u=setTimeout(function(){u=null},p)),fs(this),x.start())}}function W(z,...T){if(this.__zooming){var C=w(this,T).event(z),k=z.changedTouches,x=k.length,A,D,R,B;for($o(z),A=0;A<x;++A)D=k[A],R=Ie(D,this),C.touch0&&C.touch0[2]===D.identifier?C.touch0[0]=R:C.touch1&&C.touch1[2]===D.identifier&&(C.touch1[0]=R);if(D=C.that.__zoom,C.touch1){var X=C.touch0[0],et=C.touch0[1],K=C.touch1[0],at=C.touch1[1],nt=(nt=K[0]-X[0])*nt+(nt=K[1]-X[1])*nt,tt=(tt=at[0]-et[0])*tt+(tt=at[1]-et[1])*tt;D=$(D,Math.sqrt(nt/tt)),R=[(X[0]+K[0])/2,(X[1]+K[1])/2],B=[(et[0]+at[0])/2,(et[1]+at[1])/2]}else if(C.touch0)R=C.touch0[0],B=C.touch0[1];else return;C.zoom("touch",n(_(D,R,B),C.extent,a))}}function M(z,...T){if(this.__zooming){var C=w(this,T).event(z),k=z.changedTouches,x=k.length,A,D;for(au(z),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),A=0;A<x;++A)D=k[A],C.touch0&&C.touch0[2]===D.identifier?delete C.touch0:C.touch1&&C.touch1[2]===D.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(D=Ie(D,this),Math.hypot(d[0]-D[0],d[1]-D[1])<b)){var R=ht(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return g.wheelDelta=function(z){return arguments.length?(i=typeof z=="function"?z:rs(+z),g):i},g.filter=function(z){return arguments.length?(t=typeof z=="function"?z:rs(!!z),g):t},g.touchable=function(z){return arguments.length?(r=typeof z=="function"?z:rs(!!z),g):r},g.extent=function(z){return arguments.length?(e=typeof z=="function"?z:rs([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),g):e},g.scaleExtent=function(z){return arguments.length?(o[0]=+z[0],o[1]=+z[1],g):[o[0],o[1]]},g.translateExtent=function(z){return arguments.length?(a[0][0]=+z[0][0],a[1][0]=+z[1][0],a[0][1]=+z[0][1],a[1][1]=+z[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(z){return arguments.length?(n=z,g):n},g.duration=function(z){return arguments.length?(s=+z,g):s},g.interpolate=function(z){return arguments.length?(l=z,g):l},g.on=function(){var z=c.on.apply(c,arguments);return z===c?g:z},g.clickDistance=function(z){return arguments.length?(v=(z=+z)*z,g):Math.sqrt(v)},g.tapDistance=function(z){return arguments.length?(b=+z,g):b},g}const zc={xs:4,sm:6,md:8,lg:12,xl:16,"2xl":24,"3xl":32},Fo=["xs","sm","md","lg","xl","2xl","3xl"],o5=zc.md,ns=1,a5=1.5,su=.8,s5=20,Z1=2,wy=20,ky=100,W1={neutral:"rgba(207, 210, 214, 1)",primary:"rgba(71, 176, 255, 0.5)",secondary:"rgba(255, 140, 71, 0.5)"},l5="#64748B",Cf={bank:"#2563EB",invest:"#10B981",regional:"#F59E0B",vc:"#8B5CF6",crypto:"#F97316",exchange:"#06B6D4",blockchain:"#6366F1",defi:"#EC4899",company:"#3B82F6",startup:"#14B8A6",platform:"#A855F7",service:"#0EA5E9",person:"#EF4444",organization:"#64748B",community:"#84CC16",university:"#1E40AF",institute:"#7C3AED",program:"#059669",studio:"#DC2626",streaming:"#BE185D",producer:"#B91C1C",network:"#1F2937",tech:"#3B82F6",gaming:"#8B5CF6",lifestyle:"#EC4899",accelerator:"#10B981",manufacturer:"#6366F1",distributor:"#F59E0B",retailer:"#06B6D4",supplier:"#14B8A6",cloud:"#0EA5E9",saas:"#3B82F6",integration:"#8B5CF6",framework:"#10B981",foundation:"#64748B",sponsor:"#F59E0B",ai:"#6366F1",physics:"#8B5CF6",biology:"#10B981",corporate:"#3B82F6",global:"#1E40AF",financial:"#059669",ivy:"#7C3AED",domain:"#EC4899",research:"#14B8A6",developer:"#F97316",mission:"#4338CA",goal:"#A78BFA",insight:"#34D399",event:"#93C5FD",blocker:"#F43F5E",entity:"#4B5563",source:"#CBD5E1"},ra={leftSlider:0,rightSlider:7};function id(t,e,n){return Math.max(e,Math.min(n,t))}function K1(t,e){if(!t||!e.length)return"sm";for(let n=0;n<e.length;n++)if(t<=e[n])return Fo[n]??"sm";return Fo[Fo.length-1]}function If(t,e){return zc[K1(t.value,e)]}function c5(t,e){return If(t,e)*a5}function Mf(t){return t.color||Cf[t.type]||l5}function Y1(t,e){if(e<=0)return su;const n=id(t/e,0,1);return su+n*(s5-su)}function J1(t,e){for(let n=0;n<e.length;n++)if(t<=e[n])return n;return e.length-1}function X1(t){return t.leftSlider===ra.leftSlider&&t.rightSlider===ra.rightSlider}function od(t,e){if(X1(e)||!t.breakpoints.length)return null;const n=new Set;for(const i of t.nodes){if(typeof i.value!="number")continue;const r=J1(i.value,t.breakpoints);e.leftSlider<=r&&r<e.rightSlider&&n.add(i.id)}return n}function Q1(t){return t.map((e,n)=>({start:e,end:n===t.length-1?e*3:t[n+1],radius:zc[Fo[n]??"sm"]}))}const u5=1375,d5=36;function tS(t,e,n){const i=id(Math.min(t,e)/u5,.2,1);return{charge:-1200*i,collide:Math.max(60*i,n+d5),linkDistance:id((wy+ky)/2*i,wy,ky)}}const h5=.2,Ei={glow:"#473DD9",innerBorder:"#FFFFFF",outerBorder:"#473DD9",activeFill:"#000000",shadowInner:"#141C2C",shadowOuter:"#5F6877"},gn={text:"rgba(33, 38, 46, 0.9)",textActive:"#FFFFFF",background:"#FFFFFF00",backgroundHover:"#FFFFFF",backgroundActive:"#000000"},Sy={background:"rgba(19, 22, 29, 1)",text:"rgba(239, 240, 241, 1)"};function eS(t){const e=Number(t??0);if(e>=1e3){const n=e/1e3;return`${Number.isInteger(n)?n.toString():n.toFixed(1)}K`}return e.toString()}function rS(t){return typeof t=="number"?`$${t.toFixed(2)}`:""}function nS(t,e=0){if(!Number.isFinite(t))return"0";if(Math.abs(t)<1e3)return t.toFixed(e);const n=["B","M","K"];for(let i=0;i<n.length;i++){const r=Math.pow(1e3,n.length-i);if(Math.abs(t)>=r)return`${(t/r).toFixed(1)} ${n[i]}`}return t.toFixed(e)}const lu=14,p5=4,f5=5,m5=12,Ay=16,g5=10,y5=14,v5=8,zy=2,Ty=1,Ly=10,b5=10,x5=5,_5=[.3,4],$5=250,Cy=32,Iy=[.4,1.25],w5=Math.PI*(3-Math.sqrt(5)),Fi=new WeakMap;let k5=0;function na(t,e,n){return Math.max(e,Math.min(n,t))}function fn(t){return typeof t=="string"?t:t.id}function ad(t){if(!t||typeof t.getBBox!="function")return null;try{return t.getBBox()}catch{return null}}function My(t,e,n,i,r){const o=n-t,a=i-e,s=Math.sqrt(o*o+a*a);return s===0?{x:t,y:e}:{x:t+o/s*r,y:e+a/s*r}}function Ws(t){const e=Fi.get(t);if(e&&(e.controller=null,!!e.simulation)){for(const n of e.simulation.nodes())typeof n.x=="number"&&typeof n.y=="number"&&e.positions.set(n.id,{x:n.x,y:n.y});e.simulation.stop(),e.simulation=null}}function iS(t,e){var n;const i=(n=Fi.get(t))==null?void 0:n.controller;return i?(i.setVisibleIds(e),!0):!1}function oS(t,e,n){var i;const r=(i=Fi.get(t))==null?void 0:i.controller;return!r||e<=0||n<=0?!1:(r.resize(e,n),!0)}function aS(t,e){var n;const{model:i,theme:r,onSelect:o}=e;let a=e.visibleIds,s=e.width,l=e.height;if(Ws(t),t.replaceChildren(),!i.nodes.length||s<=0||l<=0)return null;const c=((n=Fi.get(t))==null?void 0:n.positions)??new Map,u=++k5,d=`ui9000-ng-blur-${u}`,h=`ui9000-ng-shadow-${u}`,p=new Map(i.nodes.map(I=>[I.id,If(I,i.breakpoints)])),m=Math.max(...p.values()),v=i.nodes.map((I,V)=>{const U=c.get(I.id)??A5(V,i.nodes.length,s,l);return{...I,x:U.x,y:U.y}}),b=new Map(v.map(I=>[I.id,I])),g=i.links.map(I=>({...I})),$=I=>!a||a.has(I),_=I=>$(fn(I.source))&&$(fn(I.target)),y=new Map;for(const I of g){const V=fn(I.source),U=fn(I.target);y.has(V)||y.set(V,new Set),y.has(U)||y.set(U,new Set),y.get(V).add(U),y.get(U).add(V)}let S=e.activeNodeId??null,w=null;const L=ht(t).append("svg").attr("width","100%").attr("height","100%").attr("viewBox",`0 0 ${s} ${l}`).attr("preserveAspectRatio","xMidYMid meet").style("display","block").style("font-family",r.fontFamily);z5(L,d,h);const N=L.append("g").attr("class","graph-root"),E=N.append("g").attr("class","link-layer"),H=N.append("g").attr("class","link-label-layer"),F=N.append("g").attr("class","node-layer"),W=T5(E,H,g),M=L5({layer:F,simNodes:v,model:i,radiusById:p,blurId:d,shadowId:h}),z=new Map;for(const I of M){if(!I.alwaysLabelled||!I.labelBg)continue;const V=Number(I.labelBg.getAttribute("width"))||0,U=(Number(I.labelBg.getAttribute("height"))||0)/2;(V||U)&&z.set(I.datum.id,{right:V,half:U})}const T=tS(s,l,m),C=l3(s/2,l/2).strength(.1),k=H3(s/2).strength(.05),x=q3(l/2).strength(.05),A=U3(v).stop().force("link",L3(g).id(I=>I.id).distance(T.linkDistance).strength(.5)).force("charge",B3().strength(T.charge)).force("center",C).force("collision",z3().radius(T.collide)).force("x",k).force("y",x);Fi.set(t,{simulation:A,positions:c,controller:null});const D=I=>{var V;return!!S&&S!==I&&!!((V=y.get(S))!=null&&V.has(I))},R=I=>!!S&&(fn(I.source)===S||fn(I.target)===S);function B(){for(const I of v){const V=p.get(I.id)??0;I.x=na(I.x??s/2,V,s-V),I.y=na(I.y??l/2,V,l-V)}for(const I of W){const V=b.get(fn(I.datum.source)),U=b.get(fn(I.datum.target));if(!V||!U)continue;const O=V.x??0,P=V.y??0,J=U.x??0,rt=U.y??0,it=My(O,P,J,rt,p.get(V.id)??0),lt=My(J,rt,O,P,p.get(U.id)??0);if(I.line.setAttribute("x1",String(it.x)),I.line.setAttribute("y1",String(it.y)),I.line.setAttribute("x2",String(lt.x)),I.line.setAttribute("y2",String(lt.y)),!I.label)continue;const gt=I.visible&&R(I.datum);if(I.label.style.opacity=gt?"1":"0",!gt)continue;const mt=Math.atan2(lt.y-it.y,lt.x-it.x)*180/Math.PI,bt=mt>90||mt<-90?mt+180:mt,dt=(mt-90)*Math.PI/180,Ct=(it.x+lt.x)/2+Math.cos(dt)*Ly,ut=(it.y+lt.y)/2+Math.sin(dt)*Ly;I.label.setAttribute("transform",`translate(${Ct}, ${ut}) rotate(${bt})`)}for(const I of M)I.group.setAttribute("transform",`translate(${I.datum.x??0}, ${I.datum.y??0})`)}function X(){var I,V,U;for(const O of M){const P=O.datum.id,J=S===P,rt=w===P,it=D(P);if(O.background.setAttribute("fill",J&&!O.hasImage?Ei.activeFill:Mf(O.datum)),!O.label)continue;const lt=O.alwaysLabelled||J||rt||it;O.label.style.opacity=lt?"1":"0",O.labelBg&&O.labelBg.setAttribute("fill",J?gn.backgroundActive:rt?gn.backgroundHover:gn.background);const gt=J?gn.textActive:gn.text;(I=O.labelTitle)==null||I.setAttribute("fill",gt),(V=O.labelTitle)==null||V.setAttribute("font-weight",J||it?"600":"400"),(U=O.labelValue)==null||U.setAttribute("fill",gt)}for(const O of W)O.line.setAttribute("stroke-width",String(R(O.datum)?Y1(O.datum.value,i.maxLinkValue):Z1))}function et(I){S=I,X(),B(),o==null||o(I)}function K(){for(const I of M){const V=$(I.datum.id);I.group.style.opacity=V?"1":"0",I.group.style.pointerEvents=V?"all":"none",I.grab&&(I.grab.style.pointerEvents=V?"all":"none")}for(const I of W)I.visible=_(I.datum),I.line.style.opacity=I.visible?"1":"0";w&&!$(w)&&(w=null),S&&!$(S)?et(null):(X(),B())}function at(){const I=S5(v.filter(V=>$(V.id)),p,s,l,z);I&&(tt?L.call(tt.transform,I):N.attr("transform",I.toString()))}function nt(I,V){s=I,l=V,L.attr("viewBox",`0 0 ${s} ${l}`),C.x(s/2).y(l/2),k.x(s/2),x.y(l/2),B(),at()}I5({nodes:M,simulation:A,getBounds:()=>({width:s,height:l}),radiusById:p,onHover:I=>{w=I,X()},onClick:I=>et(S===I?null:I)});let tt=null;e.enableZoom!==!1&&(tt=i5().scaleExtent(_5).filter(I=>{var V,U;return I.type==="wheel"?!!(I.ctrlKey||I.metaKey):I.button!=null&&I.button!==0?!1:!((U=(V=I.target)==null?void 0:V.closest)!=null&&U.call(V,"g.node"))}).on("zoom",I=>{N.attr("transform",I.transform.toString())}),L.call(tt)),A.tick($5),K(),at(),A.on("tick",B);const j={setVisibleIds(I){a=I,K()},resize:nt};return Fi.set(t,{simulation:A,positions:c,controller:j}),j}function S5(t,e,n,i,r){let o=1/0,a=1/0,s=-1/0,l=-1/0;for(const h of t){if(typeof h.x!="number"||typeof h.y!="number")continue;const p=e.get(h.id)??0,m=r.get(h.id),v=Math.max(p,(m==null?void 0:m.half)??0);o=Math.min(o,h.x-p),a=Math.min(a,h.y-v),s=Math.max(s,h.x+p+((m==null?void 0:m.right)??0)),l=Math.max(l,h.y+v)}if(!Number.isFinite(o))return null;const c=Math.max(s-o,1),u=Math.max(l-a,1),d=na(Math.min((n-Cy*2)/c,(i-Cy*2)/u),Iy[0],Iy[1]);return Lf.translate(n/2-(o+s)/2*d,i/2-(a+l)/2*d).scale(d)}function A5(t,e,n,i){const o=Math.min(n,i)*h5*Math.sqrt(e<=1?0:t/(e-1)),a=t*w5;return{x:n/2+Math.cos(a)*o,y:i/2+Math.sin(a)*o}}function z5(t,e,n){const i=t.append("defs");i.append("filter").attr("id",e).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%").append("feGaussianBlur").attr("stdDeviation",12);const r=i.append("radialGradient").attr("id",n);r.append("stop").attr("offset","0%").attr("stop-color",Ei.shadowInner).attr("stop-opacity",1),r.append("stop").attr("offset","100%").attr("stop-color",Ei.shadowOuter).attr("stop-opacity",.12)}function T5(t,e,n){return n.map(i=>{const r=t.append("line").attr("class","link-line").attr("stroke",W1[i.type]).attr("stroke-width",Z1).attr("stroke-linecap","round").style("opacity",1).style("pointer-events","none").node();let o=null;{const a=e.append("g").attr("class","link-label").style("opacity",0).style("pointer-events","none"),s=a.append("rect").attr("class","link-label-background").attr("rx",5).attr("ry",5).attr("fill",Sy.background),l=a.append("text").attr("class","link-label-text").text(eS(i.value)).attr("font-size",v5).attr("fill",Sy.text).attr("dominant-baseline","middle").attr("text-anchor","middle"),c=ad(l.node());c&&s.attr("x",c.x-zy).attr("y",c.y-Ty).attr("width",c.width+zy*2).attr("height",c.height+Ty*2),o=a.node()}return{datum:i,line:r,label:o,visible:!0}})}function L5(t){const{layer:e,simNodes:n,model:i,radiusById:r,blurId:o,shadowId:a}=t;return n.map(s=>{const l=r.get(s.id)??0,c=c5(s,i.breakpoints),u=!!s.img,d=e.append("g").datum(s).attr("class","node").style("cursor","grab").style("opacity",1).style("pointer-events","all"),h=C5(d,s,l);d.append("circle").attr("class","node-shadow-blue").attr("r",c).attr("fill",Ei.glow).attr("opacity",.15).attr("filter",`url(#${o})`).style("pointer-events","none");const p=d.append("circle").attr("class","node-drag-area").attr("r",l+ns+b5).attr("fill","transparent").style("cursor","grab").style("pointer-events","all").node();d.append("circle").attr("class","node-shadow-dark").attr("r",c).attr("fill",`url(#${a})`).attr("opacity",.1).attr("filter",`url(#${o})`).style("pointer-events","none");const m=d.append("circle").attr("class","node-background").attr("r",l).attr("fill",Mf(s)).style("opacity",u?0:1).style("pointer-events","none").node();return d.append("circle").attr("class","node-border-white").attr("r",l).attr("fill","none").attr("stroke",Ei.innerBorder).attr("stroke-width",ns).style("pointer-events","none"),u&&d.append("image").attr("class","node-image").attr("href",s.img).attr("width",l*2).attr("height",l*2).attr("x",-l).attr("y",-l).attr("clip-path",`circle(${l}px at ${l}px ${l}px)`).attr("preserveAspectRatio","xMidYMid slice").style("pointer-events","none"),d.append("circle").attr("class","node-border-purple").attr("r",l+ns).attr("fill","none").attr("stroke",Ei.outerBorder).attr("stroke-width",ns).style("pointer-events","none"),{datum:s,group:d.node(),background:m,grab:p,label:h.group,labelBg:h.background,labelTitle:h.title,labelValue:h.value,radius:l,hasImage:u,alwaysLabelled:l>o5}})}function C5(t,e,n){const i=rS(e.value);if(!e.label&&!i)return{group:null,background:null,title:null,value:null};const r=t.append("g").attr("class","node-label").attr("transform","translate(1, 0)").style("opacity",0).style("pointer-events","none"),o=r.append("rect").attr("class","node-label-background").attr("rx",4).attr("ry",4).attr("fill",gn.background),a=r.append("text").attr("class","node-label-title").text(e.label).attr("font-size",m5).attr("font-weight","400").attr("fill",gn.text).attr("text-anchor","middle").attr("dominant-baseline","hanging"),s=r.append("text").attr("class","node-label-value").text(i).attr("font-size",g5).attr("fill",gn.text).attr("text-anchor","middle").attr("dominant-baseline","hanging"),l=n+f5,c=ad(a.node()),u=ad(s.node()),d=Math.max((c==null?void 0:c.width)??0,(u==null?void 0:u.width)??0),h=l*2+d,p=lu+Ay+y5+p5,m=l+d/2;return o.attr("x",0).attr("y",-48/2).attr("width",h).attr("height",p),a.attr("x",m).attr("y",-48/2+lu),s.attr("x",m).attr("y",-48/2+lu+Ay),{group:r.node(),background:o.node(),title:a.node(),value:s.node()}}function I5(t){const{nodes:e,simulation:n,getBounds:i,radiusById:r,onHover:o,onClick:a}=t;let s=!1,l=null;const c=s3().filter(u=>u.button===0).on("start",(u,d)=>{u.sourceEvent.stopPropagation(),l={x:u.sourceEvent.clientX,y:u.sourceEvent.clientY},s=!1,u.active||n.alphaTarget(.3).restart();const{width:h,height:p}=i();d.fx=d.x??h/2,d.fy=d.y??p/2}).on("drag",(u,d)=>{if(l){const v=u.sourceEvent.clientX-l.x,b=u.sourceEvent.clientY-l.y;Math.sqrt(v*v+b*b)>x5&&(s=!0)}const{width:h,height:p}=i(),m=r.get(d.id)??0;d.fx=na((d.fx??d.x??0)+u.dx,m,h-m),d.fy=na((d.fy??d.y??0)+u.dy,m,p-m)}).on("end",(u,d)=>{u.active||n.alphaTarget(0),d.fx=null,d.fy=null,l=null});for(const u of e){const d=ht(u.group);d.call(c);const h=d.select(".node-drag-area");h.on("click",p=>{if(p.stopPropagation(),s){s=!1;return}a(u.datum.id)}),h.on("mouseenter",()=>o(u.datum.id)),h.on("mouseleave",()=>o(null))}}const M5=ie`
1754
+ :host {
1755
+ display: block;
1756
+ position: relative;
1757
+ width: 100%;
1758
+ height: 100%;
1759
+ min-height: 320px;
1760
+ color: var(--ui9000-color-text, #111827);
1761
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1762
+ box-sizing: border-box;
1763
+ }
1764
+ .chart-root {
1765
+ flex: 1;
1766
+ min-height: 0;
1767
+ width: 100%;
1768
+ border-radius: 12px;
1769
+ background: var(--ui9000-color-surface-muted, #f9faff);
1770
+ overflow: hidden;
1771
+ touch-action: pan-y;
1772
+ }
1773
+ .empty {
1774
+ display: grid;
1775
+ place-items: center;
1776
+ flex: 1;
1777
+ min-height: inherit;
1778
+ padding: 8px;
1779
+ text-align: center;
1780
+ color: var(--ui9000-color-text-muted, #6b7280);
1781
+ font-size: 0.875rem;
1782
+ }
1783
+
1784
+ /* Legend — value buckets as half bubbles, with a two-thumb size filter. */
1785
+ .graph-legend {
1786
+ flex-shrink: 0;
1787
+ /* The largest bubble overhangs the bar by half its diameter (3xl → ~19px). */
1788
+ margin: 26px 0 8px;
1789
+ user-select: none;
1790
+ }
1791
+ .legend-scale {
1792
+ position: relative;
1793
+ display: inline-flex;
1794
+ }
1795
+ .legend-bucket {
1796
+ position: relative;
1797
+ width: 40px;
1798
+ height: 12px;
1799
+ /* FuseDash tints the track with its label grey; the literal is the fallback
1800
+ for engines without color-mix. */
1801
+ background: #6c758429;
1802
+ background: color-mix(in srgb, var(--ui9000-color-text-muted, #6c7584) 16%, transparent);
1803
+ border-right: 1px solid var(--ui9000-color-border, #e5e7eb);
1804
+ opacity: 1;
1805
+ }
1806
+ .legend-bucket[data-muted] {
1807
+ opacity: 0.3;
1808
+ }
1809
+ .legend-bucket:first-child {
1810
+ border-top-left-radius: 8px;
1811
+ border-bottom-left-radius: 8px;
1812
+ }
1813
+ .legend-bucket:last-child {
1814
+ border-right: none;
1815
+ border-top-right-radius: 8px;
1816
+ border-bottom-right-radius: 8px;
1817
+ }
1818
+ /* Top half of a circle sitting on the bar, sized like the node it stands for. */
1819
+ .legend-bucket::before {
1820
+ content: '';
1821
+ position: absolute;
1822
+ top: -2px;
1823
+ left: 50%;
1824
+ width: var(--bubble-size);
1825
+ height: var(--bubble-size);
1826
+ transform: translate(-50%, -50%);
1827
+ border-radius: 100%;
1828
+ background: #6c758429;
1829
+ background: color-mix(in srgb, var(--ui9000-color-text-muted, #6c7584) 16%, transparent);
1830
+ -webkit-mask-image: linear-gradient(to bottom, #000 0 50%, transparent 50% 100%);
1831
+ mask-image: linear-gradient(to bottom, #000 0 50%, transparent 50% 100%);
1832
+ }
1833
+ .legend-values {
1834
+ display: flex;
1835
+ padding-top: 6px;
1836
+ }
1837
+ .legend-value {
1838
+ width: 40px;
1839
+ padding-right: 5px;
1840
+ font-size: 9px;
1841
+ line-height: 16px;
1842
+ text-align: center;
1843
+ color: var(--ui9000-color-text-muted, #6c7584);
1844
+ }
1845
+ .legend-value:first-child {
1846
+ text-align: start;
1847
+ }
1848
+ .legend-value:last-child {
1849
+ text-align: end;
1850
+ }
1851
+
1852
+ .legend-range {
1853
+ position: absolute;
1854
+ inset: 0;
1855
+ pointer-events: none;
1856
+ }
1857
+ .legend-range input {
1858
+ position: absolute;
1859
+ left: 0;
1860
+ bottom: -4px;
1861
+ width: 100%;
1862
+ height: 12px;
1863
+ margin: 0;
1864
+ padding: 0;
1865
+ background: none;
1866
+ appearance: none;
1867
+ -webkit-appearance: none;
1868
+ pointer-events: none;
1869
+ }
1870
+ .legend-range input:focus-visible {
1871
+ outline: 2px solid var(--ui9000-color-primary, #473dd9);
1872
+ outline-offset: 2px;
1873
+ }
1874
+ .legend-range input::-webkit-slider-thumb {
1875
+ appearance: none;
1876
+ -webkit-appearance: none;
1877
+ width: 8px;
1878
+ height: 16px;
1879
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
1880
+ border-radius: 3px;
1881
+ background: var(--ui9000-color-surface, #fff);
1882
+ box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
1883
+ cursor: ew-resize;
1884
+ pointer-events: auto;
1885
+ }
1886
+ .legend-range input::-moz-range-thumb {
1887
+ width: 8px;
1888
+ height: 16px;
1889
+ border: 1px solid var(--ui9000-color-border, #e5e7eb);
1890
+ border-radius: 3px;
1891
+ background: var(--ui9000-color-surface, #fff);
1892
+ box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
1893
+ cursor: ew-resize;
1894
+ pointer-events: auto;
1895
+ }
1896
+ .legend-range input::-moz-range-track {
1897
+ background: none;
1898
+ }
1899
+ `,sd=250,ld=600,N5=["primary","neutral","secondary"],D5={nodes:[],links:[],breakpoints:[],maxLinkValue:1};function Ks(){return{...D5,nodes:[],links:[],breakpoints:[]}}function ao(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function cu(t){return typeof t=="string"&&t.trim()?t:void 0}function sS(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?e:void 0}function O5(t){if(!ao(t))return null;const e=t.id==null?"":String(t.id);return e?{id:e,label:cu(t.label)??e,value:sS(t.value),type:t.type==null?"":String(t.type),color:cu(t.color),img:cu(t.img)}:null}function P5(t){return N5.includes(t)?t:"neutral"}function Ny(t){const e=new Map;for(const i of t){const r=O5(i);r&&!e.has(r.id)&&e.set(r.id,r)}const n=[...e.values()];return n.length<=sd?n:n.slice().sort((i,r)=>(r.value??0)-(i.value??0)).slice(0,sd)}function E5(t,e){const n=new Set,i=[];return t.forEach((r,o)=>{if(!ao(r))return;const a=r.source==null?"":String(r.source),s=r.target==null?"":String(r.target);if(!a||!s||a===s||!e.has(a)||!e.has(s))return;const l=r.id==null?`${a}->${s}-${o}`:String(r.id);n.has(l)||(n.add(l),i.push({id:l,source:a,target:s,value:sS(r.value)??0,type:P5(r.type)}))}),i.length<=ld?i:i.slice().sort((r,o)=>o.value-r.value).slice(0,ld)}function F5(t){const e=[];for(const i of t)!i.type||Cf[i.type]||e.includes(i.type)||e.push(i.type);if(!e.length)return;const n=Da(0,e.length);for(const i of t){if(i.color)continue;const r=e.indexOf(i.type);r>=0&&(i.color=n[r%n.length])}}function cd(t,e){let n=Ny(t);if(!n.length){const o=new Map;for(const a of e)if(ao(a))for(const s of["source","target"]){const l=a[s]==null?"":String(a[s]);l&&!o.has(l)&&o.set(l,{id:l,label:l,type:""})}n=Ny([...o.values()])}if(!n.length)return Ks();F5(n);const i=E5(e,new Set(n.map(o=>o.id))),r=n.map(o=>o.value).filter(o=>typeof o=="number");return{nodes:n,links:i,breakpoints:r.length?bf(r,7):[],maxLinkValue:i.reduce((o,a)=>Math.max(o,a.value),0)||1}}function R5(t){const e=Array.isArray(t.data)?t.data[0]:void 0;return ao(e)?cd(Array.isArray(e.nodes)?e.nodes:[],Array.isArray(e.links)?e.links:[]):Ks()}function lS(t){return t?Array.isArray(t)?cd([],t):ao(t)&&(Array.isArray(t.nodes)||Array.isArray(t.links))?cd(Array.isArray(t.nodes)?t.nodes:[],Array.isArray(t.links)?t.links:[]):ao(t)&&Array.isArray(t.data)?R5(t):Ks():Ks()}var j5=Object.defineProperty,U5=Object.getOwnPropertyDescriptor,mo=(t,e,n,i)=>{for(var r=i>1?void 0:i?U5(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&j5(e,n,r),r};const B5=1.2;let Hr=class extends qt{constructor(){super(...arguments),this.showLegend=!0,this.showTooltip=!0,this._empty=!1,this._ranges=[],this._range={...ra},this._activeNodeId=null,this._model=null,this._raf=0,this._resizeRaf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleResize()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),cancelAnimationFrame(this._resizeRaf);const e=this.chartRoot();e&&Ws(e),super.disconnectedCallback()}updated(t){t.has("dataJson")&&(this._range={...ra},this._activeNodeId=null,this._model=null),t.has("showTooltip")&&!this.showTooltip&&(this._labelTooltip=null),this.shouldRedraw(t)&&this.scheduleDraw()}shouldRedraw(t){if(!re(t))return!1;for(const e of t.keys())if(!(typeof e!="string"||e.startsWith("_"))&&!(e==="showLegend"||e==="showTooltip"))return!0;return!1}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}scheduleResize(){cancelAnimationFrame(this._resizeRaf),this._resizeRaf=requestAnimationFrame(()=>{const t=this.chartRoot();t&&(oS(t,t.clientWidth,t.clientHeight)||this.draw())})}chartRoot(){var t;return((t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root"))??null}model(){return this._model||(this._model=lS(Ot(this.dataJson,null))),this._model}draw(){const t=this.chartRoot();if(!t)return;const e=this.model();if(this._empty=e.nodes.length===0,this._ranges=Q1(e.breakpoints),this._empty){Ws(t),t.replaceChildren();return}aS(t,{model:e,visibleIds:od(e,this._range),width:t.clientWidth,height:t.clientHeight,theme:wt(this),activeNodeId:this._activeNodeId,onSelect:n=>{this._activeNodeId=n}})}setRange(t,e){const n={...this._range,[t]:e};if(n.leftSlider>=n.rightSlider)return;this._range=n;const i=this.chartRoot();if(!i)return;const r=od(this.model(),n);iS(i,r)||this.scheduleDraw()}renderLegend(){if(!this.showLegend||this._empty||this._ranges.length<2)return st;const{leftSlider:t,rightSlider:e}=this._range,n=this._ranges.length,{onAxisLabelHover:i,onAxisLabelLeave:r}=this.axisLabelHandlers();return ot`
1900
+ <div class="graph-legend" part="legend">
1901
+ <div class="legend-scale">
1902
+ ${this._ranges.map((o,a)=>{const s=!(t<=a&&a<e);return ot`<span
1903
+ class="legend-bucket"
1904
+ ?data-muted=${s}
1905
+ style="--bubble-size:${o.radius*B5}px"
1906
+ ></span>`})}
1907
+ <div class="legend-range">
1908
+ <input
1909
+ type="range"
1910
+ aria-label="Smallest node size shown"
1911
+ min="0"
1912
+ max=${n}
1913
+ step="1"
1914
+ .value=${String(t)}
1915
+ @input=${o=>this.setRange("leftSlider",Number(o.target.value))}
1916
+ />
1917
+ <input
1918
+ type="range"
1919
+ aria-label="Largest node size shown"
1920
+ min="0"
1921
+ max=${n}
1922
+ step="1"
1923
+ .value=${String(e)}
1924
+ @input=${o=>this.setRange("rightSlider",Number(o.target.value))}
1925
+ />
1926
+ </div>
1927
+ </div>
1928
+ <div class="legend-values">
1929
+ ${this._ranges.map(o=>ot`<span
1930
+ class="legend-value"
1931
+ @mouseenter=${this.showTooltip?a=>i==null?void 0:i(String(o.start),a):void 0}
1932
+ @mouseleave=${this.showTooltip?r:void 0}
1933
+ >${nS(o.start,2)}</span
1934
+ >`)}
1935
+ </div>
1936
+ </div>
1937
+ `}render(){return ot`
1938
+ <div class="widget-shell" part="shell">
1939
+ ${this.renderShellHeader(this.headerTitle())}
1940
+ <div class="widget-body">
1941
+ ${this.renderLegend()}
1942
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1943
+ ${this._empty?ot`<div class="empty" part="empty">
1944
+ Network graph requires a nodes and links payload.
1945
+ </div>`:st}
1946
+ ${this.renderShellLabelTooltip()}
1947
+ </div>
1948
+ </div>
1949
+ `}};Hr.styles=[M5,ne];mo([Y({type:Boolean,attribute:"show-legend"})],Hr.prototype,"showLegend",2);mo([Y({type:Boolean,attribute:"show-tooltip"})],Hr.prototype,"showTooltip",2);mo([yt()],Hr.prototype,"_empty",2);mo([yt()],Hr.prototype,"_ranges",2);mo([yt()],Hr.prototype,"_range",2);Hr=mo([Xt("ui9000-network-graph")],Hr);function cS(){customElements.get("ui9000-network-graph")||customElements.define("ui9000-network-graph",Hr)}cS();const H5=Object.freeze(Object.defineProperty({__proto__:null,FULL_RANGE:ra,LINK_COLORS:W1,MAX_NETWORK_LINKS:ld,MAX_NETWORK_NODES:sd,NODE_SIZES:zc,NODE_TYPE_COLORS:Cf,SIZE_KEYS:Fo,get Ui9000NetworkGraph(){return Hr},formatLegendValue:nS,formatLinkValue:eS,formatNodeValue:rS,isFullRange:X1,legendRanges:Q1,networkForces:tS,networkGraphMetadata:Y_,nodeColor:Mf,nodeRadius:If,nodeSizeKey:K1,normalizeNetworkGraphData:lS,rangeIndexOf:J1,registerNetworkGraph:cS,renderNetworkGraph:aS,resizeNetworkGraph:oS,scaleLinkWidthByMax:Y1,stopNetworkGraph:Ws,updateNetworkGraphVisibility:iS,visibleNodeIds:od},Symbol.toStringTag,{value:"Module"}));function uS(t){let e=1/0,n=-1/0;for(const i of t)for(const r of i.points)r.x<e&&(e=r.x),r.x>n&&(n=r.x);return!Number.isFinite(e)||!Number.isFinite(n)?[0,1]:e===n?[e,e+1]:[e,n]}function dS(t){let e=-1/0;for(const n of t)for(const i of n.points)i.y>e&&(e=i.y);return!Number.isFinite(e)||e<=0?[0,1]:[0,e*f.biasVarianceDomainPadFactor]}function hS(t){const e=new Set;for(const n of t)for(const i of n.points)e.add(i.x);return[...e].sort((n,i)=>n-i)}function ii(t){return Number.isFinite(t)?Number.isInteger(t)?String(t):String(Number(t.toFixed(3))):""}function Dy(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function Oy(t,e,n){return Math.max(e,Math.min(n,t))}function Py(t,e){const{x:n,y:i,text:r,align:o}=e,a=r.length*6+8,s=16,l=o==="center"?n-a/2:n+8;t.append("rect").attr("x",l).attr("y",i).attr("width",a).attr("height",s).attr("rx",6).attr("ry",6).attr("fill",f.domainLimitLabelFill),t.append("text").attr("x",l+a/2).attr("y",i+11).attr("text-anchor","middle").attr("fill",f.domainLimitLabelText).attr("font-size",f.domainLimitLabelSize).text(r)}function q5(t,e,n,i,r){const o=f.domainLimitArrow,a=t.append("g").attr("class","domain-limits").attr("pointer-events","none");for(const s of e){const l=s.color||f.domainLimitColor,c=a.append("g").attr("class",`domain-limit domain-limit--${s.orientation}`),u=s.values.length===2;if(s.orientation==="vertical"){const h=s.values.map(p=>Oy(n(p),r.left,r.right));u&&c.append("rect").attr("x",Math.min(h[0],h[1])).attr("y",r.top).attr("width",Math.abs(h[1]-h[0])).attr("height",r.bottom-r.top).attr("fill",l).attr("fill-opacity",f.domainLimitFillOpacity),h.forEach((p,m)=>{c.append("line").attr("x1",p).attr("x2",p).attr("y1",r.top).attr("y2",r.bottom).attr("stroke",l).attr("stroke-dasharray",f.domainLimitDash),c.append("path").attr("d",`M ${p},${r.top+o} L ${p-6},${r.top} L ${p+6},${r.top} Z`).attr("fill",l),c.append("path").attr("d",`M ${p},${r.bottom-o} L ${p-6},${r.bottom} L ${p+6},${r.bottom} Z`).attr("fill",l),Py(c,{x:p,y:r.top+o,text:ii(s.values[m]),align:"center"})});continue}const d=s.values.map(h=>Oy(i(h),r.top,r.bottom));u&&c.append("rect").attr("x",r.left).attr("y",Math.min(d[0],d[1])).attr("width",r.right-r.left).attr("height",Math.abs(d[1]-d[0])).attr("fill",l).attr("fill-opacity",f.domainLimitFillOpacity),d.forEach((h,p)=>{c.append("line").attr("x1",r.left).attr("x2",r.right).attr("y1",h).attr("y2",h).attr("stroke",l).attr("stroke-dasharray",f.domainLimitDash),c.append("path").attr("d",`M ${r.right-o},${h} L ${r.right},${h-6} L ${r.right},${h+6} Z`).attr("fill",l),c.append("path").attr("d",`M ${r.left+o},${h} L ${r.left},${h-6} L ${r.left},${h+6} Z`).attr("fill",l),Py(c,{x:r.left,y:h-17,text:ii(s.values[p]),align:"right"})})}}function pS(t,e){const{model:n,width:i,height:r,margin:o={...f.biasVarianceMargin},theme:a,showGrid:s=!0,showTooltip:l=!0,onHover:c,onLeave:u}=e;t.replaceChildren();const{series:d}=n;if(!d.length||i<=0||r<=0)return;const h=o.left,p=i-o.right,m=o.top,v=r-o.bottom;if(p-h<8||v-m<8)return;const b=Ft().domain(uS(d)).range([h,p]),g=Ft().domain(dS(d)).range([v,m]).nice(),$=b.ticks(f.biasVarianceXTicks),_=g.ticks(f.biasVarianceYTicks),y=ht(t).append("svg").attr("width",i).attr("height",r).attr("viewBox",`0 0 ${i} ${r}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Bias-variance tradeoff chart").style("display","block").style("font-family",a.fontFamily),S=y.append("g").attr("class","plot");if(s){const k=S.append("g").attr("class","grid").attr("pointer-events","none");for(const x of _)k.append("line").attr("x1",h).attr("x2",p).attr("y1",g(x)).attr("y2",g(x)).attr("stroke",f.biasVarianceGridStroke).attr("stroke-dasharray",f.biasVarianceGridDash).attr("shape-rendering","crispEdges")}const w=lr().x(k=>b(k.x)).y(k=>g(k.y)).curve(aw),L=S.append("g").attr("class","series-layer");d.forEach((k,x)=>{L.append("path").attr("class",`series series-${x}`).datum(k.points).attr("fill","none").attr("stroke",Dy(k,x,a)).attr("stroke-width",f.biasVarianceLineWidth).attr("opacity",f.biasVarianceLineOpacity).attr("pointer-events","none").attr("d",w)});const N=()=>L.selectAll("path.series"),E=k=>{N().attr("opacity",(x,A)=>A===k?1:f.biasVarianceLineOpacityDimmed)},H=()=>{N().attr("opacity",f.biasVarianceLineOpacity)},F=S.append("g").attr("class","axes").attr("pointer-events","none");for(const k of _)F.append("text").attr("x",h-8).attr("y",g(k)+4).attr("text-anchor","end").attr("fill",f.biasVarianceLabelFill).attr("font-size",f.axisLabelSize).text(ii(k));for(const k of $)F.append("text").attr("x",b(k)).attr("y",v+18).attr("text-anchor","middle").attr("fill",f.biasVarianceLabelFill).attr("font-size",f.axisLabelSize).text(ii(k));if(F.append("line").attr("x1",h).attr("x2",h).attr("y1",m).attr("y2",v).attr("stroke",f.biasVarianceAxisStroke),F.append("line").attr("x1",h).attr("x2",p).attr("y1",v).attr("y2",v).attr("stroke",f.biasVarianceAxisStroke),n.domainsLimits.length&&q5(S,n.domainsLimits,b,g,{left:h,right:p,top:m,bottom:v}),!l||!c)return;const W=S.append("g").attr("class","hover").attr("pointer-events","none"),M=W.append("line").attr("stroke",f.biasVarianceAxisStroke).attr("stroke-width",1).attr("stroke-dasharray",f.domainLimitDash).attr("opacity",0),z=W.append("g").attr("class","hover-dots"),T=hS(d),C=k=>{let x=T[0],A=1/0;for(const D of T){const R=Math.abs(b(D)-k);R<A&&(A=R,x=D)}return x};S.append("rect").attr("class","hover-target").attr("x",h).attr("y",m).attr("width",p-h).attr("height",v-m).attr("fill","transparent").on("mousemove",k=>{const[x,A]=Ie(k,y.node()),D=C(x);if(D==null)return;const R=b(D);M.attr("x1",R).attr("x2",R).attr("y1",m).attr("y2",v).attr("opacity",1);let B=-1,X=1/0;d.forEach((K,at)=>{const nt=K.points.find(j=>j.x===D);if(!nt)return;const tt=Math.abs(g(nt.y)-A);tt<X&&(X=tt,B=at)}),E(B),z.selectAll("*").remove();const et=[];d.forEach((K,at)=>{const nt=K.points.find(I=>I.x===D);if(!nt)return;const tt=Dy(K,at,a),j=at===B;et.push({seriesId:K.id,seriesName:K.name??K.id,color:tt,value:nt.y,focused:j}),z.append("circle").attr("class",j?"hover-dot hover-dot--focused":"hover-dot").attr("cx",R).attr("cy",g(nt.y)).attr("r",f.stepHoverDotRadius).attr("fill",tt).attr("stroke","#fff").attr("stroke-width",2).attr("opacity",j?1:f.biasVarianceLineOpacityDimmed)}),c({x:D,entries:et,event:k})}).on("mouseleave",()=>{M.attr("opacity",0),z.selectAll("*").remove(),H(),u==null||u()})}const G5=ie`
1950
+ .tooltip .row.focused {
1951
+ font-weight: 600;
1952
+ }
1953
+ .tooltip .row.dimmed {
1954
+ opacity: 0.65;
1955
+ }
1956
+ `,ki={series:[],domainsLimits:[]};function V5(t,e,n,i){return(t==null?void 0:t.some(o=>String(o.key)===e))?zt(t,e,i):f.biasVarianceSeries[n%f.biasVarianceSeries.length]}function Ey(t){return Number(t??0)}function Nf(t){return t.sort((e,n)=>e.x-n.x)}function fS(t){if(!Array.isArray(t))return[];const e=[];for(const n of t){if(!n||typeof n!="object")continue;const i=n;if(!Array.isArray(i.values))continue;const r=i.values.map(o=>Number(o)).filter(o=>Number.isFinite(o)).slice(0,2);r.length&&e.push({values:r,color:typeof i.color=="string"?i.color:void 0,orientation:i.orientation==="vertical"?"vertical":"horizontal"})}return e}function Z5(t){const e=se(t),n=ft(t.xAxe??void 0)??"x",i=ft(t.yAxe??void 0)??"y",r=ft(t.groupBy??void 0)??"series",o=new Map;for(const l of e){const c=Ey(l[n]),u=Ey(l[i]);if(!Number.isFinite(c)||!Number.isFinite(u))continue;const d=String(l[r]??""),h=o.get(d)??[];h.push({x:c,y:u}),o.set(d,h)}const a=me(o.keys(),t.uniqueValues,r);return{series:a.filter(l=>o.has(l)).map((l,c)=>({id:l,name:l,color:V5(t.formatting,l,c,a.length),points:Nf(o.get(l)??[])})).filter(l=>l.points.length>0),domainsLimits:fS(t.domainsLimits),xField:ft(t.xAxe??void 0),yField:ft(t.yAxe??void 0),groupField:ft(t.groupBy??void 0),axisDetails:t.axisDetails}}function uu(t){return t.map((e,n)=>({id:e.id,name:e.name??e.id,color:e.color??f.biasVarianceSeries[n%f.biasVarianceSeries.length],points:Nf((e.points??[]).map(i=>({x:Number(i.x),y:Number(i.y)})).filter(i=>Number.isFinite(i.x)&&Number.isFinite(i.y)))})).filter(e=>e.points.length>0)}function W5(t){const e=[];return t.forEach((n,i)=>{const r=Number(n.label),o=Number.isFinite(r)?r:i,a=Number(n.value);Number.isFinite(a)&&e.push({x:o,y:a})}),e.length?[{id:"default",name:"Series",color:f.biasVarianceSeries[0],points:Nf(e)}]:[]}function mS(t){if(!t)return ki;if(Array.isArray(t)){if(!t.length)return ki;const e=t[0];return"points"in e?{...ki,series:uu(t)}:"label"in e&&"value"in e?{...ki,series:W5(t)}:ki}if(Ht(t))return Z5(t);if(typeof t=="object"){const e=t,n=fS(e.domainsLimits);if(Array.isArray(e.series))return{series:uu(e.series),domainsLimits:n};if(Array.isArray(e.points))return{series:uu([{id:"default",name:"Series",points:e.points}]),domainsLimits:n}}return ki}var K5=Object.defineProperty,Y5=Object.getOwnPropertyDescriptor,go=(t,e,n,i)=>{for(var r=i>1?void 0:i?Y5(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&K5(e,n,r),r};const J5={series:[],domainsLimits:[]};let qr=class extends qt{constructor(){super(...arguments),this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return mS(t)}renderLegend(t){if(!this.showLegend||t.series.length<=1)return st;const e=wt(this),n=t.series.map(i=>({id:i.id,name:io(i.name??i.id),color:i.color}));return ce(ui(n,e))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.series.length===0,this._empty){e.replaceChildren();return}const{width:i,height:r,margin:o}=hC(e);pS(e,{model:n,width:i,height:r,margin:o,theme:wt(this),showGrid:this.showGrid,showTooltip:this.showTooltip,onHover:this.showTooltip?({x:a,entries:s,event:l})=>{const c=this.getBoundingClientRect();this._tooltip={x:l.clientX-c.left,y:l.clientY-c.top,xLabel:ii(a),entries:s}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){var t,e;const n=this.headerTitle(),i=this._empty?J5:this.parseData(),r=i.yField,o=r?(e=(t=i.axisDetails)==null?void 0:t[r])==null?void 0:e.measure_unit_symbol:void 0;return ot`
1957
+ <div class="widget-shell" part="shell">
1958
+ ${this.renderShellHeader(n)}
1959
+ <div class="widget-body">
1960
+ ${this.renderLegend(i)}
1961
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
1962
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
1963
+ ${this._tooltip?ot`<div
1964
+ class="tooltip"
1965
+ part="tooltip"
1966
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
1967
+ >
1968
+ <div class="x">${this._tooltip.xLabel}</div>
1969
+ ${this._tooltip.entries.map(a=>ot`<div class="row ${a.focused?"focused":"dimmed"}">
1970
+ <span class="swatch" style="background:${a.color}"></span>
1971
+ <span>${io(a.seriesName)}</span>
1972
+ <span class="value"
1973
+ >${ii(a.value)}${o?` ${o}`:""}</span
1974
+ >
1975
+ </div>`)}
1976
+ </div>`:st}
1977
+ ${this.renderShellLabelTooltip()}
1978
+ </div>
1979
+ </div>
1980
+ `}};qr.styles=[jw,G5,ne];go([Y({type:Boolean,attribute:"show-grid"})],qr.prototype,"showGrid",2);go([Y({type:Boolean,attribute:"show-legend"})],qr.prototype,"showLegend",2);go([Y({type:Boolean,attribute:"show-tooltip"})],qr.prototype,"showTooltip",2);go([yt()],qr.prototype,"_tooltip",2);go([yt()],qr.prototype,"_empty",2);qr=go([Xt("ui9000-bias-variance-tradeoff-chart")],qr);function gS(){customElements.get("ui9000-bias-variance-tradeoff-chart")||customElements.define("ui9000-bias-variance-tradeoff-chart",qr)}gS();const X5=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000BiasVarianceTradeoffChart(){return qr},biasVarianceTradeoffChartMetadata:j_,biasVarianceXDomain:uS,biasVarianceXValues:hS,biasVarianceYDomain:dS,formatTradeoffValue:ii,normalizeBiasVarianceData:mS,registerBiasVarianceTradeoffChart:gS,renderBiasVarianceChart:pS},Symbol.toStringTag,{value:"Module"}));function yS(t){const e=t.filter(Number.isFinite);if(!e.length)return[0,1];const n=Math.min(...e),i=Math.max(...e),r=(i-n)*.1;return[n-r,i+r]}function vS(t){const e=t.filter(Number.isFinite);if(!e.length)return[0,1];const n=Math.min(...e),i=Math.max(...e),r=(i-n)*.2;return[n-r/2,i+r]}function Fy(t){const e=Number.isInteger(t)&&Math.abs(t)<1e3?0:2;return Pt(t,e)}function du(t,e,n){return t.y<0?A_(f.bubbleNegativeFill,.5):n?e:`url(#bubble-gradient-${e.replace("#","hex")})`}function hu(t,e){return t.y<0?e?1:.6:e?.6:1}function Q5(t,e){return t.y<0?f.bubbleNegativeFill:e}function bS(t,e){const{model:n,width:i,height:r,margin:o=(()=>{const k=f.bubbleMaxRadius/2+1,x=f.bubbleBaseMargin;return{top:x.top+k,right:x.right+k,bottom:x.bottom,left:x.left}})(),showGrid:a=!0,showTooltip:s=!0,onHover:l,onLeave:c}=e;t.replaceChildren();const{points:u,colorRanges:d}=n;if(!u.length||i<=0||r<=0)return;const h=Math.max(0,i-o.left-o.right),p=Math.max(0,r-o.top-o.bottom);if(h<=0||p<=0)return;const m=u.map(k=>k.x),v=u.map(k=>k.y),[b,g]=yS(m),[$,_]=vS(v),y=Ft().domain([b,g]).range([0,h]).nice(),S=Ft().domain([$,_]).range([p,0]).nice(),w=ge(p),L=ge(h),N=f.gridStroke,E=f.axisStroke,H=f.axisLabelFill,F=ht(t).append("svg").attr("width",i).attr("height",r).attr("viewBox",`0 0 ${i} ${r}`).attr("role","img").attr("aria-label","Bubble chart"),W=F.append("defs"),M=new Set(u.filter(k=>k.y>=0).map(k=>k.color));for(const k of M){const x=k.replace("#","hex"),A=W.append("linearGradient").attr("id",`bubble-gradient-${x}`).attr("x1","0%").attr("y1","100%").attr("x2","0%").attr("y2","0%");A.append("stop").attr("offset","0%").attr("stop-color",k).attr("stop-opacity","0.3"),A.append("stop").attr("offset","100%").attr("stop-color",k).attr("stop-opacity","0.1")}const z=F.append("g").attr("transform",`translate(${o.left},${o.top})`);a&&(z.append("g").attr("class","y-grid").call(Jt(S).ticks(w).tickSize(-h).tickFormat(()=>"")).call(k=>k.select(".domain").remove()).selectAll("line").attr("stroke",N).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1),z.append("g").attr("class","x-grid").call(ae(y).ticks(L).tickSize(p).tickFormat(()=>"")).call(k=>k.select(".domain").remove()).selectAll("line").attr("stroke",N).attr("stroke-dasharray",f.gridDash).attr("stroke-width",1)),z.append("g").attr("class","y-axis").call(Jt(S).ticks(w).tickSize(0).tickPadding(8).tickFormat(k=>{const x=typeof k=="number"?k:k.valueOf();return Number.isInteger(x)?Fy(x):""})).call(k=>k.select(".domain").attr("stroke",N).attr("stroke-dasharray",f.gridDash)).selectAll("text").attr("dx",`-${o.left-10}px`).attr("fill",H).attr("font-size",f.axisLabelSize).attr("text-anchor","start"),z.selectAll(".y-axis .tick").append("line").attr("x1",-8).attr("x2",0).attr("y1",0).attr("y2",0).attr("stroke",E).attr("stroke-width",1),z.append("g").attr("class","x-axis").attr("transform",`translate(0,${p})`).call(ae(y).ticks(L).tickSizeOuter(0).tickSize(0).tickPadding(8).tickFormat(k=>{const x=typeof k=="number"?k:k.valueOf();return Number.isInteger(x)?Fy(x):""})).call(k=>k.select(".domain").attr("stroke",E));const T=z.append("g").attr("class","bubbles"),C=T.selectAll("g").data(u).enter().append("g").attr("class","bubble-container").attr("opacity",1);C.each(function(k){const x=ht(this),A=y(k.x),D=S(k.y),R=mw(k.y,d);x.append("circle").attr("class","bubble").attr("cx",A).attr("cy",D).attr("r",R).attr("fill",du(k,k.color,!1)).attr("fill-opacity",hu(k,!1)).attr("stroke",Q5(k,k.color)).attr("stroke-width",1),R>=dw&&x.append("text").attr("class","bubble-label").attr("x",A).attr("y",D).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("fill","#000").attr("stroke","#fff").attr("stroke-width",2).attr("paint-order","stroke fill").attr("font-size",12).attr("pointer-events","none").text(Pt(k.y))}),s&&l&&C.style("cursor","pointer").on("mouseenter",function(k,x){T.selectAll(".bubble-container").attr("opacity",f.donutArcOpacityDimmed),ht(this).attr("opacity",1),ht(this).select(".bubble").attr("fill",du(x,x.color,!0)).attr("fill-opacity",hu(x,!0)).attr("stroke-width",2),l({point:x,event:k})}).on("mousemove",(k,x)=>{l({point:x,event:k})}).on("mouseleave",()=>{C.attr("opacity",1),C.select(".bubble").each(function(k){ht(this).attr("fill",du(k,k.color,!1)).attr("fill-opacity",hu(k,!1)).attr("stroke-width",1)}),c==null||c()})}const tG=ie`
1981
+ :host {
1982
+ display: block;
1983
+ position: relative;
1984
+ width: 100%;
1985
+ height: 100%;
1986
+ min-height: 220px;
1987
+ color: var(--ui9000-color-text, #111827);
1988
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
1989
+ box-sizing: border-box;
1990
+ }
1991
+ .chart-root {
1992
+ flex: 1;
1993
+ min-height: 0;
1994
+ width: 100%;
1995
+ height: 100%;
1996
+ min-height: inherit;
1997
+ }
1998
+ .tooltip {
1999
+ position: absolute;
2000
+ pointer-events: none;
2001
+ z-index: 2;
2002
+ padding: 6px 10px;
2003
+ border-radius: 6px;
2004
+ font-size: 12px;
2005
+ line-height: 1.35;
2006
+ background: var(--ui9000-color-text, #111827);
2007
+ color: #fff;
2008
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
2009
+ transform: translate(-50%, calc(-100% - 10px));
2010
+ white-space: nowrap;
2011
+ }
2012
+ .empty {
2013
+ display: grid;
2014
+ place-items: center;
2015
+ height: 100%;
2016
+ min-height: inherit;
2017
+ color: var(--ui9000-color-text-muted, #6b7280);
2018
+ font-size: 0.875rem;
2019
+ text-align: center;
2020
+ padding: 8px;
2021
+ }
2022
+ `,Io={points:[],xField:"",yField:"",groups:[],colorRanges:[]};function Ry(t,e){return!!e&&t.some(n=>Number.isFinite(Number(n[e])))}function jy(t,e,n,i){if(e&&Ry(t,e))return e;if(!t.length)return e??"";for(const r of Object.keys(t[0]??{}))if(!(r===n||r===i)&&Ry(t,r))return r;return e??""}function eG(t){const e=ft(t.arrangeBy)||ft(t.xAxe)||"",n=ft(t.display)||ft(t.yAxe)||"";return{xField:e,yField:n}}function rG(t){const e=t.map(o=>{const a=Number(o.x),s=Number(o.y);if(!Number.isFinite(a)||!Number.isFinite(s))return null;const l=o.group!=null?String(o.group):"default";return{x:a,y:s,groupKey:l,color:o.color??zt(void 0,l,t.length),row:{x:a,y:s,group:l}}}).filter(o=>o!=null),n=[...new Set(e.map(o=>o.groupKey))],i=n.map(o=>{var a;return{key:o,label:o,color:((a=e.find(s=>s.groupKey===o))==null?void 0:a.color)??zt(void 0,o,n.length)}}),r=e.map(o=>o.y);return{points:e,xField:"x",yField:"y",groupField:e.some(o=>o.groupKey!=="default")?"group":void 0,groups:i,colorRanges:fw(r)}}function nG(t){var e;const n=se(t),{xField:i,yField:r}=eG(t),o=ft(t.groupBy??void 0),a=jy(n,i,r??"",o),s=jy(n,r,a,o);if(!a||!s)return Io;const l=pi(t),c=o?me(n.map(b=>String(b[o]??"")).filter(Boolean),t.uniqueValues,o):["default"],u=o?ci(c):["default"],d=u.map(b=>({key:b,label:b,color:zt(l,b,u.length)})),h=new Map(d.map(b=>[b.key,b.color])),p=[];for(const b of n){const g=Number(b[a]),$=Number(b[s]);if(!Number.isFinite(g)||!Number.isFinite($))continue;const _=o?String(b[o]??"default"):"default";p.push({x:g,y:$,groupKey:_,color:h.get(_)??zt(l,_,d.length),row:b})}const m=p.map(b=>b.y),v=((e=t.palette)==null?void 0:e.range)??null;return{points:p,xField:a,yField:s,groupField:o??void 0,groups:d,colorRanges:fw(m,v),axisDetails:t.axisDetails??void 0}}function xS(t){return t?Array.isArray(t)?t.length&&"x"in t[0]&&"y"in t[0]?rG(t):Io:Ht(t)?nG(t):typeof t=="object"&&Array.isArray(t.points)?t:Io:Io}var iG=Object.defineProperty,oG=Object.getOwnPropertyDescriptor,vi=(t,e,n,i)=>{for(var r=i>1?void 0:i?oG(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&iG(e,n,r),r};let Cr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return xS(t)}renderLegend(t){if(!this.showLegend||t.groups.length<=1)return st;const e=wt(this);return ce(Nr(t.groups.map(n=>n.label),e,(n,i)=>{var r;return((r=t.groups[i])==null?void 0:r.color)??e.primary}))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.points.length===0,this._empty){e.replaceChildren();return}wt(this);const{width:i,height:r,margin:o}=pC(e);bS(e,{model:n,width:i,height:r,margin:o,showGrid:this.showGrid,showTooltip:this.showTooltip,onHover:this.showTooltip?({point:a,event:s})=>{var l,c,u,d,h,p;const m=this.getBoundingClientRect(),v=((c=(l=n.axisDetails)==null?void 0:l[n.xField])==null?void 0:c.label)??n.xField,b=((d=(u=n.axisDetails)==null?void 0:u[n.yField])==null?void 0:d.label)??n.yField,g=[`${v}: ${Pt(a.x)}`,`${b}: ${Pt(a.y)}`];if(n.groupField){const $=((p=(h=n.axisDetails)==null?void 0:h[n.groupField])==null?void 0:p.label)??n.groupField;g.push(`${$}: ${a.groupKey}`)}this._tooltip={x:s.clientX-m.left,y:s.clientY-m.top,lines:g}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?null:this.parseData();return ot`
2023
+ <div class="widget-shell" part="shell">
2024
+ ${this.renderShellHeader(t)}
2025
+ <div class="widget-body">
2026
+ ${e?this.renderLegend(e):st}
2027
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
2028
+ ${this._empty?ot`<div class="empty" part="empty">
2029
+ Bubble chart requires two numeric fields. Pick numeric X and Y axes.
2030
+ </div>`:st}
2031
+ ${this._tooltip?ot`<div
2032
+ class="tooltip"
2033
+ part="tooltip"
2034
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
2035
+ >
2036
+ ${this._tooltip.lines.map(n=>ot`<div>${n}</div>`)}
2037
+ </div>`:st}
2038
+ ${this.renderShellLabelTooltip()}
2039
+ </div>
2040
+ </div>
2041
+ `}};Cr.styles=[tG,ne];vi([Y({type:String,attribute:"scale"})],Cr.prototype,"scale",2);vi([Y({type:Boolean,attribute:"show-grid"})],Cr.prototype,"showGrid",2);vi([Y({type:Boolean,attribute:"show-legend"})],Cr.prototype,"showLegend",2);vi([Y({type:Boolean,attribute:"show-tooltip"})],Cr.prototype,"showTooltip",2);vi([yt()],Cr.prototype,"_tooltip",2);vi([yt()],Cr.prototype,"_empty",2);Cr=vi([Xt("ui9000-bubble-chart")],Cr);function _S(){customElements.get("ui9000-bubble-chart")||customElements.define("ui9000-bubble-chart",Cr)}_S();const aG=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000BubbleChart(){return Cr},bubbleChartMetadata:B_,bubbleRadiusForValue:mw,bubbleXDomain:yS,bubbleYDomain:vS,normalizeBubbleData:xS,registerBubbleChart:_S,renderBubbleChart:bS},Symbol.toStringTag,{value:"Module"}));function $S(t){return Pt(t,2)}function wS(t){return Number.isInteger(t)?String(t):t.toFixed(2)}function Uy(t,e){var n;return((n=e==null?void 0:e[t])==null?void 0:n.label)??t}function ud(t,e){const n=[];for(let i=t;i<e;i+=1)n.push(i);return n}function kS(t){const e=[];for(const n of t)for(const i of n.points)Number.isFinite(i.value)&&e.push(i.value);return e}function SS(t,e){const[n,i]=Gr(kS(t)),r=n*f.radarDomainPadFactor,o=i*f.radarDomainPadFactor,a=Ft().rangeRound([0,e]).domain([r,o]).nice();return{scale:a,minValue:r,maxValue:o,domainMin:a.domain()[0]??r,domainMax:a.domain()[1]??o}}function AS(t,e,n){return t/2>=(e-(n<0?2:1))*21}function pu(t){switch(t){case"cross":return ef;case"square":case"rhombus":return rf;case"triangle":return nf;default:return pc}}function sG(t){return t==="rhombus"||t==="cross"?45:0}function is(t,e,n){return t.color?t.color:e===0&&n.primary?n.primary:e===1&&n.secondary?n.secondary:tr(e)}function fu(t){return t.replace(/[#]/g,"")}function zS(t,e){const{series:n,categories:i,width:r,height:o,margin:a={...f.radarMargin},theme:s,themeMode:l="light",showGrid:c=!0,showTooltip:u=!0,onPointHover:d,onPointLeave:h}=e;if(t.replaceChildren(),!n.length||!i.length||r<=0||o<=0)return;const p=r-a.left-a.right,m=o-a.top-a.bottom;if(p<8||m<8)return;const v=Math.min(p,m)/2,b=r/2,g=o/2,$=Math.PI*2/i.length,_=f.radarScaleSteps,{scale:y,minValue:S,maxValue:w}=SS(n,v),L=ht(t).append("svg").attr("width",r).attr("height",o).attr("role","img").attr("aria-label","Radar chart").style("display","block").style("font-family",s.fontFamily),N=L.append("g").attr("class","plot").attr("transform",`translate(${b}, ${g})`),E=N.append("defs");Ap(L,"radar-glow");const H=new Set;if(n.forEach((x,A)=>H.add(is(x,A,s))),H.forEach(x=>{const A=fu(x);E.append("radialGradient").attr("id",`radar-gradient-${A}`).attr("cx","50%").attr("cy","50%").attr("r","50%").selectAll("stop").data([{offset:"0%",stopColor:x,stopOpacity:"0"},{offset:"100%",stopColor:x,stopOpacity:String(f.radarGradientEdgeOpacity)}]).join("stop").attr("offset",D=>D.offset).attr("stop-color",D=>D.stopColor).attr("stop-opacity",D=>D.stopOpacity),E.append("pattern").attr("id",`dotted-pattern-hover-${A}`).attr("x","0").attr("y","0").attr("width","4").attr("height","4").attr("patternUnits","userSpaceOnUse").append("circle").attr("cx","2").attr("cy","2").attr("r","1.5").attr("fill",l==="dark"?A_(x,.5):x).attr("fill-opacity","0.4")}),c){const x=S<0?0:1;N.append("g").attr("class","grid").style("pointer-events","none").selectAll(".grid-polygon").data(ud(x,_+1)).enter().append("polygon").attr("class","grid-polygon").attr("points",A=>{const D=(w-S)/_,R=S+A*D,B=y(R);return i.map((X,et)=>{const K=$*et-Math.PI/2,at=B*Math.cos(K),nt=B*Math.sin(K);return`${at},${nt}`}).join(" ")}).attr("fill","none").attr("stroke",f.gridStroke)}const F=N.append("g").attr("class","axis-grid"),W=l==="dark"?"#EFF0F1":"#000000",M=y(w);i.forEach((x,A)=>{const D=$*A-Math.PI/2,R=M*Math.cos(D),B=M*Math.sin(D),X=Math.abs(D)===Math.PI/2?"middle":D<Math.PI/2&&D>-Math.PI/2?"start":"end";F.append("line").attr("x1",0).attr("y1",0).attr("x2",R).attr("y2",B).attr("class","axis").attr("stroke",f.axisStroke).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-dasharray",f.radarSpokeDash),F.append("circle").attr("cx",R).attr("cy",B).attr("r",f.radarCapRadius).attr("class","axis-cap").attr("fill",f.axisStroke),F.append("text").attr("class","axis-label").attr("x",(M+f.radarLabelOffset)*Math.cos(D)).attr("y",(M+f.radarLabelOffset)*Math.sin(D)).attr("text-anchor",X).attr("font-size","12").attr("dominant-baseline","central").attr("fill",W).text(x)}),AS(m,_,S)&&N.append("g").attr("class","ticks-container").selectAll(".tick-group").data(ud(1,_+1)).enter().append("g").attr("class","tick-group").each(function(x){var A;const D=ht(this),R=(w-S)/_,B=S+x*R,X=-y(B),K=(A=D.append("text").attr("class","tick-rect").attr("x",0).attr("y",X).attr("font-size","12px").attr("text-anchor","middle").attr("dominant-baseline","central").text($S(B)).node())==null?void 0:A.getBBox();if(!K)return;const at={x:7,y:3};D.insert("rect","text").attr("class","tick-label").attr("x",K.x-at.x).attr("y",K.y-at.y).attr("width",K.width+at.x*2).attr("height",K.height+at.y*2).attr("rx",4).attr("ry",4).attr("fill",f.radarTickLabelFill)});const z=_6().angle((x,A)=>$*A).radius(x=>y(x[1])).curve(L6),T=n.map((x,A)=>{const D=i.map(R=>{const B=x.points.find(X=>X.category===R);return[0,(B==null?void 0:B.value)??0,R]});return{key:x.id,index:A,series:x,pts:D}});N.append("g").attr("class","radar-path-group").style("pointer-events","none").selectAll("path").data(T).join("path").attr("d",x=>z(x.pts)).attr("stroke",x=>is(x.series,x.index,s)).attr("stroke-width",f.radarStrokeWidth).attr("filter","url(#radar-glow)").attr("fill",x=>{const A=is(x.series,x.index,s);return`url(#radar-gradient-${fu(A)})`});const C=f.radarMarkerSize,k=f.radarMarkerHoverSize;N.append("g").attr("class","radar-data-point-group").selectAll("g.radarchart-marker-container-group").data(T).join("g").attr("class","radarchart-marker-container-group").each(function(x){const A=ht(this),D=is(x.series,x.index,s),R=x.series.marker;x.pts.forEach((B,X)=>{if(R==="disabled")return;const et=$*X-Math.PI/2,K=y(B[1])*Math.cos(et),at=y(B[1])*Math.sin(et),nt=A.append("g").attr("class","radarchart-marker-container"),tt=C+10,j=nt.append("g").attr("class","hover-effect-group").attr("opacity",0);j.append("circle").attr("cx",K).attr("cy",at).attr("r",tt/2).attr("fill",`url(#dotted-pattern-hover-${fu(D)})`).style("mask-image","radial-gradient(circle at center, white 0%, white 40%, transparent 70%)").style("pointer-events","none");const I=Po().type(pu(R)).size(C)(),V=nt.append("path").attr("class","radarchart-marker").attr("d",I).attr("transform",`translate(${K} ${at}) rotate(${sG(R)})`).attr("fill",l==="dark"?"#000":"#fff").attr("stroke",D).attr("stroke-width",2);u&&V.style("cursor","pointer").on("mouseenter",U=>{V.attr("d",Po().type(pu(R)).size(k)()).attr("stroke-width",3),j.attr("opacity",1),d==null||d({seriesId:x.series.id,seriesName:x.series.name,category:String(B[2]),value:B[1],event:U})}).on("mouseleave",()=>{V.attr("d",Po().type(pu(R)).size(C)()).attr("stroke-width",2),j.attr("opacity",0),h==null||h()})})})}const lG=ie`
2042
+ :host {
2043
+ display: block;
2044
+ position: relative;
2045
+ width: 100%;
2046
+ height: 100%;
2047
+ min-height: 220px;
2048
+ color: var(--ui9000-color-text, #111827);
2049
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
2050
+ box-sizing: border-box;
2051
+ }
2052
+ .chart-root {
2053
+ flex: 1;
2054
+ min-height: 0;
2055
+ width: 100%;
2056
+ height: 100%;
2057
+ min-height: inherit;
2058
+ }
2059
+ .tooltip {
2060
+ position: absolute;
2061
+ pointer-events: none;
2062
+ z-index: 2;
2063
+ padding: 6px 10px;
2064
+ border-radius: 6px;
2065
+ font-size: 12px;
2066
+ line-height: 1.35;
2067
+ background: var(--ui9000-color-text, #111827);
2068
+ color: #fff;
2069
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
2070
+ transform: translate(-50%, calc(-100% - 10px));
2071
+ white-space: nowrap;
2072
+ }
2073
+ .empty {
2074
+ display: grid;
2075
+ place-items: center;
2076
+ height: 100%;
2077
+ min-height: inherit;
2078
+ color: var(--ui9000-color-text-muted, #6b7280);
2079
+ font-size: 0.875rem;
2080
+ }
2081
+ `;function cG(t,e){var n;return((n=t.find(i=>i.key===e))==null?void 0:n.shape)??"circle"}function TS(t,e){var n,i;const r=se(t),o=(i=(n=t.uniqueValues)==null?void 0:n[e])==null?void 0:i.map(String);if(o!=null&&o.length)return o.filter(l=>l!=null&&l!==""&&l!=="null"&&l!=="undefined");const a=new Set,s=[];for(const l of r){const c=String(l[e]??"");!c||a.has(c)||(a.add(c),s.push(c))}return s}function uG(t){const e=se(t),n=ft(t.groupBy),i=ft(t.xAxe),r=ft(t.yAxe);if(!i||!r)return{};const o=TS(t,i);let a={};return n?a=e.reduce((s,l)=>{const c=String(l[n]??"default");s[c]||(s[c]=[]);const u=Number(l[r]);return Number.isFinite(u)&&s[c].push({x:l[i]??void 0,y:u}),s},{}):a={default:e.map(s=>({x:s[i]??void 0,y:Number(s[r])})).filter(s=>Number.isFinite(s.y))},Object.keys(a).reduce((s,l)=>{const c=new Map(a[l].map(u=>[String(u.x??""),u]));return s[l]=o.map(u=>c.get(String(u))).filter(u=>!!u),s},{})}function Ys(t,e){return Number.isFinite(e)?{category:t,value:e}:null}function dG(t){const e=ft(t.xAxe)??"x",n=ft(t.yAxe)??"y",i=ft(t.groupBy),r=TS(t,e),o=uG(t),a=Oa(t),s=t.formatting;return{series:[...i?me(Object.keys(o),t.uniqueValues,i):["default"]].reverse().flatMap((u,d,h)=>{const p=o[u]??[];if(!p.length)return[];const m=r.flatMap((b,g)=>{const $=p[g];if(!$)return[];const _=Ys(b,$.y);return _?[_]:[]});if(!m.length)return[];const v=i?u:"default";return[{id:u,name:u==="default"?"Series":u,color:zt(s,v,h.length),marker:cG(a,v),points:m}]}),categories:r,xField:e,yField:n,groupBy:i,axisDetails:t.axisDetails??void 0}}function os(t){return t.category!=null?String(t.category):t.label!=null?String(t.label):t.x!=null?String(t.x):""}function By(t){return t.value!=null?Number(t.value):t.y!=null?Number(t.y):NaN}function hG(t){var e,n;if((e=t.series)!=null&&e.length){const i=t.categories??Array.from(new Set(t.series.flatMap(o=>o.points.map(a=>os(a)).filter(Boolean))));return{series:t.series.map((o,a)=>({id:o.id||`series-${a}`,name:o.name??o.id??`Series ${a+1}`,color:o.color,marker:o.marker??"circle",points:i.flatMap(s=>{const l=o.points.find(u=>os(u)===s);if(!l)return[];const c=Ys(s,By(l));return c?[c]:[]})})).filter(o=>o.points.length>0),categories:i,xField:"category",yField:"value"}}if((n=t.points)!=null&&n.length){const i=t.categories??t.points.map(o=>os(o)).filter(Boolean),r=i.flatMap(o=>{const a=t.points.find(l=>os(l)===o);if(!a)return[];const s=Ys(o,By(a));return s?[s]:[]});return{series:r.length?[{id:"default",name:"Series",marker:"circle",points:r}]:[],categories:i,xField:"category",yField:"value"}}return{series:[],categories:[],xField:"category",yField:"value"}}function LS(t){if(!t)return{series:[],categories:[],xField:"category",yField:"value"};if(Array.isArray(t)){const e=t.map(i=>Ys(String(i.label),Number(i.value))).filter(i=>i!=null),n=e.map(i=>i.category);return{series:e.length?[{id:"default",name:"Series",marker:"circle",points:e}]:[],categories:n,xField:"category",yField:"value"}}return Ht(t)&&!("series"in t)&&!("points"in t)?dG(t):hG(t)}var pG=Object.defineProperty,fG=Object.getOwnPropertyDescriptor,bi=(t,e,n,i)=>{for(var r=i>1?void 0:i?fG(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&pG(e,n,r),r};let Ir=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,[]);return LS(t)}themeMode(){return Rr(this,Fr.mode,"light")==="dark"?"dark":"light"}renderLegend(t,e){if(!this.showLegend||!e||t.length<=1)return st;const n=wt(this);return ce(Nr(t.map(i=>i.name??i.id),n,(i,r)=>po(t[r],r,n)))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._empty=n.series.length===0||n.categories.length===0,this._empty){e.replaceChildren();return}const i=wt(this),{width:r,height:o,margin:a}=tC(e),s=Uy(n.xField,n.axisDetails),l=Uy(n.yField,n.axisDetails);zS(e,{series:n.series,categories:n.categories,width:r,height:o,margin:a,theme:i,themeMode:this.themeMode(),showGrid:this.showGrid,showTooltip:this.showTooltip,onPointHover:this.showTooltip?({category:c,value:u,event:d})=>{const h=this.getBoundingClientRect();this._tooltip={x:d.clientX-h.left,y:d.clientY-h.top,xLabel:s,yLabel:l,xValue:c,yValue:wS(u)}}:void 0,onPointLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?{series:[]}:this.parseData();return ot`
2082
+ <div class="widget-shell" part="shell">
2083
+ ${this.renderShellHeader(t)}
2084
+ <div class="widget-body">
2085
+ ${this.renderLegend(e.series,e.groupBy)}
2086
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
2087
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
2088
+ ${this._tooltip?ot`<div
2089
+ class="tooltip"
2090
+ part="tooltip"
2091
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
2092
+ >
2093
+ <div>${this._tooltip.xLabel}: ${this._tooltip.xValue}</div>
2094
+ <div>${this._tooltip.yLabel}: ${this._tooltip.yValue}</div>
2095
+ </div>`:st}
2096
+ ${this.renderShellLabelTooltip()}
2097
+ </div>
2098
+ </div>
2099
+ `}};Ir.styles=[lG,ne];bi([Y({type:String,attribute:"scale"})],Ir.prototype,"scale",2);bi([Y({type:Boolean,attribute:"show-grid"})],Ir.prototype,"showGrid",2);bi([Y({type:Boolean,attribute:"show-legend"})],Ir.prototype,"showLegend",2);bi([Y({type:Boolean,attribute:"show-tooltip"})],Ir.prototype,"showTooltip",2);bi([yt()],Ir.prototype,"_tooltip",2);bi([yt()],Ir.prototype,"_empty",2);Ir=bi([Xt("ui9000-radar-chart")],Ir);function CS(){customElements.get("ui9000-radar-chart")||customElements.define("ui9000-radar-chart",Ir)}CS();const mG=Object.freeze(Object.defineProperty({__proto__:null,get Ui9000RadarChart(){return Ir},collectRadarValues:kS,formatRadarTick:$S,formatRadarValue:wS,hasRoomForRadialTicks:AS,integerRange:ud,normalizeRadarData:LS,radarChartMetadata:e$,radialScale:SS,registerRadarChart:CS,renderRadarChart:zS},Symbol.toStringTag,{value:"Module"})),Js=f.radialBarSweepDeg/180*Math.PI;function IS(t){const e=t.filter(s=>Number.isFinite(s)),n=e.length?Math.min(...e):0,i=e.length?Math.max(...e):0,r=Ft().domain([n<0?n:0,i]).range([0,Js]).nice(),[o,a]=r.domain();return r.domain([n<0?o:0,a]),r}function gG(t,e){return Ft().domain([t,e]).rangeRound([t,e]).nice()}function MS(t,e,n){if(n<=0)return f.radialBarMinArcWidth;const i=e-t-n;return Math.max(f.radialBarMinArcWidth,Math.min(f.radialBarMaxArcWidth,i/n*.5))}function NS(t,e){return Math.max(1,Math.ceil((e-t)/f.radialBarLabelCharWidth))}function yG(t){return Math.abs(Math.abs(t)-Math.PI/2)<1e-9?"middle":t>-Math.PI/2&&t<Math.PI/2?"start":"end"}function vG(t,e,n){return Math.max(0,Math.min(t-n.left-n.right,e-n.top-n.bottom)/2)}function bG(t,e,n){const i=Na().innerRadius(r=>r.radius).outerRadius(r=>r.radius).startAngle(0).endAngle(n);t.selectAll("path").data(e.map(r=>({radius:r}))).enter().append("path").attr("class","radial-grid-arc").attr("d",i).attr("fill","none").attr("stroke",f.radialBarGridStroke)}function DS(t,e){const{bars:n,width:i,height:r,margin:o,showGrid:a=!0,showTooltip:s=!0,onHover:l,onLeave:c}=e;if(t.replaceChildren(),!n.length||i<=0||r<=0)return;const u=IS(n.map(z=>z.value)),d=u.ticks(f.radialBarTicks),h=vG(i,r,o);if(h<=0)return;const p=h*f.radialBarInnerRadiusRatio,m=gG(p,h),v=n.length,b=(h-p)/v,g=MS(p,h,v),$=m(h),_=m(p),y=u(u.domain()[1]),S=u(0),w=z=>m(p+b*z)+b/2,N=ht(t).append("svg").attr("width",i).attr("height",r).attr("viewBox",`0 0 ${i} ${r}`).append("g").attr("transform",`translate(${i/2}, ${r/2})`);a&&bG(N.append("g").attr("class","radial-grid"),Array.from({length:v+1},(z,T)=>m(p+b*T)),y);const E=N.append("g").attr("class","radial-axis"),H=NS(p,h);d.forEach(z=>{const T=u(z)-Math.PI/2,C=Math.cos(T),k=Math.sin(T);a&&E.append("line").attr("x1",_*C).attr("y1",_*k).attr("x2",$*C).attr("y2",$*k).attr("stroke",f.radialBarGridStroke).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-dasharray",z===0?null:f.radialBarTickDash);const x=$+f.radialBarTickLabelOffset;E.append("text").attr("class","radial-tick-label").attr("x",x*C).attr("y",x*k).attr("text-anchor",yG(T)).attr("dominant-baseline","central").attr("font-size",f.radialBarTickLabelSize).attr("fill",f.radialBarLabelFill).text(Pt(z))});const F=N.append("g").attr("class","radial-ring-labels");n.forEach((z,T)=>{const C=F.append("text").attr("class","radial-ring-label").attr("x",-$).attr("y",-w(T)).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size",f.radialBarRingLabelSize).attr("fill",f.radialBarLabelFill);fo(C,z.label,{maxLength:H,onAxisLabelHover:e.onAxisLabelHover,onAxisLabelLeave:e.onAxisLabelLeave})});const W=Na().cornerRadius(f.radialBarArcCornerRadius).innerRadius(z=>w(z.index)-g/2).outerRadius(z=>w(z.index)+g/2).startAngle(z=>z.value>=0?S:Math.min(u(z.value),Js)).endAngle(z=>z.value>=0?Math.min(u(z.value),Js):S),M=N.append("g").attr("class","radial-bars").selectAll("path").data(n.map((z,T)=>({...z,index:T}))).enter().append("path").attr("class","radial-bar").attr("d",W).attr("fill",z=>z.color).attr("opacity",f.radialBarArcOpacity);s&&l&&M.style("cursor","pointer").on("mouseenter",function(z,T){N.selectAll(".radial-bar").attr("opacity",f.radialBarArcOpacityDimmed),ht(this).attr("opacity",1),l({bar:T,event:z})}).on("mousemove",(z,T)=>{l({bar:T,event:z})}).on("mouseleave",()=>{N.selectAll(".radial-bar").attr("opacity",f.radialBarArcOpacity),c==null||c()})}const xG=ie`
2100
+ :host {
2101
+ display: block;
2102
+ position: relative;
2103
+ width: 100%;
2104
+ height: 100%;
2105
+ min-height: 260px;
2106
+ color: var(--ui9000-color-text, #111827);
2107
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
2108
+ box-sizing: border-box;
2109
+ }
2110
+ .chart-root {
2111
+ flex: 1;
2112
+ min-height: 0;
2113
+ width: 100%;
2114
+ height: 100%;
2115
+ min-height: inherit;
2116
+ display: flex;
2117
+ align-items: center;
2118
+ justify-content: center;
2119
+ }
2120
+ .tooltip {
2121
+ position: absolute;
2122
+ pointer-events: none;
2123
+ z-index: 2;
2124
+ padding: 6px 10px;
2125
+ border-radius: 6px;
2126
+ font-size: 12px;
2127
+ line-height: 1.35;
2128
+ background: var(--ui9000-color-text, #111827);
2129
+ color: #fff;
2130
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
2131
+ transform: translate(-50%, calc(-100% - 10px));
2132
+ white-space: nowrap;
2133
+ }
2134
+ .tooltip-title {
2135
+ font-weight: 600;
2136
+ margin-bottom: 2px;
2137
+ }
2138
+ .empty {
2139
+ display: grid;
2140
+ place-items: center;
2141
+ height: 100%;
2142
+ min-height: inherit;
2143
+ color: var(--ui9000-color-text-muted, #6b7280);
2144
+ font-size: 0.875rem;
2145
+ }
2146
+ `,Ro={bars:[],legend:[]};function _G(t){if(!Array.isArray(t)||!t.length)return!1;const e=t[0];return!!e&&typeof e=="object"&&"label"in e&&"value"in e}function $G(t){return!!t&&typeof t=="object"&&Array.isArray(t.points)}function OS(t){const e=[];for(const n of t){const i=n.key,r=Number(n.value);i==null||i===""||!Number.isFinite(r)||e.push({key:String(i),label:String(i),value:r})}return e}function PS(t,e,n){if(!t.length)return Ro;const i=new Map(t.map(o=>[o.key,o])),r=e.map(o=>i.get(o)).filter(o=>o!=null).map(o=>({...o,color:n(o.key,e.length)}));return{bars:[...r].reverse(),legend:r}}function wG(t){var e,n;const i=ft(t.xAxe??void 0),r=ft(t.yAxe??void 0);if(!i||!r)return Ro;const o=OS(se(t).map(u=>({key:u[i],value:u[r]}))),a=(n=(e=t.uniqueValues)==null?void 0:e[i])!=null&&n.length?i:Object.keys(t.uniqueValues??{})[0],s=me(o.map(u=>u.key),t.uniqueValues,a),l=pi(t);return{...PS(o,s,(u,d)=>zt(l,u,d)),xField:i,yField:r,axisDetails:t.axisDetails??void 0}}function Hy(t){const e=OS(t.map(r=>({key:r.label,value:r.value}))),n=new Map(t.filter(r=>r.color).map(r=>[String(r.label),r.color])),i=e.map((r,o)=>({key:r.key,color:String(o%12+1)}));return PS(e,e.map(r=>r.key),(r,o)=>n.get(r)??zt(i,r,o))}function ES(t){return t?Array.isArray(t)?_G(t)?Hy(t):Ro:Ht(t)?wG(t):$G(t)?Hy(t.points.map(e=>({label:String(e.x),value:e.y}))):Array.isArray(t.bars)?t:Ro:Ro}function dd(t,e){return i1(io(t),e)}function FS(t,e){return i1(n1(t),e)}var kG=Object.defineProperty,SG=Object.getOwnPropertyDescriptor,Mn=(t,e,n,i)=>{for(var r=i>1?void 0:i?SG(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&kG(e,n,r),r};let gr=class extends qt{constructor(){super(...arguments),this.scale="default",this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this._tooltip=null,this._empty=!1,this._model=null,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseData(){const t=Ot(this.dataJson,null);return ES(t)}renderLegend(t){if(!this.showLegend||!t.legend.length)return st;const e=wt(this);return ce(Nr(t.legend.map(n=>n.label),e,(n,i)=>{var r;return((r=t.legend[i])==null?void 0:r.color)??e.primary}))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseData();if(this._model=n,this._empty=n.bars.length===0,this._empty){e.replaceChildren();return}wt(this);const{width:i,height:r,margin:o}=fC(e,this.scale),a=n.xField,s=n.yField;DS(e,{bars:n.bars,width:i,height:r,margin:o,showGrid:this.showGrid,showTooltip:this.showTooltip,...this.axisLabelHandlers(),onHover:this.showTooltip?({bar:l,event:c})=>{var u,d;const h=this.getBoundingClientRect(),p=a?(u=n.axisDetails)==null?void 0:u[a]:void 0,m=s?(d=n.axisDetails)==null?void 0:d[s]:void 0;this._tooltip={x:c.clientX-h.left,y:c.clientY-h.top,title:dd(l.label),lines:[`${(p==null?void 0:p.label)??a??"Category"}: ${dd(l.label,p)}`,`${(m==null?void 0:m.label)??s??"Value"}: ${FS(l.value,m)}`]}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}render(){const t=this.headerTitle(),e=this._empty?null:this._model;return ot`
2147
+ <div class="widget-shell" part="shell">
2148
+ ${this.renderShellHeader(t)}
2149
+ <div class="widget-body">
2150
+ ${e?this.renderLegend(e):st}
2151
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
2152
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
2153
+ ${this._tooltip?ot`<div
2154
+ class="tooltip"
2155
+ part="tooltip"
2156
+ style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
2157
+ >
2158
+ <div class="tooltip-title">${this._tooltip.title}</div>
2159
+ ${this._tooltip.lines.map(n=>ot`<div>${n}</div>`)}
2160
+ </div>`:st}
2161
+ ${this.renderShellLabelTooltip()}
2162
+ </div>
2163
+ </div>
2164
+ `}};gr.styles=[xG,ne];Mn([Y({type:String,attribute:"scale"})],gr.prototype,"scale",2);Mn([Y({type:Boolean,attribute:"show-grid"})],gr.prototype,"showGrid",2);Mn([Y({type:Boolean,attribute:"show-legend"})],gr.prototype,"showLegend",2);Mn([Y({type:Boolean,attribute:"show-tooltip"})],gr.prototype,"showTooltip",2);Mn([yt()],gr.prototype,"_tooltip",2);Mn([yt()],gr.prototype,"_empty",2);Mn([yt()],gr.prototype,"_model",2);gr=Mn([Xt("ui9000-radial-bar-chart")],gr);function RS(){customElements.get("ui9000-radial-bar-chart")||customElements.define("ui9000-radial-bar-chart",gr)}RS();const AG=Object.freeze(Object.defineProperty({__proto__:null,RADIAL_BAR_SWEEP:Js,get Ui9000RadialBarChart(){return gr},formatRadialBarCategory:dd,formatRadialBarValue:FS,normalizeRadialBarData:ES,radialBarAngleScale:IS,radialBarArcWidth:MS,radialBarChartMetadata:r$,radialBarLabelLimit:NS,registerRadialBarChart:RS,renderRadialBarChart:DS},Symbol.toStringTag,{value:"Module"}));/**
2165
+ * @license
2166
+ * Copyright 2017 Google LLC
2167
+ * SPDX-License-Identifier: BSD-3-Clause
2168
+ */const Xs=globalThis,qy=t=>t,Qs=Xs.trustedTypes,Gy=Qs?Qs.createPolicy("lit-html",{createHTML:t=>t}):void 0,jS="$lit$",yn=`lit$${Math.random().toFixed(9).slice(2)}$`,US="?"+yn,zG=`<${US}>`,oi=document,tl=()=>oi.createComment(""),ia=t=>t===null||typeof t!="object"&&typeof t!="function",Df=Array.isArray,TG=t=>Df(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",mu=`[
2169
+ \f\r]`,wo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vy=/-->/g,Zy=/>/g,En=RegExp(`>|${mu}(?:([^\\s"'>=/]+)(${mu}*=${mu}*(?:[^
2170
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Wy=/'/g,Ky=/"/g,BS=/^(?:script|style|textarea|title)$/i,so=Symbol.for("lit-noChange"),xe=Symbol.for("lit-nothing"),Yy=new WeakMap,Bn=oi.createTreeWalker(oi,129);function HS(t,e){if(!Df(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gy!==void 0?Gy.createHTML(e):e}const LG=(t,e)=>{const n=t.length-1,i=[];let r,o=e===2?"<svg>":e===3?"<math>":"",a=wo;for(let s=0;s<n;s++){const l=t[s];let c,u,d=-1,h=0;for(;h<l.length&&(a.lastIndex=h,u=a.exec(l),u!==null);)h=a.lastIndex,a===wo?u[1]==="!--"?a=Vy:u[1]!==void 0?a=Zy:u[2]!==void 0?(BS.test(u[2])&&(r=RegExp("</"+u[2],"g")),a=En):u[3]!==void 0&&(a=En):a===En?u[0]===">"?(a=r??wo,d=-1):u[1]===void 0?d=-2:(d=a.lastIndex-u[2].length,c=u[1],a=u[3]===void 0?En:u[3]==='"'?Ky:Wy):a===Ky||a===Wy?a=En:a===Vy||a===Zy?a=wo:(a=En,r=void 0);const p=a===En&&t[s+1].startsWith("/>")?" ":"";o+=a===wo?l+zG:d>=0?(i.push(c),l.slice(0,d)+jS+l.slice(d)+yn+p):l+yn+(d===-2?s:p)}return[HS(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class oa{constructor({strings:e,_$litType$:n},i){let r;this.parts=[];let o=0,a=0;const s=e.length-1,l=this.parts,[c,u]=LG(e,n);if(this.el=oa.createElement(c,i),Bn.currentNode=this.el.content,n===2||n===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=Bn.nextNode())!==null&&l.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(const d of r.getAttributeNames())if(d.endsWith(jS)){const h=u[a++],p=r.getAttribute(d).split(yn),m=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:m[2],strings:p,ctor:m[1]==="."?IG:m[1]==="?"?MG:m[1]==="@"?NG:Lc}),r.removeAttribute(d)}else d.startsWith(yn)&&(l.push({type:6,index:o}),r.removeAttribute(d));if(BS.test(r.tagName)){const d=r.textContent.split(yn),h=d.length-1;if(h>0){r.textContent=Qs?Qs.emptyScript:"";for(let p=0;p<h;p++)r.append(d[p],tl()),Bn.nextNode(),l.push({type:2,index:++o});r.append(d[h],tl())}}}else if(r.nodeType===8)if(r.data===US)l.push({type:2,index:o});else{let d=-1;for(;(d=r.data.indexOf(yn,d+1))!==-1;)l.push({type:7,index:o}),d+=yn.length-1}o++}}static createElement(e,n){const i=oi.createElement("template");return i.innerHTML=e,i}}function lo(t,e,n=t,i){var r,o;if(e===so)return e;let a=i!==void 0?(r=n._$Co)==null?void 0:r[i]:n._$Cl;const s=ia(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==s&&((o=a==null?void 0:a._$AO)==null||o.call(a,!1),s===void 0?a=void 0:(a=new s(t),a._$AT(t,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=a:n._$Cl=a),a!==void 0&&(e=lo(t,a._$AS(t,e.values),a,i)),e}class CG{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??oi).importNode(n,!0);Bn.currentNode=r;let o=Bn.nextNode(),a=0,s=0,l=i[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new Tc(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new DG(o,this,e)),this._$AV.push(c),l=i[++s]}a!==(l==null?void 0:l.index)&&(o=Bn.nextNode(),a++)}return Bn.currentNode=oi,r}p(e){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,n),n+=i.strings.length-2):i._$AI(e[n])),n++}}class Tc{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,n,i,r){this.type=2,this._$AH=xe,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=lo(this,e,n),ia(e)?e===xe||e==null||e===""?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==so&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):TG(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==xe&&ia(this._$AH)?this._$AA.nextSibling.data=e:this.T(oi.createTextNode(e)),this._$AH=e}$(e){var n;const{values:i,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=oa.createElement(HS(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===o)this._$AH.p(i);else{const a=new CG(o,this),s=a.u(this.options);a.p(i),this.T(s),this._$AH=a}}_$AC(e){let n=Yy.get(e.strings);return n===void 0&&Yy.set(e.strings,n=new oa(e)),n}k(e){Df(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,r=0;for(const o of e)r===n.length?n.push(i=new Tc(this.O(tl()),this.O(tl()),this,this.options)):i=n[r],i._$AI(o),r++;r<n.length&&(this._$AR(i&&i._$AB.nextSibling,r),n.length=r)}_$AR(e=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);e!==this._$AB;){const r=qy(e).nextSibling;qy(e).remove(),e=r}}setConnected(e){var n;this._$AM===void 0&&(this._$Cv=e,(n=this._$AP)==null||n.call(this,e))}}class Lc{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,i,r,o){this.type=1,this._$AH=xe,this._$AN=void 0,this.element=e,this.name=n,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=xe}_$AI(e,n=this,i,r){const o=this.strings;let a=!1;if(o===void 0)e=lo(this,e,n,0),a=!ia(e)||e!==this._$AH&&e!==so,a&&(this._$AH=e);else{const s=e;let l,c;for(e=o[0],l=0;l<o.length-1;l++)c=lo(this,s[i+l],n,l),c===so&&(c=this._$AH[l]),a||(a=!ia(c)||c!==this._$AH[l]),c===xe?e=xe:e!==xe&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class IG extends Lc{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}}class MG extends Lc{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==xe)}}class NG extends Lc{constructor(e,n,i,r,o){super(e,n,i,r,o),this.type=5}_$AI(e,n=this){if((e=lo(this,e,n,0)??xe)===so)return;const i=this._$AH,r=e===xe&&i!==xe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==xe&&(i===xe||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,e):this._$AH.handleEvent(e)}}class DG{constructor(e,n,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){lo(this,e)}}const Jy=Xs.litHtmlPolyfillSupport;Jy==null||Jy(oa,Tc),(Xs.litHtmlVersions??(Xs.litHtmlVersions=[])).push("3.3.3");/**
2171
+ * @license
2172
+ * Copyright 2017 Google LLC
2173
+ * SPDX-License-Identifier: BSD-3-Clause
2174
+ */const OG={ATTRIBUTE:1},PG=t=>(...e)=>({_$litDirective$:t,values:e});let EG=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,i){this._$Ct=e,this._$AM=n,this._$Ci=i}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}};/**
2175
+ * @license
2176
+ * Copyright 2018 Google LLC
2177
+ * SPDX-License-Identifier: BSD-3-Clause
2178
+ */const qS="important",FG=" !"+qS,RG=PG(class extends EG{constructor(t){var e;if(super(t),t.type!==OG.ATTRIBUTE||t.name!=="style"||((e=t.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,n)=>{const i=t[n];return i==null?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(t,[e]){const{style:n}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?n.removeProperty(i):n[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const o=typeof r=="string"&&r.endsWith(FG);i.includes("-")||o?n.setProperty(i,o?r.slice(0,-11):r,o?qS:""):n[i]=r}}return so}}),jG=ie`
2179
+ :host {
2180
+ display: block;
2181
+ position: relative;
2182
+ width: 100%;
2183
+ height: 100%;
2184
+ min-height: 95px;
2185
+ color: var(--ui9000-color-text, #111827);
2186
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
2187
+ box-sizing: border-box;
2188
+ }
2189
+
2190
+ .kpi-root[data-single='true'] {
2191
+ min-height: 120px;
2192
+ }
2193
+
2194
+ .kpi-root {
2195
+ display: flex;
2196
+ flex-direction: column;
2197
+ width: 100%;
2198
+ height: 100%;
2199
+ min-height: inherit;
2200
+ }
2201
+
2202
+ .kpi-grid {
2203
+ flex: 1;
2204
+ min-height: 0;
2205
+ width: 100%;
2206
+ }
2207
+
2208
+ .kpi-grid[data-layout='grid'] {
2209
+ display: grid;
2210
+ grid-auto-rows: minmax(72px, 1fr);
2211
+ gap: 0;
2212
+ align-content: start;
2213
+ }
2214
+
2215
+ .kpi-grid[data-layout='single'] {
2216
+ display: flex;
2217
+ flex-direction: column;
2218
+ justify-content: center;
2219
+ align-items: stretch;
2220
+ }
2221
+
2222
+ .kpi-grid[data-scroll='vertical'] {
2223
+ overflow-x: hidden;
2224
+ overflow-y: auto;
2225
+ }
2226
+
2227
+ .kpi-grid[data-scroll='horizontal'] {
2228
+ overflow-x: auto;
2229
+ overflow-y: hidden;
2230
+ }
2231
+
2232
+ .kpi-grid[data-scroll='both'] {
2233
+ overflow: auto;
2234
+ }
2235
+
2236
+ .kpi-grid {
2237
+ scrollbar-width: thin;
2238
+ }
2239
+
2240
+ .kpi-card {
2241
+ display: flex;
2242
+ flex-direction: column;
2243
+ justify-content: center;
2244
+ min-width: 0;
2245
+ padding: 10px 12px;
2246
+ box-sizing: border-box;
2247
+ }
2248
+
2249
+ .kpi-grid[data-layout='single'] .kpi-card {
2250
+ padding: 14px;
2251
+ }
2252
+
2253
+ .kpi-name {
2254
+ margin: 0 0 4px;
2255
+ font-size: 12px;
2256
+ font-weight: 500;
2257
+ line-height: 1.3;
2258
+ color: var(--ui9000-color-text-muted, #6b7280);
2259
+ overflow: hidden;
2260
+ text-overflow: ellipsis;
2261
+ white-space: nowrap;
2262
+ }
2263
+
2264
+ .kpi-value-row {
2265
+ display: flex;
2266
+ align-items: baseline;
2267
+ gap: 4px;
2268
+ flex-wrap: wrap;
2269
+ }
2270
+
2271
+ .kpi-value {
2272
+ margin: 0;
2273
+ font-size: 24px;
2274
+ font-weight: 700;
2275
+ line-height: 1.15;
2276
+ color: var(--ui9000-color-text, #111827);
2277
+ }
2278
+
2279
+ .kpi-unit {
2280
+ font-size: 14px;
2281
+ font-weight: 300;
2282
+ }
2283
+
2284
+ .kpi-indicator {
2285
+ font-size: 12px;
2286
+ font-weight: 600;
2287
+ color: var(--ui9000-color-text-muted, #6b7280);
2288
+ }
2289
+
2290
+ .kpi-subtitle {
2291
+ margin: 6px 0 0;
2292
+ padding-left: 15px;
2293
+ position: relative;
2294
+ font-size: 12px;
2295
+ line-height: 1.35;
2296
+ color: var(--ui9000-color-text-muted, #6b7280);
2297
+ }
2298
+
2299
+ .kpi-subtitle::before {
2300
+ content: '';
2301
+ position: absolute;
2302
+ left: 0;
2303
+ top: 50%;
2304
+ width: 10px;
2305
+ height: 10px;
2306
+ border-radius: 50%;
2307
+ transform: translateY(-50%);
2308
+ background: var(--ui9000-color-text-muted, #6b7280);
2309
+ }
2310
+
2311
+ .empty {
2312
+ display: grid;
2313
+ place-items: center;
2314
+ flex: 1;
2315
+ min-height: 72px;
2316
+ color: var(--ui9000-color-text-muted, #6b7280);
2317
+ font-size: 13px;
2318
+ }
2319
+ `;function Mo(t,e=2){const n=Number(t);if(Number.isNaN(n)||n===null||!Number.isFinite(n))return"—";const i=Math.abs(n);if(i===0)return"0";if(i>=.1)return new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:e}).format(n);const r=Math.ceil(Math.abs(Math.log10(i)/3))*3,o=n*10**r;return`${parseFloat(o.toFixed(e)).toString()}×10⁻${r}`}function UG(t){if(!t||typeof t!="object")return;const e=t;return{position:e.measure_unit_type==="currency"?"left":"right",text:e.measure_unit_type==="currency"?e.measure_unit_symbol??"":e.measure_unit??""}}function as(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:null}function Of(t){var e;const n=t.column??"value",r=`${t.aggregations??"sum"}_${n}`,o=Array.isArray(t.data)?as(t.data[0]):null;if(!o)return[];const a=(e=t.axisDetails)==null?void 0:e[n],s=UG(a),l=t.type??"single_value",c=t.id??t.name??n,u=t.name??n;if(l==="trend"||l==="overall"){const h=o.percentage;return[{id:c,name:u,value:Mo(o[r]),indicator:Number(h)?`${Number(h).toFixed(2)}%`:void 0,label:s}]}if(l==="comparison"){const h=as(o.current),p=o.percentage;return[{id:c,name:u,value:Mo(h==null?void 0:h[r]),indicator:Number(p)?`${Number(p).toFixed(2)}%`:void 0,label:s}]}if(l==="single_value"){const h=as(o.value)??o,p=h[r]??h[n]??Object.values(h)[0];return[{id:c,name:u,value:Mo(p),label:s}]}const d=[];for(const h of Object.keys(o)){if(h==="percentage"||h==="value")continue;const p=as(o[h]);if(!p)continue;const m=t.groupBy?String(p[t.groupBy]??h):h,v=Number(p.percentage)?`${Number(p.percentage).toFixed(2)}%`:void 0;d.push({id:`${c}-${h}`,name:u,value:Mo(p[r]),subtitle:m,indicator:v,label:s})}return d}const gu={cards:[]};function BG(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)&&("data"in t||"column"in t)}function yu(t){return{cards:t.flatMap(e=>Of(e))}}function GS(t){if(!t)return gu;if(Array.isArray(t))return t.length?yu(t):gu;if(typeof t=="object"){if(Array.isArray(t.cards))return t;if(Array.isArray(t.items))return yu(t.items);if(Array.isArray(t.kpis))return yu(t.kpis);if(BG(t))return{cards:Of(t)}}return gu}const Pf=90,HG=t=>{if(t<=1)return[1];const e=[];for(let n=t;n>=1;n-=1)t%n===0&&e.push(n);return t%2!==0&&t>2&&!e.includes(2)&&(e.push(2),e.sort((n,i)=>i-n)),e},VS=(t,e,n=Pf)=>{if(e<=1||t<=0)return 1;const i=Math.max(1,Math.min(e,Math.floor(t/n)));return HG(e).find(o=>o<=i)??1},ZS=(t,e)=>{if(e<=1)return"vertical";const n=Math.max(1,t),i=Math.ceil(e/n);return n===1?"vertical":i===1?"horizontal":"both"};var qG=Object.defineProperty,GG=Object.getOwnPropertyDescriptor,Fa=(t,e,n,i)=>{for(var r=i>1?void 0:i?GG(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&qG(e,n,r),r};let on=class extends qt{constructor(){super(...arguments),this.scale="default",this._cards=[],this._gridColumns=1,this._scrollAxis="vertical"}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.updateGridLayout()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),super.disconnectedCallback()}updated(t){if(t.has("dataJson")){const e=GS(Ot(this.dataJson,null));this._cards=e.cards,this.updateGridLayout()}}updateGridLayout(){const t=this._cards.length,e=VS(this.clientWidth,t),n=ZS(e,t);e!==this._gridColumns&&(this._gridColumns=e),n!==this._scrollAxis&&(this._scrollAxis=n)}renderValue(t){const e=t.label,n=(e==null?void 0:e.position)==="left"&&e.text,i=(e==null?void 0:e.position)==="right"&&e.text;return ot`
2320
+ <div class="kpi-value-row">
2321
+ ${n?ot`<span class="kpi-unit">${n}</span>`:st}
2322
+ <h2 class="kpi-value">${t.value}</h2>
2323
+ ${i?ot`<span class="kpi-unit">${i}</span>`:st}
2324
+ ${t.indicator?ot`<span class="kpi-indicator">${t.indicator}</span>`:st}
2325
+ </div>
2326
+ `}renderCard(t){return ot`
2327
+ <article class="kpi-card" aria-label=${t.name}>
2328
+ <p class="kpi-name">${t.name}</p>
2329
+ ${this.renderValue(t)}
2330
+ ${t.subtitle?ot`<p class="kpi-subtitle">${t.subtitle}</p>`:st}
2331
+ </article>
2332
+ `}render(){const t=this.headerTitle(),e=this._cards.length<=1,n=e?st:RG({gridTemplateColumns:`repeat(${this._gridColumns}, minmax(${Pf}px, 1fr))`});return ot`
2333
+ <div class="kpi-root" data-single=${e?"true":"false"}>
2334
+ ${this.renderShellHeader(t)}
2335
+ ${this._cards.length===0?ot`<div class="empty">No KPI data</div>`:ot`
2336
+ <div
2337
+ class="kpi-grid"
2338
+ data-layout=${e?"single":"grid"}
2339
+ data-scroll=${this._scrollAxis}
2340
+ ${n}
2341
+ >
2342
+ ${this._cards.map(i=>this.renderCard(i))}
2343
+ </div>
2344
+ `}
2345
+ ${this.renderShellLabelTooltip()}
2346
+ </div>
2347
+ `}};on.styles=[jG,ne];Fa([Y({type:String,attribute:"scale"})],on.prototype,"scale",2);Fa([yt()],on.prototype,"_cards",2);Fa([yt()],on.prototype,"_gridColumns",2);Fa([yt()],on.prototype,"_scrollAxis",2);on=Fa([Xt("ui9000-kpi-widget")],on);function VG(){customElements.get("ui9000-kpi-widget")||customElements.define("ui9000-kpi-widget",on)}const ZG=Object.freeze(Object.defineProperty({__proto__:null,MIN_KPI_CELL_WIDTH:Pf,get Ui9000KpiWidget(){return on},extractCardsFromKpi:Of,formatKpiValue:Mo,getKpiGridColumns:VS,getKpiGridScrollAxis:ZS,kpiWidgetMetadata:Z_,normalizeKpiData:GS,registerKpiWidget:VG},Symbol.toStringTag,{value:"Module"})),Xy=1e-6;function WS(t,e){let n=1/0,i=-1/0;for(const r of t)Number.isFinite(r)&&(r<n&&(n=r),r>i&&(i=r));return!Number.isFinite(n)||!Number.isFinite(i)?e:i>n?[n,i]:[n-Xy,i+Xy]}function KS(t){const e=[];for(const n of t)for(const i of n.points)e.push(i.p);return WS(e,[0,1])}function YS(t){const e=[];for(const n of t)for(const i of n.points)e.push(i.value);return WS(e,[0,1])}function zi(t){return 2*t*(1-t)}function aa(t){return Math.max(0,Math.min(1,t))}function Hn(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function WG(t){if(!Array.isArray(t)||t.length<2)return;const e=Hn(t[0]),n=Hn(t[1]);if(!(e===void 0||n===void 0))return[aa(Math.min(e,n)),aa(Math.max(e,n))]}function KG(t){if(!t||typeof t!="object")return;const e=t,n=Hn(e.pLeft),i=Hn(e.pRight);if(!(n===void 0||i===void 0))return{pLeft:aa(n),pRight:aa(i),nLeft:Hn(e.nLeft),nRight:Hn(e.nRight)}}function Ra(t,e={}){const n=Hn(t==null?void 0:t.pHat);return{pHat:n===void 0?void 0:aa(n),ci:WG(t==null?void 0:t.ci),split:KG(t==null?void 0:t.split),showPHat:e.showPHat??(t==null?void 0:t.showPHat)??!1,showCI:e.showCI??(t==null?void 0:t.showCI)??!1,showSplit:e.showSplit??(t==null?void 0:t.showSplit)??!1}}function JS(t){if(!t.showSplit||!t.split)return null;const{pLeft:e,pRight:n}=t.split,i=t.split.nLeft??1,r=t.split.nRight??1,o=i+r;if(!(o>0))return null;const a=i/o*zi(e)+r/o*zi(n),s=zi(t.pHat??.5);return{pLeft:e,pRight:n,leftValue:zi(e),rightValue:zi(n),delta:s-a}}function XS(t){return Number.isFinite(t)?Math.abs(t)>=1e3?Pt(t,1):t.toFixed(1):""}function Ef(t){return Number.isFinite(t)?Number.isInteger(t)?String(t):String(Number(t.toFixed(4))):""}function QS(t){return Number.isFinite(t)?Math.abs(t)>=1e3?Pt(t,2):t.toFixed(3):""}const ja=["entropy","gini","mis"],Ff={entropy:{color:"#36C4A5"},gini:{color:"#473DD9",dash:"5,5"},mis:{color:"#56546D",dash:"5,5"}},Rf={entropy:"Entropy",gini:"Gini Impurity",mis:"Misclassification Error"},Ua="Impurity Index";function t2(t,e,n){const i=Array.isArray(t)?t:[],r=n!=null&&n.length?n:ja,o={};for(const a of r)o[a]=[];for(const a of i){if(!a||typeof a!="object")continue;const s=Number(a[e]);if(Number.isFinite(s))for(const l of r){if(a[l]===void 0)continue;const c=Number(a[l]);Number.isFinite(c)&&o[l].push({p:s,value:c})}}for(const a of r)o[a].sort((s,l)=>s.p-l.p);return o}function e2(t,e){if(!t.length)return null;let n=0,i=t.length-1;for(;n<i;){const a=n+i>>1;t[a].p<e?n=a+1:i=a}let r=t[n],o=Math.abs(r.p-e);for(const a of[t[n-1],t[n+1]]){if(!a)continue;const s=Math.abs(a.p-e);s<o&&(r=a,o=s)}return r}function r2(t,e){const{model:n,width:i,height:r,margin:o={...f.giniMargin},theme:a,showGrid:s=!0,themeMode:l="light",onHover:c,onLeave:u,onAxisLabelHover:d,onAxisLabelLeave:h}=e;if(t.replaceChildren(),!n.series.length||i<=0||r<=0)return;const p={top:o.top,bottom:o.bottom,left:er(o.left),right:Math.max(o.right,1)},m=p.top,v=r-p.bottom,b=p.left,g=i-p.right;if(g-b<8||v-m<8)return;const $=Ft().domain(KS(n.series)).range([b,g]),_=Ft().domain(YS(n.series)).range([v,m]),y=ge(r),S=_.ticks(y),L=ht(t).append("svg").attr("width",i).attr("height",r).attr("role","img").attr("aria-label","Gini impurity and entropy chart").style("display","block").style("font-family",a.fontFamily).append("g").attr("class","plot");if(s){const x=L.append("g").attr("class","grid");for(const A of S)x.append("line").attr("x1",b).attr("x2",g).attr("y1",_(A)).attr("y2",_(A)).attr("stroke",f.gridStroke).attr("stroke-dasharray",f.gridDash).attr("shape-rendering","crispEdges")}const{overlays:N}=n;if(N.showCI&&N.ci){const[x,A]=N.ci;L.append("rect").attr("class","ci-band").attr("x",$(x)).attr("y",m).attr("width",Math.max(0,$(A)-$(x))).attr("height",v-m).attr("fill",f.giniOverlayColor).attr("fill-opacity",f.giniOverlayBandOpacity)}const E=lr().defined(x=>Number.isFinite(x.value)).x(x=>$(x.p)).y(x=>_(x.value)).curve(Rs.alpha(f.giniCurveAlpha)),H=L.append("g").attr("class","curves"),F=n.series.map(x=>H.append("path").attr("class",`curve curve-${x.id}`).datum(x.points).attr("fill","none").attr("stroke",x.color).attr("stroke-width",f.lineStrokeWidth).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-dasharray",x.dash??null).attr("d",E));if(N.showPHat&&N.pHat!==void 0){const x=$(N.pHat);L.append("line").attr("class","p-hat-guide").attr("x1",x).attr("x2",x).attr("y1",m).attr("y2",v).attr("stroke",f.giniOverlayColor).attr("stroke-width",f.lineStrokeWidth).attr("stroke-dasharray",f.giniOverlayDash)}const W=JS(N);if(W){const x=L.append("g").attr("class","split-anno"),A=[[W.pLeft,W.leftValue],[W.pRight,W.rightValue]];for(const[D,R]of A)x.append("circle").attr("cx",$(D)).attr("cy",_(R)).attr("r",f.giniSplitMarkerRadius).attr("fill",f.giniSplitMarkerFill).attr("stroke",f.giniSplitMarkerStroke).attr("stroke-width",1.5);x.append("text").attr("class","split-label").attr("x",$((W.pLeft+W.pRight)/2)).attr("y",_(Math.max(W.leftValue,W.rightValue))-f.giniSplitLabelOffset).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(`ΔGini = ${W.delta.toFixed(3)}`)}const M=L.append("g").attr("class","x-axis").attr("transform",`translate(0,${v})`).call(ae($).ticks(y).tickSize(0).tickPadding(8).tickFormat(x=>Ef(Number(x))));M.select(".domain").attr("stroke",f.axisStroke),M.selectAll("text").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize),cr(M,{onAxisLabelHover:d,onAxisLabelLeave:h});const z=L.append("g").attr("class","y-axis").attr("transform",`translate(${b},0)`).call(Jt(_).tickValues(S).tickSize(5).tickPadding(6).tickFormat(x=>XS(Number(x))));if(z.select(".domain").attr("stroke","none"),z.selectAll("line").attr("stroke",f.axisStroke).attr("stroke-dasharray",f.gridDash),we(z,b),n.xLabel&&L.append("text").attr("class","x-axis-label").attr("x",(b+g)/2).attr("y",r-2).attr("text-anchor","middle").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(n.xLabel),n.yLabel&&L.append("text").attr("class","y-axis-label").attr("x",4).attr("y",11).attr("text-anchor","start").attr("fill",f.axisLabelFill).attr("font-size",f.axisLabelSize).text(n.yLabel),!c)return;const T=L.append("g").attr("class","hover").attr("opacity",0),C=T.append("line").attr("class","hover-guide").attr("y1",m).attr("y2",v).attr("stroke",l==="dark"?f.hoverGuideDark:f.hoverGuideLight).attr("stroke-width",f.lineStrokeWidth).attr("pointer-events","none"),k=n.series.map(x=>T.append("circle").attr("class","hover-dot").attr("r",f.markerRadius).attr("fill",x.color).attr("stroke",l==="dark"?"#000":"#fff").attr("stroke-width",1.5).attr("pointer-events","none"));L.append("rect").attr("class","hover-surface").attr("x",b).attr("y",m).attr("width",g-b).attr("height",v-m).attr("fill","transparent").on("mousemove",x=>{const[A]=Ie(x,t),D=$.invert(A),R=n.series.map(nt=>e2(nt.points,D)),B=R.find(nt=>nt!==null);if(!B){T.attr("opacity",0),F.forEach(nt=>nt.attr("opacity",1));return}const[,X]=Ie(x,t);let et=-1,K=1/0;R.forEach((nt,tt)=>{if(!nt)return;const j=Math.abs(_(nt.value)-X);j<K&&(K=j,et=tt)});const at=[];R.forEach((nt,tt)=>{const j=tt===et;if(F[tt].attr("opacity",j?1:f.giniCurveDimOpacity),!nt){k[tt].attr("opacity",0);return}k[tt].attr("opacity",j?1:f.giniCurveDimOpacity).attr("cx",$(nt.p)).attr("cy",_(nt.value));const I=n.series[tt];at.push({seriesId:I.id,seriesName:I.name,color:I.color,value:nt.value})}),C.attr("x1",$(B.p)).attr("x2",$(B.p)),T.attr("opacity",1),c({p:B.p,entries:at,activeSeriesId:et>=0?n.series[et].id:null,event:x})}).on("mouseleave",()=>{T.attr("opacity",0),F.forEach(x=>x.attr("opacity",1)),u==null||u()})}const YG=ie`
2348
+ :host {
2349
+ display: block;
2350
+ position: relative;
2351
+ width: 100%;
2352
+ height: 100%;
2353
+ min-height: 220px;
2354
+ color: var(--ui9000-color-text, #111827);
2355
+ font-family: var(--ui9000-font-family, system-ui, sans-serif);
2356
+ box-sizing: border-box;
2357
+ }
2358
+ .chart-root {
2359
+ flex: 1;
2360
+ min-height: 0;
2361
+ width: 100%;
2362
+ height: 100%;
2363
+ min-height: inherit;
2364
+ }
2365
+ .tooltip {
2366
+ position: absolute;
2367
+ pointer-events: none;
2368
+ z-index: 2;
2369
+ padding: 6px 10px;
2370
+ border-radius: 6px;
2371
+ font-size: 12px;
2372
+ line-height: 1.35;
2373
+ background: var(--ui9000-color-text, #111827);
2374
+ color: #fff;
2375
+ box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
2376
+ transform: translate(-50%, calc(-100% - 10px));
2377
+ white-space: nowrap;
2378
+ }
2379
+ .tooltip .name {
2380
+ font-weight: 600;
2381
+ margin-bottom: 2px;
2382
+ }
2383
+ .tooltip .row {
2384
+ display: flex;
2385
+ align-items: center;
2386
+ gap: 6px;
2387
+ }
2388
+ /** Mirrors the plot: the curve under the cursor reads full strength. */
2389
+ .tooltip .row.dimmed {
2390
+ opacity: 0.55;
2391
+ }
2392
+ .tooltip .row.active {
2393
+ font-weight: 600;
2394
+ }
2395
+ .tooltip .dot {
2396
+ width: 8px;
2397
+ height: 8px;
2398
+ border-radius: 50%;
2399
+ flex-shrink: 0;
2400
+ }
2401
+ .tooltip .value {
2402
+ margin-left: auto;
2403
+ font-variant-numeric: tabular-nums;
2404
+ }
2405
+ .empty {
2406
+ display: grid;
2407
+ place-items: center;
2408
+ height: 100%;
2409
+ min-height: inherit;
2410
+ color: var(--ui9000-color-text-muted, #6b7280);
2411
+ font-size: 0.875rem;
2412
+ }
2413
+ `;function Qy(t){return{series:[],xLabel:"",yLabel:Ua,overlays:Ra(null,t)}}function JG(t){const e=Array.isArray(t)?t.map(String).filter(Boolean):[];return e.length>0&&e[0]!=="value"?e:ja}function XG(t,e,n,i){const r=Ff[t];return r||{color:zt(i,t,n),dash:e>0?"5,5":void 0}}function jf(t,e,n,i,r){const{color:o,dash:a}=XG(e,n,i,r);return{id:e,name:Rf[e]??e,color:o,dash:a,points:t}}function QG(t,e){var n,i,r,o;const a=ft(t.xAxe)??"p",s=JG(t.yAxe),l=t2(t.data,a,s);return{series:s.filter(u=>{var d;return(d=l[u])==null?void 0:d.length}).map((u,d,h)=>jf(l[u],u,d,h.length,t.formatting)),xLabel:((i=(n=t.axisDetails)==null?void 0:n[a])==null?void 0:i.label)??a,yLabel:((o=(r=t.axisDetails)==null?void 0:r.value)==null?void 0:o.label)??Ua,overlays:Ra(t.meta,e)}}function hd(t){const e=[];for(const n of t){const i=Number(n==null?void 0:n.x),r=Number(n==null?void 0:n.y);!Number.isFinite(i)||!Number.isFinite(r)||e.push({p:i,value:r})}return e.sort((n,i)=>n.p-i.p)}function tV(t,e){const n={xLabel:t.xLabel??"",yLabel:t.yLabel??Ua,overlays:Ra(t.meta,e)},i=t.series??[];if(i.length){const o=[];return i.forEach((a,s)=>{const l=hd(a.points??[]);if(!l.length)return;const c=Ff[a.id];o.push({id:a.id||`series-${s}`,name:a.name??Rf[a.id]??a.id,color:a.color??(c==null?void 0:c.color)??zt(null,a.id,i.length),dash:a.dash??(c==null?void 0:c.dash),points:l})}),{...n,series:o}}const r=hd(t.points??[]);return r.length?{...n,series:[jf(r,ja[1],0,1,null)]}:{...n,series:[]}}function n2(t,e={}){if(!t)return Qy(e);if(Array.isArray(t)){const n=hd(t.map(i=>({x:i==null?void 0:i.label,y:Number(i==null?void 0:i.value)})));return n.length?{series:[jf(n,ja[1],0,1,null)],xLabel:"",yLabel:Ua,overlays:Ra(null,e)}:Qy(e)}return Ht(t)?QG(t,e):tV(t,e)}var eV=Object.defineProperty,rV=Object.getOwnPropertyDescriptor,hn=(t,e,n,i)=>{for(var r=i>1?void 0:i?rV(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&eV(e,n,r),r};let Xe=class extends qt{constructor(){super(...arguments),this.showGrid=!0,this.showLegend=!0,this.showTooltip=!0,this.showPHat=!1,this.showCI=!1,this.showSplit=!1,this._tooltip=null,this._empty=!1,this._raf=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this.scheduleDraw()),this._resizeObserver.observe(this)}disconnectedCallback(){var t;(t=this._resizeObserver)==null||t.disconnect(),cancelAnimationFrame(this._raf),super.disconnectedCallback()}updated(t){re(t)&&this.scheduleDraw()}scheduleDraw(){cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>this.draw())}parseModel(){var t;const e=`${this.showPHat}|${this.showCI}|${this.showSplit}|${this.dataJson}`;if(((t=this._model)==null?void 0:t.key)===e)return this._model.value;const n=Ot(this.dataJson,null),i=n2(n,{showPHat:this.showPHat||void 0,showCI:this.showCI||void 0,showSplit:this.showSplit||void 0});return this._model={key:e,value:i},i}renderLegend(t){return!this.showLegend||!t.series.length?st:ce(t.series.map(e=>({label:e.name,swatch:e.dash?{kind:"dashed-line",color:e.color}:{kind:"line",color:e.color}})))}draw(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".chart-root");if(!e)return;const n=this.parseModel();if(this._empty=n.series.length===0,this._empty){e.replaceChildren();return}const{width:i,height:r,margin:o}=vC(e);r2(e,{model:n,width:i,height:r,margin:o,theme:wt(this),showGrid:this.showGrid,...this.axisLabelHandlers(),onHover:this.showTooltip?({p:a,entries:s,activeSeriesId:l,event:c})=>{const u=this.getBoundingClientRect();this._tooltip={x:c.clientX-u.left,y:c.clientY-u.top,p:a,entries:s,activeSeriesId:l}}:void 0,onLeave:this.showTooltip?()=>{this._tooltip=null}:void 0})}renderTooltip(){if(!this._tooltip)return st;const{x:t,y:e,p:n,entries:i,activeSeriesId:r}=this._tooltip;return ot`<div class="tooltip" part="tooltip" style="left:${t}px;top:${e}px">
2414
+ <div class="name">p = ${Ef(n)}</div>
2415
+ ${i.map(o=>ot`<div
2416
+ class="row ${o.seriesId===r?"active":"dimmed"}"
2417
+ >
2418
+ <span class="dot" style="background:${o.color}"></span>
2419
+ <span>${o.seriesName}</span>
2420
+ <span class="value">${QS(o.value)}</span>
2421
+ </div>`)}
2422
+ </div>`}render(){const t=this.headerTitle(),e=this.parseModel();return ot`
2423
+ <div class="widget-shell" part="shell">
2424
+ ${this.renderShellHeader(t)}
2425
+ <div class="widget-body">
2426
+ ${this.renderLegend(e)}
2427
+ <div class="chart-root" part="chart" ?hidden=${this._empty}></div>
2428
+ ${this._empty?ot`<div class="empty" part="empty">No data</div>`:st}
2429
+ ${this.renderTooltip()} ${this.renderShellLabelTooltip()}
2430
+ </div>
2431
+ </div>
2432
+ `}};Xe.styles=[YG,ne];hn([Y({type:Boolean,attribute:"show-grid"})],Xe.prototype,"showGrid",2);hn([Y({type:Boolean,attribute:"show-legend"})],Xe.prototype,"showLegend",2);hn([Y({type:Boolean,attribute:"show-tooltip"})],Xe.prototype,"showTooltip",2);hn([Y({type:Boolean,attribute:"show-p-hat"})],Xe.prototype,"showPHat",2);hn([Y({type:Boolean,attribute:"show-ci"})],Xe.prototype,"showCI",2);hn([Y({type:Boolean,attribute:"show-split"})],Xe.prototype,"showSplit",2);hn([yt()],Xe.prototype,"_tooltip",2);hn([yt()],Xe.prototype,"_empty",2);Xe=hn([Xt("ui9000-gini-impurity-entropy-chart")],Xe);function i2(){customElements.get("ui9000-gini-impurity-entropy-chart")||customElements.define("ui9000-gini-impurity-entropy-chart",Xe)}i2();const nV=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SERIES_KEYS:ja,DEFAULT_SERIES_STYLE:Ff,DEFAULT_Y_LABEL:Ua,SERIES_LABELS:Rf,get Ui9000GiniImpurityEntropyChart(){return Xe},collectPExtent:KS,collectValueExtent:YS,extractSeriesFromData:t2,formatImpurityTick:XS,formatImpurityValue:QS,formatProbability:Ef,giniImpurity:zi,giniImpurityEntropyChartMetadata:G_,nearestPoint:e2,normalizeGiniImpurityEntropyData:n2,registerGiniImpurityEntropyChart:i2,renderGiniImpurityEntropyChart:r2,resolveOverlays:Ra,splitAnnotation:JS},Symbol.toStringTag,{value:"Module"}));</script>
2433
+ </head>
2434
+ <body>
2435
+ <div id="shell">
2436
+ <div id="status" data-state="pending">Loading…</div>
2437
+ <div id="widget-host" hidden></div>
2438
+ <div id="empty-state" hidden data-testid="chart-unsupported">
2439
+ <p id="empty-title"></p>
2440
+ <p id="empty-detail"></p>
2441
+ </div>
2442
+ </div>
2443
+ </body>
2444
+ </html>