stickyflow 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +157 -0
- package/LICENSE +202 -0
- package/README.md +167 -2
- package/dist/chunk-34PK7HEU.cjs +842 -0
- package/dist/chunk-34PK7HEU.cjs.map +1 -0
- package/dist/chunk-6JKNT2YC.js +4685 -0
- package/dist/chunk-6JKNT2YC.js.map +1 -0
- package/dist/chunk-6LQJUAD4.js +801 -0
- package/dist/chunk-6LQJUAD4.js.map +1 -0
- package/dist/chunk-IIOJFR73.cjs +3671 -0
- package/dist/chunk-IIOJFR73.cjs.map +1 -0
- package/dist/chunk-KFJIFHXG.js +8559 -0
- package/dist/chunk-KFJIFHXG.js.map +1 -0
- package/dist/chunk-N6WVHOUQ.js +3665 -0
- package/dist/chunk-N6WVHOUQ.js.map +1 -0
- package/dist/chunk-S5BVAAEF.cjs +8568 -0
- package/dist/chunk-S5BVAAEF.cjs.map +1 -0
- package/dist/chunk-YM3XFBI4.cjs +4814 -0
- package/dist/chunk-YM3XFBI4.cjs.map +1 -0
- package/dist/index.cjs +1167 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +335 -0
- package/dist/index.d.ts +335 -0
- package/dist/index.js +1097 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/index.cjs +7358 -0
- package/dist/interaction/index.cjs.map +1 -0
- package/dist/interaction/index.d.cts +273 -0
- package/dist/interaction/index.d.ts +273 -0
- package/dist/interaction/index.js +7333 -0
- package/dist/interaction/index.js.map +1 -0
- package/dist/render-r1GYvjNm.d.cts +970 -0
- package/dist/render-r1GYvjNm.d.ts +970 -0
- package/dist/runtimeTypes-ByiafBwg.d.ts +239 -0
- package/dist/runtimeTypes-DwLeD-em.d.cts +239 -0
- package/dist/stickyflow-diagram.global.js +1442 -0
- package/dist/stickyflow-diagram.global.js.map +1 -0
- package/dist/types-T7W2yTQF.d.cts +116 -0
- package/dist/types-ndGA1kbl.d.ts +116 -0
- package/dist/viewer/index.cjs +31 -0
- package/dist/viewer/index.cjs.map +1 -0
- package/dist/viewer/index.d.cts +44 -0
- package/dist/viewer/index.d.ts +44 -0
- package/dist/viewer/index.js +6 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/web-component/index.cjs +144 -0
- package/dist/web-component/index.cjs.map +1 -0
- package/dist/web-component/index.d.cts +31 -0
- package/dist/web-component/index.d.ts +31 -0
- package/dist/web-component/index.js +141 -0
- package/dist/web-component/index.js.map +1 -0
- package/package.json +81 -4
|
@@ -0,0 +1,1442 @@
|
|
|
1
|
+
"use strict";var Stickyflow=(()=>{var Yn=Object.defineProperty;var Fp=Object.getOwnPropertyDescriptor;var Hp=Object.getOwnPropertyNames;var Vp=Object.prototype.hasOwnProperty;var Wp=(e,t)=>{for(var r in t)Yn(e,r,{get:t[r],enumerable:!0})},zp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hp(t))!Vp.call(e,o)&&o!==r&&Yn(e,o,{get:()=>t[o],enumerable:!(n=Fp(t,o))||n.enumerable});return e};var Yp=e=>zp(Yn({},"__esModule",{value:!0}),e);var Lk={};Wp(Lk,{StickyflowDiagram:()=>je,defineStickyflowDiagram:()=>na});var aa=["source","interactive","padding","diagram-id"],jp=e=>e!==null&&e!=="false";function sa(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:jp(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}var la=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Shape","Text","Isometric","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource"],Mk=[...la,"data"],Up=["top","bottom","left","right"],da=e=>Up.includes(e);var hr=e=>la.includes(e);var gr=class{constructor(t){this.input=t}input;offset=0;line=1;col=1;get done(){return this.offset>=this.input.length}peek(t=0){return this.input[this.offset+t]}startsWith(t){return this.input.startsWith(t,this.offset)}position(){return{line:this.line,col:this.col}}advance(){let t=this.input[this.offset];if(t===void 0)throw new Error("Cannot advance beyond the end of the SFL source.");return this.offset++,t===`
|
|
2
|
+
`||t==="\r"&&this.peek()!==`
|
|
3
|
+
`?(this.line++,this.col=1):this.col++,t}};var ue=class extends Error{constructor(r,n,o){super(`SFL lex error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflLexError"}line;col};var ca=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),Ke=e=>e!==void 0&&e>="0"&&e<="9",ua=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function Q(e,t,r,n={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...n}}function jn(e,t){return{...e,endLine:t.line,endCol:t.col}}function ma(e){return ca(e.peek())}function pa(e,t){let r="";for(;ua(e.peek());)r+=e.advance();return Q("ident",r,t)}function fa(e){return e==="\r"||e===`
|
|
4
|
+
`}function ha(e,t){return e.advance()==="\r"&&e.peek()===`
|
|
5
|
+
`&&e.advance(),Q("newline",`
|
|
6
|
+
`,t)}function ga(e){return e.peek()==="/"&&e.peek(1)==="/"}function ba(e){for(;!e.done&&e.peek()!==`
|
|
7
|
+
`&&e.peek()!=="\r";)e.advance()}function ya(e){let t=e.peek();return Ke(t)||t==="-"&&Ke(e.peek(1))}function xa(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());Ke(e.peek());)r+=e.advance();if(e.peek()==="."&&Ke(e.peek(1)))for(r+=e.advance();Ke(e.peek());)r+=e.advance();return Q("number",r,t,{numberValue:Number(r)})}var Xp=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],qp=e=>e!==void 0&&/[\d.]/.test(e);function Sa(e,t){let r=Xp.find(([i])=>e.startsWith(i));if(!r)return null;let[n,o]=r;if(n==="-"&&qp(e.peek(1)))return null;for(let i=0;i<n.length;i++)e.advance();return Q(o,n,t)}var Kp={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function Ca(e,t){let r=e.peek(),n=r?Kp[r]:void 0;return!r||!n||r==="&"&&e.peek(1)==="&"?null:(e.advance(),Q(n,r,t))}function Ra(e){return e===" "||e===" "}function ka(e){e.advance()}function Zp(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function Qp(e){let t=e.split(`
|
|
8
|
+
`),r=1/0;for(let n of t)n.trim()&&(r=Math.min(r,Zp(n)));return!Number.isFinite(r)||r===0?e:t.map(n=>n.trim()?n.slice(r):n).join(`
|
|
9
|
+
`)}function Jp(e,t){wa(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return wa(e),Qp(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new ue("unterminated long string",t.line,t.col)}function wa(e){e.advance(),e.advance(),e.advance()}function ef(e,t){e.advance();let r="";for(;!e.done;){let n=e.advance();if(n==='"')return r;if(n===`
|
|
10
|
+
`||n==="\r")throw new ue('newline in short string (use """ for multiline)',t.line,t.col);r+=n==="\\"?tf(e,t):n}throw new ue("unterminated string",t.line,t.col)}function tf(e,t){if(e.done)throw new ue("unterminated escape sequence",t.line,t.col);let r=e.advance();switch(r){case'"':return'"';case"\\":return"\\";case"n":return`
|
|
11
|
+
`;case"t":return" ";default:throw new ue(`invalid escape '\\${r}'`,t.line,t.col)}}function rf(e,t){return e.startsWith('"""')?Jp(e,t):ef(e,t)}function va(e,t){return Q("string",rf(e,t),t)}function Pa(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(fa(t))return ha(e,r);if(nf(e,t))return null;let n=of(e,t,r)??af(e,r);if(n)return n;throw new ue(`unexpected character '${t}'`,r.line,r.col)}function nf(e,t){return Ra(t)?(ka(e),!0):ga(e)?(ba(e),!0):!1}function of(e,t,r){let n=Ca(e,r);return n||(t==='"'?va(e,r):Sa(e,r))}function af(e,t){return ya(e)?xa(e,t):ma(e)?pa(e,t):null}function La(e){let t=new gr(e),r=[];for(;!t.done;){let n=Pa(t);n&&r.push(jn(n,t))}return r.push(jn(Q("eof","",t.position()),t)),r}var G=class extends Error{constructor(r,n,o){super(`SFL parse error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflParseError"}line;col};var br=class{constructor(t){this.tokens=t}tokens;position=0;peek(t=0){return this.tokens[Math.min(this.position+t,this.tokens.length-1)]}at(t){return this.peek().type===t}next(){return this.tokens[this.position++]}expect(t,r){let n=this.peek();if(n.type!==t)throw new G(`expected ${r}, got '${n.value||n.type}'`,n.line,n.col);return this.next()}expectNumber(t){let r=this.expect("number",t);if(r.numberValue===void 0)throw new G(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Tt(e){let t=[e.expect("ident","path identifier").value];for(;e.at("dot");)e.next(),t.push(e.expect("ident",'identifier after "."').value);return t}function Ta(e){let t=Tt(e),r,n;if(e.at("comma")){e.next();let o=e.expect("ident",'side after ","');if(!da(o.value))throw new G(`expected a side (top/right/bottom/left), got '${o.value}'`,o.line,o.col);r=o.value,e.at("lparen")&&(e.next(),n=e.expectNumber('fraction inside "("'),e.expect("rparen","')'"))}return{type:"endpoint",segments:t,side:r,fraction:n}}function sf(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(yr(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(yr(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}function yr(e,t=!0){let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return sf(e);case"number":{let n=e.expectNumber("number");if(!t||!e.at("comma"))return{type:"number",value:n};let o=[n];for(;e.at("comma");)e.next(),o.push(e.expectNumber("number in tuple"));return{type:"tuple",values:o}}case"ident":return{type:"ident",segments:Tt(e)};default:throw new G(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var lf=new Set([">","<",">=","<=","==","!="]);function df(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function $t(e,t,r){let n=r(e);for(;df(e,t);)n={kind:"binary",operator:e.next().value,left:n,right:r(e)};return n}var cf=new Set(["||"]),uf=new Set(["&&"]),mf=new Set(["+","-"]),pf=new Set(["*","/"]);function xr(e){return $t(e,cf,ff)}function ff(e){return $t(e,uf,hf)}function hf(e){return $t(e,lf,gf)}function gf(e){return $t(e,mf,bf)}function bf(e){return $t(e,pf,Aa)}function Aa(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:Aa(e)}):xf(e)}function yf(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(xr(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new G(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function xf(e){let t=e.peek();switch(t.type){case"number":return{kind:"number",value:e.expectNumber("number")};case"string":return e.next(),{kind:"string",value:t.value};case"lparen":{e.next();let r=xr(e);return e.expect("rparen","')'"),r}case"ident":{let r=Tt(e);return r.length===1&&(r[0]==="true"||r[0]==="false")?{kind:"boolean",value:r[0]==="true"}:e.at("lparen")?{kind:"call",callee:r,args:yf(e)}:{kind:"ref",path:r}}default:throw new G(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var Sf=["bind","bind2","action"];function Sr(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&Sf.includes(e.peek(2).type)}function Cr(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,n=xr(e),o=e.peek();if(!["newline","semi","rbrace","eof"].includes(o.type))throw new G(`unexpected '${o.value||o.type}' after binding`,o.line,o.col);return{key:t.value,operator:r,expr:n,line:t.line,col:t.col}}function $a(e){let t=e.peek(),r=Tt(e);e.expect("bind","'<-'");let n=xr(e);return{target:r,expr:n,line:t.line,col:t.col}}function Ea(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function Na(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push($a(e)),Ma(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new G(`unterminated handler '${t.value}'`,t.line,t.col);r.push($a(e)),Ma(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Ma(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new G(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var Rr=class{constructor(t){this.cursor=t}cursor;parseLayout(){return this.cursor.next(),{properties:this.parsePropertyBlock("layout")}}parseStyle(){this.cursor.next(),this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let t=[],r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let n=this.cursor.peek();throw new G("unterminated style block",n.line,n.col)}Sr(this.cursor)?(r.push(Cr(this.cursor)),(this.cursor.at("newline")||this.cursor.at("semi"))&&this.cursor.next()):t.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r.length?{properties:t,bindings:r}:{properties:t}}parseFields(){return this.cursor.next(),this.parsePropertyBlock("fields")}parseProperty(){let t=this.cursor.expect("ident","property key").value;this.cursor.expect("colon","':'");let r=t==="from"||t==="to"?Ta(this.cursor):yr(this.cursor);return this.consumeTerminator(),{key:t,value:r}}parsePropertyBlock(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let n=this.cursor.peek();throw new G(`unterminated ${t} block`,n.line,n.col)}r.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}consumeTerminator(){if(this.cursor.at("newline")||this.cursor.at("semi")){this.cursor.next();return}if(this.cursor.at("rbrace")||this.cursor.at("eof"))return;let t=this.cursor.peek();throw new G(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var kr=class{constructor(t){this.cursor=t;this.properties=new Rr(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!hr(t.value))throw new G(`unknown block kind '${t.value}'`,t.line,t.col);let r=this.cursor.expect("ident","block name"),n=this.parseComposition(),o=this.parseBlockEntries();return{kind:t.value,name:r.value,composition:n,entries:o}}parseComposition(){if(!this.cursor.at("colon"))return[];this.cursor.next();let t=[this.cursor.expect("ident",'reference name after ":"').value];for(;this.cursor.at("amp");)this.cursor.next(),t.push(this.cursor.expect("ident",'reference name after "&"').value);return t}parseBlockEntries(){return this.parseEntries(()=>this.parseBlockEntry())}parseDataEntries(){return this.parseEntries(()=>this.parseDataEntry())}parseEntries(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let n=this.cursor.peek();throw new G('unterminated block (missing "}")',n.line,n.col)}r.push(t()),this.cursor.at("semi")&&this.cursor.next(),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}parseBlockEntry(){let t=this.cursor.peek();if(t.type!=="ident")throw new G(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return hr(t.value)&&this.cursor.peek(1).type==="ident"?{type:"block",block:this.parseBlock()}:t.value==="layout"&&this.cursor.peek(1).type==="lbrace"?{type:"layout",layout:this.properties.parseLayout()}:t.value==="style"&&this.cursor.peek(1).type==="lbrace"?{type:"style",style:this.properties.parseStyle()}:t.value==="fields"&&this.cursor.peek(1).type==="lbrace"?{type:"fields",fields:this.properties.parseFields()}:Sr(this.cursor)?{type:"binding",binding:Cr(this.cursor)}:Ea(this.cursor)?{type:"handler",handler:Na(this.cursor)}:t.value==="data"&&this.cursor.peek(1).type==="lbrace"?{type:"data",data:this.parseDataBlock()}:{type:"property",property:this.properties.parseProperty()}}parseDataEntry(){let t=this.cursor.peek();return t.type==="ident"&&!hr(t.value)&&this.looksLikeSeriesEntry()?{type:"block",block:this.parseSeriesEntry()}:this.parseBlockEntry()}parseDataBlock(){return this.cursor.next(),{kind:"data",name:"",composition:[],entries:this.parseDataEntries()}}looksLikeSeriesEntry(){if(this.cursor.peek(1).type==="lbrace")return!0;if(this.cursor.peek(1).type!=="colon")return!1;let t=2;if(this.cursor.peek(t).type!=="ident")return!1;for(t++;this.cursor.peek(t).type==="amp";){if(t++,this.cursor.peek(t).type!=="ident")return!1;t++}return this.cursor.peek(t).type==="lbrace"}parseSeriesEntry(){let t=this.cursor.expect("ident","series name"),r=this.parseComposition(),n=this.parseBlockEntries();return{kind:"Series",name:t.value,composition:r,entries:n}}};var wr=class{constructor(t){this.cursor=t;this.blocks=new kr(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new G(`document must start with 'sfl', got '${t.value}'`,t.line,t.col);let r=this.cursor.expect("number","version number");this.cursor.skipNewlines();let n=[];for(;!this.cursor.at("eof");)n.push(this.blocks.parseBlock()),this.cursor.skipNewlines();return{version:r.value,blocks:n}}};function Un(e){return new wr(new br(La(e))).parseDocument()}function x(e){if(e){if(e.type==="string")return e.value;if(e.type==="ident")return e.segments.join(".");if(e.type==="number")return String(e.value)}}function C(e){return e?.type==="number"?e.value:void 0}function xe(e){return e?.type==="tuple"?e.values:void 0}function Oa(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function Cf(e,t){if(e.length<2)return null;let r=e[e.length-1],n=e[e.length-2],o=t.idByName.get(n);return(o?t.canvasObjectById.get(o):void 0)?.symbol?.ports?.some(a=>a.name===r)?{id:o,port:r}:null}function Ze(e,t){if(e?.type!=="endpoint")return{};let r=Cf(e.segments,t);if(r)return r;let n=e.segments[e.segments.length-1];return{id:t.idByName.get(n)??n,side:e.side,fraction:e.fraction}}function B(e){let t=new Map;for(let r of e.entries)r.type==="property"&&t.set(r.property.key,r.property.value);return t}function vr(e){let t=new Map;for(let r of e.entries)if(r.type==="style")for(let n of r.style.properties)t.set(n.key,n.value);return t}function Ba(e){let t=new Map;for(let r of e.entries)if(r.type==="layout")for(let n of r.layout.properties)t.set(n.key,n.value);return t}function _(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function Ia(e){for(let t of e.entries)if(t.type==="data")return t.data}function Qe(e){let t=Ia(e);return t?[..._(e),..._(t)]:_(e)}function Ga(e,t){let r=B(e).get(t);if(r!==void 0)return r;let n=Ia(e);return n?B(n).get(t):void 0}var Rf=["Entity","Shape","Text","Container","Path","Chart","Widget","Isometric"],kf=new Set(Rf);function Je(e){return kf.has(e)}function Da(e,t){for(let r of e)Je(r.kind)&&t.set(r.name,x(B(r).get("id"))??r.name),Da(_(r),t)}function Pr(e){let t=new Map;return e&&Da(_(e),t),t}var wf=new Set(["id","from","to","text","order","segments"]);function Lr(e){let t={};for(let[r,n]of e){if(wf.has(r))continue;let o=x(n);o!==void 0&&(t[r]=o)}return t}var vf=new Set(["top","bottom","front","back","left","right"]);function _a(e){return e!==void 0&&vf.has(e)?e:"front"}function Fa(e,t,r,n,o=[]){let i={idByName:Pr(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=n.mergedProps(a);return{id:x(l.get("id"))??a.name,fromId:Ze(l.get("from"),i).id,toId:Ze(l.get("to"),i).id,fromFace:_a(x(l.get("fromFace"))),toFace:_a(x(l.get("toFace"))),order:C(l.get("order")),sourceIndex:o[s],props:Lr(l)}})}function Ha(e,t,r){let n=t.mergedProps(e),o=Ze(n.get("from"),r),i=Ze(n.get("to"),r);return{id:x(n.get("id"))??e.name,fromId:o.id,toId:i.id,text:x(n.get("text")),fromSide:o.side,fromFraction:o.fraction,toSide:i.side,toFraction:i.fraction,fromPort:o.port,toPort:i.port,order:C(n.get("order")),segments:Oa(n.get("segments")),props:Lr(n)}}function Va(e,t,r,n,o=[]){let i={idByName:Pr(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...Ha(a,n,i),sourceIndex:o[s]}))}function Pf(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(n=>n.type==="ident"?[n.segments]:[]):[]}function Lf(e,t,r,n,o){let i=[{type:"property",property:{key:"from",value:{type:"endpoint",segments:t}}},{type:"property",property:{key:"to",value:{type:"endpoint",segments:r}}}];return o&&i.push({type:"property",property:{key:"text",value:{type:"string",value:o}}}),{kind:"Link",name:`${e.name}_${n+1}`,composition:[],entries:i}}function Wa(e,t){let r=Pf(e,t);if(r.length<2)return[];let n=x(t.mergedProps(e).get("text"));return r.slice(1).map((o,i)=>Lf(e,r[0],o,i,n))}function za(e,t){let r=x(t.layoutProp(e,"flow")),n=C(t.layoutProp(e,"gap"))??0,o=0;return i=>{if(r!=="horizontal"&&r!=="vertical")return;let a=r==="horizontal"?[o,0]:[0,o];return o+=(r==="horizontal"?i[0]:i[1])+n,a}}var Tr=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function et(e){return e!==void 0&&Tr.includes(e)}function Se(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let n=C(r);return n===void 0?[]:[n]});return t.length>0?t:void 0}function Ya(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=x(t);return r===void 0?[]:[r]})}function me(e){let t=x(e);if(t!==void 0)return t==="true"}function Xn(e){let t=e?B(e):new Map;return{min:C(t.get("min"))??0,max:C(t.get("max"))??10,step:C(t.get("step"))??1,label:x(t.get("label")),unit:x(t.get("unit")),thresholds:Se(t.get("thresholds"))}}function ja(e){return Qe(e).filter(t=>t.kind==="Rule").map(t=>{let r=B(t);return{id:t.name,at:C(r.get("at"))??0,text:x(r.get("text")),color:x(r.get("color")),strokeWidth:C(r.get("strokeWidth")),dash:Se(r.get("dash"))}})}function Ua(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(C);return t.every(r=>r!==void 0)?t:void 0}function Xa(e){return e?.type!=="list"?[]:Tf(e.values)==="tuple"?Mf(e.values):$f(e.values)}function Tf(e){for(let t of e){if(t.type==="number")return"scalar";if(Ua(t))return"tuple"}}function $f(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function Mf(e){return e.flatMap(t=>{let r=Ua(t);return r?[r]:[]})}function qa(e){if(e?.type==="list")return e.values.map(Af)}function Af(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:Ef(e)}function Ef(e){if(e.type!=="list"||e.values.length<2)return null;let t=C(e.values[0]),r=C(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function Ka(e){if(e?.type==="list")return e.values.map(Nf)}function Nf(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:x(e)??null}function Za(e,t){if(e?.type==="list"){let o=e.values.flatMap(Of);return o.length>0?{points:o}:void 0}let r=x(e),n=r?t.get(r):void 0;if(n)return{points:n.points,normalized:!0,tension:n.tension}}function Of(e){if(e.type!=="list"||e.values.length<2)return[];let t=C(e.values[0]),r=C(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Qa(e,t,r){let n=r(e);return{id:e.name,label:x(n.get("label"))??e.name,color:x(n.get("color")),colors:Ka(n.get("colors")),opacity:C(n.get("opacity")),group:x(n.get("group")),values:Xa(n.get("values")),error:qa(n.get("error")),source:x(n.get("source")),target:x(n.get("target")),size:C(n.get("size")),symbol:Za(n.get("symbol"),t),stroke:x(n.get("stroke")),strokeWidth:C(n.get("strokeWidth")),dash:Se(n.get("dash")),offset:C(n.get("offset")),labelOffsetX:C(n.get("labelOffsetX")),labelOffsetY:C(n.get("labelOffsetY"))}}function Ja(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let n=x(r.values[0]);return n===void 0?[]:[{label:n,color:x(r.values[1]),offsetX:C(r.values[2]),offsetY:C(r.values[3])}]});return t.length>0?t:void 0}var Bf=["none","true","percent","waterfall"];function If(e){return et(e)?e:"bar"}function Gf(e){return Bf.find(t=>t===e)}function es(e,t,r,n){let o=Qe(e),i=o.filter(s=>s.kind==="Axis"),a=x(t.get("stacked"));return{chartType:If(x(t.get("type"))),categories:Ya(Ga(e,"categories")),areaOpacity:C(t.get("areaOpacity")),stacked:Gf(a),scale:x(t.get("scale")),interpolate:x(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:C(t.get("idwPower")),isolines:Se(t.get("isolines")),zones:Ja(t.get("zones")),boxWidth:C(t.get("boxWidth")),orientation:x(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:C(t.get("lineTension")),highlightPoints:Se(t.get("highlightPoints")),barCornerRadius:C(t.get("barCornerRadius")),showBoxplotPoints:me(t.get("showBoxplotPoints")),barBorderColor:x(t.get("barBorderColor")),barBorderWidth:C(t.get("barBorderWidth")),barGroupGap:C(t.get("barGroupGap")),barGlow:C(t.get("barGlow")),barGap:C(t.get("barGap")),mekkoVaryHeight:me(t.get("mekkoVaryHeight")),hexRadius:C(t.get("hexRadius")),innerRadius:C(t.get("innerRadius")),pieCornerRadius:C(t.get("pieCornerRadius")),pieSliceGap:C(t.get("pieSliceGap")),ringThickness:C(t.get("ringThickness")),ringGap:C(t.get("ringGap")),cellGap:C(t.get("cellGap")),showValues:me(t.get("showValues")),squareCells:me(t.get("squareCells")),headerColor:x(t.get("headerColor")),tileGradient:me(t.get("tileGradient")),showColumnBackdrop:me(t.get("showColumnBackdrop")),labelPosition:x(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:x(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:x(t.get("labelColor")),linkGradient:me(t.get("linkGradient")),connectPoints:me(t.get("connectPoints")),reverseComparison:me(t.get("reverseComparison")),axisX:Xn(i.find(s=>s.name==="x")),axisY:Xn(i.find(s=>s.name==="y"||s.name==="value")),series:o.filter(s=>s.kind==="Series").map(s=>Qa(s,r,n)),rules:ja(e)}}function ts(e,t,r,n,o){return{...e,objectType:"chart",chart:es(t,r,n,o)}}function rs(e,t){return{depth:t,icon:x(e.get("icon"))}}function ns(e,t,r,n){let o=xe(n(t,"size"));return{...e,objectType:"isometric",isometric:rs(r,o?.[2]??24)}}function os(e,t){let r=e.get("points");return{points:r?.type==="list"?r.values.flatMap(o=>{if(o.type!=="list"||o.values.length<2)return[];let i=C(o.values[0]),a=C(o.values[1]);return i!==void 0&&a!==void 0?[{x:t.x+i,y:t.y+a}]:[]}):[],tension:C(e.get("tension")),startMarker:x(e.get("startMarker")),endMarker:x(e.get("endMarker")),closed:x(e.get("closed"))==="true",value:C(e.get("value"))}}function is(e,t,r){return{...e,objectType:"path",path:os(t,r)}}function as(e){let t=x(e.get("orientation"))==="vertical"?"vertical":"horizontal",r=e.get("lanes"),n=r?.type==="list"?r.values.flatMap((i,a)=>{if(i.type!=="list")return[];let s=x(i.values[0]),l=C(i.values[1]);if(s===void 0||l===void 0)return[];let d=x(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:n}}function ss(e,t){return{...e,objectType:"swimlane",swimlane:as(t)}}function Df(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":e.kind==="Widget"?x(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":x(t.get("kind"))??""}function _f(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":e==="rollingNumber"||e==="tickScale"||e==="ruler"?"widget":e==="isometric"?"isometric":"shape"}function ls(e,t,r){let n=Df(e,t),o=x(t.get("shape")),i=o?r.get(o):void 0;return{objectType:e.kind==="Widget"?"widget":_f(n),kind:n,shapeType:i?"symbol":o,symbol:i}}function ds(e,t,r,n){let o=n??xe(r(e,"position"))??[0,0],i=xe(r(e,"size"))??[0,0];return{x:t.x+(o[0]??0),y:t.y+(o[1]??0),width:i[0]??0,height:i[1]??0,rotation:C(r(e,"rotation")),order:C(r(e,"order"))}}var Ff=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function cs(e){let t={};for(let[r,n]of e){if(Ff.has(r))continue;let o=x(n);o!==void 0&&(t[r]=o)}return t}function us(e,t,r,n,o){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=ls(e,l,s),c=ds(e,t,a,o),u={id:x(l.get("id"))??e.name,kind:d.kind,text:x(l.get("text")),...c,parentFrameId:n??x(l.get("parent")),props:cs(l)};switch(d.objectType){case"chart":return ts(u,e,l,s,i);case"isometric":return ns(u,e,l,a);case"path":return is(u,l,t);case"swimlane":return ss(u,l);case"frame":return{...u,objectType:"frame"};case"widget":return{...u,objectType:"widget",widget:{type:x(l.get("type"))??"rollingNumber",value:x(l.get("value"))??"0",digits:C(l.get("digits")),duration:C(l.get("duration")),min:C(l.get("min")),max:C(l.get("max")),label:x(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function ms(e){return _(e).filter(t=>Je(t.kind)).map(t=>x(B(t).get("id"))??t.name)}var qn=class{#t;#n=[];#e=[];#r=[];#o=[];#i=[];#s=0;constructor(t){this.#t=t.canvasObjectResolutionContext}resolve(t){let r=t?this.#a(t,{origin:{x:0,y:0}}):[];return{canvasObjects:this.#n,groups:r,linkBlocks:this.#e,connectionBlocks:this.#r,linkSourceIndexes:this.#o,connectionSourceIndexes:this.#i}}#a(t,r){let n=[],o=za(t,this.#t);for(let i of _(t))n.push(...this.#l(i,r,o));return n}#l(t,r,n){let o=this.#s++;if(t.kind==="Container")return this.#c(t,r,n,o);if(Je(t.kind))return this.#u(t,r,n,o),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#e.push(t),this.#o.push(o),[];case"Connection":return this.#r.push(t),this.#i.push(o),[];case"Net":{let i=Wa(t,this.#t);return this.#e.push(...i),this.#o.push(...i.map(()=>o)),[]}default:return[]}}#c(t,r,n,o){let i=this.#d(t,r,n,o);return this.#n.push(i),this.#a(t,{origin:{x:i.x,y:i.y},frameId:i.id})}#u(t,r,n,o){this.#n.push(this.#d(t,r,n,o))}#d(t,r,n,o){let i=xe(this.#t.layoutProp(t,"size"))??[0,0];return{...us(t,r.origin,this.#t,r.frameId,n(i)),sourceIndex:o}}#m(t,r){let n=this.#t.mergedProps(t);return{id:x(n.get("id"))??t.name,name:x(n.get("text"))??t.name,color:x(n.get("color")),icon:x(n.get("icon")),canvasObjectIds:ms(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??x(n.get("parent"))}}};function ps(e,t){return new qn(t).resolve(e)}function fs(e){let t=B(e),r=x(t.get("program"));if(!r)return;let n={};for(let[o,i]of t){if(o==="program")continue;let a=C(i),s=x(i);a!==void 0?n[o]=a:s!==void 0&&(n[o]=s==="true"?!0:s==="false"?!1:s)}return{name:e.name,program:r,parameters:n}}function Hf(e){let t=B(e).get("points");return t?.type!=="list"?[]:t.values.flatMap(r=>{if(r.type!=="list"||r.values.length<2)return[];let n=C(r.values[0]),o=C(r.values[1]);return n===void 0||o===void 0?[]:[[n,o]]})}function Vf(e){let t=_(e).filter(r=>r.kind==="Port").flatMap(r=>{let n=xe(B(r).get("at"));return typeof n?.[0]!="number"||typeof n[1]!="number"?[]:[{name:r.name,at:[n[0],n[1]]}]});return t.length>0?t:void 0}function hs(e){let t=Hf(e);if(!(t.length<2))return{name:e.name,points:t,tension:C(B(e).get("tension")),ports:Vf(e)}}function Wf(e){return _(e).find(t=>t.kind==="Model")}function gs(e){return{styles:Yf(e),layouts:jf(e),symbols:Uf(e),shaders:zf(e),model:Xf(e)}}function zf(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let n=fs(r);n&&t.set(r.name,n)}return t}function Yf(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function jf(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function Uf(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let n=hs(r);n&&t.set(r.name,n)}return t}function Xf(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=Wf(t);if(r)return r}}}function bs(e,t,r){let n,o;for(let i of e)t.has(i)?n=i:r.has(i)&&(o=i);return{styleRef:n,layoutRef:o}}function ys(e,t,r,n){for(let o of e.composition)!t.has(o)&&!r.has(o)&&n.push({severity:"warning",code:"unresolved-style-or-layout",ownerId:e.name,message:`"${o}" is not a Style or Layout defined at the top level of the document \xC3\xA2\xE2\u201A\xAC\xE2\u20AC\x9D "${e.name}" gets no shape, fill, or stroke from it.`});for(let o of _(e))ys(o,t,r,n)}function xs(e,t,r){let n=[];for(let o of e.blocks)ys(o,t,r,n);return n}function Zn(e,t){return new Kn(e,t).resolveAll()}var Kn=class{#t;#n;#e=new Map;constructor(t,r){this.#t=t,this.#n=r}resolveAll(){for(let t of this.#t.keys())this.#r(t,new Set);return this.#e}#r(t,r){let n=this.#e.get(t);if(n)return n;let o=this.#t.get(t);if(!o||r.has(t))return new Map;let i=this.#o(o,new Set([...r,t]));for(let[a,s]of B(o))i.set(a,s);return this.#e.set(t,i),i}#o(t,r){let n=this.#n(t);return n?new Map(this.#r(n,r)):new Map}};function Ss(e){let{styles:t,layouts:r,symbols:n,shaders:o}=e,i=c=>bs(c.composition,t,r),a=Zn(t,c=>i(c).styleRef),s=Zn(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of B(c))u.set(m,f);for(let[m,f]of vr(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=Ba(c);if(m.has(u))return m.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:n,shaderDefs:o}}var qf=new Set(["radar","radial"]),Cs=new Set(["scatter","custom","hexbin"]);function Rs(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=x(B(n).get("type"));o!==void 0&&!et(o)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:n.name,message:`Unsupported chart type '${o}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn as a plain series plot. Supported: ${Tr.join(", ")}.`})}for(let o of _(n))r(o)};for(let n of e.blocks)r(n);return t}function ks(e){let t=[],r=n=>{if(n.kind==="Chart")for(let o of Qe(n).filter(i=>i.kind==="Series"))B(o).has("values")||t.push({severity:"warning",code:"series-without-values",ownerId:o.name,message:`Series '${o.name}' has no values. If this was meant to be an Axis or Rule, it needs that keyword in front of the name \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D inside data{}, a bare name is read as a Series.`});for(let o of _(n))r(o)};for(let n of e.blocks)r(n);return t}function ws(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=x(B(n).get("type")),i=et(o)?o:"bar";x(vr(n).get("gridShape"))==="circle"&&!Cs.has(i)&&!qf.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:n.name,message:`gridShape: circle isn't supported on '${i}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn with the standard rectangular grid instead. Supported: ${[...Cs].join(", ")}.`})}for(let o of _(n))r(o)};for(let n of e.blocks)r(n);return t}function vs(e){let t=[],r=n=>{if(n.kind==="Widget"){let o=x(B(n).get("type"))??"rollingNumber";o!=="rollingNumber"&&o!=="tickScale"&&o!=="ruler"&&t.push({severity:"warning",code:"unsupported-widget-type",ownerId:n.name,message:`Unsupported widget type '${o}'. Supported: rollingNumber, tickScale, ruler.`})}for(let o of _(n))r(o)};for(let n of e.blocks)r(n);return t}function Ps(e){let t=gs(e);return{model:t.model,diagnostics:[...xs(e,t.styles,t.layouts),...Rs(e),...ws(e),...ks(e),...vs(e)],canvasObjectResolutionContext:Ss(t)}}function Ls(e){let t=Ps(e),{canvasObjects:r,groups:n,linkBlocks:o,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=ps(t.model,t),l=Va(t.model,o,r,t.canvasObjectResolutionContext,a),d=Fa(t.model,i,r,t.canvasObjectResolutionContext,s);return{canvasObjects:r,groups:n,links:l,connections:d,diagnostics:t.diagnostics,shaders:[...t.canvasObjectResolutionContext.shaderDefs.values()]}}function Mt(e){return e.objectType==="isometric"&&e.isometric!==void 0}function Ts(e){return Ls(Un(e))}var At=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function Jf(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${At})\\s+([-\\d.]+)%`,"g");for(let o of t[2].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"gradient",angle:Number(t[1]),stops:r}}function eh(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${At})\\s+([-\\d.]+)\\s*,\\s*([-\\d.]+)`,"g"),o=0;for(let i of t[1].matchAll(n))r.push({id:`mp-${Date.now()}-${o++}`,color:i[1],x:Number(i[2]),y:Number(i[3])});return{type:"mesh",points:r}}function te(e){if(!(e==null||e===""))return Jf(e)??eh(e)??e}function Qn(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${At})\\s+([-\\d.]+)`,"g");for(let o of t[1].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"ramp",stops:r}}function th(e,t,r){switch(t){case"color":e.color=r;break;case"opacity":e.opacity=Number(r);break;case"blur":e.blur=Number(r);break;case"angle":e.angle=Number(r);break;case"distance":e.distance=Number(r);break}}function ae(e){if(!e)return;if(e==="on")return{enabled:!0};let t=e.match(/^shadow\((.*)\)\s*$/);if(!t)return;let r={enabled:!0};for(let n of t[1].split(",")){let o=n.split(":");o.length===2&&th(r,o[0].trim(),o[1].trim())}return r}var k=e=>e===void 0?void 0:Number(e);function rh(e){try{return JSON.parse(e)}catch{return}}function ve(e){if(e===void 0)return;let t=rh(e);if(!Array.isArray(t))return;let r=t.filter(n=>typeof n=="number"&&Number.isFinite(n));return r.length===t.length?r:void 0}function Ce(e){let t=te(e);return typeof t=="string"?t:void 0}function pe(e,t,r){return t.includes(e)?e:r}var $r=["normal","bold"],$s=["normal","bold","100","200","300","400","500","600","700","800","900"],Ms=["top","bottom","left","right"],Jn=["none","arrow","filled_arrow"];function tt(e){let t=te(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var As=["left","center","right"],Es=["top","middle","bottom"],Mr=["solid","dashed","dotted"],Ar=["straight","curved","orthogonal"];function re(e,t){return e!==void 0&&t.includes(e)?e:void 0}var Ns=["solid","dashed","dotted","double"],eo=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function nh(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function oh(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function ih(e){return e==="dashed"||e==="dotted"?e:"solid"}function ah(e){return{axisX:e.chart?.axisX??{min:0,max:4,step:1},axisY:e.chart?.axisY??{min:0,max:500,step:100},series:(e.chart?.series??[]).map(t=>({...t,color:te(t.color),colors:t.colors?.map(r=>r===null?null:te(r)??null),strokeWidth:t.strokeWidth})),rules:(e.chart?.rules??[]).map(t=>({id:t.id,at:t.at,text:t.text,color:t.color,strokeWidth:t.strokeWidth,dash:t.dash}))}}function sh(e){let t=nh(e.fill);return{fillColor:t?"#111418":te(e.fill)??"#ffffff",fillImage:t,strokeColor:Ce(e.stroke)??"#475569",strokeWidth:k(e.strokeWidth)??1,cornerRadius:k(e.cornerRadius)??12,shadowStyle:ae(e.shadow)}}function lh(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:k(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:ih(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function dh(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:k(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:k(e.tickLength),axisFontSize:k(e.axisFontSize),axisFontFamily:e.axisFontFamily,showValueAxis:e.showValueAxis!=="false",categoryAlign:e.categoryAlign==="left"||e.categoryAlign==="inside"?e.categoryAlign:void 0,showAxisLabels:e.showAxisLabels!=="false"}}function ch(e){return{textColor:e.textColor??"#0f172a",titleSize:k(e.titleSize),titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:k(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function uh(e){return{legendColor:e.legendColor,showLegend:e.showLegend==="true",legendPosition:oh(e.legendPosition)}}function Os(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,...ah(e),...sh(t),...lh(t),...dh(t),...ch(t),...uh(t),order:e.order,sourceIndex:e.sourceIndex}}function Bs(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:te(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:k(t.barSegments),barSegmentGap:k(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:k(t.barGlassBlur),barGlassSaturation:k(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:k(t.barThickness),orientation:e?.orientation,barTrack:t.barTrack==="true",barRoundedBottom:t.barRoundedBottom==="true",barLabelMaxOnly:t.barLabelMaxOnly==="true",barTrackColor:t.barTrackColor,barTrackHatch:t.barTrackHatch==="true",barTrackHatchColor:t.barTrackHatchColor,barTrackHatchAngle:k(t.barTrackHatchAngle),barTrackHatchSpacing:k(t.barTrackHatchSpacing),barTrackHatchWidth:k(t.barTrackHatchWidth),stacked:e?.stacked??"true",showBarLabels:t.showBarLabels==="true",barLabelPosition:t.barLabelPosition==="inside"||t.barLabelPosition==="center"||t.barLabelPosition==="axis"?t.barLabelPosition:void 0,barLabelFontSize:k(t.barLabelFontSize),barLabelFontFamily:t.barLabelFontFamily,barLabelFontWeight:t.barLabelFontWeight==="bold"?"bold":void 0,barLabelColor:t.barLabelColor,barLabelPill:t.barLabelPill==="true",barLabelPillColor:t.barLabelPillColor,barLabelBorderColor:t.barLabelBorderColor,barLabelBorderWidth:k(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function Is(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:k(t.lineWidth),lineGlow:k(t.lineGlow),pointSize:k(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:k(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:k(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function Gs(e){return{categories:e?.categories}}function Ds(e){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth}}function _s(e){return{scale:Qn(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Fs(e){return{categories:e?.categories,zones:e?.zones,cellGap:e?.cellGap,showValues:e?.showValues,squareCells:e?.squareCells,barCornerRadius:e?.barCornerRadius}}function Hs(e){return{hexRadius:e?.hexRadius}}function Vs(e){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop}}function Ws(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:k(t.pieStartAngle),pieSweep:k(t.pieSweep),pieExplode:k(t.pieExplode),pieGlow:k(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:k(t.pieStrokeWidth),pieLabelPosition:t.pieLabelPosition==="inside"||t.pieLabelPosition==="outside"?t.pieLabelPosition:void 0,pieLabelContent:t.pieLabelContent==="percent"||t.pieLabelContent==="name"||t.pieLabelContent==="inline"?t.pieLabelContent:void 0,pieLabelColor:t.pieLabelColor,pieCenterText:t.pieCenterText,pieCenterSize:k(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function zs(e){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap}}function Ys(e){return{categories:e?.categories,areaOpacity:e?.areaOpacity}}function js(e){return{categories:e?.categories,areaOpacity:e?.areaOpacity}}function Us(e){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap}}function Xs(e){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient}}function qs(e){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient}}function Ks(e){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison}}function Zs(e){let t=Os(e),r=e.chart,n=e.props,o=r?.chartType??"bar";switch(o){case"bar":return z(t,o,Bs(r,n));case"line":return z(t,o,Is(r,n));case"scatter":return z(t,o,Gs(r));case"boxplot":return z(t,o,Ds(r));case"field":return z(t,o,_s(r));case"heatmap":return z(t,o,Fs(r));case"hexbin":return z(t,o,Hs(r));case"mekko":return z(t,o,Vs(r));case"pie":return z(t,o,Ws(r,n));case"polarArea":return z(t,o,zs(r));case"radar":return z(t,o,Ys(r));case"radial":return z(t,o,js(r));case"radialBar":return z(t,o,Us(r));case"sankey":return z(t,o,Xs(r));case"treemap":return z(t,o,qs(r));case"custom":return z(t,o,Ks(r))}}function z(e,t,r){return{...e,chartType:t,config:r}}function Qs(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,fromFace:e.fromFace,toFace:e.toFace,order:e.order,sourceIndex:e.sourceIndex,style:{pathType:re(t.route,Ar)??"straight",color:tt(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:re(t.strokeStyle,Mr),opacity:t.opacity!==void 0?k(t.opacity):void 0}}}function Js(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,fillColor:t.fill??"rgba(155, 66, 223, 0.05)",strokeColor:t.stroke??"#9b42df",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:k(t.fontSize)??14,fontWeight:pe(t.fontWeight,$r,"bold"),fontFamily:t.fontFamily,dash:ve(t.dash),showLabel:t.showLabel!=="false",labelPosition:pe(t.labelPosition,Ms,"top"),shadow:t.shadow!=="false",order:e.order,sourceIndex:e.sourceIndex}}function el(e){let t=e.props,r=ae(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:Ce(t.fill)??"#f8fafc",strokeColor:Ce(t.stroke)??"#111827",strokeWidth:k(t.strokeWidth)??1,cornerRadius:k(t.cornerRadius)??8,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:k(t.labelOffsetX)??0,labelOffsetY:k(t.labelOffsetY)??0,labelBackground:Ce(t.labelBackground),parentFrameId:e.parentFrameId}}function tl(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:k(t.weight),showWeight:t.showWeight!=="false",style:{pathType:re(t.route,Ar),color:tt(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:re(t.strokeStyle,Mr),opacity:t.opacity!==void 0?k(t.opacity):void 0,fontSize:k(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:ae(t.shadow)},startMarker:re(t.markerStart,eo),endMarker:re(t.markerEnd,eo),segmentOffsets:e.segments,fromPoint:e.fromPort?{kind:"port",port:e.fromPort}:e.fromSide?{kind:"side",side:e.fromSide,offset:e.fromFraction}:void 0,toPoint:e.toPort?{kind:"port",port:e.toPort}:e.toSide?{kind:"side",side:e.toSide,offset:e.toFraction}:void 0,order:e.order,sourceIndex:e.sourceIndex}}function rl(e){let t=e.props;return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,points:e.path?.points??[],value:e.path?.value,tension:e.path?.tension??0,startMarker:pe(e.path?.startMarker,Jn,"none"),endMarker:pe(e.path?.endMarker,Jn,"none"),closed:e.path?.closed??!1,strokeColor:Ce(t.stroke)??"#7c3aed",strokeWidth:k(t.strokeWidth)??2,dash:ve(t.dash)??[],opacity:k(t.opacity)??1,fillColor:Ce(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function mh(e){return e||"rectangle"}function nl(e,t){let r=e.props,n=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:mh(e.shapeType),symbol:e.symbol,x:e.x,y:e.y,width:e.width,height:e.height,w:e.width,h:e.height,rotation:e.rotation??0,fillColor:te(r.fill??(n?"none":void 0)),strokeColor:tt(r.stroke??(n?"none":void 0)),isText:n||void 0,strokeWidth:k(r.strokeWidth),textColor:r.textColor,fontSize:k(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:pe(r.fontWeight,$s,"normal"),letterSpacing:k(r.letterSpacing),lineHeight:k(r.lineHeight),fontFamily:r.fontFamily,textAlign:re(r.textAlign,As),textVerticalAlign:re(r.verticalAlign,Es),cornerRadius:k(r.cornerRadius),shadowStyle:ae(r.shadow),dash:ve(r.dash),strokeStyle:re(r.strokeStyle,Ns),opacity:k(r.opacity),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function ol(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,orientation:e.swimlane?.orientation??"horizontal",lanes:e.swimlane?.lanes??[],fillColor:t.fill??"rgba(107, 114, 128, 0.05)",strokeColor:t.stroke??"#6b7280",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,dash:ve(t.dash),shadowStyle:ae(t.shadow),textColor:t.textColor??"#6b7280",fontSize:k(t.fontSize)??22,fontWeight:pe(t.fontWeight,$r,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var ph=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i,fh=/^[\w\s,'"-]+$/;function Re(e){return e&&ph.test(e)?e:void 0}function to(e){return e&&fh.test(e)?e:void 0}var hh=/^(?:[1-9]00|normal|bold)$/;function gh(e){return e==="plain"||e==="flip"?e:void 0}function bh(e){return e==="roll"||e==="fade"?e:void 0}function ro(e){return e&&hh.test(e)?e:void 0}var yh=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],xh=["color","accent"];function Sh(e){let t=e.props,r={};for(let n of yh){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of xh){let o=Re(t[n]);o&&(r[n]=o)}return{id:e.id,type:"tickScale",value:e.widget.value,max:e.widget.max,label:e.widget.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ro(t.labelWeight),fontFamily:to(t.labelFont)}:void 0}}var Ch=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],Rh=["color","accent","glow"],kh={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},wh=["core"];function vh(e){let t=e.props,r={};for(let n of Ch){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of Rh)r[n]=Re(t[n])??kh[n];for(let n of wh){let o=Re(t[n]);o&&(r[n]=o)}return r.axis=t.axis==="horizontal"?"horizontal":"vertical",t.knob&&(r.knob=t.knob),{id:e.id,type:"ruler",value:e.widget.value,min:e.widget.min,max:e.widget.max,label:e.widget.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ro(t.labelWeight),fontFamily:to(t.labelFont)}:void 0}}function il(e){if(e.widget.type==="tickScale")return Sh(e);if(e.widget.type==="ruler")return vh(e);let t=e.props;return{id:e.id,type:"rollingNumber",value:e.widget.value,digits:e.widget.digits,duration:e.widget.duration,label:e.widget.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,style:{color:Re(t.color),surface:Re(t.surface),divider:Re(t.divider),labelColor:Re(t.labelColor),fontFamily:to(t.fontFamily),variant:gh(t.variant),motion:bh(t.motion),fontWeight:ro(t.fontWeight)}}}var no=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function al(e){let t=no(e.canvasObjects),r=new Map((e.shaders??[]).map(n=>[n.name,n]));return{shapes:t.filter(n=>n.objectType==="shape").map(n=>nl(n,r)),frames:t.filter(n=>n.objectType==="frame").map(Js),swimlanes:t.filter(n=>n.objectType==="swimlane").map(ol),isometricObjects:t.filter(Mt).map(el),paths:t.filter(n=>n.objectType==="path").map(rl),charts:t.filter(n=>n.objectType==="chart").map(Zs),widgets:t.filter(n=>n.objectType==="widget"&&["rollingNumber","tickScale","ruler"].includes(n.widget?.type??"")).map(il),links:no(e.links).map(tl),connections:no(e.connections).map(Qs)}}var Er=new Set(["top","front","right"]),sl=Math.PI/6,rt=Math.cos(sl),Et=Math.sin(sl);function oo(e){let t=Math.max(0,e.width),r=Math.max(0,e.height),n=Math.max(0,e.depth);return{x:e.x,y:e.y,width:(t+n)*rt,height:r+(t+n)*Et}}function io(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*rt/2,y:e.y+(t+r)*Et/2}}function Ph(e){return{x:(e[0].x+e[1].x+e[2].x+e[3].x)/4,y:(e[0].y+e[1].y+e[2].y+e[3].y)/4}}function ao(e,t){return Ph(Ee(e)[t])}function Ee(e){let{x:t,y:r}=e,n=Math.max(0,e.width),o=Math.max(0,e.height),i=Math.max(0,e.depth),a={x:t+i*rt,y:r},s={x:n*rt,y:n*Et},l={x:-i*rt,y:i*Et},d={x:0,y:o},c={x:a.x+s.x,y:a.y+s.y},u={x:a.x+l.x,y:a.y+l.y},m={x:a.x+s.x+l.x,y:a.y+s.y+l.y},f={x:a.x+d.x,y:a.y+d.y},g={x:m.x+d.x,y:m.y+d.y},b={x:u.x+d.x,y:u.y+d.y},y={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,y,g,b],front:[u,m,g,b],back:[a,c,y,f],right:[m,c,y,g],left:[a,u,b,f]}}function Lh(e){return Math.max(0,Math.min(255,Math.round(e)))}function Th(e){let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return null;let r=Number.parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function $h(e,t,r){return`#${[e,t,r].map(n=>Lh(n).toString(16).padStart(2,"0")).join("")}`}function ll(e,t){let r=Th(e);if(!r)return e;let[n,o,i]=r;return $h(n*t,o*t,i*t)}function so(e){return{topFill:e,frontFill:ll(e,.95),sideFill:ll(e,.88)}}var Mh=Math.PI/180;function Ah(e,t){let r=t*Mh,n=Math.cos(r),o=Math.sin(r);return{x:e.x*n-e.y*o,y:e.x*o+e.y*n}}function Eh(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function dl(e,t){let r=Eh(e),n=e.rotation?Ah(t,e.rotation):t;return{x:r.x+n.x,y:r.y+n.y}}function lo(e,t){return dl(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function nt(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function co(e,t){let r=nt(e),n=nt(t),o=Math.atan2(n.y-r.y,n.x-r.x);return o>=-Math.PI/4&&o<Math.PI/4?{x:e.x+e.width,y:r.y}:o>=Math.PI/4&&o<3*Math.PI/4?{x:r.x,y:e.y+e.height}:o>=-3*Math.PI/4&&o<-Math.PI/4?{x:r.x,y:e.y}:{x:e.x,y:r.y}}function Nh(e,t){let r=t.offset??.5;switch(t.side){case"top":return{x:e.x+e.width*r,y:e.y};case"right":return{x:e.x+e.width,y:e.y+e.height*r};case"bottom":return{x:e.x+e.width*r,y:e.y+e.height};case"left":return{x:e.x,y:e.y+e.height*r}}}function Oh(e,t){let r=e.symbol?.ports?.find(n=>n.name===t.port);return r?lo({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):nt(e)}function uo(e,t,r){let n=Bh(e,t),o=Ih(n.explicit);if(o)return o;let i=cl(r,n.canvasObjectId);if(!i)return{x:0,y:0};let a=Gh(i,n.explicit);return a||Dh(i,cl(r,n.oppositeCanvasObjectId))}function Bh(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function Ih(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function Gh(e,t){return t?.kind==="port"?Oh(e,t):t?.kind==="side"?Nh(e,t):null}function Dh(e,t){return t?co(e,t):nt(e)}function cl(e,t){return e.find(r=>r.id===t)}var _h=15e3;function Fh(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function ul(e,t){return e?ao(e,t):{x:0,y:0}}function ml(e,t){let r=e.findIndex(o=>o.id===t);if(r<0)return;let n=e[r];return{rank:n.order??0,sequence:n.sourceIndex??_h+r}}function Hh(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Er.has(t.fromFace)?void 0:ml(e,t.fromId),Er.has(t.toFace)?void 0:ml(e,t.toId)].filter(o=>o!==void 0);if(!r.length)return{sourceIndex:t.sourceIndex};let n=r.reduce((o,i)=>i.rank<o.rank||i.rank===o.rank&&i.sequence<o.sequence?i:o);return{order:n.rank,sourceIndex:n.sequence-.5}}function Vh(e){let t=new Map(e.isometricObjects.map(r=>[r.id,r]));return e.connections.map(r=>({link:{id:r.id,fromId:r.fromId,toId:r.toId,fromPoint:{kind:"face",face:r.fromFace},toPoint:{kind:"face",face:r.toFace},style:r.style,...Hh(e.isometricObjects,r)},from:ul(t.get(r.fromId??""),r.fromFace),to:ul(t.get(r.toId??""),r.toFace),kind:"connection"}))}function pl(e){let t=Fh(e);return[...e.links.map(n=>({link:n,from:uo(n,"from",t),to:uo(n,"to",t)})),...Vh(e)]}function mo(e){let t=Ts(e),r=al(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,charts:r.charts,widgets:r.widgets,links:pl(r),diagnostics:t.diagnostics}}function U(e,t,r,n,o,i){return e.forEach((a,s)=>{a.identity={role:t,id:r,...n?{kind:n}:{},...s===0?{primary:!0}:{},...s===0&&o?{label:o}:{},...s===0&&i?{parentFrameId:i}:{}}}),e}var po={minX:0,minY:0,maxX:100,maxY:100};function X(e,t=0){return{minX:e.x-t,minY:e.y-t,maxX:e.x+e.width+t,maxY:e.y+e.height+t}}function J(e,t,r=0){return t?Yh(Wh(e,t),r):X(e,r)}function Wh(e,t){let r=e.x+e.width/2,n=e.y+e.height/2,o=t*Math.PI/180,i=Math.cos(o),a=Math.sin(o);return zh(e).map(s=>({x:r+(s.x-r)*i-(s.y-n)*a,y:n+(s.x-r)*a+(s.y-n)*i}))}function zh(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function Yh(e,t){return{minX:Math.min(...e.map(r=>r.x))-t,minY:Math.min(...e.map(r=>r.y))-t,maxX:Math.max(...e.map(r=>r.x))+t,maxY:Math.max(...e.map(r=>r.y))+t}}function se(e){return e.points.length===0?"":e.points.length<3||e.tension<=0?jh(e):Uh(e)}function jh(e){let[t,...r]=e.points,n=r.map(o=>`L ${o.x} ${o.y}`).join(" ");return`M ${t.x} ${t.y} ${n}${e.closed?" Z":""}`}function Uh(e){let t=e.points[0],r=e.closed?e.points.length:e.points.length-1,n=[`M ${t.x} ${t.y}`];for(let o=0;o<r;o++)n.push(Xh(e,o));return e.closed&&n.push("Z"),n.join(" ")}function Xh(e,t){let r=Nr(e,t-1),n=Nr(e,t),o=Nr(e,t+1),i=Nr(e,t+2),a=e.tension/6,s={x:n.x+(o.x-r.x)*a,y:n.y+(o.y-r.y)*a},l={x:o.x-(i.x-n.x)*a,y:o.y-(i.y-n.y)*a};return`C ${s.x} ${s.y} ${l.x} ${l.y} ${o.x} ${o.y}`}function Nr(e,t){return e.closed?e.points[(t+e.points.length)%e.points.length]:e.points[Math.max(0,Math.min(e.points.length-1,t))]}function p(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function fl(e){let t=e.order_key??e.orderKey;if(!t)return e.order??0;let r=0;for(let n=0;n<Math.min(t.length,8);n++)r=r*128+t.charCodeAt(n);return r}function hl(e,t){return e.sourceIndex??t}function R(e,t,r){return e?typeof e=="string"?{kind:"solid",color:e}:e.type==="gradient"?{kind:"linear-gradient",angle:e.angle,stops:e.stops.map(n=>({offset:n.position,color:n.color}))}:e.points.length===0?(t.push({severity:"warning",code:"empty-mesh-gradient",ownerId:r,message:"Mesh gradient has no color points."}),{kind:"none"}):{kind:"mesh-gradient",points:e.points.map(n=>({x:n.x,y:n.y,color:n.color}))}:{kind:"none"}}var N="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";function fo(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+n} H ${e} Z`}function ho(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function Nt(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r} V ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function Ot(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e} Z`}function gl(e,t,r,n,o){let i=Math.max(0,Math.min(r,n)/2),a=Math.max(0,Math.min(o.topLeft,i)),s=Math.max(0,Math.min(o.topRight,i)),l=Math.max(0,Math.min(o.bottomRight,i)),d=Math.max(0,Math.min(o.bottomLeft,i)),c=(u,m,f)=>u>0?`A ${u} ${u} 0 0 1 ${m} ${f} `:"";return`M ${e+a} ${t} H ${e+r-s} `+c(s,e+r,t+s)+`V ${t+n-l} `+c(l,e+r-l,t+n)+`H ${e+d} `+c(d,e,t+n-d)+`V ${t+a} `+c(a,e+a,t)+"Z"}function Or(e,t,r,n){return{fill:{kind:"solid",color:e||"transparent"},stroke:{kind:"solid",color:t},strokeWidth:r,dash:n?.length?n:void 0}}var Br=8;function qh(e,t,r){let n=e.strokeWidth/2;switch(e.labelPosition){case"bottom":{let o=e.x-n,i=e.y+e.height;return{x:o,y:i,width:r,height:t,path:ho(o,i,r,t,Br)}}case"left":{let o=e.x-t,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Nt(o,i,t,r,Br)}}case"right":{let o=e.x+e.width,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Ot(o,i,t,r,Br)}}default:{let o=e.x-n,i=e.y-t;return{x:o,y:i,width:r,height:t,path:fo(o,i,r,t,Br)}}}}function bl(e){let t=Math.max(32,e.fontSize+18),r=16,n=Math.max(120,e.title.length*e.fontSize*.62+r*2),o=qh(e,t,n),i=X(o,6),a=e.labelPosition==="left"||e.labelPosition==="right";return[{type:"path",id:e.tabId,order:e.order+.1,bounds:i,d:o.path,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"}}},a?Zh(e,o,r,i):Kh(e,o,r,i)]}function Kh(e,t,r,n){return{type:"text",id:e.titleId,order:e.order+.2,bounds:n,x:t.x+r,y:t.y,width:Math.max(0,t.width-r*2),height:t.height,lines:[e.title],fontFamily:e.fontFamily??N,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Zh(e,t,r,n){let o=t.x+t.width/2,i=t.y+t.height/2,a=e.fontSize*1.4,s=Math.max(1,t.height-r*2);return{type:"text",id:e.titleId,order:e.order+.2,bounds:n,x:o-s/2,y:i-a/2,width:s,height:a,lines:[e.title],fontFamily:e.fontFamily??N,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:o,y:i}}}var Qh={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function Jh(e,t,r){let n=e.shadow??!0,o=X({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(n?20:4)),i={...Or(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:n?{color:"#000000",opacity:.2,blur:12,dx:0,dy:4}:void 0};if(!r)return{type:"rect",id:`frame-${e.id}`,order:t,bounds:o,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:i};let a=Qh[e.labelPosition??"top"],s={topLeft:e.cornerRadius,topRight:e.cornerRadius,bottomRight:e.cornerRadius,bottomLeft:e.cornerRadius,[a]:0};return{type:"path",id:`frame-${e.id}`,order:t,bounds:o,d:gl(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function yl(e,t){if(e.isVisible===!1)return[];let r=t,n=(e.showLabel??!0)&&!!e.title,o=[Jh(e,r,n)];return n&&e.title&&o.push(...bl({tabId:`frame-tab-${e.id}`,titleId:`frame-title-${e.id}`,x:e.x,y:e.y,width:e.width,height:e.height,cornerRadius:e.cornerRadius,strokeWidth:e.strokeWidth,title:e.title,color:e.strokeColor,textColor:e.textColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,labelPosition:e.labelPosition??"top",order:r})),o}function eg(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Ir(e){if(!e?.enabled)return;let t=eg(e.angle??45,e.distance??5);return{color:e.color??"#000000",opacity:e.opacity??.25,blur:e.blur??10,dx:t.x,dy:t.y}}function tg(e,t){let{swimlane:r}=e;return r.orientation==="horizontal"?`M ${r.x} ${r.y+t} H ${r.x+r.width}`:`M ${r.x+t} ${r.y} V ${r.y+r.height}`}function xl(e){return e.lanes.slice(1).map((t,r)=>({type:"path",id:`swimlane-divider-${e.swimlane.id}-${r}`,order:e.order+.1+r/100,bounds:e.bounds,d:tg(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function Sl(e,t,r){return{type:"text",id:`swimlane-label-${e.swimlane.id}-${t.id}`,order:e.order+.5+r/100,lines:[t.label],fontFamily:e.swimlane.fontFamily??N,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function rg(e,t,r){let n=e.swimlane.fontSize*1.4,o=e.swimlane.x+10+n/2,i=e.swimlane.y+t.offset+t.size/2,a=Math.max(20,t.size-16),s=o-a/2,l=i-n/2;return{...Sl(e,t,r),bounds:J({x:s,y:l,width:a,height:n},-90,12),x:s,y:l,width:a,height:n,align:"center",verticalAlign:"middle",rotation:-90,rotationCenter:{x:o,y:i}}}function ng(e,t,r){return{...Sl(e,t,r),bounds:e.bounds,x:e.swimlane.x+t.offset+8,y:e.swimlane.y+8,width:Math.max(0,t.size-16),height:Math.max(0,e.swimlane.height-16),align:"left",verticalAlign:"top"}}function Cl(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?rg:ng;return e.lanes.map((r,n)=>t(e,r,n))}function og(e){let t=e.orientation==="horizontal"?e.height:e.width,r=e.lanes.reduce((n,o)=>n+o.size,0);return r<=0||t<=0?e.lanes:e.lanes.map(n=>({...n,size:n.size*(t/r)}))}function ig(e){let t=0;return og(e).map(r=>{let n={...r,offset:t};return t+=r.size,n})}function Rl(e,t){return{swimlane:e,order:5e3+t,bounds:X({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:ig(e)}}function kl(e,t){if(e.isVisible===!1)return[];let r=Rl(e,t);return[{type:"rect",id:`swimlane-${e.id}`,order:r.order,bounds:r.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:{...Or(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Ir(e.shadowStyle)}},...xl(r),...Cl(r)]}function wl(e){return[...e.frames.flatMap((t,r)=>U(yl(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>U(kl(t,r),"swimlane",t.id))]}function go(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function vl(e,t,r){let n=go(e,t);if(n===0)return e;let o=r/n;return{x:e.x+(t.x-e.x)*o,y:e.y+(t.y-e.y)*o}}function ag(e,t,r,n){let o=Math.max(0,Math.min(n,go(t,e)/2,go(t,r)/2));return{vertex:t,start:vl(t,e,o),end:vl(t,r,o)}}function Gr(e,t){if(e.length<3)return"";let r=a=>typeof t=="number"?t:t[a]??0;if(e.every((a,s)=>r(s)<=0)){let[a,...s]=e;return`M ${a.x} ${a.y} ${s.map(l=>`L ${l.x} ${l.y}`).join(" ")} Z`}let n=e.map((a,s)=>ag(e[(s-1+e.length)%e.length],a,e[(s+1)%e.length],r(s))),o=[`M ${n[0].end.x} ${n[0].end.y}`];for(let a=1;a<n.length;a++){let s=n[a];o.push(`L ${s.start.x} ${s.start.y}`,`Q ${s.vertex.x} ${s.vertex.y} ${s.end.x} ${s.end.y}`)}let i=n[0];return o.push(`L ${i.start.x} ${i.start.y}`,`Q ${i.vertex.x} ${i.vertex.y} ${i.end.x} ${i.end.y}`,"Z"),o.join(" ")}function sg(e,t){let r=Math.max(0,p(e.strokeWidth,1)),n=p(e.rotation,0),o=oo(e),i={x:o.x+o.width/2,y:o.y+o.height/2};return{object:e,index:t,order:15e3+t,rotation:n,rotationCenter:i,box:o,strokeWidth:r,common:{type:"path",bounds:J(o,n,r+2),rotation:n,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function lg(e,t){let{object:r,index:n,rotation:o,rotationCenter:i}=e;if(!r.hasShadow)return;let a=Math.max(0,r.height),s=.6+Math.min(1,a/150)*.7,l=a+p(r.shadowStyle?.distance,0),d=t.top.map(b=>({x:b.x,y:b.y+l})),c={x:d.reduce((b,y)=>b+y.x,0)/d.length,y:d.reduce((b,y)=>b+y.y,0)/d.length},u=1.3,m=d.map(b=>({x:c.x+(b.x-c.x)*u,y:c.y+(b.y-c.y)*u})),f=m.map(b=>b.x),g=m.map(b=>b.y);return{type:"path",id:`isometric-${r.id}-ground-shadow`,order:14e3+n,bounds:{minX:Math.min(...f),minY:Math.min(...g),maxX:Math.max(...f),maxY:Math.max(...g)},d:Gr(m,0),rotation:o,rotationCenter:i,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:Math.min(1,(r.shadowStyle?.opacity??.18)*s),blur:p(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function dg(e,t,r){let{object:n,order:o,common:i}=e,a={...i.style,stroke:{kind:"none"}},s=so(n.fill??"#f8fafc"),l={prop:"style.fill",propKind:"color",propSolidOnly:!0},d=(c,u,m,f)=>({...i,id:`isometric-${n.id}-${c}`,order:o+u,d:Gr(m,0),style:{...a,fill:{kind:"solid",color:f},clip:r},...l});return[d("top",0,t.top,s.topFill),d("front",.1,t.front,s.frontFill),d("side",.2,t.right,s.sideFill)]}function cg(e,t,r){let{object:n,order:o,common:i,strokeWidth:a}=e;return{...i,id:`isometric-${n.id}-seams`,order:o+.22,d:`M ${t.top[3].x} ${t.top[3].y} L ${t.top[2].x} ${t.top[2].y} L ${t.top[1].x} ${t.top[1].y} M ${t.top[2].x} ${t.top[2].y} L ${t.front[2].x} ${t.front[2].y}`,style:{...i.style,fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:Math.min(a,1),clip:r}}}function ug(e,t,r){let{object:n,order:o,common:i,box:a}=e;return{...i,id:`isometric-${n.id}-hull`,order:o+.24,d:t,detail:{of:"isometricGeometry",width:Math.max(0,n.width),height:Math.max(0,n.height),depth:Math.max(0,n.depth),cornerRadius:r,bounds:a,labelOffsetX:p(n.labelOffsetX,0),labelOffsetY:p(n.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}var bo=20,mg=12,pg=6,Dr=3,fg=6.5;function hg(e){let{object:t}=e,r=io(t),n=r.y-mg+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:n-bo,bottomY:n}}function gg(e,t,r){let{object:n,order:o,rotation:i,rotationCenter:a,box:s}=e,{centerX:l,topY:d,bottomY:c}=t;return{type:"text",id:`isometric-${n.id}-label`,order:o+.3,bounds:{minX:l-s.width/2,minY:d,maxX:l+s.width/2,maxY:c},x:l-s.width/2,y:d,width:s.width,height:bo,lines:[r],fontFamily:N,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function bg(e,t){let{object:r,order:n,rotation:o,rotationCenter:i}=e,{anchor:a,centerX:s,bottomY:l}=t;return{type:"path",id:`isometric-${r.id}-label-guide`,order:n+.25,bounds:{minX:Math.min(a.x,s),minY:Math.min(a.y,l),maxX:Math.max(a.x,s),maxY:Math.max(a.y,l)},d:`M ${a.x} ${a.y} L ${s} ${l}`,rotation:o,rotationCenter:i,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:1,lineCap:"round",pointerEvents:"none"}}}function yg(e,t,r,n){let{object:o,order:i,rotation:a}=e,{centerX:s,topY:l,bottomY:d}=t,c=Math.max(24,r.length*fg+pg*2);return{type:"rect",id:`isometric-${o.id}-label-background`,order:i+.28,x:s-c/2,y:l-Dr,width:c,height:bo+Dr*2,rx:4,bounds:{minX:s-c/2,minY:l-Dr,maxX:s+c/2,maxY:d+Dr},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:n},stroke:{kind:"none"}}}}function xg(e,t){let r=hg(e),n=gg(e,r,t),o=bg(e,r),i=e.object.labelBackground;return i?[o,yg(e,r,t,i),n]:[o,n]}function Sg(e,t){let r=sg(e,t),n=Ee(e),o=Math.max(0,p(e.cornerRadius,8)),i=[n.top[0],n.top[1],n.right[2],n.front[2],n.front[3],n.top[3]],a=Gr(i,o),s={type:"path",d:a},l=lg(r,n),d=cg(r,n,s),c=ug(r,a,o),u=dg(r,n,s),m=l?[c,...u,l,d]:[c,...u,d];return e.text?[...m,...xg(r,e.text)]:m}function Pl(e){return e.flatMap((t,r)=>U(Sg(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function Cg(e,t){let r=t==="start"?0:e.length-2,n=t==="start"?2:e.length-4,o=e[r],i=e[r+1],a=e[n]-o,s=e[n+1]-i,l=Math.hypot(a,s)||1,d=a/l,c=s/l;return{x:o+d*20-c*13,y:i+c*20+d*13}}function Ll(e,t,r){let n=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!n)return[];let o=p(e.link.style?.fontSize,10),i=Cg(e.points,t),a=90;return[{type:"text",id:`link-${t}-label-${e.link.id}`,order:e.order+.55+r*.01,bounds:e.bounds,x:i.x-a/2,y:i.y-o,width:a,height:o*2,lines:[n],fontFamily:e.link.style?.fontFamily??N,fontSize:o,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function Tl(e){return[...Ll(e,"start",0),...Ll(e,"end",1)]}function $l(e){return e.label.visible?[{type:"text",id:`link-text-${e.link.id}`,order:e.order+.5,bounds:e.bounds,x:e.midpoint.x-e.label.width/2,y:e.midpoint.y-e.label.fontSize,width:e.label.width,height:e.label.fontSize*2,lines:e.label.lines,fontFamily:e.link.style?.fontFamily??N,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var yo=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:t[4]===void 0?1:parseInt(t[4],16)/255}:{r:255,g:255,b:255,a:1}},Ml=(e,t,r,n)=>{let o=a=>{let s=Math.max(0,Math.min(255,Math.round(a))).toString(16);return s.length===1?`0${s}`:s},i=n===void 0||n>=1?"":o(n*255);return`#${o(e)}${o(t)}${o(r)}${i}`};function Rg(e,t,r){let n=yo(e),o=yo(t),i=n.a??1,a=o.a??1;return Ml(Math.round(n.r+(o.r-n.r)*r),Math.round(n.g+(o.g-n.g)*r),Math.round(n.b+(o.b-n.b)*r),i+(a-i)*r)}function Bt(e,t){let r=[...e].sort((i,a)=>i.position-a.position),n=r[0],o=r[r.length-1];if(t<=n.position)return n.color;if(t>=o.position)return o.color;for(let i=0;i<r.length-1;i++){let a=r[i],s=r[i+1];if(t>=a.position&&t<=s.position){let l=s.position-a.position,d=l===0?0:(t-a.position)/l;return Rg(a.color,s.color,d)}}return o.color}function Al(e){if(e){if(typeof e=="string")return e;if(e.type==="gradient")return e.stops?.[0]?.color;if(e.type==="solid")return e.color}}var El=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function fe(e,t,r,n){let o=Math.max(1,Math.floor(t/Math.max(1,r*.58))),i=n?(s,l)=>n.measure(s,!1)+n.spaceWidth+n.measure(l,!1)<=t:(s,l)=>`${s} ${l}`.length<=o,a=[];for(let s of e.split(`
|
|
12
|
+
`)){let l=s.split(/\s+/).filter(Boolean);if(!l.length){a.push("");continue}let d="";for(let c of l)d?i(d,c)?d+=` ${c}`:(a.push(d),d=c):d=c;a.push(d)}return a}function It(e,t,r){return e.length*t*(r?.64:.58)}function Nl(e){return{measure:(t,r)=>It(t,e,r),spaceWidth:e*.58}}var Ne=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function xo(e,t,r,n,o){let i=1-o;return{x:i*i*i*e.x+3*i*i*o*t.x+3*i*o*o*r.x+o*o*o*n.x,y:i*i*i*e.y+3*i*i*o*t.y+3*i*o*o*r.y+o*o*o*n.y}}function So(e,t,r,n,o){let i=Ne(e,t,o),a=Ne(t,r,o),s=Ne(r,n,o),l=Ne(i,a,o),d=Ne(a,s,o),c=Ne(l,d,o);return{left:[e,i,l,c],right:[c,d,s,n]}}function _r(e,t){let r=e.length-2;if(t<=0)return{point:{x:e[0],y:e[1]},segmentIndex:0};let n=0;for(let o=0;o<r;o+=2){let i={x:e[o],y:e[o+1]},a={x:e[o+2],y:e[o+3]},s=Math.hypot(a.x-i.x,a.y-i.y);if(n+s>=t){let l=s===0?0:(t-n)/s;return{point:Ne(i,a,l),segmentIndex:o}}n+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Fr(e){let t=0;for(let r=0;r<e.length-2;r+=2)t+=Math.hypot(e[r+2]-e[r],e[r+3]-e[r+1]);return t}function Ol(e,t,r,n,o=40){let i=0,a=e;for(let s=1;s<=o;s++){let l=xo(e,t,r,n,s/o);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var ot=40;function kg(e){let t=[0],r=e[0];for(let n=1;n<=ot;n++){let o=xo(...e,n/ot);t.push(t[n-1]+Math.hypot(o.x-r.x,o.y-r.y)),r=o}return t}function Bl(e,t){let r=e[ot];if(t<=0)return 0;if(t>=r)return 1;for(let n=1;n<=ot;n++)if(e[n]>=t){let o=(t-e[n-1])/(e[n]-e[n-1]||1);return(n-1+o)/ot}return 1}function wg(e,t,r){let[n,o,i,a]=e,s=.75*(o.x-n.x)+1.5*(i.x-o.x)+.75*(a.x-i.x),l=.75*(o.y-n.y)+1.5*(i.y-o.y)+.75*(a.y-i.y),d=Math.hypot(s,l),c=d===0?1:Math.abs(s)/d,u=d===0?0:Math.abs(l)/d;return Math.min(t.halfWidth*c+t.halfHeight*u,r)}function Il(e,t){if(e.length<8)return null;let r=vg(e),n=kg(r),o=n[ot];if(o===0)return null;let i=o/2,a=Math.max(0,i-t.minimumVisibleStub),s=wg(r,t,a),l=Bl(n,i-s),d=Bl(n,i+s);return{before:Pg(r,l),after:Lg(r,d),bezier:!0}}function vg(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function Pg(e,t){return t<=.01?null:So(...e,t).left.flatMap(r=>[r.x,r.y])}function Lg(e,t){return t>=.99?null:So(...e,t).right.flatMap(r=>[r.x,r.y])}function Gl(e,t){if(e.length<4)return null;let r=Fr(e);if(r===0)return null;let n=Tg(e,r,t);return{before:Mg(e,n.beforeLength),after:Ag(e,n.afterLength,r),bezier:!1}}function Tg(e,t,r){let n=t/2,o=_r(e,n),i={x:e[o.segmentIndex],y:e[o.segmentIndex+1]},a={x:e[o.segmentIndex+2],y:e[o.segmentIndex+3]},s=$g(i,a,r,n);return{beforeLength:n-s,afterLength:n+s}}function $g(e,t,r,n){let o=Math.hypot(t.x-e.x,t.y-e.y),i=o===0?1:Math.abs(t.x-e.x)/o,a=o===0?0:Math.abs(t.y-e.y)/o,s=r.halfWidth*i+r.halfHeight*a;return Math.min(s,Math.max(0,n-r.minimumVisibleStub))}function Mg(e,t){if(t<=.5)return null;let r=_r(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function Ag(e,t,r){if(t>=r-.5)return null;let n=_r(e,t);return[n.point.x,n.point.y,...e.slice(n.segmentIndex+2)]}var Dl=3,Eg=10;function Ng(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function Co(e,t){return t?Ol(...Ng(e)):Fr(e)}function _l(e,t,r,n){let o={halfWidth:(r+Dl)/2,halfHeight:(n+Dl)/2,minimumVisibleStub:Eg};return t==="curved"?Il(e,o):Gl(e,o)}function Ro(e,t,r,n){let o=_l(e,t,r,n);if(!o||!o.before&&!o.after)return null;let i=Co(e,o.bezier),a=o.before?Co(o.before,o.bezier):0,s=o.after?Co(o.after,o.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Og(e){let[t,r,n,o,i,a,s,l]=e,d=.5,c=1-d;return{x:c*c*c*t+3*c*c*d*n+3*c*d*d*i+d*d*d*s,y:c*c*c*r+3*c*c*d*o+3*c*d*d*a+d*d*d*l}}function Bg(e,t){let r=0,n=[];for(let a=0;a<e.length-2;a+=2){let s={x:e[a],y:e[a+1]},l={x:e[a+2],y:e[a+3]},d=Math.sqrt((l.x-s.x)**2+(l.y-s.y)**2);r+=d,n.push({start:s,end:l,length:d})}let o=r/2,i=0;for(let a of n){if(i+a.length>=o){let s=(o-i)/a.length;return{x:a.start.x+s*(a.end.x-a.start.x),y:a.start.y+s*(a.end.y-a.start.y)}}i+=a.length}return t}function ko(e,t,r,n){if(t==="curved")return Og(e);let o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};return t==="orthogonal"?Bg(e,o):o}function it(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Ig(e,t,r,n,o){let i=o?.min??50,a=o?.max??240,s=o?.perpendicularScale??.9,l=t.x-e.x,d=t.y-e.y,c=Math.abs(l*r[0]+d*r[1]),u=Math.abs(l*n[0]+d*n[1]),m=Math.abs(l*r[1]-d*r[0]),f=Math.abs(l*n[1]-d*n[0]),g=r[0]===n[0]&&r[1]===n[1]||r[0]===-n[0]&&r[1]===-n[1],b=Math.max(i,Math.min(a,Math.max(c,m*s))),y=Math.max(i,Math.min(a,Math.max(u,f*s)));return g&&(b=Math.min(a,b+m*.75),y=Math.min(a,y+f*.75)),{fromDistance:b,toDistance:y}}function Fl(e,t,r,n,o){let i=it(r),a=it(n),{fromDistance:s,toDistance:l}=Ig(e,t,i,a,o);return{p0:[e.x,e.y],p1:[e.x+i[0]*s,e.y+i[1]*s],p2:[t.x+a[0]*l,t.y+a[1]*l],p3:[t.x,t.y]}}function Hl(e,t,r,n){let{p0:o,p1:i,p2:a,p3:s}=Fl(e,t,r,n,{min:35,max:90,perpendicularScale:.5});return{points:[...o,...i,...a,...s],segments:[]}}function Wl(e,t,r,n){let i=["top","bottom"].includes(r)&&["top","bottom"].includes(n),a=["left","right"].includes(r)&&["left","right"].includes(n);return i&&Math.abs(t.x-e.x)<6?[e,{...t,x:e.x}]:a&&Math.abs(t.y-e.y)<6?[e,{...t,y:e.y}]:[e,t]}function zl(e,t,r){return r?.toEdge?r.toEdge==="left"||r.toEdge==="right":r?.fromEdge?r.fromEdge==="left"||r.fromEdge==="right":Math.abs(t.x-e.x)>Math.abs(t.y-e.y)}function Yl(e,t,r,n,o){let i=40,a=40,s=o?0:1,l=o?t.x-e.x:t.y-e.y;if(r[s]!==0&&r[s]===-n[s]){let d=l*r[s];d>0&&d<i+a&&(i=d/2,a=d/2)}else if(r[s]===0){let d=l*-n[s];d>0&&d<a&&(a=d)}return[i,a]}function jl(e){let{fromConnection:t,toConnection:r,to:n,horizontalFirst:o}=e,i=t.stub,a=r.stub,s=(i[0]+a[0])/2,l=(i[1]+a[1])/2,d=Vl(t.side),c=Vl(r.side);return d!==c?o?s=(i[0]-n.x)*r.normal[0]>=0?i[0]:a[0]:l=(i[1]-n.y)*r.normal[1]>=0?i[1]:a[1]:t.side===r.side&&(o?s=t.normal[0]<0?Math.min(i[0],a[0]):Math.max(i[0],a[0]):l=t.normal[1]<0?Math.min(i[1],a[1]):Math.max(i[1],a[1])),[s,l]}function Vl(e){return e==="left"||e==="right"}function Ul(e){let t=[];for(let r=0;r<e.length-2;r+=2)t.push({x:(e[r]+e[r+2])/2,y:(e[r+1]+e[r+3])/2});return t}function Xl(e,t){let{from:r,to:n,fromConnection:o,toConnection:i,horizontalFirst:a}=e,s=o.stub,l=i.stub,d=[r.x,r.y,s[0],s[1]];return a?d.push(t[0],s[1],t[0],l[1]):d.push(s[0],t[1],l[0],t[1]),d.push(l[0],l[1],n.x,n.y),d}function ql(e,t,r){let n=e?["left","right"]:["top","bottom"];return[!n.includes(t),!n.includes(r)]}function Kl(e,t,r,n){let{from:o,to:i,fromConnection:a,toConnection:s,horizontalFirst:l}=e,d=a.stub,c=s.stub,u=n[0]&&r?.[1]||0,m=r?.[2]||0,f=n[1]&&r?.[3]||0;if(l){let S=d[1]+u,v=t[0]+m,$=c[1]+f;return[o.x,o.y,d[0],S,v,S,v,$,c[0],$,i.x,i.y]}let g=d[0]+u,b=t[1]+m,y=c[0]+f;return[o.x,o.y,g,d[1],g,b,y,b,y,c[1],i.x,i.y]}function Zl(e,t,r,n){let o=(e.length-2)/2;return t.map((i,a)=>{let s=a*2,l={x:e[s],y:e[s+1]},d={x:e[s+2],y:e[s+3]},c={x:(l.x+d.x)/2,y:(l.y+d.y)/2},u=a>0&&a<o-1,m=a===1?r:a===o-2?n:!0,f=Math.hypot(d.x-l.x,d.y-l.y)>=1;return{start:l,end:d,midpoint:c,originalMidpoint:i,isHorizontal:Math.abs(d.x-l.x)>Math.abs(d.y-l.y),canMove:u&&m&&f}})}function Hr(e,t){if(e.length<6)return e;let r=Fg(e),n=[r[0]];for(let o=1;o<r.length-1;o++){let i=Gg(r[o-1],r[o],r[o+1],t);n.push(...i?_g(i):[r[o]])}return n.push(r[r.length-1]),n.flatMap(o=>[o.x,o.y])}function Gg(e,t,r,n){let o={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=o.x===0||o.y===0,s=i.x===0||i.y===0,l=o.x===0&&i.x===0||o.y===0&&i.y===0;if(!a||!s||l)return null;let d=Math.min(n,Ql(o)*.4,Ql(i)*.4);if(d<=0)return null;let c=Jl(o),u=Jl(i),m=wo(t,c,-d),f=wo(t,u,d),g=wo(m,u,d),b=Math.atan2(m.y-g.y,m.x-g.x),y=Math.atan2(f.y-g.y,f.x-g.x);return{entry:m,exit:f,center:g,radius:d,startAngle:b,angleSweep:Dg(y-b)}}function wo(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function Ql(e){return Math.abs(e.x)+Math.abs(e.y)}function Jl(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function Dg(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function _g(e){let t=[e.entry];for(let r=1;r<7;r++){let n=r/7,o=e.startAngle+e.angleSweep*n;t.push({x:e.center.x+Math.cos(o)*e.radius,y:e.center.y+Math.sin(o)*e.radius})}return t.push(e.exit),t}function Fg(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function vo(e){let t=Hg(e),r=jl(t),n=Xl(t,r),o=Ul(n),i=ql(t.horizontalFirst,e.fromSide,e.toSide),a=Kl(t,r,e.segmentOffsets,i),s=Zl(a,o,i[0],i[1]);return{points:Hr(a,10),segments:s}}function Hg(e){let[t,r]=Wl(e.from,e.to,e.fromSide,e.toSide),n=it(e.fromSide),o=it(e.toSide),i=zl(t,r,e.endpointEdges),[a,s]=Yl(t,r,n,o,i);return{from:t,to:r,fromConnection:ed(t,e.fromSide,n,a),toConnection:ed(r,e.toSide,o,s),horizontalFirst:i}}function ed(e,t,r,n){return{side:t,normal:r,stub:[e.x+r[0]*n,e.y+r[1]*n]}}var td=.5;function rd(e,t,r){let n=[e,...t,r],o=[];for(let a of n)o.push(a.x,a.y);let i=[];for(let a=0;a<o.length-2;a+=2){let s={x:o[a],y:o[a+1]},l={x:o[a+2],y:o[a+3]},d={x:(s.x+l.x)/2,y:(s.y+l.y)/2};i.push({start:s,end:l,midpoint:d,originalMidpoint:d,isHorizontal:Math.abs(l.x-s.x)>Math.abs(l.y-s.y),canMove:!1})}return{points:Hr(o,10),segments:i}}function Po(e){return e.every(t=>{let r=Math.abs(t.end.x-t.start.x),n=Math.abs(t.end.y-t.start.y);return r<=td||n<=td})}function nd(e,t,r,n,o){if(e.waypoints&&e.waypoints.length>0){let l=rd(t,e.waypoints,r);if(Po(l.segments))return l}let i={fromEdge:n,toEdge:o},a={from:t,to:r,fromSide:n,toSide:o,segmentOffsets:e.segmentOffsets,endpointEdges:i},s=vo(a);return Po(s.segments)?s:vo({...a,segmentOffsets:void 0})}function od(e,t){let r=Math.atan2(t.y-e.y,t.x-e.x);return r>=-Math.PI/4&&r<Math.PI/4?"right":r>=Math.PI/4&&r<3*Math.PI/4?"bottom":r>=-3*Math.PI/4&&r<-Math.PI/4?"top":"left"}function id(e,t,r){let n=e.fromPoint?.kind==="side"?e.fromPoint.side:od(t,r),o=e.toPoint?.kind==="side"?e.toPoint.side:od(r,t);return{fromSide:n,toSide:o}}function ad(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function sd(e,t,r,n){let{fromSide:o,toSide:i}=id(e,t,r);return n==="curved"?Hl(t,r,o,i):n==="orthogonal"?nd(e,t,r,o,i):ad(t,r)}function Vg(e,t){let r=e.filter((o,i)=>i%2===0),n=e.filter((o,i)=>i%2===1);return{minX:Math.min(...r)-t,minY:Math.min(...n)-t,maxX:Math.max(...r)+t,maxY:Math.max(...n)+t}}function Wg(e,t){let r=!!(e.showText&&e.text),n=p(e.style?.fontSize,10),o=Math.min(250,Math.max(n*2,(e.text?.length??0)*n*.65+10)),i=t?.(e.style?.fontFamily??N,n),a=r?fe(e.text??"",o,n,i):[];return{visible:r,fontSize:n,width:o,height:a.length*n*1.4,lines:a}}function zg(e,t,r,n){let o=e.link,i=typeof o.style?.color=="object"&&o.style.color.type==="gradient"?{kind:"linear-gradient",angle:0,stops:o.style.color.stops.map(a=>({offset:a.position,color:a.color}))}:{kind:"solid",color:r};return{fill:{kind:"none"},stroke:i,strokeWidth:t,dash:n,lineCap:"round",lineJoin:"round",opacity:p(o.style?.opacity,1),shadow:Ir(o.style?.shadow)}}function ld(e,t,r){let{link:n,from:o,to:i}=e,a=n.style?.pathType??"orthogonal",{points:s,segments:l}=sd(n,o,i,a),d=p(n.style?.strokeWidth,2),c=Al(n.style?.color)||"#64748b",u=Wg(n,r),m=El(d,n.style?.strokeStyle??"solid"),f=u.visible&&!m?Ro(s,a,u.width,u.height):null,g=f?[f.dashBefore,f.gapLength,1e6]:m;return{link:n,pathType:a,points:s,segments:l,midpoint:ko(s,a,o,i),strokeWidth:d,bounds:Vg(s,d+14),color:c,order:2e4+t,style:zg(e,d,c,g),label:u,hasLabelGap:!!f}}function Lo(e,t){let r=t==="start"?e.startMarker:e.endMarker;if(r)return r;let n=e.style?.arrowDirection??"forward";return n==="bidirectional"||t==="start"&&n==="backward"||t==="end"&&n==="forward"?"arrow":"none"}function dd(e,t){if(e.length===0)return"";let r=[e[0].start,...e.map(s=>s.end)],n=r.filter((s,l)=>l===0||s.x!==r[l-1].x||s.y!==r[l-1].y),o=n.filter((s,l)=>{if(l===0||l===n.length-1)return!0;let d=n[l-1],c=n[l+1];return!(d.x===s.x&&s.x===c.x||d.y===s.y&&s.y===c.y)});if(o.length<2)return"";let i=`M ${o[0].x} ${o[0].y}`;for(let s=1;s<o.length-1;s++){let l=o[s-1],d=o[s],c=o[s+1],u=Math.hypot(d.x-l.x,d.y-l.y),m=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||m===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,m*.4),g={x:d.x+(l.x-d.x)/u*f,y:d.y+(l.y-d.y)/u*f},b={x:d.x+(c.x-d.x)/m*f,y:d.y+(c.y-d.y)/m*f};i+=` L ${g.x} ${g.y} Q ${d.x} ${d.y} ${b.x} ${b.y}`}let a=o[o.length-1];return`${i} L ${a.x} ${a.y}`}function Yg(e){let t=`M ${e[0]} ${e[1]}`;for(let r=2;r<e.length;r+=2)t+=` L ${e[r]} ${e[r+1]}`;return t}function jg(e,t,r,n){return e.length<4?"":t==="curved"&&e.length>=8?`M ${e[0]} ${e[1]} C ${e[2]} ${e[3]} ${e[4]} ${e[5]} ${e[6]} ${e[7]}`:t==="orthogonal"&&r.length>0?dd(r,Math.max(16,n*4)):Yg(e)}var at=e=>Math.round(e*100)/100;function Ug(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:at(r.start.x),ay:at(r.start.y),bx:at(r.end.x),by:at(r.end.y),ox:at(r.originalMidpoint.x),oy:at(r.originalMidpoint.y),movable:r.canMove}))}function cd(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:jg(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:Lo(t,"start"),markerEnd:Lo(t,"end"),detail:{of:"link",fromId:t.fromId,toId:t.toId,route:e.pathType,fromSide:t.fromPoint?.kind==="side"?t.fromPoint.side:void 0,toSide:t.toPoint?.kind==="side"?t.toPoint.side:void 0,fromFace:t.fromPoint?.kind==="face"?t.fromPoint.face:void 0,toFace:t.toPoint?.kind==="face"?t.toPoint.face:void 0,labelGap:e.hasLabelGap,segments:Ug(e.pathType,e.segments)}}}function ud(e){let{link:t}=e;if(t.weight===void 0||t.weight===null||t.showWeight===!1)return[];let r=t.weight.toFixed(1),n=Math.max(30,r.length*8+12),o=16,i=e.midpoint.y+(e.label.visible?e.label.height/2+10:0);return[{type:"rect",id:`link-weight-badge-${t.id}`,order:e.order+.6,bounds:e.bounds,x:e.midpoint.x-n/2,y:i-o/2,width:n,height:o,rx:o/2,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"},opacity:.92}},{type:"text",id:`link-weight-${t.id}`,order:e.order+.61,bounds:e.bounds,x:e.midpoint.x-n/2,y:i-o/2,width:n,height:o,lines:[r],fontFamily:"Arial, sans-serif",fontSize:10,fontWeight:"bold",color:"#ffffff",align:"center",verticalAlign:"middle",lineHeight:1}]}function Xg(e,t,r){if(e.link.isVisible===!1)return[];let n=ld(e,t,r);return[cd(n),...$l(n),...ud(n),...Tl(n)]}function md(e,t){return e.flatMap((r,n)=>U(Xg(r,n,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function qg(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=p(e.strokeWidth,2),n=r+12,o={minX:Math.min(...e.points.map(s=>s.x))-n,minY:Math.min(...e.points.map(s=>s.y))-n,maxX:Math.max(...e.points.map(s=>s.x))+n,maxY:Math.max(...e.points.map(s=>s.y))+n},i=p(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:o,d:se({points:e.points,tension:i,closed:a}),markerStart:e.startMarker,markerEnd:e.endMarker,detail:{of:"pathGeometry",points:e.points.map(s=>[s.x,s.y]),tension:i,closed:a},style:{fill:e.closed?{kind:"solid",color:e.fillColor??"transparent"}:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??"#7c3aed"},strokeWidth:r,dash:e.dash?.length?e.dash:void 0,lineCap:"round",lineJoin:"round",opacity:p(e.opacity,1)}}]}function pd(e){return e.flatMap((t,r)=>U(qg(t,r),"path",t.id,"path","Path"))}function Gt(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Kg=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Vr=Math.PI/2,Zg=4*Vr,fd=Math.PI/2,Qg=1e-9;function To([e,t,r],n){return[e+r*Math.cos(n),t+r*Math.sin(n)]}function hd([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function gd(e,t,r){let n=t[0]-e[0],o=t[1]-e[1],i=Math.hypot(n,o),a=(e[2]**2-t[2]**2+i**2)/(2*i),s=Math.sqrt(Math.max(0,e[2]**2-a**2)),l=e[0]+a*n/i,d=e[1]+a*o/i,c=[[l-s*o/i,d+s*n/i],[l+s*o/i,d-s*n/i]],u=m=>Math.hypot(m[0]-r[0],m[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function Jg(e){let t=[e.reduce((r,n)=>r+n[0],0)/e.length,e.reduce((r,n)=>r+n[1],0)/e.length];return e.map((r,n)=>{let o=n===0?fd:hd(r,gd(e[n-1],r,t)),a=n===e.length-1?fd:hd(r,gd(r,e[n+1],t));for(;a<=o;)a+=Zg;return{lobe:r,from:o,to:a}})}function eb(e,t){let r=[];for(let n=Math.floor(e/Vr)+1;n*Vr<t-Qg;n++)r.push(n*Vr);return[...r,t]}function tb({lobe:e,from:t,to:r}){let n=To(e,t),o=[],i=t;for(let a of eb(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=To(e,i),d=To(e,a);o.push([[l[0]-s*Math.sin(i),l[1]+s*Math.cos(i)],[d[0]+s*Math.sin(a),d[1]-s*Math.cos(a)],d]),i=a}return{start:n,curves:o}}function rb(){let e=Jg(Kg).map(tb),t=e[0].start,r=e.flatMap(d=>d.curves),n=[t,...r.map(d=>d[2])],o=Math.min(...n.map(d=>d[0])),i=Math.max(...n.map(d=>d[0])),a=Math.min(...n.map(d=>d[1])),s=Math.max(...n.map(d=>d[1])),l=d=>[(d[0]-o)/(i-o),(d[1]-a)/(s-a)];return{start:l(t),curves:r.map(([d,c,u])=>[l(d),l(c),l(u)])}}var bd=rb();function yd(e,t,r,n){let o=([a,s])=>`${e+a*r} ${t+s*n}`,i=bd.curves.map(([a,s,l])=>`C ${o(a)} ${o(s)} ${o(l)}`);return`M ${o(bd.start)} ${i.join(" ")} Z`}function xd(e,t,r,n){let o=Math.min(n*.22,r*.2),i=r/2,a=e+i,s=e,l=e+r,d=t+o,c=t+n-o,u=`M ${s} ${d} C ${s} ${d+.5523*o} ${a-.5523*i} ${d+o} ${a} ${d+o} C ${a+.5523*i} ${d+o} ${l} ${d+.5523*o} ${l} ${d} C ${l} ${d-.5523*o} ${a+.5523*i} ${t} ${a} ${t} C ${a-.5523*i} ${t} ${s} ${d-.5523*o} ${s} ${d} Z`,m=`M ${s} ${d} L ${s} ${c} C ${s} ${c+.5523*o} ${a-.5523*i} ${t+n} ${a} ${t+n} C ${a+.5523*i} ${t+n} ${l} ${c+.5523*o} ${l} ${c} L ${l} ${d}`;return`${u} ${m}`}function Sd(e,t,r,n){let o=Math.min(r/4,n/4.35),i=o,a=o*2,s=o*4.35,l=t+(n-s)/2;return{head:i,body:a,centerX:e+r/2,headCenterY:l+i,bottom:l+s}}function Cd(e,t,r,n){let{body:o,centerX:i,bottom:a}=Sd(e,t,r,n);return{x:i-o,y:a-o,width:o*2,height:o}}function Rd(e,t,r,n){let{head:o,body:i,centerX:a,headCenterY:s,bottom:l}=Sd(e,t,r,n),d=`M ${a} ${s-o} C ${a+.5523*o} ${s-o} ${a+o} ${s-.5523*o} ${a+o} ${s} C ${a+o} ${s+.5523*o} ${a+.5523*o} ${s+o} ${a} ${s+o} C ${a-.5523*o} ${s+o} ${a-o} ${s+.5523*o} ${a-o} ${s} C ${a-o} ${s-.5523*o} ${a-.5523*o} ${s-o} ${a} ${s-o} Z`,c=`M ${a-i} ${l} C ${a-i} ${l-.5523*i} ${a-.5523*i} ${l-i} ${a} ${l-i} C ${a+.5523*i} ${l-i} ${a+i} ${l-.5523*i} ${a+i} ${l} Z`;return`${d} ${c}`}var nb=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,n)=>t+(n%2?` ${r}`:` L ${r}`),"")} Z`,ob=.1,ib=Math.PI/6,ab=.25,sb=.15;function kd(e,t){return Math.min(e,t)/2}function wd(e,t,r,n,o){let i=(...a)=>nb(a);switch(e){case"diamond":return i(t+n/2,r,t+n,r+o/2,t+n/2,r+o,t,r+o/2);case"triangle":return i(t+n/2,r,t,r+o,t+n,r+o);case"parallelogram":return i(t+n*.15,r,t+n,r,t+n*.85,r+o,t,r+o);case"trapezoid":return i(t+n*.2,r,t+n*.8,r,t+n,r+o,t,r+o);case"hexagon":{let a=Math.min(n,o)/4;return i(t+a,r,t+n-a,r,t+n,r+o/2,t+n-a,r+o,t+a,r+o,t,r+o/2)}case"document":{let a=o*ob,s=r+o-a,l=n/4,d=a*ib;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${s} C ${t+n-l/3} ${s-d} ${t+n-l*2/3} ${s-a} ${t+n-l} ${s-a} C ${t+n-l-l/3} ${s-a} ${t+n/2+l/3} ${s-d} ${t+n/2} ${s} C ${t+n/2-l/3} ${s+d} ${t+n/2-l*2/3} ${s+a} ${t+l} ${s+a} C ${t+l-l/3} ${s+a} ${t+l/3} ${s+d} ${t} ${s} Z`}case"note":{let a=Math.min(n,o)*ab;return`M ${t} ${r} L ${t+n-a} ${r} L ${t+n} ${r+a} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+n} ${r+a} L ${t+n-a} ${r+a} L ${t+n-a} ${r}`}case"cloud":return yd(t,r,n,o);case"cylinder":return xd(t,r,n,o);case"person":return Rd(t,r,n,o);case"predefined_process":{let a=Math.min(n,o)*sb;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+a} ${r} L ${t+a} ${r+o} M ${t+n-a} ${r} L ${t+n-a} ${r+o}`}default:return null}}function ne(e){let t=wd(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...Gt(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function vd(e){return ne(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function st(e){let t=e.shape.shapeType==="pill"?kd(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{...Gt(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function $o(e){return[{...Gt(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function Pd(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return st(e);let t=p(e.shape.symbol.tension,0),r=e.shape.symbol.points.map(([n,o])=>({x:e.x+n*e.width,y:e.y+o*e.height}));return[{...Gt(e),type:"path",d:se({points:r,tension:t,closed:!0}),rotationCenter:e.rotationCenter,detail:{of:"symbolGeometry",points:e.shape.symbol.points,tension:t,declaredBounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}]}var lb={cloud:ne,cylinder:ne,diamond:ne,document:ne,hexagon:ne,note:ne,oval:$o,circle:$o,parallelogram:ne,person:vd,pill:st,predefined_process:ne,rectangle:st,rounded_rectangle:st,symbol:Pd,trapezoid:ne,triangle:ne};function Dt(e){return(lb[e.shape.shapeType]??st)(e)}var db={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},W={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},Ld={rectangle:W,rounded_rectangle:{...W,cornerRadius:8},triangle:{...W,rotation:0},diamond:{...W,rotation:0},hexagon:{...W,rotation:0},oval:{...W,rotation:0},circle:{...W,rotation:0},document:{...W,rotation:0},parallelogram:{...W,rotation:0},trapezoid:{...W,rotation:0},cylinder:{...W,rotation:0},note:{...W,rotation:0},cloud:{...W,rotation:0},predefined_process:{...W,rotation:0},pill:W,person:{...W,rotation:0},symbol:{...W,rotation:0}};function Mo(e,t){let r=Ld[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${db[e.shapeType]??""}, falling back to rectangle defaults.`}),Ld.rectangle)}function cb(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function Td(e,t){let r=Mo(e,t),n=p(e.strokeWidth,r.strokeWidth),o=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=p(o?.angle,45)*Math.PI/180;return{fill:R(e.fillColor,t,e.id),stroke:R(e.strokeColor,t,e.id),strokeWidth:n,dash:cb(e,n),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:p(e.opacity,r.opacity),shadow:o?.enabled?{color:o.color??"#000000",opacity:p(o.opacity,.25),blur:p(o.blur,10),dx:Math.cos(i)*p(o.distance,5),dy:Math.sin(i)*p(o.distance,5)}:void 0}}var Ao=/\*\*([^*]+)\*\*/g;function $d(e){return/\*\*[^*]+\*\*/.test(e)}function ub(e){let t=[],r=0;Ao.lastIndex=0;let n;for(;n=Ao.exec(e);)n.index>r&&t.push({text:e.slice(r,n.index),bold:!1}),n[1]&&t.push({text:n[1],bold:!0}),r=Ao.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function mb(e){return e.split(`
|
|
13
|
+
`).map(ub)}function pb(e){let t=[];for(let r of e)for(let n of r.text.split(/\s+/))n&&t.push({text:n,bold:r.bold});return t}function fb(e,t,r,n){let o=pb(e);if(!o.length)return[[]];let i=[],a=[],s=0;for(let l of o){let d=r(l.text,l.bold),c=a.length?n+d:d;a.length&&s+c>t?(i.push(a),a=[l],s=d):(a.push(l),s+=c)}return i.push(a),i}function Md(e,t,r,n){return mb(e).flatMap(o=>fb(o,Math.max(1,t),r,n))}function Ad(e,t,r){let{shape:n,bounds:o,order:i,rotation:a,rotationCenter:s,x:l,y:d,width:c,height:u}=e;if(!n.text)return null;let m=p(n.fontSize,Mo(n,[]).fontSize),f=n.isText?0:Math.max(8,t*2),g=n.shapeType==="person"?Cd(l,d,c,u):{x:l,y:d,width:c,height:u},b=Math.max(0,g.width-f*2),y=n.fontFamily||N,S=r?.(y,m),v={type:"text",id:`shape-text-${n.id}`,order:i+.5,bounds:o,x:g.x+f,y:g.y+f,width:b,height:Math.max(0,g.height-f*2),lines:fe(n.text,b,m,S),fontFamily:y,fontSize:m,fontWeight:n.fontWeight??"normal",letterSpacing:n.letterSpacing,color:n.textColor||"#111827",align:n.textAlign??"center",verticalAlign:n.textVerticalAlign??"middle",lineHeight:p(n.lineHeight,1.3),rotation:a,rotationCenter:s};if($d(n.text)){let{measure:$,spaceWidth:O}=S??Nl(m);v.richLines=Md(n.text,b,$,O)}return v}function hb(e,t){let r=Math.max(0,e.width-2*t),n=Math.max(0,e.height-2*t),o={...e.style,fill:{kind:"none"},strokeWidth:Math.max(1,t/3),dash:void 0,shadow:void 0},i=Dt({...e,style:o});if(r<=0||n<=0)return i;let a={...e,x:e.x+t,y:e.y+t,width:r,height:n};return i.push(...Dt({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...Dt({...a,id:`${e.id}-inner`,style:o})),i}function gb(e,t,r){let n=p(e.x,0),o=p(e.y,0),i=Math.max(0,p(e.width,100)),a=Math.max(0,p(e.height,100)),s=p(e.rotation,0),l=p(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:J({x:n,y:o,width:i,height:a},s,l+(e.hasShadow?20:2)),rotation:s,rotationCenter:{x:n+i/2,y:o+a/2},style:Td(e,r),x:n,y:o,width:i,height:a}}}function bb(e){if(!(!e.shape.shader||e.shape.shapeType!=="circle"&&e.shape.shapeType!=="oval"))return{id:`${e.id}-shader`,type:"shader-surface",order:e.order,bounds:e.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,shader:e.shape.shader,mask:"ellipse",fillColor:e.style.fill?.kind==="solid"?e.style.fill.color:void 0}}function yb(e,t,r,n){if(e.isVisible===!1)return[];let{context:o,strokeWidth:i}=gb(e,t,r),a=e.strokeStyle==="double"?hb(o,i||1):Dt(o),s=bb(o);if(s){for(let d of a)(d.type==="ellipse"||d.type==="path"||d.type==="rect")&&(d.style={...d.style,pointerEvents:"all"});a.push(s)}let l=Ad(o,i,n);return l&&a.push(l),a}function Ed(e,t,r){return e.flatMap((n,o)=>U(yb(n,o,t,r),"shape",n.id,n.shapeType,n.text||n.shapeType,n.parentFrameId??void 0))}function _t(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Y={color:"#000000",surface:"rgba(255, 255, 255, 0.28)",divider:"rgba(0, 0, 0, 0.2)",labelColor:"rgba(0, 0, 0, 0.62)",fontFamily:"'Roboto Mono', 'SFMono-Regular', Consolas, monospace",variant:"flip",motion:"roll",fontWeight:"300"};function Eo(e){return{color:e.color??Y.color,surface:e.surface??Y.surface,divider:e.divider??Y.divider,labelColor:e.labelColor??Y.labelColor,fontFamily:e.fontFamily??Y.fontFamily,variant:e.variant??Y.variant,motion:e.motion??Y.motion,fontWeight:e.fontWeight??Y.fontWeight}}function xb(e,t){let r=p(e.x,0),n=p(e.y,0),o=Math.max(0,p(e.width,160)),i=Math.max(0,p(e.height,90)),a=p(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:J({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,value:_t(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,widgetStyle:Eo(e.style)}]}function Sb(e,t){let r=p(e.x,0),n=p(e.y,0),o=Math.max(0,p(e.width,200)),i=Math.max(0,p(e.height,200)),a=p(e.rotation,0),s=p(e.max,100)||100,l=Math.min(1,Math.max(0,p(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:J({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,shader:{name:e.id,program:"tickScale",parameters:{...e.parameters,progress:l,max:s}},mask:"ellipse"}];return e.labels&&d.push(...Cb(e,{x:r,y:n,width:o,height:i,rotation:a,max:s,order:1e4+t})),d}function Cb(e,t){let r=e.labels??{},n=Math.max(1,p(Number(e.parameters.ticks),48)),o=Math.max(1,p(Number(e.parameters.major),5)),i=p(Number(e.parameters.start),225)*Math.PI/180,a=p(Number(e.parameters.sweep),270)*Math.PI/180,s=p(Number(e.parameters.radius),.9)+p(r.offset,.08),l=p(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(n/o),m=[];for(let f=0;f<=u;f+=1){let g=f*o/n,b=i-g*a,y=d+Math.cos(b)*s*(t.width/2),S=c-Math.sin(b)*s*(t.height/2),v={x:y-24,y:S-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:J(v,0,2),...v,lines:[String(Math.round(t.max*g*10)/10)],fontFamily:r.fontFamily||N,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function Rb(e,t){let r=p(e.x,0),n=p(e.y,0),o=Math.max(0,p(e.width,120)),i=Math.max(0,p(e.height,360)),a=p(e.rotation,0),s=p(e.min,0),l=p(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(p(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:J({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,shader:{name:e.id,program:"ruler",parameters:{...e.parameters,progress:d,min:s,max:l}},mask:"rect"}];return e.labels&&c.push(...kb(e,{x:r,y:n,width:o,height:i,min:s,max:l,order:1e4+t})),c}function kb(e,t){let r=e.labels??{},n=e.parameters.axis==="horizontal",o=Math.max(1,p(Number(e.parameters.ticks),50)),i=Math.max(1,p(Number(e.parameters.major),5)),a=p(Number(e.parameters.inset),.05)>0?p(Number(e.parameters.inset),.05):.05,s=p(Number(e.parameters.line),.7)>0?p(Number(e.parameters.line),.7):.7,l=n?t.height:t.width,d=(p(Number(e.parameters.length),.1)>0?p(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-p(r.offset,.04)*l,u=p(r.size,12),m=Math.floor(o/i),f=[];for(let g=0;g<=m;g+=1){let b=g*i/o,y=a+(1-2*a)*b,S=n?{x:t.x+t.width*y-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-y)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${g}`,type:"text",order:t.order+.1,bounds:J(S,0,2),...S,lines:[String(Math.round((t.min+(t.max-t.min)*b)*10)/10)],fontFamily:r.fontFamily||N,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:n?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}function Nd(e){return e.flatMap((t,r)=>U(t.type==="tickScale"?Sb(t,r):t.type==="ruler"?Rb(t,r):xb(t,r),"widget",t.id,t.type,t.label??t.value,t.parentFrameId))}var T=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],F="#94a3b8",Ft=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],No=14;function L(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function D(e){if(!(e.step>0))return e.min===e.max?[e.min]:[e.min,e.max];let t=e.min<=e.max,r=t?e.step:-e.step,n=[];for(let o=e.min;(t?o<=e.max+1e-9:o>=e.max-1e-9)&&n.length<1e3;o+=r)n.push(Math.round(o*1e3)/1e3);return n}function Ht(e){let t=[...e.thresholds??[]].filter(r=>r>e.min&&r<e.max).sort((r,n)=>r-n);return[e.min,...t,e.max]}function Vt(e,t,r){let n=Math.max(0,t.length-1),o=r.slice(0,n).map((i,a)=>({position:t[a+1]??t[t.length-1],color:i.color??F}));return o.length?Bt(o,e):F}function oe(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var ie={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Oo(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function Bo(e,t,r){let n=r?ie.padX:0,o=r?ie.padY:0,i=t*ie.lineHeight;return{width:e.length*t*ie.charWidth+n*2,height:i+o*2,lineHeight:i,padX:n,padY:o}}function Io(e,t,r,n){let o=n/2;return`M ${e+o} ${t} H ${e+r-o} A ${o} ${o} 0 0 1 ${e+r-o} ${t+n} H ${e+o} A ${o} ${o} 0 0 1 ${e+o} ${t} Z`}function Wt(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t+i} Q ${e} ${t} ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+n} H ${e} Z`}function he(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+n-i} Q ${e+r} ${t+n} ${e+r-i} ${t+n} H ${e+i} Q ${e} ${t+n} ${e} ${t+n-i} V ${t+i} Q ${e} ${t} ${e+i} ${t} Z`}function zt(e,t,r,n,o,i){return i?he(e,t,r,n,o):Wt(e,t,r,n,o)}function Go(e,t){if(e.length===1)return e[0];let r=(e.length-1)*t,n=Math.floor(r),o=Math.ceil(r);return n===o?e[n]:e[n]+(r-n)*(e[o]-e[n])}function Do(e){if(!e?.length)return null;let t=[...e].sort((r,n)=>r-n);return{min:t[0],q1:Go(t,.25),median:Go(t,.5),q3:Go(t,.75),max:t[t.length-1]}}function Yt(e){if(e?.[0]!=="#")return;let t=e.length===4?e.slice(1).split("").map(i=>parseInt(i+i,16)):[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)),[r,n,o]=t;return[r,n,o].some(i=>Number.isNaN(i))?void 0:[r,n,o]}function _o(e,t){let r=Yt(e),n=Math.max(0,Math.min(1,t));if(!r)return n<=0?"transparent":e??"transparent";let[o,i,a]=r;return`rgba(${o}, ${i}, ${a}, ${n})`}function Fo(e,t,r){let n=o=>Math.round(Math.max(0,Math.min(255,o))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(r)}`}function zr(e,t,r){let n=e/255,o=t/255,i=r/255,a=Math.max(n,o,i),s=Math.min(n,o,i),l=(a+s)/2,d=a-s;if(d===0)return[0,0,l];let c=d/(1-Math.abs(2*l-1)),u;return a===n?u=(o-i)/d%6:a===o?u=(i-n)/d+2:u=(n-o)/d+4,u*=60,u<0&&(u+=360),[u,c,l]}function Ho(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=n*(1-Math.abs(e/60%2-1)),i=r-n/2,[a,s,l]=[0,0,0];return e<60?[a,s,l]=[n,o,0]:e<120?[a,s,l]=[o,n,0]:e<180?[a,s,l]=[0,n,o]:e<240?[a,s,l]=[0,o,n]:e<300?[a,s,l]=[o,0,n]:[a,s,l]=[n,0,o],[(a+i)*255,(s+i)*255,(l+i)*255]}function Od(e,t,r){let n=o=>{let i=o/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*n(e)+.7152*n(t)+.0722*n(r)}function wb(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}var Wr=.35,Bd=.08,Id=.22,Gd=.78,Dd=.92,vb=3;function q(e){let t=Yt(e);if(!t)return"#0f172a";let[r,n,o]=t,i=(.299*r+.587*n+.114*o)/255>.6?"#0f172a":"#ffffff",[a,s,l]=zr(r,n,o);if(s===0)return i;let d=l>.5?Math.max(Bd,Math.min(l-Wr,Id)):Math.min(Dd,Math.max(l+Wr,Gd)),c=Ho(a,s,d);return wb(Od(r,n,o),Od(...c))>=vb?Fo(...c):i}function lt(e,t){let r=Yt(e);if(!r)return t;let[n,o,i]=r,[a,s,l]=zr(n,o,i);if(s===0)return t;let d=l>.5?Math.max(Bd,Math.min(l-Wr,Id)):Math.min(Dd,Math.max(l+Wr,Gd));return Fo(...Ho(a,s,d))}function Yr(e){let t=Yt(e);return t?zr(...t)[2]>.5:!1}function Pe(e,t){let r=Yt(e);if(!r)return;let[n,o]=zr(...r);if(o!==0)return Fo(...Ho(n,o,t))}function E(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function jt(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Ut(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:Pb(e.geometry),detail:{of:"chartValue",series:e.valueReference.seriesId,valueIndex:e.valueReference.valueIndex},style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.color},strokeWidth:1}}}function Pb(e){let{centerX:t,startY:r,endY:n}=e,o=t-5,i=t+5;return`M ${t} ${r} L ${t} ${n} M ${o} ${r} L ${i} ${r} M ${o} ${n} L ${i} ${n}`}function le(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var Ur=18,jr=e=>e.config;function K(e){return e.chartType==="bar"&&jr(e)?.orientation==="horizontal"}function dt(e,t){let r=oe({series:e.series,config:jr(e)}),n=t.height/r,o=Math.min(Math.max(0,p(jr(e)?.barGroupGap,8)),Math.max(0,n-1)),i=e.categoryAlign==="left"?Ur:0,a=Math.max(1,n-o-i),s=p(jr(e)?.barThickness,0),l=s>0?Math.min(a,s):a;return{count:r,slotHeight:n,groupGap:o,labelRow:i,barsHeight:l,offset:(a-l)/2}}function ct(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function ut(e,t){return t>0?se({points:e,tension:t,closed:!1}):`M ${e.map((n,o)=>`${o?"L":""} ${n.x} ${n.y}`).join(" ")}`}function Xr(e,t,r,n){let o=Math.max(1,Math.min(e,t)/2-4),i=Math.max(0,Math.min(r??0,o-1)),a=Math.max(0,Math.min(n??0,o/2)),s=Math.max(1,o-a),l=i>0?Math.min(i+a,s-1):0;return{outerRadius:s,innerRadius:l,cornerRadius:a}}function H(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function Xt(e,t,r,n){let o=t.x-e.x,i=t.y-e.y,a=0,s=1;if(Math.abs(o)>1e-6){let d=(t.x-r-e.x)/o,c=(t.x+r-e.x)/o;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}if(Math.abs(i)>1e-6){let d=(t.y-n-e.y)/i,c=(t.y+n-e.y)/i;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}let l=a<=s?a:1;return{x:e.x+l*o,y:e.y+l*i}}function pt(e,t){return Math.abs(t-e)>Math.PI?1:0}function Oe(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function _d(e,t){return{start:e.start+t,end:e.end-t}}function Be(e,t,r){if(e<=0)return 0;let n=Math.min(Math.abs(t)/2,Math.PI/2),o=Math.sin(n);return o<=1e-6?r:Math.min(e/o,r)}function Lb(e,t,r){let n=H(e,t.start,e.outerRadius),o=H(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${pt(t.start,t.end)} 1 ${o.x} ${o.y}`,"Z"].join(" ")}function Tb(e,t,r,n){let o=H(e,r.start,e.outerRadius),i=H(e,r.end,e.outerRadius),a=H(e,n.end,t),s=H(e,n.start,t);return[`M ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${pt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${pt(n.start,n.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Fd=.82;function mt(e,t,r,n,o,i){let a=Math.min(1,o/r),s=n+i*Math.asin(a),l=Math.sqrt(Math.max(0,r*r-o*o));return{lineTangent:{x:e.centerX+l*Math.cos(n),y:e.centerY+l*Math.sin(n)},arcTangent:H(e,s,t),angle:s}}function qt(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Fd),i=e*o,a=t>0?t*o:Number.POSITIVE_INFINITY,s=t>0?(e-t)/2:e/2;return Math.max(0,Math.min(i,a,s))}function Kt(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Fd),i=e*o,a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function $b(e,t,r,n){let{outerRadius:o}=e,i=o-r,a=mt(e,o,i,t.start,r,1),s=mt(e,o,i,t.end,r,-1);return[`M ${n.x} ${n.y}`,`L ${a.lineTangent.x} ${a.lineTangent.y}`,`A ${r} ${r} 0 0 1 ${a.arcTangent.x} ${a.arcTangent.y}`,`A ${o} ${o} 0 ${pt(a.angle,s.angle)} 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${r} ${r} 0 0 1 ${s.lineTangent.x} ${s.lineTangent.y}`,"Z"].join(" ")}function Mb(e,t,r,n,o){let{outerRadius:i}=e,a=i-o,s=mt(e,i,a,r.start,o,1),l=mt(e,i,a,r.end,o,-1),d=t+o,c=mt(e,t,d,n.start,o,1),u=mt(e,t,d,n.end,o,-1);return[`M ${s.lineTangent.x} ${s.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${i} ${i} 0 ${pt(s.angle,l.angle)} 1 ${l.arcTangent.x} ${l.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${l.lineTangent.x} ${l.lineTangent.y}`,`L ${u.lineTangent.x} ${u.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${u.arcTangent.x} ${u.arcTangent.y}`,`A ${t} ${t} 0 ${pt(u.angle,c.angle)} 0 ${c.arcTangent.x} ${c.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${c.lineTangent.x} ${c.lineTangent.y}`,"Z"].join(" ")}function ft(e,t,r){let n=Math.max(0,r)/2,o=Be(n,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=o}function Ie(e,t,r=0,n=0){let o=Math.max(0,n)/2,i=_d(t,Oe(o,e.outerRadius));if(!ft(e,t,n)){let s=Be(o,t.end-t.start,e.outerRadius),l=H(e,(t.start+t.end)/2,s);return r>0?$b(e,i,r,l):Lb(e,i,l)}let a=_d(t,Oe(o,e.innerRadius));return r>0?Mb(e,e.innerRadius,i,a,r):Tb(e,e.innerRadius,i,a)}function ke(e,t,r,n,o,i,a){let s=t==="horizontal",l=s?e.width:e.height,d=Math.max(1,(l-n*(r-1))/r),c=Math.min(r,Math.max(0,i*r)),u=a?Math.round(c):c,m=[];for(let f=0;f<r;f++){let g=Math.min(1,Math.max(0,u-f))*d;if(g<.5)continue;let b=f*(d+n);m.push(s?he(e.x+b,e.y,g,e.height,o):he(e.x,e.y+e.height-b-g,e.width,g,o))}return m.join(" ")}function A(e){if(!e?.enabled)return;let t=p(e.angle,45)*Math.PI/180,r=p(e.distance,5);return{color:e.color??"#000000",opacity:p(e.opacity,.25),blur:p(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function Zt(e,t,r,n,o){let i=e.series[n].values[r]??0;return t==="waterfall"?Ab(e,r,n,o,i):t==="percent"?Eb(e,r,n,o,i):Nb(e,r,n,o,i)}function Ab(e,t,r,n,o){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return Hd(o,i,i+o,e,n)}function Eb(e,t,r,n,o){let i=e.series.reduce((l,d)=>l+Math.abs(d.values[t]??0),0)||1,a=0;for(let l=0;l<r;l++)a+=Math.abs(e.series[l].values[t]??0);let s=Math.abs(o);return{value:o,pixelStart:a/i*n,pixelEnd:(a+s)/i*n}}function Nb(e,t,r,n,o){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return Hd(o,i,i+o,e,n)}function Hd(e,t,r,n,o){return{value:e,pixelStart:L(t,n.axisY,o),pixelEnd:L(r,n.axisY,o)}}function w(e){let{chart:t,frame:r}=e;return{type:"text",id:e.id,order:e.order,bounds:e.bounds,...r,lines:[e.text],fontFamily:(e.role==="axis"?t.axisFontFamily:void 0)??t.fontFamily??N,fontSize:Math.max(9,p(e.role==="axis"?t.axisFontSize??t.fontSize:t.fontSize,12)),fontWeight:"normal",color:(e.role==="axis"?t.axisLabelColor:e.role==="legend"?t.legendColor:void 0)??t.textColor??"#0f172a",align:e.align??"left",verticalAlign:"top",lineHeight:1.2,rotation:e.rotation,rotationCenter:e.rotation?{x:r.x,y:r.y}:void 0}}var Ob=/^[A-Za-z_][A-Za-z0-9_]*$/;function ht(e,t,r){return Ob.test(t)?`${e}[${t}].${r}`:void 0}var Vd="text";function Vo(e){return`Axis[${e}].label`}function qr(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function ge(e){return ht("Series",e,"label")}function Wd(e){return ht("Series",e,"color")}function Z(e,t){return Number.isInteger(t)&&t>=0?ht("Series",e,`values[${t}]`):void 0}function gt(e,t){return Number.isInteger(t)&&t>=0?ht("Series",e,`colors[${t}]`):void 0}function zd(e){return ht("Rule",e,"text")}function Yd(e){return ht("Rule",e,"at")}function Bb(e,t,r){return e.axisX.label?{...w({role:"axis",id:`chart-x-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:t.plot.x,y:e.y+e.height-18,width:t.plot.width,height:18},text:e.axisX.label,chart:e,align:"center"}),prop:Vo("x")}:null}function Ib(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...w({role:"axis",id:`chart-y-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:e.x+12,y:t.plot.y+t.plot.height,width:t.plot.height,height:18},text:e.axisY.label,chart:e,align:"center",rotation:-90}),prop:Vo("y")}}function jd(e,t,r){let n=[],o=Bb(e,t,r);o&&n.push(o);let i=Ib(e,t,r+n.length);return i&&n.push(i),n}function Ud(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.height/n;return e.series.map((i,a)=>{let s=t.plot.y+(a+.5)*o;return{...w({role:"axis",id:`chart-y-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:e.x,y:s-9,width:t.padLeft-8,height:18},text:i.label||i.id,chart:e,align:"right"}),prop:ge(i.id)}})}var Gb=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Xd(e){return Db(e.chart)?Wb(e).flatMap(t=>zb(e,t)):[]}function Db(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Gb.has(e.chartType)&&!t}function Wo(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var zo=22,Kr=16;function Yo(e){return e==="bottomLeft"||e==="bottomRight"}function jo(e){return Wo(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function qd(e){let t=jo(e);return t.length?Math.max(...t):0}function _b(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Fb(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function Hb(e){let{chart:t,plot:r,order:n}=e,o=Wo(t),i=jo(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-Kr-a:r.x+r.width+Kr,l=r.y+r.height-15;return o.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(o.length-1-c)*zo,width:i[c],order:n+(o.length-1-c)*2}))}function Vb(e){let{chart:t,plot:r,order:n}=e,o=Wo(t),i=jo(t),a=i.reduce((d,c)=>d+c,0),s=Fb(t,r),l=_b(t,r,a);return o.map((d,c)=>{let u=i[c],m=l;return l+=u,{series:d,seriesIndex:c,x:m,y:s,width:u,order:n+(o.length-1-c)*2}})}function Wb(e){return Yo(e.chart.legendPosition)?Hb(e):Vb(e)}function zb(e,t){return[Yb(e,t),jb(e,t)]}function Yb(e,t){let{chart:r,bounds:n,diagnostics:o}=e,i=T[t.seriesIndex%T.length],a=r.chartType==="line",s=a?E(t.series.color,i):t.series.color??i;return{type:"rect",id:`chart-legend-swatch-${r.id}-${t.series.id}`,order:t.order,bounds:n,x:t.x,y:t.y,width:10,height:10,rx:3,prop:Wd(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:R(s,o,r.id)}}}function jb(e,t){let{chart:r,bounds:n}=e;return{...w({role:"legend",id:`chart-legend-${r.id}-${t.series.id}`,order:t.order+1,bounds:n,frame:{x:t.x+15,y:t.y-3,width:t.width-15,height:18},text:t.series.label,chart:r}),prop:ge(t.series.id)}}var Zd=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),Ub=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Ge(e){return!Ub.has(e.chartType)}function Le(e){return Ge(e)?Math.max(0,p(e.tickLength,0)):0}function Xb(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function qb(e){let t=p(e.fontSize,12);return Math.max(0,...e.series.map(n=>(n.label||n.id).length))*t*.58+16}var Kd=66;function Kb(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Zb(e){let t=p(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(n=>n.length))*t*.58+16}function Qb(e){return Xb(e)?qb(e):K(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Zb(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function Qd(e){let t=e.showAxisLabels!==!1,r=e.showLegend!==!1,n=e.legendPosition??"top",o=n==="top",i=r&&e.series.length>0,a=i&&Yo(n),s=a?qd(e)+Kr:0,l=Kb(e,r),d=Le(e),c=d+(t?Qb(e):12)+(n==="bottomLeft"?s:0)+(l==="left"?Kd:0),u=24+(n==="bottomRight"?s:0)+(l==="right"?Kd:0),m=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",f=K(e)&&e.showValueAxis!==!1,g=t?K(e)?f?34:12:(e.axisX.label?52:34)+(m?18:0):12,b=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,y=i&&!o&&!a,S=d+g+(b?44:0)+(y?16+zo:0),$=(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(o&&i?44:24);return{bounds:X({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+c,y:e.y+$,width:Math.max(1,e.width-c-u),height:Math.max(1,e.height-$-S)},showLabels:t,showLegend:r,padLeft:c}}function Jb(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,n)=>String(n+1))}function Jd(e,t,r){let n=oe(e),o=t.plot.width/n,i=Jb(e,n),a=!!e.config?.categories?.length,s=e.categoryAlign==="left",l=s?Math.min(Math.max(0,p(e.config?.barGroupGap,8)),Math.max(0,o-1)):0;return Array.from({length:n},(d,c)=>{let u=t.plot.x+(c+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+c,bounds:t.bounds,frame:{x:s?t.plot.x+c*o+l/2:u-o/2,y:t.plot.y+t.plot.height+4+Le(e),width:s?o-l:o,height:18},text:i[c]??String(c+1),chart:e,align:s?"left":"center"}),prop:a?qr(c):void 0}})}function ec(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.width/n;return e.series.map((i,a)=>{let s=t.plot.x+(a+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:s-o/2,y:t.plot.y+t.plot.height+4+Le(e),width:o,height:18},text:i.label||i.id,chart:e,align:"center"}),prop:ge(i.id)}})}function tc(e,t,r){return D(e.axisX).map((n,o)=>{let i=t.plot.x+L(n,e.axisX,t.plot.width);return w({role:"axis",id:`chart-x-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:i-20,y:t.plot.y+t.plot.height+10+Le(e),width:40,height:18},text:String(n),chart:e,align:"center"})})}function rc(e,t,r){return D(e.axisY).map((n,o)=>{let i=t.plot.y+t.plot.height-L(n,e.axisY,t.plot.height);return w({role:"axis",id:`chart-y-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:e.x,y:i-6,width:t.padLeft-14-Le(e),height:18},text:String(n),chart:e,align:"right"})})}function Uo(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function ey(e,t,r){return e.chartType==="bar"?Jd(e,t,r):e.chartType==="boxplot"&&!Uo(e)?ec(e,t,r):tc(e,t,r)}function ty(e,t,r){return Uo(e)?Ud(e,t,r):e.showValueAxis===!1?[]:rc(e,t,r)}function ry(e,t){let{plot:r}=t;if(e.chartType==="bar"){let n=oe(e);return Array.from({length:n},(o,i)=>r.x+(i+.5)*r.width/n)}return D(e.axisX).map(n=>r.x+L(n,e.axisX,r.width))}function ny(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function oy(e,t,r){let n=p(e.axisLineWidth,0),o=p(e.tickLength,0);if(n<=0&&o<=0)return[];let{plot:i,bounds:a}=t,s=i.y+i.height,l={fill:{kind:"none"},stroke:{kind:"solid",color:e.axisLineColor??e.gridColor??"#94a3b8"},strokeWidth:n>0?n:1,pointerEvents:"none",...ny(e,n>0?n:1)},d=[],c=(u,m)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:m,style:l});if(n>0&&(e.showValueAxis!==!1&&c("line-y",`M ${i.x} ${i.y} L ${i.x} ${s}`),c("line-x",`M ${i.x} ${s} L ${i.x+i.width} ${s}`)),o>0&&K(e)){D(e.axisY).forEach(m=>{let f=i.x+L(m,e.axisY,i.width);c(`tick-v-${m}`,`M ${f} ${s} L ${f} ${s+o}`)});let u=dt(e,i);for(let m=0;m<u.count;m++){let f=ct(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-o} ${f} L ${i.x} ${f}`)}}return o>0&&!Uo(e)&&!K(e)&&(D(e.axisY).forEach(u=>{let m=s-L(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-o} ${m} L ${i.x} ${m}`)}),ry(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+o}`)})),d}function iy(e,t){let r=e.config?.categories;return Array.from({length:t},(n,o)=>r?.[o]??String(o+1))}function ay(e,t,r){let{plot:n,bounds:o}=t,i=dt(e,n),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=iy(e,i.count).map((c,u)=>{let m=ct(i,n,u);return{...w({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:o,frame:a?{x:n.x,y:m,width:n.width,height:i.labelRow}:s?{x:n.x+14,y:m+i.barsHeight/2-9,width:n.width-28,height:18}:{x:e.x+8,y:m+i.barsHeight/2-9,width:n.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?qr(u):void 0}});return e.showValueAxis!==!1&&D(e.axisY).forEach((c,u)=>{let m=n.x+L(c,e.axisY,n.width);d.push(w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:o,frame:{x:m-20,y:n.y+n.height+4+p(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function nc(e,t,r){if(!Ge(e))return[];let n=oy(e,t,r);if(!t.showLabels)return n;if(r+=n.length,K(e))return[...n,...ay(e,t,r)];let o=ey(e,t,r),i=ty(e,t,r+o.length),a=jd(e,t,r+o.length+i.length);return[...n,...o,...i,...a]}function oc(e,t,r,n){let o=0,i=0;for(let a of e){let s=a.x-t,l=a.y-r,d=s*s+l*l;if(d===0)return a.value;let c=1/d**(n/2);o+=c*a.value,i+=c}return i===0?0:o/i}var Xo=32;function Qt(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function ic(e,t,r,n){let o=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(Xo,Math.round(Math.sqrt(Xo*Xo*o)))),a=Math.max(2,Math.round(i/o)),s=new Float32Array(i*a);for(let l=0;l<a;l++){let d=r*(l/(a-1));for(let c=0;c<i;c++){let u=t*(c/(i-1));s[l*i+c]=e.length?oc(e,u,d,n):0}}return{grid:s,cols:i,rows:a}}var ac=new Set(["scatter","custom","hexbin"]);var sc=-Math.PI/2,sy=.5,ly=6;function dy(e){return Math.max(38,e*3.2)}function Zr(e,t,r,n=!0){let o=n?dy(r):ly;return Math.max(8,Math.min(e,t)/2-o)}function Qr(e,t){return Math.max(3,e||t)}function cy(e,t){return sc+t*Math.PI*2/e}function qo(e,t,r){let n=t===e?0:(r-e)/(t-e);return sc+n*Math.PI*2}function lc(e,t,r){let n=cy(e.count,t);return{x:e.centerX+Math.cos(n)*r,y:e.centerY+Math.sin(n)*r}}function dc(e,t){let r=e.max-e.min;return(r===0?0:Math.max(0,Math.min(1,(t-e.min)/r)))*e.radius}function Jr(e,t){return e.length===0?"":t?se({points:e,tension:sy,closed:!0}):`M ${e.map((n,o)=>`${o?"L ":""}${n.x} ${n.y}`).join(" ")} Z`}function en(e,t,r,n,o,i,a,s){let l=Math.max(1,a*1.5),d={fill:{kind:"solid",color:e.gridColor??"#e2e8f0"},clip:s};if(e.gridRoundedCorners===!0)return{type:"ellipse",id:t,order:r,bounds:n,cx:o,cy:i,rx:l,ry:l,style:d};let c=l*2;return{type:"rect",id:t,order:r,bounds:n,x:o-l,y:i-l,width:c,height:c,style:d}}function Jt(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function cc(e,t,r,n){let o=t.x+t.width/2,i=t.y+t.height/2,a=Math.max(0,Math.min(t.width,t.height)/2),s=p(e.gridWidth,1);if(e.gridLineStyle==="dotted")return uy(e,r,n,o,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...Jt(e,s)},d=[];return D(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*uc(e,c);d.push({type:"ellipse",id:`chart-grid-ring-${e.id}-${c}`,order:n+d.length,bounds:r,cx:o,cy:i,rx:u,ry:u,style:l})}),D(e.axisX).forEach(c=>{let u=qo(e.axisX.min,e.axisX.max,c),m=o+Math.cos(u)*a,f=i+Math.sin(u)*a;d.push({type:"path",id:`chart-grid-spoke-${e.id}-${c}`,order:n+d.length,bounds:r,d:`M ${o} ${i} L ${m} ${f}`,style:l})}),d}function uy(e,t,r,n,o,i,a){let s=D(e.axisY).filter(c=>c>e.axisY.min),l=D(e.axisX),d=[];return s.forEach(c=>{let u=i*uc(e,c);l.forEach(m=>{let f=qo(e.axisX.min,e.axisX.max,m),g=n+Math.cos(f)*u,b=o+Math.sin(f)*u,y=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(en(e,y,r+d.length,t,g,b,a,void 0))})}),d}function uc(e,t){let r=e.axisY.max-e.axisY.min;return r===0?0:Math.max(0,Math.min(1,(t-e.axisY.min)/r))}function tn(e,t,r,n){if(e.showGrid===!1||!Ge(e))return[];if(e.gridShape==="circle"&&ac.has(e.chartType))return cc(e,t,r,n);let o=p(e.gridWidth,1);if(K(e))return my(e,t,r,n,o);let i=e.chartType==="field"?Qt(e,t):void 0;if(e.gridLineStyle==="dotted")return py(e,t,r,n,o,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...Jt(e,o),clip:i},s=[];return(e.gridAxes==="y"?[]:D(e.axisX)).forEach(l=>{let d=t.x+L(l,e.axisX,t.width);s.push({type:"path",id:`chart-grid-x-${e.id}-${l}`,order:n+s.length,bounds:r,d:`M ${d} ${t.y} L ${d} ${t.y+t.height}`,style:a})}),(e.gridAxes==="x"?[]:D(e.axisY)).forEach(l=>{let d=t.y+t.height-L(l,e.axisY,t.height);s.push({type:"path",id:`chart-grid-y-${e.id}-${l}`,order:n+s.length,bounds:r,d:`M ${t.x} ${d} L ${t.x+t.width} ${d}`,style:a})}),s}function my(e,t,r,n,o){if(e.gridAxes==="y")return[];let i={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...e.gridLineStyle==="dotted"?{dash:[.1,o*3],lineCap:"round"}:Jt(e,o)};return D(e.axisY).map((a,s)=>{let l=t.x+L(a,e.axisY,t.width);return{type:"path",id:`chart-grid-x-${e.id}-${a}`,order:n+s,bounds:r,d:`M ${l} ${t.y} L ${l} ${t.y+t.height}`,style:i}})}function py(e,t,r,n,o,i){let a=D(e.axisX),s=D(e.axisY),l=[];return a.forEach(d=>{let c=t.x+L(d,e.axisX,t.width);s.forEach(u=>{let m=t.y+t.height-L(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push(en(e,f,n+l.length,r,c,m,o,i))})}),l}function mc(e){return e.chart.rules?.length?fy(e).flatMap(t=>hy(e,t)):[]}function fy(e){let t=e.order;return(e.chart.rules??[]).map(r=>{let n=t++,o=r.text?t++:void 0;return{rule:r,color:r.color||e.chart.strokeColor||"#475569",y:e.plot.y+e.plot.height-L(r.at,e.chart.axisY,e.plot.height),lineOrder:n,labelOrder:o}})}function hy(e,t){let r=[gy(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(by(e,t)),r}function gy(e,t){return{type:"path",id:`chart-rule-${e.chart.id}-${t.rule.id}`,order:t.lineOrder,bounds:e.bounds,d:`M ${e.plot.x} ${t.y} L ${e.plot.x+e.plot.width} ${t.y}`,prop:Yd(t.rule.id),propKind:"value",style:{fill:{kind:"none"},stroke:{kind:"solid",color:t.color},strokeWidth:t.rule.strokeWidth??1,dash:t.rule.dash}}}function by(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...w({id:`chart-rule-label-${e.chart.id}-${t.rule.id}`,order:t.labelOrder??t.lineOrder+1,bounds:e.bounds,frame:{x:e.plot.x+4,y:t.y-r-2,width:160,height:r+2},text:t.rule.text??"",chart:e.chart}),color:t.color,prop:zd(t.rule.id)}}function Ko(e){let t=p(e.strokeWidth,1)/2;return{x:e.x+t,y:e.y+t,width:Math.max(1,e.width-t*2),height:Math.max(1,e.height-t*2),rx:Math.max(0,p(e.cornerRadius,12)-t)}}function pc(e,t,r){if(!e.fillImage)return[];let n=Ko(e),o=[{type:"image",id:`chart-image-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,href:e.fillImage.url,style:{clip:{type:"rect",...n},pointerEvents:"none"}}];return e.fillImage.overlay&&o.push({type:"rect",id:`chart-image-overlay-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,rx:n.rx,style:{fill:{kind:"solid",color:e.fillImage.overlay},pointerEvents:"none"}}),o}function bt(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=p(n.config?.barGlassBlur,0);if(a<=0||!n.fillImage)return[];let s=Ko(n),l=[{type:"image",id:`chart-bar-glass-${n.id}-${t}`,order:i(),bounds:o,x:s.x,y:s.y,width:s.width,height:s.height,href:n.fillImage.url,style:{blur:a,saturate:p(n.config?.barGlassSaturation,1),clip:{type:"path",d:r},pointerEvents:"none"}}];return n.fillImage.overlay&&l.push({type:"path",id:`chart-bar-glass-overlay-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.fillImage.overlay},pointerEvents:"none"}}),n.config?.barGlassTint&&l.push({type:"path",id:`chart-bar-glass-tint-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.config.barGlassTint},pointerEvents:"none"}}),l.push(...tn(n,e.plot,o,0).map(d=>({...d,id:`${d.id}-glass-${t}`,order:i(),style:{..."style"in d?d.style:{},clip:{type:"path",d:r},pointerEvents:"none"}}))),l}function yt(e,t,r,n,o,i=e.bounds){let{chart:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:t,order:l(),bounds:i,d:r,style:{fill:R(n,s,a.id),shadow:{color:E(n,"#ffffff"),opacity:.9,blur:o,dx:0,dy:0},pointerEvents:"none"}}}function xt(e){return e.chart.config?.showBarLabels===!0}function yy(e,t){let r=e.frame.height>=t.height+ie.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function xy(e,t,r){return e==="outside"?t.y-r-ie.gap:e==="inside"?t.y+ie.gap:t.y+t.height/2-r/2}function Sy(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config;return{type:"path",id:`${t}-pill`,order:s(),bounds:i,d:Io(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?R(l.barLabelPillColor,a,o.id):{kind:"none"},stroke:R(l?.barLabelBorderColor??n,a,o.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function Cy(e,t,r,n,o,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...w({id:t,order:d(),bounds:l,frame:{x:r.left,y:r.top+r.padY,width:r.width,height:r.lineHeight},text:n,chart:s,align:"center"}),mark:`bar-label|${o}|${c?.barLabelFormat??""}`,color:a,fontSize:i,fontFamily:c?.barLabelFontFamily??s.fontFamily??"Inter, sans-serif",fontWeight:c?.barLabelFontWeight??"normal"}}function Ry(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config,d=i.y+i.height+4+16+Math.max(0,o.tickLength??0);return{...w({id:t.id,order:s(),bounds:a,frame:t.horizontal?o.categoryAlign==="inside"?{x:i.x,y:t.frame.y+t.frame.height/2-n*.6,width:i.width-14,height:n*1.2}:{x:i.x,y:t.frame.y-Ur,width:i.width,height:n*1.2}:{x:t.frame.x,y:d,width:t.frame.width,height:n*1.2},text:r,chart:o,align:t.horizontal?"right":o.categoryAlign==="left"?"left":"center"}),mark:`bar-label|axis|${l?.barLabelFormat??""}`,color:l?.barLabelColor??o.textColor??"#0f172a",fontSize:n,fontFamily:l?.barLabelFontFamily??o.fontFamily??"Inter, sans-serif",fontWeight:l?.barLabelFontWeight??"normal"}}function ky(e,t){let r=e.placement==="axis"?"outside":e.placement,n=e.frame.width>=t.width+ie.gap*2;return r!=="outside"&&!n?"outside":r}function wy(e,t,r){let{frame:n}=e,o=r==="outside"?n.x+n.width+ie.gap:r==="inside"?n.x+n.width-t.width-ie.gap:n.x+n.width/2-t.width/2;return{...t,left:o,top:n.y+n.height/2-t.height/2}}function St(e,t){let{chart:r}=e,n=r.config,o=Math.max(8,p(n?.barLabelFontSize,p(r.fontSize,12))),i=Oo(t.value,n?.barLabelFormat);if(t.placement==="axis")return[Ry(e,t,i,o)];let a=n?.barLabelPill===!0,s=Bo(i,o,a),l=t.horizontal?ky(t,s):yy(t,s),d=t.horizontal?wy(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:xy(l,t.frame,s.height)},c=n?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(Sy(e,t.id,d,c)),u.push(Cy(e,t.id,d,i,l,o,c)),u}var Zo={angle:45,spacing:7,width:1.5},vy=2;function Py(e,t,r,n,o,i){let a=o*Math.PI/180,s={x:Math.cos(a),y:Math.sin(a)},l={x:-s.y,y:s.x},d={x:e+r/2,y:t+n/2},c=Math.hypot(r,n)/2,u=[];for(let m=-c;m<=c;m+=i){let f=d.x+l.x*m,g=d.y+l.y*m;u.push(`M ${f-s.x*c} ${g-s.y*c} L ${f+s.x*c} ${g+s.y*c}`)}return u.join(" ")}function Ct(e,t){if(De(e))return{type:"path",d:he(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function De(e){return e.chart.config?.barTrack===!0}function Rt(e,t,r,n="vertical"){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config,d=l?.barCornerRadius??2,c=p(l?.barSegments,0),u=c>0?ke(r,n,c,p(l?.barSegmentGap,4),d,1,!0):he(r.x,r.y,r.width,r.height,d),m=[{type:"path",id:`chart-bar-track-${o.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:R(l?.barTrackColor??o.gridColor??"#e2e8f0",a,o.id),pointerEvents:"none"}}];return l?.barTrackHatch&&m.push({type:"path",id:`chart-bar-track-hatch-${o.id}-${t}`,order:s(),bounds:i,d:Py(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,Zo.angle),Math.max(vy,p(l.barTrackHatchSpacing,Zo.spacing))),style:{fill:{kind:"none"},stroke:R(l.barTrackHatchColor??o.gridColor??"#cbd5e1",a,o.id),strokeWidth:p(l.barTrackHatchWidth,Zo.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function fc(e){let t=My(e),r=e.chart.series.flatMap((a,s)=>Ay(e,t,a,s)),n=De(e)?r.flatMap(a=>Rt(e,`${a.seriesId}-${a.valueIndex}`,{x:a.frame.x,y:e.plot.y,width:a.frame.width,height:e.plot.height})):[],o=r.flatMap(a=>Ey(e,a)),i=xt(e)?r.flatMap(a=>Ty(e,a,r)):[];return[...n,...o,...r.flatMap(a=>$y(e,a)),...i]}function Ly(e,t){let r=t.filter(n=>n.seriesId===e.seriesId).map(n=>n.value);return e.value>=Math.max(...r)}function Ty(e,t,r){let{chart:n}=e;return n.config?.barLabelMaxOnly&&!Ly(t,r)?[]:St(e,{id:`chart-bar-label-${n.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:n.config?.barLabelPosition??"outside"})}function hc(e,t){let{chart:r,plot:n}=e,o=r.config,i=o?.barCornerRadius??2,a=p(o?.barSegments,0);return a>0?ke({x:t.x,y:n.y,width:t.width,height:n.height},"vertical",a,p(o?.barSegmentGap,4),i,t.height/n.height,o?.barSegmentSnap!==!1):zt(t.x,t.y,t.width,t.height,i,o?.barRoundedBottom===!0)}function $y(e,t){let{chart:r}=e,n=p(r.config?.barGlow,0);if(n<=0||t.frame.height<=0)return[];let o=hc(e,t.frame);return[yt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,o,t.color,n)]}function My(e){let{chart:t,plot:r}=e,n=oe(t),o=r.width/n,i=Math.min(Math.max(0,p(t.config?.barGroupGap,8)),Math.max(0,o-1)),a=Math.max(0,p(t.config?.barGap,2));return{slotWidth:o,seriesWidth:Math.max(1,(o-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function Ay(e,t,r,n){let{chart:o,plot:i}=e,a=r.color??T[n%T.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,L(d,o.axisY,i.height));return{seriesId:r.id,valueIndex:l,value:d,error:r.error?.[l],color:r.colors?.[l]??a,hasColorOverride:r.colors?.[l]!=null,frame:{x:i.x+l*t.slotWidth+t.groupGap/2+n*t.seriesWidth,y:i.y+i.height-c,width:Math.max(1,t.seriesWidth-t.barGap),height:c}}})}function Ey(e,t){let r=Oy(e,t),n=By(e,t);return n&&r.push(n),r}function Ny(e){let{x:t,y:r,width:n,height:o}=e;return`M ${t} ${r} H ${t+n} V ${r+o} H ${t} Z`}function Oy(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=r.config?.barCornerRadius??2,{x:l,width:d}=t.frame,c=hc(e,t.frame),u=R(t.color,i,r.id),m=R(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),g=A(r.shadowStyle),b=g?{type:"path",id:`chart-bar-shadow-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,style:{fill:u,stroke:m,strokeWidth:f,shadow:g,clip:Ct(e,{x:l,y:n.y,width:d,height:n.height})??{type:"path",d:Ny(n)}}}:void 0,y={type:"path",id:`chart-bar-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex,mark:"bar",radius:s,colorProp:gt(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:Z(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:g}},S=bt(e,`${t.seriesId}-${t.valueIndex}`,c);return b?[b,...S,y]:[...S,y]}function By(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=jt(t.value,t.error);return Ut({id:`chart-bar-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.frame.x+t.frame.width/2,startY:n.y+n.height-L(a,r.axisY,n.height),endY:n.y+n.height-L(s,r.axisY,n.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function Iy(e,t,r,n,o){let{chart:i,plot:a}=e,s=ct(t,a,n)+t.labelRow;if(e.stackedMode){let u=Zt(i,e.stackedMode,n,r,a.width),m=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+m,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,p(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,L(o,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function Gy(e,t){let{chart:r,plot:n}=e,o=r.config,i=e.stackedMode&&r.series.length>1?0:p(o?.barSegments,0);return i>0?ke({x:n.x,y:t.y,width:n.width,height:t.height},"horizontal",i,p(o?.barSegmentGap,4),o?.barCornerRadius??2,t.width/n.width,o?.barSegmentSnap!==!1):he(t.x,t.y,t.width,t.height,o?.barCornerRadius??2)}function Dy(e,t,r,n,o,i){let{plot:a}=e,s=Iy(e,t,n,o,i);return{id:`${r.id}-${o}`,series:r,seriesIndex:n,valueIndex:o,value:i,frame:s,trackFrame:{x:a.x,y:s.y,width:a.width,height:s.height},bounds:{minX:s.x,maxX:s.x+Math.max(s.width,1),minY:s.y,maxY:s.y+s.height},path:Gy(e,s),color:r.colors?.[o]??r.color??T[n%T.length]}}function _y(e,t){let{chart:r,diagnostics:n,nextOrder:o}=e,i=r.config,a=R(i?.barBorderColor||"#000000",n,r.id),s=p(i?.barBorderWidth,0),l=A(r.shadowStyle),d=R(t.color,n,r.id),c=[...bt(e,t.id,t.path)];return l&&c.push({type:"path",id:`chart-bar-shadow-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,style:{fill:d,stroke:a,strokeWidth:s,shadow:l,clip:Ct(e,t.trackFrame)}}),c.push({type:"path",id:`chart-bar-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,detail:{of:"chartValue",series:t.series.id,valueIndex:t.valueIndex,mark:"bar",radius:i?.barCornerRadius??2,colorProp:gt(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function Fy(e,t,r){let{chart:n}=e,o=n.config,i=xt(e)&&(!o?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===n.series.length-1;return!i||e.stackedMode&&!a&&o?.barLabelPosition==="outside"?[]:St(e,{id:`chart-bar-label-${n.id}-${t.id}`,value:t.value,frame:t.frame,placement:o?.barLabelPosition??"outside",horizontal:!0})}function Hy(e,t,r,n,o,i,a,s){let{chart:l}=e,d=Dy(e,t,n,o,i,a);De(e)&&(!e.stackedMode||o===0)&&r.tracks.push(...Rt(e,d.id,d.trackFrame,"horizontal")),r.bars.push(..._y(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(yt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...Fy(e,d,s))}function gc(e){let t=dt(e.chart,e.plot),r={tracks:[],bars:[],glows:[],labels:[]};return e.chart.series.forEach((n,o)=>{let i=n.values.map(s=>typeof s=="number"?s:s[1]),a=Math.max(...i);i.forEach((s,l)=>{Hy(e,t,r,n,o,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function Vy(e,t){let{chart:r,plot:n}=e,o=n.width/oe(r),i=Math.min(Math.max(0,p(r.config?.barGroupGap,8)),Math.max(0,o-1));return{slotWidth:o,groupGap:i,barWidth:Math.max(1,o-i),cornerRadius:r.config?.barCornerRadius??2,outerSeriesIndex:t==="waterfall"?null:r.series.length-1}}function Wy(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=a.series.length===1?p(a.config?.barSegments,0):0;return l>0?ke({x:t,y:s.y,width:o.barWidth,height:s.height},"vertical",l,p(a.config?.barSegmentGap,4),i,n/s.height,a.config?.barSegmentSnap!==!1):zt(t,r,o.barWidth,n,i,a.config?.barRoundedBottom===!0)}function zy(e,t,r,n,o,i,a){let{chart:s}=e,l=s.config;if(!(xt(e)&&!(l?.barLabelMaxOnly&&!Xy(r.values,o))&&(l?.barLabelPosition!=="axis"||n===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[o];t.labels.push(...St(e,{id:`chart-bar-label-${s.id}-${r.id}-${o}`,value:Array.isArray(u)?u[1]:u??0,frame:a,placement:c==="outside"&&n!==i.outerSeriesIndex?"center":c}))}function Yy(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=Zt(a,t,i,o,s.height),d=r.outerSeriesIndex===null||o===r.outerSeriesIndex?r.cornerRadius:0,c=s.x+i*r.slotWidth+r.groupGap/2,u=s.y+s.height-Math.max(l.pixelStart,l.pixelEnd),m=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:n,valueIndex:i,radius:d,color:n.colors?.[i]??n.color??T[o%T.length],x:c,y:u,height:m,path:Wy(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function jy(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=R(t.color,i,r.id),u=R(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=A(r.shadowStyle),g=[];if(f){let b=`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`;g.push({type:"path",id:`chart-bar-shadow-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,style:{fill:c,stroke:u,strokeWidth:m,shadow:f,clip:Ct(e,t.column)??{type:"path",d:b}}})}return g.push(...bt(e,`${s.id}-${l}`,d)),g.push({type:"path",id:`chart-bar-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,detail:{of:"chartValue",series:s.id,valueIndex:l,mark:"bar",radius:t.radius,colorProp:gt(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:Z(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),g}function Uy(e,t,r,n,o,i,a){let{chart:s}=e,l=Yy(e,t,n,o,i,a);i===0&&De(e)&&r.tracks.push(...Rt(e,String(a),l.column)),r.bars.push(...jy(e,l));let d={x:l.x,y:l.y,width:n.barWidth,height:l.height};zy(e,r,o,i,a,n,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(yt(e,`chart-bar-glow-${s.id}-${o.id}-${a}`,l.path,l.color,c))}function bc(e,t){let{chart:r}=e,n={tracks:[],bars:[],glows:[],labels:[]},o=Vy(e,t),i=oe(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{Uy(e,t,n,o,s,l,a)});return[...n.tracks,...n.bars,...n.glows,...n.labels]}function Xy(e,t){let r=e.map(n=>typeof n=="number"?n:n[1]);return r[t]>=Math.max(...r)}function yc(e){return K(e.chart)?gc(e):e.stackedMode?bc(e,e.stackedMode):fc(e)}function xc(e){let{chart:t,plot:r}=e,n=t.config?.orientation??"vertical",o=Math.max(1,t.series.length),i=(n==="horizontal"?r.height:r.width)/o,a=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:n,slotWidth:i,boxWidth:Math.max(4,i*a),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:E(t.config?.barBorderColor,"#000000"),borderWidth:p(t.config?.barBorderWidth,1)}}function ee(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Sc(e,t,r,n){let{chart:o,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+L(d,o.axisX,i.width):i.y+i.height-L(d,o.axisY,i.height);return{center:i[a==="horizontal"?"y":"x"]+r*t.slotWidth+t.slotWidth/2,min:s(n.min),q1:s(n.q1),median:s(n.median),q3:s(n.q3),max:s(n.max)}}function Cc(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?o.x+L(d,n.axisX,o.width):o.y+o.height-L(d,n.axisY,o.height);return r.series.values.map((d,c)=>{let u=r.geometry.center+qy(r.seriesIndex*1e4+c)*t.boxWidth,{x:m,y:f}=ee(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:m,cy:f,rx:3,ry:3,style:{fill:R(r.color,a,n.id),opacity:.7}}})}function qy(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function Rc(e,t,r){return[er(e,t,Ky(t,r)),er(e,t,Zy(t,r)),er(e,t,Qy(t,r)),er(e,t,Jy(t,r)),tx(e,t,r),er(e,t,ex(t,r))]}function Ky(e,t){let{center:r,min:n,q1:o}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ee(e.orientation,r,n),to:ee(e.orientation,r,o),strokeWidth:1}}function Zy(e,t){let{center:r,q3:n,max:o}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ee(e.orientation,r,n),to:ee(e.orientation,r,o),strokeWidth:1}}function Qy(e,t){return kc(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function Jy(e,t){return kc(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function kc(e,t,r,n){let o=t.boxWidth*.2;return{id:e,from:ee(t.orientation,r-o,n),to:ee(t.orientation,r+o,n),strokeWidth:1}}function ex(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ee(e.orientation,t.geometry.center-r,t.geometry.median),to:ee(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:2}}function er(e,t,r){return{type:"path",id:r.id,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.from.x} ${r.from.y} L ${r.to.x} ${r.to.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:t.borderColor},strokeWidth:r.strokeWidth}}}function tx(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ee(t.orientation,s.center-l,s.q1),c=ee(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),m=Math.min(d.y,c.y),f=Math.max(1,Math.abs(c.x-d.x)),g=Math.max(1,Math.abs(c.y-d.y));return{type:"rect",id:`chart-box-${r.id}`,order:a(),bounds:o,x:u,y:m,width:f,height:g,rx:t.cornerRadius,style:{fill:R(r.color,i,n.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function wc(e,t,r,n){let o=Do(r.values);if(!o)return[];let i=Sc(e,t,n,o),a=r.color??T[n%T.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:n,color:a,geometry:i},l=Rc(e,t,s);return t.showPoints&&l.push(...Cc(e,t,s)),l}function vc(e){let t=xc(e),r=[];return e.chart.series.forEach((n,o)=>{r.push(...wc(e,t,n,o))}),r}var rx="#94a3b8",Pc=8,Qo=140;function Tc(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?ax(e):e.chart.series.flatMap((t,r)=>nx(e,t,r))}function nx(e,t,r){let n=ox(e,t,r);return Jo(e,t).map((o,i)=>{let a=ei(e,o),s={series:t,valueIndex:i,point:a,style:n};return t.symbol?.points.length?ix(e,s):ti(e,s)})}function ri(e){return e.config?.orientation==="horizontal"}function Jo(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(o=>[o[0],o[1]]):ri(r)?t.values.map((o,i)=>[o,r.axisY.min+i*r.axisY.step]):t.values.map((o,i)=>[r.axisX.min+i*r.axisX.step,o])}function Lc(e,t){return ri(e)?t[0]:t[1]}function ei(e,t){return{x:e.plot.x+L(t[0],e.chart.axisX,e.plot.width),y:e.plot.y+e.plot.height-L(t[1],e.chart.axisY,e.plot.height)}}function ox(e,t,r){let n=t.color??T[r%T.length];return{fill:R(n,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?p(t.strokeWidth,1):void 0}}function ix(e,t){let r=t.series.symbol,n=p(t.series.size,3),o=r?.normalized?n*2:1,i=r?.normalized?.5:0,a=(r?.points??[]).map(([s,l])=>({x:t.point.x+(s-i)*o,y:t.point.y+(l-i)*o}));return{type:"path",id:$c(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:se({points:a,tension:p(r?.tension,0),closed:!0}),style:t.style}}function ti(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:$c(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,cx:t.point.x,cy:t.point.y,rx:r,ry:r,style:t.style}}function $c(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function ax(e){let{chart:t}=e,[r,n]=t.series,o=Jo(e,r),i=Jo(e,n),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??F,c=!!t.config?.reverseComparison,u=Math.min(o.length,i.length),m=t.config?.categories??[],f=[];for(let g=0;g<u;g++){let b=o[g],y=i[g],S=ei(e,b),v=ei(e,y),$=Lc(t,b),O=Lc(t,y),V=c?O<$:O>$,j=c?O>$:O<$,Ue=V?s:j?l:d,pr=p(n.size,3);f.push(sx(e,g,S,v,Ue)),f.push(ti(e,{series:r,valueIndex:g,point:S,style:{fill:R(t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:rx},strokeWidth:1.5}})),f.push(ti(e,{series:n,valueIndex:g,point:v,style:{fill:R(Ue,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[g]&&f.push(lx(e,g,S,v,pr,m[g]))}return f}function sx(e,t,r,n,o){let{chart:i}=e;return{type:"path",id:`chart-custom-connector-${i.id}-${t}`,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.x} ${r.y} L ${n.x} ${n.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:o},strokeWidth:2}}}function lx(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=ri(a),c=d?{x:Math.max(r.x,n.x)+o+Pc,y:Math.min(r.y,n.y)-8,width:Qo,height:16}:{x:Math.min(r.x,n.x)-Qo/2,y:Math.min(r.y,n.y)-o-Pc-14,width:Qo,height:16};return{...w({id:`chart-custom-label-${a.id}-${t}`,order:l(),bounds:s,frame:c,text:i,chart:a,align:d?"left":"center"}),fontSize:Math.max(9,p(a.fontSize,12))-2}}function Ac(e){let{chart:t,plot:r}=e,n=t.series.filter(a=>Mc(a.values[0])===3),o=t.series.filter(a=>Mc(a.values[0])===4);return{scalarSamples:n.flatMap(a=>a.values.map(([s,l,d])=>({x:L(s,t.axisX,r.width),y:r.height-L(l,t.axisY,r.height),value:d}))),vectorSeries:o}}function Mc(e){return Array.isArray(e)?e.length:void 0}function Ec(e){let t=e.chart.config?.scale?.stops;if(!e.showLegend||!t?.length)return[];let r=[...t].sort((a,s)=>a.position-s.position),n=r[0].position,o=r[r.length-1].position,i=dx(e);return[cx(e,r,n,o,i),...ux(e,n,o,i)]}function dx(e){let{plot:t}=e,r=Math.min(220,t.width);return{x:t.x+(t.width-r)/2,y:t.y+t.height+46,width:r,height:8}}function cx(e,t,r,n,o){let{chart:i,bounds:a,nextOrder:s}=e,l=n-r;return{type:"rect",id:`chart-field-colorbar-${i.id}`,order:s(),bounds:a,x:o.x,y:o.y,width:o.width,height:o.height,rx:2,style:{fill:{kind:"linear-gradient",angle:0,stops:t.map(d=>({offset:l===0?0:(d.position-r)/l*100,color:d.color}))}}}}function ux(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=n.y+n.height+3;return[w({id:`chart-field-colorbar-min-${o.id}`,order:a(),bounds:i,frame:{x:n.x,y:s,width:80,height:16},text:le(t),chart:o}),w({id:`chart-field-colorbar-max-${o.id}`,order:a(),bounds:i,frame:{x:n.x+n.width-80,y:s,width:80,height:16},text:le(r),chart:o,align:"right"})]}var mx="#94a3b8";function Nc(e,t){return e?.stops.length?Bt(e.stops,t):mx}function Oc(e){if(e.length===0)return[];let t=s=>`${Math.round(s[0]*1e3)}:${Math.round(s[1]*1e3)}`,r=new Map,n=(s,l,d)=>{let c=t(s),u=r.get(c),m={point:l,segment:d};u?u.push(m):r.set(c,[m])};e.forEach((s,l)=>{let d=[s.x1,s.y1],c=[s.x2,s.y2];n(d,c,l),n(c,d,l)});let o=new Array(e.length).fill(!1),i=(s,l)=>{let d=l;for(;;){let u=r.get(t(d))?.find(m=>!o[m.segment]);if(!u)return;o[u.segment]=!0,s.push(u.point),d=u.point}},a=[];return e.forEach((s,l)=>{if(o[l])return;o[l]=!0;let d=[[s.x1,s.y1],[s.x2,s.y2]];i(d,d[d.length-1]);let c=[];i(c,d[0]),c.reverse(),a.push([...c,...d])}),a}function Bc(e,t){let r=[];for(let n=0;n<e.rows-1;n++)for(let o=0;o<e.columns-1;o++){let i=px(e,n,o),a=fx(i,t);a!==0&&a!==15&&r.push(...hx(i,a,t))}return r}function px(e,t,r){return{topLeft:rn(e,t,r),topRight:rn(e,t,r+1),bottomRight:rn(e,t+1,r+1),bottomLeft:rn(e,t+1,r)}}function rn(e,t,r){return{x:e.width*(r/(e.columns-1)),y:e.height*(t/(e.rows-1)),value:e.values[t*e.columns+r]}}function fx(e,t){return(nn(e.topLeft,t)?8:0)|(nn(e.topRight,t)?4:0)|(nn(e.bottomRight,t)?2:0)|(nn(e.bottomLeft,t)?1:0)}function nn(e,t){return e.value>=t}function hx(e,t,r){let n=gx(e,r);switch(t){case 1:case 14:return[be(n.left,n.bottom)];case 2:case 13:return[be(n.bottom,n.right)];case 3:case 12:return[be(n.left,n.right)];case 4:case 11:return[be(n.top,n.right)];case 5:return[be(n.left,n.top),be(n.bottom,n.right)];case 6:case 9:return[be(n.top,n.bottom)];case 7:case 8:return[be(n.left,n.top)];case 10:return[be(n.top,n.right),be(n.left,n.bottom)];default:return[]}}function gx(e,t){return{top:on(e.topLeft,e.topRight,t),right:on(e.topRight,e.bottomRight,t),bottom:on(e.bottomLeft,e.bottomRight,t),left:on(e.topLeft,e.bottomLeft,t)}}function on(e,t,r){let n=t.value===e.value?.5:(r-e.value)/(t.value-e.value);return[e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n]}function be(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var bx=.5;function Ic(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=yx(e,t);return[...xx(e,r),...Cx(e,r)]}function yx(e,t){let{plot:r,chart:n}=e,o=ic(t,r.width,r.height,n.config?.idwPower??2);return{values:o.grid,columns:o.cols,rows:o.rows,cellWidth:r.width/Math.max(1,o.cols-1),cellHeight:r.height/Math.max(1,o.rows-1)}}function xx(e,t){let r=[];for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)r.push(Sx(e,t,n,o));return r}function Sx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=i.x+i.width*(n/(t.columns-1)),d=i.y+i.height*(r/(t.rows-1)),c=Nc(o.config?.scale,t.values[r*t.columns+n]);return{type:"rect",id:`chart-field-cell-${o.id}-${r}-${n}`,order:s(),bounds:a,x:l-t.cellWidth/2,y:d-t.cellHeight/2,width:t.cellWidth,height:t.cellHeight,style:{fill:{kind:"solid",color:c},clip:Qt(o,i)}}}function Cx(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((n,o)=>{let i=Rx(e,t,n,o);i&&r.push(i)}),r}function Rx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=Bc({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=Oc(l).map(u=>ut(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),bx)).join(" ");return{type:"path",id:`chart-field-isoline-${o.id}-${n}`,order:s(),bounds:a,d:c,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"rgba(15, 23, 42, 0.55)"},strokeWidth:1,clip:Qt(o,i)}}}function Gc(e,t){let r=[];return t.forEach((n,o)=>{let i=n.color??T[o%T.length];n.values.forEach((a,s)=>{r.push(kx(e,n.id,a,s,i))})}),r}function kx(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,m,f]=r,g=a.x+L(c,i.axisX,a.width),b=a.y+a.height-L(u,i.axisY,a.height),y=a.x+L(c+Math.cos(m)*f,i.axisX,a.width),S=a.y+a.height-L(u+Math.sin(m)*f,i.axisY,a.height);return{type:"path",id:`chart-field-vector-${i.id}-${t}-${n}`,order:d(),bounds:s,d:`M ${g} ${b} L ${y} ${S}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:R(o,l,i.id),strokeWidth:2}}}function Dc(e){let t=Ac(e),r=[];return r.push(...Ic(e,t.scalarSamples)),r.push(...Gc(e,t.vectorSeries)),r.push(...Ec(e)),r}function _c(e,t){let r=[];return t.rows.forEach((n,o)=>{r.push(...wx(e,t,n,o))}),r}function wx(e,t,r,n){return t.columns.flatMap((o,i)=>{let a=vx(t,r,n,i);return Lx(e,t,a)})}function vx(e,t,r,n){let o=t.values[n]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:n,value:o,color:Px(o,e),frame:{x:e.grid.x+n*e.grid.cellWidth+i/2,y:e.grid.y+r*e.grid.cellHeight+i/2,width:Math.max(0,e.grid.cellWidth-i),height:Math.max(0,e.grid.cellHeight-i)}}}function Px(e,t){return Vt(e,t.bands,t.zones)}function Lx(e,t,r){let n=Tx(e,t,r);return e.chart.config?.showValues===!1?[n]:[n,$x(e,t,r)]}function Tx(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e;return{type:"rect",id:`chart-heatmap-cell-${n.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:o,...r.frame,rx:t.grid.cellRadius,style:{fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:p(n.gridWidth,1)}}}function $x(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e;return{...w({id:`chart-heatmap-value-${n.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:o,frame:{x:r.frame.x,y:r.frame.y+r.frame.height/2-t.fontSize/2,width:r.frame.width,height:t.fontSize+2},text:String(r.value),chart:n,align:"center"}),color:q(r.color)}}function Fc(e,t){return[...Mx(e,t),...Ex(e,t)]}function Mx(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,n)=>Ax(e,t,r,n))}function Ax(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-row-${o.id}-${r.id}`,order:s(),bounds:a,frame:{x:i.x,y:t.grid.y+n*t.grid.cellHeight+t.grid.cellHeight/2-t.fontSize/2,width:t.reservedSpace.rowHeaders-8,height:t.fontSize+2},text:r.label,chart:o})}function Ex(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,n)=>Nx(e,t,r,n))}function Nx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-col-${o.id}-${n}`,order:s(),bounds:a,frame:{x:t.grid.x+n*t.grid.cellWidth,y:i.y,width:t.grid.cellWidth,height:t.fontSize+2},text:r,chart:o,align:"center"})}function Hc(e){let{chart:t}=e,r=Ox(e),n=Bx(e);return{rows:t.series,columns:r,bands:Ht(t.axisY),zones:t.config?.zones?.length?t.config.zones:Ft,fontSize:Math.max(9,p(t.fontSize,12)),reservedSpace:n,grid:Ix(e,n,r.length)}}function Ox(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function Bx(e){let{chart:t}=e,r=Math.max(9,p(t.fontSize,12)),n=t.series.reduce((o,i)=>Math.max(o,It(i.label??"",r,!1)),0);return{rowHeaders:e.showLabels?Math.min(96,n+12):0,columnHeaders:e.showLabels?24:0,legend:e.showLegend?38:0}}function Ix(e,t,r){let{chart:n}=e,o=Math.max(1,e.plot.width-t.rowHeaders),i=Math.max(1,e.plot.height-t.columnHeaders-t.legend),a=n.series.length,s=Math.max(0,p(n.config?.cellGap,0)),l=r?o/r:o,d=a?i/a:i,c=o,u=i;if(n.config?.squareCells&&r&&a){let m=Math.min(l,d);l=m,d=m,c=m*r,u=m*a}return{x:e.plot.x+t.rowHeaders,y:e.plot.y+t.columnHeaders,width:c,height:u,cellWidth:l,cellHeight:d,cellGap:s,cellRadius:Math.max(0,p(n.config?.barCornerRadius,s))}}var tr=10,Vc=4,Gx=2;function Wc(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=t.grid.x,n=t.grid.width,o=t.fontSize+2,i=t.grid.y+t.grid.height+6,a=X({x:r,y:i,width:n,height:tr});return[Dx(e,t,r,i,n,a),..._x(e,t,r,i,n,o)]}function zc(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function Dx(e,t,r,n,o,i){let{chart:a,nextOrder:s}=e,l=Math.max(0,t.bands.length-1),c=t.zones.slice(0,l).map((u,m)=>({offset:zc(t,t.bands[m+1]??t.bands[t.bands.length-1])*100,color:u.color??F}));return{type:"rect",id:`chart-heatmap-legend-bar-${a.id}`,order:s(),bounds:i,x:r,y:n,width:o,height:tr,rx:3,zoneGradient:{axis:"y",min:a.axisY.min,max:a.axisY.max},style:{fill:c.length?{kind:"linear-gradient",angle:0,stops:c}:{kind:"solid",color:F},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}}}function _x(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=n+tr+Vc+Gx,c=48;return t.bands.flatMap((u,m)=>{let f=r+zc(t,u)*o,g={type:"path",id:`chart-heatmap-legend-tick-${a.id}-${m}`,order:l(),bounds:s,d:`M ${f} ${n+tr} L ${f} ${n+tr+Vc}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}},b=m===0,y=m===t.bands.length-1,S=b?"left":y?"right":"center",v=b?f:y?f-c:f-c/2,$=w({id:`chart-heatmap-legend-tick-label-${a.id}-${m}`,order:l(),bounds:s,frame:{x:v,y:d,width:c,height:i},text:le(u),chart:a,align:S});return[g,$]})}function Yc(e){let t=Hc(e),r=[];return r.push(..._c(e,t)),r.push(...Fc(e,t)),r.push(...Wc(e,t)),r}function ni(e,t){if(t<=0||e.length===0)return[];let r=t*1.5,n=t*Math.sqrt(3),o=new Map;for(let{x:i,y:a}of e){let s=Math.round(i/r),l=s%2!==0?n/2:0,d=Math.round((a-l)/n),c=`${s}:${d}`,u=o.get(c);u?u.count++:o.set(c,{cx:s*r,cy:d*n+l,count:1})}return[...o.values()]}function jc(e){let t=new Map;for(let r of e.ids)t.set(r,0);for(let r=0;r<e.ids.size;r++){let n=!1;for(let o of e.links){let i=(t.get(o.source)??0)+1;i>(t.get(o.target)??0)&&(t.set(o.target,i),n=!0)}if(!n)break}return t}function Uc(e,t){let r=new Map;for(let n of e){let o=t.get(n)??0,i=r.get(o)??[];i.push(n),r.set(o,i)}return r}function Xc(e,t){let r=new Set(e.map(a=>a.id));for(let a of t)r.add(a.source),r.add(a.target);let n=new Map,o=new Map;for(let a of r)n.set(a,[]),o.set(a,[]);let i=t.filter(a=>r.has(a.source)&&r.has(a.target)&&a.value>0&&a.source!==a.target);for(let a of i)o.get(a.source)?.push(a),n.get(a.target)?.push(a);return{ids:r,links:i,incoming:n,outgoing:o}}function Hx(e){let t=new Map;for(let r of e.ids){let n=(e.incoming.get(r)??[]).reduce((i,a)=>i+a.value,0),o=(e.outgoing.get(r)??[]).reduce((i,a)=>i+a.value,0);t.set(r,Math.max(n,o,1e-4))}return t}function Vx(e,t,r){let n=1/0;for(let o of e.values()){let i=o.reduce((l,d)=>l+(t.get(d)??0),0),a=Math.max(0,o.length-1)*8,s=Math.max(1,r-a);i>0&&(n=Math.min(n,s/i))}return!Number.isFinite(n)||n<=0?1:n}function rr(e,t,r){return t<=1?0:e*(r-18)/(t-1)}function Kc(e,t,r){let n=Uc(e.ids,t),o=Hx(e),i=Vx(n,o,r),a=new Map,s=new Map;for(let l of n.values()){let d=0;for(let c of l){let u=Math.max(2,(o.get(c)??0)*i);a.set(c,d),s.set(c,u),d+=u+8}}return{columns:t,y:a,heights:s,valueScale:i,columnCount:Math.max(1,...[...t.values()].map(l=>l+1))}}function Zc(e,t,r,n){let o=new Map,i=new Map;for(let a of e.ids)o.set(a,0),i.set(a,0);return e.links.map(a=>{let s=Math.max(.5,a.value*t.valueScale),l=n.get(a.source),d=n.get(a.target),c=(t.y.get(a.source)??0)+(l?.y??0),u=(t.y.get(a.target)??0)+(d?.y??0),m=o.get(a.source)??0,f=i.get(a.target)??0;return o.set(a.source,m+s),i.set(a.target,f+s),{source:a.source,target:a.target,value:a.value,color:a.color,x0:rr(t.columns.get(a.source)??0,t.columnCount,r)+18+(l?.x??0),x1:rr(t.columns.get(a.target)??0,t.columnCount,r)+(d?.x??0),sourceY0:c+m,sourceY1:c+m+s,targetY0:u+f,targetY1:u+f+s}})}function Qc(e,t,r,n,o){return[...t.ids].map(i=>{let a=e.find(d=>d.id===i),s=r.columns.get(i)??0,l=o.get(i);return{id:i,label:a?.label??i,color:a?.color,x:rr(s,r.columnCount,n)+(l?.x??0),y:(r.y.get(i)??0)+(l?.y??0),width:18,height:r.heights.get(i)??2,column:s}})}function Wx(e){let t=new Map;for(let r of e)(r.offsetX||r.offsetY)&&t.set(r.id,{x:r.offsetX??0,y:r.offsetY??0});return t}function oi(e,t,r,n){let o=Xc(e,t);if(o.ids.size===0)return{nodes:[],links:[]};let i=jc(o),a=Kc(o,i,n),s=Wx(e);return{nodes:Qc(e,o,a,r,s),links:Zc(o,a,r,s)}}function nr(e,t){let r=zx(e,t);if(!r.length)return[];let n=[],o=r,i=t;for(;o.length;){let a=Yx(o,Math.min(i.width,i.height)),s=jx(a,i);n.push(...s.rectangles),o=o.slice(a.items.length),i=s.remainingBounds}return n}function zx(e,t){let r=e.filter(i=>i.value>0);if(!r.length||t.width<=0||t.height<=0)return[];let n=r.reduce((i,a)=>i+a.value,0);if(n<=0)return[];let o=t.width*t.height/n;return[...r].sort((i,a)=>a.value-i.value).map(i=>({item:i,area:i.value*o}))}function Yx(e,t){let r=[e[0]];for(let n=1;n<e.length;n++){let o=[...r,e[n]];if(Jc(o,t)>Jc(r,t))break;r.push(e[n])}return{items:r,area:r.reduce((n,o)=>n+o.area,0)}}function Jc(e,t){let r=e.reduce((s,l)=>s+l.area,0);if(r<=0||t<=0)return 1/0;let n=e.map(s=>s.area),o=Math.max(...n),i=Math.min(...n),a=t*t;return Math.max(a*o/(r*r),r*r/(a*i))}function jx(e,t){return t.width>=t.height?Ux(e,t):Xx(e,t)}function Ux(e,t){let r=t.height>0?e.area/t.height:0,n=t.y;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:t.x,y:n,width:r,height:s};return n+=s,l}),remainingBounds:{x:t.x+r,y:t.y,width:t.width-r,height:t.height}}}function Xx(e,t){let r=t.width>0?e.area/t.width:0,n=t.x;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:n,y:t.y,width:s,height:r};return n+=s,l}),remainingBounds:{x:t.x,y:t.y+r,width:t.width,height:t.height-r}}}function qx(e,t,r){let n=[];for(let o=0;o<6;o++){let i=(-60+60*o)*Math.PI/180;n.push(`${o===0?"M":"L"} ${e+r*Math.cos(i)} ${t+r*Math.sin(i)}`)}return`${n.join(" ")} Z`}function eu(e){let{chart:t,plot:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=[],s=Math.max(1,t.config?.hexRadius??No),l=A(t.shadowStyle),d=l?`M ${r.x} ${r.y} H ${r.x+r.width} V ${r.y+r.height} H ${r.x} Z`:void 0;return t.series.forEach((c,u)=>{let g=(c.values.length>0&&Array.isArray(c.values[0])?c.values:c.values.map((v,$)=>[t.axisX.min+$*t.axisX.step,v])).map(([v,$])=>({x:L(v,t.axisX,r.width),y:r.height-L($,t.axisY,r.height)})),b=ni(g,s),y=Math.max(1,...b.map(v=>v.count)),S=c.color??T[u%T.length];b.forEach((v,$)=>{a.push({type:"path",id:`chart-hexbin-${t.id}-${c.id}-${$}`,order:i(),bounds:n,d:qx(r.x+v.cx,r.y+v.cy,s),style:{fill:R(S,o,t.id),opacity:Math.max(.15,v.count/y),shadow:l,clip:d?{type:"path",d}:void 0}})})}),a}function _e(e,t){return t.values.length>0&&Array.isArray(t.values[0])?t.values:t.values.map((r,n)=>[e.axisX.min+n*e.axisX.step,r])}function Fe(e,t){let{chart:r,plot:n}=e;return t.map(([o,i])=>({x:n.x+L(o,r.axisX,n.width),y:n.y+n.height-L(i,r.axisY,n.height)}))}function tu(e,t,r,n,o,i){let{chart:a,plot:s,nextOrder:l}=e,d=s.y+s.height,c=r[0],u=r[r.length-1],m=`${ut(r,o)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(S=>S.y)),g=(Math.min(...r.map(S=>S.x))+Math.max(...r.map(S=>S.x)))/2,b=(d-f)/2,y={minX:g-b,maxX:g+b,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:y,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:_o(n,i)},{offset:100,color:_o(n,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function Kx(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function Zx(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e;return{type:"path",id:`chart-highlight-guide-${t.key}`,order:a(),bounds:o,d:`M ${t.point.x} ${t.point.y} V ${n.y+n.height}`,style:{fill:{kind:"none"},stroke:R(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function Qx(e,t){let{chart:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=r.config?.lineGlow;return{type:"ellipse",id:`chart-highlight-${t.key}`,order:i(),bounds:n,cx:t.point.x,cy:t.point.y,rx:t.radius,ry:t.radius,style:{fill:R(t.color,o,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function Jx(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=n.config,s=Math.max(9,n.fontSize??12),l=Kx(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...w({id:`chart-highlight-label-${t.key}`,order:i(),bounds:o,frame:{x:t.point.x-d/2,y:t.point.y-t.radius-6-s*1.2,width:d,height:s*1.2},text:l,chart:n,align:"center"}),color:a?.highlightLabelColor??n.textColor??"#0f172a",fontWeight:"bold"}}function ru(e,t,r){let{chart:n}=e,o=n.config,i=o?.highlightPoints;if(!i?.length)return[];let a=_e(n,t),s=Fe(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let m={key:`${n.id}-${t.id}-${c}`,point:u,index:c,radius:o?.highlightSize??6,color:o?.highlightColor??r};o?.highlightGuide&&l.push(Zx(e,m)),l.push(Qx(e,m)),o?.highlightLabels&&l.push(Jx(e,m,a[c][1]))}return l}function nu(e,t,r,n){return r.map((o,i)=>({seriesId:e.id,valueIndex:i,value:t[i][1],error:e.error?.[i],position:o,color:n}))}function ou(e,t){return t.flatMap(r=>e0(e,r))}function e0(e,t){let r=[],n=t0(e,t);return n&&r.push(n),r.push(r0(e,t)),r}function t0(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=jt(t.value,t.error);return Ut({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.position.x,startY:n.y+n.height-L(a,r.axisY,n.height),endY:n.y+n.height-L(s,r.axisY,n.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function r0(e,t){let{chart:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=r.config,s=a?.pointSize??3,l=a?.pointStrokeWidth??0,d=s>0,c=a?.pointFill&&a.pointFill!=="series"?a.pointFill:t.color;return{type:"ellipse",id:`chart-point-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:n,cx:t.position.x,cy:t.position.y,rx:d?s:6,ry:d?s:6,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex},style:{fill:d?R(c,o,r.id):{kind:"none"},stroke:d&&l>0?R(t.color,o,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function iu(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,m=u&&typeof u!="string"&&u.type==="gradient"?u:void 0,f=c?.lineGlow;return{type:"path",id:`chart-line-${i.id}-${t.id}`,order:d(),bounds:m?{minX:a.x,maxX:a.x+a.width,minY:a.y,maxY:a.y+a.height}:s,detail:{of:"chartSeries",series:t.id,lineTension:o||void 0},d:ut(r,o),style:{fill:{kind:"none"},stroke:R(m??n,l,i.id),strokeWidth:t.strokeWidth??c?.lineWidth??2,dash:t.dash,lineCap:c?.lineWidth===void 0?void 0:"round",lineJoin:"round",shadow:f?{color:n,opacity:.9,blur:f,dx:0,dy:0}:A(i.shadowStyle)}}}function au(e,t){return E(e.color,T[t%T.length])}function su(e,t,r){let n=e.chart.config?.areaOpacity;if(n===void 0||n<=0)return[];let o=au(t,r),i=e.chart.config?.lineTension??0,a=Fe(e,_e(e.chart,t));return a.length>1?[tu(e,t,a,o,i,n)]:[]}function lu(e,t,r){let n=au(t,r),o=e.chart.config?.lineTension??0,i=_e(e.chart,t),a=Fe(e,i),s=[];a.length&&s.push(iu(e,t,a,n,o));let l=nu(t,i,a,n);return s.push(...ou(e,l)),s.push(...ru(e,t,n)),s}function du(e){let t=[];return e.chart.series.forEach((r,n)=>{t.push(...su(e,r,n))}),e.chart.series.forEach((r,n)=>{t.push(...lu(e,r,n))}),t}var cu=[0,25,50,75,100];function uu(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...n0(e,t)),e.showLabels&&r.push(...o0(e,t)),r}function n0(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return cu.map(i=>{let a=mu(t,i);return{type:"path",id:`chart-mekko-grid-${r.id}-${i}`,order:o(),bounds:n,d:`M ${t.grid.x} ${a} L ${t.grid.x+t.grid.width} ${a}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function o0(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e;return cu.map(a=>({...w({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:o,frame:{x:n.x,y:mu(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function mu(e,t){return e.grid.y+e.grid.height*(1-t/100)}function pu(e,t,r,n){return e.showLabels?[i0(e,t,r,n),a0(e,t,r,n)]:[]}function i0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return{...w({id:`chart-mekko-total-${o.id}-${r}`,order:s(),bounds:a,frame:{x:n.x,y:i.y,width:n.width,height:t.smallFontSize+2},text:String(n.total),chart:o,align:"center"}),fontSize:t.smallFontSize}}function a0(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,{label:s,width:l}=n;return{...w({id:`chart-mekko-col-label-${o.id}-${r}`,order:a(),bounds:i,frame:{x:n.x,y:t.grid.y+t.grid.height+4,width:l,height:t.smallFontSize*2+4},text:s,chart:o,align:"center"}),lines:fe(s,l,t.smallFontSize),fontSize:t.smallFontSize}}var fu=4;function hu(e){let t=s0(e),r=e.showLabels?30:0,n=l0(e,r),o=Math.max(9,p(e.chart.fontSize,12));return{columns:d0(e,n,t),fontSize:o,smallFontSize:Math.max(8,o-1),labelGutterWidth:r,grid:n}}function s0(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function l0(e,t){let r=e.showLabels?18:0,n=e.showLabels?32:0;return{x:e.plot.x+t,y:e.plot.y+r,width:Math.max(1,e.plot.width-t),height:Math.max(1,e.plot.height-r-n)}}function d0(e,t,r){let n=r.map((l,d)=>e.chart.series.reduce((c,u)=>c+(u.values[d]??0),0)),o=n.reduce((l,d)=>l+d,0),i=Math.max(1,...n),a=Math.max(1,t.width-fu*Math.max(0,r.length-1)),s=t.x;return r.map((l,d)=>{let c=n[d],u=o>0?c/o*a:a/r.length,m=e.chart.config?.mekkoVaryHeight?t.height*(c/i):t.height,f={label:l,total:c,x:s,y:t.y+t.height-m,width:u,height:m};return s+=u+fu,f})}var c0=.15;function gu(e,t,r){let o=e.chart.config?.showColumnBackdrop!==!1?[u0(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=m0(e.chart.series,t,r),s=a.flatMap((l,d)=>p0(e,t,l,i?a[d+1]?.color:void 0));return[...o,...s]}function u0(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=bu(e);return{type:"path",id:`chart-mekko-column-backdrop-${n.id}-${r}`,order:a(),bounds:o,d:Wt(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:R(n.gridColor??"#e2e8f0",i,n.id),opacity:c0}}}function bu(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function m0(e,t,r){let n=[],o=t.columns[r],i=0;return e.forEach((a,s)=>{let l=a.values[r]??0,d=(o.total>0?l/o.total:0)*o.height,c=o.y+i;i+=d;let u=a.color??T[s%T.length];n.push({columnIndex:r,seriesId:a.id,seriesLabel:a.label,value:l,color:u,isTop:s===0,frame:{x:o.x,y:c,width:o.width,height:d}})}),n}function p0(e,t,r,n){return[f0(e,r,n),...h0(e,t,r)]}function f0(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=A(n.shadowStyle),d=l?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0,c=t.isTop?bu(e):0,{x:u,y:m,width:f,height:g}=t.frame,b="#94a3b8",y={minX:u+f/2-g/2,maxX:u+f/2+g/2,minY:m,maxY:m+g},S=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:E(t.color,b)},{offset:100,color:E(r,b)}]}:R(t.color,a,n.id);return{type:"path",id:`chart-mekko-seg-${n.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?y:i,d:Wt(u,m,f,g,c),style:{fill:S,stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:p(n.gridWidth,1),shadow:l,clip:d?{type:"path",d}:void 0}}}function h0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,{x:a,y:s,width:l,height:d}=r.frame;if(!e.showLegend||l<34)return[];let c=Math.max(1,l-8),u=Math.max(1,d-6),m=t.smallFontSize*1.2,f=fe(r.seriesLabel,c,t.smallFontSize);if((f.length+1)*m>u)return[];let g=q(E(r.color,"#ffffff")),b={...w({id:`chart-mekko-seg-label-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3,width:c,height:u},text:r.seriesLabel,chart:n}),lines:f,fontSize:t.smallFontSize,fontWeight:"bold",color:g},y={...w({id:`chart-mekko-seg-value-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3+f.length*m,width:c,height:Math.max(1,u-f.length*m)},text:String(r.value),chart:n}),lines:[String(r.value)],fontSize:t.smallFontSize,color:g};return[b,y]}function yu(e){let t=hu(e),r=uu(e,t);return t.columns.forEach((n,o)=>{r.push(...gu(e,t,o)),r.push(...pu(e,t,o,n))}),r}function g0(e,t){let r=t.series.map(i=>Math.max(0,p(i.values[0],0))),n=r.reduce((i,a)=>i+a,0),o=r[0]??0;return e.replace(/\{total\}/g,String(Math.round(n*100)/100)).replace(/\{percent\}/g,String(n>0?Math.round(o/n*100):0)).replace(/\{label\}/g,t.series[0]?.label??"")}function xu(e,t){let{chart:r,bounds:n,nextOrder:o}=e,i=r.config?.pieCenterText;if(!i)return[];let a=g0(i,r).split(/\\n|\n/),s=p(r.config?.pieCenterSize,Math.max(14,Math.min(40,t.outerRadius*.3))),l=s*1.2,d=Math.max(40,(t.innerRadius>0?t.innerRadius:t.outerRadius*.6)*2);return[{type:"text",id:`chart-pie-center-${r.id}`,order:o(),bounds:n,x:t.centerX-d/2,y:t.centerY-l*a.length/2,width:d,height:l*a.length,lines:a,fontFamily:r.fontFamily??N,fontSize:s,fontWeight:"bold",align:"center",verticalAlign:"middle",lineHeight:1.2,color:r.config?.pieCenterColor??r.textColor??"#0f172a",detail:{of:"chartSeries",series:r.series[0]?.id??"",mark:"pie-center"}}]}function Su(e){let{chart:t,plot:r}=e,n=Xr(r.width,r.height,t.config?.innerRadius,t.config?.pieCornerRadius),i=t.config?.pieLabelPosition==="outside"&&t.showAxisLabels!==!1?t.config?.pieLabelContent==="inline"?.6:.7:1,a=n.outerRadius*i,s=n.innerRadius*i,l=n.cornerRadius;return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:a,innerRadius:s,cornerRadius:l,total:t.series.reduce((d,c)=>d+Math.max(0,p(c.values[0],0)),0)||1}}var b0=14*Math.PI/180,or=80,y0=.62,x0=14,S0=3,C0=.32,Cu="#334155";function wu(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(n=>n.end-n.start>=b0).flatMap(n=>R0(e,t,n))}function Ru(e,t,r,n,o,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=o*1.2,m=l.config?.pieLabelContent??"both",f=m==="inline"?or*1.9:or,g={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??N,fontSize:o,align:"center",verticalAlign:"middle",lineHeight:1.2,color:n},b=v=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...v}),y={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...g,y:m==="name"?r.y-u/2:r.y-u,lines:[m==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:b({}),prop:ge(t.seriesId)},S={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...g,y:m==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:b({}),prop:Z(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[y]:m==="percent"?[S]:[y,S]}function ku(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e;return{type:"path",id:`chart-pie-label-tick-${a.id}-${t.seriesId}`,order:l(),bounds:s,d:`M ${r.x} ${r.y} L ${n.x} ${n.y}`,detail:{of:"chartSeries",series:t.seriesId,mark:"pie-label-tick"},style:i?{stroke:{kind:"solid",color:o},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function R0(e,t,r){let n=e.chart.config,o={...t,centerX:t.centerX+r.shift.dx,centerY:t.centerY+r.shift.dy},i=(r.start+r.end)/2,a=Math.max(9,p(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=H(o,i,o.outerRadius+S0),c=o.outerRadius-o.innerRadius,u=c<l*2+6,m=r.labelOffsetX!==0||r.labelOffsetY!==0,f=n?.pieLabelPosition??"auto";if(m||f==="outside"||f==="auto"&&u){let O=m?k0(H(o,i,o.outerRadius),r.labelOffsetX,r.labelOffsetY):H(o,i,o.outerRadius+x0+(f==="outside"?Math.abs(Math.cos(i))*(n?.pieLabelContent==="inline"?or*.95:or/2):0)),V=Xt(d,O,or/2,l),j=n?.pieLabelColor??Pe(E(r.color,Cu),C0)??Cu;return[ku(e,r,d,V,j,!0),...Ru(e,r,O,j,a,s,!0,i)]}let b=o.innerRadius+c*y0,y=H(o,i,b),S=E(r.color,"#0f172a"),v=n?.pieLabelColor??lt(S,q(S));return[ku(e,r,d,d,v,!1),...Ru(e,r,y,v,a,s,!1,i)]}function k0(e,t,r){return{x:e.x+t,y:e.y+r}}var w0=-Math.PI/2,ai=Math.PI*2,v0=ai*(359.999/360),ii=e=>e*Math.PI/180;function vu(e,t){let r=e.chart.config,n=L0(e.chart.series,t.total,{start:w0+ii(p(r?.pieStartAngle,0)),sweep:Math.min(ai,Math.max(ii(1),ii(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),o=r?.pieSliceGap??0;return[...n.flatMap(i=>E0(e,P0(t,i),i,o)),...wu(e,t,n.map(i=>({seriesId:i.seriesId,label:i.label,color:i.color,share:i.share,start:i.angles.start,end:i.angles.end,labelOffsetX:i.labelOffsetX,labelOffsetY:i.labelOffsetY,shift:Pu(i)})))]}function Pu(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function P0(e,t){if(t.explode===0)return e;let{dx:r,dy:n}=Pu(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+n}}function L0(e,t,r){let n=[],o=r.start;return e.forEach((i,a)=>{let s=Math.max(0,p(i.values[0],0)),l=s/t*r.sweep;n.push({seriesId:i.id,label:i.label,color:i.color??T[a%T.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:o,end:o+Math.min(l,r.sweep>=ai?v0:r.sweep)},explode:Math.max(0,p(i.offset,r.explode)),labelOffsetX:p(i.labelOffsetX,0),labelOffsetY:p(i.labelOffsetY,0)}),o+=l}),n}function T0(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function $0(e,t){if(t<=0)return e;let r=t/2,n=Math.min(e.blur,r*2),o=r,i=Math.hypot(e.dx,e.dy),a=i>o?o/i:1;return{...e,blur:n,dx:e.dx*a,dy:e.dy*a}}function M0(e,t,r){let n=Math.max(0,r)/2,o=t.angles.end-t.angles.start,i=ft(e,t.angles,r),a=2*Oe(n,e.outerRadius),s=Math.max(0,o-a);return Math.min(e.cornerRadius,i?qt(e.outerRadius,e.innerRadius,s):Kt(e.outerRadius,Be(n,o,e.outerRadius),s))}function A0(e,t){let r=e.chart.config,n=t.stroke??r?.pieStroke;return n?{stroke:{kind:"solid",color:n},strokeWidth:p(t.strokeWidth,p(r?.pieStrokeWidth,1))}:{}}function E0(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=R(r.color,a,o.id),d=Ie(t,r.angles,M0(t,r,n),n),c=A(o.shadowStyle),u=A0(e,r),m=o.config?.pieGlow,f=c?{type:"path",id:`chart-pie-slice-shadow-${o.id}-${r.seriesId}`,order:s(),bounds:i,d,style:{fill:l,...u,shadow:$0(c,n),clip:{type:"path",d:T0(t.centerX,t.centerY,t.outerRadius)}}}:void 0,g={type:"path",id:`chart-pie-slice-${o.id}-${r.seriesId}`,order:s(),bounds:i,d,detail:{of:"chartValue",series:r.seriesId,valueIndex:0,mark:"pie-slice",pieStart:r.angles.start,pieEnd:r.angles.end,pieValue:r.value},prop:Z(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:E(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,g]:[g]}function Lu(e){let t=Su(e);return[...vu(e,t),...xu(e,t)]}var Tu=-Math.PI/2,N0="#e2e8f0",O0=14*Math.PI/180,an=80,B0=.62,I0=14,G0=3,D0=.32,$u="#334155";function _0(e){let{chart:t,plot:r}=e,n=Math.max(1,Math.min(r.width,r.height)/2-4),o=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,maxRadius:n,innerRadius:Math.max(0,Math.min(p(t.config?.innerRadius,0),n-1)),cornerRadius:Math.max(0,p(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,p(t.config?.pieSliceGap,0)),axisMin:o,range:p(t.axisY.max,100)-o,sweep:t.series.length>0?Math.PI*2/t.series.length:0}}function Mu(e,t,r){let{centerX:n,centerY:o,innerRadius:i,cornerRadius:a,gapPx:s}=e,l={centerX:n,centerY:o,outerRadius:t,innerRadius:i},d=Math.max(0,s)/2,c=r.end-r.start,u=Math.max(0,c-2*Oe(d,t));if(ft(l,r,s))return Math.min(a,qt(t,i,u));let m=Be(d,c,t);return Math.min(a,Kt(t,m,u))}function F0(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:m,innerRadius:f,maxRadius:g,gapPx:b}=t,y=R(a,d,s.id),S=A(s.shadowStyle),v=Ie({centerX:u,centerY:m,outerRadius:g,innerRadius:f},n,Mu(t,g,n),b),$={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:v,style:{fill:R(s.gridColor??N0,d,s.id)}},O=Ie({centerX:u,centerY:m,outerRadius:o,innerRadius:f},n,Mu(t,o,n),b),V=S?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:O,style:{fill:y,shadow:S,clip:{type:"path",d:v}}}:void 0,j={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:O,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:n.start,pieEnd:n.end,pieValue:i},prop:Z(r.id,0),style:{fill:y,innerShadow:S}};return V?[$,V,j]:[$,j]}function Au(e){let t=_0(e),{centerX:r,centerY:n,innerRadius:o,maxRadius:i,axisMin:a,range:s,sweep:l}=t,d=e.showLabels&&l>=O0;return e.chart.series.flatMap((c,u)=>{let m={start:Tu+u*l,end:Tu+(u+1)*l},f=Math.max(0,p(c.values[0],0)),g=s>0?Math.min(1,Math.max(0,(f-a)/s)):0,b=Math.max(o+1,o+(i-o)*g),y=c.color??T[u%T.length],S=F0(e,t,c,m,b,f,y);if(!d)return S;let v={centerX:r,centerY:n,outerRadius:b,innerRadius:o};return[...S,...V0(e,v,m,c,f,y)]})}function H0(e,t,r,n,o){let i=(r.start+r.end)/2,s=Math.max(9,p(e.chart.fontSize,12))*1.2,l=t.outerRadius-t.innerRadius,d=p(n.labelOffsetX,0),c=p(n.labelOffsetY,0),u=d!==0||c!==0,m=l<s*2+6,f=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),g=!m&&f>=an;if(!g&&!u)return;let b=u||!g,y=H(t,i,t.outerRadius+G0),S=b?u?W0(H(t,i,t.outerRadius),d,c):H(t,i,t.outerRadius+I0):H(t,i,t.innerRadius+l*B0),v=b?Pe(E(o,$u),D0)??$u:lt(E(o,"#0f172a"),q(E(o,"#0f172a")));return{point:S,color:v,outside:b,mid:i,tickStart:y}}function V0(e,t,r,n,o,i){let a=H0(e,t,r,n,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:m,mid:f,tickStart:g}=a,b=Math.max(9,p(s.fontSize,12)),y=b*1.2,S=m?Xt(g,c,an/2,y):g,v={type:"path",id:`chart-polar-area-label-tick-${s.id}-${n.id}`,order:d(),bounds:l,d:`M ${g.x} ${g.y} L ${S.x} ${S.y}`,detail:{of:"chartSeries",series:n.id,mark:"polar-area-label-tick"},style:m?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},$={of:"chartSeries",series:n.id,mark:"polar-area-label",pulled:m||void 0,midAngle:f,wedgeRadius:t.outerRadius},O={bounds:l,x:c.x-an/2,width:an,height:y,fontFamily:s.fontFamily??N,fontSize:b,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},V={type:"text",id:`chart-polar-area-label-name-${s.id}-${n.id}`,order:d(),...O,y:c.y-y,lines:[n.label],fontWeight:"bold",detail:$,prop:ge(n.id)},j={type:"text",id:`chart-polar-area-label-value-${s.id}-${n.id}`,order:d(),...O,y:c.y,lines:[le(o)],fontWeight:"normal",detail:$,prop:Z(n.id,0),propKind:"value"};return[v,V,j]}function W0(e,t,r){return{x:e.x+t,y:e.y+r}}var z0=["Speed","Quality","Cost","Reliability","Usability"];function Y0(e){let{chart:t,plot:r}=e,n=(t.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...t.series.map(i=>i.values.length));return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,radius:Zr(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Qr(n,o),curved:t.chartType==="radial"}}function Eu(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],n=Y0(e),o=j0(r,n.count),i=(a,s)=>lc(n,s,a);return{circular:n.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),categories:o,centerX:n.centerX,centerY:n.centerY,radius:n.radius,radiusForValue:a=>dc(n,a),pointAt:i,polygonPath:a=>Jr(o.map((s,l)=>i(a,l)),!1)}}function j0(e,t){return Array.from({length:t},(r,n)=>e[n]??z0[n]??`Category ${n+1}`)}function Nu(e,t){return e.chart.showGrid===!1?[]:[...U0(e,t),...q0(e,t)]}function U0(e,t){return D(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>X0(e,t,r))}function X0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=t.radiusForValue(r),s={fill:{kind:"none"},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:p(n.gridWidth,1)};return t.circular?{type:"ellipse",id:`chart-radial-ring-${n.id}-${r}`,order:i(),bounds:o,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:s}:{type:"path",id:`chart-radar-ring-${n.id}-${r}`,order:i(),bounds:o,d:t.polygonPath(a),style:s}}function q0(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return t.categories.map((i,a)=>{let s=t.pointAt(t.radius,a);return{type:"path",id:`chart-radar-spoke-${r.id}-${a}`,order:o(),bounds:n,d:`M ${t.centerX} ${t.centerY} L ${s.x} ${s.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function Ou(e,t){return e.showLabels?t.categories.map((r,n)=>K0(e,t,r,n)):[]}function K0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=t.pointAt(t.radius+10,n),d=l.x-t.centerX,c=Math.max(64,Math.min(120,i.width/3));return w({id:`chart-radar-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:Z0(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:o,align:Q0(d)})}function Z0(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function Q0(e){return e>8?"left":e<-8?"right":"center"}function Bu(e,t){let r=[];return e.chart.series.forEach((n,o)=>{r.push(...J0(e,t,n,o))}),r}function J0(e,t,r,n){let o=r.color??T[n%T.length],i=eS(r,e,t),a=Jr(i,t.circular);return[tS(e,t,r,a,o),rS(e,r,a,o),...nS(e,r,i,o)]}function eS(e,t,r){let n=e.values;return r.categories.map((o,i)=>r.pointAt(r.radiusForValue(n[i]??t.chart.axisY.min),i))}function tS(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-fill-${i.id}-${r.id}`,order:l(),bounds:a,d:n,detail:{of:"chartSeries",series:r.id},style:{fill:R(o,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function rS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e;return{type:"path",id:`chart-radar-series-${o.id}-${t.id}`,order:s(),bounds:i,d:r,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"none"},stroke:R(n,a,o.id),strokeWidth:2,lineJoin:"round",shadow:A(o.shadowStyle)}}}function nS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e;return r.map((l,d)=>({type:"ellipse",id:`chart-radar-point-${o.id}-${t.id}-${d}`,order:s(),bounds:i,cx:l.x,cy:l.y,rx:3,ry:3,detail:{of:"chartValue",series:t.id,valueIndex:d,mark:"radar-vertex"},prop:Z(t.id,d),style:{fill:R(n,a,o.id)}}))}function si(e){let t=Eu(e),r=[];return r.push(...Nu(e,t)),r.push(...Ou(e,t)),r.push(...Bu(e,t)),r}var Te=-Math.PI/2,oS=14,iS=4,aS=.18,Gu=1e-4;function kt(e,t,r,n){return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}}function Iu(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function sS(e,t,r,n){return`${Iu(e,t,r)} ${Iu(e,t,Math.max(0,n))}`}function lS(e,t,r,n,o){let i=kt(e,t,r,n),a=kt(e,t,r,o);return`M ${i.x} ${i.y} A ${r} ${r} 0 ${o-n>Math.PI?1:0} 1 ${a.x} ${a.y}`}function dS(e,t){let r=Math.min(e.blur,t*.6),n=t*.4,o=Math.hypot(e.dx,e.dy),i=o>n?n/o:1;return{...e,blur:r,dx:e.dx*i,dy:e.dy*i}}function cS(e,t,r,n){if(n>=Math.PI*2-Gu){let s=kt(e,t,r,Te),l=kt(e,t,r,Te+Math.PI);return`M ${s.x} ${s.y} A ${r} ${r} 0 1 1 ${l.x} ${l.y} A ${r} ${r} 0 1 1 ${s.x} ${s.y}`}let o=kt(e,t,r,Te),i=kt(e,t,r,Te+n),a=n>Math.PI?1:0;return`M ${o.x} ${o.y} A ${r} ${r} 0 ${a} 1 ${i.x} ${i.y}`}function uS(e){let{chart:t,plot:r}=e,n=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:Math.max(1,Math.min(r.width,r.height)/2-4),ringThickness:Math.max(1,p(t.config?.ringThickness,oS)),ringGap:Math.max(0,p(t.config?.ringGap,iS)),axisMin:n,range:p(t.axisY.max,100)-n}}function mS(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u}=t,m=A(a.shadowStyle),f=o>=Math.PI*2-Gu;if(!m||f)return[];let g=dS(m,u),b=Math.min(o,u/n);return[[Te,Te+b],[Te+o-b,Te+o]].map(([y,S],v)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${v}`,order:l(),bounds:s,d:lS(d,c,n,y,S),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:"round",shadow:g,clip:{type:"path",d:sS(d,c,n+u/2,n-u/2)}}}))}function pS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:m,axisMin:f,range:g}=t,b=c-n*(u+m)-u/2;if(b<=u/2)return[];let y=R(r.color??T[n%T.length],a,o.id),S=Math.max(0,p(r.values[0],0)),v=g>0?Math.min(1,Math.max(0,(S-f)/g)):0,$={type:"ellipse",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:b,ry:b,style:{fill:{kind:"none"},stroke:y,strokeWidth:u,opacity:aS}};if(v<=0)return[$];let O=v*Math.PI*2,V=mS(e,t,r,b,O,y),j={type:"path",id:`chart-radial-bar-ring-${o.id}-${r.id}`,order:s(),bounds:i,d:cS(l,d,b,O),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:Z(r.id,0),style:{fill:{kind:"none"},stroke:y,strokeWidth:u,lineCap:"round"}};return[$,...V,j]}function Du(e){let t=uS(e);return e.chart.series.flatMap((r,n)=>pS(e,t,r,n))}function _u(e,t){let r=A(e.chart.shadowStyle),n=!!e.chart.config?.linkGradient,{plot:o}=e,i=r?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0;return t.links.map((a,s)=>{let l=fS(t,a,s,n);return hS(e,l,r,i,n)})}function fS(e,t,r,n){let o={x:e.baseX+t.x0,top:e.baseY+t.sourceY0,bottom:e.baseY+t.sourceY1},i={x:e.baseX+t.x1,top:e.baseY+t.targetY0,bottom:e.baseY+t.targetY1},a=t.color||e.nodeColors.get(t.source)||F,s=e.nodeColors.get(t.target)||F,l=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:a},{offset:100,color:s}]}:{kind:"solid",color:t.color||s};return{linkIndex:r,fromId:t.source,toId:t.target,source:o,target:i,controlX:(o.x+i.x)/2,fill:l,opacity:t.color?.85:.45}}function hS(e,t,r,n,o){let{chart:i,bounds:a,nextOrder:s}=e,l={minX:Math.min(t.source.x,t.target.x),maxX:Math.max(t.source.x,t.target.x),minY:Math.min(t.source.top,t.target.top),maxY:Math.max(t.source.bottom,t.target.bottom)};return{type:"path",id:`chart-sankey-link-${i.id}-${t.linkIndex}`,order:s(),bounds:o?l:a,d:gS(t),detail:{of:"link",fromId:t.fromId,toId:t.toId},style:{fill:t.fill,opacity:t.opacity,shadow:r,clip:n?{type:"path",d:n}:void 0}}}function gS(e){let{source:t,target:r,controlX:n}=e;return[`M ${t.x} ${t.top}`,`C ${n} ${t.top} ${n} ${r.top} ${r.x} ${r.top}`,`L ${r.x} ${r.bottom}`,`C ${n} ${r.bottom} ${n} ${t.bottom} ${t.x} ${t.bottom}`,"Z"].join(" ")}var bS=.3,yS=.78;function Fu(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),n=[];return t.nodes.forEach(o=>{n.push(xS(e,t,o,r));let i=e.showLabels?SS(e,t,o):void 0;i&&n.push(i)}),n}function xS(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d={fill:{kind:"solid",color:r.color||F},shadow:A(o.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,m={of:"chartSeries",series:r.id,mark:"sankey-node"};return n>0&&c&&u?{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,rx:n,style:d,detail:m}:n>0&&c?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Nt(s,l,r.width,r.height,n),style:d,detail:m}:n>0&&u?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Ot(s,l,r.width,r.height,n),style:d,detail:m}:{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,style:d,detail:m}}function SS(e,t,r){let{chart:n}=e,o=n.config?.labelPosition??"outside",i=o==="inside"?RS(e,t,r,n.config?.labelOrientation??"horizontal"):CS(e,t,r);if(!i)return;let a=n.textColor??"#0f172a",s=o==="inside"?q(r.color):Pe(r.color,Yr(a)?yS:bS)??a,l=n.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function CS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=r.column===t.columnCount-1,s=t.baseX+r.x,l=t.baseY+r.y,d=a?s-t.labelGutter+8:s+r.width+6;return{...w({id:`chart-sankey-label-${n.id}-${r.id}`,order:i(),bounds:o,frame:{x:d,y:l,width:t.labelGutter-12,height:Math.max(1,r.height)},text:r.label,chart:n,align:a?"right":"left"}),fontSize:t.fontSize-2,fontWeight:"bold",verticalAlign:"middle"}}function RS(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d=s+r.width/2,c=l+r.height/2,u=t.fontSize-2,m=`chart-sankey-label-${o.id}-${r.id}`;if(n==="vertical"){let f=u*1.4,g=Math.max(1,r.height-8);return It(r.label,u,!1)>g?void 0:{...w({id:m,order:a(),bounds:i,frame:{x:d-g/2,y:c-f/2,width:g,height:f},text:r.label,chart:o,align:"center",rotation:-90}),fontSize:u,fontWeight:"bold",verticalAlign:"middle",rotationCenter:{x:d,y:c}}}return{...w({id:m,order:a(),bounds:i,frame:{x:s+4,y:c-u/2-2,width:Math.max(1,r.width-8),height:u+4},text:r.label,chart:o,align:"center"}),fontSize:u,fontWeight:"bold",verticalAlign:"middle"}}function Hu(e){let{chart:t,plot:r,showLabels:n}=e,o=n?92:0,i=Math.max(1,r.width-o*2),a=oi(kS(e),wS(e),i,r.height);return{...a,baseX:r.x+o,baseY:r.y,labelGutter:o,fontSize:Math.max(9,p(t.fontSize,12)),columnCount:Math.max(1,...a.nodes.map(s=>s.column+1)),nodeColors:new Map(a.nodes.map(s=>[s.id,s.color||F]))}}function kS(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function wS(e){let t=[];return e.chart.series.forEach(r=>{!r.source||!r.target||t.push({source:r.source,target:r.target,value:r.values[0]??0,color:r.color?E(r.color,F):void 0})}),t}function Vu(e){let t=Hu(e),r=[];return r.push(..._u(e,t)),r.push(...Fu(e,t)),r}function Wu(e,t=4){let r=[],n=A(e.chart.shadowStyle);return e.chart.series.forEach((o,i)=>{let a=o.color??T[i%T.length];Fe(e,_e(e.chart,o)).forEach((l,d)=>{r.push(vS(e,o,l,d,a,t,n))})}),r}function vS(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e;return{type:"ellipse",id:`chart-point-${s.id}-${t.id}-${n}`,order:c(),bounds:l,cx:r.x,cy:r.y,rx:i,ry:i,detail:{of:"chartValue",series:t.id,valueIndex:n},style:{fill:R(o,d,s.id),shadow:a}}}function zu(e){let{chart:t,plot:r,showLegend:n}=e,o=Math.max(9,p(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=n&&i==="bottom"?48:0,s=Math.max(0,p(t.config?.cellGap,0));return{leaves:t.series,bands:Ht(t.axisY),zones:t.config?.zones?.length?t.config.zones:Ft,fontSize:o,smallFontSize:Math.max(8,o-1),legendPosition:i,legendHeight:a,gridWidth:Math.max(1,r.width),gridHeight:Math.max(1,r.height-a),cellGap:s,cellRadius:Math.max(0,p(t.config?.barCornerRadius,s))}}function ir(e){return e.values[0]??0}function li(e,t){return e.color??Vt(ir(e),t.bands,t.zones)}var we=10,sn=4,di=2,ci=16,ar=34;function Yu(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?PS(e,t):LS(e,t)}function ui(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function ju(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((n,o)=>({offset:ui(e,e.bands[o+1]??e.bands[e.bands.length-1])*100,color:n.color??F}))}function PS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=n.x,s=t.gridWidth,l=t.fontSize+2,d=n.y+t.gridHeight+ci,c=X({x:a,y:d,width:s,height:we}),u=ju(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:we,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:0,stops:u}:{kind:"solid",color:F},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((g,b)=>{let y=a+ui(t,g)*s,S={type:"path",id:`chart-treemap-legend-tick-${r.id}-${b}`,order:i(),bounds:o,d:`M ${y} ${d+we} L ${y} ${d+we+sn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},v=b===0,$=b===t.bands.length-1,O=v?"left":$?"right":"center",V=v?y:$?y-ar:y-ar/2,j=w({id:`chart-treemap-legend-tick-label-${r.id}-${b}`,order:i(),bounds:o,frame:{x:V,y:d+we+sn+di,width:ar,height:l},text:le(g),chart:r,align:O});return[S,j]});return[m,...f]}function LS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=t.legendPosition,s=n.y,l=t.gridHeight,d=a==="left"?n.x-ci-we:n.x+t.gridWidth+ci,c=X({x:d,y:s,width:we,height:l}),u=ju(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:we,height:l,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:270,stops:u}:{kind:"solid",color:F},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+we,g=a==="left"?f-sn:f+sn,b=a==="left"?g-di-ar:g+di,y=t.bands.flatMap((S,v)=>{let $=s+(1-ui(t,S))*l,O={type:"path",id:`chart-treemap-legend-tick-${r.id}-${v}`,order:i(),bounds:o,d:`M ${f} ${$} L ${g} ${$}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},V=w({id:`chart-treemap-legend-tick-label-${r.id}-${v}`,order:i(),bounds:o,frame:{x:b,y:$-t.fontSize/2,width:ar,height:t.fontSize+2},text:le(S),chart:r,align:a==="left"?"right":"left"});return[O,V]});return[m,...y]}var mi=20;function Uu(e,t){let{tiles:r,headers:n}=TS(e,t),o=[],i=!!e.chart.config?.tileGradient;return r.forEach((a,s)=>{let l=r[s+1],d=l&&(a.item.leaf.group??"")===(l.item.leaf.group??""),c=i&&d?l:void 0;o.push(...MS(e,t,a,c))}),n.forEach((a,s)=>{o.push(...$S(e,t,a,s))}),o}function TS(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:ir(c)}));return{tiles:nr(l,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),headers:[]}}let r=[];for(let l of t.leaves){let d=l.group??"";r.includes(d)||r.push(d)}let n=r.map(l=>({key:l,label:l||"Other",value:t.leaves.filter(d=>(d.group??"")===l).reduce((d,c)=>d+ir(c),0)})),o=nr(n,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),i=t.cellGap,a=[],s=[];return o.forEach(l=>{let d=e.showLabels?Math.min(mi,l.height):0;e.showLabels&&s.push({key:l.item.key,label:l.item.label,x:l.x+i/2,y:l.y,width:Math.max(0,l.width-i)});let u=t.leaves.filter(m=>(m.group??"")===l.item.key).map(m=>({leaf:m,value:ir(m)}));a.push(...nr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function $S(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config?.headerColor??o.gridColor??"#e2e8f0",d={type:"rect",id:`chart-treemap-header-${o.id}-${n}`,order:s(),bounds:a,x:i.x+r.x,y:i.y+r.y,width:r.width,height:mi,rx:t.cellRadius,style:{fill:{kind:"solid",color:l}}},c=Math.max(8,Math.max(9,o.fontSize??12)-1),u={...w({id:`chart-treemap-header-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:i.x+r.x,y:i.y+r.y+(mi-c)/2,width:r.width,height:c+2},text:r.label,chart:o,align:"center"}),fontSize:c,color:q(l)};return[d,u]}function MS(e,t,r,n){let o=li(r.item.leaf,t),i=n?li(n.item.leaf,t):void 0,a=[AS(e,t,r,o,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...ES(e,t,r,o)),a}function AS(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=A(i.shadowStyle),m=u?`M ${a.x} ${a.y} H ${a.x+a.width} V ${a.y+a.height} H ${a.x} Z`:void 0,f=a.x+r.x+c/2,g=a.y+r.y+c/2,b=Math.max(0,r.width-c),y=Math.max(0,r.height-c),S="#94a3b8",v={minX:f,maxX:f+b,minY:g+y/2-b/2,maxY:g+y/2+b/2},$=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:E(n,S)},{offset:100,color:E(o,S)}]}:R(n,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:o?v:s,x:f,y:g,width:b,height:y,rx:t.cellRadius,style:{fill:$,stroke:{kind:"solid",color:i.gridColor??"#e2e8f0"},strokeWidth:p(i.gridWidth,1),shadow:u,clip:m?{type:"path",d:m}:void 0}}}function ES(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=Math.max(1,r.width-c-8),m=Math.max(1,r.height-c-6),f=i.x+r.x+c/2+4,g=i.y+r.y+c/2+3,b=q(E(n,"#ffffff")),y=fe(l.label,u,t.smallFontSize),S=t.smallFontSize*1.2,v={...w({id:`chart-treemap-label-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:f,y:g,width:u,height:m},text:l.label,chart:o}),lines:y,fontSize:t.smallFontSize,fontWeight:"bold",color:b},$={...w({id:`chart-treemap-value-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:f,y:g+y.length*S,width:u,height:Math.max(1,m-y.length*S)},text:String(d),chart:o}),lines:[String(d)],fontSize:t.smallFontSize,color:b};return[v,$]}function Xu(e){let t=zu(e),r=[];return r.push(...Uu(e,t)),r.push(...Yu(e,t)),r}var NS={bar:yc,boxplot:vc,custom:Tc,field:Dc,heatmap:Yc,hexbin:e=>eu(e),line:du,mekko:yu,pie:e=>Lu(e),polarArea:e=>Au(e),radar:e=>si(e),radial:e=>si(e),radialBar:e=>Du(e),sankey:Vu,scatter:Wu,treemap:Xu},OS=new Set(["radar","radial"]);function pi(e){return OS.has(e)}function He(e){return NS[e.chart.chartType](e)}function qu(e){let{chart:t,context:r,layout:n,nodes:o,renderOrder:i}=e,a=tn(t,n.plot,n.bounds,i.current());o.push(...a),i.advance(a.length),o.push(...He(r));let s=mc({chart:t,plot:n.plot,bounds:n.bounds,order:i.current()});return o.push(...s),i.advance(s.length),o.push(...nc(t,n,i.current())),o}function BS(e,t){let r=K(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function IS(e,t){let{outerRadius:r,innerRadius:n,cornerRadius:o}=Xr(t.width,t.height,e.config?.innerRadius,e.config?.pieCornerRadius);return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function GS(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),n=Math.max(0,Math.min(p(e.config?.innerRadius,0),r-1)),o=Math.max(0,p(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function DS(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...e.series.map(d=>d.values.length)),o=Qr(r,n),i=Zr(t.width,t.height,p(e.fontSize,12),e.showAxisLabels!==!1),a=t.x+t.width/2,s=t.y+t.height/2,l=e.chartType==="radial"?1:0;return{of:"radarGeometry",radarGeometry:`${a},${s},${i},${e.axisY.min},${e.axisY.max},${o},${l}`}}function _S(e,t){return e.chartType==="pie"?IS(e,t):e.chartType==="polarArea"?GS(e,t):e.chartType==="radar"||e.chartType==="radial"?DS(e,t):Zd.has(e.chartType)?BS(e,t):void 0}function Ku(e,t,r,n){let o={type:"rect",id:`chart-${e.id}`,order:n,bounds:t,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius??12,style:{fill:R(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=_S(e,r);return i&&(o.detail=i),o}function Zu(e,t,r,n){let o=Xd({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:n});return r.advance(o.length),o}function Qu(e,t,r,n){return{chart:e,plot:t.plot,bounds:t.bounds,diagnostics:n,showLabels:t.showLabels,showLegend:t.showLegend,stackedMode:e.config?.stacked&&e.config.stacked!=="none"?e.config.stacked:void 0,nextOrder:r.next}}var ln=class{#t;#n=.01;constructor(t){this.#t=t}next=()=>this.#t+this.#n++;current(){return this.#t+this.#n}advance(t){this.#n+=t}};function Ju(e,t,r,n){return e.title?[{...w({id:`chart-title-${e.id}`,order:n.next(),bounds:t,frame:{x:r.x,y:e.y+12,width:r.width,height:20},text:e.title,chart:e}),...e.titleColor?{color:e.titleColor}:{},fontWeight:e.titleWeight??"bold",fontSize:p(e.titleSize,Math.max(10,p(e.fontSize,12))+2),prop:Vd}]:[]}function em(e,t,r){let n=2e4+t,o=Qd(e),i=new ln(n),a=[Ku(e,o.bounds,o.plot,n)];return a.push(...pc(e,o.bounds,i)),a.push(...Ju(e,o.bounds,o.plot,i)),a.push(...Zu(e,o,i,r)),{chart:e,layout:o,nodes:a,renderOrder:i,context:Qu(e,o,i,r)}}function tm(e){return e.nodes.push(...He(e.context)),e.nodes}function rm(e){return e.nodes.push(...He(e.context)),e.nodes}function nm(e,t,r){if(e.isVisible===!1)return[];let n=em(e,t,r);return pi(e.chartType)?tm(n):Ge(e)?qu(n):rm(n)}function fi(e,t){return e.flatMap((r,n)=>U(nm(r,n,t),"chart",r.id,r.chartType,r.title??"Chart"))}function FS(e){return e.length?{minX:Math.min(...e.map(t=>t.bounds.minX)),minY:Math.min(...e.map(t=>t.bounds.minY)),maxX:Math.max(...e.map(t=>t.bounds.maxX)),maxY:Math.max(...e.map(t=>t.bounds.maxY))}:po}function HS(e){let t=new Map,r=(n,o,i)=>{o.forEach((a,s)=>{t.set(`${n}:${a.id}`,{rank:fl(a),sequence:hl(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.widgets??[],1e4),r("isometric",e.isometricObjects??[],15e3),r("link",e.links.map(n=>n.link),2e4),r("chart",e.charts??[],2e4),r("path",e.paths??[],3e4),t}function VS(e,t){let r=HS(t);for(let n of e){let o=n.identity?r.get(`${n.identity.role}:${n.identity.id}`):void 0;n.rank=o?.rank??0,n.sequence=o?.sequence??0}}function hi(e,t={}){let{measureText:r}=t,n=[...e.diagnostics??[]],o=[...wl(e),...pd(e.paths??[]),...fi(e.charts??[],n),...md(e.links,r),...Ed(e.shapes,n,r),...Nd(e.widgets??[]),...Pl(e.isometricObjects??[])];return VS(o,e),o.sort((i,a)=>(i.rank??0)-(a.rank??0)||(i.sequence??0)-(a.sequence??0)||i.order-a.order||(i.id<a.id?-1:i.id>a.id?1:0)),{nodes:o,bounds:FS(o),diagnostics:n}}var P=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),h=e=>Number(e.toFixed(3)).toString(),de=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var dn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;clip(t){if(!t.clip)return;let r=JSON.stringify(t.clip),n=this.ids.get(r);if(!n){n=de(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,n);let o=t.clip,i=o.type==="path"?`<path clip-rule="evenodd" d="${P(o.d)}"/>`:`<rect x="${h(o.x)}" y="${h(o.y)}" width="${h(o.width)}" height="${h(o.height)}" rx="${h(o.rx)}"/>`;this.addDefinition(`<clipPath id="${n}">${i}</clipPath>`)}return n}};var cn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;filter(t,r,n){if(t.innerShadow)return this.define(r,t.innerShadow,YS);if(t.shadow){let o=t.shadow.blur*1.5+Math.max(Math.abs(t.shadow.dx),Math.abs(t.shadow.dy));return this.define(r,t.shadow,WS,n&&n>0?Math.max(.5,o/n):.5)}if(t.blur||t.saturate!==void 0)return this.define(r,{blur:t.blur??0,saturate:t.saturate??1},zS)}define(t,r,n,o=.5){let i=JSON.stringify(r)+n.name+o,a=this.ids.get(i);return a||(a=de(`${this.prefix}shadow-${t}-${this.ids.size}`),this.ids.set(i,a),this.addDefinition(`<filter id="${a}" x="${h(-o*100)}%" y="${h(-o*100)}%" width="${h((1+o*2)*100)}%" height="${h((1+o*2)*100)}%">${n(r)}</filter>`)),a}};function WS(e){return`<feDropShadow dx="${h(e.dx)}" dy="${h(e.dy)}" stdDeviation="${h(e.blur/2)}" flood-color="${P(e.color)}" flood-opacity="${h(e.opacity)}"/>`}function zS(e){let t=e.blur>0?`<feGaussianBlur stdDeviation="${h(e.blur/2)}"/>`:"",r=e.saturate===1?"":`<feColorMatrix type="saturate" values="${h(e.saturate)}"/>`;return t+r}function YS(e){return['<feComponentTransfer in="SourceAlpha" result="sf-inverted-alpha">','<feFuncA type="table" tableValues="1 0"/>',"</feComponentTransfer>",`<feGaussianBlur in="sf-inverted-alpha" stdDeviation="${h(e.blur/2)}" result="sf-blurred"/>`,`<feOffset in="sf-blurred" dx="${h(e.dx)}" dy="${h(e.dy)}" result="sf-offset"/>`,`<feFlood flood-color="${P(e.color)}" flood-opacity="${h(e.opacity)}" result="sf-color"/>`,'<feComposite in="sf-color" in2="sf-offset" operator="in" result="sf-halo"/>','<feComposite in="sf-halo" in2="SourceGraphic" operator="in" result="sf-inset"/>','<feComposite in="sf-inset" in2="SourceGraphic" operator="over"/>'].join("")}function om(e,t,r,n){return{arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)}" fill="none" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round" stroke-linejoin="round"/>`,filled_arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}" stroke-linejoin="round"/>`,circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="${r}"/>`,diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}"/>`,bar:`<path d="M 0 ${h(-t*.6)} V ${h(t*.6)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,triangle:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 L ${h(-t)} ${h(t*.72)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}" stroke-linejoin="round"/>`,one:`<path d="M 0 ${h(-t*.62)} V ${h(t*.62)} M ${h(-t*.72)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,zero_one:`<circle cx="${h(-t*.8)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M 0 ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,one_many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0 M ${h(-t*1.45)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,zero_many:`<circle cx="${h(-t*1.45)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`}[e]}function jS(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function US(e,t){return`id="${e}" markerWidth="${h(t*2)}" markerHeight="${h(t*2)}" viewBox="${h(-t)} ${h(-t)} ${h(t*2)} ${h(t*2)}" refX="0" refY="0" orient="auto-start-reverse" markerUnits="userSpaceOnUse" overflow="visible"`}var un=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;marker(t,r,n){if(!t||t==="none")return;let o=`${t}:${r}:${n}`,i=this.ids.get(o);if(i)return i;i=de(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(o,i);let a=12+(n-2)*3,s=jS(t,a,n),l=US(i,s);return this.addDefinition(`<marker ${l}>${om(t,a,P(r),n)}</marker>`),i}};function XS(e,t){let r=t.points.map((i,a)=>de(`${e}-point-${a}`)),n=t.points.map((i,a)=>{let s=Math.max(0,Math.min(100,i.x)),l=Math.max(0,Math.min(100,i.y));return`<radialGradient id="${r[a]}" gradientUnits="objectBoundingBox" cx="${h(s)}%" cy="${h(l)}%" r="75%"><stop offset="0%" stop-color="${P(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${P(i.color)}" stop-opacity="0"/></radialGradient>`}).join(""),o=t.points.map((i,a)=>`<rect width="1" height="1" fill="url(#${r[a]})"/>`).join("");return`${n}<pattern id="${e}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><rect width="1" height="1" fill="${P(t.points[0]?.color??"transparent")}"/>${o}</pattern>`}function qS(e,t,r){let n=t.angle*Math.PI/180,o=(r.minX+r.maxX)/2,i=(r.minY+r.maxY)/2,a=Math.max(r.maxX-r.minX,r.maxY-r.minY)/2,s=Math.cos(n)*a,l=Math.sin(n)*a,d=t.stops.map(c=>`<stop offset="${h(Math.max(0,Math.min(100,c.offset)))}%" stop-color="${P(c.color)}"/>`).join("");return`<linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${h(o-s)}" y1="${h(i-l)}" x2="${h(o+s)}" y2="${h(i+l)}">${d}</linearGradient>`}var mn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;paint(t,r,n){if(!t||t.kind==="none")return"none";if(t.kind==="solid")return t.color;let o=JSON.stringify(t)+JSON.stringify(n),i=this.ids.get(o);if(!i){i=de(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(o,i);let a=t.kind==="mesh-gradient"?XS(i,t):qS(i,t,n);this.addDefinition(a)}return`url(#${i})`}};var pn=class{constructor(t){this.prefix=t;let r=n=>{this.entries.push(n)};this.paints=new mn(r,t),this.filters=new cn(r,t),this.markers=new un(r,t),this.clips=new dn(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return de(`${this.prefix}${t}`)}paint(t,r,n){return this.paints.paint(t,r,n)}filter(t,r,n){return this.filters.filter(t,r,n)}marker(t,r,n){return this.markers.marker(t,r,n)}clip(t){return this.clips.clip(t)}};function KS(e,t){return{type:"path",id:`link-hit-${t}`,order:e.order,rank:e.rank,sequence:e.sequence,bounds:e.bounds,d:e.d,identity:{role:"link",id:t},style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#000000"},strokeWidth:16,opacity:0,pointerEvents:"stroke"}}}function im(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,KS(t,t.identity.id)]:[t])}function am(e,t){let r=e.stroke;return r?.kind==="solid"?r.color:r?.kind==="linear-gradient"&&r.stops.length?(t==="start"?r.stops.reduce((o,i)=>o.offset<=i.offset?o:i):r.stops.reduce((o,i)=>o.offset>=i.offset?o:i)).color:r?.kind==="mesh-gradient"&&r.points.length?r.points[0].color:"#64748b"}function sm(e,t){let r=t.paint(e.style.stroke,`${e.id}-stroke`,e.bounds),n=t.paint(e.style.fill,`${e.id}-fill`,e.bounds),o=[`fill="${P(n)}"`,`stroke="${P(r)}"`];return ZS(o,e.style),lm(o,e,t),JS(o,e,t),o.join(" ")}function ZS(e,t){t.strokeWidth!==void 0&&e.push(`stroke-width="${h(t.strokeWidth)}"`),t.dash?.length&&e.push(`stroke-dasharray="${t.dash.map(h).join(" ")}"`),t.lineCap&&e.push(`stroke-linecap="${t.lineCap}"`),t.lineJoin&&e.push(`stroke-linejoin="${t.lineJoin}"`),t.opacity!==void 0&&e.push(`opacity="${h(t.opacity)}"`),t.pointerEvents&&e.push(`pointer-events="${t.pointerEvents}"`)}function QS(e){let t=e;if(t.type==="ellipse"&&t.rx!==void 0&&t.ry!==void 0)return Math.min(t.rx,t.ry)*2;if(t.type==="rect"&&t.width!==void 0&&t.height!==void 0)return Math.min(t.width,t.height)}function lm(e,t,r){let n=r.filter(t.style,t.id,QS(t));n&&e.push(`filter="url(#${n})"`);let o=r.clip(t.style);o&&e.push(`clip-path="url(#${o})"`)}function JS(e,t,r){if(t.type!=="path")return;let n=r.marker(t.markerStart,am(t.style,"start"),t.style.strokeWidth??1),o=r.marker(t.markerEnd,am(t.style,"end"),t.style.strokeWidth??1);n&&e.push(`marker-start="url(#${n})"`),o&&e.push(`marker-end="url(#${o})"`)}function $e(e,t){return e&&t?` transform="rotate(${h(e)} ${h(t.x)} ${h(t.y)})"`:""}function dm(e,t){let r=[];return e.style.opacity!==void 0&&r.push(`opacity="${h(e.style.opacity)}"`),e.style.pointerEvents&&r.push(`pointer-events="${e.style.pointerEvents}"`),lm(r,e,t),r.join(" ")}var cm="data-sf-symbol-points",um="data-sf-symbol-tension",fn="data-sf-symbol-bounds",sr="data-sf-corner-radius",mm="data-sf-square-corner",hn="data-sf-path-points",gn="data-sf-path-tension",bn="data-sf-path-closed",pm="data-sf-path-point",yn="data-sf-isometric-size",xn="data-sf-isometric-label-offset";function eC(e){return e.role==="shape"?"entity":e.role}function tC(e){return[`data-sf-role="${eC(e)}"`,`data-sf-id="${P(e.id)}"`,e.kind?`data-sf-kind="${P(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${P(e.parentFrameId)}"`:void 0]}function rC(e){switch(e.of){case"chartValue":return nC(e);case"chartScale":return aC(e);case"chartSeries":return sC(e);case"pieGeometry":return oC(e);case"radarGeometry":return iC(e);case"link":return mC(e);case"frameBoundary":return lC(e);case"symbolGeometry":return dC(e);case"declaredBounds":return[gi(e.bounds)];case"pathGeometry":return cC(e);case"isometricGeometry":return uC(e)}}function nC(e){return[`data-sf-series="${P(e.series)}"`,`data-sf-value-index="${e.valueIndex}"`,e.mark?`data-sf-mark="${e.mark}"`:void 0,e.radius!==void 0?`data-sf-bar-radius="${h(e.radius)}"`:void 0,e.colorProp?`data-sf-color-prop="${P(e.colorProp)}"`:void 0,e.hasColorOverride?'data-sf-color-override="true"':void 0,e.pieStart!==void 0?`data-sf-pie-start="${h(e.pieStart)}"`:void 0,e.pieEnd!==void 0?`data-sf-pie-end="${h(e.pieEnd)}"`:void 0,e.pieValue!==void 0?`data-sf-pie-value="${h(e.pieValue)}"`:void 0]}function oC(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function iC(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function aC(e){return[`data-sf-value-scale="${e.valueScale}"`]}function sC(e){return[`data-sf-series="${P(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${h(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${P(e.mark)}"`:void 0,e.pulled?'data-sf-label-pulled="true"':void 0,e.midAngle!==void 0?`data-sf-pie-mid-angle="${h(e.midAngle)}"`:void 0,e.wedgeRadius!==void 0?`data-sf-pie-wedge-radius="${h(e.wedgeRadius)}"`:void 0]}function lC(e){return[`${sr}="${h(e.cornerRadius)}"`,`${mm}="${e.squareCorner}"`]}function gi(e){return`${fn}="${h(e.x)},${h(e.y)},${h(e.width)},${h(e.height)}"`}function dC(e){return[`${cm}="${P(JSON.stringify(e.points))}"`,`${um}="${h(e.tension)}"`,gi(e.declaredBounds)]}function cC(e){return[`${hn}="${P(JSON.stringify(e.points))}"`,`${gn}="${h(e.tension)}"`,`${bn}="${e.closed}"`]}function uC(e){return[`${yn}="${h(e.width)},${h(e.height)},${h(e.depth)}"`,`${sr}="${h(e.cornerRadius)}"`,gi(e.bounds),`${xn}="${h(e.labelOffsetX)},${h(e.labelOffsetY)}"`]}function mC(e){return[e.fromId?`data-sf-from="${P(e.fromId)}"`:void 0,e.toId?`data-sf-to="${P(e.toId)}"`:void 0,e.route?`data-sf-route="${e.route}"`:void 0,e.fromSide?`data-sf-from-side="${e.fromSide}"`:void 0,e.toSide?`data-sf-to-side="${e.toSide}"`:void 0,e.segments?`data-sf-link-segments="${P(JSON.stringify(e.segments))}"`:void 0,e.fromFace?`data-sf-from-face="${e.fromFace}"`:void 0,e.toFace?`data-sf-to-face="${e.toFace}"`:void 0,e.labelGap?'data-sf-label-gap="true"':void 0]}function Ve(e){let t=e.identity?.label,r=[...e.identity?tC(e.identity):[],...e.detail?rC(e.detail):[],e.prop?`data-sf-prop="${P(e.prop)}"`:void 0,e.propKind?`data-sf-prop-kind="${e.propKind}"`:void 0,e.propSolidOnly?'data-sf-prop-solid-only="true"':void 0,e.mark?`data-sf-mark="${P(e.mark)}"`:void 0,e.zoneGradient?'data-sf-zone-gradient="true"':void 0,e.zoneGradient?`data-sf-zone-axis-min="${h(e.zoneGradient.min)}"`:void 0,e.zoneGradient?`data-sf-zone-axis-max="${h(e.zoneGradient.max)}"`:void 0,t?`tabindex="0" aria-label="${P(t.replace(/\s+/g," ").trim())}"`:void 0].filter(n=>n!==void 0);return r.length?` ${r.join(" ")}`:""}function pC(e,t,r,n){if(!e.length)return`<tspan x="${h(t)}"${r} font-size="${n}"></tspan>`;let o=[];for(let i of e){let a=o[o.length-1];a&&a.bold===i.bold?a.text+=` ${i.text}`:(a&&(a.text+=" "),o.push({text:i.text,bold:i.bold}))}return o.map((i,a)=>`<tspan${a===0?` x="${h(t)}"${r}`:""} font-size="${n}" font-weight="${i.bold?"bold":"normal"}">${P(i.text)}</tspan>`).join("")}function fm(e,t){let r=fC(e),n=`${h(e.fontSize)}px`,o=gC(e,r,n),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${Ve(e)} x="${h(r.x)}" y="${h(r.firstY)}" font-family="${P(e.fontFamily)}" font-size="${n}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${h(e.letterSpacing)}"`:""} fill="${P(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${h(e.lineHeight)}"${i}${$e(e.rotation,e.rotationCenter)}>${o}</text>`}function fC(e){let t=e.fontSize*e.lineHeight,n=(e.richLines?e.richLines.length:e.lines.length)*t,o=e.align==="left"?e.x:e.align==="right"?e.x+e.width:e.x+e.width/2,i=e.align==="left"?"start":e.align==="right"?"end":"middle";return{x:o,firstY:hC(e,n),linePx:t,anchor:i}}function hC(e,t){return e.verticalAlign==="top"?e.y+e.fontSize:e.verticalAlign==="bottom"?e.y+e.height-t+e.fontSize:e.y+(e.height-t)/2+e.fontSize}function gC(e,t,r){return e.richLines?e.richLines.map((n,o)=>pC(n,t.x,hm(o,t.linePx),r)).join(""):e.lines.map((n,o)=>bC(n,o,t,r)).join("")}function bC(e,t,r,n){return`<tspan x="${h(r.x)}" font-size="${n}"${hm(t,r.linePx)}>${P(e)}</tspan>`}function hm(e,t){return e?` dy="${h(t)}px"`:""}function yC(e,t){let r=$e(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=P(JSON.stringify(e.shader.parameters)),o=e.fillColor?` data-sf-shader-fill="${P(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${Ve(e)} data-sf-shader="${P(e.shader.program)}" data-sf-shader-name="${P(e.shader.name)}" data-sf-shader-params="${n}" data-sf-shader-mask="${e.mask}"${o} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}"${r} pointer-events="${e.shader.program==="ruler"?"all":"none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`}function xC(e,t){let r=t.widgetStyle;return r.variant==="plain"?`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.62em;height:1.1em;overflow:hidden"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${P(r.color)};font-weight:${P(r.fontWeight)};line-height:1">${P(e)}</span></span>`:`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.72em;height:1.2em;overflow:hidden;border:1px solid ${P(r.divider)};border-radius:.09em;background:${P(r.surface)};box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -.16em .38em rgba(0,0,0,.12)"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${P(r.color)};font-weight:300;line-height:1">${P(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${P(r.divider)};pointer-events:none"></span></span>`}function SC(e,t){let r=$e(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=Math.max(1,Math.min(e.width,e.height)*.28),o=e.label?`<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${P(e.widgetStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${P(e.label)}</span>`:"",i=[...e.value].map(s=>xC(s,e)).join(""),a=P(JSON.stringify(e.widgetStyle));return`<foreignObject id="${t.elementId(e.id)}"${Ve(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${P(e.value)}" data-sf-widget-digits="${e.digits??""}" data-sf-widget-duration="${h(e.duration)}" data-sf-widget-style="${a}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}"${r}><div xmlns="http://www.w3.org/1999/xhtml" style="width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:${P(e.widgetStyle.fontFamily)};font-size:${h(n)}px">${o}<div data-sf-rolling-digits="true" aria-label="${P(e.value)}" style="display:flex;gap:${e.widgetStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function gm(e,t){if(e.type==="text")return fm(e,t);if(e.type==="shader-surface")return yC(e,t);if(e.type==="rolling-number")return SC(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${Ve(e)} ${dm(e,t)} href="${P(e.href)}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}" preserveAspectRatio="xMidYMid slice"/>`;let r=`id="${t.elementId(e.id)}"${Ve(e)} ${sm(e,t)}`;return e.type==="rect"?`<rect ${r} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}"${e.rx?` rx="${h(e.rx)}"`:""}${$e(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2})}/>`:e.type==="ellipse"?`<ellipse ${r} cx="${h(e.cx)}" cy="${h(e.cy)}" rx="${h(e.rx)}" ry="${h(e.ry)}"${$e(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${P(e.d)}"${$e(e.rotation,e.rotationCenter)}/>`}function bm(e,t={}){let r=t.padding??16,n=Math.max(1,e.bounds.maxX-e.bounds.minX+r*2),o=Math.max(1,e.bounds.maxY-e.bounds.minY+r*2),i=`${h(e.bounds.minX-r)} ${h(e.bounds.minY-r)} ${h(n)} ${h(o)}`,a=new pn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?im(e.nodes):e.nodes).map(u=>gm(u,a)).join(`
|
|
14
|
+
`);return{svg:`${t.includeXmlDeclaration===!1?"":`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
|
+
`}<svg xmlns="http://www.w3.org/2000/svg" width="${h(n)}px" height="${h(o)}px" viewBox="${i}" role="img" data-sf-contract="${1}">
|
|
16
|
+
<defs>${a.entries.join("")}</defs>
|
|
17
|
+
${l}
|
|
18
|
+
</svg>`,width:n,height:o,diagnostics:e.diagnostics}}function Sn(e,t={}){return bm(e,t)}function RC(e,t={}){let r=hi(e,{measureText:t.measureText}),{svg:n,width:o,height:i,diagnostics:a}=Sn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var kC=50,We=new Map;function wC(e){let t=We.get(e);if(t)return We.delete(e),We.set(e,t),t;let r=hi(mo(e));if(We.set(e,r),We.size>kC){let n=We.keys().next().value;n!==void 0&&We.delete(n)}return r}function Cn(e,t={}){if(t.measureText)return RC(mo(e),t);let r=wC(e),{svg:n,width:o,height:i,diagnostics:a}=Sn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var ym=new Set(["viewbox","width","height"]);function xm(e,t){for(let r of Array.from(e.attributes))ym.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))ym.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function Sm(e,t,r){let n=[],o=[],i=[];for(let a of r){let s=e.has(a),l=t.has(a);l&&!s?n.push(a):s&&!l?o.push(a):s&&l&&i.push(a)}return{added:n,removed:o,changed:i}}function Cm(e,t){let r=e.querySelector(":scope > defs"),n=t.querySelector(":scope > defs");return n?(r?r.replaceWith(n):e.insertBefore(n,e.firstChild),n):(r?.remove(),r)}function vC(e,t){let r=!1;for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||(e.removeAttribute(n.name),r=!0);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&(e.setAttribute(n.name,n.value),r=!0);return r}function km(e,t){let r=Array.from(e.childNodes),n=Array.from(t.childNodes);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){let i=r[o],a=n[o];if(i.nodeType!==a.nodeType)return!1;if(i.nodeType===Node.TEXT_NODE){if(i.textContent!==a.textContent)return!1;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let s=i,l=a;if(s.tagName!==l.tagName||s.attributes.length!==l.attributes.length)return!1;for(let d of Array.from(s.attributes))if(l.getAttribute(d.name)!==d.value)return!1;if(!km(s,l))return!1}return!0}function Rm(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function wm(e,t){let r=t.hasAttribute("data-sf-widget")&&(e.getAttribute("data-sf-widget-style")!==t.getAttribute("data-sf-widget-style")||e.getAttribute("data-sf-widget-value")!==t.getAttribute("data-sf-widget-value")),n=vC(e,t),o=!1;return r&&(o=!0,Rm(e,t)),t.tagName.toLowerCase()==="text"&&!km(e,t)&&(o=!0,Rm(e,t)),n||o}function lr(e){return e.getAttribute("data-sf-id")??e.id}function PC(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function LC(e,t,r){return e&&e.tagName===t.tagName?(wm(e,t)&&r(lr(t)),e):(e?.remove(),r(lr(t)),t)}function TC(e,t,r){let n=r?r.nextSibling:e.firstChild;n!==t&&e.insertBefore(t,n)}function vm(e,t){let r=Cm(e,t),n=PC(e),o=new Set,i=new Set;for(let c of n.values())i.add(lr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let c of t.querySelectorAll(":scope > [id]")){o.add(c.id),a.add(lr(c));let u=LC(n.get(c.id),c,l);TC(e,u,d),d=u}for(let[c,u]of n)o.has(c)||(s.add(lr(u)),u.remove());return Sm(i,a,s)}function Pm(e,t){return xm(e,t),vm(e,t)}function bi(e){let r=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(r.nodeName.toLowerCase()!=="svg")throw new Error("viewer: source did not parse to an <svg> root");return r}function dr(e){let t=(e.getAttribute("viewBox")??"0 0 100 100").split(/\s+/).map(Number);return{x:t[0],y:t[1],w:t[2],h:t[3]}}var Rn=class{#t;#n;#e;constructor(t,r){this.#t=t,this.#n=r,this.#e={...r}}apply(){this.#t.setAttribute("viewBox",`${this.#e.x} ${this.#e.y} ${this.#e.w} ${this.#e.h}`)}fit(){this.#e={...this.#n},this.apply()}get(){return{...this.#e}}setNatural(t){this.#n=t}zoomBy(t,r,n){let o=this.#t.getBoundingClientRect();if(o.width<=0||o.height<=0)return;let i=r??o.left+o.width/2,a=n??o.top+o.height/2,s=this.#e.x+(i-o.left)/o.width*this.#e.w,l=this.#e.y+(a-o.top)/o.height*this.#e.h;this.#e={w:this.#e.w/t,h:this.#e.h/t,x:0,y:0},this.#e.x=s-(i-o.left)/o.width*this.#e.w,this.#e.y=l-(a-o.top)/o.height*this.#e.h,this.apply()}panBy(t,r){let n=this.#t.getBoundingClientRect(),o=n.width>0?n.width/this.#e.w:1;this.#e.x-=t/o,this.#e.y-=r/o,this.apply()}};function Lm(e,t){let r=bi(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let n=new Rn(r,dr(r));return e.appendChild(r),n.apply(),{svg:r,fit:()=>n.fit(),getViewport:()=>n.get(),zoomBy:(o,i,a)=>n.zoomBy(o,i,a),panBy:(o,i)=>n.panBy(o,i),updateContent(o){let i=bi(o),a=Pm(r,i);return n.setNatural(dr(i)),a},destroy(){r.remove()}}}var kn=class{handlers=new Map;on(t,r){let n=this.handlers.get(t)??new Set;this.handlers.set(t,n);let o=r;return n.add(o),()=>n.delete(o)}emit(t,r){let n=this.handlers.get(t);if(n!==void 0)for(let o of[...n])try{o(r)}catch(i){queueMicrotask(()=>{throw i})}}clear(){this.handlers.clear()}};var wn=class extends kn{};function $C(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function MC(e,t){return new Promise((r,n)=>{let o=e.defaultView?.Image;if(!o){n(new Error("viewer export: Image is unavailable in this environment."));return}let i=new o;i.onload=()=>r(i),i.onerror=()=>n(new Error("viewer export: the SVG snapshot could not be decoded.")),i.src=t})}function AC(e,t,r){return new Promise((n,o)=>{e.toBlob(i=>{i?n(i):o(new Error(`viewer export: ${t} encoding failed.`))},t,r)})}async function yi(e,t,r={}){let n=dr(e),o=$C(r.scale,1),i=Math.max(1,Math.round(n.w*o)),a=Math.max(1,Math.round(n.h*o)),s=e.ownerDocument.createElement("canvas");s.width=i,s.height=a;let l=s.getContext("2d");if(!l)throw new Error("viewer export: a 2D canvas context is unavailable.");let d=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(d);try{let u=await MC(e.ownerDocument,c),m=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);m&&(l.fillStyle=m,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await AC(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var xi="http://www.w3.org/2000/svg";function EC(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function NC(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function cr(e,t,r){let n=e.createElementNS(xi,t);for(let[o,i]of Object.entries(r))n.setAttribute(o,String(i));return n}function OC(e){try{return{...Y,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return Y}}function BC(e,t){let r=Math.max(1,Math.min(e.width,e.height)*.28);return{size:r,plain:t,cellWidth:t?r*.62:r*.72+2,cellHeight:t?r*1.1:r*1.2+2,gap:r*(t?.02:.1)}}function IC(e,t,r){let n=cr(e,"g",{"font-family":r.fontFamily});for(let o of["id","transform","data-sf-id","data-sf-role","data-sf-kind"]){let i=t.getAttribute(o);i!==null&&n.setAttribute(o,i)}return n}function GC(e,t,r,n,o,i){let a=cr(e,"text",{x:r.x+r.width/2,y:n-o.size*.14,"text-anchor":"middle","font-size":o.size*.16,"font-weight":600,"letter-spacing":o.size*.04,fill:i.labelColor});return a.textContent=t,a}function DC(e,t,r,n,o,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=o,c=[];s||c.push(cr(e,"rect",{x:r+.5,y:n+.5,width:l-1,height:d-1,rx:a*.09,fill:i.surface,stroke:i.divider,"stroke-width":1}));let u=cr(e,"text",{x:r+l/2,y:n+d/2,"text-anchor":"middle","dominant-baseline":"central","font-size":a,"font-weight":i.fontWeight,fill:i.color});return u.textContent=t,c.push(u),s||c.push(cr(e,"line",{x1:r+.5,x2:r+l-.5,y1:n+d/2,y2:n+d/2,stroke:i.divider,"stroke-width":1})),c}function _C(e){let t=e.ownerDocument;for(let r of e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')){let n={x:Number(r.getAttribute("x")),y:Number(r.getAttribute("y")),width:Number(r.getAttribute("width")),height:Number(r.getAttribute("height"))},o=r.getAttribute("data-sf-widget-value")??"",i=OC(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=BC(n,i.variant==="plain"),l=a?s.size*.3:0,d=o.length*s.cellWidth+Math.max(0,o.length-1)*s.gap,c=n.x+(n.width-d)/2,u=n.y+(n.height-(l+s.cellHeight))/2+l,m=IC(t,r,i);a&&m.appendChild(GC(t,a,n,u,s,i)),[...o].forEach((f,g)=>{let b=c+g*(s.cellWidth+s.gap);for(let y of DC(t,f,b,u,s,i))m.appendChild(y)}),r.replaceWith(m)}}function Tm(e,t){let r=e.cloneNode(!0);NC(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(xi,"image");EC(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),_C(r);let o=(r.getAttribute("viewBox")??"").split(/\s+/).map(Number);return o.length===4&&o.every(Number.isFinite)&&(r.setAttribute("width",String(o[2])),r.setAttribute("height",String(o[3]))),r.setAttribute("xmlns",xi),r}function Si(e,t){return new XMLSerializer().serializeToString(Tm(e,t))}var $m="http://www.w3.org/2000/svg";var Ci=new Set([]);function I(e,t){return e.createElementNS($m,t)}function ye(e,t,r){let n=I(e,"g");n.setAttribute("data-sf-selection-overlay",t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}var FC="data-sf-change-overlay",ur="#f59e0b",vn=1300,Ri=400;function Mm(e,t,r){let n=I(e,"g");n.setAttribute(FC,t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}function ki(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:vn,easing:"linear",fill:"forwards"})}function wi(e,t,r,n=ur){let o=t.getBBox(),i=Mm(e,r,t),a=I(e,"rect");return a.setAttribute("x",String(o.x-4)),a.setAttribute("y",String(o.y-4)),a.setAttribute("width",String(o.width+8)),a.setAttribute("height",String(o.height+8)),a.setAttribute("fill","none"),a.setAttribute("stroke",n),a.setAttribute("stroke-width","3"),i.appendChild(a),i}function vi(e,t,r,n=ur){let o=Mm(e,r,t),i=I(e,"path");i.setAttribute("d",t.getAttribute("d")??""),i.setAttribute("fill","none"),i.setAttribute("stroke",n);let a=Number(t.getAttribute("stroke-width"))||2;return i.setAttribute("stroke-width",String(a+6)),i.setAttribute("stroke-linecap","round"),i.setAttribute("opacity","0.6"),o.appendChild(i),o}function wt(e){return e.ctrlKey||e.metaKey}function Pn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Ln(e){return e===1}var HC=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function VC(e){return e==="entity"?"shape":e}function Me(e){let t=e.getAttribute(fn);if(!t)return null;let[r,n,o,i]=t.split(",").map(Number);return Number.isFinite(r)&&Number.isFinite(n)&&Number.isFinite(o)&&Number.isFinite(i)?{x:r,y:n,width:o,height:i}:null}function Pi(e){let t=e.getAttribute(hn);if(!t)return null;let r;try{r=JSON.parse(t)}catch{return null}return!Array.isArray(r)||!r.every(n=>Array.isArray(n)&&n.length===2)?null:{points:r,tension:Number(e.getAttribute(gn))||0,closed:e.getAttribute(bn)==="true"}}function Li(e){let t=e.getAttribute(yn);if(t===null)return null;let[r,n,o]=t.split(",").map(Number);if(!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(o))return null;let i=Number(e.getAttribute(sr))||0,[a,s]=(e.getAttribute(xn)??"0,0").split(",").map(Number);return{width:r,height:n,depth:o,cornerRadius:i,bounds:Me(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function Ae(e){let t=e?.closest("[data-sf-id]");if(!t)return null;let r=t.getAttribute("data-sf-id"),n=t.getAttribute("data-sf-role");return!r||!n||!HC.has(n)?null:{role:VC(n),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function ze(e,t,r){let n=e.querySelectorAll(`[data-sf-id="${CSS.escape(t)}"]`);for(let o of n)if(r(o))return o;return null}var Ye=e=>e.hasAttribute("data-sf-primary");function Ti(e){let t=e.getBoundingClientRect(),{width:r,height:n}=e.viewBox.baseVal;if(t.width<=0||r<=0)return 1;let o=t.width/r;return t.height>0&&n>0?Math.min(o,t.height/n):o}function M(e,t){return t/Ti(e)}var Tn=8,WC=15,$i=4,Mi=1.5;function zC(e,t){let r=e.x+e.width/2,n=e.y+e.height/2;return[[r,e.y-t,"top"],[e.x+e.width+t,n,"right"],[r,e.y+e.height+t,"bottom"],[e.x-t,n,"left"]]}function YC(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Am="#e8e8e8",Em="#ccc",jC="#9b42df",UC="#7c2fb5",XC=1.2;function Ai(e,t,r,n,o,i){let a=I(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(n)),a.setAttribute("fill",Am),a.setAttribute("stroke",Em),a.setAttribute("stroke-width",String(o)),a.setAttribute("data-sf-quick-duplicate",i),a.style.pointerEvents="auto",a.style.cursor="pointer",a.style.transition="r 120ms ease, fill 120ms ease, stroke 120ms ease",a.addEventListener("pointerenter",()=>{a.setAttribute("r",String(n*XC)),a.setAttribute("fill",jC),a.setAttribute("stroke",UC),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(n)),a.setAttribute("fill",Am),a.setAttribute("stroke",Em),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function Ei(e,t,r,n,o){let i=I(e,"path");return i.setAttribute("d",YC(t,r,n)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(o)),i.setAttribute("stroke-linecap","round"),i}function $n(e,t,r,n){let o=ye(e,r,t),i=M(n,Tn),a=i+M(n,WC),s=M(n,$i),l=M(n,Mi),d=Me(t)??t.getBBox();for(let[c,u,m]of zC(d,a))o.append(Ai(e,c,u,i,l,m),Ei(e,c,u,s,l));return o}var Bi="#9b42df",qC=2,KC=3.25,ZC=14,Om=34,QC=10.5,JC=8.5;function Nm(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function eR(e){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"><g transform="rotate(${Math.atan2(e.y,e.x)*180/Math.PI} 13 13)" stroke-linejoin="round" stroke-linecap="round"><line x1="4" y1="13" x2="22" y2="13" stroke="white" stroke-width="4.5"/><line x1="4" y1="13" x2="22" y2="13" stroke="black" stroke-width="1.6"/><path d="M4 13 L9.5 8.5 L9.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/><path d="M22 13 L16.5 8.5 L16.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/></g></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 13 13, pointer`}function Ii(e){let t=e.reduce((r,n)=>({x:r.x+n.x,y:r.y+n.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}var Gi="data-sf-iso-halo";function tR(e,t,r,n){let o=I(e,"g");o.setAttribute("data-sf-resize-handle",`iso-${t}`),o.style.cursor=eR(r);let i=I(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(M(n,ZC))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",o.appendChild(i);let a=I(e,"line");a.setAttribute("stroke",Bi),a.setAttribute("stroke-width",String(M(n,KC))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",o.appendChild(a);let s=I(e,"polygon");return s.setAttribute("fill",Bi),s.style.pointerEvents="none",o.appendChild(s),{group:o,hit:i,shaft:a,head:s}}function rR(e,t,r,n){let o=M(n,Om),i=M(n,QC),a=M(n,JC),s={x:t.x+r.x*o,y:t.y+r.y*o},l={x:t.x+r.x*(o-i),y:t.y+r.y*(o-i)},d={x:-r.y,y:r.x},c={x:l.x+d.x*a/2,y:l.y+d.y*a/2},u={x:l.x-d.x*a/2,y:l.y-d.y*a/2};e.hit.setAttribute("x1",String(t.x)),e.hit.setAttribute("y1",String(t.y)),e.hit.setAttribute("x2",String(s.x)),e.hit.setAttribute("y2",String(s.y)),e.shaft.setAttribute("x1",String(t.x)),e.shaft.setAttribute("y1",String(t.y)),e.shaft.setAttribute("x2",String(l.x)),e.shaft.setAttribute("y2",String(l.y)),e.head.setAttribute("points",`${s.x},${s.y} ${c.x},${c.y} ${u.x},${u.y}`)}function Ni(e,t,r,n,o){let i=tR(e,n,r,o);return rR(i,t,r,o),i.group}function Mn(e){let t=Ee(e),r=t.top[0],n=t.top[1],o=t.top[3],i=t.front[2];return{width:{origin:Ii(t.right),direction:Nm({x:n.x-r.x,y:n.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:Ii(t.front),direction:Nm({x:o.x-r.x,y:o.y-r.y})}}}var nR=Om+Tn+10;function Oi(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function Di(e){let t=Ee(e),r=Mn(e),n=Ii([t.top[0],t.top[1],t.top[2],t.top[3],t.front[2],t.front[3],t.right[2]]);return{"iso-width-pos":r.width,"iso-width-neg":{origin:Oi(r.width.origin,n),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:Oi(r.depth.origin,n),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:Oi(r.height.origin,n),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var _i="data-sf-iso-duplicate-bubbles",oR=["iso-height-neg","iso-depth-pos","iso-width-pos"];function Fi(e,t,r){let n=I(e,"g");n.setAttribute(_i,"");let o=M(r,Tn),i=M(r,nR),a=M(r,$i),s=M(r,Mi),l=Di(t);for(let d of oR){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;n.append(Ai(e,m,f,o,s,d),Ei(e,m,f,a,s))}return n}function An(e,t,r,n){let o=Me(t)??t.getBBox(),i=Li(t),a=ye(e,r,t),s=I(e,"path");s.setAttribute(Gi,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",Bi);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+M(n,qC))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=Mn({x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0});return a.appendChild(Ni(e,d.width.origin,d.width.direction,"width",n)),a.appendChild(Ni(e,d.height.origin,d.height.direction,"height",n)),a.appendChild(Ni(e,d.depth.origin,d.depth.direction,"depth",n)),a.appendChild(Fi(e,{x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0},n)),a}var Hi="#9b42df",iR=4,aR=5,Im=1.5;function sR(e,t,r){let n=I(e,"path");n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",Hi);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+M(r,iR))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function Bm(e,t,r,n,o){let i=t.getPointAtLength(r),a=I(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(M(o,aR))),a.setAttribute("fill",Hi),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(M(o,Im))),a.setAttribute("data-sf-link-endpoint",n),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var lR=22,dR=8;function cR(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function uR(e,t,r){let n=[];return cR(t).forEach((o,i)=>{if(!o.movable)return;let a=Math.abs(o.bx-o.ax)>Math.abs(o.by-o.ay),s=M(r,lR),l=M(r,dR),d=a?s:l,c=a?l:s,u=I(e,"rect");u.setAttribute("x",String((o.ax+o.bx)/2-d/2)),u.setAttribute("y",String((o.ay+o.by)/2-c/2)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("rx",String(l/2)),u.setAttribute("fill","white"),u.setAttribute("stroke",Hi),u.setAttribute("stroke-width",String(M(r,Im))),u.setAttribute("data-sf-link-segment",String(i)),u.setAttribute("data-sf-link-segment-axis",a?"y":"x"),u.style.pointerEvents="auto",u.style.cursor=a?"ns-resize":"ew-resize",n.push(u)}),n}function En(e,t,r,n){let o=ye(e,r,t),i=t.getTotalLength();return o.append(sR(e,t,n),...uR(e,t,n),Bm(e,t,0,"from",n),Bm(e,t,i,"to",n)),o}var Gm="#9b42df",mR=4,pR=5,fR=1.5,Vi="data-sf-path-halo";function hR(e,t,r){let n=I(e,"path");n.setAttribute(Vi,""),n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",Gm);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+M(r,mR))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function gR(e,t,r,n,o){let i=I(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(M(o,pR))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",Gm),i.setAttribute("stroke-width",String(M(o,fR))),i.setAttribute(pm,String(n)),i.style.pointerEvents="auto",i.style.cursor="move",i}function Nn(e,t,r,n){let o=ye(e,r,t);o.appendChild(hR(e,t,n));let i=Pi(t);for(let[a,[s,l]]of(i?.points??[]).entries())o.appendChild(gR(e,s,l,a,n));return o}var bR=6,yR=1,xR="#992dff",SR={"top-left":"nwse-resize",top:"ns-resize","top-right":"nesw-resize",right:"ew-resize","bottom-right":"nwse-resize",bottom:"ns-resize","bottom-left":"nesw-resize",left:"ew-resize"};function Wi(e){let t=e.x+e.width/2,r=e.y+e.height/2;return[[e.x,e.y,"top-left"],[t,e.y,"top"],[e.x+e.width,e.y,"top-right"],[e.x+e.width,r,"right"],[e.x+e.width,e.y+e.height,"bottom-right"],[t,e.y+e.height,"bottom"],[e.x,e.y+e.height,"bottom-left"],[e.x,r,"left"]]}var CR=new Set(["top","bottom"]);function Dm(e,t,r,n=!1){let o=M(r,bR),i=M(r,yR);return(n?Wi(t).filter(([,,s])=>!CR.has(s)):Wi(t)).map(([s,l,d])=>{let c=I(e,"rect");return c.setAttribute("x",String(s-o/2)),c.setAttribute("y",String(l-o/2)),c.setAttribute("width",String(o)),c.setAttribute("height",String(o)),c.setAttribute("fill","white"),c.setAttribute("stroke",xR),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=n?"ew-resize":SR[d],c})}var RR="#9b42df",kR=3,wR=1;function On(e,t,r,n,o=!1){let i=Me(t)??t.getBBox(),a=ye(e,r,t),s=M(n,wR),l=I(e,"rect");return l.setAttribute("x",String(i.x-s)),l.setAttribute("y",String(i.y-s)),l.setAttribute("width",String(i.width+s*2)),l.setAttribute("height",String(i.height+s*2)),l.setAttribute("fill","none"),l.setAttribute("stroke",RR),l.setAttribute("stroke-width",String(M(n,kR))),a.appendChild(l),a.append(...Dm(e,i,n,o)),a}function _m(e){let t=new Map;return{flash:(n,o=ur)=>{let i=[...new Set(n)];if(i.length===0)return;let a=e.ownerDocument,s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;for(let l of i){let d=ze(e,l,Ye);if(!d)continue;let c=t.get(l);c&&clearTimeout(c);for(let f of e.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(l)}"]`))f.remove();let u=d.getAttribute("data-sf-role")==="link"?vi(a,d,l,o):wi(a,d,l,o);e.appendChild(u),ki(u,s);let m=s?Ri:vn;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let n of t.values())clearTimeout(n);t.clear()}}}function Fm(e,t,r){let n=o=>{r&&o.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}function zi(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function Hm(e,t){switch(t.type){case"clear":return new Set;case"set":return new Set(t.ids);case"select":return new Set([t.id]);case"add":return new Set([...e,t.id]);case"toggle":{let r=new Set(e);return r.has(t.id)?r.delete(t.id):r.add(t.id),r}}}function Vm(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var TR="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function Yi(e){return!!e?.closest(TR)}var Bn=class{#t;#n;#e;#r;constructor(t,r,n,o){this.#t=t,this.#n=r,this.#e=n,this.#r=o}hover(t){let r=Ae(t.target);this.#n.emit("ownerHover",r?{diagramId:this.#e,owner:r,modifiers:zi(t)}:{diagramId:this.#e,owner:null})}select(t){let r=t.target,n=Ae(r);if(!n){this.#o(r);return}this.#i(n,t)}#o(t){Yi(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let n=zi(r);this.#r.dispatch(Vm(t.id,n)),this.#n.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#e,owner:t,modifiers:n});let o=ze(this.#t,t.id,Ye);o&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","-1"),o?.focus({preventScroll:!0})}};var $R=4,ji=class{#t;#n;#e;#r=null;constructor(t,r,n){this.#t=t,this.#n=r,this.#e=n}bind(){return this.#t.svg.addEventListener("pointerdown",this.#o),this.#t.svg.addEventListener("pointermove",this.#i),this.#t.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#o=t=>{let r=t.target,n=!!Ae(r)||Yi(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:wt(t)||!n}};#i=t=>{this.#a(t)||this.#e&&this.#n.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#e&&this.#n.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>$R&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&wt(t)&&this.#t.panBy(t.movementX,t.movementY),!0)}#l(){this.#t.svg.removeEventListener("pointerdown",this.#o),this.#t.svg.removeEventListener("pointermove",this.#i),this.#t.svg.removeEventListener("pointerup",this.#s)}};function Wm(e){let{display:t,emitter:r,diagramId:n,selection:o,selectable:i}=e,a=new Bn(t.svg,r,n,o);return new ji(t,a,i).bind()}function Ui(e,t,r){for(let o of e.querySelectorAll("[data-sf-selection-overlay]"))o.remove();let n=e.ownerDocument;for(let o of t){let i=ze(e,o,Ye);if(!i)continue;let a=r.get(o),s=a?.role==="link"?En(n,i,o,e):a?.role==="path"?Nn(n,i,o,e):a?.role==="isometric"?An(n,i,o,e):On(n,i,o,e,a?Ci.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild($n(n,i,o,e))}}var In=class{#t;#n;#e;#r=new Map;#o=new Set;constructor(t,r,n){this.#t=t,this.#n=r,this.#e=n}getOwners(){return[...this.#o].map(t=>this.#r.get(t)).filter(t=>!!t)}remember(t){this.#r.set(t.id,t)}dispatch(t){this.#o=Hm(this.#o,t),Ui(this.#t,this.#o,this.#r),this.#n.emit("selectionChange",{diagramId:this.#e,selection:this.getOwners()})}repaint(){this.#o.size>0&&Ui(this.#t,this.#o,this.#r)}selectIds(t){for(let r of t){let n=this.#t.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),o=Ae(n);o&&this.remember(o)}this.dispatch({type:"set",ids:t})}};function zm(e,t){let r=n=>{wt(n)&&(n.preventDefault(),e.zoomBy(n.deltaY<0?1.1:.9090909090909091,n.clientX,n.clientY),t.repaint())};return e.svg.addEventListener("wheel",r,{passive:!1}),()=>{e.svg.removeEventListener("wheel",r)}}function Ym(e,t,r,n={}){let o=n.selectable??!0,i=new In(e.svg,t,r),a=Wm({display:e,emitter:t,diagramId:r,selection:i,selectable:o}),s=zm(e,i),l=Fm(e.svg,i,o),d=_m(e.svg);return{getSelection:()=>i.getOwners(),select:c=>i.selectIds(c),repaint:()=>i.repaint(),flashChanged:(c,u)=>d.flash(c,u),destroy(){a(),s(),l(),d.destroy()}}}var Xi={numbers:{intensity:.85,speed:.18,progress:-1,boost:0,dent:-1,day:-1,light:135,gloss:.15,depth:.4,rim:.2},colors:{color:[.08,.02,.22],accent:[.58,.31,1],hot:[1,.45,.82]}};var MR=`
|
|
19
|
+
precision highp float;
|
|
20
|
+
|
|
21
|
+
uniform vec2 uResolution;
|
|
22
|
+
uniform float uLight;
|
|
23
|
+
uniform float uGloss;
|
|
24
|
+
uniform float uDepth;
|
|
25
|
+
uniform float uRim;
|
|
26
|
+
uniform float uPressed;
|
|
27
|
+
uniform vec3 uColor;
|
|
28
|
+
varying vec2 vUv;
|
|
29
|
+
|
|
30
|
+
void main() {
|
|
31
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
32
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
33
|
+
float pixel = 2.0 / max(uResolution.y, 1.0);
|
|
34
|
+
float pressed = clamp(uPressed, 0.0, 1.0);
|
|
35
|
+
|
|
36
|
+
float radius = 0.9 * (1.0 - 0.025 * pressed);
|
|
37
|
+
float r = length(p);
|
|
38
|
+
vec2 direction = r > 0.0001 ? p / r : vec2(0.0, 1.0);
|
|
39
|
+
float angle = radians(uLight);
|
|
40
|
+
vec2 toLight = vec2(cos(angle), sin(angle));
|
|
41
|
+
vec3 light = normalize(vec3(toLight, 0.85));
|
|
42
|
+
|
|
43
|
+
vec3 base = dot(uColor, uColor) > 0.0 ? uColor : vec3(0.15, 0.15, 0.17);
|
|
44
|
+
float depth = max(uDepth, 0.0) * (1.0 - 0.65 * pressed);
|
|
45
|
+
float inside = clamp(r / radius, 0.0, 1.0);
|
|
46
|
+
|
|
47
|
+
vec3 normal = normalize(vec3(direction * pow(inside, 1.6) * depth * 1.4, 1.0));
|
|
48
|
+
float diffuse = clamp(dot(normal, light), 0.0, 1.0);
|
|
49
|
+
vec3 color = base * (0.5 + 0.7 * diffuse) * (1.0 - 0.18 * pressed);
|
|
50
|
+
|
|
51
|
+
vec3 reflected = reflect(-light, normal);
|
|
52
|
+
float specular = pow(max(reflected.z, 0.0), 26.0) * max(uGloss, 0.0) * (1.0 - 0.8 * pressed);
|
|
53
|
+
color += vec3(specular) * 0.9;
|
|
54
|
+
|
|
55
|
+
float lit = max(dot(direction, toLight), 0.0);
|
|
56
|
+
float away = max(dot(direction, -toLight), 0.0);
|
|
57
|
+
float edge = smoothstep(0.55, 1.0, inside);
|
|
58
|
+
color *= 1.0 - 0.45 * edge * away * min(depth, 1.5) - 0.12 * edge;
|
|
59
|
+
color += mix(base, vec3(1.0), 0.6) * max(uRim, 0.0) * smoothstep(0.9, 1.0, inside) * lit * (1.0 - 0.7 * pressed);
|
|
60
|
+
|
|
61
|
+
float disc = 1.0 - smoothstep(radius - pixel, radius + pixel, r);
|
|
62
|
+
|
|
63
|
+
vec2 shadowAt = -toLight * 0.06 * (1.0 - 0.7 * pressed);
|
|
64
|
+
float shadowDistance = length(p - shadowAt);
|
|
65
|
+
float shadow = (1.0 - smoothstep(radius * 0.55, 0.99, shadowDistance)) * 0.55 * (1.0 - 0.4 * pressed);
|
|
66
|
+
|
|
67
|
+
float alpha = clamp(disc + shadow * (1.0 - disc), 0.0, 1.0);
|
|
68
|
+
gl_FragColor = vec4(clamp(color * disc, 0.0, 1.0), alpha);
|
|
69
|
+
}
|
|
70
|
+
`,jm={name:"button",fragmentSource:MR,replacesBaseFill:!0};var AR=`
|
|
71
|
+
precision highp float;
|
|
72
|
+
|
|
73
|
+
uniform sampler2D uBackdrop;
|
|
74
|
+
uniform vec2 uBackdropOrigin;
|
|
75
|
+
uniform vec2 uBackdropScale;
|
|
76
|
+
uniform vec2 uResolution;
|
|
77
|
+
uniform float uTime;
|
|
78
|
+
uniform float uSpeed;
|
|
79
|
+
uniform float uIntensity;
|
|
80
|
+
uniform float uThickness;
|
|
81
|
+
uniform float uRefraction;
|
|
82
|
+
uniform vec3 uPinkColor;
|
|
83
|
+
uniform vec3 uVioletColor;
|
|
84
|
+
uniform vec3 uBlueColor;
|
|
85
|
+
uniform vec3 uEdgeColor;
|
|
86
|
+
varying vec2 vUv;
|
|
87
|
+
|
|
88
|
+
float bell(float value, float width) {
|
|
89
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void main() {
|
|
93
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
94
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
95
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
96
|
+
float depth = mix(0.025, 0.105, clamp(uThickness, 0.0, 1.0));
|
|
97
|
+
float radius = 0.79;
|
|
98
|
+
float distance = length(p) - radius;
|
|
99
|
+
float pixel = 2.0 / max(min(uResolution.x, uResolution.y), 1.0);
|
|
100
|
+
float alpha = 1.0 - smoothstep(-pixel, pixel, distance);
|
|
101
|
+
if (alpha < 0.001) discard;
|
|
102
|
+
|
|
103
|
+
float edge = smoothstep(0.66, 0.995, length(p) / radius);
|
|
104
|
+
vec2 normal = p / max(length(p), 0.001);
|
|
105
|
+
vec2 opticalWarp = normal * edge * max(uRefraction, 0.0) * 0.12;
|
|
106
|
+
opticalWarp += vec2(sin(p.y * 8.0 + time * 0.35), cos(p.x * 7.0 - time * 0.27)) * 0.002;
|
|
107
|
+
vec2 backdropUv = clamp(uBackdropOrigin + (vUv + opticalWarp) * uBackdropScale, 0.001, 0.999);
|
|
108
|
+
vec3 backdrop = texture2D(uBackdrop, backdropUv).rgb;
|
|
109
|
+
|
|
110
|
+
float wave = sin(p.x * 3.1 - time * 0.38) * 0.025;
|
|
111
|
+
float pinkBand = bell(p.y - 0.42 + wave, 0.20);
|
|
112
|
+
float pinkShelf = smoothstep(0.16, 0.30, p.y + wave);
|
|
113
|
+
float whiteCap = smoothstep(0.59, 0.75, p.y + wave) * 0.95;
|
|
114
|
+
vec3 face = backdrop * 0.19 + vec3(0.004, 0.002, 0.011);
|
|
115
|
+
face += uVioletColor * bell(p.y + 0.56, 0.18) * 0.10;
|
|
116
|
+
face += uBlueColor * bell(p.x - 0.49, 0.18) * bell(p.y + 0.22, 0.39) * 0.09;
|
|
117
|
+
face += uPinkColor * pinkBand * pinkShelf * 1.05;
|
|
118
|
+
face += uEdgeColor * whiteCap * 0.88;
|
|
119
|
+
|
|
120
|
+
float left = 1.0 - smoothstep(-0.68, -0.34, p.x);
|
|
121
|
+
float right = smoothstep(0.36, 0.68, p.x);
|
|
122
|
+
float upper = smoothstep(0.0, 0.58, p.y);
|
|
123
|
+
float lower = 1.0 - smoothstep(-0.52, -0.04, p.y);
|
|
124
|
+
float rim = bell(distance + 0.004, 0.007);
|
|
125
|
+
float bevel = bell(distance + depth * 0.55, depth * 0.48);
|
|
126
|
+
float innerArc = bell(distance + depth * 1.13, depth * 0.23) * right * lower;
|
|
127
|
+
face += uEdgeColor * rim * (0.61 + 0.35 * upper);
|
|
128
|
+
face += uPinkColor * bevel * (0.18 + 0.58 * left * upper);
|
|
129
|
+
face += uBlueColor * bevel * right * lower * 0.49;
|
|
130
|
+
face += uVioletColor * innerArc * 0.27;
|
|
131
|
+
face += uEdgeColor * bell(distance + depth * 1.3, depth * 0.31) * left * upper * 0.22;
|
|
132
|
+
float movingGlint = bell(p.x + 0.42 - sin(time * 0.47) * 0.075, 0.055);
|
|
133
|
+
face += uEdgeColor * movingGlint * bell(p.y - 0.26, 0.48) * left * 0.15;
|
|
134
|
+
gl_FragColor = vec4(clamp(face * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
|
|
135
|
+
}
|
|
136
|
+
`,Um={name:"chromaticGlassPlate",fragmentSource:AR,usesBackdrop:!0,replacesBaseFill:!0};var ER=`
|
|
137
|
+
precision highp float;
|
|
138
|
+
|
|
139
|
+
uniform vec2 uResolution;
|
|
140
|
+
uniform float uTime;
|
|
141
|
+
uniform float uSpeed;
|
|
142
|
+
uniform float uIntensity;
|
|
143
|
+
uniform float uRingRadius;
|
|
144
|
+
uniform float uRingWidth;
|
|
145
|
+
uniform float uBloom;
|
|
146
|
+
uniform float uMotion;
|
|
147
|
+
uniform bool uLightMode;
|
|
148
|
+
uniform vec3 uWarmColor;
|
|
149
|
+
uniform vec3 uCoolColor;
|
|
150
|
+
uniform vec3 uAccentColor;
|
|
151
|
+
uniform vec3 uHighlightColor;
|
|
152
|
+
varying vec2 vUv;
|
|
153
|
+
|
|
154
|
+
float bell(float value, float width) {
|
|
155
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
float displacedRing(vec2 point, float radius, float width, float phase, float time, float motion) {
|
|
159
|
+
float angle = atan(point.y, point.x);
|
|
160
|
+
float wave = sin(angle * 2.0 + phase + time * 0.4) * 0.052;
|
|
161
|
+
wave += sin(angle * 3.0 - phase * 0.45 + time * 0.27) * 0.025;
|
|
162
|
+
wave += sin(angle * 6.0 - phase * 0.7 - time * 0.23) * 0.011;
|
|
163
|
+
return bell(length(point) - radius - wave * motion, width);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
void main() {
|
|
167
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
168
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
169
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
170
|
+
float radius = clamp(uRingRadius, 0.25, 0.88);
|
|
171
|
+
float width = max(uRingWidth, 0.025);
|
|
172
|
+
float motion = max(uMotion, 0.0);
|
|
173
|
+
|
|
174
|
+
vec2 coolOffset = vec2(-0.052, -0.012) * (0.7 + motion * 0.3);
|
|
175
|
+
vec2 warmOffset = vec2(0.042, 0.024) * (0.7 + motion * 0.3);
|
|
176
|
+
vec2 accentOffset = vec2(0.016, -0.044) * (0.7 + motion * 0.3);
|
|
177
|
+
float coolRing = displacedRing(p + coolOffset, radius, width * 1.18, 0.4, time, motion);
|
|
178
|
+
float warmRing = displacedRing(p + warmOffset, radius, width * 1.05, 2.6, time, motion);
|
|
179
|
+
float accentRing = displacedRing(p + accentOffset, radius, width, 4.8, time, motion);
|
|
180
|
+
float coreRing = displacedRing(p, radius, width * 0.48, 1.7, time, motion);
|
|
181
|
+
|
|
182
|
+
vec3 color = uCoolColor * coolRing * 0.72;
|
|
183
|
+
color += uWarmColor * warmRing * 0.68;
|
|
184
|
+
color += uAccentColor * accentRing * 0.64;
|
|
185
|
+
if (!uLightMode) {
|
|
186
|
+
color += uHighlightColor * coreRing * 1.35;
|
|
187
|
+
}
|
|
188
|
+
float broadBloom = displacedRing(p, radius, width * 2.35, 0.0, time, motion);
|
|
189
|
+
color += mix(uCoolColor, uWarmColor, smoothstep(-0.8, 0.8, p.y)) * broadBloom * max(uBloom, 0.0) * 0.2;
|
|
190
|
+
|
|
191
|
+
float ringAlpha = max(max(coolRing, warmRing), max(accentRing, coreRing));
|
|
192
|
+
float alpha = clamp(ringAlpha * 0.9 + broadBloom * max(uBloom, 0.0) * 0.18, 0.0, 1.0);
|
|
193
|
+
if (uLightMode) {
|
|
194
|
+
color = mix(color, uHighlightColor, smoothstep(0.16, 0.82, coreRing));
|
|
195
|
+
}
|
|
196
|
+
float circleMask = 1.0 - smoothstep(0.965, 1.0, length(p));
|
|
197
|
+
alpha *= circleMask * max(uIntensity, 0.0);
|
|
198
|
+
color *= circleMask * max(uIntensity, 0.0);
|
|
199
|
+
|
|
200
|
+
gl_FragColor = vec4(clamp(color, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
|
|
201
|
+
}
|
|
202
|
+
`,Xm={name:"chromaticHalo",fragmentSource:ER};var NR=`
|
|
203
|
+
precision highp float;
|
|
204
|
+
|
|
205
|
+
uniform float uTime;
|
|
206
|
+
uniform float uSpeed;
|
|
207
|
+
uniform float uIntensity;
|
|
208
|
+
uniform float uGlow;
|
|
209
|
+
uniform float uDay;
|
|
210
|
+
uniform vec3 uTopColor;
|
|
211
|
+
uniform vec3 uMiddleColor;
|
|
212
|
+
uniform vec3 uBottomColor;
|
|
213
|
+
uniform vec3 uRimColor;
|
|
214
|
+
varying vec2 vUv;
|
|
215
|
+
|
|
216
|
+
void main() {
|
|
217
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
218
|
+
float radius = length(p);
|
|
219
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
220
|
+
float glow = max(uGlow, 0.0);
|
|
221
|
+
float intensity = max(uIntensity, 0.0);
|
|
222
|
+
|
|
223
|
+
float current = sin(p.x * 4.2 - time * 0.75) * 0.025;
|
|
224
|
+
current += sin(p.y * 5.0 + p.x * 2.3 + time * 0.55) * 0.018;
|
|
225
|
+
float vertical = p.y + current;
|
|
226
|
+
float useDay = step(0.0, uDay);
|
|
227
|
+
float day = clamp(uDay, 0.0, 1.0);
|
|
228
|
+
float capStart = mix(-0.04, -0.62 + day * 0.98, useDay);
|
|
229
|
+
float tone = mix(1.0, mix(0.2, 1.2, day), useDay);
|
|
230
|
+
vec3 bodyColor = mix(uBottomColor, uMiddleColor, smoothstep(-0.69, -0.06, vertical)) * tone;
|
|
231
|
+
bodyColor = mix(bodyColor, uTopColor, smoothstep(capStart, capStart + 0.42, vertical));
|
|
232
|
+
|
|
233
|
+
float side = smoothstep(0.35, 0.9, abs(p.x) / max(radius, 0.001));
|
|
234
|
+
float lower = 1.0 - smoothstep(-0.35, 0.38, p.y);
|
|
235
|
+
float ring = exp(-pow((radius - 0.765) / 0.03, 2.0));
|
|
236
|
+
float rimLight = ring * (0.28 + side * 0.55 + lower * 0.52) * mix(1.0, 0.35 + 0.65 * day, useDay);
|
|
237
|
+
float crest = ring * smoothstep(0.3, 0.68, p.y) * mix(1.0, 0.15 + 0.85 * day, useDay);
|
|
238
|
+
bodyColor = mix(bodyColor, uRimColor, clamp(rimLight * 0.78 * intensity, 0.0, 1.0));
|
|
239
|
+
bodyColor = mix(bodyColor, vec3(1.0, 0.94, 0.86), clamp(crest * 0.84 * intensity, 0.0, 1.0));
|
|
240
|
+
|
|
241
|
+
float bodyAlpha = 1.0 - smoothstep(0.758, 0.778, radius);
|
|
242
|
+
float halo = exp(-pow(max(radius - 0.765, 0.0) / 0.12, 2.0));
|
|
243
|
+
halo *= (0.14 + rimLight * 0.28 + crest * 0.2) * glow * intensity;
|
|
244
|
+
float crownGlow = exp(-pow(p.x / 0.48, 2.0) - pow((p.y - 0.83) / 0.16, 2.0));
|
|
245
|
+
halo += crownGlow * 0.16 * glow * intensity;
|
|
246
|
+
float outsideAlpha = clamp(halo, 0.0, 0.85) * (1.0 - smoothstep(0.84, 1.0, radius));
|
|
247
|
+
vec3 haloColor = mix(uRimColor, vec3(1.0, 0.91, 0.77), crest * 0.55 + crownGlow * 0.45);
|
|
248
|
+
float alpha = bodyAlpha + (1.0 - bodyAlpha) * outsideAlpha;
|
|
249
|
+
vec3 premultipliedColor = bodyColor * bodyAlpha;
|
|
250
|
+
premultipliedColor += haloColor * (1.0 - bodyAlpha) * outsideAlpha;
|
|
251
|
+
|
|
252
|
+
gl_FragColor = vec4(premultipliedColor, alpha);
|
|
253
|
+
}
|
|
254
|
+
`,qm={name:"eclipseOrb",fragmentSource:NR};var OR=`
|
|
255
|
+
precision highp float;
|
|
256
|
+
|
|
257
|
+
uniform vec2 uResolution;
|
|
258
|
+
uniform float uTime;
|
|
259
|
+
uniform float uSpeed;
|
|
260
|
+
uniform float uIntensity;
|
|
261
|
+
uniform float uCellCount;
|
|
262
|
+
uniform float uGrain;
|
|
263
|
+
uniform vec3 uBaseColor;
|
|
264
|
+
uniform vec3 uTopColor;
|
|
265
|
+
uniform vec3 uCoreColor;
|
|
266
|
+
uniform vec3 uBottomColor;
|
|
267
|
+
uniform vec3 uCoolColor;
|
|
268
|
+
varying vec2 vUv;
|
|
269
|
+
|
|
270
|
+
float band(float distance, float width) {
|
|
271
|
+
return exp(-pow(distance / width, 2.0));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
float pixelNoise(vec2 uv) {
|
|
275
|
+
vec2 pixel = floor(uv * uResolution);
|
|
276
|
+
return fract(sin(dot(pixel, vec2(127.1, 311.7))) * 43758.5453);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
void main() {
|
|
280
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
281
|
+
float radius = length(p);
|
|
282
|
+
if (radius >= 1.0) discard;
|
|
283
|
+
|
|
284
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
285
|
+
float cells = max(uCellCount, 1.0);
|
|
286
|
+
vec2 grid = (p + 1.0) * cells * 0.5;
|
|
287
|
+
vec2 cell = fract(grid) - 0.5;
|
|
288
|
+
vec2 samplePoint = (floor(grid) + 0.5) * 2.0 / cells - 1.0;
|
|
289
|
+
vec2 q = samplePoint;
|
|
290
|
+
q.x += sin(samplePoint.y * 3.4 + time * 0.34) * 0.035;
|
|
291
|
+
q.y += sin(samplePoint.x * 4.0 - time * 0.29) * 0.045;
|
|
292
|
+
|
|
293
|
+
float upperCurve = 0.56 + 0.11 * sin(q.x * 3.1 + time * 0.41);
|
|
294
|
+
float topLight = band(q.y - upperCurve, 0.25) * (0.48 + 0.52 * abs(q.x));
|
|
295
|
+
topLight += band(q.x + 0.77, 0.28) * band(q.y - 0.46, 0.35) * 0.58;
|
|
296
|
+
topLight += band(q.x - 0.76, 0.28) * band(q.y - 0.43, 0.36) * 0.68;
|
|
297
|
+
topLight *= 1.0 - band(q.x + 0.02, 0.45) * band(q.y - 0.78, 0.28) * 0.88;
|
|
298
|
+
|
|
299
|
+
float coreLight = band(q.x + 0.02 + 0.08 * sin(time * 0.28), 0.58);
|
|
300
|
+
coreLight *= band(q.y + 0.19 + 0.07 * sin(q.x * 3.0 - time * 0.31), 0.44);
|
|
301
|
+
float bottomLight = band(q.y + 0.82, 0.38) * band(q.x - 0.02, 0.85);
|
|
302
|
+
float coolLight = band(q.x + 0.79, 0.31) * band(q.y + 0.03, 0.29);
|
|
303
|
+
coolLight += band(q.x - 0.89, 0.23) * band(q.y + 0.02, 0.25) * 0.48;
|
|
304
|
+
|
|
305
|
+
float centerCut = band(q.y - 0.12 + 0.08 * sin(q.x * 3.2 + time * 0.33), 0.16);
|
|
306
|
+
centerCut *= band(q.x + 0.03, 0.99);
|
|
307
|
+
float rightCut = band(q.x - 0.68, 0.35) * band(q.y + 0.37, 0.26);
|
|
308
|
+
float occlusion = clamp(centerCut * 0.78 + rightCut * 0.79, 0.0, 0.9);
|
|
309
|
+
|
|
310
|
+
vec3 color = uBaseColor;
|
|
311
|
+
color += uTopColor * topLight * 0.91;
|
|
312
|
+
color += uCoreColor * coreLight * 1.05;
|
|
313
|
+
color += uBottomColor * bottomLight * 0.86;
|
|
314
|
+
color += uCoolColor * coolLight * 0.68;
|
|
315
|
+
color *= 1.0 - occlusion;
|
|
316
|
+
|
|
317
|
+
float squareRadius = max(abs(cell.x), abs(cell.y));
|
|
318
|
+
float dot = 1.0 - smoothstep(0.23, 0.43, squareRadius);
|
|
319
|
+
color *= 0.21 + dot * 0.79;
|
|
320
|
+
float noise = (pixelNoise(vUv) - 0.5) * max(uGrain, 0.0);
|
|
321
|
+
color += vec3(noise) * (0.25 + dot * 0.75);
|
|
322
|
+
|
|
323
|
+
float edge = 1.0 - smoothstep(0.955, 0.995, radius);
|
|
324
|
+
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
|
|
325
|
+
}
|
|
326
|
+
`,Km={name:"emberMatrix",fragmentSource:OR};var BR=`
|
|
327
|
+
precision highp float;
|
|
328
|
+
|
|
329
|
+
uniform vec2 uResolution;
|
|
330
|
+
uniform float uTime;
|
|
331
|
+
uniform float uSpeed;
|
|
332
|
+
uniform float uIntensity;
|
|
333
|
+
uniform float uSlitCount;
|
|
334
|
+
uniform float uOrientation;
|
|
335
|
+
uniform bool uHole;
|
|
336
|
+
uniform float uHoleSize;
|
|
337
|
+
uniform float uGlow;
|
|
338
|
+
uniform float uMotion;
|
|
339
|
+
uniform vec3 uHotColor;
|
|
340
|
+
uniform vec3 uCoreColor;
|
|
341
|
+
uniform vec3 uHighlightColor;
|
|
342
|
+
varying vec2 vUv;
|
|
343
|
+
|
|
344
|
+
float bell(float value, float width) {
|
|
345
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
void main() {
|
|
349
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
350
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
351
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
352
|
+
float motion = max(uMotion, 0.0);
|
|
353
|
+
float radius = length(p);
|
|
354
|
+
|
|
355
|
+
float wave = sin(p.y * 6.4 - time * 0.9) * 0.04 * motion;
|
|
356
|
+
wave += sin(p.x * 5.1 + time * 0.6) * 0.026 * motion;
|
|
357
|
+
float ringRadius = length(p + vec2(wave, 0.0));
|
|
358
|
+
float holeSize = clamp(uHoleSize, 0.0, 0.72);
|
|
359
|
+
float ring = uHole ? smoothstep(holeSize - 0.08, holeSize + 0.08, ringRadius) : 1.0;
|
|
360
|
+
ring *= 1.0 - smoothstep(0.65, 0.83, ringRadius);
|
|
361
|
+
float ringCore = bell(ringRadius - 0.56, 0.19);
|
|
362
|
+
|
|
363
|
+
float count = clamp(uSlitCount, 12.0, 90.0);
|
|
364
|
+
vec2 slitPoint = uOrientation < 0.5 ? p : vec2(p.y, p.x);
|
|
365
|
+
float phase = slitPoint.x * count * 3.14159265;
|
|
366
|
+
phase += sin(slitPoint.y * 3.6 - time * 0.95) * 0.75 * motion;
|
|
367
|
+
phase += time * 2.2 * motion;
|
|
368
|
+
float bars = pow(0.5 + 0.5 * cos(phase), 1.9);
|
|
369
|
+
float slit = 0.12 + 0.88 * bars;
|
|
370
|
+
float sideFade = 1.0 - smoothstep(0.67, 0.91, abs(p.x));
|
|
371
|
+
|
|
372
|
+
float upperLight = bell(p.y - 0.45 - sin(time * 0.6) * 0.1 * motion, 0.21);
|
|
373
|
+
float lowerLight = bell(p.y + 0.48 + sin(time * 0.5 + 1.7) * 0.1 * motion, 0.24);
|
|
374
|
+
vec3 heat = mix(uHotColor, uCoreColor, smoothstep(-0.57, 0.55, p.y));
|
|
375
|
+
heat = mix(heat, uHighlightColor, upperLight * 0.45 + lowerLight * 0.28);
|
|
376
|
+
float molten = ring * slit * sideFade;
|
|
377
|
+
vec3 color = heat * molten * (0.64 + ringCore * 0.68);
|
|
378
|
+
|
|
379
|
+
float verticalTrail = bell(max(ringRadius - 0.69, 0.0), 0.24);
|
|
380
|
+
verticalTrail *= smoothstep(0.25, 0.75, abs(p.y));
|
|
381
|
+
verticalTrail *= slit * sideFade;
|
|
382
|
+
float bloom = bell(ringRadius - 0.57, 0.29) * ring;
|
|
383
|
+
float glow = max(uGlow, 0.0);
|
|
384
|
+
float glowMask = (verticalTrail * 0.25 + bloom * 0.17) * glow;
|
|
385
|
+
color += heat * glowMask;
|
|
386
|
+
|
|
387
|
+
float frameFade = 1.0 - smoothstep(0.89, 1.0, max(abs(p.x), abs(p.y)));
|
|
388
|
+
float alpha = clamp((molten * 0.92 + glowMask) * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
|
|
389
|
+
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
|
|
390
|
+
}
|
|
391
|
+
`,Zm={name:"emberSlits",fragmentSource:BR};var IR=`
|
|
392
|
+
precision highp float;
|
|
393
|
+
|
|
394
|
+
uniform sampler2D uBackdrop;
|
|
395
|
+
uniform vec2 uBackdropOrigin;
|
|
396
|
+
uniform vec2 uBackdropScale;
|
|
397
|
+
uniform vec2 uResolution;
|
|
398
|
+
uniform float uTime;
|
|
399
|
+
uniform float uSpeed;
|
|
400
|
+
uniform float uIntensity;
|
|
401
|
+
uniform float uIor;
|
|
402
|
+
uniform float uRefraction;
|
|
403
|
+
uniform float uRoughness;
|
|
404
|
+
uniform float uChromaticAberration;
|
|
405
|
+
uniform float uEdgeLight;
|
|
406
|
+
uniform vec3 uTint;
|
|
407
|
+
uniform vec3 uEdgeColor;
|
|
408
|
+
varying vec2 vUv;
|
|
409
|
+
|
|
410
|
+
float hash(vec2 point) {
|
|
411
|
+
return fract(sin(dot(point, vec2(127.1, 311.7))) * 43758.5453123);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
float smoothNoise(vec2 point) {
|
|
415
|
+
vec2 cell = floor(point);
|
|
416
|
+
vec2 local = fract(point);
|
|
417
|
+
local = local * local * (3.0 - 2.0 * local);
|
|
418
|
+
float a = hash(cell);
|
|
419
|
+
float b = hash(cell + vec2(1.0, 0.0));
|
|
420
|
+
float c = hash(cell + vec2(0.0, 1.0));
|
|
421
|
+
float d = hash(cell + vec2(1.0, 1.0));
|
|
422
|
+
return mix(mix(a, b, local.x), mix(c, d, local.x), local.y);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
void main() {
|
|
426
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
427
|
+
vec2 sphereOffset = vec2(
|
|
428
|
+
sin(time * 0.72) * 0.04,
|
|
429
|
+
cos(time * 0.56) * 0.026
|
|
430
|
+
);
|
|
431
|
+
float sphereScale = 0.95;
|
|
432
|
+
vec2 p = (vUv * 2.0 - 1.0 - sphereOffset) / sphereScale;
|
|
433
|
+
float radius = length(p);
|
|
434
|
+
if (radius >= 1.0) discard;
|
|
435
|
+
|
|
436
|
+
float roughness = max(uRoughness, 0.0);
|
|
437
|
+
vec2 flow = vec2(
|
|
438
|
+
smoothNoise(p * 2.4 + vec2(0.7, -0.3)),
|
|
439
|
+
smoothNoise(p * 2.8 + vec2(-0.4, 0.8))
|
|
440
|
+
) - 0.5;
|
|
441
|
+
float sphereDepth = sqrt(max(1.0 - radius * radius, 0.0));
|
|
442
|
+
vec2 glassMotion = vec2(
|
|
443
|
+
sin(p.y * 3.2 + 0.6),
|
|
444
|
+
cos(p.x * 2.8 - 0.35)
|
|
445
|
+
) * 0.014;
|
|
446
|
+
vec3 surfaceNormal = normalize(vec3(p + glassMotion + flow * roughness * 0.22, sphereDepth));
|
|
447
|
+
float eta = 1.0 / max(uIor, 1.001);
|
|
448
|
+
vec3 refracted = refract(vec3(0.0, 0.0, -1.0), surfaceNormal, eta);
|
|
449
|
+
vec2 distortion = refracted.xy * max(uRefraction, 0.0);
|
|
450
|
+
distortion += flow * (0.008 + roughness * 0.025);
|
|
451
|
+
|
|
452
|
+
vec2 backdropUv = uBackdropOrigin + vUv * uBackdropScale;
|
|
453
|
+
vec2 refractedUv = clamp(backdropUv + distortion * uBackdropScale, 0.001, 0.999);
|
|
454
|
+
float chroma = max(uChromaticAberration, 0.0) * 0.012;
|
|
455
|
+
vec2 chromaOffset = normalize(distortion + vec2(0.0001)) * chroma * uBackdropScale;
|
|
456
|
+
float red = texture2D(uBackdrop, clamp(refractedUv + chromaOffset, 0.001, 0.999)).r;
|
|
457
|
+
float green = texture2D(uBackdrop, refractedUv).g;
|
|
458
|
+
float blue = texture2D(uBackdrop, clamp(refractedUv - chromaOffset, 0.001, 0.999)).b;
|
|
459
|
+
vec3 sharpBackdrop = vec3(red, green, blue);
|
|
460
|
+
vec2 texel = uBackdropScale / max(uResolution, vec2(1.0));
|
|
461
|
+
vec2 blurOffset = texel * (0.65 + roughness * 5.0);
|
|
462
|
+
vec3 blurredBackdrop = texture2D(uBackdrop, refractedUv + vec2(blurOffset.x, 0.0)).rgb;
|
|
463
|
+
blurredBackdrop += texture2D(uBackdrop, refractedUv - vec2(blurOffset.x, 0.0)).rgb;
|
|
464
|
+
blurredBackdrop += texture2D(uBackdrop, refractedUv + vec2(0.0, blurOffset.y)).rgb;
|
|
465
|
+
blurredBackdrop += texture2D(uBackdrop, refractedUv - vec2(0.0, blurOffset.y)).rgb;
|
|
466
|
+
blurredBackdrop *= 0.25;
|
|
467
|
+
vec3 backdrop = mix(sharpBackdrop, blurredBackdrop, clamp(roughness * 1.15, 0.0, 1.0));
|
|
468
|
+
|
|
469
|
+
float fresnel = pow(1.0 - sphereDepth, 2.35);
|
|
470
|
+
float innerRim = smoothstep(0.72, 0.995, radius);
|
|
471
|
+
vec2 fixedLightPosition = vec2(-0.46, 0.7);
|
|
472
|
+
vec2 surfacePosition = sphereOffset + p * sphereScale * 0.22;
|
|
473
|
+
vec3 lightDirection = normalize(vec3(fixedLightPosition - surfacePosition, 0.62));
|
|
474
|
+
float highlight = pow(max(dot(lightDirection, surfaceNormal), 0.0), 28.0);
|
|
475
|
+
float hotSpot = pow(max(dot(lightDirection, surfaceNormal), 0.0), 92.0);
|
|
476
|
+
float angle = atan(p.y, p.x);
|
|
477
|
+
float lightAngle = atan(lightDirection.y, lightDirection.x);
|
|
478
|
+
float movingRim = 0.68 + 0.32 * sin(angle * 2.0 - lightAngle);
|
|
479
|
+
float rimGlint = pow(max(cos(angle - lightAngle), 0.0), 20.0) * innerRim;
|
|
480
|
+
vec3 color = mix(backdrop, backdrop * uTint, 0.025 + fresnel * 0.09);
|
|
481
|
+
color += uEdgeColor * innerRim * max(uEdgeLight, 0.0) * (0.1 + fresnel * 0.5) * movingRim;
|
|
482
|
+
color += uEdgeColor * rimGlint * max(uEdgeLight, 0.0) * 0.72;
|
|
483
|
+
color += uEdgeColor * highlight * 0.5;
|
|
484
|
+
color += vec3(1.0) * hotSpot * 0.58;
|
|
485
|
+
color += vec3(1.0) * fresnel * 0.05;
|
|
486
|
+
color *= max(uIntensity, 0.0);
|
|
487
|
+
|
|
488
|
+
float edgeWidth = 2.2 / max(min(uResolution.x, uResolution.y), 1.0);
|
|
489
|
+
float edgeAlpha = 1.0 - smoothstep(1.0 - edgeWidth, 1.0, radius);
|
|
490
|
+
vec3 finalColor = clamp(color, 0.0, 1.0) * edgeAlpha;
|
|
491
|
+
gl_FragColor = vec4(finalColor, edgeAlpha);
|
|
492
|
+
}
|
|
493
|
+
`,Qm={name:"glassRefraction",fragmentSource:IR,usesBackdrop:!0};var GR=`
|
|
494
|
+
precision highp float;
|
|
495
|
+
|
|
496
|
+
uniform vec2 uResolution;
|
|
497
|
+
uniform float uTime;
|
|
498
|
+
uniform float uSpeed;
|
|
499
|
+
uniform float uIntensity;
|
|
500
|
+
uniform float uDotCount;
|
|
501
|
+
uniform float uRingRadius;
|
|
502
|
+
uniform float uRingWidth;
|
|
503
|
+
uniform float uGlow;
|
|
504
|
+
uniform float uMotion;
|
|
505
|
+
uniform vec3 uWarmColor;
|
|
506
|
+
uniform vec3 uLightColor;
|
|
507
|
+
uniform vec3 uCoolColor;
|
|
508
|
+
varying vec2 vUv;
|
|
509
|
+
|
|
510
|
+
mat2 rotate(float angle) {
|
|
511
|
+
float sine = sin(angle);
|
|
512
|
+
float cosine = cos(angle);
|
|
513
|
+
return mat2(cosine, -sine, sine, cosine);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
float bell(float value, float width) {
|
|
517
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
void main() {
|
|
521
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
522
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
523
|
+
|
|
524
|
+
float speed = max(uSpeed, 0.0);
|
|
525
|
+
float motion = max(uMotion, 0.0);
|
|
526
|
+
float time = uTime * speed;
|
|
527
|
+
float rotation = time * 0.08 * motion;
|
|
528
|
+
vec2 gridPosition = rotate(rotation) * p;
|
|
529
|
+
float cells = max(uDotCount, 8.0);
|
|
530
|
+
vec2 grid = (gridPosition + 1.0) * cells * 0.5;
|
|
531
|
+
vec2 cell = fract(grid) - 0.5;
|
|
532
|
+
vec2 samplePoint = (floor(grid) + 0.5) * 2.0 / cells - 1.0;
|
|
533
|
+
samplePoint = rotate(-rotation) * samplePoint;
|
|
534
|
+
|
|
535
|
+
float angle = atan(samplePoint.y, samplePoint.x);
|
|
536
|
+
float radius = length(samplePoint);
|
|
537
|
+
float travelingWave = sin(angle * 3.0 - time * 0.72) * 0.024 * motion;
|
|
538
|
+
travelingWave += sin(angle * 7.0 + time * 0.31) * 0.009 * motion;
|
|
539
|
+
float ringRadius = clamp(uRingRadius, 0.2, 0.92) + travelingWave;
|
|
540
|
+
float ringWidth = max(uRingWidth, 0.025);
|
|
541
|
+
float ring = bell(radius - ringRadius, ringWidth);
|
|
542
|
+
|
|
543
|
+
float lowerBloom = bell(samplePoint.x + 0.08, 0.72) * bell(samplePoint.y + 0.56, 0.42);
|
|
544
|
+
float upperArc = bell(radius - ringRadius + 0.025, ringWidth * 0.7) * smoothstep(-0.18, 0.72, samplePoint.y);
|
|
545
|
+
float light = clamp(ring * (0.58 + lowerBloom * 0.64 + upperArc * 0.25), 0.0, 1.0);
|
|
546
|
+
float shimmer = 0.9 + 0.1 * sin(angle * 9.0 + time * 0.48);
|
|
547
|
+
float dotRadius = mix(0.055, 0.43, pow(light, 0.72) * shimmer);
|
|
548
|
+
float dotDistance = length(cell);
|
|
549
|
+
float dot = 1.0 - smoothstep(dotRadius - 0.045, dotRadius + 0.045, dotDistance);
|
|
550
|
+
|
|
551
|
+
float warmWeight = smoothstep(-0.22, 0.72, samplePoint.y);
|
|
552
|
+
warmWeight *= 0.76 + 0.24 * (1.0 - smoothstep(-0.45, 0.72, samplePoint.x));
|
|
553
|
+
float coolWeight = smoothstep(-0.85, 0.42, samplePoint.x);
|
|
554
|
+
coolWeight *= 1.0 - smoothstep(-0.78, 0.3, samplePoint.y);
|
|
555
|
+
vec3 color = mix(uLightColor, uWarmColor, clamp(warmWeight, 0.0, 1.0));
|
|
556
|
+
color = mix(color, uCoolColor, clamp(coolWeight * 0.72, 0.0, 0.82));
|
|
557
|
+
color = mix(color, uLightColor, lowerBloom * ring * 0.58);
|
|
558
|
+
|
|
559
|
+
float circleMask = 1.0 - smoothstep(0.965, 1.0, length(p));
|
|
560
|
+
float dotAlpha = dot * pow(light, 0.82) * smoothstep(0.06, 0.24, light) * circleMask;
|
|
561
|
+
float glow = bell(length(p) - ringRadius, ringWidth * 1.75) * max(uGlow, 0.0) * 0.17;
|
|
562
|
+
glow *= circleMask;
|
|
563
|
+
float alpha = clamp((dotAlpha + glow) * max(uIntensity, 0.0), 0.0, 1.0);
|
|
564
|
+
vec3 glowColor = mix(uWarmColor, uCoolColor, 1.0 - smoothstep(-0.75, 0.55, samplePoint.y));
|
|
565
|
+
vec3 finalColor = color * dotAlpha + glowColor * glow;
|
|
566
|
+
|
|
567
|
+
gl_FragColor = vec4(clamp(finalColor * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
568
|
+
}
|
|
569
|
+
`,Jm={name:"halftoneHalo",fragmentSource:GR};var DR=`
|
|
570
|
+
precision highp float;
|
|
571
|
+
|
|
572
|
+
uniform vec2 uResolution;
|
|
573
|
+
uniform float uTime;
|
|
574
|
+
uniform vec3 uColor;
|
|
575
|
+
uniform vec3 uAccent;
|
|
576
|
+
uniform float uIntensity;
|
|
577
|
+
uniform float uSpeed;
|
|
578
|
+
uniform float uThickness;
|
|
579
|
+
uniform float uProgress;
|
|
580
|
+
uniform float uBoost;
|
|
581
|
+
varying vec2 vUv;
|
|
582
|
+
|
|
583
|
+
const float TWO_PI = 6.28318530718;
|
|
584
|
+
|
|
585
|
+
void main() {
|
|
586
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
587
|
+
float radius = length(p);
|
|
588
|
+
if (radius > 1.0) discard;
|
|
589
|
+
|
|
590
|
+
float angle = atan(p.y, p.x);
|
|
591
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
592
|
+
float controlled = step(0.0, uProgress);
|
|
593
|
+
float progress = clamp(uProgress, 0.0, 1.0);
|
|
594
|
+
float boost = clamp(uBoost, 0.0, 1.0);
|
|
595
|
+
float width = max(uThickness, 0.015);
|
|
596
|
+
float wave = sin(angle * 2.0 - time * 2.4) * 0.5 + 0.5;
|
|
597
|
+
float fineWave = sin(angle * 7.0 + time * 1.15) * 0.5 + 0.5;
|
|
598
|
+
float ringRadius = 0.72 + sin(angle * 3.0 - time * 1.5) * (0.025 + boost * 0.012);
|
|
599
|
+
float ring = exp(-pow((radius - ringRadius) / width, 2.0));
|
|
600
|
+
float outerRim = exp(-pow((radius - 0.94) / 0.025, 2.0));
|
|
601
|
+
|
|
602
|
+
float startAngle = -2.35;
|
|
603
|
+
float sweep = 4.70;
|
|
604
|
+
float arcPosition = mod(startAngle - angle + TWO_PI, TWO_PI);
|
|
605
|
+
float arcHead = progress * sweep;
|
|
606
|
+
float idleTravel = sin(time * 0.82) * 0.025 * (1.0 - boost);
|
|
607
|
+
float displayedHead = clamp(arcHead + idleTravel, 0.0, sweep);
|
|
608
|
+
float arcEdge = 0.025;
|
|
609
|
+
float arcMask = (1.0 - smoothstep(displayedHead - arcEdge, displayedHead + arcEdge, arcPosition));
|
|
610
|
+
arcMask *= 1.0 - step(sweep, arcPosition);
|
|
611
|
+
float arcActive = smoothstep(0.0, 0.012, progress);
|
|
612
|
+
arcMask *= arcActive;
|
|
613
|
+
|
|
614
|
+
float ambientHead = -2.25 + sin(time * 0.45) * 0.35;
|
|
615
|
+
float progressHead = startAngle - displayedHead;
|
|
616
|
+
float headAngle = mix(ambientHead, progressHead, controlled);
|
|
617
|
+
float angleFromHead = atan(sin(angle - headAngle), cos(angle - headAngle));
|
|
618
|
+
float flare = exp(-pow(angleFromHead / (0.18 + boost * 0.035), 2.0));
|
|
619
|
+
flare *= exp(-pow((radius - 0.73) / 0.12, 2.0));
|
|
620
|
+
float ambientBand = ring * (0.32 + wave * 0.38);
|
|
621
|
+
float startDelta = atan(sin(angle - startAngle), cos(angle - startAngle));
|
|
622
|
+
float radialDelta = radius - ringRadius;
|
|
623
|
+
float startCapDistance = length(vec2(radialDelta, startDelta * ringRadius));
|
|
624
|
+
float endCapDistance = length(vec2(radialDelta, angleFromHead * ringRadius));
|
|
625
|
+
float roundedCaps = max(
|
|
626
|
+
exp(-pow(startCapDistance / width, 2.0)),
|
|
627
|
+
exp(-pow(endCapDistance / width, 2.0))
|
|
628
|
+
) * arcActive;
|
|
629
|
+
float progressShape = max(ring * arcMask, roundedCaps);
|
|
630
|
+
float progressBand = progressShape * (0.72 + boost * 0.55);
|
|
631
|
+
float idleBand = ring * (0.16 + wave * 0.16 + fineWave * 0.06);
|
|
632
|
+
float band = mix(ambientBand, idleBand + progressBand, controlled);
|
|
633
|
+
float pulse = 1.0 + boost * (0.18 + sin(time * 8.0) * 0.08);
|
|
634
|
+
float energy = clamp((band + outerRim * (0.24 + boost * 0.12) + flare * (1.35 + boost * 0.55) + fineWave * ring * 0.12) * uIntensity * pulse, 0.0, 1.0);
|
|
635
|
+
vec3 base = uColor * (0.1 + 0.28 * (1.0 - radius));
|
|
636
|
+
vec3 color = mix(base, uAccent, energy);
|
|
637
|
+
color += uAccent * flare * (0.3 + boost * 0.35);
|
|
638
|
+
float alpha = 1.0 - smoothstep(0.96, 1.0, radius);
|
|
639
|
+
gl_FragColor = vec4(color, alpha);
|
|
640
|
+
}
|
|
641
|
+
`,ep={name:"halo",fragmentSource:DR};var _R=`
|
|
642
|
+
precision highp float;
|
|
643
|
+
|
|
644
|
+
uniform float uTime;
|
|
645
|
+
uniform float uSpeed;
|
|
646
|
+
uniform float uIntensity;
|
|
647
|
+
uniform vec3 uBaseColor;
|
|
648
|
+
uniform vec3 uCoolColor;
|
|
649
|
+
uniform vec3 uWarmColor;
|
|
650
|
+
varying vec2 vUv;
|
|
651
|
+
|
|
652
|
+
float band(float distance, float width) {
|
|
653
|
+
return exp(-pow(distance / width, 2.0));
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
void main() {
|
|
657
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
658
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
659
|
+
vec2 q = p;
|
|
660
|
+
q.x += sin(p.y * 4.0 + time * 0.58) * 0.02;
|
|
661
|
+
q.y += sin(p.x * 3.3 - time * 0.43) * 0.013;
|
|
662
|
+
float distance = length(q) - 0.64;
|
|
663
|
+
float body = 1.0 - smoothstep(-0.012, 0.01, distance);
|
|
664
|
+
float nearGlow = band(max(distance, 0.0), 0.19) * 0.62;
|
|
665
|
+
float wideGlow = band(max(distance, 0.0), 0.48) * 0.3;
|
|
666
|
+
float frameFade = 1.0 - smoothstep(0.88, 1.0, length(p));
|
|
667
|
+
float halo = max(nearGlow, wideGlow) * frameFade;
|
|
668
|
+
float alpha = body + (1.0 - body) * halo;
|
|
669
|
+
if (alpha < 0.002) discard;
|
|
670
|
+
|
|
671
|
+
float vertical = 0.5 + 0.5 * q.y;
|
|
672
|
+
float warmWeight = smoothstep(-0.44, 0.42, q.x + q.y * 0.14 + sin(time * 0.62 + q.y * 3.0) * 0.065);
|
|
673
|
+
vec3 glowColor = mix(uCoolColor, uWarmColor, warmWeight);
|
|
674
|
+
float breath = 0.78 + 0.22 * sin(time * 1.12 + q.y * 3.0);
|
|
675
|
+
float rim = band(distance + 0.014, 0.042);
|
|
676
|
+
float edge = band(distance + 0.006, 0.014);
|
|
677
|
+
float bevel = band(distance + 0.092, 0.07);
|
|
678
|
+
|
|
679
|
+
vec3 color = uBaseColor * (0.62 + 0.23 * vertical);
|
|
680
|
+
color += uWarmColor * smoothstep(-0.68, 0.6, q.x) * 0.13;
|
|
681
|
+
color += uWarmColor * band(q.x - 0.38, 0.32) * band(q.y + 0.14, 0.74) * 0.11;
|
|
682
|
+
color += uCoolColor * band(q.x + 0.28, 0.42) * band(q.y - 0.47, 0.35) * 0.11;
|
|
683
|
+
color *= 1.0 - band(q.x - 0.06, 0.3) * band(q.y + 0.2, 0.5) * 0.46;
|
|
684
|
+
color += glowColor * bevel * 0.14;
|
|
685
|
+
color += glowColor * rim * 0.41 * breath;
|
|
686
|
+
color += mix(uCoolColor, vec3(1.0), 0.45) * edge * (1.0 - warmWeight) * 0.43;
|
|
687
|
+
color += mix(uWarmColor, vec3(1.0), 0.38) * edge * warmWeight * 0.45;
|
|
688
|
+
|
|
689
|
+
float topFlare = band(q.y - 0.6, 0.07) * band(q.x + 0.2, 0.28);
|
|
690
|
+
float bottomFlare = band(q.y + 0.61, 0.07) * band(q.x - 0.15, 0.35);
|
|
691
|
+
color += uCoolColor * topFlare * 0.39;
|
|
692
|
+
color += uWarmColor * bottomFlare * 0.31;
|
|
693
|
+
vec3 premultiplied = color * body + glowColor * (1.0 - body) * halo * breath;
|
|
694
|
+
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
695
|
+
}
|
|
696
|
+
`,tp={name:"lumenPortal",fragmentSource:_R};var FR=`
|
|
697
|
+
precision highp float;
|
|
698
|
+
|
|
699
|
+
uniform float uTime;
|
|
700
|
+
uniform float uSpeed;
|
|
701
|
+
uniform float uIntensity;
|
|
702
|
+
uniform vec3 uBaseColor;
|
|
703
|
+
uniform vec3 uCoolColor;
|
|
704
|
+
uniform vec3 uWarmColor;
|
|
705
|
+
uniform vec3 uShadowColor;
|
|
706
|
+
varying vec2 vUv;
|
|
707
|
+
|
|
708
|
+
float band(float distance, float width) {
|
|
709
|
+
return exp(-pow(distance / width, 2.0));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
void main() {
|
|
713
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
714
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
715
|
+
vec2 q = p;
|
|
716
|
+
q.x += sin(p.y * 4.1 + time * 0.55) * 0.013;
|
|
717
|
+
q.y += sin(p.x * 3.4 - time * 0.41) * 0.01;
|
|
718
|
+
float distance = length(q) - 0.65;
|
|
719
|
+
float body = 1.0 - smoothstep(-0.012, 0.012, distance);
|
|
720
|
+
float nearHalo = band(max(distance, 0.0), 0.12) * 0.19;
|
|
721
|
+
float wideHalo = band(max(distance, 0.0), 0.28) * 0.055;
|
|
722
|
+
float frameFade = 1.0 - smoothstep(0.89, 1.0, length(p));
|
|
723
|
+
float outside = max(nearHalo, wideHalo) * frameFade;
|
|
724
|
+
float alpha = body * 0.96 + (1.0 - body) * outside;
|
|
725
|
+
if (alpha < 0.002) discard;
|
|
726
|
+
|
|
727
|
+
float warmWeight = smoothstep(-0.46, 0.47, q.x + q.y * 0.17 + sin(time * 0.58 + q.y * 3.0) * 0.052);
|
|
728
|
+
vec3 rimColor = mix(uCoolColor, uWarmColor, warmWeight);
|
|
729
|
+
float breath = 0.84 + 0.16 * sin(time * 0.91 + q.y * 2.5);
|
|
730
|
+
float innerRim = band(distance + 0.038, 0.052);
|
|
731
|
+
float outerRim = band(distance + 0.002, 0.025);
|
|
732
|
+
float fineEdge = band(distance + 0.008, 0.01);
|
|
733
|
+
float bevelShade = band(distance + 0.11, 0.055);
|
|
734
|
+
|
|
735
|
+
vec3 color = uBaseColor;
|
|
736
|
+
color = mix(color, uCoolColor, band(q.x + 0.27, 0.39) * band(q.y - 0.35, 0.43) * 0.09);
|
|
737
|
+
color = mix(color, uWarmColor, band(q.x - 0.31, 0.43) * band(q.y + 0.31, 0.48) * 0.085);
|
|
738
|
+
color = mix(color, uShadowColor, bevelShade * 0.11);
|
|
739
|
+
color = mix(color, rimColor, innerRim * 0.46 * breath);
|
|
740
|
+
color = mix(color, rimColor, outerRim * 0.62 * breath);
|
|
741
|
+
color = mix(color, uShadowColor, fineEdge * 0.12);
|
|
742
|
+
|
|
743
|
+
float topGlint = band(q.y - 0.6, 0.06) * band(q.x + 0.2, 0.22);
|
|
744
|
+
float bottomGlint = band(q.y + 0.61, 0.06) * band(q.x - 0.16, 0.29);
|
|
745
|
+
color += uCoolColor * topGlint * 0.12;
|
|
746
|
+
color += uWarmColor * bottomGlint * 0.1;
|
|
747
|
+
|
|
748
|
+
vec3 premultiplied = color * body * 0.96;
|
|
749
|
+
premultiplied += mix(uShadowColor, rimColor, 0.58) * (1.0 - body) * outside * breath;
|
|
750
|
+
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
751
|
+
}
|
|
752
|
+
`,rp={name:"lumenPortalLight",fragmentSource:FR};var HR=`
|
|
753
|
+
precision highp float;
|
|
754
|
+
|
|
755
|
+
uniform vec2 uResolution;
|
|
756
|
+
uniform float uTime;
|
|
757
|
+
uniform vec3 uColor;
|
|
758
|
+
uniform vec3 uAccent;
|
|
759
|
+
uniform float uIntensity;
|
|
760
|
+
uniform float uSpeed;
|
|
761
|
+
varying vec2 vUv;
|
|
762
|
+
|
|
763
|
+
float hash(vec2 p) {
|
|
764
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
void main() {
|
|
768
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
769
|
+
float radius = length(p);
|
|
770
|
+
if (radius > 1.0) discard;
|
|
771
|
+
|
|
772
|
+
float angle = atan(p.y, p.x);
|
|
773
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
774
|
+
float fold = sin(angle * 3.0 - time * 1.7 + radius * 7.0);
|
|
775
|
+
float ribbon = exp(-pow(radius - (0.69 + fold * 0.07), 2.0) * 95.0);
|
|
776
|
+
float rim = smoothstep(0.58, 0.98, radius) * (1.0 - smoothstep(0.94, 1.0, radius));
|
|
777
|
+
float light = exp(-length(p - vec2(-0.42, -0.34)) * 4.2);
|
|
778
|
+
float grain = (hash(gl_FragCoord.xy + time) - 0.5) * 0.035;
|
|
779
|
+
float energy = clamp((ribbon * 0.8 + rim * 0.55 + light * 0.7) * uIntensity, 0.0, 1.0);
|
|
780
|
+
vec3 color = mix(uColor * (0.12 + 0.32 * (1.0 - radius)), uAccent, energy);
|
|
781
|
+
color += grain;
|
|
782
|
+
float alpha = 1.0 - smoothstep(0.94, 1.0, radius);
|
|
783
|
+
gl_FragColor = vec4(color, alpha);
|
|
784
|
+
}
|
|
785
|
+
`,np={name:"orb",fragmentSource:HR};var VR=`
|
|
786
|
+
precision highp float;
|
|
787
|
+
|
|
788
|
+
uniform float uTime;
|
|
789
|
+
uniform float uSpeed;
|
|
790
|
+
uniform float uIntensity;
|
|
791
|
+
uniform float uCellCount;
|
|
792
|
+
uniform float uDensity;
|
|
793
|
+
uniform vec3 uBaseColor;
|
|
794
|
+
uniform vec3 uTopColor;
|
|
795
|
+
uniform vec3 uWarmColor;
|
|
796
|
+
uniform vec3 uCenterColor;
|
|
797
|
+
uniform vec3 uVioletColor;
|
|
798
|
+
uniform vec3 uBottomColor;
|
|
799
|
+
varying vec2 vUv;
|
|
800
|
+
|
|
801
|
+
float band(float distance, float width) {
|
|
802
|
+
return exp(-pow(distance / width, 2.0));
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
float hash(vec2 p) {
|
|
806
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
float noise(vec2 p) {
|
|
810
|
+
vec2 cell = floor(p);
|
|
811
|
+
vec2 blend = fract(p);
|
|
812
|
+
blend = blend * blend * (3.0 - 2.0 * blend);
|
|
813
|
+
float lower = mix(hash(cell), hash(cell + vec2(1.0, 0.0)), blend.x);
|
|
814
|
+
float upper = mix(hash(cell + vec2(0.0, 1.0)), hash(cell + vec2(1.0, 1.0)), blend.x);
|
|
815
|
+
return mix(lower, upper, blend.y);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
vec3 strandColor(float y) {
|
|
819
|
+
vec3 color = mix(uBottomColor, uVioletColor, smoothstep(-0.9, -0.43, y));
|
|
820
|
+
color = mix(color, uCenterColor, smoothstep(-0.38, 0.05, y));
|
|
821
|
+
color = mix(color, uWarmColor, smoothstep(0.14, 0.48, y));
|
|
822
|
+
return mix(color, uTopColor, smoothstep(0.64, 0.9, y));
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
void main() {
|
|
826
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
827
|
+
float radius = length(p);
|
|
828
|
+
if (radius >= 1.0) discard;
|
|
829
|
+
|
|
830
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
831
|
+
float cells = max(uCellCount, 1.0);
|
|
832
|
+
vec2 grid = (p + 1.0) * cells * 0.5;
|
|
833
|
+
vec2 cellId = floor(grid);
|
|
834
|
+
vec2 q = (cellId + 0.5) * 2.0 / cells - 1.0;
|
|
835
|
+
vec2 flow = vec2(
|
|
836
|
+
0.1 * sin(time * 0.48 + q.y * 2.6),
|
|
837
|
+
0.08 * cos(time * 0.4 + q.x * 2.1)
|
|
838
|
+
);
|
|
839
|
+
vec2 movingQ = q + flow;
|
|
840
|
+
|
|
841
|
+
float path = -0.29 + 0.19 * sin(movingQ.y * 4.0 + time * 0.27);
|
|
842
|
+
path += 0.09 * sin(movingQ.y * 7.7 - time * 0.19);
|
|
843
|
+
float strand = band(movingQ.x - path, 0.26) * 0.11;
|
|
844
|
+
float top = band(movingQ.x + 0.52, 0.28) * band(movingQ.y - 0.78, 0.19) * 0.75;
|
|
845
|
+
float warm = band(movingQ.x + 0.46, 0.2) * band(movingQ.y - 0.47, 0.23) * 0.76;
|
|
846
|
+
float center = band(movingQ.x + 0.06, 0.25) * band(movingQ.y - 0.02, 0.21) * 1.14;
|
|
847
|
+
float lower = band(movingQ.x + 0.38, 0.32) * band(movingQ.y + 0.48, 0.27) * 0.86;
|
|
848
|
+
float bottom = band(movingQ.x + 0.56, 0.36) * band(movingQ.y + 0.85, 0.19) * 0.88;
|
|
849
|
+
float blue = band(movingQ.x - 0.28, 0.19) * band(movingQ.y + 0.64, 0.18) * 0.94;
|
|
850
|
+
float field = strand + top + warm + center + lower + bottom + blue;
|
|
851
|
+
field *= 0.35 + 1.25 * noise(movingQ * 5.1 + vec2(time * 0.075, -time * 0.04));
|
|
852
|
+
|
|
853
|
+
float chance = clamp(field * max(uDensity, 0.0), 0.0, 0.96);
|
|
854
|
+
float seed = hash(cellId);
|
|
855
|
+
float active = smoothstep(seed - 0.055, seed + 0.055, chance);
|
|
856
|
+
vec2 local = fract(grid) - 0.5;
|
|
857
|
+
local -= vec2(
|
|
858
|
+
0.11 * sin(time * 0.72 + seed * 6.28318),
|
|
859
|
+
0.11 * cos(time * 0.61 + seed * 4.71239)
|
|
860
|
+
);
|
|
861
|
+
float growth = 0.78 + 0.34 * (0.5 + 0.5 * sin(time * 0.83 + seed * 5.3));
|
|
862
|
+
float size = mix(0.27, 0.34, hash(cellId + vec2(19.3, 7.1))) * growth;
|
|
863
|
+
float squareRadius = max(abs(local.x), abs(local.y));
|
|
864
|
+
float outer = 1.0 - smoothstep(size - 0.045, size + 0.015, squareRadius);
|
|
865
|
+
float inner = 1.0 - smoothstep(size - 0.17, size - 0.105, squareRadius);
|
|
866
|
+
float outline = max(outer - inner, 0.0);
|
|
867
|
+
float glow = band(squareRadius - size + 0.075, 0.115) * 0.24;
|
|
868
|
+
|
|
869
|
+
float pulse = 0.76 + 0.24 * sin(time * 1.1 - q.y * 5.1 + seed * 6.28318);
|
|
870
|
+
float variation = 0.43 + 0.57 * hash(cellId + vec2(3.7, 27.4));
|
|
871
|
+
float highlight = band(movingQ.x + 0.07, 0.25) * band(movingQ.y - 0.02, 0.24);
|
|
872
|
+
vec3 colorSum = strandColor(movingQ.y) * strand;
|
|
873
|
+
colorSum += uTopColor * top + uWarmColor * warm + uCenterColor * center;
|
|
874
|
+
colorSum += uVioletColor * lower + uBottomColor * (bottom + blue);
|
|
875
|
+
vec3 cellColor = colorSum / max(strand + top + warm + center + lower + bottom + blue, 0.001);
|
|
876
|
+
cellColor = mix(cellColor, vec3(1.0, 0.96, 0.76), highlight * 0.54);
|
|
877
|
+
vec3 color = uBaseColor + cellColor * active * variation * pulse * (outline + glow);
|
|
878
|
+
|
|
879
|
+
float edge = 1.0 - smoothstep(0.965, 0.997, radius);
|
|
880
|
+
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
|
|
881
|
+
}
|
|
882
|
+
`,op={name:"pixelConstellation",fragmentSource:VR};var WR=`
|
|
883
|
+
precision highp float;
|
|
884
|
+
|
|
885
|
+
uniform vec2 uResolution;
|
|
886
|
+
uniform float uTime;
|
|
887
|
+
uniform float uSpeed;
|
|
888
|
+
uniform float uIntensity;
|
|
889
|
+
uniform float uProgress;
|
|
890
|
+
uniform float uDent;
|
|
891
|
+
uniform float uBoost;
|
|
892
|
+
uniform float uFlare;
|
|
893
|
+
uniform float uStart;
|
|
894
|
+
uniform float uSweep;
|
|
895
|
+
uniform vec3 uColor;
|
|
896
|
+
uniform vec3 uAccent;
|
|
897
|
+
uniform vec3 uHot;
|
|
898
|
+
varying vec2 vUv;
|
|
899
|
+
|
|
900
|
+
float bell(float value, float width) {
|
|
901
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
float wrap(float angle) {
|
|
905
|
+
return atan(sin(angle), cos(angle));
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
void main() {
|
|
909
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
910
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
911
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
912
|
+
float radius = length(p);
|
|
913
|
+
float angle = atan(p.y, p.x);
|
|
914
|
+
|
|
915
|
+
float sweep = radians(uSweep > 0.0 ? uSweep : 270.0);
|
|
916
|
+
float start = radians(uStart != 0.0 ? uStart : 225.0);
|
|
917
|
+
float progress = clamp(uProgress < 0.0 ? 0.35 : uProgress, 0.0, 1.0);
|
|
918
|
+
float needleAngle = start - progress * sweep;
|
|
919
|
+
float delta = wrap(angle - needleAngle);
|
|
920
|
+
|
|
921
|
+
float dentValue = clamp(uDent < 0.0 ? progress : uDent, 0.0, 1.0);
|
|
922
|
+
float engage = smoothstep(0.0, 0.28, dentValue);
|
|
923
|
+
float boost = smoothstep(0.0, 1.0, clamp(uBoost, 0.0, 1.0));
|
|
924
|
+
float energy = smoothstep(0.0, 1.0, dentValue);
|
|
925
|
+
float level = (uFlare > 0.0 ? uFlare : 1.0) * engage * (0.45 + 0.5 * energy + 0.3 * boost);
|
|
926
|
+
|
|
927
|
+
float heat = smoothstep(0.15, 1.0, clamp(0.75 * energy + 0.5 * boost, 0.0, 1.0));
|
|
928
|
+
vec3 cool = mix(uAccent, vec3(0.18, 0.28, 0.95), 0.55);
|
|
929
|
+
vec3 hot = uHot;
|
|
930
|
+
vec3 tint = mix(cool, hot, heat);
|
|
931
|
+
|
|
932
|
+
float ripple = 0.5 + 0.5 * sin(delta * 9.0 - time * 1.4);
|
|
933
|
+
float wake = (progress - dentValue) * sweep;
|
|
934
|
+
float lo = min(0.0, wake);
|
|
935
|
+
float hi = max(0.0, wake);
|
|
936
|
+
float segment = delta < lo ? lo - delta : (delta > hi ? delta - hi : 0.0);
|
|
937
|
+
float wakePos = hi > lo ? clamp((delta - lo) / (hi - lo), 0.0, 1.0) : 0.0;
|
|
938
|
+
float fromNeedle = wake >= 0.0 ? wakePos : 1.0 - wakePos;
|
|
939
|
+
float taper = mix(1.0, 0.45, fromNeedle * smoothstep(0.02, 0.2, abs(wake)));
|
|
940
|
+
float dent = bell(segment, 0.13 + 0.02 * ripple) * (0.82 + 0.18 * ripple) * taper;
|
|
941
|
+
float shoulder = bell(delta, 0.34);
|
|
942
|
+
float ahead = wake >= 0.0 ? -1.0 : 1.0;
|
|
943
|
+
float pile = bell(delta - ahead * 0.17, 0.15) * clamp(abs(wake) * 2.2, 0.0, 1.0) * engage;
|
|
944
|
+
float baseRadius = 0.72;
|
|
945
|
+
float orbRadius = baseRadius * (1.0 - 0.32 * level * dent - 0.07 * level * shoulder + 0.13 * pile);
|
|
946
|
+
float body = 1.0 - smoothstep(orbRadius - 0.012, orbRadius + 0.012, radius);
|
|
947
|
+
float depth = clamp(radius / orbRadius, 0.0, 1.25);
|
|
948
|
+
float roundDepth = clamp(radius / baseRadius, 0.0, 1.2);
|
|
949
|
+
|
|
950
|
+
float local = clamp(heat * (0.7 + 0.3 * bell(delta, 0.9)) + 0.25 * heat * bell(delta, 0.3), 0.0, 1.0);
|
|
951
|
+
vec3 rim = mix(cool, hot, local);
|
|
952
|
+
vec3 bodyColor = mix(uColor, rim * (0.5 + 0.25 * energy), pow(roundDepth, 2.6));
|
|
953
|
+
bodyColor += mix(uAccent, hot, local) * (0.26 + 0.3 * energy) * bell(roundDepth - 0.93, 0.13);
|
|
954
|
+
bodyColor *= (0.82 + 0.18 * smoothstep(-0.5, 0.5, -p.x)) * (0.9 + 0.6 * energy * energy);
|
|
955
|
+
|
|
956
|
+
float ribbons = 0.5 + 0.5 * sin(depth * 24.0 - delta * 8.0 + time * 1.1);
|
|
957
|
+
float zone = max(bell(delta, 0.3), dent * 0.8) * bell(depth - 0.84, 0.32) * level * (1.0 + 0.9 * energy);
|
|
958
|
+
vec3 ribbonColor = mix(tint, hot, smoothstep(0.2, 0.9, ribbons) * (0.35 + 0.65 * heat));
|
|
959
|
+
bodyColor = mix(bodyColor, ribbonColor, clamp(zone * (0.4 + 0.45 * ribbons), 0.0, 1.0));
|
|
960
|
+
float edge = max(max(bell(delta, 0.2), dent * 0.7), pile * 0.8) * bell(depth - 0.99, 0.09) * level;
|
|
961
|
+
bodyColor += mix(hot, vec3(1.0, 0.92, 1.0), 0.45) * edge * (0.45 + 1.3 * energy);
|
|
962
|
+
|
|
963
|
+
float outside = max(radius - orbRadius, 0.0);
|
|
964
|
+
float notchLight = max(max(bell(delta, 0.2), dent * 0.8), pile * 0.6) * level;
|
|
965
|
+
float halo = exp(-outside * (12.0 - 6.0 * notchLight * (0.4 + energy))) * (1.0 - body) * (0.2 + 0.5 * energy * energy + 0.9 * notchLight * (0.5 + energy));
|
|
966
|
+
vec3 haloColor = mix(tint, hot, clamp(notchLight * 1.2, 0.0, 1.0));
|
|
967
|
+
|
|
968
|
+
float cross = abs(p.x * sin(needleAngle) - p.y * cos(needleAngle));
|
|
969
|
+
float along = p.x * cos(needleAngle) + p.y * sin(needleAngle);
|
|
970
|
+
float needleSpan = smoothstep(0.1, 0.2, along) * (1.0 - smoothstep(0.9, 0.96, along));
|
|
971
|
+
float needle = smoothstep(0.0055, 0.0008, cross) * needleSpan;
|
|
972
|
+
float needleGlow = bell(cross, 0.02) * needleSpan * (0.25 + 0.35 * energy);
|
|
973
|
+
|
|
974
|
+
vec3 color = bodyColor * body + haloColor * halo + vec3(1.0, 0.94, 1.0) * needle + hot * needleGlow;
|
|
975
|
+
float alpha = max(max(body, clamp(halo, 0.0, 1.0)), max(needle, needleGlow * 0.8));
|
|
976
|
+
|
|
977
|
+
float fade = 1.0 - smoothstep(0.88, 0.99, radius);
|
|
978
|
+
float gain = max(uIntensity, 0.0) * fade;
|
|
979
|
+
gl_FragColor = vec4(clamp(color * gain, 0.0, 1.0), clamp(alpha * gain, 0.0, 1.0));
|
|
980
|
+
}
|
|
981
|
+
`,ip={name:"plasmaGauge",fragmentSource:WR,replacesBaseFill:!0};var zR=`
|
|
982
|
+
precision highp float;
|
|
983
|
+
|
|
984
|
+
uniform vec2 uResolution;
|
|
985
|
+
uniform float uTime;
|
|
986
|
+
uniform float uSpeed;
|
|
987
|
+
uniform float uIntensity;
|
|
988
|
+
uniform float uRibCount;
|
|
989
|
+
uniform float uGrain;
|
|
990
|
+
uniform vec3 uBaseColor;
|
|
991
|
+
uniform vec3 uCoolColor;
|
|
992
|
+
uniform vec3 uWarmColor;
|
|
993
|
+
uniform vec3 uHighlightColor;
|
|
994
|
+
varying vec2 vUv;
|
|
995
|
+
|
|
996
|
+
float band(float distance, float width) {
|
|
997
|
+
return exp(-pow(distance / width, 2.0));
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
float lightField(vec2 p, float time) {
|
|
1001
|
+
float upperCurve = 0.43 + 0.16 * sin(p.x * 2.8 + time * 0.58) - p.x * 0.08;
|
|
1002
|
+
float lowerCurve = -0.46 + 0.13 * sin(p.x * 2.9 - time * 0.43 + 1.4);
|
|
1003
|
+
float upper = band(p.y - upperCurve, 0.2) * band(p.x + 0.03, 0.88);
|
|
1004
|
+
float lower = band(p.y - lowerCurve, 0.19) * band(p.x - 0.05, 0.85);
|
|
1005
|
+
float leftColumn = band(p.x + 0.39 + 0.1 * sin(p.y * 2.9 + time * 0.5), 0.23);
|
|
1006
|
+
leftColumn *= band(p.y + 0.01, 0.59);
|
|
1007
|
+
float centerShadow = 1.0 - band(p.x - 0.35, 0.46) * band(p.y + 0.01, 0.28) * 0.9;
|
|
1008
|
+
float drift = 0.84 + 0.16 * sin(p.x * 3.5 - p.y * 2.2 + time * 0.72);
|
|
1009
|
+
return clamp((upper + lower + leftColumn * 0.74) * centerShadow * drift, 0.0, 1.5);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
float grain(vec2 uv) {
|
|
1013
|
+
vec2 pixel = floor(uv * uResolution);
|
|
1014
|
+
return fract(sin(dot(pixel, vec2(127.1, 311.7))) * 43758.5453);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
void main() {
|
|
1018
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
1019
|
+
float radius = length(p);
|
|
1020
|
+
if (radius >= 1.0) discard;
|
|
1021
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
1022
|
+
|
|
1023
|
+
float field = lightField(p, time);
|
|
1024
|
+
float redField = lightField(p + vec2(0.027, 0.0), time);
|
|
1025
|
+
float blueField = lightField(p - vec2(0.027, 0.0), time);
|
|
1026
|
+
float coolRegion = band(p.x + 0.58, 0.38) * 0.74;
|
|
1027
|
+
float warmRegion = band(p.x + 0.02, 0.34) * band(p.y + 0.08, 0.75) * 0.88;
|
|
1028
|
+
vec3 spectralTint = mix(uHighlightColor, uCoolColor, coolRegion);
|
|
1029
|
+
spectralTint = mix(spectralTint, uWarmColor, warmRegion);
|
|
1030
|
+
vec3 light = spectralTint * field * 1.25;
|
|
1031
|
+
light += uWarmColor * max(redField - blueField, 0.0) * 2.6;
|
|
1032
|
+
light += uCoolColor * max(blueField - redField, 0.0) * 2.6;
|
|
1033
|
+
|
|
1034
|
+
float ribCoordinate = (p.x + 1.0) * max(uRibCount, 1.0) * 0.5;
|
|
1035
|
+
float rib = fract(ribCoordinate);
|
|
1036
|
+
float glassFace = smoothstep(0.08, 0.18, rib) * (1.0 - smoothstep(0.77, 0.94, rib));
|
|
1037
|
+
float groove = 1.0 - glassFace;
|
|
1038
|
+
float refraction = 0.8 + 0.2 * sin(rib * 3.14159);
|
|
1039
|
+
vec3 color = uBaseColor + light * (0.12 + glassFace * 0.95) * refraction;
|
|
1040
|
+
color *= 1.0 - groove * 0.83;
|
|
1041
|
+
|
|
1042
|
+
float leftEdge = band(rib - 0.18, 0.028);
|
|
1043
|
+
float rightEdge = band(rib - 0.79, 0.04);
|
|
1044
|
+
color += mix(uCoolColor, uHighlightColor, 0.48) * leftEdge * (0.07 + field * 0.19);
|
|
1045
|
+
color += uHighlightColor * rightEdge * (0.025 + field * 0.075);
|
|
1046
|
+
color += uCoolColor * band(p.x + 0.78, 0.28) * band(p.y, 0.7) * 0.09;
|
|
1047
|
+
|
|
1048
|
+
float noise = (grain(vUv) - 0.5) * max(uGrain, 0.0);
|
|
1049
|
+
color += vec3(noise) * (0.18 + field * 0.82);
|
|
1050
|
+
float fade = 1.0 - smoothstep(0.88, 1.0, radius);
|
|
1051
|
+
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * fade, 0.0, 1.0), fade);
|
|
1052
|
+
}
|
|
1053
|
+
`,ap={name:"prismSlats",fragmentSource:zR};var YR=`
|
|
1054
|
+
precision highp float;
|
|
1055
|
+
|
|
1056
|
+
uniform vec2 uResolution;
|
|
1057
|
+
uniform float uIntensity;
|
|
1058
|
+
uniform float uProgress;
|
|
1059
|
+
uniform float uTicks;
|
|
1060
|
+
uniform float uMajor;
|
|
1061
|
+
uniform float uLength;
|
|
1062
|
+
uniform float uThickness;
|
|
1063
|
+
uniform float uRound;
|
|
1064
|
+
uniform float uDent;
|
|
1065
|
+
uniform float uSpread;
|
|
1066
|
+
uniform float uInset;
|
|
1067
|
+
uniform float uLine;
|
|
1068
|
+
uniform float uGap;
|
|
1069
|
+
uniform float uKnobRadius;
|
|
1070
|
+
uniform float uAxis;
|
|
1071
|
+
uniform vec3 uColor;
|
|
1072
|
+
uniform vec3 uAccent;
|
|
1073
|
+
uniform vec3 uGlow;
|
|
1074
|
+
uniform vec3 uCore;
|
|
1075
|
+
varying vec2 vUv;
|
|
1076
|
+
|
|
1077
|
+
float wireAt(float at, float lineAt, float depth, float radius, float knob, float spread) {
|
|
1078
|
+
float reach = abs(at - knob);
|
|
1079
|
+
if (uKnobRadius > 0.0) {
|
|
1080
|
+
float outline = max(sqrt(max(radius * radius - reach * reach, 0.0)) - (radius - depth), 0.0);
|
|
1081
|
+
float shoulder = max(sqrt(2.0 * depth * radius) * 0.9, 1.0);
|
|
1082
|
+
float soft = depth * exp(-(reach * reach) / (shoulder * shoulder));
|
|
1083
|
+
float k = max(depth * 0.15, 1.0);
|
|
1084
|
+
float h = max(k - abs(outline - soft), 0.0) / k;
|
|
1085
|
+
return lineAt - (max(outline, soft) + h * h * k * 0.25);
|
|
1086
|
+
}
|
|
1087
|
+
float away = reach / spread;
|
|
1088
|
+
return lineAt - depth * exp(-away * away);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
void main() {
|
|
1092
|
+
vec2 px = vUv * uResolution;
|
|
1093
|
+
float horizontal = step(0.5, uAxis);
|
|
1094
|
+
float along = mix(px.y, px.x, horizontal);
|
|
1095
|
+
float across = mix(px.x, uResolution.y - px.y, horizontal);
|
|
1096
|
+
float extent = mix(uResolution.y, uResolution.x, horizontal);
|
|
1097
|
+
float width = mix(uResolution.x, uResolution.y, horizontal);
|
|
1098
|
+
|
|
1099
|
+
float inset = uInset > 0.0 ? uInset : 0.05;
|
|
1100
|
+
float lineAt = (uLine > 0.0 ? uLine : 0.7) * width;
|
|
1101
|
+
float count = max(uTicks > 0.0 ? uTicks : 50.0, 2.0);
|
|
1102
|
+
float every = max(uMajor > 0.0 ? uMajor : 5.0, 1.0);
|
|
1103
|
+
float unit = (uThickness > 0.0 ? uThickness : 0.012) * width;
|
|
1104
|
+
float halfLine = max(unit * 0.5, 0.75);
|
|
1105
|
+
float spread = (uSpread > 0.0 ? uSpread : 0.07) * extent;
|
|
1106
|
+
float depth = (uDent < 0.0 ? 1.0 : uDent) * 0.16 * width;
|
|
1107
|
+
|
|
1108
|
+
float start = inset * extent;
|
|
1109
|
+
float span = (1.0 - 2.0 * inset) * extent;
|
|
1110
|
+
float knob = start + span * clamp(uProgress, 0.0, 1.0);
|
|
1111
|
+
|
|
1112
|
+
float away = (along - knob) / spread;
|
|
1113
|
+
float bump = exp(-away * away);
|
|
1114
|
+
float radius = (uKnobRadius + (uGap > 0.0 ? uGap : 0.04)) * width;
|
|
1115
|
+
float wire = wireAt(along, lineAt, depth, radius, knob, spread);
|
|
1116
|
+
float slope = (wireAt(along + 1.0, lineAt, depth, radius, knob, spread) - wireAt(along - 1.0, lineAt, depth, radius, knob, spread)) * 0.5;
|
|
1117
|
+
float lineDistance = abs(across - wire) / sqrt(1.0 + slope * slope);
|
|
1118
|
+
float line = 1.0 - smoothstep(halfLine - 0.75, halfLine + 0.75, lineDistance);
|
|
1119
|
+
float wireDistance = abs(across - wire);
|
|
1120
|
+
vec3 lineColor = mix(uColor, uAccent, bump);
|
|
1121
|
+
|
|
1122
|
+
vec3 glowColor = dot(uGlow, uGlow) > 0.0 ? uGlow : uAccent;
|
|
1123
|
+
float glowSide = across < wire ? 1.0 : 0.35;
|
|
1124
|
+
float glow = bump * exp(-wireDistance / (0.1 * width)) * glowSide * 1.3 * max(uIntensity, 0.0);
|
|
1125
|
+
vec3 coreColor = dot(uCore, uCore) > 0.0 ? uCore : mix(glowColor, vec3(1.0), 0.55);
|
|
1126
|
+
float core = bump * bump * exp(-wireDistance / (0.035 * width)) * glowSide * 1.6 * max(uIntensity, 0.0);
|
|
1127
|
+
float reachEdge = min(min(along, extent - along), min(across, width - across));
|
|
1128
|
+
float fade = smoothstep(0.0, 0.14 * width, reachEdge);
|
|
1129
|
+
glow *= fade;
|
|
1130
|
+
core *= fade;
|
|
1131
|
+
|
|
1132
|
+
float spacing = span / count;
|
|
1133
|
+
float position = (along - start) / spacing;
|
|
1134
|
+
float index = floor(position + 0.5);
|
|
1135
|
+
float inRange = step(0.0, index) * step(index, count);
|
|
1136
|
+
float tickAlong = abs(position - index) * spacing;
|
|
1137
|
+
float major = 1.0 - step(0.5, mod(index, every));
|
|
1138
|
+
float tickLength = (uLength > 0.0 ? uLength : 0.1) * width * mix(1.0, 1.9, major);
|
|
1139
|
+
float tickDistance = (start + index * spacing - knob) / spread;
|
|
1140
|
+
float tickBump = exp(-tickDistance * tickDistance);
|
|
1141
|
+
float tickEnd = lineAt - 0.12 * width - depth * 0.4 * tickBump;
|
|
1142
|
+
float halfTick = halfLine * mix(0.75, 1.2, major);
|
|
1143
|
+
float corner = halfTick * clamp(uRound, 0.0, 1.0);
|
|
1144
|
+
vec2 q = abs(vec2(across - (tickEnd - tickLength * 0.5), tickAlong)) - vec2(tickLength * 0.5, halfTick) + corner;
|
|
1145
|
+
float edge = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - corner;
|
|
1146
|
+
float tick = (1.0 - smoothstep(-0.75, 0.75, edge)) * inRange * mix(0.4, 1.0, tickBump);
|
|
1147
|
+
vec3 tickColor = mix(uColor, vec3(1.0), tickBump);
|
|
1148
|
+
|
|
1149
|
+
float alpha = clamp(tick + line * 0.95 + glow + core, 0.0, 1.0);
|
|
1150
|
+
vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
|
|
1151
|
+
gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
|
|
1152
|
+
}
|
|
1153
|
+
`,sp={name:"ruler",fragmentSource:YR,replacesBaseFill:!0};var jR=`
|
|
1154
|
+
precision highp float;
|
|
1155
|
+
|
|
1156
|
+
uniform vec2 uResolution;
|
|
1157
|
+
uniform float uTime;
|
|
1158
|
+
uniform float uSpeed;
|
|
1159
|
+
uniform float uIntensity;
|
|
1160
|
+
uniform float uBlur;
|
|
1161
|
+
uniform float uGlow;
|
|
1162
|
+
uniform float uMotion;
|
|
1163
|
+
uniform float uDirection;
|
|
1164
|
+
uniform float uReach;
|
|
1165
|
+
uniform vec3 uShapeColor;
|
|
1166
|
+
varying vec2 vUv;
|
|
1167
|
+
|
|
1168
|
+
float bell(float value, float width) {
|
|
1169
|
+
return exp(-pow(value / max(width, 0.001), 2.0));
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
mat2 rotate(float angle) {
|
|
1173
|
+
float sine = sin(angle);
|
|
1174
|
+
float cosine = cos(angle);
|
|
1175
|
+
return mat2(cosine, -sine, sine, cosine);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
vec2 orient(vec2 point, float direction) {
|
|
1179
|
+
if (direction < 0.5) return point;
|
|
1180
|
+
if (direction < 1.5) return vec2(-point.x, point.y);
|
|
1181
|
+
if (direction < 2.5) return vec2(-point.y, point.x);
|
|
1182
|
+
return vec2(point.y, -point.x);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
void main() {
|
|
1186
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
1187
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
1188
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
1189
|
+
float motion = max(uMotion, 0.0);
|
|
1190
|
+
float blur = clamp(uBlur, 0.02, 0.55);
|
|
1191
|
+
|
|
1192
|
+
vec2 q = orient(p, uDirection) - vec2(0.12, 0.0);
|
|
1193
|
+
float sweep = sin(time * 0.55) * 0.42 * motion;
|
|
1194
|
+
vec2 qb = rotate(sweep) * q;
|
|
1195
|
+
float radius = length(q);
|
|
1196
|
+
float reach = clamp(uReach + sin(time * 0.41 + 1.3) * 0.16 * motion, 0.0, 1.0);
|
|
1197
|
+
float left = 1.0 - smoothstep(-0.42, mix(-0.24, 0.46, reach), qb.x);
|
|
1198
|
+
float upper = smoothstep(-0.05, 0.46, qb.y);
|
|
1199
|
+
float lower = 1.0 - smoothstep(-0.46, 0.05, qb.y);
|
|
1200
|
+
float blurSide = left * (0.50 + 0.50 * max(upper, lower));
|
|
1201
|
+
float breathing = 1.0 + sin(time * 0.72) * 0.28 * motion;
|
|
1202
|
+
float edgeWidth = mix(0.015, blur * breathing, blurSide);
|
|
1203
|
+
float body = 1.0 - smoothstep(0.49 - edgeWidth, 0.49 + edgeWidth, radius);
|
|
1204
|
+
|
|
1205
|
+
float upperPlume = bell(qb.x + 0.33 + sin(time * 0.62) * 0.07 * motion, 0.37 + blur * 0.42);
|
|
1206
|
+
upperPlume *= bell(qb.y - 0.28 + sin(time * 0.47) * 0.05 * motion, 0.24 + blur * 0.5);
|
|
1207
|
+
float lowerPlume = bell(qb.x + 0.32 - sin(time * 0.58) * 0.07 * motion, 0.34 + blur * 0.42);
|
|
1208
|
+
lowerPlume *= bell(qb.y + 0.34 - sin(time * 0.44) * 0.05 * motion, 0.26 + blur * 0.5);
|
|
1209
|
+
float plume = (upperPlume * 0.44 + lowerPlume * 0.40) * left * max(uGlow, 0.0);
|
|
1210
|
+
|
|
1211
|
+
vec3 lightColor = mix(uShapeColor, vec3(1.0), 0.24);
|
|
1212
|
+
vec3 darkColor = mix(uShapeColor, vec3(0.0), 0.7);
|
|
1213
|
+
float vertical = smoothstep(-0.45, 0.44, q.y);
|
|
1214
|
+
vec3 orbColor = mix(uShapeColor * 0.82, lightColor, vertical * 0.48);
|
|
1215
|
+
float shade = bell(q.x + 0.22, 0.38) * bell(q.y, 0.28);
|
|
1216
|
+
orbColor = mix(orbColor, darkColor, shade * 0.43);
|
|
1217
|
+
orbColor *= 0.76 + bell(q.x - 0.27, 0.36) * 0.32;
|
|
1218
|
+
|
|
1219
|
+
vec3 plumeColor = mix(uShapeColor, lightColor, smoothstep(-0.26, 0.30, q.y) * 0.35);
|
|
1220
|
+
float alpha = body + (1.0 - body) * plume;
|
|
1221
|
+
float frameFade = 1.0 - smoothstep(0.85, 1.0, max(abs(p.x), abs(p.y)));
|
|
1222
|
+
alpha = clamp(alpha * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
|
|
1223
|
+
vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
|
|
1224
|
+
gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1225
|
+
}
|
|
1226
|
+
`,lp={name:"smearOrb",fragmentSource:jR,replacesBaseFill:!0};var UR=`
|
|
1227
|
+
precision highp float;
|
|
1228
|
+
|
|
1229
|
+
uniform vec2 uResolution;
|
|
1230
|
+
uniform float uIntensity;
|
|
1231
|
+
uniform float uProgress;
|
|
1232
|
+
uniform float uTicks;
|
|
1233
|
+
uniform float uMajor;
|
|
1234
|
+
uniform float uStart;
|
|
1235
|
+
uniform float uSweep;
|
|
1236
|
+
uniform float uRadius;
|
|
1237
|
+
uniform float uLength;
|
|
1238
|
+
uniform float uThickness;
|
|
1239
|
+
uniform float uRound;
|
|
1240
|
+
uniform vec3 uColor;
|
|
1241
|
+
uniform vec3 uAccent;
|
|
1242
|
+
varying vec2 vUv;
|
|
1243
|
+
|
|
1244
|
+
const float TAU = 6.28318530718;
|
|
1245
|
+
|
|
1246
|
+
void main() {
|
|
1247
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
1248
|
+
p.x *= uResolution.x / max(uResolution.y, 1.0);
|
|
1249
|
+
float radius = length(p);
|
|
1250
|
+
float angle = atan(p.y, p.x);
|
|
1251
|
+
float pixel = 2.0 / max(uResolution.y, 1.0);
|
|
1252
|
+
|
|
1253
|
+
float sweep = radians(uSweep > 0.0 ? uSweep : 270.0);
|
|
1254
|
+
float start = radians(uStart != 0.0 ? uStart : 225.0);
|
|
1255
|
+
float gap = TAU - sweep;
|
|
1256
|
+
float fraction = (mod(start - angle + gap * 0.5, TAU) - gap * 0.5) / sweep;
|
|
1257
|
+
|
|
1258
|
+
float count = max(uTicks, 2.0);
|
|
1259
|
+
float inArc = step(-0.25 / count, fraction) * step(fraction, 1.0 + 0.25 / count);
|
|
1260
|
+
float phase = fraction * count;
|
|
1261
|
+
float index = floor(phase + 0.5);
|
|
1262
|
+
float arcDistance = abs(fract(phase + 0.5) - 0.5) / count * sweep * radius;
|
|
1263
|
+
float every = max(uMajor, 1.0);
|
|
1264
|
+
float major = 1.0 - step(0.5, mod(index, every));
|
|
1265
|
+
|
|
1266
|
+
float outer = uRadius > 0.0 ? uRadius : 0.9;
|
|
1267
|
+
float tickLength = (uLength > 0.0 ? uLength : 0.05) * mix(1.0, 1.8, major);
|
|
1268
|
+
float halfWidth = max((uThickness > 0.0 ? uThickness : 0.003) * mix(1.0, 1.4, major), pixel * 0.9);
|
|
1269
|
+
float halfLength = tickLength * 0.5;
|
|
1270
|
+
float corner = min(halfWidth, halfLength) * clamp(uRound, 0.0, 1.0);
|
|
1271
|
+
vec2 q = vec2(arcDistance, abs(radius - (outer - halfLength))) - vec2(halfWidth, halfLength) + corner;
|
|
1272
|
+
float edge = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - corner;
|
|
1273
|
+
float tick = (1.0 - smoothstep(-pixel, pixel, edge)) * inArc;
|
|
1274
|
+
|
|
1275
|
+
float progress = uProgress < 0.0 ? 1.0 : clamp(uProgress, 0.0, 1.0);
|
|
1276
|
+
float lit = clamp(progress * count - index + 1.0, 0.0, 1.0);
|
|
1277
|
+
vec3 base = uColor;
|
|
1278
|
+
vec3 color = mix(base, uAccent, lit);
|
|
1279
|
+
float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
|
|
1280
|
+
gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
|
|
1281
|
+
}
|
|
1282
|
+
`,dp={name:"tickScale",fragmentSource:UR,replacesBaseFill:!0};var XR=`
|
|
1283
|
+
precision highp float;
|
|
1284
|
+
|
|
1285
|
+
uniform float uTime;
|
|
1286
|
+
uniform float uSpeed;
|
|
1287
|
+
uniform float uIntensity;
|
|
1288
|
+
uniform vec3 uBaseColor;
|
|
1289
|
+
uniform vec3 uColor;
|
|
1290
|
+
uniform vec3 uHighlightColor;
|
|
1291
|
+
varying vec2 vUv;
|
|
1292
|
+
|
|
1293
|
+
float band(float distance, float width) {
|
|
1294
|
+
return exp(-pow(distance / width, 2.0));
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
float glassDistance(vec2 p, float time) {
|
|
1298
|
+
float angle = atan(p.y, p.x);
|
|
1299
|
+
float edge = 0.72;
|
|
1300
|
+
edge += sin(angle * 3.0 + time * 0.52) * 0.038;
|
|
1301
|
+
edge += sin(angle * 5.0 - time * 0.37 + 1.6) * 0.025;
|
|
1302
|
+
edge += sin(angle * 9.0 + time * 0.29) * 0.008;
|
|
1303
|
+
return length(p) - edge;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
void main() {
|
|
1307
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
1308
|
+
p.y += 0.025;
|
|
1309
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
1310
|
+
float distance = glassDistance(p, time);
|
|
1311
|
+
float body = 1.0 - smoothstep(-0.012, 0.01, distance);
|
|
1312
|
+
float halo = band(max(distance, 0.0), 0.12) * 0.24;
|
|
1313
|
+
float alpha = body + (1.0 - body) * halo;
|
|
1314
|
+
if (alpha < 0.002) discard;
|
|
1315
|
+
|
|
1316
|
+
float lowerLight = 1.0 - smoothstep(-0.6, 0.45, p.y);
|
|
1317
|
+
float liquid = 0.5 + 0.5 * sin(p.x * 3.5 - p.y * 2.2 + time * 0.61);
|
|
1318
|
+
vec3 color = mix(uBaseColor, uColor, 0.17 + lowerLight * 0.3 + liquid * 0.09);
|
|
1319
|
+
color += uColor * band(p.x + 0.36, 0.42) * band(p.y + 0.12, 0.5) * 0.16;
|
|
1320
|
+
color *= 0.55 + 0.45 * smoothstep(-0.52, 0.5, p.y + 0.2);
|
|
1321
|
+
|
|
1322
|
+
float innerFold = p.y + 0.22 + 0.19 * sin(p.x * 4.0 + time * 0.53);
|
|
1323
|
+
float secondFold = p.y - 0.42 + 0.11 * sin(p.x * 5.5 - time * 0.42);
|
|
1324
|
+
float foldLight = band(innerFold, 0.041) * smoothstep(-0.65, -0.1, p.x);
|
|
1325
|
+
foldLight += band(secondFold, 0.027) * smoothstep(0.05, 0.6, p.x);
|
|
1326
|
+
color += uHighlightColor * foldLight * 0.64;
|
|
1327
|
+
color += uColor * band(innerFold + 0.07, 0.065) * 0.31;
|
|
1328
|
+
float softReflection = band(p.x + 0.3 + 0.1 * sin(p.y * 3.5 + time * 0.35), 0.2);
|
|
1329
|
+
softReflection *= band(p.y - 0.38, 0.35);
|
|
1330
|
+
color += uHighlightColor * softReflection * 0.1;
|
|
1331
|
+
|
|
1332
|
+
float dome = sqrt(max(0.04, 1.0 - dot(p, p) / 0.62));
|
|
1333
|
+
vec3 surfaceNormal = normalize(vec3(p.x * 1.18, p.y * 1.18, dome));
|
|
1334
|
+
surfaceNormal.xy += vec2(sin(p.y * 8.0 + time * 0.31), cos(p.x * 7.0 - time * 0.27)) * 0.065;
|
|
1335
|
+
surfaceNormal = normalize(surfaceNormal);
|
|
1336
|
+
vec3 reflection = reflect(vec3(0.0, 0.0, -1.0), surfaceNormal);
|
|
1337
|
+
float softbox = band(reflection.x + 0.42, 0.34) * band(reflection.y - 0.43, 0.24);
|
|
1338
|
+
float sidebox = band(reflection.x - 0.57, 0.19) * band(reflection.y + 0.11, 0.5);
|
|
1339
|
+
color += uHighlightColor * softbox * 0.21;
|
|
1340
|
+
color += uColor * sidebox * 0.22;
|
|
1341
|
+
|
|
1342
|
+
float e = 0.008;
|
|
1343
|
+
vec2 normal = normalize(vec2(
|
|
1344
|
+
glassDistance(p + vec2(e, 0.0), time) - glassDistance(p - vec2(e, 0.0), time),
|
|
1345
|
+
glassDistance(p + vec2(0.0, e), time) - glassDistance(p - vec2(0.0, e), time)
|
|
1346
|
+
));
|
|
1347
|
+
float light = pow(max(0.0, dot(normal, normalize(vec2(-0.62, 0.78)))), 2.0);
|
|
1348
|
+
float sideLight = pow(max(0.0, dot(normal, normalize(vec2(0.8, -0.58)))), 4.0);
|
|
1349
|
+
float rim = band(distance + 0.012, 0.031);
|
|
1350
|
+
float sharpRim = band(distance + 0.004, 0.009);
|
|
1351
|
+
color += uColor * rim * (0.25 + light * 0.53);
|
|
1352
|
+
color += uHighlightColor * sharpRim * (light * 0.78 + sideLight * 0.38);
|
|
1353
|
+
color += uHighlightColor * band(distance + 0.09, 0.025) * light * 0.23;
|
|
1354
|
+
color += uColor * band(length(p - vec2(0.27, -0.31)) - 0.26, 0.09) * 0.1;
|
|
1355
|
+
|
|
1356
|
+
vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
|
|
1357
|
+
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1358
|
+
}
|
|
1359
|
+
`,cp={name:"violetGlass",fragmentSource:XR};var qR=`
|
|
1360
|
+
precision highp float;
|
|
1361
|
+
|
|
1362
|
+
uniform float uTime;
|
|
1363
|
+
uniform float uSpeed;
|
|
1364
|
+
uniform float uIntensity;
|
|
1365
|
+
uniform vec3 uBaseColor;
|
|
1366
|
+
uniform vec3 uColor;
|
|
1367
|
+
uniform vec3 uHighlightColor;
|
|
1368
|
+
uniform vec3 uShadowColor;
|
|
1369
|
+
varying vec2 vUv;
|
|
1370
|
+
|
|
1371
|
+
float band(float distance, float width) {
|
|
1372
|
+
return exp(-pow(distance / width, 2.0));
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
float glassDistance(vec2 p, float time) {
|
|
1376
|
+
float angle = atan(p.y, p.x);
|
|
1377
|
+
float edge = 0.69;
|
|
1378
|
+
edge += sin(angle * 3.0 + time * 0.48) * 0.025;
|
|
1379
|
+
edge += sin(angle * 5.0 - time * 0.36 + 1.7) * 0.016;
|
|
1380
|
+
return length(p) - edge;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
void main() {
|
|
1384
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
1385
|
+
float time = uTime * max(uSpeed, 0.0);
|
|
1386
|
+
float distance = glassDistance(p, time);
|
|
1387
|
+
float body = 1.0 - smoothstep(-0.012, 0.012, distance);
|
|
1388
|
+
float outside = band(max(distance, 0.0), 0.13) * 0.16;
|
|
1389
|
+
outside *= 1.0 - smoothstep(0.86, 1.0, length(p));
|
|
1390
|
+
float alpha = body * 0.94 + (1.0 - body) * outside;
|
|
1391
|
+
if (alpha < 0.002) discard;
|
|
1392
|
+
|
|
1393
|
+
float lowerTint = 1.0 - smoothstep(-0.54, 0.46, p.y);
|
|
1394
|
+
float flow = 0.5 + 0.5 * sin(p.x * 3.8 - p.y * 2.4 + time * 0.57);
|
|
1395
|
+
vec3 color = mix(uBaseColor, uColor, 0.08 + lowerTint * 0.19 + flow * 0.045);
|
|
1396
|
+
color *= 1.0 - band(p.x - 0.27, 0.31) * band(p.y + 0.25, 0.48) * 0.11;
|
|
1397
|
+
|
|
1398
|
+
float fold = p.y + 0.17 + 0.15 * sin(p.x * 4.1 + time * 0.49);
|
|
1399
|
+
float secondFold = p.y - 0.43 + 0.08 * sin(p.x * 5.2 - time * 0.32);
|
|
1400
|
+
float foldShade = band(fold + 0.045, 0.055) * smoothstep(-0.55, 0.18, p.x);
|
|
1401
|
+
foldShade += band(secondFold + 0.03, 0.038) * smoothstep(-0.1, 0.58, p.x);
|
|
1402
|
+
color = mix(color, uShadowColor, foldShade * 0.13);
|
|
1403
|
+
color += uHighlightColor * band(fold, 0.028) * 0.11;
|
|
1404
|
+
color += uHighlightColor * band(secondFold, 0.019) * 0.09;
|
|
1405
|
+
|
|
1406
|
+
float dome = sqrt(max(0.04, 1.0 - dot(p, p) / 0.57));
|
|
1407
|
+
vec3 normal = normalize(vec3(p.x * 1.15, p.y * 1.15, dome));
|
|
1408
|
+
normal.xy += vec2(sin(p.y * 7.0 + time * 0.29), cos(p.x * 6.0 - time * 0.24)) * 0.04;
|
|
1409
|
+
vec3 reflection = reflect(vec3(0.0, 0.0, -1.0), normalize(normal));
|
|
1410
|
+
float softbox = band(reflection.x + 0.45, 0.28) * band(reflection.y - 0.39, 0.22);
|
|
1411
|
+
color += uHighlightColor * softbox * 0.12;
|
|
1412
|
+
|
|
1413
|
+
float rim = band(distance + 0.018, 0.041);
|
|
1414
|
+
float thinRim = band(distance + 0.004, 0.012);
|
|
1415
|
+
float innerShade = band(distance + 0.094, 0.055);
|
|
1416
|
+
float upperLight = smoothstep(-0.34, 0.78, p.y - p.x * 0.24);
|
|
1417
|
+
color = mix(color, uShadowColor, innerShade * (0.08 + (1.0 - upperLight) * 0.1));
|
|
1418
|
+
color = mix(color, uColor, rim * (0.36 + upperLight * 0.15));
|
|
1419
|
+
color = mix(color, uShadowColor, thinRim * (1.0 - upperLight) * 0.29);
|
|
1420
|
+
color += uHighlightColor * thinRim * upperLight * 0.17;
|
|
1421
|
+
|
|
1422
|
+
vec3 premultiplied = color * body * 0.94;
|
|
1423
|
+
premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
|
|
1424
|
+
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1425
|
+
}
|
|
1426
|
+
`,up={name:"violetGlassLight",fragmentSource:qR};var KR=[np,ep,Jm,Xm,Um,Qm,Zm,lp,op,ip,dp,sp,jm,ap,qm,Km,cp,up,tp,rp],ZR=new Map(KR.map(e=>[e.name,e]));function mp(e){return ZR.get(e)}var QR=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function JR(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let n=t.getComputedStyle(r).backgroundColor;if(n&&!QR.test(n.trim()))return n}}function ek(e,t,r,n){let o=e.cloneNode(!0),i=[...e.children].indexOf(t);if(i>=0)for(;o.children.length>i;)o.lastElementChild?.remove();for(let s of o.querySelectorAll("foreignObject[data-sf-shader]"))s.remove();let a=JR(e);if(a){let{x:s,y:l,width:d,height:c}=e.viewBox.baseVal,u=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("x",String(s)),u.setAttribute("y",String(l)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("fill",a),o.insertBefore(u,o.firstChild)}return o.setAttribute("width",String(r)),o.setAttribute("height",String(n)),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o}function pp(e,t){let r=Math.max(globalThis.devicePixelRatio||1,2.5),n=Math.min(r,4096/Math.max(1,Math.max(e.clientWidth,e.clientHeight))),o=Math.max(1,Math.round(e.clientWidth*n)),i=Math.max(1,Math.round(e.clientHeight*n));if(!e.ownerDocument.defaultView)return Promise.resolve(void 0);let s=new XMLSerializer().serializeToString(ek(e,t,o,i)),l=e.ownerDocument.createElement("img"),d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return new Promise(c=>{l.onload=()=>c({image:l,width:o,height:i}),l.onerror=()=>c(void 0),l.src=d})}function mr(e,t){if(typeof e!="string")return t;let r=/^#([0-9a-f]{6})$/i.exec(e);if(!r)return t;let n=Number.parseInt(r[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function fp(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vt(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform1f(n,r)}function Gn(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform3f(n,...r)}function qi(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform2f(n,...r)}function Dn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function tk(e,t){return{direction:{left:0,right:1,top:2,bottom:3},orientation:{vertical:0,horizontal:1},axis:{vertical:0,horizontal:1}}[e]?.[t]}function hp(e,t){for(let[r,n]of Object.entries(e.parameters)){let o=Dn(r);if(typeof n=="number"){let a=e.parameters[`${r}Lag`];if(typeof a=="number"&&a>0){let s=e.smoothed.get(r)??n,l=s+(n-s)*(1-Math.exp(-t/a));e.smoothed.set(r,l),vt(e,o,l);continue}vt(e,o,n);continue}if(typeof n=="boolean"){let a=e.gl.getUniformLocation(e.program,o);a&&e.gl.uniform1i(a,n?1:0);continue}let i=tk(r,n);if(i!==void 0){vt(e,o,i);continue}/^#[0-9a-f]{6}$/i.test(n)&&Gn(e,o,mr(n,[0,0,0]))}}var rk=`
|
|
1427
|
+
attribute vec2 aPosition;
|
|
1428
|
+
varying vec2 vUv;
|
|
1429
|
+
|
|
1430
|
+
void main() {
|
|
1431
|
+
vUv = aPosition * 0.5 + 0.5;
|
|
1432
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
1433
|
+
}
|
|
1434
|
+
`;function gp(e,t,r){let n=e.createShader(t);if(n){if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){e.deleteShader(n);return}return n}}function bp(e,t){let r=gp(e,e.VERTEX_SHADER,rk),n=gp(e,e.FRAGMENT_SHADER,t);if(!r||!n){r&&e.deleteShader(r),n&&e.deleteShader(n);return}let o=e.createProgram();if(!o){e.deleteShader(r),e.deleteShader(n);return}if(e.attachShader(o,r),e.attachShader(o,n),e.linkProgram(o),e.deleteShader(r),e.deleteShader(n),!e.getProgramParameter(o,e.LINK_STATUS)){e.deleteProgram(o);return}return o}function yp(e){let t=e.createTexture();if(t)return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),t}var nk=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function ok(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function ik(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,nk,e.STATIC_DRAW);let n=e.getAttribLocation(t,"aPosition");if(n<0){e.deleteBuffer(r);return}return e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),r}function ak(e,t){let r=e.getAttribute("data-sf-id");return!t.replacesBaseFill||!r?void 0:[...e.closest("svg")?.querySelectorAll('[data-sf-primary="true"]')??[]].find(o=>o!==e&&o.getAttribute("data-sf-id")===r)}function xp(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),n=r?mp(r):void 0,o=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!n||!o)return;let i=bp(o,n.fragmentSource);if(!i)return;o.useProgram(i);let a=ik(o,i);if(!a){o.deleteProgram(i);return}let s=n.usesBackdrop===!0,l=ak(t,n),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:o,program:i,buffer:a,parameters:ok(t),smoothed:new Map,backdropTexture:s?yp(o):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:mr(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Sp(e){e.backdropTexture&&e.gl.deleteTexture(e.backdropTexture),e.gl.deleteBuffer(e.buffer),e.gl.deleteProgram(e.program),e.baseGeometry&&(e.baseFill===null||e.baseFill===void 0?e.baseGeometry.removeAttribute("fill"):e.baseGeometry.setAttribute("fill",e.baseFill))}function Cp(e){let t=e.canvas.closest("svg");if(!t)return;let r=t.getBoundingClientRect(),n=e.canvas.getBoundingClientRect();r.width<=0||r.height<=0||(e.backdropOrigin=[(n.left-r.left)/r.width,(r.bottom-n.bottom)/r.height],e.backdropScale=[n.width/r.width,n.height/r.height])}function Rp(e,t){if(!e.backdropTexture)return;Cp(e);let{gl:r}=e;r.bindTexture(r.TEXTURE_2D,e.backdropTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t.image)}var sk=2560;function Pt(e,t){let{canvas:r,gl:n,parameters:o}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,sk/Math.max(1,i.width*a,i.height*a)),l=Math.max(1,Math.round((i.width||r.clientWidth)*a*s)),d=Math.max(1,Math.round((i.height||r.clientHeight)*a*s));(r.width!==l||r.height!==d)&&(r.width=l,r.height=d),n.viewport(0,0,l,d),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.useProgram(e.program);let c=n.getUniformLocation(e.program,"uResolution");if(c&&n.uniform2f(c,l,d),vt(e,"uTime",t),e.backdropTexture){Cp(e),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.backdropTexture);let m=n.getUniformLocation(e.program,"uBackdrop");m&&n.uniform1i(m,0),qi(e,"uBackdropOrigin",e.backdropOrigin),qi(e,"uBackdropScale",e.backdropScale)}for(let[m,f]of Object.entries(Xi.numbers))vt(e,Dn(m),fp(o[m],f));for(let[m,f]of Object.entries(Xi.colors))Gn(e,Dn(m),mr(o[m],[...f]));Gn(e,"uShapeColor",e.shapeColor);let u=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,hp(e,u),n.drawArrays(n.TRIANGLES,0,6)}function kp(e){let t=null,r=0,n=()=>(e?.performance.now()??0)/1e3;return{now:()=>(t??n())-r,paused:()=>t!==null,spent:()=>r,setPaused(o){o&&t===null?t=n():!o&&t!==null&&(r+=n()-t,t=null)}}}var lk=120;function dk(e,t,r){let n=new Map(t.map(o=>[o.canvas,o]));return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].map(o=>{let i=n.get(o);if(i)try{return Pt(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function ck(e,t,r,n){let o=!1;for(let i of e)i.owner.getAttribute("data-sf-id")===t&&(Object.assign(i.parameters,r),i.owner.setAttribute("data-sf-shader-params",JSON.stringify(i.parameters)),Pt(i,n),o=!0);return o}function uk(e,t,r){if(!t)return()=>{};let n=new t.MutationObserver(r);n.observe(e,{attributes:!0,attributeFilter:["viewBox"]});let o=t.ResizeObserver?new t.ResizeObserver(r):void 0;return o?.observe(e),()=>{n.disconnect(),o?.disconnect()}}function Ki(e){let t=[],r,n=0,o,i=e.ownerDocument.defaultView,a=kp(i),s=b=>{if(!a.paused())for(let y of t)Pt(y,b/1e3-a.spent());r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)Sp(b);t=[]},d=b=>{for(let y of t)y.usesBackdrop&&pp(e,y.owner).then(S=>{S&&b===n&&Rp(y,S)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)Pt(b,0);return}if(a.paused())for(let b of t)Pt(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{l();let b=++n;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(y=>{let S=xp(y);return S?[S]:[]}),d(b),t.length>0&&c()},f=uk(e,i,()=>{o!==void 0&&i?.clearTimeout(o),o=i?.setTimeout(()=>{o=void 0,d(n)},lk)});u();let g=()=>{n+=1,f(),o!==void 0&&i?.clearTimeout(o),l()};return{capture:()=>dk(e,t,a.now()),setParameters:(b,y)=>ck(t,b,y,a.now()),setPaused:a.setPaused,refresh:u,destroy:g}}function _n(e,t){let r=e.svg??(e.source!=null?Cn(e.source,{...e.renderOptions??t,linkHitAreas:!0}).svg:null);if(r==null)throw new Error("createViewer: provide either `source` (SFL) or `svg`.");return r}function wp(e){let t=Pn(e);if(!Ln(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function vp(e){let t=Pn(e);if(!Ln(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var Zi="http://www.w3.org/1999/xhtml",Fn=(e,t)=>{Object.assign(e.style,t)};function Hn(e,t,r){let n=e.createElementNS(Zi,"span");return n.setAttribute("data-sf-rolling-current","true"),n.textContent=t,Fn(n,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),n}function mk(e,t,r){let n=e.createElementNS(Zi,"span");if(n.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return Fn(n,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),n.appendChild(Hn(e,t,r)),n;Fn(n,{position:"relative",display:"inline-block",width:"0.72em",height:"1.2em",overflow:"hidden",border:`1px solid ${r.divider}`,borderRadius:"0.09em",background:r.surface,boxShadow:"inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -0.16em 0.38em rgba(0,0,0,0.12)"}),n.appendChild(Hn(e,t,r));let o=e.createElementNS(Zi,"span");return Fn(o,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),n.appendChild(o),n}function Vn(e,t,r){return r===0||typeof e.animate!="function"?null:e.animate(t,{duration:r,easing:"cubic-bezier(0.22, 1, 0.36, 1)",fill:"forwards"})}function pk(e,t,r,n){let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Hn(e.ownerDocument,t,r);i.style.opacity="0",e.insertBefore(i,e.lastElementChild??null);let a={opacity:0,filter:"blur(0.025em)",transform:"scale(0.985)"},s={opacity:1,filter:"blur(0)",transform:"scale(1)"},l=Vn(i,[a,s],n),d=o?Vn(o,[s,a],n):null,c=()=>{o?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function fk(e,t,r,n){if(r.motion==="fade"){pk(e,t,r,n);return}let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Hn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Vn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],n),s=o?Vn(o,[{transform:"translateY(0)",opacity:1},{transform:"translateY(-100%)",opacity:.25}],n):null,l=()=>{o?.remove(),i.style.transform="translateY(0)",i.style.opacity="1"};a?a.finished.then(l,l):(s?.cancel(),l())}function Pp(e,t,r,n,o){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>mk(e.ownerDocument,a,n))),e.setAttribute("aria-label",r);return}let i=[...e.querySelectorAll("[data-sf-rolling-digit]")];[...r].forEach((a,s)=>{t[s]!==a&&fk(i[s],a,n,o)}),e.setAttribute("aria-label",r)}function Qi(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var hk=140;function gk(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Lp(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return Y;try{return{...Y,...JSON.parse(t)}}catch{return Y}}function bk(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function yk(e){let t=Number(e.getAttribute("data-sf-widget-duration"));return!Number.isFinite(t)||t<0?420:e.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches?0:t}function Wn(e,t,r){let n=gk(e);if(!n)return!1;let o=e.getAttribute("data-sf-widget-value")??"",i=_t(t,bk(e.getAttribute("data-sf-widget-digits")));return o===i||(Pp(n,o,i,Lp(e),r?yk(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function Ji(e){let t=new Map,r=new Map,n=new Map;return{setValue(o,i){let a=Qi(e,o);if(!a)return!1;if(t.set(o,i),Lp(a).motion!=="fade")return Wn(a,i,!0);let s=Date.now(),l=(r.get(o)??0)+hk-s;return l<=0?(r.set(o,s),Wn(a,i,!0)):(n.has(o)||n.set(o,setTimeout(()=>{n.delete(o),r.set(o,Date.now());let d=Qi(e,o),c=t.get(o);d&&c!==void 0&&Wn(d,c,!0)},l)),!0)},refresh(){for(let[o,i]of t){let a=Qi(e,o);a&&Wn(a,i,!1)}},clearValues(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()},destroy(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()}}}var Tp=new WeakMap,$p=new WeakMap,Mp=new WeakMap;function ra(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Ap(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function ea(e,t){return Number(e)>0?Number(e):t}function Ep(e,t){let r=Ap(e),n=Number(r.min)||0,o=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return ra(o===n?0:(t-n)/(o-n))}function ta(e,t,r){let n=e.getAttribute("transform")??"",o=n===$p.get(e)?Tp.get(e)??"":n;Tp.set(e,o);let i=`translate(${t} ${r}) ${o}`.trim();$p.set(e,i),e.setAttribute("transform",i)}function xk(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function Sk(e,t){let r=Mp.get(e)??e.getAttribute("fill")??"";Mp.set(e,r);let n=xk(r);if(!n)return;let o=n.map(a=>Math.round(a+(255-a)*t)),i=`rgb(${o[0]}, ${o[1]}, ${o[2]})`;e.style.fill=i;for(let a of e.querySelectorAll("tspan"))a.style.fill=i}function Np(e,t){let r=new Map;for(let n of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let o=Ap(n),i=n.getAttribute("data-sf-id")??"",a=Number(n.getAttribute("x")),s=Number(n.getAttribute("y")),l=Number(n.getAttribute("width")),d=Number(n.getAttribute("height")),c=o.axis==="horizontal",u=ra(t(i)??Number(o.progress)),m=ea(o.inset,.05),f=ea(o.line,.7),g=c?l:d,b=c?d:l,y=m+(1-2*m)*u,S=o.dent===void 0?1:Number(o.dent),v=(S<0?1:S)*.16*b,$=typeof o.knob=="string"?o.knob:"";if($){let Xe=[...e.querySelectorAll(`[data-sf-id="${CSS.escape($)}"]`)],qe=Xe.find(ce=>ce.hasAttribute("data-sf-primary"));if(qe?.getBBox){ta(qe,0,0);let ce=qe.getBBox(),Lt=(c?ce.height:ce.width)/2;r.set(i,Lt/b);let fr=(o.gap===void 0?.04:Number(o.gap))*b,oa=f*b-v+Lt+fr,ia=c?{x:a+l*y,y:s+oa}:{x:a+oa,y:s+d*(1-y)},Gp=ia.x-(ce.x+ce.width/2),Dp=ia.y-(ce.y+ce.height/2);for(let _p of Xe)ta(_p,Gp,Dp)}}let O=Number(o.min)||0,V=Number.isFinite(Number(o.max))&&o.max!==void 0?Number(o.max):100,j=ea(o.spread,.07)*g,Ue=m*g,pr=(1-2*m)*g,Ip=Ue+pr*u;for(let Xe of e.querySelectorAll(`text[data-sf-id="${CSS.escape(i)}"]`)){let qe=Number(Xe.textContent);if(!Number.isFinite(qe)||V===O)continue;let ce=Ue+pr*ra((qe-O)/(V-O)),Lt=Math.exp(-(((ce-Ip)/j)**2)),fr=v*.4*Lt;ta(Xe,c?0:-fr,c?-fr:0),Sk(Xe,Lt)}}return r}var zn=class{constructor(t,r,n){this.options=t;this.diagramId=n;this.display=Lm(t.container,r),this.shaderSurfaces=Ki(this.display.svg),this.documentWidgets=Ji(this.display.svg),this.interaction=t.interactive?Ym(this.display,this.emitter,n,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new wn;display;interaction;shaderSurfaces;documentWidgets;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=Np(this.display.svg,r=>this.rulerProgressOverrides.get(r));for(let[r,n]of t)this.setShaderParameters(r,{knobRadius:n})}get svg(){return this.display.svg}on(t,r){return this.emitter.on(t,r)}getSelection(){return this.interaction?.getSelection()??[]}select(t){this.interaction?.select(t)}fit(){this.display.fit(),this.interaction?.repaint()}getViewport(){return this.display.getViewport()}exportSvg(){return Si(this.svg,this.shaderSurfaces.capture())}exportImage(t){return yi(this.svg,this.exportSvg(),t)}setShaderParameters(t,r){let n={...this.shaderParameterOverrides.get(t),...r};return this.shaderParameterOverrides.set(t,n),this.shaderSurfaces.setParameters(t,r)}setWidgetValue(t,r){if(this.documentWidgets.setValue(t,r))return!0;let n=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')].find(a=>a.getAttribute("data-sf-id")===t);if(n){let a=Ep(n,Number(r));this.rulerProgressOverrides.set(t,a);let s=this.setShaderParameters(t,{progress:a});return this.placeKnobs(),s}let o=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="tickScale"]')].find(a=>a.getAttribute("data-sf-id")===t);if(!o)return!1;let i=100;try{i=Number(JSON.parse(o.getAttribute("data-sf-shader-params")??"{}").max)||100}catch{i=100}return this.setShaderParameters(t,{progress:Math.min(1,Math.max(0,Number(r)/i))})}setPaused(t){this.shaderSurfaces.setPaused(t)}clearOverrides(){this.shaderParameterOverrides.clear(),this.rulerProgressOverrides.clear(),this.documentWidgets.clearValues()}update(t){let r=_n(t,this.options.renderOptions);vp(r);let n=this.display.updateContent(r);this.shaderSurfaces.refresh(),this.documentWidgets.refresh(),this.placeKnobs();for(let[i,a]of this.shaderParameterOverrides)this.shaderSurfaces.setParameters(i,a);t.resetView&&this.display.fit();let o=this.interaction?.getSelection().map(i=>i.id)??[];if(o.length>0&&this.interaction?.select(o),this.emitter.emit("sceneDiff",{diagramId:this.diagramId,...n}),t.highlightChanges){let i=typeof t.highlightChanges=="object"?t.highlightChanges.color:void 0;this.interaction?.flashChanged([...n.added,...n.changed],i)}}announceReady(){queueMicrotask(()=>this.emitter.emit("ready",{diagramId:this.diagramId}))}destroy(){this.interaction?.destroy(),this.shaderSurfaces.destroy(),this.documentWidgets.destroy(),this.shaderParameterOverrides.clear(),this.display.destroy(),this.emitter.clear()}};function Op(e){let t=e.diagramId??"diagram",r=_n(e,e.renderOptions);wp(r);let n=new zn(e,r,t);return n.announceReady(),n}var Ck=`
|
|
1435
|
+
:host { display: block; position: relative; }
|
|
1436
|
+
.sf-container { width: 100%; height: 100%; }
|
|
1437
|
+
svg { display: block; max-width: 100%; }
|
|
1438
|
+
.sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
|
|
1439
|
+
[data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
|
|
1440
|
+
[data-sf-selected] { stroke: #2563eb !important; stroke-width: 4 !important; }
|
|
1441
|
+
`;function Rk(e){let t=document.createElement("style");t.textContent=Ck;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function kk(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function wk(e,t,r){return Op({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function vk(e,t,r){e.innerHTML=Cn(t,{padding:r.padding}).svg}function Bp(e,t){let r=Rk(e);if(t.source===null)return{viewer:null,rendered:!1};try{let n=t.interactive?wk(r,t.source,t):null;return t.interactive||vk(r,t.source,t),{viewer:n,rendered:!0}}catch(n){return kk(r,n),{viewer:null,rendered:!1}}}var Pk=typeof HTMLElement>"u"?class{}:HTMLElement,je=class extends Pk{static get observedAttributes(){return[...aa]}root;view=null;sourceProp=null;constructor(){super(),this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.rerender()}disconnectedCallback(){this.teardown()}attributeChangedCallback(){this.isConnected&&this.rerender()}set source(t){this.sourceProp=t,this.isConnected&&this.rerender()}get source(){return this.sourceProp??this.getAttribute("source")}get viewer(){return this.view}config(){let t=sa(r=>this.getAttribute(r));return{...t,source:this.sourceProp??t.source}}teardown(){this.view?.destroy(),this.view=null,this.root.replaceChildren()}rerender(){this.teardown();let t=this.config(),r=Bp(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function na(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,je)}na();return Yp(Lk);})();
|
|
1442
|
+
//# sourceMappingURL=stickyflow-diagram.global.js.map
|