stickyflow 0.5.0 → 0.6.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 +16 -0
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +4 -4
- package/dist/binding/index.d.ts +4 -4
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-IEHE6WVN.js → chunk-4G2R7PEL.js} +319 -45
- package/dist/chunk-4G2R7PEL.js.map +1 -0
- package/dist/{chunk-L3VJXZFD.cjs → chunk-4LENHH6C.cjs} +15 -15
- package/dist/{chunk-L3VJXZFD.cjs.map → chunk-4LENHH6C.cjs.map} +1 -1
- package/dist/{chunk-LTGF5OHP.js → chunk-FVHVOJS2.js} +395 -89
- package/dist/chunk-FVHVOJS2.js.map +1 -0
- package/dist/{chunk-TWDLOXRM.cjs → chunk-JIJMZMGY.cjs} +18 -18
- package/dist/{chunk-TWDLOXRM.cjs.map → chunk-JIJMZMGY.cjs.map} +1 -1
- package/dist/{chunk-VK3T6O5Z.cjs → chunk-KTNCDNDB.cjs} +33 -33
- package/dist/{chunk-VK3T6O5Z.cjs.map → chunk-KTNCDNDB.cjs.map} +1 -1
- package/dist/{chunk-BODZN3ZI.js → chunk-MFNUJA26.js} +4 -4
- package/dist/{chunk-BODZN3ZI.js.map → chunk-MFNUJA26.js.map} +1 -1
- package/dist/{chunk-7VW2XKVB.js → chunk-ULQZ6CZW.js} +3 -3
- package/dist/{chunk-7VW2XKVB.js.map → chunk-ULQZ6CZW.js.map} +1 -1
- package/dist/{chunk-ZMLQIMJK.cjs → chunk-WQRT5PVT.cjs} +993 -687
- package/dist/chunk-WQRT5PVT.cjs.map +1 -0
- package/dist/{chunk-G7NRK5AG.js → chunk-WRDVNMFS.js} +5 -5
- package/dist/{chunk-G7NRK5AG.js.map → chunk-WRDVNMFS.js.map} +1 -1
- package/dist/{chunk-XY2GZUHC.cjs → chunk-XJ4W6TW4.cjs} +326 -44
- package/dist/chunk-XJ4W6TW4.cjs.map +1 -0
- package/dist/index.cjs +49 -29
- package/dist/index.d.cts +52 -7
- package/dist/index.d.ts +52 -7
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +245 -235
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +3 -2
- package/dist/interaction/index.d.ts +3 -2
- package/dist/interaction/index.js +17 -7
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-CgX_y15a.d.ts → render-Db0eSz_s.d.cts} +36 -15
- package/dist/{render-CgX_y15a.d.cts → render-Db0eSz_s.d.ts} +36 -15
- package/dist/{runtime-reWgr7MP.d.cts → runtime-BhivvBeL.d.cts} +2 -2
- package/dist/{runtime-DnUxca3Y.d.ts → runtime-n2yG-_j-.d.ts} +2 -2
- package/dist/{runtimeTypes-D60w6nyF.d.cts → runtimeTypes-CrkMHvVi.d.cts} +2 -2
- package/dist/{runtimeTypes-CEBGueYM.d.ts → runtimeTypes-DnI7mRF5.d.ts} +2 -2
- package/dist/stickyflow-diagram.global.js +35 -35
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-DvhMpqrL.d.cts → types-BHfUKT4s.d.cts} +1 -1
- package/dist/{types-DYLC_lsk.d.ts → types-D4cH4f1a.d.ts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +4 -4
- package/dist/viewer/index.d.ts +4 -4
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.d.cts +2 -2
- package/dist/web-component/index.d.ts +2 -2
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-IEHE6WVN.js.map +0 -1
- package/dist/chunk-LTGF5OHP.js.map +0 -1
- package/dist/chunk-XY2GZUHC.cjs.map +0 -1
- package/dist/chunk-ZMLQIMJK.cjs.map +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";var Stickyflow=(()=>{var
|
|
1
|
+
"use strict";var Stickyflow=(()=>{var ko=Object.defineProperty;var Qf=Object.getOwnPropertyDescriptor;var Jf=Object.getOwnPropertyNames;var eh=Object.prototype.hasOwnProperty;var th=(e,t)=>{for(var r in t)ko(e,r,{get:t[r],enumerable:!0})},rh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jf(t))!eh.call(e,o)&&o!==r&&ko(e,o,{get:()=>t[o],enumerable:!(n=Qf(t,o))||n.enumerable});return e};var nh=e=>rh(ko({},"__esModule",{value:!0}),e);var yv={};th(yv,{StickyflowDiagram:()=>ut,defineStickyflowDiagram:()=>Wa});var Ua=["source","interactive","padding","diagram-id"],oh=e=>e!==null&&e!=="false";function ja(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:oh(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function Xt(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Xa=["rollingNumber","tickScale","ruler"];function Xe(e){return e!==void 0&&Xa.includes(e)}function Nr(e){return!Xe(e.type)}var qa=[{type:"rollingNumber",group:"readout",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!1,size:{width:160,height:90}},{type:"tickScale",group:"readout",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!0,size:{width:200,height:200}},{type:"ruler",group:"input",value:{type:"number",writable:!1,default:0},properties:{},interaction:"scale",pointerScale:!0,size:{width:120,height:360}},{type:"switch",group:"input",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"}},interaction:"toggle",pointerScale:!1,size:{width:52,height:30,minWidth:36,minHeight:20,aspect:1.7333333333333334},role:"switch"},{type:"checkbox",group:"input",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},check:{type:"color",default:"#ffffff"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200}},interaction:"toggle",pointerScale:!1,size:{width:160,height:24,minWidth:18,minHeight:18},role:"checkbox"},{type:"toggleButton",group:"input",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},textColor:{type:"color",default:"#0f172a"},onTextColor:{type:"color",default:"#ffffff"},fontSize:{type:"number",default:14,min:6,max:200}},interaction:"toggle",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"button",group:"action",properties:{accent:{type:"color",default:"#5a6bff"},textColor:{type:"color",default:"#ffffff"},radius:{type:"number",default:8,min:0,max:200},fontSize:{type:"number",default:14,min:6,max:200}},interaction:"press",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"}];var ih=0,Ka=new Map(qa.map(e=>[e.type,e]));function Or(){return ih}function mt(e){return e===void 0?void 0:Ka.get(e)}function Ro(){return[...Ka.keys()]}function wo(e){return mt(e)!==void 0}var X={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",fontSize:0};function vo(e){return{color:e.color??X.color,surface:e.surface??X.surface,divider:e.divider??X.divider,labelColor:e.labelColor??X.labelColor,fontFamily:e.fontFamily??X.fontFamily,variant:e.variant??X.variant,motion:e.motion??X.motion,fontWeight:e.fontWeight??X.fontWeight,fontSize:e.fontSize??X.fontSize}}var Za=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Component","Shape","Text","Isometric","Dimension","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource"],Bv=[...Za,"data"],sh=["top","bottom","left","right"],Qa=e=>sh.includes(e),qt=e=>e==="Component"||e==="Widget";var Br=e=>Za.includes(e);var Ir=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
2
|
`||t==="\r"&&this.peek()!==`
|
|
3
|
-
`?(this.line++,this.col=1):this.col++,t}};var
|
|
4
|
-
`}function
|
|
5
|
-
`&&e.advance(),
|
|
6
|
-
`,t)}function
|
|
7
|
-
`&&e.peek()!=="\r";)e.advance()}function
|
|
8
|
-
`),r=1/0;for(let n of t)n.trim()&&(r=Math.min(r,
|
|
9
|
-
`)}function
|
|
10
|
-
`||n==="\r")throw new
|
|
11
|
-
`;case"t":return" ";default:throw new ye(`invalid escape '\\${r}'`,t.line,t.col)}}function Df(e,t){return e.startsWith('"""')?Bf(e,t):If(e,t)}function Xa(e,t){return re("string",Df(e,t),t)}function qa(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Ga(t))return Da(e,r);if(_f(e,t))return null;let n=Ff(e,t,r)??Hf(e,r);if(n)return n;throw new ye(`unexpected character '${t}'`,r.line,r.col)}function _f(e,t){return Ya(t)?(Ua(e),!0):_a(e)?(Fa(e),!0):!1}function Ff(e,t,r){let n=za(e,r);return n||(t==='"'?Xa(e,r):Wa(e,r))}function Hf(e,t){return Ha(e)?Va(e,t):Ba(e)?Ia(e,t):null}function Ka(e){let t=new $r(e),r=[];for(;!t.done;){let n=qa(t);n&&r.push(po(n,t))}return r.push(po(re("eof","",t.position()),t)),r}var F=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 Mr=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 F(`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 F(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Yt(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 Za(e){let t=Yt(e),r,n;if(e.at("comma")){e.next();let o=e.expect("ident",'side after ","');if(!Ea(o.value))throw new F(`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 Vf(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(Ar(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(Ar(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}function Ar(e,t=!0){let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return Vf(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:Yt(e)};default:throw new F(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var Wf=new Set([">","<",">=","<=","==","!="]);function zf(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function Ut(e,t,r){let n=r(e);for(;zf(e,t);)n={kind:"binary",operator:e.next().value,left:n,right:r(e)};return n}var Yf=new Set(["||"]),Uf=new Set(["&&"]),jf=new Set(["+","-"]),Xf=new Set(["*","/"]);function Er(e){return Ut(e,Yf,qf)}function qf(e){return Ut(e,Uf,Kf)}function Kf(e){return Ut(e,Wf,Zf)}function Zf(e){return Ut(e,jf,Qf)}function Qf(e){return Ut(e,Xf,es)}function es(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:es(e)}):eh(e)}function Jf(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(Er(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new F(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function eh(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=Er(e);return e.expect("rparen","')'"),r}case"ident":{let r=Yt(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:Jf(e)}:{kind:"ref",path:r}}default:throw new F(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var th=["bind","bind2","action"];function Nr(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&th.includes(e.peek(2).type)}function Or(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,n=Er(e),o=e.peek();if(!["newline","semi","rbrace","eof"].includes(o.type))throw new F(`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 Qa(e){let t=e.peek(),r=Yt(e);e.expect("bind","'<-'");let n=Er(e);return{target:r,expr:n,line:t.line,col:t.col}}function ts(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function rs(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(Qa(e)),Ja(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new F(`unterminated handler '${t.value}'`,t.line,t.col);r.push(Qa(e)),Ja(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Ja(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new F(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var Br=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 F("unterminated style block",n.line,n.col)}Nr(this.cursor)?(r.push(Or(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"?Za(this.cursor):Ar(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 F(`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 F(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var Ir=class{constructor(t){this.cursor=t;this.properties=new Br(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!Tr(t.value))throw new F(`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 F('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 F(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return Tr(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()}:Nr(this.cursor)?{type:"binding",binding:Or(this.cursor)}:ts(this.cursor)?{type:"handler",handler:rs(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"&&!Tr(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 Gr=class{constructor(t){this.cursor=t;this.blocks=new Ir(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new F(`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 fo(e){return new Gr(new Mr(Ka(e))).parseDocument()}function S(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 R(e){return e?.type==="number"?e.value:void 0}function Le(e){return e?.type==="tuple"?e.values:void 0}function ns(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function rh(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 ct(e,t){if(e?.type!=="endpoint")return{};let r=rh(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 G(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 Dr(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 os(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 W(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function is(e){for(let t of e.entries)if(t.type==="data")return t.data}function ut(e){let t=is(e);return t?[...W(e),...W(t)]:W(e)}function as(e,t){let r=G(e).get(t);if(r!==void 0)return r;let n=is(e);return n?G(n).get(t):void 0}var nh=["Entity","Shape","Text","Container","Path","Chart","Widget","Component","Isometric"],oh=new Set(nh);function mt(e){return oh.has(e)}function ss(e,t){for(let r of e)mt(r.kind)&&t.set(r.name,S(G(r).get("id"))??r.name),ss(W(r),t)}function _r(e){let t=new Map;return e&&ss(W(e),t),t}var ih=new Set(["id","from","to","text","order","segments"]);function Fr(e){let t={};for(let[r,n]of e){if(ih.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}var ah=new Set(["top","bottom","front","back","left","right"]);function ls(e){return e!==void 0&&ah.has(e)?e:"front"}function ds(e,t,r,n,o=[]){let i={idByName:_r(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=n.mergedProps(a);return{id:S(l.get("id"))??a.name,fromId:ct(l.get("from"),i).id,toId:ct(l.get("to"),i).id,fromFace:ls(S(l.get("fromFace"))),toFace:ls(S(l.get("toFace"))),order:R(l.get("order")),sourceIndex:o[s],props:Fr(l)}})}function cs(e,t,r){let n=t.mergedProps(e),o=ct(n.get("from"),r),i=ct(n.get("to"),r);return{id:S(n.get("id"))??e.name,fromId:o.id,toId:i.id,text:S(n.get("text")),fromSide:o.side,fromFraction:o.fraction,toSide:i.side,toFraction:i.fraction,fromPort:o.port,toPort:i.port,order:R(n.get("order")),segments:ns(n.get("segments")),props:Fr(n)}}function us(e,t,r,n,o=[]){let i={idByName:_r(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...cs(a,n,i),sourceIndex:o[s]}))}function sh(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(n=>n.type==="ident"?[n.segments]:[]):[]}function lh(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 ms(e,t){let r=sh(e,t);if(r.length<2)return[];let n=S(t.mergedProps(e).get("text"));return r.slice(1).map((o,i)=>lh(e,r[0],o,i,n))}function ps(e,t){let r=S(t.layoutProp(e,"flow")),n=R(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 Hr=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function pt(e){return e!==void 0&&Hr.includes(e)}function Te(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let n=R(r);return n===void 0?[]:[n]});return t.length>0?t:void 0}function fs(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=S(t);return r===void 0?[]:[r]})}function xe(e){let t=S(e);if(t!==void 0)return t==="true"}function ho(e){let t=e?G(e):new Map;return{min:R(t.get("min"))??0,max:R(t.get("max"))??10,step:R(t.get("step"))??1,label:S(t.get("label")),unit:S(t.get("unit")),thresholds:Te(t.get("thresholds"))}}function hs(e){return ut(e).filter(t=>t.kind==="Rule").map(t=>{let r=G(t);return{id:t.name,at:R(r.get("at"))??0,text:S(r.get("text")),color:S(r.get("color")),strokeWidth:R(r.get("strokeWidth")),dash:Te(r.get("dash"))}})}function gs(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(R);return t.every(r=>r!==void 0)?t:void 0}function bs(e){return e?.type!=="list"?[]:dh(e.values)==="tuple"?uh(e.values):ch(e.values)}function dh(e){for(let t of e){if(t.type==="number")return"scalar";if(gs(t))return"tuple"}}function ch(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function uh(e){return e.flatMap(t=>{let r=gs(t);return r?[r]:[]})}function ys(e){if(e?.type==="list")return e.values.map(mh)}function mh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:ph(e)}function ph(e){if(e.type!=="list"||e.values.length<2)return null;let t=R(e.values[0]),r=R(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function xs(e){if(e?.type==="list")return e.values.map(fh)}function fh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:S(e)??null}function Ss(e,t){if(e?.type==="list"){let o=e.values.flatMap(hh);return o.length>0?{points:o}:void 0}let r=S(e),n=r?t.get(r):void 0;if(n)return{points:n.points,normalized:!0,tension:n.tension}}function hh(e){if(e.type!=="list"||e.values.length<2)return[];let t=R(e.values[0]),r=R(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Cs(e,t,r){let n=r(e);return{id:e.name,label:S(n.get("label"))??e.name,color:S(n.get("color")),colors:xs(n.get("colors")),opacity:R(n.get("opacity")),group:S(n.get("group")),values:bs(n.get("values")),error:ys(n.get("error")),source:S(n.get("source")),target:S(n.get("target")),size:R(n.get("size")),symbol:Ss(n.get("symbol"),t),stroke:S(n.get("stroke")),strokeWidth:R(n.get("strokeWidth")),dash:Te(n.get("dash")),offset:R(n.get("offset")),labelOffsetX:R(n.get("labelOffsetX")),labelOffsetY:R(n.get("labelOffsetY"))}}function Rs(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let n=S(r.values[0]);return n===void 0?[]:[{label:n,color:S(r.values[1]),offsetX:R(r.values[2]),offsetY:R(r.values[3])}]});return t.length>0?t:void 0}var gh=["none","true","percent","waterfall"];function bh(e){return pt(e)?e:"bar"}function yh(e){return gh.find(t=>t===e)}function ks(e,t,r,n){let o=ut(e),i=o.filter(s=>s.kind==="Axis"),a=S(t.get("stacked"));return{chartType:bh(S(t.get("type"))),categories:fs(as(e,"categories")),areaOpacity:R(t.get("areaOpacity")),stacked:yh(a),scale:S(t.get("scale")),interpolate:S(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:R(t.get("idwPower")),isolines:Te(t.get("isolines")),zones:Rs(t.get("zones")),boxWidth:R(t.get("boxWidth")),orientation:S(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:R(t.get("lineTension")),highlightPoints:Te(t.get("highlightPoints")),barCornerRadius:R(t.get("barCornerRadius")),showBoxplotPoints:xe(t.get("showBoxplotPoints")),barBorderColor:S(t.get("barBorderColor")),barBorderWidth:R(t.get("barBorderWidth")),barGroupGap:R(t.get("barGroupGap")),barGlow:R(t.get("barGlow")),barGap:R(t.get("barGap")),mekkoVaryHeight:xe(t.get("mekkoVaryHeight")),hexRadius:R(t.get("hexRadius")),innerRadius:R(t.get("innerRadius")),pieCornerRadius:R(t.get("pieCornerRadius")),pieSliceGap:R(t.get("pieSliceGap")),ringThickness:R(t.get("ringThickness")),ringGap:R(t.get("ringGap")),cellGap:R(t.get("cellGap")),showValues:xe(t.get("showValues")),squareCells:xe(t.get("squareCells")),headerColor:S(t.get("headerColor")),tileGradient:xe(t.get("tileGradient")),showColumnBackdrop:xe(t.get("showColumnBackdrop")),labelPosition:S(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:S(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:S(t.get("labelColor")),linkGradient:xe(t.get("linkGradient")),connectPoints:xe(t.get("connectPoints")),reverseComparison:xe(t.get("reverseComparison")),axisX:ho(i.find(s=>s.name==="x")),axisY:ho(i.find(s=>s.name==="y"||s.name==="value")),series:o.filter(s=>s.kind==="Series").map(s=>Cs(s,r,n)),rules:hs(e)}}function ws(e,t,r,n,o){return{...e,objectType:"chart",chart:ks(t,r,n,o)}}function vs(e,t){return{depth:t,icon:S(e.get("icon"))}}function Ps(e,t,r,n){let o=Le(n(t,"size"));return{...e,objectType:"isometric",isometric:vs(r,o?.[2]??24)}}function Ls(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=R(o.values[0]),a=R(o.values[1]);return i!==void 0&&a!==void 0?[{x:t.x+i,y:t.y+a}]:[]}):[],tension:R(e.get("tension")),startMarker:S(e.get("startMarker")),endMarker:S(e.get("endMarker")),closed:S(e.get("closed"))==="true",value:R(e.get("value"))}}function Ts(e,t,r){return{...e,objectType:"path",path:Ls(t,r)}}function $s(e){let t=S(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=S(i.values[0]),l=R(i.values[1]);if(s===void 0||l===void 0)return[];let d=S(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:n}}function Ms(e,t){return{...e,objectType:"swimlane",swimlane:$s(t)}}function xh(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":zt(e.kind)?S(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":S(t.get("kind"))??""}function Sh(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":ze(e)?"component":e==="isometric"?"isometric":"shape"}function As(e,t,r){let n=xh(e,t),o=S(t.get("shape")),i=o?r.get(o):void 0;return{objectType:zt(e.kind)?"component":Sh(n),kind:n,shapeType:i?"symbol":o,symbol:i}}function Es(e,t,r,n){let o=n??Le(r(e,"position"))??[0,0],i=Le(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:R(r(e,"rotation")),order:R(r(e,"order"))}}var Ch=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function Ns(e){let t={};for(let[r,n]of e){if(Ch.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}function Os(e,t,r,n,o){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=As(e,l,s),c=Es(e,t,a,o),u={id:S(l.get("id"))??e.name,kind:d.kind,text:S(l.get("text")),...c,parentFrameId:n??S(l.get("parent")),props:Ns(l)};switch(d.objectType){case"chart":return ws(u,e,l,s,i);case"isometric":return Ps(u,e,l,a);case"path":return Ts(u,l,t);case"swimlane":return Ms(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:S(l.get("type"))??"rollingNumber",value:S(l.get("value"))??"0",digits:R(l.get("digits")),duration:R(l.get("duration")),min:R(l.get("min")),max:R(l.get("max")),label:S(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function Bs(e){return W(e).filter(t=>mt(t.kind)).map(t=>S(G(t).get("id"))??t.name)}var go=class{#e;#n=[];#t=[];#r=[];#o=[];#i=[];#s=0;constructor(t){this.#e=t.canvasObjectResolutionContext}resolve(t){let r=t?this.#a(t,{origin:{x:0,y:0}}):[];return{canvasObjects:this.#n,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#o,connectionSourceIndexes:this.#i}}#a(t,r){let n=[],o=ps(t,this.#e);for(let i of W(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(mt(t.kind))return this.#u(t,r,n,o),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#o.push(o),[];case"Connection":return this.#r.push(t),this.#i.push(o),[];case"Net":{let i=ms(t,this.#e);return this.#t.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=Le(this.#e.layoutProp(t,"size"))??[0,0];return{...Os(t,r.origin,this.#e,r.frameId,n(i)),sourceIndex:o}}#m(t,r){let n=this.#e.mergedProps(t);return{id:S(n.get("id"))??t.name,name:S(n.get("text"))??t.name,color:S(n.get("color")),icon:S(n.get("icon")),canvasObjectIds:Bs(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??S(n.get("parent"))}}};function Is(e,t){return new go(t).resolve(e)}function Gs(e){let t=G(e),r=S(t.get("program"));if(!r)return;let n={};for(let[o,i]of t){if(o==="program")continue;let a=R(i),s=S(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 Rh(e){let t=G(e).get("points");return t?.type!=="list"?[]:t.values.flatMap(r=>{if(r.type!=="list"||r.values.length<2)return[];let n=R(r.values[0]),o=R(r.values[1]);return n===void 0||o===void 0?[]:[[n,o]]})}function kh(e){let t=W(e).filter(r=>r.kind==="Port").flatMap(r=>{let n=Le(G(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 Ds(e){let t=Rh(e);if(!(t.length<2))return{name:e.name,points:t,tension:R(G(e).get("tension")),ports:kh(e)}}function wh(e){return W(e).find(t=>t.kind==="Model")}function _s(e){return{styles:Ph(e),layouts:Lh(e),symbols:Th(e),shaders:vh(e),model:$h(e)}}function vh(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let n=Gs(r);n&&t.set(r.name,n)}return t}function Ph(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function Lh(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function Th(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let n=Ds(r);n&&t.set(r.name,n)}return t}function $h(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=wh(t);if(r)return r}}}function Fs(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 Hs(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 W(e))Hs(o,t,r,n)}function Vs(e,t,r){let n=[];for(let o of e.blocks)Hs(o,t,r,n);return n}function yo(e,t){return new bo(e,t).resolveAll()}var bo=class{#e;#n;#t=new Map;constructor(t,r){this.#e=t,this.#n=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let n=this.#t.get(t);if(n)return n;let o=this.#e.get(t);if(!o||r.has(t))return new Map;let i=this.#o(o,new Set([...r,t]));for(let[a,s]of G(o))i.set(a,s);return this.#t.set(t,i),i}#o(t,r){let n=this.#n(t);return n?new Map(this.#r(n,r)):new Map}};function Ws(e){let{styles:t,layouts:r,symbols:n,shaders:o}=e,i=c=>Fs(c.composition,t,r),a=yo(t,c=>i(c).styleRef),s=yo(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[p,f]of G(c))u.set(p,f);for(let[p,f]of Dr(c))u.set(p,f);return u},layoutProp:(c,u)=>{let p=os(c);if(p.has(u))return p.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:n,shaderDefs:o}}var Mh=new Set(["radar","radial"]),zs=new Set(["scatter","custom","hexbin"]);function Ys(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(G(n).get("type"));o!==void 0&&!pt(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: ${Hr.join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function Us(e){let t=[],r=n=>{if(n.kind==="Chart")for(let o of ut(n).filter(i=>i.kind==="Series"))G(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 W(n))r(o)};for(let n of e.blocks)r(n);return t}function js(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(G(n).get("type")),i=pt(o)?o:"bar";S(Dr(n).get("gridShape"))==="circle"&&!zs.has(i)&&!Mh.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: ${[...zs].join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function Xs(e){let t=[],r=n=>{if(zt(n.kind)){let o=S(G(n).get("type"))??"rollingNumber";uo(o)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:n.name,message:`Unsupported component type '${o}'. Supported: ${co().join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function qs(e){let t=_s(e);return{model:t.model,diagnostics:[...Vs(e,t.styles,t.layouts),...Ys(e),...js(e),...Us(e),...Xs(e)],canvasObjectResolutionContext:Ws(t)}}function Ks(e){let t=qs(e),{canvasObjects:r,groups:n,linkBlocks:o,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=Is(t.model,t),l=us(t.model,o,r,t.canvasObjectResolutionContext,a),d=ds(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 jt(e){return e.objectType==="isometric"&&e.isometric!==void 0}function Zs(e){return Ks(fo(e))}var Xt=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function Oh(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\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 Bh(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\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 ae(e){if(!(e==null||e===""))return Oh(e)??Bh(e)??e}function Vr(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\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 Ih(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 pe(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&&Ih(r,o[0].trim(),o[1].trim())}return r}var y=e=>e===void 0?void 0:Number(e);function Gh(e){try{return JSON.parse(e)}catch{return}}function Be(e){if(e===void 0)return;let t=Gh(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 $e(e){let t=ae(e);return typeof t=="string"?t:void 0}var Dh=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function se(e){return e&&Dh.test(e)?e:void 0}function Se(e,t,r){return t.includes(e)?e:r}var Wr=["normal","bold"],Qs=["normal","bold","100","200","300","400","500","600","700","800","900"],Js=["top","bottom","left","right"],xo=["none","arrow","filled_arrow"];function ft(e){let t=ae(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var el=["left","center","right"],tl=["top","middle","bottom"],zr=["solid","dashed","dotted"],Yr=["straight","curved","orthogonal"];function le(e,t){return e!==void 0&&t.includes(e)?e:void 0}var rl=["solid","dashed","dotted","double"],So=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function _h(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function Fh(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function Hh(e){return e==="dashed"||e==="dotted"?e:"solid"}function Vh(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:ae(t.color),colors:t.colors?.map(r=>r===null?null:ae(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 Wh(e){let t=_h(e.fill);return{fillColor:t?"#111418":ae(e.fill)??"#ffffff",fillImage:t,strokeColor:$e(e.stroke)??"#475569",strokeWidth:y(e.strokeWidth)??1,cornerRadius:y(e.cornerRadius)??12,shadowStyle:pe(e.shadow)}}function zh(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:y(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:Hh(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function Yh(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:y(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:y(e.tickLength),axisFontSize:y(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 Uh(e){return{textColor:e.textColor??"#0f172a",titleSize:y(e.titleSize),titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:y(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function jh(e){return{legendColor:e.legendColor,showLegend:e.showLegend==="true",legendPosition:Fh(e.legendPosition)}}function nl(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,...Vh(e),...Wh(t),...zh(t),...Yh(t),...Uh(t),...jh(t),order:e.order,sourceIndex:e.sourceIndex}}function ol(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:ae(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:y(t.barSegments),barSegmentGap:y(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:y(t.barGlassBlur),barGlassSaturation:y(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:y(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:y(t.barTrackHatchAngle),barTrackHatchSpacing:y(t.barTrackHatchSpacing),barTrackHatchWidth:y(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:y(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:y(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function il(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:y(t.lineWidth),lineGlow:y(t.lineGlow),pointSize:y(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:y(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:y(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function al(e,t){return{categories:e?.categories,pointSize:y(t.pointSize),pointOpacity:y(t.pointOpacity),pointStrokeWidth:y(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function sl(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:y(t.boxWhiskerWidth),boxMedianWidth:y(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:y(t.boxCapSize),boxPointSize:y(t.boxPointSize),boxPointOpacity:y(t.boxPointOpacity),boxJitter:y(t.boxJitter)}}function ll(e){return{scale:Vr(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function dl(e,t){return{categories:e?.categories,zones:e?.zones,cellGap:e?.cellGap,showValues:e?.showValues,squareCells:e?.squareCells,barCornerRadius:e?.barCornerRadius,cellShape:t.cellShape==="circle"?"circle":t.cellShape==="square"?"square":void 0,cellStrokeColor:t.cellStrokeColor,cellStrokeWidth:y(t.cellStrokeWidth),cellValueSize:y(t.cellValueSize),cellValueColor:t.cellValueColor}}function cl(e,t){return{hexRadius:e?.hexRadius,scale:Vr(e?.scale),hexGap:y(t.hexGap),hexStrokeWidth:y(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:y(t.hexMinOpacity)}}function ul(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:y(t.mekkoColumnGap),mekkoSegmentGap:y(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:y(t.mekkoSegmentStrokeWidth),mekkoLabelSize:y(t.mekkoLabelSize),mekkoValueSize:y(t.mekkoValueSize),mekkoTextColor:t.mekkoTextColor,showMekkoTotals:t.showMekkoTotals===void 0?void 0:String(t.showMekkoTotals)!=="false",mekkoValueFormat:t.mekkoValueFormat==="percent"?"percent":t.mekkoValueFormat==="value"?"value":void 0}}function ml(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieSweep:y(t.pieSweep),pieExplode:y(t.pieExplode),pieGlow:y(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:y(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:y(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function pl(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:y(t.pieStrokeWidth),polarTrackOpacity:y(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:y(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:y(t.polarValueSize),polarNameSize:y(t.polarNameSize),polarValueFirst:t.polarValueFirst===void 0?void 0:String(t.polarValueFirst)!=="false",polarOutsideLabels:t.polarOutsideLabels===void 0?void 0:String(t.polarOutsideLabels)!=="false"}}function fl(e){return{radarStrokeWidth:y(e.radarStrokeWidth),radarPointSize:y(e.radarPointSize),radarTension:y(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function hl(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...fl(t)}}function gl(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...fl(t)}}function bl(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:y(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:y(t.ringStartAngle),ringSweep:y(t.ringSweep)}}function yl(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:y(t.sankeyNodeWidth),sankeyNodeGap:y(t.sankeyNodeGap),sankeyLinkOpacity:y(t.sankeyLinkOpacity),sankeyLinkCurve:y(t.sankeyLinkCurve),sankeyLabelSize:y(t.sankeyLabelSize)}}function xl(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:y(t.tileStrokeWidth),tileLabelSize:y(t.tileLabelSize),tileValueSize:y(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:y(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:y(t.headerHeight)}}function Sl(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:y(t.customConnectorWidth),customConnectorOpacity:y(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:y(t.customBeforeStrokeWidth),customLabelSize:y(t.customLabelSize),customLabelColor:t.customLabelColor}}function Cl(e){let t=nl(e),r=e.chart,n=e.props,o=r?.chartType??"bar";switch(o){case"bar":return K(t,o,ol(r,n));case"line":return K(t,o,il(r,n));case"scatter":return K(t,o,al(r,n));case"boxplot":return K(t,o,sl(r,n));case"field":return K(t,o,ll(r));case"heatmap":return K(t,o,dl(r,n));case"hexbin":return K(t,o,cl(r,n));case"mekko":return K(t,o,ul(r,n));case"pie":return K(t,o,ml(r,n));case"polarArea":return K(t,o,pl(r,n));case"radar":return K(t,o,hl(r,n));case"radial":return K(t,o,gl(r,n));case"radialBar":return K(t,o,bl(r,n));case"sankey":return K(t,o,yl(r,n));case"treemap":return K(t,o,xl(r,n));case"custom":return K(t,o,Sl(r,n))}}function K(e,t,r){return{...e,chartType:t,config:r}}function Xh(e,t){let r=Number(t);if(t===void 0||t===""||!Number.isFinite(r))return e.default;let n=e.min===void 0?r:Math.max(e.min,r);return e.max===void 0?n:Math.min(e.max,n)}function qh(e,t){switch(e.type){case"number":return Xh(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return se(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function Kh(e,t){let r={};for(let[n,o]of Object.entries(e?.properties??{}))r[n]=qh(o,t[n]);return r}function Zh(e,t){if(!e)return"";if(e.type==="boolean")return t==="true";if(e.type==="number"){let r=Number(t);return Number.isFinite(r)?r:e.default}return t}function Rl(e){let t=lt(e.component.type);return{id:e.id,type:e.component.type,value:t?Zh(t.value,e.component.value):e.component.value,disabled:e.props.disabled==="true",label:e.component.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,properties:Kh(t,e.props)}}var Qh=/^[\w\s,'"-]+$/;function Co(e){return e&&Qh.test(e)?e:void 0}var Jh=/^(?:[1-9]00|normal|bold)$/;function eg(e){return e==="plain"||e==="flip"?e:void 0}function tg(e){return e==="roll"||e==="fade"?e:void 0}function rg(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function Ro(e){return e&&Jh.test(e)?e:void 0}var ng=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],og=["color","accent"];function ig(e){let t=e.props,r={};for(let n of ng){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of og){let o=se(t[n]);o&&(r[n]=o)}return{id:e.id,type:"tickScale",value:e.component.value,max:e.component.max,label:e.component.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:se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Ro(t.labelWeight),fontFamily:Co(t.labelFont)}:void 0}}var ag=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],sg=["color","accent","glow"],lg={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},dg=["core","peak"];function cg(e){let t=e.props,r={};for(let n of ag){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of sg)r[n]=se(t[n])??lg[n];for(let n of dg){let o=se(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.component.value,min:e.component.min,max:e.component.max,label:e.component.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:se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Ro(t.labelWeight),fontFamily:Co(t.labelFont)}:void 0}}function ug(e){let t=e.props;return{id:e.id,type:"rollingNumber",value:e.component.value,digits:e.component.digits,duration:e.component.duration,label:e.component.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:se(t.color),surface:se(t.surface),divider:se(t.divider),labelColor:se(t.labelColor),fontFamily:Co(t.fontFamily),variant:eg(t.variant),motion:tg(t.motion),fontWeight:Ro(t.fontWeight),fontSize:rg(t.fontSize)}}}var mg={rollingNumber:ug,tickScale:ig,ruler:cg};function kl(e){let t=e.component.type;return ze(t)?mg[t](e):Rl(e)}function wl(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:le(t.route,Yr)??"straight",color:ft(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:le(t.strokeStyle,zr),opacity:t.opacity!==void 0?y(t.opacity):void 0}}}function vl(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:y(t.fontSize)??14,fontWeight:Se(t.fontWeight,Wr,"bold"),fontFamily:t.fontFamily,dash:Be(t.dash),showLabel:t.showLabel!=="false",labelPosition:Se(t.labelPosition,Js,"top"),shadow:t.shadow!=="false",order:e.order,sourceIndex:e.sourceIndex}}function Pl(e){let t=e.props,r=pe(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:$e(t.fill)??"#f8fafc",strokeColor:$e(t.stroke)??"#111827",strokeWidth:y(t.strokeWidth)??1,cornerRadius:y(t.cornerRadius)??8,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:y(t.labelOffsetX)??0,labelOffsetY:y(t.labelOffsetY)??0,labelBackground:$e(t.labelBackground),parentFrameId:e.parentFrameId}}function Ll(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:y(t.weight),showWeight:t.showWeight!=="false",style:{pathType:le(t.route,Yr),color:ft(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:le(t.strokeStyle,zr),opacity:t.opacity!==void 0?y(t.opacity):void 0,fontSize:y(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:pe(t.shadow)},startMarker:le(t.markerStart,So),endMarker:le(t.markerEnd,So),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 Tl(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:Se(e.path?.startMarker,xo,"none"),endMarker:Se(e.path?.endMarker,xo,"none"),closed:e.path?.closed??!1,strokeColor:$e(t.stroke)??"#7c3aed",strokeWidth:y(t.strokeWidth)??2,dash:Be(t.dash)??[],opacity:y(t.opacity)??1,fillColor:$e(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function pg(e){return e||"rectangle"}function $l(e,t){let r=e.props,n=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:pg(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:ae(r.fill??(n?"none":void 0)),strokeColor:ft(r.stroke??(n?"none":void 0)),isText:n||void 0,strokeWidth:y(r.strokeWidth),textColor:r.textColor,fontSize:y(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Se(r.fontWeight,Qs,"normal"),letterSpacing:y(r.letterSpacing),lineHeight:y(r.lineHeight),fontFamily:r.fontFamily,textAlign:le(r.textAlign,el),textVerticalAlign:le(r.verticalAlign,tl),cornerRadius:y(r.cornerRadius),shadowStyle:pe(r.shadow),dash:Be(r.dash),strokeStyle:le(r.strokeStyle,rl),opacity:y(r.opacity),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function Ml(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,dash:Be(t.dash),shadowStyle:pe(t.shadow),textColor:t.textColor??"#6b7280",fontSize:y(t.fontSize)??22,fontWeight:Se(t.fontWeight,Wr,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var ko=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function Al(e){let t=ko(e.canvasObjects),r=new Map((e.shaders??[]).map(n=>[n.name,n]));return{shapes:t.filter(n=>n.objectType==="shape").map(n=>$l(n,r)),frames:t.filter(n=>n.objectType==="frame").map(vl),swimlanes:t.filter(n=>n.objectType==="swimlane").map(Ml),isometricObjects:t.filter(jt).map(Pl),paths:t.filter(n=>n.objectType==="path").map(Tl),charts:t.filter(n=>n.objectType==="chart").map(Cl),components:t.filter(n=>n.objectType==="component"&&n.component!==void 0).map(kl),links:ko(e.links).map(Ll),connections:ko(e.connections).map(wl)}}var Ur=new Set(["top","front","right"]),El=Math.PI/6,ht=Math.cos(El),qt=Math.sin(El);function wo(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)*ht,height:r+(t+n)*qt}}function vo(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*ht/2,y:e.y+(t+r)*qt/2}}function fg(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 Po(e,t){return fg(Ye(e)[t])}function Ye(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*ht,y:r},s={x:n*ht,y:n*qt},l={x:-i*ht,y:i*qt},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},p={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:p.x+d.x,y:p.y+d.y},b={x:u.x+d.x,y:u.y+d.y},x={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,p,u],bottom:[f,x,g,b],front:[u,p,g,b],back:[a,c,x,f],right:[p,c,x,g],left:[a,u,b,f]}}function hg(e){return Math.max(0,Math.min(255,Math.round(e)))}function gg(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 bg(e,t,r){return`#${[e,t,r].map(n=>hg(n).toString(16).padStart(2,"0")).join("")}`}function Nl(e,t){let r=gg(e);if(!r)return e;let[n,o,i]=r;return bg(n*t,o*t,i*t)}function Lo(e){return{topFill:e,frontFill:Nl(e,.95),sideFill:Nl(e,.88)}}var yg=Math.PI/180;function xg(e,t){let r=t*yg,n=Math.cos(r),o=Math.sin(r);return{x:e.x*n-e.y*o,y:e.x*o+e.y*n}}function Sg(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ol(e,t){let r=Sg(e),n=e.rotation?xg(t,e.rotation):t;return{x:r.x+n.x,y:r.y+n.y}}function To(e,t){return Ol(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function gt(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function $o(e,t){let r=gt(e),n=gt(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 Cg(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 Rg(e,t){let r=e.symbol?.ports?.find(n=>n.name===t.port);return r?To({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):gt(e)}function Mo(e,t,r){let n=kg(e,t),o=wg(n.explicit);if(o)return o;let i=Bl(r,n.canvasObjectId);if(!i)return{x:0,y:0};let a=vg(i,n.explicit);return a||Pg(i,Bl(r,n.oppositeCanvasObjectId))}function kg(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function wg(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function vg(e,t){return t?.kind==="port"?Rg(e,t):t?.kind==="side"?Cg(e,t):null}function Pg(e,t){return t?$o(e,t):gt(e)}function Bl(e,t){return e.find(r=>r.id===t)}var Lg=15e3;function Tg(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function Il(e,t){return e?Po(e,t):{x:0,y:0}}function Gl(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??Lg+r}}function $g(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Ur.has(t.fromFace)?void 0:Gl(e,t.fromId),Ur.has(t.toFace)?void 0:Gl(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 Mg(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,...$g(e.isometricObjects,r)},from:Il(t.get(r.fromId??""),r.fromFace),to:Il(t.get(r.toId??""),r.toFace),kind:"connection"}))}function Dl(e){let t=Tg(e);return[...e.links.map(n=>({link:n,from:Mo(n,"from",t),to:Mo(n,"to",t)})),...Mg(e)]}function Ao(e){let t=Zs(e),r=Al(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,charts:r.charts,components:r.components,links:Dl(r),diagnostics:t.diagnostics}}function Z(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 Eo={minX:0,minY:0,maxX:100,maxY:100};function Q(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 B(e,t,r=0){return t?Ng(Ag(e,t),r):Q(e,r)}function Ag(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 Eg(e).map(s=>({x:r+(s.x-r)*i-(s.y-n)*a,y:n+(s.x-r)*a+(s.y-n)*i}))}function Eg(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 Ng(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 fe(e){return e.points.length===0?"":e.points.length<3||e.tension<=0?Og(e):Bg(e)}function Og(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 Bg(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(Ig(e,o));return e.closed&&n.push("Z"),n.join(" ")}function Ig(e,t){let r=jr(e,t-1),n=jr(e,t),o=jr(e,t+1),i=jr(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 jr(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 m(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _l(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 Fl(e,t){return e.sourceIndex??t}function k(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 E="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var Hl="#94a3b8";function Vl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,60)),a=m(e.rotation,0),s=1e4+t,l=B({x:r,y:n,width:o,height:i},a,2);return[{id:`widget-${e.id}`,type:"rect",order:s,bounds:l,x:r,y:n,width:o,height:i,rx:6,rotation:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:Hl},strokeWidth:1,dash:[4,3]}},{id:`widget-${e.id}-label`,type:"text",order:s+.1,bounds:l,x:r,y:n,width:o,height:i,lines:[e.type],fontFamily:E,fontSize:12,fontWeight:"normal",color:Hl,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function Wl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,160)),i=Math.max(0,m(e.height,90)),a=m(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:B({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,value:Wt(e.value,e.digits),digits:e.digits,duration:Math.max(0,m(e.duration,420)),label:e.label,componentStyle:mo(e.style)}]}function zl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,200)),i=Math.max(0,m(e.height,200)),a=m(e.rotation,0),s=m(e.max,100)||100,l=Math.min(1,Math.max(0,m(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:B({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(...Gg(e,{x:r,y:n,width:o,height:i,rotation:a,max:s,order:1e4+t})),d}function Gg(e,t){let r=e.labels??{},n=Math.max(1,m(Number(e.parameters.ticks),48)),o=Math.max(1,m(Number(e.parameters.major),5)),i=m(Number(e.parameters.start),225)*Math.PI/180,a=m(Number(e.parameters.sweep),270)*Math.PI/180,s=m(Number(e.parameters.radius),.9)+m(r.offset,.08),l=m(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(n/o),p=[];for(let f=0;f<=u;f+=1){let g=f*o/n,b=i-g*a,x=d+Math.cos(b)*s*(t.width/2),C=c-Math.sin(b)*s*(t.height/2),L={x:x-24,y:C-l,width:48,height:l*2};p.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:B(L,0,2),...L,lines:[String(Math.round(t.max*g*10)/10)],fontFamily:r.fontFamily||E,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return p}function Yl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,360)),a=m(e.rotation,0),s=m(e.min,0),l=m(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(m(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:B({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(...Dg(e,{x:r,y:n,width:o,height:i,min:s,max:l,order:1e4+t})),c}function Dg(e,t){let r=e.labels??{},n=e.parameters.axis==="horizontal",o=Math.max(1,m(Number(e.parameters.ticks),50)),i=Math.max(1,m(Number(e.parameters.major),5)),a=m(Number(e.parameters.inset),.05)>0?m(Number(e.parameters.inset),.05):.05,s=m(Number(e.parameters.line),.7)>0?m(Number(e.parameters.line),.7):.7,l=n?t.height:t.width,d=(m(Number(e.parameters.length),.1)>0?m(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-m(r.offset,.04)*l,u=m(r.size,12),p=Math.floor(o/i),f=[];for(let g=0;g<=p;g+=1){let b=g*i/o,x=a+(1-2*a)*b,C=n?{x:t.x+t.width*x-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-x)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${g}`,type:"text",order:t.order+.1,bounds:B(C,0,2),...C,lines:[String(Math.round((t.min+(t.max-t.min)*b)*10)/10)],fontFamily:r.fontFamily||E,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:n?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var _g="#94a3b8";function Ie(e,t,r){return{x:m(e.x,0),y:m(e.y,0),width:Math.max(1,m(e.width,r.width)),height:Math.max(1,m(e.height,r.height)),order:1e4+t}}var X=(e,t)=>String(e.properties[t]??""),Ue=(e,t)=>Number(e.properties[t]??0),de=e=>({kind:"solid",color:e}),bt=(e,t)=>e.disabled?_g:t;function Ce(e,t){return e.disabled?{...t,opacity:.4}:t}function Ge(e,t){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:B(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}}function yt(e,t,r,n,o){return{id:`widget-${e.id}-${t}`,type:"text",order:o,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[n.text],fontFamily:E,fontSize:n.fontSize,fontWeight:"600",color:n.color,align:n.align,verticalAlign:"middle",lineHeight:1.3}}function Ul(e,t){let r=Ie(e,t,{width:120,height:40}),n=[Ge(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min(Ue(e,"radius"),r.height/2),style:Ce(e,{fill:de(X(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let o={text:e.label,color:bt(e,X(e,"textColor")),fontSize:Ue(e,"fontSize"),align:"center"};n.push(yt(e,"label",r,o,r.order+.2))}return n}var Fg=.22,Hg=.5,Vg=[[.24,.52],[.43,.72],[.78,.3]];function Wg(e){let[t,...r]=Vg.map(([n,o])=>`${e.x+n*e.width} ${e.y+o*e.width}`);return`M ${t} ${r.map(n=>`L ${n}`).join(" ")}`}function zg(e,t,r){let n=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:B(r,0,2),...r,rx:r.width*Fg,style:Ce(e,{fill:n?de(X(e,"accent")):{kind:"none"},stroke:de(n?X(e,"accent"):X(e,"stroke")),strokeWidth:1.5})}}function Yg(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:B(r,0,0),d:Wg(r),style:Ce(e,{fill:{kind:"none"},stroke:de(X(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Ug(e,t,r,n){let o=r*Hg,i={x:t.x+r+o,y:t.y,width:Math.max(0,t.width-r-o),height:t.height},a={text:n,color:bt(e,X(e,"textColor")),fontSize:Ue(e,"fontSize"),align:"left"};return yt(e,"label",i,a,t.order+.3)}function jl(e,t){let r=Ie(e,t,{width:160,height:24}),n=Math.min(r.height,r.width),o={x:r.x,y:r.y+(r.height-n)/2,width:n,height:n};return[Ge(e,r),zg(e,r,o),...e.value===!0?[Yg(e,r,o)]:[],...e.label?[Ug(e,r,n,e.label)]:[]]}var jg=.12;function Xl(e,t){let r=Ie(e,t,{width:52,height:30}),n=e.value===!0,o=r.height*jg,i=r.height/2-o,a=n?r.x+r.width-r.height/2:r.x+r.height/2,s={x:a-i,y:r.y+o,width:i*2,height:i*2};return[Ge(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:Ce(e,{fill:de(X(e,n?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:B(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:Ce(e,{fill:de(X(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function ql(e,t){let r=Ie(e,t,{width:120,height:40}),n=e.value===!0,o=[Ge(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:B(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:Ce(e,{fill:n?de(X(e,"accent")):{kind:"none"},stroke:de(n?X(e,"accent"):X(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:bt(e,X(e,n?"onTextColor":"textColor")),fontSize:Ue(e,"fontSize"),align:"center"};o.push(yt(e,"label",r,i,r.order+.2))}return o}var je=e=>(t,r)=>e(t,r),Xg=new Map([["rollingNumber",je(Wl)],["tickScale",je(zl)],["ruler",je(Yl)],["switch",je(Xl)],["checkbox",je(jl)],["toggleButton",je(ql)],["button",je(Ul)]]);function Kl(e){return Xg.get(e)}function qg(e){let t=lt(e.type)?.role;if(!t||!Pr(e))return;let r=typeof e.value=="boolean"?e.value:void 0;return{role:t,...r===void 0?{}:t==="button"?{pressed:r}:{checked:r},...e.disabled?{disabled:!0}:{}}}function Kg(e){return e.label??(Pr(e)?e.id:String(e.value))}function No(e){return e.flatMap((t,r)=>{let n=Kl(t.type)??Vl,o=Z(n(t,r),"widget",t.id,t.type,Kg(t),t.parentFrameId),i=qg(t),a=o.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),o})}function Oo(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 Bo(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 Kt(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 Zt(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 Zl(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,p,f)=>u>0?`A ${u} ${u} 0 0 1 ${p} ${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 Xr(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 qr=8;function Zg(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:Bo(o,i,r,t,qr)}}case"left":{let o=e.x-t,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Kt(o,i,t,r,qr)}}case"right":{let o=e.x+e.width,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Zt(o,i,t,r,qr)}}default:{let o=e.x-n,i=e.y-t;return{x:o,y:i,width:r,height:t,path:Oo(o,i,r,t,qr)}}}}function Ql(e){let t=Math.max(32,e.fontSize+18),r=16,n=Math.max(120,e.title.length*e.fontSize*.62+r*2),o=Zg(e,t,n),i=Q(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?Jg(e,o,r,i):Qg(e,o,r,i)]}function Qg(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??E,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Jg(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??E,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:o,y:i}}}var eb={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function tb(e,t,r){let n=e.shadow??!0,o=Q({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(n?20:4)),i={...Xr(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=eb[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:Zl(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function Jl(e,t){if(e.isVisible===!1)return[];let r=t,n=(e.showLabel??!0)&&!!e.title,o=[tb(e,r,n)];return n&&e.title&&o.push(...Ql({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 rb(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Kr(e){if(!e?.enabled)return;let t=rb(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 nb(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 ed(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:nb(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function td(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??E,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function ob(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{...td(e,t,r),bounds:B({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 ib(e,t,r){return{...td(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 rd(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?ob:ib;return e.lanes.map((r,n)=>t(e,r,n))}function ab(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 sb(e){let t=0;return ab(e).map(r=>{let n={...r,offset:t};return t+=r.size,n})}function nd(e,t){return{swimlane:e,order:5e3+t,bounds:Q({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:sb(e)}}function od(e,t){if(e.isVisible===!1)return[];let r=nd(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:{...Xr(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Kr(e.shadowStyle)}},...ed(r),...rd(r)]}function id(e){return[...e.frames.flatMap((t,r)=>Z(Jl(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>Z(od(t,r),"swimlane",t.id))]}function Io(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function ad(e,t,r){let n=Io(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 lb(e,t,r,n){let o=Math.max(0,Math.min(n,Io(t,e)/2,Io(t,r)/2));return{vertex:t,start:ad(t,e,o),end:ad(t,r,o)}}function Zr(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)=>lb(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 db(e,t){let r=Math.max(0,m(e.strokeWidth,1)),n=m(e.rotation,0),o=wo(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:B(o,n,r+2),rotation:n,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function cb(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+m(r.shadowStyle?.distance,0),d=t.top.map(b=>({x:b.x,y:b.y+l})),c={x:d.reduce((b,x)=>b+x.x,0)/d.length,y:d.reduce((b,x)=>b+x.y,0)/d.length},u=1.3,p=d.map(b=>({x:c.x+(b.x-c.x)*u,y:c.y+(b.y-c.y)*u})),f=p.map(b=>b.x),g=p.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:Zr(p,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:m(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function ub(e,t,r){let{object:n,order:o,common:i}=e,a={...i.style,stroke:{kind:"none"}},s=Lo(n.fill??"#f8fafc"),l={prop:"style.fill",propKind:"color",propSolidOnly:!0},d=(c,u,p,f)=>({...i,id:`isometric-${n.id}-${c}`,order:o+u,d:Zr(p,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 mb(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 pb(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:m(n.labelOffsetX,0),labelOffsetY:m(n.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}var Go=20,fb=12,hb=6,Qr=3,gb=6.5;function bb(e){let{object:t}=e,r=vo(t),n=r.y-fb+m(t.labelOffsetY,0);return{anchor:r,centerX:r.x+m(t.labelOffsetX,0),topY:n-Go,bottomY:n}}function yb(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:Go,lines:[r],fontFamily:E,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function xb(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 Sb(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*gb+hb*2);return{type:"rect",id:`isometric-${o.id}-label-background`,order:i+.28,x:s-c/2,y:l-Qr,width:c,height:Go+Qr*2,rx:4,bounds:{minX:s-c/2,minY:l-Qr,maxX:s+c/2,maxY:d+Qr},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:n},stroke:{kind:"none"}}}}function Cb(e,t){let r=bb(e),n=yb(e,r,t),o=xb(e,r),i=e.object.labelBackground;return i?[o,Sb(e,r,t,i),n]:[o,n]}function Rb(e,t){let r=db(e,t),n=Ye(e),o=Math.max(0,m(e.cornerRadius,8)),i=[n.top[0],n.top[1],n.right[2],n.front[2],n.front[3],n.top[3]],a=Zr(i,o),s={type:"path",d:a},l=cb(r,n),d=mb(r,n,s),c=pb(r,a,o),u=ub(r,n,s),p=l?[c,...u,l,d]:[c,...u,d];return e.text?[...p,...Cb(r,e.text)]:p}function sd(e){return e.flatMap((t,r)=>Z(Rb(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function kb(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 ld(e,t,r){let n=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!n)return[];let o=m(e.link.style?.fontSize,10),i=kb(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??E,fontSize:o,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function dd(e){return[...ld(e,"start",0),...ld(e,"end",1)]}function cd(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??E,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var Do=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}},ud=(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 wb(e,t,r){let n=Do(e),o=Do(t),i=n.a??1,a=o.a??1;return ud(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 Qt(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 wb(a.color,s.color,d)}}return o.color}function md(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 pd=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function Re(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 Jr(e,t,r,n){if(Me(e,r,n)<=t)return e;let o=e.length;for(;o>1&&Me(`${e.slice(0,o)}\u2026`,r,n)>t;)o-=1;return`${e.slice(0,o)}\u2026`}function Me(e,t,r){return e.length*t*(r?.64:.58)}function fd(e){return{measure:(t,r)=>Me(t,e,r),spaceWidth:e*.58}}var Xe=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function _o(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 Fo(e,t,r,n,o){let i=Xe(e,t,o),a=Xe(t,r,o),s=Xe(r,n,o),l=Xe(i,a,o),d=Xe(a,s,o),c=Xe(l,d,o);return{left:[e,i,l,c],right:[c,d,s,n]}}function en(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:Xe(i,a,l),segmentIndex:o}}n+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function tn(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 hd(e,t,r,n,o=40){let i=0,a=e;for(let s=1;s<=o;s++){let l=_o(e,t,r,n,s/o);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var xt=40;function vb(e){let t=[0],r=e[0];for(let n=1;n<=xt;n++){let o=_o(...e,n/xt);t.push(t[n-1]+Math.hypot(o.x-r.x,o.y-r.y)),r=o}return t}function gd(e,t){let r=e[xt];if(t<=0)return 0;if(t>=r)return 1;for(let n=1;n<=xt;n++)if(e[n]>=t){let o=(t-e[n-1])/(e[n]-e[n-1]||1);return(n-1+o)/xt}return 1}function Pb(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 bd(e,t){if(e.length<8)return null;let r=Lb(e),n=vb(r),o=n[xt];if(o===0)return null;let i=o/2,a=Math.max(0,i-t.minimumVisibleStub),s=Pb(r,t,a),l=gd(n,i-s),d=gd(n,i+s);return{before:Tb(r,l),after:$b(r,d),bezier:!0}}function Lb(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 Tb(e,t){return t<=.01?null:Fo(...e,t).left.flatMap(r=>[r.x,r.y])}function $b(e,t){return t>=.99?null:Fo(...e,t).right.flatMap(r=>[r.x,r.y])}function yd(e,t){if(e.length<4)return null;let r=tn(e);if(r===0)return null;let n=Mb(e,r,t);return{before:Eb(e,n.beforeLength),after:Nb(e,n.afterLength,r),bezier:!1}}function Mb(e,t,r){let n=t/2,o=en(e,n),i={x:e[o.segmentIndex],y:e[o.segmentIndex+1]},a={x:e[o.segmentIndex+2],y:e[o.segmentIndex+3]},s=Ab(i,a,r,n);return{beforeLength:n-s,afterLength:n+s}}function Ab(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 Eb(e,t){if(t<=.5)return null;let r=en(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function Nb(e,t,r){if(t>=r-.5)return null;let n=en(e,t);return[n.point.x,n.point.y,...e.slice(n.segmentIndex+2)]}var xd=3,Ob=10;function Bb(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 Ho(e,t){return t?hd(...Bb(e)):tn(e)}function Sd(e,t,r,n){let o={halfWidth:(r+xd)/2,halfHeight:(n+xd)/2,minimumVisibleStub:Ob};return t==="curved"?bd(e,o):yd(e,o)}function Vo(e,t,r,n){let o=Sd(e,t,r,n);if(!o||!o.before&&!o.after)return null;let i=Ho(e,o.bezier),a=o.before?Ho(o.before,o.bezier):0,s=o.after?Ho(o.after,o.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Ib(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 Gb(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 Wo(e,t,r,n){if(t==="curved")return Ib(e);let o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};return t==="orthogonal"?Gb(e,o):o}function St(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Db(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]),p=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,p*s))),x=Math.max(i,Math.min(a,Math.max(u,f*s)));return g&&(b=Math.min(a,b+p*.75),x=Math.min(a,x+f*.75)),{fromDistance:b,toDistance:x}}function Cd(e,t,r,n,o){let i=St(r),a=St(n),{fromDistance:s,toDistance:l}=Db(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 Rd(e,t,r,n){let{p0:o,p1:i,p2:a,p3:s}=Cd(e,t,r,n,{min:35,max:90,perpendicularScale:.5});return{points:[...o,...i,...a,...s],segments:[]}}function wd(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 vd(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 Pd(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 Ld(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=kd(t.side),c=kd(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 kd(e){return e==="left"||e==="right"}function Td(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 $d(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 Md(e,t,r){let n=e?["left","right"]:["top","bottom"];return[!n.includes(t),!n.includes(r)]}function Ad(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,p=r?.[2]||0,f=n[1]&&r?.[3]||0;if(l){let C=d[1]+u,L=t[0]+p,v=c[1]+f;return[o.x,o.y,d[0],C,L,C,L,v,c[0],v,i.x,i.y]}let g=d[0]+u,b=t[1]+p,x=c[0]+f;return[o.x,o.y,g,d[1],g,b,x,b,x,c[1],i.x,i.y]}function Ed(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,p=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&&p&&f}})}function rn(e,t){if(e.length<6)return e;let r=Vb(e),n=[r[0]];for(let o=1;o<r.length-1;o++){let i=_b(r[o-1],r[o],r[o+1],t);n.push(...i?Hb(i):[r[o]])}return n.push(r[r.length-1]),n.flatMap(o=>[o.x,o.y])}function _b(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,Nd(o)*.4,Nd(i)*.4);if(d<=0)return null;let c=Od(o),u=Od(i),p=zo(t,c,-d),f=zo(t,u,d),g=zo(p,u,d),b=Math.atan2(p.y-g.y,p.x-g.x),x=Math.atan2(f.y-g.y,f.x-g.x);return{entry:p,exit:f,center:g,radius:d,startAngle:b,angleSweep:Fb(x-b)}}function zo(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function Nd(e){return Math.abs(e.x)+Math.abs(e.y)}function Od(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function Fb(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function Hb(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 Vb(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Yo(e){let t=Wb(e),r=Ld(t),n=$d(t,r),o=Td(n),i=Md(t.horizontalFirst,e.fromSide,e.toSide),a=Ad(t,r,e.segmentOffsets,i),s=Ed(a,o,i[0],i[1]);return{points:rn(a,10),segments:s}}function Wb(e){let[t,r]=wd(e.from,e.to,e.fromSide,e.toSide),n=St(e.fromSide),o=St(e.toSide),i=vd(t,r,e.endpointEdges),[a,s]=Pd(t,r,n,o,i);return{from:t,to:r,fromConnection:Bd(t,e.fromSide,n,a),toConnection:Bd(r,e.toSide,o,s),horizontalFirst:i}}function Bd(e,t,r,n){return{side:t,normal:r,stub:[e.x+r[0]*n,e.y+r[1]*n]}}var Id=.5;function Gd(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:rn(o,10),segments:i}}function Uo(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<=Id||n<=Id})}function Dd(e,t,r,n,o){if(e.waypoints&&e.waypoints.length>0){let l=Gd(t,e.waypoints,r);if(Uo(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=Yo(a);return Uo(s.segments)?s:Yo({...a,segmentOffsets:void 0})}function _d(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 Fd(e,t,r){let n=e.fromPoint?.kind==="side"?e.fromPoint.side:_d(t,r),o=e.toPoint?.kind==="side"?e.toPoint.side:_d(r,t);return{fromSide:n,toSide:o}}function Hd(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function Vd(e,t,r,n){let{fromSide:o,toSide:i}=Fd(e,t,r);return n==="curved"?Rd(t,r,o,i):n==="orthogonal"?Dd(e,t,r,o,i):Hd(t,r)}function zb(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 Yb(e,t){let r=!!(e.showText&&e.text),n=m(e.style?.fontSize,10),o=Math.min(250,Math.max(n*2,(e.text?.length??0)*n*.65+10)),i=t?.(e.style?.fontFamily??E,n),a=r?Re(e.text??"",o,n,i):[];return{visible:r,fontSize:n,width:o,height:a.length*n*1.4,lines:a}}function Ub(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:m(o.style?.opacity,1),shadow:Kr(o.style?.shadow)}}function Wd(e,t,r){let{link:n,from:o,to:i}=e,a=n.style?.pathType??"orthogonal",{points:s,segments:l}=Vd(n,o,i,a),d=m(n.style?.strokeWidth,2),c=md(n.style?.color)||"#64748b",u=Yb(n,r),p=pd(d,n.style?.strokeStyle??"solid"),f=u.visible&&!p?Vo(s,a,u.width,u.height):null,g=f?[f.dashBefore,f.gapLength,1e6]:p;return{link:n,pathType:a,points:s,segments:l,midpoint:Wo(s,a,o,i),strokeWidth:d,bounds:zb(s,d+14),color:c,order:2e4+t,style:Ub(e,d,c,g),label:u,hasLabelGap:!!f}}function jo(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 zd(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),p=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||p===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,p*.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)/p*f,y:d.y+(c.y-d.y)/p*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 jb(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 Xb(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?zd(r,Math.max(16,n*4)):jb(e)}var Ct=e=>Math.round(e*100)/100;function qb(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:Ct(r.start.x),ay:Ct(r.start.y),bx:Ct(r.end.x),by:Ct(r.end.y),ox:Ct(r.originalMidpoint.x),oy:Ct(r.originalMidpoint.y),movable:r.canMove}))}function Yd(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:Xb(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:jo(t,"start"),markerEnd:jo(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:qb(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 Kb(e,t,r){if(e.link.isVisible===!1)return[];let n=Wd(e,t,r);return[Yd(n),...cd(n),...Ud(n),...dd(n)]}function jd(e,t){return e.flatMap((r,n)=>Z(Kb(r,n,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Zb(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=m(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=m(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:o,d:fe({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:m(e.opacity,1)}}]}function Xd(e){return e.flatMap((t,r)=>Z(Zb(t,r),"path",t.id,"path","Path"))}function Jt(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Qb=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],nn=Math.PI/2,Jb=4*nn,qd=Math.PI/2,ey=1e-9;function Xo([e,t,r],n){return[e+r*Math.cos(n),t+r*Math.sin(n)]}function Kd([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function Zd(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=p=>Math.hypot(p[0]-r[0],p[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function ty(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?qd:Kd(r,Zd(e[n-1],r,t)),a=n===e.length-1?qd:Kd(r,Zd(r,e[n+1],t));for(;a<=o;)a+=Jb;return{lobe:r,from:o,to:a}})}function ry(e,t){let r=[];for(let n=Math.floor(e/nn)+1;n*nn<t-ey;n++)r.push(n*nn);return[...r,t]}function ny({lobe:e,from:t,to:r}){let n=Xo(e,t),o=[],i=t;for(let a of ry(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Xo(e,i),d=Xo(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 oy(){let e=ty(Qb).map(ny),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 Qd=oy();function Jd(e,t,r,n){let o=([a,s])=>`${e+a*r} ${t+s*n}`,i=Qd.curves.map(([a,s,l])=>`C ${o(a)} ${o(s)} ${o(l)}`);return`M ${o(Qd.start)} ${i.join(" ")} Z`}function ec(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`,p=`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} ${p}`}function tc(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 rc(e,t,r,n){let{body:o,centerX:i,bottom:a}=tc(e,t,r,n);return{x:i-o,y:a-o,width:o*2,height:o}}function nc(e,t,r,n){let{head:o,body:i,centerX:a,headCenterY:s,bottom:l}=tc(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 iy=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,n)=>t+(n%2?` ${r}`:` L ${r}`),"")} Z`,ay=.1,sy=Math.PI/6,ly=.25,dy=.15;function oc(e,t){return Math.min(e,t)/2}function ic(e,t,r,n,o){let i=(...a)=>iy(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*ay,s=r+o-a,l=n/4,d=a*sy;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)*ly;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 Jd(t,r,n,o);case"cylinder":return ec(t,r,n,o);case"person":return nc(t,r,n,o);case"predefined_process":{let a=Math.min(n,o)*dy;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 ce(e){let t=ic(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...Jt(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function ac(e){return ce(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function Rt(e){let t=e.shape.shapeType==="pill"?oc(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?m(e.shape.cornerRadius,8):0;return[{...Jt(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function qo(e){return[{...Jt(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function sc(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return Rt(e);let t=m(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[{...Jt(e),type:"path",d:fe({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 cy={cloud:ce,cylinder:ce,diamond:ce,document:ce,hexagon:ce,note:ce,oval:qo,circle:qo,parallelogram:ce,person:ac,pill:Rt,predefined_process:ce,rectangle:Rt,rounded_rectangle:Rt,symbol:sc,trapezoid:ce,triangle:ce};function er(e){return(cy[e.shape.shapeType]??Rt)(e)}var uy={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},q={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},lc={rectangle:q,rounded_rectangle:{...q,cornerRadius:8},triangle:{...q,rotation:0},diamond:{...q,rotation:0},hexagon:{...q,rotation:0},oval:{...q,rotation:0},circle:{...q,rotation:0},document:{...q,rotation:0},parallelogram:{...q,rotation:0},trapezoid:{...q,rotation:0},cylinder:{...q,rotation:0},note:{...q,rotation:0},cloud:{...q,rotation:0},predefined_process:{...q,rotation:0},pill:q,person:{...q,rotation:0},symbol:{...q,rotation:0}};function Ko(e,t){let r=lc[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${uy[e.shapeType]??""}, falling back to rectangle defaults.`}),lc.rectangle)}function my(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function dc(e,t){let r=Ko(e,t),n=m(e.strokeWidth,r.strokeWidth),o=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=m(o?.angle,45)*Math.PI/180;return{fill:k(e.fillColor,t,e.id),stroke:k(e.strokeColor,t,e.id),strokeWidth:n,dash:my(e,n),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:m(e.opacity,r.opacity),shadow:o?.enabled?{color:o.color??"#000000",opacity:m(o.opacity,.25),blur:m(o.blur,10),dx:Math.cos(i)*m(o.distance,5),dy:Math.sin(i)*m(o.distance,5)}:void 0}}var Zo=/\*\*([^*]+)\*\*/g;function cc(e){return/\*\*[^*]+\*\*/.test(e)}function py(e){let t=[],r=0;Zo.lastIndex=0;let n;for(;n=Zo.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=Zo.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function fy(e){return e.split(`
|
|
13
|
-
`).map(py)}function hy(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 gy(e,t,r,n){let o=hy(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 uc(e,t,r,n){return fy(e).flatMap(o=>gy(o,Math.max(1,t),r,n))}function mc(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 p=m(n.fontSize,Ko(n,[]).fontSize),f=n.isText?0:Math.max(8,t*2),g=n.shapeType==="person"?rc(l,d,c,u):{x:l,y:d,width:c,height:u},b=Math.max(0,g.width-f*2),x=n.fontFamily||E,C=r?.(x,p),L={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:Re(n.text,b,p,C),fontFamily:x,fontSize:p,fontWeight:n.fontWeight??"normal",letterSpacing:n.letterSpacing,color:n.textColor||"#111827",align:n.textAlign??"center",verticalAlign:n.textVerticalAlign??"middle",lineHeight:m(n.lineHeight,1.3),rotation:a,rotationCenter:s};if(cc(n.text)){let{measure:v,spaceWidth:M}=C??fd(p);L.richLines=uc(n.text,b,v,M)}return L}function by(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=er({...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(...er({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...er({...a,id:`${e.id}-inner`,style:o})),i}function yy(e,t,r){let n=m(e.x,0),o=m(e.y,0),i=Math.max(0,m(e.width,100)),a=Math.max(0,m(e.height,100)),s=m(e.rotation,0),l=m(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:B({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:dc(e,r),x:n,y:o,width:i,height:a}}}function xy(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 Sy(e,t,r,n){if(e.isVisible===!1)return[];let{context:o,strokeWidth:i}=yy(e,t,r),a=e.strokeStyle==="double"?by(o,i||1):er(o),s=xy(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=mc(o,i,n);return l&&a.push(l),a}function pc(e,t,r){return e.flatMap((n,o)=>Z(Sy(n,o,t,r),"shape",n.id,n.shapeType,n.text||n.shapeType,n.parentFrameId??void 0))}var $=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],z="#94a3b8",tr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],Qo=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function _(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 rr(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 nr(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??z}));return o.length?Qt(o,e):z}function ue(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var me={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Jo(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ei(e,t,r){let n=r?me.padX:0,o=r?me.padY:0,i=t*me.lineHeight;return{width:e.length*t*me.charWidth+n*2,height:i+o*2,lineHeight:i,padX:n,padY:o}}function ti(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 on(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 ke(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 qe(e,t,r,n,o,i){return i?ke(e,t,r,n,o):on(e,t,r,n,o)}function ri(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 ni(e){if(!e?.length)return null;let t=[...e].sort((r,n)=>r-n);return{min:t[0],q1:ri(t,.25),median:ri(t,.5),q3:ri(t,.75),max:t[t.length-1]}}function or(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 oi(e,t){let r=or(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 ii(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 sn(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 ai(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 fc(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 Cy(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}var an=.35,hc=.08,gc=.22,bc=.78,yc=.92,Ry=3;function J(e){let t=or(e);if(!t)return"#0f172a";let[r,n,o]=t,i=(.299*r+.587*n+.114*o)/255>.6?"#0f172a":"#ffffff",[a,s,l]=sn(r,n,o);if(s===0)return i;let d=l>.5?Math.max(hc,Math.min(l-an,gc)):Math.min(yc,Math.max(l+an,bc)),c=ai(a,s,d);return Cy(fc(r,n,o),fc(...c))>=Ry?ii(...c):i}function kt(e,t){let r=or(e);if(!r)return t;let[n,o,i]=r,[a,s,l]=sn(n,o,i);if(s===0)return t;let d=l>.5?Math.max(hc,Math.min(l-an,gc)):Math.min(yc,Math.max(l+an,bc));return ii(...ai(a,s,d))}function ln(e){let t=or(e);return t?sn(...t)[2]>.5:!1}function De(e,t){let r=or(e);if(!r)return;let[n,o]=sn(...r);if(o!==0)return ii(...ai(n,o,t))}function N(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function ir(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function ar(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:ky(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 ky(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 he(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var cn=18,dn=e=>e.config;function ee(e){return e.chartType==="bar"&&dn(e)?.orientation==="horizontal"}function wt(e,t){let r=ue({series:e.series,config:dn(e)}),n=t.height/r,o=Math.min(Math.max(0,m(dn(e)?.barGroupGap,8)),Math.max(0,n-1)),i=e.categoryAlign==="left"?cn:0,a=Math.max(1,n-o-i),s=m(dn(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 vt(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function Pt(e,t){return t>0?fe({points:e,tension:t,closed:!1}):`M ${e.map((n,o)=>`${o?"L":""} ${n.x} ${n.y}`).join(" ")}`}function un(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 Y(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function sr(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 Tt(e,t){return Math.abs(t-e)>Math.PI?1:0}function Ke(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function xc(e,t){return{start:e.start+t,end:e.end-t}}function Ze(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 wy(e,t,r){let n=Y(e,t.start,e.outerRadius),o=Y(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Tt(t.start,t.end)} 1 ${o.x} ${o.y}`,"Z"].join(" ")}function vy(e,t,r,n){let o=Y(e,r.start,e.outerRadius),i=Y(e,r.end,e.outerRadius),a=Y(e,n.end,t),s=Y(e,n.start,t);return[`M ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Tt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${Tt(n.start,n.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Sc=.82;function Lt(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:Y(e,s,t),angle:s}}function lr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Sc),i=e*o/(1+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 dr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Sc),i=e*o/(1+o),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function Py(e,t,r,n){let{outerRadius:o}=e,i=o-r,a=Lt(e,o,i,t.start,r,1),s=Lt(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 ${Tt(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 Ly(e,t,r,n,o){let{outerRadius:i}=e,a=i-o,s=Lt(e,i,a,r.start,o,1),l=Lt(e,i,a,r.end,o,-1),d=t+o,c=Lt(e,t,d,n.start,o,1),u=Lt(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 ${Tt(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 ${Tt(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 $t(e,t,r){let n=Math.max(0,r)/2,o=Ze(n,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=o}function Qe(e,t,r=0,n=0){let o=Math.max(0,n)/2,i=xc(t,Ke(o,e.outerRadius));if(!$t(e,t,n)){let s=Ze(o,t.end-t.start,e.outerRadius),l=Y(e,(t.start+t.end)/2,s);return r>0?Py(e,i,r,l):wy(e,i,l)}let a=xc(t,Ke(o,e.innerRadius));return r>0?Ly(e,e.innerRadius,i,a,r):vy(e,e.innerRadius,i,a)}function Ae(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,p=[];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);p.push(s?ke(e.x+b,e.y,g,e.height,o):ke(e.x,e.y+e.height-b-g,e.width,g,o))}return p.join(" ")}function O(e){if(!e?.enabled)return;let t=m(e.angle,45)*Math.PI/180,r=m(e.distance,5);return{color:e.color??"#000000",opacity:m(e.opacity,.25),blur:m(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function cr(e,t,r,n,o){let i=e.series[n].values[r]??0;return t==="waterfall"?Ty(e,r,n,o,i):t==="percent"?$y(e,r,n,o,i):My(e,r,n,o,i)}function Ty(e,t,r,n,o){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return Cc(o,i,i+o,e,n)}function $y(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 My(e,t,r,n,o){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return Cc(o,i,i+o,e,n)}function Cc(e,t,r,n,o){return{value:e,pixelStart:T(t,n.axisY,o),pixelEnd:T(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??E,fontSize:Math.max(9,m(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 Ay=/^[A-Za-z_][A-Za-z0-9_]*$/;function Mt(e,t,r){return Ay.test(t)?`${e}[${t}].${r}`:void 0}var Rc="text";function si(e){return`Axis[${e}].label`}function mn(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function we(e){return Mt("Series",e,"label")}function kc(e){return Mt("Series",e,"color")}function te(e,t){return Number.isInteger(t)&&t>=0?Mt("Series",e,`values[${t}]`):void 0}function At(e,t){return Number.isInteger(t)&&t>=0?Mt("Series",e,`colors[${t}]`):void 0}function wc(e){return Mt("Rule",e,"text")}function vc(e){return Mt("Rule",e,"at")}function Ey(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:si("x")}:null}function Ny(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:si("y")}}function Pc(e,t,r){let n=[],o=Ey(e,t,r);o&&n.push(o);let i=Ny(e,t,r+n.length);return i&&n.push(i),n}function Lc(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:we(i.id)}})}var Oy=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Tc(e){return By(e.chart)?Fy(e).flatMap(t=>Hy(e,t)):[]}function By(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Oy.has(e.chartType)&&!t}function li(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var di=22,pn=16;function ci(e){return e==="bottomLeft"||e==="bottomRight"}function ui(e){return li(e).map(t=>Math.max(42,t.label.length*m(e.fontSize,12)*.58+22))}function $c(e){let t=ui(e);return t.length?Math.max(...t):0}function Iy(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Gy(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function Dy(e){let{chart:t,plot:r,order:n}=e,o=li(t),i=ui(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-pn-a:r.x+r.width+pn,l=r.y+r.height-15;return o.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(o.length-1-c)*di,width:i[c],order:n+(o.length-1-c)*2}))}function _y(e){let{chart:t,plot:r,order:n}=e,o=li(t),i=ui(t),a=i.reduce((d,c)=>d+c,0),s=Gy(t,r),l=Iy(t,r,a);return o.map((d,c)=>{let u=i[c],p=l;return l+=u,{series:d,seriesIndex:c,x:p,y:s,width:u,order:n+(o.length-1-c)*2}})}function Fy(e){return ci(e.chart.legendPosition)?Dy(e):_y(e)}function Hy(e,t){return[Vy(e,t),Wy(e,t)]}function Vy(e,t){let{chart:r,bounds:n,diagnostics:o}=e,i=$[t.seriesIndex%$.length],a=r.chartType==="line",s=a?N(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:kc(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:k(s,o,r.id)}}}function Wy(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:we(t.series.id)}}var Ac=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),zy=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Je(e){return!zy.has(e.chartType)}function _e(e){return Je(e)?Math.max(0,m(e.tickLength,0)):0}function Yy(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Uy(e){let t=m(e.fontSize,12);return Math.max(0,...e.series.map(n=>(n.label||n.id).length))*t*.58+16}var Mc=66;function jy(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Xy(e){let t=m(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(n=>n.length))*t*.58+16}function qy(e){return Yy(e)?Uy(e):ee(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Xy(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function Ec(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&&ci(n),s=a?$c(e)+pn:0,l=jy(e,r),d=_e(e),c=d+(t?qy(e):12)+(n==="bottomLeft"?s:0)+(l==="left"?Mc:0),u=24+(n==="bottomRight"?s:0)+(l==="right"?Mc:0),p=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",f=ee(e)&&e.showValueAxis!==!1,g=t?ee(e)?f?34:12:(e.axisX.label?52:34)+(p?18:0):12,b=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,x=i&&!o&&!a,C=d+g+(b?44:0)+(x?16+di:0),v=(e.title?Math.max(44,20+m(e.titleSize,14)*1.6):0)||(o&&i?44:24);return{bounds:Q({x:e.x,y:e.y,width:e.width,height:e.height},m(e.strokeWidth,1)+2),plot:{x:e.x+c,y:e.y+v,width:Math.max(1,e.width-c-u),height:Math.max(1,e.height-v-C)},showLabels:t,showLegend:r,padLeft:c}}function Ky(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,n)=>String(n+1))}function Nc(e,t,r){let n=ue(e),o=t.plot.width/n,i=Ky(e,n),a=!!e.config?.categories?.length,s=e.categoryAlign==="left",l=s?Math.min(Math.max(0,m(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+_e(e),width:s?o-l:o,height:18},text:i[c]??String(c+1),chart:e,align:s?"left":"center"}),prop:a?mn(c):void 0}})}function Oc(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+_e(e),width:o,height:18},text:i.label||i.id,chart:e,align:"center"}),prop:we(i.id)}})}function Bc(e,t,r){return _(e.axisX).map((n,o)=>{let i=t.plot.x+T(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+_e(e),width:40,height:18},text:String(n),chart:e,align:"center"})})}function Ic(e,t,r){return _(e.axisY).map((n,o)=>{let i=t.plot.y+t.plot.height-T(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-_e(e),height:18},text:String(n),chart:e,align:"right"})})}function mi(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Zy(e,t,r){return e.chartType==="bar"?Nc(e,t,r):e.chartType==="boxplot"&&!mi(e)?Oc(e,t,r):Bc(e,t,r)}function Qy(e,t,r){return mi(e)?Lc(e,t,r):e.showValueAxis===!1?[]:Ic(e,t,r)}function Jy(e,t){let{plot:r}=t;if(e.chartType==="bar"){let n=ue(e);return Array.from({length:n},(o,i)=>r.x+(i+.5)*r.width/n)}return _(e.axisX).map(n=>r.x+T(n,e.axisX,r.width))}function ex(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function tx(e,t,r){let n=m(e.axisLineWidth,0),o=m(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",...ex(e,n>0?n:1)},d=[],c=(u,p)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:p,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&&ee(e)){_(e.axisY).forEach(p=>{let f=i.x+T(p,e.axisY,i.width);c(`tick-v-${p}`,`M ${f} ${s} L ${f} ${s+o}`)});let u=wt(e,i);for(let p=0;p<u.count;p++){let f=vt(u,i,p)+u.labelRow+u.barsHeight/2;c(`tick-c-${p}`,`M ${i.x-o} ${f} L ${i.x} ${f}`)}}return o>0&&!mi(e)&&!ee(e)&&(_(e.axisY).forEach(u=>{let p=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-o} ${p} L ${i.x} ${p}`)}),Jy(e,t).forEach((u,p)=>{c(`tick-x-${p}`,`M ${u} ${s} L ${u} ${s+o}`)})),d}function rx(e,t){let r=e.config?.categories;return Array.from({length:t},(n,o)=>r?.[o]??String(o+1))}function nx(e,t,r){let{plot:n,bounds:o}=t,i=wt(e,n),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=rx(e,i.count).map((c,u)=>{let p=vt(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:p,width:n.width,height:i.labelRow}:s?{x:n.x+14,y:p+i.barsHeight/2-9,width:n.width-28,height:18}:{x:e.x+8,y:p+i.barsHeight/2-9,width:n.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?mn(u):void 0}});return e.showValueAxis!==!1&&_(e.axisY).forEach((c,u)=>{let p=n.x+T(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:p-20,y:n.y+n.height+4+m(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function Gc(e,t,r){if(!Je(e))return[];let n=tx(e,t,r);if(!t.showLabels)return n;if(r+=n.length,ee(e))return[...n,...nx(e,t,r)];let o=Zy(e,t,r),i=Qy(e,t,r+o.length),a=Pc(e,t,r+o.length+i.length);return[...n,...o,...i,...a]}function Dc(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 pi=32;function ur(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function _c(e,t,r,n){let o=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(pi,Math.round(Math.sqrt(pi*pi*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?Dc(e,u,d,n):0}}return{grid:s,cols:i,rows:a}}var Fc=new Set(["scatter","custom","hexbin"]);var Hc=-Math.PI/2,ox=.5,ix=6;function ax(e){return Math.max(38,e*3.2)}function fn(e,t,r,n=!0){let o=n?ax(r):ix;return Math.max(8,Math.min(e,t)/2-o)}function hn(e,t){return Math.max(3,e||t)}function sx(e,t){return Hc+t*Math.PI*2/e}function fi(e,t,r){let n=t===e?0:(r-e)/(t-e);return Hc+n*Math.PI*2}function Vc(e,t,r){let n=sx(e.count,t);return{x:e.centerX+Math.cos(n)*r,y:e.centerY+Math.sin(n)*r}}function Wc(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 gn(e,t,r=ox){return e.length===0?"":t?fe({points:e,tension:r,closed:!0}):`M ${e.map((o,i)=>`${i?"L ":""}${o.x} ${o.y}`).join(" ")} Z`}function bn(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 mr(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function zc(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=m(e.gridWidth,1);if(e.gridLineStyle==="dotted")return lx(e,r,n,o,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...mr(e,s)},d=[];return _(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*Yc(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})}),_(e.axisX).forEach(c=>{let u=fi(e.axisX.min,e.axisX.max,c),p=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 ${p} ${f}`,style:l})}),d}function lx(e,t,r,n,o,i,a){let s=_(e.axisY).filter(c=>c>e.axisY.min),l=_(e.axisX),d=[];return s.forEach(c=>{let u=i*Yc(e,c);l.forEach(p=>{let f=fi(e.axisX.min,e.axisX.max,p),g=n+Math.cos(f)*u,b=o+Math.sin(f)*u,x=`chart-grid-dot-${e.id}-${p}-${c}`;d.push(bn(e,x,r+d.length,t,g,b,a,void 0))})}),d}function Yc(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 yn(e,t,r,n){if(e.showGrid===!1||!Je(e))return[];if(e.gridShape==="circle"&&Fc.has(e.chartType))return zc(e,t,r,n);let o=m(e.gridWidth,1);if(ee(e))return dx(e,t,r,n,o);let i=e.chartType==="field"?ur(e,t):void 0;if(e.gridLineStyle==="dotted")return cx(e,t,r,n,o,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...mr(e,o),clip:i},s=[];return(e.gridAxes==="y"?[]:_(e.axisX)).forEach(l=>{let d=t.x+T(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"?[]:_(e.axisY)).forEach(l=>{let d=t.y+t.height-T(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 dx(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"}:mr(e,o)};return _(e.axisY).map((a,s)=>{let l=t.x+T(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 cx(e,t,r,n,o,i){let a=_(e.axisX),s=_(e.axisY),l=[];return a.forEach(d=>{let c=t.x+T(d,e.axisX,t.width);s.forEach(u=>{let p=t.y+t.height-T(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push(bn(e,f,n+l.length,r,c,p,o,i))})}),l}function Uc(e){return e.chart.rules?.length?ux(e).flatMap(t=>mx(e,t)):[]}function ux(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-T(r.at,e.chart.axisY,e.plot.height),lineOrder:n,labelOrder:o}})}function mx(e,t){let r=[px(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(fx(e,t)),r}function px(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:vc(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 fx(e,t){let r=Math.max(9,m(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:wc(t.rule.id)}}function hi(e){let t=m(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,m(e.cornerRadius,12)-t)}}function jc(e,t,r){if(!e.fillImage)return[];let n=hi(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 Et(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=m(n.config?.barGlassBlur,0);if(a<=0||!n.fillImage)return[];let s=hi(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:m(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(...yn(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 Nt(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:k(n,s,a.id),shadow:{color:N(n,"#ffffff"),opacity:.9,blur:o,dx:0,dy:0},pointerEvents:"none"}}}function Ot(e){return e.chart.config?.showBarLabels===!0}function hx(e,t){let r=e.frame.height>=t.height+me.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function gx(e,t,r){return e==="outside"?t.y-r-me.gap:e==="inside"?t.y+me.gap:t.y+t.height/2-r/2}function bx(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:ti(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?k(l.barLabelPillColor,a,o.id):{kind:"none"},stroke:k(l?.barLabelBorderColor??n,a,o.id),strokeWidth:m(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function yx(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 xx(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-cn,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 Sx(e,t){let r=e.placement==="axis"?"outside":e.placement,n=e.frame.width>=t.width+me.gap*2;return r!=="outside"&&!n?"outside":r}function Cx(e,t,r){let{frame:n}=e,o=r==="outside"?n.x+n.width+me.gap:r==="inside"?n.x+n.width-t.width-me.gap:n.x+n.width/2-t.width/2;return{...t,left:o,top:n.y+n.height/2-t.height/2}}function Bt(e,t){let{chart:r}=e,n=r.config,o=Math.max(8,m(n?.barLabelFontSize,m(r.fontSize,12))),i=Jo(t.value,n?.barLabelFormat);if(t.placement==="axis")return[xx(e,t,i,o)];let a=n?.barLabelPill===!0,s=ei(i,o,a),l=t.horizontal?Sx(t,s):hx(t,s),d=t.horizontal?Cx(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:gx(l,t.frame,s.height)},c=n?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(bx(e,t.id,d,c)),u.push(yx(e,t.id,d,i,l,o,c)),u}var gi={angle:45,spacing:7,width:1.5},Rx=2;function kx(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 p=-c;p<=c;p+=i){let f=d.x+l.x*p,g=d.y+l.y*p;u.push(`M ${f-s.x*c} ${g-s.y*c} L ${f+s.x*c} ${g+s.y*c}`)}return u.join(" ")}function It(e,t){if(et(e))return{type:"path",d:ke(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function et(e){return e.chart.config?.barTrack===!0}function Gt(e,t,r,n="vertical"){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config,d=l?.barCornerRadius??2,c=m(l?.barSegments,0),u=c>0?Ae(r,n,c,m(l?.barSegmentGap,4),d,1,!0):ke(r.x,r.y,r.width,r.height,d),p=[{type:"path",id:`chart-bar-track-${o.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:k(l?.barTrackColor??o.gridColor??"#e2e8f0",a,o.id),pointerEvents:"none"}}];return l?.barTrackHatch&&p.push({type:"path",id:`chart-bar-track-hatch-${o.id}-${t}`,order:s(),bounds:i,d:kx(r.x,r.y,r.width,r.height,m(l.barTrackHatchAngle,gi.angle),Math.max(Rx,m(l.barTrackHatchSpacing,gi.spacing))),style:{fill:{kind:"none"},stroke:k(l.barTrackHatchColor??o.gridColor??"#cbd5e1",a,o.id),strokeWidth:m(l.barTrackHatchWidth,gi.width),pointerEvents:"none",clip:{type:"path",d:u}}}),p}function Xc(e){let t=Lx(e),r=e.chart.series.flatMap((a,s)=>Tx(e,t,a,s)),n=et(e)?r.flatMap(a=>Gt(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=>$x(e,a)),i=Ot(e)?r.flatMap(a=>vx(e,a,r)):[];return[...n,...o,...r.flatMap(a=>Px(e,a)),...i]}function wx(e,t){let r=t.filter(n=>n.seriesId===e.seriesId).map(n=>n.value);return e.value>=Math.max(...r)}function vx(e,t,r){let{chart:n}=e;return n.config?.barLabelMaxOnly&&!wx(t,r)?[]:Bt(e,{id:`chart-bar-label-${n.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:n.config?.barLabelPosition??"outside"})}function qc(e,t){let{chart:r,plot:n}=e,o=r.config,i=o?.barCornerRadius??2,a=m(o?.barSegments,0);return a>0?Ae({x:t.x,y:n.y,width:t.width,height:n.height},"vertical",a,m(o?.barSegmentGap,4),i,t.height/n.height,o?.barSegmentSnap!==!1):qe(t.x,t.y,t.width,t.height,i,o?.barRoundedBottom===!0)}function Px(e,t){let{chart:r}=e,n=m(r.config?.barGlow,0);if(n<=0||t.frame.height<=0)return[];let o=qc(e,t.frame);return[Nt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,o,t.color,n)]}function Lx(e){let{chart:t,plot:r}=e,n=ue(t),o=r.width/n,i=Math.min(Math.max(0,m(t.config?.barGroupGap,8)),Math.max(0,o-1)),a=Math.max(0,m(t.config?.barGap,2));return{slotWidth:o,seriesWidth:Math.max(1,(o-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function Tx(e,t,r,n){let{chart:o,plot:i}=e,a=r.color??$[n%$.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(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 $x(e,t){let r=Ax(e,t),n=Ex(e,t);return n&&r.push(n),r}function Mx(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 Ax(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=qc(e,t.frame),u=k(t.color,i,r.id),p=k(r.config?.barBorderColor||"#000000",i,r.id),f=m(r.config?.barBorderWidth,0),g=O(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:p,strokeWidth:f,shadow:g,clip:It(e,{x:l,y:n.y,width:d,height:n.height})??{type:"path",d:Mx(n)}}}:void 0,x={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:At(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:te(t.seriesId,t.valueIndex),style:{fill:u,stroke:p,strokeWidth:f,innerShadow:g}},C=Et(e,`${t.seriesId}-${t.valueIndex}`,c);return b?[b,...C,x]:[...C,x]}function Ex(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=ir(t.value,t.error);return ar({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-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function Nx(e,t,r,n,o){let{chart:i,plot:a}=e,s=vt(t,a,n)+t.labelRow;if(e.stackedMode){let u=cr(i,e.stackedMode,n,r,a.width),p=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+p,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,m(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,T(o,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function Ox(e,t){let{chart:r,plot:n}=e,o=r.config,i=e.stackedMode&&r.series.length>1?0:m(o?.barSegments,0);return i>0?Ae({x:n.x,y:t.y,width:n.width,height:t.height},"horizontal",i,m(o?.barSegmentGap,4),o?.barCornerRadius??2,t.width/n.width,o?.barSegmentSnap!==!1):ke(t.x,t.y,t.width,t.height,o?.barCornerRadius??2)}function Bx(e,t,r,n,o,i){let{plot:a}=e,s=Nx(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:Ox(e,s),color:r.colors?.[o]??r.color??$[n%$.length]}}function Ix(e,t){let{chart:r,diagnostics:n,nextOrder:o}=e,i=r.config,a=k(i?.barBorderColor||"#000000",n,r.id),s=m(i?.barBorderWidth,0),l=O(r.shadowStyle),d=k(t.color,n,r.id),c=[...Et(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:It(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:At(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function Gx(e,t,r){let{chart:n}=e,o=n.config,i=Ot(e)&&(!o?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===n.series.length-1;return!i||e.stackedMode&&!a&&o?.barLabelPosition==="outside"?[]:Bt(e,{id:`chart-bar-label-${n.id}-${t.id}`,value:t.value,frame:t.frame,placement:o?.barLabelPosition??"outside",horizontal:!0})}function Dx(e,t,r,n,o,i,a,s){let{chart:l}=e,d=Bx(e,t,n,o,i,a);et(e)&&(!e.stackedMode||o===0)&&r.tracks.push(...Gt(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...Ix(e,d));let c=m(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(Nt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...Gx(e,d,s))}function Kc(e){let t=wt(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)=>{Dx(e,t,r,n,o,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function _x(e,t){let{chart:r,plot:n}=e,o=n.width/ue(r),i=Math.min(Math.max(0,m(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 Fx(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=a.series.length===1?m(a.config?.barSegments,0):0;return l>0?Ae({x:t,y:s.y,width:o.barWidth,height:s.height},"vertical",l,m(a.config?.barSegmentGap,4),i,n/s.height,a.config?.barSegmentSnap!==!1):qe(t,r,o.barWidth,n,i,a.config?.barRoundedBottom===!0)}function Hx(e,t,r,n,o,i,a){let{chart:s}=e,l=s.config;if(!(Ot(e)&&!(l?.barLabelMaxOnly&&!Yx(r.values,o))&&(l?.barLabelPosition!=="axis"||n===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[o];t.labels.push(...Bt(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 Vx(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=cr(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),p=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:n,valueIndex:i,radius:d,color:n.colors?.[i]??n.color??$[o%$.length],x:c,y:u,height:p,path:Fx(e,c,u,p,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function Wx(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=k(t.color,i,r.id),u=k(r.config?.barBorderColor||"#000000",i,r.id),p=m(r.config?.barBorderWidth,0),f=O(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:p,shadow:f,clip:It(e,t.column)??{type:"path",d:b}}})}return g.push(...Et(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:At(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:te(s.id,l),style:{fill:c,stroke:u,strokeWidth:p,innerShadow:f}}),g}function zx(e,t,r,n,o,i,a){let{chart:s}=e,l=Vx(e,t,n,o,i,a);i===0&&et(e)&&r.tracks.push(...Gt(e,String(a),l.column)),r.bars.push(...Wx(e,l));let d={x:l.x,y:l.y,width:n.barWidth,height:l.height};Hx(e,r,o,i,a,n,d);let c=m(s.config?.barGlow,0);c>0&&r.glows.push(Nt(e,`chart-bar-glow-${s.id}-${o.id}-${a}`,l.path,l.color,c))}function Zc(e,t){let{chart:r}=e,n={tracks:[],bars:[],glows:[],labels:[]},o=_x(e,t),i=ue(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{zx(e,t,n,o,s,l,a)});return[...n.tracks,...n.bars,...n.glows,...n.labels]}function Yx(e,t){let r=e.map(n=>typeof n=="number"?n:n[1]);return r[t]>=Math.max(...r)}function Qc(e){return ee(e.chart)?Kc(e):e.stackedMode?Zc(e,e.stackedMode):Xc(e)}function Jc(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=N(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:n,slotWidth:i,boxWidth:Math.max(4,i*s),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:a,borderWidth:m(t.config?.barBorderWidth,1),whiskerWidth:Math.max(0,m(t.config?.boxWhiskerWidth,1)),medianWidth:Math.max(0,m(t.config?.boxMedianWidth,2)),medianColor:t.config?.boxMedianColor??a,whiskerColor:t.config?.boxWhiskerColor,capSize:Math.max(0,m(t.config?.boxCapSize,.4)),pointSize:Math.max(0,m(t.config?.boxPointSize,3)),pointOpacity:Math.min(1,Math.max(0,m(t.config?.boxPointOpacity,.7))),jitter:Math.max(0,m(t.config?.boxJitter,1))}}function oe(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function eu(e,t,r,n){let{chart:o,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,o.axisX,i.width):i.y+i.height-T(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 tu(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?o.x+T(d,n.axisX,o.width):o.y+o.height-T(d,n.axisY,o.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+Ux(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:p,y:f}=oe(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:p,cy:f,rx:t.pointSize,ry:t.pointSize,style:{fill:k(r.color,a,n.id),opacity:t.pointOpacity}}})}function Ux(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function nu(e,t,r){let n=t.whiskerWidth>0?[Xx(t,r),qx(t,r)]:[],o=t.whiskerWidth>0&&t.capSize>0?[Kx(t,r),Zx(t,r)]:[],i=t.medianWidth>0?[Qx(t,r)]:[];return[...[...n,...o].map(a=>ru(e,t,{...a,color:jx(t,r)})),Jx(e,t,r),...i.map(a=>ru(e,t,a))]}function jx(e,t){return e.whiskerColor==="series"?N(t.color,e.borderColor):e.whiskerColor}function Xx(e,t){let{center:r,min:n,q1:o}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:oe(e.orientation,r,n),to:oe(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function qx(e,t){let{center:r,q3:n,max:o}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:oe(e.orientation,r,n),to:oe(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function Kx(e,t){return ou(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function Zx(e,t){return ou(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function ou(e,t,r,n){let o=t.boxWidth*t.capSize/2;return{id:e,from:oe(t.orientation,r-o,n),to:oe(t.orientation,r+o,n),strokeWidth:t.whiskerWidth}}function Qx(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:oe(e.orientation,t.geometry.center-r,t.geometry.median),to:oe(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function ru(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:r.color??t.borderColor},strokeWidth:r.strokeWidth}}}function Jx(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=oe(t.orientation,s.center-l,s.q1),c=oe(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),p=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:p,width:f,height:g,rx:t.cornerRadius,style:{fill:k(r.color,i,n.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function iu(e,t,r,n){let o=ni(r.values);if(!o)return[];let i=eu(e,t,n,o),a=r.color??$[n%$.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:n,color:a,geometry:i},l=nu(e,t,s);return t.showPoints&&l.push(...tu(e,t,s)),l}function au(e){let t=Jc(e),r=[];return e.chart.series.forEach((n,o)=>{r.push(...iu(e,t,n,o))}),r}var e0="#94a3b8",su=8,bi=140;function du(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?o0(e):e.chart.series.flatMap((t,r)=>t0(e,t,r))}function t0(e,t,r){let n=r0(e,t,r);return yi(e,t).map((o,i)=>{let a=xi(e,o),s={series:t,valueIndex:i,point:a,style:n};return t.symbol?.points.length?n0(e,s):Si(e,s)})}function Ci(e){return e.config?.orientation==="horizontal"}function yi(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(o=>[o[0],o[1]]):Ci(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 lu(e,t){return Ci(e)?t[0]:t[1]}function xi(e,t){return{x:e.plot.x+T(t[0],e.chart.axisX,e.plot.width),y:e.plot.y+e.plot.height-T(t[1],e.chart.axisY,e.plot.height)}}function r0(e,t,r){let n=t.color??$[r%$.length];return{fill:k(n,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?m(t.strokeWidth,1):void 0}}function n0(e,t){let r=t.series.symbol,n=m(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:cu(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:fe({points:a,tension:m(r?.tension,0),closed:!0}),style:t.style}}function Si(e,t){let r=m(t.series.size,3);return{type:"ellipse",id:cu(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 cu(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function o0(e){let{chart:t}=e,[r,n]=t.series,o=yi(e,r),i=yi(e,n),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??z,c=!!t.config?.reverseComparison,u=Math.min(o.length,i.length),p=t.config?.categories??[],f=[];for(let g=0;g<u;g++){let b=o[g],x=i[g],C=xi(e,b),L=xi(e,x),v=lu(t,b),M=lu(t,x),H=c?M<v:M>v,I=c?M>v:M<v,V=H?s:I?l:d,U=m(n.size,3);f.push(a0(e,g,C,L,V)),f.push(Si(e,{series:r,valueIndex:g,point:C,style:{fill:k(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??e0},strokeWidth:m(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(Si(e,{series:n,valueIndex:g,point:L,style:{fill:k(V,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&p[g]&&f.push(s0(e,g,C,L,U,p[g]))}return f}function i0(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function a0(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:m(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:i0(i.config?.customConnectorDash)}}}function s0(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=Ci(a),c=d?{x:Math.max(r.x,n.x)+o+su,y:Math.min(r.y,n.y)-8,width:bi,height:16}:{x:Math.min(r.x,n.x)-bi/2,y:Math.min(r.y,n.y)-o-su-14,width:bi,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(6,m(a.config?.customLabelSize,Math.max(9,m(a.fontSize,12))-2)),...a.config?.customLabelColor?{color:a.config.customLabelColor}:{}}}function mu(e){let{chart:t,plot:r}=e,n=t.series.filter(a=>uu(a.values[0])===3),o=t.series.filter(a=>uu(a.values[0])===4);return{scalarSamples:n.flatMap(a=>a.values.map(([s,l,d])=>({x:T(s,t.axisX,r.width),y:r.height-T(l,t.axisY,r.height),value:d}))),vectorSeries:o}}function uu(e){return Array.isArray(e)?e.length:void 0}function pu(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=l0(e);return[d0(e,r,n,o,i),...c0(e,n,o,i)]}function l0(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 d0(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 c0(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:he(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:he(r),chart:o,align:"right"})]}var u0="#94a3b8";function xn(e,t){return e?.stops.length?Qt(e.stops,t):u0}function fu(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),p={point:l,segment:d};u?u.push(p):r.set(c,[p])};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(p=>!o[p.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 hu(e,t){let r=[];for(let n=0;n<e.rows-1;n++)for(let o=0;o<e.columns-1;o++){let i=m0(e,n,o),a=p0(i,t);a!==0&&a!==15&&r.push(...f0(i,a,t))}return r}function m0(e,t,r){return{topLeft:Sn(e,t,r),topRight:Sn(e,t,r+1),bottomRight:Sn(e,t+1,r+1),bottomLeft:Sn(e,t+1,r)}}function Sn(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 p0(e,t){return(Cn(e.topLeft,t)?8:0)|(Cn(e.topRight,t)?4:0)|(Cn(e.bottomRight,t)?2:0)|(Cn(e.bottomLeft,t)?1:0)}function Cn(e,t){return e.value>=t}function f0(e,t,r){let n=h0(e,r);switch(t){case 1:case 14:return[ve(n.left,n.bottom)];case 2:case 13:return[ve(n.bottom,n.right)];case 3:case 12:return[ve(n.left,n.right)];case 4:case 11:return[ve(n.top,n.right)];case 5:return[ve(n.left,n.top),ve(n.bottom,n.right)];case 6:case 9:return[ve(n.top,n.bottom)];case 7:case 8:return[ve(n.left,n.top)];case 10:return[ve(n.top,n.right),ve(n.left,n.bottom)];default:return[]}}function h0(e,t){return{top:Rn(e.topLeft,e.topRight,t),right:Rn(e.topRight,e.bottomRight,t),bottom:Rn(e.bottomLeft,e.bottomRight,t),left:Rn(e.topLeft,e.bottomLeft,t)}}function Rn(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 ve(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var g0=.5;function gu(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=b0(e,t);return[...y0(e,r),...S0(e,r)]}function b0(e,t){let{plot:r,chart:n}=e,o=_c(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 y0(e,t){let r=[];for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)r.push(x0(e,t,n,o));return r}function x0(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=xn(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:ur(o,i)}}}function S0(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((n,o)=>{let i=C0(e,t,n,o);i&&r.push(i)}),r}function C0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=hu({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=fu(l).map(u=>Pt(u.map(([p,f])=>({x:i.x+p,y:i.y+f})),g0)).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:ur(o,i)}}}function bu(e,t){let r=[];return t.forEach((n,o)=>{let i=n.color??$[o%$.length];n.values.forEach((a,s)=>{r.push(R0(e,n.id,a,s,i))})}),r}function R0(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,p,f]=r,g=a.x+T(c,i.axisX,a.width),b=a.y+a.height-T(u,i.axisY,a.height),x=a.x+T(c+Math.cos(p)*f,i.axisX,a.width),C=a.y+a.height-T(u+Math.sin(p)*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 ${x} ${C}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:k(o,l,i.id),strokeWidth:2}}}function yu(e){let t=mu(e),r=[];return r.push(...gu(e,t.scalarSamples)),r.push(...bu(e,t.vectorSeries)),r.push(...pu(e)),r}function xu(e,t){let r=[];return t.rows.forEach((n,o)=>{r.push(...k0(e,t,n,o))}),r}function k0(e,t,r,n){return t.columns.flatMap((o,i)=>{let a=w0(t,r,n,i);return P0(e,t,a)})}function w0(e,t,r,n){let o=t.values[n]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:n,value:o,color:v0(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 v0(e,t){return nr(e,t.bands,t.zones)}function P0(e,t,r){let n=L0(e,t,r);return e.chart.config?.showValues===!1?[n]:[n,T0(e,t,r)]}function L0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=`chart-heatmap-cell-${n.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:n.config?.cellStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(n.config?.cellStrokeWidth,m(n.gridWidth,1))};return n.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:o,cx:r.frame.x+r.frame.width/2,cy:r.frame.y+r.frame.height/2,rx:r.frame.width/2,ry:r.frame.height/2,style:s}:{type:"rect",id:a,order:i(),bounds:o,...r.frame,rx:t.grid.cellRadius,style:s}}function T0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=Math.max(6,m(n.config?.cellValueSize,t.fontSize));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-a/2,width:r.frame.width,height:a+2},text:String(r.value),chart:n,align:"center"}),...n.config?.cellValueSize===void 0?{}:{fontSize:a},color:n.config?.cellValueColor??J(r.color)}}function Su(e,t){return[...$0(e,t),...A0(e,t)]}function $0(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,n)=>M0(e,t,r,n))}function M0(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 A0(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,n)=>E0(e,t,r,n))}function E0(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 Cu(e){let{chart:t}=e,r=N0(e),n=O0(e);return{rows:t.series,columns:r,bands:rr(t.axisY),zones:t.config?.zones?.length?t.config.zones:tr,fontSize:Math.max(9,m(t.fontSize,12)),reservedSpace:n,grid:B0(e,n,r.length)}}function N0(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function O0(e){let{chart:t}=e,r=Math.max(9,m(t.fontSize,12)),n=t.series.reduce((o,i)=>Math.max(o,Me(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 B0(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,m(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 p=Math.min(l,d);l=p,d=p,c=p*r,u=p*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,m(n.config?.barCornerRadius,s))}}var pr=10,Ru=4,I0=2;function ku(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=Q({x:r,y:i,width:n,height:pr});return[G0(e,t,r,i,n,a),...D0(e,t,r,i,n,o)]}function wu(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function G0(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,p)=>({offset:wu(t,t.bands[p+1]??t.bands[t.bands.length-1])*100,color:u.color??z}));return{type:"rect",id:`chart-heatmap-legend-bar-${a.id}`,order:s(),bounds:i,x:r,y:n,width:o,height:pr,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:z},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}}}function D0(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=n+pr+Ru+I0,c=48;return t.bands.flatMap((u,p)=>{let f=r+wu(t,u)*o,g={type:"path",id:`chart-heatmap-legend-tick-${a.id}-${p}`,order:l(),bounds:s,d:`M ${f} ${n+pr} L ${f} ${n+pr+Ru}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}},b=p===0,x=p===t.bands.length-1,C=b?"left":x?"right":"center",L=b?f:x?f-c:f-c/2,v=w({id:`chart-heatmap-legend-tick-label-${a.id}-${p}`,order:l(),bounds:s,frame:{x:L,y:d,width:c,height:i},text:he(u),chart:a,align:C});return[g,v]})}function vu(e){let t=Cu(e),r=[];return r.push(...xu(e,t)),r.push(...Su(e,t)),r.push(...ku(e,t)),r}function Ri(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 Pu(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 Lu(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 Tu(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 F0(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 H0(e,t,r,n){let o=1/0;for(let i of e.values()){let a=i.reduce((d,c)=>d+(t.get(c)??0),0),s=Math.max(0,i.length-1)*n,l=Math.max(1,r-s);a>0&&(o=Math.min(o,l/a))}return!Number.isFinite(o)||o<=0?1:o}function fr(e,t,r,n=18){return t<=1?0:e*(r-n)/(t-1)}function $u(e,t,r,n=8){let o=Lu(e.ids,t),i=F0(e),a=H0(o,i,r,n),s=new Map,l=new Map;for(let d of o.values()){let c=0;for(let u of d){let p=Math.max(2,(i.get(u)??0)*a);s.set(u,c),l.set(u,p),c+=p+n}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function Mu(e,t,r,n,o=18){let i=new Map,a=new Map;for(let s of e.ids)i.set(s,0),a.set(s,0);return e.links.map(s=>{let l=Math.max(.5,s.value*t.valueScale),d=n.get(s.source),c=n.get(s.target),u=(t.y.get(s.source)??0)+(d?.y??0),p=(t.y.get(s.target)??0)+(c?.y??0),f=i.get(s.source)??0,g=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,g+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:fr(t.columns.get(s.source)??0,t.columnCount,r,o)+o+(d?.x??0),x1:fr(t.columns.get(s.target)??0,t.columnCount,r,o)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:p+g,targetY1:p+g+l}})}function Au(e,t,r,n,o,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=o.get(a);return{id:a,label:s?.label??a,color:s?.color,x:fr(l,r.columnCount,n,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function V0(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 wi(e,t,r,n,o={nodeWidth:18,nodeGap:8}){let i=Tu(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=Pu(i),s=$u(i,a,n,o.nodeGap),l=V0(e);return{nodes:Au(e,i,s,r,l,o.nodeWidth),links:Mu(i,s,r,l,o.nodeWidth)}}function hr(e,t){let r=W0(e,t);if(!r.length)return[];let n=[],o=r,i=t;for(;o.length;){let a=z0(o,Math.min(i.width,i.height)),s=Y0(a,i);n.push(...s.rectangles),o=o.slice(a.items.length),i=s.remainingBounds}return n}function W0(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 z0(e,t){let r=[e[0]];for(let n=1;n<e.length;n++){let o=[...r,e[n]];if(Eu(o,t)>Eu(r,t))break;r.push(e[n])}return{items:r,area:r.reduce((n,o)=>n+o.area,0)}}function Eu(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 Y0(e,t){return t.width>=t.height?U0(e,t):j0(e,t)}function U0(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 j0(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}}}var X0=.15,q0=1/Math.sqrt(3);function K0(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 Nu(e){let{chart:t,plot:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??Qo),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*q0),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??X0)),p=O(t.shadowStyle),f=p?`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((g,b)=>{let L=(g.values.length>0&&Array.isArray(g.values[0])?g.values:g.values.map((V,U)=>[t.axisX.min+U*t.axisX.step,V])).map(([V,U])=>({x:T(V,t.axisX,r.width),y:r.height-T(U,t.axisY,r.height)})),v=Ri(L,l),M=Math.max(1,...v.map(V=>V.count)),H=g.color??$[b%$.length],I=s?.scale;v.forEach((V,U)=>{let ne=V.count/M,Ne=I?xn(I,ne):H;a.push({type:"path",id:`chart-hexbin-${t.id}-${g.id}-${U}`,order:i(),bounds:n,d:K0(r.x+V.cx,r.y+V.cy,d),style:{fill:k(Ne,o,t.id),stroke:c>0?k(s?.hexStrokeColor??Ne,o,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:I?void 0:Math.max(u,ne),shadow:p,clip:f?{type:"path",d:f}:void 0}})})}),a}function tt(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 rt(e,t){let{chart:r,plot:n}=e;return t.map(([o,i])=>({x:n.x+T(o,r.axisX,n.width),y:n.y+n.height-T(i,r.axisY,n.height)}))}function Ou(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],p=`${Pt(r,o)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(C=>C.y)),g=(Math.min(...r.map(C=>C.x))+Math.max(...r.map(C=>C.x)))/2,b=(d-f)/2,x={minX:g-b,maxX:g+b,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:x,d:p,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:oi(n,i)},{offset:100,color:oi(n,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function Z0(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function Q0(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:k(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function J0(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:k(t.color,o,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function eS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=n.config,s=Math.max(9,n.fontSize??12),l=Z0(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 Bu(e,t,r){let{chart:n}=e,o=n.config,i=o?.highlightPoints;if(!i?.length)return[];let a=tt(n,t),s=rt(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let p={key:`${n.id}-${t.id}-${c}`,point:u,index:c,radius:o?.highlightSize??6,color:o?.highlightColor??r};o?.highlightGuide&&l.push(Q0(e,p)),l.push(J0(e,p)),o?.highlightLabels&&l.push(eS(e,p,a[c][1]))}return l}function Iu(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 Gu(e,t){return t.flatMap(r=>tS(e,r))}function tS(e,t){let r=[],n=rS(e,t);return n&&r.push(n),r.push(nS(e,t)),r}function rS(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=ir(t.value,t.error);return ar({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.position.x,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function nS(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?k(c,o,r.id):{kind:"none"},stroke:d&&l>0?k(t.color,o,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function Du(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,p=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:p?{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:Pt(r,o),style:{fill:{kind:"none"},stroke:k(p??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}:O(i.shadowStyle)}}}function _u(e,t){return N(e.color,$[t%$.length])}function Fu(e,t,r){let n=e.chart.config?.areaOpacity;if(n===void 0||n<=0)return[];let o=_u(t,r),i=e.chart.config?.lineTension??0,a=rt(e,tt(e.chart,t));return a.length>1?[Ou(e,t,a,o,i,n)]:[]}function Hu(e,t,r){let n=_u(t,r),o=e.chart.config?.lineTension??0,i=tt(e.chart,t),a=rt(e,i),s=[];a.length&&s.push(Du(e,t,a,n,o));let l=Iu(t,i,a,n);return s.push(...Gu(e,l)),s.push(...Bu(e,t,n)),s}function Vu(e){let t=[];return e.chart.series.forEach((r,n)=>{t.push(...Fu(e,r,n))}),e.chart.series.forEach((r,n)=>{t.push(...Hu(e,r,n))}),t}var Wu=[0,25,50,75,100];function zu(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...oS(e,t)),e.showLabels&&r.push(...iS(e,t)),r}function oS(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return Wu.map(i=>{let a=Yu(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:m(r.gridWidth,1)}}})}function iS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e;return Wu.map(a=>({...w({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:o,frame:{x:n.x,y:Yu(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function Yu(e,t){return e.grid.y+e.grid.height*(1-t/100)}function Uu(e,t,r,n){if(!e.showLabels)return[];let o=sS(e,t,r,n);return e.chart.config?.showMekkoTotals===!1?[o]:[aS(e,t,r,n),o]}function aS(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 sS(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:Re(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function ju(e){let t=lS(e),r=e.showLabels?30:0,n=dS(e,r),o=Math.max(9,m(e.chart.fontSize,12)),i=Math.max(0,m(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,o-1);return{columns:cS(e,n,t,i),fontSize:o,smallFontSize:a,labelGutterWidth:r,columnGap:i,labelSize:Math.max(6,m(e.chart.config?.mekkoLabelSize,a)),valueSize:Math.max(6,m(e.chart.config?.mekkoValueSize,a)),grid:n}}function lS(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function dS(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 cS(e,t,r,n){let o=r.map((d,c)=>e.chart.series.reduce((u,p)=>u+(p.values[c]??0),0)),i=o.reduce((d,c)=>d+c,0),a=Math.max(1,...o),s=Math.max(1,t.width-n*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=o[c],p=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,g={label:d,total:u,x:l,y:t.y+t.height-f,width:p,height:f};return l+=p+n,g})}var uS=.15;function Xu(e,t,r){let o=e.chart.config?.showColumnBackdrop!==!1?[mS(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=pS(e.chart.series,t,r),s=a.flatMap((l,d)=>fS(e,t,l,i?a[d+1]?.color:void 0));return[...o,...s]}function mS(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=qu(e);return{type:"path",id:`chart-mekko-column-backdrop-${n.id}-${r}`,order:a(),bounds:o,d:on(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:k(n.gridColor??"#e2e8f0",i,n.id),opacity:uS}}}function qu(e){return Math.max(0,m(e.chart.config?.barCornerRadius,2))}function pS(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??$[s%$.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 fS(e,t,r,n){return[hS(e,r,n),...gS(e,t,r)]}function hS(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=O(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=n.config,u=t.isTop||c?.mekkoRoundAll?qu(e):0,{x:p,y:f,width:g,height:b}=t.frame,x=Math.max(0,m(c?.mekkoSegmentGap,0)),C="#94a3b8",L={minX:p+g/2-b/2,maxX:p+g/2+b/2,minY:f,maxY:f+b},v=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:N(t.color,C)},{offset:100,color:N(r,C)}]}:k(t.color,a,n.id);return{type:"path",id:`chart-mekko-seg-${n.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?L:i,d:qe(p,f+x/2,g,Math.max(0,b-x),u,!!c?.mekkoRoundAll),style:{fill:v,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(c?.mekkoSegmentStrokeWidth,m(n.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function gS(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),p=t.labelSize*1.2,f=t.valueSize*1.2,g=Re(r.seriesLabel,c,t.labelSize).map(M=>Jr(M,c,t.labelSize,!0));if(g.length*p+f>u)return[];let b=n.config?.mekkoTextColor??J(N(r.color,"#ffffff")),x=t.columns[r.columnIndex]?.total??0,C=n.config?.mekkoValueFormat==="percent"?`${x>0?Math.round(r.value/x*100):0}%`:String(r.value),L={...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:g,fontSize:t.labelSize,fontWeight:"bold",color:b},v={...w({id:`chart-mekko-seg-value-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3+g.length*p,width:c,height:Math.max(1,u-g.length*p)},text:C,chart:n}),lines:[C],fontSize:t.valueSize,color:b};return[L,v]}function Ku(e){let t=ju(e),r=zu(e,t);return t.columns.forEach((n,o)=>{r.push(...Xu(e,t,o)),r.push(...Uu(e,t,o,n))}),r}function bS(e,t){let r=t.series.map(i=>Math.max(0,m(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 Zu(e,t){let{chart:r,bounds:n,nextOrder:o}=e,i=r.config?.pieCenterText;if(!i)return[];let a=bS(i,r).split(/\\n|\n/),s=m(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??E,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 Qu(e){let{chart:t,plot:r}=e,n=un(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,m(c.values[0],0)),0)||1}}var yS=14*Math.PI/180,gr=80,xS=.62,SS=14,CS=3,RS=.32,Ju="#334155";function rm(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(n=>n.end-n.start>=yS).flatMap(n=>kS(e,t,n))}function em(e,t,r,n,o,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=o*1.2,p=l.config?.pieLabelContent??"both",f=p==="inline"?gr*1.9:gr,g={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??E,fontSize:o,align:"center",verticalAlign:"middle",lineHeight:1.2,color:n},b=L=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...L}),x={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="name"?r.y-u/2:r.y-u,lines:[p==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:b({}),prop:we(t.seriesId)},C={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:b({}),prop:te(t.seriesId,0),propKind:"value"};return p==="inline"||p==="name"?[x]:p==="percent"?[C]:[x,C]}function tm(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 kS(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,m(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=Y(o,i,o.outerRadius+CS),c=o.outerRadius-o.innerRadius,u=c<l*2+6,p=r.labelOffsetX!==0||r.labelOffsetY!==0,f=n?.pieLabelPosition??"auto";if(p||f==="outside"||f==="auto"&&u){let M=p?wS(Y(o,i,o.outerRadius),r.labelOffsetX,r.labelOffsetY):Y(o,i,o.outerRadius+SS+(f==="outside"?Math.abs(Math.cos(i))*(n?.pieLabelContent==="inline"?gr*.95:gr/2):0)),H=sr(d,M,gr/2,l),I=n?.pieLabelColor??De(N(r.color,Ju),RS)??Ju;return[tm(e,r,d,H,I,!0),...em(e,r,M,I,a,s,!0,i)]}let b=o.innerRadius+c*xS,x=Y(o,i,b),C=N(r.color,"#0f172a"),L=n?.pieLabelColor??kt(C,J(C));return[tm(e,r,d,d,L,!1),...em(e,r,x,L,a,s,!1,i)]}function wS(e,t,r){return{x:e.x+t,y:e.y+r}}var vS=-Math.PI/2,Pi=Math.PI*2,PS=Pi*(359.999/360),vi=e=>e*Math.PI/180;function nm(e,t){let r=e.chart.config,n=TS(e.chart.series,t.total,{start:vS+vi(m(r?.pieStartAngle,0)),sweep:Math.min(Pi,Math.max(vi(1),vi(m(r?.pieSweep,360)))),explode:Math.max(0,m(r?.pieExplode,0))}),o=r?.pieSliceGap??0;return[...n.flatMap(i=>NS(e,LS(t,i),i,o)),...rm(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:om(i)})))]}function om(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function LS(e,t){if(t.explode===0)return e;let{dx:r,dy:n}=om(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+n}}function TS(e,t,r){let n=[],o=r.start;return e.forEach((i,a)=>{let s=Math.max(0,m(i.values[0],0)),l=s/t*r.sweep;n.push({seriesId:i.id,label:i.label,color:i.color??$[a%$.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:o,end:o+Math.min(l,r.sweep>=Pi?PS:r.sweep)},explode:Math.max(0,m(i.offset,r.explode)),labelOffsetX:m(i.labelOffsetX,0),labelOffsetY:m(i.labelOffsetY,0)}),o+=l}),n}function $S(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 MS(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 AS(e,t,r){let n=Math.max(0,r)/2,o=t.angles.end-t.angles.start,i=$t(e,t.angles,r),a=2*Ke(n,e.outerRadius),s=Math.max(0,o-a);return Math.min(e.cornerRadius,i?lr(e.outerRadius,e.innerRadius,s):dr(e.outerRadius,Ze(n,o,e.outerRadius),s))}function ES(e,t){let r=e.chart.config,n=t.stroke??r?.pieStroke;return n?{stroke:{kind:"solid",color:n},strokeWidth:m(t.strokeWidth,m(r?.pieStrokeWidth,1))}:{}}function NS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=k(r.color,a,o.id),d=Qe(t,r.angles,AS(t,r,n),n),c=O(o.shadowStyle),u=ES(e,r),p=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:MS(c,n),clip:{type:"path",d:$S(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:te(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:p?{color:N(r.color,"#ffffff"),opacity:.85,blur:p,dx:0,dy:0}:void 0}};return f?[f,g]:[g]}function im(e){let t=Qu(e);return[...nm(e,t),...Zu(e,t)]}var OS=-Math.PI/2,BS="#e2e8f0",IS=14*Math.PI/180,kn=80,GS=.62,DS=14,_S=3,FS=.32,am="#334155";function HS(e){let{chart:t,plot:r}=e,n=Math.max(1,Math.min(r.width,r.height)/2-4),o=m(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(m(t.config?.innerRadius,0),n-1)),cornerRadius:Math.max(0,m(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,m(t.config?.pieSliceGap,0)),axisMin:o,range:m(t.axisY.max,100)-o,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:OS+m(t.config?.pieStartAngle,0)*Math.PI/180}}function sm(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*Ke(d,t));if($t(l,r,s))return Math.min(a,lr(t,i,u));let p=Ze(d,c,t);return Math.min(a,dr(t,p,u))}function VS(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:p,innerRadius:f,maxRadius:g,gapPx:b}=t,x=k(a,d,s.id),C=O(s.shadowStyle),L=Qe({centerX:u,centerY:p,outerRadius:g,innerRadius:f},n,sm(t,g,n),b),v={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:L,style:{fill:k(s.gridColor??BS,d,s.id),opacity:s.config?.polarTrackOpacity,...WS(e)}},M=Qe({centerX:u,centerY:p,outerRadius:o,innerRadius:f},n,sm(t,o,n),b),H=C?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:M,style:{fill:x,shadow:C,clip:{type:"path",d:L}}}:void 0,I={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:M,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:n.start,pieEnd:n.end,pieValue:i},prop:te(r.id,0),style:{fill:x,innerShadow:C,...zS(e)}};return H?[v,H,I]:[v,I]}function WS(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(n=>Number.isFinite(n)&&n>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:m(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function zS(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:m(t.pieStrokeWidth,1)}:{}}function YS(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return!r.config?.polarRings||t.range<=0?[]:_(r.axisY).filter(i=>i>t.axisMin&&i<t.axisMin+t.range).map(i=>{let a=t.innerRadius+(t.maxRadius-t.innerRadius)*(i-t.axisMin)/t.range;return{type:"ellipse",id:`chart-polar-area-ring-${r.id}-${i}`,order:o(),bounds:n,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.textColor??"#334155"},strokeWidth:m(r.gridWidth,1),opacity:.25}}})}function lm(e){let t=HS(e),{centerX:r,centerY:n,innerRadius:o,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=IS;return[...e.chart.series.flatMap((p,f)=>{let g={start:d+f*l,end:d+(f+1)*l},b=Math.max(0,m(p.values[0],0)),x=s>0?Math.min(1,Math.max(0,(b-a)/s)):0,C=Math.max(o+1,o+(i-o)*x),L=p.color??$[f%$.length],v=VS(e,t,p,g,C,b,L);if(!c)return v;let M={centerX:r,centerY:n,outerRadius:C,innerRadius:o};return[...v,...jS(e,M,g,p,b,L)]}),...YS(e,t)]}function dm(e){let t=Math.max(9,m(e.fontSize,12));return{nameSize:Math.max(6,m(e.config?.polarNameSize,t)),valueSize:Math.max(6,m(e.config?.polarValueSize,t))}}function US(e,t,r,n,o){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=dm(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=m(n.labelOffsetX,0),u=m(n.labelOffsetY,0),p=c!==0||u!==0,f=d<l*2+6,g=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),b=!f&&g>=kn,x=e.chart.config?.polarOutsideLabels??!1;if(!b&&!p&&!x)return;let C=p||!b,L=Y(t,i,t.outerRadius+_S),v=C?p?XS(Y(t,i,t.outerRadius),c,u):Y(t,i,t.outerRadius+DS):Y(t,i,t.innerRadius+d*GS),M=C?x&&e.chart.textColor?e.chart.textColor:De(N(o,am),FS)??am:kt(N(o,"#0f172a"),J(N(o,"#0f172a")));return{point:v,color:M,outside:C,mid:i,tickStart:L}}function jS(e,t,r,n,o,i){let a=US(e,t,r,n,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:p,mid:f,tickStart:g}=a,{nameSize:b,valueSize:x}=dm(s),C=Math.max(b,x)*1.2,L=p?sr(g,c,kn/2,C):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 ${L.x} ${L.y}`,detail:{of:"chartSeries",series:n.id,mark:"polar-area-label-tick"},style:p?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},M={of:"chartSeries",series:n.id,mark:"polar-area-label",pulled:p||void 0,midAngle:f,wedgeRadius:t.outerRadius},H={bounds:l,x:c.x-kn/2,width:kn,fontFamily:s.fontFamily??E,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},I=s.config?.polarValueFirst??!1,V=b*1.2,U=x*1.2,ne=c.y-(V+U)/2,Ne=I?ne+U:ne,be=I?ne:ne+V,Oe={type:"text",id:`chart-polar-area-label-name-${s.id}-${n.id}`,order:d(),...H,y:Ne,height:b*1.2,fontSize:b,lines:[n.label],fontWeight:I?"normal":"bold",detail:M,prop:we(n.id)},ie={type:"text",id:`chart-polar-area-label-value-${s.id}-${n.id}`,order:d(),...H,y:be,height:x*1.2,fontSize:x,lines:[he(o)],fontWeight:I?"bold":"normal",detail:M,prop:te(n.id,0),propKind:"value"};return[v,Oe,ie]}function XS(e,t,r){return{x:e.x+t,y:e.y+r}}var qS=["Speed","Quality","Cost","Reliability","Usability"];function KS(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:fn(r.width,r.height,m(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:hn(n,o),curved:t.chartType==="radial",tension:t.config?.radarTension}}function cm(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],n=KS(e),o=ZS(r,n.count),i=(a,s)=>Vc(n,s,a);return{circular:n.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:n.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:o,centerX:n.centerX,centerY:n.centerY,radius:n.radius,radiusForValue:a=>Wc(n,a),pointAt:i,polygonPath:a=>gn(o.map((s,l)=>i(a,l)),!1)}}function ZS(e,t){return Array.from({length:t},(r,n)=>e[n]??qS[n]??`Category ${n+1}`)}function um(e,t){return e.chart.showGrid===!1?[]:[...QS(e,t),...t.showSpokes?eC(e,t):[]]}function QS(e,t){return _(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>JS(e,t,r))}function JS(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:m(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 eC(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:m(r.gridWidth,1)}}})}function mm(e,t){return e.showLabels?t.categories.map((r,n)=>tC(e,t,r,n)):[]}function tC(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:rC(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:o,align:nC(d)})}function rC(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function nC(e){return e>8?"left":e<-8?"right":"center"}function pm(e,t){let r=[];return e.chart.series.forEach((n,o)=>{r.push(...oC(e,t,n,o))}),r}function oC(e,t,r,n){let o=r.color??$[n%$.length],i=iC(r,e,t),a=gn(i,t.circular,t.tension);return[aC(e,t,r,a,o),...t.strokeWidth>0?[sC(e,t,r,a,o)]:[],...t.pointSize>0?lC(e,t,r,i,o):[]]}function iC(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 aC(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:k(o,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function sC(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-series-${i.id}-${r.id}`,order:l(),bounds:a,d:n,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:k(o,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:O(i.shadowStyle)}}}function lC(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return n.map((d,c)=>({type:"ellipse",id:`chart-radar-point-${i.id}-${r.id}-${c}`,order:l(),bounds:a,cx:d.x,cy:d.y,rx:t.pointSize,ry:t.pointSize,detail:{of:"chartValue",series:r.id,valueIndex:c,mark:"radar-vertex"},prop:te(r.id,c),style:{fill:k(o,s,i.id)}}))}function Li(e){let t=cm(e),r=[];return r.push(...um(e,t)),r.push(...mm(e,t)),r.push(...pm(e,t)),r}var dC=-Math.PI/2,cC=14,uC=4,mC=.18,Ti=1e-4;function Dt(e,t,r,n){return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}}function fm(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 pC(e,t,r,n){return`${fm(e,t,r)} ${fm(e,t,Math.max(0,n))}`}function hm(e,t,r,n,o){let i=Dt(e,t,r,n),a=Dt(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 fC(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 hC(e,t,r,n,o){if(n>=Math.PI*2-Ti){let l=Dt(e,t,r,o),d=Dt(e,t,r,o+Math.PI);return`M ${l.x} ${l.y} A ${r} ${r} 0 1 1 ${d.x} ${d.y} A ${r} ${r} 0 1 1 ${l.x} ${l.y}`}let i=Dt(e,t,r,o),a=Dt(e,t,r,o+n),s=n>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function gC(e){let{chart:t,plot:r}=e,n=m(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,m(t.config?.ringThickness,cC)),ringGap:Math.max(0,m(t.config?.ringGap,uC)),axisMin:n,range:m(t.axisY.max,100)-n,start:dC+m(t.config?.ringStartAngle,0)*Math.PI/180,total:Math.min(360,Math.max(1,m(t.config?.ringSweep,360)))*Math.PI/180,trackOpacity:Math.min(1,Math.max(0,m(t.config?.ringTrackOpacity,mC))),cap:t.config?.ringCap??"round"}}function bC(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:p}=t,f=O(a.shadowStyle),g=o>=Math.PI*2-Ti;if(!f||g)return[];let b=fC(f,u),x=Math.min(o,u/n);return[[p,p+x],[p+o-x,p+o]].map(([C,L],v)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${v}`,order:l(),bounds:s,d:hm(d,c,n,C,L),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:b,clip:{type:"path",d:pC(d,c,n+u/2,n-u/2)}}}))}function yC(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:p,axisMin:f,range:g,start:b,total:x,trackOpacity:C,cap:L}=t,v=c-n*(u+p)-u/2;if(v<=u/2)return[];let M=k(r.color??$[n%$.length],a,o.id),H=Math.max(0,m(r.values[0],0)),I=g>0?Math.min(1,Math.max(0,(H-f)/g)):0,V={fill:{kind:"none"},stroke:M,strokeWidth:u,opacity:C},U=x>=Math.PI*2-Ti?{type:"ellipse",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:v,ry:v,style:V}:{type:"path",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,d:hm(l,d,v,b,b+x),style:{...V,lineCap:L}};if(I<=0)return[U];let ne=I*x,Ne=bC(e,t,r,v,ne,M),be={type:"path",id:`chart-radial-bar-ring-${o.id}-${r.id}`,order:s(),bounds:i,d:hC(l,d,v,ne,b),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:te(r.id,0),style:{fill:{kind:"none"},stroke:M,strokeWidth:u,lineCap:L}};return[U,...Ne,be]}function gm(e){let t=gC(e);return e.chart.series.flatMap((r,n)=>yC(e,t,r,n))}function bm(e,t){let r=O(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=xC(e,t,a,s,n);return SC(e,l,r,i,n)})}function xC(e,t,r,n,o){let i={x:t.baseX+r.x0,top:t.baseY+r.sourceY0,bottom:t.baseY+r.sourceY1},a={x:t.baseX+r.x1,top:t.baseY+r.targetY0,bottom:t.baseY+r.targetY1},s=e.chart.config,l=r.color||t.nodeColors.get(r.source)||z,d=t.nodeColors.get(r.target)||z,c=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:n,fromId:r.source,toId:r.target,source:i,target:a,controlX:i.x+(a.x-i.x)*Math.min(1,Math.max(0,m(s?.sankeyLinkCurve,.5))),fill:c,opacity:Math.min(1,Math.max(0,m(s?.sankeyLinkOpacity,r.color?.85:.45)))}}function SC(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:CC(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 CC(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 RC=.3,kC=.78;function ym(e,t){let r=Math.max(0,m(e.chart.config?.barCornerRadius,0)),n=[];return t.nodes.forEach(o=>{n.push(wC(e,t,o,r));let i=e.showLabels?vC(e,t,o):void 0;i&&n.push(i)}),n}function wC(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||z},shadow:O(o.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,p={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:p}:n>0&&c?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Kt(s,l,r.width,r.height,n),style:d,detail:p}:n>0&&u?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Zt(s,l,r.width,r.height,n),style:d,detail:p}:{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:p}}function vC(e,t,r){let{chart:n}=e,o=n.config?.labelPosition??"outside",i=o==="inside"?LC(e,t,r,n.config?.labelOrientation??"horizontal"):PC(e,t,r);if(!i)return;let a=n.textColor??"#0f172a",s=o==="inside"?J(r.color):De(r.color,ln(a)?kC:RC)??a,l=n.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function PC(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.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function LC(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.labelSize,p=`chart-sankey-label-${o.id}-${r.id}`;if(n==="vertical"){let f=u*1.4,g=Math.max(1,r.height-8);return Me(r.label,u,!1)>g?void 0:{...w({id:p,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:p,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 xm(e){let{chart:t,plot:r,showLabels:n}=e,o=n?92:0,i=Math.max(1,r.width-o*2),a=wi(TC(e),$C(e),i,r.height,{nodeWidth:Math.max(1,m(t.config?.sankeyNodeWidth,18)),nodeGap:Math.max(0,m(t.config?.sankeyNodeGap,8))});return{...a,baseX:r.x+o,baseY:r.y,labelGutter:o,fontSize:Math.max(9,m(t.fontSize,12)),labelSize:Math.max(6,m(t.config?.sankeyLabelSize,Math.max(9,m(t.fontSize,12))-2)),columnCount:Math.max(1,...a.nodes.map(s=>s.column+1)),nodeColors:new Map(a.nodes.map(s=>[s.id,s.color||z]))}}function TC(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function $C(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?N(r.color,z):void 0})}),t}function Sm(e){let t=xm(e),r=[];return r.push(...bm(e,t)),r.push(...ym(e,t)),r}var MC=4;function Cm(e){let t=[],r=O(e.chart.shadowStyle);return e.chart.series.forEach((n,o)=>{let i=n.color??$[o%$.length];rt(e,tt(e.chart,n)).forEach((s,l)=>{t.push(AC(e,n,s,l,i,r))})}),t}function AC(e,t,r,n,o,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??MC,p=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${n}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:n},style:{fill:k(o,l,a.id),stroke:p>0?k(c?.pointStrokeColor??o,l,a.id):void 0,strokeWidth:p>0?p:void 0,opacity:c?.pointOpacity,shadow:i}}}function Rm(e){let{chart:t,plot:r,showLegend:n}=e,o=Math.max(9,m(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=n&&i==="bottom"?48:0,s=Math.max(0,m(t.config?.cellGap,0));return{leaves:t.series,bands:rr(t.axisY),zones:t.config?.zones?.length?t.config.zones:tr,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,m(t.config?.barCornerRadius,s)),headerHeight:Math.max(0,m(t.config?.headerHeight,20)),labelSize:Math.max(6,m(t.config?.tileLabelSize,Math.max(8,o-1))),valueSize:Math.max(6,m(t.config?.tileValueSize,Math.max(8,o-1))),labelPadding:Math.max(0,m(t.config?.tileLabelPadding,4))}}function br(e){return e.values[0]??0}function $i(e,t){return e.color??nr(br(e),t.bands,t.zones)}var Ee=10,wn=4,Mi=2,Ai=16,yr=34;function km(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?EC(e,t):NC(e,t)}function Ei(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function wm(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((n,o)=>({offset:Ei(e,e.bands[o+1]??e.bands[e.bands.length-1])*100,color:n.color??z}))}function EC(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+Ai,c=Q({x:a,y:d,width:s,height:Ee}),u=wm(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:Ee,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:z},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((g,b)=>{let x=a+Ei(t,g)*s,C={type:"path",id:`chart-treemap-legend-tick-${r.id}-${b}`,order:i(),bounds:o,d:`M ${x} ${d+Ee} L ${x} ${d+Ee+wn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},L=b===0,v=b===t.bands.length-1,M=L?"left":v?"right":"center",H=L?x:v?x-yr:x-yr/2,I=w({id:`chart-treemap-legend-tick-label-${r.id}-${b}`,order:i(),bounds:o,frame:{x:H,y:d+Ee+wn+Mi,width:yr,height:l},text:he(g),chart:r,align:M});return[C,I]});return[p,...f]}function NC(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-Ai-Ee:n.x+t.gridWidth+Ai,c=Q({x:d,y:s,width:Ee,height:l}),u=wm(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:Ee,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:z},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+Ee,g=a==="left"?f-wn:f+wn,b=a==="left"?g-Mi-yr:g+Mi,x=t.bands.flatMap((C,L)=>{let v=s+(1-Ei(t,C))*l,M={type:"path",id:`chart-treemap-legend-tick-${r.id}-${L}`,order:i(),bounds:o,d:`M ${f} ${v} L ${g} ${v}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},H=w({id:`chart-treemap-legend-tick-label-${r.id}-${L}`,order:i(),bounds:o,frame:{x:b,y:v-t.fontSize/2,width:yr,height:t.fontSize+2},text:he(C),chart:r,align:a==="left"?"right":"left"});return[M,H]});return[p,...x]}function vm(e,t){let{tiles:r,headers:n}=OC(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(...IC(e,t,a,c))}),n.forEach((a,s)=>{o.push(...BC(e,t,a,s))}),o}function OC(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:br(c)}));return{tiles:hr(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+br(c),0)})),o=hr(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(t.headerHeight,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(p=>(p.group??"")===l.item.key).map(p=>({leaf:p,value:br(p)}));a.push(...hr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function BC(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:t.headerHeight,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+(t.headerHeight-c)/2,width:r.width,height:c+2},text:r.label,chart:o,align:"center"}),fontSize:c,color:J(l)};return[d,u]}function IC(e,t,r,n){let o=$i(r.item.leaf,t),i=n?$i(n.item.leaf,t):void 0,a=[GC(e,t,r,o,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...DC(e,t,r,o)),a}function GC(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=O(i.shadowStyle),p=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),x=Math.max(0,r.height-c),C="#94a3b8",L={minX:f,maxX:f+b,minY:g+x/2-b/2,maxY:g+x/2+b/2},v=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:N(n,C)},{offset:100,color:N(o,C)}]}:k(n,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:o?L:s,x:f,y:g,width:b,height:x,rx:t.cellRadius,style:{fill:v,stroke:{kind:"solid",color:i.config?.tileStrokeColor??i.gridColor??"#e2e8f0"},strokeWidth:m(i.config?.tileStrokeWidth,m(i.gridWidth,1)),shadow:u,clip:p?{type:"path",d:p}:void 0}}}function DC(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=t.labelPadding,p=Math.max(1,r.width-c-u*2),f=Math.max(1,r.height-c-u*1.5),g=i.x+r.x+c/2+u,b=i.y+r.y+c/2+u*.75,x=o.config?.tileTextColor??J(N(n,"#ffffff")),C=t.labelSize*1.2,L=Math.max(1,Math.floor(f/C)),v=Re(l.label,p,t.labelSize).slice(0,L).map(U=>Jr(U,p,t.labelSize,!0)),M={...w({id:`chart-treemap-label-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b,width:p,height:f},text:l.label,chart:o}),lines:v,fontSize:t.labelSize,fontWeight:"bold",color:x},H=String(d),I=v.length*C+t.valueSize*1.2<=f+2&&Me(H,t.valueSize,!1)<=p;if(o.config?.showTileValues===!1||!I)return[M];let V={...w({id:`chart-treemap-value-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b+v.length*C,width:p,height:Math.max(1,f-v.length*C)},text:String(d),chart:o}),lines:[String(d)],fontSize:t.valueSize,color:x};return[M,V]}function Pm(e){let t=Rm(e),r=[];return r.push(...vm(e,t)),r.push(...km(e,t)),r}var _C={bar:Qc,boxplot:au,custom:du,field:yu,heatmap:vu,hexbin:e=>Nu(e),line:Vu,mekko:Ku,pie:e=>im(e),polarArea:e=>lm(e),radar:e=>Li(e),radial:e=>Li(e),radialBar:e=>gm(e),sankey:Sm,scatter:Cm,treemap:Pm},FC=new Set(["radar","radial"]);function Ni(e){return FC.has(e)}function nt(e){return _C[e.chart.chartType](e)}function Lm(e){let{chart:t,context:r,layout:n,nodes:o,renderOrder:i}=e,a=yn(t,n.plot,n.bounds,i.current());o.push(...a),i.advance(a.length),o.push(...nt(r));let s=Uc({chart:t,plot:n.plot,bounds:n.bounds,order:i.current()});return o.push(...s),i.advance(s.length),o.push(...Gc(t,n,i.current())),o}function HC(e,t){let r=ee(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function VC(e,t){let{outerRadius:r,innerRadius:n,cornerRadius:o}=un(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 WC(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),n=Math.max(0,Math.min(m(e.config?.innerRadius,0),r-1)),o=Math.max(0,m(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function zC(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...e.series.map(c=>c.values.length)),o=hn(r,n),i=fn(t.width,t.height,m(e.fontSize,12),e.showAxisLabels!==!1),a=t.x+t.width/2,s=t.y+t.height/2,l=e.chartType==="radial"?1:0,d=e.config?.radarTension;return{of:"radarGeometry",radarGeometry:`${a},${s},${i},${e.axisY.min},${e.axisY.max},${o},${l}${d===void 0?"":`,${d}`}`}}function YC(e,t){return e.chartType==="pie"?VC(e,t):e.chartType==="polarArea"?WC(e,t):e.chartType==="radar"||e.chartType==="radial"?zC(e,t):Ac.has(e.chartType)?HC(e,t):void 0}function Tm(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:k(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:m(e.strokeWidth,1)}},i=YC(e,r);return i&&(o.detail=i),o}function $m(e,t,r,n){let o=Tc({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:n});return r.advance(o.length),o}function Mm(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 vn=class{#e;#n=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#n++;current(){return this.#e+this.#n}advance(t){this.#n+=t}};function Am(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:m(e.titleSize,Math.max(10,m(e.fontSize,12))+2),prop:Rc}]:[]}function Em(e,t,r){let n=2e4+t,o=Ec(e),i=new vn(n),a=[Tm(e,o.bounds,o.plot,n)];return a.push(...jc(e,o.bounds,i)),a.push(...Am(e,o.bounds,o.plot,i)),a.push(...$m(e,o,i,r)),{chart:e,layout:o,nodes:a,renderOrder:i,context:Mm(e,o,i,r)}}function Nm(e){return e.nodes.push(...nt(e.context)),e.nodes}function Om(e){return e.nodes.push(...nt(e.context)),e.nodes}function Bm(e,t,r){if(e.isVisible===!1)return[];let n=Em(e,t,r);return Ni(e.chartType)?Nm(n):Je(e)?Lm(n):Om(n)}function Oi(e,t){return e.flatMap((r,n)=>Z(Bm(r,n,t),"chart",r.id,r.chartType,r.title??"Chart"))}function UC(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))}:Eo}function jC(e){let t=new Map,r=(n,o,i)=>{o.forEach((a,s)=>{t.set(`${n}:${a.id}`,{rank:_l(a),sequence:Fl(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.components??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 XC(e,t){let r=jC(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 Bi(e,t={}){let{measureText:r}=t,n=[...e.diagnostics??[]],o=[...id(e),...Xd(e.paths??[]),...Oi(e.charts??[],n),...jd(e.links,r),...pc(e.shapes,n,r),...No(e.components??e.widgets??[]),...sd(e.isometricObjects??[])];return XC(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:UC(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(),ge=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var Pn=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=ge(`${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 Ln=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,ZC);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,qC,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},KC)}define(t,r,n,o=.5){let i=JSON.stringify(r)+n.name+o,a=this.ids.get(i);return a||(a=ge(`${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 qC(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 KC(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 ZC(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 Im(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 QC(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function JC(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 Tn=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=ge(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(o,i);let a=12+(n-2)*3,s=QC(t,a,n),l=JC(i,s);return this.addDefinition(`<marker ${l}>${Im(t,a,P(r),n)}</marker>`),i}};function eR(e,t){let r=t.points.map((i,a)=>ge(`${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 tR(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 $n=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=ge(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(o,i);let a=t.kind==="mesh-gradient"?eR(i,t):tR(i,t,n);this.addDefinition(a)}return`url(#${i})`}};var Mn=class{constructor(t){this.prefix=t;let r=n=>{this.entries.push(n)};this.paints=new $n(r,t),this.filters=new Ln(r,t),this.markers=new Tn(r,t),this.clips=new Pn(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return ge(`${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 rR(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 Gm(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,rR(t,t.identity.id)]:[t])}function Dm(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 _m(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 nR(o,e.style),Fm(o,e,t),iR(o,e,t),o.join(" ")}function nR(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 oR(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 Fm(e,t,r){let n=r.filter(t.style,t.id,oR(t));n&&e.push(`filter="url(#${n})"`);let o=r.clip(t.style);o&&e.push(`clip-path="url(#${o})"`)}function iR(e,t,r){if(t.type!=="path")return;let n=r.marker(t.markerStart,Dm(t.style,"start"),t.style.strokeWidth??1),o=r.marker(t.markerEnd,Dm(t.style,"end"),t.style.strokeWidth??1);n&&e.push(`marker-start="url(#${n})"`),o&&e.push(`marker-end="url(#${o})"`)}function Fe(e,t){return e&&t?` transform="rotate(${h(e)} ${h(t.x)} ${h(t.y)})"`:""}function Hm(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}"`),Fm(r,e,t),r.join(" ")}var Vm="data-sf-symbol-points",Wm="data-sf-symbol-tension",An="data-sf-symbol-bounds",xr="data-sf-corner-radius",zm="data-sf-square-corner",En="data-sf-path-points",Nn="data-sf-path-tension",On="data-sf-path-closed",Ym="data-sf-path-point",Bn="data-sf-isometric-size",In="data-sf-isometric-label-offset";function aR(e){return e.role==="shape"?"entity":e.role}function sR(e){return[`role="${P(e.role)}"`,e.checked===void 0?void 0:`aria-checked="${e.checked}"`,e.pressed===void 0?void 0:`aria-pressed="${e.pressed}"`,e.disabled?'aria-disabled="true"':void 0]}function lR(e){return[`data-sf-role="${aR(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,...e.aria?sR(e.aria):[]]}function dR(e){switch(e.of){case"chartValue":return cR(e);case"chartScale":return pR(e);case"chartSeries":return fR(e);case"pieGeometry":return uR(e);case"radarGeometry":return mR(e);case"link":return xR(e);case"frameBoundary":return hR(e);case"symbolGeometry":return gR(e);case"declaredBounds":return[Ii(e.bounds)];case"pathGeometry":return bR(e);case"isometricGeometry":return yR(e)}}function cR(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 uR(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function mR(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function pR(e){return[`data-sf-value-scale="${e.valueScale}"`]}function fR(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 hR(e){return[`${xr}="${h(e.cornerRadius)}"`,`${zm}="${e.squareCorner}"`]}function Ii(e){return`${An}="${h(e.x)},${h(e.y)},${h(e.width)},${h(e.height)}"`}function gR(e){return[`${Vm}="${P(JSON.stringify(e.points))}"`,`${Wm}="${h(e.tension)}"`,Ii(e.declaredBounds)]}function bR(e){return[`${En}="${P(JSON.stringify(e.points))}"`,`${Nn}="${h(e.tension)}"`,`${On}="${e.closed}"`]}function yR(e){return[`${Bn}="${h(e.width)},${h(e.height)},${h(e.depth)}"`,`${xr}="${h(e.cornerRadius)}"`,Ii(e.bounds),`${In}="${h(e.labelOffsetX)},${h(e.labelOffsetY)}"`]}function xR(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 ot(e){let t=e.identity?.label,r=[...e.identity?lR(e.identity):[],...e.detail?dR(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 SR(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 Um(e,t){let r=CR(e),n=`${h(e.fontSize)}px`,o=kR(e,r,n),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${ot(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}${Fe(e.rotation,e.rotationCenter)}>${o}</text>`}function CR(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:RR(e,n),linePx:t,anchor:i}}function RR(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 kR(e,t,r){return e.richLines?e.richLines.map((n,o)=>SR(n,t.x,jm(o,t.linePx),r)).join(""):e.lines.map((n,o)=>wR(n,o,t,r)).join("")}function wR(e,t,r,n){return`<tspan x="${h(r.x)}" font-size="${n}"${jm(t,r.linePx)}>${P(e)}</tspan>`}function jm(e,t){return e?` dy="${h(t)}px"`:""}function vR(e,t){let r=Fe(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)}"${ot(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"||e.identity?.role==="widget"?"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 PR(e,t){let r=t.componentStyle;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 LR(e,t){let r=Fe(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=e.componentStyle.fontSize>0?e.componentStyle.fontSize: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.componentStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${P(e.label)}</span>`:"",i=[...e.value].map(s=>PR(s,e)).join(""),a=P(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${ot(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.componentStyle.fontFamily)};font-size:${h(n)}px">${o}<div data-sf-rolling-digits="true" aria-label="${P(e.value)}" style="display:flex;gap:${e.componentStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function Xm(e,t){if(e.type==="text")return Um(e,t);if(e.type==="shader-surface")return vR(e,t);if(e.type==="rolling-number")return LR(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${ot(e)} ${Hm(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)}"${ot(e)} ${_m(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)}"`:""}${Fe(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)}"${Fe(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${P(e.d)}"${Fe(e.rotation,e.rotationCenter)}/>`}function qm(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 Mn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?Gm(e.nodes):e.nodes).map(u=>Xm(u,a)).join(`
|
|
3
|
+
`?(this.line++,this.col=1):this.col++,t}};var ke=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 Ja=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),pt=e=>e!==void 0&&e>="0"&&e<="9",es=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function ie(e,t,r,n={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...n}}function Po(e,t){return{...e,endLine:t.line,endCol:t.col}}function ts(e){return Ja(e.peek())}function rs(e,t){let r="";for(;es(e.peek());)r+=e.advance();return ie("ident",r,t)}function ns(e){return e==="\r"||e===`
|
|
4
|
+
`}function os(e,t){return e.advance()==="\r"&&e.peek()===`
|
|
5
|
+
`&&e.advance(),ie("newline",`
|
|
6
|
+
`,t)}function is(e){return e.peek()==="/"&&e.peek(1)==="/"}function as(e){for(;!e.done&&e.peek()!==`
|
|
7
|
+
`&&e.peek()!=="\r";)e.advance()}function ss(e){let t=e.peek();return pt(t)||t==="-"&&pt(e.peek(1))}function ls(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());pt(e.peek());)r+=e.advance();if(e.peek()==="."&&pt(e.peek(1)))for(r+=e.advance();pt(e.peek());)r+=e.advance();return ie("number",r,t,{numberValue:Number(r)})}var lh=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],dh=e=>e!==void 0&&/[\d.]/.test(e);function ds(e,t){let r=lh.find(([i])=>e.startsWith(i));if(!r)return null;let[n,o]=r;if(n==="-"&&dh(e.peek(1)))return null;for(let i=0;i<n.length;i++)e.advance();return ie(o,n,t)}var ch={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function cs(e,t){let r=e.peek(),n=r?ch[r]:void 0;return!r||!n||r==="&"&&e.peek(1)==="&"?null:(e.advance(),ie(n,r,t))}function us(e){return e===" "||e===" "}function ms(e){e.advance()}function uh(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function mh(e){let t=e.split(`
|
|
8
|
+
`),r=1/0;for(let n of t)n.trim()&&(r=Math.min(r,uh(n)));return!Number.isFinite(r)||r===0?e:t.map(n=>n.trim()?n.slice(r):n).join(`
|
|
9
|
+
`)}function ph(e,t){ps(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return ps(e),mh(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new ke("unterminated long string",t.line,t.col)}function ps(e){e.advance(),e.advance(),e.advance()}function fh(e,t){e.advance();let r="";for(;!e.done;){let n=e.advance();if(n==='"')return r;if(n===`
|
|
10
|
+
`||n==="\r")throw new ke('newline in short string (use """ for multiline)',t.line,t.col);r+=n==="\\"?hh(e,t):n}throw new ke("unterminated string",t.line,t.col)}function hh(e,t){if(e.done)throw new ke("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 ke(`invalid escape '\\${r}'`,t.line,t.col)}}function gh(e,t){return e.startsWith('"""')?ph(e,t):fh(e,t)}function fs(e,t){return ie("string",gh(e,t),t)}function hs(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(ns(t))return os(e,r);if(bh(e,t))return null;let n=yh(e,t,r)??xh(e,r);if(n)return n;throw new ke(`unexpected character '${t}'`,r.line,r.col)}function bh(e,t){return us(t)?(ms(e),!0):is(e)?(as(e),!0):!1}function yh(e,t,r){let n=cs(e,r);return n||(t==='"'?fs(e,r):ds(e,r))}function xh(e,t){return ss(e)?ls(e,t):ts(e)?rs(e,t):null}function gs(e){let t=new Ir(e),r=[];for(;!t.done;){let n=hs(t);n&&r.push(Po(n,t))}return r.push(Po(ie("eof","",t.position()),t)),r}var V=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 Dr=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 V(`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 V(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Kt(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 bs(e){let t=Kt(e),r,n;if(e.at("comma")){e.next();let o=e.expect("ident",'side after ","');if(!Qa(o.value))throw new V(`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 Sh(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(Gr(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(Gr(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}function Gr(e,t=!0){let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return Sh(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:Kt(e)};default:throw new V(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var Ch=new Set([">","<",">=","<=","==","!="]);function kh(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function Zt(e,t,r){let n=r(e);for(;kh(e,t);)n={kind:"binary",operator:e.next().value,left:n,right:r(e)};return n}var Rh=new Set(["||"]),wh=new Set(["&&"]),vh=new Set(["+","-"]),Ph=new Set(["*","/"]);function _r(e){return Zt(e,Rh,Lh)}function Lh(e){return Zt(e,wh,Th)}function Th(e){return Zt(e,Ch,Mh)}function Mh(e){return Zt(e,vh,$h)}function $h(e){return Zt(e,Ph,Ss)}function Ss(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:Ss(e)}):Eh(e)}function Ah(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(_r(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new V(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function Eh(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=_r(e);return e.expect("rparen","')'"),r}case"ident":{let r=Kt(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:Ah(e)}:{kind:"ref",path:r}}default:throw new V(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var Nh=["bind","bind2","action"];function Fr(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&Nh.includes(e.peek(2).type)}function Hr(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,n=_r(e),o=e.peek();if(!["newline","semi","rbrace","eof"].includes(o.type))throw new V(`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 ys(e){let t=e.peek(),r=Kt(e);e.expect("bind","'<-'");let n=_r(e);return{target:r,expr:n,line:t.line,col:t.col}}function Cs(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function ks(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(ys(e)),xs(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new V(`unterminated handler '${t.value}'`,t.line,t.col);r.push(ys(e)),xs(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function xs(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new V(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var Vr=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 V("unterminated style block",n.line,n.col)}Fr(this.cursor)?(r.push(Hr(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"?bs(this.cursor):Gr(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 V(`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 V(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var Wr=class{constructor(t){this.cursor=t;this.properties=new Vr(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!Br(t.value))throw new V(`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 V('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 V(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return Br(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()}:Fr(this.cursor)?{type:"binding",binding:Hr(this.cursor)}:Cs(this.cursor)?{type:"handler",handler:ks(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"&&!Br(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 zr=class{constructor(t){this.cursor=t;this.blocks=new Wr(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new V(`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 Lo(e){return new zr(new Dr(gs(e))).parseDocument()}function S(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 k(e){return e?.type==="number"?e.value:void 0}function be(e){return e?.type==="tuple"?e.values:void 0}function Rs(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function Oh(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 ft(e,t){if(e?.type!=="endpoint")return{};let r=Oh(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 _(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 Yr(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 ws(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 W(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function vs(e){for(let t of e.entries)if(t.type==="data")return t.data}function ht(e){let t=vs(e);return t?[...W(e),...W(t)]:W(e)}function Ps(e,t){let r=_(e).get(t);if(r!==void 0)return r;let n=vs(e);return n?_(n).get(t):void 0}var Bh=["Entity","Shape","Text","Container","Path","Chart","Widget","Component","Isometric","Dimension"],Ih=new Set(Bh);function gt(e){return Ih.has(e)}function Ls(e,t){for(let r of e)gt(r.kind)&&t.set(r.name,S(_(r).get("id"))??r.name),Ls(W(r),t)}function Ur(e){let t=new Map;return e&&Ls(W(e),t),t}var Dh=new Set(["id","from","to","text","order","segments"]);function jr(e){let t={};for(let[r,n]of e){if(Dh.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}var Gh=new Set(["top","bottom","front","back","left","right"]);function Ts(e){return e!==void 0&&Gh.has(e)?e:"front"}function Ms(e,t,r,n,o=[]){let i={idByName:Ur(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=n.mergedProps(a);return{id:S(l.get("id"))??a.name,fromId:ft(l.get("from"),i).id,toId:ft(l.get("to"),i).id,fromFace:Ts(S(l.get("fromFace"))),toFace:Ts(S(l.get("toFace"))),order:k(l.get("order")),sourceIndex:o[s],props:jr(l)}})}function $s(e,t,r){let n=t.mergedProps(e),o=ft(n.get("from"),r),i=ft(n.get("to"),r);return{id:S(n.get("id"))??e.name,fromId:o.id,toId:i.id,text:S(n.get("text")),fromSide:o.side,fromFraction:o.fraction,toSide:i.side,toFraction:i.fraction,fromPort:o.port,toPort:i.port,order:k(n.get("order")),segments:Rs(n.get("segments")),props:jr(n)}}function As(e,t,r,n,o=[]){let i={idByName:Ur(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...$s(a,n,i),sourceIndex:o[s]}))}function _h(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(n=>n.type==="ident"?[n.segments]:[]):[]}function Fh(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 Es(e,t){let r=_h(e,t);if(r.length<2)return[];let n=S(t.mergedProps(e).get("text"));return r.slice(1).map((o,i)=>Fh(e,r[0],o,i,n))}function Ns(e,t){let r=S(t.layoutProp(e,"flow")),n=k(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 Xr=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function bt(e){return e!==void 0&&Xr.includes(e)}function Ae(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let n=k(r);return n===void 0?[]:[n]});return t.length>0?t:void 0}function Os(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=S(t);return r===void 0?[]:[r]})}function Re(e){let t=S(e);if(t!==void 0)return t==="true"}function To(e){let t=e?_(e):new Map;return{min:k(t.get("min"))??0,max:k(t.get("max"))??10,step:k(t.get("step"))??1,label:S(t.get("label")),unit:S(t.get("unit")),thresholds:Ae(t.get("thresholds"))}}function Bs(e){return ht(e).filter(t=>t.kind==="Rule").map(t=>{let r=_(t);return{id:t.name,at:k(r.get("at"))??0,text:S(r.get("text")),color:S(r.get("color")),strokeWidth:k(r.get("strokeWidth")),dash:Ae(r.get("dash"))}})}function Is(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(k);return t.every(r=>r!==void 0)?t:void 0}function Ds(e){return e?.type!=="list"?[]:Hh(e.values)==="tuple"?Wh(e.values):Vh(e.values)}function Hh(e){for(let t of e){if(t.type==="number")return"scalar";if(Is(t))return"tuple"}}function Vh(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function Wh(e){return e.flatMap(t=>{let r=Is(t);return r?[r]:[]})}function Gs(e){if(e?.type==="list")return e.values.map(zh)}function zh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:Yh(e)}function Yh(e){if(e.type!=="list"||e.values.length<2)return null;let t=k(e.values[0]),r=k(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function _s(e){if(e?.type==="list")return e.values.map(Uh)}function Uh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:S(e)??null}function Fs(e,t){if(e?.type==="list"){let o=e.values.flatMap(jh);return o.length>0?{points:o}:void 0}let r=S(e),n=r?t.get(r):void 0;if(n)return{points:n.points,normalized:!0,tension:n.tension}}function jh(e){if(e.type!=="list"||e.values.length<2)return[];let t=k(e.values[0]),r=k(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Hs(e,t,r){let n=r(e);return{id:e.name,label:S(n.get("label"))??e.name,color:S(n.get("color")),colors:_s(n.get("colors")),opacity:k(n.get("opacity")),group:S(n.get("group")),values:Ds(n.get("values")),error:Gs(n.get("error")),source:S(n.get("source")),target:S(n.get("target")),size:k(n.get("size")),symbol:Fs(n.get("symbol"),t),stroke:S(n.get("stroke")),strokeWidth:k(n.get("strokeWidth")),dash:Ae(n.get("dash")),offset:k(n.get("offset")),labelOffsetX:k(n.get("labelOffsetX")),labelOffsetY:k(n.get("labelOffsetY"))}}function Vs(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let n=S(r.values[0]);return n===void 0?[]:[{label:n,color:S(r.values[1]),offsetX:k(r.values[2]),offsetY:k(r.values[3])}]});return t.length>0?t:void 0}var Xh=["none","true","percent","waterfall"];function qh(e){return bt(e)?e:"bar"}function Kh(e){return Xh.find(t=>t===e)}function Ws(e,t,r,n){let o=ht(e),i=o.filter(s=>s.kind==="Axis"),a=S(t.get("stacked"));return{chartType:qh(S(t.get("type"))),categories:Os(Ps(e,"categories")),areaOpacity:k(t.get("areaOpacity")),stacked:Kh(a),scale:S(t.get("scale")),interpolate:S(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:k(t.get("idwPower")),isolines:Ae(t.get("isolines")),zones:Vs(t.get("zones")),boxWidth:k(t.get("boxWidth")),orientation:S(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:k(t.get("lineTension")),highlightPoints:Ae(t.get("highlightPoints")),barCornerRadius:k(t.get("barCornerRadius")),showBoxplotPoints:Re(t.get("showBoxplotPoints")),barBorderColor:S(t.get("barBorderColor")),barBorderWidth:k(t.get("barBorderWidth")),barGroupGap:k(t.get("barGroupGap")),barGlow:k(t.get("barGlow")),barGap:k(t.get("barGap")),mekkoVaryHeight:Re(t.get("mekkoVaryHeight")),hexRadius:k(t.get("hexRadius")),innerRadius:k(t.get("innerRadius")),pieCornerRadius:k(t.get("pieCornerRadius")),pieSliceGap:k(t.get("pieSliceGap")),ringThickness:k(t.get("ringThickness")),ringGap:k(t.get("ringGap")),cellGap:k(t.get("cellGap")),showValues:Re(t.get("showValues")),squareCells:Re(t.get("squareCells")),headerColor:S(t.get("headerColor")),tileGradient:Re(t.get("tileGradient")),showColumnBackdrop:Re(t.get("showColumnBackdrop")),labelPosition:S(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:S(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:S(t.get("labelColor")),linkGradient:Re(t.get("linkGradient")),connectPoints:Re(t.get("connectPoints")),reverseComparison:Re(t.get("reverseComparison")),axisX:To(i.find(s=>s.name==="x")),axisY:To(i.find(s=>s.name==="y"||s.name==="value")),series:o.filter(s=>s.kind==="Series").map(s=>Hs(s,r,n)),rules:Bs(e)}}function zs(e,t,r,n,o){return{...e,objectType:"chart",chart:Ws(t,r,n,o)}}function Ys(e,t){let[r,n]=be(e)??[];return{x:t.x+(r??0),y:t.y+(n??0)}}function Us(e,t){return{start:Ys(e.get("start"),t),end:Ys(e.get("end"),t),offset:k(e.get("offset"))??0,unit:S(e.get("unit"))}}function js(e,t,r){return{...e,objectType:"dimension",dimension:Us(t,r)}}function Kr(e,t){return Math.max(0,t.tension??e.tension)}function Zr(e){return e.points.length<3||e.points.every(t=>Kr(e,t)<=0)}function qr(e,t){let{points:r}=e;return e.closed?r[(t+r.length)%r.length]:r[Math.max(0,Math.min(r.length-1,t))]}function Qr(e){let t=e.closed?e.points.length:e.points.length-1;return Array.from({length:Math.max(0,t)},(r,n)=>{let o=qr(e,n-1),i=qr(e,n),a=qr(e,n+1),s=qr(e,n+2),l=Kr(e,i)/6,d=Kr(e,a)/6;if(l===0&&d===0)return{from:i,to:a,controls:null};let c={x:i.x+(a.x-o.x)*l,y:i.y+(a.y-o.y)*l},u={x:a.x-(s.x-i.x)*d,y:a.y-(s.y-i.y)*d};return{from:i,to:a,controls:[c,u]}})}function Zh(e,t){let{from:r,to:n,controls:o}=e,i=1-t,a=[i*i*i,3*i*i*t,3*i*t*t,t*t*t],s=[r,o[0],o[1],n];return{x:s.reduce((l,d,c)=>l+d.x*a[c],0),y:s.reduce((l,d,c)=>l+d.y*a[c],0)}}function Mo(e,t=8){if(Zr(e))return e.points.map(i=>({x:i.x,y:i.y}));let r=[],n=Qr(e);n.forEach(i=>{if(r.push({x:i.from.x,y:i.from.y}),i.controls){let a={...i,controls:i.controls};for(let s=1;s<t;s++)r.push(Zh(a,s/t))}});let o=n[n.length-1];return!e.closed&&o&&r.push({x:o.to.x,y:o.to.y}),r}function Qh(e){if(e.type!=="list"||e.values.length<2)return[];let t=k(e.values[0]),r=k(e.values[1]),n=e.values[2]===void 0?void 0:k(e.values[2]);return t===void 0||r===void 0?[]:[n===void 0?{x:t,y:r}:{x:t,y:r,tension:n}]}function Xs(e,t){let r=Mo({points:e,tension:t,closed:!0});return r.length>=3?r.map(n=>[n.x,n.y]):void 0}function Jh(e,t){if(e?.type==="list")return Xs(e.values.flatMap(Qh),0);let r=S(e),n=r?t.get(r):void 0;if(!n)return;let o=n.points.map(([i,a],s)=>{let l=n.pointTensions?.[s];return l===void 0?{x:i,y:a}:{x:i,y:a,tension:l}});return Xs(o,n.tension??0)}function qs(e,t,r){return{depth:t,icon:S(e.get("icon")),footprint:Jh(e.get("symbol"),r),form:S(e.get("shape"))==="sphere"?"sphere":"box"}}function Ks(e,t,r,n,o){let i=be(n(t,"size"));return{...e,objectType:"isometric",isometric:qs(r,i?.[2]??24,o)}}function Zs(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=k(o.values[0]),a=k(o.values[1]),s=o.values[2]===void 0?void 0:k(o.values[2]);if(i===void 0||a===void 0)return[];let l={x:t.x+i,y:t.y+a};return[s===void 0?l:{...l,tension:s}]}):[],tension:k(e.get("tension")),startMarker:S(e.get("startMarker")),endMarker:S(e.get("endMarker")),closed:S(e.get("closed"))==="true",value:k(e.get("value"))}}function Qs(e,t,r){return{...e,objectType:"path",path:Zs(t,r)}}function Js(e){let t=S(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=S(i.values[0]),l=k(i.values[1]);if(s===void 0||l===void 0)return[];let d=S(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:n}}function el(e,t){return{...e,objectType:"swimlane",swimlane:Js(t)}}function eg(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":qt(e.kind)?S(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":e.kind==="Dimension"?"dimension":S(t.get("kind"))??""}function tg(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":Xe(e)?"component":e==="isometric"?"isometric":e==="dimension"?"dimension":"shape"}function tl(e,t,r){let n=eg(e,t),o=S(t.get("shape")),i=o?r.get(o):void 0;return{objectType:qt(e.kind)?"component":tg(n),kind:n,shapeType:i?"symbol":o,symbol:i}}function rl(e,t,r,n){let o=n??be(r(e,"position"))??[0,0],i=be(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:k(r(e,"rotation")),order:k(r(e,"order"))}}var rg=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function nl(e){let t={};for(let[r,n]of e){if(rg.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}function ol(e,t,r,n,o){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=tl(e,l,s),c=rl(e,t,a,o),u={id:S(l.get("id"))??e.name,kind:d.kind,text:S(l.get("text")),...c,parentFrameId:n??S(l.get("parent")),props:nl(l)};switch(d.objectType){case"chart":return zs(u,e,l,s,i);case"isometric":return Ks(u,e,l,a,s);case"path":return Qs(u,l,t);case"dimension":return js(u,l,t);case"swimlane":return el(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:S(l.get("type"))??"rollingNumber",value:S(l.get("value"))??"0",digits:k(l.get("digits")),duration:k(l.get("duration")),min:k(l.get("min")),max:k(l.get("max")),label:S(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function il(e){return W(e).filter(t=>gt(t.kind)).map(t=>S(_(t).get("id"))??t.name)}var $o=class{#e;#n=[];#t=[];#r=[];#o=[];#i=[];#s=0;constructor(t){this.#e=t.canvasObjectResolutionContext}resolve(t){let r=t?this.#a(t,{origin:{x:0,y:0}}):[];return{canvasObjects:this.#n,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#o,connectionSourceIndexes:this.#i}}#a(t,r){let n=[],o=Ns(t,this.#e);for(let i of W(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(gt(t.kind))return this.#u(t,r,n,o),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#o.push(o),[];case"Connection":return this.#r.push(t),this.#i.push(o),[];case"Net":{let i=Es(t,this.#e);return this.#t.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=be(this.#e.layoutProp(t,"size"))??[0,0];return{...ol(t,r.origin,this.#e,r.frameId,n(i)),sourceIndex:o}}#m(t,r){let n=this.#e.mergedProps(t);return{id:S(n.get("id"))??t.name,name:S(n.get("text"))??t.name,color:S(n.get("color")),icon:S(n.get("icon")),canvasObjectIds:il(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??S(n.get("parent"))}}};function al(e,t){return new $o(t).resolve(e)}function sl(e){let t=_(e),r=S(t.get("program"));if(!r)return;let n={};for(let[o,i]of t){if(o==="program")continue;let a=k(i),s=S(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 ng(e){let t=_(e).get("points"),r=[],n=[];if(t?.type!=="list")return{points:r,tensions:n};for(let o of t.values){if(o.type!=="list"||o.values.length<2)continue;let i=k(o.values[0]),a=k(o.values[1]);i===void 0||a===void 0||(r.push([i,a]),n.push(o.values[2]===void 0?void 0:k(o.values[2])))}return{points:r,tensions:n}}function og(e){let t=W(e).filter(r=>r.kind==="Port").flatMap(r=>{let n=be(_(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 ll(e){let{points:t,tensions:r}=ng(e);if(!(t.length<2))return{name:e.name,points:t,pointTensions:r.some(n=>n!==void 0)?r:void 0,tension:k(_(e).get("tension")),ports:og(e)}}function ig(e){return W(e).find(t=>t.kind==="Model")}function dl(e){return{styles:sg(e),layouts:lg(e),symbols:dg(e),shaders:ag(e),model:cg(e)}}function ag(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let n=sl(r);n&&t.set(r.name,n)}return t}function sg(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function lg(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function dg(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let n=ll(r);n&&t.set(r.name,n)}return t}function cg(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=ig(t);if(r)return r}}}function cl(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 ul(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 W(e))ul(o,t,r,n)}function ml(e,t,r){let n=[];for(let o of e.blocks)ul(o,t,r,n);return n}function Eo(e,t){return new Ao(e,t).resolveAll()}var Ao=class{#e;#n;#t=new Map;constructor(t,r){this.#e=t,this.#n=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let n=this.#t.get(t);if(n)return n;let o=this.#e.get(t);if(!o||r.has(t))return new Map;let i=this.#o(o,new Set([...r,t]));for(let[a,s]of _(o))i.set(a,s);return this.#t.set(t,i),i}#o(t,r){let n=this.#n(t);return n?new Map(this.#r(n,r)):new Map}};function pl(e){let{styles:t,layouts:r,symbols:n,shaders:o}=e,i=c=>cl(c.composition,t,r),a=Eo(t,c=>i(c).styleRef),s=Eo(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[p,f]of _(c))u.set(p,f);for(let[p,f]of Yr(c))u.set(p,f);return u},layoutProp:(c,u)=>{let p=ws(c);if(p.has(u))return p.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:n,shaderDefs:o}}var ug=new Set(["radar","radial"]),fl=new Set(["scatter","custom","hexbin"]);function hl(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(_(n).get("type"));o!==void 0&&!bt(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: ${Xr.join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function gl(e){let t=[],r=n=>{if(n.kind==="Chart")for(let o of ht(n).filter(i=>i.kind==="Series"))_(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 W(n))r(o)};for(let n of e.blocks)r(n);return t}function bl(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(_(n).get("type")),i=bt(o)?o:"bar";S(Yr(n).get("gridShape"))==="circle"&&!fl.has(i)&&!ug.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: ${[...fl].join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function yl(e){let t=[],r=n=>{if(qt(n.kind)){let o=S(_(n).get("type"))??"rollingNumber";wo(o)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:n.name,message:`Unsupported component type '${o}'. Supported: ${Ro().join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function xl(e){let t=dl(e);return{model:t.model,diagnostics:[...ml(e,t.styles,t.layouts),...hl(e),...bl(e),...gl(e),...yl(e)],canvasObjectResolutionContext:pl(t)}}function Sl(e){let t=xl(e),{canvasObjects:r,groups:n,linkBlocks:o,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=al(t.model,t),l=As(t.model,o,r,t.canvasObjectResolutionContext,a),d=Ms(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 Qt(e){return e.objectType==="dimension"&&e.dimension!==void 0}function Jt(e){return e.objectType==="isometric"&&e.isometric!==void 0}function Cl(e){return Sl(Lo(e))}var er=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function hg(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${er})\\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 gg(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${er})\\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 se(e){if(!(e==null||e===""))return hg(e)??gg(e)??e}function Jr(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${er})\\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 bg(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 ye(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&&bg(r,o[0].trim(),o[1].trim())}return r}var x=e=>e===void 0?void 0:Number(e);function yg(e){try{return JSON.parse(e)}catch{return}}function _e(e){if(e===void 0)return;let t=yg(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 le(e){let t=se(e);return typeof t=="string"?t:void 0}var xg=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function de(e){return e&&xg.test(e)?e:void 0}function we(e,t,r){return t.includes(e)?e:r}var en=["normal","bold"],kl=["normal","bold","100","200","300","400","500","600","700","800","900"],Rl=["top","bottom","left","right"],No=["none","arrow","filled_arrow"];function yt(e){let t=se(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var wl=["left","center","right"],vl=["top","middle","bottom"],tn=["solid","dashed","dotted"],rn=["straight","curved","orthogonal"];function ce(e,t){return e!==void 0&&t.includes(e)?e:void 0}var Pl=["solid","dashed","dotted","double"],Oo=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function Sg(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function Cg(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function kg(e){return e==="dashed"||e==="dotted"?e:"solid"}function Rg(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:se(t.color),colors:t.colors?.map(r=>r===null?null:se(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 wg(e){let t=Sg(e.fill);return{fillColor:t?"#111418":se(e.fill)??"#ffffff",fillImage:t,strokeColor:le(e.stroke)??"#475569",strokeWidth:x(e.strokeWidth)??1,cornerRadius:x(e.cornerRadius)??12,shadowStyle:ye(e.shadow)}}function vg(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:x(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:kg(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function Pg(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:x(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:x(e.tickLength),axisFontSize:x(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 Lg(e){return{textColor:e.textColor??"#0f172a",titleSize:x(e.titleSize),titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:x(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function Tg(e){return{legendColor:e.legendColor,showLegend:e.showLegend==="true",legendPosition:Cg(e.legendPosition)}}function Ll(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,...Rg(e),...wg(t),...vg(t),...Pg(t),...Lg(t),...Tg(t),order:e.order,sourceIndex:e.sourceIndex}}function Tl(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:se(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:x(t.barSegments),barSegmentGap:x(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:x(t.barGlassBlur),barGlassSaturation:x(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:x(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:x(t.barTrackHatchAngle),barTrackHatchSpacing:x(t.barTrackHatchSpacing),barTrackHatchWidth:x(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:x(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:x(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function Ml(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:x(t.lineWidth),lineGlow:x(t.lineGlow),pointSize:x(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:x(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:x(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function $l(e,t){return{categories:e?.categories,pointSize:x(t.pointSize),pointOpacity:x(t.pointOpacity),pointStrokeWidth:x(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function Al(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:x(t.boxWhiskerWidth),boxMedianWidth:x(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:x(t.boxCapSize),boxPointSize:x(t.boxPointSize),boxPointOpacity:x(t.boxPointOpacity),boxJitter:x(t.boxJitter)}}function El(e){return{scale:Jr(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Nl(e,t){return{categories:e?.categories,zones:e?.zones,cellGap:e?.cellGap,showValues:e?.showValues,squareCells:e?.squareCells,barCornerRadius:e?.barCornerRadius,cellShape:t.cellShape==="circle"?"circle":t.cellShape==="square"?"square":void 0,cellStrokeColor:t.cellStrokeColor,cellStrokeWidth:x(t.cellStrokeWidth),cellValueSize:x(t.cellValueSize),cellValueColor:t.cellValueColor}}function Ol(e,t){return{hexRadius:e?.hexRadius,scale:Jr(e?.scale),hexGap:x(t.hexGap),hexStrokeWidth:x(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:x(t.hexMinOpacity)}}function Bl(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:x(t.mekkoColumnGap),mekkoSegmentGap:x(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:x(t.mekkoSegmentStrokeWidth),mekkoLabelSize:x(t.mekkoLabelSize),mekkoValueSize:x(t.mekkoValueSize),mekkoTextColor:t.mekkoTextColor,showMekkoTotals:t.showMekkoTotals===void 0?void 0:String(t.showMekkoTotals)!=="false",mekkoValueFormat:t.mekkoValueFormat==="percent"?"percent":t.mekkoValueFormat==="value"?"value":void 0}}function Il(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieSweep:x(t.pieSweep),pieExplode:x(t.pieExplode),pieGlow:x(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:x(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:x(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function Dl(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:x(t.pieStrokeWidth),polarTrackOpacity:x(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:x(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:x(t.polarValueSize),polarNameSize:x(t.polarNameSize),polarValueFirst:t.polarValueFirst===void 0?void 0:String(t.polarValueFirst)!=="false",polarOutsideLabels:t.polarOutsideLabels===void 0?void 0:String(t.polarOutsideLabels)!=="false"}}function Gl(e){return{radarStrokeWidth:x(e.radarStrokeWidth),radarPointSize:x(e.radarPointSize),radarTension:x(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function _l(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Gl(t)}}function Fl(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Gl(t)}}function Hl(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:x(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:x(t.ringStartAngle),ringSweep:x(t.ringSweep)}}function Vl(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:x(t.sankeyNodeWidth),sankeyNodeGap:x(t.sankeyNodeGap),sankeyLinkOpacity:x(t.sankeyLinkOpacity),sankeyLinkCurve:x(t.sankeyLinkCurve),sankeyLabelSize:x(t.sankeyLabelSize)}}function Wl(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:x(t.tileStrokeWidth),tileLabelSize:x(t.tileLabelSize),tileValueSize:x(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:x(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:x(t.headerHeight)}}function zl(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:x(t.customConnectorWidth),customConnectorOpacity:x(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:x(t.customBeforeStrokeWidth),customLabelSize:x(t.customLabelSize),customLabelColor:t.customLabelColor}}function Yl(e){let t=Ll(e),r=e.chart,n=e.props,o=r?.chartType??"bar";switch(o){case"bar":return J(t,o,Tl(r,n));case"line":return J(t,o,Ml(r,n));case"scatter":return J(t,o,$l(r,n));case"boxplot":return J(t,o,Al(r,n));case"field":return J(t,o,El(r));case"heatmap":return J(t,o,Nl(r,n));case"hexbin":return J(t,o,Ol(r,n));case"mekko":return J(t,o,Bl(r,n));case"pie":return J(t,o,Il(r,n));case"polarArea":return J(t,o,Dl(r,n));case"radar":return J(t,o,_l(r,n));case"radial":return J(t,o,Fl(r,n));case"radialBar":return J(t,o,Hl(r,n));case"sankey":return J(t,o,Vl(r,n));case"treemap":return J(t,o,Wl(r,n));case"custom":return J(t,o,zl(r,n))}}function J(e,t,r){return{...e,chartType:t,config:r}}function Mg(e,t){let r=Number(t);if(t===void 0||t===""||!Number.isFinite(r))return e.default;let n=e.min===void 0?r:Math.max(e.min,r);return e.max===void 0?n:Math.min(e.max,n)}function $g(e,t){switch(e.type){case"number":return Mg(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return de(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function Ag(e,t){let r={};for(let[n,o]of Object.entries(e?.properties??{}))r[n]=$g(o,t[n]);return r}function Eg(e,t){if(!e)return"";if(e.type==="boolean")return t==="true";if(e.type==="number"){let r=Number(t);return Number.isFinite(r)?r:e.default}return t}function Ul(e){let t=mt(e.component.type);return{id:e.id,type:e.component.type,value:t?Eg(t.value,e.component.value):e.component.value,disabled:e.props.disabled==="true",label:e.component.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,properties:Ag(t,e.props)}}var Ng=/^[\w\s,'"-]+$/;function Bo(e){return e&&Ng.test(e)?e:void 0}var Og=/^(?:[1-9]00|normal|bold)$/;function Bg(e){return e==="plain"||e==="flip"?e:void 0}function Ig(e){return e==="roll"||e==="fade"?e:void 0}function Dg(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function Io(e){return e&&Og.test(e)?e:void 0}var Gg=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],_g=["color","accent"];function Fg(e){let t=e.props,r={};for(let n of Gg){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of _g){let o=de(t[n]);o&&(r[n]=o)}return{id:e.id,type:"tickScale",value:e.component.value,max:e.component.max,label:e.component.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:de(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Io(t.labelWeight),fontFamily:Bo(t.labelFont)}:void 0}}var Hg=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],Vg=["color","accent","glow"],Wg={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},zg=["core","peak"];function Yg(e){let t=e.props,r={};for(let n of Hg){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of Vg)r[n]=de(t[n])??Wg[n];for(let n of zg){let o=de(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.component.value,min:e.component.min,max:e.component.max,label:e.component.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:de(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Io(t.labelWeight),fontFamily:Bo(t.labelFont)}:void 0}}function Ug(e){let t=e.props;return{id:e.id,type:"rollingNumber",value:e.component.value,digits:e.component.digits,duration:e.component.duration,label:e.component.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:de(t.color),surface:de(t.surface),divider:de(t.divider),labelColor:de(t.labelColor),fontFamily:Bo(t.fontFamily),variant:Bg(t.variant),motion:Ig(t.motion),fontWeight:Io(t.fontWeight),fontSize:Dg(t.fontSize)}}}var jg={rollingNumber:Ug,tickScale:Fg,ruler:Yg};function jl(e){let t=e.component.type;return Xe(t)?jg[t](e):Ul(e)}function Xl(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:ce(t.route,rn)??"straight",color:yt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:ce(t.strokeStyle,tn),opacity:t.opacity!==void 0?x(t.opacity):void 0}}}function ql(e){let t=e.props;return{id:e.id,start:e.dimension.start,end:e.dimension.end,offset:e.dimension.offset,text:e.text,unit:e.dimension.unit,strokeColor:le(t.stroke),strokeWidth:x(t.strokeWidth),textColor:le(t.textColor),fontSize:x(t.fontSize),order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId}}function Kl(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:x(t.strokeWidth)??2,cornerRadius:x(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:x(t.fontSize)??14,fontWeight:we(t.fontWeight,en,"bold"),fontFamily:t.fontFamily,dash:_e(t.dash),showLabel:t.showLabel!=="false",labelPosition:we(t.labelPosition,Rl,"top"),shadow:t.shadow!=="false",order:e.order,sourceIndex:e.sourceIndex}}function Zl(e){let t=e.props,r=ye(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,footprint:e.isometric.footprint,form:e.isometric.form,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:le(t.fill)??"#f8fafc",strokeColor:le(t.stroke)??"#111827",strokeWidth:x(t.strokeWidth)??1,cornerRadius:x(t.cornerRadius)??(e.isometric.footprint?0:8),hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:x(t.labelOffsetX)??0,labelOffsetY:x(t.labelOffsetY)??0,labelBackground:le(t.labelBackground),parentFrameId:e.parentFrameId}}function Ql(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:x(t.weight),showWeight:t.showWeight!=="false",style:{pathType:ce(t.route,rn),color:yt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:ce(t.strokeStyle,tn),opacity:t.opacity!==void 0?x(t.opacity):void 0,fontSize:x(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:ye(t.shadow)},startMarker:ce(t.markerStart,Oo),endMarker:ce(t.markerEnd,Oo),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 Jl(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:we(e.path?.startMarker,No,"none"),endMarker:we(e.path?.endMarker,No,"none"),closed:e.path?.closed??!1,strokeColor:le(t.stroke)??"#7c3aed",strokeWidth:x(t.strokeWidth)??2,dash:_e(t.dash)??[],opacity:x(t.opacity)??1,fillColor:le(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function Xg(e){return e||"rectangle"}function ed(e,t){let r=e.props,n=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:Xg(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:se(r.fill??(n?"none":void 0)),strokeColor:yt(r.stroke??(n?"none":void 0)),isText:n||void 0,strokeWidth:x(r.strokeWidth),textColor:r.textColor,fontSize:x(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:we(r.fontWeight,kl,"normal"),letterSpacing:x(r.letterSpacing),lineHeight:x(r.lineHeight),fontFamily:r.fontFamily,textAlign:ce(r.textAlign,wl),textVerticalAlign:ce(r.verticalAlign,vl),cornerRadius:x(r.cornerRadius),shadowStyle:ye(r.shadow),dash:_e(r.dash),strokeStyle:ce(r.strokeStyle,Pl),opacity:x(r.opacity),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function td(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:x(t.strokeWidth)??2,cornerRadius:x(t.cornerRadius)??12,dash:_e(t.dash),shadowStyle:ye(t.shadow),textColor:t.textColor??"#6b7280",fontSize:x(t.fontSize)??22,fontWeight:we(t.fontWeight,en,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var Do=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function rd(e){let t=Do(e.canvasObjects),r=new Map((e.shaders??[]).map(n=>[n.name,n]));return{shapes:t.filter(n=>n.objectType==="shape").map(n=>ed(n,r)),frames:t.filter(n=>n.objectType==="frame").map(Kl),swimlanes:t.filter(n=>n.objectType==="swimlane").map(td),isometricObjects:t.filter(Jt).map(Zl),paths:t.filter(n=>n.objectType==="path").map(Jl),dimensions:t.filter(Qt).map(ql),charts:t.filter(n=>n.objectType==="chart").map(Yl),components:t.filter(n=>n.objectType==="component"&&n.component!==void 0).map(jl),links:Do(e.links).map(Ql),connections:Do(e.connections).map(Xl)}}var nn=new Set(["top","front","right"]),nd=Math.PI/6,Ee=Math.cos(nd),Ne=Math.sin(nd);function Go(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)*Ee,height:r+(t+n)*Ne}}function _o(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*Ee/2,y:e.y+(t+r)*Ne/2}}function qg(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 Fo(e,t){return qg(Oe(e)[t])}function Oe(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*Ee,y:r},s={x:n*Ee,y:n*Ne},l={x:-i*Ee,y:i*Ne},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},p={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:p.x+d.x,y:p.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,p,u],bottom:[f,y,g,b],front:[u,p,g,b],back:[a,c,y,f],right:[p,c,y,g],left:[a,u,b,f]}}function Kg(e){let t=0;for(let r=0;r<e.length;r+=1){let[n,o]=e[r],[i,a]=e[(r+1)%e.length];t+=n*a-i*o}return t/2}function on(e){let t=(e??[]).filter(n=>Array.isArray(n)&&Number.isFinite(n[0])&&Number.isFinite(n[1])),r=t.filter((n,o)=>{let i=t[(o+1)%t.length];return n[0]!==i[0]||n[1]!==i[1]});return r.length>=3?r:[]}var Zg=Math.PI/12;function od(e,t,r,n){if(!(t>0)||r<=0||n<=0)return[...e];let o=e.map(([a,s])=>({x:a*r,y:s*n})),i=[];for(let a=0;a<o.length;a+=1){let s=o[a],l=o[(a-1+o.length)%o.length],d=o[(a+1)%o.length],c={x:l.x-s.x,y:l.y-s.y},u={x:d.x-s.x,y:d.y-s.y},p=Math.hypot(c.x,c.y),f=Math.hypot(u.x,u.y),g=(c.x*u.x+c.y*u.y)/(p*f),b=Math.acos(Math.max(-1,Math.min(1,g)));if(!Number.isFinite(b)||b<.001||Math.PI-b<.001){i.push(e[a]);continue}let y=Math.min(t/Math.tan(b/2),Math.min(p,f)/2),C=y*Math.tan(b/2),w={x:c.x/p,y:c.y/p},R={x:u.x/f,y:u.y/f},$={x:s.x+w.x*y,y:s.y+w.y*y},B={x:s.x+R.x*y,y:s.y+R.y*y},N={x:w.x+R.x,y:w.y+R.y},G=Math.hypot(N.x,N.y),z=C/Math.sin(b/2),U={x:s.x+N.x/G*z,y:s.y+N.y/G*z},he=Math.atan2($.y-U.y,$.x-U.x),ee=Math.atan2(B.y-U.y,B.x-U.x)-he;ee-=2*Math.PI*Math.round(ee/(2*Math.PI));let ge=Math.max(2,Math.ceil(Math.abs(ee)/Zg));for(let Q=0;Q<=ge;Q+=1){let Ge=he+ee*Q/ge;i.push([(U.x+C*Math.cos(Ge))/r,(U.y+C*Math.sin(Ge))/n])}}return i}function Ho(e,t,r=0){let n=Math.max(0,e.width),o=Math.max(0,e.depth),i=Math.max(0,e.height),a=od(on(t),r,n,o),s=e.x+o*Ee,l=([g,b],y)=>({x:s+(g*n-b*o)*Ee,y:e.y+(g*n+b*o)*Ne+y}),d=a.map(g=>l(g,0)),c=Kg(a)>=0?1:-1,u=a.map((g,b)=>{let y=a[(b+1)%a.length],C=(y[0]-g[0])*n,w=(y[1]-g[1])*o,R=Math.hypot(C,w),$=R===0?0:w/R*c,B=R===0?0:-C/R*c;return{from:g,to:y,length:R,normalU:$,normalV:B,visible:R>0&&$+B>1e-9}}),p=(g,b)=>g.visible&&b.visible&&g.normalU*b.normalU+g.normalV*b.normalV>Math.cos(.5),f=[];return u.forEach((g,b)=>{if(!g.visible)return;let y=u[(b-1+u.length)%u.length],C=u[(b+1)%u.length],{from:w,to:R}=g;f.push({points:[l(w,0),l(R,0),l(R,i),l(w,i)],light:.72+.28*Math.max(0,Math.min(1,g.normalV/(Math.abs(g.normalU)+Math.abs(g.normalV)))),depth:(w[0]+R[0])/2+(w[1]+R[1])/2,smoothStart:p(y,g),smoothEnd:p(g,C)})}),f.sort((g,b)=>g.depth-b.depth),{top:d,sides:f}}function Qg(e){return Math.max(0,Math.min(255,Math.round(e)))}function Jg(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 eb(e,t,r){return`#${[e,t,r].map(n=>Qg(n).toString(16).padStart(2,"0")).join("")}`}function Vo(e,t){let r=Jg(e);if(!r)return e;let[n,o,i]=r;return eb(n*t,o*t,i*t)}function xt(e,t){return Vo(e,t)}function Wo(e){return{topFill:e,frontFill:Vo(e,.95),sideFill:Vo(e,.88)}}var tb=Math.PI/180;function rb(e,t){let r=t*tb,n=Math.cos(r),o=Math.sin(r);return{x:e.x*n-e.y*o,y:e.x*o+e.y*n}}function nb(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function id(e,t){let r=nb(e),n=e.rotation?rb(t,e.rotation):t;return{x:r.x+n.x,y:r.y+n.y}}function zo(e,t){return id(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function St(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Yo(e,t){let r=St(e),n=St(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 ob(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 ib(e,t){let r=e.symbol?.ports?.find(n=>n.name===t.port);return r?zo({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):St(e)}function Uo(e,t,r){let n=ab(e,t),o=sb(n.explicit);if(o)return o;let i=ad(r,n.canvasObjectId);if(!i)return{x:0,y:0};let a=lb(i,n.explicit);return a||db(i,ad(r,n.oppositeCanvasObjectId))}function ab(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function sb(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function lb(e,t){return t?.kind==="port"?ib(e,t):t?.kind==="side"?ob(e,t):null}function db(e,t){return t?Yo(e,t):St(e)}function ad(e,t){return e.find(r=>r.id===t)}var cb=15e3;function ub(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function sd(e,t){return e?Fo(e,t):{x:0,y:0}}function ld(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??cb+r}}function mb(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[nn.has(t.fromFace)?void 0:ld(e,t.fromId),nn.has(t.toFace)?void 0:ld(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 pb(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,...mb(e.isometricObjects,r)},from:sd(t.get(r.fromId??""),r.fromFace),to:sd(t.get(r.toId??""),r.toFace),kind:"connection"}))}function dd(e){let t=ub(e);return[...e.links.map(n=>({link:n,from:Uo(n,"from",t),to:Uo(n,"to",t)})),...pb(e)]}function jo(e){let t=Cl(e),r=rd(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,dimensions:r.dimensions,charts:r.charts,components:r.components,links:dd(r),diagnostics:t.diagnostics}}function q(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 Xo={minX:0,minY:0,maxX:100,maxY:100};function te(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 D(e,t,r=0){return t?gb(fb(e,t),r):te(e,r)}function fb(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 hb(e).map(s=>({x:r+(s.x-r)*i-(s.y-n)*a,y:n+(s.x-r)*a+(s.y-n)*i}))}function hb(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 gb(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 xe(e){if(e.points.length===0)return"";if(Zr(e))return bb(e);let t=e.points[0],r=[`M ${t.x} ${t.y}`];for(let{to:n,controls:o}of Qr(e))r.push(o?`C ${o[0].x} ${o[0].y} ${o[1].x} ${o[1].y} ${n.x} ${n.y}`:`L ${n.x} ${n.y}`);return e.closed&&r.push("Z"),r.join(" ")}function bb(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 m(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function cd(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 ud(e,t){return e.sourceIndex??t}function v(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 A="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var md="#94a3b8";function pd(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,60)),a=m(e.rotation,0),s=1e4+t,l=D({x:r,y:n,width:o,height:i},a,2);return[{id:`widget-${e.id}`,type:"rect",order:s,bounds:l,x:r,y:n,width:o,height:i,rx:6,rotation:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:md},strokeWidth:1,dash:[4,3]}},{id:`widget-${e.id}-label`,type:"text",order:s+.1,bounds:l,x:r,y:n,width:o,height:i,lines:[e.type],fontFamily:A,fontSize:12,fontWeight:"normal",color:md,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function fd(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,160)),i=Math.max(0,m(e.height,90)),a=m(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:D({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,value:Xt(e.value,e.digits),digits:e.digits,duration:Math.max(0,m(e.duration,420)),label:e.label,componentStyle:vo(e.style)}]}function hd(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,200)),i=Math.max(0,m(e.height,200)),a=m(e.rotation,0),s=m(e.max,100)||100,l=Math.min(1,Math.max(0,m(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:D({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(...yb(e,{x:r,y:n,width:o,height:i,rotation:a,max:s,order:1e4+t})),d}function yb(e,t){let r=e.labels??{},n=Math.max(1,m(Number(e.parameters.ticks),48)),o=Math.max(1,m(Number(e.parameters.major),5)),i=m(Number(e.parameters.start),225)*Math.PI/180,a=m(Number(e.parameters.sweep),270)*Math.PI/180,s=m(Number(e.parameters.radius),.9)+m(r.offset,.08),l=m(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(n/o),p=[];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),C=c-Math.sin(b)*s*(t.height/2),w={x:y-24,y:C-l,width:48,height:l*2};p.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:D(w,0,2),...w,lines:[String(Math.round(t.max*g*10)/10)],fontFamily:r.fontFamily||A,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return p}function gd(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,360)),a=m(e.rotation,0),s=m(e.min,0),l=m(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(m(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:D({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(...xb(e,{x:r,y:n,width:o,height:i,min:s,max:l,order:1e4+t})),c}function xb(e,t){let r=e.labels??{},n=e.parameters.axis==="horizontal",o=Math.max(1,m(Number(e.parameters.ticks),50)),i=Math.max(1,m(Number(e.parameters.major),5)),a=m(Number(e.parameters.inset),.05)>0?m(Number(e.parameters.inset),.05):.05,s=m(Number(e.parameters.line),.7)>0?m(Number(e.parameters.line),.7):.7,l=n?t.height:t.width,d=(m(Number(e.parameters.length),.1)>0?m(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-m(r.offset,.04)*l,u=m(r.size,12),p=Math.floor(o/i),f=[];for(let g=0;g<=p;g+=1){let b=g*i/o,y=a+(1-2*a)*b,C=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:D(C,0,2),...C,lines:[String(Math.round((t.min+(t.max-t.min)*b)*10)/10)],fontFamily:r.fontFamily||A,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:n?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var Sb="#94a3b8";function Fe(e,t,r){return{x:m(e.x,0),y:m(e.y,0),width:Math.max(1,m(e.width,r.width)),height:Math.max(1,m(e.height,r.height)),order:1e4+t}}var K=(e,t)=>String(e.properties[t]??""),qe=(e,t)=>Number(e.properties[t]??0),ue=e=>({kind:"solid",color:e}),Ct=(e,t)=>e.disabled?Sb:t;function ve(e,t){return e.disabled?{...t,opacity:.4}:t}function He(e,t){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:D(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}}function kt(e,t,r,n,o){return{id:`widget-${e.id}-${t}`,type:"text",order:o,bounds:D(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[n.text],fontFamily:A,fontSize:n.fontSize,fontWeight:"600",color:n.color,align:n.align,verticalAlign:"middle",lineHeight:1.3}}function bd(e,t){let r=Fe(e,t,{width:120,height:40}),n=[He(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:D(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min(qe(e,"radius"),r.height/2),style:ve(e,{fill:ue(K(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let o={text:e.label,color:Ct(e,K(e,"textColor")),fontSize:qe(e,"fontSize"),align:"center"};n.push(kt(e,"label",r,o,r.order+.2))}return n}var Cb=.22,kb=.5,Rb=[[.24,.52],[.43,.72],[.78,.3]];function wb(e){let[t,...r]=Rb.map(([n,o])=>`${e.x+n*e.width} ${e.y+o*e.width}`);return`M ${t} ${r.map(n=>`L ${n}`).join(" ")}`}function vb(e,t,r){let n=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:D(r,0,2),...r,rx:r.width*Cb,style:ve(e,{fill:n?ue(K(e,"accent")):{kind:"none"},stroke:ue(n?K(e,"accent"):K(e,"stroke")),strokeWidth:1.5})}}function Pb(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:D(r,0,0),d:wb(r),style:ve(e,{fill:{kind:"none"},stroke:ue(K(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Lb(e,t,r,n){let o=r*kb,i={x:t.x+r+o,y:t.y,width:Math.max(0,t.width-r-o),height:t.height},a={text:n,color:Ct(e,K(e,"textColor")),fontSize:qe(e,"fontSize"),align:"left"};return kt(e,"label",i,a,t.order+.3)}function yd(e,t){let r=Fe(e,t,{width:160,height:24}),n=Math.min(r.height,r.width),o={x:r.x,y:r.y+(r.height-n)/2,width:n,height:n};return[He(e,r),vb(e,r,o),...e.value===!0?[Pb(e,r,o)]:[],...e.label?[Lb(e,r,n,e.label)]:[]]}var Tb=.12;function xd(e,t){let r=Fe(e,t,{width:52,height:30}),n=e.value===!0,o=r.height*Tb,i=r.height/2-o,a=n?r.x+r.width-r.height/2:r.x+r.height/2,s={x:a-i,y:r.y+o,width:i*2,height:i*2};return[He(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:D(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:ve(e,{fill:ue(K(e,n?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:D(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:ve(e,{fill:ue(K(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function Sd(e,t){let r=Fe(e,t,{width:120,height:40}),n=e.value===!0,o=[He(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:D(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:ve(e,{fill:n?ue(K(e,"accent")):{kind:"none"},stroke:ue(n?K(e,"accent"):K(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:Ct(e,K(e,n?"onTextColor":"textColor")),fontSize:qe(e,"fontSize"),align:"center"};o.push(kt(e,"label",r,i,r.order+.2))}return o}var Ke=e=>(t,r)=>e(t,r),Mb=new Map([["rollingNumber",Ke(fd)],["tickScale",Ke(hd)],["ruler",Ke(gd)],["switch",Ke(xd)],["checkbox",Ke(yd)],["toggleButton",Ke(Sd)],["button",Ke(bd)]]);function Cd(e){return Mb.get(e)}function $b(e){let t=mt(e.type)?.role;if(!t||!Nr(e))return;let r=typeof e.value=="boolean"?e.value:void 0;return{role:t,...r===void 0?{}:t==="button"?{pressed:r}:{checked:r},...e.disabled?{disabled:!0}:{}}}function Ab(e){return e.label??(Nr(e)?e.id:String(e.value))}function qo(e){return e.flatMap((t,r)=>{let n=Cd(t.type)??pd,o=q(n(t,r),"widget",t.id,t.type,Ab(t),t.parentFrameId),i=$b(t),a=o.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),o})}function Ko(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 Zo(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 tr(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 rr(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 kd(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,p,f)=>u>0?`A ${u} ${u} 0 0 1 ${p} ${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 an(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 sn=8;function Eb(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:Zo(o,i,r,t,sn)}}case"left":{let o=e.x-t,i=e.y-n;return{x:o,y:i,width:t,height:r,path:tr(o,i,t,r,sn)}}case"right":{let o=e.x+e.width,i=e.y-n;return{x:o,y:i,width:t,height:r,path:rr(o,i,t,r,sn)}}default:{let o=e.x-n,i=e.y-t;return{x:o,y:i,width:r,height:t,path:Ko(o,i,r,t,sn)}}}}function Rd(e){let t=Math.max(32,e.fontSize+18),r=16,n=Math.max(120,e.title.length*e.fontSize*.62+r*2),o=Eb(e,t,n),i=te(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?Ob(e,o,r,i):Nb(e,o,r,i)]}function Nb(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??A,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Ob(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??A,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:o,y:i}}}var Bb={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function Ib(e,t,r){let n=e.shadow??!0,o=te({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(n?20:4)),i={...an(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=Bb[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:kd(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function wd(e,t){if(e.isVisible===!1)return[];let r=t,n=(e.showLabel??!0)&&!!e.title,o=[Ib(e,r,n)];return n&&e.title&&o.push(...Rd({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 Db(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function ln(e){if(!e?.enabled)return;let t=Db(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 Gb(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 vd(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:Gb(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function Pd(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??A,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function _b(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{...Pd(e,t,r),bounds:D({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 Fb(e,t,r){return{...Pd(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 Ld(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?_b:Fb;return e.lanes.map((r,n)=>t(e,r,n))}function Hb(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 Vb(e){let t=0;return Hb(e).map(r=>{let n={...r,offset:t};return t+=r.size,n})}function Td(e,t){return{swimlane:e,order:5e3+t,bounds:te({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:Vb(e)}}function Md(e,t){if(e.isVisible===!1)return[];let r=Td(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:{...an(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:ln(e.shadowStyle)}},...vd(r),...Ld(r)]}function $d(e){return[...e.frames.flatMap((t,r)=>q(wd(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>q(Md(t,r),"swimlane",t.id))]}var nr=(e,t,r)=>({x:e.x+t.x*r,y:e.y+t.y*r});function Qo(e){return Math.hypot(e.end.x-e.start.x,e.end.y-e.start.y)}function dn(e){return e.text!==void 0?e.text:`${Math.round(Qo(e)*10)/10}${e.unit?` ${e.unit}`:""}`}function Jo(e){let t=Qo(e),r=t===0?{x:1,y:0}:{x:(e.end.x-e.start.x)/t,y:(e.end.y-e.start.y)/t},n={x:r.y,y:-r.x},o=e.offset<0?-1:1,i=[nr(e.start,n,e.offset),nr(e.end,n,e.offset)],a=Math.abs(e.offset)<=4?[]:[e.start,e.end].map(c=>[nr(c,n,4*o),nr(c,n,e.offset+6*o)]),s=((e.fontSize??11)*.75+2)*o,l={x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2},d=Math.atan2(r.y,r.x)*180/Math.PI;return d>90?d-=180:d<=-90&&(d+=180),{length:t,line:i,extensions:a,label:{center:nr(l,n,s),angle:d}}}var Ed="#475569",Wb=.6,zb=e=>e.map(([t,r])=>`M ${t.x} ${t.y} L ${r.x} ${r.y}`).join(" ");function Ad(e,t,r,n){let o=Math.max(0,m(e.strokeWidth,1)),i=n.flat();return{type:"path",id:`dimension-${e.id}-${t}`,order:r,bounds:{minX:Math.min(...i.map(a=>a.x))-o,minY:Math.min(...i.map(a=>a.y))-o,maxX:Math.max(...i.map(a=>a.x))+o,maxY:Math.max(...i.map(a=>a.y))+o},d:zb(n),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??Ed},strokeWidth:o,lineCap:"round"}}}function Yb(e,t,r,n,o){let i=m(e.fontSize,11),a=Math.max(24,r.length*i*Wb+8),s=i*1.3;return{type:"text",id:`dimension-${e.id}-label`,order:t,bounds:{minX:n.x-a/2,minY:n.y-s/2,maxX:n.x+a/2,maxY:n.y+s/2},x:n.x-a/2,y:n.y-s/2,width:a,height:s,lines:[r],fontFamily:A,fontSize:i,fontWeight:"normal",color:e.textColor??e.strokeColor??Ed,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:o,rotationCenter:n}}function Ub(e,t){let r=Jo(e),n=31e3+t,o={...Ad(e,"line",n+.1,[r.line]),markerStart:"filled_arrow",markerEnd:"filled_arrow"},i=r.extensions.length>0?[Ad(e,"extensions",n,r.extensions)]:[],a=dn(e);return[...i,o,Yb(e,n+.2,a,r.label.center,r.label.angle)]}function Nd(e){return e.flatMap((t,r)=>q(Ub(t,r),"dimension",t.id,"dimension",dn(t),t.parentFrameId))}function ei(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Od(e,t,r){let n=ei(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 jb(e,t,r,n){let o=Math.max(0,Math.min(n,ei(t,e)/2,ei(t,r)/2));return{vertex:t,start:Od(t,e,o),end:Od(t,r,o)}}function Ze(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)=>jb(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(" ")}var Xb={prop:"style.fill",propKind:"color",propSolidOnly:!0};function Rt(e,t){let r=Math.max(0,m(e.strokeWidth,1)),n=m(e.rotation,0),o=Go(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:D(o,n,r+2),rotation:n,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function or(e,t,r,n,o){return{...e.common,id:`isometric-${e.object.id}-${t}`,order:e.order+r,d:Ze([...n],0),style:o,...Xb}}function ti(e){let t=Oe(e);return[t.top[0],t.top[1],t.right[2],t.front[2],t.front[3],t.top[3]]}function ri(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:m(n.labelOffsetX,0),labelOffsetY:m(n.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}function cn(e){return{...ri(e,Ze(ti(e.object),0),0),style:{...e.common.style,fill:{kind:"none"},stroke:{kind:"none"}}}}var ni=20,qb=12,Kb=6,un=3,Zb=6.5;function Qb(e){let{object:t}=e,r=_o(t),n=r.y-qb+m(t.labelOffsetY,0);return{anchor:r,centerX:r.x+m(t.labelOffsetX,0),topY:n-ni,bottomY:n}}function Jb(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:ni,lines:[r],fontFamily:A,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function ey(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 ty(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*Zb+Kb*2);return{type:"rect",id:`isometric-${o.id}-label-background`,order:i+.28,x:s-c/2,y:l-un,width:c,height:ni+un*2,rx:4,bounds:{minX:s-c/2,minY:l-un,maxX:s+c/2,maxY:d+un},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:n},stroke:{kind:"none"}}}}function wt(e,t){let r=Qb(e),n=Jb(e,r,t),o=ey(e,r),i=e.object.labelBackground;return i?[o,ty(e,r,t,i),n]:[o,n]}function mn(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+m(r.shadowStyle?.distance,0),d=t.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,p=d.map(b=>({x:c.x+(b.x-c.x)*u,y:c.y+(b.y-c.y)*u})),f=p.map(b=>b.x),g=p.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:Ze(p,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:m(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function Bd(e,t){let{object:r,index:n,box:o}=e;if(!r.hasShadow)return;let i=Math.max(0,r.width),a=Math.max(0,r.depth),s={x:o.x+o.width/2,y:r.y+Math.max(0,r.height)+(i+a)*Ne/2};return{type:"ellipse",id:`isometric-${r.id}-ground-shadow`,order:14e3+n,bounds:{minX:s.x-t*1.1,minY:s.y-t*.6,maxX:s.x+t*1.1,maxY:s.y+t*.6},cx:s.x,cy:s.y,rx:t*1.05,ry:t*.52,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:r.shadowStyle?.opacity??.2,blur:m(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function ry(e,t,r){let{object:n,common:o}=e,i={...o.style,stroke:{kind:"none"}},a=Wo(n.fill??"#f8fafc"),s=(l,d,c,u)=>or(e,l,d,c,{...i,fill:{kind:"solid",color:u},clip:r});return[s("top",0,t.top,a.topFill),s("front",.1,t.front,a.frontFill),s("side",.2,t.right,a.sideFill)]}function ny(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 Id(e,t){let r=Rt(e,t),n=Oe(e),o=Math.max(0,m(e.cornerRadius,8)),i=Ze(ti(e),o),a={type:"path",d:i},s=mn(r,n.top),l=ny(r,n,a),d=ri(r,i,o),c=ry(r,n,a),u=s?[d,...c,s,l]:[d,...c,l];return e.text?[...u,...wt(r,e.text)]:u}function oy(e,t,r,n){let o=xt(n,t.light);return or(e,`side-${r}`,.05+r*.001,t.points,{...e.common.style,stroke:{kind:"solid",color:o},strokeWidth:.6,fill:{kind:"solid",color:o}})}function iy(e,t,r){let[n,o,i,a]=t.points,s=[`M ${a.x} ${a.y} L ${i.x} ${i.y}`,...t.smoothStart?[]:[`M ${n.x} ${n.y} L ${a.x} ${a.y}`],...t.smoothEnd?[]:[`M ${o.x} ${o.y} L ${i.x} ${i.y}`]];return{...e.common,id:`isometric-${e.object.id}-side-${r}-edges`,order:e.order+.0505+r*.001,d:s.join(" "),style:{...e.common.style,fill:{kind:"none"}}}}function Dd(e,t,r){let n=Rt(e,t),{top:o,sides:i}=Ho(e,r,Math.max(0,m(e.cornerRadius,0))),a=e.fill??"#f8fafc",s=mn(n,o),l=or(n,"top",.2,o,{...n.common.style,fill:{kind:"solid",color:a}}),d=[cn(n),...s?[s]:[],...i.flatMap((c,u)=>[oy(n,c,u,a),iy(n,c,u)]),l];return e.text?[...d,...wt(n,e.text)]:d}function Gd(e,t){let r=Rt(e,t),{order:n,common:o,box:i}=r,a=Math.max(0,Math.min(e.width,e.height,e.depth))/2,s=i.x+i.width/2,l=i.y+i.height/2,d=e.fill??"#f8fafc",c={minX:s-a,minY:l-a,maxX:s+a,maxY:l+a},u={type:"ellipse",id:`isometric-${e.id}-sphere`,order:n+.1,bounds:c,cx:s,cy:l,rx:a,ry:a,style:{...o.style,fill:{kind:"linear-gradient",angle:135,stops:[{offset:0,color:xt(d,1.22)},{offset:.5,color:d},{offset:1,color:xt(d,.82)}]}},prop:"style.fill",propKind:"color",propSolidOnly:!0},p={type:"ellipse",id:`isometric-${e.id}-highlight`,order:n+.2,bounds:c,cx:s-a*.32,cy:l-a*.38,rx:a*.26,ry:a*.18,rotation:-35,style:{fill:{kind:"solid",color:"#ffffff"},stroke:{kind:"none"},opacity:.45,blur:a*.1,pointerEvents:"none"}},f=Bd(r,a),g=[cn(r),...f?[f]:[],u,p];return e.text?[...g,...wt(r,e.text)]:g}function ay(e,t){if(e.form==="sphere")return Gd(e,t);let r=on(e.footprint);return r.length>0?Dd(e,t,r):Id(e,t)}function _d(e){return e.flatMap((t,r)=>q(ay(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function sy(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 Fd(e,t,r){let n=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!n)return[];let o=m(e.link.style?.fontSize,10),i=sy(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??A,fontSize:o,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function Hd(e){return[...Fd(e,"start",0),...Fd(e,"end",1)]}function Vd(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??A,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var oi=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}},Wd=(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 ly(e,t,r){let n=oi(e),o=oi(t),i=n.a??1,a=o.a??1;return Wd(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 ir(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 ly(a.color,s.color,d)}}return o.color}function zd(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 Yd=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function Pe(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 pn(e,t,r,n){if(Be(e,r,n)<=t)return e;let o=e.length;for(;o>1&&Be(`${e.slice(0,o)}\u2026`,r,n)>t;)o-=1;return`${e.slice(0,o)}\u2026`}function Be(e,t,r){return e.length*t*(r?.64:.58)}function Ud(e){return{measure:(t,r)=>Be(t,e,r),spaceWidth:e*.58}}var Qe=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function ii(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 ai(e,t,r,n,o){let i=Qe(e,t,o),a=Qe(t,r,o),s=Qe(r,n,o),l=Qe(i,a,o),d=Qe(a,s,o),c=Qe(l,d,o);return{left:[e,i,l,c],right:[c,d,s,n]}}function fn(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:Qe(i,a,l),segmentIndex:o}}n+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function hn(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 jd(e,t,r,n,o=40){let i=0,a=e;for(let s=1;s<=o;s++){let l=ii(e,t,r,n,s/o);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var vt=40;function dy(e){let t=[0],r=e[0];for(let n=1;n<=vt;n++){let o=ii(...e,n/vt);t.push(t[n-1]+Math.hypot(o.x-r.x,o.y-r.y)),r=o}return t}function Xd(e,t){let r=e[vt];if(t<=0)return 0;if(t>=r)return 1;for(let n=1;n<=vt;n++)if(e[n]>=t){let o=(t-e[n-1])/(e[n]-e[n-1]||1);return(n-1+o)/vt}return 1}function cy(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 qd(e,t){if(e.length<8)return null;let r=uy(e),n=dy(r),o=n[vt];if(o===0)return null;let i=o/2,a=Math.max(0,i-t.minimumVisibleStub),s=cy(r,t,a),l=Xd(n,i-s),d=Xd(n,i+s);return{before:my(r,l),after:py(r,d),bezier:!0}}function uy(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 my(e,t){return t<=.01?null:ai(...e,t).left.flatMap(r=>[r.x,r.y])}function py(e,t){return t>=.99?null:ai(...e,t).right.flatMap(r=>[r.x,r.y])}function Kd(e,t){if(e.length<4)return null;let r=hn(e);if(r===0)return null;let n=fy(e,r,t);return{before:gy(e,n.beforeLength),after:by(e,n.afterLength,r),bezier:!1}}function fy(e,t,r){let n=t/2,o=fn(e,n),i={x:e[o.segmentIndex],y:e[o.segmentIndex+1]},a={x:e[o.segmentIndex+2],y:e[o.segmentIndex+3]},s=hy(i,a,r,n);return{beforeLength:n-s,afterLength:n+s}}function hy(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 gy(e,t){if(t<=.5)return null;let r=fn(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function by(e,t,r){if(t>=r-.5)return null;let n=fn(e,t);return[n.point.x,n.point.y,...e.slice(n.segmentIndex+2)]}var Zd=3,yy=10;function xy(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 si(e,t){return t?jd(...xy(e)):hn(e)}function Qd(e,t,r,n){let o={halfWidth:(r+Zd)/2,halfHeight:(n+Zd)/2,minimumVisibleStub:yy};return t==="curved"?qd(e,o):Kd(e,o)}function li(e,t,r,n){let o=Qd(e,t,r,n);if(!o||!o.before&&!o.after)return null;let i=si(e,o.bezier),a=o.before?si(o.before,o.bezier):0,s=o.after?si(o.after,o.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Sy(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 Cy(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 di(e,t,r,n){if(t==="curved")return Sy(e);let o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};return t==="orthogonal"?Cy(e,o):o}function Pt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function ky(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]),p=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,p*s))),y=Math.max(i,Math.min(a,Math.max(u,f*s)));return g&&(b=Math.min(a,b+p*.75),y=Math.min(a,y+f*.75)),{fromDistance:b,toDistance:y}}function Jd(e,t,r,n,o){let i=Pt(r),a=Pt(n),{fromDistance:s,toDistance:l}=ky(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 ec(e,t,r,n){let{p0:o,p1:i,p2:a,p3:s}=Jd(e,t,r,n,{min:35,max:90,perpendicularScale:.5});return{points:[...o,...i,...a,...s],segments:[]}}function rc(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 nc(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 oc(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 ic(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=tc(t.side),c=tc(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 tc(e){return e==="left"||e==="right"}function ac(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 sc(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 lc(e,t,r){let n=e?["left","right"]:["top","bottom"];return[!n.includes(t),!n.includes(r)]}function dc(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,p=r?.[2]||0,f=n[1]&&r?.[3]||0;if(l){let C=d[1]+u,w=t[0]+p,R=c[1]+f;return[o.x,o.y,d[0],C,w,C,w,R,c[0],R,i.x,i.y]}let g=d[0]+u,b=t[1]+p,y=c[0]+f;return[o.x,o.y,g,d[1],g,b,y,b,y,c[1],i.x,i.y]}function cc(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,p=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&&p&&f}})}function gn(e,t){if(e.length<6)return e;let r=Py(e),n=[r[0]];for(let o=1;o<r.length-1;o++){let i=Ry(r[o-1],r[o],r[o+1],t);n.push(...i?vy(i):[r[o]])}return n.push(r[r.length-1]),n.flatMap(o=>[o.x,o.y])}function Ry(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,uc(o)*.4,uc(i)*.4);if(d<=0)return null;let c=mc(o),u=mc(i),p=ci(t,c,-d),f=ci(t,u,d),g=ci(p,u,d),b=Math.atan2(p.y-g.y,p.x-g.x),y=Math.atan2(f.y-g.y,f.x-g.x);return{entry:p,exit:f,center:g,radius:d,startAngle:b,angleSweep:wy(y-b)}}function ci(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function uc(e){return Math.abs(e.x)+Math.abs(e.y)}function mc(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function wy(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function vy(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 Py(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function ui(e){let t=Ly(e),r=ic(t),n=sc(t,r),o=ac(n),i=lc(t.horizontalFirst,e.fromSide,e.toSide),a=dc(t,r,e.segmentOffsets,i),s=cc(a,o,i[0],i[1]);return{points:gn(a,10),segments:s}}function Ly(e){let[t,r]=rc(e.from,e.to,e.fromSide,e.toSide),n=Pt(e.fromSide),o=Pt(e.toSide),i=nc(t,r,e.endpointEdges),[a,s]=oc(t,r,n,o,i);return{from:t,to:r,fromConnection:pc(t,e.fromSide,n,a),toConnection:pc(r,e.toSide,o,s),horizontalFirst:i}}function pc(e,t,r,n){return{side:t,normal:r,stub:[e.x+r[0]*n,e.y+r[1]*n]}}var fc=.5;function hc(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:gn(o,10),segments:i}}function mi(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<=fc||n<=fc})}function gc(e,t,r,n,o){if(e.waypoints&&e.waypoints.length>0){let l=hc(t,e.waypoints,r);if(mi(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=ui(a);return mi(s.segments)?s:ui({...a,segmentOffsets:void 0})}function bc(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 yc(e,t,r){let n=e.fromPoint?.kind==="side"?e.fromPoint.side:bc(t,r),o=e.toPoint?.kind==="side"?e.toPoint.side:bc(r,t);return{fromSide:n,toSide:o}}function xc(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function Sc(e,t,r,n){let{fromSide:o,toSide:i}=yc(e,t,r);return n==="curved"?ec(t,r,o,i):n==="orthogonal"?gc(e,t,r,o,i):xc(t,r)}function Ty(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 My(e,t){let r=!!(e.showText&&e.text),n=m(e.style?.fontSize,10),o=Math.min(250,Math.max(n*2,(e.text?.length??0)*n*.65+10)),i=t?.(e.style?.fontFamily??A,n),a=r?Pe(e.text??"",o,n,i):[];return{visible:r,fontSize:n,width:o,height:a.length*n*1.4,lines:a}}function $y(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:m(o.style?.opacity,1),shadow:ln(o.style?.shadow)}}function Cc(e,t,r){let{link:n,from:o,to:i}=e,a=n.style?.pathType??"orthogonal",{points:s,segments:l}=Sc(n,o,i,a),d=m(n.style?.strokeWidth,2),c=zd(n.style?.color)||"#64748b",u=My(n,r),p=Yd(d,n.style?.strokeStyle??"solid"),f=u.visible&&!p?li(s,a,u.width,u.height):null,g=f?[f.dashBefore,f.gapLength,1e6]:p;return{link:n,pathType:a,points:s,segments:l,midpoint:di(s,a,o,i),strokeWidth:d,bounds:Ty(s,d+14),color:c,order:2e4+t,style:$y(e,d,c,g),label:u,hasLabelGap:!!f}}function pi(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 kc(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),p=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||p===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,p*.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)/p*f,y:d.y+(c.y-d.y)/p*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 Ay(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 Ey(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?kc(r,Math.max(16,n*4)):Ay(e)}var Lt=e=>Math.round(e*100)/100;function Ny(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:Lt(r.start.x),ay:Lt(r.start.y),bx:Lt(r.end.x),by:Lt(r.end.y),ox:Lt(r.originalMidpoint.x),oy:Lt(r.originalMidpoint.y),movable:r.canMove}))}function Rc(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:Ey(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:pi(t,"start"),markerEnd:pi(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:Ny(e.pathType,e.segments)}}}function wc(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 Oy(e,t,r){if(e.link.isVisible===!1)return[];let n=Cc(e,t,r);return[Rc(n),...Vd(n),...wc(n),...Hd(n)]}function vc(e,t){return e.flatMap((r,n)=>q(Oy(r,n,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function By(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=m(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=m(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:o,d:xe({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:m(e.opacity,1)}}]}function Pc(e){return e.flatMap((t,r)=>q(By(t,r),"path",t.id,"path","Path"))}function ar(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Iy=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],bn=Math.PI/2,Dy=4*bn,Lc=Math.PI/2,Gy=1e-9;function fi([e,t,r],n){return[e+r*Math.cos(n),t+r*Math.sin(n)]}function Tc([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function Mc(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=p=>Math.hypot(p[0]-r[0],p[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function _y(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?Lc:Tc(r,Mc(e[n-1],r,t)),a=n===e.length-1?Lc:Tc(r,Mc(r,e[n+1],t));for(;a<=o;)a+=Dy;return{lobe:r,from:o,to:a}})}function Fy(e,t){let r=[];for(let n=Math.floor(e/bn)+1;n*bn<t-Gy;n++)r.push(n*bn);return[...r,t]}function Hy({lobe:e,from:t,to:r}){let n=fi(e,t),o=[],i=t;for(let a of Fy(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=fi(e,i),d=fi(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 Vy(){let e=_y(Iy).map(Hy),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 $c=Vy();function Ac(e,t,r,n){let o=([a,s])=>`${e+a*r} ${t+s*n}`,i=$c.curves.map(([a,s,l])=>`C ${o(a)} ${o(s)} ${o(l)}`);return`M ${o($c.start)} ${i.join(" ")} Z`}function Ec(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`,p=`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} ${p}`}function Nc(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 Oc(e,t,r,n){let{body:o,centerX:i,bottom:a}=Nc(e,t,r,n);return{x:i-o,y:a-o,width:o*2,height:o}}function Bc(e,t,r,n){let{head:o,body:i,centerX:a,headCenterY:s,bottom:l}=Nc(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 Wy=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,n)=>t+(n%2?` ${r}`:` L ${r}`),"")} Z`,zy=.1,Yy=Math.PI/6,Uy=.25,jy=.15;function Ic(e,t){return Math.min(e,t)/2}function Dc(e,t,r,n,o){let i=(...a)=>Wy(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*zy,s=r+o-a,l=n/4,d=a*Yy;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)*Uy;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 Ac(t,r,n,o);case"cylinder":return Ec(t,r,n,o);case"person":return Bc(t,r,n,o);case"predefined_process":{let a=Math.min(n,o)*jy;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 me(e){let t=Dc(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...ar(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function Gc(e){return me(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function Tt(e){let t=e.shape.shapeType==="pill"?Ic(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?m(e.shape.cornerRadius,8):0;return[{...ar(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function hi(e){return[{...ar(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function _c(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return Tt(e);let t=m(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[{...ar(e),type:"path",d:xe({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 Xy={cloud:me,cylinder:me,diamond:me,document:me,hexagon:me,note:me,oval:hi,circle:hi,parallelogram:me,person:Gc,pill:Tt,predefined_process:me,rectangle:Tt,rounded_rectangle:Tt,symbol:_c,trapezoid:me,triangle:me};function sr(e){return(Xy[e.shape.shapeType]??Tt)(e)}var qy={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},Z={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},Fc={rectangle:Z,rounded_rectangle:{...Z,cornerRadius:8},triangle:{...Z,rotation:0},diamond:{...Z,rotation:0},hexagon:{...Z,rotation:0},oval:{...Z,rotation:0},circle:{...Z,rotation:0},document:{...Z,rotation:0},parallelogram:{...Z,rotation:0},trapezoid:{...Z,rotation:0},cylinder:{...Z,rotation:0},note:{...Z,rotation:0},cloud:{...Z,rotation:0},predefined_process:{...Z,rotation:0},pill:Z,person:{...Z,rotation:0},symbol:{...Z,rotation:0}};function gi(e,t){let r=Fc[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${qy[e.shapeType]??""}, falling back to rectangle defaults.`}),Fc.rectangle)}function Ky(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function Hc(e,t){let r=gi(e,t),n=m(e.strokeWidth,r.strokeWidth),o=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=m(o?.angle,45)*Math.PI/180;return{fill:v(e.fillColor,t,e.id),stroke:v(e.strokeColor,t,e.id),strokeWidth:n,dash:Ky(e,n),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:m(e.opacity,r.opacity),shadow:o?.enabled?{color:o.color??"#000000",opacity:m(o.opacity,.25),blur:m(o.blur,10),dx:Math.cos(i)*m(o.distance,5),dy:Math.sin(i)*m(o.distance,5)}:void 0}}var bi=/\*\*([^*]+)\*\*/g;function Vc(e){return/\*\*[^*]+\*\*/.test(e)}function Zy(e){let t=[],r=0;bi.lastIndex=0;let n;for(;n=bi.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=bi.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function Qy(e){return e.split(`
|
|
13
|
+
`).map(Zy)}function Jy(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 ex(e,t,r,n){let o=Jy(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 Wc(e,t,r,n){return Qy(e).flatMap(o=>ex(o,Math.max(1,t),r,n))}function zc(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 p=m(n.fontSize,gi(n,[]).fontSize),f=n.isText?0:Math.max(8,t*2),g=n.shapeType==="person"?Oc(l,d,c,u):{x:l,y:d,width:c,height:u},b=Math.max(0,g.width-f*2),y=n.fontFamily||A,C=r?.(y,p),w={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:Pe(n.text,b,p,C),fontFamily:y,fontSize:p,fontWeight:n.fontWeight??"normal",letterSpacing:n.letterSpacing,color:n.textColor||"#111827",align:n.textAlign??"center",verticalAlign:n.textVerticalAlign??"middle",lineHeight:m(n.lineHeight,1.3),rotation:a,rotationCenter:s};if(Vc(n.text)){let{measure:R,spaceWidth:$}=C??Ud(p);w.richLines=Wc(n.text,b,R,$)}return w}function tx(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=sr({...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(...sr({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...sr({...a,id:`${e.id}-inner`,style:o})),i}function rx(e,t,r){let n=m(e.x,0),o=m(e.y,0),i=Math.max(0,m(e.width,100)),a=Math.max(0,m(e.height,100)),s=m(e.rotation,0),l=m(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:D({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:Hc(e,r),x:n,y:o,width:i,height:a}}}function nx(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 ox(e,t,r,n){if(e.isVisible===!1)return[];let{context:o,strokeWidth:i}=rx(e,t,r),a=e.strokeStyle==="double"?tx(o,i||1):sr(o),s=nx(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=zc(o,i,n);return l&&a.push(l),a}function Yc(e,t,r){return e.flatMap((n,o)=>q(ox(n,o,t,r),"shape",n.id,n.shapeType,n.text||n.shapeType,n.parentFrameId??void 0))}var M=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],Y="#94a3b8",lr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],yi=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function H(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 dr(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 cr(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??Y}));return o.length?ir(o,e):Y}function pe(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var fe={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function xi(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function Si(e,t,r){let n=r?fe.padX:0,o=r?fe.padY:0,i=t*fe.lineHeight;return{width:e.length*t*fe.charWidth+n*2,height:i+o*2,lineHeight:i,padX:n,padY:o}}function Ci(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 yn(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 Le(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 Je(e,t,r,n,o,i){return i?Le(e,t,r,n,o):yn(e,t,r,n,o)}function ki(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 Ri(e){if(!e?.length)return null;let t=[...e].sort((r,n)=>r-n);return{min:t[0],q1:ki(t,.25),median:ki(t,.5),q3:ki(t,.75),max:t[t.length-1]}}function ur(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 wi(e,t){let r=ur(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 vi(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 Sn(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 Pi(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 Uc(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 ix(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}var xn=.35,jc=.08,Xc=.22,qc=.78,Kc=.92,ax=3;function re(e){let t=ur(e);if(!t)return"#0f172a";let[r,n,o]=t,i=(.299*r+.587*n+.114*o)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Sn(r,n,o);if(s===0)return i;let d=l>.5?Math.max(jc,Math.min(l-xn,Xc)):Math.min(Kc,Math.max(l+xn,qc)),c=Pi(a,s,d);return ix(Uc(r,n,o),Uc(...c))>=ax?vi(...c):i}function Mt(e,t){let r=ur(e);if(!r)return t;let[n,o,i]=r,[a,s,l]=Sn(n,o,i);if(s===0)return t;let d=l>.5?Math.max(jc,Math.min(l-xn,Xc)):Math.min(Kc,Math.max(l+xn,qc));return vi(...Pi(a,s,d))}function Cn(e){let t=ur(e);return t?Sn(...t)[2]>.5:!1}function Ve(e,t){let r=ur(e);if(!r)return;let[n,o]=Sn(...r);if(o!==0)return vi(...Pi(n,o,t))}function O(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function mr(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function pr(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:sx(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 sx(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 Se(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var Rn=18,kn=e=>e.config;function ne(e){return e.chartType==="bar"&&kn(e)?.orientation==="horizontal"}function $t(e,t){let r=pe({series:e.series,config:kn(e)}),n=t.height/r,o=Math.min(Math.max(0,m(kn(e)?.barGroupGap,8)),Math.max(0,n-1)),i=e.categoryAlign==="left"?Rn:0,a=Math.max(1,n-o-i),s=m(kn(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 At(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function Et(e,t){return t>0?xe({points:e,tension:t,closed:!1}):`M ${e.map((n,o)=>`${o?"L":""} ${n.x} ${n.y}`).join(" ")}`}function wn(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 j(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function fr(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 Ot(e,t){return Math.abs(t-e)>Math.PI?1:0}function et(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function Zc(e,t){return{start:e.start+t,end:e.end-t}}function tt(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 lx(e,t,r){let n=j(e,t.start,e.outerRadius),o=j(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Ot(t.start,t.end)} 1 ${o.x} ${o.y}`,"Z"].join(" ")}function dx(e,t,r,n){let o=j(e,r.start,e.outerRadius),i=j(e,r.end,e.outerRadius),a=j(e,n.end,t),s=j(e,n.start,t);return[`M ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Ot(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${Ot(n.start,n.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Qc=.82;function Nt(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:j(e,s,t),angle:s}}function hr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Qc),i=e*o/(1+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 gr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Qc),i=e*o/(1+o),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function cx(e,t,r,n){let{outerRadius:o}=e,i=o-r,a=Nt(e,o,i,t.start,r,1),s=Nt(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 ${Ot(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 ux(e,t,r,n,o){let{outerRadius:i}=e,a=i-o,s=Nt(e,i,a,r.start,o,1),l=Nt(e,i,a,r.end,o,-1),d=t+o,c=Nt(e,t,d,n.start,o,1),u=Nt(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 ${Ot(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 ${Ot(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 Bt(e,t,r){let n=Math.max(0,r)/2,o=tt(n,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=o}function rt(e,t,r=0,n=0){let o=Math.max(0,n)/2,i=Zc(t,et(o,e.outerRadius));if(!Bt(e,t,n)){let s=tt(o,t.end-t.start,e.outerRadius),l=j(e,(t.start+t.end)/2,s);return r>0?cx(e,i,r,l):lx(e,i,l)}let a=Zc(t,et(o,e.innerRadius));return r>0?ux(e,e.innerRadius,i,a,r):dx(e,e.innerRadius,i,a)}function Ie(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,p=[];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);p.push(s?Le(e.x+b,e.y,g,e.height,o):Le(e.x,e.y+e.height-b-g,e.width,g,o))}return p.join(" ")}function I(e){if(!e?.enabled)return;let t=m(e.angle,45)*Math.PI/180,r=m(e.distance,5);return{color:e.color??"#000000",opacity:m(e.opacity,.25),blur:m(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function br(e,t,r,n,o){let i=e.series[n].values[r]??0;return t==="waterfall"?mx(e,r,n,o,i):t==="percent"?px(e,r,n,o,i):fx(e,r,n,o,i)}function mx(e,t,r,n,o){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return Jc(o,i,i+o,e,n)}function px(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 fx(e,t,r,n,o){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return Jc(o,i,i+o,e,n)}function Jc(e,t,r,n,o){return{value:e,pixelStart:T(t,n.axisY,o),pixelEnd:T(r,n.axisY,o)}}function P(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??A,fontSize:Math.max(9,m(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 hx=/^[A-Za-z_][A-Za-z0-9_]*$/;function It(e,t,r){return hx.test(t)?`${e}[${t}].${r}`:void 0}var eu="text";function Li(e){return`Axis[${e}].label`}function vn(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Te(e){return It("Series",e,"label")}function tu(e){return It("Series",e,"color")}function oe(e,t){return Number.isInteger(t)&&t>=0?It("Series",e,`values[${t}]`):void 0}function Dt(e,t){return Number.isInteger(t)&&t>=0?It("Series",e,`colors[${t}]`):void 0}function ru(e){return It("Rule",e,"text")}function nu(e){return It("Rule",e,"at")}function gx(e,t,r){return e.axisX.label?{...P({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:Li("x")}:null}function bx(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...P({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:Li("y")}}function ou(e,t,r){let n=[],o=gx(e,t,r);o&&n.push(o);let i=bx(e,t,r+n.length);return i&&n.push(i),n}function iu(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{...P({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:Te(i.id)}})}var yx=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function au(e){return xx(e.chart)?wx(e).flatMap(t=>vx(e,t)):[]}function xx(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!yx.has(e.chartType)&&!t}function Ti(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var Mi=22,Pn=16;function $i(e){return e==="bottomLeft"||e==="bottomRight"}function Ai(e){return Ti(e).map(t=>Math.max(42,t.label.length*m(e.fontSize,12)*.58+22))}function su(e){let t=Ai(e);return t.length?Math.max(...t):0}function Sx(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Cx(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function kx(e){let{chart:t,plot:r,order:n}=e,o=Ti(t),i=Ai(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-Pn-a:r.x+r.width+Pn,l=r.y+r.height-15;return o.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(o.length-1-c)*Mi,width:i[c],order:n+(o.length-1-c)*2}))}function Rx(e){let{chart:t,plot:r,order:n}=e,o=Ti(t),i=Ai(t),a=i.reduce((d,c)=>d+c,0),s=Cx(t,r),l=Sx(t,r,a);return o.map((d,c)=>{let u=i[c],p=l;return l+=u,{series:d,seriesIndex:c,x:p,y:s,width:u,order:n+(o.length-1-c)*2}})}function wx(e){return $i(e.chart.legendPosition)?kx(e):Rx(e)}function vx(e,t){return[Px(e,t),Lx(e,t)]}function Px(e,t){let{chart:r,bounds:n,diagnostics:o}=e,i=M[t.seriesIndex%M.length],a=r.chartType==="line",s=a?O(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:tu(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:v(s,o,r.id)}}}function Lx(e,t){let{chart:r,bounds:n}=e;return{...P({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:Te(t.series.id)}}var du=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),Tx=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function nt(e){return!Tx.has(e.chartType)}function We(e){return nt(e)?Math.max(0,m(e.tickLength,0)):0}function Mx(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function $x(e){let t=m(e.fontSize,12);return Math.max(0,...e.series.map(n=>(n.label||n.id).length))*t*.58+16}var lu=66;function Ax(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Ex(e){let t=m(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(n=>n.length))*t*.58+16}function Nx(e){return Mx(e)?$x(e):ne(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Ex(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function cu(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&&$i(n),s=a?su(e)+Pn:0,l=Ax(e,r),d=We(e),c=d+(t?Nx(e):12)+(n==="bottomLeft"?s:0)+(l==="left"?lu:0),u=24+(n==="bottomRight"?s:0)+(l==="right"?lu:0),p=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",f=ne(e)&&e.showValueAxis!==!1,g=t?ne(e)?f?34:12:(e.axisX.label?52:34)+(p?18:0):12,b=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,y=i&&!o&&!a,C=d+g+(b?44:0)+(y?16+Mi:0),R=(e.title?Math.max(44,20+m(e.titleSize,14)*1.6):0)||(o&&i?44:24);return{bounds:te({x:e.x,y:e.y,width:e.width,height:e.height},m(e.strokeWidth,1)+2),plot:{x:e.x+c,y:e.y+R,width:Math.max(1,e.width-c-u),height:Math.max(1,e.height-R-C)},showLabels:t,showLegend:r,padLeft:c}}function Ox(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,n)=>String(n+1))}function uu(e,t,r){let n=pe(e),o=t.plot.width/n,i=Ox(e,n),a=!!e.config?.categories?.length,s=e.categoryAlign==="left",l=s?Math.min(Math.max(0,m(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{...P({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+We(e),width:s?o-l:o,height:18},text:i[c]??String(c+1),chart:e,align:s?"left":"center"}),prop:a?vn(c):void 0}})}function mu(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{...P({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+We(e),width:o,height:18},text:i.label||i.id,chart:e,align:"center"}),prop:Te(i.id)}})}function pu(e,t,r){return H(e.axisX).map((n,o)=>{let i=t.plot.x+T(n,e.axisX,t.plot.width);return P({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+We(e),width:40,height:18},text:String(n),chart:e,align:"center"})})}function fu(e,t,r){return H(e.axisY).map((n,o)=>{let i=t.plot.y+t.plot.height-T(n,e.axisY,t.plot.height);return P({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-We(e),height:18},text:String(n),chart:e,align:"right"})})}function Ei(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Bx(e,t,r){return e.chartType==="bar"?uu(e,t,r):e.chartType==="boxplot"&&!Ei(e)?mu(e,t,r):pu(e,t,r)}function Ix(e,t,r){return Ei(e)?iu(e,t,r):e.showValueAxis===!1?[]:fu(e,t,r)}function Dx(e,t){let{plot:r}=t;if(e.chartType==="bar"){let n=pe(e);return Array.from({length:n},(o,i)=>r.x+(i+.5)*r.width/n)}return H(e.axisX).map(n=>r.x+T(n,e.axisX,r.width))}function Gx(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function _x(e,t,r){let n=m(e.axisLineWidth,0),o=m(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",...Gx(e,n>0?n:1)},d=[],c=(u,p)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:p,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&&ne(e)){H(e.axisY).forEach(p=>{let f=i.x+T(p,e.axisY,i.width);c(`tick-v-${p}`,`M ${f} ${s} L ${f} ${s+o}`)});let u=$t(e,i);for(let p=0;p<u.count;p++){let f=At(u,i,p)+u.labelRow+u.barsHeight/2;c(`tick-c-${p}`,`M ${i.x-o} ${f} L ${i.x} ${f}`)}}return o>0&&!Ei(e)&&!ne(e)&&(H(e.axisY).forEach(u=>{let p=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-o} ${p} L ${i.x} ${p}`)}),Dx(e,t).forEach((u,p)=>{c(`tick-x-${p}`,`M ${u} ${s} L ${u} ${s+o}`)})),d}function Fx(e,t){let r=e.config?.categories;return Array.from({length:t},(n,o)=>r?.[o]??String(o+1))}function Hx(e,t,r){let{plot:n,bounds:o}=t,i=$t(e,n),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=Fx(e,i.count).map((c,u)=>{let p=At(i,n,u);return{...P({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:o,frame:a?{x:n.x,y:p,width:n.width,height:i.labelRow}:s?{x:n.x+14,y:p+i.barsHeight/2-9,width:n.width-28,height:18}:{x:e.x+8,y:p+i.barsHeight/2-9,width:n.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?vn(u):void 0}});return e.showValueAxis!==!1&&H(e.axisY).forEach((c,u)=>{let p=n.x+T(c,e.axisY,n.width);d.push(P({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:o,frame:{x:p-20,y:n.y+n.height+4+m(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function hu(e,t,r){if(!nt(e))return[];let n=_x(e,t,r);if(!t.showLabels)return n;if(r+=n.length,ne(e))return[...n,...Hx(e,t,r)];let o=Bx(e,t,r),i=Ix(e,t,r+o.length),a=ou(e,t,r+o.length+i.length);return[...n,...o,...i,...a]}function gu(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 Ni=32;function yr(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function bu(e,t,r,n){let o=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(Ni,Math.round(Math.sqrt(Ni*Ni*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?gu(e,u,d,n):0}}return{grid:s,cols:i,rows:a}}var yu=new Set(["scatter","custom","hexbin"]);var xu=-Math.PI/2,Vx=.5,Wx=6;function zx(e){return Math.max(38,e*3.2)}function Ln(e,t,r,n=!0){let o=n?zx(r):Wx;return Math.max(8,Math.min(e,t)/2-o)}function Tn(e,t){return Math.max(3,e||t)}function Yx(e,t){return xu+t*Math.PI*2/e}function Oi(e,t,r){let n=t===e?0:(r-e)/(t-e);return xu+n*Math.PI*2}function Su(e,t,r){let n=Yx(e.count,t);return{x:e.centerX+Math.cos(n)*r,y:e.centerY+Math.sin(n)*r}}function Cu(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 Mn(e,t,r=Vx){return e.length===0?"":t?xe({points:e,tension:r,closed:!0}):`M ${e.map((o,i)=>`${i?"L ":""}${o.x} ${o.y}`).join(" ")} Z`}function $n(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 xr(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function ku(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=m(e.gridWidth,1);if(e.gridLineStyle==="dotted")return Ux(e,r,n,o,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...xr(e,s)},d=[];return H(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*Ru(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})}),H(e.axisX).forEach(c=>{let u=Oi(e.axisX.min,e.axisX.max,c),p=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 ${p} ${f}`,style:l})}),d}function Ux(e,t,r,n,o,i,a){let s=H(e.axisY).filter(c=>c>e.axisY.min),l=H(e.axisX),d=[];return s.forEach(c=>{let u=i*Ru(e,c);l.forEach(p=>{let f=Oi(e.axisX.min,e.axisX.max,p),g=n+Math.cos(f)*u,b=o+Math.sin(f)*u,y=`chart-grid-dot-${e.id}-${p}-${c}`;d.push($n(e,y,r+d.length,t,g,b,a,void 0))})}),d}function Ru(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 An(e,t,r,n){if(e.showGrid===!1||!nt(e))return[];if(e.gridShape==="circle"&&yu.has(e.chartType))return ku(e,t,r,n);let o=m(e.gridWidth,1);if(ne(e))return jx(e,t,r,n,o);let i=e.chartType==="field"?yr(e,t):void 0;if(e.gridLineStyle==="dotted")return Xx(e,t,r,n,o,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...xr(e,o),clip:i},s=[];return(e.gridAxes==="y"?[]:H(e.axisX)).forEach(l=>{let d=t.x+T(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"?[]:H(e.axisY)).forEach(l=>{let d=t.y+t.height-T(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 jx(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"}:xr(e,o)};return H(e.axisY).map((a,s)=>{let l=t.x+T(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 Xx(e,t,r,n,o,i){let a=H(e.axisX),s=H(e.axisY),l=[];return a.forEach(d=>{let c=t.x+T(d,e.axisX,t.width);s.forEach(u=>{let p=t.y+t.height-T(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push($n(e,f,n+l.length,r,c,p,o,i))})}),l}function wu(e){return e.chart.rules?.length?qx(e).flatMap(t=>Kx(e,t)):[]}function qx(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-T(r.at,e.chart.axisY,e.plot.height),lineOrder:n,labelOrder:o}})}function Kx(e,t){let r=[Zx(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(Qx(e,t)),r}function Zx(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:nu(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 Qx(e,t){let r=Math.max(9,m(e.chart.fontSize,12)-2);return{...P({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:ru(t.rule.id)}}function Bi(e){let t=m(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,m(e.cornerRadius,12)-t)}}function vu(e,t,r){if(!e.fillImage)return[];let n=Bi(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 Gt(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=m(n.config?.barGlassBlur,0);if(a<=0||!n.fillImage)return[];let s=Bi(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:m(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(...An(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 _t(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:v(n,s,a.id),shadow:{color:O(n,"#ffffff"),opacity:.9,blur:o,dx:0,dy:0},pointerEvents:"none"}}}function Ft(e){return e.chart.config?.showBarLabels===!0}function Jx(e,t){let r=e.frame.height>=t.height+fe.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function e0(e,t,r){return e==="outside"?t.y-r-fe.gap:e==="inside"?t.y+fe.gap:t.y+t.height/2-r/2}function t0(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:Ci(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?v(l.barLabelPillColor,a,o.id):{kind:"none"},stroke:v(l?.barLabelBorderColor??n,a,o.id),strokeWidth:m(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function r0(e,t,r,n,o,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...P({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 n0(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{...P({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-Rn,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 o0(e,t){let r=e.placement==="axis"?"outside":e.placement,n=e.frame.width>=t.width+fe.gap*2;return r!=="outside"&&!n?"outside":r}function i0(e,t,r){let{frame:n}=e,o=r==="outside"?n.x+n.width+fe.gap:r==="inside"?n.x+n.width-t.width-fe.gap:n.x+n.width/2-t.width/2;return{...t,left:o,top:n.y+n.height/2-t.height/2}}function Ht(e,t){let{chart:r}=e,n=r.config,o=Math.max(8,m(n?.barLabelFontSize,m(r.fontSize,12))),i=xi(t.value,n?.barLabelFormat);if(t.placement==="axis")return[n0(e,t,i,o)];let a=n?.barLabelPill===!0,s=Si(i,o,a),l=t.horizontal?o0(t,s):Jx(t,s),d=t.horizontal?i0(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:e0(l,t.frame,s.height)},c=n?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(t0(e,t.id,d,c)),u.push(r0(e,t.id,d,i,l,o,c)),u}var Ii={angle:45,spacing:7,width:1.5},a0=2;function s0(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 p=-c;p<=c;p+=i){let f=d.x+l.x*p,g=d.y+l.y*p;u.push(`M ${f-s.x*c} ${g-s.y*c} L ${f+s.x*c} ${g+s.y*c}`)}return u.join(" ")}function Vt(e,t){if(ot(e))return{type:"path",d:Le(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function ot(e){return e.chart.config?.barTrack===!0}function Wt(e,t,r,n="vertical"){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config,d=l?.barCornerRadius??2,c=m(l?.barSegments,0),u=c>0?Ie(r,n,c,m(l?.barSegmentGap,4),d,1,!0):Le(r.x,r.y,r.width,r.height,d),p=[{type:"path",id:`chart-bar-track-${o.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:v(l?.barTrackColor??o.gridColor??"#e2e8f0",a,o.id),pointerEvents:"none"}}];return l?.barTrackHatch&&p.push({type:"path",id:`chart-bar-track-hatch-${o.id}-${t}`,order:s(),bounds:i,d:s0(r.x,r.y,r.width,r.height,m(l.barTrackHatchAngle,Ii.angle),Math.max(a0,m(l.barTrackHatchSpacing,Ii.spacing))),style:{fill:{kind:"none"},stroke:v(l.barTrackHatchColor??o.gridColor??"#cbd5e1",a,o.id),strokeWidth:m(l.barTrackHatchWidth,Ii.width),pointerEvents:"none",clip:{type:"path",d:u}}}),p}function Pu(e){let t=u0(e),r=e.chart.series.flatMap((a,s)=>m0(e,t,a,s)),n=ot(e)?r.flatMap(a=>Wt(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=>p0(e,a)),i=Ft(e)?r.flatMap(a=>d0(e,a,r)):[];return[...n,...o,...r.flatMap(a=>c0(e,a)),...i]}function l0(e,t){let r=t.filter(n=>n.seriesId===e.seriesId).map(n=>n.value);return e.value>=Math.max(...r)}function d0(e,t,r){let{chart:n}=e;return n.config?.barLabelMaxOnly&&!l0(t,r)?[]:Ht(e,{id:`chart-bar-label-${n.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:n.config?.barLabelPosition??"outside"})}function Lu(e,t){let{chart:r,plot:n}=e,o=r.config,i=o?.barCornerRadius??2,a=m(o?.barSegments,0);return a>0?Ie({x:t.x,y:n.y,width:t.width,height:n.height},"vertical",a,m(o?.barSegmentGap,4),i,t.height/n.height,o?.barSegmentSnap!==!1):Je(t.x,t.y,t.width,t.height,i,o?.barRoundedBottom===!0)}function c0(e,t){let{chart:r}=e,n=m(r.config?.barGlow,0);if(n<=0||t.frame.height<=0)return[];let o=Lu(e,t.frame);return[_t(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,o,t.color,n)]}function u0(e){let{chart:t,plot:r}=e,n=pe(t),o=r.width/n,i=Math.min(Math.max(0,m(t.config?.barGroupGap,8)),Math.max(0,o-1)),a=Math.max(0,m(t.config?.barGap,2));return{slotWidth:o,seriesWidth:Math.max(1,(o-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function m0(e,t,r,n){let{chart:o,plot:i}=e,a=r.color??M[n%M.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(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 p0(e,t){let r=h0(e,t),n=g0(e,t);return n&&r.push(n),r}function f0(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 h0(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=Lu(e,t.frame),u=v(t.color,i,r.id),p=v(r.config?.barBorderColor||"#000000",i,r.id),f=m(r.config?.barBorderWidth,0),g=I(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:p,strokeWidth:f,shadow:g,clip:Vt(e,{x:l,y:n.y,width:d,height:n.height})??{type:"path",d:f0(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:Dt(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:oe(t.seriesId,t.valueIndex),style:{fill:u,stroke:p,strokeWidth:f,innerShadow:g}},C=Gt(e,`${t.seriesId}-${t.valueIndex}`,c);return b?[b,...C,y]:[...C,y]}function g0(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=mr(t.value,t.error);return pr({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-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function b0(e,t,r,n,o){let{chart:i,plot:a}=e,s=At(t,a,n)+t.labelRow;if(e.stackedMode){let u=br(i,e.stackedMode,n,r,a.width),p=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+p,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,m(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,T(o,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function y0(e,t){let{chart:r,plot:n}=e,o=r.config,i=e.stackedMode&&r.series.length>1?0:m(o?.barSegments,0);return i>0?Ie({x:n.x,y:t.y,width:n.width,height:t.height},"horizontal",i,m(o?.barSegmentGap,4),o?.barCornerRadius??2,t.width/n.width,o?.barSegmentSnap!==!1):Le(t.x,t.y,t.width,t.height,o?.barCornerRadius??2)}function x0(e,t,r,n,o,i){let{plot:a}=e,s=b0(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:y0(e,s),color:r.colors?.[o]??r.color??M[n%M.length]}}function S0(e,t){let{chart:r,diagnostics:n,nextOrder:o}=e,i=r.config,a=v(i?.barBorderColor||"#000000",n,r.id),s=m(i?.barBorderWidth,0),l=I(r.shadowStyle),d=v(t.color,n,r.id),c=[...Gt(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:Vt(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:Dt(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function C0(e,t,r){let{chart:n}=e,o=n.config,i=Ft(e)&&(!o?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===n.series.length-1;return!i||e.stackedMode&&!a&&o?.barLabelPosition==="outside"?[]:Ht(e,{id:`chart-bar-label-${n.id}-${t.id}`,value:t.value,frame:t.frame,placement:o?.barLabelPosition??"outside",horizontal:!0})}function k0(e,t,r,n,o,i,a,s){let{chart:l}=e,d=x0(e,t,n,o,i,a);ot(e)&&(!e.stackedMode||o===0)&&r.tracks.push(...Wt(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...S0(e,d));let c=m(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(_t(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...C0(e,d,s))}function Tu(e){let t=$t(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)=>{k0(e,t,r,n,o,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function R0(e,t){let{chart:r,plot:n}=e,o=n.width/pe(r),i=Math.min(Math.max(0,m(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 w0(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=a.series.length===1?m(a.config?.barSegments,0):0;return l>0?Ie({x:t,y:s.y,width:o.barWidth,height:s.height},"vertical",l,m(a.config?.barSegmentGap,4),i,n/s.height,a.config?.barSegmentSnap!==!1):Je(t,r,o.barWidth,n,i,a.config?.barRoundedBottom===!0)}function v0(e,t,r,n,o,i,a){let{chart:s}=e,l=s.config;if(!(Ft(e)&&!(l?.barLabelMaxOnly&&!M0(r.values,o))&&(l?.barLabelPosition!=="axis"||n===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[o];t.labels.push(...Ht(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 P0(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=br(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),p=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:n,valueIndex:i,radius:d,color:n.colors?.[i]??n.color??M[o%M.length],x:c,y:u,height:p,path:w0(e,c,u,p,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function L0(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=v(t.color,i,r.id),u=v(r.config?.barBorderColor||"#000000",i,r.id),p=m(r.config?.barBorderWidth,0),f=I(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:p,shadow:f,clip:Vt(e,t.column)??{type:"path",d:b}}})}return g.push(...Gt(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:Dt(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:oe(s.id,l),style:{fill:c,stroke:u,strokeWidth:p,innerShadow:f}}),g}function T0(e,t,r,n,o,i,a){let{chart:s}=e,l=P0(e,t,n,o,i,a);i===0&&ot(e)&&r.tracks.push(...Wt(e,String(a),l.column)),r.bars.push(...L0(e,l));let d={x:l.x,y:l.y,width:n.barWidth,height:l.height};v0(e,r,o,i,a,n,d);let c=m(s.config?.barGlow,0);c>0&&r.glows.push(_t(e,`chart-bar-glow-${s.id}-${o.id}-${a}`,l.path,l.color,c))}function Mu(e,t){let{chart:r}=e,n={tracks:[],bars:[],glows:[],labels:[]},o=R0(e,t),i=pe(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{T0(e,t,n,o,s,l,a)});return[...n.tracks,...n.bars,...n.glows,...n.labels]}function M0(e,t){let r=e.map(n=>typeof n=="number"?n:n[1]);return r[t]>=Math.max(...r)}function $u(e){return ne(e.chart)?Tu(e):e.stackedMode?Mu(e,e.stackedMode):Pu(e)}function Au(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=O(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:n,slotWidth:i,boxWidth:Math.max(4,i*s),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:a,borderWidth:m(t.config?.barBorderWidth,1),whiskerWidth:Math.max(0,m(t.config?.boxWhiskerWidth,1)),medianWidth:Math.max(0,m(t.config?.boxMedianWidth,2)),medianColor:t.config?.boxMedianColor??a,whiskerColor:t.config?.boxWhiskerColor,capSize:Math.max(0,m(t.config?.boxCapSize,.4)),pointSize:Math.max(0,m(t.config?.boxPointSize,3)),pointOpacity:Math.min(1,Math.max(0,m(t.config?.boxPointOpacity,.7))),jitter:Math.max(0,m(t.config?.boxJitter,1))}}function ae(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Eu(e,t,r,n){let{chart:o,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,o.axisX,i.width):i.y+i.height-T(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 Nu(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?o.x+T(d,n.axisX,o.width):o.y+o.height-T(d,n.axisY,o.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+$0(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:p,y:f}=ae(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:p,cy:f,rx:t.pointSize,ry:t.pointSize,style:{fill:v(r.color,a,n.id),opacity:t.pointOpacity}}})}function $0(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function Bu(e,t,r){let n=t.whiskerWidth>0?[E0(t,r),N0(t,r)]:[],o=t.whiskerWidth>0&&t.capSize>0?[O0(t,r),B0(t,r)]:[],i=t.medianWidth>0?[I0(t,r)]:[];return[...[...n,...o].map(a=>Ou(e,t,{...a,color:A0(t,r)})),D0(e,t,r),...i.map(a=>Ou(e,t,a))]}function A0(e,t){return e.whiskerColor==="series"?O(t.color,e.borderColor):e.whiskerColor}function E0(e,t){let{center:r,min:n,q1:o}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ae(e.orientation,r,n),to:ae(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function N0(e,t){let{center:r,q3:n,max:o}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ae(e.orientation,r,n),to:ae(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function O0(e,t){return Iu(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function B0(e,t){return Iu(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function Iu(e,t,r,n){let o=t.boxWidth*t.capSize/2;return{id:e,from:ae(t.orientation,r-o,n),to:ae(t.orientation,r+o,n),strokeWidth:t.whiskerWidth}}function I0(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ae(e.orientation,t.geometry.center-r,t.geometry.median),to:ae(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function Ou(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:r.color??t.borderColor},strokeWidth:r.strokeWidth}}}function D0(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ae(t.orientation,s.center-l,s.q1),c=ae(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),p=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:p,width:f,height:g,rx:t.cornerRadius,style:{fill:v(r.color,i,n.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function Du(e,t,r,n){let o=Ri(r.values);if(!o)return[];let i=Eu(e,t,n,o),a=r.color??M[n%M.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:n,color:a,geometry:i},l=Bu(e,t,s);return t.showPoints&&l.push(...Nu(e,t,s)),l}function Gu(e){let t=Au(e),r=[];return e.chart.series.forEach((n,o)=>{r.push(...Du(e,t,n,o))}),r}var G0="#94a3b8",_u=8,Di=140;function Hu(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?V0(e):e.chart.series.flatMap((t,r)=>_0(e,t,r))}function _0(e,t,r){let n=F0(e,t,r);return Gi(e,t).map((o,i)=>{let a=_i(e,o),s={series:t,valueIndex:i,point:a,style:n};return t.symbol?.points.length?H0(e,s):Fi(e,s)})}function Hi(e){return e.config?.orientation==="horizontal"}function Gi(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(o=>[o[0],o[1]]):Hi(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 Fu(e,t){return Hi(e)?t[0]:t[1]}function _i(e,t){return{x:e.plot.x+T(t[0],e.chart.axisX,e.plot.width),y:e.plot.y+e.plot.height-T(t[1],e.chart.axisY,e.plot.height)}}function F0(e,t,r){let n=t.color??M[r%M.length];return{fill:v(n,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?m(t.strokeWidth,1):void 0}}function H0(e,t){let r=t.series.symbol,n=m(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:Vu(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:xe({points:a,tension:m(r?.tension,0),closed:!0}),style:t.style}}function Fi(e,t){let r=m(t.series.size,3);return{type:"ellipse",id:Vu(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 Vu(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function V0(e){let{chart:t}=e,[r,n]=t.series,o=Gi(e,r),i=Gi(e,n),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??Y,c=!!t.config?.reverseComparison,u=Math.min(o.length,i.length),p=t.config?.categories??[],f=[];for(let g=0;g<u;g++){let b=o[g],y=i[g],C=_i(e,b),w=_i(e,y),R=Fu(t,b),$=Fu(t,y),B=c?$<R:$>R,N=c?$>R:$<R,G=B?s:N?l:d,z=m(n.size,3);f.push(z0(e,g,C,w,G)),f.push(Fi(e,{series:r,valueIndex:g,point:C,style:{fill:v(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??G0},strokeWidth:m(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(Fi(e,{series:n,valueIndex:g,point:w,style:{fill:v(G,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&p[g]&&f.push(Y0(e,g,C,w,z,p[g]))}return f}function W0(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function z0(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:m(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:W0(i.config?.customConnectorDash)}}}function Y0(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=Hi(a),c=d?{x:Math.max(r.x,n.x)+o+_u,y:Math.min(r.y,n.y)-8,width:Di,height:16}:{x:Math.min(r.x,n.x)-Di/2,y:Math.min(r.y,n.y)-o-_u-14,width:Di,height:16};return{...P({id:`chart-custom-label-${a.id}-${t}`,order:l(),bounds:s,frame:c,text:i,chart:a,align:d?"left":"center"}),fontSize:Math.max(6,m(a.config?.customLabelSize,Math.max(9,m(a.fontSize,12))-2)),...a.config?.customLabelColor?{color:a.config.customLabelColor}:{}}}function zu(e){let{chart:t,plot:r}=e,n=t.series.filter(a=>Wu(a.values[0])===3),o=t.series.filter(a=>Wu(a.values[0])===4);return{scalarSamples:n.flatMap(a=>a.values.map(([s,l,d])=>({x:T(s,t.axisX,r.width),y:r.height-T(l,t.axisY,r.height),value:d}))),vectorSeries:o}}function Wu(e){return Array.isArray(e)?e.length:void 0}function Yu(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=U0(e);return[j0(e,r,n,o,i),...X0(e,n,o,i)]}function U0(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 j0(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 X0(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=n.y+n.height+3;return[P({id:`chart-field-colorbar-min-${o.id}`,order:a(),bounds:i,frame:{x:n.x,y:s,width:80,height:16},text:Se(t),chart:o}),P({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:Se(r),chart:o,align:"right"})]}var q0="#94a3b8";function En(e,t){return e?.stops.length?ir(e.stops,t):q0}function Uu(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),p={point:l,segment:d};u?u.push(p):r.set(c,[p])};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(p=>!o[p.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 ju(e,t){let r=[];for(let n=0;n<e.rows-1;n++)for(let o=0;o<e.columns-1;o++){let i=K0(e,n,o),a=Z0(i,t);a!==0&&a!==15&&r.push(...Q0(i,a,t))}return r}function K0(e,t,r){return{topLeft:Nn(e,t,r),topRight:Nn(e,t,r+1),bottomRight:Nn(e,t+1,r+1),bottomLeft:Nn(e,t+1,r)}}function Nn(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 Z0(e,t){return(On(e.topLeft,t)?8:0)|(On(e.topRight,t)?4:0)|(On(e.bottomRight,t)?2:0)|(On(e.bottomLeft,t)?1:0)}function On(e,t){return e.value>=t}function Q0(e,t,r){let n=J0(e,r);switch(t){case 1:case 14:return[Me(n.left,n.bottom)];case 2:case 13:return[Me(n.bottom,n.right)];case 3:case 12:return[Me(n.left,n.right)];case 4:case 11:return[Me(n.top,n.right)];case 5:return[Me(n.left,n.top),Me(n.bottom,n.right)];case 6:case 9:return[Me(n.top,n.bottom)];case 7:case 8:return[Me(n.left,n.top)];case 10:return[Me(n.top,n.right),Me(n.left,n.bottom)];default:return[]}}function J0(e,t){return{top:Bn(e.topLeft,e.topRight,t),right:Bn(e.topRight,e.bottomRight,t),bottom:Bn(e.bottomLeft,e.bottomRight,t),left:Bn(e.topLeft,e.bottomLeft,t)}}function Bn(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 Me(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var eS=.5;function Xu(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=tS(e,t);return[...rS(e,r),...oS(e,r)]}function tS(e,t){let{plot:r,chart:n}=e,o=bu(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 rS(e,t){let r=[];for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)r.push(nS(e,t,n,o));return r}function nS(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=En(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:yr(o,i)}}}function oS(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((n,o)=>{let i=iS(e,t,n,o);i&&r.push(i)}),r}function iS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=ju({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=Uu(l).map(u=>Et(u.map(([p,f])=>({x:i.x+p,y:i.y+f})),eS)).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:yr(o,i)}}}function qu(e,t){let r=[];return t.forEach((n,o)=>{let i=n.color??M[o%M.length];n.values.forEach((a,s)=>{r.push(aS(e,n.id,a,s,i))})}),r}function aS(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,p,f]=r,g=a.x+T(c,i.axisX,a.width),b=a.y+a.height-T(u,i.axisY,a.height),y=a.x+T(c+Math.cos(p)*f,i.axisX,a.width),C=a.y+a.height-T(u+Math.sin(p)*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} ${C}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:v(o,l,i.id),strokeWidth:2}}}function Ku(e){let t=zu(e),r=[];return r.push(...Xu(e,t.scalarSamples)),r.push(...qu(e,t.vectorSeries)),r.push(...Yu(e)),r}function Zu(e,t){let r=[];return t.rows.forEach((n,o)=>{r.push(...sS(e,t,n,o))}),r}function sS(e,t,r,n){return t.columns.flatMap((o,i)=>{let a=lS(t,r,n,i);return cS(e,t,a)})}function lS(e,t,r,n){let o=t.values[n]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:n,value:o,color:dS(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 dS(e,t){return cr(e,t.bands,t.zones)}function cS(e,t,r){let n=uS(e,t,r);return e.chart.config?.showValues===!1?[n]:[n,mS(e,t,r)]}function uS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=`chart-heatmap-cell-${n.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:n.config?.cellStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(n.config?.cellStrokeWidth,m(n.gridWidth,1))};return n.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:o,cx:r.frame.x+r.frame.width/2,cy:r.frame.y+r.frame.height/2,rx:r.frame.width/2,ry:r.frame.height/2,style:s}:{type:"rect",id:a,order:i(),bounds:o,...r.frame,rx:t.grid.cellRadius,style:s}}function mS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=Math.max(6,m(n.config?.cellValueSize,t.fontSize));return{...P({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-a/2,width:r.frame.width,height:a+2},text:String(r.value),chart:n,align:"center"}),...n.config?.cellValueSize===void 0?{}:{fontSize:a},color:n.config?.cellValueColor??re(r.color)}}function Qu(e,t){return[...pS(e,t),...hS(e,t)]}function pS(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,n)=>fS(e,t,r,n))}function fS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return P({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 hS(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,n)=>gS(e,t,r,n))}function gS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return P({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 Ju(e){let{chart:t}=e,r=bS(e),n=yS(e);return{rows:t.series,columns:r,bands:dr(t.axisY),zones:t.config?.zones?.length?t.config.zones:lr,fontSize:Math.max(9,m(t.fontSize,12)),reservedSpace:n,grid:xS(e,n,r.length)}}function bS(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function yS(e){let{chart:t}=e,r=Math.max(9,m(t.fontSize,12)),n=t.series.reduce((o,i)=>Math.max(o,Be(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 xS(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,m(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 p=Math.min(l,d);l=p,d=p,c=p*r,u=p*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,m(n.config?.barCornerRadius,s))}}var Sr=10,em=4,SS=2;function tm(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=te({x:r,y:i,width:n,height:Sr});return[CS(e,t,r,i,n,a),...kS(e,t,r,i,n,o)]}function rm(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function CS(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,p)=>({offset:rm(t,t.bands[p+1]??t.bands[t.bands.length-1])*100,color:u.color??Y}));return{type:"rect",id:`chart-heatmap-legend-bar-${a.id}`,order:s(),bounds:i,x:r,y:n,width:o,height:Sr,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:Y},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}}}function kS(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=n+Sr+em+SS,c=48;return t.bands.flatMap((u,p)=>{let f=r+rm(t,u)*o,g={type:"path",id:`chart-heatmap-legend-tick-${a.id}-${p}`,order:l(),bounds:s,d:`M ${f} ${n+Sr} L ${f} ${n+Sr+em}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}},b=p===0,y=p===t.bands.length-1,C=b?"left":y?"right":"center",w=b?f:y?f-c:f-c/2,R=P({id:`chart-heatmap-legend-tick-label-${a.id}-${p}`,order:l(),bounds:s,frame:{x:w,y:d,width:c,height:i},text:Se(u),chart:a,align:C});return[g,R]})}function nm(e){let t=Ju(e),r=[];return r.push(...Zu(e,t)),r.push(...Qu(e,t)),r.push(...tm(e,t)),r}function Vi(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 om(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 im(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 am(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 wS(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 vS(e,t,r,n){let o=1/0;for(let i of e.values()){let a=i.reduce((d,c)=>d+(t.get(c)??0),0),s=Math.max(0,i.length-1)*n,l=Math.max(1,r-s);a>0&&(o=Math.min(o,l/a))}return!Number.isFinite(o)||o<=0?1:o}function Cr(e,t,r,n=18){return t<=1?0:e*(r-n)/(t-1)}function sm(e,t,r,n=8){let o=im(e.ids,t),i=wS(e),a=vS(o,i,r,n),s=new Map,l=new Map;for(let d of o.values()){let c=0;for(let u of d){let p=Math.max(2,(i.get(u)??0)*a);s.set(u,c),l.set(u,p),c+=p+n}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function lm(e,t,r,n,o=18){let i=new Map,a=new Map;for(let s of e.ids)i.set(s,0),a.set(s,0);return e.links.map(s=>{let l=Math.max(.5,s.value*t.valueScale),d=n.get(s.source),c=n.get(s.target),u=(t.y.get(s.source)??0)+(d?.y??0),p=(t.y.get(s.target)??0)+(c?.y??0),f=i.get(s.source)??0,g=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,g+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:Cr(t.columns.get(s.source)??0,t.columnCount,r,o)+o+(d?.x??0),x1:Cr(t.columns.get(s.target)??0,t.columnCount,r,o)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:p+g,targetY1:p+g+l}})}function dm(e,t,r,n,o,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=o.get(a);return{id:a,label:s?.label??a,color:s?.color,x:Cr(l,r.columnCount,n,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function PS(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 zi(e,t,r,n,o={nodeWidth:18,nodeGap:8}){let i=am(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=om(i),s=sm(i,a,n,o.nodeGap),l=PS(e);return{nodes:dm(e,i,s,r,l,o.nodeWidth),links:lm(i,s,r,l,o.nodeWidth)}}function kr(e,t){let r=LS(e,t);if(!r.length)return[];let n=[],o=r,i=t;for(;o.length;){let a=TS(o,Math.min(i.width,i.height)),s=MS(a,i);n.push(...s.rectangles),o=o.slice(a.items.length),i=s.remainingBounds}return n}function LS(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 TS(e,t){let r=[e[0]];for(let n=1;n<e.length;n++){let o=[...r,e[n]];if(cm(o,t)>cm(r,t))break;r.push(e[n])}return{items:r,area:r.reduce((n,o)=>n+o.area,0)}}function cm(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 MS(e,t){return t.width>=t.height?$S(e,t):AS(e,t)}function $S(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 AS(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}}}var ES=.15,NS=1/Math.sqrt(3);function OS(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 um(e){let{chart:t,plot:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??yi),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*NS),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??ES)),p=I(t.shadowStyle),f=p?`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((g,b)=>{let w=(g.values.length>0&&Array.isArray(g.values[0])?g.values:g.values.map((G,z)=>[t.axisX.min+z*t.axisX.step,G])).map(([G,z])=>({x:T(G,t.axisX,r.width),y:r.height-T(z,t.axisY,r.height)})),R=Vi(w,l),$=Math.max(1,...R.map(G=>G.count)),B=g.color??M[b%M.length],N=s?.scale;R.forEach((G,z)=>{let U=G.count/$,he=N?En(N,U):B;a.push({type:"path",id:`chart-hexbin-${t.id}-${g.id}-${z}`,order:i(),bounds:n,d:OS(r.x+G.cx,r.y+G.cy,d),style:{fill:v(he,o,t.id),stroke:c>0?v(s?.hexStrokeColor??he,o,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:N?void 0:Math.max(u,U),shadow:p,clip:f?{type:"path",d:f}:void 0}})})}),a}function it(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 at(e,t){let{chart:r,plot:n}=e;return t.map(([o,i])=>({x:n.x+T(o,r.axisX,n.width),y:n.y+n.height-T(i,r.axisY,n.height)}))}function mm(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],p=`${Et(r,o)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(C=>C.y)),g=(Math.min(...r.map(C=>C.x))+Math.max(...r.map(C=>C.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:p,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:wi(n,i)},{offset:100,color:wi(n,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function BS(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function IS(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:v(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function DS(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:v(t.color,o,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function GS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=n.config,s=Math.max(9,n.fontSize??12),l=BS(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...P({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 pm(e,t,r){let{chart:n}=e,o=n.config,i=o?.highlightPoints;if(!i?.length)return[];let a=it(n,t),s=at(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let p={key:`${n.id}-${t.id}-${c}`,point:u,index:c,radius:o?.highlightSize??6,color:o?.highlightColor??r};o?.highlightGuide&&l.push(IS(e,p)),l.push(DS(e,p)),o?.highlightLabels&&l.push(GS(e,p,a[c][1]))}return l}function fm(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 hm(e,t){return t.flatMap(r=>_S(e,r))}function _S(e,t){let r=[],n=FS(e,t);return n&&r.push(n),r.push(HS(e,t)),r}function FS(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=mr(t.value,t.error);return pr({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.position.x,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function HS(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?v(c,o,r.id):{kind:"none"},stroke:d&&l>0?v(t.color,o,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function gm(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,p=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:p?{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:Et(r,o),style:{fill:{kind:"none"},stroke:v(p??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}:I(i.shadowStyle)}}}function bm(e,t){return O(e.color,M[t%M.length])}function ym(e,t,r){let n=e.chart.config?.areaOpacity;if(n===void 0||n<=0)return[];let o=bm(t,r),i=e.chart.config?.lineTension??0,a=at(e,it(e.chart,t));return a.length>1?[mm(e,t,a,o,i,n)]:[]}function xm(e,t,r){let n=bm(t,r),o=e.chart.config?.lineTension??0,i=it(e.chart,t),a=at(e,i),s=[];a.length&&s.push(gm(e,t,a,n,o));let l=fm(t,i,a,n);return s.push(...hm(e,l)),s.push(...pm(e,t,n)),s}function Sm(e){let t=[];return e.chart.series.forEach((r,n)=>{t.push(...ym(e,r,n))}),e.chart.series.forEach((r,n)=>{t.push(...xm(e,r,n))}),t}var Cm=[0,25,50,75,100];function km(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...VS(e,t)),e.showLabels&&r.push(...WS(e,t)),r}function VS(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return Cm.map(i=>{let a=Rm(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:m(r.gridWidth,1)}}})}function WS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e;return Cm.map(a=>({...P({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:o,frame:{x:n.x,y:Rm(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function Rm(e,t){return e.grid.y+e.grid.height*(1-t/100)}function wm(e,t,r,n){if(!e.showLabels)return[];let o=YS(e,t,r,n);return e.chart.config?.showMekkoTotals===!1?[o]:[zS(e,t,r,n),o]}function zS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return{...P({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 YS(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,{label:s,width:l}=n;return{...P({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:Pe(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function vm(e){let t=US(e),r=e.showLabels?30:0,n=jS(e,r),o=Math.max(9,m(e.chart.fontSize,12)),i=Math.max(0,m(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,o-1);return{columns:XS(e,n,t,i),fontSize:o,smallFontSize:a,labelGutterWidth:r,columnGap:i,labelSize:Math.max(6,m(e.chart.config?.mekkoLabelSize,a)),valueSize:Math.max(6,m(e.chart.config?.mekkoValueSize,a)),grid:n}}function US(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function jS(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 XS(e,t,r,n){let o=r.map((d,c)=>e.chart.series.reduce((u,p)=>u+(p.values[c]??0),0)),i=o.reduce((d,c)=>d+c,0),a=Math.max(1,...o),s=Math.max(1,t.width-n*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=o[c],p=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,g={label:d,total:u,x:l,y:t.y+t.height-f,width:p,height:f};return l+=p+n,g})}var qS=.15;function Pm(e,t,r){let o=e.chart.config?.showColumnBackdrop!==!1?[KS(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=ZS(e.chart.series,t,r),s=a.flatMap((l,d)=>QS(e,t,l,i?a[d+1]?.color:void 0));return[...o,...s]}function KS(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=Lm(e);return{type:"path",id:`chart-mekko-column-backdrop-${n.id}-${r}`,order:a(),bounds:o,d:yn(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:v(n.gridColor??"#e2e8f0",i,n.id),opacity:qS}}}function Lm(e){return Math.max(0,m(e.chart.config?.barCornerRadius,2))}function ZS(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??M[s%M.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 QS(e,t,r,n){return[JS(e,r,n),...eC(e,t,r)]}function JS(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=I(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=n.config,u=t.isTop||c?.mekkoRoundAll?Lm(e):0,{x:p,y:f,width:g,height:b}=t.frame,y=Math.max(0,m(c?.mekkoSegmentGap,0)),C="#94a3b8",w={minX:p+g/2-b/2,maxX:p+g/2+b/2,minY:f,maxY:f+b},R=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:O(t.color,C)},{offset:100,color:O(r,C)}]}:v(t.color,a,n.id);return{type:"path",id:`chart-mekko-seg-${n.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?w:i,d:Je(p,f+y/2,g,Math.max(0,b-y),u,!!c?.mekkoRoundAll),style:{fill:R,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(c?.mekkoSegmentStrokeWidth,m(n.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function eC(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),p=t.labelSize*1.2,f=t.valueSize*1.2,g=Pe(r.seriesLabel,c,t.labelSize).map($=>pn($,c,t.labelSize,!0));if(g.length*p+f>u)return[];let b=n.config?.mekkoTextColor??re(O(r.color,"#ffffff")),y=t.columns[r.columnIndex]?.total??0,C=n.config?.mekkoValueFormat==="percent"?`${y>0?Math.round(r.value/y*100):0}%`:String(r.value),w={...P({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:g,fontSize:t.labelSize,fontWeight:"bold",color:b},R={...P({id:`chart-mekko-seg-value-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3+g.length*p,width:c,height:Math.max(1,u-g.length*p)},text:C,chart:n}),lines:[C],fontSize:t.valueSize,color:b};return[w,R]}function Tm(e){let t=vm(e),r=km(e,t);return t.columns.forEach((n,o)=>{r.push(...Pm(e,t,o)),r.push(...wm(e,t,o,n))}),r}function tC(e,t){let r=t.series.map(i=>Math.max(0,m(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 Mm(e,t){let{chart:r,bounds:n,nextOrder:o}=e,i=r.config?.pieCenterText;if(!i)return[];let a=tC(i,r).split(/\\n|\n/),s=m(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??A,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 $m(e){let{chart:t,plot:r}=e,n=wn(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,m(c.values[0],0)),0)||1}}var rC=14*Math.PI/180,Rr=80,nC=.62,oC=14,iC=3,aC=.32,Am="#334155";function Om(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(n=>n.end-n.start>=rC).flatMap(n=>sC(e,t,n))}function Em(e,t,r,n,o,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=o*1.2,p=l.config?.pieLabelContent??"both",f=p==="inline"?Rr*1.9:Rr,g={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??A,fontSize:o,align:"center",verticalAlign:"middle",lineHeight:1.2,color:n},b=w=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...w}),y={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="name"?r.y-u/2:r.y-u,lines:[p==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:b({}),prop:Te(t.seriesId)},C={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:b({}),prop:oe(t.seriesId,0),propKind:"value"};return p==="inline"||p==="name"?[y]:p==="percent"?[C]:[y,C]}function Nm(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 sC(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,m(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=j(o,i,o.outerRadius+iC),c=o.outerRadius-o.innerRadius,u=c<l*2+6,p=r.labelOffsetX!==0||r.labelOffsetY!==0,f=n?.pieLabelPosition??"auto";if(p||f==="outside"||f==="auto"&&u){let $=p?lC(j(o,i,o.outerRadius),r.labelOffsetX,r.labelOffsetY):j(o,i,o.outerRadius+oC+(f==="outside"?Math.abs(Math.cos(i))*(n?.pieLabelContent==="inline"?Rr*.95:Rr/2):0)),B=fr(d,$,Rr/2,l),N=n?.pieLabelColor??Ve(O(r.color,Am),aC)??Am;return[Nm(e,r,d,B,N,!0),...Em(e,r,$,N,a,s,!0,i)]}let b=o.innerRadius+c*nC,y=j(o,i,b),C=O(r.color,"#0f172a"),w=n?.pieLabelColor??Mt(C,re(C));return[Nm(e,r,d,d,w,!1),...Em(e,r,y,w,a,s,!1,i)]}function lC(e,t,r){return{x:e.x+t,y:e.y+r}}var dC=-Math.PI/2,Ui=Math.PI*2,cC=Ui*(359.999/360),Yi=e=>e*Math.PI/180;function Bm(e,t){let r=e.chart.config,n=mC(e.chart.series,t.total,{start:dC+Yi(m(r?.pieStartAngle,0)),sweep:Math.min(Ui,Math.max(Yi(1),Yi(m(r?.pieSweep,360)))),explode:Math.max(0,m(r?.pieExplode,0))}),o=r?.pieSliceGap??0;return[...n.flatMap(i=>bC(e,uC(t,i),i,o)),...Om(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:Im(i)})))]}function Im(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function uC(e,t){if(t.explode===0)return e;let{dx:r,dy:n}=Im(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+n}}function mC(e,t,r){let n=[],o=r.start;return e.forEach((i,a)=>{let s=Math.max(0,m(i.values[0],0)),l=s/t*r.sweep;n.push({seriesId:i.id,label:i.label,color:i.color??M[a%M.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:o,end:o+Math.min(l,r.sweep>=Ui?cC:r.sweep)},explode:Math.max(0,m(i.offset,r.explode)),labelOffsetX:m(i.labelOffsetX,0),labelOffsetY:m(i.labelOffsetY,0)}),o+=l}),n}function pC(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 fC(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 hC(e,t,r){let n=Math.max(0,r)/2,o=t.angles.end-t.angles.start,i=Bt(e,t.angles,r),a=2*et(n,e.outerRadius),s=Math.max(0,o-a);return Math.min(e.cornerRadius,i?hr(e.outerRadius,e.innerRadius,s):gr(e.outerRadius,tt(n,o,e.outerRadius),s))}function gC(e,t){let r=e.chart.config,n=t.stroke??r?.pieStroke;return n?{stroke:{kind:"solid",color:n},strokeWidth:m(t.strokeWidth,m(r?.pieStrokeWidth,1))}:{}}function bC(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=v(r.color,a,o.id),d=rt(t,r.angles,hC(t,r,n),n),c=I(o.shadowStyle),u=gC(e,r),p=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:fC(c,n),clip:{type:"path",d:pC(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:oe(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:p?{color:O(r.color,"#ffffff"),opacity:.85,blur:p,dx:0,dy:0}:void 0}};return f?[f,g]:[g]}function Dm(e){let t=$m(e);return[...Bm(e,t),...Mm(e,t)]}var yC=-Math.PI/2,xC="#e2e8f0",SC=14*Math.PI/180,In=80,CC=.62,kC=14,RC=3,wC=.32,Gm="#334155";function vC(e){let{chart:t,plot:r}=e,n=Math.max(1,Math.min(r.width,r.height)/2-4),o=m(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(m(t.config?.innerRadius,0),n-1)),cornerRadius:Math.max(0,m(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,m(t.config?.pieSliceGap,0)),axisMin:o,range:m(t.axisY.max,100)-o,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:yC+m(t.config?.pieStartAngle,0)*Math.PI/180}}function _m(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*et(d,t));if(Bt(l,r,s))return Math.min(a,hr(t,i,u));let p=tt(d,c,t);return Math.min(a,gr(t,p,u))}function PC(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:p,innerRadius:f,maxRadius:g,gapPx:b}=t,y=v(a,d,s.id),C=I(s.shadowStyle),w=rt({centerX:u,centerY:p,outerRadius:g,innerRadius:f},n,_m(t,g,n),b),R={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:w,style:{fill:v(s.gridColor??xC,d,s.id),opacity:s.config?.polarTrackOpacity,...LC(e)}},$=rt({centerX:u,centerY:p,outerRadius:o,innerRadius:f},n,_m(t,o,n),b),B=C?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:$,style:{fill:y,shadow:C,clip:{type:"path",d:w}}}:void 0,N={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:$,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:n.start,pieEnd:n.end,pieValue:i},prop:oe(r.id,0),style:{fill:y,innerShadow:C,...TC(e)}};return B?[R,B,N]:[R,N]}function LC(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(n=>Number.isFinite(n)&&n>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:m(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function TC(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:m(t.pieStrokeWidth,1)}:{}}function MC(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return!r.config?.polarRings||t.range<=0?[]:H(r.axisY).filter(i=>i>t.axisMin&&i<t.axisMin+t.range).map(i=>{let a=t.innerRadius+(t.maxRadius-t.innerRadius)*(i-t.axisMin)/t.range;return{type:"ellipse",id:`chart-polar-area-ring-${r.id}-${i}`,order:o(),bounds:n,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.textColor??"#334155"},strokeWidth:m(r.gridWidth,1),opacity:.25}}})}function Fm(e){let t=vC(e),{centerX:r,centerY:n,innerRadius:o,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=SC;return[...e.chart.series.flatMap((p,f)=>{let g={start:d+f*l,end:d+(f+1)*l},b=Math.max(0,m(p.values[0],0)),y=s>0?Math.min(1,Math.max(0,(b-a)/s)):0,C=Math.max(o+1,o+(i-o)*y),w=p.color??M[f%M.length],R=PC(e,t,p,g,C,b,w);if(!c)return R;let $={centerX:r,centerY:n,outerRadius:C,innerRadius:o};return[...R,...AC(e,$,g,p,b,w)]}),...MC(e,t)]}function Hm(e){let t=Math.max(9,m(e.fontSize,12));return{nameSize:Math.max(6,m(e.config?.polarNameSize,t)),valueSize:Math.max(6,m(e.config?.polarValueSize,t))}}function $C(e,t,r,n,o){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Hm(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=m(n.labelOffsetX,0),u=m(n.labelOffsetY,0),p=c!==0||u!==0,f=d<l*2+6,g=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),b=!f&&g>=In,y=e.chart.config?.polarOutsideLabels??!1;if(!b&&!p&&!y)return;let C=p||!b,w=j(t,i,t.outerRadius+RC),R=C?p?EC(j(t,i,t.outerRadius),c,u):j(t,i,t.outerRadius+kC):j(t,i,t.innerRadius+d*CC),$=C?y&&e.chart.textColor?e.chart.textColor:Ve(O(o,Gm),wC)??Gm:Mt(O(o,"#0f172a"),re(O(o,"#0f172a")));return{point:R,color:$,outside:C,mid:i,tickStart:w}}function AC(e,t,r,n,o,i){let a=$C(e,t,r,n,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:p,mid:f,tickStart:g}=a,{nameSize:b,valueSize:y}=Hm(s),C=Math.max(b,y)*1.2,w=p?fr(g,c,In/2,C):g,R={type:"path",id:`chart-polar-area-label-tick-${s.id}-${n.id}`,order:d(),bounds:l,d:`M ${g.x} ${g.y} L ${w.x} ${w.y}`,detail:{of:"chartSeries",series:n.id,mark:"polar-area-label-tick"},style:p?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},$={of:"chartSeries",series:n.id,mark:"polar-area-label",pulled:p||void 0,midAngle:f,wedgeRadius:t.outerRadius},B={bounds:l,x:c.x-In/2,width:In,fontFamily:s.fontFamily??A,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},N=s.config?.polarValueFirst??!1,G=b*1.2,z=y*1.2,U=c.y-(G+z)/2,he=N?U+z:U,ee=N?U:U+G,ge={type:"text",id:`chart-polar-area-label-name-${s.id}-${n.id}`,order:d(),...B,y:he,height:b*1.2,fontSize:b,lines:[n.label],fontWeight:N?"normal":"bold",detail:$,prop:Te(n.id)},Q={type:"text",id:`chart-polar-area-label-value-${s.id}-${n.id}`,order:d(),...B,y:ee,height:y*1.2,fontSize:y,lines:[Se(o)],fontWeight:N?"bold":"normal",detail:$,prop:oe(n.id,0),propKind:"value"};return[R,ge,Q]}function EC(e,t,r){return{x:e.x+t,y:e.y+r}}var NC=["Speed","Quality","Cost","Reliability","Usability"];function OC(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:Ln(r.width,r.height,m(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Tn(n,o),curved:t.chartType==="radial",tension:t.config?.radarTension}}function Vm(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],n=OC(e),o=BC(r,n.count),i=(a,s)=>Su(n,s,a);return{circular:n.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:n.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:o,centerX:n.centerX,centerY:n.centerY,radius:n.radius,radiusForValue:a=>Cu(n,a),pointAt:i,polygonPath:a=>Mn(o.map((s,l)=>i(a,l)),!1)}}function BC(e,t){return Array.from({length:t},(r,n)=>e[n]??NC[n]??`Category ${n+1}`)}function Wm(e,t){return e.chart.showGrid===!1?[]:[...IC(e,t),...t.showSpokes?GC(e,t):[]]}function IC(e,t){return H(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>DC(e,t,r))}function DC(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:m(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 GC(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:m(r.gridWidth,1)}}})}function zm(e,t){return e.showLabels?t.categories.map((r,n)=>_C(e,t,r,n)):[]}function _C(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 P({id:`chart-radar-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:FC(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:o,align:HC(d)})}function FC(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function HC(e){return e>8?"left":e<-8?"right":"center"}function Ym(e,t){let r=[];return e.chart.series.forEach((n,o)=>{r.push(...VC(e,t,n,o))}),r}function VC(e,t,r,n){let o=r.color??M[n%M.length],i=WC(r,e,t),a=Mn(i,t.circular,t.tension);return[zC(e,t,r,a,o),...t.strokeWidth>0?[YC(e,t,r,a,o)]:[],...t.pointSize>0?UC(e,t,r,i,o):[]]}function WC(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 zC(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:v(o,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function YC(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-series-${i.id}-${r.id}`,order:l(),bounds:a,d:n,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:v(o,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:I(i.shadowStyle)}}}function UC(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return n.map((d,c)=>({type:"ellipse",id:`chart-radar-point-${i.id}-${r.id}-${c}`,order:l(),bounds:a,cx:d.x,cy:d.y,rx:t.pointSize,ry:t.pointSize,detail:{of:"chartValue",series:r.id,valueIndex:c,mark:"radar-vertex"},prop:oe(r.id,c),style:{fill:v(o,s,i.id)}}))}function ji(e){let t=Vm(e),r=[];return r.push(...Wm(e,t)),r.push(...zm(e,t)),r.push(...Ym(e,t)),r}var jC=-Math.PI/2,XC=14,qC=4,KC=.18,Xi=1e-4;function zt(e,t,r,n){return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}}function Um(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 ZC(e,t,r,n){return`${Um(e,t,r)} ${Um(e,t,Math.max(0,n))}`}function jm(e,t,r,n,o){let i=zt(e,t,r,n),a=zt(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 QC(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 JC(e,t,r,n,o){if(n>=Math.PI*2-Xi){let l=zt(e,t,r,o),d=zt(e,t,r,o+Math.PI);return`M ${l.x} ${l.y} A ${r} ${r} 0 1 1 ${d.x} ${d.y} A ${r} ${r} 0 1 1 ${l.x} ${l.y}`}let i=zt(e,t,r,o),a=zt(e,t,r,o+n),s=n>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function ek(e){let{chart:t,plot:r}=e,n=m(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,m(t.config?.ringThickness,XC)),ringGap:Math.max(0,m(t.config?.ringGap,qC)),axisMin:n,range:m(t.axisY.max,100)-n,start:jC+m(t.config?.ringStartAngle,0)*Math.PI/180,total:Math.min(360,Math.max(1,m(t.config?.ringSweep,360)))*Math.PI/180,trackOpacity:Math.min(1,Math.max(0,m(t.config?.ringTrackOpacity,KC))),cap:t.config?.ringCap??"round"}}function tk(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:p}=t,f=I(a.shadowStyle),g=o>=Math.PI*2-Xi;if(!f||g)return[];let b=QC(f,u),y=Math.min(o,u/n);return[[p,p+y],[p+o-y,p+o]].map(([C,w],R)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${R}`,order:l(),bounds:s,d:jm(d,c,n,C,w),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:b,clip:{type:"path",d:ZC(d,c,n+u/2,n-u/2)}}}))}function rk(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:p,axisMin:f,range:g,start:b,total:y,trackOpacity:C,cap:w}=t,R=c-n*(u+p)-u/2;if(R<=u/2)return[];let $=v(r.color??M[n%M.length],a,o.id),B=Math.max(0,m(r.values[0],0)),N=g>0?Math.min(1,Math.max(0,(B-f)/g)):0,G={fill:{kind:"none"},stroke:$,strokeWidth:u,opacity:C},z=y>=Math.PI*2-Xi?{type:"ellipse",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:R,ry:R,style:G}:{type:"path",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,d:jm(l,d,R,b,b+y),style:{...G,lineCap:w}};if(N<=0)return[z];let U=N*y,he=tk(e,t,r,R,U,$),ee={type:"path",id:`chart-radial-bar-ring-${o.id}-${r.id}`,order:s(),bounds:i,d:JC(l,d,R,U,b),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:oe(r.id,0),style:{fill:{kind:"none"},stroke:$,strokeWidth:u,lineCap:w}};return[z,...he,ee]}function Xm(e){let t=ek(e);return e.chart.series.flatMap((r,n)=>rk(e,t,r,n))}function qm(e,t){let r=I(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=nk(e,t,a,s,n);return ok(e,l,r,i,n)})}function nk(e,t,r,n,o){let i={x:t.baseX+r.x0,top:t.baseY+r.sourceY0,bottom:t.baseY+r.sourceY1},a={x:t.baseX+r.x1,top:t.baseY+r.targetY0,bottom:t.baseY+r.targetY1},s=e.chart.config,l=r.color||t.nodeColors.get(r.source)||Y,d=t.nodeColors.get(r.target)||Y,c=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:n,fromId:r.source,toId:r.target,source:i,target:a,controlX:i.x+(a.x-i.x)*Math.min(1,Math.max(0,m(s?.sankeyLinkCurve,.5))),fill:c,opacity:Math.min(1,Math.max(0,m(s?.sankeyLinkOpacity,r.color?.85:.45)))}}function ok(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:ik(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 ik(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 ak=.3,sk=.78;function Km(e,t){let r=Math.max(0,m(e.chart.config?.barCornerRadius,0)),n=[];return t.nodes.forEach(o=>{n.push(lk(e,t,o,r));let i=e.showLabels?dk(e,t,o):void 0;i&&n.push(i)}),n}function lk(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||Y},shadow:I(o.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,p={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:p}:n>0&&c?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:tr(s,l,r.width,r.height,n),style:d,detail:p}:n>0&&u?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:rr(s,l,r.width,r.height,n),style:d,detail:p}:{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:p}}function dk(e,t,r){let{chart:n}=e,o=n.config?.labelPosition??"outside",i=o==="inside"?uk(e,t,r,n.config?.labelOrientation??"horizontal"):ck(e,t,r);if(!i)return;let a=n.textColor??"#0f172a",s=o==="inside"?re(r.color):Ve(r.color,Cn(a)?sk:ak)??a,l=n.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function ck(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{...P({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.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function uk(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.labelSize,p=`chart-sankey-label-${o.id}-${r.id}`;if(n==="vertical"){let f=u*1.4,g=Math.max(1,r.height-8);return Be(r.label,u,!1)>g?void 0:{...P({id:p,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{...P({id:p,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 Zm(e){let{chart:t,plot:r,showLabels:n}=e,o=n?92:0,i=Math.max(1,r.width-o*2),a=zi(mk(e),pk(e),i,r.height,{nodeWidth:Math.max(1,m(t.config?.sankeyNodeWidth,18)),nodeGap:Math.max(0,m(t.config?.sankeyNodeGap,8))});return{...a,baseX:r.x+o,baseY:r.y,labelGutter:o,fontSize:Math.max(9,m(t.fontSize,12)),labelSize:Math.max(6,m(t.config?.sankeyLabelSize,Math.max(9,m(t.fontSize,12))-2)),columnCount:Math.max(1,...a.nodes.map(s=>s.column+1)),nodeColors:new Map(a.nodes.map(s=>[s.id,s.color||Y]))}}function mk(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function pk(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?O(r.color,Y):void 0})}),t}function Qm(e){let t=Zm(e),r=[];return r.push(...qm(e,t)),r.push(...Km(e,t)),r}var fk=4;function Jm(e){let t=[],r=I(e.chart.shadowStyle);return e.chart.series.forEach((n,o)=>{let i=n.color??M[o%M.length];at(e,it(e.chart,n)).forEach((s,l)=>{t.push(hk(e,n,s,l,i,r))})}),t}function hk(e,t,r,n,o,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??fk,p=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${n}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:n},style:{fill:v(o,l,a.id),stroke:p>0?v(c?.pointStrokeColor??o,l,a.id):void 0,strokeWidth:p>0?p:void 0,opacity:c?.pointOpacity,shadow:i}}}function ep(e){let{chart:t,plot:r,showLegend:n}=e,o=Math.max(9,m(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=n&&i==="bottom"?48:0,s=Math.max(0,m(t.config?.cellGap,0));return{leaves:t.series,bands:dr(t.axisY),zones:t.config?.zones?.length?t.config.zones:lr,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,m(t.config?.barCornerRadius,s)),headerHeight:Math.max(0,m(t.config?.headerHeight,20)),labelSize:Math.max(6,m(t.config?.tileLabelSize,Math.max(8,o-1))),valueSize:Math.max(6,m(t.config?.tileValueSize,Math.max(8,o-1))),labelPadding:Math.max(0,m(t.config?.tileLabelPadding,4))}}function wr(e){return e.values[0]??0}function qi(e,t){return e.color??cr(wr(e),t.bands,t.zones)}var De=10,Dn=4,Ki=2,Zi=16,vr=34;function tp(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?gk(e,t):bk(e,t)}function Qi(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function rp(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((n,o)=>({offset:Qi(e,e.bands[o+1]??e.bands[e.bands.length-1])*100,color:n.color??Y}))}function gk(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+Zi,c=te({x:a,y:d,width:s,height:De}),u=rp(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:De,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:Y},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((g,b)=>{let y=a+Qi(t,g)*s,C={type:"path",id:`chart-treemap-legend-tick-${r.id}-${b}`,order:i(),bounds:o,d:`M ${y} ${d+De} L ${y} ${d+De+Dn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},w=b===0,R=b===t.bands.length-1,$=w?"left":R?"right":"center",B=w?y:R?y-vr:y-vr/2,N=P({id:`chart-treemap-legend-tick-label-${r.id}-${b}`,order:i(),bounds:o,frame:{x:B,y:d+De+Dn+Ki,width:vr,height:l},text:Se(g),chart:r,align:$});return[C,N]});return[p,...f]}function bk(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-Zi-De:n.x+t.gridWidth+Zi,c=te({x:d,y:s,width:De,height:l}),u=rp(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:De,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:Y},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+De,g=a==="left"?f-Dn:f+Dn,b=a==="left"?g-Ki-vr:g+Ki,y=t.bands.flatMap((C,w)=>{let R=s+(1-Qi(t,C))*l,$={type:"path",id:`chart-treemap-legend-tick-${r.id}-${w}`,order:i(),bounds:o,d:`M ${f} ${R} L ${g} ${R}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},B=P({id:`chart-treemap-legend-tick-label-${r.id}-${w}`,order:i(),bounds:o,frame:{x:b,y:R-t.fontSize/2,width:vr,height:t.fontSize+2},text:Se(C),chart:r,align:a==="left"?"right":"left"});return[$,B]});return[p,...y]}function np(e,t){let{tiles:r,headers:n}=yk(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(...Sk(e,t,a,c))}),n.forEach((a,s)=>{o.push(...xk(e,t,a,s))}),o}function yk(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:wr(c)}));return{tiles:kr(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+wr(c),0)})),o=kr(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(t.headerHeight,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(p=>(p.group??"")===l.item.key).map(p=>({leaf:p,value:wr(p)}));a.push(...kr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function xk(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:t.headerHeight,rx:t.cellRadius,style:{fill:{kind:"solid",color:l}}},c=Math.max(8,Math.max(9,o.fontSize??12)-1),u={...P({id:`chart-treemap-header-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:i.x+r.x,y:i.y+r.y+(t.headerHeight-c)/2,width:r.width,height:c+2},text:r.label,chart:o,align:"center"}),fontSize:c,color:re(l)};return[d,u]}function Sk(e,t,r,n){let o=qi(r.item.leaf,t),i=n?qi(n.item.leaf,t):void 0,a=[Ck(e,t,r,o,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...kk(e,t,r,o)),a}function Ck(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=I(i.shadowStyle),p=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),C="#94a3b8",w={minX:f,maxX:f+b,minY:g+y/2-b/2,maxY:g+y/2+b/2},R=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:O(n,C)},{offset:100,color:O(o,C)}]}:v(n,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:o?w:s,x:f,y:g,width:b,height:y,rx:t.cellRadius,style:{fill:R,stroke:{kind:"solid",color:i.config?.tileStrokeColor??i.gridColor??"#e2e8f0"},strokeWidth:m(i.config?.tileStrokeWidth,m(i.gridWidth,1)),shadow:u,clip:p?{type:"path",d:p}:void 0}}}function kk(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=t.labelPadding,p=Math.max(1,r.width-c-u*2),f=Math.max(1,r.height-c-u*1.5),g=i.x+r.x+c/2+u,b=i.y+r.y+c/2+u*.75,y=o.config?.tileTextColor??re(O(n,"#ffffff")),C=t.labelSize*1.2,w=Math.max(1,Math.floor(f/C)),R=Pe(l.label,p,t.labelSize).slice(0,w).map(z=>pn(z,p,t.labelSize,!0)),$={...P({id:`chart-treemap-label-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b,width:p,height:f},text:l.label,chart:o}),lines:R,fontSize:t.labelSize,fontWeight:"bold",color:y},B=String(d),N=R.length*C+t.valueSize*1.2<=f+2&&Be(B,t.valueSize,!1)<=p;if(o.config?.showTileValues===!1||!N)return[$];let G={...P({id:`chart-treemap-value-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b+R.length*C,width:p,height:Math.max(1,f-R.length*C)},text:String(d),chart:o}),lines:[String(d)],fontSize:t.valueSize,color:y};return[$,G]}function op(e){let t=ep(e),r=[];return r.push(...np(e,t)),r.push(...tp(e,t)),r}var Rk={bar:$u,boxplot:Gu,custom:Hu,field:Ku,heatmap:nm,hexbin:e=>um(e),line:Sm,mekko:Tm,pie:e=>Dm(e),polarArea:e=>Fm(e),radar:e=>ji(e),radial:e=>ji(e),radialBar:e=>Xm(e),sankey:Qm,scatter:Jm,treemap:op},wk=new Set(["radar","radial"]);function Ji(e){return wk.has(e)}function st(e){return Rk[e.chart.chartType](e)}function ip(e){let{chart:t,context:r,layout:n,nodes:o,renderOrder:i}=e,a=An(t,n.plot,n.bounds,i.current());o.push(...a),i.advance(a.length),o.push(...st(r));let s=wu({chart:t,plot:n.plot,bounds:n.bounds,order:i.current()});return o.push(...s),i.advance(s.length),o.push(...hu(t,n,i.current())),o}function vk(e,t){let r=ne(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function Pk(e,t){let{outerRadius:r,innerRadius:n,cornerRadius:o}=wn(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 Lk(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),n=Math.max(0,Math.min(m(e.config?.innerRadius,0),r-1)),o=Math.max(0,m(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function Tk(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...e.series.map(c=>c.values.length)),o=Tn(r,n),i=Ln(t.width,t.height,m(e.fontSize,12),e.showAxisLabels!==!1),a=t.x+t.width/2,s=t.y+t.height/2,l=e.chartType==="radial"?1:0,d=e.config?.radarTension;return{of:"radarGeometry",radarGeometry:`${a},${s},${i},${e.axisY.min},${e.axisY.max},${o},${l}${d===void 0?"":`,${d}`}`}}function Mk(e,t){return e.chartType==="pie"?Pk(e,t):e.chartType==="polarArea"?Lk(e,t):e.chartType==="radar"||e.chartType==="radial"?Tk(e,t):du.has(e.chartType)?vk(e,t):void 0}function ap(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:v(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:m(e.strokeWidth,1)}},i=Mk(e,r);return i&&(o.detail=i),o}function sp(e,t,r,n){let o=au({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:n});return r.advance(o.length),o}function lp(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 Gn=class{#e;#n=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#n++;current(){return this.#e+this.#n}advance(t){this.#n+=t}};function dp(e,t,r,n){return e.title?[{...P({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:m(e.titleSize,Math.max(10,m(e.fontSize,12))+2),prop:eu}]:[]}function cp(e,t,r){let n=2e4+t,o=cu(e),i=new Gn(n),a=[ap(e,o.bounds,o.plot,n)];return a.push(...vu(e,o.bounds,i)),a.push(...dp(e,o.bounds,o.plot,i)),a.push(...sp(e,o,i,r)),{chart:e,layout:o,nodes:a,renderOrder:i,context:lp(e,o,i,r)}}function up(e){return e.nodes.push(...st(e.context)),e.nodes}function mp(e){return e.nodes.push(...st(e.context)),e.nodes}function pp(e,t,r){if(e.isVisible===!1)return[];let n=cp(e,t,r);return Ji(e.chartType)?up(n):nt(e)?ip(n):mp(n)}function ea(e,t){return e.flatMap((r,n)=>q(pp(r,n,t),"chart",r.id,r.chartType,r.title??"Chart"))}function $k(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))}:Xo}function Ak(e){let t=new Map,r=(n,o,i)=>{o.forEach((a,s)=>{t.set(`${n}:${a.id}`,{rank:cd(a),sequence:ud(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.components??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),r("dimension",e.dimensions??[],31e3),t}function Ek(e,t){let r=Ak(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 ta(e,t={}){let{measureText:r}=t,n=[...e.diagnostics??[]],o=[...$d(e),...Pc(e.paths??[]),...ea(e.charts??[],n),...vc(e.links,r),...Yc(e.shapes,n,r),...qo(e.components??e.widgets??[]),..._d(e.isometricObjects??[]),...Nd(e.dimensions??[])];return Ek(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:$k(o),diagnostics:n}}var L=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),h=e=>Number(e.toFixed(3)).toString(),Ce=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var _n=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=Ce(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,n);let o=t.clip,i=o.type==="path"?`<path clip-rule="evenodd" d="${L(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 Fn=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,Bk);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,Nk,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},Ok)}define(t,r,n,o=.5){let i=JSON.stringify(r)+n.name+o,a=this.ids.get(i);return a||(a=Ce(`${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 Nk(e){return`<feDropShadow dx="${h(e.dx)}" dy="${h(e.dy)}" stdDeviation="${h(e.blur/2)}" flood-color="${L(e.color)}" flood-opacity="${h(e.opacity)}"/>`}function Ok(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 Bk(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="${L(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 fp(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 Ik(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function Dk(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 Hn=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=Ce(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(o,i);let a=12+(n-2)*3,s=Ik(t,a,n),l=Dk(i,s);return this.addDefinition(`<marker ${l}>${fp(t,a,L(r),n)}</marker>`),i}};function Gk(e,t){let r=t.points.map((i,a)=>Ce(`${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="${L(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${L(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="${L(t.points[0]?.color??"transparent")}"/>${o}</pattern>`}function _k(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="${L(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 Vn=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=Ce(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(o,i);let a=t.kind==="mesh-gradient"?Gk(i,t):_k(i,t,n);this.addDefinition(a)}return`url(#${i})`}};var Wn=class{constructor(t){this.prefix=t;let r=n=>{this.entries.push(n)};this.paints=new Vn(r,t),this.filters=new Fn(r,t),this.markers=new Hn(r,t),this.clips=new _n(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return Ce(`${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 Fk(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 hp(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,Fk(t,t.identity.id)]:[t])}function gp(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 bp(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="${L(n)}"`,`stroke="${L(r)}"`];return Hk(o,e.style),yp(o,e,t),Wk(o,e,t),o.join(" ")}function Hk(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 Vk(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 yp(e,t,r){let n=r.filter(t.style,t.id,Vk(t));n&&e.push(`filter="url(#${n})"`);let o=r.clip(t.style);o&&e.push(`clip-path="url(#${o})"`)}function Wk(e,t,r){if(t.type!=="path")return;let n=r.marker(t.markerStart,gp(t.style,"start"),t.style.strokeWidth??1),o=r.marker(t.markerEnd,gp(t.style,"end"),t.style.strokeWidth??1);n&&e.push(`marker-start="url(#${n})"`),o&&e.push(`marker-end="url(#${o})"`)}function ze(e,t){return e&&t?` transform="rotate(${h(e)} ${h(t.x)} ${h(t.y)})"`:""}function xp(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}"`),yp(r,e,t),r.join(" ")}var Sp="data-sf-symbol-points",Cp="data-sf-symbol-tension",zn="data-sf-symbol-bounds",Pr="data-sf-corner-radius",kp="data-sf-square-corner",Yn="data-sf-path-points",Un="data-sf-path-tension",jn="data-sf-path-closed",Rp="data-sf-path-point",Xn="data-sf-isometric-size",qn="data-sf-isometric-label-offset";function zk(e){return e.role==="shape"?"entity":e.role}function Yk(e){return[`role="${L(e.role)}"`,e.checked===void 0?void 0:`aria-checked="${e.checked}"`,e.pressed===void 0?void 0:`aria-pressed="${e.pressed}"`,e.disabled?'aria-disabled="true"':void 0]}function Uk(e){return[`data-sf-role="${zk(e)}"`,`data-sf-id="${L(e.id)}"`,e.kind?`data-sf-kind="${L(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${L(e.parentFrameId)}"`:void 0,...e.aria?Yk(e.aria):[]]}function jk(e){switch(e.of){case"chartValue":return Xk(e);case"chartScale":return Zk(e);case"chartSeries":return Qk(e);case"pieGeometry":return qk(e);case"radarGeometry":return Kk(e);case"link":return nR(e);case"frameBoundary":return Jk(e);case"symbolGeometry":return eR(e);case"declaredBounds":return[ra(e.bounds)];case"pathGeometry":return tR(e);case"isometricGeometry":return rR(e)}}function Xk(e){return[`data-sf-series="${L(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="${L(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 qk(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function Kk(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function Zk(e){return[`data-sf-value-scale="${e.valueScale}"`]}function Qk(e){return[`data-sf-series="${L(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${h(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${L(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 Jk(e){return[`${Pr}="${h(e.cornerRadius)}"`,`${kp}="${e.squareCorner}"`]}function ra(e){return`${zn}="${h(e.x)},${h(e.y)},${h(e.width)},${h(e.height)}"`}function eR(e){return[`${Sp}="${L(JSON.stringify(e.points))}"`,`${Cp}="${h(e.tension)}"`,ra(e.declaredBounds)]}function tR(e){return[`${Yn}="${L(JSON.stringify(e.points))}"`,`${Un}="${h(e.tension)}"`,`${jn}="${e.closed}"`]}function rR(e){return[`${Xn}="${h(e.width)},${h(e.height)},${h(e.depth)}"`,`${Pr}="${h(e.cornerRadius)}"`,ra(e.bounds),`${qn}="${h(e.labelOffsetX)},${h(e.labelOffsetY)}"`]}function nR(e){return[e.fromId?`data-sf-from="${L(e.fromId)}"`:void 0,e.toId?`data-sf-to="${L(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="${L(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 lt(e){let t=e.identity?.label,r=[...e.identity?Uk(e.identity):[],...e.detail?jk(e.detail):[],e.prop?`data-sf-prop="${L(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="${L(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="${L(t.replace(/\s+/g," ").trim())}"`:void 0].filter(n=>n!==void 0);return r.length?` ${r.join(" ")}`:""}function oR(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"}">${L(i.text)}</tspan>`).join("")}function wp(e,t){let r=iR(e),n=`${h(e.fontSize)}px`,o=sR(e,r,n),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${lt(e)} x="${h(r.x)}" y="${h(r.firstY)}" font-family="${L(e.fontFamily)}" font-size="${n}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${h(e.letterSpacing)}"`:""} fill="${L(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${h(e.lineHeight)}"${i}${ze(e.rotation,e.rotationCenter)}>${o}</text>`}function iR(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:aR(e,n),linePx:t,anchor:i}}function aR(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 sR(e,t,r){return e.richLines?e.richLines.map((n,o)=>oR(n,t.x,vp(o,t.linePx),r)).join(""):e.lines.map((n,o)=>lR(n,o,t,r)).join("")}function lR(e,t,r,n){return`<tspan x="${h(r.x)}" font-size="${n}"${vp(t,r.linePx)}>${L(e)}</tspan>`}function vp(e,t){return e?` dy="${h(t)}px"`:""}function dR(e,t){let r=ze(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=L(JSON.stringify(e.shader.parameters)),o=e.fillColor?` data-sf-shader-fill="${L(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${lt(e)} data-sf-shader="${L(e.shader.program)}" data-sf-shader-name="${L(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"||e.identity?.role==="widget"?"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 cR(e,t){let r=t.componentStyle;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:${L(r.color)};font-weight:${L(r.fontWeight)};line-height:1">${L(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 ${L(r.divider)};border-radius:.09em;background:${L(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:${L(r.color)};font-weight:300;line-height:1">${L(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${L(r.divider)};pointer-events:none"></span></span>`}function uR(e,t){let r=ze(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=e.componentStyle.fontSize>0?e.componentStyle.fontSize: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:${L(e.componentStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${L(e.label)}</span>`:"",i=[...e.value].map(s=>cR(s,e)).join(""),a=L(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${lt(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${L(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:${L(e.componentStyle.fontFamily)};font-size:${h(n)}px">${o}<div data-sf-rolling-digits="true" aria-label="${L(e.value)}" style="display:flex;gap:${e.componentStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function Pp(e,t){if(e.type==="text")return wp(e,t);if(e.type==="shader-surface")return dR(e,t);if(e.type==="rolling-number")return uR(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${lt(e)} ${xp(e,t)} href="${L(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)}"${lt(e)} ${bp(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)}"`:""}${ze(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)}"${ze(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${L(e.d)}"${ze(e.rotation,e.rotationCenter)}/>`}function Lp(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 Wn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?hp(e.nodes):e.nodes).map(u=>Pp(u,a)).join(`
|
|
14
14
|
`);return{svg:`${t.includeXmlDeclaration===!1?"":`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
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
16
|
<defs>${a.entries.join("")}</defs>
|
|
17
17
|
${l}
|
|
18
|
-
</svg>`,width:n,height:o,diagnostics:e.diagnostics}}function Gn(e,t={}){return qm(e,t)}function $R(e,t={}){let r=Bi(e,{measureText:t.measureText}),{svg:n,width:o,height:i,diagnostics:a}=Gn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var MR=50,He=new Map,Km=Lr();function AR(e){let t=Lr();t!==Km&&(He.clear(),Km=t);let r=He.get(e);if(r)return He.delete(e),He.set(e,r),r;let n=Bi(Ao(e));if(He.set(e,n),He.size>MR){let o=He.keys().next().value;o!==void 0&&He.delete(o)}return n}function Dn(e,t={}){if(t.measureText)return $R(Ao(e),t);let r=AR(e),{svg:n,width:o,height:i,diagnostics:a}=Gn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var Gi="http://www.w3.org/1999/xhtml",_n=(e,t)=>{Object.assign(e.style,t)};function Fn(e,t,r){let n=e.createElementNS(Gi,"span");return n.setAttribute("data-sf-rolling-current","true"),n.textContent=t,_n(n,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),n}function ER(e,t,r){let n=e.createElementNS(Gi,"span");if(n.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return _n(n,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),n.appendChild(Fn(e,t,r)),n;_n(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(Fn(e,t,r));let o=e.createElementNS(Gi,"span");return _n(o,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),n.appendChild(o),n}function Hn(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 NR(e,t,r,n){let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Fn(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=Hn(i,[a,s],n),d=o?Hn(o,[s,a],n):null,c=()=>{o?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function OR(e,t,r,n){if(r.motion==="fade"){NR(e,t,r,n);return}let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Fn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Hn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],n),s=o?Hn(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 Zm(e,t,r,n,o){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>ER(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&&OR(i[s],a,n,o)}),e.setAttribute("aria-label",r)}function Di(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var BR=140;function IR(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Qm(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return j;try{return{...j,...JSON.parse(t)}}catch{return j}}function GR(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function DR(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 Vn(e,t,r){let n=IR(e);if(!n)return!1;let o=e.getAttribute("data-sf-widget-value")??"",i=Wt(t,GR(e.getAttribute("data-sf-widget-digits")));return o===i||(Zm(n,o,i,Qm(e),r?DR(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function _i(e){let t=new Map,r=new Map,n=new Map;return{setValue(o,i){let a=Di(e,o);if(!a)return!1;if(t.set(o,i),Qm(a).motion!=="fade")return Vn(a,i,!0);let s=Date.now(),l=(r.get(o)??0)+BR-s;return l<=0?(r.set(o,s),Vn(a,i,!0)):(n.has(o)||n.set(o,setTimeout(()=>{n.delete(o),r.set(o,Date.now());let d=Di(e,o),c=t.get(o);d&&c!==void 0&&Vn(d,c,!0)},l)),!0)},refresh(){for(let[o,i]of t){let a=Di(e,o);a&&Vn(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 Jm=new WeakMap,ep=new WeakMap,tp=new WeakMap;function Vi(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function rp(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function Fi(e,t){return Number(e)>0?Number(e):t}function np(e,t){let r=rp(e),n=Number(r.min)||0,o=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return Vi(o===n?0:(t-n)/(o-n))}function Hi(e,t,r){let n=e.getAttribute("transform")??"",o=n===ep.get(e)?Jm.get(e)??"":n;Jm.set(e,o);let i=`translate(${t} ${r}) ${o}`.trim();ep.set(e,i),e.setAttribute("transform",i)}function op(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]}var _R=[255,255,255];function FR(e,t,r){let n=tp.get(e)??e.getAttribute("fill")??"";tp.set(e,n);let o=op(n);if(!o)return;let i=o.map((s,l)=>Math.round(s+(r[l]-s)*t)),a=`rgb(${i[0]}, ${i[1]}, ${i[2]})`;e.style.fill=a;for(let s of e.querySelectorAll("tspan"))s.style.fill=a}function ip(e,t){let r=new Map;for(let n of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let o=rp(n),i=(typeof o.peak=="string"?op(o.peak):null)??_R,a=n.getAttribute("data-sf-id")??"",s=Number(n.getAttribute("x")),l=Number(n.getAttribute("y")),d=Number(n.getAttribute("width")),c=Number(n.getAttribute("height")),u=o.axis==="horizontal",p=Vi(t(a)??Number(o.progress)),f=Fi(o.inset,.05),g=Fi(o.line,.7),b=u?d:c,x=u?c:d,C=f+(1-2*f)*p,L=o.dent===void 0?1:Number(o.dent),v=(L<0?1:L)*.16*x,M=typeof o.knob=="string"?o.knob:"";if(M){let be=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(M)}"]`)],Oe=be.find(ie=>ie.hasAttribute("data-sf-primary"));if(Oe?.getBBox){Hi(Oe,0,0);let ie=Oe.getBBox(),Vt=(u?ie.height:ie.width)/2;r.set(a,Vt/x);let vr=(o.gap===void 0?.04:Number(o.gap))*x,wa=g*x-v+Vt+vr,va=u?{x:s+d*C,y:l+wa}:{x:s+wa,y:l+c*(1-C)},bf=va.x-(ie.x+ie.width/2),yf=va.y-(ie.y+ie.height/2);for(let xf of be)Hi(xf,bf,yf)}}let H=Number(o.min)||0,I=Number.isFinite(Number(o.max))&&o.max!==void 0?Number(o.max):100,V=Fi(o.spread,.07)*b,U=f*b,ne=(1-2*f)*b,Ne=U+ne*p;for(let be of e.querySelectorAll(`text[data-sf-id="${CSS.escape(a)}"]`)){let Oe=Number(be.textContent);if(!Number.isFinite(Oe)||I===H)continue;let ie=U+ne*Vi((Oe-H)/(I-H)),Vt=Math.exp(-(((ie-Ne)/V)**2)),vr=v*.4*Vt;Hi(be,u?0:-vr,u?-vr:0),FR(be,Vt,i)}}return r}var ap=new Set(["viewbox","width","height"]);function sp(e,t){for(let r of Array.from(e.attributes))ap.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))ap.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function lp(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 dp(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 HR(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 up(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(!up(s,l))return!1}return!0}function cp(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function mp(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=HR(e,t),o=!1;return r&&(o=!0,cp(e,t)),t.tagName.toLowerCase()==="text"&&!up(e,t)&&(o=!0,cp(e,t)),n||o}function Sr(e){return e.getAttribute("data-sf-id")??e.id}function VR(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function WR(e,t,r){return e&&e.tagName===t.tagName?(mp(e,t)&&r(Sr(t)),e):(e?.remove(),r(Sr(t)),t)}function zR(e,t,r){let n=r?r.nextSibling:e.firstChild;n!==t&&e.insertBefore(t,n)}function pp(e,t){let r=dp(e,t),n=VR(e),o=new Set,i=new Set;for(let c of n.values())i.add(Sr(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(Sr(c));let u=WR(n.get(c.id),c,l);zR(e,u,d),d=u}for(let[c,u]of n)o.has(c)||(s.add(Sr(u)),u.remove());return lp(i,a,s)}function fp(e,t){return sp(e,t),pp(e,t)}function Wi(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 Cr(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 Wn=class{#e;#n;#t;constructor(t,r){this.#e=t,this.#n=r,this.#t={...r}}apply(){this.#e.setAttribute("viewBox",`${this.#t.x} ${this.#t.y} ${this.#t.w} ${this.#t.h}`)}fit(){this.#t={...this.#n},this.apply()}get(){return{...this.#t}}setNatural(t){this.#n=t}#r(t,r){let n=this.#e.getScreenCTM();if(!n)return null;let o=new DOMPoint(t,r).matrixTransform(n.inverse());return{x:o.x,y:o.y}}zoomBy(t,r,n){let o=this.#e.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.#r(i,a);this.#t={...this.#t,w:this.#t.w/t,h:this.#t.h/t},this.apply();let l=s?this.#r(i,a):null;s&&l&&(this.#t.x+=s.x-l.x,this.#t.y+=s.y-l.y),this.apply()}panBy(t,r){let n=this.#e.getScreenCTM()?.a,o=n&&n>0?n:1;this.#t.x-=t/o,this.#t.y-=r/o,this.apply()}};function hp(e,t){let r=Wi(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let n=new Wn(r,Cr(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=Wi(o),a=fp(r,i);return n.setNatural(Cr(i)),a},destroy(){r.remove()}}}var zn=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 Yn=class extends zn{};function YR(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function UR(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 jR(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 zi(e,t,r={}){let n=Cr(e),o=YR(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 UR(e.ownerDocument,c),p=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);p&&(l.fillStyle=p,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await jR(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var Yi="http://www.w3.org/2000/svg";function XR(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function qR(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function Rr(e,t,r){let n=e.createElementNS(Yi,t);for(let[o,i]of Object.entries(r))n.setAttribute(o,String(i));return n}function KR(e){try{return{...j,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return j}}function ZR(e,t,r=0){let n=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:n,plain:t,cellWidth:t?n*.62:n*.72+2,cellHeight:t?n*1.1:n*1.2+2,gap:n*(t?.02:.1)}}function QR(e,t,r){let n=Rr(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 JR(e,t,r,n,o,i){let a=Rr(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 ek(e,t,r,n,o,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=o,c=[];s||c.push(Rr(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=Rr(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(Rr(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 tk(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=KR(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=ZR(n,i.variant==="plain",i.fontSize),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,p=QR(t,r,i);a&&p.appendChild(JR(t,a,n,u,s,i)),[...o].forEach((f,g)=>{let b=c+g*(s.cellWidth+s.gap);for(let x of ek(t,f,b,u,s,i))p.appendChild(x)}),r.replaceWith(p)}}function gp(e,t){let r=e.cloneNode(!0);qR(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(Yi,"image");XR(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),tk(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",Yi),r}function Ui(e,t){return new XMLSerializer().serializeToString(gp(e,t))}var bp="http://www.w3.org/2000/svg";var ji=new Set([]);function D(e,t){return e.createElementNS(bp,t)}function Pe(e,t,r){let n=D(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 rk="data-sf-change-overlay",kr="#f59e0b",Un=1300,Xi=400;function yp(e,t,r){let n=D(e,"g");n.setAttribute(rk,t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}function qi(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:Un,easing:"linear",fill:"forwards"})}function Ki(e,t,r,n=kr){let o=t.getBBox(),i=yp(e,r,t),a=D(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 Zi(e,t,r,n=kr){let o=yp(e,r,t),i=D(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 _t(e){return e.ctrlKey||e.metaKey}function jn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Xn(e){return e===1}var nk=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function ok(e){return e==="entity"?"shape":e}function Ve(e){let t=e.getAttribute(An);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 Qi(e){let t=e.getAttribute(En);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(Nn))||0,closed:e.getAttribute(On)==="true"}}function Ji(e){let t=e.getAttribute(Bn);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(xr))||0,[a,s]=(e.getAttribute(In)??"0,0").split(",").map(Number);return{width:r,height:n,depth:o,cornerRadius:i,bounds:Ve(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function We(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||!nk.has(n)?null:{role:ok(n),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function it(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 at=e=>e.hasAttribute("data-sf-primary");function ea(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 A(e,t){return t/ea(e)}var qn=6,ik=14,ta=3,ra=1.5;function ak(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 sk(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var xp="#e8e8e8",Sp="#ccc",lk="#9b42df",dk="#7c2fb5",ck=1.2;function na(e,t,r,n,o,i){let a=D(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(n)),a.setAttribute("fill",xp),a.setAttribute("stroke",Sp),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*ck)),a.setAttribute("fill",lk),a.setAttribute("stroke",dk),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(n)),a.setAttribute("fill",xp),a.setAttribute("stroke",Sp),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function oa(e,t,r,n,o){let i=D(e,"path");return i.setAttribute("d",sk(t,r,n)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(o)),i.setAttribute("stroke-linecap","round"),i}function Kn(e,t,r,n){let o=Pe(e,r,t),i=A(n,qn),a=i+A(n,ik),s=A(n,ta),l=A(n,ra),d=Ve(t)??t.getBBox();for(let[c,u,p]of ak(d,a))o.append(na(e,c,u,i,l,p),oa(e,c,u,s,l));return o}var sa="#9b42df",uk=2,mk=3.25,pk=14,Rp=34,fk=10.5,hk=8.5;function Cp(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function gk(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 la(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 da="data-sf-iso-halo";function bk(e,t,r,n){let o=D(e,"g");o.setAttribute("data-sf-resize-handle",`iso-${t}`),o.style.cursor=gk(r);let i=D(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(A(n,pk))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",o.appendChild(i);let a=D(e,"line");a.setAttribute("stroke",sa),a.setAttribute("stroke-width",String(A(n,mk))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",o.appendChild(a);let s=D(e,"polygon");return s.setAttribute("fill",sa),s.style.pointerEvents="none",o.appendChild(s),{group:o,hit:i,shaft:a,head:s}}function yk(e,t,r,n){let o=A(n,Rp),i=A(n,fk),a=A(n,hk),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 ia(e,t,r,n,o){let i=bk(e,n,r,o);return yk(i,t,r,o),i.group}function Zn(e){let t=Ye(e),r=t.top[0],n=t.top[1],o=t.top[3],i=t.front[2];return{width:{origin:la(t.right),direction:Cp({x:n.x-r.x,y:n.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:la(t.front),direction:Cp({x:o.x-r.x,y:o.y-r.y})}}}var xk=Rp+qn+10;function aa(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function ca(e){let t=Ye(e),r=Zn(e),n=la([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:aa(r.width.origin,n),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:aa(r.depth.origin,n),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:aa(r.height.origin,n),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var ua="data-sf-iso-duplicate-bubbles",Sk=["iso-height-neg","iso-depth-pos","iso-width-pos"];function ma(e,t,r){let n=D(e,"g");n.setAttribute(ua,"");let o=A(r,qn),i=A(r,xk),a=A(r,ta),s=A(r,ra),l=ca(t);for(let d of Sk){let{origin:c,direction:u}=l[d],p=c.x+u.x*i,f=c.y+u.y*i;n.append(na(e,p,f,o,s,d),oa(e,p,f,a,s))}return n}function Qn(e,t,r,n){let o=Ve(t)??t.getBBox(),i=Ji(t),a=Pe(e,r,t),s=D(e,"path");s.setAttribute(da,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",sa);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+A(n,uk))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=Zn({x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0});return a.appendChild(ia(e,d.width.origin,d.width.direction,"width",n)),a.appendChild(ia(e,d.height.origin,d.height.direction,"height",n)),a.appendChild(ia(e,d.depth.origin,d.depth.direction,"depth",n)),a.appendChild(ma(e,{x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0},n)),a}var pa="#9b42df",Ck=4,Rk=5,wp=1.5;function kk(e,t,r){let n=D(e,"path");n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",pa);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,Ck))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function kp(e,t,r,n,o){let i=t.getPointAtLength(r),a=D(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(A(o,Rk))),a.setAttribute("fill",pa),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(A(o,wp))),a.setAttribute("data-sf-link-endpoint",n),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var wk=22,vk=8;function Pk(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function Lk(e,t,r){let n=[];return Pk(t).forEach((o,i)=>{if(!o.movable)return;let a=Math.abs(o.bx-o.ax)>Math.abs(o.by-o.ay),s=A(r,wk),l=A(r,vk),d=a?s:l,c=a?l:s,u=D(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",pa),u.setAttribute("stroke-width",String(A(r,wp))),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 Jn(e,t,r,n){let o=Pe(e,r,t),i=t.getTotalLength();return o.append(kk(e,t,n),...Lk(e,t,n),kp(e,t,0,"from",n),kp(e,t,i,"to",n)),o}var vp="#9b42df",Tk=4,$k=5,Mk=1.5,fa="data-sf-path-halo";function Ak(e,t,r){let n=D(e,"path");n.setAttribute(fa,""),n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",vp);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,Tk))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function Ek(e,t,r,n,o){let i=D(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(A(o,$k))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",vp),i.setAttribute("stroke-width",String(A(o,Mk))),i.setAttribute(Ym,String(n)),i.style.pointerEvents="auto",i.style.cursor="move",i}function eo(e,t,r,n){let o=Pe(e,r,t);o.appendChild(Ak(e,t,n));let i=Qi(t);for(let[a,[s,l]]of(i?.points??[]).entries())o.appendChild(Ek(e,s,l,a,n));return o}var Nk=6,Ok=1,Bk="#992dff",Ik={"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 ha(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 Gk=new Set(["top","bottom"]);function Pp(e,t,r,n=!1){let o=A(r,Nk),i=A(r,Ok);return(n?ha(t).filter(([,,s])=>!Gk.has(s)):ha(t)).map(([s,l,d])=>{let c=D(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",Bk),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=n?"ew-resize":Ik[d],c})}var Dk="#9b42df",_k=3,Fk=1;function to(e,t,r,n,o=!1){let i=Ve(t)??t.getBBox(),a=Pe(e,r,t),s=A(n,Fk),l=D(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",Dk),l.setAttribute("stroke-width",String(A(n,_k))),a.appendChild(l),a.append(...Pp(e,i,n,o)),a}function Lp(e){let t=new Map;return{flash:(n,o=kr)=>{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=it(e,l,at);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"?Zi(a,d,l,o):Ki(a,d,l,o);e.appendChild(u),qi(u,s);let p=s?Xi:Un;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},p))}},destroy(){for(let n of t.values())clearTimeout(n);t.clear()}}}function Tp(e,t,r){let n=o=>{r&&o.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}function ga(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function $p(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 Mp(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var zk="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function ba(e){return!!e?.closest(zk)}var ro=class{#e;#n;#t;#r;constructor(t,r,n,o){this.#e=t,this.#n=r,this.#t=n,this.#r=o}hover(t){let r=We(t.target);this.#n.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:ga(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,n=We(r);if(!n){this.#o(r);return}this.#i(n,t)}#o(t){ba(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let n=ga(r);this.#r.dispatch(Mp(t.id,n)),this.#n.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:n});let o=it(this.#e,t.id,at);o&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","-1"),o?.focus({preventScroll:!0})}};var Yk=4,ya=class{#e;#n;#t;#r=null;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}bind(){return this.#e.svg.addEventListener("pointerdown",this.#o),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#o=t=>{let r=t.target,n=!!We(r)||ba(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:_t(t)||!n}};#i=t=>{this.#a(t)||this.#t&&this.#n.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#n.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>Yk&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&_t(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#o),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function Ap(e){let{display:t,emitter:r,diagramId:n,selection:o,selectable:i}=e,a=new ro(t.svg,r,n,o);return new ya(t,a,i).bind()}function xa(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=it(e,o,at);if(!i)continue;let a=r.get(o),s=a?.role==="link"?Jn(n,i,o,e):a?.role==="path"?eo(n,i,o,e):a?.role==="isometric"?Qn(n,i,o,e):to(n,i,o,e,a?ji.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Kn(n,i,o,e))}}var no=class{#e;#n;#t;#r=new Map;#o=new Set;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=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=$p(this.#o,t),xa(this.#e,this.#o,this.#r),this.#n.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#o.size>0&&xa(this.#e,this.#o,this.#r)}selectIds(t){for(let r of t){let n=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),o=We(n);o&&this.remember(o)}this.dispatch({type:"set",ids:t})}};function Ep(e,t){let r=n=>{_t(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 Np(e,t,r,n={}){let o=n.selectable??!0,i=new no(e.svg,t,r),a=Ap({display:e,emitter:t,diagramId:r,selection:i,selectable:o}),s=Ep(e,i),l=Tp(e.svg,i,o),d=Lp(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 Sa={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 Uk=`
|
|
18
|
+
</svg>`,width:n,height:o,diagnostics:e.diagnostics}}function Kn(e,t={}){return Lp(e,t)}function pR(e,t={}){let r=ta(e,{measureText:t.measureText}),{svg:n,width:o,height:i,diagnostics:a}=Kn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var fR=50,Ye=new Map,Tp=Or();function hR(e){let t=Or();t!==Tp&&(Ye.clear(),Tp=t);let r=Ye.get(e);if(r)return Ye.delete(e),Ye.set(e,r),r;let n=ta(jo(e));if(Ye.set(e,n),Ye.size>fR){let o=Ye.keys().next().value;o!==void 0&&Ye.delete(o)}return n}function Zn(e,t={}){if(t.measureText)return pR(jo(e),t);let r=hR(e),{svg:n,width:o,height:i,diagnostics:a}=Kn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var na="http://www.w3.org/1999/xhtml",Qn=(e,t)=>{Object.assign(e.style,t)};function Jn(e,t,r){let n=e.createElementNS(na,"span");return n.setAttribute("data-sf-rolling-current","true"),n.textContent=t,Qn(n,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),n}function gR(e,t,r){let n=e.createElementNS(na,"span");if(n.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return Qn(n,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),n.appendChild(Jn(e,t,r)),n;Qn(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(Jn(e,t,r));let o=e.createElementNS(na,"span");return Qn(o,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),n.appendChild(o),n}function eo(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 bR(e,t,r,n){let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Jn(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=eo(i,[a,s],n),d=o?eo(o,[s,a],n):null,c=()=>{o?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function yR(e,t,r,n){if(r.motion==="fade"){bR(e,t,r,n);return}let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Jn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=eo(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],n),s=o?eo(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 Mp(e,t,r,n,o){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>gR(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&&yR(i[s],a,n,o)}),e.setAttribute("aria-label",r)}function oa(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var xR=140;function SR(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function $p(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return X;try{return{...X,...JSON.parse(t)}}catch{return X}}function CR(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function kR(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 to(e,t,r){let n=SR(e);if(!n)return!1;let o=e.getAttribute("data-sf-widget-value")??"",i=Xt(t,CR(e.getAttribute("data-sf-widget-digits")));return o===i||(Mp(n,o,i,$p(e),r?kR(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function ia(e){let t=new Map,r=new Map,n=new Map;return{setValue(o,i){let a=oa(e,o);if(!a)return!1;if(t.set(o,i),$p(a).motion!=="fade")return to(a,i,!0);let s=Date.now(),l=(r.get(o)??0)+xR-s;return l<=0?(r.set(o,s),to(a,i,!0)):(n.has(o)||n.set(o,setTimeout(()=>{n.delete(o),r.set(o,Date.now());let d=oa(e,o),c=t.get(o);d&&c!==void 0&&to(d,c,!0)},l)),!0)},refresh(){for(let[o,i]of t){let a=oa(e,o);a&&to(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 Ap=new WeakMap,Ep=new WeakMap,Np=new WeakMap;function la(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Op(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function aa(e,t){return Number(e)>0?Number(e):t}function Bp(e,t){let r=Op(e),n=Number(r.min)||0,o=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return la(o===n?0:(t-n)/(o-n))}function sa(e,t,r){let n=e.getAttribute("transform")??"",o=n===Ep.get(e)?Ap.get(e)??"":n;Ap.set(e,o);let i=`translate(${t} ${r}) ${o}`.trim();Ep.set(e,i),e.setAttribute("transform",i)}function Ip(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]}var RR=[255,255,255];function wR(e,t,r){let n=Np.get(e)??e.getAttribute("fill")??"";Np.set(e,n);let o=Ip(n);if(!o)return;let i=o.map((s,l)=>Math.round(s+(r[l]-s)*t)),a=`rgb(${i[0]}, ${i[1]}, ${i[2]})`;e.style.fill=a;for(let s of e.querySelectorAll("tspan"))s.style.fill=a}function Dp(e,t){let r=new Map;for(let n of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let o=Op(n),i=(typeof o.peak=="string"?Ip(o.peak):null)??RR,a=n.getAttribute("data-sf-id")??"",s=Number(n.getAttribute("x")),l=Number(n.getAttribute("y")),d=Number(n.getAttribute("width")),c=Number(n.getAttribute("height")),u=o.axis==="horizontal",p=la(t(a)??Number(o.progress)),f=aa(o.inset,.05),g=aa(o.line,.7),b=u?d:c,y=u?c:d,C=f+(1-2*f)*p,w=o.dent===void 0?1:Number(o.dent),R=(w<0?1:w)*.16*y,$=typeof o.knob=="string"?o.knob:"";if($){let ee=[...e.querySelectorAll(`[data-sf-id="${CSS.escape($)}"]`)],ge=ee.find(Q=>Q.hasAttribute("data-sf-primary"));if(ge?.getBBox){sa(ge,0,0);let Q=ge.getBBox(),Ge=(u?Q.height:Q.width)/2;r.set(a,Ge/y);let Er=(o.gap===void 0?.04:Number(o.gap))*y,za=g*y-R+Ge+Er,Ya=u?{x:s+d*C,y:l+za}:{x:s+za,y:l+c*(1-C)},qf=Ya.x-(Q.x+Q.width/2),Kf=Ya.y-(Q.y+Q.height/2);for(let Zf of ee)sa(Zf,qf,Kf)}}let B=Number(o.min)||0,N=Number.isFinite(Number(o.max))&&o.max!==void 0?Number(o.max):100,G=aa(o.spread,.07)*b,z=f*b,U=(1-2*f)*b,he=z+U*p;for(let ee of e.querySelectorAll(`text[data-sf-id="${CSS.escape(a)}"]`)){let ge=Number(ee.textContent);if(!Number.isFinite(ge)||N===B)continue;let Q=z+U*la((ge-B)/(N-B)),Ge=Math.exp(-(((Q-he)/G)**2)),Er=R*.4*Ge;sa(ee,u?0:-Er,u?-Er:0),wR(ee,Ge,i)}}return r}var Gp=new Set(["viewbox","width","height"]);function _p(e,t){for(let r of Array.from(e.attributes))Gp.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))Gp.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function Fp(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 Hp(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 vR(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 Wp(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(!Wp(s,l))return!1}return!0}function Vp(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function zp(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=vR(e,t),o=!1;return r&&(o=!0,Vp(e,t)),t.tagName.toLowerCase()==="text"&&!Wp(e,t)&&(o=!0,Vp(e,t)),n||o}function Lr(e){return e.getAttribute("data-sf-id")??e.id}function PR(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function LR(e,t,r){return e&&e.tagName===t.tagName?(zp(e,t)&&r(Lr(t)),e):(e?.remove(),r(Lr(t)),t)}function TR(e,t,r){let n=r?r.nextSibling:e.firstChild;n!==t&&e.insertBefore(t,n)}function Yp(e,t){let r=Hp(e,t),n=PR(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=LR(n.get(c.id),c,l);TR(e,u,d),d=u}for(let[c,u]of n)o.has(c)||(s.add(Lr(u)),u.remove());return Fp(i,a,s)}function Up(e,t){return _p(e,t),Yp(e,t)}function da(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 Tr(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 ro=class{#e;#n;#t;constructor(t,r){this.#e=t,this.#n=r,this.#t={...r}}apply(){this.#e.setAttribute("viewBox",`${this.#t.x} ${this.#t.y} ${this.#t.w} ${this.#t.h}`)}fit(){this.#t={...this.#n},this.apply()}get(){return{...this.#t}}setNatural(t){this.#n=t}#r(t,r){let n=this.#e.getScreenCTM();if(!n)return null;let o=new DOMPoint(t,r).matrixTransform(n.inverse());return{x:o.x,y:o.y}}zoomBy(t,r,n){let o=this.#e.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.#r(i,a);this.#t={...this.#t,w:this.#t.w/t,h:this.#t.h/t},this.apply();let l=s?this.#r(i,a):null;s&&l&&(this.#t.x+=s.x-l.x,this.#t.y+=s.y-l.y),this.apply()}panBy(t,r){let n=this.#e.getScreenCTM()?.a,o=n&&n>0?n:1;this.#t.x-=t/o,this.#t.y-=r/o,this.apply()}};function jp(e,t){let r=da(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let n=new ro(r,Tr(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=da(o),a=Up(r,i);return n.setNatural(Tr(i)),a},destroy(){r.remove()}}}var no=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 oo=class extends no{};function MR(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function $R(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 AR(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 ca(e,t,r={}){let n=Tr(e),o=MR(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 $R(e.ownerDocument,c),p=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);p&&(l.fillStyle=p,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await AR(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var ua="http://www.w3.org/2000/svg";function ER(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function NR(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function Mr(e,t,r){let n=e.createElementNS(ua,t);for(let[o,i]of Object.entries(r))n.setAttribute(o,String(i));return n}function OR(e){try{return{...X,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return X}}function BR(e,t,r=0){let n=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:n,plain:t,cellWidth:t?n*.62:n*.72+2,cellHeight:t?n*1.1:n*1.2+2,gap:n*(t?.02:.1)}}function IR(e,t,r){let n=Mr(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 DR(e,t,r,n,o,i){let a=Mr(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 GR(e,t,r,n,o,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=o,c=[];s||c.push(Mr(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=Mr(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(Mr(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 _R(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=OR(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=BR(n,i.variant==="plain",i.fontSize),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,p=IR(t,r,i);a&&p.appendChild(DR(t,a,n,u,s,i)),[...o].forEach((f,g)=>{let b=c+g*(s.cellWidth+s.gap);for(let y of GR(t,f,b,u,s,i))p.appendChild(y)}),r.replaceWith(p)}}function Xp(e,t){let r=e.cloneNode(!0);NR(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(ua,"image");ER(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),_R(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",ua),r}function ma(e,t){return new XMLSerializer().serializeToString(Xp(e,t))}var qp="http://www.w3.org/2000/svg";var pa=new Set([]);function F(e,t){return e.createElementNS(qp,t)}function $e(e,t,r){let n=F(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 FR="data-sf-change-overlay",$r="#f59e0b",io=1300,fa=400;function Kp(e,t,r){let n=F(e,"g");n.setAttribute(FR,t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}function ha(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:io,easing:"linear",fill:"forwards"})}function ga(e,t,r,n=$r){let o=t.getBBox(),i=Kp(e,r,t),a=F(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 ba(e,t,r,n=$r){let o=Kp(e,r,t),i=F(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 Yt(e){return e.ctrlKey||e.metaKey}function ao(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function so(e){return e===1}var HR=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function VR(e){return e==="entity"?"shape":e}function Ue(e){let t=e.getAttribute(zn);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 ya(e){let t=e.getAttribute(Yn);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(Un))||0,closed:e.getAttribute(jn)==="true"}}function xa(e){let t=e.getAttribute(Xn);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(Pr))||0,[a,s]=(e.getAttribute(qn)??"0,0").split(",").map(Number);return{width:r,height:n,depth:o,cornerRadius:i,bounds:Ue(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function je(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||!HR.has(n)?null:{role:VR(n),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function dt(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 ct=e=>e.hasAttribute("data-sf-primary");function Sa(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 E(e,t){return t/Sa(e)}var lo=6,WR=14,Ca=3,ka=1.5;function zR(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 YR(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Zp="#e8e8e8",Qp="#ccc",UR="#9b42df",jR="#7c2fb5",XR=1.2;function Ra(e,t,r,n,o,i){let a=F(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(n)),a.setAttribute("fill",Zp),a.setAttribute("stroke",Qp),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*XR)),a.setAttribute("fill",UR),a.setAttribute("stroke",jR),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(n)),a.setAttribute("fill",Zp),a.setAttribute("stroke",Qp),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function wa(e,t,r,n,o){let i=F(e,"path");return i.setAttribute("d",YR(t,r,n)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(o)),i.setAttribute("stroke-linecap","round"),i}function co(e,t,r,n){let o=$e(e,r,t),i=E(n,lo),a=i+E(n,WR),s=E(n,Ca),l=E(n,ka),d=Ue(t)??t.getBBox();for(let[c,u,p]of zR(d,a))o.append(Ra(e,c,u,i,l,p),wa(e,c,u,s,l));return o}var La="#9b42df",qR=2,KR=3.25,ZR=14,ef=34,QR=10.5,JR=8.5;function Jp(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function ew(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 Ta(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 Ma="data-sf-iso-halo";function tw(e,t,r,n){let o=F(e,"g");o.setAttribute("data-sf-resize-handle",`iso-${t}`),o.style.cursor=ew(r);let i=F(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(E(n,ZR))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",o.appendChild(i);let a=F(e,"line");a.setAttribute("stroke",La),a.setAttribute("stroke-width",String(E(n,KR))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",o.appendChild(a);let s=F(e,"polygon");return s.setAttribute("fill",La),s.style.pointerEvents="none",o.appendChild(s),{group:o,hit:i,shaft:a,head:s}}function rw(e,t,r,n){let o=E(n,ef),i=E(n,QR),a=E(n,JR),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 va(e,t,r,n,o){let i=tw(e,n,r,o);return rw(i,t,r,o),i.group}function uo(e){let t=Oe(e),r=t.top[0],n=t.top[1],o=t.top[3],i=t.front[2];return{width:{origin:Ta(t.right),direction:Jp({x:n.x-r.x,y:n.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:Ta(t.front),direction:Jp({x:o.x-r.x,y:o.y-r.y})}}}var nw=ef+lo+10;function Pa(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function $a(e){let t=Oe(e),r=uo(e),n=Ta([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:Pa(r.width.origin,n),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:Pa(r.depth.origin,n),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:Pa(r.height.origin,n),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var Aa="data-sf-iso-duplicate-bubbles",ow=["iso-height-neg","iso-depth-pos","iso-width-pos"];function Ea(e,t,r){let n=F(e,"g");n.setAttribute(Aa,"");let o=E(r,lo),i=E(r,nw),a=E(r,Ca),s=E(r,ka),l=$a(t);for(let d of ow){let{origin:c,direction:u}=l[d],p=c.x+u.x*i,f=c.y+u.y*i;n.append(Ra(e,p,f,o,s,d),wa(e,p,f,a,s))}return n}function mo(e,t,r,n){let o=Ue(t)??t.getBBox(),i=xa(t),a=$e(e,r,t),s=F(e,"path");s.setAttribute(Ma,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",La);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+E(n,qR))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=uo({x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0});return a.appendChild(va(e,d.width.origin,d.width.direction,"width",n)),a.appendChild(va(e,d.height.origin,d.height.direction,"height",n)),a.appendChild(va(e,d.depth.origin,d.depth.direction,"depth",n)),a.appendChild(Ea(e,{x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0},n)),a}var Na="#9b42df",iw=4,aw=5,rf=1.5;function sw(e,t,r){let n=F(e,"path");n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",Na);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+E(r,iw))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function tf(e,t,r,n,o){let i=t.getPointAtLength(r),a=F(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(E(o,aw))),a.setAttribute("fill",Na),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(E(o,rf))),a.setAttribute("data-sf-link-endpoint",n),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var lw=22,dw=8;function cw(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function uw(e,t,r){let n=[];return cw(t).forEach((o,i)=>{if(!o.movable)return;let a=Math.abs(o.bx-o.ax)>Math.abs(o.by-o.ay),s=E(r,lw),l=E(r,dw),d=a?s:l,c=a?l:s,u=F(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",Na),u.setAttribute("stroke-width",String(E(r,rf))),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 po(e,t,r,n){let o=$e(e,r,t),i=t.getTotalLength();return o.append(sw(e,t,n),...uw(e,t,n),tf(e,t,0,"from",n),tf(e,t,i,"to",n)),o}var nf="#9b42df",mw=4,pw=5,fw=1.5,Oa="data-sf-path-halo";function hw(e,t,r){let n=F(e,"path");n.setAttribute(Oa,""),n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",nf);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+E(r,mw))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function gw(e,t,r,n,o){let i=F(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(E(o,pw))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",nf),i.setAttribute("stroke-width",String(E(o,fw))),i.setAttribute(Rp,String(n)),i.style.pointerEvents="auto",i.style.cursor="move",i}function fo(e,t,r,n){let o=$e(e,r,t);o.appendChild(hw(e,t,n));let i=ya(t);for(let[a,[s,l]]of(i?.points??[]).entries())o.appendChild(gw(e,s,l,a,n));return o}var bw=6,yw=1,xw="#992dff",Sw={"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 Ba(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 Cw=new Set(["top","bottom"]);function of(e,t,r,n=!1){let o=E(r,bw),i=E(r,yw);return(n?Ba(t).filter(([,,s])=>!Cw.has(s)):Ba(t)).map(([s,l,d])=>{let c=F(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",xw),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=n?"ew-resize":Sw[d],c})}var kw="#9b42df",Rw=3,ww=1;function ho(e,t,r,n,o=!1){let i=Ue(t)??t.getBBox(),a=$e(e,r,t),s=E(n,ww),l=F(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",kw),l.setAttribute("stroke-width",String(E(n,Rw))),a.appendChild(l),a.append(...of(e,i,n,o)),a}function af(e){let t=new Map;return{flash:(n,o=$r)=>{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=dt(e,l,ct);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"?ba(a,d,l,o):ga(a,d,l,o);e.appendChild(u),ha(u,s);let p=s?fa:io;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},p))}},destroy(){for(let n of t.values())clearTimeout(n);t.clear()}}}function sf(e,t,r){let n=o=>{r&&o.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}function Ia(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function lf(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 df(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var Tw="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function Da(e){return!!e?.closest(Tw)}var go=class{#e;#n;#t;#r;constructor(t,r,n,o){this.#e=t,this.#n=r,this.#t=n,this.#r=o}hover(t){let r=je(t.target);this.#n.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:Ia(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,n=je(r);if(!n){this.#o(r);return}this.#i(n,t)}#o(t){Da(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let n=Ia(r);this.#r.dispatch(df(t.id,n)),this.#n.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:n});let o=dt(this.#e,t.id,ct);o&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","-1"),o?.focus({preventScroll:!0})}};var Mw=4,Ga=class{#e;#n;#t;#r=null;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}bind(){return this.#e.svg.addEventListener("pointerdown",this.#o),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#o=t=>{let r=t.target,n=!!je(r)||Da(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:Yt(t)||!n}};#i=t=>{this.#a(t)||this.#t&&this.#n.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#n.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>Mw&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&Yt(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#o),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function cf(e){let{display:t,emitter:r,diagramId:n,selection:o,selectable:i}=e,a=new go(t.svg,r,n,o);return new Ga(t,a,i).bind()}function _a(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=dt(e,o,ct);if(!i)continue;let a=r.get(o),s=a?.role==="link"?po(n,i,o,e):a?.role==="path"?fo(n,i,o,e):a?.role==="isometric"?mo(n,i,o,e):ho(n,i,o,e,a?pa.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(co(n,i,o,e))}}var bo=class{#e;#n;#t;#r=new Map;#o=new Set;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=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=lf(this.#o,t),_a(this.#e,this.#o,this.#r),this.#n.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#o.size>0&&_a(this.#e,this.#o,this.#r)}selectIds(t){for(let r of t){let n=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),o=je(n);o&&this.remember(o)}this.dispatch({type:"set",ids:t})}};function uf(e,t){let r=n=>{Yt(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 mf(e,t,r,n={}){let o=n.selectable??!0,i=new bo(e.svg,t,r),a=cf({display:e,emitter:t,diagramId:r,selection:i,selectable:o}),s=uf(e,i),l=sf(e.svg,i,o),d=af(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 Fa={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 $w=`
|
|
19
19
|
precision highp float;
|
|
20
20
|
|
|
21
21
|
uniform vec2 uResolution;
|
|
@@ -67,7 +67,7 @@ void main() {
|
|
|
67
67
|
float alpha = clamp(disc + shadow * (1.0 - disc), 0.0, 1.0);
|
|
68
68
|
gl_FragColor = vec4(clamp(color * disc, 0.0, 1.0), alpha);
|
|
69
69
|
}
|
|
70
|
-
`,
|
|
70
|
+
`,pf={name:"button",fragmentSource:$w,replacesBaseFill:!0};var Aw=`
|
|
71
71
|
precision highp float;
|
|
72
72
|
|
|
73
73
|
uniform sampler2D uBackdrop;
|
|
@@ -133,7 +133,7 @@ void main() {
|
|
|
133
133
|
face += uEdgeColor * movingGlint * bell(p.y - 0.26, 0.48) * left * 0.15;
|
|
134
134
|
gl_FragColor = vec4(clamp(face * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
136
|
+
`,ff={name:"chromaticGlassPlate",fragmentSource:Aw,usesBackdrop:!0,replacesBaseFill:!0};var Ew=`
|
|
137
137
|
precision highp float;
|
|
138
138
|
|
|
139
139
|
uniform vec2 uResolution;
|
|
@@ -199,7 +199,7 @@ void main() {
|
|
|
199
199
|
|
|
200
200
|
gl_FragColor = vec4(clamp(color, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
|
|
201
201
|
}
|
|
202
|
-
`,
|
|
202
|
+
`,hf={name:"chromaticHalo",fragmentSource:Ew};var Nw=`
|
|
203
203
|
precision highp float;
|
|
204
204
|
|
|
205
205
|
uniform float uTime;
|
|
@@ -251,7 +251,7 @@ void main() {
|
|
|
251
251
|
|
|
252
252
|
gl_FragColor = vec4(premultipliedColor, alpha);
|
|
253
253
|
}
|
|
254
|
-
`,
|
|
254
|
+
`,gf={name:"eclipseOrb",fragmentSource:Nw};var Ow=`
|
|
255
255
|
precision highp float;
|
|
256
256
|
|
|
257
257
|
uniform vec2 uResolution;
|
|
@@ -323,7 +323,7 @@ void main() {
|
|
|
323
323
|
float edge = 1.0 - smoothstep(0.955, 0.995, radius);
|
|
324
324
|
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
|
|
325
325
|
}
|
|
326
|
-
`,
|
|
326
|
+
`,bf={name:"emberMatrix",fragmentSource:Ow};var Bw=`
|
|
327
327
|
precision highp float;
|
|
328
328
|
|
|
329
329
|
uniform vec2 uResolution;
|
|
@@ -388,7 +388,7 @@ void main() {
|
|
|
388
388
|
float alpha = clamp((molten * 0.92 + glowMask) * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
|
|
389
389
|
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
|
|
390
390
|
}
|
|
391
|
-
`,
|
|
391
|
+
`,yf={name:"emberSlits",fragmentSource:Bw};var Iw=`
|
|
392
392
|
precision highp float;
|
|
393
393
|
|
|
394
394
|
uniform sampler2D uBackdrop;
|
|
@@ -490,7 +490,7 @@ void main() {
|
|
|
490
490
|
vec3 finalColor = clamp(color, 0.0, 1.0) * edgeAlpha;
|
|
491
491
|
gl_FragColor = vec4(finalColor, edgeAlpha);
|
|
492
492
|
}
|
|
493
|
-
`,
|
|
493
|
+
`,xf={name:"glassRefraction",fragmentSource:Iw,usesBackdrop:!0};var Dw=`
|
|
494
494
|
precision highp float;
|
|
495
495
|
|
|
496
496
|
uniform vec2 uResolution;
|
|
@@ -566,7 +566,7 @@ void main() {
|
|
|
566
566
|
|
|
567
567
|
gl_FragColor = vec4(clamp(finalColor * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
568
568
|
}
|
|
569
|
-
`,
|
|
569
|
+
`,Sf={name:"halftoneHalo",fragmentSource:Dw};var Gw=`
|
|
570
570
|
precision highp float;
|
|
571
571
|
|
|
572
572
|
uniform vec2 uResolution;
|
|
@@ -638,7 +638,7 @@ void main() {
|
|
|
638
638
|
float alpha = 1.0 - smoothstep(0.96, 1.0, radius);
|
|
639
639
|
gl_FragColor = vec4(color, alpha);
|
|
640
640
|
}
|
|
641
|
-
`,
|
|
641
|
+
`,Cf={name:"halo",fragmentSource:Gw};var _w=`
|
|
642
642
|
precision highp float;
|
|
643
643
|
|
|
644
644
|
uniform float uTime;
|
|
@@ -693,7 +693,7 @@ void main() {
|
|
|
693
693
|
vec3 premultiplied = color * body + glowColor * (1.0 - body) * halo * breath;
|
|
694
694
|
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
695
695
|
}
|
|
696
|
-
`,
|
|
696
|
+
`,kf={name:"lumenPortal",fragmentSource:_w};var Fw=`
|
|
697
697
|
precision highp float;
|
|
698
698
|
|
|
699
699
|
uniform float uTime;
|
|
@@ -749,7 +749,7 @@ void main() {
|
|
|
749
749
|
premultiplied += mix(uShadowColor, rimColor, 0.58) * (1.0 - body) * outside * breath;
|
|
750
750
|
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
751
751
|
}
|
|
752
|
-
`,
|
|
752
|
+
`,Rf={name:"lumenPortalLight",fragmentSource:Fw};var Hw=`
|
|
753
753
|
precision highp float;
|
|
754
754
|
|
|
755
755
|
uniform vec2 uResolution;
|
|
@@ -782,7 +782,7 @@ void main() {
|
|
|
782
782
|
float alpha = 1.0 - smoothstep(0.94, 1.0, radius);
|
|
783
783
|
gl_FragColor = vec4(color, alpha);
|
|
784
784
|
}
|
|
785
|
-
`,
|
|
785
|
+
`,wf={name:"orb",fragmentSource:Hw};var Vw=`
|
|
786
786
|
precision highp float;
|
|
787
787
|
|
|
788
788
|
uniform float uTime;
|
|
@@ -879,7 +879,7 @@ void main() {
|
|
|
879
879
|
float edge = 1.0 - smoothstep(0.965, 0.997, radius);
|
|
880
880
|
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
|
|
881
881
|
}
|
|
882
|
-
`,
|
|
882
|
+
`,vf={name:"pixelConstellation",fragmentSource:Vw};var Ww=`
|
|
883
883
|
precision highp float;
|
|
884
884
|
|
|
885
885
|
uniform vec2 uResolution;
|
|
@@ -978,7 +978,7 @@ void main() {
|
|
|
978
978
|
float gain = max(uIntensity, 0.0) * fade;
|
|
979
979
|
gl_FragColor = vec4(clamp(color * gain, 0.0, 1.0), clamp(alpha * gain, 0.0, 1.0));
|
|
980
980
|
}
|
|
981
|
-
`,
|
|
981
|
+
`,Pf={name:"plasmaGauge",fragmentSource:Ww,replacesBaseFill:!0};var zw=`
|
|
982
982
|
precision highp float;
|
|
983
983
|
|
|
984
984
|
uniform vec2 uResolution;
|
|
@@ -1050,7 +1050,7 @@ void main() {
|
|
|
1050
1050
|
float fade = 1.0 - smoothstep(0.88, 1.0, radius);
|
|
1051
1051
|
gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * fade, 0.0, 1.0), fade);
|
|
1052
1052
|
}
|
|
1053
|
-
`,
|
|
1053
|
+
`,Lf={name:"prismSlats",fragmentSource:zw};var Yw=`
|
|
1054
1054
|
precision highp float;
|
|
1055
1055
|
|
|
1056
1056
|
uniform vec2 uResolution;
|
|
@@ -1152,7 +1152,7 @@ void main() {
|
|
|
1152
1152
|
vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
|
|
1153
1153
|
gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
|
|
1154
1154
|
}
|
|
1155
|
-
`,
|
|
1155
|
+
`,Tf={name:"ruler",fragmentSource:Yw,replacesBaseFill:!0};var Uw=`
|
|
1156
1156
|
precision highp float;
|
|
1157
1157
|
|
|
1158
1158
|
uniform vec2 uResolution;
|
|
@@ -1225,7 +1225,7 @@ void main() {
|
|
|
1225
1225
|
vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
|
|
1226
1226
|
gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1227
1227
|
}
|
|
1228
|
-
`,
|
|
1228
|
+
`,Mf={name:"smearOrb",fragmentSource:Uw,replacesBaseFill:!0};var jw=`
|
|
1229
1229
|
precision highp float;
|
|
1230
1230
|
|
|
1231
1231
|
uniform vec2 uResolution;
|
|
@@ -1281,7 +1281,7 @@ void main() {
|
|
|
1281
1281
|
float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
|
|
1282
1282
|
gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
|
|
1283
1283
|
}
|
|
1284
|
-
|
|
1284
|
+
`,$f={name:"tickScale",fragmentSource:jw,replacesBaseFill:!0};var Xw=`
|
|
1285
1285
|
precision highp float;
|
|
1286
1286
|
|
|
1287
1287
|
uniform float uTime;
|
|
@@ -1358,7 +1358,7 @@ void main() {
|
|
|
1358
1358
|
vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
|
|
1359
1359
|
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1360
1360
|
}
|
|
1361
|
-
`,
|
|
1361
|
+
`,Af={name:"violetGlass",fragmentSource:Xw};var qw=`
|
|
1362
1362
|
precision highp float;
|
|
1363
1363
|
|
|
1364
1364
|
uniform float uTime;
|
|
@@ -1425,7 +1425,7 @@ void main() {
|
|
|
1425
1425
|
premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
|
|
1426
1426
|
gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
|
|
1427
1427
|
}
|
|
1428
|
-
`,
|
|
1428
|
+
`,Ef={name:"violetGlassLight",fragmentSource:qw};var Kw=[wf,Cf,Sf,hf,ff,xf,yf,Mf,vf,Pf,$f,Tf,pf,Lf,gf,bf,Af,Ef,kf,Rf],Zw=new Map(Kw.map(e=>[e.name,e]));function Nf(e){return Zw.get(e)}var Qw=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function Jw(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let n=t.getComputedStyle(r).backgroundColor;if(n&&!Qw.test(n.trim()))return n}}function ev(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=Jw(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 Of(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(ev(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 Ar(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 Bf(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Ut(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform1f(n,r)}function yo(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform3f(n,...r)}function Ha(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform2f(n,...r)}function xo(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function tv(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 If(e,t){for(let[r,n]of Object.entries(e.parameters)){let o=xo(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),Ut(e,o,l);continue}Ut(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=tv(r,n);if(i!==void 0){Ut(e,o,i);continue}/^#[0-9a-f]{6}$/i.test(n)&&yo(e,o,Ar(n,[0,0,0]))}}var rv=`
|
|
1429
1429
|
attribute vec2 aPosition;
|
|
1430
1430
|
varying vec2 vUv;
|
|
1431
1431
|
|
|
@@ -1433,12 +1433,12 @@ void main() {
|
|
|
1433
1433
|
vUv = aPosition * 0.5 + 0.5;
|
|
1434
1434
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
1435
1435
|
}
|
|
1436
|
-
`;function
|
|
1436
|
+
`;function Df(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 Gf(e,t){let r=Df(e,e.VERTEX_SHADER,rv),n=Df(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 _f(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 nv=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function ov(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function iv(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,nv,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 av(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 Ff(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),n=r?Nf(r):void 0,o=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!n||!o)return;let i=Gf(o,n.fragmentSource);if(!i)return;o.useProgram(i);let a=iv(o,i);if(!a){o.deleteProgram(i);return}let s=n.usesBackdrop===!0,l=av(t,n),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:o,program:i,buffer:a,parameters:ov(t),smoothed:new Map,backdropTexture:s?_f(o):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:Ar(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Hf(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 Vf(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 Wf(e,t){if(!e.backdropTexture)return;Vf(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 sv=2560;function jt(e,t){let{canvas:r,gl:n,parameters:o}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,sv/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),Ut(e,"uTime",t),e.backdropTexture){Vf(e),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.backdropTexture);let p=n.getUniformLocation(e.program,"uBackdrop");p&&n.uniform1i(p,0),Ha(e,"uBackdropOrigin",e.backdropOrigin),Ha(e,"uBackdropScale",e.backdropScale)}for(let[p,f]of Object.entries(Fa.numbers))Ut(e,xo(p),Bf(o[p],f));for(let[p,f]of Object.entries(Fa.colors))yo(e,xo(p),Ar(o[p],[...f]));yo(e,"uShapeColor",e.shapeColor);let u=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,If(e,u),n.drawArrays(n.TRIANGLES,0,6)}function zf(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 lv=120;function dv(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 jt(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function cv(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)),jt(i,n),o=!0);return o}function uv(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 Va(e){let t=[],r,n=0,o,i=e.ownerDocument.defaultView,a=zf(i),s=b=>{if(!a.paused())for(let y of t)jt(y,b/1e3-a.spent());r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)Hf(b);t=[]},d=b=>{for(let y of t)y.usesBackdrop&&Of(e,y.owner).then(C=>{C&&b===n&&Wf(y,C)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)jt(b,0);return}if(a.paused())for(let b of t)jt(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{l();let b=++n;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(y=>{let C=Ff(y);return C?[C]:[]}),d(b),t.length>0&&c()},f=uv(e,i,()=>{o!==void 0&&i?.clearTimeout(o),o=i?.setTimeout(()=>{o=void 0,d(n)},lv)});u();let g=()=>{n+=1,f(),o!==void 0&&i?.clearTimeout(o),l()};return{capture:()=>dv(e,t,a.now()),setParameters:(b,y)=>cv(t,b,y,a.now()),setPaused:a.setPaused,refresh:u,destroy:g}}function So(e,t){let r=e.svg??(e.source!=null?Zn(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 Yf(e){let t=ao(e);if(!so(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function Uf(e){let t=ao(e);if(!so(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var Co=class{constructor(t,r,n){this.options=t;this.diagramId=n;this.display=jp(t.container,r),this.shaderSurfaces=Va(this.display.svg),this.documentComponents=ia(this.display.svg),this.interaction=t.interactive?mf(this.display,this.emitter,n,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new oo;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=Dp(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 ma(this.svg,this.shaderSurfaces.capture())}exportImage(t){return ca(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){return this.setComponentValue(t,r)}setComponentValue(t,r){if(this.documentComponents.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=Bp(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.documentComponents.clearValues()}update(t){let r=So(t,this.options.renderOptions);Uf(r);let n=this.display.updateContent(r);this.shaderSurfaces.refresh(),this.documentComponents.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.documentComponents.destroy(),this.shaderParameterOverrides.clear(),this.display.destroy(),this.emitter.clear()}};function jf(e){let t=e.diagramId??"diagram",r=So(e,e.renderOptions);Yf(r);let n=new Co(e,r,t);return n.announceReady(),n}var mv=`
|
|
1437
1437
|
:host { display: block; position: relative; }
|
|
1438
1438
|
.sf-container { width: 100%; height: 100%; }
|
|
1439
1439
|
svg { display: block; max-width: 100%; }
|
|
1440
1440
|
.sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
|
|
1441
1441
|
[data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
|
|
1442
1442
|
[data-sf-selected] { stroke: #2563eb !important; stroke-width: 4 !important; }
|
|
1443
|
-
`;function
|
|
1443
|
+
`;function pv(e){let t=document.createElement("style");t.textContent=mv;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function fv(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function hv(e,t,r){return jf({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function gv(e,t,r){e.innerHTML=Zn(t,{padding:r.padding}).svg}function Xf(e,t){let r=pv(e);if(t.source===null)return{viewer:null,rendered:!1};try{let n=t.interactive?hv(r,t.source,t):null;return t.interactive||gv(r,t.source,t),{viewer:n,rendered:!0}}catch(n){return fv(r,n),{viewer:null,rendered:!1}}}var bv=typeof HTMLElement>"u"?class{}:HTMLElement,ut=class extends bv{static get observedAttributes(){return[...Ua]}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=ja(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=Xf(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function Wa(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,ut)}Wa();return nh(yv);})();
|
|
1444
1444
|
//# sourceMappingURL=stickyflow-diagram.global.js.map
|