@bigduu/lotus 2026.3.100 → 2026.3.101
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/dist/assets/{App-Cr9Fyy_0.js → App-DiO7yW2B.js} +25 -20
- package/dist/assets/{_basePickBy-dSXOHMcR.js → _basePickBy-DSGdRpfk.js} +1 -1
- package/dist/assets/{_baseUniq-5YPP0-KD.js → _baseUniq-BaFy5HZw.js} +1 -1
- package/dist/assets/{arc--JNB6wub.js → arc-C45INhZ3.js} +1 -1
- package/dist/assets/{architectureDiagram-VXUJARFQ-QIQUX8-G.js → architectureDiagram-VXUJARFQ-COcOCBA0.js} +1 -1
- package/dist/assets/{blockDiagram-VD42YOAC-CzNdz7Zq.js → blockDiagram-VD42YOAC-BJiLHRN0.js} +1 -1
- package/dist/assets/{c4Diagram-YG6GDRKO-D2GTDE5q.js → c4Diagram-YG6GDRKO-BX7Tbmjk.js} +1 -1
- package/dist/assets/channel-BwFSDc2k.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-BSBU46cF.js → chunk-4BX2VUAB-C18EkMfg.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-CnK975In.js → chunk-55IACEB6-kRIFcCX6.js} +1 -1
- package/dist/assets/{chunk-B4BG7PRW-BDyiUGqj.js → chunk-B4BG7PRW-D_bF9GUC.js} +1 -1
- package/dist/assets/{chunk-DI55MBZ5-OB6qSSV-.js → chunk-DI55MBZ5-t6geA1ae.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-BIGTZCCo.js → chunk-FMBD7UC4-1Wx9VixN.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-P4QC7JV7.js → chunk-QN33PNHL-CYFYimK8.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-S0htXvH9.js → chunk-QZHKN3VN-bnjGfJvp.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-Dy33zt95.js → chunk-TZMSLE5B-BCz6VHVP.js} +1 -1
- package/dist/assets/classDiagram-2ON5EDUG-BAbGsHKp.js +1 -0
- package/dist/assets/classDiagram-v2-WZHVMYZB-BAbGsHKp.js +1 -0
- package/dist/assets/clone-CKlm6y9g.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-DoQ50Yj5.js → cose-bilkent-S5V4N54A-lKdHVs2U.js} +1 -1
- package/dist/assets/{dagre-6UL2VRFP-CDqvKph7.js → dagre-6UL2VRFP-C5EnKtVv.js} +1 -1
- package/dist/assets/{diagram-PSM6KHXK-SX5vW-aW.js → diagram-PSM6KHXK-CwegSRqD.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DsUJThS2.js → diagram-QEK2KX5R-BdYKr9ab.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-CAXCgWq2.js → diagram-S2PKOQOG-STkseHgn.js} +1 -1
- package/dist/assets/{erDiagram-Q2GNP2WA-BFr63qhd.js → erDiagram-Q2GNP2WA-DLlcVzLB.js} +1 -1
- package/dist/assets/{flowDiagram-NV44I4VS-BqFJbSgW.js → flowDiagram-NV44I4VS-C8pbqvnc.js} +1 -1
- package/dist/assets/{ganttDiagram-JELNMOA3-DCNWVcT-.js → ganttDiagram-JELNMOA3-BMn9n4pe.js} +1 -1
- package/dist/assets/{gitGraphDiagram-V2S2FVAM-DXAZZdjO.js → gitGraphDiagram-V2S2FVAM-DSZXQx4a.js} +1 -1
- package/dist/assets/{graph-CCFofypb.js → graph-g_-BildY.js} +1 -1
- package/dist/assets/{index-CtzvedZy.js → index-8oAqABHX.js} +1 -1
- package/dist/assets/{index-Cgf2zzsS.js → index-BC1I7hu4.js} +1 -1
- package/dist/assets/{index-w0H73Qu_.js → index-BVl_96QK.js} +1 -1
- package/dist/assets/{index-CQXrMvBL.js → index-CF41Z0g4.js} +1 -1
- package/dist/assets/{index-BMn0p5au.js → index-CU3N9MO6.js} +1 -1
- package/dist/assets/{index.es-kryfsIxG.js → index.es-ekGscMm8.js} +1 -1
- package/dist/assets/{infoDiagram-HS3SLOUP-DoyLlndm.js → infoDiagram-HS3SLOUP-Bk1va7Yc.js} +1 -1
- package/dist/assets/{journeyDiagram-XKPGCS4Q-C0e2TIUw.js → journeyDiagram-XKPGCS4Q-BL0e_AP8.js} +1 -1
- package/dist/assets/{jspdf.es.min-_5dLWB_g.js → jspdf.es.min-Cr0yMma9.js} +4 -4
- package/dist/assets/{kanban-definition-3W4ZIXB7-ibqA1SWj.js → kanban-definition-3W4ZIXB7-DOrLV23M.js} +1 -1
- package/dist/assets/{layout-CK1s7pZK.js → layout-DkSBLbqm.js} +1 -1
- package/dist/assets/{main-D7DxuoFj.js → main-r5-Ghhxx.js} +2 -2
- package/dist/assets/{mindmap-definition-VGOIOE7T-Ch_o6XZH.js → mindmap-definition-VGOIOE7T-B2WskgZi.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-8TeuvV-v.js → pieDiagram-ADFJNKIX-d92vh0NT.js} +1 -1
- package/dist/assets/{quadrantDiagram-AYHSOK5B-C9DK9G59.js → quadrantDiagram-AYHSOK5B-D7XvGMsu.js} +1 -1
- package/dist/assets/{requirementDiagram-UZGBJVZJ-xEES0mSj.js → requirementDiagram-UZGBJVZJ-fU6nP0KD.js} +1 -1
- package/dist/assets/{sankeyDiagram-TZEHDZUN-Ja__kj5o.js → sankeyDiagram-TZEHDZUN-C3swjjfS.js} +1 -1
- package/dist/assets/{sequenceDiagram-WL72ISMW-QjJ0ZfOV.js → sequenceDiagram-WL72ISMW-qnI_BC0O.js} +1 -1
- package/dist/assets/{stateDiagram-FKZM4ZOC-BWQxGLKB.js → stateDiagram-FKZM4ZOC-C-VvT7hf.js} +1 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-C5I1eYNJ.js +1 -0
- package/dist/assets/{timeline-definition-IT6M3QCI-CpKNjtW1.js → timeline-definition-IT6M3QCI-CQ1Ts1zj.js} +1 -1
- package/dist/assets/{treemap-GDKQZRPO-Bg6pfkc3.js → treemap-GDKQZRPO-ClB5HrQt.js} +1 -1
- package/dist/assets/{xychartDiagram-PRI3JC2R-C4HrnAaS.js → xychartDiagram-PRI3JC2R-DdCk42LP.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-BaMgndq-.js +0 -1
- package/dist/assets/classDiagram-2ON5EDUG-Ciwj12il.js +0 -1
- package/dist/assets/classDiagram-v2-WZHVMYZB-Ciwj12il.js +0 -1
- package/dist/assets/clone-B6KBmiMV.js +0 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-LFokkVTe.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
var m1e=Object.defineProperty;var v1e=(e,t,n)=>t in e?m1e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Bt=(e,t,n)=>v1e(e,typeof t!="symbol"?t+"":t,n);import{r as p,b as b1e,d as y1e,e as S1e,g as An,R as U,f as x1e,h as $1,j as E,_ as Mn,a as z0,i as w1e,A as C1e,k as E1e}from"./main-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BC1I7hu4.js","./main-r5-Ghhxx.js","./main-B6snAd4S.css","./dagre-6UL2VRFP-C5EnKtVv.js","./graph-g_-BildY.js","./_baseUniq-BaFy5HZw.js","./layout-DkSBLbqm.js","./_basePickBy-DSGdRpfk.js","./clone-CKlm6y9g.js","./cose-bilkent-S5V4N54A-lKdHVs2U.js","./cytoscape.esm-BY7v1xhs.js","./c4Diagram-YG6GDRKO-BX7Tbmjk.js","./chunk-TZMSLE5B-BCz6VHVP.js","./flowDiagram-NV44I4VS-C8pbqvnc.js","./chunk-FMBD7UC4-1Wx9VixN.js","./chunk-55IACEB6-kRIFcCX6.js","./chunk-QN33PNHL-CYFYimK8.js","./channel-BwFSDc2k.js","./erDiagram-Q2GNP2WA-DLlcVzLB.js","./gitGraphDiagram-V2S2FVAM-DSZXQx4a.js","./chunk-4BX2VUAB-C18EkMfg.js","./chunk-QZHKN3VN-bnjGfJvp.js","./treemap-GDKQZRPO-ClB5HrQt.js","./ganttDiagram-JELNMOA3-BMn9n4pe.js","./infoDiagram-HS3SLOUP-Bk1va7Yc.js","./pieDiagram-ADFJNKIX-d92vh0NT.js","./arc-C45INhZ3.js","./quadrantDiagram-AYHSOK5B-D7XvGMsu.js","./xychartDiagram-PRI3JC2R-DdCk42LP.js","./requirementDiagram-UZGBJVZJ-fU6nP0KD.js","./sequenceDiagram-WL72ISMW-qnI_BC0O.js","./classDiagram-2ON5EDUG-BAbGsHKp.js","./chunk-B4BG7PRW-D_bF9GUC.js","./classDiagram-v2-WZHVMYZB-BAbGsHKp.js","./stateDiagram-FKZM4ZOC-C-VvT7hf.js","./chunk-DI55MBZ5-t6geA1ae.js","./stateDiagram-v2-4FDKWEC3-C5I1eYNJ.js","./journeyDiagram-XKPGCS4Q-BL0e_AP8.js","./timeline-definition-IT6M3QCI-CQ1Ts1zj.js","./mindmap-definition-VGOIOE7T-B2WskgZi.js","./kanban-definition-3W4ZIXB7-DOrLV23M.js","./sankeyDiagram-TZEHDZUN-C3swjjfS.js","./diagram-S2PKOQOG-STkseHgn.js","./diagram-QEK2KX5R-BdYKr9ab.js","./blockDiagram-VD42YOAC-BJiLHRN0.js","./architectureDiagram-VXUJARFQ-COcOCBA0.js","./diagram-PSM6KHXK-CwegSRqD.js","./index-CU3N9MO6.js","./index-8oAqABHX.js","./index-DzHbgzzW.css","./index-BVl_96QK.js","./index-CF41Z0g4.js","./index-BmjFP0ha.js","./core-Cfh-QHsP.js","./index-_XI0Qq6F.js","./jspdf.es.min-Cr0yMma9.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var m1e=Object.defineProperty;var v1e=(e,t,n)=>t in e?m1e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Bt=(e,t,n)=>v1e(e,typeof t!="symbol"?t+"":t,n);import{r as p,b as b1e,d as y1e,e as S1e,g as An,R as U,f as x1e,h as $1,j as E,_ as Mn,a as z0,i as w1e,A as C1e,k as E1e}from"./main-r5-Ghhxx.js";function _1e(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const T1e=(e,t,n,r)=>{var i,o,s,l;const a=[n,{code:t,...r||{}}];if((o=(i=e==null?void 0:e.services)==null?void 0:i.logger)!=null&&o.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);Sd(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(l=(s=e==null?void 0:e.services)==null?void 0:s.logger)!=null&&l.warn?e.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},xU={},xae=(e,t,n,r)=>{Sd(n)&&xU[n]||(Sd(n)&&(xU[n]=new Date),T1e(e,t,n,r))},wae=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},S2=(e,t,n)=>{e.loadNamespaces(t,wae(e,n))},wU=(e,t,n,r)=>{if(Sd(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return S2(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,wae(e,r))},k1e=(e,t,n={})=>!t.languages||!t.languages.length?(xae(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),Sd=e=>typeof e=="string",O1e=e=>typeof e=="object"&&e!==null,$1e=p.createContext();class I1e{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var _T={exports:{}},TT={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
25
25
|
`);else if(y._keyframe)g(y);else{var S=d.reduce(function(C,x){var w;return(x==null||(w=x.visit)===null||w===void 0?void 0:w.call(x,C))||C},y);Object.keys(S).forEach(function(C){var x=S[C];if(mt(x)==="object"&&x&&(C!=="animationName"||!x._keyframe)&&!x_e(x)){var w=!1,_=C.trim(),T=!1;(a||i)&&s?_.startsWith("@")?w=!0:_==="&"?_=HU("",s,c):_=HU(C,s,c):a&&!s&&(_==="&"||_==="")&&(_="",T=!0);var k=e(x,n,{root:T,injectHash:w,parentSelectors:[].concat(Le(o),[_])}),O=se(k,2),I=O[0],M=O[1];h=K(K({},h),M),f+="".concat(_).concat(I)}else{let A=function(P,N){var L=P.replace(/[A-Z]/g,function(D){return"-".concat(D.toLowerCase())}),j=N;!t_e[P]&&typeof j=="number"&&j!==0&&(j="".concat(j,"px")),P==="animationName"&&N!==null&&N!==void 0&&N._keyframe&&(g(N),j=N.getName(s)),f+="".concat(L,":").concat(j,";")};var $,R=($=x==null?void 0:x.value)!==null&&$!==void 0?$:x;mt(x)==="object"&&x!==null&&x!==void 0&&x[rie]&&Array.isArray(R)?R.forEach(function(P){A(C,P)}):A(C,R)}})}}),a?l&&(f&&(f="@layer ".concat(l.name," {").concat(f,"}")),l.dependencies&&(h["@layer ".concat(l.name)]=l.dependencies.map(function(b){return"@layer ".concat(b,", ").concat(l.name,";")}).join(`
|
|
26
26
|
`))):f="{".concat(f,"}"),[f,h]};function aie(e,t){return wb("".concat(e.join("%")).concat(t))}function C_e(){return null}var iie="style";function I2(e,t){var n=e.token,r=e.path,a=e.hashId,i=e.layer,o=e.nonce,s=e.clientOnly,l=e.order,c=l===void 0?0:l,u=p.useContext(jy),d=u.autoClear;u.mock;var f=u.defaultCache,h=u.hashPriority,g=u.container,m=u.ssrInline,v=u.transformers,b=u.linters,y=u.cache,S=u.layer,C=n._tokenKey,x=[C];S&&x.push("layer"),x.push.apply(x,Le(r));var w=O2,_=yj(iie,x,function(){var M=x.join("|");if(b_e(M)){var $=y_e(M),R=se($,2),A=R[0],P=R[1];if(A)return[A,C,P,{},s,c]}var N=t(),L=w_e(N,{hashId:a,hashPriority:h,layer:S?i:void 0,path:r.join("-"),transformers:v,linters:b}),j=se(L,2),D=j[0],H=j[1],F=hx(D),B=aie(x,F);return[F,C,B,H,s,c]},function(M,$){var R=se(M,3),A=R[2];($||d)&&O2&&Cb(A,{mark:Ss})},function(M){var $=se(M,4),R=$[0];$[1];var A=$[2],P=$[3];if(w&&R!==tie){var N={mark:Ss,prepend:S?!1:"queue",attachTo:g,priority:c},L=typeof o=="function"?o():o;L&&(N.csp={nonce:L});var j=[],D=[];Object.keys(P).forEach(function(F){F.startsWith("@layer")?j.push(F):D.push(F)}),j.forEach(function(F){zl(hx(P[F]),"_layer-".concat(F),K(K({},N),{},{prepend:!0}))});var H=zl(R,A,N);H[Nc]=y.instanceId,H.setAttribute(Fp,C),D.forEach(function(F){zl(hx(P[F]),"_effect-".concat(F),N)})}}),T=se(_,3),k=T[0],O=T[1],I=T[2];return function(M){var $;if(!m||w||!f)$=p.createElement(C_e,null);else{var R;$=p.createElement("style",ke({},(R={},V(R,Fp,O),V(R,Ss,I),R),{dangerouslySetInnerHTML:{__html:k}}))}return p.createElement(p.Fragment,null,$,M)}}var E_e=function(t,n,r){var a=se(t,6),i=a[0],o=a[1],s=a[2],l=a[3],c=a[4],u=a[5],d=r||{},f=d.plain;if(c)return null;var h=i,g={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return h=cw(i,o,s,g,f),l&&Object.keys(l).forEach(function(m){if(!n[m]){n[m]=!0;var v=hx(l[m]),b=cw(v,o,"_effect-".concat(m),g,f);m.startsWith("@layer")?h=b+h:h+=b}}),[u,s,h]},oie="cssVar",__e=function(t,n){var r=t.key,a=t.prefix,i=t.unitless,o=t.ignore,s=t.token,l=t.scope,c=l===void 0?"":l,u=p.useContext(jy),d=u.cache.instanceId,f=u.container,h=s._tokenKey,g=[].concat(Le(t.path),[r,c,h]),m=yj(oie,g,function(){var v=n(),b=Wae(v,r,{prefix:a,unitless:i,ignore:o,scope:c}),y=se(b,2),S=y[0],C=y[1],x=aie(g,C);return[S,C,x,r]},function(v){var b=se(v,3),y=b[2];O2&&Cb(y,{mark:Ss})},function(v){var b=se(v,3),y=b[1],S=b[2];if(y){var C=zl(y,S,{mark:Ss,prepend:"queue",attachTo:f,priority:-999});C[Nc]=d,C.setAttribute(Fp,r)}});return m},T_e=function(t,n,r){var a=se(t,4),i=a[1],o=a[2],s=a[3],l=r||{},c=l.plain;if(!i)return null;var u=-999,d={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)},f=cw(i,s,o,d,c);return[u,o,f]},kg;kg={},V(kg,iie,E_e),V(kg,Vae,e_e),V(kg,oie,T_e);var Zt=function(){function e(t,n){sr(this,e),V(this,"name",void 0),V(this,"style",void 0),V(this,"_keyframe",!0),this.name=t,this.style=n}return lr(e,[{key:"getName",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return n?"".concat(n,"-").concat(this.name):this.name}}]),e}();function _f(e){return e.notSplit=!0,e}_f(["borderTop","borderBottom"]),_f(["borderTop"]),_f(["borderBottom"]),_f(["borderLeft","borderRight"]),_f(["borderLeft"]),_f(["borderRight"]);var wj=p.createContext({});function sie(e){return jae(e)||Pae(e)||gj(e)||Bae()}function Oi(e,t){for(var n=e,r=0;r<t.length;r+=1){if(n==null)return;n=n[t[r]]}return n}function lie(e,t,n,r){if(!t.length)return n;var a=sie(t),i=a[0],o=a.slice(1),s;return!e&&typeof i=="number"?s=[]:Array.isArray(e)?s=Le(e):s=K({},e),r&&n===void 0&&o.length===1?delete s[i][o[0]]:s[i]=lie(s[i],o,n,r),s}function Po(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!Oi(e,t.slice(0,-1))?e:lie(e,t,n,r)}function k_e(e){return mt(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function UU(e){return Array.isArray(e)?[]:{}}var O_e=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function ap(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=UU(t[0]);return t.forEach(function(a){function i(o,s){var l=new Set(s),c=Oi(a,o),u=Array.isArray(c);if(u||k_e(c)){if(!l.has(c)){l.add(c);var d=Oi(r,o);u?r=Po(r,o,[]):(!d||mt(d)!=="object")&&(r=Po(r,o,UU(c))),O_e(c).forEach(function(f){i([].concat(Le(o),[f]),l)})}}else r=Po(r,o,c)}i([])}),r}function $_e(){}const I_e=p.createContext({}),hl=()=>{const e=()=>{};return e.deprecated=$_e,e},cie=p.createContext(void 0);var uie={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},A_e={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},R_e=K(K({},A_e),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const die={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},dw={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},R_e),timePickerLocale:Object.assign({},die)},Zi="${label} is not a valid ${type}",ol={locale:"en",Pagination:uie,DatePicker:dw,TimePicker:die,Calendar:dw,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:Zi,method:Zi,array:Zi,object:Zi,number:Zi,date:Zi,boolean:Zi,integer:Zi,float:Zi,regexp:Zi,email:Zi,url:Zi,hex:Zi},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};let gx=Object.assign({},ol.Modal),mx=[];const WU=()=>mx.reduce((e,t)=>Object.assign(Object.assign({},e),t),ol.Modal);function M_e(e){if(e){const t=Object.assign({},e);return mx.push(t),gx=WU(),()=>{mx=mx.filter(n=>n!==t),gx=WU()}}gx=Object.assign({},ol.Modal)}function fie(){return gx}const Cj=p.createContext(void 0),yo=(e,t)=>{const n=p.useContext(Cj),r=p.useMemo(()=>{var i;const o=t||ol[e],s=(i=n==null?void 0:n[e])!==null&&i!==void 0?i:{};return Object.assign(Object.assign({},typeof o=="function"?o():o),s||{})},[e,t,n]),a=p.useMemo(()=>{const i=n==null?void 0:n.locale;return n!=null&&n.exist&&!i?ol.locale:i},[n]);return[r,a]},P_e="internalMark",N_e=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;p.useEffect(()=>M_e(t==null?void 0:t.Modal),[t]);const a=p.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return p.createElement(Cj.Provider,{value:a},n)},Ej={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},Up=Object.assign(Object.assign({},Ej),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
27
27
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
28
|
-
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),$a=Math.round;function RT(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(a=>parseFloat(a));for(let a=0;a<3;a+=1)r[a]=t(r[a]||0,n[a]||"",a);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const qU=(e,t,n)=>n===0?e:e/100;function Og(e,t){const n=t||255;return e>n?n:e<0?0:e}let $n=class pie{constructor(t){V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0);function n(r){return r[0]in t&&r[1]in t&&r[2]in t}if(t)if(typeof t=="string"){let a=function(i){return r.startsWith(i)};const r=t.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):a("rgb")?this.fromRgbString(r):a("hsl")?this.fromHslString(r):(a("hsv")||a("hsb"))&&this.fromHsvString(r)}else if(t instanceof pie)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Og(t.r),this.g=Og(t.g),this.b=Og(t.b),this.a=typeof t.a=="number"?Og(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const o=i/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),a=t(this.b);return .2126*n+.7152*r+.0722*a}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=$a(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let a=this.getLightness()-t/100;return a<0&&(a=0),this._c({h:n,s:r,l:a,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let a=this.getLightness()+t/100;return a>1&&(a=1),this._c({h:n,s:r,l:a,a:this.a})}mix(t,n=50){const r=this._c(t),a=n/100,i=s=>(r[s]-this[s])*a+this[s],o={r:$a(i("r")),g:$a(i("g")),b:$a(i("b")),a:$a(i("a")*100)/100};return this._c(o)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),a=i=>$a((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:a("r"),g:a("g"),b:a("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const a=(this.b||0).toString(16);if(t+=a.length===2?a:"0"+a,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=$a(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=$a(this.getSaturation()*100),r=$a(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const a=this.clone();return a[t]=Og(n,r),a}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(a,i){return parseInt(n[a]+n[i||a],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof a=="number"?a:1,n<=0){const f=$a(r*255);this.r=f,this.g=f,this.b=f}let i=0,o=0,s=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(l%2-1));l>=0&&l<1?(i=c,o=u):l>=1&&l<2?(i=u,o=c):l>=2&&l<3?(o=c,s=u):l>=3&&l<4?(o=u,s=c):l>=4&&l<5?(i=u,s=c):l>=5&&l<6&&(i=c,s=u);const d=r-c/2;this.r=$a((i+d)*255),this.g=$a((o+d)*255),this.b=$a((s+d)*255)}fromHsv({h:t,s:n,v:r,a}){this._h=t%360,this._s=n,this._v=r,this.a=typeof a=="number"?a:1;const i=$a(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const o=t/60,s=Math.floor(o),l=o-s,c=$a(r*(1-n)*255),u=$a(r*(1-n*l)*255),d=$a(r*(1-n*(1-l))*255);switch(s){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(t){const n=RT(t,qU);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=RT(t,qU);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=RT(t,(r,a)=>a.includes("%")?$a(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}};var U0=2,VU=.16,L_e=.05,D_e=.05,j_e=.15,hie=5,gie=4,B_e=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function GU(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-U0*t:Math.round(e.h)+U0*t:r=n?Math.round(e.h)+U0*t:Math.round(e.h)-U0*t,r<0?r+=360:r>=360&&(r-=360),r}function KU(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-VU*t:t===gie?r=e.s+VU:r=e.s+L_e*t,r>1&&(r=1),n&&t===hie&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function YU(e,t,n){var r;return n?r=e.v+D_e*t:r=e.v-j_e*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function xd(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new $n(e),a=r.toHsv(),i=hie;i>0;i-=1){var o=new $n({h:GU(a,i,!0),s:KU(a,i,!0),v:YU(a,i,!0)});n.push(o)}n.push(r);for(var s=1;s<=gie;s+=1){var l=new $n({h:GU(a,s),s:KU(a,s),v:YU(a,s)});n.push(l)}return t.theme==="dark"?B_e.map(function(c){var u=c.index,d=c.amount;return new $n(t.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var yp={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},A2=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];A2.primary=A2[5];var R2=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];R2.primary=R2[5];var M2=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];M2.primary=M2[5];var fw=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];fw.primary=fw[5];var P2=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];P2.primary=P2[5];var N2=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];N2.primary=N2[5];var L2=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];L2.primary=L2[5];var D2=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];D2.primary=D2[5];var pw=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];pw.primary=pw[5];var j2=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];j2.primary=j2[5];var B2=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];B2.primary=B2[5];var F2=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];F2.primary=F2[5];var z2=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];z2.primary=z2[5];var MT={red:A2,volcano:R2,orange:M2,gold:fw,yellow:P2,lime:N2,green:L2,cyan:D2,blue:pw,geekblue:j2,purple:B2,magenta:F2,grey:z2};function mie(e,t){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=t;const{colorSuccess:a,colorWarning:i,colorError:o,colorInfo:s,colorPrimary:l,colorBgBase:c,colorTextBase:u}=e,d=n(l),f=n(a),h=n(i),g=n(o),m=n(s),v=r(c,u),b=e.colorLink||e.colorInfo,y=n(b),S=new $n(g[1]).mix(new $n(g[3]),50).toHexString();return Object.assign(Object.assign({},v),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:g[1],colorErrorBgHover:g[2],colorErrorBgFilledHover:S,colorErrorBgActive:g[3],colorErrorBorder:g[3],colorErrorBorderHover:g[4],colorErrorHover:g[5],colorError:g[6],colorErrorActive:g[7],colorErrorTextHover:g[8],colorErrorText:g[9],colorErrorTextActive:g[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorLinkHover:y[4],colorLink:y[6],colorLinkActive:y[7],colorBgMask:new $n("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const F_e=e=>{let t=e,n=e,r=e,a=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?a=4:e>=8&&(a=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:a}};function z_e(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:a}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:a+1},F_e(r))}const vie=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function vx(e){return(e+8)/e}function H_e(e){const t=Array.from({length:10}).map((n,r)=>{const a=r-1,i=e*Math.pow(Math.E,a/5),o=r>1?Math.floor(i):Math.ceil(i);return Math.floor(o/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:vx(n)}))}const bie=e=>{const t=H_e(e),n=t.map(u=>u.size),r=t.map(u=>u.lineHeight),a=n[1],i=n[0],o=n[2],s=r[1],l=r[0],c=r[2];return{fontSizeSM:i,fontSize:a,fontSizeLG:o,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(s*a),fontHeightLG:Math.round(c*o),fontHeightSM:Math.round(l*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function U_e(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const So=(e,t)=>new $n(e).setA(t).toRgbString(),$g=(e,t)=>new $n(e).darken(t).toHexString(),W_e=e=>{const t=xd(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},q_e=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:So(r,.88),colorTextSecondary:So(r,.65),colorTextTertiary:So(r,.45),colorTextQuaternary:So(r,.25),colorFill:So(r,.15),colorFillSecondary:So(r,.06),colorFillTertiary:So(r,.04),colorFillQuaternary:So(r,.02),colorBgSolid:So(r,1),colorBgSolidHover:So(r,.75),colorBgSolidActive:So(r,.95),colorBgLayout:$g(n,4),colorBgContainer:$g(n,0),colorBgElevated:$g(n,0),colorBgSpotlight:So(r,.85),colorBgBlur:"transparent",colorBorder:$g(n,15),colorBorderSecondary:$g(n,6)}};function P1(e){yp.pink=yp.magenta,MT.pink=MT.magenta;const t=Object.keys(Ej).map(n=>{const r=e[n]===yp[n]?MT[n]:xd(e[n]);return Array.from({length:10},()=>1).reduce((a,i,o)=>(a[`${n}-${o+1}`]=r[o],a[`${n}${o+1}`]=r[o],a),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),mie(e,{generateColorPalettes:W_e,generateNeutralColorPalettes:q_e})),bie(e.fontSize)),U_e(e)),vie(e)),z_e(e))}const _j=lw(P1),_b={token:Up,override:{override:Up},hashed:!0},Tj=U.createContext(_b),Tb="ant",N1="anticon",V_e=["outlined","borderless","filled","underlined"],G_e=(e,t)=>t||(e?`${Tb}-${e}`:Tb),Ct=p.createContext({getPrefixCls:G_e,iconPrefixCls:N1}),{Consumer:j3t}=Ct,XU={};function Ar(e){const t=p.useContext(Ct),{getPrefixCls:n,direction:r,getPopupContainer:a}=t,i=t[e];return Object.assign(Object.assign({classNames:XU,styles:XU},i),{getPrefixCls:n,direction:r,getPopupContainer:a})}const K_e=`-ant-${Date.now()}-${Math.random()}`;function Y_e(e,t){const n={},r=(o,s)=>{let l=o.clone();return l=(s==null?void 0:s(l))||l,l.toRgbString()},a=(o,s)=>{const l=new $n(o),c=xd(l.toRgbString());n[`${s}-color`]=r(l),n[`${s}-color-disabled`]=c[1],n[`${s}-color-hover`]=c[4],n[`${s}-color-active`]=c[6],n[`${s}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${s}-color-deprecated-bg`]=c[0],n[`${s}-color-deprecated-border`]=c[2]};if(t.primaryColor){a(t.primaryColor,"primary");const o=new $n(t.primaryColor),s=xd(o.toRgbString());s.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=r(o,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(o,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(o,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(o,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(o,c=>c.setA(c.a*.12));const l=new $n(s[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&a(t.successColor,"success"),t.warningColor&&a(t.warningColor,"warning"),t.errorColor&&a(t.errorColor,"error"),t.infoColor&&a(t.infoColor,"info"),`
|
|
28
|
+
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),$a=Math.round;function RT(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(a=>parseFloat(a));for(let a=0;a<3;a+=1)r[a]=t(r[a]||0,n[a]||"",a);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const qU=(e,t,n)=>n===0?e:e/100;function Og(e,t){const n=t||255;return e>n?n:e<0?0:e}let $n=class pie{constructor(t){V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0);function n(r){return r[0]in t&&r[1]in t&&r[2]in t}if(t)if(typeof t=="string"){let a=function(i){return r.startsWith(i)};const r=t.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):a("rgb")?this.fromRgbString(r):a("hsl")?this.fromHslString(r):(a("hsv")||a("hsb"))&&this.fromHsvString(r)}else if(t instanceof pie)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Og(t.r),this.g=Og(t.g),this.b=Og(t.b),this.a=typeof t.a=="number"?Og(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const o=i/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),a=t(this.b);return .2126*n+.7152*r+.0722*a}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=$a(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let a=this.getLightness()-t/100;return a<0&&(a=0),this._c({h:n,s:r,l:a,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let a=this.getLightness()+t/100;return a>1&&(a=1),this._c({h:n,s:r,l:a,a:this.a})}mix(t,n=50){const r=this._c(t),a=n/100,i=s=>(r[s]-this[s])*a+this[s],o={r:$a(i("r")),g:$a(i("g")),b:$a(i("b")),a:$a(i("a")*100)/100};return this._c(o)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),a=i=>$a((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:a("r"),g:a("g"),b:a("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const a=(this.b||0).toString(16);if(t+=a.length===2?a:"0"+a,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=$a(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=$a(this.getSaturation()*100),r=$a(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const a=this.clone();return a[t]=Og(n,r),a}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(a,i){return parseInt(n[a]+n[i||a],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof a=="number"?a:1,n<=0){const f=$a(r*255);this.r=f,this.g=f,this.b=f}let i=0,o=0,s=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(l%2-1));l>=0&&l<1?(i=c,o=u):l>=1&&l<2?(i=u,o=c):l>=2&&l<3?(o=c,s=u):l>=3&&l<4?(o=u,s=c):l>=4&&l<5?(i=u,s=c):l>=5&&l<6&&(i=c,s=u);const d=r-c/2;this.r=$a((i+d)*255),this.g=$a((o+d)*255),this.b=$a((s+d)*255)}fromHsv({h:t,s:n,v:r,a}){this._h=t%360,this._s=n,this._v=r,this.a=typeof a=="number"?a:1;const i=$a(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const o=t/60,s=Math.floor(o),l=o-s,c=$a(r*(1-n)*255),u=$a(r*(1-n*l)*255),d=$a(r*(1-n*(1-l))*255);switch(s){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(t){const n=RT(t,qU);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=RT(t,qU);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=RT(t,(r,a)=>a.includes("%")?$a(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}};var U0=2,VU=.16,L_e=.05,D_e=.05,j_e=.15,hie=5,gie=4,B_e=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function GU(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-U0*t:Math.round(e.h)+U0*t:r=n?Math.round(e.h)+U0*t:Math.round(e.h)-U0*t,r<0?r+=360:r>=360&&(r-=360),r}function KU(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-VU*t:t===gie?r=e.s+VU:r=e.s+L_e*t,r>1&&(r=1),n&&t===hie&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function YU(e,t,n){var r;return n?r=e.v+D_e*t:r=e.v-j_e*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function xd(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new $n(e),a=r.toHsv(),i=hie;i>0;i-=1){var o=new $n({h:GU(a,i,!0),s:KU(a,i,!0),v:YU(a,i,!0)});n.push(o)}n.push(r);for(var s=1;s<=gie;s+=1){var l=new $n({h:GU(a,s),s:KU(a,s),v:YU(a,s)});n.push(l)}return t.theme==="dark"?B_e.map(function(c){var u=c.index,d=c.amount;return new $n(t.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var yp={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},A2=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];A2.primary=A2[5];var R2=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];R2.primary=R2[5];var M2=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];M2.primary=M2[5];var fw=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];fw.primary=fw[5];var P2=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];P2.primary=P2[5];var N2=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];N2.primary=N2[5];var L2=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];L2.primary=L2[5];var D2=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];D2.primary=D2[5];var pw=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];pw.primary=pw[5];var j2=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];j2.primary=j2[5];var B2=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];B2.primary=B2[5];var F2=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];F2.primary=F2[5];var z2=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];z2.primary=z2[5];var MT={red:A2,volcano:R2,orange:M2,gold:fw,yellow:P2,lime:N2,green:L2,cyan:D2,blue:pw,geekblue:j2,purple:B2,magenta:F2,grey:z2};function mie(e,t){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=t;const{colorSuccess:a,colorWarning:i,colorError:o,colorInfo:s,colorPrimary:l,colorBgBase:c,colorTextBase:u}=e,d=n(l),f=n(a),h=n(i),g=n(o),m=n(s),v=r(c,u),b=e.colorLink||e.colorInfo,y=n(b),S=new $n(g[1]).mix(new $n(g[3]),50).toHexString();return Object.assign(Object.assign({},v),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:g[1],colorErrorBgHover:g[2],colorErrorBgFilledHover:S,colorErrorBgActive:g[3],colorErrorBorder:g[3],colorErrorBorderHover:g[4],colorErrorHover:g[5],colorError:g[6],colorErrorActive:g[7],colorErrorTextHover:g[8],colorErrorText:g[9],colorErrorTextActive:g[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorLinkHover:y[4],colorLink:y[6],colorLinkActive:y[7],colorBgMask:new $n("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const F_e=e=>{let t=e,n=e,r=e,a=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?a=4:e>=8&&(a=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:a}};function z_e(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:a}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:a+1},F_e(r))}const vie=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function vx(e){return(e+8)/e}function H_e(e){const t=Array.from({length:10}).map((n,r)=>{const a=r-1,i=e*Math.pow(Math.E,a/5),o=r>1?Math.floor(i):Math.ceil(i);return Math.floor(o/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:vx(n)}))}const bie=e=>{const t=H_e(e),n=t.map(u=>u.size),r=t.map(u=>u.lineHeight),a=n[1],i=n[0],o=n[2],s=r[1],l=r[0],c=r[2];return{fontSizeSM:i,fontSize:a,fontSizeLG:o,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(s*a),fontHeightLG:Math.round(c*o),fontHeightSM:Math.round(l*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function U_e(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const So=(e,t)=>new $n(e).setA(t).toRgbString(),$g=(e,t)=>new $n(e).darken(t).toHexString(),W_e=e=>{const t=xd(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},q_e=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:So(r,.88),colorTextSecondary:So(r,.65),colorTextTertiary:So(r,.45),colorTextQuaternary:So(r,.25),colorFill:So(r,.15),colorFillSecondary:So(r,.06),colorFillTertiary:So(r,.04),colorFillQuaternary:So(r,.02),colorBgSolid:So(r,1),colorBgSolidHover:So(r,.75),colorBgSolidActive:So(r,.95),colorBgLayout:$g(n,4),colorBgContainer:$g(n,0),colorBgElevated:$g(n,0),colorBgSpotlight:So(r,.85),colorBgBlur:"transparent",colorBorder:$g(n,15),colorBorderSecondary:$g(n,6)}};function P1(e){yp.pink=yp.magenta,MT.pink=MT.magenta;const t=Object.keys(Ej).map(n=>{const r=e[n]===yp[n]?MT[n]:xd(e[n]);return Array.from({length:10},()=>1).reduce((a,i,o)=>(a[`${n}-${o+1}`]=r[o],a[`${n}${o+1}`]=r[o],a),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),mie(e,{generateColorPalettes:W_e,generateNeutralColorPalettes:q_e})),bie(e.fontSize)),U_e(e)),vie(e)),z_e(e))}const _j=lw(P1),_b={token:Up,override:{override:Up},hashed:!0},Tj=U.createContext(_b),Tb="ant",N1="anticon",V_e=["outlined","borderless","filled","underlined"],G_e=(e,t)=>t||(e?`${Tb}-${e}`:Tb),Ct=p.createContext({getPrefixCls:G_e,iconPrefixCls:N1}),{Consumer:B3t}=Ct,XU={};function Ar(e){const t=p.useContext(Ct),{getPrefixCls:n,direction:r,getPopupContainer:a}=t,i=t[e];return Object.assign(Object.assign({classNames:XU,styles:XU},i),{getPrefixCls:n,direction:r,getPopupContainer:a})}const K_e=`-ant-${Date.now()}-${Math.random()}`;function Y_e(e,t){const n={},r=(o,s)=>{let l=o.clone();return l=(s==null?void 0:s(l))||l,l.toRgbString()},a=(o,s)=>{const l=new $n(o),c=xd(l.toRgbString());n[`${s}-color`]=r(l),n[`${s}-color-disabled`]=c[1],n[`${s}-color-hover`]=c[4],n[`${s}-color-active`]=c[6],n[`${s}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${s}-color-deprecated-bg`]=c[0],n[`${s}-color-deprecated-border`]=c[2]};if(t.primaryColor){a(t.primaryColor,"primary");const o=new $n(t.primaryColor),s=xd(o.toRgbString());s.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=r(o,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(o,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(o,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(o,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(o,c=>c.setA(c.a*.12));const l=new $n(s[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&a(t.successColor,"success"),t.warningColor&&a(t.warningColor,"warning"),t.errorColor&&a(t.errorColor,"error"),t.infoColor&&a(t.infoColor,"info"),`
|
|
29
29
|
:root {
|
|
30
30
|
${Object.keys(n).map(o=>`--${e}-${o}: ${n[o]};`).join(`
|
|
31
31
|
`)}
|
|
@@ -492,7 +492,7 @@ ${a}
|
|
|
492
492
|
|
|
493
493
|
You help users solve problems quickly and correctly. Be concise, practical, and proactive.
|
|
494
494
|
If requirements are unclear, ask focused clarifying questions before proceeding.`,isDefault:!0},Dw=()=>[{...iGe}];class oGe{async getProviderConfig(){return Bn.get("/bamboo/settings/provider")}async saveProviderConfig(t){return Bn.post("/bamboo/settings/provider",t)}async reloadConfig(){return Bn.post("/bamboo/settings/reload")}async getCopilotAuthStatus(){return Bn.post("/bamboo/copilot/auth/status")}async startCopilotAuth(){return Bn.post("/bamboo/copilot/auth/start")}async completeCopilotAuth(t){return Bn.post("/bamboo/copilot/auth/complete",t)}async authenticateCopilot(){return Bn.post("/bamboo/copilot/authenticate")}async logoutCopilot(){return Bn.post("/bamboo/copilot/logout")}async fetchProviderModels(t){return(await Bn.post("/bamboo/settings/provider/models",{provider:t})).models}}const lo=new oGe,Ho=Qh((e,t)=>({currentProvider:"copilot",providerConfig:{provider:"copilot",providers:{}},isLoading:!1,error:null,loadProviderConfig:async()=>{e({isLoading:!0,error:null});try{const n=await lo.getProviderConfig();e({providerConfig:n,currentProvider:n.provider,isLoading:!1})}catch(n){console.error("Failed to load provider config:",n),e({error:n instanceof Error?n.message:"Failed to load provider config",isLoading:!1})}},setCurrentProvider:n=>{e({currentProvider:n})},updateProviderConfig:n=>{e(r=>({providerConfig:{...r.providerConfig,...n}}))},getActiveModel:()=>{const n=t(),r=n.providerConfig.providers[n.currentProvider];if(r&&"model"in r&&r.model)return r.model}})),sGe=Object.freeze(Object.defineProperty({__proto__:null,useProviderStore:Ho},Symbol.toStringTag,{value:"Module"})),tV="copilot_auto_generate_titles",mc=Rs.getInstance(),_p=Dw()[0],lGe=(_p==null?void 0:_p.id)||"general_assistant";var Sae;const Cde=((Sae=_p==null?void 0:_p.content)==null?void 0:Sae.trim())||"",cGe=()=>{try{const e=globalThis.crypto;if(e!=null&&e.randomUUID)return e.randomUUID()}catch{}return`id_${Date.now()}_${Math.random().toString(16).slice(2)}`},uGe=()=>{let e=Jh().trim().replace(/\/+$/,"");return e.endsWith("/v1")&&(e=e.slice(0,-3)),`${e}/api/v1`},Ede=e=>{const t=e.trim();if(!t.startsWith("bamboo-attachment://"))return null;const n=t.slice(20),[r,a]=n.split("/",2);return!r||!a?null:{sessionId:r,attachmentId:a}},dGe=e=>{const t=Ede(e);return t?`${uGe()}/sessions/${encodeURIComponent(t.sessionId)}/attachments/${encodeURIComponent(t.attachmentId)}`:e},Vk=e=>{var r,a;const t=Number.isFinite(Date.parse(e.created_at))?Date.parse(e.created_at):Date.now(),n=e.token_usage?{systemTokens:e.token_usage.system_tokens,summaryTokens:e.token_usage.summary_tokens,windowTokens:e.token_usage.window_tokens,totalTokens:e.token_usage.total_tokens,budgetLimit:e.token_usage.budget_limit}:void 0;return{id:e.id,kind:e.kind,parentSessionId:e.parent_session_id??null,rootSessionId:e.root_session_id,spawnDepth:e.spawn_depth,createdByScheduleId:e.created_by_schedule_id??null,isRunning:e.is_running,updatedAt:e.updated_at,lastActivityAt:e.last_activity_at,messageCount:e.message_count,hasAttachments:e.has_attachments,lastRunStatus:e.last_run_status,lastRunError:e.last_run_error,title:e.title||"Session",createdAt:t,pinned:e.pinned,messages:[],config:{systemPromptId:lGe,baseSystemPrompt:Cde,lastUsedEnhancedPrompt:null,tokenUsage:n,truncationOccurred:(r=e.token_usage)==null?void 0:r.truncation_occurred,segmentsRemoved:(a=e.token_usage)==null?void 0:a.segments_removed,compressionEvents:[]},currentInteraction:null}},fGe=(e,t)=>{var a,i,o;const n=new Map,r=[];for(const s of t){const l=s.created_at||new Date().toISOString();if(s.role==="system"){const c={role:"system",id:s.id,createdAt:l,content:s.content||"",isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(c);continue}if(s.role==="user"){const c=new Map;for(const f of s.image_ocr||[]){const h=(a=f.image_url)==null?void 0:a.trim();if(!h)continue;const m=(f.lines||[]).map(v=>((v==null?void 0:v.text)||"").trim()).filter(Boolean);c.set(h,{ocrText:m.length?m.join(`
|
|
495
|
-
`):void 0,ocrError:f.error?String(f.error):void 0})}const u=[];for(const f of s.content_parts||[]){if(f.type!=="image_url")continue;const h=((i=f.image_url)==null?void 0:i.url)||"";if(!h)continue;const g=dGe(h),m=Ede(h),v=c.get(h.trim());u.push({id:cGe(),url:g,ocrText:v==null?void 0:v.ocrText,ocrError:v==null?void 0:v.ocrError,name:m?`attachment-${m.attachmentId}`:"image",size:0,type:"image/*"})}const d={role:"user",id:s.id,createdAt:l,content:s.content||"",images:u.length?u:void 0,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(d);continue}if(s.role==="assistant"){const c=s.tool_calls||[];if(c.length>0){if((s.content||"").trim()){const g=typeof s.reasoning=="string"&&s.reasoning.trim().length>0?{reasoning:s.reasoning}:{},m={role:"assistant",type:"text",id:`${s.id}_text`,createdAt:l,content:s.content||"",metadata:g,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(m)}for(const g of c)n.set(g.id,((o=g.function)==null?void 0:o.name)||"unknown");const h={role:"assistant",type:"tool_call",id:s.id,createdAt:l,toolCalls:c.map(g=>{var m;return{toolCallId:g.id,toolName:((m=g.function)==null?void 0:m.name)||"unknown",parameters:(()=>{var v,b;try{return JSON.parse(((v=g.function)==null?void 0:v.arguments)||"{}")}catch{return{raw:((b=g.function)==null?void 0:b.arguments)||""}}})(),streamingOutput:""}}),isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(h);continue}const u=typeof s.reasoning=="string"&&s.reasoning.trim().length>0?{reasoning:s.reasoning}:{},d={role:"assistant",type:"text",id:s.id,createdAt:l,content:s.content||"",metadata:u,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(d);continue}if(s.role==="tool"){const c=s.tool_call_id||"unknown",u=n.get(c)||"unknown",d=s.tool_success===!1||s.tool_success==null&&typeof s.content=="string"&&s.content.trimStart().startsWith("Error:"),f={role:"assistant",type:"tool_result",id:s.id,createdAt:l,toolName:u,toolCallId:c,result:{tool_name:u,result:s.content||"",display_preference:"Default"},isError:d,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(f);continue}}return r},pGe=(e,t)=>({chats:[],currentSessionId:null,latestActiveSessionId:null,processingChats:new Set,autoGenerateTitles:!0,isUpdatingAutoTitlePreference:!1,subSessionsByParent:{},addChat:async n=>{var c,u,d;const r=(n.title||"New Session").trim(),a=((u=(c=n.config)==null?void 0:c.baseSystemPrompt)==null?void 0:u.trim())||"",o=((d=Ho.getState().getActiveModel())==null?void 0:d.trim())||void 0,s=await mc.createSession({title:r,system_prompt:a||void 0,model:o}),l={...Vk(s.session),title:r,config:{...n.config,baseSystemPrompt:a||Cde},messages:[],currentInteraction:null};return e(f=>{const h=[l,...f.chats.filter(g=>g.id!==l.id)];return{...f,chats:h,currentSessionId:l.id,latestActiveSessionId:l.id}}),l.id},selectSession:n=>{const r=t();r.currentSessionId===n&&r.latestActiveSessionId===n||e({currentSessionId:n,latestActiveSessionId:n})},deleteSession:async n=>{try{await mc.deleteSession(n)}catch(r){console.error(`[ChatSlice] Failed to delete backend session ${n}:`,r)}e(r=>{var l;const a=new Set;for(const c of r.chats)c.id===n&&a.add(c.id),c.rootSessionId===n&&a.add(c.id);const i=r.chats.filter(c=>!a.has(c.id)),o=r.currentSessionId&&a.has(r.currentSessionId)?null:r.currentSessionId,s=r.latestActiveSessionId&&a.has(r.latestActiveSessionId)?((l=i[0])==null?void 0:l.id)??null:r.latestActiveSessionId;return{...r,chats:i,currentSessionId:o,latestActiveSessionId:s}})},deleteSessions:async n=>{for(const r of n)await t().deleteSession(r)},updateSession:(n,r)=>{e(i=>{const o=i.chats.map(s=>s.id===n?{...s,...r}:s);return{...i,chats:o}});const a={};typeof r.title=="string"&&(a.title=r.title),typeof r.pinned=="boolean"&&(a.pinned=r.pinned),Object.keys(a).length>0&&mc.patchSession(n,a).catch(i=>{console.warn(`[ChatSlice] Failed to patch session ${n}:`,i)})},pinSession:n=>{t().updateSession(n,{pinned:!0})},unpinSession:n=>{t().updateSession(n,{pinned:!1})},setMessages:(n,r)=>{t().chats.find(i=>i.id===n)&&t().updateSession(n,{messages:r})},addMessage:async(n,r)=>{const a=t().chats.find(o=>o.id===n);if(!a)return;const i=[...a.messages,r];t().updateSession(n,{messages:i})},updateMessage:(n,r,a)=>{const i=t().chats.find(s=>s.id===n);if(!i)return;const o=i.messages.map(s=>{if(s.id!==r)return s;const l={...s};return Object.keys(a).forEach(c=>{Object.prototype.hasOwnProperty.call(l,c)&&(l[c]=a[c])}),l});t().updateSession(n,{messages:o})},deleteMessage:(n,r)=>{const a=t().chats.find(o=>o.id===n);if(!a)return;const i=a.messages.filter(o=>o.id!==r);t().updateSession(n,{messages:i}),mc.deleteSessionMessage(n,r).catch(o=>{console.warn(`[ChatSlice] Failed to delete message ${r} from session ${n}:`,o)})},refreshChats:async()=>{const r=(await mc.listSessions()).sessions.map(Vk);e(a=>{const i=new Map(a.chats.map(s=>[s.id,s])),o=r.map(s=>{const l=i.get(s.id);return l?{...s,messages:l.messages,config:l.config}:s});return{...a,chats:o}})},loadChats:async()=>{var s;const n=localStorage.getItem(tV),r=n===null?t().autoGenerateTitles:n==="true";let a=await mc.listSessions();(!a.sessions||a.sessions.length===0)&&(a={sessions:[(await mc.createSession({title:"New Session"})).session]});const i=a.sessions.map(Vk),o=((s=i[0])==null?void 0:s.id)??null;e({chats:i,latestActiveSessionId:o,currentSessionId:o,processingChats:new Set,autoGenerateTitles:r}),o&&await t().loadChatHistory(o)},loadChatHistory:async(n,r)=>{var s,l,c;const a=(r==null?void 0:r.mode)??"replace",i=Math.max(0,(r==null?void 0:r.retries)??0),o=Math.max(0,(r==null?void 0:r.retryDelayMs)??0);for(let u=0;u<=i;u+=1)try{const d=t().chats.find(m=>m.id===n);if(!d)return;const f=await mc.getHistory(n),h=(s=f.messages[f.messages.length-1])==null?void 0:s.role;if(r!=null&&r.waitForAssistant&&h==="user"&&u<i){const m=o>0?o*(u+1):200*(u+1);await new Promise(v=>setTimeout(v,m));continue}const g=fGe(n,f.messages);if(a==="monotonic"){const m=d.messages||[],v=m.length,b=g.length,y=(l=g[g.length-1])==null?void 0:l.role,S=(c=m[m.length-1])==null?void 0:c.role;if(!(b>=v||typeof y=="string"&&y!=="user"||S==="user"&&y!=="user")){t().updateSession(n,{messageCount:Math.max(d.messageCount??0,f.messages.length)});return}}t().updateSession(n,{messages:g,messageCount:f.messages.length,config:{...d.config||{},compressionEvents:(f.compression_events||[]).map(m=>({id:m.id,createdAt:m.created_at,messagesCompressed:m.messages_compressed,segmentsRemoved:m.segments_removed}))}});return}catch(d){if(u>=i){console.warn(`[ChatSlice] Failed to load history for ${n}:`,d);return}const f=o>0?o*(u+1):200*(u+1);await new Promise(h=>setTimeout(h,f))}},upsertSubSessionProgress:(n,r,a)=>{e(i=>{const o=i.subSessionsByParent[n]||{},s=o[r]||{},l={...o,[r]:{...s,...a}};return{subSessionsByParent:{...i.subSessionsByParent,[n]:l}}})},clearSubSessionProgress:(n,r)=>{e(a=>{const i=a.subSessionsByParent[n];if(!i||!i[r])return{};const{[r]:o,...s}=i;return{subSessionsByParent:{...a.subSessionsByParent,[n]:s}}})},setSessionProcessing:(n,r)=>{e(a=>{const i=new Set(a.processingChats);return r?i.add(n):i.delete(n),{processingChats:i}})},isSessionProcessing:n=>t().processingChats.has(n),setAutoGenerateTitlesPreference:async n=>{const r=t().autoGenerateTitles;e({autoGenerateTitles:n,isUpdatingAutoTitlePreference:!0});try{localStorage.setItem(tV,String(n))}catch(a){throw console.warn("[ChatSlice] Failed to update auto-title preference:",a),e({autoGenerateTitles:r}),a}finally{e({isUpdatingAutoTitlePreference:!1})}}});class jw extends Error{constructor(n="Proxy authentication required"){super(n);Bt(this,"code","proxy_auth_required");this.name="ProxyAuthRequiredError"}}const Gu=class Gu{constructor(){}static getInstance(){return Gu.instance||(Gu.instance=new Gu),Gu.instance}resolveOpenAICompatBaseUrl(){const t=Jh().trim().replace(/\/+$/,"");return t.endsWith("/openai/v1")?t:`${t.endsWith("/v1")?t.slice(0,-3):t}/openai/v1`}async getModels(){var t,n;try{return(await new cF({baseUrl:this.resolveOpenAICompatBaseUrl()}).get("models")).data.map(i=>i.id)}catch(r){if(console.error("Failed to fetch models from HTTP API:",r),r instanceof Zp){if(r.status===428)throw new jw(r.message);let a;if(r.body)try{a=JSON.parse(r.body)}catch{}if(a&&typeof a=="object"&&"error"in a&&((t=a.error)==null?void 0:t.code)==="proxy_auth_required")throw new jw(((n=a.error)==null?void 0:n.message)||r.message)}throw r}}};Bt(Gu,"instance");let Bw=Gu;const BE=Bw.getInstance(),hGe=Object.freeze(Object.defineProperty({__proto__:null,ModelService:Bw,ProxyAuthRequiredError:jw,modelService:BE},Symbol.toStringTag,{value:"Module"})),gGe=async e=>{var t;if(typeof navigator>"u"||!((t=navigator.clipboard)!=null&&t.writeText))throw new Error("navigator.clipboard.writeText is unavailable");await navigator.clipboard.writeText(e)},mGe=e=>{if(typeof document>"u")throw new Error("document is unavailable");const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)throw new Error("document.execCommand('copy') returned false")},Ko=async e=>{try{await gGe(e);return}catch(t){try{mGe(e);return}catch(n){const r=t instanceof Error?t.message:String(t),a=n instanceof Error?n.message:String(n);throw new Error(`Clipboard copy failed: navigator(${r}); fallback(${a})`)}}};class vGe{async copyToClipboard(t){await Ko(t)}async getBambooConfig(){try{return await Bn.get("bamboo/config")}catch(t){return console.error("Failed to fetch Bamboo config:",t),{}}}async getBambooTools(){try{return await Bn.get("bamboo/tools")}catch(t){return console.error("Failed to fetch Bamboo tools:",t),{tools:[]}}}async setBambooConfig(t){return Bn.post("bamboo/config",t)}async validateBambooConfigPatch(t){return Bn.post("bamboo/config/validate",t)}async setProxyAuth(t){return Bn.post("bamboo/proxy-auth",t)}async getProxyAuthStatus(){try{return await Bn.get("bamboo/proxy-auth/status")}catch(t){return console.error("Failed to fetch proxy auth status:",t),{configured:!1,username:null}}}async clearProxyAuth(){return Bn.post("bamboo/proxy-auth",{username:"",password:""})}async getAnthropicModelMapping(){try{return await Bn.get("bamboo/anthropic-model-mapping")}catch(t){return console.error("Failed to fetch Anthropic model mapping:",t),{mappings:{}}}}async setAnthropicModelMapping(t){return Bn.post("bamboo/anthropic-model-mapping",t)}async resetBambooConfig(){return Bn.post("bamboo/config/reset",{})}async saveWorkflow(t,n){return Bn.post("bamboo/workflows",{name:t,content:n})}async deleteWorkflow(t){return Bn.delete(`bamboo/workflows/${encodeURIComponent(t)}`)}async getKeywordMaskingConfig(){try{return await Bn.get("bamboo/keyword-masking")}catch(t){return console.error("Failed to fetch keyword masking config:",t),{entries:[]}}}async updateKeywordMaskingConfig(t){return Bn.post("bamboo/keyword-masking",t)}async validateKeywordEntries(t){return Bn.post("bamboo/keyword-masking/validate",t)}async getSetupStatus(){return await Bn.get("bamboo/setup/status")}async markSetupComplete(){return Bn.post("bamboo/setup/complete",{})}async resetSetupStatus(){await Bn.post("bamboo/setup/incomplete",{})}}const Ku=class Ku{constructor(){Bt(this,"httpUtilityService",new vGe)}static getInstance(){return Ku.instance||(Ku.instance=new Ku),Ku.instance}getUtilityService(){return{copyToClipboard:t=>this.httpUtilityService.copyToClipboard(t),getBambooConfig:()=>this.httpUtilityService.getBambooConfig(),getBambooTools:()=>this.httpUtilityService.getBambooTools(),setBambooConfig:t=>this.httpUtilityService.setBambooConfig(t),validateBambooConfigPatch:t=>this.httpUtilityService.validateBambooConfigPatch(t),setProxyAuth:t=>this.httpUtilityService.setProxyAuth(t),getProxyAuthStatus:()=>this.httpUtilityService.getProxyAuthStatus(),clearProxyAuth:()=>this.httpUtilityService.clearProxyAuth(),getAnthropicModelMapping:()=>this.httpUtilityService.getAnthropicModelMapping(),setAnthropicModelMapping:t=>this.httpUtilityService.setAnthropicModelMapping(t),resetBambooConfig:()=>this.httpUtilityService.resetBambooConfig(),resetSetupStatus:()=>this.httpUtilityService.resetSetupStatus(),saveWorkflow:(t,n)=>this.httpUtilityService.saveWorkflow(t,n),deleteWorkflow:t=>this.httpUtilityService.deleteWorkflow(t),getKeywordMaskingConfig:()=>this.httpUtilityService.getKeywordMaskingConfig(),updateKeywordMaskingConfig:t=>this.httpUtilityService.updateKeywordMaskingConfig(t),validateKeywordEntries:t=>this.httpUtilityService.validateKeywordEntries(t),getSetupStatus:()=>this.httpUtilityService.getSetupStatus(),markSetupComplete:()=>this.httpUtilityService.markSetupComplete()}}async copyToClipboard(t){return this.getUtilityService().copyToClipboard(t)}async getBambooConfig(){return this.getUtilityService().getBambooConfig()}async getBambooTools(){return this.getUtilityService().getBambooTools()}async setBambooConfig(t){return this.getUtilityService().setBambooConfig(t)}async validateBambooConfigPatch(t){return this.getUtilityService().validateBambooConfigPatch(t)}async setProxyAuth(t){return this.getUtilityService().setProxyAuth(t)}async getProxyAuthStatus(){return this.getUtilityService().getProxyAuthStatus()}async clearProxyAuth(){return this.getUtilityService().clearProxyAuth()}async getAnthropicModelMapping(){return this.getUtilityService().getAnthropicModelMapping()}async setAnthropicModelMapping(t){return this.getUtilityService().setAnthropicModelMapping(t)}async resetBambooConfig(){return this.getUtilityService().resetBambooConfig()}async resetSetupStatus(){return this.getUtilityService().resetSetupStatus()}async saveWorkflow(t,n){return this.getUtilityService().saveWorkflow(t,n)}async deleteWorkflow(t){return this.getUtilityService().deleteWorkflow(t)}async getKeywordMaskingConfig(){return this.getUtilityService().getKeywordMaskingConfig()}async updateKeywordMaskingConfig(t){return this.getUtilityService().updateKeywordMaskingConfig(t)}async validateKeywordEntries(t){return this.getUtilityService().validateKeywordEntries(t)}async getSetupStatus(){return this.getUtilityService().getSetupStatus()}async markSetupComplete(){return this.getUtilityService().markSetupComplete()}};Bt(Ku,"instance");let Vi=Ku;const Dr=Vi.getInstance();let Bg=null,Fg=null;const Gk=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,Rc=Qh((e,t)=>({config:null,proxyAuthStatus:null,isLoadingConfig:!1,isLoadingProxyAuthStatus:!1,lastLoadedAt:null,error:null,loadConfig:async({force:n=!1}={})=>{const r=t().config;if(!n&&r)return r;if(Bg)return Bg;Bg=(async()=>{e({isLoadingConfig:!0,error:null});try{const a=await Dr.getBambooConfig()??{};return e({config:a,lastLoadedAt:Date.now(),error:null}),a}catch(a){const i=Gk(a,"Failed to load Bamboo config");throw e({error:i}),a}finally{e({isLoadingConfig:!1})}})();try{return await Bg}finally{Bg=null}},saveConfig:async n=>{e({isLoadingConfig:!0,error:null,config:n});try{const r=await Dr.setBambooConfig(n);return e({config:r,lastLoadedAt:Date.now(),error:null}),r}catch(r){const a=Gk(r,"Failed to save Bamboo config");throw e({error:a}),r}finally{e({isLoadingConfig:!1})}},patchConfig:async n=>{const a={...await t().loadConfig()??{},...n??{}};return t().saveConfig(a)},loadProxyAuthStatus:async({force:n=!1}={})=>{const r=t().proxyAuthStatus;if(!n&&r)return r;if(Fg)return Fg;Fg=(async()=>{e({isLoadingProxyAuthStatus:!0,error:null});try{const a=await Dr.getProxyAuthStatus();return e({proxyAuthStatus:a,error:null}),a}catch(a){const i=Gk(a,"Failed to load proxy auth status");throw e({error:i}),a}finally{e({isLoadingProxyAuthStatus:!1})}})();try{return await Fg}finally{Fg=null}},applyProxyAuth:async n=>{await Dr.setProxyAuth(n),await t().loadProxyAuthStatus({force:!0})},clearProxyAuth:async()=>{await Dr.clearProxyAuth(),await t().loadProxyAuthStatus({force:!0})}}));let zg=null;const bGe=(e,t)=>({models:[],selectedModel:void 0,isLoadingModels:!1,modelsError:null,configModel:void 0,setSelectedModel:n=>{e({selectedModel:n})},loadConfigModel:async()=>{try{const n=await Rc.getState().loadConfig(),r=typeof(n==null?void 0:n.model)=="string"?n.model:void 0;r&&e({configModel:r})}catch(n){console.error("Failed to load model from config:",n)}},fetchModels:async()=>{if(zg)return zg;zg=(async()=>{e({isLoadingModels:!0,modelsError:null});try{try{if(!(await Dr.getSetupStatus()).is_complete){console.log("Setup not complete, skipping model fetch"),e({models:[],selectedModel:void 0,isLoadingModels:!1,modelsError:"Complete setup to access all models"});return}}catch(r){console.error("Failed to check setup status:",r)}const n=await BE.getModels();e(r=>{const a=r.selectedModel;let i=r.selectedModel;return a&&n.includes(a)||(n.length>0?i=n[0]:i=void 0),{...r,models:n,selectedModel:i,modelsError:n.length>0?null:"No available model options"}}),t().models.length===0&&console.warn("No models available from service")}catch(n){const r=n instanceof Error?n.message:String(n);if(console.error("Failed to fetch models:",n),n instanceof jw){e(a=>({...a,models:a.models,selectedModel:a.selectedModel,modelsError:r||"Proxy authentication required. Please configure proxy auth."}));return}e(a=>({...a,models:[],selectedModel:a.selectedModel,modelsError:r}))}finally{e({isLoadingModels:!1})}})();try{await zg}finally{zg=null}}}),yGe=["system_prompt","system_prompt_selected_id"],Kk=e=>({id:e.id,name:e.name||e.id,content:e.content||"",description:e.description,isDefault:!!e.is_default}),Ac=class Ac{constructor(){Bt(this,"deprecatedKeysCleanupDone",!1)}static getInstance(){return Ac.instance||(Ac.instance=new Ac),Ac.instance.cleanupDeprecatedPromptStorageKeys(),Ac.instance}cleanupDeprecatedPromptStorageKeys(){if(!this.deprecatedKeysCleanupDone){this.deprecatedKeysCleanupDone=!0;try{for(const t of yGe)localStorage.removeItem(t)}catch(t){console.warn("[SystemPromptService] Failed to cleanup deprecated prompt storage keys:",t)}}}async getSystemPromptPresets(){try{const t=await fn.get("prompt-presets"),r=(Array.isArray(t==null?void 0:t.prompts)?t.prompts:[]).filter(a=>a.id&&a.id.trim().length>0).map(Kk);if(r.length>0)return r}catch(t){console.error("Failed to load prompt presets from backend:",t)}return Dw()}async createSystemPromptPreset(t){var a;const n={name:t.name,content:t.content};(a=t.id)!=null&&a.trim()&&(n.id=t.id.trim()),t.description!==void 0&&(n.description=t.description);const r=await fn.post("prompt-presets",n);if(!(r!=null&&r.prompt))throw new Error("Backend did not return created prompt preset");return Kk(r.prompt)}async updateSystemPromptPreset(t){const n=encodeURIComponent(t.id),r={name:t.name,content:t.content,description:t.description},a=await fn.patch(`prompt-presets/${n}`,r);if(!(a!=null&&a.prompt))throw new Error("Backend did not return updated prompt preset");return Kk(a.prompt)}async deleteSystemPromptPreset(t){const n=encodeURIComponent(t);await fn.delete(`prompt-presets/${n}`)}async findPresetById(t){return(await this.getSystemPromptPresets()).find(r=>r.id===t)}async getCurrentSystemPromptContent(t){const n=await this.findPresetById(t);if(n)return n.content;const r=await this.getSystemPromptPresets(),a=r.find(i=>i.isDefault)||r[0];return(a==null?void 0:a.content)||""}};Bt(Ac,"instance");let Fw=Ac;const nV="copilot_last_selected_prompt_id",_de="copilot_custom_system_prompts_v2",Tde="copilot_custom_system_prompts_v2_migrated_to_backend",kde="general_assistant",uF=80,cp=Fw.getInstance();let gS=null;function dF(e){const t=e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t.length===0?`prompt_${Date.now()}_${Math.random().toString(36).substring(2,9)}`:t.slice(0,uF)}function Ode(e){if(typeof e!="string")return null;const t=e.toLowerCase().trim().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return t?t.slice(0,uF):null}function $de(e,t){if(!t.has(e))return e;let n=2;for(;;){const r=`_${n}`,i=`${e.slice(0,Math.max(0,uF-r.length))}${r}`;if(!t.has(i))return i;n+=1}}function Ide(){try{const e=localStorage.getItem(_de);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=new Set,r=[];for(const a of t){const i=typeof(a==null?void 0:a.name)=="string"?a.name.trim():"",o=typeof(a==null?void 0:a.content)=="string"?a.content.trim():"";if(!i||!o)continue;const l=Ode(a==null?void 0:a.id)||dF(i),c=$de(l,n);c!==kde&&(n.add(c),r.push({id:c,name:i,content:o,description:typeof(a==null?void 0:a.description)=="string"&&a.description.trim()||void 0,isDefault:!!(a!=null&&a.isDefault)}))}return r}catch(e){return console.error("[promptSlice] Failed to read legacy custom prompts:",e),[]}}function Ade(){try{return localStorage.getItem(Tde)==="1"}catch(e){return console.error("[promptSlice] Failed to read migration marker:",e),!1}}function rV(){try{localStorage.setItem(Tde,"1")}catch(e){console.error("[promptSlice] Failed to write migration marker:",e)}}function aV(){try{localStorage.removeItem(_de)}catch(e){console.error("[promptSlice] Failed to clear legacy custom prompts:",e)}}async function SGe(){var a,i;if(Ade())return;const e=Ide();if(e.length===0){aV(),rV();return}const t=await cp.getSystemPromptPresets(),n=new Set(t.map(o=>o.id));let r=!1;for(const o of e){const s=(a=o.name)==null?void 0:a.trim(),l=(i=o.content)==null?void 0:i.trim();if(!s||!l||o.id===kde||o.isDefault)continue;const c=Ode(o.id)||dF(s),u=$de(c,n);try{const d=await cp.createSystemPromptPreset({id:u,name:s,content:l,description:o.description});n.add(d.id)}catch(d){r=!0,console.error(`[promptSlice] Failed to migrate legacy prompt '${s}' to backend:`,d)}}r||(aV(),rV())}async function xGe(){gS||(gS=SGe().finally(()=>{gS=null})),await gS}const wGe=(e,t)=>({systemPrompts:[],lastSelectedPromptId:localStorage.getItem(nV)||null,loadSystemPrompts:async()=>{try{await xGe()}catch(a){console.warn("[promptSlice] Legacy prompt migration skipped:",a)}let n=[];try{n=await cp.getSystemPromptPresets()}catch(a){console.error("Failed to load system prompts from backend:",a)}let r=n.length?n:Dw();if(!Ade()){const a=Ide();r=CGe(r,a)}r.length===0&&(r=Dw()),e({systemPrompts:r})},addSystemPrompt:async n=>{try{await cp.createSystemPromptPreset({id:dF(n.name),name:n.name,content:n.content,description:n.description}),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to add system prompt:",r),r}},updateSystemPrompt:async n=>{try{await cp.updateSystemPromptPreset(n),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to update system prompt:",r),r}},deleteSystemPrompt:async n=>{try{await cp.deleteSystemPromptPreset(n),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to delete system prompt:",r),r}},setLastSelectedPromptId:n=>{e({lastSelectedPromptId:n});try{localStorage.setItem(nV,n)}catch(r){console.error("Failed to save last selected prompt ID to localStorage:",r)}}}),CGe=(e,t)=>{const n=new Map;return e.forEach(r=>{n.set(r.id,r)}),t.forEach(r=>{n.set(r.id,r)}),Array.from(n.values())},EGe=(e,t)=>({currentRequestController:null,setCurrentRequestController:n=>{e({currentRequestController:n})},cancelCurrentRequest:()=>{var n;(n=t().currentRequestController)==null||n.abort(),t().processingChats.forEach(r=>{t().setSessionProcessing(r,!1)}),e({currentRequestController:null})}});class _Ge{async listSkills(t,n){const r=new URLSearchParams;t!=null&&t.search&&r.append("search",t.search),n&&r.append("refresh","true");const a=r.toString(),i=a?`skills?${a}`:"skills";return Bn.get(i)}async getSkill(t){return Bn.get(`skills/${t}`)}async getFilteredTools(t){const n=t?`?session_id=${encodeURIComponent(t)}`:"";return(await Bn.get(`skills/filtered-tools${n}`)).tools??[]}}const iV=new _Ge,TGe=(e,t)=>({skills:[],isLoadingSkills:!1,skillsError:null,loadSkills:async(n,r)=>{e({isLoadingSkills:!0,skillsError:null});try{const a=await iV.listSkills(n,r);e({skills:a.skills,isLoadingSkills:!1})}catch(a){e({skillsError:a instanceof Error?a.message:"Failed to load skills",isLoadingSkills:!1})}},getSkill:async n=>{e({isLoadingSkills:!0,skillsError:null});try{const r=await iV.getSkill(n),a=t().skills,o=a.findIndex(s=>s.id===r.id)>=0?a.map(s=>s.id===r.id?r:s):[...a,r];e({skills:o,isLoadingSkills:!1})}catch(r){e({skillsError:r instanceof Error?r.message:"Failed to get skill",isLoadingSkills:!1})}},clearSkillsError:()=>{e({skillsError:null})}}),kGe=e=>({tokenUsages:{},truncationOccurred:{},segmentsRemoved:{},updateTokenUsage:(t,n)=>e(r=>({tokenUsages:{...r.tokenUsages,[t]:n}})),setTruncationInfo:(t,n,r)=>e(a=>({truncationOccurred:{...a.truncationOccurred,[t]:n},segmentsRemoved:{...a.segmentsRemoved,[t]:r}})),clearTokenUsage:t=>e(n=>{const{[t]:r,...a}=n.tokenUsages,{[t]:i,...o}=n.truncationOccurred,{[t]:s,...l}=n.segmentsRemoved;return{tokenUsages:a,truncationOccurred:o,segmentsRemoved:l}})}),OGe=(e,t)=>({taskLists:{},taskListVersions:{},activeItems:{},evaluationStates:{},setTaskList:(n,r)=>e(a=>({taskLists:{...a.taskLists,[n]:r},taskListVersions:{...a.taskListVersions,[n]:r.version||0}})),updateTaskListDelta:(n,r)=>e(a=>{const i=a.taskListVersions[n]||0;if(r.version<=i)return a;const o=a.taskLists[n];if(!o)return a;const s=o.items.map(l=>l.id===r.item_id?{...l,status:r.status,tool_calls_count:r.tool_calls_count}:l);return{taskLists:{...a.taskLists,[n]:{...o,items:s,updated_at:new Date().toISOString()}},taskListVersions:{...a.taskListVersions,[n]:r.version},activeItems:{...a.activeItems,[n]:r.status==="in_progress"?r.item_id:null}}}),clearTaskList:n=>e(r=>{const{[n]:a,...i}=r.taskLists,{[n]:o,...s}=r.taskListVersions,{[n]:l,...c}=r.activeItems,{[n]:u,...d}=r.evaluationStates;return{taskLists:i,taskListVersions:s,activeItems:c,evaluationStates:d}}),getTaskListVersion:n=>t().taskListVersions[n]||0,setEvaluationState:(n,r)=>e(a=>({evaluationStates:{...a.evaluationStates,[n]:r}})),clearEvaluationState:n=>e(r=>{const{[n]:a,...i}=r.evaluationStates;return{evaluationStates:i}})}),Rde="chat_input_reasoning_by_session_v1",Mde="chat_input_reasoning_last_used_v1",oV={content:"",referenceText:null,attachments:[],reasoningEffort:"medium"},fF=e=>e==="low"||e==="medium"||e==="high"||e==="xhigh"||e==="max",Pde=()=>{if(typeof window>"u")return{};try{const e=localStorage.getItem(Rde);if(!e)return{};const t=JSON.parse(e),n={};for(const[r,a]of Object.entries(t||{}))fF(a)&&(n[r]=a);return n}catch{return{}}},$Ge=e=>{if(!(typeof window>"u"))try{localStorage.setItem(Rde,JSON.stringify(e))}catch{}},IGe=()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem(Mde);return fF(e)?e:void 0}catch{return}},AGe=e=>{if(!(typeof window>"u"))try{localStorage.setItem(Mde,e)}catch{}},pF=e=>{const t=Pde();return fF(t[e])?t[e]:IGe()},Hg=e=>({...oV,reasoningEffort:pF(e)??oV.reasoningEffort}),RGe=(e,t)=>({inputStates:{},pendingQuestionRespond:null,setInputContent:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),content:r}}})),setReferenceText:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),referenceText:r}}})),setAttachments:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),attachments:r}}})),setInputReasoningEffort:(n,r)=>{e(i=>({inputStates:{...i.inputStates,[n]:{...i.inputStates[n]||Hg(n),reasoningEffort:r}}}));const a=Pde();a[n]=r,$Ge(a),AGe(r)},clearInputState:n=>e(r=>{const{[n]:a,...i}=r.inputStates;return{inputStates:i}}),getInputState:n=>t().inputStates[n]||Hg(n),setPendingQuestionRespond:n=>e({pendingQuestionRespond:n})}),MGe="bamboo_proxy_auth",PGe=()=>{try{const e=localStorage.getItem(MGe);if(!e)return null;const t=JSON.parse(e);if(!t||typeof t!="object")return null;const n=typeof t.username=="string"?t.username.trim():"",r=typeof t.password=="string"?t.password:"";return n?{username:n,password:r}:null}catch{return null}},NGe="auto",LGe="required",DGe=1e4,jGe=2e3,BGe=Rs.getInstance();let sV=null,Ug=null,lV=null,Wg=null;const cV=new WeakMap,Ue=Qh()(YVe(ZVe((e,t,n)=>({...pGe(e,t),...bGe(e,t),...wGe(e,t),...EGe(e,t),...TGe(e,t),...kGe(e),...OGe(e,t),...RGe(e,t),agentAvailability:null,setAgentAvailability:r=>{e({agentAvailability:r})},checkAgentAvailability:async()=>{if(Ug)return Ug;Ug=(async()=>{const r=await BGe.healthCheck();return t().agentAvailability!==r&&e({agentAvailability:r}),r})();try{return await Ug}finally{Ug=null}},startAgentHealthCheck:()=>{sV||(t().checkAgentAvailability(),sV=setInterval(()=>{t().checkAgentAvailability()},DGe))},refreshSessionsIndex:async()=>{if(Wg)return Wg;Wg=(async()=>{try{await t().refreshChats()}catch(r){console.warn("[AppStore] refreshChats failed:",r)}})();try{return await Wg}finally{Wg=null}},startSessionsIndexSync:()=>{lV||(t().refreshSessionsIndex(),lV=setInterval(()=>{t().refreshSessionsIndex()},jGe))}})),{name:"AppStore"})),Nde=e=>{const t=cV.get(e);if(t)return t;const n=new Map(e.map(r=>[r.id,r]));return cV.set(e,n),n},hF=e=>t=>e?Nde(t.chats).get(e)??null:null,FGe=e=>e.currentSessionId?Nde(e.chats).get(e.currentSessionId)??null:null,uV=async()=>{const e=PGe();if(!e)return!1;try{return await Dr.setProxyAuth(e),!0}catch(t){return console.error("Failed to apply stored proxy auth during startup:",t),!1}},zGe=async()=>{try{const e=await Rc.getState().loadConfig();if((typeof(e==null?void 0:e.proxy_auth_mode)=="string"?e.proxy_auth_mode:NGe)!==LGe)return await uV(),!1;const n=await Rc.getState().loadProxyAuthStatus({force:!0});return n!=null&&n.configured||await uV()?!1:(Ue.setState(a=>({...a,models:[],selectedModel:void 0,modelsError:"Proxy auth mode is set to required. Please configure proxy username/password and apply it.",isLoadingModels:!1})),!0)}catch(e){return console.error("Failed to evaluate startup proxy auth mode:",e),!1}};let dV=!1;const HGe=async(e=!1)=>{if(dV&&!e)return;dV=!0,Ue.getState().startAgentHealthCheck(),Ue.getState().startSessionsIndexSync(),await Ue.getState().loadChats(),await zGe()||await Ue.getState().fetchModels(),await Ue.getState().loadSystemPrompts()};function fV(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function UGe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const WGe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qGe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VGe={};function pV(e,t){return(VGe.jsx?qGe:WGe).test(e)}const GGe=/[ \t\n\f\r]/g;function KGe(e){return typeof e=="object"?e.type==="text"?hV(e.value):!1:hV(e)}function hV(e){return e.replace(GGe,"")===""}class n0{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}n0.prototype.normal={};n0.prototype.property={};n0.prototype.space=void 0;function Lde(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new n0(n,r,t)}function jb(e){return e.toLowerCase()}class Yi{constructor(t,n){this.attribute=n,this.property=t}}Yi.prototype.attribute="";Yi.prototype.booleanish=!1;Yi.prototype.boolean=!1;Yi.prototype.commaOrSpaceSeparated=!1;Yi.prototype.commaSeparated=!1;Yi.prototype.defined=!1;Yi.prototype.mustUseProperty=!1;Yi.prototype.number=!1;Yi.prototype.overloadedBoolean=!1;Yi.prototype.property="";Yi.prototype.spaceSeparated=!1;Yi.prototype.space=void 0;let YGe=0;const jn=uf(),ta=uf(),Dde=uf(),pt=uf(),wr=uf(),Tp=uf(),to=uf();function uf(){return 2**++YGe}const sN=Object.freeze(Object.defineProperty({__proto__:null,boolean:jn,booleanish:ta,commaOrSpaceSeparated:to,commaSeparated:Tp,number:pt,overloadedBoolean:Dde,spaceSeparated:wr},Symbol.toStringTag,{value:"Module"})),Yk=Object.keys(sN);class gF extends Yi{constructor(t,n,r,a){let i=-1;if(super(t,n),gV(this,"space",a),typeof r=="number")for(;++i<Yk.length;){const o=Yk[i];gV(this,Yk[i],(r&sN[o])===sN[o])}}}gF.prototype.defined=!0;function gV(e,t,n){n&&(e[t]=n)}function eg(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new gF(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[jb(r)]=r,n[jb(i.attribute)]=r}return new n0(t,n,e.space)}const jde=eg({properties:{ariaActiveDescendant:null,ariaAtomic:ta,ariaAutoComplete:null,ariaBusy:ta,ariaChecked:ta,ariaColCount:pt,ariaColIndex:pt,ariaColSpan:pt,ariaControls:wr,ariaCurrent:null,ariaDescribedBy:wr,ariaDetails:null,ariaDisabled:ta,ariaDropEffect:wr,ariaErrorMessage:null,ariaExpanded:ta,ariaFlowTo:wr,ariaGrabbed:ta,ariaHasPopup:null,ariaHidden:ta,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wr,ariaLevel:pt,ariaLive:null,ariaModal:ta,ariaMultiLine:ta,ariaMultiSelectable:ta,ariaOrientation:null,ariaOwns:wr,ariaPlaceholder:null,ariaPosInSet:pt,ariaPressed:ta,ariaReadOnly:ta,ariaRelevant:null,ariaRequired:ta,ariaRoleDescription:wr,ariaRowCount:pt,ariaRowIndex:pt,ariaRowSpan:pt,ariaSelected:ta,ariaSetSize:pt,ariaSort:null,ariaValueMax:pt,ariaValueMin:pt,ariaValueNow:pt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Bde(e,t){return t in e?e[t]:t}function Fde(e,t){return Bde(e,t.toLowerCase())}const XGe=eg({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Tp,acceptCharset:wr,accessKey:wr,action:null,allow:null,allowFullScreen:jn,allowPaymentRequest:jn,allowUserMedia:jn,alt:null,as:null,async:jn,autoCapitalize:null,autoComplete:wr,autoFocus:jn,autoPlay:jn,blocking:wr,capture:null,charSet:null,checked:jn,cite:null,className:wr,cols:pt,colSpan:null,content:null,contentEditable:ta,controls:jn,controlsList:wr,coords:pt|Tp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:jn,defer:jn,dir:null,dirName:null,disabled:jn,download:Dde,draggable:ta,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:jn,formTarget:null,headers:wr,height:pt,hidden:jn,high:pt,href:null,hrefLang:null,htmlFor:wr,httpEquiv:wr,id:null,imageSizes:null,imageSrcSet:null,inert:jn,inputMode:null,integrity:null,is:null,isMap:jn,itemId:null,itemProp:wr,itemRef:wr,itemScope:jn,itemType:wr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:jn,low:pt,manifest:null,max:null,maxLength:pt,media:null,method:null,min:null,minLength:pt,multiple:jn,muted:jn,name:null,nonce:null,noModule:jn,noValidate:jn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:jn,optimum:pt,pattern:null,ping:wr,placeholder:null,playsInline:jn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:jn,referrerPolicy:null,rel:wr,required:jn,reversed:jn,rows:pt,rowSpan:pt,sandbox:wr,scope:null,scoped:jn,seamless:jn,selected:jn,shadowRootClonable:jn,shadowRootDelegatesFocus:jn,shadowRootMode:null,shape:null,size:pt,sizes:null,slot:null,span:pt,spellCheck:ta,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pt,step:null,style:null,tabIndex:pt,target:null,title:null,translate:null,type:null,typeMustMatch:jn,useMap:null,value:ta,width:pt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wr,axis:null,background:null,bgColor:null,border:pt,borderColor:null,bottomMargin:pt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:jn,declare:jn,event:null,face:null,frame:null,frameBorder:null,hSpace:pt,leftMargin:pt,link:null,longDesc:null,lowSrc:null,marginHeight:pt,marginWidth:pt,noResize:jn,noHref:jn,noShade:jn,noWrap:jn,object:null,profile:null,prompt:null,rev:null,rightMargin:pt,rules:null,scheme:null,scrolling:ta,standby:null,summary:null,text:null,topMargin:pt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:jn,disableRemotePlayback:jn,prefix:null,property:null,results:pt,security:null,unselectable:null},space:"html",transform:Fde}),ZGe=eg({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:to,accentHeight:pt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pt,amplitude:pt,arabicForm:null,ascent:pt,attributeName:null,attributeType:null,azimuth:pt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pt,by:null,calcMode:null,capHeight:pt,className:wr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:pt,diffuseConstant:pt,direction:null,display:null,dur:null,divisor:pt,dominantBaseline:null,download:jn,dx:null,dy:null,edgeMode:null,editable:null,elevation:pt,enableBackground:null,end:null,event:null,exponent:pt,externalResourcesRequired:null,fill:null,fillOpacity:pt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Tp,g2:Tp,glyphName:Tp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pt,horizOriginX:pt,horizOriginY:pt,id:null,ideographic:pt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pt,k:pt,k1:pt,k2:pt,k3:pt,k4:pt,kernelMatrix:to,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:pt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:pt,overlineThickness:pt,paintOrder:null,panose1:null,path:null,pathLength:pt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pt,pointsAtY:pt,pointsAtZ:pt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:to,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:to,rev:to,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:to,requiredFeatures:to,requiredFonts:to,requiredFormats:to,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:pt,specularExponent:pt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pt,strikethroughThickness:pt,string:null,stroke:null,strokeDashArray:to,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pt,strokeOpacity:pt,strokeWidth:null,style:null,surfaceScale:pt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:to,tabIndex:pt,tableValues:null,target:null,targetX:pt,targetY:pt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:to,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pt,underlineThickness:pt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pt,values:null,vAlphabetic:pt,vMathematical:pt,vectorEffect:null,vHanging:pt,vIdeographic:pt,version:null,vertAdvY:pt,vertOriginX:pt,vertOriginY:pt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Bde}),zde=eg({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Hde=eg({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fde}),Ude=eg({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),QGe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},JGe=/[A-Z]/g,mV=/-[a-z]/g,eKe=/^data[-\w.:]+$/i;function Wde(e,t){const n=jb(t);let r=t,a=Yi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&eKe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(mV,nKe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!mV.test(i)){let o=i.replace(JGe,tKe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=gF}return new a(r,t)}function tKe(e){return"-"+e.toLowerCase()}function nKe(e){return e.charAt(1).toUpperCase()}const qde=Lde([jde,XGe,zde,Hde,Ude],"html"),FE=Lde([jde,ZGe,zde,Hde,Ude],"svg");function vV(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function rKe(e){return e.join(" ").trim()}var Lf={},Xk,bV;function aKe(){if(bV)return Xk;bV=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
495
|
+
`):void 0,ocrError:f.error?String(f.error):void 0})}const u=[];for(const f of s.content_parts||[]){if(f.type!=="image_url")continue;const h=((i=f.image_url)==null?void 0:i.url)||"";if(!h)continue;const g=dGe(h),m=Ede(h),v=c.get(h.trim());u.push({id:cGe(),url:g,ocrText:v==null?void 0:v.ocrText,ocrError:v==null?void 0:v.ocrError,name:m?`attachment-${m.attachmentId}`:"image",size:0,type:"image/*"})}const d={role:"user",id:s.id,createdAt:l,content:s.content||"",images:u.length?u:void 0,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(d);continue}if(s.role==="assistant"){const c=s.tool_calls||[];if(c.length>0){const f=(s.content||"").trim(),h=typeof s.reasoning=="string"&&s.reasoning.trim().length>0;if(f||h){const m=h?{reasoning:s.reasoning}:{},v={role:"assistant",type:"text",id:`${s.id}_text`,createdAt:l,content:s.content||"",metadata:m,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(v)}for(const m of c)n.set(m.id,((o=m.function)==null?void 0:o.name)||"unknown");const g={role:"assistant",type:"tool_call",id:s.id,createdAt:l,toolCalls:c.map(m=>{var v;return{toolCallId:m.id,toolName:((v=m.function)==null?void 0:v.name)||"unknown",parameters:(()=>{var b,y;try{return JSON.parse(((b=m.function)==null?void 0:b.arguments)||"{}")}catch{return{raw:((y=m.function)==null?void 0:y.arguments)||""}}})(),streamingOutput:""}}),isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(g);continue}const u=typeof s.reasoning=="string"&&s.reasoning.trim().length>0?{reasoning:s.reasoning}:{},d={role:"assistant",type:"text",id:s.id,createdAt:l,content:s.content||"",metadata:u,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(d);continue}if(s.role==="tool"){const c=s.tool_call_id||"unknown",u=n.get(c)||"unknown",d=s.tool_success===!1||s.tool_success==null&&typeof s.content=="string"&&s.content.trimStart().startsWith("Error:"),f={role:"assistant",type:"tool_result",id:s.id,createdAt:l,toolName:u,toolCallId:c,result:{tool_name:u,result:s.content||"",display_preference:"Default"},isError:d,isCompressed:!!s.compressed,compressedEventId:s.compressed_by_event_id};r.push(f);continue}}return r},pGe=(e,t)=>({chats:[],currentSessionId:null,latestActiveSessionId:null,processingChats:new Set,autoGenerateTitles:!0,isUpdatingAutoTitlePreference:!1,subSessionsByParent:{},addChat:async n=>{var c,u,d;const r=(n.title||"New Session").trim(),a=((u=(c=n.config)==null?void 0:c.baseSystemPrompt)==null?void 0:u.trim())||"",o=((d=Ho.getState().getActiveModel())==null?void 0:d.trim())||void 0,s=await mc.createSession({title:r,system_prompt:a||void 0,model:o}),l={...Vk(s.session),title:r,config:{...n.config,baseSystemPrompt:a||Cde},messages:[],currentInteraction:null};return e(f=>{const h=[l,...f.chats.filter(g=>g.id!==l.id)];return{...f,chats:h,currentSessionId:l.id,latestActiveSessionId:l.id}}),l.id},selectSession:n=>{const r=t();r.currentSessionId===n&&r.latestActiveSessionId===n||e({currentSessionId:n,latestActiveSessionId:n})},deleteSession:async n=>{try{await mc.deleteSession(n)}catch(r){console.error(`[ChatSlice] Failed to delete backend session ${n}:`,r)}e(r=>{var l;const a=new Set;for(const c of r.chats)c.id===n&&a.add(c.id),c.rootSessionId===n&&a.add(c.id);const i=r.chats.filter(c=>!a.has(c.id)),o=r.currentSessionId&&a.has(r.currentSessionId)?null:r.currentSessionId,s=r.latestActiveSessionId&&a.has(r.latestActiveSessionId)?((l=i[0])==null?void 0:l.id)??null:r.latestActiveSessionId;return{...r,chats:i,currentSessionId:o,latestActiveSessionId:s}})},deleteSessions:async n=>{for(const r of n)await t().deleteSession(r)},updateSession:(n,r)=>{e(i=>{const o=i.chats.map(s=>s.id===n?{...s,...r}:s);return{...i,chats:o}});const a={};typeof r.title=="string"&&(a.title=r.title),typeof r.pinned=="boolean"&&(a.pinned=r.pinned),Object.keys(a).length>0&&mc.patchSession(n,a).catch(i=>{console.warn(`[ChatSlice] Failed to patch session ${n}:`,i)})},pinSession:n=>{t().updateSession(n,{pinned:!0})},unpinSession:n=>{t().updateSession(n,{pinned:!1})},setMessages:(n,r)=>{t().chats.find(i=>i.id===n)&&t().updateSession(n,{messages:r})},addMessage:async(n,r)=>{const a=t().chats.find(o=>o.id===n);if(!a)return;const i=[...a.messages,r];t().updateSession(n,{messages:i})},updateMessage:(n,r,a)=>{const i=t().chats.find(s=>s.id===n);if(!i)return;const o=i.messages.map(s=>{if(s.id!==r)return s;const l={...s};return Object.keys(a).forEach(c=>{Object.prototype.hasOwnProperty.call(l,c)&&(l[c]=a[c])}),l});t().updateSession(n,{messages:o})},deleteMessage:(n,r)=>{const a=t().chats.find(o=>o.id===n);if(!a)return;const i=a.messages.filter(o=>o.id!==r);t().updateSession(n,{messages:i}),mc.deleteSessionMessage(n,r).catch(o=>{console.warn(`[ChatSlice] Failed to delete message ${r} from session ${n}:`,o)})},refreshChats:async()=>{const r=(await mc.listSessions()).sessions.map(Vk);e(a=>{const i=new Map(a.chats.map(s=>[s.id,s])),o=r.map(s=>{const l=i.get(s.id);return l?{...s,messages:l.messages,config:l.config}:s});return{...a,chats:o}})},loadChats:async()=>{var s;const n=localStorage.getItem(tV),r=n===null?t().autoGenerateTitles:n==="true";let a=await mc.listSessions();(!a.sessions||a.sessions.length===0)&&(a={sessions:[(await mc.createSession({title:"New Session"})).session]});const i=a.sessions.map(Vk),o=((s=i[0])==null?void 0:s.id)??null;e({chats:i,latestActiveSessionId:o,currentSessionId:o,processingChats:new Set,autoGenerateTitles:r}),o&&await t().loadChatHistory(o)},loadChatHistory:async(n,r)=>{var s,l,c;const a=(r==null?void 0:r.mode)??"replace",i=Math.max(0,(r==null?void 0:r.retries)??0),o=Math.max(0,(r==null?void 0:r.retryDelayMs)??0);for(let u=0;u<=i;u+=1)try{const d=t().chats.find(m=>m.id===n);if(!d)return;const f=await mc.getHistory(n),h=(s=f.messages[f.messages.length-1])==null?void 0:s.role;if(r!=null&&r.waitForAssistant&&h==="user"&&u<i){const m=o>0?o*(u+1):200*(u+1);await new Promise(v=>setTimeout(v,m));continue}const g=fGe(n,f.messages);if(a==="monotonic"){const m=d.messages||[],v=m.length,b=g.length,y=(l=g[g.length-1])==null?void 0:l.role,S=(c=m[m.length-1])==null?void 0:c.role;if(!(b>=v||typeof y=="string"&&y!=="user"||S==="user"&&y!=="user")){t().updateSession(n,{messageCount:Math.max(d.messageCount??0,f.messages.length)});return}}t().updateSession(n,{messages:g,messageCount:f.messages.length,config:{...d.config||{},compressionEvents:(f.compression_events||[]).map(m=>({id:m.id,createdAt:m.created_at,messagesCompressed:m.messages_compressed,segmentsRemoved:m.segments_removed}))}});return}catch(d){if(u>=i){console.warn(`[ChatSlice] Failed to load history for ${n}:`,d);return}const f=o>0?o*(u+1):200*(u+1);await new Promise(h=>setTimeout(h,f))}},upsertSubSessionProgress:(n,r,a)=>{e(i=>{const o=i.subSessionsByParent[n]||{},s=o[r]||{},l={...o,[r]:{...s,...a}};return{subSessionsByParent:{...i.subSessionsByParent,[n]:l}}})},clearSubSessionProgress:(n,r)=>{e(a=>{const i=a.subSessionsByParent[n];if(!i||!i[r])return{};const{[r]:o,...s}=i;return{subSessionsByParent:{...a.subSessionsByParent,[n]:s}}})},setSessionProcessing:(n,r)=>{e(a=>{const i=new Set(a.processingChats);return r?i.add(n):i.delete(n),{processingChats:i}})},isSessionProcessing:n=>t().processingChats.has(n),setAutoGenerateTitlesPreference:async n=>{const r=t().autoGenerateTitles;e({autoGenerateTitles:n,isUpdatingAutoTitlePreference:!0});try{localStorage.setItem(tV,String(n))}catch(a){throw console.warn("[ChatSlice] Failed to update auto-title preference:",a),e({autoGenerateTitles:r}),a}finally{e({isUpdatingAutoTitlePreference:!1})}}});class jw extends Error{constructor(n="Proxy authentication required"){super(n);Bt(this,"code","proxy_auth_required");this.name="ProxyAuthRequiredError"}}const Gu=class Gu{constructor(){}static getInstance(){return Gu.instance||(Gu.instance=new Gu),Gu.instance}resolveOpenAICompatBaseUrl(){const t=Jh().trim().replace(/\/+$/,"");return t.endsWith("/openai/v1")?t:`${t.endsWith("/v1")?t.slice(0,-3):t}/openai/v1`}async getModels(){var t,n;try{return(await new cF({baseUrl:this.resolveOpenAICompatBaseUrl()}).get("models")).data.map(i=>i.id)}catch(r){if(console.error("Failed to fetch models from HTTP API:",r),r instanceof Zp){if(r.status===428)throw new jw(r.message);let a;if(r.body)try{a=JSON.parse(r.body)}catch{}if(a&&typeof a=="object"&&"error"in a&&((t=a.error)==null?void 0:t.code)==="proxy_auth_required")throw new jw(((n=a.error)==null?void 0:n.message)||r.message)}throw r}}};Bt(Gu,"instance");let Bw=Gu;const BE=Bw.getInstance(),hGe=Object.freeze(Object.defineProperty({__proto__:null,ModelService:Bw,ProxyAuthRequiredError:jw,modelService:BE},Symbol.toStringTag,{value:"Module"})),gGe=async e=>{var t;if(typeof navigator>"u"||!((t=navigator.clipboard)!=null&&t.writeText))throw new Error("navigator.clipboard.writeText is unavailable");await navigator.clipboard.writeText(e)},mGe=e=>{if(typeof document>"u")throw new Error("document is unavailable");const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)throw new Error("document.execCommand('copy') returned false")},Ko=async e=>{try{await gGe(e);return}catch(t){try{mGe(e);return}catch(n){const r=t instanceof Error?t.message:String(t),a=n instanceof Error?n.message:String(n);throw new Error(`Clipboard copy failed: navigator(${r}); fallback(${a})`)}}};class vGe{async copyToClipboard(t){await Ko(t)}async getBambooConfig(){try{return await Bn.get("bamboo/config")}catch(t){return console.error("Failed to fetch Bamboo config:",t),{}}}async getBambooTools(){try{return await Bn.get("bamboo/tools")}catch(t){return console.error("Failed to fetch Bamboo tools:",t),{tools:[]}}}async setBambooConfig(t){return Bn.post("bamboo/config",t)}async validateBambooConfigPatch(t){return Bn.post("bamboo/config/validate",t)}async setProxyAuth(t){return Bn.post("bamboo/proxy-auth",t)}async getProxyAuthStatus(){try{return await Bn.get("bamboo/proxy-auth/status")}catch(t){return console.error("Failed to fetch proxy auth status:",t),{configured:!1,username:null}}}async clearProxyAuth(){return Bn.post("bamboo/proxy-auth",{username:"",password:""})}async getAnthropicModelMapping(){try{return await Bn.get("bamboo/anthropic-model-mapping")}catch(t){return console.error("Failed to fetch Anthropic model mapping:",t),{mappings:{}}}}async setAnthropicModelMapping(t){return Bn.post("bamboo/anthropic-model-mapping",t)}async resetBambooConfig(){return Bn.post("bamboo/config/reset",{})}async saveWorkflow(t,n){return Bn.post("bamboo/workflows",{name:t,content:n})}async deleteWorkflow(t){return Bn.delete(`bamboo/workflows/${encodeURIComponent(t)}`)}async getKeywordMaskingConfig(){try{return await Bn.get("bamboo/keyword-masking")}catch(t){return console.error("Failed to fetch keyword masking config:",t),{entries:[]}}}async updateKeywordMaskingConfig(t){return Bn.post("bamboo/keyword-masking",t)}async validateKeywordEntries(t){return Bn.post("bamboo/keyword-masking/validate",t)}async getSetupStatus(){return await Bn.get("bamboo/setup/status")}async markSetupComplete(){return Bn.post("bamboo/setup/complete",{})}async resetSetupStatus(){await Bn.post("bamboo/setup/incomplete",{})}}const Ku=class Ku{constructor(){Bt(this,"httpUtilityService",new vGe)}static getInstance(){return Ku.instance||(Ku.instance=new Ku),Ku.instance}getUtilityService(){return{copyToClipboard:t=>this.httpUtilityService.copyToClipboard(t),getBambooConfig:()=>this.httpUtilityService.getBambooConfig(),getBambooTools:()=>this.httpUtilityService.getBambooTools(),setBambooConfig:t=>this.httpUtilityService.setBambooConfig(t),validateBambooConfigPatch:t=>this.httpUtilityService.validateBambooConfigPatch(t),setProxyAuth:t=>this.httpUtilityService.setProxyAuth(t),getProxyAuthStatus:()=>this.httpUtilityService.getProxyAuthStatus(),clearProxyAuth:()=>this.httpUtilityService.clearProxyAuth(),getAnthropicModelMapping:()=>this.httpUtilityService.getAnthropicModelMapping(),setAnthropicModelMapping:t=>this.httpUtilityService.setAnthropicModelMapping(t),resetBambooConfig:()=>this.httpUtilityService.resetBambooConfig(),resetSetupStatus:()=>this.httpUtilityService.resetSetupStatus(),saveWorkflow:(t,n)=>this.httpUtilityService.saveWorkflow(t,n),deleteWorkflow:t=>this.httpUtilityService.deleteWorkflow(t),getKeywordMaskingConfig:()=>this.httpUtilityService.getKeywordMaskingConfig(),updateKeywordMaskingConfig:t=>this.httpUtilityService.updateKeywordMaskingConfig(t),validateKeywordEntries:t=>this.httpUtilityService.validateKeywordEntries(t),getSetupStatus:()=>this.httpUtilityService.getSetupStatus(),markSetupComplete:()=>this.httpUtilityService.markSetupComplete()}}async copyToClipboard(t){return this.getUtilityService().copyToClipboard(t)}async getBambooConfig(){return this.getUtilityService().getBambooConfig()}async getBambooTools(){return this.getUtilityService().getBambooTools()}async setBambooConfig(t){return this.getUtilityService().setBambooConfig(t)}async validateBambooConfigPatch(t){return this.getUtilityService().validateBambooConfigPatch(t)}async setProxyAuth(t){return this.getUtilityService().setProxyAuth(t)}async getProxyAuthStatus(){return this.getUtilityService().getProxyAuthStatus()}async clearProxyAuth(){return this.getUtilityService().clearProxyAuth()}async getAnthropicModelMapping(){return this.getUtilityService().getAnthropicModelMapping()}async setAnthropicModelMapping(t){return this.getUtilityService().setAnthropicModelMapping(t)}async resetBambooConfig(){return this.getUtilityService().resetBambooConfig()}async resetSetupStatus(){return this.getUtilityService().resetSetupStatus()}async saveWorkflow(t,n){return this.getUtilityService().saveWorkflow(t,n)}async deleteWorkflow(t){return this.getUtilityService().deleteWorkflow(t)}async getKeywordMaskingConfig(){return this.getUtilityService().getKeywordMaskingConfig()}async updateKeywordMaskingConfig(t){return this.getUtilityService().updateKeywordMaskingConfig(t)}async validateKeywordEntries(t){return this.getUtilityService().validateKeywordEntries(t)}async getSetupStatus(){return this.getUtilityService().getSetupStatus()}async markSetupComplete(){return this.getUtilityService().markSetupComplete()}};Bt(Ku,"instance");let Vi=Ku;const Dr=Vi.getInstance();let Bg=null,Fg=null;const Gk=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,Rc=Qh((e,t)=>({config:null,proxyAuthStatus:null,isLoadingConfig:!1,isLoadingProxyAuthStatus:!1,lastLoadedAt:null,error:null,loadConfig:async({force:n=!1}={})=>{const r=t().config;if(!n&&r)return r;if(Bg)return Bg;Bg=(async()=>{e({isLoadingConfig:!0,error:null});try{const a=await Dr.getBambooConfig()??{};return e({config:a,lastLoadedAt:Date.now(),error:null}),a}catch(a){const i=Gk(a,"Failed to load Bamboo config");throw e({error:i}),a}finally{e({isLoadingConfig:!1})}})();try{return await Bg}finally{Bg=null}},saveConfig:async n=>{e({isLoadingConfig:!0,error:null,config:n});try{const r=await Dr.setBambooConfig(n);return e({config:r,lastLoadedAt:Date.now(),error:null}),r}catch(r){const a=Gk(r,"Failed to save Bamboo config");throw e({error:a}),r}finally{e({isLoadingConfig:!1})}},patchConfig:async n=>{const a={...await t().loadConfig()??{},...n??{}};return t().saveConfig(a)},loadProxyAuthStatus:async({force:n=!1}={})=>{const r=t().proxyAuthStatus;if(!n&&r)return r;if(Fg)return Fg;Fg=(async()=>{e({isLoadingProxyAuthStatus:!0,error:null});try{const a=await Dr.getProxyAuthStatus();return e({proxyAuthStatus:a,error:null}),a}catch(a){const i=Gk(a,"Failed to load proxy auth status");throw e({error:i}),a}finally{e({isLoadingProxyAuthStatus:!1})}})();try{return await Fg}finally{Fg=null}},applyProxyAuth:async n=>{await Dr.setProxyAuth(n),await t().loadProxyAuthStatus({force:!0})},clearProxyAuth:async()=>{await Dr.clearProxyAuth(),await t().loadProxyAuthStatus({force:!0})}}));let zg=null;const bGe=(e,t)=>({models:[],selectedModel:void 0,isLoadingModels:!1,modelsError:null,configModel:void 0,setSelectedModel:n=>{e({selectedModel:n})},loadConfigModel:async()=>{try{const n=await Rc.getState().loadConfig(),r=typeof(n==null?void 0:n.model)=="string"?n.model:void 0;r&&e({configModel:r})}catch(n){console.error("Failed to load model from config:",n)}},fetchModels:async()=>{if(zg)return zg;zg=(async()=>{e({isLoadingModels:!0,modelsError:null});try{try{if(!(await Dr.getSetupStatus()).is_complete){console.log("Setup not complete, skipping model fetch"),e({models:[],selectedModel:void 0,isLoadingModels:!1,modelsError:"Complete setup to access all models"});return}}catch(r){console.error("Failed to check setup status:",r)}const n=await BE.getModels();e(r=>{const a=r.selectedModel;let i=r.selectedModel;return a&&n.includes(a)||(n.length>0?i=n[0]:i=void 0),{...r,models:n,selectedModel:i,modelsError:n.length>0?null:"No available model options"}}),t().models.length===0&&console.warn("No models available from service")}catch(n){const r=n instanceof Error?n.message:String(n);if(console.error("Failed to fetch models:",n),n instanceof jw){e(a=>({...a,models:a.models,selectedModel:a.selectedModel,modelsError:r||"Proxy authentication required. Please configure proxy auth."}));return}e(a=>({...a,models:[],selectedModel:a.selectedModel,modelsError:r}))}finally{e({isLoadingModels:!1})}})();try{await zg}finally{zg=null}}}),yGe=["system_prompt","system_prompt_selected_id"],Kk=e=>({id:e.id,name:e.name||e.id,content:e.content||"",description:e.description,isDefault:!!e.is_default}),Ac=class Ac{constructor(){Bt(this,"deprecatedKeysCleanupDone",!1)}static getInstance(){return Ac.instance||(Ac.instance=new Ac),Ac.instance.cleanupDeprecatedPromptStorageKeys(),Ac.instance}cleanupDeprecatedPromptStorageKeys(){if(!this.deprecatedKeysCleanupDone){this.deprecatedKeysCleanupDone=!0;try{for(const t of yGe)localStorage.removeItem(t)}catch(t){console.warn("[SystemPromptService] Failed to cleanup deprecated prompt storage keys:",t)}}}async getSystemPromptPresets(){try{const t=await fn.get("prompt-presets"),r=(Array.isArray(t==null?void 0:t.prompts)?t.prompts:[]).filter(a=>a.id&&a.id.trim().length>0).map(Kk);if(r.length>0)return r}catch(t){console.error("Failed to load prompt presets from backend:",t)}return Dw()}async createSystemPromptPreset(t){var a;const n={name:t.name,content:t.content};(a=t.id)!=null&&a.trim()&&(n.id=t.id.trim()),t.description!==void 0&&(n.description=t.description);const r=await fn.post("prompt-presets",n);if(!(r!=null&&r.prompt))throw new Error("Backend did not return created prompt preset");return Kk(r.prompt)}async updateSystemPromptPreset(t){const n=encodeURIComponent(t.id),r={name:t.name,content:t.content,description:t.description},a=await fn.patch(`prompt-presets/${n}`,r);if(!(a!=null&&a.prompt))throw new Error("Backend did not return updated prompt preset");return Kk(a.prompt)}async deleteSystemPromptPreset(t){const n=encodeURIComponent(t);await fn.delete(`prompt-presets/${n}`)}async findPresetById(t){return(await this.getSystemPromptPresets()).find(r=>r.id===t)}async getCurrentSystemPromptContent(t){const n=await this.findPresetById(t);if(n)return n.content;const r=await this.getSystemPromptPresets(),a=r.find(i=>i.isDefault)||r[0];return(a==null?void 0:a.content)||""}};Bt(Ac,"instance");let Fw=Ac;const nV="copilot_last_selected_prompt_id",_de="copilot_custom_system_prompts_v2",Tde="copilot_custom_system_prompts_v2_migrated_to_backend",kde="general_assistant",uF=80,cp=Fw.getInstance();let gS=null;function dF(e){const t=e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t.length===0?`prompt_${Date.now()}_${Math.random().toString(36).substring(2,9)}`:t.slice(0,uF)}function Ode(e){if(typeof e!="string")return null;const t=e.toLowerCase().trim().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return t?t.slice(0,uF):null}function $de(e,t){if(!t.has(e))return e;let n=2;for(;;){const r=`_${n}`,i=`${e.slice(0,Math.max(0,uF-r.length))}${r}`;if(!t.has(i))return i;n+=1}}function Ide(){try{const e=localStorage.getItem(_de);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=new Set,r=[];for(const a of t){const i=typeof(a==null?void 0:a.name)=="string"?a.name.trim():"",o=typeof(a==null?void 0:a.content)=="string"?a.content.trim():"";if(!i||!o)continue;const l=Ode(a==null?void 0:a.id)||dF(i),c=$de(l,n);c!==kde&&(n.add(c),r.push({id:c,name:i,content:o,description:typeof(a==null?void 0:a.description)=="string"&&a.description.trim()||void 0,isDefault:!!(a!=null&&a.isDefault)}))}return r}catch(e){return console.error("[promptSlice] Failed to read legacy custom prompts:",e),[]}}function Ade(){try{return localStorage.getItem(Tde)==="1"}catch(e){return console.error("[promptSlice] Failed to read migration marker:",e),!1}}function rV(){try{localStorage.setItem(Tde,"1")}catch(e){console.error("[promptSlice] Failed to write migration marker:",e)}}function aV(){try{localStorage.removeItem(_de)}catch(e){console.error("[promptSlice] Failed to clear legacy custom prompts:",e)}}async function SGe(){var a,i;if(Ade())return;const e=Ide();if(e.length===0){aV(),rV();return}const t=await cp.getSystemPromptPresets(),n=new Set(t.map(o=>o.id));let r=!1;for(const o of e){const s=(a=o.name)==null?void 0:a.trim(),l=(i=o.content)==null?void 0:i.trim();if(!s||!l||o.id===kde||o.isDefault)continue;const c=Ode(o.id)||dF(s),u=$de(c,n);try{const d=await cp.createSystemPromptPreset({id:u,name:s,content:l,description:o.description});n.add(d.id)}catch(d){r=!0,console.error(`[promptSlice] Failed to migrate legacy prompt '${s}' to backend:`,d)}}r||(aV(),rV())}async function xGe(){gS||(gS=SGe().finally(()=>{gS=null})),await gS}const wGe=(e,t)=>({systemPrompts:[],lastSelectedPromptId:localStorage.getItem(nV)||null,loadSystemPrompts:async()=>{try{await xGe()}catch(a){console.warn("[promptSlice] Legacy prompt migration skipped:",a)}let n=[];try{n=await cp.getSystemPromptPresets()}catch(a){console.error("Failed to load system prompts from backend:",a)}let r=n.length?n:Dw();if(!Ade()){const a=Ide();r=CGe(r,a)}r.length===0&&(r=Dw()),e({systemPrompts:r})},addSystemPrompt:async n=>{try{await cp.createSystemPromptPreset({id:dF(n.name),name:n.name,content:n.content,description:n.description}),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to add system prompt:",r),r}},updateSystemPrompt:async n=>{try{await cp.updateSystemPromptPreset(n),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to update system prompt:",r),r}},deleteSystemPrompt:async n=>{try{await cp.deleteSystemPromptPreset(n),await t().loadSystemPrompts()}catch(r){throw console.error("Failed to delete system prompt:",r),r}},setLastSelectedPromptId:n=>{e({lastSelectedPromptId:n});try{localStorage.setItem(nV,n)}catch(r){console.error("Failed to save last selected prompt ID to localStorage:",r)}}}),CGe=(e,t)=>{const n=new Map;return e.forEach(r=>{n.set(r.id,r)}),t.forEach(r=>{n.set(r.id,r)}),Array.from(n.values())},EGe=(e,t)=>({currentRequestController:null,setCurrentRequestController:n=>{e({currentRequestController:n})},cancelCurrentRequest:()=>{var n;(n=t().currentRequestController)==null||n.abort(),t().processingChats.forEach(r=>{t().setSessionProcessing(r,!1)}),e({currentRequestController:null})}});class _Ge{async listSkills(t,n){const r=new URLSearchParams;t!=null&&t.search&&r.append("search",t.search),n&&r.append("refresh","true");const a=r.toString(),i=a?`skills?${a}`:"skills";return Bn.get(i)}async getSkill(t){return Bn.get(`skills/${t}`)}async getFilteredTools(t){const n=t?`?session_id=${encodeURIComponent(t)}`:"";return(await Bn.get(`skills/filtered-tools${n}`)).tools??[]}}const iV=new _Ge,TGe=(e,t)=>({skills:[],isLoadingSkills:!1,skillsError:null,loadSkills:async(n,r)=>{e({isLoadingSkills:!0,skillsError:null});try{const a=await iV.listSkills(n,r);e({skills:a.skills,isLoadingSkills:!1})}catch(a){e({skillsError:a instanceof Error?a.message:"Failed to load skills",isLoadingSkills:!1})}},getSkill:async n=>{e({isLoadingSkills:!0,skillsError:null});try{const r=await iV.getSkill(n),a=t().skills,o=a.findIndex(s=>s.id===r.id)>=0?a.map(s=>s.id===r.id?r:s):[...a,r];e({skills:o,isLoadingSkills:!1})}catch(r){e({skillsError:r instanceof Error?r.message:"Failed to get skill",isLoadingSkills:!1})}},clearSkillsError:()=>{e({skillsError:null})}}),kGe=e=>({tokenUsages:{},truncationOccurred:{},segmentsRemoved:{},updateTokenUsage:(t,n)=>e(r=>({tokenUsages:{...r.tokenUsages,[t]:n}})),setTruncationInfo:(t,n,r)=>e(a=>({truncationOccurred:{...a.truncationOccurred,[t]:n},segmentsRemoved:{...a.segmentsRemoved,[t]:r}})),clearTokenUsage:t=>e(n=>{const{[t]:r,...a}=n.tokenUsages,{[t]:i,...o}=n.truncationOccurred,{[t]:s,...l}=n.segmentsRemoved;return{tokenUsages:a,truncationOccurred:o,segmentsRemoved:l}})}),OGe=(e,t)=>({taskLists:{},taskListVersions:{},activeItems:{},evaluationStates:{},setTaskList:(n,r)=>e(a=>({taskLists:{...a.taskLists,[n]:r},taskListVersions:{...a.taskListVersions,[n]:r.version||0}})),updateTaskListDelta:(n,r)=>e(a=>{const i=a.taskListVersions[n]||0;if(r.version<=i)return a;const o=a.taskLists[n];if(!o)return a;const s=o.items.map(l=>l.id===r.item_id?{...l,status:r.status,tool_calls_count:r.tool_calls_count}:l);return{taskLists:{...a.taskLists,[n]:{...o,items:s,updated_at:new Date().toISOString()}},taskListVersions:{...a.taskListVersions,[n]:r.version},activeItems:{...a.activeItems,[n]:r.status==="in_progress"?r.item_id:null}}}),clearTaskList:n=>e(r=>{const{[n]:a,...i}=r.taskLists,{[n]:o,...s}=r.taskListVersions,{[n]:l,...c}=r.activeItems,{[n]:u,...d}=r.evaluationStates;return{taskLists:i,taskListVersions:s,activeItems:c,evaluationStates:d}}),getTaskListVersion:n=>t().taskListVersions[n]||0,setEvaluationState:(n,r)=>e(a=>({evaluationStates:{...a.evaluationStates,[n]:r}})),clearEvaluationState:n=>e(r=>{const{[n]:a,...i}=r.evaluationStates;return{evaluationStates:i}})}),Rde="chat_input_reasoning_by_session_v1",Mde="chat_input_reasoning_last_used_v1",oV={content:"",referenceText:null,attachments:[],reasoningEffort:"medium"},fF=e=>e==="low"||e==="medium"||e==="high"||e==="xhigh"||e==="max",Pde=()=>{if(typeof window>"u")return{};try{const e=localStorage.getItem(Rde);if(!e)return{};const t=JSON.parse(e),n={};for(const[r,a]of Object.entries(t||{}))fF(a)&&(n[r]=a);return n}catch{return{}}},$Ge=e=>{if(!(typeof window>"u"))try{localStorage.setItem(Rde,JSON.stringify(e))}catch{}},IGe=()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem(Mde);return fF(e)?e:void 0}catch{return}},AGe=e=>{if(!(typeof window>"u"))try{localStorage.setItem(Mde,e)}catch{}},pF=e=>{const t=Pde();return fF(t[e])?t[e]:IGe()},Hg=e=>({...oV,reasoningEffort:pF(e)??oV.reasoningEffort}),RGe=(e,t)=>({inputStates:{},pendingQuestionRespond:null,setInputContent:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),content:r}}})),setReferenceText:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),referenceText:r}}})),setAttachments:(n,r)=>e(a=>({inputStates:{...a.inputStates,[n]:{...a.inputStates[n]||Hg(n),attachments:r}}})),setInputReasoningEffort:(n,r)=>{e(i=>({inputStates:{...i.inputStates,[n]:{...i.inputStates[n]||Hg(n),reasoningEffort:r}}}));const a=Pde();a[n]=r,$Ge(a),AGe(r)},clearInputState:n=>e(r=>{const{[n]:a,...i}=r.inputStates;return{inputStates:i}}),getInputState:n=>t().inputStates[n]||Hg(n),setPendingQuestionRespond:n=>e({pendingQuestionRespond:n})}),MGe="bamboo_proxy_auth",PGe=()=>{try{const e=localStorage.getItem(MGe);if(!e)return null;const t=JSON.parse(e);if(!t||typeof t!="object")return null;const n=typeof t.username=="string"?t.username.trim():"",r=typeof t.password=="string"?t.password:"";return n?{username:n,password:r}:null}catch{return null}},NGe="auto",LGe="required",DGe=1e4,jGe=2e3,BGe=Rs.getInstance();let sV=null,Ug=null,lV=null,Wg=null;const cV=new WeakMap,Ue=Qh()(YVe(ZVe((e,t,n)=>({...pGe(e,t),...bGe(e,t),...wGe(e,t),...EGe(e,t),...TGe(e,t),...kGe(e),...OGe(e,t),...RGe(e,t),agentAvailability:null,setAgentAvailability:r=>{e({agentAvailability:r})},checkAgentAvailability:async()=>{if(Ug)return Ug;Ug=(async()=>{const r=await BGe.healthCheck();return t().agentAvailability!==r&&e({agentAvailability:r}),r})();try{return await Ug}finally{Ug=null}},startAgentHealthCheck:()=>{sV||(t().checkAgentAvailability(),sV=setInterval(()=>{t().checkAgentAvailability()},DGe))},refreshSessionsIndex:async()=>{if(Wg)return Wg;Wg=(async()=>{try{await t().refreshChats()}catch(r){console.warn("[AppStore] refreshChats failed:",r)}})();try{return await Wg}finally{Wg=null}},startSessionsIndexSync:()=>{lV||(t().refreshSessionsIndex(),lV=setInterval(()=>{t().refreshSessionsIndex()},jGe))}})),{name:"AppStore"})),Nde=e=>{const t=cV.get(e);if(t)return t;const n=new Map(e.map(r=>[r.id,r]));return cV.set(e,n),n},hF=e=>t=>e?Nde(t.chats).get(e)??null:null,FGe=e=>e.currentSessionId?Nde(e.chats).get(e.currentSessionId)??null:null,uV=async()=>{const e=PGe();if(!e)return!1;try{return await Dr.setProxyAuth(e),!0}catch(t){return console.error("Failed to apply stored proxy auth during startup:",t),!1}},zGe=async()=>{try{const e=await Rc.getState().loadConfig();if((typeof(e==null?void 0:e.proxy_auth_mode)=="string"?e.proxy_auth_mode:NGe)!==LGe)return await uV(),!1;const n=await Rc.getState().loadProxyAuthStatus({force:!0});return n!=null&&n.configured||await uV()?!1:(Ue.setState(a=>({...a,models:[],selectedModel:void 0,modelsError:"Proxy auth mode is set to required. Please configure proxy username/password and apply it.",isLoadingModels:!1})),!0)}catch(e){return console.error("Failed to evaluate startup proxy auth mode:",e),!1}};let dV=!1;const HGe=async(e=!1)=>{if(dV&&!e)return;dV=!0,Ue.getState().startAgentHealthCheck(),Ue.getState().startSessionsIndexSync(),await Ue.getState().loadChats(),await zGe()||await Ue.getState().fetchModels(),await Ue.getState().loadSystemPrompts()};function fV(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function UGe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const WGe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qGe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VGe={};function pV(e,t){return(VGe.jsx?qGe:WGe).test(e)}const GGe=/[ \t\n\f\r]/g;function KGe(e){return typeof e=="object"?e.type==="text"?hV(e.value):!1:hV(e)}function hV(e){return e.replace(GGe,"")===""}class n0{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}n0.prototype.normal={};n0.prototype.property={};n0.prototype.space=void 0;function Lde(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new n0(n,r,t)}function jb(e){return e.toLowerCase()}class Yi{constructor(t,n){this.attribute=n,this.property=t}}Yi.prototype.attribute="";Yi.prototype.booleanish=!1;Yi.prototype.boolean=!1;Yi.prototype.commaOrSpaceSeparated=!1;Yi.prototype.commaSeparated=!1;Yi.prototype.defined=!1;Yi.prototype.mustUseProperty=!1;Yi.prototype.number=!1;Yi.prototype.overloadedBoolean=!1;Yi.prototype.property="";Yi.prototype.spaceSeparated=!1;Yi.prototype.space=void 0;let YGe=0;const jn=uf(),ta=uf(),Dde=uf(),pt=uf(),wr=uf(),Tp=uf(),to=uf();function uf(){return 2**++YGe}const sN=Object.freeze(Object.defineProperty({__proto__:null,boolean:jn,booleanish:ta,commaOrSpaceSeparated:to,commaSeparated:Tp,number:pt,overloadedBoolean:Dde,spaceSeparated:wr},Symbol.toStringTag,{value:"Module"})),Yk=Object.keys(sN);class gF extends Yi{constructor(t,n,r,a){let i=-1;if(super(t,n),gV(this,"space",a),typeof r=="number")for(;++i<Yk.length;){const o=Yk[i];gV(this,Yk[i],(r&sN[o])===sN[o])}}}gF.prototype.defined=!0;function gV(e,t,n){n&&(e[t]=n)}function eg(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new gF(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[jb(r)]=r,n[jb(i.attribute)]=r}return new n0(t,n,e.space)}const jde=eg({properties:{ariaActiveDescendant:null,ariaAtomic:ta,ariaAutoComplete:null,ariaBusy:ta,ariaChecked:ta,ariaColCount:pt,ariaColIndex:pt,ariaColSpan:pt,ariaControls:wr,ariaCurrent:null,ariaDescribedBy:wr,ariaDetails:null,ariaDisabled:ta,ariaDropEffect:wr,ariaErrorMessage:null,ariaExpanded:ta,ariaFlowTo:wr,ariaGrabbed:ta,ariaHasPopup:null,ariaHidden:ta,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wr,ariaLevel:pt,ariaLive:null,ariaModal:ta,ariaMultiLine:ta,ariaMultiSelectable:ta,ariaOrientation:null,ariaOwns:wr,ariaPlaceholder:null,ariaPosInSet:pt,ariaPressed:ta,ariaReadOnly:ta,ariaRelevant:null,ariaRequired:ta,ariaRoleDescription:wr,ariaRowCount:pt,ariaRowIndex:pt,ariaRowSpan:pt,ariaSelected:ta,ariaSetSize:pt,ariaSort:null,ariaValueMax:pt,ariaValueMin:pt,ariaValueNow:pt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Bde(e,t){return t in e?e[t]:t}function Fde(e,t){return Bde(e,t.toLowerCase())}const XGe=eg({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Tp,acceptCharset:wr,accessKey:wr,action:null,allow:null,allowFullScreen:jn,allowPaymentRequest:jn,allowUserMedia:jn,alt:null,as:null,async:jn,autoCapitalize:null,autoComplete:wr,autoFocus:jn,autoPlay:jn,blocking:wr,capture:null,charSet:null,checked:jn,cite:null,className:wr,cols:pt,colSpan:null,content:null,contentEditable:ta,controls:jn,controlsList:wr,coords:pt|Tp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:jn,defer:jn,dir:null,dirName:null,disabled:jn,download:Dde,draggable:ta,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:jn,formTarget:null,headers:wr,height:pt,hidden:jn,high:pt,href:null,hrefLang:null,htmlFor:wr,httpEquiv:wr,id:null,imageSizes:null,imageSrcSet:null,inert:jn,inputMode:null,integrity:null,is:null,isMap:jn,itemId:null,itemProp:wr,itemRef:wr,itemScope:jn,itemType:wr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:jn,low:pt,manifest:null,max:null,maxLength:pt,media:null,method:null,min:null,minLength:pt,multiple:jn,muted:jn,name:null,nonce:null,noModule:jn,noValidate:jn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:jn,optimum:pt,pattern:null,ping:wr,placeholder:null,playsInline:jn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:jn,referrerPolicy:null,rel:wr,required:jn,reversed:jn,rows:pt,rowSpan:pt,sandbox:wr,scope:null,scoped:jn,seamless:jn,selected:jn,shadowRootClonable:jn,shadowRootDelegatesFocus:jn,shadowRootMode:null,shape:null,size:pt,sizes:null,slot:null,span:pt,spellCheck:ta,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pt,step:null,style:null,tabIndex:pt,target:null,title:null,translate:null,type:null,typeMustMatch:jn,useMap:null,value:ta,width:pt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wr,axis:null,background:null,bgColor:null,border:pt,borderColor:null,bottomMargin:pt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:jn,declare:jn,event:null,face:null,frame:null,frameBorder:null,hSpace:pt,leftMargin:pt,link:null,longDesc:null,lowSrc:null,marginHeight:pt,marginWidth:pt,noResize:jn,noHref:jn,noShade:jn,noWrap:jn,object:null,profile:null,prompt:null,rev:null,rightMargin:pt,rules:null,scheme:null,scrolling:ta,standby:null,summary:null,text:null,topMargin:pt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:jn,disableRemotePlayback:jn,prefix:null,property:null,results:pt,security:null,unselectable:null},space:"html",transform:Fde}),ZGe=eg({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:to,accentHeight:pt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pt,amplitude:pt,arabicForm:null,ascent:pt,attributeName:null,attributeType:null,azimuth:pt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pt,by:null,calcMode:null,capHeight:pt,className:wr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:pt,diffuseConstant:pt,direction:null,display:null,dur:null,divisor:pt,dominantBaseline:null,download:jn,dx:null,dy:null,edgeMode:null,editable:null,elevation:pt,enableBackground:null,end:null,event:null,exponent:pt,externalResourcesRequired:null,fill:null,fillOpacity:pt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Tp,g2:Tp,glyphName:Tp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pt,horizOriginX:pt,horizOriginY:pt,id:null,ideographic:pt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pt,k:pt,k1:pt,k2:pt,k3:pt,k4:pt,kernelMatrix:to,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:pt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:pt,overlineThickness:pt,paintOrder:null,panose1:null,path:null,pathLength:pt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pt,pointsAtY:pt,pointsAtZ:pt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:to,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:to,rev:to,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:to,requiredFeatures:to,requiredFonts:to,requiredFormats:to,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:pt,specularExponent:pt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pt,strikethroughThickness:pt,string:null,stroke:null,strokeDashArray:to,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pt,strokeOpacity:pt,strokeWidth:null,style:null,surfaceScale:pt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:to,tabIndex:pt,tableValues:null,target:null,targetX:pt,targetY:pt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:to,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pt,underlineThickness:pt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pt,values:null,vAlphabetic:pt,vMathematical:pt,vectorEffect:null,vHanging:pt,vIdeographic:pt,version:null,vertAdvY:pt,vertOriginX:pt,vertOriginY:pt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Bde}),zde=eg({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Hde=eg({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fde}),Ude=eg({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),QGe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},JGe=/[A-Z]/g,mV=/-[a-z]/g,eKe=/^data[-\w.:]+$/i;function Wde(e,t){const n=jb(t);let r=t,a=Yi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&eKe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(mV,nKe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!mV.test(i)){let o=i.replace(JGe,tKe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=gF}return new a(r,t)}function tKe(e){return"-"+e.toLowerCase()}function nKe(e){return e.charAt(1).toUpperCase()}const qde=Lde([jde,XGe,zde,Hde,Ude],"html"),FE=Lde([jde,ZGe,zde,Hde,Ude],"svg");function vV(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function rKe(e){return e.join(" ").trim()}var Lf={},Xk,bV;function aKe(){if(bV)return Xk;bV=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
496
496
|
`,c="/",u="*",d="",f="comment",h="declaration";Xk=function(m,v){if(typeof m!="string")throw new TypeError("First argument must be a string");if(!m)return[];v=v||{};var b=1,y=1;function S($){var R=$.match(t);R&&(b+=R.length);var A=$.lastIndexOf(l);y=~A?$.length-A:y+$.length}function C(){var $={line:b,column:y};return function(R){return R.position=new x($),T(),R}}function x($){this.start=$,this.end={line:b,column:y},this.source=v.source}x.prototype.content=m;function w($){var R=new Error(v.source+":"+b+":"+y+": "+$);if(R.reason=$,R.filename=v.source,R.line=b,R.column=y,R.source=m,!v.silent)throw R}function _($){var R=$.exec(m);if(R){var A=R[0];return S(A),m=m.slice(A.length),R}}function T(){_(n)}function k($){var R;for($=$||[];R=O();)R!==!1&&$.push(R);return $}function O(){var $=C();if(!(c!=m.charAt(0)||u!=m.charAt(1))){for(var R=2;d!=m.charAt(R)&&(u!=m.charAt(R)||c!=m.charAt(R+1));)++R;if(R+=2,d===m.charAt(R-1))return w("End of comment missing");var A=m.slice(2,R-2);return y+=2,S(A),m=m.slice(R),y+=2,$({type:f,comment:A})}}function I(){var $=C(),R=_(r);if(R){if(O(),!_(a))return w("property missing ':'");var A=_(i),P=$({type:h,property:g(R[0].replace(e,d)),value:A?g(A[0].replace(e,d)):d});return _(o),P}}function M(){var $=[];k($);for(var R;R=I();)R!==!1&&($.push(R),k($));return $}return T(),M()};function g(m){return m?m.replace(s,d):d}return Xk}var yV;function iKe(){if(yV)return Lf;yV=1;var e=Lf&&Lf.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.default=n;var t=e(aKe());function n(r,a){var i=null;if(!r||typeof r!="string")return i;var o=(0,t.default)(r),s=typeof a=="function";return o.forEach(function(l){if(l.type==="declaration"){var c=l.property,u=l.value;s?a(c,u,l):u&&(i=i||{},i[c]=u)}}),i}return Lf}var qg={},SV;function oKe(){if(SV)return qg;SV=1,Object.defineProperty(qg,"__esModule",{value:!0}),qg.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},o=function(c,u){return u.toUpperCase()},s=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(a,s):c=c.replace(r,s),c.replace(t,o))};return qg.camelCase=l,qg}var Vg,xV;function sKe(){if(xV)return Vg;xV=1;var e=Vg&&Vg.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(iKe()),n=oKe();function r(a,i){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(s,l){s&&l&&(o[(0,n.camelCase)(s,i)]=l)}),o}return r.default=r,Vg=r,Vg}var lKe=sKe();const cKe=An(lKe),Vde=Gde("end"),mF=Gde("start");function Gde(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Kde(e){const t=mF(e),n=Vde(e);if(t&&n)return{start:t,end:n}}function Kv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wV(e.position):"start"in e||"end"in e?wV(e):"line"in e||"column"in e?lN(e):""}function lN(e){return CV(e&&e.line)+":"+CV(e&&e.column)}function wV(e){return lN(e&&e.start)+"-"+lN(e&&e.end)}function CV(e){return e&&typeof e=="number"?e:1}class Si extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=s?s.line:void 0,this.name=Kv(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Si.prototype.file="";Si.prototype.name="";Si.prototype.reason="";Si.prototype.message="";Si.prototype.stack="";Si.prototype.column=void 0;Si.prototype.line=void 0;Si.prototype.ancestors=void 0;Si.prototype.cause=void 0;Si.prototype.fatal=void 0;Si.prototype.place=void 0;Si.prototype.ruleId=void 0;Si.prototype.source=void 0;const vF={}.hasOwnProperty,uKe=new Map,dKe=/[A-Z]/g,fKe=new Set(["table","tbody","thead","tfoot","tr"]),pKe=new Set(["td","th"]),Yde="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hKe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wKe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=xKe(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?FE:qde,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Xde(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Xde(e,t,n){if(t.type==="element")return gKe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mKe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bKe(e,t,n);if(t.type==="mdxjsEsm")return vKe(e,t);if(t.type==="root")return yKe(e,t,n);if(t.type==="text")return SKe(e,t)}function gKe(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=FE,e.schema=a),e.ancestors.push(t);const i=Qde(e,t.tagName,!1),o=CKe(e,t);let s=yF(e,t);return fKe.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!KGe(l):!0})),Zde(e,o,i,t),bF(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function mKe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Bb(e,t.position)}function vKe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Bb(e,t.position)}function bKe(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=FE,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Qde(e,t.name,!0),o=EKe(e,t),s=yF(e,t);return Zde(e,o,i,t),bF(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function yKe(e,t,n){const r={};return bF(r,yF(e,t)),e.create(t,e.Fragment,r,n)}function SKe(e,t){return t.value}function Zde(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bF(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xKe(e,t,n){return r;function r(a,i,o,s){const c=Array.isArray(o.children)?n:t;return s?c(i,o,s):c(i,o)}}function wKe(e,t){return n;function n(r,a,i,o){const s=Array.isArray(i.children),l=mF(r);return t(a,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function CKe(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&vF.call(t.properties,a)){const i=_Ke(e,a,t.properties[a]);if(i){const[o,s]=i;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&pKe.has(t.tagName)?r=s:n[o]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function EKe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Bb(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,i=e.evaluater.evaluateExpression(s.expression)}else Bb(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function yF(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:uKe;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=a.get(l)||0;o=l+"-"+c,a.set(l,c+1)}}const s=Xde(e,i,o);s!==void 0&&n.push(s)}return n}function _Ke(e,t,n){const r=Wde(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?UGe(n):rKe(n)),r.property==="style"){let a=typeof n=="object"?n:TKe(e,String(n));return e.stylePropertyNameCase==="css"&&(a=kKe(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?QGe[r.property]||r.property:r.attribute,n]}}function TKe(e,t){try{return cKe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Si("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Yde+"#cannot-parse-style-attribute",a}}function Qde(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const s=pV(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=o}else r=pV(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return vF.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Bb(e)}function Bb(e,t){const n=new Si("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Yde+"#cannot-handle-mdx-estrees-without-createevaluater",n}function kKe(e){const t={};let n;for(n in e)vF.call(e,n)&&(t[OKe(n)]=e[n]);return t}function OKe(e){let t=e.replace(dKe,$Ke);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $Ke(e){return"-"+e.toLowerCase()}const Zk={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},IKe={};function SF(e,t){const n=IKe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Jde(e,r,a)}function Jde(e,t,n){if(AKe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return EV(e.children,t,n)}return Array.isArray(e)?EV(e,t,n):""}function EV(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Jde(e[a],t,n);return r.join("")}function AKe(e){return!!(e&&typeof e=="object")}const _V=document.createElement("i");function Fb(e){const t="&"+e+";";_V.innerHTML=t;const n=_V.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ho(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function No(e,t){return e.length>0?(ho(e,e.length,0,t),e):t}const TV={}.hasOwnProperty;function efe(e){const t={};let n=-1;for(;++n<e.length;)RKe(t,e[n]);return t}function RKe(e,t){let n;for(n in t){const a=(TV.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){TV.call(a,o)||(a[o]=[]);const s=i[o];MKe(a[o],Array.isArray(s)?s:s?[s]:[])}}}function MKe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ho(e,0,0,r)}function tfe(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Es(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ki=du(/[A-Za-z]/),gi=du(/[\dA-Za-z]/),PKe=du(/[#-'*+\--9=?A-Z^-~]/);function zw(e){return e!==null&&(e<32||e===127)}const cN=du(/\d/),NKe=du(/[\dA-Fa-f]/),LKe=du(/[!-/:-@[-`{-~]/);function sn(e){return e!==null&&e<-2}function xr(e){return e!==null&&(e<0||e===32)}function Yn(e){return e===-2||e===-1||e===32}const zE=du(new RegExp("\\p{P}|\\p{S}","u")),$d=du(/\s/);function du(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function tg(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&gi(e.charCodeAt(n+1))&&gi(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function tr(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Yn(l)?(e.enter(n),s(l)):t(l)}function s(l){return Yn(l)&&i++<a?(e.consume(l),s):(e.exit(n),t(l))}}const DKe={tokenize:jKe};function jKe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),tr(e,t,"linePrefix")}function a(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return sn(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),o)}}const BKe={tokenize:FKe},kV={tokenize:zKe};function FKe(e){const t=this,n=[];let r=0,a,i,o;return s;function s(S){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&y();const C=t.events.length;let x=C,w;for(;x--;)if(t.events[x][0]==="exit"&&t.events[x][1].type==="chunkFlow"){w=t.events[x][1].end;break}b(r);let _=C;for(;_<t.events.length;)t.events[_][1].end={...w},_++;return ho(t.events,x+1,0,t.events.slice(C)),t.events.length=_,c(S)}return s(S)}function c(S){if(r===n.length){if(!a)return f(S);if(a.currentConstruct&&a.currentConstruct.concrete)return g(S);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kV,u,d)(S)}function u(S){return a&&y(),b(r),f(S)}function d(S){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(S)}function f(S){return t.containerState={},e.attempt(kV,h,g)(S)}function h(S){return r++,n.push([t.currentConstruct,t.containerState]),f(S)}function g(S){if(S===null){a&&y(),b(0),e.consume(S);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),m(S)}function m(S){if(S===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return sn(S)?(e.consume(S),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(S),m)}function v(S,C){const x=t.sliceStream(S);if(C&&x.push(null),S.previous=i,i&&(i.next=S),i=S,a.defineSkip(S.start),a.write(x),t.parser.lazy[S.start.line]){let w=a.events.length;for(;w--;)if(a.events[w][1].start.offset<o&&(!a.events[w][1].end||a.events[w][1].end.offset>o))return;const _=t.events.length;let T=_,k,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(k){O=t.events[T][1].end;break}k=!0}for(b(r),w=_;w<t.events.length;)t.events[w][1].end={...O},w++;ho(t.events,T+1,0,t.events.slice(_)),t.events.length=w}}function b(S){let C=n.length;for(;C-- >S;){const x=n[C];t.containerState=x[1],x[0].exit.call(t,e)}n.length=S}function y(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function zKe(e,t,n){return tr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qp(e){if(e===null||xr(e)||$d(e))return 1;if(zE(e))return 2}function HE(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const uN={name:"attention",resolveAll:HKe,tokenize:UKe};function HKe(e,t){let n=-1,r,a,i,o,s,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};OV(d,-l),OV(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=No(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=No(c,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=No(c,HE(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=No(c,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=No(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,ho(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function UKe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Qp(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const c=e.exit("attentionSequence"),u=Qp(l),d=!u||u===2&&a||n.includes(l),f=!a||a===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(a||!f)),c._close=!!(i===42?f:f&&(u||!d)),t(l)}}function OV(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const WKe={name:"autolink",tokenize:qKe};function qKe(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return ki(h)?(e.consume(h),o):h===64?n(h):c(h)}function o(h){return h===43||h===45||h===46||gi(h)?(r=1,s(h)):c(h)}function s(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||gi(h))&&r++<32?(e.consume(h),s):(r=0,c(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||zw(h)?n(h):(e.consume(h),l)}function c(h){return h===64?(e.consume(h),u):PKe(h)?(e.consume(h),c):n(h)}function u(h){return gi(h)?d(h):n(h)}function d(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||gi(h))&&r++<63){const g=h===45?f:d;return e.consume(h),g}return n(h)}}const r0={partial:!0,tokenize:VKe};function VKe(e,t,n){return r;function r(i){return Yn(i)?tr(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||sn(i)?t(i):n(i)}}const nfe={continuation:{tokenize:KKe},exit:YKe,name:"blockQuote",tokenize:GKe};function GKe(e,t,n){const r=this;return a;function a(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Yn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function KKe(e,t,n){const r=this;return a;function a(o){return Yn(o)?tr(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(nfe,t,n)(o)}}function YKe(e){e.exit("blockQuote")}const rfe={name:"characterEscape",tokenize:XKe};function XKe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return LKe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const afe={name:"characterReference",tokenize:ZKe};function ZKe(e,t,n){const r=this;let a=0,i,o;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=gi,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=NKe,u):(e.enter("characterReferenceValue"),i=7,o=cN,u(d))}function u(d){if(d===59&&a){const f=e.exit("characterReferenceValue");return o===gi&&!Fb(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&a++<i?(e.consume(d),u):n(d)}}const $V={partial:!0,tokenize:JKe},IV={concrete:!0,name:"codeFenced",tokenize:QKe};function QKe(e,t,n){const r=this,a={partial:!0,tokenize:x};let i=0,o=0,s;return l;function l(w){return c(w)}function c(w){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===s?(o++,e.consume(w),u):o<3?n(w):(e.exit("codeFencedFenceSequence"),Yn(w)?tr(e,d,"whitespace")(w):d(w))}function d(w){return w===null||sn(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check($V,m,C)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||sn(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(w)):Yn(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tr(e,h,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),f)}function h(w){return w===null||sn(w)?d(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||sn(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(w)):w===96&&w===s?n(w):(e.consume(w),g)}function m(w){return e.attempt(a,C,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),b}function b(w){return i>0&&Yn(w)?tr(e,y,"linePrefix",i+1)(w):y(w)}function y(w){return w===null||sn(w)?e.check($V,m,C)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||sn(w)?(e.exit("codeFlowValue"),y(w)):(e.consume(w),S)}function C(w){return e.exit("codeFenced"),t(w)}function x(w,_,T){let k=0;return O;function O(A){return w.enter("lineEnding"),w.consume(A),w.exit("lineEnding"),I}function I(A){return w.enter("codeFencedFence"),Yn(A)?tr(w,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):M(A)}function M(A){return A===s?(w.enter("codeFencedFenceSequence"),$(A)):T(A)}function $(A){return A===s?(k++,w.consume(A),$):k>=o?(w.exit("codeFencedFenceSequence"),Yn(A)?tr(w,R,"whitespace")(A):R(A)):T(A)}function R(A){return A===null||sn(A)?(w.exit("codeFencedFence"),_(A)):T(A)}}}function JKe(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Qk={name:"codeIndented",tokenize:tYe},eYe={partial:!0,tokenize:nYe};function tYe(e,t,n){const r=this;return a;function a(c){return e.enter("codeIndented"),tr(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):sn(c)?e.attempt(eYe,o,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||sn(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function nYe(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):sn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):tr(e,i,"linePrefix",5)(o)}function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):sn(o)?a(o):n(o)}}const rYe={name:"codeText",previous:iYe,resolve:aYe,tokenize:oYe};function aYe(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function iYe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function oYe(e,t,n){let r=0,a,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),a=0,u(d)):sn(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||sn(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),a++,u):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class sYe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Gg(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Gg(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Gg(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Gg(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Gg(this.left,n.reverse())}}}function Gg(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ife(e){const t={};let n=-1,r,a,i,o,s,l,c;const u=new sYe(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,lYe(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(u.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...u.get(a)[1].start},s=u.slice(a,n),s.unshift(r),u.splice(a,n-a+1,s))}}return ho(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function lYe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],c={};let u,d,f=-1,h=n,g=0,m=0;const v=[m];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),d&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(m=f+1,v.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):v.pop(),f=v.length;f--;){const b=s.slice(v[f],v[f+1]),y=i.pop();l.push([y,y+b.length-1]),e.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const cYe={resolve:dYe,tokenize:fYe},uYe={partial:!0,tokenize:pYe};function dYe(e){return ife(e),e}function fYe(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(s)}function a(s){return s===null?i(s):sn(s)?e.check(uYe,o,i)(s):(e.consume(s),a)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function pYe(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),tr(e,i,"linePrefix")}function i(o){if(o===null||sn(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ofe(e,t,n,r,a,i,o,s,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||zw(b)?n(b):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===62?(e.exit("chunkString"),e.exit(s),f(b)):b===null||b===60||sn(b)?n(b):(e.consume(b),b===92?g:h)}function g(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function m(b){return!u&&(b===null||b===41||xr(b))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,m):b===41?(e.consume(b),u--,m):b===null||b===32||b===40||zw(b)?n(b):(e.consume(b),b===92?v:m)}function v(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function sfe(e,t,n,r,a,i){const o=this;let s=0,l;return c;function c(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),u}function u(h){return s>999||h===null||h===91||h===93&&!l||h===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):sn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||sn(h)||s++>999?(e.exit("chunkString"),u(h)):(e.consume(h),l||(l=!Yn(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(e.consume(h),s++,d):d(h)}}function lfe(e,t,n,r,a,i){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(a),e.consume(f),e.exit(a),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(a),e.consume(f),e.exit(a),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):sn(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),tr(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||sn(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Yv(e,t){let n;return r;function r(a){return sn(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Yn(a)?tr(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const hYe={name:"definition",tokenize:mYe},gYe={partial:!0,tokenize:vYe};function mYe(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),o(h)}function o(h){return sfe.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function s(h){return a=Es(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return xr(h)?Yv(e,c)(h):c(h)}function c(h){return ofe(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(gYe,d,d)(h)}function d(h){return Yn(h)?tr(e,f,"whitespace")(h):f(h)}function f(h){return h===null||sn(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function vYe(e,t,n){return r;function r(s){return xr(s)?Yv(e,a)(s):n(s)}function a(s){return lfe(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return Yn(s)?tr(e,o,"whitespace")(s):o(s)}function o(s){return s===null||sn(s)?t(s):n(s)}}const bYe={name:"hardBreakEscape",tokenize:yYe};function yYe(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return sn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const SYe={name:"headingAtx",resolve:xYe,tokenize:wYe};function xYe(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ho(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function wYe(e,t,n){let r=0;return a;function a(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||xr(u)?(e.exit("atxHeadingSequence"),s(u)):n(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||sn(u)?(e.exit("atxHeading"),t(u)):Yn(u)?tr(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||xr(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}const CYe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],AV=["pre","script","style","textarea"],EYe={concrete:!0,name:"htmlFlow",resolveTo:kYe,tokenize:OYe},_Ye={partial:!0,tokenize:IYe},TYe={partial:!0,tokenize:$Ye};function kYe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function OYe(e,t,n){const r=this;let a,i,o,s,l;return c;function c(B){return u(B)}function u(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),d}function d(B){return B===33?(e.consume(B),f):B===47?(e.consume(B),i=!0,m):B===63?(e.consume(B),a=3,r.interrupt?t:D):ki(B)?(e.consume(B),o=String.fromCharCode(B),v):n(B)}function f(B){return B===45?(e.consume(B),a=2,h):B===91?(e.consume(B),a=5,s=0,g):ki(B)?(e.consume(B),a=4,r.interrupt?t:D):n(B)}function h(B){return B===45?(e.consume(B),r.interrupt?t:D):n(B)}function g(B){const z="CDATA[";return B===z.charCodeAt(s++)?(e.consume(B),s===z.length?r.interrupt?t:M:g):n(B)}function m(B){return ki(B)?(e.consume(B),o=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||xr(B)){const z=B===47,G=o.toLowerCase();return!z&&!i&&AV.includes(G)?(a=1,r.interrupt?t(B):M(B)):CYe.includes(o.toLowerCase())?(a=6,z?(e.consume(B),b):r.interrupt?t(B):M(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?y(B):S(B))}return B===45||gi(B)?(e.consume(B),o+=String.fromCharCode(B),v):n(B)}function b(B){return B===62?(e.consume(B),r.interrupt?t:M):n(B)}function y(B){return Yn(B)?(e.consume(B),y):O(B)}function S(B){return B===47?(e.consume(B),O):B===58||B===95||ki(B)?(e.consume(B),C):Yn(B)?(e.consume(B),S):O(B)}function C(B){return B===45||B===46||B===58||B===95||gi(B)?(e.consume(B),C):x(B)}function x(B){return B===61?(e.consume(B),w):Yn(B)?(e.consume(B),x):S(B)}function w(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,_):Yn(B)?(e.consume(B),w):T(B)}function _(B){return B===l?(e.consume(B),l=null,k):B===null||sn(B)?n(B):(e.consume(B),_)}function T(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||xr(B)?x(B):(e.consume(B),T)}function k(B){return B===47||B===62||Yn(B)?S(B):n(B)}function O(B){return B===62?(e.consume(B),I):n(B)}function I(B){return B===null||sn(B)?M(B):Yn(B)?(e.consume(B),I):n(B)}function M(B){return B===45&&a===2?(e.consume(B),P):B===60&&a===1?(e.consume(B),N):B===62&&a===4?(e.consume(B),H):B===63&&a===3?(e.consume(B),D):B===93&&a===5?(e.consume(B),j):sn(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(_Ye,F,$)(B)):B===null||sn(B)?(e.exit("htmlFlowData"),$(B)):(e.consume(B),M)}function $(B){return e.check(TYe,R,F)(B)}function R(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),A}function A(B){return B===null||sn(B)?$(B):(e.enter("htmlFlowData"),M(B))}function P(B){return B===45?(e.consume(B),D):M(B)}function N(B){return B===47?(e.consume(B),o="",L):M(B)}function L(B){if(B===62){const z=o.toLowerCase();return AV.includes(z)?(e.consume(B),H):M(B)}return ki(B)&&o.length<8?(e.consume(B),o+=String.fromCharCode(B),L):M(B)}function j(B){return B===93?(e.consume(B),D):M(B)}function D(B){return B===62?(e.consume(B),H):B===45&&a===2?(e.consume(B),D):M(B)}function H(B){return B===null||sn(B)?(e.exit("htmlFlowData"),F(B)):(e.consume(B),H)}function F(B){return e.exit("htmlFlow"),t(B)}}function $Ye(e,t,n){const r=this;return a;function a(o){return sn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function IYe(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(r0,t,n)}}const AYe={name:"htmlText",tokenize:RYe};function RYe(e,t,n){const r=this;let a,i,o;return s;function s(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),c):D===47?(e.consume(D),x):D===63?(e.consume(D),S):ki(D)?(e.consume(D),T):n(D)}function c(D){return D===45?(e.consume(D),u):D===91?(e.consume(D),i=0,g):ki(D)?(e.consume(D),y):n(D)}function u(D){return D===45?(e.consume(D),h):n(D)}function d(D){return D===null?n(D):D===45?(e.consume(D),f):sn(D)?(o=d,N(D)):(e.consume(D),d)}function f(D){return D===45?(e.consume(D),h):d(D)}function h(D){return D===62?P(D):D===45?f(D):d(D)}function g(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?m:g):n(D)}function m(D){return D===null?n(D):D===93?(e.consume(D),v):sn(D)?(o=m,N(D)):(e.consume(D),m)}function v(D){return D===93?(e.consume(D),b):m(D)}function b(D){return D===62?P(D):D===93?(e.consume(D),b):m(D)}function y(D){return D===null||D===62?P(D):sn(D)?(o=y,N(D)):(e.consume(D),y)}function S(D){return D===null?n(D):D===63?(e.consume(D),C):sn(D)?(o=S,N(D)):(e.consume(D),S)}function C(D){return D===62?P(D):S(D)}function x(D){return ki(D)?(e.consume(D),w):n(D)}function w(D){return D===45||gi(D)?(e.consume(D),w):_(D)}function _(D){return sn(D)?(o=_,N(D)):Yn(D)?(e.consume(D),_):P(D)}function T(D){return D===45||gi(D)?(e.consume(D),T):D===47||D===62||xr(D)?k(D):n(D)}function k(D){return D===47?(e.consume(D),P):D===58||D===95||ki(D)?(e.consume(D),O):sn(D)?(o=k,N(D)):Yn(D)?(e.consume(D),k):P(D)}function O(D){return D===45||D===46||D===58||D===95||gi(D)?(e.consume(D),O):I(D)}function I(D){return D===61?(e.consume(D),M):sn(D)?(o=I,N(D)):Yn(D)?(e.consume(D),I):k(D)}function M(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,$):sn(D)?(o=M,N(D)):Yn(D)?(e.consume(D),M):(e.consume(D),R)}function $(D){return D===a?(e.consume(D),a=void 0,A):D===null?n(D):sn(D)?(o=$,N(D)):(e.consume(D),$)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||xr(D)?k(D):(e.consume(D),R)}function A(D){return D===47||D===62||xr(D)?k(D):n(D)}function P(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function N(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),L}function L(D){return Yn(D)?tr(e,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D)}function j(D){return e.enter("htmlTextData"),o(D)}}const xF={name:"labelEnd",resolveAll:LYe,resolveTo:DYe,tokenize:jYe},MYe={tokenize:BYe},PYe={tokenize:FYe},NYe={tokenize:zYe};function LYe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&ho(e,0,e.length,n),e}function DYe(e,t){let n=e.length,r=0,a,i,o,s;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=No(s,e.slice(i+1,i+r+3)),s=No(s,[["enter",u,t]]),s=No(s,HE(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),s=No(s,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),s=No(s,e.slice(o+1)),s=No(s,[["exit",l,t]]),ho(e,i,e.length,s),e}function jYe(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return s;function s(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(Es(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(MYe,u,o?u:d)(f):f===91?e.attempt(PYe,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(NYe,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function BYe(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),a}function a(d){return xr(d)?Yv(e,i)(d):i(d)}function i(d){return d===41?u(d):ofe(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return xr(d)?Yv(e,l)(d):u(d)}function s(d){return n(d)}function l(d){return d===34||d===39||d===40?lfe(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return xr(d)?Yv(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function FYe(e,t,n){const r=this;return a;function a(s){return sfe.call(r,e,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes(Es(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function zYe(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const HYe={name:"labelStartImage",resolveAll:xF.resolveAll,tokenize:UYe};function UYe(e,t,n){const r=this;return a;function a(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const WYe={name:"labelStartLink",resolveAll:xF.resolveAll,tokenize:qYe};function qYe(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Jk={name:"lineEnding",tokenize:VYe};function VYe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),tr(e,t,"linePrefix")}}const Rx={name:"thematicBreak",tokenize:GYe};function GYe(e,t,n){let r=0,a;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return a=c,s(c)}function s(c){return c===a?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||sn(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===a?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Yn(c)?tr(e,s,"whitespace")(c):s(c))}}const Hi={continuation:{tokenize:ZYe},exit:JYe,name:"list",tokenize:XYe},KYe={partial:!0,tokenize:eXe},YYe={partial:!0,tokenize:QYe};function XYe(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return s;function s(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:cN(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Rx,n,c)(h):c(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return cN(h)&&++o<10?(e.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),c(h)):n(h)}function c(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(r0,r.interrupt?n:u,e.attempt(KYe,f,d))}function u(h){return r.containerState.initialBlankLine=!0,i++,f(h)}function d(h){return Yn(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function ZYe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(r0,a,i);function a(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tr(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!Yn(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(YYe,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,tr(e,e.attempt(Hi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function QYe(e,t,n){const r=this;return tr(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function JYe(e){e.exit(this.containerState.type)}function eXe(e,t,n){const r=this;return tr(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!Yn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const RV={name:"setextUnderline",resolveTo:tXe,tokenize:nXe};function tXe(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function nXe(e,t,n){const r=this;let a;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===a?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),Yn(c)?tr(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||sn(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const rXe={tokenize:aXe};function aXe(e){const t=this,n=e.attempt(r0,r,e.attempt(this.parser.constructs.flowInitial,a,tr(e,e.attempt(this.parser.constructs.flow,a,e.attempt(cYe,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const iXe={resolveAll:ufe()},oXe=cfe("string"),sXe=cfe("text");function cfe(e){return{resolveAll:ufe(e==="text"?lXe:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,s);return o;function o(u){return c(u)?i(u):s(u)}function s(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=a[u];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function ufe(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function lXe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,s=0,l;for(;i--;){const c=a[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const cXe={42:Hi,43:Hi,45:Hi,48:Hi,49:Hi,50:Hi,51:Hi,52:Hi,53:Hi,54:Hi,55:Hi,56:Hi,57:Hi,62:nfe},uXe={91:hYe},dXe={[-2]:Qk,[-1]:Qk,32:Qk},fXe={35:SYe,42:Rx,45:[RV,Rx],60:EYe,61:RV,95:Rx,96:IV,126:IV},pXe={38:afe,92:rfe},hXe={[-5]:Jk,[-4]:Jk,[-3]:Jk,33:HYe,38:afe,42:uN,60:[WKe,AYe],91:WYe,92:[bYe,rfe],93:xF,95:uN,96:rYe},gXe={null:[uN,iXe]},mXe={null:[42,95]},vXe={null:[]},bXe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mXe,contentInitial:uXe,disable:vXe,document:cXe,flow:fXe,flowInitial:dXe,insideSpan:gXe,string:pXe,text:hXe},Symbol.toStringTag,{value:"Module"}));function yXe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],s=[];const l={attempt:_(x),check:_(w),consume:y,enter:S,exit:C,interrupt:_(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(I){return o=No(o,I),v(),o[o.length-1]!==null?[]:(T(t,0),c.events=HE(i,c.events,c),c.events)}function f(I,M){return xXe(h(I),M)}function h(I){return SXe(o,I)}function g(){const{_bufferIndex:I,_index:M,line:$,column:R,offset:A}=r;return{_bufferIndex:I,_index:M,line:$,column:R,offset:A}}function m(I){a[I.line]=I.column,O()}function v(){let I;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<M.length;)b(M.charCodeAt(r._bufferIndex));else b(M)}}function b(I){u=u(I)}function y(I){sn(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,O()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function S(I,M){const $=M||{};return $.type=I,$.start=g(),c.events.push(["enter",$,c]),s.push($),$}function C(I){const M=s.pop();return M.end=g(),c.events.push(["exit",M,c]),M}function x(I,M){T(I,M.from)}function w(I,M){M.restore()}function _(I,M){return $;function $(R,A,P){let N,L,j,D;return Array.isArray(R)?F(R):"tokenize"in R?F([R]):H(R);function H(X){return Z;function Z(q){const Y=q!==null&&X[q],te=q!==null&&X.null,ee=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(te)?te:te?[te]:[]];return F(ee)(q)}}function F(X){return N=X,L=0,X.length===0?P:B(X[L])}function B(X){return Z;function Z(q){return D=k(),j=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?G():X.tokenize.call(M?Object.assign(Object.create(c),M):c,l,z,G)(q)}}function z(X){return I(j,D),A}function G(X){return D.restore(),++L<N.length?B(N[L]):P}}}function T(I,M){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&ho(c.events,M,c.events.length-M,I.resolve(c.events.slice(M),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function k(){const I=g(),M=c.previous,$=c.currentConstruct,R=c.events.length,A=Array.from(s);return{from:R,restore:P};function P(){r=I,c.previous=M,c.currentConstruct=$,c.events.length=R,s=A,O()}}function O(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function SXe(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function xXe(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
497
497
|
`;break}case-3:{o=`\r
|
|
498
498
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function wXe(e){const r={constructs:efe([bXe,...(e||{}).extensions||[]]),content:a(DKe),defined:[],document:a(BKe),flow:a(rXe),lazy:{},string:a(oXe),text:a(sXe)};return r;function a(i){return o;function o(s){return yXe(r,i,s)}}}function CXe(e){for(;!ife(e););return e}const MV=/[\0\t\n\r]/g;function EXe(){let e=1,t="",n=!0,r;return a;function a(i,o,s){const l=[];let c,u,d,f,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(MV.lastIndex=d,c=MV.exec(i),f=c&&c.index!==void 0?c.index:i.length,h=i.charCodeAt(f),!c){t=i.slice(d);break}if(h===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),h){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const _Xe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function TXe(e){return e.replace(_Xe,kXe)}function kXe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return tfe(n.slice(i?2:1),i?16:10)}return Fb(n)||e}const dfe={}.hasOwnProperty;function OXe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),$Xe(n)(CXe(wXe(n).document().write(EXe()(e,t,!0))))}function $Xe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Te),autolinkProtocol:k,autolinkEmail:k,atxHeading:i(re),blockQuote:i(te),characterEscape:k,characterReference:k,codeFenced:i(ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ee,o),codeText:i(Q,o),codeTextData:k,data:k,codeFlowValue:k,definition:i(ae),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(oe),hardBreakEscape:i(ie),hardBreakTrailing:i(ie),htmlFlow:i(ue,o),htmlFlowData:k,htmlText:i(ue,o),htmlTextData:k,image:i(ge),label:o,link:i(Te),listItem:i(fe),listItemValue:f,listOrdered:i(Se,d),listUnordered:i(Se),paragraph:i(he),reference:B,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(re),strong:i(ve),thematicBreak:i(Re)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:Y,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:X,characterReference:Z,codeFenced:l(v),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:O,codeIndented:l(b),codeText:l(A),codeTextData:O,data:O,definition:l(),definitionDestinationString:C,definitionLabelString:y,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l($),htmlFlowData:O,htmlText:l(R),htmlTextData:O,image:l(N),label:j,labelText:L,lineEnding:I,link:l(P),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:z,resourceDestinationString:D,resourceTitleString:H,resource:F,setextHeading:l(T),setextHeadingLineSequence:_,setextHeadingText:w,strong:l(),thematicBreak:l()}};ffe(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let xe={type:"root",children:[]};const Me={stack:[xe],tokenStack:[],config:t,enter:s,exit:c,buffer:o,resume:u,data:n},Ie=[];let de=-1;for(;++de<ce.length;)if(ce[de][1].type==="listOrdered"||ce[de][1].type==="listUnordered")if(ce[de][0]==="enter")Ie.push(de);else{const me=Ie.pop();de=a(ce,me,de)}for(de=-1;++de<ce.length;){const me=t[ce[de][0]];dfe.call(me,ce[de][1].type)&&me[ce[de][1].type].call(Object.assign({sliceSerialize:ce[de][2].sliceSerialize},Me),ce[de][1])}if(Me.tokenStack.length>0){const me=Me.tokenStack[Me.tokenStack.length-1];(me[1]||PV).call(Me,void 0,me[0])}for(xe.position={start:vc(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:vc(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},de=-1;++de<t.transforms.length;)xe=t.transforms[de](xe)||xe;return xe}function a(ce,xe,Me){let Ie=xe-1,de=-1,me=!1,pe,Ae,ye,Ce;for(;++Ie<=Me;){const Ee=ce[Ie];switch(Ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ee[0]==="enter"?de++:de--,Ce=void 0;break}case"lineEndingBlank":{Ee[0]==="enter"&&(pe&&!Ce&&!de&&!ye&&(ye=Ie),Ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ce=void 0}if(!de&&Ee[0]==="enter"&&Ee[1].type==="listItemPrefix"||de===-1&&Ee[0]==="exit"&&(Ee[1].type==="listUnordered"||Ee[1].type==="listOrdered")){if(pe){let _e=Ie;for(Ae=void 0;_e--;){const je=ce[_e];if(je[1].type==="lineEnding"||je[1].type==="lineEndingBlank"){if(je[0]==="exit")continue;Ae&&(ce[Ae][1].type="lineEndingBlank",me=!0),je[1].type="lineEnding",Ae=_e}else if(!(je[1].type==="linePrefix"||je[1].type==="blockQuotePrefix"||je[1].type==="blockQuotePrefixWhitespace"||je[1].type==="blockQuoteMarker"||je[1].type==="listItemIndent"))break}ye&&(!Ae||ye<Ae)&&(pe._spread=!0),pe.end=Object.assign({},Ae?ce[Ae][1].start:Ee[1].end),ce.splice(Ae||Ie,0,["exit",pe,Ee[2]]),Ie++,Me++}if(Ee[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},Ee[1].start),end:void 0};pe=_e,ce.splice(Ie,0,["enter",_e,Ee[2]]),Ie++,Me++,ye=void 0,Ce=!0}}}return ce[xe][1]._spread=me,Me}function i(ce,xe){return Me;function Me(Ie){s.call(this,ce(Ie),Ie),xe&&xe.call(this,Ie)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(ce,xe,Me){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([xe,Me||void 0]),ce.position={start:vc(xe.start),end:void 0}}function l(ce){return xe;function xe(Me){ce&&ce.call(this,Me),c.call(this,Me)}}function c(ce,xe){const Me=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ce.type&&(xe?xe.call(this,ce,Ie[0]):(Ie[1]||PV).call(this,ce,Ie[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Kv({start:ce.start,end:ce.end})+"): it’s not open");Me.position.end=vc(ce.end)}function u(){return SF(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(ce){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ce}function g(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ce}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce.replace(/(\r?\n|\r)$/g,"")}function y(ce){const xe=this.resume(),Me=this.stack[this.stack.length-1];Me.label=xe,Me.identifier=Es(this.sliceSerialize(ce)).toLowerCase()}function S(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ce}function C(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ce}function x(ce){const xe=this.stack[this.stack.length-1];if(!xe.depth){const Me=this.sliceSerialize(ce).length;xe.depth=Me}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function _(ce){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function k(ce){const Me=this.stack[this.stack.length-1].children;let Ie=Me[Me.length-1];(!Ie||Ie.type!=="text")&&(Ie=we(),Ie.position={start:vc(ce.start),end:void 0},Me.push(Ie)),this.stack.push(Ie)}function O(ce){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ce),xe.position.end=vc(ce.end)}function I(ce){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Me=xe.children[xe.children.length-1];Me.position.end=vc(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(k.call(this,ce),O.call(this,ce))}function M(){this.data.atHardBreak=!0}function $(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function R(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function A(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function P(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=xe,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function N(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=xe,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function L(ce){const xe=this.sliceSerialize(ce),Me=this.stack[this.stack.length-2];Me.label=TXe(xe),Me.identifier=Es(xe).toLowerCase()}function j(){const ce=this.stack[this.stack.length-1],xe=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const Ie=ce.children;Me.children=Ie}else Me.alt=xe}function D(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ce}function H(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ce}function F(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function z(ce){const xe=this.resume(),Me=this.stack[this.stack.length-1];Me.label=xe,Me.identifier=Es(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function G(ce){this.data.characterReferenceType=ce.type}function X(ce){const xe=this.sliceSerialize(ce),Me=this.data.characterReferenceType;let Ie;Me?(Ie=tfe(xe,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=Fb(xe);const de=this.stack[this.stack.length-1];de.value+=Ie}function Z(ce){const xe=this.stack.pop();xe.position.end=vc(ce.end)}function q(ce){O.call(this,ce);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ce)}function Y(ce){O.call(this,ce);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ce)}function te(){return{type:"blockquote",children:[]}}function ee(){return{type:"code",lang:null,meta:null,value:""}}function Q(){return{type:"inlineCode",value:""}}function ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function oe(){return{type:"emphasis",children:[]}}function re(){return{type:"heading",depth:0,children:[]}}function ie(){return{type:"break"}}function ue(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function Se(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function fe(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function he(){return{type:"paragraph",children:[]}}function ve(){return{type:"strong",children:[]}}function we(){return{type:"text",value:""}}function Re(){return{type:"thematicBreak"}}}function vc(e){return{line:e.line,column:e.column,offset:e.offset}}function ffe(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ffe(e,r):IXe(e,r)}}function IXe(e,t){let n;for(n in t)if(dfe.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function PV(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Kv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Kv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Kv({start:t.start,end:t.end})+") is still open")}function AXe(e){const t=this;t.parser=n;function n(r){return OXe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function RXe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function MXe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -634,11 +634,11 @@ Requirements:
|
|
|
634
634
|
`,Phe="bamboo_system_prompt_enhancement",Jnt=()=>["## Bamboo Operational Guidance","","- For recurring or delayed tasks, use the `schedule_tasks` tool to create and manage schedule jobs instead of only describing manual steps.","- The `schedule_tasks` tool supports: `list`, `create`, `patch`, `delete`, `run_now`, and `list_sessions`.","- Bamboo configuration is stored in `${BAMBOO_DATA_DIR}/config.json`.","- Default config path: `~/.bamboo/config.json` (macOS/Linux) or `%USERPROFILE%\\\\.bamboo\\\\config.json` (Windows)."].join(`
|
|
635
635
|
`),ert=e=>e.map(n=>n.trim()).filter(n=>n.length>0).join(`
|
|
636
636
|
|
|
637
|
-
`),Nhe=()=>{try{return localStorage.getItem(Phe)??""}catch(e){return console.error("Failed to load system prompt enhancement:",e),""}},trt=e=>{try{const t=e.trim()?e:"";localStorage.setItem(Phe,t)}catch(t){console.error("Failed to save system prompt enhancement:",t)}},nrt=e=>{const t=[];t.push(Xnt().trim()),t.push(Jnt().trim());const n=Nhe().trim();return n&&t.push(n),LN()&&t.push(qnt().trim()),jN()&&t.push(Knt().trim()),(e??"").trim().toLowerCase()==="copilot"&&BN()&&t.push(Qnt().trim()),t},rrt=e=>ert(nrt(e));function Lhe(e){const{modal:t,message:n}=Ns.useApp(),r=p.useRef(null),a=p.useRef(null),i=p.useRef(""),o=p.useRef(new Rs),s=Ue(y=>y.agentAvailability),l=Ue(y=>y.setAgentAvailability),c=Ue(y=>y.checkAgentAvailability),u=Ue(y=>y.startAgentHealthCheck),d=pg(),f=Ho(y=>y.currentProvider),h=Ue(y=>e.sessionId&&y.chats.find(S=>S.id===e.sessionId)||null);p.useEffect(()=>{u()},[u]);const g=p.useCallback(()=>{var S;(S=r.current)==null||S.abort();const y=h==null?void 0:h.id;y&&o.current.stopGeneration(y).catch(C=>{console.error("[useMessageStreaming] Failed to stop generation:",C)})},[h==null?void 0:h.id]),m=p.useCallback(async(y,S,C,x,w)=>{var T,k;if(!d)throw new Error("Model not selected");const _=new AbortController;r.current=_;try{const O=rrt(f).trim(),M=(((T=h==null?void 0:h.config)==null?void 0:T.workspacePath)||"").trim().replace(/\/+$/,"").replace(/\\+$/,""),$=await o.current.sendMessage({message:y,session_id:S,enhance_prompt:O||void 0,workspace_path:M||void 0,selected_skill_ids:w&&w.length>0?w:void 0,images:(k=C.images)==null?void 0:k.filter(P=>!!P.base64).map(P=>({base64:P.base64,name:P.name,size:P.size,type:P.type})),model:d}),{session_id:R}=$;R!==S&&console.warn(`[useMessageStreaming] Backend returned unexpected session_id=${R} for sessionId=${S}`),e.setSessionProcessing(S,!0),await new Promise(P=>setTimeout(P,0));const A=x?await o.current.execute(S,d,x):await o.current.execute(S,d);if(console.log("[Agent] Execute status:",A.status),!["started","already_running"].includes(A.status))if(A.status==="completed")console.log("[Agent] Session already completed"),e.setSessionProcessing(S,!1);else throw console.error("[Agent] Execute failed:",A.status),e.setSessionProcessing(S,!1),new Error(`Execute failed: ${A.status}`)}catch(O){throw O}},[e,d,h,f]),v=p.useCallback(async(y,S,C,x)=>{if(!h){t.info({title:"No Active Chat",content:"Please create or select a chat before sending a message."});return}if(!e.sessionId){t.info({title:"No Chat ID",content:"Chat ID is required to send a message."});return}if(!d){t.error({title:"No Model Selected",content:"Please select a model before sending a message."});return}let w=s;if(w===null&&(w=await c()),!w){n.error("Agent unavailable. Please try again later.");return}if(!d){n.error("Model configuration not loaded. Please wait or reload the page.");return}const _=e.sessionId,T=(S==null?void 0:S.map(O=>({id:O.id,base64:O.base64,name:O.name,size:O.size,type:O.type})))||[],k={role:"user",content:y,id:crypto.randomUUID(),createdAt:new Date().toISOString(),images:T};await e.addMessage(_,k);try{console.log("[useChatStreaming] Using Agent Server"),await m(y,_,k,C,x)}catch(O){a.current&&Yr.clear(_,a.current),a.current=null,i.current="",O instanceof Error&&O.name==="AbortError"?n.info("Request cancelled"):(console.error("[useChatStreaming] Failed to send message:",O),n.error("Failed to send message. Please try again."),l(!1)),e.setSessionProcessing(_,!1)}finally{r.current=null,a.current&&Yr.clear(_,a.current),a.current=null,i.current=""}},[s,n,c,e,h,t,m,l,d]),b=p.useCallback(async(y,S="regenerate")=>{if(!h){t.info({title:"No Active Chat",content:"Please create or select a chat before retrying."});return}if(!e.sessionId){t.info({title:"No Chat ID",content:"Chat ID is required to retry."});return}if(!d){t.error({title:"No Model Selected",content:"Please select a model before retrying."});return}let C=s;if(C===null&&(C=await c()),!C){n.error("Agent unavailable. Please try again later.");return}const x=e.sessionId;a.current&&Yr.clear(x,a.current),a.current=null,i.current="";try{const w=S==="error_retry"?"error_retry":"after_last_user";await o.current.truncateSessionMessages(x,{mode:w}),S==="regenerate"&&await Ue.getState().loadChatHistory(x,{mode:"replace"}),e.setSessionProcessing(x,!0);const _=y?await o.current.execute(x,d,y):await o.current.execute(x,d);if(["started","already_running"].includes(_.status))return;if(_.status==="completed"){e.setSessionProcessing(x,!1);return}throw e.setSessionProcessing(x,!1),new Error(`Execute failed: ${_.status}`)}catch(w){console.error("[useMessageStreaming] Retry failed:",w),n.error("Retry failed. Please try again."),e.setSessionProcessing(x,!1)}finally{r.current=null}},[d,s,n,c,h,e,t]);return{sendMessage:v,retryLastTurn:b,cancel:g,agentAvailable:s}}function art(e,t){const n=p.useMemo(()=>e.baseMessages,[e.baseMessages]),r=p.useCallback(async()=>{var c;if(!e.currentSessionId||!e.currentChat)return;const a=[...e.baseMessages];if(a.length===0)return;const i=a[a.length-1];let o=a;(i==null?void 0:i.role)==="assistant"&&(e.deleteMessage(e.currentSessionId,i.id),o=a.slice(0,-1));const s=[...o].reverse().find(u=>u.role==="user");if(!s)return;const l="content"in s?s.content:s.displayText;typeof l=="string"&&await((c=t==null?void 0:t.onRetry)==null?void 0:c.call(t,l))},[t,e.baseMessages,e.currentChat,e.currentSessionId,e.deleteMessage]);return{currentMessages:n,retryLastMessage:r}}const irt=()=>{const e=znt(),t=Z8(e),n=Hnt(e),r=Lhe({sessionId:e.currentSessionId,addMessage:e.addMessage,setSessionProcessing:e.setSessionProcessing,updateSession:e.updateSession}),a=art(e,{onRetry:r.sendMessage});return{chats:e.chats,currentSessionId:e.currentSessionId,currentChat:e.currentChat,pinnedChats:e.pinnedChats,unpinnedChats:e.unpinnedChats,chatCount:e.chatCount,currentMessages:a.currentMessages,agentAvailable:r.agentAvailable,titleGenerationState:t.titleGenerationState,autoGenerateTitles:t.autoGenerateTitles,isUpdatingAutoTitlePreference:t.isUpdatingAutoTitlePreference,addMessage:e.addMessage,deleteMessage:e.deleteMessage,selectSession:e.selectSession,deleteSession:e.deleteSession,deleteSessions:e.deleteSessions,pinSession:e.pinSession,unpinSession:e.unpinSession,updateSession:e.updateSession,loadChats:e.loadChats,generateChatTitle:t.generateChatTitle,setAutoGenerateTitlesPreference:t.setAutoGenerateTitlesPreference,createNewChat:n.createNewChat,createChatWithSystemPrompt:n.createChatWithSystemPrompt,toggleChatPin:n.toggleChatPin,updateChatTitle:n.updateChatTitle,deleteEmptyChats:n.deleteEmptyChats,deleteAllUnpinnedChats:n.deleteAllUnpinnedChats,deleteAllChats:n.deleteAllChats,retryLastMessage:a.retryLastMessage,sendMessage:r.sendMessage,cancelMessage:r.cancel}},{Text:IS}=Qt,{useToken:ort}=pn,srt=({httpProxy:e,httpsProxy:t,onHttpProxyChange:n,onHttpsProxyChange:r,onReload:a,onSave:i,isLoading:o})=>{const{t:s}=br(),{token:l}=ort(),c=Rc(C=>C.proxyAuthStatus),u=Rc(C=>C.isLoadingProxyAuthStatus),d=Rc(C=>C.loadProxyAuthStatus),f=Rc(C=>C.applyProxyAuth),h=Rc(C=>C.clearProxyAuth),[g,m]=p.useState({username:"",password:""}),[v,b]=p.useState(!1);p.useEffect(()=>{d()},[]);const y=async()=>{const C=g.username.trim();if(C){b(!0);try{await f({username:C,password:g.password}),m({username:"",password:""})}catch(x){console.error("Failed to apply proxy auth:",x)}finally{b(!1)}}},S=async()=>{b(!0);try{await h()}catch(C){console.error("Failed to clear proxy auth:",C)}finally{b(!1)}};return E.jsx(Ot,{size:"small",title:E.jsx(IS,{strong:!0,children:s("settings.networkCard.title")}),children:E.jsxs(He,{direction:"vertical",size:l.marginSM,style:{width:"100%"},children:[E.jsxs(He,{direction:"vertical",size:l.marginXXS,style:{width:"100%"},children:[E.jsx(IS,{type:"secondary",children:s("settings.networkCard.httpProxy")}),E.jsx(tn,{"data-testid":"proxy-url",style:{width:"100%"},value:e,onChange:C=>n(C.target.value),placeholder:s("settings.networkCard.proxyPlaceholder"),disabled:o})]}),E.jsxs(He,{direction:"vertical",size:l.marginXXS,style:{width:"100%"},children:[E.jsx(IS,{type:"secondary",children:s("settings.networkCard.httpsProxy")}),E.jsx(tn,{style:{width:"100%"},value:t,onChange:C=>r(C.target.value),placeholder:s("settings.networkCard.proxyPlaceholder"),disabled:o})]}),E.jsx(Ot,{size:"small",title:s("settings.networkCard.proxyAuthTitle"),style:{marginTop:l.marginSM},children:c!=null&&c.configured?E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(fr,{type:"success",message:s("settings.networkCard.proxyConfiguredForUser",{username:c.username??""}),showIcon:!0}),E.jsx(De,{onClick:S,loading:v||u,danger:!0,children:s("settings.networkCard.clearCredentials")})]}):E.jsxs(He,{direction:"vertical",size:l.marginXS,style:{width:"100%"},children:[E.jsx(tn,{placeholder:s("settings.networkCard.username"),value:g.username,onChange:C=>m(x=>({...x,username:C.target.value}))}),E.jsx(tn.Password,{placeholder:s("settings.networkCard.password"),value:g.password,onChange:C=>m(x=>({...x,password:C.target.value}))}),E.jsx(De,{type:"primary",onClick:y,loading:v||u,disabled:!g.username.trim(),children:s("settings.networkCard.apply")})]})}),E.jsx(IS,{type:"secondary",style:{fontSize:l.fontSizeSM},children:s("settings.networkCard.credentialsStorageNote")}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:l.marginSM},children:[E.jsx(De,{onClick:()=>Promise.resolve(a()).finally(()=>d({force:!0})),disabled:o,children:s("settings.networkCard.reload")}),E.jsx(De,{"data-testid":"save-proxy-settings",type:"primary",onClick:()=>Promise.resolve(i()).finally(()=>d({force:!0})),disabled:o,children:s("settings.networkCard.save")})]})]})})},{Text:Eo}=Qt,{useToken:lrt}=pn,crt=5*60*1e3,urt=()=>{const{t:e}=br(),{token:t}=lrt(),[n,r]=p.useState({}),[a,i]=p.useState([]),[o,s]=p.useState(!1),[l,c]=p.useState(""),[u,d]=p.useState(null),[f,h]=vn.useMessage(),[g,m]=p.useState({}),[v,b]=p.useState(!1),[y,S]=p.useState(""),[C,x]=p.useState("");p.useEffect(()=>{(async()=>{try{const A=await lo.getProviderConfig();c(A.provider||"copilot")}catch(A){console.error("Failed to load provider config:",A),d(e("settings.modelMappingCard.loadProviderFailed"))}})()},[e]),p.useEffect(()=>{const A=setInterval(async()=>{try{const N=(await lo.getProviderConfig()).provider||"copilot";N!==l&&l!==""&&(console.log(`Provider changed from ${l} to ${N}`),c(N),d(null))}catch(P){console.error("Failed to check provider change:",P)}},1e4);return()=>clearInterval(A)},[l]),p.useEffect(()=>{(async()=>{try{const A=await Dr.getAnthropicModelMapping();r(A.mappings||{})}catch(A){console.error("Failed to load model mappings:",A),f.error(e("settings.modelMappingCard.loadMappingsFailed"))}})()},[f,e]);const w=p.useCallback(async(R=!1)=>{if(l){if(!R&&g[l]){const A=g[l];if(Date.now()-A.timestamp<crt){console.log(`Using cached models for ${l}`),i(A.models),d(null);return}}s(!0),d(null);try{let A;if(l==="copilot"){const{modelService:P}=await Mn(async()=>{const{modelService:N}=await Promise.resolve().then(()=>hGe);return{modelService:N}},void 0,import.meta.url);A=await P.getModels()}else A=await lo.fetchProviderModels(l);i(A),m(P=>({...P,[l]:{models:A,timestamp:Date.now()}})),console.log(`Fetched ${A.length} models for ${l}`)}catch(A){console.error("Failed to fetch models:",A);const P=A instanceof Error?A.message:e("settings.modelMappingCard.loadModelsFailed");d(P),f.error(e("settings.modelMappingCard.loadModelsHint")),i([])}finally{s(!1)}}},[l,g,f,e]);p.useEffect(()=>{l&&w()},[l,w]);const _=async(R,A)=>{if(A==="__custom__"){S(R),x(""),b(!0);return}if(!A)return;const P={...n,[R]:A};r(P);try{await Dr.setAnthropicModelMapping({mappings:P}),f.success(e("settings.modelMappingCard.mappingSaved"))}catch(N){console.error("Failed to save model mapping:",N),f.error(e("settings.modelMappingCard.mappingSaveFailed"))}},T=async()=>{if(!C.trim()){f.warning(e("settings.modelMappingCard.enterModelName"));return}const R={...n,[y]:C.trim()};r(R);try{await Dr.setAnthropicModelMapping({mappings:R}),f.success(e("settings.modelMappingCard.customMappingSaved")),b(!1),x("")}catch(A){console.error("Failed to save custom model mapping:",A),f.error(e("settings.modelMappingCard.customMappingSaveFailed"))}},k=()=>{w(!0)},O=R=>{const A=n[R];return A?a.includes(A):!0},I=[{key:"opus",label:e("settings.modelMappingCard.modelTypeOpus"),description:e("settings.modelMappingCard.modelTypeOpusDescription")},{key:"sonnet",label:e("settings.modelMappingCard.modelTypeSonnet"),description:e("settings.modelMappingCard.modelTypeSonnetDescription")},{key:"haiku",label:e("settings.modelMappingCard.modelTypeHaiku"),description:e("settings.modelMappingCard.modelTypeHaikuDescription")}],M=l.charAt(0).toUpperCase()+l.slice(1),$=[{key:"1",label:e("settings.modelMappingCard.collapseTitle"),children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsx(Eo,{type:"secondary",children:e("settings.modelMappingCard.description",{provider:M})}),u&&E.jsx(fr,{type:"error",message:e("settings.modelMappingCard.loadModelsErrorTitle"),description:u,showIcon:!0,action:E.jsx(De,{size:"small",icon:E.jsx(Zl,{}),onClick:k,loading:o,children:e("settings.modelMappingCard.retry")})}),o&&!u&&E.jsx("div",{style:{textAlign:"center",padding:t.paddingMD},children:E.jsx(ia,{tip:e("settings.modelMappingCard.loadingModels")})}),!o&&!u&&I.map(({key:R,label:A,description:P})=>{const N=O(R),L=n[R];return E.jsxs(He,{direction:"vertical",size:t.marginXXS,style:{width:"100%"},children:[E.jsxs(Eo,{type:"secondary",children:[A," (",P,")"]}),E.jsx(Jn,{style:{width:"100%"},value:L||void 0,onChange:j=>_(R,j),placeholder:e("settings.modelMappingCard.selectModelPlaceholder",{label:A}),loading:o,disabled:o||a.length===0,showSearch:!0,allowClear:!0,optionFilterProp:"children",options:[...a.map(j=>({label:j,value:j})),{label:`✏️ ${e("settings.modelMappingCard.customModelOption")}`,value:"__custom__"}],status:N?void 0:"warning",filterOption:(j,D)=>((D==null?void 0:D.label)??"").toString().toLowerCase().includes(j.toLowerCase())}),!N&&L&&E.jsx(Eo,{type:"warning",style:{fontSize:t.fontSizeSM},children:e("settings.modelMappingCard.mappedModelNotFound",{model:L})})]},R)}),E.jsx(nl,{style:{margin:`${t.marginSM} 0`}}),E.jsx(He,{style:{width:"100%",justifyContent:"flex-end"},children:E.jsx(De,{size:"small",icon:E.jsx(Zl,{}),onClick:k,loading:o,disabled:!l,children:e("settings.modelMappingCard.refreshModels")})}),E.jsxs(He,{direction:"vertical",size:t.marginXXS,style:{width:"100%"},children:[E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.currentProvider"),":"," ",E.jsx(Eo,{strong:!0,children:l||e("settings.modelMappingCard.loadingProvider")})]}),E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.availableModels"),":"," ",E.jsx(Eo,{strong:!0,children:a.length}),g[l]&&E.jsx(Eo,{type:"secondary",style:{marginLeft:t.marginXXS},children:e("settings.modelMappingCard.cached")})]}),E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.storedIn"),":"," ",E.jsx(Eo,{code:!0,children:"~/.bamboo/anthropic-model-mapping.json"})]})]})]})}];return E.jsxs(E.Fragment,{children:[h,E.jsx(gl,{size:"small",items:$,style:{marginBottom:t.marginSM}}),E.jsx(qr,{title:e("settings.modelMappingCard.customModalTitle"),open:v,onOk:T,onCancel:()=>{b(!1),x("")},okText:e("settings.modelMappingCard.save"),cancelText:e("settings.modelMappingCard.cancel"),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(Eo,{type:"secondary",children:e("settings.modelMappingCard.customModalDescription",{modelType:y})}),E.jsx(tn,{placeholder:e("settings.modelMappingCard.customModalPlaceholder"),value:C,onChange:R=>x(R.target.value),onPressEnter:T,autoFocus:!0}),E.jsx(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:e("settings.modelMappingCard.customModalNote")})]})})]})},{Text:Hf}=Qt,{useToken:drt}=pn,KG="http://127.0.0.1:9562/v1",_v=e=>[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort(),frt=e=>{var n;const t=(n=e.tools)==null?void 0:n.disabled;return Array.isArray(t)?_v(t.filter(r=>typeof r=="string")):[]},prt=({msgApi:e,locale:t,onLocaleChange:n})=>{const{t:r}=br(),{token:a}=drt(),[i,o]=p.useState({http_proxy:"",https_proxy:""}),[s,l]=p.useState(KG),[c,u]=p.useState([]),[d,f]=p.useState([]),[h,g]=p.useState([]),[m,v]=p.useState(!1),[b,y]=p.useState(!1),S=p.useCallback(async()=>{v(!0);try{const[R,A]=await Promise.all([Dr.getBambooConfig(),Dr.getBambooTools()]);o({http_proxy:R.http_proxy||"",https_proxy:R.https_proxy||""});const P=frt(R);f(P),g(P),u(_v(A.tools||[]))}catch(R){console.error("Failed to load config:",R),e.error(r("settings.configTab.loadConfigFailed"))}finally{v(!1)}},[e,r]);p.useEffect(()=>{S()},[S]);const C=R=>{o(A=>({...A,http_proxy:R}))},x=R=>{o(A=>({...A,https_proxy:R}))},w=async()=>{var R,A;v(!0);try{const P=await Dr.validateBambooConfigPatch(i);if(!P.valid){const L=((A=(R=P.errors)==null?void 0:R.proxy)==null?void 0:A[0])??Object.values(P.errors||{}).flat().filter(Boolean)[0];e.error((L==null?void 0:L.message)||r("settings.configTab.invalidConfig"));return}await Dr.setBambooConfig(i),e.success(r("settings.configTab.saveConfigSuccess"))}catch(P){console.error("Failed to save config:",P);const N=P instanceof Error&&P.message.trim()?P.message:r("settings.configTab.saveConfigFailed");e.error(N)}finally{v(!1)}},_=async()=>{e.success(r("settings.configTab.backendSaved"))},T=()=>{l(KG),e.success(r("settings.configTab.backendResetDefault"))},k=(R,A)=>{f(P=>{const N=new Set(P);return A?N.delete(R):N.add(R),_v([...N])})},O=async()=>{y(!0);try{const R=await Dr.getBambooTools();u(_v(R.tools||[])),e.success(r("settings.configTab.toolsReloadSuccess"))}catch(R){console.error("Failed to reload tools:",R),e.error(r("settings.configTab.toolsLoadFailed"))}finally{y(!1)}},I=async()=>{y(!0);try{const R=_v(d);await Dr.setBambooConfig({tools:{disabled:R}}),f(R),g(R),e.success(r("settings.configTab.toolsSaveSuccess"))}catch(R){console.error("Failed to save tool settings:",R),e.error(r("settings.configTab.toolsSaveFailed"))}finally{y(!1)}},M=JSON.stringify(d)!==JSON.stringify(h),$=new Set(d);return E.jsx(ia,{spinning:m,tip:r("settings.common.loading"),children:E.jsx(Gp,{items:[{key:"general",label:r("settings.configTab.tabs.general"),children:E.jsxs(He,{direction:"vertical",size:a.marginMD,style:{width:"100%"},children:[E.jsx(fr,{message:r("settings.configTab.providerMovedTitle"),description:r("settings.configTab.providerMovedDescription"),type:"info",showIcon:!0,closable:!0}),E.jsx(srt,{httpProxy:i.http_proxy,httpsProxy:i.https_proxy,onHttpProxyChange:C,onHttpsProxyChange:x,onReload:S,onSave:w,isLoading:m}),E.jsx(urt,{}),E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.language")}),children:E.jsx(Jn,{value:t,style:{width:260},options:[{label:r("settings.configTab.languageEnglish"),value:"en-US"},{label:r("settings.configTab.languageChinese"),value:"zh-CN"},{label:r("settings.configTab.languageTraditionalChinese"),value:"zh-TW"},{label:r("settings.configTab.languageFrench"),value:"fr-FR"},{label:r("settings.configTab.languageJapanese"),value:"ja-JP"}],onChange:R=>n(R)})}),E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.backendApiBaseUrlTitle")}),children:E.jsxs(He,{direction:"vertical",size:a.marginSM,style:{width:"100%"},children:[E.jsx(He,{direction:"vertical",size:a.marginXXS,style:{width:"100%"},children:E.jsx(tn,{style:{width:"100%"},value:s,onChange:R=>l(R.target.value),placeholder:r("settings.configTab.backendApiPlaceholder")})}),E.jsx(Hf,{type:"secondary",style:{fontSize:a.fontSizeSM},children:r("settings.configTab.backendApiHint")}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:a.marginSM},children:[E.jsx(De,{"data-testid":"reset-to-defaults",onClick:T,children:r("settings.configTab.resetToDefault")}),E.jsx(De,{"data-testid":"save-api-settings",type:"primary",onClick:_,children:r("settings.configTab.save")})]})]})})]})},{key:"tools",label:r("settings.configTab.tabs.tools"),children:E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.toolsTitle")}),children:E.jsxs(He,{direction:"vertical",size:a.marginMD,style:{width:"100%"},children:[E.jsx(Hf,{type:"secondary",children:r("settings.configTab.toolsDescription")}),c.length===0?E.jsx(fr,{type:"info",showIcon:!0,message:r("settings.configTab.toolsEmpty")}):E.jsx(jr,{bordered:!0,dataSource:c,renderItem:R=>E.jsx(jr.Item,{actions:[E.jsx(ba,{checked:!$.has(R),onChange:A=>k(R,A)},`${R}-switch`)],children:E.jsx(Hf,{code:!0,children:R})})}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:a.marginSM},children:[E.jsx(De,{onClick:O,loading:b,children:r("settings.configTab.reloadTools")}),E.jsx(De,{type:"primary",onClick:I,loading:b,disabled:!M,children:r("settings.configTab.save")})]})]})})}]})})},YG={theme:"default",themeVariables:{},fontSize:16,defaultScale:1,useMaxWidth:!0,flowchartNodeSpacing:50,flowchartRankSpacing:50,flowchartCurve:"basis",sequenceActorMargin:50,sequenceMessageMargin:35,sequenceWidth:150,sequenceHeight:65,ganttBarHeight:20,ganttTopPadding:50},e5=Qh()(eGe(e=>({settings:YG,updateSettings:t=>e(n=>({settings:{...n.settings,...t}})),resetSettings:()=>e({settings:YG})}),{name:"mermaid-settings"})),o_=()=>e5(t=>t.settings),hrt=()=>e5(e=>e.updateSettings),grt=()=>e5(e=>e.resetSettings),{Title:mrt,Text:_O}=Qt,{useToken:vrt}=pn,brt=()=>{const{t:e}=br(),{token:t}=vrt(),n=o_(),r=hrt(),a=grt(),[i]=wt.useForm();U.useEffect(()=>{i.setFieldsValue(n)},[n,i]);const o=l=>{r(l)},s=()=>{a(),i.resetFields()};return E.jsxs("div",{style:{padding:"24px",maxWidth:"1200px",margin:"0 auto"},children:[E.jsx(mrt,{level:3,style:{marginBottom:"8px"},children:e("settings.mermaidTab.title")}),E.jsx(_O,{type:"secondary",style:{display:"block",marginBottom:"24px"},children:e("settings.mermaidTab.description")}),E.jsxs(wt,{form:i,layout:"vertical",initialValues:n,onValuesChange:o,children:[E.jsxs(Ot,{title:e("settings.mermaidTab.themeCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:[E.jsx(gs,{gutter:16,children:E.jsx(Lr,{span:24,children:E.jsx(wt.Item,{name:"theme",label:E.jsxs(He,{children:[e("settings.mermaidTab.themeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.themeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsxs(Jn,{children:[E.jsx(Jn.Option,{value:"default",children:e("settings.mermaidTab.themeOptions.default")}),E.jsx(Jn.Option,{value:"neutral",children:e("settings.mermaidTab.themeOptions.neutral")}),E.jsx(Jn.Option,{value:"dark",children:e("settings.mermaidTab.themeOptions.dark")}),E.jsx(Jn.Option,{value:"forest",children:e("settings.mermaidTab.themeOptions.forest")}),E.jsx(Jn.Option,{value:"base",children:e("settings.mermaidTab.themeOptions.base")})]})})})}),E.jsxs(_O,{type:"secondary",style:{display:"block",marginTop:"8px"},children:[E.jsx("strong",{children:e("settings.mermaidTab.themeDescriptionsTitle")}),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.default"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.neutral"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.dark"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.forest"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.base")]})]}),E.jsxs(Ot,{title:e("settings.mermaidTab.globalCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:[E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"fontSize",label:E.jsxs(He,{children:[e("settings.mermaidTab.fontSizeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.fontSizeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:32,step:1,style:{width:"100%"},addonAfter:"px"})})}),E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"defaultScale",label:E.jsxs(He,{children:[e("settings.mermaidTab.defaultZoomLabel"),E.jsx(wn,{title:e("settings.mermaidTab.defaultZoomTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:.1,max:3,step:.1,style:{width:"100%"}})})})]}),E.jsx(wt.Item,{name:"useMaxWidth",label:E.jsxs(He,{children:[e("settings.mermaidTab.responsiveWidthLabel"),E.jsx(wn,{title:e("settings.mermaidTab.responsiveWidthTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsx(Ot,{title:e("settings.mermaidTab.flowchartCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartNodeSpacing",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartNodeSpacingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartNodeSpacingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartRankSpacing",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartRankSpacingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartRankSpacingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartCurve",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartCurveTypeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartCurveTypeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsxs(Jn,{children:[E.jsx(Jn.Option,{value:"basis",children:e("settings.mermaidTab.flowchartCurveOptions.basis")}),E.jsx(Jn.Option,{value:"linear",children:e("settings.mermaidTab.flowchartCurveOptions.linear")}),E.jsx(Jn.Option,{value:"cardinal",children:e("settings.mermaidTab.flowchartCurveOptions.cardinal")})]})})})]})}),E.jsx(Ot,{title:e("settings.mermaidTab.sequenceCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceActorMargin",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorMarginLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorMarginTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceMessageMargin",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceMessageMarginLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceMessageMarginTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:100,step:5,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceWidth",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorWidthLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorWidthTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:100,max:300,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceHeight",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorHeightLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorHeightTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:40,max:150,step:5,style:{width:"100%"}})})})]})}),E.jsx(Ot,{title:e("settings.mermaidTab.ganttCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"ganttBarHeight",label:E.jsxs(He,{children:[e("settings.mermaidTab.ganttBarHeightLabel"),E.jsx(wn,{title:e("settings.mermaidTab.ganttBarHeightTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:50,step:5,style:{width:"100%"},addonAfter:"px"})})}),E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"ganttTopPadding",label:E.jsxs(He,{children:[e("settings.mermaidTab.ganttTopPaddingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.ganttTopPaddingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:100,step:10,style:{width:"100%"}})})})]})}),E.jsx(He,{children:E.jsx(De,{icon:E.jsx(SVe,{}),onClick:s,children:e("settings.mermaidTab.resetToDefaults")})}),E.jsx(nl,{}),E.jsx(Ot,{title:e("settings.mermaidTab.previewTitle"),styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsx(_O,{type:"secondary",children:e("settings.mermaidTab.previewDescription")})})]})]})},yrt=p.lazy(()=>Mn(()=>import("./index-Cgf2zzsS.js"),__vite__mapDeps([0,1,2]),import.meta.url)),{Text:Uf}=Qt,{useToken:Srt}=pn,xrt=({promptEnhancement:e,onPromptEnhancementChange:t,mermaidEnhancementEnabled:n,taskEnhancementEnabled:r,showCopilotAskUserEnhancement:a,copilotAskUserEnhancementEnabled:i,onMermaidToggle:o,onTaskToggle:s,onCopilotAskUserToggle:l,onSaveEnhancement:c})=>{const{t:u}=br(),{token:d}=Srt(),f=d.marginLG;return E.jsxs(rt,{vertical:!0,gap:f,children:[E.jsx(Ot,{size:"small",children:E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(yrt,{})})}),E.jsx(Ot,{size:"small",children:E.jsxs(He,{direction:"vertical",size:d.marginXS,style:{width:"100%"},children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.title")}),E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.mermaidEnhancement")}),E.jsx(ba,{checked:n,onChange:o})]}),E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.taskListRules")}),E.jsx(ba,{checked:r,onChange:s})]}),a&&E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.copilotAskUserBeforeFinish")}),E.jsx(ba,{checked:i,onChange:l})]}),E.jsx(tn.TextArea,{rows:6,placeholder:u("settings.promptsTab.enhancementPlaceholder"),value:e,onChange:h=>t(h.target.value)}),E.jsx(rt,{justify:"flex-end",children:E.jsx(De,{type:"primary",onClick:c,children:u("settings.promptsTab.saveEnhancement")})}),E.jsx(Uf,{type:"secondary",style:{fontSize:d.fontSizeSM},children:u("settings.promptsTab.description")})]})}),n&&E.jsx(gl,{size:"small",items:[{key:"mermaid",label:E.jsx(Uf,{strong:!0,children:u("settings.mermaidTab.title")}),children:E.jsx(brt,{})}]})]})},{Text:Xg}=Qt,{useToken:wrt}=pn,Crt=({autoGenerateTitles:e,isUpdatingAutoTitlePreference:t,onAutoTitleToggle:n,themeMode:r,onThemeModeChange:a,onClearLocalStorage:i,onResetApp:o,isResetting:s,darkModeKey:l})=>{const{t:c}=br(),{token:u}=wrt();return E.jsx(Ot,{size:"small",children:E.jsxs(He,{direction:"vertical",size:u.marginSM,style:{width:"100%"},children:[E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(Xg,{strong:!0,children:c("settings.appTab.autoGenerateTitle")}),E.jsx(ba,{checked:e,loading:t,onChange:n})]}),E.jsx(Xg,{type:"secondary",style:{fontSize:u.fontSizeSM},children:c("settings.appTab.autoGenerateTitleDesc")}),E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(Xg,{strong:!0,children:c("settings.appTab.darkMode")}),E.jsx(ba,{"data-testid":"dark-mode-toggle",checked:r==="dark",onChange:d=>{const f=d?"dark":"light";a(f),localStorage.setItem(l,f)}})]}),E.jsx(Aw,{title:c("settings.appTab.clearLocalStorageTitle"),description:c("settings.appTab.clearLocalStorageDescription"),onConfirm:i,okText:c("settings.appTab.confirmClear"),cancelText:c("settings.appTab.cancel"),placement:"top",children:E.jsx(De,{danger:!0,block:!0,icon:E.jsx(Zh,{}),children:c("settings.appTab.clearLocalStorageButton")})}),E.jsx(nl,{style:{margin:`${u.marginSM}px 0`}}),E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(lF,{style:{color:u.colorError}}),E.jsx(Xg,{strong:!0,style:{color:u.colorError},children:c("settings.appTab.dangerZone")})]}),E.jsx(Xg,{type:"secondary",style:{fontSize:u.fontSizeSM},children:c("settings.appTab.dangerDescription")}),E.jsx(Aw,{title:c("settings.appTab.resetApplicationTitle"),description:E.jsxs("div",{children:[E.jsx("p",{children:c("settings.appTab.resetApplicationIntro")}),E.jsxs("ul",{style:{margin:0,paddingLeft:16},children:[E.jsx("li",{children:c("settings.appTab.resetStepDeleteAllSessions")}),E.jsx("li",{children:c("settings.appTab.resetStepClearStorage")}),E.jsx("li",{children:c("settings.appTab.resetStepResetConfig")}),E.jsx("li",{children:c("settings.appTab.resetStepSetupFlow")}),E.jsx("li",{children:c("settings.appTab.resetStepReload")})]})]}),onConfirm:o,okText:c("settings.appTab.resetConfirm"),cancelText:c("settings.appTab.cancel"),placement:"top",okButtonProps:{danger:!0},children:E.jsx(De,{"data-testid":"reset-to-defaults",danger:!0,block:!0,type:"primary",icon:E.jsx(xde,{}),loading:s,children:c("settings.appTab.resetButton")})})]})})},{Text:Tu}=Qt,{useToken:Ert}=pn,XG=[{value:"literal-token",labelKey:"settings.keywordMaskingTab.example.literalToken",match_type:"exact",pattern:"sk-"},{value:"github",labelKey:"settings.keywordMaskingTab.example.githubTokens",match_type:"regex",pattern:"ghp_[A-Za-z0-9]+"},{value:"aws",labelKey:"settings.keywordMaskingTab.example.awsKeys",match_type:"regex",pattern:"AKIA[0-9A-Z]{16}"},{value:"email",labelKey:"settings.keywordMaskingTab.example.emails",match_type:"regex",pattern:"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"}],_rt=(e,t,n)=>{if(!t)return{masked:e};if(n==="exact")return{masked:e.split(t).join("[MASKED]")};try{const r=new RegExp(t,"g");return{masked:e.replace(r,"[MASKED]")}}catch(r){return{masked:e,error:r instanceof Error?r.message:"Invalid regex pattern"}}},Trt=()=>{const{t:e}=br(),{token:t}=Ert(),[n,r]=p.useState([]),[a,i]=p.useState(!1),[o,s]=p.useState(null),[l,c]=p.useState(""),[u,d]=p.useState("exact"),[f,h]=p.useState(!0),[g,m]=p.useState(),[v,b]=p.useState("My token is sk-123");p.useEffect(()=>{y()},[]);const y=async()=>{try{i(!0);const M=await Vi.getInstance().getKeywordMaskingConfig();r(M.entries)}catch(I){vn.error(e("settings.keywordMaskingTab.loadFailed")),console.error(I)}finally{i(!1)}},S=async I=>{try{const M=Vi.getInstance(),$=await M.validateKeywordEntries(I);if(!$.valid&&$.errors){const A=$.errors.map(P=>`Entry ${P.index+1}: ${P.message}`).join("; ");return vn.error(`${e("settings.keywordMaskingTab.validationFailedPrefix")}: ${A}`),!1}const R=await M.updateKeywordMaskingConfig(I);return r(R.entries),vn.success(e("settings.keywordMaskingTab.saveSuccess")),!0}catch(M){return vn.error(M instanceof Error?M.message:e("settings.keywordMaskingTab.saveFailed")),!1}},C=async()=>{const I={pattern:"",match_type:"exact",enabled:!0},M=[...n,I];r(M),s(M.length-1),c(""),d("exact"),h(!0),m(void 0)},x=I=>{const M=n[I];s(I),c(M.pattern),d(M.match_type),h(M.enabled),m(void 0)},w=async()=>{if(o===null)return;if(!l.trim()){vn.error(e("settings.keywordMaskingTab.patternRequired"));return}const I=[...n];I[o]={pattern:l.trim(),match_type:u,enabled:f},await S(I)&&s(null)},_=()=>{var I;o!==null&&!((I=n[o])!=null&&I.pattern)&&r(n.filter((M,$)=>$!==o)),s(null)},T=async I=>{const M=n.filter(($,R)=>R!==I);await S(M)},k=async(I,M)=>{const $=[...n];$[I]={...$[I],enabled:M},await S($)},O=_rt(v,l,u);return E.jsx(Ot,{title:e("settings.keywordMaskingTab.title"),extra:E.jsx(De,{"data-testid":"add-keyword",type:"primary",icon:E.jsx(Xp,{}),onClick:C,loading:a,children:e("settings.keywordMaskingTab.addKeyword")}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"large",children:[E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.description")}),E.jsx(jr,{loading:a,dataSource:n,locale:{emptyText:e("settings.keywordMaskingTab.empty")},renderItem:(I,M)=>E.jsx(jr.Item,{style:{backgroundColor:t.colorFillAlter,marginBottom:8,borderRadius:t.borderRadius,padding:12},actions:o===M?[E.jsx(De,{"data-testid":"save-keyword",type:"primary",icon:E.jsx(jE,{}),onClick:w},"save"),E.jsx(De,{onClick:_,children:e("settings.keywordMaskingTab.cancel")},"cancel")]:[E.jsx(De,{icon:E.jsx(NE,{}),onClick:()=>x(M)},"edit"),E.jsx(De,{"data-testid":`delete-keyword-${M}`,danger:!0,icon:E.jsx(Zh,{}),onClick:()=>T(M)},"delete")],children:E.jsx(rt,{vertical:!0,style:{width:"100%"},gap:8,children:o===M?E.jsxs(E.Fragment,{children:[E.jsx(tn,{"data-testid":"keyword-pattern-input",placeholder:e("settings.keywordMaskingTab.patternPlaceholder"),value:l,onChange:$=>c($.target.value),autoFocus:!0}),E.jsxs(rt,{gap:8,align:"center",wrap:"wrap",children:[E.jsx(Jn,{"data-testid":"keyword-examples-select","aria-label":e("settings.keywordMaskingTab.examples"),placeholder:e("settings.keywordMaskingTab.examples"),value:g,onChange:$=>{m($);const R=XG.find(A=>A.value===$);R&&(c(R.pattern),d(R.match_type))},options:XG.map($=>({value:$.value,label:e($.labelKey)})),style:{minWidth:220}}),E.jsx(Jn,{value:u,onChange:d,options:[{value:"exact",label:e("settings.keywordMaskingTab.exactMatch")},{value:"regex",label:e("settings.keywordMaskingTab.regexPattern")}],style:{width:150}}),E.jsx(ba,{checked:f,onChange:h})]}),E.jsxs(rt,{vertical:!0,gap:6,children:[E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.sampleText")}),E.jsx(tn,{placeholder:e("settings.keywordMaskingTab.sampleTextPlaceholder"),value:v,onChange:$=>b($.target.value)}),E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.maskedPreview")}),E.jsx(tn,{readOnly:!0,value:O.masked,status:O.error?"error":void 0}),O.error&&E.jsx(Tu,{type:"danger",children:O.error})]})]}):E.jsxs(rt,{justify:"space-between",align:"center",children:[E.jsxs(rt,{vertical:!0,gap:4,children:[E.jsx(Tu,{strong:!0,children:I.pattern||e("settings.keywordMaskingTab.emptyPattern")}),E.jsxs(rt,{gap:8,children:[E.jsx(Tu,{type:"secondary",style:{fontSize:12},children:I.match_type==="regex"?e("settings.keywordMaskingTab.regexPattern"):e("settings.keywordMaskingTab.exactMatch")}),!I.enabled&&E.jsx(Tu,{type:"warning",style:{fontSize:12},children:e("settings.keywordMaskingTab.disabled")})]})]}),E.jsx(ba,{checked:I.enabled,onChange:$=>k(M,$),size:"small"})]})})})})]})})},Yu=class Yu{constructor(){}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}async listWorkflows(){try{console.log("[WorkflowManagerService] Listing workflows");const t=await Bn.get("bamboo/workflows"),n=Array.isArray(t)?t:[];return console.log("[WorkflowManagerService] Listed workflows:",n),n.map(r=>({name:String(r.name||""),filename:String(r.filename||(r.name||"workflow")+".md"),size:Number(r.size||0),modified_at:r.modified_at,source:"global"}))}catch(t){throw console.error("[WorkflowManagerService] Failed to list workflows:",t),t}}async getWorkflow(t){try{console.log("[WorkflowManagerService] Getting workflow: "+t);const n=await Bn.get("bamboo/workflows/"+encodeURIComponent(t)),r=n!=null&&n.name?String(n.name):t,a={name:r,filename:String((n==null?void 0:n.filename)||r+".md"),size:Number((n==null?void 0:n.size)||0),modified_at:n==null?void 0:n.modified_at,source:"global"};return console.log("[WorkflowManagerService] Got workflow:",n),{name:r,content:String((n==null?void 0:n.content)||""),metadata:a}}catch(n){throw console.error("[WorkflowManagerService] Failed to get workflow "+t+":",n),aGe(n)&&n.status===404?new Error("Workflow '"+t+"' not found"):n instanceof Error&&n.message.includes("404")?new Error("Workflow '"+t+"' not found"):n}}};Bt(Yu,"instance");let FN=Yu;const{Text:TO}=Qt,{TextArea:krt}=tn,{useToken:Ort}=pn,$rt=e=>!(!e||e.includes("/")||e.includes("\\")||e.includes("..")),Irt=()=>{const{t:e}=br(),{token:t}=Ort(),[n,r]=vn.useMessage(),[a,i]=p.useState([]),[o,s]=p.useState(!1),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(null),[g,m]=p.useState(""),[v,b]=p.useState(""),[y,S]=p.useState(!1),C=p.useMemo(()=>FN.getInstance(),[]),x=p.useCallback(async()=>{s(!0);try{const O=await C.listWorkflows();return i(O),O}catch{return n.error(e("settings.workflowsTab.loadFailed")),[]}finally{s(!1)}},[n,C]);p.useEffect(()=>{x()},[x]);const w=p.useCallback(async O=>{h(O),m(O.name),S(!1),c(!0);try{const I=await C.getWorkflow(O.name);b(I.content??"")}catch{n.error(e("settings.workflowsTab.loadContentFailed")),b("")}finally{c(!1)}},[n,C]),_=()=>{h(null),m(""),b(""),S(!1)},T=p.useCallback(async()=>{if(!$rt(g)){n.error(e("settings.workflowsTab.invalidName"));return}const O=a.some(I=>I.name===g);if(!f&&O){n.error(e("settings.workflowsTab.nameAlreadyExists"));return}d(!0);try{await Vi.getInstance().saveWorkflow(g,v),n.success(e("settings.workflowsTab.saved")),S(!1);const $=(await x()).find(R=>R.name===g);$&&h($)}catch(I){n.error(I instanceof Error?I.message:e("settings.workflowsTab.saveFailed"))}finally{d(!1)}},[v,g,x,n,f,e,a]),k=p.useCallback(async O=>{try{await Vi.getInstance().deleteWorkflow(O.name),n.success(e("settings.workflowsTab.deleted")),(f==null?void 0:f.name)===O.name&&_(),await x()}catch(I){n.error(I instanceof Error?I.message:e("settings.workflowsTab.deleteFailed"))}},[x,n,f,e]);return E.jsxs("div",{style:{padding:"24px"},children:[r,E.jsxs(Ot,{title:e("settings.workflowsTab.title"),extra:E.jsxs(He,{children:[E.jsx(De,{icon:E.jsx(Zl,{}),onClick:x,loading:o,children:e("settings.workflowsTab.refresh")}),E.jsx(De,{"data-testid":"create-workflow",icon:E.jsx(Xp,{}),onClick:_,children:e("settings.workflowsTab.newWorkflow")}),E.jsx(De,{"data-testid":"save-workflow",type:"primary",icon:E.jsx(jE,{}),onClick:T,loading:u,disabled:!y,children:e("settings.workflowsTab.save")})]}),children:[E.jsx(TO,{type:"secondary",children:e("settings.workflowsTab.description")}),E.jsxs(rt,{gap:t.marginLG,style:{marginTop:t.marginLG},children:[E.jsx("div",{style:{width:320,flexShrink:0},children:E.jsx(jr,{loading:o,dataSource:a,locale:{emptyText:e("settings.workflowsTab.empty")},renderItem:O=>E.jsx(jr.Item,{style:{cursor:"pointer",backgroundColor:(f==null?void 0:f.name)===O.name?t.colorFillSecondary:"transparent",borderRadius:t.borderRadius,padding:t.paddingSM},onClick:()=>w(O),actions:[E.jsx(De,{"data-testid":`delete-workflow-${O.name}`,type:"text",danger:!0,size:"small",icon:E.jsx(Zh,{}),onClick:I=>{I.stopPropagation(),k(O)}},"delete")],children:E.jsxs(He,{direction:"vertical",size:0,children:[E.jsxs(TO,{strong:!0,children:["/",O.name]}),E.jsx(TO,{type:"secondary",style:{fontSize:12},children:O.filename})]})})})}),E.jsx("div",{style:{flex:1},children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsx(tn,{"data-testid":"workflow-name",placeholder:e("settings.workflowsTab.namePlaceholder"),value:g,onChange:O=>{m(O.target.value),S(!0)},disabled:!!f,prefix:E.jsx(NE,{})}),E.jsx(krt,{"data-testid":"workflow-content",placeholder:e("settings.workflowsTab.contentPlaceholder"),value:v,onChange:O=>{b(O.target.value),S(!0)},autoSize:{minRows:12},disabled:l})]})})]})]})]})};var Ln=(e=>(e.Connecting="connecting",e.Ready="ready",e.Degraded="degraded",e.Stopped="stopped",e.Error="error",e))(Ln||{});const p0=6e4,h0=3e4,Vb=2e4,Zw=1e4,s_=e=>({id:e,enabled:!0,transport:{type:"stdio",command:"",args:[],env:{},startup_timeout_ms:Vb},request_timeout_ms:p0,healthcheck_interval_ms:h0,allowed_tools:[],denied_tools:[]}),Art=()=>({status:"stopped",tool_count:0,restart_count:0}),Rrt=e=>{switch(typeof e=="string"?e.trim().toLowerCase():""){case Ln.Connecting:return Ln.Connecting;case Ln.Ready:return Ln.Ready;case Ln.Degraded:return Ln.Degraded;case Ln.Error:return Ln.Error;case Ln.Stopped:default:return Ln.Stopped}},Ll=(e,t)=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Number(e);if(Number.isFinite(n))return n}return t},Mrt=(e,t)=>{if(!e||typeof e!="object")return t;const n=e;if(n.type==="sse"){const i=Array.isArray(n.headers)?n.headers.map(o=>{if(!o||typeof o!="object")return null;const s=o;return typeof s.name!="string"||typeof s.value!="string"?null:{name:s.name,value:s.value}}).filter(o=>!!o):[];return{type:"sse",url:typeof n.url=="string"?n.url:"",headers:i,connect_timeout_ms:Ll(n.connect_timeout_ms,Zw)}}const r=Array.isArray(n.args)?n.args.filter(i=>typeof i=="string"):[],a=n.env&&typeof n.env=="object"?Object.entries(n.env):[];return{type:"stdio",command:typeof n.command=="string"?n.command:"",args:r,cwd:typeof n.cwd=="string"?n.cwd:void 0,env:a.reduce((i,[o,s])=>(typeof s=="string"&&(i[o]=s),i),{}),startup_timeout_ms:Ll(n.startup_timeout_ms,Vb)}},Prt=(e,t)=>{const n=s_(e.id),r=t??{};return{...n,...r,id:e.id,name:typeof r.name=="string"?r.name:typeof e.name=="string"?e.name:void 0,enabled:typeof e.enabled=="boolean"?e.enabled:typeof r.enabled=="boolean"?r.enabled:!0,request_timeout_ms:Ll(r.request_timeout_ms,p0),healthcheck_interval_ms:Ll(r.healthcheck_interval_ms,h0),allowed_tools:Array.isArray(r.allowed_tools)?r.allowed_tools.filter(i=>typeof i=="string"):[],denied_tools:Array.isArray(r.denied_tools)?r.denied_tools.filter(i=>typeof i=="string"):[],reconnect:r.reconnect&&typeof r.reconnect=="object"?{enabled:typeof r.reconnect.enabled=="boolean"?r.reconnect.enabled:!0,initial_backoff_ms:Ll(r.reconnect.initial_backoff_ms,1e3),max_backoff_ms:Ll(r.reconnect.max_backoff_ms,3e4),max_attempts:Ll(r.reconnect.max_attempts,0)}:void 0,transport:Mrt(r.transport,n.transport)}},Nrt=e=>{const t=Art(),r=e.runtime??{},a=r.status??e.status;return{status:Rrt(a),last_error:typeof r.last_error=="string"?r.last_error:typeof e.last_error=="string"?e.last_error:void 0,connected_at:typeof r.connected_at=="string"?r.connected_at:void 0,disconnected_at:typeof r.disconnected_at=="string"?r.disconnected_at:void 0,tool_count:Ll(r.tool_count??e.tool_count,t.tool_count),restart_count:Ll(r.restart_count??e.restart_count,t.restart_count),last_ping_at:typeof r.last_ping_at=="string"?r.last_ping_at:void 0}},Lrt=e=>{const t=Prt(e,e.config);return{id:e.id,name:typeof e.name=="string"?e.name:typeof t.name=="string"?t.name:e.id,enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,config:t,runtime:Nrt(e)}},Drt=(e,t)=>`mcp__${e}__${t}`,jrt=e=>{if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");if(n<=0)return null;const r=t.slice(0,n),a=t.slice(n+2);return!r||!a?null:{server_id:r,original_name:a}},Brt=(e,t,n=0)=>{if(!e||typeof e!="object")return null;const r=e,a=typeof r.alias=="string"?r.alias:typeof r.name=="string"&&r.name.startsWith("mcp__")?r.name:void 0,i=a&&typeof a=="string"?jrt(a):null,o=(typeof r.server_id=="string"?r.server_id:void 0)??(typeof r.serverId=="string"?r.serverId:void 0)??(i==null?void 0:i.server_id)??t??"",s=(typeof r.original_name=="string"?r.original_name:void 0)??(typeof r.originalName=="string"?r.originalName:void 0)??(i==null?void 0:i.original_name)??(typeof r.name=="string"?r.name:void 0)??"",l=a??(o&&s?Drt(o,s):""),c=typeof r.description=="string"?r.description:"",u="parameters"in r?r.parameters:"inputSchema"in r?r.inputSchema:"input_schema"in r?r.input_schema:void 0,d=l||s||`mcp_tool_${n}`;return{alias:d,server_id:o||"unknown",original_name:s||d,description:c,parameters:u}};class Frt{async getServers(){const t=await fn.get("mcp/servers");return Array.isArray(t.servers)?t.servers.map(Lrt):[]}async addServer(t){return fn.post("mcp/servers",t)}async updateServer(t,n){const r={...n,id:t};return fn.put(`mcp/servers/${t}`,r)}async deleteServer(t){return fn.delete(`mcp/servers/${t}`)}async connectServer(t){return fn.post(`mcp/servers/${t}/connect`)}async disconnectServer(t){return fn.post(`mcp/servers/${t}/disconnect`)}async refreshTools(t){return fn.post(`mcp/servers/${t}/refresh`)}async getTools(t){const n=t?`mcp/servers/${t}/tools`:"mcp/tools",r=await fn.get(n);return(Array.isArray(r.tools)?r.tools:[]).map((i,o)=>Brt(i,t,o)).filter(i=>!!i)}async importServers(t){return fn.post("mcp/servers/import",t)}}const Dhe=new Frt,zrt=5e3,El=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,ZG=(e,t)=>`${e}:${t}`,Hrt=(e={})=>{const{service:t=Dhe,autoRefreshMs:n=zrt,autoRefreshEnabled:r=!0}=e,[a,i]=p.useState([]),[o,s]=p.useState(null),[l,c]=p.useState({}),[u,d]=p.useState({}),[f,h]=p.useState({}),[g,m]=p.useState(!1),[v,b]=p.useState(!1),[y,S]=p.useState(!1),[C,x]=p.useState(null),w=p.useRef({}),_=p.useCallback(F=>{const B=new Set(F.map(G=>G.id)),z=F.map(G=>{const Z=w.current[G.id]??G.config,q={...Z,id:G.id,name:Z.name??G.name};return w.current[G.id]=q,{...G,name:G.name||q.name||G.id,enabled:G.enabled??q.enabled,config:q}});return Object.keys(w.current).forEach(G=>{B.has(G)||delete w.current[G]}),z},[]),T=p.useCallback(async({silent:F=!1}={})=>{F||m(!0);try{const B=await t.getServers(),z=_(B);i(z),s(G=>{var X;return G&&z.some(Z=>Z.id===G)?G:((X=z[0])==null?void 0:X.id)??null}),x(null)}catch(B){throw x(El(B,"Failed to load MCP servers")),B}finally{F||m(!1)}},[_,t]),k=p.useCallback(async(F,B=!1)=>{if(!F)return[];if(!B&&l[F])return l[F];d(z=>({...z,[F]:!0}));try{const z=await t.getTools(F);return c(G=>({...G,[F]:z})),x(null),z}catch(z){throw x(El(z,"Failed to load MCP tools")),z}finally{d(z=>({...z,[F]:!1}))}},[t,l]),O=p.useCallback((F,B,z)=>{const G=ZG(F,B);h(X=>({...X,[G]:z}))},[]),I=p.useCallback(async F=>{b(!0);try{await t.addServer(F),w.current[F.id]=F,await T()}catch(B){throw x(El(B,"Failed to add MCP server")),B}finally{b(!1)}},[T,t]),M=p.useCallback(async(F,B)=>{b(!0);try{const z={...B,id:F};await t.updateServer(F,z),w.current[F]=z,await T()}catch(z){throw x(El(z,"Failed to update MCP server")),z}finally{b(!1)}},[T,t]),$=p.useCallback(async F=>{O(F,"delete",!0);try{await t.deleteServer(F),c(B=>{const z={...B};return delete z[F],z}),delete w.current[F],await T()}catch(B){throw x(El(B,"Failed to delete MCP server")),B}finally{O(F,"delete",!1)}},[T,t,O]),R=p.useCallback(async F=>{O(F,"connect",!0);try{await t.connectServer(F),await T({silent:!0})}catch(B){throw x(El(B,"Failed to connect MCP server")),B}finally{O(F,"connect",!1)}},[T,t,O]),A=p.useCallback(async F=>{O(F,"disconnect",!0);try{await t.disconnectServer(F),await T({silent:!0})}catch(B){throw x(El(B,"Failed to disconnect MCP server")),B}finally{O(F,"disconnect",!1)}},[T,t,O]),P=p.useCallback(async F=>{O(F,"refresh",!0);try{await t.refreshTools(F),await k(F,!0),await T({silent:!0})}catch(B){throw x(El(B,"Failed to refresh MCP tools")),B}finally{O(F,"refresh",!1)}},[k,T,t,O]),N=p.useCallback(async()=>{S(!0);try{const F=a.map(B=>B.id);await Promise.all(F.map(async B=>{try{await t.refreshTools(B)}catch{}})),await T(),o&&await k(o,!0)}catch(F){throw x(El(F,"Failed to refresh MCP status")),F}finally{S(!1)}},[k,T,o,a,t]),L=p.useCallback(F=>{s(F)},[]),j=p.useCallback((F,B)=>!!f[ZG(F,B)],[f]),D=p.useMemo(()=>o?l[o]??[]:[],[o,l]),H=p.useMemo(()=>o?!!u[o]:!1,[o,u]);return p.useEffect(()=>{T().catch(()=>{})},[T]),p.useEffect(()=>{if(!r||n<=0)return;const F=window.setInterval(()=>{T({silent:!0}).catch(()=>{})},n);return()=>{window.clearInterval(F)}},[r,n,T]),p.useEffect(()=>{o&&k(o).catch(()=>{})},[k,o]),{servers:a,selectedServerId:o,selectedServerTools:D,isLoadingServers:g,isMutatingConfig:v,isRefreshingAll:y,isSelectedServerToolsLoading:H,error:C,setSelectedServerId:L,refreshServers:T,addServer:I,updateServer:M,deleteServer:$,connectServer:R,disconnectServer:A,refreshServerTools:P,refreshAll:N,isServerActionLoading:j}},Urt={[Ln.Connecting]:"blue",[Ln.Ready]:"green",[Ln.Degraded]:"orange",[Ln.Stopped]:"default",[Ln.Error]:"red"},Wrt=e=>e===Ln.Connecting||e===Ln.Ready||e===Ln.Degraded,qrt=({servers:e,loading:t=!1,selectedServerId:n,onSelectServer:r,onEditServer:a,onDeleteServer:i,onConnectServer:o,onDisconnectServer:s,onRefreshTools:l,isServerActionLoading:c})=>{const{t:u}=br(),{token:d}=pn.useToken(),f=p.useMemo(()=>[{key:"name",title:u("settings.mcpServerTable.columns.name"),render:(h,g)=>g.name||g.id},{key:"transport",title:u("settings.mcpServerTable.columns.transportType"),render:(h,g)=>g.config.transport.type==="sse"?u("settings.mcpServerTable.transportOptions.sse"):u("settings.mcpServerTable.transportOptions.stdio"),width:140},{key:"status",title:u("settings.mcpServerTable.columns.status"),render:(h,g)=>{var b;const m=((b=g.runtime)==null?void 0:b.status)??Ln.Stopped,v={[Ln.Connecting]:u("settings.mcpTab.status.connecting"),[Ln.Ready]:u("settings.mcpTab.status.ready"),[Ln.Degraded]:u("settings.mcpTab.status.degraded"),[Ln.Stopped]:u("settings.mcpTab.status.stopped"),[Ln.Error]:u("settings.mcpTab.status.error")};return E.jsx(Dn,{color:Urt[m],style:{marginInlineEnd:0},children:v[m]})},width:120},{key:"toolCount",title:u("settings.mcpServerTable.columns.toolCount"),render:(h,g)=>{var m;return((m=g.runtime)==null?void 0:m.tool_count)??0},width:100},{key:"actions",title:u("settings.mcpServerTable.columns.actions"),width:360,render:(h,g)=>{var b;const m=((b=g.runtime)==null?void 0:b.status)??Ln.Stopped,v=Wrt(m);return E.jsxs(He,{size:d.marginXS,children:[E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),a==null||a(g)},children:u("settings.mcpServerTable.actions.edit")}),E.jsx(Aw,{title:u("settings.mcpServerTable.deleteTitle"),description:u("settings.mcpServerTable.deleteDescription",{name:g.name||g.id}),onConfirm:()=>i==null?void 0:i(g),okText:u("settings.mcpServerTable.actions.delete"),okButtonProps:{danger:!0,loading:c==null?void 0:c(g.id,"delete")},children:E.jsx(De,{size:"small",danger:!0,loading:c==null?void 0:c(g.id,"delete"),onClick:y=>y.stopPropagation(),children:u("settings.mcpServerTable.actions.delete")})}),v?E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),s==null||s(g)},loading:c==null?void 0:c(g.id,"disconnect"),children:u("settings.mcpServerTable.actions.disconnect")}):E.jsx(De,{size:"small",type:"primary",ghost:!0,onClick:y=>{y.stopPropagation(),o==null||o(g)},loading:c==null?void 0:c(g.id,"connect"),children:u("settings.mcpServerTable.actions.connect")}),E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),l==null||l(g)},loading:c==null?void 0:c(g.id,"refresh"),children:u("settings.mcpServerTable.actions.refreshTools")})]})}}],[c,o,i,s,a,l,u,d.marginXS]);return E.jsx(Bi,{rowKey:"id",columns:f,dataSource:e,loading:t,pagination:!1,locale:{emptyText:u("settings.mcpServerTable.empty")},onRow:h=>({onClick:()=>r==null?void 0:r(h.id),style:{cursor:r?"pointer":"default",backgroundColor:n===h.id?d.colorFillSecondary:void 0}})})},{Text:QG}=Qt,{TextArea:Vrt}=tn,JG=e=>{const t=e??s_(""),n=t.transport,r=n.type==="stdio"?Object.entries(n.env??{}).map(([i,o])=>({key:i,value:o})):[],a=n.type==="sse"?n.headers.map(i=>({name:i.name,value:i.value})):[];return{id:t.id,name:t.name,enabled:t.enabled,transportType:n.type,command:n.type==="stdio"?n.command:void 0,args:n.type==="stdio"?n.args:[],envEntries:r,url:n.type==="sse"?n.url:void 0,headerEntries:a,requestTimeoutMs:t.request_timeout_ms||p0,healthcheckIntervalMs:t.healthcheck_interval_ms||h0,allowedTools:t.allowed_tools||[],deniedTools:t.denied_tools||[]}},Grt=e=>e.reduce((t,n)=>{var a;const r=(a=n.key)==null?void 0:a.trim();return r&&(t[r]=n.value??""),t},{}),Krt=e=>e.filter(t=>{var n;return(n=t.name)==null?void 0:n.trim()}).map(t=>{var n;return{name:((n=t.name)==null?void 0:n.trim())||"",value:t.value??""}}),eK=(e,t,n)=>{var u,d,f;const r=t==="edit"&&(n==null?void 0:n.id)||e.id,a=(u=e.name)==null?void 0:u.trim(),i=typeof e.requestTimeoutMs=="number"?e.requestTimeoutMs:(n==null?void 0:n.request_timeout_ms)??p0,o=typeof e.healthcheckIntervalMs=="number"?e.healthcheckIntervalMs:(n==null?void 0:n.healthcheck_interval_ms)??h0,s=Array.isArray(e.allowedTools)?e.allowedTools:(n==null?void 0:n.allowed_tools)??[],l=Array.isArray(e.deniedTools)?e.deniedTools:(n==null?void 0:n.denied_tools)??[],c=e.transportType==="sse"?{type:"sse",url:((d=e.url)==null?void 0:d.trim())||"",headers:Krt(e.headerEntries||[]),connect_timeout_ms:(n==null?void 0:n.transport.type)==="sse"?n.transport.connect_timeout_ms??Zw:Zw}:{type:"stdio",command:((f=e.command)==null?void 0:f.trim())||"",args:e.args||[],env:Grt(e.envEntries||[]),cwd:(n==null?void 0:n.transport.type)==="stdio"?n.transport.cwd:void 0,startup_timeout_ms:(n==null?void 0:n.transport.type)==="stdio"?n.transport.startup_timeout_ms??Vb:Vb};return{id:r,name:a||void 0,enabled:e.enabled,transport:c,request_timeout_ms:i,healthcheck_interval_ms:o,allowed_tools:s,denied_tools:l,reconnect:n==null?void 0:n.reconnect}},tK=e=>JSON.stringify(e||s_(""),null,2),kO=(e,t)=>{try{const n=JSON.parse(e);if(!n||typeof n!="object")return{valid:!1,error:t("settings.mcpServerForm.jsonMustBeObject")};const r=n;if(r.mcpServers&&typeof r.mcpServers=="object")return{valid:!1,error:t("settings.mcpServerForm.detectedBulkConfig")};const a=typeof r.id=="string"?r.id:"";if(!a.trim())return{valid:!1,error:t("settings.mcpServerForm.missingIdField")};if(r.transport&&typeof r.transport=="object"){const d=r;return!d.transport||typeof d.transport!="object"?{valid:!1,error:t("settings.mcpServerForm.missingTransportField")}:{valid:!0,config:d}}const i=typeof r.enabled=="boolean"?r.enabled:typeof r.disabled=="boolean"?!r.disabled:!0,o=typeof r.request_timeout_ms=="number"?r.request_timeout_ms:p0,s=typeof r.healthcheck_interval_ms=="number"?r.healthcheck_interval_ms:h0,l=Array.isArray(r.allowed_tools)?r.allowed_tools.filter(d=>typeof d=="string"):[],c=Array.isArray(r.denied_tools)?r.denied_tools.filter(d=>typeof d=="string"):[],u=typeof r.name=="string"?r.name:void 0;if(typeof r.url=="string"){const d=r.headers,f=Array.isArray(d)?d.map(g=>{if(!g||typeof g!="object")return null;const m=g,v=typeof m.name=="string"?m.name:"",b=typeof m.value=="string"?m.value:"";return v.trim()?{name:v,value:b}:null}).filter(g=>!!g):d&&typeof d=="object"?Object.entries(d).filter(([g])=>g.trim()).map(([g,m])=>({name:g,value:typeof m=="string"?m:""})):[],h=typeof r.connect_timeout_ms=="number"?r.connect_timeout_ms:Zw;return{valid:!0,config:{id:a,name:u,enabled:i,transport:{type:"sse",url:r.url,headers:f,connect_timeout_ms:h},request_timeout_ms:o,healthcheck_interval_ms:s,allowed_tools:l,denied_tools:c,reconnect:void 0}}}if(typeof r.command=="string"){const d=Array.isArray(r.args)?r.args.filter(m=>typeof m=="string"):[],f=r.env,h=f&&typeof f=="object"?Object.entries(f).reduce((m,[v,b])=>(typeof b=="string"&&(m[v]=b),m),{}):{},g=typeof r.startup_timeout_ms=="number"?r.startup_timeout_ms:Vb;return{valid:!0,config:{id:a,name:u,enabled:i,transport:{type:"stdio",command:r.command,args:d,cwd:typeof r.cwd=="string"?r.cwd:void 0,env:h,startup_timeout_ms:g},request_timeout_ms:o,healthcheck_interval_ms:s,allowed_tools:l,denied_tools:c,reconnect:void 0}}}return{valid:!1,error:t("settings.mcpServerForm.missingTransportInfo")}}catch(n){return{valid:!1,error:t("settings.mcpServerForm.invalidJson",{message:n instanceof Error?n.message:t("settings.mcpServerForm.unknownError")})}}},Yrt=({open:e,mode:t,initialConfig:n,confirmLoading:r=!1,onCancel:a,onSubmit:i})=>{const{t:o}=br(),[s]=wt.useForm(),[l,c]=p.useState("form"),[u,d]=p.useState(""),[f,h]=p.useState(null),g=p.useMemo(()=>JG(n),[n]),m=wt.useWatch("transportType",s)??"stdio";p.useEffect(()=>{e&&(s.setFieldsValue(g),d(tK(n)),h(null),c("form"))},[s,g,n,e]);const v=()=>{s.resetFields(),d(""),h(null),a()},b=async()=>{if(l==="json"){const C=kO(u,o);if(!C.valid){h(C.error);return}h(null);try{await i(C.config),d("")}catch(x){console.error("MCP server JSON submission error:",x)}return}try{const C=await s.validateFields(),x=eK(C,t,n);await i(x),s.resetFields()}catch(C){console.error("MCP server form submission error:",C)}},y=C=>{d(C),f&&kO(C,o).valid&&h(null)},S=C=>{if(C==="json")try{const x=s.getFieldsValue(),w=eK(x,t,n);d(JSON.stringify(w,null,2))}catch{d(tK(n))}else{const x=kO(u,o);x.valid&&s.setFieldsValue(JG(x.config))}c(C),h(null)};return E.jsxs(qr,{title:o(t==="edit"?"settings.mcpServerForm.editTitle":"settings.mcpServerForm.addTitle"),open:e,onCancel:v,onOk:()=>{b()},okText:o("settings.mcpServerForm.save"),destroyOnClose:!0,confirmLoading:r,width:720,children:[E.jsx("div",{style:{marginBottom:16},children:E.jsxs(Xa.Group,{value:l,onChange:C=>S(C.target.value),optionType:"button",buttonStyle:"solid",children:[E.jsxs(Xa.Button,{value:"form",children:[E.jsx(V7e,{})," ",o("settings.mcpServerForm.modeForm")]}),E.jsxs(Xa.Button,{value:"json",children:[E.jsx(_7e,{})," ",o("settings.mcpServerForm.modeJson")]})]})}),l==="json"&&f&&E.jsx(fr,{type:"error",message:o("settings.mcpServerForm.jsonError"),description:f,showIcon:!0,style:{marginBottom:16},closable:!0,onClose:()=>h(null)}),l==="json"?E.jsx(Vrt,{value:u,onChange:C=>y(C.target.value),rows:20,style:{fontFamily:"monospace",fontSize:13},placeholder:JSON.stringify(s_("example-server"),null,2)}):E.jsxs(wt,{layout:"vertical",form:s,preserve:!0,initialValues:g,children:[E.jsx(wt.Item,{name:"id",label:o("settings.mcpServerForm.serverId"),rules:[{required:!0,message:o("settings.mcpServerForm.serverIdRequired")},{pattern:/^[a-zA-Z0-9_-]+$/,message:o("settings.mcpServerForm.serverIdPatternError")}],children:E.jsx(tn,{placeholder:"filesystem",disabled:t==="edit",autoComplete:"off"})}),E.jsx(wt.Item,{name:"name",label:o("settings.mcpServerForm.displayName"),children:E.jsx(tn,{placeholder:"Filesystem MCP",autoComplete:"off"})}),E.jsx(wt.Item,{name:"enabled",label:o("settings.mcpServerForm.enabled"),valuePropName:"checked",extra:o("settings.mcpServerForm.enabledHelp"),children:E.jsx(ba,{})}),E.jsx(wt.Item,{name:"transportType",label:o("settings.mcpServerForm.transportType"),rules:[{required:!0,message:o("settings.mcpServerForm.transportTypeRequired")}],children:E.jsx(Jn,{options:[{label:o("settings.mcpServerForm.transportOptions.stdio"),value:"stdio"},{label:o("settings.mcpServerForm.transportOptions.sse"),value:"sse"}]})}),m==="stdio"?E.jsxs(E.Fragment,{children:[E.jsx(wt.Item,{name:"command",label:o("settings.mcpServerForm.command"),rules:[{required:!0,message:o("settings.mcpServerForm.commandRequired")}],children:E.jsx(tn,{placeholder:"npx",autoComplete:"off"})}),E.jsx(wt.Item,{name:"args",label:o("settings.mcpServerForm.arguments"),children:E.jsx(Jn,{mode:"tags",tokenSeparators:[","],placeholder:o("settings.mcpServerForm.argumentsPlaceholder"),open:!1})}),E.jsx(wt.List,{name:"envEntries",children:(C,{add:x,remove:w})=>E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsxs(He,{align:"center",style:{justifyContent:"space-between",width:"100%"},children:[E.jsx(QG,{strong:!0,children:o("settings.mcpServerForm.envVars")}),E.jsx(De,{icon:E.jsx(Xp,{}),onClick:()=>x({key:"",value:""}),type:"dashed",children:o("settings.mcpServerForm.addEnv")})]}),C.map(_=>E.jsxs(He,{align:"baseline",style:{display:"flex"},children:[E.jsx(wt.Item,{..._,name:[_.name,"key"],rules:[{required:!0,message:o("settings.mcpServerForm.keyRequired")}],children:E.jsx(tn,{placeholder:"MCP_ROOT",autoComplete:"off"})}),E.jsx(wt.Item,{..._,name:[_.name,"value"],children:E.jsx(tn,{placeholder:"/Users/me/workspace",autoComplete:"off"})}),E.jsx(De,{danger:!0,type:"text",icon:E.jsx(jP,{}),onClick:()=>w(_.name)})]},_.key))]})})]}):E.jsxs(E.Fragment,{children:[E.jsx(wt.Item,{name:"url",label:o("settings.mcpServerForm.sseUrl"),rules:[{required:!0,message:o("settings.mcpServerForm.sseUrlRequired")},{validator:async(C,x)=>{if(x)try{new URL(x)}catch{throw new Error(o("settings.mcpServerForm.validUrlRequired"))}}}],children:E.jsx(tn,{placeholder:"http://localhost:4000/sse",autoComplete:"off"})}),E.jsx(wt.List,{name:"headerEntries",children:(C,{add:x,remove:w})=>E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsxs(He,{align:"center",style:{justifyContent:"space-between",width:"100%"},children:[E.jsx(QG,{strong:!0,children:o("settings.mcpServerForm.headers")}),E.jsx(De,{icon:E.jsx(Xp,{}),onClick:()=>x({name:"",value:""}),type:"dashed",children:o("settings.mcpServerForm.addHeader")})]}),C.map(_=>E.jsxs(He,{align:"baseline",style:{display:"flex"},children:[E.jsx(wt.Item,{..._,name:[_.name,"name"],rules:[{required:!0,message:o("settings.mcpServerForm.headerNameRequired")}],children:E.jsx(tn,{placeholder:"Authorization",autoComplete:"off"})}),E.jsx(wt.Item,{..._,name:[_.name,"value"],children:E.jsx(tn,{placeholder:"Bearer token",autoComplete:"off"})}),E.jsx(De,{danger:!0,type:"text",icon:E.jsx(jP,{}),onClick:()=>w(_.name)})]},_.key))]})})]})]})]})},Xrt={maxLines:8,maxCharacters:500},OO=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Sc=e=>typeof e=="string"?e:void 0,Zg=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,nK=e=>typeof e=="boolean"?e:void 0,g0=e=>{if(!e)return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);if(!OO(n))return null;const r=Sc(n.file_path),a=Sc(n.operation),i=n.diff;if(!r||!a||!OO(i))return null;const o=Sc(i.unified);if(!o)return null;const s=n.checkpoint,l=OO(s)?{created:nK(s.created)??!1,id:Sc(s.id),path:Sc(s.path),size_bytes:Zg(s.size_bytes),reason:Sc(s.reason)}:void 0;return{operation:a,message:Sc(n.message),file_path:r,workspace:Sc(n.workspace),checkpoint:l,diff:{unified:o,old_line_count:Zg(i.old_line_count),new_line_count:Zg(i.new_line_count),added_lines:Zg(i.added_lines),removed_lines:Zg(i.removed_lines),truncated:nK(i.truncated)}}}catch{return null}},zN=e=>e.startsWith("-")&&!e.startsWith("---"),HN=e=>e.startsWith("+")&&!e.startsWith("+++"),jhe=e=>{const t=e.split(`
|
|
637
|
+
`),Nhe=()=>{try{return localStorage.getItem(Phe)??""}catch(e){return console.error("Failed to load system prompt enhancement:",e),""}},trt=e=>{try{const t=e.trim()?e:"";localStorage.setItem(Phe,t)}catch(t){console.error("Failed to save system prompt enhancement:",t)}},nrt=e=>{const t=[];t.push(Xnt().trim()),t.push(Jnt().trim());const n=Nhe().trim();return n&&t.push(n),LN()&&t.push(qnt().trim()),jN()&&t.push(Knt().trim()),(e??"").trim().toLowerCase()==="copilot"&&BN()&&t.push(Qnt().trim()),t},rrt=e=>ert(nrt(e));function Lhe(e){const{modal:t,message:n}=Ns.useApp(),r=p.useRef(null),a=p.useRef(null),i=p.useRef(""),o=p.useRef(new Rs),s=Ue(y=>y.agentAvailability),l=Ue(y=>y.setAgentAvailability),c=Ue(y=>y.checkAgentAvailability),u=Ue(y=>y.startAgentHealthCheck),d=pg(),f=Ho(y=>y.currentProvider),h=Ue(y=>e.sessionId&&y.chats.find(S=>S.id===e.sessionId)||null);p.useEffect(()=>{u()},[u]);const g=p.useCallback(()=>{var S;(S=r.current)==null||S.abort();const y=h==null?void 0:h.id;y&&o.current.stopGeneration(y).catch(C=>{console.error("[useMessageStreaming] Failed to stop generation:",C)})},[h==null?void 0:h.id]),m=p.useCallback(async(y,S,C,x,w)=>{var T,k;if(!d)throw new Error("Model not selected");const _=new AbortController;r.current=_;try{const O=rrt(f).trim(),M=(((T=h==null?void 0:h.config)==null?void 0:T.workspacePath)||"").trim().replace(/\/+$/,"").replace(/\\+$/,""),$=await o.current.sendMessage({message:y,session_id:S,enhance_prompt:O||void 0,workspace_path:M||void 0,selected_skill_ids:w&&w.length>0?w:void 0,images:(k=C.images)==null?void 0:k.filter(P=>!!P.base64).map(P=>({base64:P.base64,name:P.name,size:P.size,type:P.type})),model:d}),{session_id:R}=$;R!==S&&console.warn(`[useMessageStreaming] Backend returned unexpected session_id=${R} for sessionId=${S}`),e.setSessionProcessing(S,!0),await new Promise(P=>setTimeout(P,0));const A=x?await o.current.execute(S,d,x):await o.current.execute(S,d);if(console.log("[Agent] Execute status:",A.status),!["started","already_running"].includes(A.status))if(A.status==="completed")console.log("[Agent] Session already completed"),e.setSessionProcessing(S,!1);else throw console.error("[Agent] Execute failed:",A.status),e.setSessionProcessing(S,!1),new Error(`Execute failed: ${A.status}`)}catch(O){throw O}},[e,d,h,f]),v=p.useCallback(async(y,S,C,x)=>{if(!h){t.info({title:"No Active Chat",content:"Please create or select a chat before sending a message."});return}if(!e.sessionId){t.info({title:"No Chat ID",content:"Chat ID is required to send a message."});return}if(!d){t.error({title:"No Model Selected",content:"Please select a model before sending a message."});return}let w=s;if(w===null&&(w=await c()),!w){n.error("Agent unavailable. Please try again later.");return}if(!d){n.error("Model configuration not loaded. Please wait or reload the page.");return}const _=e.sessionId,T=(S==null?void 0:S.map(O=>({id:O.id,base64:O.base64,name:O.name,size:O.size,type:O.type})))||[],k={role:"user",content:y,id:crypto.randomUUID(),createdAt:new Date().toISOString(),images:T};await e.addMessage(_,k);try{console.log("[useChatStreaming] Using Agent Server"),await m(y,_,k,C,x)}catch(O){a.current&&Yr.clear(_,a.current),a.current=null,i.current="",O instanceof Error&&O.name==="AbortError"?n.info("Request cancelled"):(console.error("[useChatStreaming] Failed to send message:",O),n.error("Failed to send message. Please try again."),l(!1)),e.setSessionProcessing(_,!1)}finally{r.current=null,a.current&&Yr.clear(_,a.current),a.current=null,i.current=""}},[s,n,c,e,h,t,m,l,d]),b=p.useCallback(async(y,S="regenerate")=>{if(!h){t.info({title:"No Active Chat",content:"Please create or select a chat before retrying."});return}if(!e.sessionId){t.info({title:"No Chat ID",content:"Chat ID is required to retry."});return}if(!d){t.error({title:"No Model Selected",content:"Please select a model before retrying."});return}let C=s;if(C===null&&(C=await c()),!C){n.error("Agent unavailable. Please try again later.");return}const x=e.sessionId;a.current&&Yr.clear(x,a.current),a.current=null,i.current="";try{const w=S==="error_retry"?"error_retry":"after_last_user";await o.current.truncateSessionMessages(x,{mode:w}),S==="regenerate"&&await Ue.getState().loadChatHistory(x,{mode:"replace"}),e.setSessionProcessing(x,!0);const _=y?await o.current.execute(x,d,y):await o.current.execute(x,d);if(["started","already_running"].includes(_.status))return;if(_.status==="completed"){e.setSessionProcessing(x,!1);return}throw e.setSessionProcessing(x,!1),new Error(`Execute failed: ${_.status}`)}catch(w){console.error("[useMessageStreaming] Retry failed:",w),n.error("Retry failed. Please try again."),e.setSessionProcessing(x,!1)}finally{r.current=null}},[d,s,n,c,h,e,t]);return{sendMessage:v,retryLastTurn:b,cancel:g,agentAvailable:s}}function art(e,t){const n=p.useMemo(()=>e.baseMessages,[e.baseMessages]),r=p.useCallback(async()=>{var c;if(!e.currentSessionId||!e.currentChat)return;const a=[...e.baseMessages];if(a.length===0)return;const i=a[a.length-1];let o=a;(i==null?void 0:i.role)==="assistant"&&(e.deleteMessage(e.currentSessionId,i.id),o=a.slice(0,-1));const s=[...o].reverse().find(u=>u.role==="user");if(!s)return;const l="content"in s?s.content:s.displayText;typeof l=="string"&&await((c=t==null?void 0:t.onRetry)==null?void 0:c.call(t,l))},[t,e.baseMessages,e.currentChat,e.currentSessionId,e.deleteMessage]);return{currentMessages:n,retryLastMessage:r}}const irt=()=>{const e=znt(),t=Z8(e),n=Hnt(e),r=Lhe({sessionId:e.currentSessionId,addMessage:e.addMessage,setSessionProcessing:e.setSessionProcessing,updateSession:e.updateSession}),a=art(e,{onRetry:r.sendMessage});return{chats:e.chats,currentSessionId:e.currentSessionId,currentChat:e.currentChat,pinnedChats:e.pinnedChats,unpinnedChats:e.unpinnedChats,chatCount:e.chatCount,currentMessages:a.currentMessages,agentAvailable:r.agentAvailable,titleGenerationState:t.titleGenerationState,autoGenerateTitles:t.autoGenerateTitles,isUpdatingAutoTitlePreference:t.isUpdatingAutoTitlePreference,addMessage:e.addMessage,deleteMessage:e.deleteMessage,selectSession:e.selectSession,deleteSession:e.deleteSession,deleteSessions:e.deleteSessions,pinSession:e.pinSession,unpinSession:e.unpinSession,updateSession:e.updateSession,loadChats:e.loadChats,generateChatTitle:t.generateChatTitle,setAutoGenerateTitlesPreference:t.setAutoGenerateTitlesPreference,createNewChat:n.createNewChat,createChatWithSystemPrompt:n.createChatWithSystemPrompt,toggleChatPin:n.toggleChatPin,updateChatTitle:n.updateChatTitle,deleteEmptyChats:n.deleteEmptyChats,deleteAllUnpinnedChats:n.deleteAllUnpinnedChats,deleteAllChats:n.deleteAllChats,retryLastMessage:a.retryLastMessage,sendMessage:r.sendMessage,cancelMessage:r.cancel}},{Text:IS}=Qt,{useToken:ort}=pn,srt=({httpProxy:e,httpsProxy:t,onHttpProxyChange:n,onHttpsProxyChange:r,onReload:a,onSave:i,isLoading:o})=>{const{t:s}=br(),{token:l}=ort(),c=Rc(C=>C.proxyAuthStatus),u=Rc(C=>C.isLoadingProxyAuthStatus),d=Rc(C=>C.loadProxyAuthStatus),f=Rc(C=>C.applyProxyAuth),h=Rc(C=>C.clearProxyAuth),[g,m]=p.useState({username:"",password:""}),[v,b]=p.useState(!1);p.useEffect(()=>{d()},[]);const y=async()=>{const C=g.username.trim();if(C){b(!0);try{await f({username:C,password:g.password}),m({username:"",password:""})}catch(x){console.error("Failed to apply proxy auth:",x)}finally{b(!1)}}},S=async()=>{b(!0);try{await h()}catch(C){console.error("Failed to clear proxy auth:",C)}finally{b(!1)}};return E.jsx(Ot,{size:"small",title:E.jsx(IS,{strong:!0,children:s("settings.networkCard.title")}),children:E.jsxs(He,{direction:"vertical",size:l.marginSM,style:{width:"100%"},children:[E.jsxs(He,{direction:"vertical",size:l.marginXXS,style:{width:"100%"},children:[E.jsx(IS,{type:"secondary",children:s("settings.networkCard.httpProxy")}),E.jsx(tn,{"data-testid":"proxy-url",style:{width:"100%"},value:e,onChange:C=>n(C.target.value),placeholder:s("settings.networkCard.proxyPlaceholder"),disabled:o})]}),E.jsxs(He,{direction:"vertical",size:l.marginXXS,style:{width:"100%"},children:[E.jsx(IS,{type:"secondary",children:s("settings.networkCard.httpsProxy")}),E.jsx(tn,{style:{width:"100%"},value:t,onChange:C=>r(C.target.value),placeholder:s("settings.networkCard.proxyPlaceholder"),disabled:o})]}),E.jsx(Ot,{size:"small",title:s("settings.networkCard.proxyAuthTitle"),style:{marginTop:l.marginSM},children:c!=null&&c.configured?E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(fr,{type:"success",message:s("settings.networkCard.proxyConfiguredForUser",{username:c.username??""}),showIcon:!0}),E.jsx(De,{onClick:S,loading:v||u,danger:!0,children:s("settings.networkCard.clearCredentials")})]}):E.jsxs(He,{direction:"vertical",size:l.marginXS,style:{width:"100%"},children:[E.jsx(tn,{placeholder:s("settings.networkCard.username"),value:g.username,onChange:C=>m(x=>({...x,username:C.target.value}))}),E.jsx(tn.Password,{placeholder:s("settings.networkCard.password"),value:g.password,onChange:C=>m(x=>({...x,password:C.target.value}))}),E.jsx(De,{type:"primary",onClick:y,loading:v||u,disabled:!g.username.trim(),children:s("settings.networkCard.apply")})]})}),E.jsx(IS,{type:"secondary",style:{fontSize:l.fontSizeSM},children:s("settings.networkCard.credentialsStorageNote")}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:l.marginSM},children:[E.jsx(De,{onClick:()=>Promise.resolve(a()).finally(()=>d({force:!0})),disabled:o,children:s("settings.networkCard.reload")}),E.jsx(De,{"data-testid":"save-proxy-settings",type:"primary",onClick:()=>Promise.resolve(i()).finally(()=>d({force:!0})),disabled:o,children:s("settings.networkCard.save")})]})]})})},{Text:Eo}=Qt,{useToken:lrt}=pn,crt=5*60*1e3,urt=()=>{const{t:e}=br(),{token:t}=lrt(),[n,r]=p.useState({}),[a,i]=p.useState([]),[o,s]=p.useState(!1),[l,c]=p.useState(""),[u,d]=p.useState(null),[f,h]=vn.useMessage(),[g,m]=p.useState({}),[v,b]=p.useState(!1),[y,S]=p.useState(""),[C,x]=p.useState("");p.useEffect(()=>{(async()=>{try{const A=await lo.getProviderConfig();c(A.provider||"copilot")}catch(A){console.error("Failed to load provider config:",A),d(e("settings.modelMappingCard.loadProviderFailed"))}})()},[e]),p.useEffect(()=>{const A=setInterval(async()=>{try{const N=(await lo.getProviderConfig()).provider||"copilot";N!==l&&l!==""&&(console.log(`Provider changed from ${l} to ${N}`),c(N),d(null))}catch(P){console.error("Failed to check provider change:",P)}},1e4);return()=>clearInterval(A)},[l]),p.useEffect(()=>{(async()=>{try{const A=await Dr.getAnthropicModelMapping();r(A.mappings||{})}catch(A){console.error("Failed to load model mappings:",A),f.error(e("settings.modelMappingCard.loadMappingsFailed"))}})()},[f,e]);const w=p.useCallback(async(R=!1)=>{if(l){if(!R&&g[l]){const A=g[l];if(Date.now()-A.timestamp<crt){console.log(`Using cached models for ${l}`),i(A.models),d(null);return}}s(!0),d(null);try{let A;if(l==="copilot"){const{modelService:P}=await Mn(async()=>{const{modelService:N}=await Promise.resolve().then(()=>hGe);return{modelService:N}},void 0,import.meta.url);A=await P.getModels()}else A=await lo.fetchProviderModels(l);i(A),m(P=>({...P,[l]:{models:A,timestamp:Date.now()}})),console.log(`Fetched ${A.length} models for ${l}`)}catch(A){console.error("Failed to fetch models:",A);const P=A instanceof Error?A.message:e("settings.modelMappingCard.loadModelsFailed");d(P),f.error(e("settings.modelMappingCard.loadModelsHint")),i([])}finally{s(!1)}}},[l,g,f,e]);p.useEffect(()=>{l&&w()},[l,w]);const _=async(R,A)=>{if(A==="__custom__"){S(R),x(""),b(!0);return}if(!A)return;const P={...n,[R]:A};r(P);try{await Dr.setAnthropicModelMapping({mappings:P}),f.success(e("settings.modelMappingCard.mappingSaved"))}catch(N){console.error("Failed to save model mapping:",N),f.error(e("settings.modelMappingCard.mappingSaveFailed"))}},T=async()=>{if(!C.trim()){f.warning(e("settings.modelMappingCard.enterModelName"));return}const R={...n,[y]:C.trim()};r(R);try{await Dr.setAnthropicModelMapping({mappings:R}),f.success(e("settings.modelMappingCard.customMappingSaved")),b(!1),x("")}catch(A){console.error("Failed to save custom model mapping:",A),f.error(e("settings.modelMappingCard.customMappingSaveFailed"))}},k=()=>{w(!0)},O=R=>{const A=n[R];return A?a.includes(A):!0},I=[{key:"opus",label:e("settings.modelMappingCard.modelTypeOpus"),description:e("settings.modelMappingCard.modelTypeOpusDescription")},{key:"sonnet",label:e("settings.modelMappingCard.modelTypeSonnet"),description:e("settings.modelMappingCard.modelTypeSonnetDescription")},{key:"haiku",label:e("settings.modelMappingCard.modelTypeHaiku"),description:e("settings.modelMappingCard.modelTypeHaikuDescription")}],M=l.charAt(0).toUpperCase()+l.slice(1),$=[{key:"1",label:e("settings.modelMappingCard.collapseTitle"),children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsx(Eo,{type:"secondary",children:e("settings.modelMappingCard.description",{provider:M})}),u&&E.jsx(fr,{type:"error",message:e("settings.modelMappingCard.loadModelsErrorTitle"),description:u,showIcon:!0,action:E.jsx(De,{size:"small",icon:E.jsx(Zl,{}),onClick:k,loading:o,children:e("settings.modelMappingCard.retry")})}),o&&!u&&E.jsx("div",{style:{textAlign:"center",padding:t.paddingMD},children:E.jsx(ia,{tip:e("settings.modelMappingCard.loadingModels")})}),!o&&!u&&I.map(({key:R,label:A,description:P})=>{const N=O(R),L=n[R];return E.jsxs(He,{direction:"vertical",size:t.marginXXS,style:{width:"100%"},children:[E.jsxs(Eo,{type:"secondary",children:[A," (",P,")"]}),E.jsx(Jn,{style:{width:"100%"},value:L||void 0,onChange:j=>_(R,j),placeholder:e("settings.modelMappingCard.selectModelPlaceholder",{label:A}),loading:o,disabled:o||a.length===0,showSearch:!0,allowClear:!0,optionFilterProp:"children",options:[...a.map(j=>({label:j,value:j})),{label:`✏️ ${e("settings.modelMappingCard.customModelOption")}`,value:"__custom__"}],status:N?void 0:"warning",filterOption:(j,D)=>((D==null?void 0:D.label)??"").toString().toLowerCase().includes(j.toLowerCase())}),!N&&L&&E.jsx(Eo,{type:"warning",style:{fontSize:t.fontSizeSM},children:e("settings.modelMappingCard.mappedModelNotFound",{model:L})})]},R)}),E.jsx(nl,{style:{margin:`${t.marginSM} 0`}}),E.jsx(He,{style:{width:"100%",justifyContent:"flex-end"},children:E.jsx(De,{size:"small",icon:E.jsx(Zl,{}),onClick:k,loading:o,disabled:!l,children:e("settings.modelMappingCard.refreshModels")})}),E.jsxs(He,{direction:"vertical",size:t.marginXXS,style:{width:"100%"},children:[E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.currentProvider"),":"," ",E.jsx(Eo,{strong:!0,children:l||e("settings.modelMappingCard.loadingProvider")})]}),E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.availableModels"),":"," ",E.jsx(Eo,{strong:!0,children:a.length}),g[l]&&E.jsx(Eo,{type:"secondary",style:{marginLeft:t.marginXXS},children:e("settings.modelMappingCard.cached")})]}),E.jsxs(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:[e("settings.modelMappingCard.storedIn"),":"," ",E.jsx(Eo,{code:!0,children:"~/.bamboo/anthropic-model-mapping.json"})]})]})]})}];return E.jsxs(E.Fragment,{children:[h,E.jsx(gl,{size:"small",items:$,style:{marginBottom:t.marginSM}}),E.jsx(qr,{title:e("settings.modelMappingCard.customModalTitle"),open:v,onOk:T,onCancel:()=>{b(!1),x("")},okText:e("settings.modelMappingCard.save"),cancelText:e("settings.modelMappingCard.cancel"),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(Eo,{type:"secondary",children:e("settings.modelMappingCard.customModalDescription",{modelType:y})}),E.jsx(tn,{placeholder:e("settings.modelMappingCard.customModalPlaceholder"),value:C,onChange:R=>x(R.target.value),onPressEnter:T,autoFocus:!0}),E.jsx(Eo,{type:"secondary",style:{fontSize:t.fontSizeSM},children:e("settings.modelMappingCard.customModalNote")})]})})]})},{Text:Hf}=Qt,{useToken:drt}=pn,KG="http://127.0.0.1:9562/v1",_v=e=>[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort(),frt=e=>{var n;const t=(n=e.tools)==null?void 0:n.disabled;return Array.isArray(t)?_v(t.filter(r=>typeof r=="string")):[]},prt=({msgApi:e,locale:t,onLocaleChange:n})=>{const{t:r}=br(),{token:a}=drt(),[i,o]=p.useState({http_proxy:"",https_proxy:""}),[s,l]=p.useState(KG),[c,u]=p.useState([]),[d,f]=p.useState([]),[h,g]=p.useState([]),[m,v]=p.useState(!1),[b,y]=p.useState(!1),S=p.useCallback(async()=>{v(!0);try{const[R,A]=await Promise.all([Dr.getBambooConfig(),Dr.getBambooTools()]);o({http_proxy:R.http_proxy||"",https_proxy:R.https_proxy||""});const P=frt(R);f(P),g(P),u(_v(A.tools||[]))}catch(R){console.error("Failed to load config:",R),e.error(r("settings.configTab.loadConfigFailed"))}finally{v(!1)}},[e,r]);p.useEffect(()=>{S()},[S]);const C=R=>{o(A=>({...A,http_proxy:R}))},x=R=>{o(A=>({...A,https_proxy:R}))},w=async()=>{var R,A;v(!0);try{const P=await Dr.validateBambooConfigPatch(i);if(!P.valid){const L=((A=(R=P.errors)==null?void 0:R.proxy)==null?void 0:A[0])??Object.values(P.errors||{}).flat().filter(Boolean)[0];e.error((L==null?void 0:L.message)||r("settings.configTab.invalidConfig"));return}await Dr.setBambooConfig(i),e.success(r("settings.configTab.saveConfigSuccess"))}catch(P){console.error("Failed to save config:",P);const N=P instanceof Error&&P.message.trim()?P.message:r("settings.configTab.saveConfigFailed");e.error(N)}finally{v(!1)}},_=async()=>{e.success(r("settings.configTab.backendSaved"))},T=()=>{l(KG),e.success(r("settings.configTab.backendResetDefault"))},k=(R,A)=>{f(P=>{const N=new Set(P);return A?N.delete(R):N.add(R),_v([...N])})},O=async()=>{y(!0);try{const R=await Dr.getBambooTools();u(_v(R.tools||[])),e.success(r("settings.configTab.toolsReloadSuccess"))}catch(R){console.error("Failed to reload tools:",R),e.error(r("settings.configTab.toolsLoadFailed"))}finally{y(!1)}},I=async()=>{y(!0);try{const R=_v(d);await Dr.setBambooConfig({tools:{disabled:R}}),f(R),g(R),e.success(r("settings.configTab.toolsSaveSuccess"))}catch(R){console.error("Failed to save tool settings:",R),e.error(r("settings.configTab.toolsSaveFailed"))}finally{y(!1)}},M=JSON.stringify(d)!==JSON.stringify(h),$=new Set(d);return E.jsx(ia,{spinning:m,tip:r("settings.common.loading"),children:E.jsx(Gp,{items:[{key:"general",label:r("settings.configTab.tabs.general"),children:E.jsxs(He,{direction:"vertical",size:a.marginMD,style:{width:"100%"},children:[E.jsx(fr,{message:r("settings.configTab.providerMovedTitle"),description:r("settings.configTab.providerMovedDescription"),type:"info",showIcon:!0,closable:!0}),E.jsx(srt,{httpProxy:i.http_proxy,httpsProxy:i.https_proxy,onHttpProxyChange:C,onHttpsProxyChange:x,onReload:S,onSave:w,isLoading:m}),E.jsx(urt,{}),E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.language")}),children:E.jsx(Jn,{value:t,style:{width:260},options:[{label:r("settings.configTab.languageEnglish"),value:"en-US"},{label:r("settings.configTab.languageChinese"),value:"zh-CN"},{label:r("settings.configTab.languageTraditionalChinese"),value:"zh-TW"},{label:r("settings.configTab.languageFrench"),value:"fr-FR"},{label:r("settings.configTab.languageJapanese"),value:"ja-JP"}],onChange:R=>n(R)})}),E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.backendApiBaseUrlTitle")}),children:E.jsxs(He,{direction:"vertical",size:a.marginSM,style:{width:"100%"},children:[E.jsx(He,{direction:"vertical",size:a.marginXXS,style:{width:"100%"},children:E.jsx(tn,{style:{width:"100%"},value:s,onChange:R=>l(R.target.value),placeholder:r("settings.configTab.backendApiPlaceholder")})}),E.jsx(Hf,{type:"secondary",style:{fontSize:a.fontSizeSM},children:r("settings.configTab.backendApiHint")}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:a.marginSM},children:[E.jsx(De,{"data-testid":"reset-to-defaults",onClick:T,children:r("settings.configTab.resetToDefault")}),E.jsx(De,{"data-testid":"save-api-settings",type:"primary",onClick:_,children:r("settings.configTab.save")})]})]})})]})},{key:"tools",label:r("settings.configTab.tabs.tools"),children:E.jsx(Ot,{size:"small",title:E.jsx(Hf,{strong:!0,children:r("settings.configTab.toolsTitle")}),children:E.jsxs(He,{direction:"vertical",size:a.marginMD,style:{width:"100%"},children:[E.jsx(Hf,{type:"secondary",children:r("settings.configTab.toolsDescription")}),c.length===0?E.jsx(fr,{type:"info",showIcon:!0,message:r("settings.configTab.toolsEmpty")}):E.jsx(jr,{bordered:!0,dataSource:c,renderItem:R=>E.jsx(jr.Item,{actions:[E.jsx(ba,{checked:!$.has(R),onChange:A=>k(R,A)},`${R}-switch`)],children:E.jsx(Hf,{code:!0,children:R})})}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:a.marginSM},children:[E.jsx(De,{onClick:O,loading:b,children:r("settings.configTab.reloadTools")}),E.jsx(De,{type:"primary",onClick:I,loading:b,disabled:!M,children:r("settings.configTab.save")})]})]})})}]})})},YG={theme:"default",themeVariables:{},fontSize:16,defaultScale:1,useMaxWidth:!0,flowchartNodeSpacing:50,flowchartRankSpacing:50,flowchartCurve:"basis",sequenceActorMargin:50,sequenceMessageMargin:35,sequenceWidth:150,sequenceHeight:65,ganttBarHeight:20,ganttTopPadding:50},e5=Qh()(eGe(e=>({settings:YG,updateSettings:t=>e(n=>({settings:{...n.settings,...t}})),resetSettings:()=>e({settings:YG})}),{name:"mermaid-settings"})),o_=()=>e5(t=>t.settings),hrt=()=>e5(e=>e.updateSettings),grt=()=>e5(e=>e.resetSettings),{Title:mrt,Text:_O}=Qt,{useToken:vrt}=pn,brt=()=>{const{t:e}=br(),{token:t}=vrt(),n=o_(),r=hrt(),a=grt(),[i]=wt.useForm();U.useEffect(()=>{i.setFieldsValue(n)},[n,i]);const o=l=>{r(l)},s=()=>{a(),i.resetFields()};return E.jsxs("div",{style:{padding:"24px",maxWidth:"1200px",margin:"0 auto"},children:[E.jsx(mrt,{level:3,style:{marginBottom:"8px"},children:e("settings.mermaidTab.title")}),E.jsx(_O,{type:"secondary",style:{display:"block",marginBottom:"24px"},children:e("settings.mermaidTab.description")}),E.jsxs(wt,{form:i,layout:"vertical",initialValues:n,onValuesChange:o,children:[E.jsxs(Ot,{title:e("settings.mermaidTab.themeCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:[E.jsx(gs,{gutter:16,children:E.jsx(Lr,{span:24,children:E.jsx(wt.Item,{name:"theme",label:E.jsxs(He,{children:[e("settings.mermaidTab.themeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.themeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsxs(Jn,{children:[E.jsx(Jn.Option,{value:"default",children:e("settings.mermaidTab.themeOptions.default")}),E.jsx(Jn.Option,{value:"neutral",children:e("settings.mermaidTab.themeOptions.neutral")}),E.jsx(Jn.Option,{value:"dark",children:e("settings.mermaidTab.themeOptions.dark")}),E.jsx(Jn.Option,{value:"forest",children:e("settings.mermaidTab.themeOptions.forest")}),E.jsx(Jn.Option,{value:"base",children:e("settings.mermaidTab.themeOptions.base")})]})})})}),E.jsxs(_O,{type:"secondary",style:{display:"block",marginTop:"8px"},children:[E.jsx("strong",{children:e("settings.mermaidTab.themeDescriptionsTitle")}),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.default"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.neutral"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.dark"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.forest"),E.jsx("br",{}),"• ",e("settings.mermaidTab.themeDescriptions.base")]})]}),E.jsxs(Ot,{title:e("settings.mermaidTab.globalCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:[E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"fontSize",label:E.jsxs(He,{children:[e("settings.mermaidTab.fontSizeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.fontSizeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:32,step:1,style:{width:"100%"},addonAfter:"px"})})}),E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"defaultScale",label:E.jsxs(He,{children:[e("settings.mermaidTab.defaultZoomLabel"),E.jsx(wn,{title:e("settings.mermaidTab.defaultZoomTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:.1,max:3,step:.1,style:{width:"100%"}})})})]}),E.jsx(wt.Item,{name:"useMaxWidth",label:E.jsxs(He,{children:[e("settings.mermaidTab.responsiveWidthLabel"),E.jsx(wn,{title:e("settings.mermaidTab.responsiveWidthTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsx(Ot,{title:e("settings.mermaidTab.flowchartCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartNodeSpacing",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartNodeSpacingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartNodeSpacingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartRankSpacing",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartRankSpacingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartRankSpacingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:8,children:E.jsx(wt.Item,{name:"flowchartCurve",label:E.jsxs(He,{children:[e("settings.mermaidTab.flowchartCurveTypeLabel"),E.jsx(wn,{title:e("settings.mermaidTab.flowchartCurveTypeTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsxs(Jn,{children:[E.jsx(Jn.Option,{value:"basis",children:e("settings.mermaidTab.flowchartCurveOptions.basis")}),E.jsx(Jn.Option,{value:"linear",children:e("settings.mermaidTab.flowchartCurveOptions.linear")}),E.jsx(Jn.Option,{value:"cardinal",children:e("settings.mermaidTab.flowchartCurveOptions.cardinal")})]})})})]})}),E.jsx(Ot,{title:e("settings.mermaidTab.sequenceCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceActorMargin",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorMarginLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorMarginTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:200,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceMessageMargin",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceMessageMarginLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceMessageMarginTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:100,step:5,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceWidth",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorWidthLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorWidthTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:100,max:300,step:10,style:{width:"100%"}})})}),E.jsx(Lr,{span:6,children:E.jsx(wt.Item,{name:"sequenceHeight",label:E.jsxs(He,{children:[e("settings.mermaidTab.sequenceActorHeightLabel"),E.jsx(wn,{title:e("settings.mermaidTab.sequenceActorHeightTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:40,max:150,step:5,style:{width:"100%"}})})})]})}),E.jsx(Ot,{title:e("settings.mermaidTab.ganttCardTitle"),style:{marginBottom:"16px"},styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsxs(gs,{gutter:16,children:[E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"ganttBarHeight",label:E.jsxs(He,{children:[e("settings.mermaidTab.ganttBarHeightLabel"),E.jsx(wn,{title:e("settings.mermaidTab.ganttBarHeightTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:10,max:50,step:5,style:{width:"100%"},addonAfter:"px"})})}),E.jsx(Lr,{span:12,children:E.jsx(wt.Item,{name:"ganttTopPadding",label:E.jsxs(He,{children:[e("settings.mermaidTab.ganttTopPaddingLabel"),E.jsx(wn,{title:e("settings.mermaidTab.ganttTopPaddingTooltip"),children:E.jsx(zi,{style:{color:t.colorTextSecondary}})})]}),children:E.jsx(ui,{min:20,max:100,step:10,style:{width:"100%"}})})})]})}),E.jsx(He,{children:E.jsx(De,{icon:E.jsx(SVe,{}),onClick:s,children:e("settings.mermaidTab.resetToDefaults")})}),E.jsx(nl,{}),E.jsx(Ot,{title:e("settings.mermaidTab.previewTitle"),styles:{header:{backgroundColor:t.colorBgElevated}},children:E.jsx(_O,{type:"secondary",children:e("settings.mermaidTab.previewDescription")})})]})]})},yrt=p.lazy(()=>Mn(()=>import("./index-BC1I7hu4.js"),__vite__mapDeps([0,1,2]),import.meta.url)),{Text:Uf}=Qt,{useToken:Srt}=pn,xrt=({promptEnhancement:e,onPromptEnhancementChange:t,mermaidEnhancementEnabled:n,taskEnhancementEnabled:r,showCopilotAskUserEnhancement:a,copilotAskUserEnhancementEnabled:i,onMermaidToggle:o,onTaskToggle:s,onCopilotAskUserToggle:l,onSaveEnhancement:c})=>{const{t:u}=br(),{token:d}=Srt(),f=d.marginLG;return E.jsxs(rt,{vertical:!0,gap:f,children:[E.jsx(Ot,{size:"small",children:E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(yrt,{})})}),E.jsx(Ot,{size:"small",children:E.jsxs(He,{direction:"vertical",size:d.marginXS,style:{width:"100%"},children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.title")}),E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.mermaidEnhancement")}),E.jsx(ba,{checked:n,onChange:o})]}),E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.taskListRules")}),E.jsx(ba,{checked:r,onChange:s})]}),a&&E.jsxs(rt,{align:"center",gap:d.marginSM,children:[E.jsx(Uf,{strong:!0,children:u("settings.promptsTab.copilotAskUserBeforeFinish")}),E.jsx(ba,{checked:i,onChange:l})]}),E.jsx(tn.TextArea,{rows:6,placeholder:u("settings.promptsTab.enhancementPlaceholder"),value:e,onChange:h=>t(h.target.value)}),E.jsx(rt,{justify:"flex-end",children:E.jsx(De,{type:"primary",onClick:c,children:u("settings.promptsTab.saveEnhancement")})}),E.jsx(Uf,{type:"secondary",style:{fontSize:d.fontSizeSM},children:u("settings.promptsTab.description")})]})}),n&&E.jsx(gl,{size:"small",items:[{key:"mermaid",label:E.jsx(Uf,{strong:!0,children:u("settings.mermaidTab.title")}),children:E.jsx(brt,{})}]})]})},{Text:Xg}=Qt,{useToken:wrt}=pn,Crt=({autoGenerateTitles:e,isUpdatingAutoTitlePreference:t,onAutoTitleToggle:n,themeMode:r,onThemeModeChange:a,onClearLocalStorage:i,onResetApp:o,isResetting:s,darkModeKey:l})=>{const{t:c}=br(),{token:u}=wrt();return E.jsx(Ot,{size:"small",children:E.jsxs(He,{direction:"vertical",size:u.marginSM,style:{width:"100%"},children:[E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(Xg,{strong:!0,children:c("settings.appTab.autoGenerateTitle")}),E.jsx(ba,{checked:e,loading:t,onChange:n})]}),E.jsx(Xg,{type:"secondary",style:{fontSize:u.fontSizeSM},children:c("settings.appTab.autoGenerateTitleDesc")}),E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(Xg,{strong:!0,children:c("settings.appTab.darkMode")}),E.jsx(ba,{"data-testid":"dark-mode-toggle",checked:r==="dark",onChange:d=>{const f=d?"dark":"light";a(f),localStorage.setItem(l,f)}})]}),E.jsx(Aw,{title:c("settings.appTab.clearLocalStorageTitle"),description:c("settings.appTab.clearLocalStorageDescription"),onConfirm:i,okText:c("settings.appTab.confirmClear"),cancelText:c("settings.appTab.cancel"),placement:"top",children:E.jsx(De,{danger:!0,block:!0,icon:E.jsx(Zh,{}),children:c("settings.appTab.clearLocalStorageButton")})}),E.jsx(nl,{style:{margin:`${u.marginSM}px 0`}}),E.jsxs(rt,{align:"center",gap:u.marginSM,children:[E.jsx(lF,{style:{color:u.colorError}}),E.jsx(Xg,{strong:!0,style:{color:u.colorError},children:c("settings.appTab.dangerZone")})]}),E.jsx(Xg,{type:"secondary",style:{fontSize:u.fontSizeSM},children:c("settings.appTab.dangerDescription")}),E.jsx(Aw,{title:c("settings.appTab.resetApplicationTitle"),description:E.jsxs("div",{children:[E.jsx("p",{children:c("settings.appTab.resetApplicationIntro")}),E.jsxs("ul",{style:{margin:0,paddingLeft:16},children:[E.jsx("li",{children:c("settings.appTab.resetStepDeleteAllSessions")}),E.jsx("li",{children:c("settings.appTab.resetStepClearStorage")}),E.jsx("li",{children:c("settings.appTab.resetStepResetConfig")}),E.jsx("li",{children:c("settings.appTab.resetStepSetupFlow")}),E.jsx("li",{children:c("settings.appTab.resetStepReload")})]})]}),onConfirm:o,okText:c("settings.appTab.resetConfirm"),cancelText:c("settings.appTab.cancel"),placement:"top",okButtonProps:{danger:!0},children:E.jsx(De,{"data-testid":"reset-to-defaults",danger:!0,block:!0,type:"primary",icon:E.jsx(xde,{}),loading:s,children:c("settings.appTab.resetButton")})})]})})},{Text:Tu}=Qt,{useToken:Ert}=pn,XG=[{value:"literal-token",labelKey:"settings.keywordMaskingTab.example.literalToken",match_type:"exact",pattern:"sk-"},{value:"github",labelKey:"settings.keywordMaskingTab.example.githubTokens",match_type:"regex",pattern:"ghp_[A-Za-z0-9]+"},{value:"aws",labelKey:"settings.keywordMaskingTab.example.awsKeys",match_type:"regex",pattern:"AKIA[0-9A-Z]{16}"},{value:"email",labelKey:"settings.keywordMaskingTab.example.emails",match_type:"regex",pattern:"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"}],_rt=(e,t,n)=>{if(!t)return{masked:e};if(n==="exact")return{masked:e.split(t).join("[MASKED]")};try{const r=new RegExp(t,"g");return{masked:e.replace(r,"[MASKED]")}}catch(r){return{masked:e,error:r instanceof Error?r.message:"Invalid regex pattern"}}},Trt=()=>{const{t:e}=br(),{token:t}=Ert(),[n,r]=p.useState([]),[a,i]=p.useState(!1),[o,s]=p.useState(null),[l,c]=p.useState(""),[u,d]=p.useState("exact"),[f,h]=p.useState(!0),[g,m]=p.useState(),[v,b]=p.useState("My token is sk-123");p.useEffect(()=>{y()},[]);const y=async()=>{try{i(!0);const M=await Vi.getInstance().getKeywordMaskingConfig();r(M.entries)}catch(I){vn.error(e("settings.keywordMaskingTab.loadFailed")),console.error(I)}finally{i(!1)}},S=async I=>{try{const M=Vi.getInstance(),$=await M.validateKeywordEntries(I);if(!$.valid&&$.errors){const A=$.errors.map(P=>`Entry ${P.index+1}: ${P.message}`).join("; ");return vn.error(`${e("settings.keywordMaskingTab.validationFailedPrefix")}: ${A}`),!1}const R=await M.updateKeywordMaskingConfig(I);return r(R.entries),vn.success(e("settings.keywordMaskingTab.saveSuccess")),!0}catch(M){return vn.error(M instanceof Error?M.message:e("settings.keywordMaskingTab.saveFailed")),!1}},C=async()=>{const I={pattern:"",match_type:"exact",enabled:!0},M=[...n,I];r(M),s(M.length-1),c(""),d("exact"),h(!0),m(void 0)},x=I=>{const M=n[I];s(I),c(M.pattern),d(M.match_type),h(M.enabled),m(void 0)},w=async()=>{if(o===null)return;if(!l.trim()){vn.error(e("settings.keywordMaskingTab.patternRequired"));return}const I=[...n];I[o]={pattern:l.trim(),match_type:u,enabled:f},await S(I)&&s(null)},_=()=>{var I;o!==null&&!((I=n[o])!=null&&I.pattern)&&r(n.filter((M,$)=>$!==o)),s(null)},T=async I=>{const M=n.filter(($,R)=>R!==I);await S(M)},k=async(I,M)=>{const $=[...n];$[I]={...$[I],enabled:M},await S($)},O=_rt(v,l,u);return E.jsx(Ot,{title:e("settings.keywordMaskingTab.title"),extra:E.jsx(De,{"data-testid":"add-keyword",type:"primary",icon:E.jsx(Xp,{}),onClick:C,loading:a,children:e("settings.keywordMaskingTab.addKeyword")}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"large",children:[E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.description")}),E.jsx(jr,{loading:a,dataSource:n,locale:{emptyText:e("settings.keywordMaskingTab.empty")},renderItem:(I,M)=>E.jsx(jr.Item,{style:{backgroundColor:t.colorFillAlter,marginBottom:8,borderRadius:t.borderRadius,padding:12},actions:o===M?[E.jsx(De,{"data-testid":"save-keyword",type:"primary",icon:E.jsx(jE,{}),onClick:w},"save"),E.jsx(De,{onClick:_,children:e("settings.keywordMaskingTab.cancel")},"cancel")]:[E.jsx(De,{icon:E.jsx(NE,{}),onClick:()=>x(M)},"edit"),E.jsx(De,{"data-testid":`delete-keyword-${M}`,danger:!0,icon:E.jsx(Zh,{}),onClick:()=>T(M)},"delete")],children:E.jsx(rt,{vertical:!0,style:{width:"100%"},gap:8,children:o===M?E.jsxs(E.Fragment,{children:[E.jsx(tn,{"data-testid":"keyword-pattern-input",placeholder:e("settings.keywordMaskingTab.patternPlaceholder"),value:l,onChange:$=>c($.target.value),autoFocus:!0}),E.jsxs(rt,{gap:8,align:"center",wrap:"wrap",children:[E.jsx(Jn,{"data-testid":"keyword-examples-select","aria-label":e("settings.keywordMaskingTab.examples"),placeholder:e("settings.keywordMaskingTab.examples"),value:g,onChange:$=>{m($);const R=XG.find(A=>A.value===$);R&&(c(R.pattern),d(R.match_type))},options:XG.map($=>({value:$.value,label:e($.labelKey)})),style:{minWidth:220}}),E.jsx(Jn,{value:u,onChange:d,options:[{value:"exact",label:e("settings.keywordMaskingTab.exactMatch")},{value:"regex",label:e("settings.keywordMaskingTab.regexPattern")}],style:{width:150}}),E.jsx(ba,{checked:f,onChange:h})]}),E.jsxs(rt,{vertical:!0,gap:6,children:[E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.sampleText")}),E.jsx(tn,{placeholder:e("settings.keywordMaskingTab.sampleTextPlaceholder"),value:v,onChange:$=>b($.target.value)}),E.jsx(Tu,{type:"secondary",children:e("settings.keywordMaskingTab.maskedPreview")}),E.jsx(tn,{readOnly:!0,value:O.masked,status:O.error?"error":void 0}),O.error&&E.jsx(Tu,{type:"danger",children:O.error})]})]}):E.jsxs(rt,{justify:"space-between",align:"center",children:[E.jsxs(rt,{vertical:!0,gap:4,children:[E.jsx(Tu,{strong:!0,children:I.pattern||e("settings.keywordMaskingTab.emptyPattern")}),E.jsxs(rt,{gap:8,children:[E.jsx(Tu,{type:"secondary",style:{fontSize:12},children:I.match_type==="regex"?e("settings.keywordMaskingTab.regexPattern"):e("settings.keywordMaskingTab.exactMatch")}),!I.enabled&&E.jsx(Tu,{type:"warning",style:{fontSize:12},children:e("settings.keywordMaskingTab.disabled")})]})]}),E.jsx(ba,{checked:I.enabled,onChange:$=>k(M,$),size:"small"})]})})})})]})})},Yu=class Yu{constructor(){}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}async listWorkflows(){try{console.log("[WorkflowManagerService] Listing workflows");const t=await Bn.get("bamboo/workflows"),n=Array.isArray(t)?t:[];return console.log("[WorkflowManagerService] Listed workflows:",n),n.map(r=>({name:String(r.name||""),filename:String(r.filename||(r.name||"workflow")+".md"),size:Number(r.size||0),modified_at:r.modified_at,source:"global"}))}catch(t){throw console.error("[WorkflowManagerService] Failed to list workflows:",t),t}}async getWorkflow(t){try{console.log("[WorkflowManagerService] Getting workflow: "+t);const n=await Bn.get("bamboo/workflows/"+encodeURIComponent(t)),r=n!=null&&n.name?String(n.name):t,a={name:r,filename:String((n==null?void 0:n.filename)||r+".md"),size:Number((n==null?void 0:n.size)||0),modified_at:n==null?void 0:n.modified_at,source:"global"};return console.log("[WorkflowManagerService] Got workflow:",n),{name:r,content:String((n==null?void 0:n.content)||""),metadata:a}}catch(n){throw console.error("[WorkflowManagerService] Failed to get workflow "+t+":",n),aGe(n)&&n.status===404?new Error("Workflow '"+t+"' not found"):n instanceof Error&&n.message.includes("404")?new Error("Workflow '"+t+"' not found"):n}}};Bt(Yu,"instance");let FN=Yu;const{Text:TO}=Qt,{TextArea:krt}=tn,{useToken:Ort}=pn,$rt=e=>!(!e||e.includes("/")||e.includes("\\")||e.includes("..")),Irt=()=>{const{t:e}=br(),{token:t}=Ort(),[n,r]=vn.useMessage(),[a,i]=p.useState([]),[o,s]=p.useState(!1),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(null),[g,m]=p.useState(""),[v,b]=p.useState(""),[y,S]=p.useState(!1),C=p.useMemo(()=>FN.getInstance(),[]),x=p.useCallback(async()=>{s(!0);try{const O=await C.listWorkflows();return i(O),O}catch{return n.error(e("settings.workflowsTab.loadFailed")),[]}finally{s(!1)}},[n,C]);p.useEffect(()=>{x()},[x]);const w=p.useCallback(async O=>{h(O),m(O.name),S(!1),c(!0);try{const I=await C.getWorkflow(O.name);b(I.content??"")}catch{n.error(e("settings.workflowsTab.loadContentFailed")),b("")}finally{c(!1)}},[n,C]),_=()=>{h(null),m(""),b(""),S(!1)},T=p.useCallback(async()=>{if(!$rt(g)){n.error(e("settings.workflowsTab.invalidName"));return}const O=a.some(I=>I.name===g);if(!f&&O){n.error(e("settings.workflowsTab.nameAlreadyExists"));return}d(!0);try{await Vi.getInstance().saveWorkflow(g,v),n.success(e("settings.workflowsTab.saved")),S(!1);const $=(await x()).find(R=>R.name===g);$&&h($)}catch(I){n.error(I instanceof Error?I.message:e("settings.workflowsTab.saveFailed"))}finally{d(!1)}},[v,g,x,n,f,e,a]),k=p.useCallback(async O=>{try{await Vi.getInstance().deleteWorkflow(O.name),n.success(e("settings.workflowsTab.deleted")),(f==null?void 0:f.name)===O.name&&_(),await x()}catch(I){n.error(I instanceof Error?I.message:e("settings.workflowsTab.deleteFailed"))}},[x,n,f,e]);return E.jsxs("div",{style:{padding:"24px"},children:[r,E.jsxs(Ot,{title:e("settings.workflowsTab.title"),extra:E.jsxs(He,{children:[E.jsx(De,{icon:E.jsx(Zl,{}),onClick:x,loading:o,children:e("settings.workflowsTab.refresh")}),E.jsx(De,{"data-testid":"create-workflow",icon:E.jsx(Xp,{}),onClick:_,children:e("settings.workflowsTab.newWorkflow")}),E.jsx(De,{"data-testid":"save-workflow",type:"primary",icon:E.jsx(jE,{}),onClick:T,loading:u,disabled:!y,children:e("settings.workflowsTab.save")})]}),children:[E.jsx(TO,{type:"secondary",children:e("settings.workflowsTab.description")}),E.jsxs(rt,{gap:t.marginLG,style:{marginTop:t.marginLG},children:[E.jsx("div",{style:{width:320,flexShrink:0},children:E.jsx(jr,{loading:o,dataSource:a,locale:{emptyText:e("settings.workflowsTab.empty")},renderItem:O=>E.jsx(jr.Item,{style:{cursor:"pointer",backgroundColor:(f==null?void 0:f.name)===O.name?t.colorFillSecondary:"transparent",borderRadius:t.borderRadius,padding:t.paddingSM},onClick:()=>w(O),actions:[E.jsx(De,{"data-testid":`delete-workflow-${O.name}`,type:"text",danger:!0,size:"small",icon:E.jsx(Zh,{}),onClick:I=>{I.stopPropagation(),k(O)}},"delete")],children:E.jsxs(He,{direction:"vertical",size:0,children:[E.jsxs(TO,{strong:!0,children:["/",O.name]}),E.jsx(TO,{type:"secondary",style:{fontSize:12},children:O.filename})]})})})}),E.jsx("div",{style:{flex:1},children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsx(tn,{"data-testid":"workflow-name",placeholder:e("settings.workflowsTab.namePlaceholder"),value:g,onChange:O=>{m(O.target.value),S(!0)},disabled:!!f,prefix:E.jsx(NE,{})}),E.jsx(krt,{"data-testid":"workflow-content",placeholder:e("settings.workflowsTab.contentPlaceholder"),value:v,onChange:O=>{b(O.target.value),S(!0)},autoSize:{minRows:12},disabled:l})]})})]})]})]})};var Ln=(e=>(e.Connecting="connecting",e.Ready="ready",e.Degraded="degraded",e.Stopped="stopped",e.Error="error",e))(Ln||{});const p0=6e4,h0=3e4,Vb=2e4,Zw=1e4,s_=e=>({id:e,enabled:!0,transport:{type:"stdio",command:"",args:[],env:{},startup_timeout_ms:Vb},request_timeout_ms:p0,healthcheck_interval_ms:h0,allowed_tools:[],denied_tools:[]}),Art=()=>({status:"stopped",tool_count:0,restart_count:0}),Rrt=e=>{switch(typeof e=="string"?e.trim().toLowerCase():""){case Ln.Connecting:return Ln.Connecting;case Ln.Ready:return Ln.Ready;case Ln.Degraded:return Ln.Degraded;case Ln.Error:return Ln.Error;case Ln.Stopped:default:return Ln.Stopped}},Ll=(e,t)=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Number(e);if(Number.isFinite(n))return n}return t},Mrt=(e,t)=>{if(!e||typeof e!="object")return t;const n=e;if(n.type==="sse"){const i=Array.isArray(n.headers)?n.headers.map(o=>{if(!o||typeof o!="object")return null;const s=o;return typeof s.name!="string"||typeof s.value!="string"?null:{name:s.name,value:s.value}}).filter(o=>!!o):[];return{type:"sse",url:typeof n.url=="string"?n.url:"",headers:i,connect_timeout_ms:Ll(n.connect_timeout_ms,Zw)}}const r=Array.isArray(n.args)?n.args.filter(i=>typeof i=="string"):[],a=n.env&&typeof n.env=="object"?Object.entries(n.env):[];return{type:"stdio",command:typeof n.command=="string"?n.command:"",args:r,cwd:typeof n.cwd=="string"?n.cwd:void 0,env:a.reduce((i,[o,s])=>(typeof s=="string"&&(i[o]=s),i),{}),startup_timeout_ms:Ll(n.startup_timeout_ms,Vb)}},Prt=(e,t)=>{const n=s_(e.id),r=t??{};return{...n,...r,id:e.id,name:typeof r.name=="string"?r.name:typeof e.name=="string"?e.name:void 0,enabled:typeof e.enabled=="boolean"?e.enabled:typeof r.enabled=="boolean"?r.enabled:!0,request_timeout_ms:Ll(r.request_timeout_ms,p0),healthcheck_interval_ms:Ll(r.healthcheck_interval_ms,h0),allowed_tools:Array.isArray(r.allowed_tools)?r.allowed_tools.filter(i=>typeof i=="string"):[],denied_tools:Array.isArray(r.denied_tools)?r.denied_tools.filter(i=>typeof i=="string"):[],reconnect:r.reconnect&&typeof r.reconnect=="object"?{enabled:typeof r.reconnect.enabled=="boolean"?r.reconnect.enabled:!0,initial_backoff_ms:Ll(r.reconnect.initial_backoff_ms,1e3),max_backoff_ms:Ll(r.reconnect.max_backoff_ms,3e4),max_attempts:Ll(r.reconnect.max_attempts,0)}:void 0,transport:Mrt(r.transport,n.transport)}},Nrt=e=>{const t=Art(),r=e.runtime??{},a=r.status??e.status;return{status:Rrt(a),last_error:typeof r.last_error=="string"?r.last_error:typeof e.last_error=="string"?e.last_error:void 0,connected_at:typeof r.connected_at=="string"?r.connected_at:void 0,disconnected_at:typeof r.disconnected_at=="string"?r.disconnected_at:void 0,tool_count:Ll(r.tool_count??e.tool_count,t.tool_count),restart_count:Ll(r.restart_count??e.restart_count,t.restart_count),last_ping_at:typeof r.last_ping_at=="string"?r.last_ping_at:void 0}},Lrt=e=>{const t=Prt(e,e.config);return{id:e.id,name:typeof e.name=="string"?e.name:typeof t.name=="string"?t.name:e.id,enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,config:t,runtime:Nrt(e)}},Drt=(e,t)=>`mcp__${e}__${t}`,jrt=e=>{if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");if(n<=0)return null;const r=t.slice(0,n),a=t.slice(n+2);return!r||!a?null:{server_id:r,original_name:a}},Brt=(e,t,n=0)=>{if(!e||typeof e!="object")return null;const r=e,a=typeof r.alias=="string"?r.alias:typeof r.name=="string"&&r.name.startsWith("mcp__")?r.name:void 0,i=a&&typeof a=="string"?jrt(a):null,o=(typeof r.server_id=="string"?r.server_id:void 0)??(typeof r.serverId=="string"?r.serverId:void 0)??(i==null?void 0:i.server_id)??t??"",s=(typeof r.original_name=="string"?r.original_name:void 0)??(typeof r.originalName=="string"?r.originalName:void 0)??(i==null?void 0:i.original_name)??(typeof r.name=="string"?r.name:void 0)??"",l=a??(o&&s?Drt(o,s):""),c=typeof r.description=="string"?r.description:"",u="parameters"in r?r.parameters:"inputSchema"in r?r.inputSchema:"input_schema"in r?r.input_schema:void 0,d=l||s||`mcp_tool_${n}`;return{alias:d,server_id:o||"unknown",original_name:s||d,description:c,parameters:u}};class Frt{async getServers(){const t=await fn.get("mcp/servers");return Array.isArray(t.servers)?t.servers.map(Lrt):[]}async addServer(t){return fn.post("mcp/servers",t)}async updateServer(t,n){const r={...n,id:t};return fn.put(`mcp/servers/${t}`,r)}async deleteServer(t){return fn.delete(`mcp/servers/${t}`)}async connectServer(t){return fn.post(`mcp/servers/${t}/connect`)}async disconnectServer(t){return fn.post(`mcp/servers/${t}/disconnect`)}async refreshTools(t){return fn.post(`mcp/servers/${t}/refresh`)}async getTools(t){const n=t?`mcp/servers/${t}/tools`:"mcp/tools",r=await fn.get(n);return(Array.isArray(r.tools)?r.tools:[]).map((i,o)=>Brt(i,t,o)).filter(i=>!!i)}async importServers(t){return fn.post("mcp/servers/import",t)}}const Dhe=new Frt,zrt=5e3,El=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,ZG=(e,t)=>`${e}:${t}`,Hrt=(e={})=>{const{service:t=Dhe,autoRefreshMs:n=zrt,autoRefreshEnabled:r=!0}=e,[a,i]=p.useState([]),[o,s]=p.useState(null),[l,c]=p.useState({}),[u,d]=p.useState({}),[f,h]=p.useState({}),[g,m]=p.useState(!1),[v,b]=p.useState(!1),[y,S]=p.useState(!1),[C,x]=p.useState(null),w=p.useRef({}),_=p.useCallback(F=>{const B=new Set(F.map(G=>G.id)),z=F.map(G=>{const Z=w.current[G.id]??G.config,q={...Z,id:G.id,name:Z.name??G.name};return w.current[G.id]=q,{...G,name:G.name||q.name||G.id,enabled:G.enabled??q.enabled,config:q}});return Object.keys(w.current).forEach(G=>{B.has(G)||delete w.current[G]}),z},[]),T=p.useCallback(async({silent:F=!1}={})=>{F||m(!0);try{const B=await t.getServers(),z=_(B);i(z),s(G=>{var X;return G&&z.some(Z=>Z.id===G)?G:((X=z[0])==null?void 0:X.id)??null}),x(null)}catch(B){throw x(El(B,"Failed to load MCP servers")),B}finally{F||m(!1)}},[_,t]),k=p.useCallback(async(F,B=!1)=>{if(!F)return[];if(!B&&l[F])return l[F];d(z=>({...z,[F]:!0}));try{const z=await t.getTools(F);return c(G=>({...G,[F]:z})),x(null),z}catch(z){throw x(El(z,"Failed to load MCP tools")),z}finally{d(z=>({...z,[F]:!1}))}},[t,l]),O=p.useCallback((F,B,z)=>{const G=ZG(F,B);h(X=>({...X,[G]:z}))},[]),I=p.useCallback(async F=>{b(!0);try{await t.addServer(F),w.current[F.id]=F,await T()}catch(B){throw x(El(B,"Failed to add MCP server")),B}finally{b(!1)}},[T,t]),M=p.useCallback(async(F,B)=>{b(!0);try{const z={...B,id:F};await t.updateServer(F,z),w.current[F]=z,await T()}catch(z){throw x(El(z,"Failed to update MCP server")),z}finally{b(!1)}},[T,t]),$=p.useCallback(async F=>{O(F,"delete",!0);try{await t.deleteServer(F),c(B=>{const z={...B};return delete z[F],z}),delete w.current[F],await T()}catch(B){throw x(El(B,"Failed to delete MCP server")),B}finally{O(F,"delete",!1)}},[T,t,O]),R=p.useCallback(async F=>{O(F,"connect",!0);try{await t.connectServer(F),await T({silent:!0})}catch(B){throw x(El(B,"Failed to connect MCP server")),B}finally{O(F,"connect",!1)}},[T,t,O]),A=p.useCallback(async F=>{O(F,"disconnect",!0);try{await t.disconnectServer(F),await T({silent:!0})}catch(B){throw x(El(B,"Failed to disconnect MCP server")),B}finally{O(F,"disconnect",!1)}},[T,t,O]),P=p.useCallback(async F=>{O(F,"refresh",!0);try{await t.refreshTools(F),await k(F,!0),await T({silent:!0})}catch(B){throw x(El(B,"Failed to refresh MCP tools")),B}finally{O(F,"refresh",!1)}},[k,T,t,O]),N=p.useCallback(async()=>{S(!0);try{const F=a.map(B=>B.id);await Promise.all(F.map(async B=>{try{await t.refreshTools(B)}catch{}})),await T(),o&&await k(o,!0)}catch(F){throw x(El(F,"Failed to refresh MCP status")),F}finally{S(!1)}},[k,T,o,a,t]),L=p.useCallback(F=>{s(F)},[]),j=p.useCallback((F,B)=>!!f[ZG(F,B)],[f]),D=p.useMemo(()=>o?l[o]??[]:[],[o,l]),H=p.useMemo(()=>o?!!u[o]:!1,[o,u]);return p.useEffect(()=>{T().catch(()=>{})},[T]),p.useEffect(()=>{if(!r||n<=0)return;const F=window.setInterval(()=>{T({silent:!0}).catch(()=>{})},n);return()=>{window.clearInterval(F)}},[r,n,T]),p.useEffect(()=>{o&&k(o).catch(()=>{})},[k,o]),{servers:a,selectedServerId:o,selectedServerTools:D,isLoadingServers:g,isMutatingConfig:v,isRefreshingAll:y,isSelectedServerToolsLoading:H,error:C,setSelectedServerId:L,refreshServers:T,addServer:I,updateServer:M,deleteServer:$,connectServer:R,disconnectServer:A,refreshServerTools:P,refreshAll:N,isServerActionLoading:j}},Urt={[Ln.Connecting]:"blue",[Ln.Ready]:"green",[Ln.Degraded]:"orange",[Ln.Stopped]:"default",[Ln.Error]:"red"},Wrt=e=>e===Ln.Connecting||e===Ln.Ready||e===Ln.Degraded,qrt=({servers:e,loading:t=!1,selectedServerId:n,onSelectServer:r,onEditServer:a,onDeleteServer:i,onConnectServer:o,onDisconnectServer:s,onRefreshTools:l,isServerActionLoading:c})=>{const{t:u}=br(),{token:d}=pn.useToken(),f=p.useMemo(()=>[{key:"name",title:u("settings.mcpServerTable.columns.name"),render:(h,g)=>g.name||g.id},{key:"transport",title:u("settings.mcpServerTable.columns.transportType"),render:(h,g)=>g.config.transport.type==="sse"?u("settings.mcpServerTable.transportOptions.sse"):u("settings.mcpServerTable.transportOptions.stdio"),width:140},{key:"status",title:u("settings.mcpServerTable.columns.status"),render:(h,g)=>{var b;const m=((b=g.runtime)==null?void 0:b.status)??Ln.Stopped,v={[Ln.Connecting]:u("settings.mcpTab.status.connecting"),[Ln.Ready]:u("settings.mcpTab.status.ready"),[Ln.Degraded]:u("settings.mcpTab.status.degraded"),[Ln.Stopped]:u("settings.mcpTab.status.stopped"),[Ln.Error]:u("settings.mcpTab.status.error")};return E.jsx(Dn,{color:Urt[m],style:{marginInlineEnd:0},children:v[m]})},width:120},{key:"toolCount",title:u("settings.mcpServerTable.columns.toolCount"),render:(h,g)=>{var m;return((m=g.runtime)==null?void 0:m.tool_count)??0},width:100},{key:"actions",title:u("settings.mcpServerTable.columns.actions"),width:360,render:(h,g)=>{var b;const m=((b=g.runtime)==null?void 0:b.status)??Ln.Stopped,v=Wrt(m);return E.jsxs(He,{size:d.marginXS,children:[E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),a==null||a(g)},children:u("settings.mcpServerTable.actions.edit")}),E.jsx(Aw,{title:u("settings.mcpServerTable.deleteTitle"),description:u("settings.mcpServerTable.deleteDescription",{name:g.name||g.id}),onConfirm:()=>i==null?void 0:i(g),okText:u("settings.mcpServerTable.actions.delete"),okButtonProps:{danger:!0,loading:c==null?void 0:c(g.id,"delete")},children:E.jsx(De,{size:"small",danger:!0,loading:c==null?void 0:c(g.id,"delete"),onClick:y=>y.stopPropagation(),children:u("settings.mcpServerTable.actions.delete")})}),v?E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),s==null||s(g)},loading:c==null?void 0:c(g.id,"disconnect"),children:u("settings.mcpServerTable.actions.disconnect")}):E.jsx(De,{size:"small",type:"primary",ghost:!0,onClick:y=>{y.stopPropagation(),o==null||o(g)},loading:c==null?void 0:c(g.id,"connect"),children:u("settings.mcpServerTable.actions.connect")}),E.jsx(De,{size:"small",onClick:y=>{y.stopPropagation(),l==null||l(g)},loading:c==null?void 0:c(g.id,"refresh"),children:u("settings.mcpServerTable.actions.refreshTools")})]})}}],[c,o,i,s,a,l,u,d.marginXS]);return E.jsx(Bi,{rowKey:"id",columns:f,dataSource:e,loading:t,pagination:!1,locale:{emptyText:u("settings.mcpServerTable.empty")},onRow:h=>({onClick:()=>r==null?void 0:r(h.id),style:{cursor:r?"pointer":"default",backgroundColor:n===h.id?d.colorFillSecondary:void 0}})})},{Text:QG}=Qt,{TextArea:Vrt}=tn,JG=e=>{const t=e??s_(""),n=t.transport,r=n.type==="stdio"?Object.entries(n.env??{}).map(([i,o])=>({key:i,value:o})):[],a=n.type==="sse"?n.headers.map(i=>({name:i.name,value:i.value})):[];return{id:t.id,name:t.name,enabled:t.enabled,transportType:n.type,command:n.type==="stdio"?n.command:void 0,args:n.type==="stdio"?n.args:[],envEntries:r,url:n.type==="sse"?n.url:void 0,headerEntries:a,requestTimeoutMs:t.request_timeout_ms||p0,healthcheckIntervalMs:t.healthcheck_interval_ms||h0,allowedTools:t.allowed_tools||[],deniedTools:t.denied_tools||[]}},Grt=e=>e.reduce((t,n)=>{var a;const r=(a=n.key)==null?void 0:a.trim();return r&&(t[r]=n.value??""),t},{}),Krt=e=>e.filter(t=>{var n;return(n=t.name)==null?void 0:n.trim()}).map(t=>{var n;return{name:((n=t.name)==null?void 0:n.trim())||"",value:t.value??""}}),eK=(e,t,n)=>{var u,d,f;const r=t==="edit"&&(n==null?void 0:n.id)||e.id,a=(u=e.name)==null?void 0:u.trim(),i=typeof e.requestTimeoutMs=="number"?e.requestTimeoutMs:(n==null?void 0:n.request_timeout_ms)??p0,o=typeof e.healthcheckIntervalMs=="number"?e.healthcheckIntervalMs:(n==null?void 0:n.healthcheck_interval_ms)??h0,s=Array.isArray(e.allowedTools)?e.allowedTools:(n==null?void 0:n.allowed_tools)??[],l=Array.isArray(e.deniedTools)?e.deniedTools:(n==null?void 0:n.denied_tools)??[],c=e.transportType==="sse"?{type:"sse",url:((d=e.url)==null?void 0:d.trim())||"",headers:Krt(e.headerEntries||[]),connect_timeout_ms:(n==null?void 0:n.transport.type)==="sse"?n.transport.connect_timeout_ms??Zw:Zw}:{type:"stdio",command:((f=e.command)==null?void 0:f.trim())||"",args:e.args||[],env:Grt(e.envEntries||[]),cwd:(n==null?void 0:n.transport.type)==="stdio"?n.transport.cwd:void 0,startup_timeout_ms:(n==null?void 0:n.transport.type)==="stdio"?n.transport.startup_timeout_ms??Vb:Vb};return{id:r,name:a||void 0,enabled:e.enabled,transport:c,request_timeout_ms:i,healthcheck_interval_ms:o,allowed_tools:s,denied_tools:l,reconnect:n==null?void 0:n.reconnect}},tK=e=>JSON.stringify(e||s_(""),null,2),kO=(e,t)=>{try{const n=JSON.parse(e);if(!n||typeof n!="object")return{valid:!1,error:t("settings.mcpServerForm.jsonMustBeObject")};const r=n;if(r.mcpServers&&typeof r.mcpServers=="object")return{valid:!1,error:t("settings.mcpServerForm.detectedBulkConfig")};const a=typeof r.id=="string"?r.id:"";if(!a.trim())return{valid:!1,error:t("settings.mcpServerForm.missingIdField")};if(r.transport&&typeof r.transport=="object"){const d=r;return!d.transport||typeof d.transport!="object"?{valid:!1,error:t("settings.mcpServerForm.missingTransportField")}:{valid:!0,config:d}}const i=typeof r.enabled=="boolean"?r.enabled:typeof r.disabled=="boolean"?!r.disabled:!0,o=typeof r.request_timeout_ms=="number"?r.request_timeout_ms:p0,s=typeof r.healthcheck_interval_ms=="number"?r.healthcheck_interval_ms:h0,l=Array.isArray(r.allowed_tools)?r.allowed_tools.filter(d=>typeof d=="string"):[],c=Array.isArray(r.denied_tools)?r.denied_tools.filter(d=>typeof d=="string"):[],u=typeof r.name=="string"?r.name:void 0;if(typeof r.url=="string"){const d=r.headers,f=Array.isArray(d)?d.map(g=>{if(!g||typeof g!="object")return null;const m=g,v=typeof m.name=="string"?m.name:"",b=typeof m.value=="string"?m.value:"";return v.trim()?{name:v,value:b}:null}).filter(g=>!!g):d&&typeof d=="object"?Object.entries(d).filter(([g])=>g.trim()).map(([g,m])=>({name:g,value:typeof m=="string"?m:""})):[],h=typeof r.connect_timeout_ms=="number"?r.connect_timeout_ms:Zw;return{valid:!0,config:{id:a,name:u,enabled:i,transport:{type:"sse",url:r.url,headers:f,connect_timeout_ms:h},request_timeout_ms:o,healthcheck_interval_ms:s,allowed_tools:l,denied_tools:c,reconnect:void 0}}}if(typeof r.command=="string"){const d=Array.isArray(r.args)?r.args.filter(m=>typeof m=="string"):[],f=r.env,h=f&&typeof f=="object"?Object.entries(f).reduce((m,[v,b])=>(typeof b=="string"&&(m[v]=b),m),{}):{},g=typeof r.startup_timeout_ms=="number"?r.startup_timeout_ms:Vb;return{valid:!0,config:{id:a,name:u,enabled:i,transport:{type:"stdio",command:r.command,args:d,cwd:typeof r.cwd=="string"?r.cwd:void 0,env:h,startup_timeout_ms:g},request_timeout_ms:o,healthcheck_interval_ms:s,allowed_tools:l,denied_tools:c,reconnect:void 0}}}return{valid:!1,error:t("settings.mcpServerForm.missingTransportInfo")}}catch(n){return{valid:!1,error:t("settings.mcpServerForm.invalidJson",{message:n instanceof Error?n.message:t("settings.mcpServerForm.unknownError")})}}},Yrt=({open:e,mode:t,initialConfig:n,confirmLoading:r=!1,onCancel:a,onSubmit:i})=>{const{t:o}=br(),[s]=wt.useForm(),[l,c]=p.useState("form"),[u,d]=p.useState(""),[f,h]=p.useState(null),g=p.useMemo(()=>JG(n),[n]),m=wt.useWatch("transportType",s)??"stdio";p.useEffect(()=>{e&&(s.setFieldsValue(g),d(tK(n)),h(null),c("form"))},[s,g,n,e]);const v=()=>{s.resetFields(),d(""),h(null),a()},b=async()=>{if(l==="json"){const C=kO(u,o);if(!C.valid){h(C.error);return}h(null);try{await i(C.config),d("")}catch(x){console.error("MCP server JSON submission error:",x)}return}try{const C=await s.validateFields(),x=eK(C,t,n);await i(x),s.resetFields()}catch(C){console.error("MCP server form submission error:",C)}},y=C=>{d(C),f&&kO(C,o).valid&&h(null)},S=C=>{if(C==="json")try{const x=s.getFieldsValue(),w=eK(x,t,n);d(JSON.stringify(w,null,2))}catch{d(tK(n))}else{const x=kO(u,o);x.valid&&s.setFieldsValue(JG(x.config))}c(C),h(null)};return E.jsxs(qr,{title:o(t==="edit"?"settings.mcpServerForm.editTitle":"settings.mcpServerForm.addTitle"),open:e,onCancel:v,onOk:()=>{b()},okText:o("settings.mcpServerForm.save"),destroyOnClose:!0,confirmLoading:r,width:720,children:[E.jsx("div",{style:{marginBottom:16},children:E.jsxs(Xa.Group,{value:l,onChange:C=>S(C.target.value),optionType:"button",buttonStyle:"solid",children:[E.jsxs(Xa.Button,{value:"form",children:[E.jsx(V7e,{})," ",o("settings.mcpServerForm.modeForm")]}),E.jsxs(Xa.Button,{value:"json",children:[E.jsx(_7e,{})," ",o("settings.mcpServerForm.modeJson")]})]})}),l==="json"&&f&&E.jsx(fr,{type:"error",message:o("settings.mcpServerForm.jsonError"),description:f,showIcon:!0,style:{marginBottom:16},closable:!0,onClose:()=>h(null)}),l==="json"?E.jsx(Vrt,{value:u,onChange:C=>y(C.target.value),rows:20,style:{fontFamily:"monospace",fontSize:13},placeholder:JSON.stringify(s_("example-server"),null,2)}):E.jsxs(wt,{layout:"vertical",form:s,preserve:!0,initialValues:g,children:[E.jsx(wt.Item,{name:"id",label:o("settings.mcpServerForm.serverId"),rules:[{required:!0,message:o("settings.mcpServerForm.serverIdRequired")},{pattern:/^[a-zA-Z0-9_-]+$/,message:o("settings.mcpServerForm.serverIdPatternError")}],children:E.jsx(tn,{placeholder:"filesystem",disabled:t==="edit",autoComplete:"off"})}),E.jsx(wt.Item,{name:"name",label:o("settings.mcpServerForm.displayName"),children:E.jsx(tn,{placeholder:"Filesystem MCP",autoComplete:"off"})}),E.jsx(wt.Item,{name:"enabled",label:o("settings.mcpServerForm.enabled"),valuePropName:"checked",extra:o("settings.mcpServerForm.enabledHelp"),children:E.jsx(ba,{})}),E.jsx(wt.Item,{name:"transportType",label:o("settings.mcpServerForm.transportType"),rules:[{required:!0,message:o("settings.mcpServerForm.transportTypeRequired")}],children:E.jsx(Jn,{options:[{label:o("settings.mcpServerForm.transportOptions.stdio"),value:"stdio"},{label:o("settings.mcpServerForm.transportOptions.sse"),value:"sse"}]})}),m==="stdio"?E.jsxs(E.Fragment,{children:[E.jsx(wt.Item,{name:"command",label:o("settings.mcpServerForm.command"),rules:[{required:!0,message:o("settings.mcpServerForm.commandRequired")}],children:E.jsx(tn,{placeholder:"npx",autoComplete:"off"})}),E.jsx(wt.Item,{name:"args",label:o("settings.mcpServerForm.arguments"),children:E.jsx(Jn,{mode:"tags",tokenSeparators:[","],placeholder:o("settings.mcpServerForm.argumentsPlaceholder"),open:!1})}),E.jsx(wt.List,{name:"envEntries",children:(C,{add:x,remove:w})=>E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsxs(He,{align:"center",style:{justifyContent:"space-between",width:"100%"},children:[E.jsx(QG,{strong:!0,children:o("settings.mcpServerForm.envVars")}),E.jsx(De,{icon:E.jsx(Xp,{}),onClick:()=>x({key:"",value:""}),type:"dashed",children:o("settings.mcpServerForm.addEnv")})]}),C.map(_=>E.jsxs(He,{align:"baseline",style:{display:"flex"},children:[E.jsx(wt.Item,{..._,name:[_.name,"key"],rules:[{required:!0,message:o("settings.mcpServerForm.keyRequired")}],children:E.jsx(tn,{placeholder:"MCP_ROOT",autoComplete:"off"})}),E.jsx(wt.Item,{..._,name:[_.name,"value"],children:E.jsx(tn,{placeholder:"/Users/me/workspace",autoComplete:"off"})}),E.jsx(De,{danger:!0,type:"text",icon:E.jsx(jP,{}),onClick:()=>w(_.name)})]},_.key))]})})]}):E.jsxs(E.Fragment,{children:[E.jsx(wt.Item,{name:"url",label:o("settings.mcpServerForm.sseUrl"),rules:[{required:!0,message:o("settings.mcpServerForm.sseUrlRequired")},{validator:async(C,x)=>{if(x)try{new URL(x)}catch{throw new Error(o("settings.mcpServerForm.validUrlRequired"))}}}],children:E.jsx(tn,{placeholder:"http://localhost:4000/sse",autoComplete:"off"})}),E.jsx(wt.List,{name:"headerEntries",children:(C,{add:x,remove:w})=>E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsxs(He,{align:"center",style:{justifyContent:"space-between",width:"100%"},children:[E.jsx(QG,{strong:!0,children:o("settings.mcpServerForm.headers")}),E.jsx(De,{icon:E.jsx(Xp,{}),onClick:()=>x({name:"",value:""}),type:"dashed",children:o("settings.mcpServerForm.addHeader")})]}),C.map(_=>E.jsxs(He,{align:"baseline",style:{display:"flex"},children:[E.jsx(wt.Item,{..._,name:[_.name,"name"],rules:[{required:!0,message:o("settings.mcpServerForm.headerNameRequired")}],children:E.jsx(tn,{placeholder:"Authorization",autoComplete:"off"})}),E.jsx(wt.Item,{..._,name:[_.name,"value"],children:E.jsx(tn,{placeholder:"Bearer token",autoComplete:"off"})}),E.jsx(De,{danger:!0,type:"text",icon:E.jsx(jP,{}),onClick:()=>w(_.name)})]},_.key))]})})]})]})]})},Xrt={maxLines:8,maxCharacters:500},OO=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Sc=e=>typeof e=="string"?e:void 0,Zg=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,nK=e=>typeof e=="boolean"?e:void 0,g0=e=>{if(!e)return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);if(!OO(n))return null;const r=Sc(n.file_path),a=Sc(n.operation),i=n.diff;if(!r||!a||!OO(i))return null;const o=Sc(i.unified);if(!o)return null;const s=n.checkpoint,l=OO(s)?{created:nK(s.created)??!1,id:Sc(s.id),path:Sc(s.path),size_bytes:Zg(s.size_bytes),reason:Sc(s.reason)}:void 0;return{operation:a,message:Sc(n.message),file_path:r,workspace:Sc(n.workspace),checkpoint:l,diff:{unified:o,old_line_count:Zg(i.old_line_count),new_line_count:Zg(i.new_line_count),added_lines:Zg(i.added_lines),removed_lines:Zg(i.removed_lines),truncated:nK(i.truncated)}}}catch{return null}},zN=e=>e.startsWith("-")&&!e.startsWith("---"),HN=e=>e.startsWith("+")&&!e.startsWith("+++"),jhe=e=>{const t=e.split(`
|
|
638
638
|
`),n=[];let r=0;for(;r<t.length;){const a=t[r]??"";if(a.startsWith("--- ")||a.startsWith("+++ ")){n.push({kind:"meta",text:a}),r+=1;continue}if(a.startsWith("@@")){n.push({kind:"hunk",text:a}),r+=1;continue}if(zN(a)){const i=[];for(;r<t.length&&zN(t[r]??"");)i.push(t[r]??""),r+=1;const o=[];for(;r<t.length&&HN(t[r]??"");)o.push(t[r]??""),r+=1;o.length>0?(i.forEach(s=>n.push({kind:"modified_remove",text:s})),o.forEach(s=>n.push({kind:"modified_add",text:s}))):i.forEach(s=>n.push({kind:"remove",text:s}));continue}if(HN(a)){n.push({kind:"add",text:a}),r+=1;continue}n.push({kind:"context",text:a}),r+=1}return n},Zrt=e=>{let t=0,n=0;for(const r of e.split(`
|
|
639
639
|
`)){if(HN(r)){t+=1;continue}zN(r)&&(n+=1)}return{added:t,removed:n}},UN=e=>{const t=g0(e);if(!t)return null;const n=Zrt(t.diff.unified);return{added:t.diff.added_lines??n.added,removed:t.diff.removed_lines??n.removed}},WN=e=>{if(typeof e=="string")return e.replace(/\\n/g,`
|
|
640
640
|
`).replace(/\\t/g," ");if(Array.isArray(e))return e.map(WN);if(e!==null&&typeof e=="object"){const t={};for(const[n,r]of Object.entries(e))t[n]=WN(r);return t}return e},qN=e=>{if(!e)return{isJson:!1,formattedText:""};const t=e.trim();if(!t)return{isJson:!1,formattedText:""};if(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]")))return{isJson:!1,formattedText:e};try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===1){const a=Object.keys(n)[0];if((a==="content"||a==="result"||a==="output")&&typeof n[a]=="string")return{isJson:!1,formattedText:n[a].replace(/\\n/g,`
|
|
641
|
-
`).replace(/\\t/g," "),parsedJson:n}}const r=WN(n);return{isJson:!0,formattedText:JSON.stringify(r,null,2),parsedJson:r}}catch{return{isJson:!1,formattedText:e}}},Qrt=(e,t={})=>{const n={...Xrt,...t};return e?e.split(/\r?\n/).length>n.maxLines?!0:e.length>n.maxCharacters:!1},Jrt=(e,t=320)=>e?e.length<=t?{preview:e,isTruncated:!1}:{preview:e.substring(0,t).trimEnd()+"…",isTruncated:!0}:{preview:"",isTruncated:!1},eat=e=>{if(!e)return"No content";const t=60,n=e.trim(),r=g0(n);if(r){const a=r.file_path.split(/[\\/]/).pop()||r.file_path,i=`${r.operation}: ${a}`;return i.length<=t?i:i.substring(0,t).trimEnd()+"…"}if(n.length<=t)return n;if(n.startsWith("{")||n.startsWith("["))try{const a=JSON.parse(n);if(typeof a=="object"&&a!==null){const i=["content","result","output","message","data"].find(s=>s in a&&typeof a[s]=="string");if(i){const s=a[i];return s.length<=t?s:s.substring(0,t).trimEnd()+"…"}if(Array.isArray(a))return`Array with ${a.length} items`;const o=Object.keys(a);return`Object with ${o.length} propert${o.length===1?"y":"ies"}`}}catch{}return n.substring(0,t).trimEnd()+"…"},Bhe=e=>{switch(e){case"success":return"green";case"error":return"red";case"warning":return"orange";default:return"blue"}},Jp=(e,t=2)=>{if(typeof e=="string")return e;try{return JSON.stringify(e,null,t)}catch(n){return console.error("[resultFormatters] Failed to stringify value:",n),String(e)}},qx=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ku=(e,t)=>{const n=e[t];return typeof n=="string"?n:void 0},rK=(e,t)=>{const n=e[t];return typeof n=="boolean"?n:void 0},tat=(e,t)=>{const n=e[t];return Array.isArray(n)?n:void 0},Tv=e=>{if(!qx(e))return"any";const t=e.type;if(typeof t=="string"){if(t==="array"){const i=e.items;return`array<${Tv(i)}>`}return t==="object"?"object":t}if(Array.isArray(t)){const i=t.filter(o=>typeof o=="string").map(o=>o==="array"?"array<any>":o);return i.length>0?i.join(" | "):"any"}const n=Array.isArray(e.oneOf)?e.oneOf:null;if(n)return n.map(Tv).join(" | ")||"any";const r=Array.isArray(e.anyOf)?e.anyOf:null;if(r)return r.map(Tv).join(" | ")||"any";const a=Array.isArray(e.allOf)?e.allOf:null;return a&&a.map(Tv).join(" & ")||"any"},nat=e=>{if(!qx(e))return null;const t=e.properties;if(!qx(t))return{schemaUri:ku(e,"$schema"),title:ku(e,"title"),description:ku(e,"description"),additionalProperties:rK(e,"additionalProperties"),fields:[]};const n=new Set((tat(e,"required")??[]).filter(a=>typeof a=="string").map(a=>a)),r=Object.entries(t).map(([a,i])=>{const o=qx(i)?i:void 0;return{name:a,type:Tv(i),required:n.has(a),description:o?ku(o,"description"):void 0,defaultValue:o?o.default:void 0,enumValues:o&&Array.isArray(o.enum)?o.enum:void 0}});return r.sort((a,i)=>a.required!==i.required?a.required?-1:1:a.name.localeCompare(i.name)),{schemaUri:ku(e,"$schema"),title:ku(e,"title"),description:ku(e,"description"),additionalProperties:rK(e,"additionalProperties"),fields:r}},{Text:zs}=Qt,rat=e=>e===void 0?"":e===null?"null":typeof e=="string"?e:Jp(e,0),aat=({schema:e})=>{const{token:t}=pn.useToken(),n=p.useMemo(()=>nat(e),[e]);if(!n)return E.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:Jp(e,2)});const r=[{title:"Field",dataIndex:"name",key:"name",width:180,render:i=>E.jsx(zs,{code:!0,children:i})},{title:"Type",dataIndex:"type",key:"type",width:140,render:i=>E.jsx(zs,{children:i})},{title:"Required",dataIndex:"required",key:"required",width:110,render:i=>i?E.jsx(zs,{strong:!0,style:{color:t.colorError},children:"Yes"}):E.jsx(zs,{type:"secondary",children:"No"})},{title:"Default",dataIndex:"defaultValue",key:"default",width:160,render:i=>i===void 0?E.jsx(zs,{type:"secondary",children:"-"}):E.jsx(zs,{children:rat(i)})},{title:"Description",dataIndex:"description",key:"description",render:i=>i?E.jsx(zs,{style:{whiteSpace:"pre-wrap"},children:i}):E.jsx(zs,{type:"secondary",children:"-"})}],a=(n.fields??[]).map(i=>({...i,key:i.name}));return E.jsxs("div",{style:{width:"100%"},children:[E.jsx(Ks,{size:"small",column:1,items:[n.schemaUri?{key:"schema",label:"$schema",children:E.jsx(zs,{code:!0,children:n.schemaUri})}:null,typeof n.additionalProperties=="boolean"?{key:"additionalProperties",label:"additionalProperties",children:E.jsx(zs,{children:n.additionalProperties?"true":"false"})}:null].filter(Boolean)}),E.jsx(Bi,{size:"small",pagination:!1,columns:r,dataSource:a,locale:{emptyText:"No properties in schema"},style:{marginTop:t.marginSM}})]})},{Text:Qg}=Qt,iat=(e,t)=>`mcp__${e}__${t}`,oat=({server:e,tools:t,loading:n=!1})=>{const{t:r}=br();return E.jsx(Ot,{title:r("settings.mcpToolList.title"),size:"small",children:e?E.jsx(jr,{loading:n,dataSource:t,locale:{emptyText:r("settings.mcpToolList.empty")},renderItem:a=>{const i=iat(a.server_id,a.original_name);return E.jsx(jr.Item,{children:E.jsxs(He,{direction:"vertical",size:2,style:{width:"100%"},children:[E.jsx(Qg,{strong:!0,children:a.original_name}),E.jsx(Qg,{type:"secondary",children:a.description||r("settings.mcpToolList.noDescription")}),E.jsx(Qg,{code:!0,children:a.alias}),E.jsxs(Qg,{type:"secondary",children:[r("settings.mcpToolList.aliasMapping"),":"," ",E.jsx(Qg,{code:!0,children:i})]}),a.parameters!==void 0&&E.jsx(gl,{size:"small",items:[{key:"schema",label:r("settings.mcpToolList.parametersSchema"),children:E.jsx(aat,{schema:a.parameters})}]})]})})}}):E.jsx(va,{image:va.PRESENTED_IMAGE_SIMPLE,description:r("settings.mcpToolList.selectServerHint")})})},{Text:$O}=Qt,{useToken:sat}=pn,{TextArea:lat}=tn,cat={[Ln.Connecting]:"blue",[Ln.Ready]:"green",[Ln.Degraded]:"orange",[Ln.Stopped]:"default",[Ln.Error]:"red"},uat=()=>({[Ln.Connecting]:0,[Ln.Ready]:0,[Ln.Degraded]:0,[Ln.Stopped]:0,[Ln.Error]:0}),Ou=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,dat=e=>{var n,r,a;const t={};for(const i of e){const o=(n=i.id)==null?void 0:n.trim();if(!o)continue;const l=!(i.enabled??i.config.enabled),c=i.config.transport;if(c.type==="sse"){const d={};for(const h of c.headers??[]){const g=(r=h.name)==null?void 0:r.trim();g&&(d[g]=h.value??"")}const f={url:c.url};l&&(f.disabled=!0),Object.keys(d).length&&(f.headers=d),t[o]=f;continue}const u={command:c.command};l&&(u.disabled=!0),(a=c.args)!=null&&a.length&&(u.args=c.args),c.cwd&&(u.cwd=c.cwd),c.env&&Object.keys(c.env).length&&(u.env=c.env),t[o]=u}return{mcpServers:t}},fat=()=>{const{t:e}=br(),{token:t}=sat(),[n,r]=vn.useMessage(),{servers:a,selectedServerId:i,selectedServerTools:o,isLoadingServers:s,isMutatingConfig:l,isRefreshingAll:c,isSelectedServerToolsLoading:u,error:d,setSelectedServerId:f,addServer:h,updateServer:g,deleteServer:m,connectServer:v,disconnectServer:b,refreshServerTools:y,refreshAll:S,isServerActionLoading:C}=Hrt(),x=p.useMemo(()=>({[Ln.Connecting]:e("settings.mcpTab.status.connecting"),[Ln.Ready]:e("settings.mcpTab.status.ready"),[Ln.Degraded]:e("settings.mcpTab.status.degraded"),[Ln.Stopped]:e("settings.mcpTab.status.stopped"),[Ln.Error]:e("settings.mcpTab.status.error")}),[e]),[w,_]=p.useState(!1),[T,k]=p.useState("create"),[O,I]=p.useState(null),[M,$]=p.useState(!1),[R,A]=p.useState("merge"),[P,N]=p.useState(""),[L,j]=p.useState(null),[D,H]=p.useState(!1),F=p.useMemo(()=>i?a.find(re=>re.id===i)??null:null,[i,a]),B=p.useMemo(()=>{const re=uat();let ie=0;return a.forEach(ue=>{var Te,Se;const ge=((Te=ue.runtime)==null?void 0:Te.status)??Ln.Stopped;re[ge]+=1,ie+=((Se=ue.runtime)==null?void 0:Se.tool_count)??0}),{byStatus:re,totalServers:a.length,totalTools:ie}},[a]),z=async re=>{try{await m(re.id),n.success(e("settings.mcpTab.serverDeleted"))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.deleteServerFailed")))}},G=async re=>{try{await v(re.id),n.success(e("settings.mcpTab.connectedTo",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.connectServerFailed")))}},X=async re=>{try{await b(re.id),n.success(e("settings.mcpTab.disconnected",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.disconnectServerFailed")))}},Z=async re=>{try{await y(re.id),n.success(e("settings.mcpTab.toolsRefreshedFor",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.refreshToolsFailed")))}},q=async()=>{try{await S(),n.success(e("settings.mcpTab.statusRefreshed"))}catch(re){n.error(Ou(re,e("settings.mcpTab.refreshStatusFailed")))}},Y=()=>{I(null),k("create"),_(!0)},te=re=>{I(re),k("edit"),_(!0)},ee=async re=>{try{if(T==="edit"){if(!O){n.error(e("settings.mcpTab.noServerForEditing"));return}await g(O.id,re),n.success(e("settings.mcpTab.savedServer",{name:O.name||O.id}))}else await h(re),n.success(e("settings.mcpTab.addedServer",{name:re.name||re.id}));_(!1),I(null)}catch(ie){n.error(Ou(ie,e("settings.mcpTab.saveServerFailed")))}},Q=()=>{$(!0),j(null),A("merge"),N("")},ae=async()=>{const re=dat(a),ie=JSON.stringify(re,null,2);try{await Ko(ie),n.success(e("settings.mcpTab.copiedConfig"))}catch{$(!0),j(null),A("merge"),N(ie),n.warning(e("settings.mcpTab.clipboardUnavailable"))}},oe=async()=>{var ge;j(null);let re;try{re=JSON.parse(P)}catch(Te){j(`${e("settings.mcpTab.invalidJsonPrefix")}: ${Te instanceof Error?Te.message:e("settings.mcpTab.unknownError")}`);return}if(!re||typeof re!="object"){j(e("settings.mcpTab.jsonMustBeObject"));return}const ue=re.mcpServers;if(!ue||typeof ue!="object"){j(e("settings.mcpTab.missingMcpServers"));return}H(!0);try{const Te=await Dhe.importServers({mcpServers:ue,mode:R}),Se=((ge=Te.start_errors)==null?void 0:ge.length)??0;n.success(e("settings.mcpTab.importSummary",{count:Te.server_ids.length,added:Te.added,updated:Te.updated,removed:Te.removed,failed:Se})),Se&&n.warning(e("settings.mcpTab.importStartFailures")),$(!1),N(""),await q()}catch(Te){j(Ou(Te,e("settings.mcpTab.importFailed")))}finally{H(!1)}};return E.jsxs(He,{direction:"vertical",size:t.marginMD,style:{width:"100%"},children:[r,d?E.jsx(fr,{type:"error",showIcon:!0,message:d}):null,E.jsx(Ot,{size:"small",title:e("settings.mcpTab.overviewTitle"),children:E.jsxs(He,{direction:"vertical",size:t.marginXS,style:{width:"100%"},children:[E.jsx($O,{type:"secondary",children:e("settings.mcpTab.overviewDescription")}),E.jsxs(He,{wrap:!0,children:[E.jsx(Dn,{children:e("settings.mcpTab.totalServers",{count:B.totalServers})}),E.jsx(Dn,{children:e("settings.mcpTab.totalTools",{count:B.totalTools})}),Object.values(Ln).map(re=>E.jsxs(Dn,{color:cat[re],children:[x[re],": ",B.byStatus[re]]},re))]})]})}),E.jsx(Ot,{size:"small",title:e("settings.mcpTab.serversTitle"),extra:E.jsxs(He,{children:[E.jsx(De,{type:"primary",onClick:Y,children:e("settings.mcpTab.addServer")}),E.jsx(De,{icon:E.jsx(Zl,{}),loading:c,onClick:()=>{q()},children:e("settings.mcpTab.refreshAll")}),E.jsx(De,{icon:E.jsx(Go,{}),onClick:()=>void ae(),children:e("settings.mcpTab.export")}),E.jsx(De,{icon:E.jsx(DVe,{}),onClick:Q,children:e("settings.mcpTab.import")})]}),children:E.jsx(qrt,{servers:a,loading:s,selectedServerId:i,onSelectServer:f,onEditServer:te,onDeleteServer:z,onConnectServer:G,onDisconnectServer:X,onRefreshTools:Z,isServerActionLoading:C})}),E.jsx(oat,{server:F,tools:o,loading:u}),E.jsx(Yrt,{open:w,mode:T,initialConfig:(O==null?void 0:O.config)??null,confirmLoading:l,onCancel:()=>{l||(_(!1),I(null))},onSubmit:re=>void ee(re)}),E.jsx(qr,{open:M,title:e("settings.mcpTab.importModalTitle"),okText:e("settings.mcpTab.import"),onOk:()=>void oe(),okButtonProps:{loading:D},onCancel:()=>{D||($(!1),j(null))},width:800,destroyOnClose:!1,children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"middle",children:[E.jsxs($O,{type:"secondary",children:[e("settings.mcpTab.importHint"),E.jsx("br",{}),E.jsx($O,{code:!0,children:'{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "..."] } } }'})]}),E.jsxs(Xa.Group,{value:R,onChange:re=>A(re.target.value),optionType:"button",buttonStyle:"solid",children:[E.jsx(Xa.Button,{value:"merge",children:e("settings.mcpTab.importModeMerge")}),E.jsx(Xa.Button,{value:"replace",children:e("settings.mcpTab.importModeReplace")})]}),R==="replace"?E.jsx(fr,{type:"warning",showIcon:!0,message:e("settings.mcpTab.replaceWarning")}):null,L?E.jsx(fr,{type:"error",showIcon:!0,message:L}):null,E.jsx(lat,{value:P,onChange:re=>N(re.target.value),rows:14,placeholder:'{"mcpServers": { "filesystem": { "command": "...", "args": [], "env": {} } }}',spellCheck:!1})]})})]})};function Fhe(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Fhe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Fn(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Fhe(e))&&(r&&(r+=" "),r+=t);return r}var IO,aK;function Xi(){if(aK)return IO;aK=1;var e=Array.isArray;return IO=e,IO}var AO,iK;function zhe(){if(iK)return AO;iK=1;var e=typeof z0=="object"&&z0&&z0.Object===Object&&z0;return AO=e,AO}var RO,oK;function bl(){if(oK)return RO;oK=1;var e=zhe(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return RO=n,RO}var MO,sK;function m0(){if(sK)return MO;sK=1;var e=bl(),t=e.Symbol;return MO=t,MO}var PO,lK;function pat(){if(lK)return PO;lK=1;var e=m0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(o){var s=n.call(o,a),l=o[a];try{o[a]=void 0;var c=!0}catch{}var u=r.call(o);return c&&(s?o[a]=l:delete o[a]),u}return PO=i,PO}var NO,cK;function hat(){if(cK)return NO;cK=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return NO=n,NO}var LO,uK;function lc(){if(uK)return LO;uK=1;var e=m0(),t=pat(),n=hat(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?a:r:i&&i in Object(s)?t(s):n(s)}return LO=o,LO}var DO,dK;function cc(){if(dK)return DO;dK=1;function e(t){return t!=null&&typeof t=="object"}return DO=e,DO}var jO,fK;function hg(){if(fK)return jO;fK=1;var e=lc(),t=cc(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return jO=r,jO}var BO,pK;function t5(){if(pK)return BO;pK=1;var e=Xi(),t=hg(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,o){if(e(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||o!=null&&i in Object(o)}return BO=a,BO}var FO,hK;function pu(){if(hK)return FO;hK=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return FO=e,FO}var zO,gK;function n5(){if(gK)return zO;gK=1;var e=lc(),t=pu(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!t(s))return!1;var l=e(s);return l==r||l==a||l==n||l==i}return zO=o,zO}var HO,mK;function gat(){if(mK)return HO;mK=1;var e=bl(),t=e["__core-js_shared__"];return HO=t,HO}var UO,vK;function mat(){if(vK)return UO;vK=1;var e=gat(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return UO=n,UO}var WO,bK;function Hhe(){if(bK)return WO;bK=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return WO=n,WO}var qO,yK;function vat(){if(yK)return qO;yK=1;var e=n5(),t=mat(),n=pu(),r=Hhe(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,c=s.hasOwnProperty,u=RegExp("^"+l.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!n(f)||t(f))return!1;var h=e(f)?u:i;return h.test(r(f))}return qO=d,qO}var VO,SK;function bat(){if(SK)return VO;SK=1;function e(t,n){return t==null?void 0:t[n]}return VO=e,VO}var GO,xK;function pf(){if(xK)return GO;xK=1;var e=vat(),t=bat();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return GO=n,GO}var KO,wK;function l_(){if(wK)return KO;wK=1;var e=pf(),t=e(Object,"create");return KO=t,KO}var YO,CK;function yat(){if(CK)return YO;CK=1;var e=l_();function t(){this.__data__=e?e(null):{},this.size=0}return YO=t,YO}var XO,EK;function Sat(){if(EK)return XO;EK=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return XO=e,XO}var ZO,_K;function xat(){if(_K)return ZO;_K=1;var e=l_(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var o=this.__data__;if(e){var s=o[i];return s===t?void 0:s}return r.call(o,i)?o[i]:void 0}return ZO=a,ZO}var QO,TK;function wat(){if(TK)return QO;TK=1;var e=l_(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return QO=r,QO}var JO,kK;function Cat(){if(kK)return JO;kK=1;var e=l_(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return JO=n,JO}var e$,OK;function Eat(){if(OK)return e$;OK=1;var e=yat(),t=Sat(),n=xat(),r=wat(),a=Cat();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,e$=i,e$}var t$,$K;function _at(){if($K)return t$;$K=1;function e(){this.__data__=[],this.size=0}return t$=e,t$}var n$,IK;function r5(){if(IK)return n$;IK=1;function e(t,n){return t===n||t!==t&&n!==n}return n$=e,n$}var r$,AK;function c_(){if(AK)return r$;AK=1;var e=r5();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return r$=t,r$}var a$,RK;function Tat(){if(RK)return a$;RK=1;var e=c_(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,o=e(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():n.call(i,o,1),--this.size,!0}return a$=r,a$}var i$,MK;function kat(){if(MK)return i$;MK=1;var e=c_();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return i$=t,i$}var o$,PK;function Oat(){if(PK)return o$;PK=1;var e=c_();function t(n){return e(this.__data__,n)>-1}return o$=t,o$}var s$,NK;function $at(){if(NK)return s$;NK=1;var e=c_();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return s$=t,s$}var l$,LK;function u_(){if(LK)return l$;LK=1;var e=_at(),t=Tat(),n=kat(),r=Oat(),a=$at();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,l$=i,l$}var c$,DK;function a5(){if(DK)return c$;DK=1;var e=pf(),t=bl(),n=e(t,"Map");return c$=n,c$}var u$,jK;function Iat(){if(jK)return u$;jK=1;var e=Eat(),t=u_(),n=a5();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return u$=r,u$}var d$,BK;function Aat(){if(BK)return d$;BK=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return d$=e,d$}var f$,FK;function d_(){if(FK)return f$;FK=1;var e=Aat();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return f$=t,f$}var p$,zK;function Rat(){if(zK)return p$;zK=1;var e=d_();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return p$=t,p$}var h$,HK;function Mat(){if(HK)return h$;HK=1;var e=d_();function t(n){return e(this,n).get(n)}return h$=t,h$}var g$,UK;function Pat(){if(UK)return g$;UK=1;var e=d_();function t(n){return e(this,n).has(n)}return g$=t,g$}var m$,WK;function Nat(){if(WK)return m$;WK=1;var e=d_();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return m$=t,m$}var v$,qK;function i5(){if(qK)return v$;qK=1;var e=Iat(),t=Rat(),n=Mat(),r=Pat(),a=Nat();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,v$=i,v$}var b$,VK;function Uhe(){if(VK)return b$;VK=1;var e=i5(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],l=i.cache;if(l.has(s))return l.get(s);var c=r.apply(this,o);return i.cache=l.set(s,c)||l,c};return i.cache=new(n.Cache||e),i}return n.Cache=e,b$=n,b$}var y$,GK;function Lat(){if(GK)return y$;GK=1;var e=Uhe(),t=500;function n(r){var a=e(r,function(o){return i.size===t&&i.clear(),o}),i=a.cache;return a}return y$=n,y$}var S$,KK;function Dat(){if(KK)return S$;KK=1;var e=Lat(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(o,s,l,c){i.push(l?c.replace(n,"$1"):s||o)}),i});return S$=r,S$}var x$,YK;function o5(){if(YK)return x$;YK=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return x$=e,x$}var w$,XK;function jat(){if(XK)return w$;XK=1;var e=m0(),t=o5(),n=Xi(),r=hg(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(n(s))return t(s,o)+"";if(r(s))return i?i.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return w$=o,w$}var C$,ZK;function Whe(){if(ZK)return C$;ZK=1;var e=jat();function t(n){return n==null?"":e(n)}return C$=t,C$}var E$,QK;function qhe(){if(QK)return E$;QK=1;var e=Xi(),t=t5(),n=Dat(),r=Whe();function a(i,o){return e(i)?i:t(i,o)?[i]:n(r(i))}return E$=a,E$}var _$,JK;function f_(){if(JK)return _$;JK=1;var e=hg();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return _$=t,_$}var T$,eY;function s5(){if(eY)return T$;eY=1;var e=qhe(),t=f_();function n(r,a){a=e(a,r);for(var i=0,o=a.length;r!=null&&i<o;)r=r[t(a[i++])];return i&&i==o?r:void 0}return T$=n,T$}var k$,tY;function Vhe(){if(tY)return k$;tY=1;var e=s5();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return k$=t,k$}var Bat=Vhe();const go=An(Bat);var O$,nY;function Fat(){if(nY)return O$;nY=1;function e(t){return t==null}return O$=e,O$}var zat=Fat();const Pn=An(zat);var $$,rY;function Hat(){if(rY)return $$;rY=1;var e=lc(),t=Xi(),n=cc(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return $$=a,$$}var Uat=Hat();const Md=An(Uat);var Wat=n5();const On=An(Wat);var qat=pu();const gg=An(qat);var I$,aY;function Ghe(){if(aY)return I$;aY=1;var e=lc(),t=cc(),n="[object Number]";function r(a){return typeof a=="number"||t(a)&&e(a)==n}return I$=r,I$}var A$,iY;function Vat(){if(iY)return A$;iY=1;var e=Ghe();function t(n){return e(n)&&n!=+n}return A$=t,A$}var Gat=Vat();const v0=An(Gat);var Kat=Ghe();const Yat=An(Kat);var $i=function(t){return t===0?0:t>0?1:-1},ad=function(t){return Md(t)&&t.indexOf("%")===t.length-1},St=function(t){return Yat(t)&&!v0(t)},Xat=function(t){return Pn(t)},Ca=function(t){return St(t)||Md(t)},Zat=0,mg=function(t){var n=++Zat;return"".concat(t||"").concat(n)},Ii=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!St(t)&&!Md(t))return r;var i;if(ad(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return v0(i)&&(i=r),a&&i>n&&(i=n),i},Mc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},Qat=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},a=0;a<n;a++)if(!r[t[a]])r[t[a]]=!0;else return!0;return!1},uo=function(t,n){return St(t)&&St(n)?function(r){return t+r*(n-t)}:function(){return n}};function Qw(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):go(r,t))===n})}var Jat=function(t,n){return St(t)&&St(n)?t-n:Md(t)&&Md(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function kp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function VN(e){"@babel/helpers - typeof";return VN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},VN(e)}var eit=["viewBox","children"],tit=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],oY=["points","pathLength"],R$={svg:eit,polygon:oY,polyline:oY},l5=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Jw=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(p.isValidElement(t)&&(r=t.props),!gg(r))return null;var a={};return Object.keys(r).forEach(function(i){l5.includes(i)&&(a[i]=n||function(o){return r[i](r,o)})}),a},nit=function(t,n,r){return function(a){return t(n,r,a),null}},Pd=function(t,n,r){if(!gg(t)||VN(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];l5.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=nit(o,n,r))}),a},rit=["children"],ait=["children"];function sY(e,t){if(e==null)return{};var n=iit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function GN(e){"@babel/helpers - typeof";return GN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},GN(e)}var lY={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Ul=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},cY=null,M$=null,c5=function e(t){if(t===cY&&Array.isArray(M$))return M$;var n=[];return p.Children.forEach(t,function(r){Pn(r)||(cx.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),M$=n,cY=t,n};function mo(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(a){return Ul(a)}):r=[Ul(t)],c5(e).forEach(function(a){var i=go(a,"type.displayName")||go(a,"type.name");r.indexOf(i)!==-1&&n.push(a)}),n}function so(e,t){var n=mo(e,t);return n&&n[0]}var uY=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,a=n.height;return!(!St(r)||r<=0||!St(a)||a<=0)},oit=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],sit=function(t){return t&&t.type&&Md(t.type)&&oit.indexOf(t.type)>=0},lit=function(t){return t&&GN(t)==="object"&&"clipDot"in t},cit=function(t,n,r,a){var i,o=(i=R$==null?void 0:R$[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!On(t)&&(a&&o.includes(n)||tit.includes(n))||r&&l5.includes(n)},ln=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(p.isValidElement(t)&&(a=t.props),!gg(a))return null;var i={};return Object.keys(a).forEach(function(o){var s;cit((s=a)===null||s===void 0?void 0:s[o],o,n,r)&&(i[o]=a[o])}),i},KN=function e(t,n){if(t===n)return!0;var r=p.Children.count(t);if(r!==p.Children.count(n))return!1;if(r===0)return!0;if(r===1)return dY(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<r;a++){var i=t[a],o=n[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!dY(i,o))return!1}return!0},dY=function(t,n){if(Pn(t)&&Pn(n))return!0;if(!Pn(t)&&!Pn(n)){var r=t.props||{},a=r.children,i=sY(r,rit),o=n.props||{},s=o.children,l=sY(o,ait);return a&&s?kp(i,l)&&KN(a,s):!a&&!s?kp(i,l):!1}return!1},fY=function(t,n){var r=[],a={};return c5(t).forEach(function(i,o){if(sit(i))r.push(i);else if(i){var s=Ul(i.type),l=n[s]||{},c=l.handler,u=l.once;if(c&&(!u||!a[s])){var d=c(i,s,o);r.push(d),a[s]=!0}}}),r},uit=function(t){var n=t&&t.type;return n&&lY[n]?lY[n]:null},dit=function(t,n){return c5(n).indexOf(t)},fit=["children","width","height","viewBox","className","style","title","desc"];function YN(){return YN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YN.apply(this,arguments)}function pit(e,t){if(e==null)return{};var n=hit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XN(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,i=e.className,o=e.style,s=e.title,l=e.desc,c=pit(e,fit),u=a||{width:n,height:r,x:0,y:0},d=Fn("recharts-surface",i);return U.createElement("svg",YN({},ln(c,!0,"svg"),{className:d,width:n,height:r,style:o,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),U.createElement("title",null,s),U.createElement("desc",null,l),t)}var git=["children","className"];function ZN(){return ZN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ZN.apply(this,arguments)}function mit(e,t){if(e==null)return{};var n=vit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ar=U.forwardRef(function(e,t){var n=e.children,r=e.className,a=mit(e,git),i=Fn("recharts-layer",r);return U.createElement("g",ZN({className:i},ln(a,!0),{ref:t}),n)}),_s=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i]},P$,pY;function bit(){if(pY)return P$;pY=1;function e(t,n,r){var a=-1,i=t.length;n<0&&(n=-n>i?0:i+n),r=r>i?i:r,r<0&&(r+=i),i=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(i);++a<i;)o[a]=t[a+n];return o}return P$=e,P$}var N$,hY;function yit(){if(hY)return N$;hY=1;var e=bit();function t(n,r,a){var i=n.length;return a=a===void 0?i:a,!r&&a>=i?n:e(n,r,a)}return N$=t,N$}var L$,gY;function Khe(){if(gY)return L$;gY=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+e+a+i+"]");function l(c){return s.test(c)}return L$=l,L$}var D$,mY;function Sit(){if(mY)return D$;mY=1;function e(t){return t.split("")}return D$=e,D$}var j$,vY;function xit(){if(vY)return j$;vY=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",o="["+e+"]",s="["+a+"]",l="\\ud83c[\\udffb-\\udfff]",c="(?:"+s+"|"+l+")",u="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",g=c+"?",m="["+i+"]?",v="(?:"+h+"(?:"+[u,d,f].join("|")+")"+m+g+")*",b=m+g+v,y="(?:"+[u+s+"?",s,d,f,o].join("|")+")",S=RegExp(l+"(?="+l+")|"+y+b,"g");function C(x){return x.match(S)||[]}return j$=C,j$}var B$,bY;function wit(){if(bY)return B$;bY=1;var e=Sit(),t=Khe(),n=xit();function r(a){return t(a)?n(a):e(a)}return B$=r,B$}var F$,yY;function Cit(){if(yY)return F$;yY=1;var e=yit(),t=Khe(),n=wit(),r=Whe();function a(i){return function(o){o=r(o);var s=t(o)?n(o):void 0,l=s?s[0]:o.charAt(0),c=s?e(s,1).join(""):o.slice(1);return l[i]()+c}}return F$=a,F$}var z$,SY;function Eit(){if(SY)return z$;SY=1;var e=Cit(),t=e("toUpperCase");return z$=t,z$}var _it=Eit();const p_=An(_it);function _r(e){return function(){return e}}const G3t=Math.abs,K3t=Math.atan2,Yhe=Math.cos,Y3t=Math.max,X3t=Math.min,eC=Math.sin,Ds=Math.sqrt,xY=1e-12,eh=Math.PI,wY=eh/2,h_=2*eh;function Z3t(e){return e>1?0:e<-1?eh:Math.acos(e)}function Q3t(e){return e>=1?wY:e<=-1?-wY:Math.asin(e)}const QN=Math.PI,JN=2*QN,Du=1e-6,Tit=JN-Du;function Xhe(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function kit(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Xhe;const n=10**t;return function(r){this._+=r[0];for(let a=1,i=r.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+r[a]}}class Oit{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Xhe:kit(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,a){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+a}`}bezierCurveTo(t,n,r,a,i,o){this._append`C${+t},${+n},${+r},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,r,a,i){if(t=+t,n=+n,r=+r,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,s=this._y1,l=r-t,c=a-n,u=o-t,d=s-n,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>Du)if(!(Math.abs(d*l-c*u)>Du)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,g=a-s,m=l*l+c*c,v=h*h+g*g,b=Math.sqrt(m),y=Math.sqrt(f),S=i*Math.tan((QN-Math.acos((m+f-v)/(2*b*y)))/2),C=S/y,x=S/b;Math.abs(C-1)>Du&&this._append`L${t+C*u},${n+C*d}`,this._append`A${i},${i},0,0,${+(d*h>u*g)},${this._x1=t+x*l},${this._y1=n+x*c}`}}arc(t,n,r,a,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(a),l=r*Math.sin(a),c=t+s,u=n+l,d=1^o,f=o?a-i:i-a;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Du||Math.abs(this._y1-u)>Du)&&this._append`L${c},${u}`,r&&(f<0&&(f=f%JN+JN),f>Tit?this._append`A${r},${r},0,1,${d},${t-s},${n-l}A${r},${r},0,1,${d},${this._x1=c},${this._y1=u}`:f>Du&&this._append`A${r},${r},0,${+(f>=QN)},${d},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function u5(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Oit(t)}function d5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zhe(e){this._context=e}Zhe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Nd(e){return new Zhe(e)}function Qhe(e){return e[0]}function Jhe(e){return e[1]}function f5(e,t){var n=_r(!0),r=null,a=Nd,i=null,o=u5(s);e=typeof e=="function"?e:e===void 0?Qhe:_r(e),t=typeof t=="function"?t:t===void 0?Jhe:_r(t);function s(l){var c,u=(l=d5(l)).length,d,f=!1,h;for(r==null&&(i=a(h=o())),c=0;c<=u;++c)!(c<u&&n(d=l[c],c,l))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(d,c,l),+t(d,c,l));if(h)return i=null,h+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:_r(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:_r(+l),s):t},s.defined=function(l){return arguments.length?(n=typeof l=="function"?l:_r(!!l),s):n},s.curve=function(l){return arguments.length?(a=l,r!=null&&(i=a(r)),s):a},s.context=function(l){return arguments.length?(l==null?r=i=null:i=a(r=l),s):r},s}function AS(e,t,n){var r=null,a=_r(!0),i=null,o=Nd,s=null,l=u5(c);e=typeof e=="function"?e:e===void 0?Qhe:_r(+e),t=typeof t=="function"?t:_r(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Jhe:_r(+n);function c(d){var f,h,g,m=(d=d5(d)).length,v,b=!1,y,S=new Array(m),C=new Array(m);for(i==null&&(s=o(y=l())),f=0;f<=m;++f){if(!(f<m&&a(v=d[f],f,d))===b)if(b=!b)h=f,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),g=f-1;g>=h;--g)s.point(S[g],C[g]);s.lineEnd(),s.areaEnd()}b&&(S[f]=+e(v,f,d),C[f]=+t(v,f,d),s.point(r?+r(v,f,d):S[f],n?+n(v,f,d):C[f]))}if(y)return s=null,y+""||null}function u(){return f5().defined(a).curve(o).context(i)}return c.x=function(d){return arguments.length?(e=typeof d=="function"?d:_r(+d),r=null,c):e},c.x0=function(d){return arguments.length?(e=typeof d=="function"?d:_r(+d),c):e},c.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:_r(+d),c):r},c.y=function(d){return arguments.length?(t=typeof d=="function"?d:_r(+d),n=null,c):t},c.y0=function(d){return arguments.length?(t=typeof d=="function"?d:_r(+d),c):t},c.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:_r(+d),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(d){return arguments.length?(a=typeof d=="function"?d:_r(!!d),c):a},c.curve=function(d){return arguments.length?(o=d,i!=null&&(s=o(i)),c):o},c.context=function(d){return arguments.length?(d==null?i=s=null:s=o(i=d),c):i},c}class ege{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function p5(e){return new ege(e,!0)}function h5(e){return new ege(e,!1)}const g5={draw(e,t){const n=Ds(t/eh);e.moveTo(n,0),e.arc(0,0,n,0,h_)}},$it={draw(e,t){const n=Ds(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},tge=Ds(1/3),Iit=tge*2,Ait={draw(e,t){const n=Ds(t/Iit),r=n*tge;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Rit={draw(e,t){const n=Ds(t),r=-n/2;e.rect(r,r,n,n)}},Mit=.8908130915292852,nge=eC(eh/10)/eC(7*eh/10),Pit=eC(h_/10)*nge,Nit=-Yhe(h_/10)*nge,Lit={draw(e,t){const n=Ds(t*Mit),r=Pit*n,a=Nit*n;e.moveTo(0,-n),e.lineTo(r,a);for(let i=1;i<5;++i){const o=h_*i/5,s=Yhe(o),l=eC(o);e.lineTo(l*n,-s*n),e.lineTo(s*r-l*a,l*r+s*a)}e.closePath()}},H$=Ds(3),Dit={draw(e,t){const n=-Ds(t/(H$*3));e.moveTo(0,n*2),e.lineTo(-H$*n,-n),e.lineTo(H$*n,-n),e.closePath()}},_o=-.5,To=Ds(3)/2,eL=1/Ds(12),jit=(eL/2+1)*3,Bit={draw(e,t){const n=Ds(t/jit),r=n/2,a=n*eL,i=r,o=n*eL+n,s=-i,l=o;e.moveTo(r,a),e.lineTo(i,o),e.lineTo(s,l),e.lineTo(_o*r-To*a,To*r+_o*a),e.lineTo(_o*i-To*o,To*i+_o*o),e.lineTo(_o*s-To*l,To*s+_o*l),e.lineTo(_o*r+To*a,_o*a-To*r),e.lineTo(_o*i+To*o,_o*o-To*i),e.lineTo(_o*s+To*l,_o*l-To*s),e.closePath()}};function Fit(e,t){let n=null,r=u5(a);e=typeof e=="function"?e:_r(e||g5),t=typeof t=="function"?t:_r(t===void 0?64:+t);function a(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:_r(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:_r(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function nu(){}function tC(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function g_(e){this._context=e}g_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:tC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nb(e){return new g_(e)}function rge(e){this._context=e}rge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function age(e){return new rge(e)}function ige(e){this._context=e}ige.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oge(e){return new ige(e)}function sge(e,t){this._basis=new g_(e),this._beta=t}sge.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],a=t[0],i=e[n]-r,o=t[n]-a,s=-1,l;++s<=n;)l=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+l*i),this._beta*t[s]+(1-this._beta)*(a+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const zit=function e(t){function n(r){return t===1?new g_(r):new sge(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function nC(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function m5(e,t){this._context=e,this._k=(1-t)/6}m5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:nC(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const lge=function e(t){function n(r){return new m5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function v5(e,t){this._context=e,this._k=(1-t)/6}v5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Hit=function e(t){function n(r){return new v5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function b5(e,t){this._context=e,this._k=(1-t)/6}b5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Uit=function e(t){function n(r){return new b5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function y5(e,t,n){var r=e._x1,a=e._y1,i=e._x2,o=e._y2;if(e._l01_a>xY){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,a=(a*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>xY){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*c+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,a,i,o,e._x2,e._y2)}function cge(e,t){this._context=e,this._alpha=t}cge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const uge=function e(t){function n(r){return t?new cge(r,t):new m5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function dge(e,t){this._context=e,this._alpha=t}dge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Wit=function e(t){function n(r){return t?new dge(r,t):new v5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function fge(e,t){this._context=e,this._alpha=t}fge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const qit=function e(t){function n(r){return t?new fge(r,t):new b5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function pge(e){this._context=e}pge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function hge(e){return new pge(e)}function CY(e){return e<0?-1:1}function EY(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(CY(i)+CY(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function _Y(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function U$(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,s=(i-r)/3;e._context.bezierCurveTo(r+s,a+s*t,i-s,o-s*n,i,o)}function rC(e){this._context=e}rC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:U$(this,this._t0,_Y(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,U$(this,_Y(this,n=EY(this,e,t)),n);break;default:U$(this,this._t0,n=EY(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function gge(e){this._context=new mge(e)}(gge.prototype=Object.create(rC.prototype)).point=function(e,t){rC.prototype.point.call(this,t,e)};function mge(e){this._context=e}mge.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}};function S5(e){return new rC(e)}function x5(e){return new gge(e)}function vge(e){this._context=e}vge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=TY(e),a=TY(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],a[0][i],r[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function TY(e){var t,n=e.length-1,r,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=a[t]/i[t-1],i[t]-=r,o[t]-=r*o[t-1];for(a[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function w5(e){return new vge(e)}function m_(e,t){this._context=e,this._t=t}m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function C5(e){return new m_(e,.5)}function E5(e){return new m_(e,0)}function _5(e){return new m_(e,1)}function th(e,t){if((o=e.length)>1)for(var n=1,r,a,i=e[t[0]],o,s=i.length;n<o;++n)for(a=i,i=e[t[n]],r=0;r<s;++r)i[r][1]+=i[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function tL(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function Vit(e,t){return e[t]}function Git(e){const t=[];return t.key=e,t}function Kit(){var e=_r([]),t=tL,n=th,r=Vit;function a(i){var o=Array.from(e.apply(this,arguments),Git),s,l=o.length,c=-1,u;for(const d of i)for(s=0,++c;s<l;++s)(o[s][c]=[0,+r(d,o[s].key,c,i)]).data=d;for(s=0,u=d5(t(o));s<l;++s)o[u[s]].index=s;return n(o,u),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:_r(Array.from(i)),a):e},a.value=function(i){return arguments.length?(r=typeof i=="function"?i:_r(+i),a):r},a.order=function(i){return arguments.length?(t=i==null?tL:typeof i=="function"?i:_r(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(n=i??th,a):n},a}function Yit(e,t){if((r=e.length)>0){for(var n,r,a=0,i=e[0].length,o;a<i;++a){for(o=n=0;n<r;++n)o+=e[n][a][1]||0;if(o)for(n=0;n<r;++n)e[n][a][1]/=o}th(e,t)}}function Xit(e,t){if((a=e.length)>0){for(var n=0,r=e[t[0]],a,i=r.length;n<i;++n){for(var o=0,s=0;o<a;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}th(e,t)}}function Zit(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,r=1,a,i,o;r<i;++r){for(var s=0,l=0,c=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=u[r-1][1]||0,h=(d-f)/2,g=0;g<s;++g){var m=e[t[g]],v=m[r][1]||0,b=m[r-1][1]||0;h+=v-b}l+=d,c+=h*d}a[r-1][1]+=a[r-1][0]=n,l&&(n-=c/l)}a[r-1][1]+=a[r-1][0]=n,th(e,t)}}function Gb(e){"@babel/helpers - typeof";return Gb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gb(e)}var Qit=["type","size","sizeType"];function nL(){return nL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nL.apply(this,arguments)}function kY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function OY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kY(Object(n),!0).forEach(function(r){Jit(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kY(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jit(e,t,n){return t=eot(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eot(e){var t=tot(e,"string");return Gb(t)=="symbol"?t:t+""}function tot(e,t){if(Gb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function not(e,t){if(e==null)return{};var n=rot(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rot(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bge={symbolCircle:g5,symbolCross:$it,symbolDiamond:Ait,symbolSquare:Rit,symbolStar:Lit,symbolTriangle:Dit,symbolWye:Bit},aot=Math.PI/180,iot=function(t){var n="symbol".concat(p_(t));return bge[n]||g5},oot=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*aot;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},sot=function(t,n){bge["symbol".concat(p_(t))]=n},T5=function(t){var n=t.type,r=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,o=t.sizeType,s=o===void 0?"area":o,l=not(t,Qit),c=OY(OY({},l),{},{type:r,size:i,sizeType:s}),u=function(){var v=iot(r),b=Fit().type(v).size(oot(i,s,r));return b()},d=c.className,f=c.cx,h=c.cy,g=ln(c,!0);return f===+f&&h===+h&&i===+i?U.createElement("path",nL({},g,{className:Fn("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(h,")"),d:u()})):null};T5.registerSymbol=sot;function nh(e){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nh(e)}function rL(){return rL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rL.apply(this,arguments)}function $Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lot(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$Y(Object(n),!0).forEach(function(r){Kb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$Y(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uot(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sge(r.key),r)}}function dot(e,t,n){return t&&uot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function fot(e,t,n){return t=aC(t),pot(e,yge()?Reflect.construct(t,n||[],aC(e).constructor):t.apply(e,n))}function pot(e,t){if(t&&(nh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hot(e)}function hot(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yge=function(){return!!e})()}function aC(e){return aC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},aC(e)}function got(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&aL(e,t)}function aL(e,t){return aL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},aL(e,t)}function Kb(e,t,n){return t=Sge(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sge(e){var t=mot(e,"string");return nh(t)=="symbol"?t:t+""}function mot(e,t){if(nh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ko=32,k5=function(e){function t(){return cot(this,t),fot(this,t,arguments)}return got(t,e),dot(t,[{key:"renderIcon",value:function(r){var a=this.props.inactiveColor,i=ko/2,o=ko/6,s=ko/3,l=r.inactive?a:r.color;if(r.type==="plainline")return U.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:ko,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return U.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(i,"h").concat(s,`
|
|
641
|
+
`).replace(/\\t/g," "),parsedJson:n}}const r=WN(n);return{isJson:!0,formattedText:JSON.stringify(r,null,2),parsedJson:r}}catch{return{isJson:!1,formattedText:e}}},Qrt=(e,t={})=>{const n={...Xrt,...t};return e?e.split(/\r?\n/).length>n.maxLines?!0:e.length>n.maxCharacters:!1},Jrt=(e,t=320)=>e?e.length<=t?{preview:e,isTruncated:!1}:{preview:e.substring(0,t).trimEnd()+"…",isTruncated:!0}:{preview:"",isTruncated:!1},eat=e=>{if(!e)return"No content";const t=60,n=e.trim(),r=g0(n);if(r){const a=r.file_path.split(/[\\/]/).pop()||r.file_path,i=`${r.operation}: ${a}`;return i.length<=t?i:i.substring(0,t).trimEnd()+"…"}if(n.length<=t)return n;if(n.startsWith("{")||n.startsWith("["))try{const a=JSON.parse(n);if(typeof a=="object"&&a!==null){const i=["content","result","output","message","data"].find(s=>s in a&&typeof a[s]=="string");if(i){const s=a[i];return s.length<=t?s:s.substring(0,t).trimEnd()+"…"}if(Array.isArray(a))return`Array with ${a.length} items`;const o=Object.keys(a);return`Object with ${o.length} propert${o.length===1?"y":"ies"}`}}catch{}return n.substring(0,t).trimEnd()+"…"},Bhe=e=>{switch(e){case"success":return"green";case"error":return"red";case"warning":return"orange";default:return"blue"}},Jp=(e,t=2)=>{if(typeof e=="string")return e;try{return JSON.stringify(e,null,t)}catch(n){return console.error("[resultFormatters] Failed to stringify value:",n),String(e)}},qx=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ku=(e,t)=>{const n=e[t];return typeof n=="string"?n:void 0},rK=(e,t)=>{const n=e[t];return typeof n=="boolean"?n:void 0},tat=(e,t)=>{const n=e[t];return Array.isArray(n)?n:void 0},Tv=e=>{if(!qx(e))return"any";const t=e.type;if(typeof t=="string"){if(t==="array"){const i=e.items;return`array<${Tv(i)}>`}return t==="object"?"object":t}if(Array.isArray(t)){const i=t.filter(o=>typeof o=="string").map(o=>o==="array"?"array<any>":o);return i.length>0?i.join(" | "):"any"}const n=Array.isArray(e.oneOf)?e.oneOf:null;if(n)return n.map(Tv).join(" | ")||"any";const r=Array.isArray(e.anyOf)?e.anyOf:null;if(r)return r.map(Tv).join(" | ")||"any";const a=Array.isArray(e.allOf)?e.allOf:null;return a&&a.map(Tv).join(" & ")||"any"},nat=e=>{if(!qx(e))return null;const t=e.properties;if(!qx(t))return{schemaUri:ku(e,"$schema"),title:ku(e,"title"),description:ku(e,"description"),additionalProperties:rK(e,"additionalProperties"),fields:[]};const n=new Set((tat(e,"required")??[]).filter(a=>typeof a=="string").map(a=>a)),r=Object.entries(t).map(([a,i])=>{const o=qx(i)?i:void 0;return{name:a,type:Tv(i),required:n.has(a),description:o?ku(o,"description"):void 0,defaultValue:o?o.default:void 0,enumValues:o&&Array.isArray(o.enum)?o.enum:void 0}});return r.sort((a,i)=>a.required!==i.required?a.required?-1:1:a.name.localeCompare(i.name)),{schemaUri:ku(e,"$schema"),title:ku(e,"title"),description:ku(e,"description"),additionalProperties:rK(e,"additionalProperties"),fields:r}},{Text:zs}=Qt,rat=e=>e===void 0?"":e===null?"null":typeof e=="string"?e:Jp(e,0),aat=({schema:e})=>{const{token:t}=pn.useToken(),n=p.useMemo(()=>nat(e),[e]);if(!n)return E.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:Jp(e,2)});const r=[{title:"Field",dataIndex:"name",key:"name",width:180,render:i=>E.jsx(zs,{code:!0,children:i})},{title:"Type",dataIndex:"type",key:"type",width:140,render:i=>E.jsx(zs,{children:i})},{title:"Required",dataIndex:"required",key:"required",width:110,render:i=>i?E.jsx(zs,{strong:!0,style:{color:t.colorError},children:"Yes"}):E.jsx(zs,{type:"secondary",children:"No"})},{title:"Default",dataIndex:"defaultValue",key:"default",width:160,render:i=>i===void 0?E.jsx(zs,{type:"secondary",children:"-"}):E.jsx(zs,{children:rat(i)})},{title:"Description",dataIndex:"description",key:"description",render:i=>i?E.jsx(zs,{style:{whiteSpace:"pre-wrap"},children:i}):E.jsx(zs,{type:"secondary",children:"-"})}],a=(n.fields??[]).map(i=>({...i,key:i.name}));return E.jsxs("div",{style:{width:"100%"},children:[E.jsx(Ks,{size:"small",column:1,items:[n.schemaUri?{key:"schema",label:"$schema",children:E.jsx(zs,{code:!0,children:n.schemaUri})}:null,typeof n.additionalProperties=="boolean"?{key:"additionalProperties",label:"additionalProperties",children:E.jsx(zs,{children:n.additionalProperties?"true":"false"})}:null].filter(Boolean)}),E.jsx(Bi,{size:"small",pagination:!1,columns:r,dataSource:a,locale:{emptyText:"No properties in schema"},style:{marginTop:t.marginSM}})]})},{Text:Qg}=Qt,iat=(e,t)=>`mcp__${e}__${t}`,oat=({server:e,tools:t,loading:n=!1})=>{const{t:r}=br();return E.jsx(Ot,{title:r("settings.mcpToolList.title"),size:"small",children:e?E.jsx(jr,{loading:n,dataSource:t,locale:{emptyText:r("settings.mcpToolList.empty")},renderItem:a=>{const i=iat(a.server_id,a.original_name);return E.jsx(jr.Item,{children:E.jsxs(He,{direction:"vertical",size:2,style:{width:"100%"},children:[E.jsx(Qg,{strong:!0,children:a.original_name}),E.jsx(Qg,{type:"secondary",children:a.description||r("settings.mcpToolList.noDescription")}),E.jsx(Qg,{code:!0,children:a.alias}),E.jsxs(Qg,{type:"secondary",children:[r("settings.mcpToolList.aliasMapping"),":"," ",E.jsx(Qg,{code:!0,children:i})]}),a.parameters!==void 0&&E.jsx(gl,{size:"small",items:[{key:"schema",label:r("settings.mcpToolList.parametersSchema"),children:E.jsx(aat,{schema:a.parameters})}]})]})})}}):E.jsx(va,{image:va.PRESENTED_IMAGE_SIMPLE,description:r("settings.mcpToolList.selectServerHint")})})},{Text:$O}=Qt,{useToken:sat}=pn,{TextArea:lat}=tn,cat={[Ln.Connecting]:"blue",[Ln.Ready]:"green",[Ln.Degraded]:"orange",[Ln.Stopped]:"default",[Ln.Error]:"red"},uat=()=>({[Ln.Connecting]:0,[Ln.Ready]:0,[Ln.Degraded]:0,[Ln.Stopped]:0,[Ln.Error]:0}),Ou=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,dat=e=>{var n,r,a;const t={};for(const i of e){const o=(n=i.id)==null?void 0:n.trim();if(!o)continue;const l=!(i.enabled??i.config.enabled),c=i.config.transport;if(c.type==="sse"){const d={};for(const h of c.headers??[]){const g=(r=h.name)==null?void 0:r.trim();g&&(d[g]=h.value??"")}const f={url:c.url};l&&(f.disabled=!0),Object.keys(d).length&&(f.headers=d),t[o]=f;continue}const u={command:c.command};l&&(u.disabled=!0),(a=c.args)!=null&&a.length&&(u.args=c.args),c.cwd&&(u.cwd=c.cwd),c.env&&Object.keys(c.env).length&&(u.env=c.env),t[o]=u}return{mcpServers:t}},fat=()=>{const{t:e}=br(),{token:t}=sat(),[n,r]=vn.useMessage(),{servers:a,selectedServerId:i,selectedServerTools:o,isLoadingServers:s,isMutatingConfig:l,isRefreshingAll:c,isSelectedServerToolsLoading:u,error:d,setSelectedServerId:f,addServer:h,updateServer:g,deleteServer:m,connectServer:v,disconnectServer:b,refreshServerTools:y,refreshAll:S,isServerActionLoading:C}=Hrt(),x=p.useMemo(()=>({[Ln.Connecting]:e("settings.mcpTab.status.connecting"),[Ln.Ready]:e("settings.mcpTab.status.ready"),[Ln.Degraded]:e("settings.mcpTab.status.degraded"),[Ln.Stopped]:e("settings.mcpTab.status.stopped"),[Ln.Error]:e("settings.mcpTab.status.error")}),[e]),[w,_]=p.useState(!1),[T,k]=p.useState("create"),[O,I]=p.useState(null),[M,$]=p.useState(!1),[R,A]=p.useState("merge"),[P,N]=p.useState(""),[L,j]=p.useState(null),[D,H]=p.useState(!1),F=p.useMemo(()=>i?a.find(re=>re.id===i)??null:null,[i,a]),B=p.useMemo(()=>{const re=uat();let ie=0;return a.forEach(ue=>{var Te,Se;const ge=((Te=ue.runtime)==null?void 0:Te.status)??Ln.Stopped;re[ge]+=1,ie+=((Se=ue.runtime)==null?void 0:Se.tool_count)??0}),{byStatus:re,totalServers:a.length,totalTools:ie}},[a]),z=async re=>{try{await m(re.id),n.success(e("settings.mcpTab.serverDeleted"))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.deleteServerFailed")))}},G=async re=>{try{await v(re.id),n.success(e("settings.mcpTab.connectedTo",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.connectServerFailed")))}},X=async re=>{try{await b(re.id),n.success(e("settings.mcpTab.disconnected",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.disconnectServerFailed")))}},Z=async re=>{try{await y(re.id),n.success(e("settings.mcpTab.toolsRefreshedFor",{name:re.name||re.id}))}catch(ie){n.error(Ou(ie,e("settings.mcpTab.refreshToolsFailed")))}},q=async()=>{try{await S(),n.success(e("settings.mcpTab.statusRefreshed"))}catch(re){n.error(Ou(re,e("settings.mcpTab.refreshStatusFailed")))}},Y=()=>{I(null),k("create"),_(!0)},te=re=>{I(re),k("edit"),_(!0)},ee=async re=>{try{if(T==="edit"){if(!O){n.error(e("settings.mcpTab.noServerForEditing"));return}await g(O.id,re),n.success(e("settings.mcpTab.savedServer",{name:O.name||O.id}))}else await h(re),n.success(e("settings.mcpTab.addedServer",{name:re.name||re.id}));_(!1),I(null)}catch(ie){n.error(Ou(ie,e("settings.mcpTab.saveServerFailed")))}},Q=()=>{$(!0),j(null),A("merge"),N("")},ae=async()=>{const re=dat(a),ie=JSON.stringify(re,null,2);try{await Ko(ie),n.success(e("settings.mcpTab.copiedConfig"))}catch{$(!0),j(null),A("merge"),N(ie),n.warning(e("settings.mcpTab.clipboardUnavailable"))}},oe=async()=>{var ge;j(null);let re;try{re=JSON.parse(P)}catch(Te){j(`${e("settings.mcpTab.invalidJsonPrefix")}: ${Te instanceof Error?Te.message:e("settings.mcpTab.unknownError")}`);return}if(!re||typeof re!="object"){j(e("settings.mcpTab.jsonMustBeObject"));return}const ue=re.mcpServers;if(!ue||typeof ue!="object"){j(e("settings.mcpTab.missingMcpServers"));return}H(!0);try{const Te=await Dhe.importServers({mcpServers:ue,mode:R}),Se=((ge=Te.start_errors)==null?void 0:ge.length)??0;n.success(e("settings.mcpTab.importSummary",{count:Te.server_ids.length,added:Te.added,updated:Te.updated,removed:Te.removed,failed:Se})),Se&&n.warning(e("settings.mcpTab.importStartFailures")),$(!1),N(""),await q()}catch(Te){j(Ou(Te,e("settings.mcpTab.importFailed")))}finally{H(!1)}};return E.jsxs(He,{direction:"vertical",size:t.marginMD,style:{width:"100%"},children:[r,d?E.jsx(fr,{type:"error",showIcon:!0,message:d}):null,E.jsx(Ot,{size:"small",title:e("settings.mcpTab.overviewTitle"),children:E.jsxs(He,{direction:"vertical",size:t.marginXS,style:{width:"100%"},children:[E.jsx($O,{type:"secondary",children:e("settings.mcpTab.overviewDescription")}),E.jsxs(He,{wrap:!0,children:[E.jsx(Dn,{children:e("settings.mcpTab.totalServers",{count:B.totalServers})}),E.jsx(Dn,{children:e("settings.mcpTab.totalTools",{count:B.totalTools})}),Object.values(Ln).map(re=>E.jsxs(Dn,{color:cat[re],children:[x[re],": ",B.byStatus[re]]},re))]})]})}),E.jsx(Ot,{size:"small",title:e("settings.mcpTab.serversTitle"),extra:E.jsxs(He,{children:[E.jsx(De,{type:"primary",onClick:Y,children:e("settings.mcpTab.addServer")}),E.jsx(De,{icon:E.jsx(Zl,{}),loading:c,onClick:()=>{q()},children:e("settings.mcpTab.refreshAll")}),E.jsx(De,{icon:E.jsx(Go,{}),onClick:()=>void ae(),children:e("settings.mcpTab.export")}),E.jsx(De,{icon:E.jsx(DVe,{}),onClick:Q,children:e("settings.mcpTab.import")})]}),children:E.jsx(qrt,{servers:a,loading:s,selectedServerId:i,onSelectServer:f,onEditServer:te,onDeleteServer:z,onConnectServer:G,onDisconnectServer:X,onRefreshTools:Z,isServerActionLoading:C})}),E.jsx(oat,{server:F,tools:o,loading:u}),E.jsx(Yrt,{open:w,mode:T,initialConfig:(O==null?void 0:O.config)??null,confirmLoading:l,onCancel:()=>{l||(_(!1),I(null))},onSubmit:re=>void ee(re)}),E.jsx(qr,{open:M,title:e("settings.mcpTab.importModalTitle"),okText:e("settings.mcpTab.import"),onOk:()=>void oe(),okButtonProps:{loading:D},onCancel:()=>{D||($(!1),j(null))},width:800,destroyOnClose:!1,children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"middle",children:[E.jsxs($O,{type:"secondary",children:[e("settings.mcpTab.importHint"),E.jsx("br",{}),E.jsx($O,{code:!0,children:'{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "..."] } } }'})]}),E.jsxs(Xa.Group,{value:R,onChange:re=>A(re.target.value),optionType:"button",buttonStyle:"solid",children:[E.jsx(Xa.Button,{value:"merge",children:e("settings.mcpTab.importModeMerge")}),E.jsx(Xa.Button,{value:"replace",children:e("settings.mcpTab.importModeReplace")})]}),R==="replace"?E.jsx(fr,{type:"warning",showIcon:!0,message:e("settings.mcpTab.replaceWarning")}):null,L?E.jsx(fr,{type:"error",showIcon:!0,message:L}):null,E.jsx(lat,{value:P,onChange:re=>N(re.target.value),rows:14,placeholder:'{"mcpServers": { "filesystem": { "command": "...", "args": [], "env": {} } }}',spellCheck:!1})]})})]})};function Fhe(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Fhe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Fn(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Fhe(e))&&(r&&(r+=" "),r+=t);return r}var IO,aK;function Xi(){if(aK)return IO;aK=1;var e=Array.isArray;return IO=e,IO}var AO,iK;function zhe(){if(iK)return AO;iK=1;var e=typeof z0=="object"&&z0&&z0.Object===Object&&z0;return AO=e,AO}var RO,oK;function bl(){if(oK)return RO;oK=1;var e=zhe(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return RO=n,RO}var MO,sK;function m0(){if(sK)return MO;sK=1;var e=bl(),t=e.Symbol;return MO=t,MO}var PO,lK;function pat(){if(lK)return PO;lK=1;var e=m0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(o){var s=n.call(o,a),l=o[a];try{o[a]=void 0;var c=!0}catch{}var u=r.call(o);return c&&(s?o[a]=l:delete o[a]),u}return PO=i,PO}var NO,cK;function hat(){if(cK)return NO;cK=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return NO=n,NO}var LO,uK;function lc(){if(uK)return LO;uK=1;var e=m0(),t=pat(),n=hat(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?a:r:i&&i in Object(s)?t(s):n(s)}return LO=o,LO}var DO,dK;function cc(){if(dK)return DO;dK=1;function e(t){return t!=null&&typeof t=="object"}return DO=e,DO}var jO,fK;function hg(){if(fK)return jO;fK=1;var e=lc(),t=cc(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return jO=r,jO}var BO,pK;function t5(){if(pK)return BO;pK=1;var e=Xi(),t=hg(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,o){if(e(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||o!=null&&i in Object(o)}return BO=a,BO}var FO,hK;function pu(){if(hK)return FO;hK=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return FO=e,FO}var zO,gK;function n5(){if(gK)return zO;gK=1;var e=lc(),t=pu(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!t(s))return!1;var l=e(s);return l==r||l==a||l==n||l==i}return zO=o,zO}var HO,mK;function gat(){if(mK)return HO;mK=1;var e=bl(),t=e["__core-js_shared__"];return HO=t,HO}var UO,vK;function mat(){if(vK)return UO;vK=1;var e=gat(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return UO=n,UO}var WO,bK;function Hhe(){if(bK)return WO;bK=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return WO=n,WO}var qO,yK;function vat(){if(yK)return qO;yK=1;var e=n5(),t=mat(),n=pu(),r=Hhe(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,c=s.hasOwnProperty,u=RegExp("^"+l.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!n(f)||t(f))return!1;var h=e(f)?u:i;return h.test(r(f))}return qO=d,qO}var VO,SK;function bat(){if(SK)return VO;SK=1;function e(t,n){return t==null?void 0:t[n]}return VO=e,VO}var GO,xK;function pf(){if(xK)return GO;xK=1;var e=vat(),t=bat();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return GO=n,GO}var KO,wK;function l_(){if(wK)return KO;wK=1;var e=pf(),t=e(Object,"create");return KO=t,KO}var YO,CK;function yat(){if(CK)return YO;CK=1;var e=l_();function t(){this.__data__=e?e(null):{},this.size=0}return YO=t,YO}var XO,EK;function Sat(){if(EK)return XO;EK=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return XO=e,XO}var ZO,_K;function xat(){if(_K)return ZO;_K=1;var e=l_(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var o=this.__data__;if(e){var s=o[i];return s===t?void 0:s}return r.call(o,i)?o[i]:void 0}return ZO=a,ZO}var QO,TK;function wat(){if(TK)return QO;TK=1;var e=l_(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return QO=r,QO}var JO,kK;function Cat(){if(kK)return JO;kK=1;var e=l_(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return JO=n,JO}var e$,OK;function Eat(){if(OK)return e$;OK=1;var e=yat(),t=Sat(),n=xat(),r=wat(),a=Cat();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,e$=i,e$}var t$,$K;function _at(){if($K)return t$;$K=1;function e(){this.__data__=[],this.size=0}return t$=e,t$}var n$,IK;function r5(){if(IK)return n$;IK=1;function e(t,n){return t===n||t!==t&&n!==n}return n$=e,n$}var r$,AK;function c_(){if(AK)return r$;AK=1;var e=r5();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return r$=t,r$}var a$,RK;function Tat(){if(RK)return a$;RK=1;var e=c_(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,o=e(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():n.call(i,o,1),--this.size,!0}return a$=r,a$}var i$,MK;function kat(){if(MK)return i$;MK=1;var e=c_();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return i$=t,i$}var o$,PK;function Oat(){if(PK)return o$;PK=1;var e=c_();function t(n){return e(this.__data__,n)>-1}return o$=t,o$}var s$,NK;function $at(){if(NK)return s$;NK=1;var e=c_();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return s$=t,s$}var l$,LK;function u_(){if(LK)return l$;LK=1;var e=_at(),t=Tat(),n=kat(),r=Oat(),a=$at();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,l$=i,l$}var c$,DK;function a5(){if(DK)return c$;DK=1;var e=pf(),t=bl(),n=e(t,"Map");return c$=n,c$}var u$,jK;function Iat(){if(jK)return u$;jK=1;var e=Eat(),t=u_(),n=a5();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return u$=r,u$}var d$,BK;function Aat(){if(BK)return d$;BK=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return d$=e,d$}var f$,FK;function d_(){if(FK)return f$;FK=1;var e=Aat();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return f$=t,f$}var p$,zK;function Rat(){if(zK)return p$;zK=1;var e=d_();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return p$=t,p$}var h$,HK;function Mat(){if(HK)return h$;HK=1;var e=d_();function t(n){return e(this,n).get(n)}return h$=t,h$}var g$,UK;function Pat(){if(UK)return g$;UK=1;var e=d_();function t(n){return e(this,n).has(n)}return g$=t,g$}var m$,WK;function Nat(){if(WK)return m$;WK=1;var e=d_();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return m$=t,m$}var v$,qK;function i5(){if(qK)return v$;qK=1;var e=Iat(),t=Rat(),n=Mat(),r=Pat(),a=Nat();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var c=o[s];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,v$=i,v$}var b$,VK;function Uhe(){if(VK)return b$;VK=1;var e=i5(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],l=i.cache;if(l.has(s))return l.get(s);var c=r.apply(this,o);return i.cache=l.set(s,c)||l,c};return i.cache=new(n.Cache||e),i}return n.Cache=e,b$=n,b$}var y$,GK;function Lat(){if(GK)return y$;GK=1;var e=Uhe(),t=500;function n(r){var a=e(r,function(o){return i.size===t&&i.clear(),o}),i=a.cache;return a}return y$=n,y$}var S$,KK;function Dat(){if(KK)return S$;KK=1;var e=Lat(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(o,s,l,c){i.push(l?c.replace(n,"$1"):s||o)}),i});return S$=r,S$}var x$,YK;function o5(){if(YK)return x$;YK=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return x$=e,x$}var w$,XK;function jat(){if(XK)return w$;XK=1;var e=m0(),t=o5(),n=Xi(),r=hg(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(n(s))return t(s,o)+"";if(r(s))return i?i.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return w$=o,w$}var C$,ZK;function Whe(){if(ZK)return C$;ZK=1;var e=jat();function t(n){return n==null?"":e(n)}return C$=t,C$}var E$,QK;function qhe(){if(QK)return E$;QK=1;var e=Xi(),t=t5(),n=Dat(),r=Whe();function a(i,o){return e(i)?i:t(i,o)?[i]:n(r(i))}return E$=a,E$}var _$,JK;function f_(){if(JK)return _$;JK=1;var e=hg();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return _$=t,_$}var T$,eY;function s5(){if(eY)return T$;eY=1;var e=qhe(),t=f_();function n(r,a){a=e(a,r);for(var i=0,o=a.length;r!=null&&i<o;)r=r[t(a[i++])];return i&&i==o?r:void 0}return T$=n,T$}var k$,tY;function Vhe(){if(tY)return k$;tY=1;var e=s5();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return k$=t,k$}var Bat=Vhe();const go=An(Bat);var O$,nY;function Fat(){if(nY)return O$;nY=1;function e(t){return t==null}return O$=e,O$}var zat=Fat();const Pn=An(zat);var $$,rY;function Hat(){if(rY)return $$;rY=1;var e=lc(),t=Xi(),n=cc(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return $$=a,$$}var Uat=Hat();const Md=An(Uat);var Wat=n5();const On=An(Wat);var qat=pu();const gg=An(qat);var I$,aY;function Ghe(){if(aY)return I$;aY=1;var e=lc(),t=cc(),n="[object Number]";function r(a){return typeof a=="number"||t(a)&&e(a)==n}return I$=r,I$}var A$,iY;function Vat(){if(iY)return A$;iY=1;var e=Ghe();function t(n){return e(n)&&n!=+n}return A$=t,A$}var Gat=Vat();const v0=An(Gat);var Kat=Ghe();const Yat=An(Kat);var $i=function(t){return t===0?0:t>0?1:-1},ad=function(t){return Md(t)&&t.indexOf("%")===t.length-1},St=function(t){return Yat(t)&&!v0(t)},Xat=function(t){return Pn(t)},Ca=function(t){return St(t)||Md(t)},Zat=0,mg=function(t){var n=++Zat;return"".concat(t||"").concat(n)},Ii=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!St(t)&&!Md(t))return r;var i;if(ad(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return v0(i)&&(i=r),a&&i>n&&(i=n),i},Mc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},Qat=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},a=0;a<n;a++)if(!r[t[a]])r[t[a]]=!0;else return!0;return!1},uo=function(t,n){return St(t)&&St(n)?function(r){return t+r*(n-t)}:function(){return n}};function Qw(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):go(r,t))===n})}var Jat=function(t,n){return St(t)&&St(n)?t-n:Md(t)&&Md(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function kp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function VN(e){"@babel/helpers - typeof";return VN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},VN(e)}var eit=["viewBox","children"],tit=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],oY=["points","pathLength"],R$={svg:eit,polygon:oY,polyline:oY},l5=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Jw=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(p.isValidElement(t)&&(r=t.props),!gg(r))return null;var a={};return Object.keys(r).forEach(function(i){l5.includes(i)&&(a[i]=n||function(o){return r[i](r,o)})}),a},nit=function(t,n,r){return function(a){return t(n,r,a),null}},Pd=function(t,n,r){if(!gg(t)||VN(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];l5.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=nit(o,n,r))}),a},rit=["children"],ait=["children"];function sY(e,t){if(e==null)return{};var n=iit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function GN(e){"@babel/helpers - typeof";return GN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},GN(e)}var lY={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Ul=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},cY=null,M$=null,c5=function e(t){if(t===cY&&Array.isArray(M$))return M$;var n=[];return p.Children.forEach(t,function(r){Pn(r)||(cx.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),M$=n,cY=t,n};function mo(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(a){return Ul(a)}):r=[Ul(t)],c5(e).forEach(function(a){var i=go(a,"type.displayName")||go(a,"type.name");r.indexOf(i)!==-1&&n.push(a)}),n}function so(e,t){var n=mo(e,t);return n&&n[0]}var uY=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,a=n.height;return!(!St(r)||r<=0||!St(a)||a<=0)},oit=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],sit=function(t){return t&&t.type&&Md(t.type)&&oit.indexOf(t.type)>=0},lit=function(t){return t&&GN(t)==="object"&&"clipDot"in t},cit=function(t,n,r,a){var i,o=(i=R$==null?void 0:R$[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!On(t)&&(a&&o.includes(n)||tit.includes(n))||r&&l5.includes(n)},ln=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(p.isValidElement(t)&&(a=t.props),!gg(a))return null;var i={};return Object.keys(a).forEach(function(o){var s;cit((s=a)===null||s===void 0?void 0:s[o],o,n,r)&&(i[o]=a[o])}),i},KN=function e(t,n){if(t===n)return!0;var r=p.Children.count(t);if(r!==p.Children.count(n))return!1;if(r===0)return!0;if(r===1)return dY(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<r;a++){var i=t[a],o=n[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!dY(i,o))return!1}return!0},dY=function(t,n){if(Pn(t)&&Pn(n))return!0;if(!Pn(t)&&!Pn(n)){var r=t.props||{},a=r.children,i=sY(r,rit),o=n.props||{},s=o.children,l=sY(o,ait);return a&&s?kp(i,l)&&KN(a,s):!a&&!s?kp(i,l):!1}return!1},fY=function(t,n){var r=[],a={};return c5(t).forEach(function(i,o){if(sit(i))r.push(i);else if(i){var s=Ul(i.type),l=n[s]||{},c=l.handler,u=l.once;if(c&&(!u||!a[s])){var d=c(i,s,o);r.push(d),a[s]=!0}}}),r},uit=function(t){var n=t&&t.type;return n&&lY[n]?lY[n]:null},dit=function(t,n){return c5(n).indexOf(t)},fit=["children","width","height","viewBox","className","style","title","desc"];function YN(){return YN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YN.apply(this,arguments)}function pit(e,t){if(e==null)return{};var n=hit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XN(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,i=e.className,o=e.style,s=e.title,l=e.desc,c=pit(e,fit),u=a||{width:n,height:r,x:0,y:0},d=Fn("recharts-surface",i);return U.createElement("svg",YN({},ln(c,!0,"svg"),{className:d,width:n,height:r,style:o,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),U.createElement("title",null,s),U.createElement("desc",null,l),t)}var git=["children","className"];function ZN(){return ZN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ZN.apply(this,arguments)}function mit(e,t){if(e==null)return{};var n=vit(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ar=U.forwardRef(function(e,t){var n=e.children,r=e.className,a=mit(e,git),i=Fn("recharts-layer",r);return U.createElement("g",ZN({className:i},ln(a,!0),{ref:t}),n)}),_s=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i]},P$,pY;function bit(){if(pY)return P$;pY=1;function e(t,n,r){var a=-1,i=t.length;n<0&&(n=-n>i?0:i+n),r=r>i?i:r,r<0&&(r+=i),i=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(i);++a<i;)o[a]=t[a+n];return o}return P$=e,P$}var N$,hY;function yit(){if(hY)return N$;hY=1;var e=bit();function t(n,r,a){var i=n.length;return a=a===void 0?i:a,!r&&a>=i?n:e(n,r,a)}return N$=t,N$}var L$,gY;function Khe(){if(gY)return L$;gY=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+e+a+i+"]");function l(c){return s.test(c)}return L$=l,L$}var D$,mY;function Sit(){if(mY)return D$;mY=1;function e(t){return t.split("")}return D$=e,D$}var j$,vY;function xit(){if(vY)return j$;vY=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",o="["+e+"]",s="["+a+"]",l="\\ud83c[\\udffb-\\udfff]",c="(?:"+s+"|"+l+")",u="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",g=c+"?",m="["+i+"]?",v="(?:"+h+"(?:"+[u,d,f].join("|")+")"+m+g+")*",b=m+g+v,y="(?:"+[u+s+"?",s,d,f,o].join("|")+")",S=RegExp(l+"(?="+l+")|"+y+b,"g");function C(x){return x.match(S)||[]}return j$=C,j$}var B$,bY;function wit(){if(bY)return B$;bY=1;var e=Sit(),t=Khe(),n=xit();function r(a){return t(a)?n(a):e(a)}return B$=r,B$}var F$,yY;function Cit(){if(yY)return F$;yY=1;var e=yit(),t=Khe(),n=wit(),r=Whe();function a(i){return function(o){o=r(o);var s=t(o)?n(o):void 0,l=s?s[0]:o.charAt(0),c=s?e(s,1).join(""):o.slice(1);return l[i]()+c}}return F$=a,F$}var z$,SY;function Eit(){if(SY)return z$;SY=1;var e=Cit(),t=e("toUpperCase");return z$=t,z$}var _it=Eit();const p_=An(_it);function _r(e){return function(){return e}}const K3t=Math.abs,Y3t=Math.atan2,Yhe=Math.cos,X3t=Math.max,Z3t=Math.min,eC=Math.sin,Ds=Math.sqrt,xY=1e-12,eh=Math.PI,wY=eh/2,h_=2*eh;function Q3t(e){return e>1?0:e<-1?eh:Math.acos(e)}function J3t(e){return e>=1?wY:e<=-1?-wY:Math.asin(e)}const QN=Math.PI,JN=2*QN,Du=1e-6,Tit=JN-Du;function Xhe(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function kit(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Xhe;const n=10**t;return function(r){this._+=r[0];for(let a=1,i=r.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+r[a]}}class Oit{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Xhe:kit(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,a){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+a}`}bezierCurveTo(t,n,r,a,i,o){this._append`C${+t},${+n},${+r},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,r,a,i){if(t=+t,n=+n,r=+r,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,s=this._y1,l=r-t,c=a-n,u=o-t,d=s-n,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>Du)if(!(Math.abs(d*l-c*u)>Du)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,g=a-s,m=l*l+c*c,v=h*h+g*g,b=Math.sqrt(m),y=Math.sqrt(f),S=i*Math.tan((QN-Math.acos((m+f-v)/(2*b*y)))/2),C=S/y,x=S/b;Math.abs(C-1)>Du&&this._append`L${t+C*u},${n+C*d}`,this._append`A${i},${i},0,0,${+(d*h>u*g)},${this._x1=t+x*l},${this._y1=n+x*c}`}}arc(t,n,r,a,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(a),l=r*Math.sin(a),c=t+s,u=n+l,d=1^o,f=o?a-i:i-a;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Du||Math.abs(this._y1-u)>Du)&&this._append`L${c},${u}`,r&&(f<0&&(f=f%JN+JN),f>Tit?this._append`A${r},${r},0,1,${d},${t-s},${n-l}A${r},${r},0,1,${d},${this._x1=c},${this._y1=u}`:f>Du&&this._append`A${r},${r},0,${+(f>=QN)},${d},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function u5(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Oit(t)}function d5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zhe(e){this._context=e}Zhe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Nd(e){return new Zhe(e)}function Qhe(e){return e[0]}function Jhe(e){return e[1]}function f5(e,t){var n=_r(!0),r=null,a=Nd,i=null,o=u5(s);e=typeof e=="function"?e:e===void 0?Qhe:_r(e),t=typeof t=="function"?t:t===void 0?Jhe:_r(t);function s(l){var c,u=(l=d5(l)).length,d,f=!1,h;for(r==null&&(i=a(h=o())),c=0;c<=u;++c)!(c<u&&n(d=l[c],c,l))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(d,c,l),+t(d,c,l));if(h)return i=null,h+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:_r(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:_r(+l),s):t},s.defined=function(l){return arguments.length?(n=typeof l=="function"?l:_r(!!l),s):n},s.curve=function(l){return arguments.length?(a=l,r!=null&&(i=a(r)),s):a},s.context=function(l){return arguments.length?(l==null?r=i=null:i=a(r=l),s):r},s}function AS(e,t,n){var r=null,a=_r(!0),i=null,o=Nd,s=null,l=u5(c);e=typeof e=="function"?e:e===void 0?Qhe:_r(+e),t=typeof t=="function"?t:_r(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Jhe:_r(+n);function c(d){var f,h,g,m=(d=d5(d)).length,v,b=!1,y,S=new Array(m),C=new Array(m);for(i==null&&(s=o(y=l())),f=0;f<=m;++f){if(!(f<m&&a(v=d[f],f,d))===b)if(b=!b)h=f,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),g=f-1;g>=h;--g)s.point(S[g],C[g]);s.lineEnd(),s.areaEnd()}b&&(S[f]=+e(v,f,d),C[f]=+t(v,f,d),s.point(r?+r(v,f,d):S[f],n?+n(v,f,d):C[f]))}if(y)return s=null,y+""||null}function u(){return f5().defined(a).curve(o).context(i)}return c.x=function(d){return arguments.length?(e=typeof d=="function"?d:_r(+d),r=null,c):e},c.x0=function(d){return arguments.length?(e=typeof d=="function"?d:_r(+d),c):e},c.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:_r(+d),c):r},c.y=function(d){return arguments.length?(t=typeof d=="function"?d:_r(+d),n=null,c):t},c.y0=function(d){return arguments.length?(t=typeof d=="function"?d:_r(+d),c):t},c.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:_r(+d),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(d){return arguments.length?(a=typeof d=="function"?d:_r(!!d),c):a},c.curve=function(d){return arguments.length?(o=d,i!=null&&(s=o(i)),c):o},c.context=function(d){return arguments.length?(d==null?i=s=null:s=o(i=d),c):i},c}class ege{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function p5(e){return new ege(e,!0)}function h5(e){return new ege(e,!1)}const g5={draw(e,t){const n=Ds(t/eh);e.moveTo(n,0),e.arc(0,0,n,0,h_)}},$it={draw(e,t){const n=Ds(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},tge=Ds(1/3),Iit=tge*2,Ait={draw(e,t){const n=Ds(t/Iit),r=n*tge;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Rit={draw(e,t){const n=Ds(t),r=-n/2;e.rect(r,r,n,n)}},Mit=.8908130915292852,nge=eC(eh/10)/eC(7*eh/10),Pit=eC(h_/10)*nge,Nit=-Yhe(h_/10)*nge,Lit={draw(e,t){const n=Ds(t*Mit),r=Pit*n,a=Nit*n;e.moveTo(0,-n),e.lineTo(r,a);for(let i=1;i<5;++i){const o=h_*i/5,s=Yhe(o),l=eC(o);e.lineTo(l*n,-s*n),e.lineTo(s*r-l*a,l*r+s*a)}e.closePath()}},H$=Ds(3),Dit={draw(e,t){const n=-Ds(t/(H$*3));e.moveTo(0,n*2),e.lineTo(-H$*n,-n),e.lineTo(H$*n,-n),e.closePath()}},_o=-.5,To=Ds(3)/2,eL=1/Ds(12),jit=(eL/2+1)*3,Bit={draw(e,t){const n=Ds(t/jit),r=n/2,a=n*eL,i=r,o=n*eL+n,s=-i,l=o;e.moveTo(r,a),e.lineTo(i,o),e.lineTo(s,l),e.lineTo(_o*r-To*a,To*r+_o*a),e.lineTo(_o*i-To*o,To*i+_o*o),e.lineTo(_o*s-To*l,To*s+_o*l),e.lineTo(_o*r+To*a,_o*a-To*r),e.lineTo(_o*i+To*o,_o*o-To*i),e.lineTo(_o*s+To*l,_o*l-To*s),e.closePath()}};function Fit(e,t){let n=null,r=u5(a);e=typeof e=="function"?e:_r(e||g5),t=typeof t=="function"?t:_r(t===void 0?64:+t);function a(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:_r(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:_r(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function nu(){}function tC(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function g_(e){this._context=e}g_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:tC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nb(e){return new g_(e)}function rge(e){this._context=e}rge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function age(e){return new rge(e)}function ige(e){this._context=e}ige.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:tC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oge(e){return new ige(e)}function sge(e,t){this._basis=new g_(e),this._beta=t}sge.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],a=t[0],i=e[n]-r,o=t[n]-a,s=-1,l;++s<=n;)l=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+l*i),this._beta*t[s]+(1-this._beta)*(a+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const zit=function e(t){function n(r){return t===1?new g_(r):new sge(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function nC(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function m5(e,t){this._context=e,this._k=(1-t)/6}m5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:nC(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const lge=function e(t){function n(r){return new m5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function v5(e,t){this._context=e,this._k=(1-t)/6}v5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Hit=function e(t){function n(r){return new v5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function b5(e,t){this._context=e,this._k=(1-t)/6}b5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:nC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Uit=function e(t){function n(r){return new b5(r,t)}return n.tension=function(r){return e(+r)},n}(0);function y5(e,t,n){var r=e._x1,a=e._y1,i=e._x2,o=e._y2;if(e._l01_a>xY){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,a=(a*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>xY){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*c+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,a,i,o,e._x2,e._y2)}function cge(e,t){this._context=e,this._alpha=t}cge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const uge=function e(t){function n(r){return t?new cge(r,t):new m5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function dge(e,t){this._context=e,this._alpha=t}dge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Wit=function e(t){function n(r){return t?new dge(r,t):new v5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function fge(e,t){this._context=e,this._alpha=t}fge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:y5(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const qit=function e(t){function n(r){return t?new fge(r,t):new b5(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function pge(e){this._context=e}pge.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function hge(e){return new pge(e)}function CY(e){return e<0?-1:1}function EY(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(CY(i)+CY(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function _Y(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function U$(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,s=(i-r)/3;e._context.bezierCurveTo(r+s,a+s*t,i-s,o-s*n,i,o)}function rC(e){this._context=e}rC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:U$(this,this._t0,_Y(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,U$(this,_Y(this,n=EY(this,e,t)),n);break;default:U$(this,this._t0,n=EY(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function gge(e){this._context=new mge(e)}(gge.prototype=Object.create(rC.prototype)).point=function(e,t){rC.prototype.point.call(this,t,e)};function mge(e){this._context=e}mge.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}};function S5(e){return new rC(e)}function x5(e){return new gge(e)}function vge(e){this._context=e}vge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=TY(e),a=TY(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],a[0][i],r[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function TY(e){var t,n=e.length-1,r,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=a[t]/i[t-1],i[t]-=r,o[t]-=r*o[t-1];for(a[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function w5(e){return new vge(e)}function m_(e,t){this._context=e,this._t=t}m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function C5(e){return new m_(e,.5)}function E5(e){return new m_(e,0)}function _5(e){return new m_(e,1)}function th(e,t){if((o=e.length)>1)for(var n=1,r,a,i=e[t[0]],o,s=i.length;n<o;++n)for(a=i,i=e[t[n]],r=0;r<s;++r)i[r][1]+=i[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function tL(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function Vit(e,t){return e[t]}function Git(e){const t=[];return t.key=e,t}function Kit(){var e=_r([]),t=tL,n=th,r=Vit;function a(i){var o=Array.from(e.apply(this,arguments),Git),s,l=o.length,c=-1,u;for(const d of i)for(s=0,++c;s<l;++s)(o[s][c]=[0,+r(d,o[s].key,c,i)]).data=d;for(s=0,u=d5(t(o));s<l;++s)o[u[s]].index=s;return n(o,u),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:_r(Array.from(i)),a):e},a.value=function(i){return arguments.length?(r=typeof i=="function"?i:_r(+i),a):r},a.order=function(i){return arguments.length?(t=i==null?tL:typeof i=="function"?i:_r(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(n=i??th,a):n},a}function Yit(e,t){if((r=e.length)>0){for(var n,r,a=0,i=e[0].length,o;a<i;++a){for(o=n=0;n<r;++n)o+=e[n][a][1]||0;if(o)for(n=0;n<r;++n)e[n][a][1]/=o}th(e,t)}}function Xit(e,t){if((a=e.length)>0){for(var n=0,r=e[t[0]],a,i=r.length;n<i;++n){for(var o=0,s=0;o<a;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}th(e,t)}}function Zit(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,r=1,a,i,o;r<i;++r){for(var s=0,l=0,c=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=u[r-1][1]||0,h=(d-f)/2,g=0;g<s;++g){var m=e[t[g]],v=m[r][1]||0,b=m[r-1][1]||0;h+=v-b}l+=d,c+=h*d}a[r-1][1]+=a[r-1][0]=n,l&&(n-=c/l)}a[r-1][1]+=a[r-1][0]=n,th(e,t)}}function Gb(e){"@babel/helpers - typeof";return Gb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gb(e)}var Qit=["type","size","sizeType"];function nL(){return nL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nL.apply(this,arguments)}function kY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function OY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kY(Object(n),!0).forEach(function(r){Jit(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kY(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jit(e,t,n){return t=eot(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eot(e){var t=tot(e,"string");return Gb(t)=="symbol"?t:t+""}function tot(e,t){if(Gb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function not(e,t){if(e==null)return{};var n=rot(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rot(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bge={symbolCircle:g5,symbolCross:$it,symbolDiamond:Ait,symbolSquare:Rit,symbolStar:Lit,symbolTriangle:Dit,symbolWye:Bit},aot=Math.PI/180,iot=function(t){var n="symbol".concat(p_(t));return bge[n]||g5},oot=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*aot;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},sot=function(t,n){bge["symbol".concat(p_(t))]=n},T5=function(t){var n=t.type,r=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,o=t.sizeType,s=o===void 0?"area":o,l=not(t,Qit),c=OY(OY({},l),{},{type:r,size:i,sizeType:s}),u=function(){var v=iot(r),b=Fit().type(v).size(oot(i,s,r));return b()},d=c.className,f=c.cx,h=c.cy,g=ln(c,!0);return f===+f&&h===+h&&i===+i?U.createElement("path",nL({},g,{className:Fn("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(h,")"),d:u()})):null};T5.registerSymbol=sot;function nh(e){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nh(e)}function rL(){return rL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rL.apply(this,arguments)}function $Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lot(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$Y(Object(n),!0).forEach(function(r){Kb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$Y(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uot(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sge(r.key),r)}}function dot(e,t,n){return t&&uot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function fot(e,t,n){return t=aC(t),pot(e,yge()?Reflect.construct(t,n||[],aC(e).constructor):t.apply(e,n))}function pot(e,t){if(t&&(nh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hot(e)}function hot(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yge=function(){return!!e})()}function aC(e){return aC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},aC(e)}function got(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&aL(e,t)}function aL(e,t){return aL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},aL(e,t)}function Kb(e,t,n){return t=Sge(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sge(e){var t=mot(e,"string");return nh(t)=="symbol"?t:t+""}function mot(e,t){if(nh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ko=32,k5=function(e){function t(){return cot(this,t),fot(this,t,arguments)}return got(t,e),dot(t,[{key:"renderIcon",value:function(r){var a=this.props.inactiveColor,i=ko/2,o=ko/6,s=ko/3,l=r.inactive?a:r.color;if(r.type==="plainline")return U.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:ko,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return U.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(i,"h").concat(s,`
|
|
642
642
|
A`).concat(o,",").concat(o,",0,1,1,").concat(2*s,",").concat(i,`
|
|
643
643
|
H`).concat(ko,"M").concat(2*s,",").concat(i,`
|
|
644
644
|
A`).concat(o,",").concat(o,",0,1,1,").concat(s,",").concat(i),className:"recharts-legend-icon"});if(r.type==="rect")return U.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(ko/8,"h").concat(ko,"v").concat(ko*3/4,"h").concat(-ko,"z"),className:"recharts-legend-icon"});if(U.isValidElement(r.legendIcon)){var c=lot({},r);return delete c.legendIcon,U.cloneElement(r.legendIcon,c)}return U.createElement(T5,{fill:l,cx:i,cy:i,size:ko,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,a=this.props,i=a.payload,o=a.iconSize,s=a.layout,l=a.formatter,c=a.inactiveColor,u={x:0,y:0,width:ko,height:ko},d={display:s==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(h,g){var m=h.formatter||l,v=Fn(Kb(Kb({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",h.inactive));if(h.type==="none")return null;var b=On(h.value)?null:h.value;_s(!On(h.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var y=h.inactive?c:h.color;return U.createElement("li",rL({className:v,style:d,key:"legend-item-".concat(g)},Pd(r.props,h,g)),U.createElement(XN,{width:o,height:o,viewBox:u,style:f},r.renderIcon(h)),U.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},m?m(b,h,g):b))})}},{key:"render",value:function(){var r=this.props,a=r.payload,i=r.layout,o=r.align;if(!a||!a.length)return null;var s={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return U.createElement("ul",{className:"recharts-default-legend",style:s},this.renderItems())}}])}(p.PureComponent);Kb(k5,"displayName","Legend");Kb(k5,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var W$,IY;function vot(){if(IY)return W$;IY=1;var e=u_();function t(){this.__data__=new e,this.size=0}return W$=t,W$}var q$,AY;function bot(){if(AY)return q$;AY=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return q$=e,q$}var V$,RY;function yot(){if(RY)return V$;RY=1;function e(t){return this.__data__.get(t)}return V$=e,V$}var G$,MY;function Sot(){if(MY)return G$;MY=1;function e(t){return this.__data__.has(t)}return G$=e,G$}var K$,PY;function xot(){if(PY)return K$;PY=1;var e=u_(),t=a5(),n=i5(),r=200;function a(i,o){var s=this.__data__;if(s instanceof e){var l=s.__data__;if(!t||l.length<r-1)return l.push([i,o]),this.size=++s.size,this;s=this.__data__=new n(l)}return s.set(i,o),this.size=s.size,this}return K$=a,K$}var Y$,NY;function xge(){if(NY)return Y$;NY=1;var e=u_(),t=vot(),n=bot(),r=yot(),a=Sot(),i=xot();function o(s){var l=this.__data__=new e(s);this.size=l.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,Y$=o,Y$}var X$,LY;function wot(){if(LY)return X$;LY=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return X$=t,X$}var Z$,DY;function Cot(){if(DY)return Z$;DY=1;function e(t){return this.__data__.has(t)}return Z$=e,Z$}var Q$,jY;function wge(){if(jY)return Q$;jY=1;var e=i5(),t=wot(),n=Cot();function r(a){var i=-1,o=a==null?0:a.length;for(this.__data__=new e;++i<o;)this.add(a[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Q$=r,Q$}var J$,BY;function Cge(){if(BY)return J$;BY=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return J$=e,J$}var eI,FY;function Ege(){if(FY)return eI;FY=1;function e(t,n){return t.has(n)}return eI=e,eI}var tI,zY;function _ge(){if(zY)return tI;zY=1;var e=wge(),t=Cge(),n=Ege(),r=1,a=2;function i(o,s,l,c,u,d){var f=l&r,h=o.length,g=s.length;if(h!=g&&!(f&&g>h))return!1;var m=d.get(o),v=d.get(s);if(m&&v)return m==s&&v==o;var b=-1,y=!0,S=l&a?new e:void 0;for(d.set(o,s),d.set(s,o);++b<h;){var C=o[b],x=s[b];if(c)var w=f?c(x,C,b,s,o,d):c(C,x,b,o,s,d);if(w!==void 0){if(w)continue;y=!1;break}if(S){if(!t(s,function(_,T){if(!n(S,T)&&(C===_||u(C,_,l,c,d)))return S.push(T)})){y=!1;break}}else if(!(C===x||u(C,x,l,c,d))){y=!1;break}}return d.delete(o),d.delete(s),y}return tI=i,tI}var nI,HY;function Eot(){if(HY)return nI;HY=1;var e=bl(),t=e.Uint8Array;return nI=t,nI}var rI,UY;function _ot(){if(UY)return rI;UY=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return rI=e,rI}var aI,WY;function O5(){if(WY)return aI;WY=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return aI=e,aI}var iI,qY;function Tot(){if(qY)return iI;qY=1;var e=m0(),t=Eot(),n=r5(),r=_ge(),a=_ot(),i=O5(),o=1,s=2,l="[object Boolean]",c="[object Date]",u="[object Error]",d="[object Map]",f="[object Number]",h="[object RegExp]",g="[object Set]",m="[object String]",v="[object Symbol]",b="[object ArrayBuffer]",y="[object DataView]",S=e?e.prototype:void 0,C=S?S.valueOf:void 0;function x(w,_,T,k,O,I,M){switch(T){case y:if(w.byteLength!=_.byteLength||w.byteOffset!=_.byteOffset)return!1;w=w.buffer,_=_.buffer;case b:return!(w.byteLength!=_.byteLength||!I(new t(w),new t(_)));case l:case c:case f:return n(+w,+_);case u:return w.name==_.name&&w.message==_.message;case h:case m:return w==_+"";case d:var $=a;case g:var R=k&o;if($||($=i),w.size!=_.size&&!R)return!1;var A=M.get(w);if(A)return A==_;k|=s,M.set(w,_);var P=r($(w),$(_),k,O,I,M);return M.delete(w),P;case v:if(C)return C.call(w)==C.call(_)}return!1}return iI=x,iI}var oI,VY;function Tge(){if(VY)return oI;VY=1;function e(t,n){for(var r=-1,a=n.length,i=t.length;++r<a;)t[i+r]=n[r];return t}return oI=e,oI}var sI,GY;function kot(){if(GY)return sI;GY=1;var e=Tge(),t=Xi();function n(r,a,i){var o=a(r);return t(r)?o:e(o,i(r))}return sI=n,sI}var lI,KY;function Oot(){if(KY)return lI;KY=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=0,o=[];++r<a;){var s=t[r];n(s,r,t)&&(o[i++]=s)}return o}return lI=e,lI}var cI,YY;function $ot(){if(YY)return cI;YY=1;function e(){return[]}return cI=e,cI}var uI,XY;function Iot(){if(XY)return uI;XY=1;var e=Oot(),t=$ot(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),e(a(o),function(s){return r.call(o,s)}))}:t;return uI=i,uI}var dI,ZY;function Aot(){if(ZY)return dI;ZY=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return dI=e,dI}var fI,QY;function Rot(){if(QY)return fI;QY=1;var e=lc(),t=cc(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return fI=r,fI}var pI,JY;function $5(){if(JY)return pI;JY=1;var e=Rot(),t=cc(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(o){return t(o)&&r.call(o,"callee")&&!a.call(o,"callee")};return pI=i,pI}var kv={exports:{}},hI,eX;function Mot(){if(eX)return hI;eX=1;function e(){return!1}return hI=e,hI}kv.exports;var tX;function kge(){return tX||(tX=1,function(e,t){var n=bl(),r=Mot(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,s=o?n.Buffer:void 0,l=s?s.isBuffer:void 0,c=l||r;e.exports=c}(kv,kv.exports)),kv.exports}var gI,nX;function I5(){if(nX)return gI;nX=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return gI=n,gI}var mI,rX;function A5(){if(rX)return mI;rX=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return mI=t,mI}var vI,aX;function Pot(){if(aX)return vI;aX=1;var e=lc(),t=A5(),n=cc(),r="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[object Date]",s="[object Error]",l="[object Function]",c="[object Map]",u="[object Number]",d="[object Object]",f="[object RegExp]",h="[object Set]",g="[object String]",m="[object WeakMap]",v="[object ArrayBuffer]",b="[object DataView]",y="[object Float32Array]",S="[object Float64Array]",C="[object Int8Array]",x="[object Int16Array]",w="[object Int32Array]",_="[object Uint8Array]",T="[object Uint8ClampedArray]",k="[object Uint16Array]",O="[object Uint32Array]",I={};I[y]=I[S]=I[C]=I[x]=I[w]=I[_]=I[T]=I[k]=I[O]=!0,I[r]=I[a]=I[v]=I[i]=I[b]=I[o]=I[s]=I[l]=I[c]=I[u]=I[d]=I[f]=I[h]=I[g]=I[m]=!1;function M($){return n($)&&t($.length)&&!!I[e($)]}return vI=M,vI}var bI,iX;function Oge(){if(iX)return bI;iX=1;function e(t){return function(n){return t(n)}}return bI=e,bI}var Ov={exports:{}};Ov.exports;var oX;function Not(){return oX||(oX=1,function(e,t){var n=zhe(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,o=i&&n.process,s=function(){try{var l=a&&a.require&&a.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();e.exports=s}(Ov,Ov.exports)),Ov.exports}var yI,sX;function $ge(){if(sX)return yI;sX=1;var e=Pot(),t=Oge(),n=Not(),r=n&&n.isTypedArray,a=r?t(r):e;return yI=a,yI}var SI,lX;function Lot(){if(lX)return SI;lX=1;var e=Aot(),t=$5(),n=Xi(),r=kge(),a=I5(),i=$ge(),o=Object.prototype,s=o.hasOwnProperty;function l(c,u){var d=n(c),f=!d&&t(c),h=!d&&!f&&r(c),g=!d&&!f&&!h&&i(c),m=d||f||h||g,v=m?e(c.length,String):[],b=v.length;for(var y in c)(u||s.call(c,y))&&!(m&&(y=="length"||h&&(y=="offset"||y=="parent")||g&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||a(y,b)))&&v.push(y);return v}return SI=l,SI}var xI,cX;function Dot(){if(cX)return xI;cX=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return xI=t,xI}var wI,uX;function Ige(){if(uX)return wI;uX=1;function e(t,n){return function(r){return t(n(r))}}return wI=e,wI}var CI,dX;function jot(){if(dX)return CI;dX=1;var e=Ige(),t=e(Object.keys,Object);return CI=t,CI}var EI,fX;function Bot(){if(fX)return EI;fX=1;var e=Dot(),t=jot(),n=Object.prototype,r=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var o=[];for(var s in Object(i))r.call(i,s)&&s!="constructor"&&o.push(s);return o}return EI=a,EI}var _I,pX;function b0(){if(pX)return _I;pX=1;var e=n5(),t=A5();function n(r){return r!=null&&t(r.length)&&!e(r)}return _I=n,_I}var TI,hX;function v_(){if(hX)return TI;hX=1;var e=Lot(),t=Bot(),n=b0();function r(a){return n(a)?e(a):t(a)}return TI=r,TI}var kI,gX;function Fot(){if(gX)return kI;gX=1;var e=kot(),t=Iot(),n=v_();function r(a){return e(a,n,t)}return kI=r,kI}var OI,mX;function zot(){if(mX)return OI;mX=1;var e=Fot(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,o,s,l,c,u){var d=s&t,f=e(i),h=f.length,g=e(o),m=g.length;if(h!=m&&!d)return!1;for(var v=h;v--;){var b=f[v];if(!(d?b in o:r.call(o,b)))return!1}var y=u.get(i),S=u.get(o);if(y&&S)return y==o&&S==i;var C=!0;u.set(i,o),u.set(o,i);for(var x=d;++v<h;){b=f[v];var w=i[b],_=o[b];if(l)var T=d?l(_,w,b,o,i,u):l(w,_,b,i,o,u);if(!(T===void 0?w===_||c(w,_,s,l,u):T)){C=!1;break}x||(x=b=="constructor")}if(C&&!x){var k=i.constructor,O=o.constructor;k!=O&&"constructor"in i&&"constructor"in o&&!(typeof k=="function"&&k instanceof k&&typeof O=="function"&&O instanceof O)&&(C=!1)}return u.delete(i),u.delete(o),C}return OI=a,OI}var $I,vX;function Hot(){if(vX)return $I;vX=1;var e=pf(),t=bl(),n=e(t,"DataView");return $I=n,$I}var II,bX;function Uot(){if(bX)return II;bX=1;var e=pf(),t=bl(),n=e(t,"Promise");return II=n,II}var AI,yX;function Age(){if(yX)return AI;yX=1;var e=pf(),t=bl(),n=e(t,"Set");return AI=n,AI}var RI,SX;function Wot(){if(SX)return RI;SX=1;var e=pf(),t=bl(),n=e(t,"WeakMap");return RI=n,RI}var MI,xX;function qot(){if(xX)return MI;xX=1;var e=Hot(),t=a5(),n=Uot(),r=Age(),a=Wot(),i=lc(),o=Hhe(),s="[object Map]",l="[object Object]",c="[object Promise]",u="[object Set]",d="[object WeakMap]",f="[object DataView]",h=o(e),g=o(t),m=o(n),v=o(r),b=o(a),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=f||t&&y(new t)!=s||n&&y(n.resolve())!=c||r&&y(new r)!=u||a&&y(new a)!=d)&&(y=function(S){var C=i(S),x=C==l?S.constructor:void 0,w=x?o(x):"";if(w)switch(w){case h:return f;case g:return s;case m:return c;case v:return u;case b:return d}return C}),MI=y,MI}var PI,wX;function Vot(){if(wX)return PI;wX=1;var e=xge(),t=_ge(),n=Tot(),r=zot(),a=qot(),i=Xi(),o=kge(),s=$ge(),l=1,c="[object Arguments]",u="[object Array]",d="[object Object]",f=Object.prototype,h=f.hasOwnProperty;function g(m,v,b,y,S,C){var x=i(m),w=i(v),_=x?u:a(m),T=w?u:a(v);_=_==c?d:_,T=T==c?d:T;var k=_==d,O=T==d,I=_==T;if(I&&o(m)){if(!o(v))return!1;x=!0,k=!1}if(I&&!k)return C||(C=new e),x||s(m)?t(m,v,b,y,S,C):n(m,v,_,b,y,S,C);if(!(b&l)){var M=k&&h.call(m,"__wrapped__"),$=O&&h.call(v,"__wrapped__");if(M||$){var R=M?m.value():m,A=$?v.value():v;return C||(C=new e),S(R,A,b,y,C)}}return I?(C||(C=new e),r(m,v,b,y,S,C)):!1}return PI=g,PI}var NI,CX;function R5(){if(CX)return NI;CX=1;var e=Vot(),t=cc();function n(r,a,i,o,s){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,i,o,n,s)}return NI=n,NI}var LI,EX;function Got(){if(EX)return LI;EX=1;var e=xge(),t=R5(),n=1,r=2;function a(i,o,s,l){var c=s.length,u=c,d=!l;if(i==null)return!u;for(i=Object(i);c--;){var f=s[c];if(d&&f[2]?f[1]!==i[f[0]]:!(f[0]in i))return!1}for(;++c<u;){f=s[c];var h=f[0],g=i[h],m=f[1];if(d&&f[2]){if(g===void 0&&!(h in i))return!1}else{var v=new e;if(l)var b=l(g,m,h,i,o,v);if(!(b===void 0?t(m,g,n|r,l,v):b))return!1}}return!0}return LI=a,LI}var DI,_X;function Rge(){if(_X)return DI;_X=1;var e=pu();function t(n){return n===n&&!e(n)}return DI=t,DI}var jI,TX;function Kot(){if(TX)return jI;TX=1;var e=Rge(),t=v_();function n(r){for(var a=t(r),i=a.length;i--;){var o=a[i],s=r[o];a[i]=[o,s,e(s)]}return a}return jI=n,jI}var BI,kX;function Mge(){if(kX)return BI;kX=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return BI=e,BI}var FI,OX;function Yot(){if(OX)return FI;OX=1;var e=Got(),t=Kot(),n=Mge();function r(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(o){return o===a||e(o,a,i)}}return FI=r,FI}var zI,$X;function Xot(){if($X)return zI;$X=1;function e(t,n){return t!=null&&n in Object(t)}return zI=e,zI}var HI,IX;function Zot(){if(IX)return HI;IX=1;var e=qhe(),t=$5(),n=Xi(),r=I5(),a=A5(),i=f_();function o(s,l,c){l=e(l,s);for(var u=-1,d=l.length,f=!1;++u<d;){var h=i(l[u]);if(!(f=s!=null&&c(s,h)))break;s=s[h]}return f||++u!=d?f:(d=s==null?0:s.length,!!d&&a(d)&&r(h,d)&&(n(s)||t(s)))}return HI=o,HI}var UI,AX;function Qot(){if(AX)return UI;AX=1;var e=Xot(),t=Zot();function n(r,a){return r!=null&&t(r,a,e)}return UI=n,UI}var WI,RX;function Jot(){if(RX)return WI;RX=1;var e=R5(),t=Vhe(),n=Qot(),r=t5(),a=Rge(),i=Mge(),o=f_(),s=1,l=2;function c(u,d){return r(u)&&a(d)?i(o(u),d):function(f){var h=t(f,u);return h===void 0&&h===d?n(f,u):e(d,h,s|l)}}return WI=c,WI}var qI,MX;function vg(){if(MX)return qI;MX=1;function e(t){return t}return qI=e,qI}var VI,PX;function est(){if(PX)return VI;PX=1;function e(t){return function(n){return n==null?void 0:n[t]}}return VI=e,VI}var GI,NX;function tst(){if(NX)return GI;NX=1;var e=s5();function t(n){return function(r){return e(r,n)}}return GI=t,GI}var KI,LX;function nst(){if(LX)return KI;LX=1;var e=est(),t=tst(),n=t5(),r=f_();function a(i){return n(i)?e(r(i)):t(i)}return KI=a,KI}var YI,DX;function yl(){if(DX)return YI;DX=1;var e=Yot(),t=Jot(),n=vg(),r=Xi(),a=nst();function i(o){return typeof o=="function"?o:o==null?n:typeof o=="object"?r(o)?t(o[0],o[1]):e(o):a(o)}return YI=i,YI}var XI,jX;function Pge(){if(jX)return XI;jX=1;function e(t,n,r,a){for(var i=t.length,o=r+(a?1:-1);a?o--:++o<i;)if(n(t[o],o,t))return o;return-1}return XI=e,XI}var ZI,BX;function rst(){if(BX)return ZI;BX=1;function e(t){return t!==t}return ZI=e,ZI}var QI,FX;function ast(){if(FX)return QI;FX=1;function e(t,n,r){for(var a=r-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return QI=e,QI}var JI,zX;function ist(){if(zX)return JI;zX=1;var e=Pge(),t=rst(),n=ast();function r(a,i,o){return i===i?n(a,i,o):e(a,t,o)}return JI=r,JI}var eA,HX;function ost(){if(HX)return eA;HX=1;var e=ist();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return eA=t,eA}var tA,UX;function sst(){if(UX)return tA;UX=1;function e(t,n,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(n,t[a]))return!0;return!1}return tA=e,tA}var nA,WX;function lst(){if(WX)return nA;WX=1;function e(){}return nA=e,nA}var rA,qX;function cst(){if(qX)return rA;qX=1;var e=Age(),t=lst(),n=O5(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return rA=a,rA}var aA,VX;function ust(){if(VX)return aA;VX=1;var e=wge(),t=ost(),n=sst(),r=Ege(),a=cst(),i=O5(),o=200;function s(l,c,u){var d=-1,f=t,h=l.length,g=!0,m=[],v=m;if(u)g=!1,f=n;else if(h>=o){var b=c?null:a(l);if(b)return i(b);g=!1,f=r,v=new e}else v=c?[]:m;e:for(;++d<h;){var y=l[d],S=c?c(y):y;if(y=u||y!==0?y:0,g&&S===S){for(var C=v.length;C--;)if(v[C]===S)continue e;c&&v.push(S),m.push(y)}else f(v,S,u)||(v!==m&&v.push(S),m.push(y))}return m}return aA=s,aA}var iA,GX;function dst(){if(GX)return iA;GX=1;var e=yl(),t=ust();function n(r,a){return r&&r.length?t(r,e(a,2)):[]}return iA=n,iA}var fst=dst();const KX=An(fst);function Nge(e,t,n){return t===!0?KX(e,n):On(t)?KX(e,t):e}function rh(e){"@babel/helpers - typeof";return rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rh(e)}var pst=["ref"];function YX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YX(Object(n),!0).forEach(function(r){b_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YX(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hst(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dge(r.key),r)}}function gst(e,t,n){return t&&XX(e.prototype,t),n&&XX(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function mst(e,t,n){return t=iC(t),vst(e,Lge()?Reflect.construct(t,n||[],iC(e).constructor):t.apply(e,n))}function vst(e,t){if(t&&(rh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bst(e)}function bst(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lge=function(){return!!e})()}function iC(e){return iC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},iC(e)}function yst(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&iL(e,t)}function iL(e,t){return iL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},iL(e,t)}function b_(e,t,n){return t=Dge(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dge(e){var t=Sst(e,"string");return rh(t)=="symbol"?t:t+""}function Sst(e,t){if(rh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function xst(e,t){if(e==null)return{};var n=wst(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wst(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Cst(e){return e.value}function Est(e,t){if(U.isValidElement(e))return U.cloneElement(e,t);if(typeof e=="function")return U.createElement(e,t);t.ref;var n=xst(t,pst);return U.createElement(k5,n)}var ZX=1,Wc=function(e){function t(){var n;hst(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=mst(this,t,[].concat(a)),b_(n,"lastBoundingBox",{width:-1,height:-1}),n}return yst(t,e),gst(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>ZX||Math.abs(a.height-this.lastBoundingBox.height)>ZX)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,r&&r(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?_l({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var a=this.props,i=a.layout,o=a.align,s=a.verticalAlign,l=a.margin,c=a.chartWidth,u=a.chartHeight,d,f;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var h=this.getBBoxSnapshot();d={left:((c||0)-h.width)/2}}else d=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(s==="middle"){var g=this.getBBoxSnapshot();f={top:((u||0)-g.height)/2}}else f=s==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return _l(_l({},d),f)}},{key:"render",value:function(){var r=this,a=this.props,i=a.content,o=a.width,s=a.height,l=a.wrapperStyle,c=a.payloadUniqBy,u=a.payload,d=_l(_l({position:"absolute",width:o||"auto",height:s||"auto"},this.getDefaultPosition(l)),l);return U.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(h){r.wrapperNode=h}},Est(i,_l(_l({},this.props),{},{payload:Nge(u,c,Cst)})))}}],[{key:"getWithHeight",value:function(r,a){var i=_l(_l({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&St(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||a}:null}}])}(p.PureComponent);b_(Wc,"displayName","Legend");b_(Wc,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var oA,QX;function _st(){if(QX)return oA;QX=1;var e=m0(),t=$5(),n=Xi(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return oA=a,oA}var sA,JX;function jge(){if(JX)return sA;JX=1;var e=Tge(),t=_st();function n(r,a,i,o,s){var l=-1,c=r.length;for(i||(i=t),s||(s=[]);++l<c;){var u=r[l];a>0&&i(u)?a>1?n(u,a-1,i,o,s):e(s,u):o||(s[s.length]=u)}return s}return sA=n,sA}var lA,eZ;function Tst(){if(eZ)return lA;eZ=1;function e(t){return function(n,r,a){for(var i=-1,o=Object(n),s=a(n),l=s.length;l--;){var c=s[t?l:++i];if(r(o[c],c,o)===!1)break}return n}}return lA=e,lA}var cA,tZ;function kst(){if(tZ)return cA;tZ=1;var e=Tst(),t=e();return cA=t,cA}var uA,nZ;function Bge(){if(nZ)return uA;nZ=1;var e=kst(),t=v_();function n(r,a){return r&&e(r,a,t)}return uA=n,uA}var dA,rZ;function Ost(){if(rZ)return dA;rZ=1;var e=b0();function t(n,r){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var o=a.length,s=r?o:-1,l=Object(a);(r?s--:++s<o)&&i(l[s],s,l)!==!1;);return a}}return dA=t,dA}var fA,aZ;function M5(){if(aZ)return fA;aZ=1;var e=Bge(),t=Ost(),n=t(e);return fA=n,fA}var pA,iZ;function Fge(){if(iZ)return pA;iZ=1;var e=M5(),t=b0();function n(r,a){var i=-1,o=t(r)?Array(r.length):[];return e(r,function(s,l,c){o[++i]=a(s,l,c)}),o}return pA=n,pA}var hA,oZ;function $st(){if(oZ)return hA;oZ=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return hA=e,hA}var gA,sZ;function Ist(){if(sZ)return gA;sZ=1;var e=hg();function t(n,r){if(n!==r){var a=n!==void 0,i=n===null,o=n===n,s=e(n),l=r!==void 0,c=r===null,u=r===r,d=e(r);if(!c&&!d&&!s&&n>r||s&&l&&u&&!c&&!d||i&&l&&u||!a&&u||!o)return 1;if(!i&&!s&&!d&&n<r||d&&a&&o&&!i&&!s||c&&a&&o||!l&&o||!u)return-1}return 0}return gA=t,gA}var mA,lZ;function Ast(){if(lZ)return mA;lZ=1;var e=Ist();function t(n,r,a){for(var i=-1,o=n.criteria,s=r.criteria,l=o.length,c=a.length;++i<l;){var u=e(o[i],s[i]);if(u){if(i>=c)return u;var d=a[i];return u*(d=="desc"?-1:1)}}return n.index-r.index}return mA=t,mA}var vA,cZ;function Rst(){if(cZ)return vA;cZ=1;var e=o5(),t=s5(),n=yl(),r=Fge(),a=$st(),i=Oge(),o=Ast(),s=vg(),l=Xi();function c(u,d,f){d.length?d=e(d,function(m){return l(m)?function(v){return t(v,m.length===1?m[0]:m)}:m}):d=[s];var h=-1;d=e(d,i(n));var g=r(u,function(m,v,b){var y=e(d,function(S){return S(m)});return{criteria:y,index:++h,value:m}});return a(g,function(m,v){return o(m,v,f)})}return vA=c,vA}var bA,uZ;function Mst(){if(uZ)return bA;uZ=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return bA=e,bA}var yA,dZ;function Pst(){if(dZ)return yA;dZ=1;var e=Mst(),t=Math.max;function n(r,a,i){return a=t(a===void 0?r.length-1:a,0),function(){for(var o=arguments,s=-1,l=t(o.length-a,0),c=Array(l);++s<l;)c[s]=o[a+s];s=-1;for(var u=Array(a+1);++s<a;)u[s]=o[s];return u[a]=i(c),e(r,this,u)}}return yA=n,yA}var SA,fZ;function Nst(){if(fZ)return SA;fZ=1;function e(t){return function(){return t}}return SA=e,SA}var xA,pZ;function zge(){if(pZ)return xA;pZ=1;var e=pf(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return xA=t,xA}var wA,hZ;function Lst(){if(hZ)return wA;hZ=1;var e=Nst(),t=zge(),n=vg(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return wA=r,wA}var CA,gZ;function Dst(){if(gZ)return CA;gZ=1;var e=800,t=16,n=Date.now;function r(a){var i=0,o=0;return function(){var s=n(),l=t-(s-o);if(o=s,l>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return CA=r,CA}var EA,mZ;function jst(){if(mZ)return EA;mZ=1;var e=Lst(),t=Dst(),n=t(e);return EA=n,EA}var _A,vZ;function Bst(){if(vZ)return _A;vZ=1;var e=vg(),t=Pst(),n=jst();function r(a,i){return n(t(a,i,e),a+"")}return _A=r,_A}var TA,bZ;function y_(){if(bZ)return TA;bZ=1;var e=r5(),t=b0(),n=I5(),r=pu();function a(i,o,s){if(!r(s))return!1;var l=typeof o;return(l=="number"?t(s)&&n(o,s.length):l=="string"&&o in s)?e(s[o],i):!1}return TA=a,TA}var kA,yZ;function Fst(){if(yZ)return kA;yZ=1;var e=jge(),t=Rst(),n=Bst(),r=y_(),a=n(function(i,o){if(i==null)return[];var s=o.length;return s>1&&r(i,o[0],o[1])?o=[]:s>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),t(i,e(o,1),[])});return kA=a,kA}var zst=Fst();const P5=An(zst);function Yb(e){"@babel/helpers - typeof";return Yb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yb(e)}function oL(){return oL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oL.apply(this,arguments)}function Hst(e,t){return Vst(e)||qst(e,t)||Wst(e,t)||Ust()}function Ust(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -649,7 +649,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
649
649
|
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
|
650
650
|
height and width.`,A,P,o,l,u,d,n);var N=!Array.isArray(h)&&Ul(h.type).endsWith("Chart");return U.Children.map(h,function(L){return U.isValidElement(L)?p.cloneElement(L,MS({width:A,height:P},N?{style:MS({height:"100%",width:"100%",maxHeight:P,maxWidth:A},L.props.style)}:{})):L})},[n,h,l,f,d,u,k,o]);return U.createElement("div",{id:v?"".concat(v):void 0,className:Fn("recharts-responsive-container",b),style:MS(MS({},C),{},{width:o,height:l,minWidth:u,minHeight:d,maxHeight:f}),ref:x},M)}),x_=function(t){return null};x_.displayName="Cell";function Qb(e){"@babel/helpers - typeof";return Qb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qb(e)}function LZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function uL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LZ(Object(n),!0).forEach(function(r){jlt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LZ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jlt(e,t,n){return t=Blt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Blt(e){var t=Flt(e,"string");return Qb(t)=="symbol"?t:t+""}function Flt(e,t){if(Qb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Wf={widthCache:{},cacheCount:0},zlt=2e3,Hlt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},DZ="recharts_measurement_span";function Ult(e){var t=uL({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var rb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||hf.isSsr)return{width:0,height:0};var r=Ult(n),a=JSON.stringify({text:t,copyStyle:r});if(Wf.widthCache[a])return Wf.widthCache[a];try{var i=document.getElementById(DZ);i||(i=document.createElement("span"),i.setAttribute("id",DZ),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=uL(uL({},Hlt),r);Object.assign(i.style,o),i.textContent="".concat(t);var s=i.getBoundingClientRect(),l={width:s.width,height:s.height};return Wf.widthCache[a]=l,++Wf.cacheCount>zlt&&(Wf.cacheCount=0,Wf.widthCache={}),l}catch{return{width:0,height:0}}},Wlt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Jb(e){"@babel/helpers - typeof";return Jb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jb(e)}function lC(e,t){return Klt(e)||Glt(e,t)||Vlt(e,t)||qlt()}function qlt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
651
651
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vlt(e,t){if(e){if(typeof e=="string")return jZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jZ(e,t)}}function jZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Glt(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}function Klt(e){if(Array.isArray(e))return e}function Ylt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BZ(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Zlt(r.key),r)}}function Xlt(e,t,n){return t&&BZ(e.prototype,t),n&&BZ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zlt(e){var t=Qlt(e,"string");return Jb(t)=="symbol"?t:t+""}function Qlt(e,t){if(Jb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var FZ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,zZ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Jlt=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,ect=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Kge={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},tct=Object.keys(Kge),fp="NaN";function nct(e,t){return e*Kge[t]}var PS=function(){function e(t,n){Ylt(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!Jlt.test(n)&&(this.num=NaN,this.unit=""),tct.includes(n)&&(this.num=nct(t,n),this.unit="px")}return Xlt(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,a=(r=ect.exec(n))!==null&&r!==void 0?r:[],i=lC(a,3),o=i[1],s=i[2];return new e(parseFloat(o),s??"")}}])}();function Yge(e){if(e.includes(fp))return fp;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=FZ.exec(t))!==null&&n!==void 0?n:[],a=lC(r,4),i=a[1],o=a[2],s=a[3],l=PS.parse(i??""),c=PS.parse(s??""),u=o==="*"?l.multiply(c):l.divide(c);if(u.isNaN())return fp;t=t.replace(FZ,u.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,f=(d=zZ.exec(t))!==null&&d!==void 0?d:[],h=lC(f,4),g=h[1],m=h[2],v=h[3],b=PS.parse(g??""),y=PS.parse(v??""),S=m==="+"?b.add(y):b.subtract(y);if(S.isNaN())return fp;t=t.replace(zZ,S.toString())}return t}var HZ=/\(([^()]*)\)/;function rct(e){for(var t=e;t.includes("(");){var n=HZ.exec(t),r=lC(n,2),a=r[1];t=t.replace(HZ,Yge(a))}return t}function act(e){var t=e.replace(/\s+/g,"");return t=rct(t),t=Yge(t),t}function ict(e){try{return act(e)}catch{return fp}}function NA(e){var t=ict(e.slice(5,-1));return t===fp?"":t}var oct=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],sct=["dx","dy","angle","className","breakAll"];function dL(){return dL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dL.apply(this,arguments)}function UZ(e,t){if(e==null)return{};var n=lct(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lct(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function WZ(e,t){return fct(e)||dct(e,t)||uct(e,t)||cct()}function cct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
652
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uct(e,t){if(e){if(typeof e=="string")return qZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qZ(e,t)}}function qZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dct(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}function fct(e){if(Array.isArray(e))return e}var Xge=/[ \f\n\r\t\v\u2028\u2029]+/,Zge=function(t){var n=t.children,r=t.breakAll,a=t.style;try{var i=[];Pn(n)||(r?i=n.toString().split(""):i=n.toString().split(Xge));var o=i.map(function(l){return{word:l,width:rb(l,a).width}}),s=r?0:rb(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:s}}catch{return null}},pct=function(t,n,r,a,i){var o=t.maxLines,s=t.children,l=t.style,c=t.breakAll,u=St(o),d=s,f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return A.reduce(function(P,N){var L=N.word,j=N.width,D=P[P.length-1];if(D&&(a==null||i||D.width+j+r<Number(a)))D.words.push(L),D.width+=j+r;else{var H={words:[L],width:j};P.push(H)}return P},[])},h=f(n),g=function(A){return A.reduce(function(P,N){return P.width>N.width?P:N})};if(!u)return h;for(var m="…",v=function(A){var P=d.slice(0,A),N=Zge({breakAll:c,style:l,children:P+m}).wordsWithComputedWidth,L=f(N),j=L.length>o||g(L).width>Number(a);return[j,L]},b=0,y=d.length-1,S=0,C;b<=y&&S<=d.length-1;){var x=Math.floor((b+y)/2),w=x-1,_=v(w),T=WZ(_,2),k=T[0],O=T[1],I=v(x),M=WZ(I,1),$=M[0];if(!k&&!$&&(b=x+1),k&&$&&(y=x-1),!k&&$){C=O;break}S++}return C||h},VZ=function(t){var n=Pn(t)?[]:t.toString().split(Xge);return[{words:n}]},hct=function(t){var n=t.width,r=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,s=t.maxLines;if((n||r)&&!hf.isSsr){var l,c,u=Zge({breakAll:o,children:a,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;l=d,c=f}else return VZ(a);return pct({breakAll:o,children:a,maxLines:s,style:i},l,c,n,r)}return VZ(a)},GZ="#808080",Ld=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.lineHeight,s=o===void 0?"1em":o,l=t.capHeight,c=l===void 0?"0.71em":l,u=t.scaleToFit,d=u===void 0?!1:u,f=t.textAnchor,h=f===void 0?"start":f,g=t.verticalAnchor,m=g===void 0?"end":g,v=t.fill,b=v===void 0?GZ:v,y=UZ(t,oct),S=p.useMemo(function(){return hct({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:d,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,d,y.style,y.width]),C=y.dx,x=y.dy,w=y.angle,_=y.className,T=y.breakAll,k=UZ(y,sct);if(!Ca(r)||!Ca(i))return null;var O=r+(St(C)?C:0),I=i+(St(x)?x:0),M;switch(m){case"start":M=NA("calc(".concat(c,")"));break;case"middle":M=NA("calc(".concat((S.length-1)/2," * -").concat(s," + (").concat(c," / 2))"));break;default:M=NA("calc(".concat(S.length-1," * -").concat(s,")"));break}var $=[];if(d){var R=S[0].width,A=y.width;$.push("scale(".concat((St(A)?A/R:1)/R,")"))}return w&&$.push("rotate(".concat(w,", ").concat(O,", ").concat(I,")")),$.length&&(k.transform=$.join(" ")),U.createElement("text",dL({},ln(k,!0),{x:O,y:I,className:Fn("recharts-text",_),textAnchor:h,fill:b.includes("url")?GZ:b}),S.map(function(P,N){var L=P.words.join(T?"":" ");return U.createElement("tspan",{x:O,dy:N===0?M:s,key:"".concat(L,"-").concat(N)},L)}))};function qc(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function gct(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function L5(e){let t,n,r;e.length!==2?(t=qc,n=(s,l)=>qc(e(s),l),r=(s,l)=>e(s)-l):(t=e===qc||e===gct?e:mct,n=e,r=e);function a(s,l,c=0,u=s.length){if(c<u){if(t(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<0?c=d+1:u=d}while(c<u)}return c}function i(s,l,c=0,u=s.length){if(c<u){if(t(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<=0?c=d+1:u=d}while(c<u)}return c}function o(s,l,c=0,u=s.length){const d=a(s,l,c,u-1);return d>c&&r(s[d-1],l)>-r(s[d],l)?d-1:d}return{left:a,center:o,right:i}}function mct(){return 0}function Qge(e){return e===null?NaN:+e}function*vct(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const bct=L5(qc),y0=bct.right;L5(Qge).center;class KZ extends Map{constructor(t,n=xct){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(YZ(this,t))}has(t){return super.has(YZ(this,t))}set(t,n){return super.set(yct(this,t),n)}delete(t){return super.delete(Sct(this,t))}}function YZ({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function yct({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Sct({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function xct(e){return e!==null&&typeof e=="object"?e.valueOf():e}function wct(e=qc){if(e===qc)return Jge;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Jge(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Cct=Math.sqrt(50),Ect=Math.sqrt(10),_ct=Math.sqrt(2);function cC(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=Cct?10:i>=Ect?5:i>=_ct?2:1;let s,l,c;return a<0?(c=Math.pow(10,-a)/o,s=Math.round(e*c),l=Math.round(t*c),s/c<e&&++s,l/c>t&&--l,c=-c):(c=Math.pow(10,a)*o,s=Math.round(e/c),l=Math.round(t/c),s*c<e&&++s,l*c>t&&--l),l<s&&.5<=n&&n<2?cC(e,t,n*2):[s,l,c]}function fL(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[a,i,o]=r?cC(t,e,n):cC(e,t,n);if(!(i>=a))return[];const s=i-a+1,l=new Array(s);if(r)if(o<0)for(let c=0;c<s;++c)l[c]=(i-c)/-o;else for(let c=0;c<s;++c)l[c]=(i-c)*o;else if(o<0)for(let c=0;c<s;++c)l[c]=(a+c)/-o;else for(let c=0;c<s;++c)l[c]=(a+c)*o;return l}function pL(e,t,n){return t=+t,e=+e,n=+n,cC(e,t,n)[2]}function hL(e,t,n){t=+t,e=+e,n=+n;const r=t<e,a=r?pL(t,e,n):pL(e,t,n);return(r?-1:1)*(a<0?1/-a:a)}function XZ(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let a of e)(a=t(a,++r,e))!=null&&(n<a||n===void 0&&a>=a)&&(n=a)}return n}function ZZ(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let a of e)(a=t(a,++r,e))!=null&&(n>a||n===void 0&&a>=a)&&(n=a)}return n}function eme(e,t,n=0,r=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(a=a===void 0?Jge:wct(a);r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(l-d)/l)*(c-l/2<0?-1:1),h=Math.max(n,Math.floor(t-c*d/l+f)),g=Math.min(r,Math.floor(t+(l-c)*d/l+f));eme(e,t,h,g,a)}const i=e[t];let o=n,s=r;for(em(e,n,t),a(e[r],i)>0&&em(e,n,r);o<s;){for(em(e,o,s),++o,--s;a(e[o],i)<0;)++o;for(;a(e[s],i)>0;)--s}a(e[n],i)===0?em(e,n,s):(++s,em(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function em(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Tct(e,t,n){if(e=Float64Array.from(vct(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ZZ(e);if(t>=1)return XZ(e);var r,a=(r-1)*t,i=Math.floor(a),o=XZ(eme(e,i).subarray(0,i+1)),s=ZZ(e.subarray(i+1));return o+(s-o)*(a-i)}}function kct(e,t,n=Qge){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),o=+n(e[i],i,e),s=+n(e[i+1],i+1,e);return o+(s-o)*(a-i)}}function Oct(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++r<a;)i[r]=e+r*n;return i}function es(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function uc(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const gL=Symbol("implicit");function D5(){var e=new KZ,t=[],n=[],r=gL;function a(i){let o=e.get(i);if(o===void 0){if(r!==gL)return r;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new KZ;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(n=Array.from(i),a):n.slice()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return D5(t,n).unknown(r)},es.apply(a,arguments),a}function ey(){var e=D5().unknown(void 0),t=e.domain,n=e.range,r=0,a=1,i,o,s=!1,l=0,c=0,u=.5;delete e.unknown;function d(){var f=t().length,h=a<r,g=h?a:r,m=h?r:a;i=(m-g)/Math.max(1,f-l+c*2),s&&(i=Math.floor(i)),g+=(m-g-i*(f-l))*u,o=i*(1-l),s&&(g=Math.round(g),o=Math.round(o));var v=Oct(f).map(function(b){return g+i*b});return n(h?v.reverse():v)}return e.domain=function(f){return arguments.length?(t(f),d()):t()},e.range=function(f){return arguments.length?([r,a]=f,r=+r,a=+a,d()):[r,a]},e.rangeRound=function(f){return[r,a]=f,r=+r,a=+a,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(f){return arguments.length?(s=!!f,d()):s},e.padding=function(f){return arguments.length?(l=Math.min(1,c=+f),d()):l},e.paddingInner=function(f){return arguments.length?(l=Math.min(1,f),d()):l},e.paddingOuter=function(f){return arguments.length?(c=+f,d()):c},e.align=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),d()):u},e.copy=function(){return ey(t(),[r,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},es.apply(d(),arguments)}function tme(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return tme(t())},e}function ab(){return tme(ey.apply(null,arguments).paddingInner(1))}function j5(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nme(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function S0(){}var ty=.7,uC=1/ty,Op="\\s*([+-]?\\d+)\\s*",ny="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$ct=/^#([0-9a-f]{3,8})$/,Ict=new RegExp(`^rgb\\(${Op},${Op},${Op}\\)$`),Act=new RegExp(`^rgb\\(${rl},${rl},${rl}\\)$`),Rct=new RegExp(`^rgba\\(${Op},${Op},${Op},${ny}\\)$`),Mct=new RegExp(`^rgba\\(${rl},${rl},${rl},${ny}\\)$`),Pct=new RegExp(`^hsl\\(${ny},${rl},${rl}\\)$`),Nct=new RegExp(`^hsla\\(${ny},${rl},${rl},${ny}\\)$`),QZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};j5(S0,Dd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:JZ,formatHex:JZ,formatHex8:Lct,formatHsl:Dct,formatRgb:eQ,toString:eQ});function JZ(){return this.rgb().formatHex()}function Lct(){return this.rgb().formatHex8()}function Dct(){return rme(this).formatHsl()}function eQ(){return this.rgb().formatRgb()}function Dd(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$ct.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tQ(t):n===3?new Ki(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?NS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?NS(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ict.exec(e))?new Ki(t[1],t[2],t[3],1):(t=Act.exec(e))?new Ki(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rct.exec(e))?NS(t[1],t[2],t[3],t[4]):(t=Mct.exec(e))?NS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pct.exec(e))?aQ(t[1],t[2]/100,t[3]/100,1):(t=Nct.exec(e))?aQ(t[1],t[2]/100,t[3]/100,t[4]):QZ.hasOwnProperty(e)?tQ(QZ[e]):e==="transparent"?new Ki(NaN,NaN,NaN,0):null}function tQ(e){return new Ki(e>>16&255,e>>8&255,e&255,1)}function NS(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ki(e,t,n,r)}function jct(e){return e instanceof S0||(e=Dd(e)),e?(e=e.rgb(),new Ki(e.r,e.g,e.b,e.opacity)):new Ki}function mL(e,t,n,r){return arguments.length===1?jct(e):new Ki(e,t,n,r??1)}function Ki(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}j5(Ki,mL,nme(S0,{brighter(e){return e=e==null?uC:Math.pow(uC,e),new Ki(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ty:Math.pow(ty,e),new Ki(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ki(gd(this.r),gd(this.g),gd(this.b),dC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nQ,formatHex:nQ,formatHex8:Bct,formatRgb:rQ,toString:rQ}));function nQ(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function Bct(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function rQ(){const e=dC(this.opacity);return`${e===1?"rgb(":"rgba("}${gd(this.r)}, ${gd(this.g)}, ${gd(this.b)}${e===1?")":`, ${e})`}`}function dC(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=gd(e),(e<16?"0":"")+e.toString(16)}function aQ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new vs(e,t,n,r)}function rme(e){if(e instanceof vs)return new vs(e.h,e.s,e.l,e.opacity);if(e instanceof S0||(e=Dd(e)),!e)return new vs;if(e instanceof vs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(t===i?o=(n-r)/s+(n<r)*6:n===i?o=(r-t)/s+2:o=(t-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new vs(o,s,l,e.opacity)}function Fct(e,t,n,r){return arguments.length===1?rme(e):new vs(e,t,n,r??1)}function vs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}j5(vs,Fct,nme(S0,{brighter(e){return e=e==null?uC:Math.pow(uC,e),new vs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ty:Math.pow(ty,e),new vs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Ki(LA(e>=240?e-240:e+120,a,r),LA(e,a,r),LA(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new vs(iQ(this.h),LS(this.s),LS(this.l),dC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=dC(this.opacity);return`${e===1?"hsl(":"hsla("}${iQ(this.h)}, ${LS(this.s)*100}%, ${LS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function iQ(e){return e=(e||0)%360,e<0?e+360:e}function LS(e){return Math.max(0,Math.min(1,e||0))}function LA(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const w_=e=>()=>e;function ame(e,t){return function(n){return e+n*t}}function zct(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function J3t(e,t){var n=t-e;return n?ame(e,n>180||n<-180?n-360*Math.round(n/360):n):w_(isNaN(e)?t:e)}function Hct(e){return(e=+e)==1?ime:function(t,n){return n-t?zct(t,n,e):w_(isNaN(t)?n:t)}}function ime(e,t){var n=t-e;return n?ame(e,n):w_(isNaN(e)?t:e)}const fC=function e(t){var n=Hct(t);function r(a,i){var o=n((a=mL(a)).r,(i=mL(i)).r),s=n(a.g,i.g),l=n(a.b,i.b),c=ime(a.opacity,i.opacity);return function(u){return a.r=o(u),a.g=s(u),a.b=l(u),a.opacity=c(u),a+""}}return r.gamma=e,r}(1);function Uct(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(i){for(a=0;a<n;++a)r[a]=e[a]*(1-i)+t[a]*i;return r}}function Wct(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qct(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)a[o]=bg(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(s){for(o=0;o<r;++o)i[o]=a[o](s);return i}}function Vct(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ds(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Gct(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=bg(e[a],t[a]):r[a]=t[a];return function(i){for(a in n)r[a]=n[a](i);return r}}var vL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DA=new RegExp(vL.source,"g");function Kct(e){return function(){return e}}function Yct(e){return function(t){return e(t)+""}}function ome(e,t){var n=vL.lastIndex=DA.lastIndex=0,r,a,i,o=-1,s=[],l=[];for(e=e+"",t=t+"";(r=vL.exec(e))&&(a=DA.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(a=a[0])?s[o]?s[o]+=a:s[++o]=a:(s[++o]=null,l.push({i:o,x:ds(r,a)})),n=DA.lastIndex;return n<t.length&&(i=t.slice(n),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?Yct(l[0].x):Kct(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)s[(d=l[u]).i]=d.x(c);return s.join("")})}function bg(e,t){var n=typeof t,r;return t==null||n==="boolean"?w_(t):(n==="number"?ds:n==="string"?(r=Dd(t))?(t=r,fC):ome:t instanceof Dd?fC:t instanceof Date?Vct:Wct(t)?Uct:Array.isArray(t)?qct:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Gct:ds)(e,t)}function B5(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var oQ=180/Math.PI,bL={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function sme(e,t,n,r,a,i){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*oQ,skewX:Math.atan(l)*oQ,scaleX:o,scaleY:s}}var DS;function Xct(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?bL:sme(t.a,t.b,t.c,t.d,t.e,t.f)}function Zct(e){return e==null||(DS||(DS=document.createElementNS("http://www.w3.org/2000/svg","g")),DS.setAttribute("transform",e),!(e=DS.transform.baseVal.consolidate()))?bL:(e=e.matrix,sme(e.a,e.b,e.c,e.d,e.e,e.f))}function lme(e,t,n,r){function a(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,h,g){if(c!==d||u!==f){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:ds(c,d)},{i:m-2,x:ds(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function o(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ds(c,u)})):u&&d.push(a(d)+"rotate("+u+r)}function s(c,u,d,f){c!==u?f.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ds(c,u)}):u&&d.push(a(d)+"skewX("+u+r)}function l(c,u,d,f,h,g){if(c!==d||u!==f){var m=h.push(a(h)+"scale(",null,",",null,")");g.push({i:m-4,x:ds(c,d)},{i:m-2,x:ds(u,f)})}else(d!==1||f!==1)&&h.push(a(h)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),o(c.rotate,u.rotate,d,f),s(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(h){for(var g=-1,m=f.length,v;++g<m;)d[(v=f[g]).i]=v.x(h);return d.join("")}}}var Qct=lme(Xct,"px, ","px)","deg)"),Jct=lme(Zct,", ",")",")");function eut(e,t){t===void 0&&(t=e,e=bg);for(var n=0,r=t.length-1,a=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(a,a=t[++n]);return function(o){var s=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[s](o-s)}}function tut(e){return function(){return e}}function pC(e){return+e}var sQ=[0,1];function Ai(e){return e}function yL(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:tut(isNaN(t)?NaN:.5)}function nut(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function rut(e,t,n){var r=e[0],a=e[1],i=t[0],o=t[1];return a<r?(r=yL(a,r),i=n(o,i)):(r=yL(r,a),i=n(i,o)),function(s){return i(r(s))}}function aut(e,t,n){var r=Math.min(e.length,t.length)-1,a=new Array(r),i=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)a[o]=yL(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(s){var l=y0(e,s,1,r)-1;return i[l](a[l](s))}}function x0(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function C_(){var e=sQ,t=sQ,n=bg,r,a,i,o=Ai,s,l,c;function u(){var f=Math.min(e.length,t.length);return o!==Ai&&(o=nut(e[0],e[f-1])),s=f>2?aut:rut,l=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(l||(l=s(e.map(r),t,n)))(r(o(f)))}return d.invert=function(f){return o(a((c||(c=s(t,e.map(r),ds)))(f)))},d.domain=function(f){return arguments.length?(e=Array.from(f,pC),u()):e.slice()},d.range=function(f){return arguments.length?(t=Array.from(f),u()):t.slice()},d.rangeRound=function(f){return t=Array.from(f),n=B5,u()},d.clamp=function(f){return arguments.length?(o=f?!0:Ai,u()):o!==Ai},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,h){return r=f,a=h,u()}}function F5(){return C_()(Ai,Ai)}function iut(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function hC(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function oh(e){return e=hC(Math.abs(e)),e?e[1]:NaN}function out(e,t){return function(n,r){for(var a=n.length,i=[],o=0,s=e[0],l=0;a>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),i.push(n.substring(a-=s,a+s)),!((l+=s+1)>r));)s=e[o=(o+1)%e.length];return i.reverse().join(t)}}function sut(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var lut=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ry(e){if(!(t=lut.exec(e)))throw new Error("invalid format: "+e);var t;return new z5({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ry.prototype=z5.prototype;function z5(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}z5.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cut(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var cme;function uut(e,t){var n=hC(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(cme=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+hC(e,Math.max(0,t+i-1))[0]}function lQ(e,t){var n=hC(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const cQ={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:iut,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>lQ(e*100,t),r:lQ,s:uut,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uQ(e){return e}var dQ=Array.prototype.map,fQ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dut(e){var t=e.grouping===void 0||e.thousands===void 0?uQ:out(dQ.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?uQ:sut(dQ.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(d){d=ry(d);var f=d.fill,h=d.align,g=d.sign,m=d.symbol,v=d.zero,b=d.width,y=d.comma,S=d.precision,C=d.trim,x=d.type;x==="n"?(y=!0,x="g"):cQ[x]||(S===void 0&&(S=12),C=!0,x="g"),(v||f==="0"&&h==="=")&&(v=!0,f="0",h="=");var w=m==="$"?n:m==="#"&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",_=m==="$"?r:/[%p]/.test(x)?o:"",T=cQ[x],k=/[defgprs%]/.test(x);S=S===void 0?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function O(I){var M=w,$=_,R,A,P;if(x==="c")$=T(I)+$,I="";else{I=+I;var N=I<0||1/I<0;if(I=isNaN(I)?l:T(Math.abs(I),S),C&&(I=cut(I)),N&&+I==0&&g!=="+"&&(N=!1),M=(N?g==="("?g:s:g==="-"||g==="("?"":g)+M,$=(x==="s"?fQ[8+cme/3]:"")+$+(N&&g==="("?")":""),k){for(R=-1,A=I.length;++R<A;)if(P=I.charCodeAt(R),48>P||P>57){$=(P===46?a+I.slice(R+1):I.slice(R))+$,I=I.slice(0,R);break}}}y&&!v&&(I=t(I,1/0));var L=M.length+I.length+$.length,j=L<b?new Array(b-L+1).join(f):"";switch(y&&v&&(I=t(j+I,j.length?b-$.length:1/0),j=""),h){case"<":I=M+I+$+j;break;case"=":I=M+j+I+$;break;case"^":I=j.slice(0,L=j.length>>1)+M+I+$+j.slice(L);break;default:I=j+M+I+$;break}return i(I)}return O.toString=function(){return d+""},O}function u(d,f){var h=c((d=ry(d),d.type="f",d)),g=Math.max(-8,Math.min(8,Math.floor(oh(f)/3)))*3,m=Math.pow(10,-g),v=fQ[8+g/3];return function(b){return h(m*b)+v}}return{format:c,formatPrefix:u}}var jS,H5,ume;fut({thousands:",",grouping:[3],currency:["$",""]});function fut(e){return jS=dut(e),H5=jS.format,ume=jS.formatPrefix,jS}function put(e){return Math.max(0,-oh(Math.abs(e)))}function hut(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(oh(t)/3)))*3-oh(Math.abs(e)))}function gut(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,oh(t)-oh(e))+1}function dme(e,t,n,r){var a=hL(e,t,n),i;switch(r=ry(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=hut(a,o))&&(r.precision=i),ume(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=gut(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=put(a))&&(r.precision=i-(r.type==="%")*2);break}}return H5(r)}function hu(e){var t=e.domain;return e.ticks=function(n){var r=t();return fL(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var a=t();return dme(a[0],a[a.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,i=r.length-1,o=r[a],s=r[i],l,c,u=10;for(s<o&&(c=o,o=s,s=c,c=a,a=i,i=c);u-- >0;){if(c=pL(o,s,n),c===l)return r[a]=o,r[i]=s,t(r);if(c>0)o=Math.floor(o/c)*c,s=Math.ceil(s/c)*c;else if(c<0)o=Math.ceil(o*c)/c,s=Math.floor(s*c)/c;else break;l=c}return e},e}function gC(){var e=F5();return e.copy=function(){return x0(e,gC())},es.apply(e,arguments),hu(e)}function fme(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,pC),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return fme(e).unknown(t)},e=arguments.length?Array.from(e,pC):[0,1],hu(n)}function pme(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],i=e[r],o;return i<a&&(o=n,n=r,r=o,o=a,a=i,i=o),e[n]=t.floor(a),e[r]=t.ceil(i),e}function pQ(e){return Math.log(e)}function hQ(e){return Math.exp(e)}function mut(e){return-Math.log(-e)}function vut(e){return-Math.exp(-e)}function but(e){return isFinite(e)?+("1e"+e):e<0?0:e}function yut(e){return e===10?but:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Sut(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function gQ(e){return(t,n)=>-e(-t,n)}function U5(e){const t=e(pQ,hQ),n=t.domain;let r=10,a,i;function o(){return a=Sut(r),i=yut(r),n()[0]<0?(a=gQ(a),i=gQ(i),e(mut,vut)):e(pQ,hQ),t}return t.base=function(s){return arguments.length?(r=+s,o()):r},t.domain=function(s){return arguments.length?(n(s),o()):n()},t.ticks=s=>{const l=n();let c=l[0],u=l[l.length-1];const d=u<c;d&&([c,u]=[u,c]);let f=a(c),h=a(u),g,m;const v=s==null?10:+s;let b=[];if(!(r%1)&&h-f<v){if(f=Math.floor(f),h=Math.ceil(h),c>0){for(;f<=h;++f)for(g=1;g<r;++g)if(m=f<0?g/i(-f):g*i(f),!(m<c)){if(m>u)break;b.push(m)}}else for(;f<=h;++f)for(g=r-1;g>=1;--g)if(m=f>0?g/i(-f):g*i(f),!(m<c)){if(m>u)break;b.push(m)}b.length*2<v&&(b=fL(c,u,v))}else b=fL(f,h,Math.min(h-f,v)).map(i);return d?b.reverse():b},t.tickFormat=(s,l)=>{if(s==null&&(s=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=ry(l)).precision==null&&(l.trim=!0),l=H5(l)),s===1/0)return l;const c=Math.max(1,r*s/t.ticks().length);return u=>{let d=u/i(Math.round(a(u)));return d*r<r-.5&&(d*=r),d<=c?l(u):""}},t.nice=()=>n(pme(n(),{floor:s=>i(Math.floor(a(s))),ceil:s=>i(Math.ceil(a(s)))})),t}function hme(){const e=U5(C_()).domain([1,10]);return e.copy=()=>x0(e,hme()).base(e.base()),es.apply(e,arguments),e}function mQ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function vQ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function W5(e){var t=1,n=e(mQ(t),vQ(t));return n.constant=function(r){return arguments.length?e(mQ(t=+r),vQ(t)):t},hu(n)}function gme(){var e=W5(C_());return e.copy=function(){return x0(e,gme()).constant(e.constant())},es.apply(e,arguments)}function bQ(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function xut(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function wut(e){return e<0?-e*e:e*e}function q5(e){var t=e(Ai,Ai),n=1;function r(){return n===1?e(Ai,Ai):n===.5?e(xut,wut):e(bQ(n),bQ(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,r()):n},hu(t)}function V5(){var e=q5(C_());return e.copy=function(){return x0(e,V5()).exponent(e.exponent())},es.apply(e,arguments),e}function Cut(){return V5.apply(null,arguments).exponent(.5)}function yQ(e){return Math.sign(e)*e*e}function Eut(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function mme(){var e=F5(),t=[0,1],n=!1,r;function a(i){var o=Eut(e(i));return isNaN(o)?r:n?Math.round(o):o}return a.invert=function(i){return e.invert(yQ(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,pC)).map(yQ)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return mme(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},es.apply(a,arguments),hu(a)}function vme(){var e=[],t=[],n=[],r;function a(){var o=0,s=Math.max(1,t.length);for(n=new Array(s-1);++o<s;)n[o-1]=kct(e,o/s);return i}function i(o){return o==null||isNaN(o=+o)?r:t[y0(n,o)]}return i.invertExtent=function(o){var s=t.indexOf(o);return s<0?[NaN,NaN]:[s>0?n[s-1]:e[0],s<n.length?n[s]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let s of o)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(qc),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return vme().domain(e).range(t).unknown(r)},es.apply(i,arguments)}function bme(){var e=0,t=1,n=1,r=[.5],a=[0,1],i;function o(l){return l!=null&&l<=l?a[y0(r,l,0,n)]:i}function s(){var l=-1;for(r=new Array(n);++l<n;)r[l]=((l+1)*t-(l-n)*e)/(n+1);return o}return o.domain=function(l){return arguments.length?([e,t]=l,e=+e,t=+t,s()):[e,t]},o.range=function(l){return arguments.length?(n=(a=Array.from(l)).length-1,s()):a.slice()},o.invertExtent=function(l){var c=a.indexOf(l);return c<0?[NaN,NaN]:c<1?[e,r[0]]:c>=n?[r[n-1],t]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(i=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return bme().domain([e,t]).range(a).unknown(i)},es.apply(hu(o),arguments)}function yme(){var e=[.5],t=[0,1],n,r=1;function a(i){return i!=null&&i<=i?t[y0(e,i,0,r)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return yme().domain(e).range(t).unknown(n)},es.apply(a,arguments)}const jA=new Date,BA=new Date;function Oa(e,t,n,r){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),s=a.ceil(i);return i-o<s-i?o:s},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,s)=>{const l=[];if(i=a.ceil(i),s=s==null?1:Math.floor(s),!(i<o)||!(s>0))return l;let c;do l.push(c=new Date(+i)),t(i,s),e(i);while(c<i&&i<o);return l},a.filter=i=>Oa(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;t(o,-1),!i(o););else for(;--s>=0;)for(;t(o,1),!i(o););}),n&&(a.count=(i,o)=>(jA.setTime(+i),BA.setTime(+o),e(jA),e(BA),Math.floor(n(jA,BA))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(r?o=>r(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const mC=Oa(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);mC.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Oa(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):mC);mC.range;const jl=1e3,Fo=jl*60,Bl=Fo*60,Ql=Bl*24,G5=Ql*7,SQ=Ql*30,FA=Ql*365,od=Oa(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*jl)},(e,t)=>(t-e)/jl,e=>e.getUTCSeconds());od.range;const K5=Oa(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jl)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getMinutes());K5.range;const Y5=Oa(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getUTCMinutes());Y5.range;const X5=Oa(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jl-e.getMinutes()*Fo)},(e,t)=>{e.setTime(+e+t*Bl)},(e,t)=>(t-e)/Bl,e=>e.getHours());X5.range;const Z5=Oa(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Bl)},(e,t)=>(t-e)/Bl,e=>e.getUTCHours());Z5.range;const w0=Oa(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Fo)/Ql,e=>e.getDate()-1);w0.range;const E_=Oa(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ql,e=>e.getUTCDate()-1);E_.range;const Sme=Oa(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ql,e=>Math.floor(e/Ql));Sme.range;function gf(e){return Oa(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Fo)/G5)}const __=gf(0),vC=gf(1),_ut=gf(2),Tut=gf(3),sh=gf(4),kut=gf(5),Out=gf(6);__.range;vC.range;_ut.range;Tut.range;sh.range;kut.range;Out.range;function mf(e){return Oa(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/G5)}const T_=mf(0),bC=mf(1),$ut=mf(2),Iut=mf(3),lh=mf(4),Aut=mf(5),Rut=mf(6);T_.range;bC.range;$ut.range;Iut.range;lh.range;Aut.range;Rut.range;const Q5=Oa(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Q5.range;const J5=Oa(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());J5.range;const Jl=Oa(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Jl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oa(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Jl.range;const ec=Oa(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ec.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oa(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ec.range;function xme(e,t,n,r,a,i){const o=[[od,1,jl],[od,5,5*jl],[od,15,15*jl],[od,30,30*jl],[i,1,Fo],[i,5,5*Fo],[i,15,15*Fo],[i,30,30*Fo],[a,1,Bl],[a,3,3*Bl],[a,6,6*Bl],[a,12,12*Bl],[r,1,Ql],[r,2,2*Ql],[n,1,G5],[t,1,SQ],[t,3,3*SQ],[e,1,FA]];function s(c,u,d){const f=u<c;f&&([c,u]=[u,c]);const h=d&&typeof d.range=="function"?d:l(c,u,d),g=h?h.range(c,+u+1):[];return f?g.reverse():g}function l(c,u,d){const f=Math.abs(u-c)/d,h=L5(([,,v])=>v).right(o,f);if(h===o.length)return e.every(hL(c/FA,u/FA,d));if(h===0)return mC.every(Math.max(hL(c,u,d),1));const[g,m]=o[f/o[h-1][2]<o[h][2]/f?h-1:h];return g.every(m)}return[s,l]}const[Mut,Put]=xme(ec,J5,T_,Sme,Z5,Y5),[Nut,Lut]=xme(Jl,Q5,__,w0,X5,K5);function zA(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function HA(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function tm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Dut(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=nm(a),u=rm(a),d=nm(i),f=rm(i),h=nm(o),g=rm(o),m=nm(s),v=rm(s),b=nm(l),y=rm(l),S={a:N,A:L,b:j,B:D,c:null,d:TQ,e:TQ,f:odt,g:mdt,G:bdt,H:rdt,I:adt,j:idt,L:wme,m:sdt,M:ldt,p:H,q:F,Q:$Q,s:IQ,S:cdt,u:udt,U:ddt,V:fdt,w:pdt,W:hdt,x:null,X:null,y:gdt,Y:vdt,Z:ydt,"%":OQ},C={a:B,A:z,b:G,B:X,c:null,d:kQ,e:kQ,f:Cdt,g:Mdt,G:Ndt,H:Sdt,I:xdt,j:wdt,L:Eme,m:Edt,M:_dt,p:Z,q,Q:$Q,s:IQ,S:Tdt,u:kdt,U:Odt,V:$dt,w:Idt,W:Adt,x:null,X:null,y:Rdt,Y:Pdt,Z:Ldt,"%":OQ},x={a:O,A:I,b:M,B:$,c:R,d:EQ,e:EQ,f:Jut,g:CQ,G:wQ,H:_Q,I:_Q,j:Yut,L:Qut,m:Kut,M:Xut,p:k,q:Gut,Q:tdt,s:ndt,S:Zut,u:Hut,U:Uut,V:Wut,w:zut,W:qut,x:A,X:P,y:CQ,Y:wQ,Z:Vut,"%":edt};S.x=w(n,S),S.X=w(r,S),S.c=w(t,S),C.x=w(n,C),C.X=w(r,C),C.c=w(t,C);function w(Y,te){return function(ee){var Q=[],ae=-1,oe=0,re=Y.length,ie,ue,ge;for(ee instanceof Date||(ee=new Date(+ee));++ae<re;)Y.charCodeAt(ae)===37&&(Q.push(Y.slice(oe,ae)),(ue=xQ[ie=Y.charAt(++ae)])!=null?ie=Y.charAt(++ae):ue=ie==="e"?" ":"0",(ge=te[ie])&&(ie=ge(ee,ue)),Q.push(ie),oe=ae+1);return Q.push(Y.slice(oe,ae)),Q.join("")}}function _(Y,te){return function(ee){var Q=tm(1900,void 0,1),ae=T(Q,Y,ee+="",0),oe,re;if(ae!=ee.length)return null;if("Q"in Q)return new Date(Q.Q);if("s"in Q)return new Date(Q.s*1e3+("L"in Q?Q.L:0));if(te&&!("Z"in Q)&&(Q.Z=0),"p"in Q&&(Q.H=Q.H%12+Q.p*12),Q.m===void 0&&(Q.m="q"in Q?Q.q:0),"V"in Q){if(Q.V<1||Q.V>53)return null;"w"in Q||(Q.w=1),"Z"in Q?(oe=HA(tm(Q.y,0,1)),re=oe.getUTCDay(),oe=re>4||re===0?bC.ceil(oe):bC(oe),oe=E_.offset(oe,(Q.V-1)*7),Q.y=oe.getUTCFullYear(),Q.m=oe.getUTCMonth(),Q.d=oe.getUTCDate()+(Q.w+6)%7):(oe=zA(tm(Q.y,0,1)),re=oe.getDay(),oe=re>4||re===0?vC.ceil(oe):vC(oe),oe=w0.offset(oe,(Q.V-1)*7),Q.y=oe.getFullYear(),Q.m=oe.getMonth(),Q.d=oe.getDate()+(Q.w+6)%7)}else("W"in Q||"U"in Q)&&("w"in Q||(Q.w="u"in Q?Q.u%7:"W"in Q?1:0),re="Z"in Q?HA(tm(Q.y,0,1)).getUTCDay():zA(tm(Q.y,0,1)).getDay(),Q.m=0,Q.d="W"in Q?(Q.w+6)%7+Q.W*7-(re+5)%7:Q.w+Q.U*7-(re+6)%7);return"Z"in Q?(Q.H+=Q.Z/100|0,Q.M+=Q.Z%100,HA(Q)):zA(Q)}}function T(Y,te,ee,Q){for(var ae=0,oe=te.length,re=ee.length,ie,ue;ae<oe;){if(Q>=re)return-1;if(ie=te.charCodeAt(ae++),ie===37){if(ie=te.charAt(ae++),ue=x[ie in xQ?te.charAt(ae++):ie],!ue||(Q=ue(Y,ee,Q))<0)return-1}else if(ie!=ee.charCodeAt(Q++))return-1}return Q}function k(Y,te,ee){var Q=c.exec(te.slice(ee));return Q?(Y.p=u.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function O(Y,te,ee){var Q=h.exec(te.slice(ee));return Q?(Y.w=g.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function I(Y,te,ee){var Q=d.exec(te.slice(ee));return Q?(Y.w=f.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function M(Y,te,ee){var Q=b.exec(te.slice(ee));return Q?(Y.m=y.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function $(Y,te,ee){var Q=m.exec(te.slice(ee));return Q?(Y.m=v.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function R(Y,te,ee){return T(Y,t,te,ee)}function A(Y,te,ee){return T(Y,n,te,ee)}function P(Y,te,ee){return T(Y,r,te,ee)}function N(Y){return o[Y.getDay()]}function L(Y){return i[Y.getDay()]}function j(Y){return l[Y.getMonth()]}function D(Y){return s[Y.getMonth()]}function H(Y){return a[+(Y.getHours()>=12)]}function F(Y){return 1+~~(Y.getMonth()/3)}function B(Y){return o[Y.getUTCDay()]}function z(Y){return i[Y.getUTCDay()]}function G(Y){return l[Y.getUTCMonth()]}function X(Y){return s[Y.getUTCMonth()]}function Z(Y){return a[+(Y.getUTCHours()>=12)]}function q(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var te=w(Y+="",S);return te.toString=function(){return Y},te},parse:function(Y){var te=_(Y+="",!1);return te.toString=function(){return Y},te},utcFormat:function(Y){var te=w(Y+="",C);return te.toString=function(){return Y},te},utcParse:function(Y){var te=_(Y+="",!0);return te.toString=function(){return Y},te}}}var xQ={"-":"",_:" ",0:"0"},Fa=/^\s*\d+/,jut=/^%/,But=/[\\^$*+?|[\]().{}]/g;function ir(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function Fut(e){return e.replace(But,"\\$&")}function nm(e){return new RegExp("^(?:"+e.map(Fut).join("|")+")","i")}function rm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function zut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Hut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Uut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Wut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function wQ(e,t,n){var r=Fa.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function CQ(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vut(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Gut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Kut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function EQ(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Yut(e,t,n){var r=Fa.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function _Q(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Xut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Zut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Qut(e,t,n){var r=Fa.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Jut(e,t,n){var r=Fa.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function edt(e,t,n){var r=jut.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function tdt(e,t,n){var r=Fa.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ndt(e,t,n){var r=Fa.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function TQ(e,t){return ir(e.getDate(),t,2)}function rdt(e,t){return ir(e.getHours(),t,2)}function adt(e,t){return ir(e.getHours()%12||12,t,2)}function idt(e,t){return ir(1+w0.count(Jl(e),e),t,3)}function wme(e,t){return ir(e.getMilliseconds(),t,3)}function odt(e,t){return wme(e,t)+"000"}function sdt(e,t){return ir(e.getMonth()+1,t,2)}function ldt(e,t){return ir(e.getMinutes(),t,2)}function cdt(e,t){return ir(e.getSeconds(),t,2)}function udt(e){var t=e.getDay();return t===0?7:t}function ddt(e,t){return ir(__.count(Jl(e)-1,e),t,2)}function Cme(e){var t=e.getDay();return t>=4||t===0?sh(e):sh.ceil(e)}function fdt(e,t){return e=Cme(e),ir(sh.count(Jl(e),e)+(Jl(e).getDay()===4),t,2)}function pdt(e){return e.getDay()}function hdt(e,t){return ir(vC.count(Jl(e)-1,e),t,2)}function gdt(e,t){return ir(e.getFullYear()%100,t,2)}function mdt(e,t){return e=Cme(e),ir(e.getFullYear()%100,t,2)}function vdt(e,t){return ir(e.getFullYear()%1e4,t,4)}function bdt(e,t){var n=e.getDay();return e=n>=4||n===0?sh(e):sh.ceil(e),ir(e.getFullYear()%1e4,t,4)}function ydt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ir(t/60|0,"0",2)+ir(t%60,"0",2)}function kQ(e,t){return ir(e.getUTCDate(),t,2)}function Sdt(e,t){return ir(e.getUTCHours(),t,2)}function xdt(e,t){return ir(e.getUTCHours()%12||12,t,2)}function wdt(e,t){return ir(1+E_.count(ec(e),e),t,3)}function Eme(e,t){return ir(e.getUTCMilliseconds(),t,3)}function Cdt(e,t){return Eme(e,t)+"000"}function Edt(e,t){return ir(e.getUTCMonth()+1,t,2)}function _dt(e,t){return ir(e.getUTCMinutes(),t,2)}function Tdt(e,t){return ir(e.getUTCSeconds(),t,2)}function kdt(e){var t=e.getUTCDay();return t===0?7:t}function Odt(e,t){return ir(T_.count(ec(e)-1,e),t,2)}function _me(e){var t=e.getUTCDay();return t>=4||t===0?lh(e):lh.ceil(e)}function $dt(e,t){return e=_me(e),ir(lh.count(ec(e),e)+(ec(e).getUTCDay()===4),t,2)}function Idt(e){return e.getUTCDay()}function Adt(e,t){return ir(bC.count(ec(e)-1,e),t,2)}function Rdt(e,t){return ir(e.getUTCFullYear()%100,t,2)}function Mdt(e,t){return e=_me(e),ir(e.getUTCFullYear()%100,t,2)}function Pdt(e,t){return ir(e.getUTCFullYear()%1e4,t,4)}function Ndt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?lh(e):lh.ceil(e),ir(e.getUTCFullYear()%1e4,t,4)}function Ldt(){return"+0000"}function OQ(){return"%"}function $Q(e){return+e}function IQ(e){return Math.floor(+e/1e3)}var qf,Tme,kme;Ddt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ddt(e){return qf=Dut(e),Tme=qf.format,qf.parse,kme=qf.utcFormat,qf.utcParse,qf}function jdt(e){return new Date(e)}function Bdt(e){return e instanceof Date?+e:+new Date(+e)}function eH(e,t,n,r,a,i,o,s,l,c){var u=F5(),d=u.invert,f=u.domain,h=c(".%L"),g=c(":%S"),m=c("%I:%M"),v=c("%I %p"),b=c("%a %d"),y=c("%b %d"),S=c("%B"),C=c("%Y");function x(w){return(l(w)<w?h:s(w)<w?g:o(w)<w?m:i(w)<w?v:r(w)<w?a(w)<w?b:y:n(w)<w?S:C)(w)}return u.invert=function(w){return new Date(d(w))},u.domain=function(w){return arguments.length?f(Array.from(w,Bdt)):f().map(jdt)},u.ticks=function(w){var _=f();return e(_[0],_[_.length-1],w??10)},u.tickFormat=function(w,_){return _==null?x:c(_)},u.nice=function(w){var _=f();return(!w||typeof w.range!="function")&&(w=t(_[0],_[_.length-1],w??10)),w?f(pme(_,w)):u},u.copy=function(){return x0(u,eH(e,t,n,r,a,i,o,s,l,c))},u}function Fdt(){return es.apply(eH(Nut,Lut,Jl,Q5,__,w0,X5,K5,od,Tme).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function zdt(){return es.apply(eH(Mut,Put,ec,J5,T_,E_,Z5,Y5,od,kme).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function k_(){var e=0,t=1,n,r,a,i,o=Ai,s=!1,l;function c(d){return d==null||isNaN(d=+d)?l:o(a===0?.5:(d=(i(d)-n)*a,s?Math.max(0,Math.min(1,d)):d))}c.domain=function(d){return arguments.length?([e,t]=d,n=i(e=+e),r=i(t=+t),a=n===r?0:1/(r-n),c):[e,t]},c.clamp=function(d){return arguments.length?(s=!!d,c):s},c.interpolator=function(d){return arguments.length?(o=d,c):o};function u(d){return function(f){var h,g;return arguments.length?([h,g]=f,o=d(h,g),c):[o(0),o(1)]}}return c.range=u(bg),c.rangeRound=u(B5),c.unknown=function(d){return arguments.length?(l=d,c):l},function(d){return i=d,n=d(e),r=d(t),a=n===r?0:1/(r-n),c}}function gu(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ome(){var e=hu(k_()(Ai));return e.copy=function(){return gu(e,Ome())},uc.apply(e,arguments)}function $me(){var e=U5(k_()).domain([1,10]);return e.copy=function(){return gu(e,$me()).base(e.base())},uc.apply(e,arguments)}function Ime(){var e=W5(k_());return e.copy=function(){return gu(e,Ime()).constant(e.constant())},uc.apply(e,arguments)}function tH(){var e=q5(k_());return e.copy=function(){return gu(e,tH()).exponent(e.exponent())},uc.apply(e,arguments)}function Hdt(){return tH.apply(null,arguments).exponent(.5)}function Ame(){var e=[],t=Ai;function n(r){if(r!=null&&!isNaN(r=+r))return t((y0(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let a of r)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(qc),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,a)=>t(a/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,i)=>Tct(e,i/r))},n.copy=function(){return Ame(t).domain(e)},uc.apply(n,arguments)}function O_(){var e=0,t=.5,n=1,r=1,a,i,o,s,l,c=Ai,u,d=!1,f;function h(m){return isNaN(m=+m)?f:(m=.5+((m=+u(m))-i)*(r*m<r*i?s:l),c(d?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,a=u(e=+e),i=u(t=+t),o=u(n=+n),s=a===i?0:.5/(i-a),l=i===o?0:.5/(o-i),r=i<a?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(d=!!m,h):d},h.interpolator=function(m){return arguments.length?(c=m,h):c};function g(m){return function(v){var b,y,S;return arguments.length?([b,y,S]=v,c=eut(m,[b,y,S]),h):[c(0),c(.5),c(1)]}}return h.range=g(bg),h.rangeRound=g(B5),h.unknown=function(m){return arguments.length?(f=m,h):f},function(m){return u=m,a=m(e),i=m(t),o=m(n),s=a===i?0:.5/(i-a),l=i===o?0:.5/(o-i),r=i<a?-1:1,h}}function Rme(){var e=hu(O_()(Ai));return e.copy=function(){return gu(e,Rme())},uc.apply(e,arguments)}function Mme(){var e=U5(O_()).domain([.1,1,10]);return e.copy=function(){return gu(e,Mme()).base(e.base())},uc.apply(e,arguments)}function Pme(){var e=W5(O_());return e.copy=function(){return gu(e,Pme()).constant(e.constant())},uc.apply(e,arguments)}function nH(){var e=q5(O_());return e.copy=function(){return gu(e,nH()).exponent(e.exponent())},uc.apply(e,arguments)}function Udt(){return nH.apply(null,arguments).exponent(.5)}const AQ=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:ey,scaleDiverging:Rme,scaleDivergingLog:Mme,scaleDivergingPow:nH,scaleDivergingSqrt:Udt,scaleDivergingSymlog:Pme,scaleIdentity:fme,scaleImplicit:gL,scaleLinear:gC,scaleLog:hme,scaleOrdinal:D5,scalePoint:ab,scalePow:V5,scaleQuantile:vme,scaleQuantize:bme,scaleRadial:mme,scaleSequential:Ome,scaleSequentialLog:$me,scaleSequentialPow:tH,scaleSequentialQuantile:Ame,scaleSequentialSqrt:Hdt,scaleSequentialSymlog:Ime,scaleSqrt:Cut,scaleSymlog:gme,scaleThreshold:yme,scaleTime:Fdt,scaleUtc:zdt,tickFormat:dme},Symbol.toStringTag,{value:"Module"}));var UA,RQ;function $_(){if(RQ)return UA;RQ=1;var e=hg();function t(n,r,a){for(var i=-1,o=n.length;++i<o;){var s=n[i],l=r(s);if(l!=null&&(c===void 0?l===l&&!e(l):a(l,c)))var c=l,u=s}return u}return UA=t,UA}var WA,MQ;function Nme(){if(MQ)return WA;MQ=1;function e(t,n){return t>n}return WA=e,WA}var qA,PQ;function Wdt(){if(PQ)return qA;PQ=1;var e=$_(),t=Nme(),n=vg();function r(a){return a&&a.length?e(a,n,t):void 0}return qA=r,qA}var qdt=Wdt();const I_=An(qdt);var VA,NQ;function Lme(){if(NQ)return VA;NQ=1;function e(t,n){return t<n}return VA=e,VA}var GA,LQ;function Vdt(){if(LQ)return GA;LQ=1;var e=$_(),t=Lme(),n=vg();function r(a){return a&&a.length?e(a,n,t):void 0}return GA=r,GA}var Gdt=Vdt();const A_=An(Gdt);var KA,DQ;function Kdt(){if(DQ)return KA;DQ=1;var e=o5(),t=yl(),n=Fge(),r=Xi();function a(i,o){var s=r(i)?e:n;return s(i,t(o,3))}return KA=a,KA}var YA,jQ;function Ydt(){if(jQ)return YA;jQ=1;var e=jge(),t=Kdt();function n(r,a){return e(t(r,a),1)}return YA=n,YA}var Xdt=Ydt();const Zdt=An(Xdt);var XA,BQ;function Qdt(){if(BQ)return XA;BQ=1;var e=R5();function t(n,r){return e(n,r)}return XA=t,XA}var Jdt=Qdt();const C0=An(Jdt);var yg=1e9,eft={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},aH,Br=!0,Yo="[DecimalError] ",md=Yo+"Invalid argument: ",rH=Yo+"Exponent out of range: ",Sg=Math.floor,ju=Math.pow,tft=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,fo,Pa=1e7,Ir=7,Dme=9007199254740991,yC=Sg(Dme/Ir),jt={};jt.absoluteValue=jt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};jt.comparedTo=jt.cmp=function(e){var t,n,r,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(r=i.d.length,a=e.d.length,t=0,n=r<a?r:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===a?0:r>a^i.s<0?1:-1};jt.decimalPlaces=jt.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Ir;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};jt.dividedBy=jt.div=function(e){return Wl(this,new this.constructor(e))};jt.dividedToIntegerBy=jt.idiv=function(e){var t=this,n=t.constructor;return Sr(Wl(t,new n(e),0,1),n.precision)};jt.equals=jt.eq=function(e){return!this.cmp(e)};jt.exponent=function(){return oa(this)};jt.greaterThan=jt.gt=function(e){return this.cmp(e)>0};jt.greaterThanOrEqualTo=jt.gte=function(e){return this.cmp(e)>=0};jt.isInteger=jt.isint=function(){return this.e>this.d.length-2};jt.isNegative=jt.isneg=function(){return this.s<0};jt.isPositive=jt.ispos=function(){return this.s>0};jt.isZero=function(){return this.s===0};jt.lessThan=jt.lt=function(e){return this.cmp(e)<0};jt.lessThanOrEqualTo=jt.lte=function(e){return this.cmp(e)<1};jt.logarithm=jt.log=function(e){var t,n=this,r=n.constructor,a=r.precision,i=a+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(fo))throw Error(Yo+"NaN");if(n.s<1)throw Error(Yo+(n.s?"NaN":"-Infinity"));return n.eq(fo)?new r(0):(Br=!1,t=Wl(ay(n,i),ay(e,i),i),Br=!0,Sr(t,a))};jt.minus=jt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Fme(t,e):jme(t,(e.s=-e.s,e))};jt.modulo=jt.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(e=new r(e),!e.s)throw Error(Yo+"NaN");return n.s?(Br=!1,t=Wl(n,e,0,1).times(e),Br=!0,n.minus(t)):Sr(new r(n),a)};jt.naturalExponential=jt.exp=function(){return Bme(this)};jt.naturalLogarithm=jt.ln=function(){return ay(this)};jt.negated=jt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};jt.plus=jt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?jme(t,e):Fme(t,(e.s=-e.s,e))};jt.precision=jt.sd=function(e){var t,n,r,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(md+e);if(t=oa(a)+1,r=a.d.length-1,n=r*Ir+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};jt.squareRoot=jt.sqrt=function(){var e,t,n,r,a,i,o,s=this,l=s.constructor;if(s.s<1){if(!s.s)return new l(0);throw Error(Yo+"NaN")}for(e=oa(s),Br=!1,a=Math.sqrt(+s),a==0||a==1/0?(t=tl(s.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Sg((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new l(t)):r=new l(a.toString()),n=l.precision,a=o=n+3;;)if(i=r,r=i.plus(Wl(s,i,o+2)).times(.5),tl(i.d).slice(0,o)===(t=tl(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(Sr(i,n+1,0),i.times(i).eq(s)){r=i;break}}else if(t!="9999")break;o+=4}return Br=!0,Sr(r,n)};jt.times=jt.mul=function(e){var t,n,r,a,i,o,s,l,c,u=this,d=u.constructor,f=u.d,h=(e=new d(e)).d;if(!u.s||!e.s)return new d(0);for(e.s*=u.s,n=u.e+e.e,l=f.length,c=h.length,l<c&&(i=f,f=h,h=i,o=l,l=c,c=o),i=[],o=l+c,r=o;r--;)i.push(0);for(r=c;--r>=0;){for(t=0,a=l+r;a>r;)s=i[a]+h[r]*f[a-r-1]+t,i[a--]=s%Pa|0,t=s/Pa|0;i[a]=(i[a]+t)%Pa|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,Br?Sr(e,d.precision):e};jt.toDecimalPlaces=jt.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(cl(e,0,yg),t===void 0?t=r.rounding:cl(t,0,8),Sr(n,e+oa(n)+1,t))};jt.toExponential=function(e,t){var n,r=this,a=r.constructor;return e===void 0?n=jd(r,!0):(cl(e,0,yg),t===void 0?t=a.rounding:cl(t,0,8),r=Sr(new a(r),e+1,t),n=jd(r,!0,e+1)),n};jt.toFixed=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?jd(a):(cl(e,0,yg),t===void 0?t=i.rounding:cl(t,0,8),r=Sr(new i(a),e+oa(a)+1,t),n=jd(r.abs(),!1,e+oa(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};jt.toInteger=jt.toint=function(){var e=this,t=e.constructor;return Sr(new t(e),oa(e)+1,t.rounding)};jt.toNumber=function(){return+this};jt.toPower=jt.pow=function(e){var t,n,r,a,i,o,s=this,l=s.constructor,c=12,u=+(e=new l(e));if(!e.s)return new l(fo);if(s=new l(s),!s.s){if(e.s<1)throw Error(Yo+"Infinity");return s}if(s.eq(fo))return s;if(r=l.precision,e.eq(fo))return Sr(s,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=s.s,o){if((n=u<0?-u:u)<=Dme){for(a=new l(fo),t=Math.ceil(r/Ir+4),Br=!1;n%2&&(a=a.times(s),zQ(a.d,t)),n=Sg(n/2),n!==0;)s=s.times(s),zQ(s.d,t);return Br=!0,e.s<0?new l(fo).div(a):Sr(a,r)}}else if(i<0)throw Error(Yo+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,s.s=1,Br=!1,a=e.times(ay(s,r+c)),Br=!0,a=Bme(a),a.s=i,a};jt.toPrecision=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?(n=oa(a),r=jd(a,n<=i.toExpNeg||n>=i.toExpPos)):(cl(e,1,yg),t===void 0?t=i.rounding:cl(t,0,8),a=Sr(new i(a),e,t),n=oa(a),r=jd(a,e<=n||n<=i.toExpNeg,e)),r};jt.toSignificantDigits=jt.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(cl(e,1,yg),t===void 0?t=r.rounding:cl(t,0,8)),Sr(new r(n),e,t)};jt.toString=jt.valueOf=jt.val=jt.toJSON=jt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=oa(e),n=e.constructor;return jd(e,t<=n.toExpNeg||t>=n.toExpPos)};function jme(e,t){var n,r,a,i,o,s,l,c,u=e.constructor,d=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),Br?Sr(t,d):t;if(l=e.d,c=t.d,o=e.e,a=t.e,l=l.slice(),i=o-a,i){for(i<0?(r=l,i=-i,s=c.length):(r=c,a=o,s=l.length),o=Math.ceil(d/Ir),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=l.length,i=c.length,s-i<0&&(i=s,r=c,c=l,l=r),n=0;i;)n=(l[--i]=l[i]+c[i]+n)/Pa|0,l[i]%=Pa;for(n&&(l.unshift(n),++a),s=l.length;l[--s]==0;)l.pop();return t.d=l,t.e=a,Br?Sr(t,d):t}function cl(e,t,n){if(e!==~~e||e<t||e>n)throw Error(md+e)}function tl(e){var t,n,r,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)r=e[t]+"",n=Ir-r.length,n&&(i+=$c(n)),i+=r;o=e[t],r=o+"",n=Ir-r.length,n&&(i+=$c(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Wl=function(){function e(r,a){var i,o=0,s=r.length;for(r=r.slice();s--;)i=r[s]*a+o,r[s]=i%Pa|0,o=i/Pa|0;return o&&r.unshift(o),r}function t(r,a,i,o){var s,l;if(i!=o)l=i>o?1:-1;else for(s=l=0;s<i;s++)if(r[s]!=a[s]){l=r[s]>a[s]?1:-1;break}return l}function n(r,a,i){for(var o=0;i--;)r[i]-=o,o=r[i]<a[i]?1:0,r[i]=o*Pa+r[i]-a[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,a,i,o){var s,l,c,u,d,f,h,g,m,v,b,y,S,C,x,w,_,T,k=r.constructor,O=r.s==a.s?1:-1,I=r.d,M=a.d;if(!r.s)return new k(r);if(!a.s)throw Error(Yo+"Division by zero");for(l=r.e-a.e,_=M.length,x=I.length,h=new k(O),g=h.d=[],c=0;M[c]==(I[c]||0);)++c;if(M[c]>(I[c]||0)&&--l,i==null?y=i=k.precision:o?y=i+(oa(r)-oa(a))+1:y=i,y<0)return new k(0);if(y=y/Ir+2|0,c=0,_==1)for(u=0,M=M[0],y++;(c<x||u)&&y--;c++)S=u*Pa+(I[c]||0),g[c]=S/M|0,u=S%M|0;else{for(u=Pa/(M[0]+1)|0,u>1&&(M=e(M,u),I=e(I,u),_=M.length,x=I.length),C=_,m=I.slice(0,_),v=m.length;v<_;)m[v++]=0;T=M.slice(),T.unshift(0),w=M[0],M[1]>=Pa/2&&++w;do u=0,s=t(M,m,_,v),s<0?(b=m[0],_!=v&&(b=b*Pa+(m[1]||0)),u=b/w|0,u>1?(u>=Pa&&(u=Pa-1),d=e(M,u),f=d.length,v=m.length,s=t(d,m,f,v),s==1&&(u--,n(d,_<f?T:M,f))):(u==0&&(s=u=1),d=M.slice()),f=d.length,f<v&&d.unshift(0),n(m,d,v),s==-1&&(v=m.length,s=t(M,m,_,v),s<1&&(u++,n(m,_<v?T:M,v))),v=m.length):s===0&&(u++,m=[0]),g[c++]=u,s&&m[0]?m[v++]=I[C]||0:(m=[I[C]],v=1);while((C++<x||m[0]!==void 0)&&y--)}return g[0]||g.shift(),h.e=l,Sr(h,o?i+oa(h)+1:i)}}();function Bme(e,t){var n,r,a,i,o,s,l=0,c=0,u=e.constructor,d=u.precision;if(oa(e)>16)throw Error(rH+oa(e));if(!e.s)return new u(fo);for(Br=!1,s=d,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),c+=5;for(r=Math.log(ju(2,c))/Math.LN10*2+5|0,s+=r,n=a=i=new u(fo),u.precision=s;;){if(a=Sr(a.times(e),s),n=n.times(++l),o=i.plus(Wl(a,n,s)),tl(o.d).slice(0,s)===tl(i.d).slice(0,s)){for(;c--;)i=Sr(i.times(i),s);return u.precision=d,t==null?(Br=!0,Sr(i,d)):i}i=o}}function oa(e){for(var t=e.e*Ir,n=e.d[0];n>=10;n/=10)t++;return t}function ZA(e,t,n){if(t>e.LN10.sd())throw Br=!0,n&&(e.precision=n),Error(Yo+"LN10 precision limit exceeded");return Sr(new e(e.LN10),t)}function $c(e){for(var t="";e--;)t+="0";return t}function ay(e,t){var n,r,a,i,o,s,l,c,u,d=1,f=10,h=e,g=h.d,m=h.constructor,v=m.precision;if(h.s<1)throw Error(Yo+(h.s?"NaN":"-Infinity"));if(h.eq(fo))return new m(0);if(t==null?(Br=!1,c=v):c=t,h.eq(10))return t==null&&(Br=!0),ZA(m,c);if(c+=f,m.precision=c,n=tl(g),r=n.charAt(0),i=oa(h),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=tl(h.d),r=n.charAt(0),d++;i=oa(h),r>1?(h=new m("0."+n),i++):h=new m(r+"."+n.slice(1))}else return l=ZA(m,c+2,v).times(i+""),h=ay(new m(r+"."+n.slice(1)),c-f).plus(l),m.precision=v,t==null?(Br=!0,Sr(h,v)):h;for(s=o=h=Wl(h.minus(fo),h.plus(fo),c),u=Sr(h.times(h),c),a=3;;){if(o=Sr(o.times(u),c),l=s.plus(Wl(o,new m(a),c)),tl(l.d).slice(0,c)===tl(s.d).slice(0,c))return s=s.times(2),i!==0&&(s=s.plus(ZA(m,c+2,v).times(i+""))),s=Wl(s,new m(d),c),m.precision=v,t==null?(Br=!0,Sr(s,v)):s;s=l,a+=2}}function FQ(e,t){var n,r,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=Sg(n/Ir),e.d=[],r=(n+1)%Ir,n<0&&(r+=Ir),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=Ir;r<a;)e.d.push(+t.slice(r,r+=Ir));t=t.slice(r),r=Ir-t.length}else r-=a;for(;r--;)t+="0";if(e.d.push(+t),Br&&(e.e>yC||e.e<-yC))throw Error(rH+n)}else e.s=0,e.e=0,e.d=[0];return e}function Sr(e,t,n){var r,a,i,o,s,l,c,u,d=e.d;for(o=1,i=d[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=Ir,a=t,c=d[u=0];else{if(u=Math.ceil((r+1)/Ir),i=d.length,u>=i)return e;for(c=i=d[u],o=1;i>=10;i/=10)o++;r%=Ir,a=r-Ir+o}if(n!==void 0&&(i=ju(10,o-a-1),s=c/i%10|0,l=t<0||d[u+1]!==void 0||c%i,l=n<4?(s||l)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||l||n==6&&(r>0?a>0?c/ju(10,o-a):0:d[u-1])%10&1||n==(e.s<0?8:7))),t<1||!d[0])return l?(i=oa(e),d.length=1,t=t-i-1,d[0]=ju(10,(Ir-t%Ir)%Ir),e.e=Sg(-t/Ir)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(r==0?(d.length=u,i=1,u--):(d.length=u+1,i=ju(10,Ir-r),d[u]=a>0?(c/ju(10,o-a)%ju(10,a)|0)*i:0),l)for(;;)if(u==0){(d[0]+=i)==Pa&&(d[0]=1,++e.e);break}else{if(d[u]+=i,d[u]!=Pa)break;d[u--]=0,i=1}for(r=d.length;d[--r]===0;)d.pop();if(Br&&(e.e>yC||e.e<-yC))throw Error(rH+oa(e));return e}function Fme(e,t){var n,r,a,i,o,s,l,c,u,d,f=e.constructor,h=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),Br?Sr(t,h):t;if(l=e.d,d=t.d,r=t.e,c=e.e,l=l.slice(),o=c-r,o){for(u=o<0,u?(n=l,o=-o,s=d.length):(n=d,r=c,s=l.length),a=Math.max(Math.ceil(h/Ir),s)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=l.length,s=d.length,u=a<s,u&&(s=a),a=0;a<s;a++)if(l[a]!=d[a]){u=l[a]<d[a];break}o=0}for(u&&(n=l,l=d,d=n,t.s=-t.s),s=l.length,a=d.length-s;a>0;--a)l[s++]=0;for(a=d.length;a>o;){if(l[--a]<d[a]){for(i=a;i&&l[--i]===0;)l[i]=Pa-1;--l[i],l[a]+=Pa}l[a]-=d[a]}for(;l[--s]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=r,Br?Sr(t,h):t):new f(0)}function jd(e,t,n){var r,a=oa(e),i=tl(e.d),o=i.length;return t?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+$c(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+$c(-a-1)+i,n&&(r=n-o)>0&&(i+=$c(r))):a>=o?(i+=$c(a+1-o),n&&(r=n-a-1)>0&&(i=i+"."+$c(r))):((r=a+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(a+1===o&&(i+="."),i+=$c(r))),e.s<0?"-"+i:i}function zQ(e,t){if(e.length>t)return e.length=t,!0}function zme(e){var t,n,r;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(md+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return FQ(o,i.toString())}else if(typeof i!="string")throw Error(md+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,tft.test(i))FQ(o,i);else throw Error(md+i)}if(a.prototype=jt,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=zme,a.config=a.set=nft,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return a.config(e),a}function nft(e){if(!e||typeof e!="object")throw Error(Yo+"Object expected");var t,n,r,a=["precision",1,yg,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((r=e[n=a[t]])!==void 0)if(Sg(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(md+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(md+n+": "+r);return this}var aH=zme(eft);fo=new aH(1);const vr=aH;function rft(e){return sft(e)||oft(e)||ift(e)||aft()}function aft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
652
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uct(e,t){if(e){if(typeof e=="string")return qZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qZ(e,t)}}function qZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dct(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}function fct(e){if(Array.isArray(e))return e}var Xge=/[ \f\n\r\t\v\u2028\u2029]+/,Zge=function(t){var n=t.children,r=t.breakAll,a=t.style;try{var i=[];Pn(n)||(r?i=n.toString().split(""):i=n.toString().split(Xge));var o=i.map(function(l){return{word:l,width:rb(l,a).width}}),s=r?0:rb(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:s}}catch{return null}},pct=function(t,n,r,a,i){var o=t.maxLines,s=t.children,l=t.style,c=t.breakAll,u=St(o),d=s,f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return A.reduce(function(P,N){var L=N.word,j=N.width,D=P[P.length-1];if(D&&(a==null||i||D.width+j+r<Number(a)))D.words.push(L),D.width+=j+r;else{var H={words:[L],width:j};P.push(H)}return P},[])},h=f(n),g=function(A){return A.reduce(function(P,N){return P.width>N.width?P:N})};if(!u)return h;for(var m="…",v=function(A){var P=d.slice(0,A),N=Zge({breakAll:c,style:l,children:P+m}).wordsWithComputedWidth,L=f(N),j=L.length>o||g(L).width>Number(a);return[j,L]},b=0,y=d.length-1,S=0,C;b<=y&&S<=d.length-1;){var x=Math.floor((b+y)/2),w=x-1,_=v(w),T=WZ(_,2),k=T[0],O=T[1],I=v(x),M=WZ(I,1),$=M[0];if(!k&&!$&&(b=x+1),k&&$&&(y=x-1),!k&&$){C=O;break}S++}return C||h},VZ=function(t){var n=Pn(t)?[]:t.toString().split(Xge);return[{words:n}]},hct=function(t){var n=t.width,r=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,s=t.maxLines;if((n||r)&&!hf.isSsr){var l,c,u=Zge({breakAll:o,children:a,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;l=d,c=f}else return VZ(a);return pct({breakAll:o,children:a,maxLines:s,style:i},l,c,n,r)}return VZ(a)},GZ="#808080",Ld=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.lineHeight,s=o===void 0?"1em":o,l=t.capHeight,c=l===void 0?"0.71em":l,u=t.scaleToFit,d=u===void 0?!1:u,f=t.textAnchor,h=f===void 0?"start":f,g=t.verticalAnchor,m=g===void 0?"end":g,v=t.fill,b=v===void 0?GZ:v,y=UZ(t,oct),S=p.useMemo(function(){return hct({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:d,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,d,y.style,y.width]),C=y.dx,x=y.dy,w=y.angle,_=y.className,T=y.breakAll,k=UZ(y,sct);if(!Ca(r)||!Ca(i))return null;var O=r+(St(C)?C:0),I=i+(St(x)?x:0),M;switch(m){case"start":M=NA("calc(".concat(c,")"));break;case"middle":M=NA("calc(".concat((S.length-1)/2," * -").concat(s," + (").concat(c," / 2))"));break;default:M=NA("calc(".concat(S.length-1," * -").concat(s,")"));break}var $=[];if(d){var R=S[0].width,A=y.width;$.push("scale(".concat((St(A)?A/R:1)/R,")"))}return w&&$.push("rotate(".concat(w,", ").concat(O,", ").concat(I,")")),$.length&&(k.transform=$.join(" ")),U.createElement("text",dL({},ln(k,!0),{x:O,y:I,className:Fn("recharts-text",_),textAnchor:h,fill:b.includes("url")?GZ:b}),S.map(function(P,N){var L=P.words.join(T?"":" ");return U.createElement("tspan",{x:O,dy:N===0?M:s,key:"".concat(L,"-").concat(N)},L)}))};function qc(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function gct(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function L5(e){let t,n,r;e.length!==2?(t=qc,n=(s,l)=>qc(e(s),l),r=(s,l)=>e(s)-l):(t=e===qc||e===gct?e:mct,n=e,r=e);function a(s,l,c=0,u=s.length){if(c<u){if(t(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<0?c=d+1:u=d}while(c<u)}return c}function i(s,l,c=0,u=s.length){if(c<u){if(t(l,l)!==0)return u;do{const d=c+u>>>1;n(s[d],l)<=0?c=d+1:u=d}while(c<u)}return c}function o(s,l,c=0,u=s.length){const d=a(s,l,c,u-1);return d>c&&r(s[d-1],l)>-r(s[d],l)?d-1:d}return{left:a,center:o,right:i}}function mct(){return 0}function Qge(e){return e===null?NaN:+e}function*vct(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const bct=L5(qc),y0=bct.right;L5(Qge).center;class KZ extends Map{constructor(t,n=xct){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(YZ(this,t))}has(t){return super.has(YZ(this,t))}set(t,n){return super.set(yct(this,t),n)}delete(t){return super.delete(Sct(this,t))}}function YZ({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function yct({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Sct({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function xct(e){return e!==null&&typeof e=="object"?e.valueOf():e}function wct(e=qc){if(e===qc)return Jge;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Jge(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Cct=Math.sqrt(50),Ect=Math.sqrt(10),_ct=Math.sqrt(2);function cC(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=Cct?10:i>=Ect?5:i>=_ct?2:1;let s,l,c;return a<0?(c=Math.pow(10,-a)/o,s=Math.round(e*c),l=Math.round(t*c),s/c<e&&++s,l/c>t&&--l,c=-c):(c=Math.pow(10,a)*o,s=Math.round(e/c),l=Math.round(t/c),s*c<e&&++s,l*c>t&&--l),l<s&&.5<=n&&n<2?cC(e,t,n*2):[s,l,c]}function fL(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[a,i,o]=r?cC(t,e,n):cC(e,t,n);if(!(i>=a))return[];const s=i-a+1,l=new Array(s);if(r)if(o<0)for(let c=0;c<s;++c)l[c]=(i-c)/-o;else for(let c=0;c<s;++c)l[c]=(i-c)*o;else if(o<0)for(let c=0;c<s;++c)l[c]=(a+c)/-o;else for(let c=0;c<s;++c)l[c]=(a+c)*o;return l}function pL(e,t,n){return t=+t,e=+e,n=+n,cC(e,t,n)[2]}function hL(e,t,n){t=+t,e=+e,n=+n;const r=t<e,a=r?pL(t,e,n):pL(e,t,n);return(r?-1:1)*(a<0?1/-a:a)}function XZ(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let a of e)(a=t(a,++r,e))!=null&&(n<a||n===void 0&&a>=a)&&(n=a)}return n}function ZZ(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let a of e)(a=t(a,++r,e))!=null&&(n>a||n===void 0&&a>=a)&&(n=a)}return n}function eme(e,t,n=0,r=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(a=a===void 0?Jge:wct(a);r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(l-d)/l)*(c-l/2<0?-1:1),h=Math.max(n,Math.floor(t-c*d/l+f)),g=Math.min(r,Math.floor(t+(l-c)*d/l+f));eme(e,t,h,g,a)}const i=e[t];let o=n,s=r;for(em(e,n,t),a(e[r],i)>0&&em(e,n,r);o<s;){for(em(e,o,s),++o,--s;a(e[o],i)<0;)++o;for(;a(e[s],i)>0;)--s}a(e[n],i)===0?em(e,n,s):(++s,em(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function em(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Tct(e,t,n){if(e=Float64Array.from(vct(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ZZ(e);if(t>=1)return XZ(e);var r,a=(r-1)*t,i=Math.floor(a),o=XZ(eme(e,i).subarray(0,i+1)),s=ZZ(e.subarray(i+1));return o+(s-o)*(a-i)}}function kct(e,t,n=Qge){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),o=+n(e[i],i,e),s=+n(e[i+1],i+1,e);return o+(s-o)*(a-i)}}function Oct(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++r<a;)i[r]=e+r*n;return i}function es(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function uc(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const gL=Symbol("implicit");function D5(){var e=new KZ,t=[],n=[],r=gL;function a(i){let o=e.get(i);if(o===void 0){if(r!==gL)return r;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new KZ;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(n=Array.from(i),a):n.slice()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return D5(t,n).unknown(r)},es.apply(a,arguments),a}function ey(){var e=D5().unknown(void 0),t=e.domain,n=e.range,r=0,a=1,i,o,s=!1,l=0,c=0,u=.5;delete e.unknown;function d(){var f=t().length,h=a<r,g=h?a:r,m=h?r:a;i=(m-g)/Math.max(1,f-l+c*2),s&&(i=Math.floor(i)),g+=(m-g-i*(f-l))*u,o=i*(1-l),s&&(g=Math.round(g),o=Math.round(o));var v=Oct(f).map(function(b){return g+i*b});return n(h?v.reverse():v)}return e.domain=function(f){return arguments.length?(t(f),d()):t()},e.range=function(f){return arguments.length?([r,a]=f,r=+r,a=+a,d()):[r,a]},e.rangeRound=function(f){return[r,a]=f,r=+r,a=+a,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(f){return arguments.length?(s=!!f,d()):s},e.padding=function(f){return arguments.length?(l=Math.min(1,c=+f),d()):l},e.paddingInner=function(f){return arguments.length?(l=Math.min(1,f),d()):l},e.paddingOuter=function(f){return arguments.length?(c=+f,d()):c},e.align=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),d()):u},e.copy=function(){return ey(t(),[r,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},es.apply(d(),arguments)}function tme(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return tme(t())},e}function ab(){return tme(ey.apply(null,arguments).paddingInner(1))}function j5(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nme(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function S0(){}var ty=.7,uC=1/ty,Op="\\s*([+-]?\\d+)\\s*",ny="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$ct=/^#([0-9a-f]{3,8})$/,Ict=new RegExp(`^rgb\\(${Op},${Op},${Op}\\)$`),Act=new RegExp(`^rgb\\(${rl},${rl},${rl}\\)$`),Rct=new RegExp(`^rgba\\(${Op},${Op},${Op},${ny}\\)$`),Mct=new RegExp(`^rgba\\(${rl},${rl},${rl},${ny}\\)$`),Pct=new RegExp(`^hsl\\(${ny},${rl},${rl}\\)$`),Nct=new RegExp(`^hsla\\(${ny},${rl},${rl},${ny}\\)$`),QZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};j5(S0,Dd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:JZ,formatHex:JZ,formatHex8:Lct,formatHsl:Dct,formatRgb:eQ,toString:eQ});function JZ(){return this.rgb().formatHex()}function Lct(){return this.rgb().formatHex8()}function Dct(){return rme(this).formatHsl()}function eQ(){return this.rgb().formatRgb()}function Dd(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$ct.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tQ(t):n===3?new Ki(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?NS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?NS(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ict.exec(e))?new Ki(t[1],t[2],t[3],1):(t=Act.exec(e))?new Ki(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rct.exec(e))?NS(t[1],t[2],t[3],t[4]):(t=Mct.exec(e))?NS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pct.exec(e))?aQ(t[1],t[2]/100,t[3]/100,1):(t=Nct.exec(e))?aQ(t[1],t[2]/100,t[3]/100,t[4]):QZ.hasOwnProperty(e)?tQ(QZ[e]):e==="transparent"?new Ki(NaN,NaN,NaN,0):null}function tQ(e){return new Ki(e>>16&255,e>>8&255,e&255,1)}function NS(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ki(e,t,n,r)}function jct(e){return e instanceof S0||(e=Dd(e)),e?(e=e.rgb(),new Ki(e.r,e.g,e.b,e.opacity)):new Ki}function mL(e,t,n,r){return arguments.length===1?jct(e):new Ki(e,t,n,r??1)}function Ki(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}j5(Ki,mL,nme(S0,{brighter(e){return e=e==null?uC:Math.pow(uC,e),new Ki(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ty:Math.pow(ty,e),new Ki(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ki(gd(this.r),gd(this.g),gd(this.b),dC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nQ,formatHex:nQ,formatHex8:Bct,formatRgb:rQ,toString:rQ}));function nQ(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function Bct(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function rQ(){const e=dC(this.opacity);return`${e===1?"rgb(":"rgba("}${gd(this.r)}, ${gd(this.g)}, ${gd(this.b)}${e===1?")":`, ${e})`}`}function dC(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=gd(e),(e<16?"0":"")+e.toString(16)}function aQ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new vs(e,t,n,r)}function rme(e){if(e instanceof vs)return new vs(e.h,e.s,e.l,e.opacity);if(e instanceof S0||(e=Dd(e)),!e)return new vs;if(e instanceof vs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(t===i?o=(n-r)/s+(n<r)*6:n===i?o=(r-t)/s+2:o=(t-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new vs(o,s,l,e.opacity)}function Fct(e,t,n,r){return arguments.length===1?rme(e):new vs(e,t,n,r??1)}function vs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}j5(vs,Fct,nme(S0,{brighter(e){return e=e==null?uC:Math.pow(uC,e),new vs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ty:Math.pow(ty,e),new vs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Ki(LA(e>=240?e-240:e+120,a,r),LA(e,a,r),LA(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new vs(iQ(this.h),LS(this.s),LS(this.l),dC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=dC(this.opacity);return`${e===1?"hsl(":"hsla("}${iQ(this.h)}, ${LS(this.s)*100}%, ${LS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function iQ(e){return e=(e||0)%360,e<0?e+360:e}function LS(e){return Math.max(0,Math.min(1,e||0))}function LA(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const w_=e=>()=>e;function ame(e,t){return function(n){return e+n*t}}function zct(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function e4t(e,t){var n=t-e;return n?ame(e,n>180||n<-180?n-360*Math.round(n/360):n):w_(isNaN(e)?t:e)}function Hct(e){return(e=+e)==1?ime:function(t,n){return n-t?zct(t,n,e):w_(isNaN(t)?n:t)}}function ime(e,t){var n=t-e;return n?ame(e,n):w_(isNaN(e)?t:e)}const fC=function e(t){var n=Hct(t);function r(a,i){var o=n((a=mL(a)).r,(i=mL(i)).r),s=n(a.g,i.g),l=n(a.b,i.b),c=ime(a.opacity,i.opacity);return function(u){return a.r=o(u),a.g=s(u),a.b=l(u),a.opacity=c(u),a+""}}return r.gamma=e,r}(1);function Uct(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(i){for(a=0;a<n;++a)r[a]=e[a]*(1-i)+t[a]*i;return r}}function Wct(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qct(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)a[o]=bg(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(s){for(o=0;o<r;++o)i[o]=a[o](s);return i}}function Vct(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ds(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Gct(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=bg(e[a],t[a]):r[a]=t[a];return function(i){for(a in n)r[a]=n[a](i);return r}}var vL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DA=new RegExp(vL.source,"g");function Kct(e){return function(){return e}}function Yct(e){return function(t){return e(t)+""}}function ome(e,t){var n=vL.lastIndex=DA.lastIndex=0,r,a,i,o=-1,s=[],l=[];for(e=e+"",t=t+"";(r=vL.exec(e))&&(a=DA.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(a=a[0])?s[o]?s[o]+=a:s[++o]=a:(s[++o]=null,l.push({i:o,x:ds(r,a)})),n=DA.lastIndex;return n<t.length&&(i=t.slice(n),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?Yct(l[0].x):Kct(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)s[(d=l[u]).i]=d.x(c);return s.join("")})}function bg(e,t){var n=typeof t,r;return t==null||n==="boolean"?w_(t):(n==="number"?ds:n==="string"?(r=Dd(t))?(t=r,fC):ome:t instanceof Dd?fC:t instanceof Date?Vct:Wct(t)?Uct:Array.isArray(t)?qct:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Gct:ds)(e,t)}function B5(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var oQ=180/Math.PI,bL={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function sme(e,t,n,r,a,i){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*oQ,skewX:Math.atan(l)*oQ,scaleX:o,scaleY:s}}var DS;function Xct(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?bL:sme(t.a,t.b,t.c,t.d,t.e,t.f)}function Zct(e){return e==null||(DS||(DS=document.createElementNS("http://www.w3.org/2000/svg","g")),DS.setAttribute("transform",e),!(e=DS.transform.baseVal.consolidate()))?bL:(e=e.matrix,sme(e.a,e.b,e.c,e.d,e.e,e.f))}function lme(e,t,n,r){function a(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,h,g){if(c!==d||u!==f){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:ds(c,d)},{i:m-2,x:ds(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function o(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ds(c,u)})):u&&d.push(a(d)+"rotate("+u+r)}function s(c,u,d,f){c!==u?f.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ds(c,u)}):u&&d.push(a(d)+"skewX("+u+r)}function l(c,u,d,f,h,g){if(c!==d||u!==f){var m=h.push(a(h)+"scale(",null,",",null,")");g.push({i:m-4,x:ds(c,d)},{i:m-2,x:ds(u,f)})}else(d!==1||f!==1)&&h.push(a(h)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),o(c.rotate,u.rotate,d,f),s(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(h){for(var g=-1,m=f.length,v;++g<m;)d[(v=f[g]).i]=v.x(h);return d.join("")}}}var Qct=lme(Xct,"px, ","px)","deg)"),Jct=lme(Zct,", ",")",")");function eut(e,t){t===void 0&&(t=e,e=bg);for(var n=0,r=t.length-1,a=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(a,a=t[++n]);return function(o){var s=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[s](o-s)}}function tut(e){return function(){return e}}function pC(e){return+e}var sQ=[0,1];function Ai(e){return e}function yL(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:tut(isNaN(t)?NaN:.5)}function nut(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function rut(e,t,n){var r=e[0],a=e[1],i=t[0],o=t[1];return a<r?(r=yL(a,r),i=n(o,i)):(r=yL(r,a),i=n(i,o)),function(s){return i(r(s))}}function aut(e,t,n){var r=Math.min(e.length,t.length)-1,a=new Array(r),i=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)a[o]=yL(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(s){var l=y0(e,s,1,r)-1;return i[l](a[l](s))}}function x0(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function C_(){var e=sQ,t=sQ,n=bg,r,a,i,o=Ai,s,l,c;function u(){var f=Math.min(e.length,t.length);return o!==Ai&&(o=nut(e[0],e[f-1])),s=f>2?aut:rut,l=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(l||(l=s(e.map(r),t,n)))(r(o(f)))}return d.invert=function(f){return o(a((c||(c=s(t,e.map(r),ds)))(f)))},d.domain=function(f){return arguments.length?(e=Array.from(f,pC),u()):e.slice()},d.range=function(f){return arguments.length?(t=Array.from(f),u()):t.slice()},d.rangeRound=function(f){return t=Array.from(f),n=B5,u()},d.clamp=function(f){return arguments.length?(o=f?!0:Ai,u()):o!==Ai},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,h){return r=f,a=h,u()}}function F5(){return C_()(Ai,Ai)}function iut(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function hC(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function oh(e){return e=hC(Math.abs(e)),e?e[1]:NaN}function out(e,t){return function(n,r){for(var a=n.length,i=[],o=0,s=e[0],l=0;a>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),i.push(n.substring(a-=s,a+s)),!((l+=s+1)>r));)s=e[o=(o+1)%e.length];return i.reverse().join(t)}}function sut(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var lut=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ry(e){if(!(t=lut.exec(e)))throw new Error("invalid format: "+e);var t;return new z5({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ry.prototype=z5.prototype;function z5(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}z5.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cut(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var cme;function uut(e,t){var n=hC(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(cme=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+hC(e,Math.max(0,t+i-1))[0]}function lQ(e,t){var n=hC(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const cQ={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:iut,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>lQ(e*100,t),r:lQ,s:uut,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uQ(e){return e}var dQ=Array.prototype.map,fQ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dut(e){var t=e.grouping===void 0||e.thousands===void 0?uQ:out(dQ.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?uQ:sut(dQ.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(d){d=ry(d);var f=d.fill,h=d.align,g=d.sign,m=d.symbol,v=d.zero,b=d.width,y=d.comma,S=d.precision,C=d.trim,x=d.type;x==="n"?(y=!0,x="g"):cQ[x]||(S===void 0&&(S=12),C=!0,x="g"),(v||f==="0"&&h==="=")&&(v=!0,f="0",h="=");var w=m==="$"?n:m==="#"&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",_=m==="$"?r:/[%p]/.test(x)?o:"",T=cQ[x],k=/[defgprs%]/.test(x);S=S===void 0?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function O(I){var M=w,$=_,R,A,P;if(x==="c")$=T(I)+$,I="";else{I=+I;var N=I<0||1/I<0;if(I=isNaN(I)?l:T(Math.abs(I),S),C&&(I=cut(I)),N&&+I==0&&g!=="+"&&(N=!1),M=(N?g==="("?g:s:g==="-"||g==="("?"":g)+M,$=(x==="s"?fQ[8+cme/3]:"")+$+(N&&g==="("?")":""),k){for(R=-1,A=I.length;++R<A;)if(P=I.charCodeAt(R),48>P||P>57){$=(P===46?a+I.slice(R+1):I.slice(R))+$,I=I.slice(0,R);break}}}y&&!v&&(I=t(I,1/0));var L=M.length+I.length+$.length,j=L<b?new Array(b-L+1).join(f):"";switch(y&&v&&(I=t(j+I,j.length?b-$.length:1/0),j=""),h){case"<":I=M+I+$+j;break;case"=":I=M+j+I+$;break;case"^":I=j.slice(0,L=j.length>>1)+M+I+$+j.slice(L);break;default:I=j+M+I+$;break}return i(I)}return O.toString=function(){return d+""},O}function u(d,f){var h=c((d=ry(d),d.type="f",d)),g=Math.max(-8,Math.min(8,Math.floor(oh(f)/3)))*3,m=Math.pow(10,-g),v=fQ[8+g/3];return function(b){return h(m*b)+v}}return{format:c,formatPrefix:u}}var jS,H5,ume;fut({thousands:",",grouping:[3],currency:["$",""]});function fut(e){return jS=dut(e),H5=jS.format,ume=jS.formatPrefix,jS}function put(e){return Math.max(0,-oh(Math.abs(e)))}function hut(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(oh(t)/3)))*3-oh(Math.abs(e)))}function gut(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,oh(t)-oh(e))+1}function dme(e,t,n,r){var a=hL(e,t,n),i;switch(r=ry(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=hut(a,o))&&(r.precision=i),ume(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=gut(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=put(a))&&(r.precision=i-(r.type==="%")*2);break}}return H5(r)}function hu(e){var t=e.domain;return e.ticks=function(n){var r=t();return fL(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var a=t();return dme(a[0],a[a.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,i=r.length-1,o=r[a],s=r[i],l,c,u=10;for(s<o&&(c=o,o=s,s=c,c=a,a=i,i=c);u-- >0;){if(c=pL(o,s,n),c===l)return r[a]=o,r[i]=s,t(r);if(c>0)o=Math.floor(o/c)*c,s=Math.ceil(s/c)*c;else if(c<0)o=Math.ceil(o*c)/c,s=Math.floor(s*c)/c;else break;l=c}return e},e}function gC(){var e=F5();return e.copy=function(){return x0(e,gC())},es.apply(e,arguments),hu(e)}function fme(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,pC),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return fme(e).unknown(t)},e=arguments.length?Array.from(e,pC):[0,1],hu(n)}function pme(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],i=e[r],o;return i<a&&(o=n,n=r,r=o,o=a,a=i,i=o),e[n]=t.floor(a),e[r]=t.ceil(i),e}function pQ(e){return Math.log(e)}function hQ(e){return Math.exp(e)}function mut(e){return-Math.log(-e)}function vut(e){return-Math.exp(-e)}function but(e){return isFinite(e)?+("1e"+e):e<0?0:e}function yut(e){return e===10?but:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Sut(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function gQ(e){return(t,n)=>-e(-t,n)}function U5(e){const t=e(pQ,hQ),n=t.domain;let r=10,a,i;function o(){return a=Sut(r),i=yut(r),n()[0]<0?(a=gQ(a),i=gQ(i),e(mut,vut)):e(pQ,hQ),t}return t.base=function(s){return arguments.length?(r=+s,o()):r},t.domain=function(s){return arguments.length?(n(s),o()):n()},t.ticks=s=>{const l=n();let c=l[0],u=l[l.length-1];const d=u<c;d&&([c,u]=[u,c]);let f=a(c),h=a(u),g,m;const v=s==null?10:+s;let b=[];if(!(r%1)&&h-f<v){if(f=Math.floor(f),h=Math.ceil(h),c>0){for(;f<=h;++f)for(g=1;g<r;++g)if(m=f<0?g/i(-f):g*i(f),!(m<c)){if(m>u)break;b.push(m)}}else for(;f<=h;++f)for(g=r-1;g>=1;--g)if(m=f>0?g/i(-f):g*i(f),!(m<c)){if(m>u)break;b.push(m)}b.length*2<v&&(b=fL(c,u,v))}else b=fL(f,h,Math.min(h-f,v)).map(i);return d?b.reverse():b},t.tickFormat=(s,l)=>{if(s==null&&(s=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=ry(l)).precision==null&&(l.trim=!0),l=H5(l)),s===1/0)return l;const c=Math.max(1,r*s/t.ticks().length);return u=>{let d=u/i(Math.round(a(u)));return d*r<r-.5&&(d*=r),d<=c?l(u):""}},t.nice=()=>n(pme(n(),{floor:s=>i(Math.floor(a(s))),ceil:s=>i(Math.ceil(a(s)))})),t}function hme(){const e=U5(C_()).domain([1,10]);return e.copy=()=>x0(e,hme()).base(e.base()),es.apply(e,arguments),e}function mQ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function vQ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function W5(e){var t=1,n=e(mQ(t),vQ(t));return n.constant=function(r){return arguments.length?e(mQ(t=+r),vQ(t)):t},hu(n)}function gme(){var e=W5(C_());return e.copy=function(){return x0(e,gme()).constant(e.constant())},es.apply(e,arguments)}function bQ(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function xut(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function wut(e){return e<0?-e*e:e*e}function q5(e){var t=e(Ai,Ai),n=1;function r(){return n===1?e(Ai,Ai):n===.5?e(xut,wut):e(bQ(n),bQ(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,r()):n},hu(t)}function V5(){var e=q5(C_());return e.copy=function(){return x0(e,V5()).exponent(e.exponent())},es.apply(e,arguments),e}function Cut(){return V5.apply(null,arguments).exponent(.5)}function yQ(e){return Math.sign(e)*e*e}function Eut(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function mme(){var e=F5(),t=[0,1],n=!1,r;function a(i){var o=Eut(e(i));return isNaN(o)?r:n?Math.round(o):o}return a.invert=function(i){return e.invert(yQ(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,pC)).map(yQ)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return mme(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},es.apply(a,arguments),hu(a)}function vme(){var e=[],t=[],n=[],r;function a(){var o=0,s=Math.max(1,t.length);for(n=new Array(s-1);++o<s;)n[o-1]=kct(e,o/s);return i}function i(o){return o==null||isNaN(o=+o)?r:t[y0(n,o)]}return i.invertExtent=function(o){var s=t.indexOf(o);return s<0?[NaN,NaN]:[s>0?n[s-1]:e[0],s<n.length?n[s]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let s of o)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(qc),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return vme().domain(e).range(t).unknown(r)},es.apply(i,arguments)}function bme(){var e=0,t=1,n=1,r=[.5],a=[0,1],i;function o(l){return l!=null&&l<=l?a[y0(r,l,0,n)]:i}function s(){var l=-1;for(r=new Array(n);++l<n;)r[l]=((l+1)*t-(l-n)*e)/(n+1);return o}return o.domain=function(l){return arguments.length?([e,t]=l,e=+e,t=+t,s()):[e,t]},o.range=function(l){return arguments.length?(n=(a=Array.from(l)).length-1,s()):a.slice()},o.invertExtent=function(l){var c=a.indexOf(l);return c<0?[NaN,NaN]:c<1?[e,r[0]]:c>=n?[r[n-1],t]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(i=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return bme().domain([e,t]).range(a).unknown(i)},es.apply(hu(o),arguments)}function yme(){var e=[.5],t=[0,1],n,r=1;function a(i){return i!=null&&i<=i?t[y0(e,i,0,r)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return yme().domain(e).range(t).unknown(n)},es.apply(a,arguments)}const jA=new Date,BA=new Date;function Oa(e,t,n,r){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),s=a.ceil(i);return i-o<s-i?o:s},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,s)=>{const l=[];if(i=a.ceil(i),s=s==null?1:Math.floor(s),!(i<o)||!(s>0))return l;let c;do l.push(c=new Date(+i)),t(i,s),e(i);while(c<i&&i<o);return l},a.filter=i=>Oa(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;t(o,-1),!i(o););else for(;--s>=0;)for(;t(o,1),!i(o););}),n&&(a.count=(i,o)=>(jA.setTime(+i),BA.setTime(+o),e(jA),e(BA),Math.floor(n(jA,BA))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(r?o=>r(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const mC=Oa(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);mC.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Oa(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):mC);mC.range;const jl=1e3,Fo=jl*60,Bl=Fo*60,Ql=Bl*24,G5=Ql*7,SQ=Ql*30,FA=Ql*365,od=Oa(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*jl)},(e,t)=>(t-e)/jl,e=>e.getUTCSeconds());od.range;const K5=Oa(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jl)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getMinutes());K5.range;const Y5=Oa(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getUTCMinutes());Y5.range;const X5=Oa(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jl-e.getMinutes()*Fo)},(e,t)=>{e.setTime(+e+t*Bl)},(e,t)=>(t-e)/Bl,e=>e.getHours());X5.range;const Z5=Oa(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Bl)},(e,t)=>(t-e)/Bl,e=>e.getUTCHours());Z5.range;const w0=Oa(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Fo)/Ql,e=>e.getDate()-1);w0.range;const E_=Oa(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ql,e=>e.getUTCDate()-1);E_.range;const Sme=Oa(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ql,e=>Math.floor(e/Ql));Sme.range;function gf(e){return Oa(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Fo)/G5)}const __=gf(0),vC=gf(1),_ut=gf(2),Tut=gf(3),sh=gf(4),kut=gf(5),Out=gf(6);__.range;vC.range;_ut.range;Tut.range;sh.range;kut.range;Out.range;function mf(e){return Oa(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/G5)}const T_=mf(0),bC=mf(1),$ut=mf(2),Iut=mf(3),lh=mf(4),Aut=mf(5),Rut=mf(6);T_.range;bC.range;$ut.range;Iut.range;lh.range;Aut.range;Rut.range;const Q5=Oa(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Q5.range;const J5=Oa(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());J5.range;const Jl=Oa(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Jl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oa(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Jl.range;const ec=Oa(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ec.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oa(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ec.range;function xme(e,t,n,r,a,i){const o=[[od,1,jl],[od,5,5*jl],[od,15,15*jl],[od,30,30*jl],[i,1,Fo],[i,5,5*Fo],[i,15,15*Fo],[i,30,30*Fo],[a,1,Bl],[a,3,3*Bl],[a,6,6*Bl],[a,12,12*Bl],[r,1,Ql],[r,2,2*Ql],[n,1,G5],[t,1,SQ],[t,3,3*SQ],[e,1,FA]];function s(c,u,d){const f=u<c;f&&([c,u]=[u,c]);const h=d&&typeof d.range=="function"?d:l(c,u,d),g=h?h.range(c,+u+1):[];return f?g.reverse():g}function l(c,u,d){const f=Math.abs(u-c)/d,h=L5(([,,v])=>v).right(o,f);if(h===o.length)return e.every(hL(c/FA,u/FA,d));if(h===0)return mC.every(Math.max(hL(c,u,d),1));const[g,m]=o[f/o[h-1][2]<o[h][2]/f?h-1:h];return g.every(m)}return[s,l]}const[Mut,Put]=xme(ec,J5,T_,Sme,Z5,Y5),[Nut,Lut]=xme(Jl,Q5,__,w0,X5,K5);function zA(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function HA(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function tm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Dut(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=nm(a),u=rm(a),d=nm(i),f=rm(i),h=nm(o),g=rm(o),m=nm(s),v=rm(s),b=nm(l),y=rm(l),S={a:N,A:L,b:j,B:D,c:null,d:TQ,e:TQ,f:odt,g:mdt,G:bdt,H:rdt,I:adt,j:idt,L:wme,m:sdt,M:ldt,p:H,q:F,Q:$Q,s:IQ,S:cdt,u:udt,U:ddt,V:fdt,w:pdt,W:hdt,x:null,X:null,y:gdt,Y:vdt,Z:ydt,"%":OQ},C={a:B,A:z,b:G,B:X,c:null,d:kQ,e:kQ,f:Cdt,g:Mdt,G:Ndt,H:Sdt,I:xdt,j:wdt,L:Eme,m:Edt,M:_dt,p:Z,q,Q:$Q,s:IQ,S:Tdt,u:kdt,U:Odt,V:$dt,w:Idt,W:Adt,x:null,X:null,y:Rdt,Y:Pdt,Z:Ldt,"%":OQ},x={a:O,A:I,b:M,B:$,c:R,d:EQ,e:EQ,f:Jut,g:CQ,G:wQ,H:_Q,I:_Q,j:Yut,L:Qut,m:Kut,M:Xut,p:k,q:Gut,Q:tdt,s:ndt,S:Zut,u:Hut,U:Uut,V:Wut,w:zut,W:qut,x:A,X:P,y:CQ,Y:wQ,Z:Vut,"%":edt};S.x=w(n,S),S.X=w(r,S),S.c=w(t,S),C.x=w(n,C),C.X=w(r,C),C.c=w(t,C);function w(Y,te){return function(ee){var Q=[],ae=-1,oe=0,re=Y.length,ie,ue,ge;for(ee instanceof Date||(ee=new Date(+ee));++ae<re;)Y.charCodeAt(ae)===37&&(Q.push(Y.slice(oe,ae)),(ue=xQ[ie=Y.charAt(++ae)])!=null?ie=Y.charAt(++ae):ue=ie==="e"?" ":"0",(ge=te[ie])&&(ie=ge(ee,ue)),Q.push(ie),oe=ae+1);return Q.push(Y.slice(oe,ae)),Q.join("")}}function _(Y,te){return function(ee){var Q=tm(1900,void 0,1),ae=T(Q,Y,ee+="",0),oe,re;if(ae!=ee.length)return null;if("Q"in Q)return new Date(Q.Q);if("s"in Q)return new Date(Q.s*1e3+("L"in Q?Q.L:0));if(te&&!("Z"in Q)&&(Q.Z=0),"p"in Q&&(Q.H=Q.H%12+Q.p*12),Q.m===void 0&&(Q.m="q"in Q?Q.q:0),"V"in Q){if(Q.V<1||Q.V>53)return null;"w"in Q||(Q.w=1),"Z"in Q?(oe=HA(tm(Q.y,0,1)),re=oe.getUTCDay(),oe=re>4||re===0?bC.ceil(oe):bC(oe),oe=E_.offset(oe,(Q.V-1)*7),Q.y=oe.getUTCFullYear(),Q.m=oe.getUTCMonth(),Q.d=oe.getUTCDate()+(Q.w+6)%7):(oe=zA(tm(Q.y,0,1)),re=oe.getDay(),oe=re>4||re===0?vC.ceil(oe):vC(oe),oe=w0.offset(oe,(Q.V-1)*7),Q.y=oe.getFullYear(),Q.m=oe.getMonth(),Q.d=oe.getDate()+(Q.w+6)%7)}else("W"in Q||"U"in Q)&&("w"in Q||(Q.w="u"in Q?Q.u%7:"W"in Q?1:0),re="Z"in Q?HA(tm(Q.y,0,1)).getUTCDay():zA(tm(Q.y,0,1)).getDay(),Q.m=0,Q.d="W"in Q?(Q.w+6)%7+Q.W*7-(re+5)%7:Q.w+Q.U*7-(re+6)%7);return"Z"in Q?(Q.H+=Q.Z/100|0,Q.M+=Q.Z%100,HA(Q)):zA(Q)}}function T(Y,te,ee,Q){for(var ae=0,oe=te.length,re=ee.length,ie,ue;ae<oe;){if(Q>=re)return-1;if(ie=te.charCodeAt(ae++),ie===37){if(ie=te.charAt(ae++),ue=x[ie in xQ?te.charAt(ae++):ie],!ue||(Q=ue(Y,ee,Q))<0)return-1}else if(ie!=ee.charCodeAt(Q++))return-1}return Q}function k(Y,te,ee){var Q=c.exec(te.slice(ee));return Q?(Y.p=u.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function O(Y,te,ee){var Q=h.exec(te.slice(ee));return Q?(Y.w=g.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function I(Y,te,ee){var Q=d.exec(te.slice(ee));return Q?(Y.w=f.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function M(Y,te,ee){var Q=b.exec(te.slice(ee));return Q?(Y.m=y.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function $(Y,te,ee){var Q=m.exec(te.slice(ee));return Q?(Y.m=v.get(Q[0].toLowerCase()),ee+Q[0].length):-1}function R(Y,te,ee){return T(Y,t,te,ee)}function A(Y,te,ee){return T(Y,n,te,ee)}function P(Y,te,ee){return T(Y,r,te,ee)}function N(Y){return o[Y.getDay()]}function L(Y){return i[Y.getDay()]}function j(Y){return l[Y.getMonth()]}function D(Y){return s[Y.getMonth()]}function H(Y){return a[+(Y.getHours()>=12)]}function F(Y){return 1+~~(Y.getMonth()/3)}function B(Y){return o[Y.getUTCDay()]}function z(Y){return i[Y.getUTCDay()]}function G(Y){return l[Y.getUTCMonth()]}function X(Y){return s[Y.getUTCMonth()]}function Z(Y){return a[+(Y.getUTCHours()>=12)]}function q(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var te=w(Y+="",S);return te.toString=function(){return Y},te},parse:function(Y){var te=_(Y+="",!1);return te.toString=function(){return Y},te},utcFormat:function(Y){var te=w(Y+="",C);return te.toString=function(){return Y},te},utcParse:function(Y){var te=_(Y+="",!0);return te.toString=function(){return Y},te}}}var xQ={"-":"",_:" ",0:"0"},Fa=/^\s*\d+/,jut=/^%/,But=/[\\^$*+?|[\]().{}]/g;function ir(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function Fut(e){return e.replace(But,"\\$&")}function nm(e){return new RegExp("^(?:"+e.map(Fut).join("|")+")","i")}function rm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function zut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Hut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Uut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Wut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function wQ(e,t,n){var r=Fa.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function CQ(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vut(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Gut(e,t,n){var r=Fa.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Kut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function EQ(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Yut(e,t,n){var r=Fa.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function _Q(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Xut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Zut(e,t,n){var r=Fa.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Qut(e,t,n){var r=Fa.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Jut(e,t,n){var r=Fa.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function edt(e,t,n){var r=jut.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function tdt(e,t,n){var r=Fa.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ndt(e,t,n){var r=Fa.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function TQ(e,t){return ir(e.getDate(),t,2)}function rdt(e,t){return ir(e.getHours(),t,2)}function adt(e,t){return ir(e.getHours()%12||12,t,2)}function idt(e,t){return ir(1+w0.count(Jl(e),e),t,3)}function wme(e,t){return ir(e.getMilliseconds(),t,3)}function odt(e,t){return wme(e,t)+"000"}function sdt(e,t){return ir(e.getMonth()+1,t,2)}function ldt(e,t){return ir(e.getMinutes(),t,2)}function cdt(e,t){return ir(e.getSeconds(),t,2)}function udt(e){var t=e.getDay();return t===0?7:t}function ddt(e,t){return ir(__.count(Jl(e)-1,e),t,2)}function Cme(e){var t=e.getDay();return t>=4||t===0?sh(e):sh.ceil(e)}function fdt(e,t){return e=Cme(e),ir(sh.count(Jl(e),e)+(Jl(e).getDay()===4),t,2)}function pdt(e){return e.getDay()}function hdt(e,t){return ir(vC.count(Jl(e)-1,e),t,2)}function gdt(e,t){return ir(e.getFullYear()%100,t,2)}function mdt(e,t){return e=Cme(e),ir(e.getFullYear()%100,t,2)}function vdt(e,t){return ir(e.getFullYear()%1e4,t,4)}function bdt(e,t){var n=e.getDay();return e=n>=4||n===0?sh(e):sh.ceil(e),ir(e.getFullYear()%1e4,t,4)}function ydt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ir(t/60|0,"0",2)+ir(t%60,"0",2)}function kQ(e,t){return ir(e.getUTCDate(),t,2)}function Sdt(e,t){return ir(e.getUTCHours(),t,2)}function xdt(e,t){return ir(e.getUTCHours()%12||12,t,2)}function wdt(e,t){return ir(1+E_.count(ec(e),e),t,3)}function Eme(e,t){return ir(e.getUTCMilliseconds(),t,3)}function Cdt(e,t){return Eme(e,t)+"000"}function Edt(e,t){return ir(e.getUTCMonth()+1,t,2)}function _dt(e,t){return ir(e.getUTCMinutes(),t,2)}function Tdt(e,t){return ir(e.getUTCSeconds(),t,2)}function kdt(e){var t=e.getUTCDay();return t===0?7:t}function Odt(e,t){return ir(T_.count(ec(e)-1,e),t,2)}function _me(e){var t=e.getUTCDay();return t>=4||t===0?lh(e):lh.ceil(e)}function $dt(e,t){return e=_me(e),ir(lh.count(ec(e),e)+(ec(e).getUTCDay()===4),t,2)}function Idt(e){return e.getUTCDay()}function Adt(e,t){return ir(bC.count(ec(e)-1,e),t,2)}function Rdt(e,t){return ir(e.getUTCFullYear()%100,t,2)}function Mdt(e,t){return e=_me(e),ir(e.getUTCFullYear()%100,t,2)}function Pdt(e,t){return ir(e.getUTCFullYear()%1e4,t,4)}function Ndt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?lh(e):lh.ceil(e),ir(e.getUTCFullYear()%1e4,t,4)}function Ldt(){return"+0000"}function OQ(){return"%"}function $Q(e){return+e}function IQ(e){return Math.floor(+e/1e3)}var qf,Tme,kme;Ddt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ddt(e){return qf=Dut(e),Tme=qf.format,qf.parse,kme=qf.utcFormat,qf.utcParse,qf}function jdt(e){return new Date(e)}function Bdt(e){return e instanceof Date?+e:+new Date(+e)}function eH(e,t,n,r,a,i,o,s,l,c){var u=F5(),d=u.invert,f=u.domain,h=c(".%L"),g=c(":%S"),m=c("%I:%M"),v=c("%I %p"),b=c("%a %d"),y=c("%b %d"),S=c("%B"),C=c("%Y");function x(w){return(l(w)<w?h:s(w)<w?g:o(w)<w?m:i(w)<w?v:r(w)<w?a(w)<w?b:y:n(w)<w?S:C)(w)}return u.invert=function(w){return new Date(d(w))},u.domain=function(w){return arguments.length?f(Array.from(w,Bdt)):f().map(jdt)},u.ticks=function(w){var _=f();return e(_[0],_[_.length-1],w??10)},u.tickFormat=function(w,_){return _==null?x:c(_)},u.nice=function(w){var _=f();return(!w||typeof w.range!="function")&&(w=t(_[0],_[_.length-1],w??10)),w?f(pme(_,w)):u},u.copy=function(){return x0(u,eH(e,t,n,r,a,i,o,s,l,c))},u}function Fdt(){return es.apply(eH(Nut,Lut,Jl,Q5,__,w0,X5,K5,od,Tme).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function zdt(){return es.apply(eH(Mut,Put,ec,J5,T_,E_,Z5,Y5,od,kme).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function k_(){var e=0,t=1,n,r,a,i,o=Ai,s=!1,l;function c(d){return d==null||isNaN(d=+d)?l:o(a===0?.5:(d=(i(d)-n)*a,s?Math.max(0,Math.min(1,d)):d))}c.domain=function(d){return arguments.length?([e,t]=d,n=i(e=+e),r=i(t=+t),a=n===r?0:1/(r-n),c):[e,t]},c.clamp=function(d){return arguments.length?(s=!!d,c):s},c.interpolator=function(d){return arguments.length?(o=d,c):o};function u(d){return function(f){var h,g;return arguments.length?([h,g]=f,o=d(h,g),c):[o(0),o(1)]}}return c.range=u(bg),c.rangeRound=u(B5),c.unknown=function(d){return arguments.length?(l=d,c):l},function(d){return i=d,n=d(e),r=d(t),a=n===r?0:1/(r-n),c}}function gu(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ome(){var e=hu(k_()(Ai));return e.copy=function(){return gu(e,Ome())},uc.apply(e,arguments)}function $me(){var e=U5(k_()).domain([1,10]);return e.copy=function(){return gu(e,$me()).base(e.base())},uc.apply(e,arguments)}function Ime(){var e=W5(k_());return e.copy=function(){return gu(e,Ime()).constant(e.constant())},uc.apply(e,arguments)}function tH(){var e=q5(k_());return e.copy=function(){return gu(e,tH()).exponent(e.exponent())},uc.apply(e,arguments)}function Hdt(){return tH.apply(null,arguments).exponent(.5)}function Ame(){var e=[],t=Ai;function n(r){if(r!=null&&!isNaN(r=+r))return t((y0(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let a of r)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(qc),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,a)=>t(a/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,i)=>Tct(e,i/r))},n.copy=function(){return Ame(t).domain(e)},uc.apply(n,arguments)}function O_(){var e=0,t=.5,n=1,r=1,a,i,o,s,l,c=Ai,u,d=!1,f;function h(m){return isNaN(m=+m)?f:(m=.5+((m=+u(m))-i)*(r*m<r*i?s:l),c(d?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,a=u(e=+e),i=u(t=+t),o=u(n=+n),s=a===i?0:.5/(i-a),l=i===o?0:.5/(o-i),r=i<a?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(d=!!m,h):d},h.interpolator=function(m){return arguments.length?(c=m,h):c};function g(m){return function(v){var b,y,S;return arguments.length?([b,y,S]=v,c=eut(m,[b,y,S]),h):[c(0),c(.5),c(1)]}}return h.range=g(bg),h.rangeRound=g(B5),h.unknown=function(m){return arguments.length?(f=m,h):f},function(m){return u=m,a=m(e),i=m(t),o=m(n),s=a===i?0:.5/(i-a),l=i===o?0:.5/(o-i),r=i<a?-1:1,h}}function Rme(){var e=hu(O_()(Ai));return e.copy=function(){return gu(e,Rme())},uc.apply(e,arguments)}function Mme(){var e=U5(O_()).domain([.1,1,10]);return e.copy=function(){return gu(e,Mme()).base(e.base())},uc.apply(e,arguments)}function Pme(){var e=W5(O_());return e.copy=function(){return gu(e,Pme()).constant(e.constant())},uc.apply(e,arguments)}function nH(){var e=q5(O_());return e.copy=function(){return gu(e,nH()).exponent(e.exponent())},uc.apply(e,arguments)}function Udt(){return nH.apply(null,arguments).exponent(.5)}const AQ=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:ey,scaleDiverging:Rme,scaleDivergingLog:Mme,scaleDivergingPow:nH,scaleDivergingSqrt:Udt,scaleDivergingSymlog:Pme,scaleIdentity:fme,scaleImplicit:gL,scaleLinear:gC,scaleLog:hme,scaleOrdinal:D5,scalePoint:ab,scalePow:V5,scaleQuantile:vme,scaleQuantize:bme,scaleRadial:mme,scaleSequential:Ome,scaleSequentialLog:$me,scaleSequentialPow:tH,scaleSequentialQuantile:Ame,scaleSequentialSqrt:Hdt,scaleSequentialSymlog:Ime,scaleSqrt:Cut,scaleSymlog:gme,scaleThreshold:yme,scaleTime:Fdt,scaleUtc:zdt,tickFormat:dme},Symbol.toStringTag,{value:"Module"}));var UA,RQ;function $_(){if(RQ)return UA;RQ=1;var e=hg();function t(n,r,a){for(var i=-1,o=n.length;++i<o;){var s=n[i],l=r(s);if(l!=null&&(c===void 0?l===l&&!e(l):a(l,c)))var c=l,u=s}return u}return UA=t,UA}var WA,MQ;function Nme(){if(MQ)return WA;MQ=1;function e(t,n){return t>n}return WA=e,WA}var qA,PQ;function Wdt(){if(PQ)return qA;PQ=1;var e=$_(),t=Nme(),n=vg();function r(a){return a&&a.length?e(a,n,t):void 0}return qA=r,qA}var qdt=Wdt();const I_=An(qdt);var VA,NQ;function Lme(){if(NQ)return VA;NQ=1;function e(t,n){return t<n}return VA=e,VA}var GA,LQ;function Vdt(){if(LQ)return GA;LQ=1;var e=$_(),t=Lme(),n=vg();function r(a){return a&&a.length?e(a,n,t):void 0}return GA=r,GA}var Gdt=Vdt();const A_=An(Gdt);var KA,DQ;function Kdt(){if(DQ)return KA;DQ=1;var e=o5(),t=yl(),n=Fge(),r=Xi();function a(i,o){var s=r(i)?e:n;return s(i,t(o,3))}return KA=a,KA}var YA,jQ;function Ydt(){if(jQ)return YA;jQ=1;var e=jge(),t=Kdt();function n(r,a){return e(t(r,a),1)}return YA=n,YA}var Xdt=Ydt();const Zdt=An(Xdt);var XA,BQ;function Qdt(){if(BQ)return XA;BQ=1;var e=R5();function t(n,r){return e(n,r)}return XA=t,XA}var Jdt=Qdt();const C0=An(Jdt);var yg=1e9,eft={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},aH,Br=!0,Yo="[DecimalError] ",md=Yo+"Invalid argument: ",rH=Yo+"Exponent out of range: ",Sg=Math.floor,ju=Math.pow,tft=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,fo,Pa=1e7,Ir=7,Dme=9007199254740991,yC=Sg(Dme/Ir),jt={};jt.absoluteValue=jt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};jt.comparedTo=jt.cmp=function(e){var t,n,r,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(r=i.d.length,a=e.d.length,t=0,n=r<a?r:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===a?0:r>a^i.s<0?1:-1};jt.decimalPlaces=jt.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Ir;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};jt.dividedBy=jt.div=function(e){return Wl(this,new this.constructor(e))};jt.dividedToIntegerBy=jt.idiv=function(e){var t=this,n=t.constructor;return Sr(Wl(t,new n(e),0,1),n.precision)};jt.equals=jt.eq=function(e){return!this.cmp(e)};jt.exponent=function(){return oa(this)};jt.greaterThan=jt.gt=function(e){return this.cmp(e)>0};jt.greaterThanOrEqualTo=jt.gte=function(e){return this.cmp(e)>=0};jt.isInteger=jt.isint=function(){return this.e>this.d.length-2};jt.isNegative=jt.isneg=function(){return this.s<0};jt.isPositive=jt.ispos=function(){return this.s>0};jt.isZero=function(){return this.s===0};jt.lessThan=jt.lt=function(e){return this.cmp(e)<0};jt.lessThanOrEqualTo=jt.lte=function(e){return this.cmp(e)<1};jt.logarithm=jt.log=function(e){var t,n=this,r=n.constructor,a=r.precision,i=a+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(fo))throw Error(Yo+"NaN");if(n.s<1)throw Error(Yo+(n.s?"NaN":"-Infinity"));return n.eq(fo)?new r(0):(Br=!1,t=Wl(ay(n,i),ay(e,i),i),Br=!0,Sr(t,a))};jt.minus=jt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Fme(t,e):jme(t,(e.s=-e.s,e))};jt.modulo=jt.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(e=new r(e),!e.s)throw Error(Yo+"NaN");return n.s?(Br=!1,t=Wl(n,e,0,1).times(e),Br=!0,n.minus(t)):Sr(new r(n),a)};jt.naturalExponential=jt.exp=function(){return Bme(this)};jt.naturalLogarithm=jt.ln=function(){return ay(this)};jt.negated=jt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};jt.plus=jt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?jme(t,e):Fme(t,(e.s=-e.s,e))};jt.precision=jt.sd=function(e){var t,n,r,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(md+e);if(t=oa(a)+1,r=a.d.length-1,n=r*Ir+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};jt.squareRoot=jt.sqrt=function(){var e,t,n,r,a,i,o,s=this,l=s.constructor;if(s.s<1){if(!s.s)return new l(0);throw Error(Yo+"NaN")}for(e=oa(s),Br=!1,a=Math.sqrt(+s),a==0||a==1/0?(t=tl(s.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Sg((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new l(t)):r=new l(a.toString()),n=l.precision,a=o=n+3;;)if(i=r,r=i.plus(Wl(s,i,o+2)).times(.5),tl(i.d).slice(0,o)===(t=tl(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(Sr(i,n+1,0),i.times(i).eq(s)){r=i;break}}else if(t!="9999")break;o+=4}return Br=!0,Sr(r,n)};jt.times=jt.mul=function(e){var t,n,r,a,i,o,s,l,c,u=this,d=u.constructor,f=u.d,h=(e=new d(e)).d;if(!u.s||!e.s)return new d(0);for(e.s*=u.s,n=u.e+e.e,l=f.length,c=h.length,l<c&&(i=f,f=h,h=i,o=l,l=c,c=o),i=[],o=l+c,r=o;r--;)i.push(0);for(r=c;--r>=0;){for(t=0,a=l+r;a>r;)s=i[a]+h[r]*f[a-r-1]+t,i[a--]=s%Pa|0,t=s/Pa|0;i[a]=(i[a]+t)%Pa|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,Br?Sr(e,d.precision):e};jt.toDecimalPlaces=jt.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(cl(e,0,yg),t===void 0?t=r.rounding:cl(t,0,8),Sr(n,e+oa(n)+1,t))};jt.toExponential=function(e,t){var n,r=this,a=r.constructor;return e===void 0?n=jd(r,!0):(cl(e,0,yg),t===void 0?t=a.rounding:cl(t,0,8),r=Sr(new a(r),e+1,t),n=jd(r,!0,e+1)),n};jt.toFixed=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?jd(a):(cl(e,0,yg),t===void 0?t=i.rounding:cl(t,0,8),r=Sr(new i(a),e+oa(a)+1,t),n=jd(r.abs(),!1,e+oa(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};jt.toInteger=jt.toint=function(){var e=this,t=e.constructor;return Sr(new t(e),oa(e)+1,t.rounding)};jt.toNumber=function(){return+this};jt.toPower=jt.pow=function(e){var t,n,r,a,i,o,s=this,l=s.constructor,c=12,u=+(e=new l(e));if(!e.s)return new l(fo);if(s=new l(s),!s.s){if(e.s<1)throw Error(Yo+"Infinity");return s}if(s.eq(fo))return s;if(r=l.precision,e.eq(fo))return Sr(s,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=s.s,o){if((n=u<0?-u:u)<=Dme){for(a=new l(fo),t=Math.ceil(r/Ir+4),Br=!1;n%2&&(a=a.times(s),zQ(a.d,t)),n=Sg(n/2),n!==0;)s=s.times(s),zQ(s.d,t);return Br=!0,e.s<0?new l(fo).div(a):Sr(a,r)}}else if(i<0)throw Error(Yo+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,s.s=1,Br=!1,a=e.times(ay(s,r+c)),Br=!0,a=Bme(a),a.s=i,a};jt.toPrecision=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?(n=oa(a),r=jd(a,n<=i.toExpNeg||n>=i.toExpPos)):(cl(e,1,yg),t===void 0?t=i.rounding:cl(t,0,8),a=Sr(new i(a),e,t),n=oa(a),r=jd(a,e<=n||n<=i.toExpNeg,e)),r};jt.toSignificantDigits=jt.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(cl(e,1,yg),t===void 0?t=r.rounding:cl(t,0,8)),Sr(new r(n),e,t)};jt.toString=jt.valueOf=jt.val=jt.toJSON=jt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=oa(e),n=e.constructor;return jd(e,t<=n.toExpNeg||t>=n.toExpPos)};function jme(e,t){var n,r,a,i,o,s,l,c,u=e.constructor,d=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),Br?Sr(t,d):t;if(l=e.d,c=t.d,o=e.e,a=t.e,l=l.slice(),i=o-a,i){for(i<0?(r=l,i=-i,s=c.length):(r=c,a=o,s=l.length),o=Math.ceil(d/Ir),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=l.length,i=c.length,s-i<0&&(i=s,r=c,c=l,l=r),n=0;i;)n=(l[--i]=l[i]+c[i]+n)/Pa|0,l[i]%=Pa;for(n&&(l.unshift(n),++a),s=l.length;l[--s]==0;)l.pop();return t.d=l,t.e=a,Br?Sr(t,d):t}function cl(e,t,n){if(e!==~~e||e<t||e>n)throw Error(md+e)}function tl(e){var t,n,r,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)r=e[t]+"",n=Ir-r.length,n&&(i+=$c(n)),i+=r;o=e[t],r=o+"",n=Ir-r.length,n&&(i+=$c(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Wl=function(){function e(r,a){var i,o=0,s=r.length;for(r=r.slice();s--;)i=r[s]*a+o,r[s]=i%Pa|0,o=i/Pa|0;return o&&r.unshift(o),r}function t(r,a,i,o){var s,l;if(i!=o)l=i>o?1:-1;else for(s=l=0;s<i;s++)if(r[s]!=a[s]){l=r[s]>a[s]?1:-1;break}return l}function n(r,a,i){for(var o=0;i--;)r[i]-=o,o=r[i]<a[i]?1:0,r[i]=o*Pa+r[i]-a[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,a,i,o){var s,l,c,u,d,f,h,g,m,v,b,y,S,C,x,w,_,T,k=r.constructor,O=r.s==a.s?1:-1,I=r.d,M=a.d;if(!r.s)return new k(r);if(!a.s)throw Error(Yo+"Division by zero");for(l=r.e-a.e,_=M.length,x=I.length,h=new k(O),g=h.d=[],c=0;M[c]==(I[c]||0);)++c;if(M[c]>(I[c]||0)&&--l,i==null?y=i=k.precision:o?y=i+(oa(r)-oa(a))+1:y=i,y<0)return new k(0);if(y=y/Ir+2|0,c=0,_==1)for(u=0,M=M[0],y++;(c<x||u)&&y--;c++)S=u*Pa+(I[c]||0),g[c]=S/M|0,u=S%M|0;else{for(u=Pa/(M[0]+1)|0,u>1&&(M=e(M,u),I=e(I,u),_=M.length,x=I.length),C=_,m=I.slice(0,_),v=m.length;v<_;)m[v++]=0;T=M.slice(),T.unshift(0),w=M[0],M[1]>=Pa/2&&++w;do u=0,s=t(M,m,_,v),s<0?(b=m[0],_!=v&&(b=b*Pa+(m[1]||0)),u=b/w|0,u>1?(u>=Pa&&(u=Pa-1),d=e(M,u),f=d.length,v=m.length,s=t(d,m,f,v),s==1&&(u--,n(d,_<f?T:M,f))):(u==0&&(s=u=1),d=M.slice()),f=d.length,f<v&&d.unshift(0),n(m,d,v),s==-1&&(v=m.length,s=t(M,m,_,v),s<1&&(u++,n(m,_<v?T:M,v))),v=m.length):s===0&&(u++,m=[0]),g[c++]=u,s&&m[0]?m[v++]=I[C]||0:(m=[I[C]],v=1);while((C++<x||m[0]!==void 0)&&y--)}return g[0]||g.shift(),h.e=l,Sr(h,o?i+oa(h)+1:i)}}();function Bme(e,t){var n,r,a,i,o,s,l=0,c=0,u=e.constructor,d=u.precision;if(oa(e)>16)throw Error(rH+oa(e));if(!e.s)return new u(fo);for(Br=!1,s=d,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),c+=5;for(r=Math.log(ju(2,c))/Math.LN10*2+5|0,s+=r,n=a=i=new u(fo),u.precision=s;;){if(a=Sr(a.times(e),s),n=n.times(++l),o=i.plus(Wl(a,n,s)),tl(o.d).slice(0,s)===tl(i.d).slice(0,s)){for(;c--;)i=Sr(i.times(i),s);return u.precision=d,t==null?(Br=!0,Sr(i,d)):i}i=o}}function oa(e){for(var t=e.e*Ir,n=e.d[0];n>=10;n/=10)t++;return t}function ZA(e,t,n){if(t>e.LN10.sd())throw Br=!0,n&&(e.precision=n),Error(Yo+"LN10 precision limit exceeded");return Sr(new e(e.LN10),t)}function $c(e){for(var t="";e--;)t+="0";return t}function ay(e,t){var n,r,a,i,o,s,l,c,u,d=1,f=10,h=e,g=h.d,m=h.constructor,v=m.precision;if(h.s<1)throw Error(Yo+(h.s?"NaN":"-Infinity"));if(h.eq(fo))return new m(0);if(t==null?(Br=!1,c=v):c=t,h.eq(10))return t==null&&(Br=!0),ZA(m,c);if(c+=f,m.precision=c,n=tl(g),r=n.charAt(0),i=oa(h),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=tl(h.d),r=n.charAt(0),d++;i=oa(h),r>1?(h=new m("0."+n),i++):h=new m(r+"."+n.slice(1))}else return l=ZA(m,c+2,v).times(i+""),h=ay(new m(r+"."+n.slice(1)),c-f).plus(l),m.precision=v,t==null?(Br=!0,Sr(h,v)):h;for(s=o=h=Wl(h.minus(fo),h.plus(fo),c),u=Sr(h.times(h),c),a=3;;){if(o=Sr(o.times(u),c),l=s.plus(Wl(o,new m(a),c)),tl(l.d).slice(0,c)===tl(s.d).slice(0,c))return s=s.times(2),i!==0&&(s=s.plus(ZA(m,c+2,v).times(i+""))),s=Wl(s,new m(d),c),m.precision=v,t==null?(Br=!0,Sr(s,v)):s;s=l,a+=2}}function FQ(e,t){var n,r,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=Sg(n/Ir),e.d=[],r=(n+1)%Ir,n<0&&(r+=Ir),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=Ir;r<a;)e.d.push(+t.slice(r,r+=Ir));t=t.slice(r),r=Ir-t.length}else r-=a;for(;r--;)t+="0";if(e.d.push(+t),Br&&(e.e>yC||e.e<-yC))throw Error(rH+n)}else e.s=0,e.e=0,e.d=[0];return e}function Sr(e,t,n){var r,a,i,o,s,l,c,u,d=e.d;for(o=1,i=d[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=Ir,a=t,c=d[u=0];else{if(u=Math.ceil((r+1)/Ir),i=d.length,u>=i)return e;for(c=i=d[u],o=1;i>=10;i/=10)o++;r%=Ir,a=r-Ir+o}if(n!==void 0&&(i=ju(10,o-a-1),s=c/i%10|0,l=t<0||d[u+1]!==void 0||c%i,l=n<4?(s||l)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||l||n==6&&(r>0?a>0?c/ju(10,o-a):0:d[u-1])%10&1||n==(e.s<0?8:7))),t<1||!d[0])return l?(i=oa(e),d.length=1,t=t-i-1,d[0]=ju(10,(Ir-t%Ir)%Ir),e.e=Sg(-t/Ir)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(r==0?(d.length=u,i=1,u--):(d.length=u+1,i=ju(10,Ir-r),d[u]=a>0?(c/ju(10,o-a)%ju(10,a)|0)*i:0),l)for(;;)if(u==0){(d[0]+=i)==Pa&&(d[0]=1,++e.e);break}else{if(d[u]+=i,d[u]!=Pa)break;d[u--]=0,i=1}for(r=d.length;d[--r]===0;)d.pop();if(Br&&(e.e>yC||e.e<-yC))throw Error(rH+oa(e));return e}function Fme(e,t){var n,r,a,i,o,s,l,c,u,d,f=e.constructor,h=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),Br?Sr(t,h):t;if(l=e.d,d=t.d,r=t.e,c=e.e,l=l.slice(),o=c-r,o){for(u=o<0,u?(n=l,o=-o,s=d.length):(n=d,r=c,s=l.length),a=Math.max(Math.ceil(h/Ir),s)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=l.length,s=d.length,u=a<s,u&&(s=a),a=0;a<s;a++)if(l[a]!=d[a]){u=l[a]<d[a];break}o=0}for(u&&(n=l,l=d,d=n,t.s=-t.s),s=l.length,a=d.length-s;a>0;--a)l[s++]=0;for(a=d.length;a>o;){if(l[--a]<d[a]){for(i=a;i&&l[--i]===0;)l[i]=Pa-1;--l[i],l[a]+=Pa}l[a]-=d[a]}for(;l[--s]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=r,Br?Sr(t,h):t):new f(0)}function jd(e,t,n){var r,a=oa(e),i=tl(e.d),o=i.length;return t?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+$c(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+$c(-a-1)+i,n&&(r=n-o)>0&&(i+=$c(r))):a>=o?(i+=$c(a+1-o),n&&(r=n-a-1)>0&&(i=i+"."+$c(r))):((r=a+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(a+1===o&&(i+="."),i+=$c(r))),e.s<0?"-"+i:i}function zQ(e,t){if(e.length>t)return e.length=t,!0}function zme(e){var t,n,r;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(md+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return FQ(o,i.toString())}else if(typeof i!="string")throw Error(md+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,tft.test(i))FQ(o,i);else throw Error(md+i)}if(a.prototype=jt,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=zme,a.config=a.set=nft,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return a.config(e),a}function nft(e){if(!e||typeof e!="object")throw Error(Yo+"Object expected");var t,n,r,a=["precision",1,yg,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((r=e[n=a[t]])!==void 0)if(Sg(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(md+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(md+n+": "+r);return this}var aH=zme(eft);fo=new aH(1);const vr=aH;function rft(e){return sft(e)||oft(e)||ift(e)||aft()}function aft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
653
653
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ift(e,t){if(e){if(typeof e=="string")return SL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SL(e,t)}}function oft(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function sft(e){if(Array.isArray(e))return SL(e)}function SL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var lft=function(t){return t},Hme={},Ume=function(t){return t===Hme},HQ=function(t){return function n(){return arguments.length===0||arguments.length===1&&Ume(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},cft=function e(t,n){return t===1?n:HQ(function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var o=a.filter(function(s){return s!==Hme}).length;return o>=t?n.apply(void 0,a):e(t-o,HQ(function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];var u=a.map(function(d){return Ume(d)?l.shift():d});return n.apply(void 0,rft(u).concat(l))}))})},R_=function(t){return cft(t.length,t)},xL=function(t,n){for(var r=[],a=t;a<n;++a)r[a-t]=a;return r},uft=R_(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),dft=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return lft;var a=n.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(s,l){return l(s)},i.apply(void 0,arguments))}},wL=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},Wme=function(t){var n=null,r=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n&&i.every(function(s,l){return s===n[l]})||(n=i,r=t.apply(void 0,i)),r}};function fft(e){var t;return e===0?t=1:t=Math.floor(new vr(e).abs().log(10).toNumber())+1,t}function pft(e,t,n){for(var r=new vr(e),a=0,i=[];r.lt(t)&&a<1e5;)i.push(r.toNumber()),r=r.add(n),a++;return i}var hft=R_(function(e,t,n){var r=+e,a=+t;return r+n*(a-r)}),gft=R_(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),mft=R_(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const M_={rangeStep:pft,getDigitCount:fft,interpolateNumber:hft,uninterpolateNumber:gft,uninterpolateTruncation:mft};function CL(e){return yft(e)||bft(e)||qme(e)||vft()}function vft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
654
654
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bft(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function yft(e){if(Array.isArray(e))return EL(e)}function iy(e,t){return wft(e)||xft(e,t)||qme(e,t)||Sft()}function Sft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
655
655
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qme(e,t){if(e){if(typeof e=="string")return EL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return EL(e,t)}}function EL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xft(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(l){a=!0,i=l}finally{try{!r&&o.return!=null&&o.return()}finally{if(a)throw i}}return n}}function wft(e){if(Array.isArray(e))return e}function Vme(e){var t=iy(e,2),n=t[0],r=t[1],a=n,i=r;return n>r&&(a=r,i=n),[a,i]}function Gme(e,t,n){if(e.lte(0))return new vr(0);var r=M_.getDigitCount(e.toNumber()),a=new vr(10).pow(r),i=e.div(a),o=r!==1?.05:.1,s=new vr(Math.ceil(i.div(o).toNumber())).add(n).mul(o),l=s.mul(a);return t?l:new vr(Math.ceil(l))}function Cft(e,t,n){var r=1,a=new vr(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(r=new vr(10).pow(M_.getDigitCount(e)-1),a=new vr(Math.floor(a.div(r).toNumber())).mul(r)):i>1&&(a=new vr(Math.floor(e)))}else e===0?a=new vr(Math.floor((t-1)/2)):n||(a=new vr(Math.floor(e)));var o=Math.floor((t-1)/2),s=dft(uft(function(l){return a.add(new vr(l-o).mul(r)).toNumber()}),xL);return s(0,t)}function Kme(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new vr(0),tickMin:new vr(0),tickMax:new vr(0)};var i=Gme(new vr(t).sub(e).div(n-1),r,a),o;e<=0&&t>=0?o=new vr(0):(o=new vr(e).add(t).div(2),o=o.sub(new vr(o).mod(i)));var s=Math.ceil(o.sub(e).div(i).toNumber()),l=Math.ceil(new vr(t).sub(o).div(i).toNumber()),c=s+l+1;return c>n?Kme(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:i,tickMin:o.sub(new vr(s).mul(i)),tickMax:o.add(new vr(l).mul(i))})}function Eft(e){var t=iy(e,2),n=t[0],r=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),s=Vme([n,r]),l=iy(s,2),c=l[0],u=l[1];if(c===-1/0||u===1/0){var d=u===1/0?[c].concat(CL(xL(0,a-1).map(function(){return 1/0}))):[].concat(CL(xL(0,a-1).map(function(){return-1/0})),[u]);return n>r?wL(d):d}if(c===u)return Cft(c,a,i);var f=Kme(c,u,o,i),h=f.step,g=f.tickMin,m=f.tickMax,v=M_.rangeStep(g,m.add(new vr(.1).mul(h)),h);return n>r?wL(v):v}function _ft(e,t){var n=iy(e,2),r=n[0],a=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Vme([r,a]),s=iy(o,2),l=s[0],c=s[1];if(l===-1/0||c===1/0)return[r,a];if(l===c)return[l];var u=Math.max(t,2),d=Gme(new vr(c).sub(l).div(u-1),i,0),f=[].concat(CL(M_.rangeStep(new vr(l),new vr(c).sub(new vr(.99).mul(d)),d)),[c]);return r>a?wL(f):f}var Tft=Wme(Eft),kft=Wme(_ft),Oft="Invariant failed";function Bd(e,t){throw new Error(Oft)}var $ft=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ch(e){"@babel/helpers - typeof";return ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ch(e)}function SC(){return SC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SC.apply(this,arguments)}function Ift(e,t){return Pft(e)||Mft(e,t)||Rft(e,t)||Aft()}function Aft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -705,8 +705,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
705
705
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hbe(e,t){if(e){if(typeof e=="string")return fD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fD(e,t)}}function TSt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kSt(e){if(Array.isArray(e))return fD(e)}function fD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function We(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yee(Object(n),!0).forEach(function(r){dn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yee(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dn(e,t,n){return t=gbe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gbe(e){var t=OSt(e,"string");return Eh(t)=="symbol"?t:t+""}function OSt(e,t){if(Eh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Eh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $St={xAxis:["bottom","top"],yAxis:["left","right"]},ISt={width:"100%",height:"100%"},mbe={x:0,y:0};function WS(e){return e}var ASt=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},RSt=function(t,n,r,a){var i=n.find(function(u){return u&&u.index===r});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,s=a.radius;return We(We(We({},a),Tr(a.cx,a.cy,s,o)),{},{angle:o,radius:s})}var l=i.coordinate,c=a.angle;return We(We(We({},a),Tr(a.cx,a.cy,l,c)),{},{angle:c,radius:l})}return mbe},G_=function(t,n){var r=n.graphicalItems,a=n.dataStartIndex,i=n.dataEndIndex,o=(r??[]).reduce(function(s,l){var c=l.props.data;return c&&c.length?[].concat(_h(s),_h(c)):s},[]);return o.length>0?o:t&&t.length&&St(a)&&St(i)?t.slice(a,i+1):[]};function vbe(e){return e==="number"?[0,"auto"]:void 0}var pD=function(t,n,r,a){var i=t.graphicalItems,o=t.tooltipAxis,s=G_(n,t);return r<0||!i||!i.length||r>=s.length?null:i.reduce(function(l,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:n;d&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(d=d.slice(t.dataStartIndex,t.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var h=d===void 0?s:d;f=Qw(h,o.dataKey,a)}else f=d&&d[r]||s[r];return f?[].concat(_h(l),[sve(c,f)]):l},[])},Xee=function(t,n,r,a){var i=a||{x:t.chartX,y:t.chartY},o=ASt(i,r),s=t.orderedTooltipTicks,l=t.tooltipAxis,c=t.tooltipTicks,u=ept(o,s,c,l);if(u>=0&&c){var d=c[u]&&c[u].value,f=pD(t,n,u,d),h=RSt(r,s,u,i);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:h}}return null},MSt=function(t,n){var r=n.axes,a=n.graphicalItems,i=n.axisType,o=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,c=n.dataEndIndex,u=t.layout,d=t.children,f=t.stackOffset,h=tve(u,i);return r.reduce(function(g,m){var v,b=m.type.defaultProps!==void 0?We(We({},m.type.defaultProps),m.props):m.props,y=b.type,S=b.dataKey,C=b.allowDataOverflow,x=b.allowDuplicatedCategory,w=b.scale,_=b.ticks,T=b.includeHidden,k=b[o];if(g[k])return g;var O=G_(t.data,{graphicalItems:a.filter(function(F){var B,z=o in F.props?F.props[o]:(B=F.type.defaultProps)===null||B===void 0?void 0:B[o];return z===k}),dataStartIndex:l,dataEndIndex:c}),I=O.length,M,$,R;iSt(b.domain,C,y)&&(M=kL(b.domain,null,C),h&&(y==="number"||w!=="auto")&&(R=ib(O,S,"category")));var A=vbe(y);if(!M||M.length===0){var P,N=(P=b.domain)!==null&&P!==void 0?P:A;if(S){if(M=ib(O,S,y),y==="category"&&h){var L=Qat(M);x&&L?($=M,M=LC(0,I)):x||(M=QQ(N,M,m).reduce(function(F,B){return F.indexOf(B)>=0?F:[].concat(_h(F),[B])},[]))}else if(y==="category")x?M=M.filter(function(F){return F!==""&&!Pn(F)}):M=QQ(N,M,m).reduce(function(F,B){return F.indexOf(B)>=0||B===""||Pn(B)?F:[].concat(_h(F),[B])},[]);else if(y==="number"){var j=ipt(O,a.filter(function(F){var B,z,G=o in F.props?F.props[o]:(B=F.type.defaultProps)===null||B===void 0?void 0:B[o],X="hide"in F.props?F.props.hide:(z=F.type.defaultProps)===null||z===void 0?void 0:z.hide;return G===k&&(T||!X)}),S,i,u);j&&(M=j)}h&&(y==="number"||w!=="auto")&&(R=ib(O,S,"category"))}else h?M=LC(0,I):s&&s[k]&&s[k].hasStack&&y==="number"?M=f==="expand"?[0,1]:ove(s[k].stackGroups,l,c):M=eve(O,a.filter(function(F){var B=o in F.props?F.props[o]:F.type.defaultProps[o],z="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return B===k&&(T||!z)}),y,u,!0);if(y==="number")M=uD(d,M,k,i,_),N&&(M=kL(N,M,C));else if(y==="category"&&N){var D=N,H=M.every(function(F){return D.indexOf(F)>=0});H&&(M=D)}}return We(We({},g),{},dn({},k,We(We({},b),{},{axisType:i,domain:M,categoricalDomain:R,duplicateDomain:$,originalDomain:(v=b.domain)!==null&&v!==void 0?v:A,isCategorical:h,layout:u})))},{})},PSt=function(t,n){var r=n.graphicalItems,a=n.Axis,i=n.axisType,o=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,c=n.dataEndIndex,u=t.layout,d=t.children,f=G_(t.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:c}),h=f.length,g=tve(u,i),m=-1;return r.reduce(function(v,b){var y=b.type.defaultProps!==void 0?We(We({},b.type.defaultProps),b.props):b.props,S=y[o],C=vbe("number");if(!v[S]){m++;var x;return g?x=LC(0,h):s&&s[S]&&s[S].hasStack?(x=ove(s[S].stackGroups,l,c),x=uD(d,x,S,i)):(x=kL(C,eve(f,r.filter(function(w){var _,T,k=o in w.props?w.props[o]:(_=w.type.defaultProps)===null||_===void 0?void 0:_[o],O="hide"in w.props?w.props.hide:(T=w.type.defaultProps)===null||T===void 0?void 0:T.hide;return k===S&&!O}),"number",u),a.defaultProps.allowDataOverflow),x=uD(d,x,S,i)),We(We({},v),{},dn({},S,We(We({axisType:i},a.defaultProps),{},{hide:!0,orientation:go($St,"".concat(i,".").concat(m%2),null),domain:x,originalDomain:C,isCategorical:g,layout:u})))}return v},{})},NSt=function(t,n){var r=n.axisType,a=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,s=n.stackGroups,l=n.dataStartIndex,c=n.dataEndIndex,u=t.children,d="".concat(a,"Id"),f=mo(u,i),h={};return f&&f.length?h=MSt(t,{axes:f,graphicalItems:o,axisType:a,axisIdKey:d,stackGroups:s,dataStartIndex:l,dataEndIndex:c}):o&&o.length&&(h=PSt(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:d,stackGroups:s,dataStartIndex:l,dataEndIndex:c})),h},LSt=function(t){var n=Mc(t),r=Fl(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:P5(r,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:wC(n,r)}},Zee=function(t){var n=t.children,r=t.defaultShowTooltip,a=so(n,gh),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},DSt=function(t){return!t||!t.length?!1:t.some(function(n){var r=Ul(n&&n.type);return r&&r.indexOf("Bar")>=0})},Qee=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},jSt=function(t,n){var r=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,s=t.yAxisMap,l=s===void 0?{}:s,c=r.width,u=r.height,d=r.children,f=r.margin||{},h=so(d,gh),g=so(d,Wc),m=Object.keys(l).reduce(function(x,w){var _=l[w],T=_.orientation;return!_.mirror&&!_.hide?We(We({},x),{},dn({},T,x[T]+_.width)):x},{left:f.left||0,right:f.right||0}),v=Object.keys(o).reduce(function(x,w){var _=o[w],T=_.orientation;return!_.mirror&&!_.hide?We(We({},x),{},dn({},T,go(x,"".concat(T))+_.height)):x},{top:f.top||0,bottom:f.bottom||0}),b=We(We({},v),m),y=b.bottom;h&&(b.bottom+=h.props.height||gh.defaultProps.height),g&&n&&(b=rpt(b,a,r,n));var S=c-b.left-b.right,C=u-b.top-b.bottom;return We(We({brushBottom:y},b),{},{width:Math.max(S,0),height:Math.max(C,0)})},BSt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},mH=function(t){var n=t.chartName,r=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,s=o===void 0?["axis"]:o,l=t.axisComponents,c=t.legendContent,u=t.formatAxisMap,d=t.defaultProps,f=function(b,y){var S=y.graphicalItems,C=y.stackGroups,x=y.offset,w=y.updateId,_=y.dataStartIndex,T=y.dataEndIndex,k=b.barSize,O=b.layout,I=b.barGap,M=b.barCategoryGap,$=b.maxBarSize,R=Qee(O),A=R.numericAxisName,P=R.cateAxisName,N=DSt(S),L=[];return S.forEach(function(j,D){var H=G_(b.data,{graphicalItems:[j],dataStartIndex:_,dataEndIndex:T}),F=j.type.defaultProps!==void 0?We(We({},j.type.defaultProps),j.props):j.props,B=F.dataKey,z=F.maxBarSize,G=F["".concat(A,"Id")],X=F["".concat(P,"Id")],Z={},q=l.reduce(function(fe,he){var ve=y["".concat(he.axisType,"Map")],we=F["".concat(he.axisType,"Id")];ve&&ve[we]||he.axisType==="zAxis"||Bd();var Re=ve[we];return We(We({},fe),{},dn(dn({},he.axisType,Re),"".concat(he.axisType,"Ticks"),Fl(Re)))},Z),Y=q[P],te=q["".concat(P,"Ticks")],ee=C&&C[G]&&C[G].hasStack&&hpt(j,C[G].stackGroups),Q=Ul(j.type).indexOf("Bar")>=0,ae=wC(Y,te),oe=[],re=N&&tpt({barSize:k,stackGroups:C,totalSize:BSt(q,P)});if(Q){var ie,ue,ge=Pn(z)?$:z,Te=(ie=(ue=wC(Y,te,!0))!==null&&ue!==void 0?ue:ge)!==null&&ie!==void 0?ie:0;oe=npt({barGap:I,barCategoryGap:M,bandSize:Te!==ae?Te:ae,sizeList:re[X],maxBarSize:ge}),Te!==ae&&(oe=oe.map(function(fe){return We(We({},fe),{},{position:We(We({},fe.position),{},{offset:fe.position.offset-Te/2})})}))}var Se=j&&j.type&&j.type.getComposedData;Se&&L.push({props:We(We({},Se(We(We({},q),{},{displayedData:H,props:b,dataKey:B,item:j,bandSize:ae,barPosition:oe,offset:x,stackedData:ee,layout:O,dataStartIndex:_,dataEndIndex:T}))),{},dn(dn(dn({key:j.key||"item-".concat(D)},A,q[A]),P,q[P]),"animationId",w)),childIndex:dit(j,b.children),item:j})}),L},h=function(b,y){var S=b.props,C=b.dataStartIndex,x=b.dataEndIndex,w=b.updateId;if(!uY({props:S}))return null;var _=S.children,T=S.layout,k=S.stackOffset,O=S.data,I=S.reverseStackOrder,M=Qee(T),$=M.numericAxisName,R=M.cateAxisName,A=mo(_,r),P=fpt(O,A,"".concat($,"Id"),"".concat(R,"Id"),k,I),N=l.reduce(function(F,B){var z="".concat(B.axisType,"Map");return We(We({},F),{},dn({},z,NSt(S,We(We({},B),{},{graphicalItems:A,stackGroups:B.axisType===$&&P,dataStartIndex:C,dataEndIndex:x}))))},{}),L=jSt(We(We({},N),{},{props:S,graphicalItems:A}),y==null?void 0:y.legendBBox);Object.keys(N).forEach(function(F){N[F]=u(S,N[F],L,F.replace("Map",""),n)});var j=N["".concat(R,"Map")],D=LSt(j),H=f(S,We(We({},N),{},{dataStartIndex:C,dataEndIndex:x,updateId:w,graphicalItems:A,stackGroups:P,offset:L}));return We(We({formattedGraphicalItems:H,graphicalItems:A,offset:L,stackGroups:P},D),N)},g=function(v){function b(y){var S,C,x;return bSt(this,b),x=xSt(this,b,[y]),dn(x,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),dn(x,"accessibilityManager",new aSt),dn(x,"handleLegendBBoxUpdate",function(w){if(w){var _=x.state,T=_.dataStartIndex,k=_.dataEndIndex,O=_.updateId;x.setState(We({legendBBox:w},h({props:x.props,dataStartIndex:T,dataEndIndex:k,updateId:O},We(We({},x.state),{},{legendBBox:w}))))}}),dn(x,"handleReceiveSyncEvent",function(w,_,T){if(x.props.syncId===w){if(T===x.eventEmitterSymbol&&typeof x.props.syncMethod!="function")return;x.applySyncEvent(_)}}),dn(x,"handleBrushChange",function(w){var _=w.startIndex,T=w.endIndex;if(_!==x.state.dataStartIndex||T!==x.state.dataEndIndex){var k=x.state.updateId;x.setState(function(){return We({dataStartIndex:_,dataEndIndex:T},h({props:x.props,dataStartIndex:_,dataEndIndex:T,updateId:k},x.state))}),x.triggerSyncEvent({dataStartIndex:_,dataEndIndex:T})}}),dn(x,"handleMouseEnter",function(w){var _=x.getMouseInfo(w);if(_){var T=We(We({},_),{},{isTooltipActive:!0});x.setState(T),x.triggerSyncEvent(T);var k=x.props.onMouseEnter;On(k)&&k(T,w)}}),dn(x,"triggeredAfterMouseMove",function(w){var _=x.getMouseInfo(w),T=_?We(We({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};x.setState(T),x.triggerSyncEvent(T);var k=x.props.onMouseMove;On(k)&&k(T,w)}),dn(x,"handleItemMouseEnter",function(w){x.setState(function(){return{isTooltipActive:!0,activeItem:w,activePayload:w.tooltipPayload,activeCoordinate:w.tooltipPosition||{x:w.cx,y:w.cy}}})}),dn(x,"handleItemMouseLeave",function(){x.setState(function(){return{isTooltipActive:!1}})}),dn(x,"handleMouseMove",function(w){w.persist(),x.throttleTriggeredAfterMouseMove(w)}),dn(x,"handleMouseLeave",function(w){x.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};x.setState(_),x.triggerSyncEvent(_);var T=x.props.onMouseLeave;On(T)&&T(_,w)}),dn(x,"handleOuterEvent",function(w){var _=uit(w),T=go(x.props,"".concat(_));if(_&&On(T)){var k,O;/.*touch.*/i.test(_)?O=x.getMouseInfo(w.changedTouches[0]):O=x.getMouseInfo(w),T((k=O)!==null&&k!==void 0?k:{},w)}}),dn(x,"handleClick",function(w){var _=x.getMouseInfo(w);if(_){var T=We(We({},_),{},{isTooltipActive:!0});x.setState(T),x.triggerSyncEvent(T);var k=x.props.onClick;On(k)&&k(T,w)}}),dn(x,"handleMouseDown",function(w){var _=x.props.onMouseDown;if(On(_)){var T=x.getMouseInfo(w);_(T,w)}}),dn(x,"handleMouseUp",function(w){var _=x.props.onMouseUp;if(On(_)){var T=x.getMouseInfo(w);_(T,w)}}),dn(x,"handleTouchMove",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&x.throttleTriggeredAfterMouseMove(w.changedTouches[0])}),dn(x,"handleTouchStart",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&x.handleMouseDown(w.changedTouches[0])}),dn(x,"handleTouchEnd",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&x.handleMouseUp(w.changedTouches[0])}),dn(x,"handleDoubleClick",function(w){var _=x.props.onDoubleClick;if(On(_)){var T=x.getMouseInfo(w);_(T,w)}}),dn(x,"handleContextMenu",function(w){var _=x.props.onContextMenu;if(On(_)){var T=x.getMouseInfo(w);_(T,w)}}),dn(x,"triggerSyncEvent",function(w){x.props.syncId!==void 0&&OR.emit($R,x.props.syncId,w,x.eventEmitterSymbol)}),dn(x,"applySyncEvent",function(w){var _=x.props,T=_.layout,k=_.syncMethod,O=x.state.updateId,I=w.dataStartIndex,M=w.dataEndIndex;if(w.dataStartIndex!==void 0||w.dataEndIndex!==void 0)x.setState(We({dataStartIndex:I,dataEndIndex:M},h({props:x.props,dataStartIndex:I,dataEndIndex:M,updateId:O},x.state)));else if(w.activeTooltipIndex!==void 0){var $=w.chartX,R=w.chartY,A=w.activeTooltipIndex,P=x.state,N=P.offset,L=P.tooltipTicks;if(!N)return;if(typeof k=="function")A=k(L,w);else if(k==="value"){A=-1;for(var j=0;j<L.length;j++)if(L[j].value===w.activeLabel){A=j;break}}var D=We(We({},N),{},{x:N.left,y:N.top}),H=Math.min($,D.x+D.width),F=Math.min(R,D.y+D.height),B=L[A]&&L[A].value,z=pD(x.state,x.props.data,A),G=L[A]?{x:T==="horizontal"?L[A].coordinate:H,y:T==="horizontal"?F:L[A].coordinate}:mbe;x.setState(We(We({},w),{},{activeLabel:B,activeCoordinate:G,activePayload:z,activeTooltipIndex:A}))}else x.setState(w)}),dn(x,"renderCursor",function(w){var _,T=x.state,k=T.isTooltipActive,O=T.activeCoordinate,I=T.activePayload,M=T.offset,$=T.activeTooltipIndex,R=T.tooltipAxisBandSize,A=x.getTooltipEventType(),P=(_=w.props.active)!==null&&_!==void 0?_:k,N=x.props.layout,L=w.key||"_recharts-cursor";return U.createElement(dSt,{key:L,activeCoordinate:O,activePayload:I,activeTooltipIndex:$,chartName:n,element:w,isActive:P,layout:N,offset:M,tooltipAxisBandSize:R,tooltipEventType:A})}),dn(x,"renderPolarAxis",function(w,_,T){var k=go(w,"type.axisType"),O=go(x.state,"".concat(k,"Map")),I=w.type.defaultProps,M=I!==void 0?We(We({},I),w.props):w.props,$=O&&O[M["".concat(k,"Id")]];return p.cloneElement(w,We(We({},$),{},{className:Fn(k,$.className),key:w.key||"".concat(_,"-").concat(T),ticks:Fl($,!0)}))}),dn(x,"renderPolarGrid",function(w){var _=w.props,T=_.radialLines,k=_.polarAngles,O=_.polarRadius,I=x.state,M=I.radiusAxisMap,$=I.angleAxisMap,R=Mc(M),A=Mc($),P=A.cx,N=A.cy,L=A.innerRadius,j=A.outerRadius;return p.cloneElement(w,{polarAngles:Array.isArray(k)?k:Fl(A,!0).map(function(D){return D.coordinate}),polarRadius:Array.isArray(O)?O:Fl(R,!0).map(function(D){return D.coordinate}),cx:P,cy:N,innerRadius:L,outerRadius:j,key:w.key||"polar-grid",radialLines:T})}),dn(x,"renderLegend",function(){var w=x.state.formattedGraphicalItems,_=x.props,T=_.children,k=_.width,O=_.height,I=x.props.margin||{},M=k-(I.left||0)-(I.right||0),$=Qme({children:T,formattedGraphicalItems:w,legendWidth:M,legendContent:c});if(!$)return null;var R=$.item,A=Kee($,fSt);return p.cloneElement(R,We(We({},A),{},{chartWidth:k,chartHeight:O,margin:I,onBBoxUpdate:x.handleLegendBBoxUpdate}))}),dn(x,"renderTooltip",function(){var w,_=x.props,T=_.children,k=_.accessibilityLayer,O=so(T,co);if(!O)return null;var I=x.state,M=I.isTooltipActive,$=I.activeCoordinate,R=I.activePayload,A=I.activeLabel,P=I.offset,N=(w=O.props.active)!==null&&w!==void 0?w:M;return p.cloneElement(O,{viewBox:We(We({},P),{},{x:P.left,y:P.top}),active:N,label:A,payload:N?R:[],coordinate:$,accessibilityLayer:k})}),dn(x,"renderBrush",function(w){var _=x.props,T=_.margin,k=_.data,O=x.state,I=O.offset,M=O.dataStartIndex,$=O.dataEndIndex,R=O.updateId;return p.cloneElement(w,{key:w.key||"_recharts-brush",onChange:BS(x.handleBrushChange,w.props.onChange),data:k,x:St(w.props.x)?w.props.x:I.left,y:St(w.props.y)?w.props.y:I.top+I.height+I.brushBottom-(T.bottom||0),width:St(w.props.width)?w.props.width:I.width,startIndex:M,endIndex:$,updateId:"brush-".concat(R)})}),dn(x,"renderReferenceElement",function(w,_,T){if(!w)return null;var k=x,O=k.clipPathId,I=x.state,M=I.xAxisMap,$=I.yAxisMap,R=I.offset,A=w.type.defaultProps||{},P=w.props,N=P.xAxisId,L=N===void 0?A.xAxisId:N,j=P.yAxisId,D=j===void 0?A.yAxisId:j;return p.cloneElement(w,{key:w.key||"".concat(_,"-").concat(T),xAxis:M[L],yAxis:$[D],viewBox:{x:R.left,y:R.top,width:R.width,height:R.height},clipPathId:O})}),dn(x,"renderActivePoints",function(w){var _=w.item,T=w.activePoint,k=w.basePoint,O=w.childIndex,I=w.isRange,M=[],$=_.props.key,R=_.item.type.defaultProps!==void 0?We(We({},_.item.type.defaultProps),_.item.props):_.item.props,A=R.activeDot,P=R.dataKey,N=We(We({index:O,dataKey:P,cx:T.x,cy:T.y,r:4,fill:iH(_.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},ln(A,!1)),Jw(A));return M.push(b.renderActiveDot(A,N,"".concat($,"-activePoint-").concat(O))),k?M.push(b.renderActiveDot(A,We(We({},N),{},{cx:k.x,cy:k.y}),"".concat($,"-basePoint-").concat(O))):I&&M.push(null),M}),dn(x,"renderGraphicChild",function(w,_,T){var k=x.filterFormatItem(w,_,T);if(!k)return null;var O=x.getTooltipEventType(),I=x.state,M=I.isTooltipActive,$=I.tooltipAxis,R=I.activeTooltipIndex,A=I.activeLabel,P=x.props.children,N=so(P,co),L=k.props,j=L.points,D=L.isRange,H=L.baseLine,F=k.item.type.defaultProps!==void 0?We(We({},k.item.type.defaultProps),k.item.props):k.item.props,B=F.activeDot,z=F.hide,G=F.activeBar,X=F.activeShape,Z=!!(!z&&M&&N&&(B||G||X)),q={};O!=="axis"&&N&&N.props.trigger==="click"?q={onClick:BS(x.handleItemMouseEnter,w.props.onClick)}:O!=="axis"&&(q={onMouseLeave:BS(x.handleItemMouseLeave,w.props.onMouseLeave),onMouseEnter:BS(x.handleItemMouseEnter,w.props.onMouseEnter)});var Y=p.cloneElement(w,We(We({},k.props),q));function te(he){return typeof $.dataKey=="function"?$.dataKey(he.payload):null}if(Z)if(R>=0){var ee,Q;if($.dataKey&&!$.allowDuplicatedCategory){var ae=typeof $.dataKey=="function"?te:"payload.".concat($.dataKey.toString());ee=Qw(j,ae,A),Q=D&&H&&Qw(H,ae,A)}else ee=j==null?void 0:j[R],Q=D&&H&&H[R];if(X||G){var oe=w.props.activeIndex!==void 0?w.props.activeIndex:R;return[p.cloneElement(w,We(We(We({},k.props),q),{},{activeIndex:oe})),null,null]}if(!Pn(ee))return[Y].concat(_h(x.renderActivePoints({item:k,activePoint:ee,basePoint:Q,childIndex:R,isRange:D})))}else{var re,ie=(re=x.getItemByXY(x.state.activeCoordinate))!==null&&re!==void 0?re:{graphicalItem:Y},ue=ie.graphicalItem,ge=ue.item,Te=ge===void 0?w:ge,Se=ue.childIndex,fe=We(We(We({},k.props),q),{},{activeIndex:Se});return[p.cloneElement(Te,fe),null,null]}return D?[Y,null,null]:[Y,null]}),dn(x,"renderCustomized",function(w,_,T){return p.cloneElement(w,We(We({key:"recharts-customized-".concat(T)},x.props),x.state))}),dn(x,"renderMap",{CartesianGrid:{handler:WS,once:!0},ReferenceArea:{handler:x.renderReferenceElement},ReferenceLine:{handler:WS},ReferenceDot:{handler:x.renderReferenceElement},XAxis:{handler:WS},YAxis:{handler:WS},Brush:{handler:x.renderBrush,once:!0},Bar:{handler:x.renderGraphicChild},Line:{handler:x.renderGraphicChild},Area:{handler:x.renderGraphicChild},Radar:{handler:x.renderGraphicChild},RadialBar:{handler:x.renderGraphicChild},Scatter:{handler:x.renderGraphicChild},Pie:{handler:x.renderGraphicChild},Funnel:{handler:x.renderGraphicChild},Tooltip:{handler:x.renderCursor,once:!0},PolarGrid:{handler:x.renderPolarGrid,once:!0},PolarAngleAxis:{handler:x.renderPolarAxis},PolarRadiusAxis:{handler:x.renderPolarAxis},Customized:{handler:x.renderCustomized}}),x.clipPathId="".concat((S=y.id)!==null&&S!==void 0?S:mg("recharts"),"-clip"),x.throttleTriggeredAfterMouseMove=Gge(x.triggeredAfterMouseMove,(C=y.throttleDelay)!==null&&C!==void 0?C:1e3/60),x.state={},x}return ESt(b,v),SSt(b,[{key:"componentDidMount",value:function(){var S,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var S=this.props,C=S.children,x=S.data,w=S.height,_=S.layout,T=so(C,co);if(T){var k=T.props.defaultIndex;if(!(typeof k!="number"||k<0||k>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[k]&&this.state.tooltipTicks[k].value,I=pD(this.state,x,k,O),M=this.state.tooltipTicks[k].coordinate,$=(this.state.offset.top+w)/2,R=_==="horizontal",A=R?{x:M,y:$}:{y:M,x:$},P=this.state.formattedGraphicalItems.find(function(L){var j=L.item;return j.type.name==="Scatter"});P&&(A=We(We({},A),P.props.points[k].tooltipPosition),I=P.props.points[k].tooltipPayload);var N={activeTooltipIndex:k,isTooltipActive:!0,activeLabel:O,activePayload:I,activeCoordinate:A};this.setState(N),this.renderCursor(T),this.accessibilityManager.setIndex(k)}}}},{key:"getSnapshotBeforeUpdate",value:function(S,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==S.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==S.margin){var x,w;this.accessibilityManager.setDetails({offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0}})}return null}},{key:"componentDidUpdate",value:function(S){KN([so(S.children,co)],[so(this.props.children,co)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var S=so(this.props.children,co);if(S&&typeof S.props.shared=="boolean"){var C=S.props.shared?"axis":"item";return s.indexOf(C)>=0?C:i}return i}},{key:"getMouseInfo",value:function(S){if(!this.container)return null;var C=this.container,x=C.getBoundingClientRect(),w=Wlt(x),_={chartX:Math.round(S.pageX-w.left),chartY:Math.round(S.pageY-w.top)},T=x.width/C.offsetWidth||1,k=this.inRange(_.chartX,_.chartY,T);if(!k)return null;var O=this.state,I=O.xAxisMap,M=O.yAxisMap,$=this.getTooltipEventType(),R=Xee(this.state,this.props.data,this.props.layout,k);if($!=="axis"&&I&&M){var A=Mc(I).scale,P=Mc(M).scale,N=A&&A.invert?A.invert(_.chartX):null,L=P&&P.invert?P.invert(_.chartY):null;return We(We({},_),{},{xValue:N,yValue:L},R)}return R?We(We({},_),R):null}},{key:"inRange",value:function(S,C){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,w=this.props.layout,_=S/x,T=C/x;if(w==="horizontal"||w==="vertical"){var k=this.state.offset,O=_>=k.left&&_<=k.left+k.width&&T>=k.top&&T<=k.top+k.height;return O?{x:_,y:T}:null}var I=this.state,M=I.angleAxisMap,$=I.radiusAxisMap;if(M&&$){var R=Mc(M);return tJ({x:_,y:T},R)}return null}},{key:"parseEventsOfWrapper",value:function(){var S=this.props.children,C=this.getTooltipEventType(),x=so(S,co),w={};x&&C==="axis"&&(x.props.trigger==="click"?w={onClick:this.handleClick}:w={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Jw(this.props,this.handleOuterEvent);return We(We({},_),w)}},{key:"addListener",value:function(){OR.on($R,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){OR.removeListener($R,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(S,C,x){for(var w=this.state.formattedGraphicalItems,_=0,T=w.length;_<T;_++){var k=w[_];if(k.item===S||k.props.key===S.key||C===Ul(k.item.type)&&x===k.childIndex)return k}return null}},{key:"renderClipPath",value:function(){var S=this.clipPathId,C=this.state.offset,x=C.left,w=C.top,_=C.height,T=C.width;return U.createElement("defs",null,U.createElement("clipPath",{id:S},U.createElement("rect",{x,y:w,height:_,width:T})))}},{key:"getXScales",value:function(){var S=this.state.xAxisMap;return S?Object.entries(S).reduce(function(C,x){var w=Gee(x,2),_=w[0],T=w[1];return We(We({},C),{},dn({},_,T.scale))},{}):null}},{key:"getYScales",value:function(){var S=this.state.yAxisMap;return S?Object.entries(S).reduce(function(C,x){var w=Gee(x,2),_=w[0],T=w[1];return We(We({},C),{},dn({},_,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(S){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[S])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(S){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[S])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(S){var C=this.state,x=C.formattedGraphicalItems,w=C.activeItem;if(x&&x.length)for(var _=0,T=x.length;_<T;_++){var k=x[_],O=k.props,I=k.item,M=I.type.defaultProps!==void 0?We(We({},I.type.defaultProps),I.props):I.props,$=Ul(I.type);if($==="Bar"){var R=(O.data||[]).find(function(L){return pmt(S,L)});if(R)return{graphicalItem:k,payload:R}}else if($==="RadialBar"){var A=(O.data||[]).find(function(L){return tJ(S,L)});if(A)return{graphicalItem:k,payload:A}}else if(B_(k,w)||F_(k,w)||Sy(k,w)){var P=Lvt({graphicalItem:k,activeTooltipItem:w,itemData:M.data}),N=M.activeIndex===void 0?P:M.activeIndex;return{graphicalItem:We(We({},k),{},{childIndex:N}),payload:Sy(k,w)?M.data[P]:k.props.data[P]}}}return null}},{key:"render",value:function(){var S=this;if(!uY(this))return null;var C=this.props,x=C.children,w=C.className,_=C.width,T=C.height,k=C.style,O=C.compact,I=C.title,M=C.desc,$=Kee(C,pSt),R=ln($,!1);if(O)return U.createElement(Oee,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},U.createElement(XN,mp({},R,{width:_,height:T,title:I,desc:M}),this.renderClipPath(),fY(x,this.renderMap)));if(this.props.accessibilityLayer){var A,P;R.tabIndex=(A=this.props.tabIndex)!==null&&A!==void 0?A:0,R.role=(P=this.props.role)!==null&&P!==void 0?P:"application",R.onKeyDown=function(L){S.accessibilityManager.keyboardEvent(L)},R.onFocus=function(){S.accessibilityManager.focus()}}var N=this.parseEventsOfWrapper();return U.createElement(Oee,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},U.createElement("div",mp({className:Fn("recharts-wrapper",w),style:We({position:"relative",cursor:"default",width:_,height:T},k)},N,{ref:function(j){S.container=j}}),U.createElement(XN,mp({},R,{width:_,height:T,title:I,desc:M,style:ISt}),this.renderClipPath(),fY(x,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(p.Component);dn(g,"displayName",n),dn(g,"defaultProps",We({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},d)),dn(g,"getDerivedStateFromProps",function(v,b){var y=v.dataKey,S=v.data,C=v.children,x=v.width,w=v.height,_=v.layout,T=v.stackOffset,k=v.margin,O=b.dataStartIndex,I=b.dataEndIndex;if(b.updateId===void 0){var M=Zee(v);return We(We(We({},M),{},{updateId:0},h(We(We({props:v},M),{},{updateId:0}),b)),{},{prevDataKey:y,prevData:S,prevWidth:x,prevHeight:w,prevLayout:_,prevStackOffset:T,prevMargin:k,prevChildren:C})}if(y!==b.prevDataKey||S!==b.prevData||x!==b.prevWidth||w!==b.prevHeight||_!==b.prevLayout||T!==b.prevStackOffset||!kp(k,b.prevMargin)){var $=Zee(v),R={chartX:b.chartX,chartY:b.chartY,isTooltipActive:b.isTooltipActive},A=We(We({},Xee(b,S,_)),{},{updateId:b.updateId+1}),P=We(We(We({},$),R),A);return We(We(We({},P),h(We({props:v},P),b)),{},{prevDataKey:y,prevData:S,prevWidth:x,prevHeight:w,prevLayout:_,prevStackOffset:T,prevMargin:k,prevChildren:C})}if(!KN(C,b.prevChildren)){var N,L,j,D,H=so(C,gh),F=H&&(N=(L=H.props)===null||L===void 0?void 0:L.startIndex)!==null&&N!==void 0?N:O,B=H&&(j=(D=H.props)===null||D===void 0?void 0:D.endIndex)!==null&&j!==void 0?j:I,z=F!==O||B!==I,G=!Pn(S),X=G&&!z?b.updateId:b.updateId+1;return We(We({updateId:X},h(We(We({props:v},b),{},{updateId:X,dataStartIndex:F,dataEndIndex:B}),b)),{},{prevChildren:C,dataStartIndex:F,dataEndIndex:B})}return null}),dn(g,"renderActiveDot",function(v,b,y){var S;return p.isValidElement(v)?S=p.cloneElement(v,b):On(v)?S=v(b):S=U.createElement(P_,b),U.createElement(ar,{className:"recharts-active-dot",key:y},S)});var m=p.forwardRef(function(b,y){return U.createElement(g,mp({},b,{ref:y}))});return m.displayName=g.displayName,m},FSt=mH({chartName:"LineChart",GraphicalChild:vd,axisComponents:[{axisType:"xAxis",AxisComp:bf},{axisType:"yAxis",AxisComp:yf}],formatAxisMap:Dve}),bbe=mH({chartName:"BarChart",GraphicalChild:tc,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:bf},{axisType:"yAxis",AxisComp:yf}],formatAxisMap:Dve}),zSt=mH({chartName:"PieChart",GraphicalChild:dc,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:j_},{axisType:"radiusAxis",AxisComp:L_}],formatAxisMap:Ept,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Tl=e=>{const t=new URLSearchParams;Object.entries(e).forEach(([r,a])=>{a===void 0||a===""||t.set(r,String(a))});const n=t.toString();return n?`?${n}`:""};class HSt{async getSummary(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate});return fn.get(`metrics/summary${n}`)}async getByModel(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate});return fn.get(`metrics/by-model${n}`)}async getSessions(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate,model:t.model,limit:t.limit});return fn.get(`metrics/sessions${n}`)}async getSessionDetail(t){try{return await fn.get(`metrics/sessions/${encodeURIComponent(t)}`)}catch(n){if(n instanceof Error&&n.message.includes("not found"))return null;throw n}}async getDaily(t={}){const n=Tl({days:t.days,end_date:t.endDate,granularity:t.granularity});return fn.get(`metrics/daily${n}`)}async getForwardSummary(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate,endpoint:t.endpoint,model:t.model,limit:t.limit});return fn.get(`metrics/forward/summary${n}`)}async getForwardByEndpoint(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate,endpoint:t.endpoint,model:t.model,limit:t.limit});return fn.get(`metrics/forward/by-endpoint${n}`)}async getForwardRequests(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate,endpoint:t.endpoint,model:t.model,limit:t.limit});return fn.get(`metrics/forward/requests${n}`)}async getUnifiedSummary(t={}){const n=Tl({start_date:t.startDate,end_date:t.endDate});return fn.get(`metrics/v2/summary${n}`)}async getUnifiedTimeline(t={}){const n=Tl({days:t.days,end_date:t.endDate,granularity:t.granularity});return fn.get(`metrics/v2/timeline${n}`)}}const Gx=new HSt,ybe=1,USt=365,Sbe=e=>Number.isFinite(e)?Math.min(USt,Math.max(ybe,Math.floor(e??30))):30,AR=e=>{if(!e)return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),a=Number(t[3]),i=new Date(Date.UTC(n,r-1,a));return i.getUTCFullYear()!==n||i.getUTCMonth()!==r-1||i.getUTCDate()!==a?null:i},lm=e=>e.toISOString().slice(0,10),WSt=(e,t)=>{const n=new Date(e.getTime());return n.setUTCDate(n.getUTCDate()+t),n},qSt=(e,t)=>{const n=t.getTime()-e.getTime(),r=Math.floor(n/864e5)+1;return Sbe(r)},xbe=(e,t=new Date)=>{const n=Sbe(e.days),r=lm(t),a=AR(e.endDate)??AR(r);if(!a)return{startDate:r,endDate:r,days:ybe};const i=AR(e.startDate);if(i){const s=a<i?i:a;return{startDate:lm(i),endDate:lm(s),days:qSt(i,s)}}const o=WSt(a,-(n-1));return{startDate:lm(o),endDate:lm(a),days:n}},VSt=15e3,Jee=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,GSt=(e={})=>{const{filters:t,autoRefreshMs:n=VSt,service:r=Gx}=e,a=p.useMemo(()=>({startDate:t==null?void 0:t.startDate,endDate:t==null?void 0:t.endDate,model:t==null?void 0:t.model,days:(t==null?void 0:t.days)??30,granularity:(t==null?void 0:t.granularity)??"daily",sessionLimit:(t==null?void 0:t.sessionLimit)??200}),[t==null?void 0:t.startDate,t==null?void 0:t.endDate,t==null?void 0:t.model,t==null?void 0:t.days,t==null?void 0:t.granularity,t==null?void 0:t.sessionLimit]),i=p.useMemo(()=>xbe({startDate:a.startDate,endDate:a.endDate,days:a.days}),[a.days,a.endDate,a.startDate]),[o,s]=p.useState(null),[l,c]=p.useState([]),[u,d]=p.useState([]),[f,h]=p.useState([]),[g,m]=p.useState(null),[v,b]=p.useState(!1),[y,S]=p.useState(!1),[C,x]=p.useState(!1),[w,_]=p.useState(null),T=p.useCallback(async M=>{M?S(!0):x(!0);try{const[$,R,A,P]=await Promise.all([r.getSummary({startDate:i.startDate,endDate:i.endDate}),r.getByModel({startDate:i.startDate,endDate:i.endDate}),r.getSessions({startDate:i.startDate,endDate:i.endDate,model:a.model,limit:a.sessionLimit}),r.getDaily({days:i.days,endDate:i.endDate,granularity:a.granularity})]);s($),c(R),d(A),h(P),_(null)}catch($){_(Jee($,"Failed to load metrics"))}finally{M?S(!1):x(!1)}},[a.granularity,a.model,a.sessionLimit,i.days,i.endDate,i.startDate,r]),k=p.useCallback(async()=>{await T(!1)},[T]),O=p.useCallback(async M=>{b(!0);try{const $=await r.getSessionDetail(M);m($)}catch($){_(Jee($,"Failed to load session detail"))}finally{b(!1)}},[r]),I=p.useCallback(()=>{m(null)},[]);return p.useEffect(()=>{T(!0)},[T]),p.useEffect(()=>{if(n<=0)return;const M=window.setInterval(()=>{T(!1)},n);return()=>{window.clearInterval(M)}},[n,T]),{summary:o,modelMetrics:l,sessions:u,timeline:f,sessionDetail:g,isLoading:y,isRefreshing:C,isSessionDetailLoading:v,error:w,refresh:k,loadSessionDetail:O,clearSessionDetail:I}},KSt=15e3,YSt=(e,t)=>e instanceof Error&&e.message.trim()?e.message:t,XSt=(e={})=>{const{filters:t,autoRefreshMs:n=KSt}=e,r=p.useMemo(()=>({startDate:t==null?void 0:t.startDate,endDate:t==null?void 0:t.endDate,days:(t==null?void 0:t.days)??30,endpoint:t==null?void 0:t.endpoint,model:t==null?void 0:t.model,limit:(t==null?void 0:t.limit)??100}),[t==null?void 0:t.startDate,t==null?void 0:t.endDate,t==null?void 0:t.days,t==null?void 0:t.endpoint,t==null?void 0:t.model,t==null?void 0:t.limit]),a=p.useMemo(()=>xbe({startDate:r.startDate,endDate:r.endDate,days:r.days}),[r.days,r.endDate,r.startDate]),[i,o]=p.useState(null),[s,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!1),[h,g]=p.useState(!1),[m,v]=p.useState(null),b=p.useCallback(async S=>{S?f(!0):g(!0);try{const C={startDate:a.startDate,endDate:a.endDate,endpoint:r.endpoint,model:r.model,limit:r.limit},[x,w,_]=await Promise.all([Gx.getForwardSummary(C),Gx.getForwardByEndpoint(C),Gx.getForwardRequests(C)]);o(x),l(w),u(_),v(null)}catch(C){v(YSt(C,"Failed to load forward metrics"))}finally{S?f(!1):g(!1)}},[r.endpoint,r.model,r.limit,a.endDate,a.startDate]),y=p.useCallback(async()=>{await b(!1)},[b]);return p.useEffect(()=>{b(!0)},[b]),p.useEffect(()=>{if(n<=0)return;const S=window.setInterval(()=>{b(!1)},n);return()=>{window.clearInterval(S)}},[n,b]),{summary:i,endpointMetrics:s,requests:c,isLoading:d,isRefreshing:h,error:m,refresh:y}},{useToken:ZSt}=pn,QSt=e=>{const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`},JSt=e=>{const t=e.filter(r=>typeof r.duration_ms=="number"&&r.duration_ms>0);if(t.length===0)return 0;const n=t.reduce((r,a)=>r+(a.duration_ms??0),0);return Math.floor(n/t.length)},ext=({summary:e,sessions:t,loading:n})=>{const{t:r}=br(),{token:a}=ZSt();if(n)return E.jsx(Jo,{active:!0,paragraph:{rows:1}});const i=JSt(t);return E.jsxs(gs,{gutter:[a.marginSM,a.marginSM],children:[E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:r("settings.metricsCards.totalSessions"),value:(e==null?void 0:e.total_sessions)??0,precision:0})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:r("settings.metricsCards.chatTokens"),value:(e==null?void 0:e.total_tokens.total_tokens)??0,precision:0})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:r("settings.metricsCards.totalToolCalls"),value:(e==null?void 0:e.total_tool_calls)??0,precision:0})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:r("settings.metricsCards.avgSessionDuration"),value:i>0?QSt(i):"-"})})})]})},{Text:txt}=Qt,ete=["#1677ff","#52c41a","#fa8c16","#722ed1","#13c2c2"],nxt=({data:e,loading:t})=>{const{t:n}=br();if(t)return E.jsx(Ot,{size:"small",title:n("settings.charts.modelDistribution"),children:E.jsx(Jo,{active:!0,paragraph:{rows:5}})});const r=e.map(a=>({name:a.model,value:a.tokens.total_tokens}));return E.jsx(Ot,{size:"small",title:n("settings.charts.modelDistribution"),children:r.length===0?E.jsx(va,{image:va.PRESENTED_IMAGE_SIMPLE,description:n("settings.charts.noModelMetrics")}):E.jsxs(E.Fragment,{children:[E.jsx(txt,{type:"secondary",children:n("settings.charts.modelDistributionDescription")}),E.jsx("div",{style:{width:"100%",height:280,marginTop:12},children:E.jsx(S_,{children:E.jsxs(zSt,{children:[E.jsx(dc,{data:r,cx:"50%",cy:"50%",outerRadius:90,fill:"#1677ff",dataKey:"value",nameKey:"name",label:!0,children:r.map((a,i)=>E.jsx(x_,{fill:ete[i%ete.length]},`${a.name}-${i}`))}),E.jsx(co,{})]})})})]})})},rxt=e=>{if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?"-":t.toLocaleString()},axt=e=>{if(!e||e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;if(n>=60){const a=Math.floor(n/60),i=n%60;return`${a}h ${i}m`}return n>0?`${n}m ${r}s`:`${r}s`},ixt=e=>{switch(e){case"completed":return"green";case"running":return"blue";case"error":return"red";case"cancelled":return"orange";default:return"default"}},oxt=({sessions:e,loading:t,onSelectSession:n})=>{const{t:r}=br(),a=[{title:r("settings.metricsTable.session.columns.session"),dataIndex:"session_id",key:"session_id",render:i=>E.jsx(wn,{title:i,children:E.jsxs("span",{children:[i.slice(0,8),"..."]})}),width:120},{title:r("settings.metricsTable.session.columns.model"),dataIndex:"model",key:"model",width:160},{title:r("settings.metricsTable.session.columns.status"),dataIndex:"status",key:"status",width:120,render:i=>E.jsx(Dn,{color:ixt(i),children:i})},{title:r("settings.metricsTable.session.columns.started"),dataIndex:"started_at",key:"started_at",render:i=>rxt(i),width:200,sorter:(i,o)=>new Date(i.started_at).getTime()-new Date(o.started_at).getTime(),defaultSortOrder:"descend"},{title:r("settings.metricsTable.session.columns.duration"),dataIndex:"duration_ms",key:"duration_ms",render:i=>axt(i),width:120},{title:r("settings.metricsTable.session.columns.tokens"),key:"tokens",render:(i,o)=>o.total_token_usage.total_tokens.toLocaleString(),width:120,sorter:(i,o)=>i.total_token_usage.total_tokens-o.total_token_usage.total_tokens},{title:r("settings.metricsTable.session.columns.toolCalls"),dataIndex:"tool_call_count",key:"tool_call_count",width:120,sorter:(i,o)=>i.tool_call_count-o.tool_call_count},{title:r("settings.metricsTable.session.columns.messages"),dataIndex:"message_count",key:"message_count",width:120,sorter:(i,o)=>i.message_count-o.message_count},{title:r("settings.metricsTable.session.columns.action"),key:"action",fixed:"right",width:120,render:(i,o)=>E.jsx(De,{type:"link",onClick:()=>{n(o.session_id)},children:r("settings.metricsTable.session.view")})}];return E.jsx(Bi,{rowKey:"session_id",size:"small",columns:a,loading:t,dataSource:e,pagination:{pageSize:10,showSizeChanger:!1},scroll:{x:1100}})},{Text:sxt}=Qt,lxt=({data:e,loading:t})=>{const{t:n}=br();return t?E.jsx(Ot,{size:"small",title:n("settings.charts.tokenUsageOverTime"),children:E.jsx(Jo,{active:!0,paragraph:{rows:5}})}):E.jsx(Ot,{size:"small",title:n("settings.charts.tokenUsageOverTime"),children:e.length===0?E.jsx(va,{image:va.PRESENTED_IMAGE_SIMPLE,description:n("settings.charts.noTokenUsage")}):E.jsxs(E.Fragment,{children:[E.jsx(sxt,{type:"secondary",children:n("settings.charts.tokenUsageDescription")}),E.jsx("div",{style:{width:"100%",height:280,marginTop:12},children:E.jsx(S_,{children:E.jsxs(FSt,{data:e,children:[E.jsx(V_,{strokeDasharray:"3 3"}),E.jsx(bf,{dataKey:"label",minTickGap:24}),E.jsx(yf,{allowDecimals:!1}),E.jsx(co,{}),E.jsx(Wc,{}),E.jsx(vd,{type:"monotone",dataKey:"totalTokens",name:n("settings.charts.total"),stroke:"#1677ff",strokeWidth:2,dot:!1}),E.jsx(vd,{type:"monotone",dataKey:"promptTokens",name:n("settings.charts.prompt"),stroke:"#52c41a",dot:!1}),E.jsx(vd,{type:"monotone",dataKey:"completionTokens",name:n("settings.charts.completion"),stroke:"#fa8c16",dot:!1})]})})})]})})},{useToken:cxt}=pn,uxt=e=>{if(!e||e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;if(n>=60){const a=Math.floor(n/60),i=n%60;return`${a}h ${i}m`}return n>0?`${n}m ${r}s`:`${r}s`},dxt=({summary:e,loading:t})=>{const{t:n}=br(),{token:r}=cxt();if(t)return E.jsx(Jo,{active:!0,paragraph:{rows:1}});const a=e&&e.total_requests>0?(e.successful_requests/e.total_requests*100).toFixed(1):"0.0";return E.jsxs(gs,{gutter:[r.marginSM,r.marginSM],children:[E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:n("settings.forwardMetricsCards.totalForwardRequests"),value:(e==null?void 0:e.total_requests)??0,precision:0})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:n("settings.forwardMetricsCards.successRate"),value:a,suffix:"%",valueStyle:{color:Number(a)>=95?"#52c41a":Number(a)>=80?"#faad14":"#ff4d4f"}})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:n("settings.forwardMetricsCards.forwardTokens"),value:(e==null?void 0:e.total_tokens.total_tokens)??0,precision:0})})}),E.jsx(Lr,{xs:24,sm:12,xl:6,children:E.jsx(Ot,{size:"small",children:E.jsx(ys,{title:n("settings.forwardMetricsCards.avgResponseTime"),value:uxt(e==null?void 0:e.avg_duration_ms)})})})]})},{useToken:fxt}=pn,pxt=({data:e,loading:t})=>{const{t:n}=br(),{token:r}=fxt();if(t)return E.jsx(Ot,{size:"small",title:n("settings.charts.endpointDistribution"),children:E.jsx("div",{style:{width:"100%",height:240},children:E.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:r.colorTextSecondary},children:n("settings.common.loading")})})});if(e.length===0)return E.jsx(Ot,{size:"small",title:n("settings.charts.endpointDistribution"),children:E.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:240,color:r.colorTextSecondary},children:n("settings.charts.noForwardMetrics")})});const a=e.map(i=>({endpoint:i.endpoint.split(".").pop()||i.endpoint,requests:i.requests,successful:i.successful,failed:i.failed}));return E.jsx(Ot,{size:"small",title:n("settings.charts.endpointDistribution"),children:E.jsx("div",{style:{width:"100%",height:240},children:E.jsx(S_,{children:E.jsxs(bbe,{data:a,children:[E.jsx(V_,{strokeDasharray:"3 3"}),E.jsx(bf,{dataKey:"endpoint"}),E.jsx(yf,{}),E.jsx(co,{formatter:(i,o)=>[`${i}`,o.charAt(0).toUpperCase()+o.slice(1)]}),E.jsx(Wc,{}),E.jsx(tc,{dataKey:"successful",fill:"#52c41a",name:n("settings.common.successful"),fillOpacity:.8,radius:[4,4,0,0]}),E.jsx(tc,{dataKey:"failed",fill:"#ff7875",name:n("settings.common.failed"),fillOpacity:.8,radius:[4,4,0,0]})]})})})})},{Text:Ru}=Qt,hxt=e=>{if(!e||e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`},gxt=e=>new Date(e).toLocaleString(),mxt=({requests:e,loading:t})=>{const{t:n}=br(),r=[{title:n("settings.metricsTable.forward.columns.id"),dataIndex:"forward_id",key:"forward_id",width:120,render:a=>E.jsxs(Ru,{style:{fontSize:12},copyable:!0,children:[a.slice(0,8),"..."]})},{title:n("settings.metricsTable.forward.columns.endpoint"),dataIndex:"endpoint",key:"endpoint",width:150,render:a=>E.jsx(Dn,{color:"blue",children:a.split(".").pop()||a})},{title:n("settings.metricsTable.forward.columns.model"),dataIndex:"model",key:"model",width:120},{title:n("settings.metricsTable.forward.columns.type"),dataIndex:"is_stream",key:"is_stream",width:80,render:a=>E.jsx(Dn,{color:a?"purple":"cyan",children:n(a?"settings.metricsTable.forward.typeStream":"settings.metricsTable.forward.typeSync")})},{title:n("settings.metricsTable.forward.columns.status"),key:"status",width:100,render:(a,i)=>{const o=i.status==="success"?"success":i.status==="error"?"error":"default";return E.jsx(Gy,{status:o,text:i.status_code?E.jsxs("span",{children:[i.status,E.jsxs(Ru,{type:"secondary",style:{marginLeft:4},children:["(",i.status_code,")"]})]}):i.status||"-"})}},{title:n("settings.metricsTable.forward.columns.tokens"),key:"tokens",width:100,render:(a,i)=>i.token_usage?E.jsx(Ru,{children:i.token_usage.total_tokens.toLocaleString()}):E.jsx(Ru,{type:"secondary",children:"-"})},{title:n("settings.metricsTable.forward.columns.duration"),dataIndex:"duration_ms",key:"duration_ms",width:100,render:a=>hxt(a)},{title:n("settings.metricsTable.forward.columns.started"),dataIndex:"started_at",key:"started_at",width:160,render:a=>E.jsx(Ru,{style:{fontSize:12},children:gxt(a)})},{title:n("settings.metricsTable.forward.columns.error"),dataIndex:"error",key:"error",width:200,render:a=>a?E.jsx(Ru,{type:"danger",ellipsis:!0,style:{maxWidth:180},children:a}):E.jsx(Ru,{type:"secondary",children:"-"})}];return E.jsx(Bi,{rowKey:"forward_id",columns:r,dataSource:e,loading:t,size:"small",pagination:{pageSize:10,showSizeChanger:!0,showTotal:a=>n("settings.metricsTable.forward.totalRequests",{total:a}),pageSizeOptions:["10","20","50","100"]},scroll:{x:1200},locale:{emptyText:n("settings.metricsTable.forward.empty")}})},{Text:Mu}=Qt,{useToken:vxt}=pn,tte=70,nte=130,rte=2,ate=1.2,ite=.65,ote=45,ste=1.8,lte=e=>"date"in e?e.date:e.label,bxt=(e,t)=>{if(t<=0||e<=0)return"#f5f5f5";const n=e/t;return n>=.8?"#1677ff":n>=.6?"#4096ff":n>=.4?"#69b1ff":n>=.2?"#91caff":"#d6e4ff"},qS=e=>{if(!e||e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;if(n>=60){const a=Math.floor(n/60),i=n%60;return`${a}h ${i}m`}return n>0?`${n}m ${r}s`:`${r}s`},yxt=()=>{const{t:e}=br(),{token:t}=vxt(),[n,r]=p.useState(void 0),[a,i]=p.useState(void 0),[o,s]=p.useState(void 0),[l,c]=p.useState(30),[u,d]=p.useState("daily"),{summary:f,modelMetrics:h,sessions:g,timeline:m,sessionDetail:v,isLoading:b,isRefreshing:y,isSessionDetailLoading:S,error:C,refresh:x,loadSessionDetail:w,clearSessionDetail:_}=GSt({filters:{startDate:n,endDate:a,model:o,days:l,granularity:u}}),{summary:T,endpointMetrics:k,requests:O,isLoading:I,isRefreshing:M,error:$,refresh:R}=XSt({filters:{startDate:n,endDate:a,days:l,model:o}}),A=p.useMemo(()=>m.map(z=>({label:lte(z),promptTokens:z.total_token_usage.prompt_tokens,completionTokens:z.total_token_usage.completion_tokens,totalTokens:z.total_token_usage.total_tokens})),[m]),P=p.useMemo(()=>h.map(z=>({label:z.model,value:z.model})),[h]),N=p.useMemo(()=>{const z=new Map;return g.forEach(G=>{Object.entries(G.tool_breakdown).forEach(([X,Z])=>{z.set(X,(z.get(X)??0)+Z)})}),Array.from(z.entries()).map(([G,X])=>({tool:G,count:X})).sort((G,X)=>X.count-G.count).slice(0,10)},[g]),L=p.useMemo(()=>{const z=m.map(X=>({label:lte(X),sessions:X.total_sessions,tokens:X.total_token_usage.total_tokens})),G=z.reduce((X,Z)=>Math.max(X,Z.sessions),0);return{points:z,maxSessions:G}},[m]),j=p.useMemo(()=>{const z=O.map(X=>X.duration_ms).filter(X=>typeof X=="number"&&X>0).sort((X,Z)=>X-Z);if(z.length===0)return null;const G=Math.ceil(z.length*.95)-1;return z[Math.max(0,Math.min(G,z.length-1))]},[O]),D=p.useMemo(()=>[{title:e("settings.metricsDashboard.roundColumns.round"),dataIndex:"round_id",key:"round_id",render:z=>`${z.slice(0,8)}...`},{title:e("settings.metricsDashboard.roundColumns.status"),dataIndex:"status",key:"status"},{title:e("settings.metricsDashboard.roundColumns.duration"),dataIndex:"duration_ms",key:"duration_ms",render:z=>qS(z)},{title:e("settings.metricsDashboard.roundColumns.tokens"),key:"tokens",render:(z,G)=>G.token_usage.total_tokens.toLocaleString()},{title:e("settings.metricsDashboard.roundColumns.toolCalls"),key:"tool_calls",render:(z,G)=>G.tool_calls.length}],[e]),H=p.useMemo(()=>{const z=(f==null?void 0:f.total_sessions)??0,G=(f==null?void 0:f.total_tokens.total_tokens)??0,X=(f==null?void 0:f.total_tool_calls)??0,Z=(f==null?void 0:f.active_sessions)??0,q=g.reduce((ce,xe)=>ce+xe.total_rounds,0),Y=(T==null?void 0:T.total_requests)??0,te=(T==null?void 0:T.total_tokens.total_tokens)??0,ee=(T==null?void 0:T.failed_requests)??0,Q=G+te,ae=O.filter(ce=>ce.is_stream).length,oe=z>0?Z/z*100:0,re=Y>0?ee/Y*100:0,ie=O.length>0?ae/O.length*100:0,ue=G/tte+X*rte,ge=G/nte+X*ate,Se=Math.max(0,ue-ge)*ite,fe=Math.max(ge,ue-Se),he=qS(Se*6e4),ve=Number((Se/(8*60)).toFixed(2)),we=ue>0?Math.min(ote,Number((Se/ue*100).toFixed(1))):0,Re=fe>0?Math.min(ste,Number((ue/fe).toFixed(2))):1;return[{title:e("settings.metricsDashboard.compactStats.combinedTokens"),value:Q},{title:e("settings.metricsDashboard.compactStats.chatTokens"),value:G},{title:e("settings.metricsDashboard.compactStats.forwardTokens"),value:te},{title:e("settings.metricsDashboard.compactStats.avgTokensPerSession"),value:z>0?Math.round(G/z):0},{title:e("settings.metricsDashboard.compactStats.estimatedTimeSaved"),value:he},{title:e("settings.metricsDashboard.compactStats.estimatedEfficiencyLift"),value:we,suffix:"%"},{title:e("settings.metricsDashboard.compactStats.estimatedSpeedMultiplier"),value:Re,suffix:e("settings.metricsDashboard.multiplierSuffix")},{title:e("settings.metricsDashboard.compactStats.estimatedSavedWorkdays"),value:ve},{title:e("settings.metricsDashboard.compactStats.avgRoundsPerSession"),value:z>0?Number((q/z).toFixed(2)):0},{title:e("settings.metricsDashboard.compactStats.toolCallsPerSession"),value:z>0?Number((X/z).toFixed(2)):0},{title:e("settings.metricsDashboard.compactStats.activeSessionRate"),value:Number(oe.toFixed(1)),suffix:"%"},{title:e("settings.metricsDashboard.compactStats.avgTokensPerForward"),value:Y>0?Math.round(te/Y):0},{title:e("settings.metricsDashboard.compactStats.forwardErrorRate"),value:Number(re.toFixed(1)),suffix:"%"},{title:e("settings.metricsDashboard.compactStats.streamingRatio"),value:Number(ie.toFixed(1)),suffix:"%"},{title:e("settings.metricsDashboard.compactStats.p95ForwardLatency"),value:qS(j)},{title:e("settings.metricsDashboard.compactStats.modelCoverage"),value:h.length},{title:e("settings.metricsDashboard.compactStats.endpointCoverage"),value:k.length}]},[k.length,O,T,h.length,j,g,f,e]),F=v==null?void 0:v.session,B=y||M;return E.jsxs(He,{direction:"vertical",size:t.marginMD,style:{width:"100%"},children:[C?E.jsx(fr,{type:"error",showIcon:!0,message:C}):null,$?E.jsx(fr,{type:"error",showIcon:!0,message:$}):null,E.jsx(Ot,{size:"small",title:e("settings.metricsDashboard.filtersTitle"),extra:E.jsx(De,{icon:E.jsx(Zl,{}),loading:B,onClick:()=>{x(),R()},children:e("settings.metricsDashboard.refresh")}),children:E.jsxs(He,{wrap:!0,children:[E.jsx(kd,{placeholder:e("settings.metricsDashboard.startDate"),onChange:z=>{r(z?z.format("YYYY-MM-DD"):void 0)}}),E.jsx(kd,{placeholder:e("settings.metricsDashboard.endDate"),onChange:z=>{i(z?z.format("YYYY-MM-DD"):void 0)}}),E.jsx(Jn,{allowClear:!0,style:{minWidth:180},placeholder:e("settings.metricsDashboard.model"),value:o,options:P,onChange:z=>{s(z)}}),E.jsx(Jn,{style:{width:120},value:l,options:[7,14,30,90].map(z=>({label:e("settings.metricsDashboard.daysOption",{value:z}),value:z})),onChange:z=>{c(z)}}),E.jsx(Jn,{style:{width:140},value:u,options:[{label:e("settings.metricsDashboard.granularity.daily"),value:"daily"},{label:e("settings.metricsDashboard.granularity.weekly"),value:"weekly"},{label:e("settings.metricsDashboard.granularity.monthly"),value:"monthly"}],onChange:z=>{d(z)}})]})}),E.jsx(Ot,{size:"small",title:e("settings.metricsDashboard.dashboardTitle"),children:E.jsx(Gp,{size:"small",destroyInactiveTabPane:!0,items:[{key:"overview",label:e("settings.metricsDashboard.tabs.overview"),children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsx(ext,{summary:f,sessions:g,loading:b}),E.jsx(dxt,{summary:T,loading:I}),E.jsxs(Ot,{size:"small",title:e("settings.metricsDashboard.derivedMetricsTitle"),extra:E.jsx(Mu,{type:"secondary",children:e("settings.metricsDashboard.derivedMetricsSubtitle")}),children:[E.jsx(gs,{gutter:[t.marginSM,t.marginSM],children:H.map(z=>E.jsx(Lr,{xs:24,sm:12,md:8,xl:6,children:E.jsx("div",{style:{borderRadius:t.borderRadiusSM,padding:t.paddingXS,background:t.colorFillTertiary},children:E.jsx(ys,{title:z.title,value:z.value,suffix:z.suffix,valueStyle:{fontSize:t.fontSizeHeading4}})})},z.title))}),E.jsx(Mu,{type:"secondary",style:{display:"block",marginTop:t.marginXS},children:e("settings.metricsDashboard.efficiencyHint",{manualTpm:tte,manualToolMinutes:rte,assistedTpm:nte,assistedToolMinutes:ate,realization:Math.round(ite*100),maxLift:ote,maxMultiplier:ste})})]})]})},{key:"analysis",label:e("settings.metricsDashboard.tabs.analysis"),children:E.jsxs(He,{direction:"vertical",size:t.marginSM,style:{width:"100%"},children:[E.jsxs("div",{style:{width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 2fr) minmax(0, 1fr)",gap:t.marginSM},children:[E.jsx(lxt,{data:A,loading:b}),E.jsx(nxt,{data:h,loading:b})]}),E.jsxs("div",{style:{width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:t.marginSM},children:[E.jsx(Ot,{size:"small",title:e("settings.metricsDashboard.toolUsageTitle"),children:N.length===0?E.jsx(Mu,{type:"secondary",children:e("settings.metricsDashboard.noToolUsage")}):E.jsx("div",{style:{width:"100%",height:240},children:E.jsx(S_,{children:E.jsxs(bbe,{data:N,children:[E.jsx(V_,{strokeDasharray:"3 3"}),E.jsx(bf,{dataKey:"tool",interval:0,angle:-20,textAnchor:"end",height:70}),E.jsx(yf,{allowDecimals:!1}),E.jsx(co,{}),E.jsx(tc,{dataKey:"count",fill:"#1677ff",name:e("settings.metricsDashboard.calls")})]})})})}),E.jsx(Ot,{size:"small",title:e("settings.metricsDashboard.activityHeatmapTitle"),children:L.points.length===0?E.jsx(Mu,{type:"secondary",children:e("settings.metricsDashboard.noActivity")}):E.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(72px, 1fr))",gap:t.marginXS},children:L.points.map(z=>E.jsxs("div",{style:{borderRadius:t.borderRadiusSM,padding:t.paddingXS,background:bxt(z.sessions,L.maxSessions),minHeight:64,color:z.sessions>0?"#fff":t.colorTextSecondary},children:[E.jsx("div",{style:{fontSize:12,lineHeight:1.2},children:z.label}),E.jsx("div",{style:{fontWeight:600,marginTop:4},children:e("settings.metricsDashboard.sessionsCount",{count:z.sessions})}),E.jsx("div",{style:{fontSize:12},children:e("settings.metricsDashboard.tokensAmount",{value:z.tokens.toLocaleString()})})]},z.label))})})]}),E.jsx(pxt,{data:k,loading:I})]})},{key:"records",label:e("settings.metricsDashboard.tabs.records"),children:E.jsx(Gp,{size:"small",destroyInactiveTabPane:!0,items:[{key:"sessions",label:e("settings.metricsDashboard.sessionsTabLabel",{count:g.length}),children:E.jsx(Ot,{size:"small",extra:E.jsx(Mu,{type:"secondary",children:e("settings.metricsDashboard.sessionsHint")}),children:E.jsx(oxt,{sessions:g,loading:b,onSelectSession:z=>{w(z)}})})},{key:"forward-requests",label:e("settings.metricsDashboard.forwardTabLabel",{count:O.length}),children:E.jsx(Ot,{size:"small",children:E.jsx(mxt,{requests:O,loading:I})})}]})}]})}),E.jsx(qr,{title:e("settings.metricsDashboard.sessionMetricsTitle"),open:!!v,onCancel:_,onOk:_,width:960,destroyOnClose:!0,children:S?E.jsx(Mu,{children:e("settings.metricsDashboard.loadingSessionDetails")}):F?E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:t.marginMD,children:[E.jsxs(Ks,{size:"small",bordered:!0,column:2,children:[E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.sessionId"),span:2,children:F.session_id}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.model"),children:F.model}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.status"),children:F.status}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.duration"),children:qS(F.duration_ms)}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.messages"),children:F.message_count}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.totalTokens"),children:F.total_token_usage.total_tokens.toLocaleString()}),E.jsx(Ks.Item,{label:e("settings.metricsDashboard.sessionDetail.toolCalls"),children:F.tool_call_count})]}),E.jsx(Bi,{rowKey:"round_id",size:"small",columns:D,dataSource:v.rounds,pagination:{pageSize:6,showSizeChanger:!1}})]}):E.jsx(Mu,{type:"secondary",children:e("settings.metricsDashboard.noDetail")})})]})},{Text:VS}=Qt,{useToken:Sxt}=pn,xxt=e=>{var n,r;const t=String(((r=(n=e==null?void 0:e.hooks)==null?void 0:n.image_fallback)==null?void 0:r.mode)||"placeholder").trim().toLowerCase();return t==="error"||t==="ocr"?t:"placeholder"},wxt=e=>{var n,r;const t=(r=(n=e==null?void 0:e.hooks)==null?void 0:n.image_fallback)==null?void 0:r.enabled;return typeof t=="boolean"?t:!1},Cxt=()=>{const{t:e}=br(),{token:t}=Sxt(),[n,r]=vn.useMessage(),[a,i]=p.useState(!1),[o,s]=p.useState(!0),[l,c]=p.useState("placeholder"),u=p.useMemo(()=>[{label:e("settings.hooksTab.mode.placeholder"),value:"placeholder"},{label:e("settings.hooksTab.mode.error"),value:"error"},{label:e("settings.hooksTab.mode.ocr"),value:"ocr"}],[e]),d=p.useCallback(async()=>{i(!0);try{const m=await Dr.getBambooConfig();s(wxt(m)),c(xxt(m))}catch(m){n.error(m instanceof Error?m.message:e("settings.hooksTab.loadFailed"))}finally{i(!1)}},[n]),f=p.useCallback(async(m,v)=>{await Dr.setBambooConfig({hooks:{image_fallback:{enabled:m,mode:v}}})},[]),h=p.useCallback(async m=>{i(!0);try{await f(m,l),n.success(e(m?"settings.hooksTab.enabled":"settings.hooksTab.disabled")),await d()}catch(v){n.error(v instanceof Error?v.message:e("settings.hooksTab.updateFailed"))}finally{i(!1)}},[d,l,n,f]),g=p.useCallback(async m=>{var v;i(!0);try{await f(o,m),n.success(e("settings.hooksTab.modeUpdated",{mode:((v=u.find(b=>b.value===m))==null?void 0:v.label)??m})),await d()}catch(b){n.error(b instanceof Error?b.message:e("settings.hooksTab.modeUpdateFailed"))}finally{i(!1)}},[o,d,n,f]);return p.useEffect(()=>{d()},[d]),E.jsxs(rt,{vertical:!0,gap:t.marginLG,children:[r,E.jsx(Ot,{size:"small",loading:a,children:E.jsxs(rt,{vertical:!0,gap:t.marginXS,children:[E.jsx(VS,{strong:!0,children:e("settings.hooksTab.title")}),E.jsxs(rt,{align:"center",justify:"space-between",children:[E.jsx(VS,{children:e("settings.hooksTab.enableImagePreflight")}),E.jsx(ba,{checked:o,onChange:h})]}),E.jsxs(rt,{align:"center",justify:"space-between",children:[E.jsx(VS,{children:e("settings.hooksTab.modeLabel")}),E.jsx(Jn,{style:{width:180},value:l,options:u,onChange:g,disabled:!o})]}),E.jsx(VS,{type:"secondary",style:{fontSize:t.fontSizeSM},children:e("settings.hooksTab.description")})]})})]})},{Text:xc}=Qt,wc=Rs.getInstance();function Ext(){const{t:e}=br(),[t,n]=vn.useMessage(),[r,a]=p.useState(!1),[i,o]=p.useState([]),[s,l]=p.useState({open:!1,scheduleId:null,sessions:[],loading:!1}),[c,u]=p.useState({open:!1,schedule:null,saving:!1}),d=Ub(v=>v.close),[f]=wt.useForm(),[h]=wt.useForm(),g=async()=>{a(!0);try{const v=await wc.listSchedules();o(v.schedules||[])}catch(v){console.error("[Schedules] Failed to load schedules:",v),t.error(e("settings.schedulesTab.loadFailed"))}finally{a(!1)}};p.useEffect(()=>{g()},[]);const m=p.useMemo(()=>[{title:e("settings.schedulesTab.columns.name"),dataIndex:"name",key:"name"},{title:e("settings.schedulesTab.columns.autoExecute"),key:"auto_execute",render:(v,b)=>{var y,S;return E.jsx(xc,{type:(y=b.run_config)!=null&&y.auto_execute?void 0:"secondary",children:(S=b.run_config)!=null&&S.auto_execute?e("settings.schedulesTab.yes"):e("settings.schedulesTab.no")})}},{title:e("settings.schedulesTab.columns.model"),key:"model",render:(v,b)=>{var y;return E.jsx(xc,{type:"secondary",children:(y=b.run_config)!=null&&y.model?String(b.run_config.model):"-"})}},{title:e("settings.schedulesTab.columns.enabled"),key:"enabled",render:(v,b)=>E.jsx(ba,{checked:b.enabled,onChange:async y=>{try{await wc.patchSchedule(b.id,{enabled:y}),await g()}catch(S){console.error("[Schedules] Failed to toggle:",S),t.error(e("settings.schedulesTab.updateFailed"))}}})},{title:e("settings.schedulesTab.columns.intervalSeconds"),key:"interval_seconds",render:(v,b)=>E.jsx(ui,{min:1,value:b.interval_seconds,onChange:async y=>{const S=typeof y=="number"?y:null;if(!(!S||S<=0))try{await wc.patchSchedule(b.id,{interval_seconds:S}),await g()}catch(C){console.error("[Schedules] Failed to patch interval:",C),t.error(e("settings.schedulesTab.updateFailed"))}}})},{title:e("settings.schedulesTab.columns.nextRun"),dataIndex:"next_run_at",key:"next_run_at",render:v=>E.jsx(xc,{type:"secondary",children:String(v)})},{title:e("settings.schedulesTab.columns.lastRun"),dataIndex:"last_run_at",key:"last_run_at",render:v=>E.jsx(xc,{type:"secondary",children:v?String(v):"-"})},{title:e("settings.schedulesTab.columns.actions"),key:"actions",render:(v,b)=>E.jsxs(rt,{gap:8,wrap:"wrap",children:[E.jsx(De,{size:"small",onClick:()=>{var y,S,C,x,w,_;u({open:!0,schedule:b,saving:!1}),h.setFieldsValue({name:b.name,enabled:b.enabled,interval_seconds:b.interval_seconds,system_prompt:((y=b.run_config)==null?void 0:y.system_prompt)||"",task_message:((S=b.run_config)==null?void 0:S.task_message)||"",model:((C=b.run_config)==null?void 0:C.model)||"",workspace_path:((x=b.run_config)==null?void 0:x.workspace_path)||"",enhance_prompt:((w=b.run_config)==null?void 0:w.enhance_prompt)||"",auto_execute:!!((_=b.run_config)!=null&&_.auto_execute)})},children:e("settings.schedulesTab.actions.edit")}),E.jsx(De,{size:"small",onClick:async()=>{try{await wc.runScheduleNow(b.id),t.success(e("settings.schedulesTab.enqueuedRun")),await g()}catch(y){console.error("[Schedules] Failed to run now:",y),t.error(e("settings.schedulesTab.runNowFailed"))}},children:e("settings.schedulesTab.actions.runNow")}),E.jsx(De,{size:"small",onClick:async()=>{l(y=>({...y,open:!0,scheduleId:b.id,loading:!0,sessions:[]}));try{const y=await wc.listScheduleSessions(b.id);l(S=>({...S,open:!0,scheduleId:b.id,loading:!1,sessions:(y.sessions||[]).map(C=>({id:C.id,title:C.title,updated_at:C.updated_at}))}))}catch(y){console.error("[Schedules] Failed to list sessions:",y),t.error(e("settings.schedulesTab.loadSessionsFailed")),l(S=>({...S,loading:!1}))}},children:e("settings.schedulesTab.actions.sessions")}),E.jsx(De,{danger:!0,size:"small",onClick:async()=>{try{await wc.deleteSchedule(b.id),t.success(e("settings.schedulesTab.deleted")),await g()}catch(y){console.error("[Schedules] Failed to delete:",y),t.error(e("settings.schedulesTab.deleteFailed"))}},children:e("settings.schedulesTab.actions.delete")})]})}],[t,e]);return E.jsxs(rt,{vertical:!0,gap:16,children:[n,E.jsx(Ot,{title:e("settings.schedulesTab.createTitle"),children:E.jsxs(wt,{form:f,layout:"vertical",initialValues:{name:e("settings.schedulesTab.defaultName"),interval_seconds:3600,enabled:!1,task_message:"",model:"",auto_execute:!0},onFinish:async v=>{try{const b=!!v.auto_execute,y=String(v.task_message||"").trim(),S=String(v.model||"").trim();if(b&&!y){t.error(e("settings.schedulesTab.taskMessageRequired"));return}await wc.createSchedule({name:String(v.name||"").trim(),interval_seconds:Number(v.interval_seconds||0),enabled:!!v.enabled,run_config:{task_message:y||void 0,model:S||void 0,auto_execute:b}}),t.success(e("settings.schedulesTab.created")),f.resetFields(),await g()}catch(b){console.error("[Schedules] Failed to create schedule:",b),t.error(e("settings.schedulesTab.createFailed"))}},children:[E.jsxs(rt,{gap:12,wrap:"wrap",children:[E.jsx(wt.Item,{label:e("settings.schedulesTab.form.name"),name:"name",rules:[{required:!0,message:e("settings.schedulesTab.validation.nameRequired")}],style:{flex:"1 1 280px"},children:E.jsx(tn,{})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.intervalSeconds"),name:"interval_seconds",rules:[{required:!0,message:e("settings.schedulesTab.validation.intervalRequired")}],style:{width:200},children:E.jsx(ui,{min:1,style:{width:"100%"}})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.enabled"),name:"enabled",valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsxs(rt,{gap:12,wrap:"wrap",children:[E.jsx(wt.Item,{label:e("settings.schedulesTab.form.taskMessage"),name:"task_message",style:{flex:"1 1 480px"},children:E.jsx(tn.TextArea,{rows:3,placeholder:e("settings.schedulesTab.form.taskMessagePlaceholder")})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.model"),name:"model",style:{width:240},children:E.jsx(tn,{placeholder:e("settings.schedulesTab.form.modelPlaceholder")})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.autoExecute"),name:"auto_execute",valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsx(De,{type:"primary",htmlType:"submit",children:e("settings.schedulesTab.actions.create")})]})}),E.jsx(Ot,{title:e("settings.schedulesTab.listTitle"),extra:E.jsx(De,{onClick:()=>g(),loading:r,children:e("settings.schedulesTab.actions.refresh")}),children:E.jsx(Bi,{rowKey:"id",columns:m,dataSource:i,loading:r,pagination:{pageSize:10}})}),E.jsx(qr,{title:e("settings.schedulesTab.scheduleSessionsTitle"),open:s.open,onCancel:()=>l(v=>({...v,open:!1,scheduleId:null})),footer:null,children:s.loading?E.jsx(xc,{type:"secondary",children:e("settings.schedulesTab.loading")}):E.jsx(rt,{vertical:!0,gap:8,children:s.sessions.length===0?E.jsx(xc,{type:"secondary",children:e("settings.schedulesTab.noSessionsYet")}):s.sessions.map(v=>E.jsxs(rt,{justify:"space-between",align:"center",children:[E.jsxs(rt,{vertical:!0,style:{minWidth:0},children:[E.jsx(xc,{strong:!0,ellipsis:!0,children:v.title}),E.jsxs(xc,{type:"secondary",ellipsis:!0,children:[v.id," • ",v.updated_at]})]}),E.jsx(De,{size:"small",onClick:()=>{J8(v.id,{forceRefreshIndex:!0,forceLoadHistory:!0,subscribeIfRunning:!0,forceSubscribe:!0}),d()},children:e("settings.schedulesTab.actions.open")})]},v.id))})}),E.jsx(qr,{title:e("settings.schedulesTab.editTitle"),open:c.open,onCancel:()=>u({open:!1,schedule:null,saving:!1}),okText:e("settings.schedulesTab.actions.save"),confirmLoading:c.saving,onOk:()=>h.submit(),children:E.jsxs(wt,{form:h,layout:"vertical",onFinish:async v=>{const b=c.schedule;if(!b)return;const y=!!v.auto_execute,S=String(v.task_message||"").trim(),C=String(v.model||"").trim();if(y&&!S){t.error(e("settings.schedulesTab.taskMessageRequired"));return}u(x=>({...x,saving:!0}));try{await wc.patchSchedule(b.id,{name:String(v.name||"").trim()||void 0,enabled:!!v.enabled,interval_seconds:Number(v.interval_seconds||0)||void 0,run_config:{system_prompt:String(v.system_prompt||"").trim()||void 0,task_message:S||void 0,model:C||void 0,workspace_path:String(v.workspace_path||"").trim()||void 0,enhance_prompt:String(v.enhance_prompt||"").trim()||void 0,auto_execute:y}}),t.success(e("settings.schedulesTab.updated")),u({open:!1,schedule:null,saving:!1}),await g()}catch(x){console.error("[Schedules] Failed to patch schedule:",x),t.error(e("settings.schedulesTab.updateFailed")),u(w=>({...w,saving:!1}))}},children:[E.jsxs(rt,{gap:12,wrap:"wrap",children:[E.jsx(wt.Item,{label:e("settings.schedulesTab.form.name"),name:"name",rules:[{required:!0,message:e("settings.schedulesTab.validation.nameRequired")}],style:{flex:"1 1 280px"},children:E.jsx(tn,{})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.intervalSeconds"),name:"interval_seconds",rules:[{required:!0,message:e("settings.schedulesTab.validation.intervalRequired")}],style:{width:220},children:E.jsx(ui,{min:1,style:{width:"100%"}})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.enabled"),name:"enabled",valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.systemPrompt"),name:"system_prompt",children:E.jsx(tn.TextArea,{rows:2,placeholder:e("settings.schedulesTab.optional")})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.taskMessage"),name:"task_message",children:E.jsx(tn.TextArea,{rows:3,placeholder:e("settings.schedulesTab.optional")})}),E.jsxs(rt,{gap:12,wrap:"wrap",children:[E.jsx(wt.Item,{label:e("settings.schedulesTab.form.model"),name:"model",style:{flex:"1 1 260px"},children:E.jsx(tn,{placeholder:e("settings.schedulesTab.form.modelRequiredIfAuto")})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.autoExecute"),name:"auto_execute",valuePropName:"checked",children:E.jsx(ba,{})})]}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.workspacePath"),name:"workspace_path",children:E.jsx(tn,{placeholder:e("settings.schedulesTab.optional")})}),E.jsx(wt.Item,{label:e("settings.schedulesTab.form.enhancePrompt"),name:"enhance_prompt",children:E.jsx(tn.TextArea,{rows:2,placeholder:e("settings.schedulesTab.optional")})})]})})]})}const{Text:cm}=Qt,um=Rs.getInstance();function _xt(){const{t:e}=br(),{modal:t,message:n}=Ns.useApp(),r=Ue(g=>g.chats),a=Ue(g=>g.currentSessionId),i=Ue(g=>g.refreshChats),o=Ue(g=>g.loadChats),s=Ue(g=>g.loadChatHistory),[l,c]=p.useState(!0),[u,d]=p.useState(!1),f=p.useMemo(()=>a?r.find(g=>g.id===a)??null:null,[r,a]),h=async g=>{if(!u){d(!0);try{await g()}finally{d(!1)}}};return E.jsxs(rt,{vertical:!0,gap:16,children:[E.jsx(Ot,{size:"small",title:e("settings.sessionsTab.currentSessionTitle"),children:f?E.jsxs(rt,{vertical:!0,gap:4,children:[E.jsx(cm,{strong:!0,ellipsis:!0,children:f.title}),E.jsxs(cm,{type:"secondary",ellipsis:!0,children:[e("settings.sessionsTab.id"),": ",f.id," ","•"," ",e("settings.sessionsTab.kind"),": ",f.kind]}),E.jsx(rt,{gap:8,wrap:"wrap",style:{marginTop:8},children:E.jsx(De,{danger:!0,loading:u,onClick:()=>{t.confirm({title:e("settings.sessionsTab.clearMessagesTitle"),content:e("settings.sessionsTab.clearMessagesContent"),okText:e("settings.sessionsTab.clear"),okButtonProps:{danger:!0},cancelText:e("settings.sessionsTab.cancel"),onOk:async()=>{await h(async()=>{await um.clearSession(f.id),await s(f.id),await i(),n.success(e("settings.sessionsTab.sessionCleared"))})}})},children:e("settings.sessionsTab.clearMessages")})})]}):E.jsx(cm,{type:"secondary",children:e("settings.sessionsTab.noActiveSession")})}),E.jsxs(Ot,{size:"small",title:e("settings.sessionsTab.bulkCleanupTitle"),children:[E.jsxs(rt,{align:"center",gap:8,style:{marginBottom:12},children:[E.jsx(cm,{children:e("settings.sessionsTab.keepPinned")}),E.jsx(ba,{checked:l,onChange:c})]}),E.jsxs(rt,{gap:8,wrap:"wrap",children:[E.jsx(De,{danger:!0,loading:u,onClick:()=>{t.confirm({title:e("settings.sessionsTab.deleteAllTitle"),content:e(l?"settings.sessionsTab.deleteAllKeepPinned":"settings.sessionsTab.deleteAllIncludePinned"),okText:e("settings.sessionsTab.delete"),okButtonProps:{danger:!0},cancelText:e("settings.sessionsTab.cancel"),onOk:async()=>{await h(async()=>{await um.cleanupSessions("all",l),await o(),n.success(e("settings.sessionsTab.cleanupComplete"))})}})},children:e("settings.sessionsTab.deleteAll")}),E.jsx(De,{danger:!0,loading:u,onClick:()=>{t.confirm({title:e("settings.sessionsTab.deleteEmptyTitle"),content:e(l?"settings.sessionsTab.deleteEmptyKeepPinned":"settings.sessionsTab.deleteEmptyIncludePinned"),okText:e("settings.sessionsTab.delete"),okButtonProps:{danger:!0},cancelText:e("settings.sessionsTab.cancel"),onOk:async()=>{await h(async()=>{await um.cleanupSessions("empty",l),await o(),n.success(e("settings.sessionsTab.cleanupComplete"))})}})},children:e("settings.sessionsTab.deleteEmpty")}),E.jsx(De,{danger:!0,loading:u,onClick:()=>{t.confirm({title:e("settings.sessionsTab.deleteChildrenTitle"),content:e(l?"settings.sessionsTab.deleteChildrenKeepPinned":"settings.sessionsTab.deleteChildrenIncludePinned"),okText:e("settings.sessionsTab.delete"),okButtonProps:{danger:!0},cancelText:e("settings.sessionsTab.cancel"),onOk:async()=>{await h(async()=>{await um.cleanupSessions("children",l),await o(),n.success(e("settings.sessionsTab.cleanupComplete"))})}})},children:e("settings.sessionsTab.deleteChildren")})]})]}),E.jsxs(Ot,{size:"small",title:e("settings.sessionsTab.devResetTitle"),children:[E.jsx(cm,{type:"secondary",children:e("settings.sessionsTab.devResetDescription")}),E.jsx(rt,{style:{marginTop:12},children:E.jsx(De,{danger:!0,type:"primary",loading:u,onClick:()=>{t.confirm({title:e("settings.sessionsTab.devResetConfirmTitle"),content:e("settings.sessionsTab.devResetConfirmContent"),okText:e("settings.sessionsTab.reset"),okButtonProps:{danger:!0},cancelText:e("settings.sessionsTab.cancel"),onOk:async()=>{await h(async()=>{await um.devResetSessions(),await o(),n.success(e("settings.sessionsTab.devResetDone"))})}})},children:e("settings.sessionsTab.devResetAction")})})]})]})}const RR={copilot:"GitHub Copilot",openai:"OpenAI",anthropic:"Anthropic",gemini:"Google Gemini"},wbe=[{value:"gpt-4o-mini",label:"GPT-4o Mini"},{value:"gpt-4o",label:"GPT-4o"},{value:"gpt-4-turbo",label:"GPT-4 Turbo"},{value:"gpt-4-turbo-preview",label:"GPT-4 Turbo Preview"},{value:"gpt-4",label:"GPT-4"},{value:"gpt-3.5-turbo",label:"GPT-3.5 Turbo"}],Cbe=[{value:"claude-3-5-sonnet-20241022",label:"Claude 3.5 Sonnet"},{value:"claude-3-5-sonnet-20240620",label:"Claude 3.5 Sonnet (Legacy)"},{value:"claude-3-opus-20240229",label:"Claude 3 Opus"},{value:"claude-3-sonnet-20240229",label:"Claude 3 Sonnet"},{value:"claude-3-haiku-20240307",label:"Claude 3 Haiku"}],Ebe=[{value:"gemini-pro",label:"Gemini Pro"},{value:"gemini-pro-vision",label:"Gemini Pro Vision"},{value:"gemini-1.5-pro",label:"Gemini 1.5 Pro"},{value:"gemini-1.5-flash",label:"Gemini 1.5 Flash"}],Txt=[{value:"gpt-4o",label:"GPT-4o"},{value:"gpt-4o-mini",label:"GPT-4o Mini"}],{Option:dm}=Jn,{Password:cte}=tn,{Text:ss,Paragraph:GS}=Qt,ute=e=>E.jsxs(He,{direction:"vertical",size:4,children:[E.jsxs(ss,{type:"secondary",children:[e("settings.providerTab.responsesOnlyHelp1")," ",E.jsx(ss,{code:!0,children:"/responses"}),"."]}),E.jsx(ss,{type:"secondary",children:e("settings.providerTab.responsesOnlyHelp2")})]}),kxt=e=>e.map(t=>({value:t,label:t})),Oxt=()=>{const{t:e}=br(),{token:t}=pn.useToken(),[n]=wt.useForm(),[r,a]=p.useState(!1),[i,o]=p.useState(!1),[s,l]=p.useState("copilot"),[c,u]=p.useState(!1),[d,f]=p.useState(null),[h,g]=p.useState(!1),[m,v]=p.useState(!1),[b,y]=p.useState(null),[S,C]=p.useState(!1),[x,w]=p.useState(!1),[_,T]=p.useState(0),[k,O]=p.useState(!1),[I,M]=p.useState(!1),[$,R]=p.useState([]),[A,P]=p.useState(null),[N,L]=p.useState(!1),[j,D]=p.useState("idle"),[H,F]=p.useState(null);p.useEffect(()=>{if(j!=="success")return;const de=setTimeout(()=>{D("idle"),F(null)},2e3);return()=>clearTimeout(de)},[j]);const B=wt.useWatch(["providers","openai","api_key"],n),z=wt.useWatch(["providers","openai","base_url"],n),G=wt.useWatch(["providers","anthropic","api_key"],n),X=wt.useWatch(["providers","anthropic","base_url"],n),Z=wt.useWatch(["providers","gemini","api_key"],n),q=wt.useWatch(["providers","gemini","base_url"],n);p.useEffect(()=>{s==="openai"&&(R([]),P(null),L(!1))},[s,B,z]),p.useEffect(()=>{s==="anthropic"&&(R([]),P(null),L(!1))},[s,G,X]),p.useEffect(()=>{s==="gemini"&&(R([]),P(null),L(!1))},[s,Z,q]),p.useEffect(()=>{if(!S||!b){T(0);return}T(b.expires_in);const de=setInterval(()=>{T(me=>me<=1?(clearInterval(de),0):me-1)},1e3);return()=>clearInterval(de)},[S,b]),p.useEffect(()=>{Y()},[]),p.useEffect(()=>{s==="copilot"&&te()},[s]);const Y=async()=>{try{a(!0);const de=await lo.getProviderConfig(),me={provider:de.provider,providers:de.providers||{}};if(me.provider==="copilot"){const pe=me.providers.copilot||{};pe.model||(me.providers.copilot={...pe,model:"gpt-4o"})}console.log("Loaded provider config:",me),l(me.provider),n.setFieldsValue(me),u(!0)}catch(de){vn.error(e("settings.providerTab.loadConfigFailed")),console.error("Failed to load provider config:",de)}finally{a(!1)}},te=async()=>{try{g(!0);const de=await lo.getCopilotAuthStatus();f(de)}catch(de){console.error("Failed to check Copilot auth status:",de),f({authenticated:!1,message:e("settings.providerTab.checkStatusFailed")})}finally{g(!1)}},ee=async()=>{try{v(!0);const de=await lo.startCopilotAuth();y(de),C(!0)}catch(de){vn.error(e("settings.providerTab.startCopilotAuthFailed")),console.error("Failed to start Copilot authentication:",de)}finally{v(!1)}},Q=async()=>{if(b)try{w(!0),await lo.completeCopilotAuth({device_code:b.device_code,interval:b.interval||5,expires_in:b.expires_in}),vn.success(e("settings.providerTab.copilotAuthSuccess")),C(!1),y(null),await te()}catch(de){vn.error(e("settings.providerTab.completeAuthFailed")),console.error("Authentication completion failed:",de)}finally{w(!1)}},ae=async()=>{if(b)try{await Ko(b.user_code),O(!0),vn.success(e("settings.providerTab.userCodeCopied")),setTimeout(()=>O(!1),2e3)}catch{vn.error(`${e("settings.providerTab.copyCodeFailedPrefix")} ${b.user_code}`)}},oe=async()=>{try{v(!0),await lo.logoutCopilot(),vn.success(e("settings.providerTab.logoutSuccess")),await te()}catch(de){vn.error(e("settings.providerTab.logoutFailed")),console.error("Failed to logout:",de)}finally{v(!1)}},re=de=>{l(de),n.setFieldsValue({provider:de}),R([]),P(null),L(!1),D("idle"),F(null)},ie=de=>rGe(de)||de instanceof Error?de.message:e("settings.providerTab.unknownError"),ue=de=>{n.setFields([{name:["provider"],errors:[]},{name:["providers",de,"api_key"],errors:[]},{name:["providers",de,"model"],errors:[]}])},ge=de=>{const me=de.trim();return me?me.includes(".")?me.split(".").filter(Boolean):me==="provider"?["provider"]:me==="provider/providers"?["provider"]:null:null},Te=(de,me)=>{if(!de.length)return;const pe=de.map(Ae=>{const ye=ge(Ae.path);return ye?{name:ye,errors:[Ae.message]}:Ae.message.toLowerCase().includes("api key")?{name:["providers",me,"api_key"],errors:[Ae.message]}:{name:["provider"],errors:[Ae.message]}}).filter((Ae,ye,Ce)=>Ce.findIndex(Ee=>JSON.stringify(Ee.name)===JSON.stringify(Ae.name))===ye);pe.length&&n.setFields(pe)},Se=async de=>{var pe;const me=de.provider||s;ue(me);try{const ye=await Vi.getInstance().validateBambooConfigPatch({provider:de.provider,providers:de.providers||{}});if(ye.valid)return{valid:!0};const Ce=((pe=ye.errors)==null?void 0:pe.provider)||[];Te(Ce,me);const Ee=Ce[0];return{valid:!1,message:(Ee==null?void 0:Ee.message)||e("settings.providerTab.invalidConfig")}}catch(Ae){return console.warn("Config validation failed, falling back to save:",Ae),{valid:!0}}},fe=async(de,me)=>{const pe={openai:e("settings.providerTab.providerNames.openai"),anthropic:e("settings.providerTab.providerNames.anthropic"),gemini:e("settings.providerTab.providerNames.gemini"),copilot:e("settings.providerTab.providerNames.copilot")},Ae=e(de==="copilot"?"settings.providerTab.fetchModelsCopilotFailed":"settings.providerTab.fetchModelsFailed");if(!(!(me!=null&&me.force)&&$.length>0))try{M(!0),P(null),L(!0);const ye=de==="copilot"?await BE.getModels():await lo.fetchProviderModels(de),Ce=kxt(ye);if(R(Ce),de==="copilot"&&Ce.length===0){const Ee=e("settings.providerTab.noModelsReturned");P(Ee),(me==null?void 0:me.showMessage)!==!1&&vn.warning(Ee);return}(me==null?void 0:me.showMessage)!==!1&&vn.success(e("settings.providerTab.foundModels",{count:Ce.length}))}catch(ye){const Ce=ie(ye);P(Ce),(me==null?void 0:me.showMessage)!==!1&&vn.error(Ce?`${e("settings.providerTab.fetchModelsErrorPrefix")}: ${Ce}`:Ae),console.error(`Failed to fetch ${pe[de]} models:`,ye)}finally{M(!1)}},he=async(de,me)=>{try{a(!0);const pe={provider:de.provider,providers:de.providers||{}},Ae=await Se(de);if(!Ae.valid){const ye=Ae.message||e("settings.providerTab.invalidConfig");if((me==null?void 0:me.showMessage)!==!1&&vn.error(`${e("settings.providerTab.invalidConfigPrefix")}: ${ye}`),me!=null&&me.throwOnError)throw new Error(ye);return}console.log("Saving provider config:",pe),await lo.saveProviderConfig(pe),(me==null?void 0:me.showMessage)!==!1&&vn.success(e("settings.providerTab.saveConfigSuccess"))}catch(pe){const Ae=ie(pe);if((me==null?void 0:me.showMessage)!==!1&&vn.error(Ae?`${e("settings.providerTab.saveConfigErrorPrefix")}: ${Ae}`:e("settings.providerTab.saveConfigFailed")),console.error("Failed to save configuration:",pe),me!=null&&me.throwOnError)throw pe}finally{a(!1)}},ve=async de=>{try{o(!0);const{useProviderStore:me}=await Mn(async()=>{const{useProviderStore:pe}=await Promise.resolve().then(()=>sGe);return{useProviderStore:pe}},void 0,import.meta.url);await me.getState().loadProviderConfig(),(de==null?void 0:de.showMessage)!==!1&&vn.success(e("settings.providerTab.applyConfigSuccess"))}catch(me){const pe=ie(me);if((de==null?void 0:de.showMessage)!==!1&&vn.error(pe?`${e("settings.providerTab.applyConfigErrorPrefix")}: ${pe}`:e("settings.providerTab.applyConfigFailed")),console.error("Failed to apply configuration:",me),de!=null&&de.throwOnError)throw me}finally{o(!1)}},we=async de=>{try{await he(de,{throwOnError:!0}),await ve({throwOnError:!0})}catch{}},Re=async(de,me)=>{if(!(!(me!=null&&me.force)&&$.length>0)){try{const pe=n.getFieldsValue(!0);await he(pe,{showMessage:!1,throwOnError:!0})}catch(pe){const Ae=ie(pe);P(Ae),L(!0),vn.error(Ae?`${e("settings.providerTab.saveConfigErrorPrefix")}: ${Ae}`:e("settings.providerTab.saveConfigFailed"));return}await fe(de,{force:me==null?void 0:me.force})}},ce=async(de,me)=>{me&&(I||$.length>0||N&&A||await Re(de))},xe=async(de,me)=>{if(me&&j!=="saving"){D("saving"),F(null);try{const pe=n.getFieldsValue(!0);pe.providers=pe.providers||{},pe.providers[de]={...pe.providers[de],model:me},await he(pe,{showMessage:!1,throwOnError:!0}),await ve({showMessage:!1,throwOnError:!0}),D("success"),vn.success(e("settings.providerTab.modelUpdated"))}catch(pe){const Ae=ie(pe);D("error"),F(Ae),vn.error(Ae?`${e("settings.providerTab.updateModelErrorPrefix")}: ${Ae}`:e("settings.providerTab.updateModelFailed"))}}},Me=(de,me)=>E.jsxs(He,{direction:"vertical",size:4,children:[E.jsxs(He,{size:"small",children:[E.jsx(De,{type:"link",size:"small",onClick:()=>Re(de,{force:!0}),loading:I,style:{padding:0},children:I?e("settings.providerTab.fetchingModels"):$.length>0?e("settings.providerTab.refreshModelsFrom",{source:me}):e("settings.providerTab.fetchModelsFrom",{source:me})}),j==="saving"&&E.jsx(ia,{size:"small"}),j==="success"&&E.jsx(Hl,{style:{color:"#52c41a"}}),j==="error"&&E.jsx(wn,{title:H||e("settings.providerTab.saveModelChangeFailed"),children:E.jsx(cP,{style:{color:"#ff4d4f"}})})]}),A&&E.jsxs(He,{size:"small",children:[E.jsx(wn,{title:A,children:E.jsx(ss,{type:"danger",children:e("settings.providerTab.fetchModelsFailedShort")})}),E.jsx(De,{size:"small",onClick:()=>Re(de,{force:!0}),loading:I,children:e("settings.providerTab.retry")})]})]}),Ie=()=>{switch(s){case"openai":return E.jsxs(E.Fragment,{children:[E.jsx(fr,{message:e("settings.providerTab.openaiConfigTitle"),description:e("settings.providerTab.openaiConfigDescription"),type:"info",showIcon:!0,style:{marginBottom:16}}),E.jsx(wt.Item,{name:["providers","openai","api_key"],label:e("settings.providerTab.openaiApiKey"),rules:[{required:!0,message:e("settings.providerTab.openaiApiKeyRequired")}],children:E.jsx(tn.Password,{"data-testid":"api-key-input",placeholder:"sk-...",prefix:E.jsx(Uk,{})})}),E.jsx(wt.Item,{name:["providers","openai","base_url"],label:e("settings.providerTab.baseUrlOptional"),extra:e("settings.providerTab.openaiBaseUrlHelp"),children:E.jsx(tn,{placeholder:"https://api.openai.com/v1"})}),E.jsx(wt.Item,{name:["providers","openai","model"],label:e("settings.providerTab.defaultModel"),rules:[{required:!0,message:e("settings.providerTab.selectModelRequired")}],extra:Me("openai","API"),children:E.jsx(Jn,{placeholder:e("settings.providerTab.selectModel"),allowClear:!0,showSearch:!0,loading:I,disabled:j==="saving",notFoundContent:I?E.jsx(ia,{size:"small"}):null,onDropdownVisibleChange:de=>ce("openai",de),onChange:de=>xe("openai",de),children:($.length>0?$:wbe).map(de=>E.jsx(dm,{value:de.value,children:de.label},de.value))})}),E.jsx(wt.Item,{name:["providers","openai","responses_only_models"],label:e("settings.providerTab.responsesOnlyModelsOptional"),extra:ute(e),children:E.jsx(Jn,{mode:"tags",placeholder:'e.g. "gpt-5.3-codex", "gpt-5*"',tokenSeparators:[","," ",`
|
|
706
706
|
`," "]})})]});case"anthropic":return E.jsxs(E.Fragment,{children:[E.jsx(fr,{message:e("settings.providerTab.anthropicConfigTitle"),description:e("settings.providerTab.anthropicConfigDescription"),type:"info",showIcon:!0,style:{marginBottom:16}}),E.jsx(wt.Item,{name:["providers","anthropic","api_key"],label:e("settings.providerTab.anthropicApiKey"),rules:[{required:!0,message:e("settings.providerTab.anthropicApiKeyRequired")}],children:E.jsx(cte,{placeholder:"sk-ant-...",prefix:E.jsx(Uk,{})})}),E.jsx(wt.Item,{name:["providers","anthropic","base_url"],label:e("settings.providerTab.baseUrlOptional"),extra:e("settings.providerTab.anthropicBaseUrlHelp"),children:E.jsx(tn,{placeholder:"https://api.anthropic.com/v1"})}),E.jsx(wt.Item,{name:["providers","anthropic","model"],label:e("settings.providerTab.defaultModel"),rules:[{required:!0,message:e("settings.providerTab.selectModelRequired")}],extra:Me("anthropic","API"),children:E.jsx(Jn,{placeholder:e("settings.providerTab.selectModel"),allowClear:!0,showSearch:!0,loading:I,disabled:j==="saving",notFoundContent:I?E.jsx(ia,{size:"small"}):null,onDropdownVisibleChange:de=>ce("anthropic",de),onChange:de=>xe("anthropic",de),children:($.length>0?$:Cbe).map(de=>E.jsx(dm,{value:de.value,children:de.label},de.value))})}),E.jsx(wt.Item,{name:["providers","anthropic","max_tokens"],label:e("settings.providerTab.maxTokensOptional"),extra:e("settings.providerTab.maxTokensHelp"),children:E.jsx(tn,{type:"number",placeholder:"4096",min:1,max:1e5})})]});case"gemini":return E.jsxs(E.Fragment,{children:[E.jsx(fr,{message:e("settings.providerTab.geminiConfigTitle"),description:e("settings.providerTab.geminiConfigDescription"),type:"info",showIcon:!0,style:{marginBottom:16}}),E.jsx(wt.Item,{name:["providers","gemini","api_key"],label:e("settings.providerTab.geminiApiKey"),rules:[{required:!0,message:e("settings.providerTab.geminiApiKeyRequired")}],children:E.jsx(cte,{placeholder:"AIza...",prefix:E.jsx(Uk,{})})}),E.jsx(wt.Item,{name:["providers","gemini","base_url"],label:e("settings.providerTab.baseUrlOptional"),extra:e("settings.providerTab.geminiBaseUrlHelp"),children:E.jsx(tn,{placeholder:"https://generativelanguage.googleapis.com/v1beta"})}),E.jsx(wt.Item,{name:["providers","gemini","model"],label:e("settings.providerTab.defaultModel"),rules:[{required:!0,message:e("settings.providerTab.selectModelRequired")}],extra:Me("gemini","API"),children:E.jsx(Jn,{placeholder:e("settings.providerTab.selectModel"),allowClear:!0,showSearch:!0,loading:I,disabled:j==="saving",notFoundContent:I?E.jsx(ia,{size:"small"}):null,onDropdownVisibleChange:de=>ce("gemini",de),onChange:de=>xe("gemini",de),children:($.length>0?$:Ebe).map(de=>E.jsx(dm,{value:de.value,children:de.label},de.value))})})]});case"copilot":{const de=n.getFieldValue(["providers","copilot","model"]),me=$.length>0?$:de?[{value:de,label:de}]:[];return E.jsxs(E.Fragment,{children:[E.jsx(fr,{message:e("settings.providerTab.copilotConfigTitle"),description:e("settings.providerTab.copilotConfigDescription"),type:"info",showIcon:!0}),E.jsxs(Ot,{size:"small",style:{marginTop:16,marginBottom:16},title:e("settings.providerTab.authStatusTitle"),extra:h?E.jsx(ia,{size:"small"}):d!=null&&d.authenticated?E.jsx(Dn,{icon:E.jsx(Hl,{}),color:"success",children:e("settings.providerTab.authenticated")}):E.jsx(Dn,{icon:E.jsx(cP,{}),color:"error",children:e("settings.providerTab.notAuthenticated")}),children:[(d==null?void 0:d.message)&&E.jsx(GS,{type:"secondary",style:{marginBottom:16},children:d.message}),E.jsxs(He,{children:[d!=null&&d.authenticated?E.jsx(De,{danger:!0,icon:E.jsx(aVe,{}),onClick:oe,loading:m,children:e("settings.providerTab.logoutCopilot")}):E.jsx(De,{type:"primary",icon:E.jsx(nVe,{}),onClick:ee,loading:m,children:e("settings.providerTab.authenticateCopilot")}),E.jsx(De,{onClick:te,loading:h,children:e("settings.providerTab.refreshStatus")})]})]}),E.jsx(wt.Item,{name:["providers","copilot","headless_auth"],label:e("settings.providerTab.headlessAuth"),valuePropName:"checked",extra:e("settings.providerTab.headlessAuthHelp"),children:E.jsx(ba,{})}),E.jsx(wt.Item,{name:["providers","copilot","model"],label:e("settings.providerTab.defaultModel"),rules:[{required:!0,message:e("settings.providerTab.selectModelRequired")}],extra:Me("copilot","backend"),children:E.jsx(Jn,{placeholder:e("settings.providerTab.selectModel"),allowClear:!0,showSearch:!0,loading:I,disabled:j==="saving",notFoundContent:I?E.jsx(ia,{size:"small"}):E.jsx(ss,{type:"secondary",children:d!=null&&d.authenticated?e("settings.providerTab.noModelsLoaded"):e("settings.providerTab.authFirstThenFetch")}),onDropdownVisibleChange:pe=>ce("copilot",pe),onChange:pe=>xe("copilot",pe),children:me.map(pe=>E.jsx(dm,{value:pe.value,children:pe.label},pe.value))})}),E.jsx(wt.Item,{name:["providers","copilot","responses_only_models"],label:e("settings.providerTab.responsesOnlyModelsOptional"),extra:ute(e),children:E.jsx(Jn,{mode:"tags",placeholder:'e.g. "gpt-5.3-codex", "gpt-5*"',tokenSeparators:[","," ",`
|
|
707
707
|
`," "]})}),E.jsxs(GS,{type:"secondary",children:[e("settings.providerTab.copilotUsageTitle"),E.jsxs("ul",{style:{marginTop:8,marginBottom:0},children:[E.jsx("li",{children:e("settings.providerTab.copilotUsageStep1")}),E.jsx("li",{children:e("settings.providerTab.copilotUsageStep2")}),E.jsx("li",{children:e("settings.providerTab.copilotUsageStep3")})]})]})]})}default:return null}};return E.jsxs(Ot,{title:e("settings.providerTab.title"),loading:r&&!c,extra:E.jsxs(ss,{type:"secondary",children:[e("settings.providerTab.currentProvider"),":"," ",E.jsx(ss,{strong:!0,children:RR[s]})]}),children:[E.jsx(GS,{type:"secondary",children:e("settings.providerTab.description")}),E.jsx(nl,{}),E.jsxs(wt,{form:n,layout:"vertical",onFinish:we,disabled:r&&!c,children:[E.jsx(wt.Item,{name:"provider",label:e("settings.providerTab.activeProvider"),rules:[{required:!0,message:e("settings.providerTab.selectProviderRequired")}],children:E.jsx(Jn,{"data-testid":"provider-select",onChange:re,size:"large",children:Object.keys(RR).map(de=>E.jsx(dm,{value:de,children:RR[de]},de))})}),E.jsx(nl,{}),Ie(),E.jsx(nl,{}),E.jsx(He,{size:"middle",children:E.jsx(De,{"data-testid":"save-api-settings",type:"primary",htmlType:"submit",icon:E.jsx(jE,{}),loading:r||i,size:"large",children:e("settings.providerTab.saveAndApply")})})]}),E.jsx(qr,{title:e("settings.providerTab.copilotAuthModalTitle"),open:S,onCancel:()=>C(!1),footer:[E.jsx(De,{onClick:()=>C(!1),children:e("settings.providerTab.cancel")},"cancel"),E.jsx(De,{type:"primary",onClick:Q,loading:x,children:e("settings.providerTab.completedAuthorization")},"complete")],children:b&&E.jsxs(He,{direction:"vertical",size:"large",style:{width:"100%"},children:[E.jsx(fr,{message:e("settings.providerTab.browserOpened"),description:E.jsxs("ol",{children:[E.jsx("li",{children:e("settings.providerTab.authStep1")}),E.jsx("li",{children:e("settings.providerTab.authStep2")}),E.jsx("li",{children:e("settings.providerTab.authStep3")})]}),type:"info"}),E.jsx(Ot,{size:"small",children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(ss,{type:"secondary",children:e("settings.providerTab.visitUrl")}),E.jsx(He,{children:E.jsx(ss,{copyable:{text:b.verification_uri},children:b.verification_uri})})]})}),E.jsx(Ot,{style:{textAlign:"center",background:t.colorFillTertiary,borderColor:t.colorBorderSecondary},children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},children:[E.jsx(ss,{type:"secondary",children:e("settings.providerTab.enterCode")}),E.jsxs(He,{children:[E.jsx(ss,{style:{color:t.colorText,fontSize:"32px",fontFamily:"monospace",fontWeight:"bold",letterSpacing:"4px"},children:b.user_code}),E.jsx(De,{icon:k?E.jsx(Hl,{}):E.jsx(Go,{}),onClick:ae,type:k?"default":"primary",children:e(k?"settings.providerTab.copied":"settings.providerTab.copyCode")})]}),E.jsx("div",{style:{marginTop:8},children:E.jsxs(Dn,{color:_<60?"red":_<180?"orange":"green",children:["⏱️ Expires in ",Math.floor(_/60),":",(_%60).toString().padStart(2,"0")]})})]})}),E.jsx(GS,{type:"secondary",children:e("settings.providerTab.afterContinueHint")})]})})]})},{Text:dte}=Qt,$xt=({skill:e})=>{const{token:t}=pn.useToken();return E.jsx(Ot,{title:E.jsxs(He,{size:t.marginXS,wrap:!0,children:[E.jsx("span",{children:e.name}),e.license&&E.jsxs(Dn,{color:"blue",children:["License: ",e.license]})]}),styles:{body:{padding:t.paddingMD}},children:E.jsxs(He,{direction:"vertical",size:t.marginXS,style:{width:"100%"},children:[E.jsx(dte,{type:"secondary",children:e.description}),e.compatibility&&E.jsxs(dte,{type:"secondary",children:["Compatibility: ",e.compatibility]}),e.tool_refs.length>0&&E.jsx(He,{size:t.marginXXS,wrap:!0,children:e.tool_refs.map(n=>E.jsx(Dn,{children:n},n))})]})})},Ixt=3e4,Axt=()=>{const e=Ue(f=>f.skills),t=Ue(f=>f.isLoadingSkills),n=Ue(f=>f.skillsError),r=Ue(f=>f.loadSkills),a=Ue(f=>f.clearSkillsError),[i,o]=p.useState(""),[s,l]=p.useState(new Date);p.useEffect(()=>{r(void 0,!0);const f=setInterval(()=>{r(void 0,!0),l(new Date)},Ixt);return()=>clearInterval(f)},[r]),p.useEffect(()=>{const f=()=>{r(void 0,!0),l(new Date)};return window.addEventListener("focus",f),()=>window.removeEventListener("focus",f)},[r]);const c=p.useCallback(async()=>{await r(void 0,!0),l(new Date),vn.success("Skills refreshed")},[r]);p.useEffect(()=>{n&&(vn.error(n),a())},[n,a]);const u=e.filter(f=>{const h=i.trim().toLowerCase();return!(h&&![f.name,f.description,f.license??"",f.compatibility??"",...f.tool_refs].join(" ").toLowerCase().includes(h))}),d=()=>{const h=new Date().getTime()-s.getTime(),g=Math.floor(h/1e3);if(g<5)return"just now";if(g<60)return`${g}s ago`;const m=Math.floor(g/60);return m<60?`${m}m ago`:s.toLocaleTimeString()};return E.jsx("div",{style:{padding:"24px"},children:E.jsxs(Ot,{title:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[E.jsx("span",{children:"Skill Manager"}),E.jsx(De,{icon:E.jsx(Zl,{spin:t}),onClick:c,loading:t,size:"small",children:"Refresh"}),E.jsxs("span",{style:{fontSize:"12px",color:"#8c8c8c",marginLeft:"auto"},children:["Last updated: ",d()]})]}),children:[E.jsx("div",{style:{marginBottom:"16px",color:"#8c8c8c"},children:"Skills are read-only. Edit `~/.bamboo/skills/<skill-name>/SKILL.md` and refresh to apply changes. Auto-refresh every 30s."}),E.jsx(gs,{style:{marginBottom:"24px"},children:E.jsx(tn,{placeholder:"Search skills...",prefix:E.jsx(_Ve,{}),value:i,onChange:f=>o(f.target.value),allowClear:!0})}),E.jsx(ia,{spinning:t,children:u.length===0?E.jsx(va,{description:i?"No skills match your filters":"No skills found. Add skill folders in ~/.bamboo/skills"}):E.jsx(jr,{grid:{gutter:16,xs:1,sm:2,md:3,lg:3,xl:4},dataSource:u,renderItem:f=>E.jsx(jr.Item,{children:E.jsx($xt,{skill:f})})})})]})})},{Title:Rxt,Text:MR,Paragraph:Mxt}=Qt,fte="model_limits",hD="modelLimitsConfigs",pte="defaultBudgetStrategy",Ro=1e3;function fm(e){return[{vendor:"OpenAI (GPT-5)",model_pattern:"gpt-5.4-thinking",max_context_tokens:1e6,max_output_tokens:128e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt54")},{vendor:"OpenAI (GPT-5)",model_pattern:"gpt-5.3-codex",max_context_tokens:1e6,max_output_tokens:128e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt53Codex")},{vendor:"OpenAI (GPT-5)",model_pattern:"gpt-5.2-pro",max_context_tokens:256e3,max_output_tokens:64e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt52Pro")},{vendor:"OpenAI (GPT-5)",model_pattern:"gpt-5-mini",max_context_tokens:4e5,max_output_tokens:128e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt5Mini")},{vendor:"OpenAI (Legacy)",model_pattern:"gpt-4.1",max_context_tokens:1e6,max_output_tokens:32e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt41")},{vendor:"OpenAI (Legacy)",model_pattern:"gpt-4o",max_context_tokens:128e3,max_output_tokens:16e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gpt4o")},{vendor:"Google",model_pattern:"gemini-2.5-pro",max_context_tokens:1e6,max_output_tokens:64e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.gemini25Pro")},{vendor:"Moonshot",model_pattern:"kimi-k2.5",max_context_tokens:256e3,max_output_tokens:64e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.kimiK25")},{vendor:"Moonshot",model_pattern:"kimi-for-coding",max_context_tokens:256e3,max_output_tokens:64e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.kimiCoding")},{vendor:"Zhipu",model_pattern:"glm-5",max_context_tokens:2e5,max_output_tokens:128e3,safety_margin:Ro,note:e("settings.modelLimits.defaults.glm5")}]}function hte(e,t){if(typeof e!="number"||!Number.isFinite(e))return t;const n=Math.floor(e);return n>0?n:t}function Pxt(e,t){if(typeof e!="number"||!Number.isFinite(e))return t;const n=Math.floor(e);return n>=0?n:t}function Nxt(e){if(!e||typeof e!="object")return null;const t=e,n=t.model_pattern??t.model;if(typeof n!="string"||!n.trim())return null;const r=hte(t.max_context_tokens??t.maxContextTokens,128e3),a=hte(t.max_output_tokens??t.maxOutputTokens,Math.min(4096,Math.floor(r/4))),i=Pxt(t.safety_margin??t.safetyMargin,Ro);return{vendor:typeof t.vendor=="string"&&t.vendor.trim()?t.vendor.trim():"",model_pattern:n.trim(),max_context_tokens:r,max_output_tokens:a,safety_margin:i,note:typeof t.note=="string"?t.note:""}}function _be(e){return Array.isArray(e)?e.map(t=>Nxt(t)).filter(t=>!!t):[]}function Lxt(){const e=localStorage.getItem(hD);if(!e)return[];try{const t=JSON.parse(e);return _be(t)}catch{return[]}}function Dxt(e){const t=Object.prototype.hasOwnProperty.call(e,fte);return t?{hasModelLimitsKey:t,modelLimits:_be(e[fte])}:{hasModelLimitsKey:!1,modelLimits:[]}}function jxt(e,t){if(e.length===0)return t("settings.modelLimits.validation.atLeastOneRow");const n=new Set;for(const r of e){const a=r.model_pattern.trim();if(!a)return t("settings.modelLimits.validation.modelPatternEmpty");const i=a.toLowerCase();if(n.has(i))return t("settings.modelLimits.validation.duplicateModelPattern",{pattern:a});if(n.add(i),r.max_context_tokens<1e3)return t("settings.modelLimits.validation.contextWindowMin",{pattern:a});if(r.max_output_tokens<1)return t("settings.modelLimits.validation.maxOutputMin",{pattern:a});if(r.max_output_tokens>r.max_context_tokens)return t("settings.modelLimits.validation.maxOutputExceedsContext",{pattern:a});if(r.safety_margin<0)return t("settings.modelLimits.validation.safetyMarginNegative",{pattern:a});if(r.safety_margin>=r.max_context_tokens)return t("settings.modelLimits.validation.safetyMarginTooLarge",{pattern:a})}return null}const Bxt=()=>{const{t:e}=br(),[t,n]=p.useState(()=>fm(e)),[r,a]=p.useState(!1),[i,o]=vn.useMessage(),s=p.useCallback((g,m)=>{n(v=>v.map((b,y)=>y===g?{...b,...m}:b))},[]),l=p.useCallback(()=>{n(g=>[...g,{vendor:"",model_pattern:"",max_context_tokens:128e3,max_output_tokens:4096,safety_margin:Ro,note:""}])},[]),c=p.useCallback(g=>{n(m=>m.filter((v,b)=>b!==g))},[]),u=p.useCallback(async()=>{a(!0);try{const g=await Dr.getBambooConfig(),{hasModelLimitsKey:m,modelLimits:v}=Dxt(g);if(v.length>0){n(v);return}if(m){n(fm(e));return}const b=Lxt();if(b.length>0){await Dr.setBambooConfig({model_limits:b}),localStorage.removeItem(hD),localStorage.removeItem(pte),n(b),i.info(e("settings.modelLimits.migratedFromLocalStorage"));return}n(fm(e))}catch(g){console.error("Failed to load model limits settings:",g),i.error(e("settings.modelLimits.loadFailed")),n(fm(e))}finally{a(!1)}},[i,e]);p.useEffect(()=>{u()},[u]);const d=async()=>{const g=jxt(t,e);if(g){i.error(g);return}a(!0);try{await Dr.setBambooConfig({model_limits:t}),i.success(e("settings.modelLimits.saveSuccess"))}catch(m){console.error("Failed to save model limits settings:",m),i.error(e("settings.modelLimits.saveFailed"))}finally{a(!1)}},f=async()=>{const g=fm(e);a(!0);try{await Dr.setBambooConfig({model_limits:g}),n(g),localStorage.removeItem(hD),localStorage.removeItem(pte),i.success(e("settings.modelLimits.resetSuccess"))}catch(m){console.error("Failed to reset model limits settings:",m),i.error(e("settings.modelLimits.resetFailed"))}finally{a(!1)}},h=p.useMemo(()=>[{title:e("settings.modelLimits.columns.vendor"),dataIndex:"vendor",key:"vendor",width:170,render:(g,m,v)=>E.jsx(tn,{value:g,placeholder:e("settings.modelLimits.placeholders.vendor"),onChange:b=>s(v,{vendor:b.target.value})})},{title:e("settings.modelLimits.columns.model"),dataIndex:"model_pattern",key:"model_pattern",width:220,render:(g,m,v)=>E.jsx(tn,{value:g,placeholder:e("settings.modelLimits.placeholders.model"),onChange:b=>s(v,{model_pattern:b.target.value})})},{title:e("settings.modelLimits.columns.contextWindow"),dataIndex:"max_context_tokens",key:"max_context_tokens",width:180,render:(g,m,v)=>E.jsx(ui,{value:g,onChange:b=>s(v,{max_context_tokens:Math.max(1e3,Number(b)||128e3)}),min:1e3,max:2e6,step:1e3,style:{width:"100%"}})},{title:e("settings.modelLimits.columns.maxOutput"),dataIndex:"max_output_tokens",key:"max_output_tokens",width:160,render:(g,m,v)=>E.jsx(ui,{value:g,onChange:b=>s(v,{max_output_tokens:Math.max(1,Number(b)||4096)}),min:1,max:2e6,step:256,style:{width:"100%"}})},{title:e("settings.modelLimits.columns.notes"),dataIndex:"note",key:"note",width:240,render:(g,m,v)=>E.jsx(tn,{value:g,placeholder:e("settings.modelLimits.placeholders.optional"),onChange:b=>s(v,{note:b.target.value})})},{title:e("settings.modelLimits.columns.actions"),key:"actions",width:100,render:(g,m,v)=>E.jsx(De,{danger:!0,size:"small",onClick:()=>c(v),children:e("settings.modelLimits.actions.remove")})}],[c,e,s]);return E.jsxs("div",{className:"model-limits-settings",children:[o,E.jsxs(Ot,{children:[E.jsx(Rxt,{level:4,children:e("settings.modelLimits.title")}),E.jsxs(Mxt,{type:"secondary",children:[e("settings.modelLimits.descriptionPrefix")," ",E.jsx(MR,{code:!0,children:"config.json"})," ",e("settings.modelLimits.descriptionSuffix")]}),E.jsx(nl,{}),E.jsxs(He,{direction:"vertical",size:"small",style:{width:"100%"},children:[E.jsx(MR,{strong:!0,children:e("settings.modelLimits.defaultsTitle")}),E.jsx(MR,{type:"secondary",children:e("settings.modelLimits.defaultsDescription")})]}),E.jsx(Bi,{dataSource:t,columns:h,rowKey:(g,m)=>`${g.model_pattern}-${m}`,pagination:!1,size:"small",style:{margin:"16px 0"},scroll:{x:1150}}),E.jsxs(He,{children:[E.jsx(De,{onClick:l,children:e("settings.modelLimits.actions.addRow")}),E.jsx(De,{type:"primary",icon:E.jsx(jE,{}),onClick:()=>void d(),loading:r,children:e("settings.modelLimits.actions.save")}),E.jsx(De,{icon:E.jsx(Zl,{}),onClick:()=>void f(),loading:r,children:e("settings.modelLimits.actions.resetToDefaults")}),E.jsx(De,{onClick:()=>void u(),loading:r,children:e("settings.modelLimits.actions.reload")})]})]})]})},{Text:gte}=Qt,{useToken:Fxt}=pn,zxt="bamboo_dark_mode",Hxt=({themeMode:e,onThemeModeChange:t,locale:n,onLocaleChange:r,onBack:a})=>{const{t:i}=br(),{token:o}=Fxt(),{deleteAllChats:s,autoGenerateTitles:l,setAutoGenerateTitlesPreference:c,isUpdatingAutoTitlePreference:u}=irt(),[d,f]=p.useState(!1),[h,g]=vn.useMessage(),[m,v]=p.useState(""),[b,y]=p.useState(LN()),[S,C]=p.useState(jN()),[x,w]=p.useState(BN()),T=Ho(j=>j.currentProvider)==="copilot",k=o.paddingSM,O=(j,D)=>({key:j,label:E.jsx(gte,{type:"secondary",style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",cursor:"default",userSelect:"none"},children:D}),disabled:!0,children:null}),I=(j,D)=>E.jsx("span",{"data-testid":`settings-tab-${j}`,children:D}),M=()=>{localStorage.clear(),h.success(i("settings.notifications.localStorageCleared"))},$=async()=>{f(!0);try{await s(),await Dr.resetSetupStatus(),await Dr.resetBambooConfig(),localStorage.clear(),h.success(i("settings.notifications.resetSuccessReloading")),setTimeout(()=>{window.location.reload()},1500)}catch(j){console.error("Failed to reset application:",j),h.error(j instanceof Error?j.message:i("settings.notifications.resetFailed")),f(!1)}},R=async j=>{try{await c(j),h.success(i(j?"settings.notifications.autoTitleEnabled":"settings.notifications.autoTitleDisabled"))}catch{h.error(i("settings.notifications.autoTitleUpdateFailed"))}},A=()=>{trt(m),h.success(i("settings.notifications.promptEnhancementSaved"))},P=j=>{y(j),Wnt(j)},N=j=>{C(j),Gnt(j)},L=j=>{w(j),Znt(j)};return p.useEffect(()=>{v(Nhe()),y(LN()),C(jN()),w(BN())},[]),E.jsxs(rt,{vertical:!0,style:{height:"100vh",overflow:"hidden",background:o.colorBgContainer},children:[g,E.jsx(rt,{align:"center",justify:"space-between",style:{padding:o.padding,paddingTop:o.padding+k,borderBottom:`1px solid ${o.colorBorderSecondary}`},children:E.jsxs(rt,{align:"center",gap:o.marginSM,children:[E.jsx(De,{icon:E.jsx(i7e,{}),onClick:a,children:i("settings.page.back")}),E.jsx(gte,{strong:!0,"data-testid":"settings-page-title",children:i("settings.page.title")})]})}),E.jsx(Cs.Content,{style:{flex:1,minHeight:0,overflow:"auto",padding:o.padding},children:E.jsx(Gp,{tabPosition:"left",defaultActiveKey:"provider",items:[O("group-ai",i("settings.page.groups.ai")),{key:"provider",label:I("provider",i("settings.page.tabs.provider")),children:E.jsx(Oxt,{})},{key:"model-limits",label:I("model-limits",i("settings.page.tabs.modelLimits")),children:E.jsx(Bxt,{})},{key:"prompts",label:I("prompts",i("settings.page.tabs.prompts")),children:E.jsx(xrt,{promptEnhancement:m,onPromptEnhancementChange:v,mermaidEnhancementEnabled:b,taskEnhancementEnabled:S,showCopilotAskUserEnhancement:T,copilotAskUserEnhancementEnabled:x,onMermaidToggle:P,onTaskToggle:N,onCopilotAskUserToggle:L,onSaveEnhancement:A})},O("group-tools",i("settings.page.groups.toolsAndExtensions")),{key:"skills",label:I("skills",i("settings.page.tabs.skills")),children:E.jsx(Axt,{})},{key:"mcp",label:I("mcp",i("settings.page.tabs.mcp")),children:E.jsx(fat,{})},{key:"workflows",label:I("workflows",i("settings.page.tabs.workflows")),children:E.jsx(Irt,{})},{key:"hooks",label:I("hooks",i("settings.page.tabs.hooks")),children:E.jsx(Cxt,{})},O("group-security",i("settings.page.groups.securityAndPrivacy")),{key:"masking",label:I("masking",i("settings.page.tabs.masking")),children:E.jsx(Trt,{})},O("group-monitoring",i("settings.page.groups.monitoring")),{key:"metrics",label:I("metrics",i("settings.page.tabs.metrics")),children:E.jsx(yxt,{})},{key:"sessions",label:I("sessions",i("settings.page.tabs.sessions")),children:E.jsx(_xt,{})},O("group-system",i("settings.page.groups.system")),{key:"config",label:I("config",i("settings.page.tabs.config")),children:E.jsx(prt,{msgApi:h,locale:n,onLocaleChange:r})},{key:"schedules",label:I("schedules",i("settings.page.tabs.schedules")),children:E.jsx(Ext,{})},{key:"app",label:I("app",i("settings.page.tabs.app")),children:E.jsx(Crt,{autoGenerateTitles:l,isUpdatingAutoTitlePreference:u,onAutoTitleToggle:R,themeMode:e,onThemeModeChange:t,onClearLocalStorage:M,onResetApp:$,isResetting:d,darkModeKey:zxt})}]})})]})},Uxt=()=>{const e=Ue(a=>a.chats),t=Ue(a=>a.updateSession),{generateChatTitle:n}=Z8({chats:e,updateSession:t}),r=p.useRef(new Map);return p.useEffect(()=>{e.forEach(a=>{const i=a.id,o=a.messages;if(o.length===0)return;const s=o[o.length-1];if(s.role!=="assistant")return;const l=r.current.get(i);s.id!==l&&(r.current.set(i,s.id),n(i).catch(c=>{console.warn("Auto title generation failed for chat",i,":",c)}))})},[e,n]),p.useEffect(()=>{const a=new Set(e.map(o=>o.id));Array.from(r.current.keys()).forEach(o=>{a.has(o)||r.current.delete(o)})},[e]),null};var mte={name:"mermaid",version:"11.12.3",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.23",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},Tbe=Object.defineProperty,W=(e,t)=>Tbe(e,"name",{value:t,configurable:!0}),Wxt=(e,t)=>{for(var n in t)Tbe(e,n,{get:t[n],enumerable:!0})},kl={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},et={trace:W((...e)=>{},"trace"),debug:W((...e)=>{},"debug"),info:W((...e)=>{},"info"),warn:W((...e)=>{},"warn"),error:W((...e)=>{},"error"),fatal:W((...e)=>{},"fatal")},vH=W(function(e="fatal"){let t=kl.fatal;typeof e=="string"?e.toLowerCase()in kl&&(t=kl[e]):typeof e=="number"&&(t=e),et.trace=()=>{},et.debug=()=>{},et.info=()=>{},et.warn=()=>{},et.error=()=>{},et.fatal=()=>{},t<=kl.fatal&&(et.fatal=console.error?console.error.bind(console,Oo("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Oo("FATAL"))),t<=kl.error&&(et.error=console.error?console.error.bind(console,Oo("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Oo("ERROR"))),t<=kl.warn&&(et.warn=console.warn?console.warn.bind(console,Oo("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Oo("WARN"))),t<=kl.info&&(et.info=console.info?console.info.bind(console,Oo("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Oo("INFO"))),t<=kl.debug&&(et.debug=console.debug?console.debug.bind(console,Oo("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Oo("DEBUG"))),t<=kl.trace&&(et.trace=console.debug?console.debug.bind(console,Oo("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Oo("TRACE")))},"setLogLevel"),Oo=W(e=>`%c${Ti().format("ss.SSS")} : ${e} : `,"format");const Kx={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),hsl2rgb:({h:e,s:t,l:n},r)=>{if(!t)return n*2.55;e/=360,t/=100,n/=100;const a=n<.5?n*(1+t):n+t-n*t,i=2*n-a;switch(r){case"r":return Kx.hue2rgb(i,a,e+1/3)*255;case"g":return Kx.hue2rgb(i,a,e)*255;case"b":return Kx.hue2rgb(i,a,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:n},r)=>{e/=255,t/=255,n/=255;const a=Math.max(e,t,n),i=Math.min(e,t,n),o=(a+i)/2;if(r==="l")return o*100;if(a===i)return 0;const s=a-i,l=o>.5?s/(2-a-i):s/(a+i);if(r==="s")return l*100;switch(a){case e:return((t-n)/s+(t<n?6:0))*60;case t:return((n-e)/s+2)*60;case n:return((e-t)/s+4)*60;default:return-1}}},qxt={clamp:(e,t,n)=>t>n?Math.min(t,Math.max(n,e)):Math.min(n,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},Vxt={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},kn={channel:Kx,lang:qxt,unit:Vxt},Oc={};for(let e=0;e<=255;e++)Oc[e]=kn.unit.dec2hex(e);const si={ALL:0,RGB:1,HSL:2};class Gxt{constructor(){this.type=si.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=si.ALL}is(t){return this.type===t}}class Kxt{constructor(t,n){this.color=n,this.changed=!1,this.data=t,this.type=new Gxt}set(t,n){return this.color=n,this.changed=!1,this.data=t,this.type.type=si.ALL,this}_ensureHSL(){const t=this.data,{h:n,s:r,l:a}=t;n===void 0&&(t.h=kn.channel.rgb2hsl(t,"h")),r===void 0&&(t.s=kn.channel.rgb2hsl(t,"s")),a===void 0&&(t.l=kn.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r:n,g:r,b:a}=t;n===void 0&&(t.r=kn.channel.hsl2rgb(t,"r")),r===void 0&&(t.g=kn.channel.hsl2rgb(t,"g")),a===void 0&&(t.b=kn.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,n=t.r;return!this.type.is(si.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,n=t.g;return!this.type.is(si.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,n=t.b;return!this.type.is(si.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,n=t.h;return!this.type.is(si.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,n=t.s;return!this.type.is(si.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,n=t.l;return!this.type.is(si.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(si.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(si.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(si.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(si.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(si.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(si.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const K_=new Kxt({r:0,g:0,b:0,a:0},"transparent"),Ip={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Ip.re);if(!t)return;const n=t[1],r=parseInt(n,16),a=n.length,i=a%4===0,o=a>4,s=o?1:17,l=o?8:4,c=i?0:-1,u=o?255:15;return K_.set({r:(r>>l*(c+3)&u)*s,g:(r>>l*(c+2)&u)*s,b:(r>>l*(c+1)&u)*s,a:i?(r&u)*s/255:1},e)},stringify:e=>{const{r:t,g:n,b:r,a}=e;return a<1?`#${Oc[Math.round(t)]}${Oc[Math.round(n)]}${Oc[Math.round(r)]}${Oc[Math.round(a*255)]}`:`#${Oc[Math.round(t)]}${Oc[Math.round(n)]}${Oc[Math.round(r)]}`}},ld={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(ld.hueRe);if(t){const[,n,r]=t;switch(r){case"grad":return kn.channel.clamp.h(parseFloat(n)*.9);case"rad":return kn.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return kn.channel.clamp.h(parseFloat(n)*360)}}return kn.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const n=e.match(ld.re);if(!n)return;const[,r,a,i,o,s]=n;return K_.set({h:ld._hue2deg(r),s:kn.channel.clamp.s(parseFloat(a)),l:kn.channel.clamp.l(parseFloat(i)),a:o?kn.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:t,s:n,l:r,a}=e;return a<1?`hsla(${kn.lang.round(t)}, ${kn.lang.round(n)}%, ${kn.lang.round(r)}%, ${a})`:`hsl(${kn.lang.round(t)}, ${kn.lang.round(n)}%, ${kn.lang.round(r)}%)`}},ub={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ub.colors[e];if(t)return Ip.parse(t)},stringify:e=>{const t=Ip.stringify(e);for(const n in ub.colors)if(ub.colors[n]===t)return n}},Iv={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const n=e.match(Iv.re);if(!n)return;const[,r,a,i,o,s,l,c,u]=n;return K_.set({r:kn.channel.clamp.r(a?parseFloat(r)*2.55:parseFloat(r)),g:kn.channel.clamp.g(o?parseFloat(i)*2.55:parseFloat(i)),b:kn.channel.clamp.b(l?parseFloat(s)*2.55:parseFloat(s)),a:c?kn.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:n,b:r,a}=e;return a<1?`rgba(${kn.lang.round(t)}, ${kn.lang.round(n)}, ${kn.lang.round(r)}, ${kn.lang.round(a)})`:`rgb(${kn.lang.round(t)}, ${kn.lang.round(n)}, ${kn.lang.round(r)})`}},dl={format:{keyword:ub,hex:Ip,rgb:Iv,rgba:Iv,hsl:ld,hsla:ld},parse:e=>{if(typeof e!="string")return e;const t=Ip.parse(e)||Iv.parse(e)||ld.parse(e)||ub.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(si.HSL)||e.data.r===void 0?ld.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Iv.stringify(e):Ip.stringify(e)},kbe=(e,t)=>{const n=dl.parse(e);for(const r in t)n[r]=kn.channel.clamp[r](t[r]);return dl.stringify(n)},db=(e,t,n=0,r=1)=>{if(typeof e!="number")return kbe(e,{a:t});const a=K_.set({r:kn.channel.clamp.r(e),g:kn.channel.clamp.g(t),b:kn.channel.clamp.b(n),a:kn.channel.clamp.a(r)});return dl.stringify(a)},Yxt=e=>{const{r:t,g:n,b:r}=dl.parse(e),a=.2126*kn.channel.toLinear(t)+.7152*kn.channel.toLinear(n)+.0722*kn.channel.toLinear(r);return kn.lang.round(a)},Xxt=e=>Yxt(e)>=.5,_0=e=>!Xxt(e),Obe=(e,t,n)=>{const r=dl.parse(e),a=r[t],i=kn.channel.clamp[t](a+n);return a!==i&&(r[t]=i),dl.stringify(r)},Ht=(e,t)=>Obe(e,"l",t),Jt=(e,t)=>Obe(e,"l",-t),Pe=(e,t)=>{const n=dl.parse(e),r={};for(const a in t)t[a]&&(r[a]=n[a]+t[a]);return kbe(e,r)},Zxt=(e,t,n=50)=>{const{r,g:a,b:i,a:o}=dl.parse(e),{r:s,g:l,b:c,a:u}=dl.parse(t),d=n/100,f=d*2-1,h=o-u,m=((f*h===-1?f:(f+h)/(1+f*h))+1)/2,v=1-m,b=r*m+s*v,y=a*m+l*v,S=i*m+c*v,C=o*d+u*(1-d);return db(b,y,S,C)},At=(e,t=100)=>{const n=dl.parse(e);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,Zxt(n,e,t)};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:$be,setPrototypeOf:vte,isFrozen:Qxt,getPrototypeOf:Jxt,getOwnPropertyDescriptor:ewt}=Object;let{freeze:Li,seal:Xo,create:gD}=Object,{apply:mD,construct:vD}=typeof Reflect<"u"&&Reflect;Li||(Li=function(t){return t});Xo||(Xo=function(t){return t});mD||(mD=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];return t.apply(n,a)});vD||(vD=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const KS=Di(Array.prototype.forEach),twt=Di(Array.prototype.lastIndexOf),bte=Di(Array.prototype.pop),pm=Di(Array.prototype.push),nwt=Di(Array.prototype.splice),Yx=Di(String.prototype.toLowerCase),PR=Di(String.prototype.toString),NR=Di(String.prototype.match),hm=Di(String.prototype.replace),rwt=Di(String.prototype.indexOf),awt=Di(String.prototype.trim),is=Di(Object.prototype.hasOwnProperty),Ei=Di(RegExp.prototype.test),gm=iwt(TypeError);function Di(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return mD(e,t,r)}}function iwt(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return vD(e,n)}}function Gn(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yx;vte&&vte(e,null);let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(Qxt(t)||(t[r]=i),a=i)}e[a]=!0}return e}function owt(e){for(let t=0;t<e.length;t++)is(e,t)||(e[t]=null);return e}function qs(e){const t=gD(null);for(const[n,r]of $be(e))is(e,n)&&(Array.isArray(r)?t[n]=owt(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=qs(r):t[n]=r);return t}function mm(e,t){for(;e!==null;){const r=ewt(e,t);if(r){if(r.get)return Di(r.get);if(typeof r.value=="function")return Di(r.value)}e=Jxt(e)}function n(){return null}return n}const yte=Li(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),LR=Li(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),DR=Li(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),swt=Li(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),jR=Li(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),lwt=Li(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ste=Li(["#text"]),xte=Li(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),BR=Li(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wte=Li(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),YS=Li(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),cwt=Xo(/\{\{[\w\W]*|[\w\W]*\}\}/gm),uwt=Xo(/<%[\w\W]*|[\w\W]*%>/gm),dwt=Xo(/\$\{[\w\W]*/gm),fwt=Xo(/^data-[\-\w.\u00B7-\uFFFF]+$/),pwt=Xo(/^aria-[\-\w]+$/),Ibe=Xo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hwt=Xo(/^(?:\w+script|data):/i),gwt=Xo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Abe=Xo(/^html$/i),mwt=Xo(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cte=Object.freeze({__proto__:null,ARIA_ATTR:pwt,ATTR_WHITESPACE:gwt,CUSTOM_ELEMENT:mwt,DATA_ATTR:fwt,DOCTYPE_NAME:Abe,ERB_EXPR:uwt,IS_ALLOWED_URI:Ibe,IS_SCRIPT_OR_DATA:hwt,MUSTACHE_EXPR:cwt,TMPLIT_EXPR:dwt});const vm={element:1,text:3,progressingInstruction:7,comment:8,document:9},vwt=function(){return typeof window>"u"?null:window},bwt=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ete=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rbe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vwt();const t=it=>Rbe(it);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==vm.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,a=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:h}=e,g=l.prototype,m=mm(g,"cloneNode"),v=mm(g,"remove"),b=mm(g,"nextSibling"),y=mm(g,"childNodes"),S=mm(g,"parentNode");if(typeof o=="function"){const it=n.createElement("template");it.content&&it.content.ownerDocument&&(n=it.content.ownerDocument)}let C,x="";const{implementation:w,createNodeIterator:_,createDocumentFragment:T,getElementsByTagName:k}=n,{importNode:O}=r;let I=Ete();t.isSupported=typeof $be=="function"&&typeof S=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:$,TMPLIT_EXPR:R,DATA_ATTR:A,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:j}=Cte;let{IS_ALLOWED_URI:D}=Cte,H=null;const F=Gn({},[...yte,...LR,...DR,...jR,...Ste]);let B=null;const z=Gn({},[...xte,...BR,...wte,...YS]);let G=Object.seal(gD(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,Z=null;const q=Object.seal(gD(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Y=!0,te=!0,ee=!1,Q=!0,ae=!1,oe=!0,re=!1,ie=!1,ue=!1,ge=!1,Te=!1,Se=!1,fe=!0,he=!1;const ve="user-content-";let we=!0,Re=!1,ce={},xe=null;const Me=Gn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ie=null;const de=Gn({},["audio","video","img","source","image","track"]);let me=null;const pe=Gn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ae="http://www.w3.org/1998/Math/MathML",ye="http://www.w3.org/2000/svg",Ce="http://www.w3.org/1999/xhtml";let Ee=Ce,_e=!1,je=null;const Ne=Gn({},[Ae,ye,Ce],PR);let tt=Gn({},["mi","mo","mn","ms","mtext"]),ct=Gn({},["annotation-xml"]);const Ke=Gn({},["title","style","font","a","script"]);let Ze=null;const ut=["application/xhtml+xml","text/html"],Je="text/html";let qe=null,Qe=null;const Oe=n.createElement("form"),Fe=function(be){return be instanceof RegExp||be instanceof Function},nt=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Qe&&Qe===be)){if((!be||typeof be!="object")&&(be={}),be=qs(be),Ze=ut.indexOf(be.PARSER_MEDIA_TYPE)===-1?Je:be.PARSER_MEDIA_TYPE,qe=Ze==="application/xhtml+xml"?PR:Yx,H=is(be,"ALLOWED_TAGS")?Gn({},be.ALLOWED_TAGS,qe):F,B=is(be,"ALLOWED_ATTR")?Gn({},be.ALLOWED_ATTR,qe):z,je=is(be,"ALLOWED_NAMESPACES")?Gn({},be.ALLOWED_NAMESPACES,PR):Ne,me=is(be,"ADD_URI_SAFE_ATTR")?Gn(qs(pe),be.ADD_URI_SAFE_ATTR,qe):pe,Ie=is(be,"ADD_DATA_URI_TAGS")?Gn(qs(de),be.ADD_DATA_URI_TAGS,qe):de,xe=is(be,"FORBID_CONTENTS")?Gn({},be.FORBID_CONTENTS,qe):Me,X=is(be,"FORBID_TAGS")?Gn({},be.FORBID_TAGS,qe):qs({}),Z=is(be,"FORBID_ATTR")?Gn({},be.FORBID_ATTR,qe):qs({}),ce=is(be,"USE_PROFILES")?be.USE_PROFILES:!1,Y=be.ALLOW_ARIA_ATTR!==!1,te=be.ALLOW_DATA_ATTR!==!1,ee=be.ALLOW_UNKNOWN_PROTOCOLS||!1,Q=be.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ae=be.SAFE_FOR_TEMPLATES||!1,oe=be.SAFE_FOR_XML!==!1,re=be.WHOLE_DOCUMENT||!1,ge=be.RETURN_DOM||!1,Te=be.RETURN_DOM_FRAGMENT||!1,Se=be.RETURN_TRUSTED_TYPE||!1,ue=be.FORCE_BODY||!1,fe=be.SANITIZE_DOM!==!1,he=be.SANITIZE_NAMED_PROPS||!1,we=be.KEEP_CONTENT!==!1,Re=be.IN_PLACE||!1,D=be.ALLOWED_URI_REGEXP||Ibe,Ee=be.NAMESPACE||Ce,tt=be.MATHML_TEXT_INTEGRATION_POINTS||tt,ct=be.HTML_INTEGRATION_POINTS||ct,G=be.CUSTOM_ELEMENT_HANDLING||{},be.CUSTOM_ELEMENT_HANDLING&&Fe(be.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=be.CUSTOM_ELEMENT_HANDLING.tagNameCheck),be.CUSTOM_ELEMENT_HANDLING&&Fe(be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),be.CUSTOM_ELEMENT_HANDLING&&typeof be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ae&&(te=!1),Te&&(ge=!0),ce&&(H=Gn({},Ste),B=[],ce.html===!0&&(Gn(H,yte),Gn(B,xte)),ce.svg===!0&&(Gn(H,LR),Gn(B,BR),Gn(B,YS)),ce.svgFilters===!0&&(Gn(H,DR),Gn(B,BR),Gn(B,YS)),ce.mathMl===!0&&(Gn(H,jR),Gn(B,wte),Gn(B,YS))),be.ADD_TAGS&&(typeof be.ADD_TAGS=="function"?q.tagCheck=be.ADD_TAGS:(H===F&&(H=qs(H)),Gn(H,be.ADD_TAGS,qe))),be.ADD_ATTR&&(typeof be.ADD_ATTR=="function"?q.attributeCheck=be.ADD_ATTR:(B===z&&(B=qs(B)),Gn(B,be.ADD_ATTR,qe))),be.ADD_URI_SAFE_ATTR&&Gn(me,be.ADD_URI_SAFE_ATTR,qe),be.FORBID_CONTENTS&&(xe===Me&&(xe=qs(xe)),Gn(xe,be.FORBID_CONTENTS,qe)),be.ADD_FORBID_CONTENTS&&(xe===Me&&(xe=qs(xe)),Gn(xe,be.ADD_FORBID_CONTENTS,qe)),we&&(H["#text"]=!0),re&&Gn(H,["html","head","body"]),H.table&&(Gn(H,["tbody"]),delete X.tbody),be.TRUSTED_TYPES_POLICY){if(typeof be.TRUSTED_TYPES_POLICY.createHTML!="function")throw gm('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof be.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gm('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=be.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else C===void 0&&(C=bwt(h,a)),C!==null&&typeof x=="string"&&(x=C.createHTML(""));Li&&Li(be),Qe=be}},ht=Gn({},[...LR,...DR,...swt]),Ge=Gn({},[...jR,...lwt]),Xe=function(be){let $e=S(be);(!$e||!$e.tagName)&&($e={namespaceURI:Ee,tagName:"template"});const ze=Yx(be.tagName),Ye=Yx($e.tagName);return je[be.namespaceURI]?be.namespaceURI===ye?$e.namespaceURI===Ce?ze==="svg":$e.namespaceURI===Ae?ze==="svg"&&(Ye==="annotation-xml"||tt[Ye]):!!ht[ze]:be.namespaceURI===Ae?$e.namespaceURI===Ce?ze==="math":$e.namespaceURI===ye?ze==="math"&&ct[Ye]:!!Ge[ze]:be.namespaceURI===Ce?$e.namespaceURI===ye&&!ct[Ye]||$e.namespaceURI===Ae&&!tt[Ye]?!1:!Ge[ze]&&(Ke[ze]||!ht[ze]):!!(Ze==="application/xhtml+xml"&&je[be.namespaceURI]):!1},st=function(be){pm(t.removed,{element:be});try{S(be).removeChild(be)}catch{v(be)}},gt=function(be,$e){try{pm(t.removed,{attribute:$e.getAttributeNode(be),from:$e})}catch{pm(t.removed,{attribute:null,from:$e})}if($e.removeAttribute(be),be==="is")if(ge||Te)try{st($e)}catch{}else try{$e.setAttribute(be,"")}catch{}},vt=function(be){let $e=null,ze=null;if(ue)be="<remove></remove>"+be;else{const ft=NR(be,/^[\r\n\t ]+/);ze=ft&&ft[0]}Ze==="application/xhtml+xml"&&Ee===Ce&&(be='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+be+"</body></html>");const Ye=C?C.createHTML(be):be;if(Ee===Ce)try{$e=new f().parseFromString(Ye,Ze)}catch{}if(!$e||!$e.documentElement){$e=w.createDocument(Ee,"template",null);try{$e.documentElement.innerHTML=_e?x:Ye}catch{}}const Ve=$e.body||$e.documentElement;return be&&ze&&Ve.insertBefore(n.createTextNode(ze),Ve.childNodes[0]||null),Ee===Ce?k.call($e,re?"html":"body")[0]:re?$e.documentElement:Ve},Et=function(be){return _.call(be.ownerDocument||be,be,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ot=function(be){return be instanceof d&&(typeof be.nodeName!="string"||typeof be.textContent!="string"||typeof be.removeChild!="function"||!(be.attributes instanceof u)||typeof be.removeAttribute!="function"||typeof be.setAttribute!="function"||typeof be.namespaceURI!="string"||typeof be.insertBefore!="function"||typeof be.hasChildNodes!="function")},dt=function(be){return typeof s=="function"&&be instanceof s};function xt(it,be,$e){KS(it,ze=>{ze.call(t,be,$e,Qe)})}const Lt=function(be){let $e=null;if(xt(I.beforeSanitizeElements,be,null),ot(be))return st(be),!0;const ze=qe(be.nodeName);if(xt(I.uponSanitizeElement,be,{tagName:ze,allowedTags:H}),oe&&be.hasChildNodes()&&!dt(be.firstElementChild)&&Ei(/<[/\w!]/g,be.innerHTML)&&Ei(/<[/\w!]/g,be.textContent)||be.nodeType===vm.progressingInstruction||oe&&be.nodeType===vm.comment&&Ei(/<[/\w]/g,be.data))return st(be),!0;if(!(q.tagCheck instanceof Function&&q.tagCheck(ze))&&(!H[ze]||X[ze])){if(!X[ze]&&gn(ze)&&(G.tagNameCheck instanceof RegExp&&Ei(G.tagNameCheck,ze)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ze)))return!1;if(we&&!xe[ze]){const Ye=S(be)||be.parentNode,Ve=y(be)||be.childNodes;if(Ve&&Ye){const ft=Ve.length;for(let Dt=ft-1;Dt>=0;--Dt){const cn=m(Ve[Dt],!0);cn.__removalCount=(be.__removalCount||0)+1,Ye.insertBefore(cn,b(be))}}}return st(be),!0}return be instanceof l&&!Xe(be)||(ze==="noscript"||ze==="noembed"||ze==="noframes")&&Ei(/<\/no(script|embed|frames)/i,be.innerHTML)?(st(be),!0):(ae&&be.nodeType===vm.text&&($e=be.textContent,KS([M,$,R],Ye=>{$e=hm($e,Ye," ")}),be.textContent!==$e&&(pm(t.removed,{element:be.cloneNode()}),be.textContent=$e)),xt(I.afterSanitizeElements,be,null),!1)},Kt=function(be,$e,ze){if(fe&&($e==="id"||$e==="name")&&(ze in n||ze in Oe))return!1;if(!(te&&!Z[$e]&&Ei(A,$e))){if(!(Y&&Ei(P,$e))){if(!(q.attributeCheck instanceof Function&&q.attributeCheck($e,be))){if(!B[$e]||Z[$e]){if(!(gn(be)&&(G.tagNameCheck instanceof RegExp&&Ei(G.tagNameCheck,be)||G.tagNameCheck instanceof Function&&G.tagNameCheck(be))&&(G.attributeNameCheck instanceof RegExp&&Ei(G.attributeNameCheck,$e)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck($e,be))||$e==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&Ei(G.tagNameCheck,ze)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ze))))return!1}else if(!me[$e]){if(!Ei(D,hm(ze,L,""))){if(!(($e==="src"||$e==="xlink:href"||$e==="href")&&be!=="script"&&rwt(ze,"data:")===0&&Ie[be])){if(!(ee&&!Ei(N,hm(ze,L,"")))){if(ze)return!1}}}}}}}return!0},gn=function(be){return be!=="annotation-xml"&&NR(be,j)},en=function(be){xt(I.beforeSanitizeAttributes,be,null);const{attributes:$e}=be;if(!$e||ot(be))return;const ze={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let Ye=$e.length;for(;Ye--;){const Ve=$e[Ye],{name:ft,namespaceURI:Dt,value:cn}=Ve,Un=qe(ft),Tt=cn;let bt=ft==="value"?Tt:awt(Tt);if(ze.attrName=Un,ze.attrValue=bt,ze.keepAttr=!0,ze.forceKeepAttr=void 0,xt(I.uponSanitizeAttribute,be,ze),bt=ze.attrValue,he&&(Un==="id"||Un==="name")&&(gt(ft,be),bt=ve+bt),oe&&Ei(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){gt(ft,be);continue}if(Un==="attributename"&&NR(bt,"href")){gt(ft,be);continue}if(ze.forceKeepAttr)continue;if(!ze.keepAttr){gt(ft,be);continue}if(!Q&&Ei(/\/>/i,bt)){gt(ft,be);continue}ae&&KS([M,$,R],Wn=>{bt=hm(bt,Wn," ")});const an=qe(be.nodeName);if(!Kt(an,Un,bt)){gt(ft,be);continue}if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Dt)switch(h.getAttributeType(an,Un)){case"TrustedHTML":{bt=C.createHTML(bt);break}case"TrustedScriptURL":{bt=C.createScriptURL(bt);break}}if(bt!==Tt)try{Dt?be.setAttributeNS(Dt,ft,bt):be.setAttribute(ft,bt),ot(be)?st(be):bte(t.removed)}catch{gt(ft,be)}}xt(I.afterSanitizeAttributes,be,null)},Tn=function it(be){let $e=null;const ze=Et(be);for(xt(I.beforeSanitizeShadowDOM,be,null);$e=ze.nextNode();)xt(I.uponSanitizeShadowNode,$e,null),Lt($e),en($e),$e.content instanceof i&&it($e.content);xt(I.afterSanitizeShadowDOM,be,null)};return t.sanitize=function(it){let be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$e=null,ze=null,Ye=null,Ve=null;if(_e=!it,_e&&(it="<!-->"),typeof it!="string"&&!dt(it))if(typeof it.toString=="function"){if(it=it.toString(),typeof it!="string")throw gm("dirty is not a string, aborting")}else throw gm("toString is not a function");if(!t.isSupported)return it;if(ie||nt(be),t.removed=[],typeof it=="string"&&(Re=!1),Re){if(it.nodeName){const cn=qe(it.nodeName);if(!H[cn]||X[cn])throw gm("root node is forbidden and cannot be sanitized in-place")}}else if(it instanceof s)$e=vt("<!---->"),ze=$e.ownerDocument.importNode(it,!0),ze.nodeType===vm.element&&ze.nodeName==="BODY"||ze.nodeName==="HTML"?$e=ze:$e.appendChild(ze);else{if(!ge&&!ae&&!re&&it.indexOf("<")===-1)return C&&Se?C.createHTML(it):it;if($e=vt(it),!$e)return ge?null:Se?x:""}$e&&ue&&st($e.firstChild);const ft=Et(Re?it:$e);for(;Ye=ft.nextNode();)Lt(Ye),en(Ye),Ye.content instanceof i&&Tn(Ye.content);if(Re)return it;if(ge){if(Te)for(Ve=T.call($e.ownerDocument);$e.firstChild;)Ve.appendChild($e.firstChild);else Ve=$e;return(B.shadowroot||B.shadowrootmode)&&(Ve=O.call(r,Ve,!0)),Ve}let Dt=re?$e.outerHTML:$e.innerHTML;return re&&H["!doctype"]&&$e.ownerDocument&&$e.ownerDocument.doctype&&$e.ownerDocument.doctype.name&&Ei(Abe,$e.ownerDocument.doctype.name)&&(Dt="<!DOCTYPE "+$e.ownerDocument.doctype.name+`>
|
|
708
|
-
`+Dt),ae&&KS([M,$,R],cn=>{Dt=hm(Dt,cn," ")}),C&&Se?C.createHTML(Dt):Dt},t.setConfig=function(){let it=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(it),ie=!0},t.clearConfig=function(){Qe=null,ie=!1},t.isValidAttribute=function(it,be,$e){Qe||nt({});const ze=qe(it),Ye=qe(be);return Kt(ze,Ye,$e)},t.addHook=function(it,be){typeof be=="function"&&pm(I[it],be)},t.removeHook=function(it,be){if(be!==void 0){const $e=twt(I[it],be);return $e===-1?void 0:nwt(I[it],$e,1)[0]}return bte(I[it])},t.removeHooks=function(it){I[it]=[]},t.removeAllHooks=function(){I=Ete()},t}var zd=Rbe();const
|
|
709
|
-
`);for(const[n,{detector:r}]of Object.entries(Hd))if(r(e,t))return n;throw new Pbe(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),bD=W((...e)=>{for(const{id:t,detector:n,loader:r}of e)Nbe(t,n,r)},"registerLazyLoadedDiagrams"),Nbe=W((e,t,n)=>{Hd[e]&&et.warn(`Detector with key ${e} already exists. Overwriting.`),Hd[e]={detector:t,loader:n},et.debug(`Detector with key ${e} added${n?" with loader":""}`)},"addDetector"),Swt=W(e=>Hd[e].loader,"getDiagramLoader"),yD=W((e,t,{depth:n=2,clobber:r=!1}={})=>{const a={depth:n,clobber:r};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(i=>yD(e,i,a)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(i=>{e.includes(i)||e.push(i)}),e):e===void 0||n<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(i=>{typeof t[i]=="object"&&(e[i]===void 0||typeof e[i]=="object")?(e[i]===void 0&&(e[i]=Array.isArray(t[i])?[]:{}),e[i]=yD(e[i],t[i],{depth:n-1,clobber:r})):(r||typeof e[i]!="object"&&typeof t[i]!="object")&&(e[i]=t[i])}),e)},"assignWithDepth"),Sa=yD,Y_="#ffffff",X_="#f2f2f2",Ri=W((e,t)=>t?Pe(e,{s:-40,l:10}):Pe(e,{s:-40,l:-10}),"mkBorder"),Rp,xwt=(Rp=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){var n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x,w;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||Pe(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||Pe(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Ri(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Ri(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||At(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||At(this.tertiaryColor),this.lineColor=this.lineColor||At(this.background),this.arrowheadColor=this.arrowheadColor||At(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Jt(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||At(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Ht(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||Jt(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Jt(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.darkMode)for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=Jt(this["cScale"+_],75);else for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=Jt(this["cScale"+_],25);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleInv"+_]=this["cScaleInv"+_]||At(this["cScale"+_]);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this.darkMode?this["cScalePeer"+_]=this["cScalePeer"+_]||Ht(this["cScale"+_],10):this["cScalePeer"+_]=this["cScalePeer"+_]||Jt(this["cScale"+_],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleLabel"+_]=this["cScaleLabel"+_]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let _=0;_<5;_++)this["surface"+_]=this["surface"+_]||Pe(this.mainBkg,{h:180,s:-15,l:t*(5+_*3)}),this["surfacePeer"+_]=this["surfacePeer"+_]||Pe(this.mainBkg,{h:180,s:-15,l:t*(8+_*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||Pe(this.primaryColor,{h:64}),this.fillType3=this.fillType3||Pe(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||Pe(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||Pe(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||Pe(this.primaryColor,{h:128}),this.fillType7=this.fillType7||Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Pe(this.primaryColor,{l:-10}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-10}),this.pie6=this.pie6||Pe(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:((n=this.radar)==null?void 0:n.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((a=this.radar)==null?void 0:a.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((s=this.radar)==null?void 0:s.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((f=this.xyChart)==null?void 0:f.backgroundColor)||this.background,titleColor:((h=this.xyChart)==null?void 0:h.titleColor)||this.primaryTextColor,xAxisTitleColor:((g=this.xyChart)==null?void 0:g.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((m=this.xyChart)==null?void 0:m.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((v=this.xyChart)==null?void 0:v.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((b=this.xyChart)==null?void 0:b.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((y=this.xyChart)==null?void 0:y.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((S=this.xyChart)==null?void 0:S.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((C=this.xyChart)==null?void 0:C.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((x=this.xyChart)==null?void 0:x.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((w=this.xyChart)==null?void 0:w.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Rp,"Theme"),Rp),wwt=W(e=>{const t=new xwt;return t.calculate(e),t},"getThemeVariables"),Mp,Cwt=(Mp=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Ht(this.primaryColor,16),this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=At(this.background),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Ht(At("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=db(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=Jt("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Jt(this.sectionBkgColor,10),this.taskBorderColor=db(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=db(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Ht(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Jt(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.secondBkg=Ht(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Ht(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Ht(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330});for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||At(this["cScale"+w]);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScalePeer"+w]=this["cScalePeer"+w]||Ht(this["cScale"+w],10);for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(-10+w*4)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(-7+w*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["pie"+w]=this["cScale"+w];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((r=this.xyChart)==null?void 0:r.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((a=this.xyChart)==null?void 0:a.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((c=this.xyChart)==null?void 0:c.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((u=this.xyChart)==null?void 0:u.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((d=this.xyChart)==null?void 0:d.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((h=this.radar)==null?void 0:h.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((m=this.radar)==null?void 0:m.curveOpacity)||.5,curveStrokeWidth:((v=this.radar)==null?void 0:v.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((C=this.radar)==null?void 0:C.legendBoxSize)||12,legendFontSize:((x=this.radar)==null?void 0:x.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Ht(this.secondaryColor,20),this.git1=Ht(this.pie2||this.secondaryColor,20),this.git2=Ht(this.pie3||this.tertiaryColor,20),this.git3=Ht(this.pie4||Pe(this.primaryColor,{h:-30}),20),this.git4=Ht(this.pie5||Pe(this.primaryColor,{h:-60}),20),this.git5=Ht(this.pie6||Pe(this.primaryColor,{h:-90}),10),this.git6=Ht(this.pie7||Pe(this.primaryColor,{h:60}),10),this.git7=Ht(this.pie8||Pe(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Ht(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Mp,"Theme"),Mp),Ewt=W(e=>{const t=new Cwt;return t.calculate(e),t},"getThemeVariables"),Pp,_wt=(Pp=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=Pe(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=db(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Jt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Jt(this.tertiaryColor,40);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScale"+w]=Jt(this["cScale"+w],10),this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],25);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||Pe(this["cScale"+w],{h:180});for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,l:-(7+w*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||At(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||At(this.labelTextColor);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=Ht(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Ht(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||Pe(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||Pe(this.primaryColor,{l:-10}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Pe(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((r=this.radar)==null?void 0:r.axisLabelFontSize)||12,curveOpacity:((a=this.radar)==null?void 0:a.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,xAxisTitleColor:((h=this.xyChart)==null?void 0:h.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((m=this.xyChart)==null?void 0:m.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((v=this.xyChart)==null?void 0:v.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((C=this.xyChart)==null?void 0:C.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||Jt(At(this.git0),25),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(Object.keys(this).forEach(r=>{this[r]==="calculated"&&(this[r]=void 0)}),typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Pp,"Theme"),Pp),Twt=W(e=>{const t=new _wt;return t.calculate(e),t},"getThemeVariables"),Np,kwt=(Np=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Ht("#cde498",10),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.primaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.actorBorder=Jt(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Jt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Jt(this.tertiaryColor,40);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScale"+w]=Jt(this["cScale"+w],10),this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],25);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||Pe(this["cScale"+w],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(8+w*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Pe(this.primaryColor,{l:-30}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Pe(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((r=this.radar)==null?void 0:r.axisLabelFontSize)||12,curveOpacity:((a=this.radar)==null?void 0:a.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,xAxisTitleColor:((h=this.xyChart)==null?void 0:h.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((m=this.xyChart)==null?void 0:m.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((v=this.xyChart)==null?void 0:v.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((C=this.xyChart)==null?void 0:C.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Np,"Theme"),Np),Owt=W(e=>{const t=new kwt;return t.calculate(e),t},"getThemeVariables"),Lp,$wt=(Lp=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Ht(this.contrast,55),this.background="#ffffff",this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.secondBkg=Ht(this.contrast,55),this.border2=this.contrast,this.actorBorder=Ht(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||At(this["cScale"+w]);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this.darkMode?this["cScalePeer"+w]=this["cScalePeer"+w]||Ht(this["cScale"+w],10):this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{l:-(8+w*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Ht(this.contrast,30),this.sectionBkgColor2=Ht(this.contrast,30),this.taskBorderColor=Jt(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Ht(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=Jt(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128});for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["pie"+w]=this["cScale"+w];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((r=this.xyChart)==null?void 0:r.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((a=this.xyChart)==null?void 0:a.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((c=this.xyChart)==null?void 0:c.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((u=this.xyChart)==null?void 0:u.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((d=this.xyChart)==null?void 0:d.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((h=this.radar)==null?void 0:h.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((m=this.radar)==null?void 0:m.curveOpacity)||.5,curveStrokeWidth:((v=this.radar)==null?void 0:v.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((C=this.radar)==null?void 0:C.legendBoxSize)||12,legendFontSize:((x=this.radar)==null?void 0:x.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Jt(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||Pe(this.primaryColor,{h:-30}),this.git4=this.pie5||Pe(this.primaryColor,{h:-60}),this.git5=this.pie6||Pe(this.primaryColor,{h:-90}),this.git6=this.pie7||Pe(this.primaryColor,{h:60}),this.git7=this.pie8||Pe(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Lp,"Theme"),Lp),Iwt=W(e=>{const t=new $wt;return t.calculate(e),t},"getThemeVariables"),Vl={base:{getThemeVariables:wwt},dark:{getThemeVariables:Ewt},default:{getThemeVariables:Twt},forest:{getThemeVariables:Owt},neutral:{getThemeVariables:Iwt}},Hs={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Lbe={...Hs,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Vl.default.getThemeVariables(),sequence:{...Hs.sequence,messageFont:W(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:W(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:W(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...Hs.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Hs.c4,useWidth:void 0,personFont:W(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Hs.flowchart,inheritDir:!1},external_personFont:W(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:W(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:W(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:W(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:W(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:W(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:W(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:W(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:W(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:W(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:W(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:W(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:W(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:W(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:W(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:W(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:W(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:W(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:W(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:W(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:W(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Hs.pie,useWidth:984},xyChart:{...Hs.xyChart,useWidth:void 0},requirement:{...Hs.requirement,useWidth:void 0},packet:{...Hs.packet},radar:{...Hs.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},Dbe=W((e,t="")=>Object.keys(e).reduce((n,r)=>Array.isArray(e[r])?n:typeof e[r]=="object"&&e[r]!==null?[...n,t+r,...Dbe(e[r],"")]:[...n,t+r],[]),"keyify"),Awt=new Set(Dbe(Lbe,"")),jbe=Lbe,XC=W(e=>{if(et.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>XC(t));return}for(const t of Object.keys(e)){if(et.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Awt.has(t)||e[t]==null){et.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){et.debug("sanitizing object",t),XC(e[t]);continue}const n=["themeCSS","fontFamily","altFontFamily"];for(const r of n)t.includes(r)&&(et.debug("sanitizing css option",t),e[t]=Rwt(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const n=e.themeVariables[t];n!=null&&n.match&&!n.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}et.debug("After sanitization",e)}},"sanitizeDirective"),Rwt=W(e=>{let t=0,n=0;for(const r of e){if(t<n)return"{ /* ERROR: Unbalanced CSS */ }";r==="{"?t++:r==="}"&&n++}return t!==n?"{ /* ERROR: Unbalanced CSS */ }":e},"sanitizeCss"),Th=Object.freeze(jbe),qi=Sa({},Th),ZC,Ud=[],pb=Sa({},Th),Z_=W((e,t)=>{let n=Sa({},e),r={};for(const a of t)zbe(a),r=Sa(r,a);if(n=Sa(n,r),r.theme&&r.theme in Vl){const a=Sa({},ZC),i=Sa(a.themeVariables||{},r.themeVariables);n.theme&&n.theme in Vl&&(n.themeVariables=Vl[n.theme].getThemeVariables(i))}return pb=n,Hbe(pb),pb},"updateCurrentConfig"),Mwt=W(e=>(qi=Sa({},Th),qi=Sa(qi,e),e.theme&&Vl[e.theme]&&(qi.themeVariables=Vl[e.theme].getThemeVariables(e.themeVariables)),Z_(qi,Ud),qi),"setSiteConfig"),Pwt=W(e=>{ZC=Sa({},e)},"saveConfigFromInitialize"),Nwt=W(e=>(qi=Sa(qi,e),Z_(qi,Ud),qi),"updateSiteConfig"),Bbe=W(()=>Sa({},qi),"getSiteConfig"),Fbe=W(e=>(Hbe(e),Sa(pb,e),mi()),"setConfig"),mi=W(()=>Sa({},pb),"getConfig"),zbe=W(e=>{e&&(["secure",...qi.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(et.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&zbe(e[t])}))},"sanitize"),Lwt=W(e=>{var t;XC(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Ud.push(e),Z_(qi,Ud)},"addDirective"),QC=W((e=qi)=>{Ud=[],Z_(e,Ud)},"reset"),Dwt={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},_te={},jwt=W(e=>{_te[e]||(et.warn(Dwt[e]),_te[e]=!0)},"issueWarning"),Hbe=W(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&jwt("LAZY_LOAD_DEPRECATED")},"checkConfig"),t4t=W(()=>{let e={};ZC&&(e=Sa(e,ZC));for(const t of Ud)e=Sa(e,t);return e},"getUserDefinedConfig"),T0=/<br\s*\/?>/gi,Bwt=W(e=>e?qbe(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),Fwt=(()=>{let e=!1;return()=>{e||(Ube(),e=!0)}})();function Ube(){const e="data-temp-href-target";zd.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),zd.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}W(Ube,"setupDompurifyHooks");var Wbe=W(e=>(Fwt(),zd.sanitize(e)),"removeScript"),Tte=W((e,t)=>{var n;if(((n=t.flowchart)==null?void 0:n.htmlLabels)!==!1){const r=t.securityLevel;r==="antiscript"||r==="strict"?e=Wbe(e):r!=="loose"&&(e=qbe(e),e=e.replace(/</g,"<").replace(/>/g,">"),e=e.replace(/=/g,"="),e=Wwt(e))}return e},"sanitizeMore"),Zo=W((e,t)=>e&&(t.dompurifyConfig?e=zd.sanitize(Tte(e,t),t.dompurifyConfig).toString():e=zd.sanitize(Tte(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),zwt=W((e,t)=>typeof e=="string"?Zo(e,t):e.flat().map(n=>Zo(n,t)),"sanitizeTextOrArray"),Hwt=W(e=>T0.test(e),"hasBreaks"),Uwt=W(e=>e.split(T0),"splitBreaks"),Wwt=W(e=>e.replace(/#br#/g,"<br/>"),"placeholderToBreak"),qbe=W(e=>e.replace(T0,"#br#"),"breakToPlaceholder"),qwt=W(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),_a=W(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),Vwt=W(function(...e){const t=e.filter(n=>!isNaN(n));return Math.max(...t)},"getMax"),Gwt=W(function(...e){const t=e.filter(n=>!isNaN(n));return Math.min(...t)},"getMin"),kte=W(function(e){const t=e.split(/(,)/),n=[];for(let r=0;r<t.length;r++){let a=t[r];if(a===","&&r>0&&r+1<t.length){const i=t[r-1],o=t[r+1];Kwt(i,o)&&(a=i+","+o,r++,n.pop())}n.push(Ywt(a))}return n.join("")},"parseGenericTypes"),SD=W((e,t)=>Math.max(0,e.split(t).length-1),"countOccurrence"),Kwt=W((e,t)=>{const n=SD(e,"~"),r=SD(t,"~");return n===1&&r===1},"shouldCombineSets"),Ywt=W(e=>{const t=SD(e,"~");let n=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),n=!0);const r=[...e];let a=r.indexOf("~"),i=r.lastIndexOf("~");for(;a!==-1&&i!==-1&&a!==i;)r[a]="<",r[i]=">",a=r.indexOf("~"),i=r.lastIndexOf("~");return n&&r.unshift("~"),r.join("")},"processSet"),Ote=W(()=>window.MathMLElement!==void 0,"isMathMLSupported"),xD=/\$\$(.*)\$\$/g,kh=W(e=>{var t;return(((t=e.match(xD))==null?void 0:t.length)??0)>0},"hasKatex"),n4t=W(async(e,t)=>{const n=document.createElement("div");n.innerHTML=await yH(e,t),n.id="katex-temp",n.style.visibility="hidden",n.style.position="absolute",n.style.top="0";const r=document.querySelector("body");r==null||r.insertAdjacentElement("beforeend",n);const a={width:n.clientWidth,height:n.clientHeight};return n.remove(),a},"calculateMathMLDimensions"),Xwt=W(async(e,t)=>{if(!kh(e))return e;if(!(Ote()||t.legacyMathML||t.forceLegacyMathML))return e.replace(xD,"MathML is unsupported in this environment.");{const{default:n}=await Mn(async()=>{const{default:a}=await import("./katex-ChWnQ-fc.js");return{default:a}},[],import.meta.url),r=t.forceLegacyMathML||!Ote()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(T0).map(a=>kh(a)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${a}</div>`:`<div>${a}</div>`).join("").replace(xD,(a,i)=>n.renderToString(i,{throwOnError:!0,displayMode:!0,output:r}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),yH=W(async(e,t)=>Zo(await Xwt(e,t),t),"renderKatexSanitized"),wg={getRows:Bwt,sanitizeText:Zo,sanitizeTextOrArray:zwt,hasBreaks:Hwt,splitBreaks:Uwt,lineBreakRegex:T0,removeScript:Wbe,getUrl:qwt,evaluate:_a,getMax:Vwt,getMin:Gwt},Zwt=W(function(e,t){for(let n of t)e.attr(n[0],n[1])},"d3Attrs"),Qwt=W(function(e,t,n){let r=new Map;return n?(r.set("width","100%"),r.set("style",`max-width: ${t}px;`)):(r.set("height",e),r.set("width",t)),r},"calculateSvgSizeAttrs"),Vbe=W(function(e,t,n,r){const a=Qwt(t,n,r);Zwt(e,a)},"configureSvgSize"),Jwt=W(function(e,t,n,r){const a=t.node().getBBox(),i=a.width,o=a.height;et.info(`SVG bounds: ${i}x${o}`,a);let s=0,l=0;et.info(`Graph bounds: ${s}x${l}`,e),s=i+n*2,l=o+n*2,et.info(`Calculated bounds: ${s}x${l}`),Vbe(t,l,s,r);const c=`${a.x-n} ${a.y-n} ${a.width+2*n} ${a.height+2*n}`;t.attr("viewBox",c)},"setupGraphViewbox"),Xx={},eCt=W((e,t,n)=>{let r="";return e in Xx&&Xx[e]?r=Xx[e](n):et.warn(`No theme found for ${e}`),` & {
|
|
708
|
+
`+Dt),ae&&KS([M,$,R],cn=>{Dt=hm(Dt,cn," ")}),C&&Se?C.createHTML(Dt):Dt},t.setConfig=function(){let it=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(it),ie=!0},t.clearConfig=function(){Qe=null,ie=!1},t.isValidAttribute=function(it,be,$e){Qe||nt({});const ze=qe(it),Ye=qe(be);return Kt(ze,Ye,$e)},t.addHook=function(it,be){typeof be=="function"&&pm(I[it],be)},t.removeHook=function(it,be){if(be!==void 0){const $e=twt(I[it],be);return $e===-1?void 0:nwt(I[it],$e,1)[0]}return bte(I[it])},t.removeHooks=function(it){I[it]=[]},t.removeAllHooks=function(){I=Ete()},t}var zd=Rbe();const t4t=Object.freeze(Object.defineProperty({__proto__:null,default:zd},Symbol.toStringTag,{value:"Module"}));var Mbe=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,fb=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,ywt=/\s*%%.*\n/gm,Ap,Pbe=(Ap=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},W(Ap,"UnknownDiagramError"),Ap),Hd={},bH=W(function(e,t){e=e.replace(Mbe,"").replace(fb,"").replace(ywt,`
|
|
709
|
+
`);for(const[n,{detector:r}]of Object.entries(Hd))if(r(e,t))return n;throw new Pbe(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),bD=W((...e)=>{for(const{id:t,detector:n,loader:r}of e)Nbe(t,n,r)},"registerLazyLoadedDiagrams"),Nbe=W((e,t,n)=>{Hd[e]&&et.warn(`Detector with key ${e} already exists. Overwriting.`),Hd[e]={detector:t,loader:n},et.debug(`Detector with key ${e} added${n?" with loader":""}`)},"addDetector"),Swt=W(e=>Hd[e].loader,"getDiagramLoader"),yD=W((e,t,{depth:n=2,clobber:r=!1}={})=>{const a={depth:n,clobber:r};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(i=>yD(e,i,a)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(i=>{e.includes(i)||e.push(i)}),e):e===void 0||n<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(i=>{typeof t[i]=="object"&&(e[i]===void 0||typeof e[i]=="object")?(e[i]===void 0&&(e[i]=Array.isArray(t[i])?[]:{}),e[i]=yD(e[i],t[i],{depth:n-1,clobber:r})):(r||typeof e[i]!="object"&&typeof t[i]!="object")&&(e[i]=t[i])}),e)},"assignWithDepth"),Sa=yD,Y_="#ffffff",X_="#f2f2f2",Ri=W((e,t)=>t?Pe(e,{s:-40,l:10}):Pe(e,{s:-40,l:-10}),"mkBorder"),Rp,xwt=(Rp=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){var n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x,w;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||Pe(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||Pe(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Ri(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Ri(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||At(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||At(this.tertiaryColor),this.lineColor=this.lineColor||At(this.background),this.arrowheadColor=this.arrowheadColor||At(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Jt(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||At(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Ht(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||Jt(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Jt(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.darkMode)for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=Jt(this["cScale"+_],75);else for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=Jt(this["cScale"+_],25);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleInv"+_]=this["cScaleInv"+_]||At(this["cScale"+_]);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this.darkMode?this["cScalePeer"+_]=this["cScalePeer"+_]||Ht(this["cScale"+_],10):this["cScalePeer"+_]=this["cScalePeer"+_]||Jt(this["cScale"+_],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleLabel"+_]=this["cScaleLabel"+_]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let _=0;_<5;_++)this["surface"+_]=this["surface"+_]||Pe(this.mainBkg,{h:180,s:-15,l:t*(5+_*3)}),this["surfacePeer"+_]=this["surfacePeer"+_]||Pe(this.mainBkg,{h:180,s:-15,l:t*(8+_*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||Pe(this.primaryColor,{h:64}),this.fillType3=this.fillType3||Pe(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||Pe(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||Pe(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||Pe(this.primaryColor,{h:128}),this.fillType7=this.fillType7||Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Pe(this.primaryColor,{l:-10}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-10}),this.pie6=this.pie6||Pe(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:((n=this.radar)==null?void 0:n.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((a=this.radar)==null?void 0:a.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((s=this.radar)==null?void 0:s.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((f=this.xyChart)==null?void 0:f.backgroundColor)||this.background,titleColor:((h=this.xyChart)==null?void 0:h.titleColor)||this.primaryTextColor,xAxisTitleColor:((g=this.xyChart)==null?void 0:g.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((m=this.xyChart)==null?void 0:m.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((v=this.xyChart)==null?void 0:v.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((b=this.xyChart)==null?void 0:b.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((y=this.xyChart)==null?void 0:y.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((S=this.xyChart)==null?void 0:S.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((C=this.xyChart)==null?void 0:C.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((x=this.xyChart)==null?void 0:x.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((w=this.xyChart)==null?void 0:w.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Rp,"Theme"),Rp),wwt=W(e=>{const t=new xwt;return t.calculate(e),t},"getThemeVariables"),Mp,Cwt=(Mp=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Ht(this.primaryColor,16),this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=At(this.background),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Ht(At("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=db(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=Jt("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Jt(this.sectionBkgColor,10),this.taskBorderColor=db(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=db(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Ht(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Jt(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.secondBkg=Ht(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Ht(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Ht(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330});for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||At(this["cScale"+w]);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScalePeer"+w]=this["cScalePeer"+w]||Ht(this["cScale"+w],10);for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(-10+w*4)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(-7+w*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["pie"+w]=this["cScale"+w];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((r=this.xyChart)==null?void 0:r.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((a=this.xyChart)==null?void 0:a.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((c=this.xyChart)==null?void 0:c.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((u=this.xyChart)==null?void 0:u.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((d=this.xyChart)==null?void 0:d.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((h=this.radar)==null?void 0:h.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((m=this.radar)==null?void 0:m.curveOpacity)||.5,curveStrokeWidth:((v=this.radar)==null?void 0:v.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((C=this.radar)==null?void 0:C.legendBoxSize)||12,legendFontSize:((x=this.radar)==null?void 0:x.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Jt(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Ht(this.secondaryColor,20),this.git1=Ht(this.pie2||this.secondaryColor,20),this.git2=Ht(this.pie3||this.tertiaryColor,20),this.git3=Ht(this.pie4||Pe(this.primaryColor,{h:-30}),20),this.git4=Ht(this.pie5||Pe(this.primaryColor,{h:-60}),20),this.git5=Ht(this.pie6||Pe(this.primaryColor,{h:-90}),10),this.git6=Ht(this.pie7||Pe(this.primaryColor,{h:60}),10),this.git7=Ht(this.pie8||Pe(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Ht(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Mp,"Theme"),Mp),Ewt=W(e=>{const t=new Cwt;return t.calculate(e),t},"getThemeVariables"),Pp,_wt=(Pp=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=Pe(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=db(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Jt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Jt(this.tertiaryColor,40);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScale"+w]=Jt(this["cScale"+w],10),this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],25);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||Pe(this["cScale"+w],{h:180});for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,l:-(7+w*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||At(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||At(this.labelTextColor);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=Ht(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Ht(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||Pe(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||Pe(this.primaryColor,{l:-10}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Pe(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((r=this.radar)==null?void 0:r.axisLabelFontSize)||12,curveOpacity:((a=this.radar)==null?void 0:a.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,xAxisTitleColor:((h=this.xyChart)==null?void 0:h.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((m=this.xyChart)==null?void 0:m.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((v=this.xyChart)==null?void 0:v.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((C=this.xyChart)==null?void 0:C.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||Jt(At(this.git0),25),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(Object.keys(this).forEach(r=>{this[r]==="calculated"&&(this[r]=void 0)}),typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Pp,"Theme"),Pp),Twt=W(e=>{const t=new _wt;return t.calculate(e),t},"getThemeVariables"),Np,kwt=(Np=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Ht("#cde498",10),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.primaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.actorBorder=Jt(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Pe(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Pe(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Pe(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Pe(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Pe(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Pe(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Pe(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Pe(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Pe(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Jt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Jt(this.tertiaryColor,40);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScale"+w]=Jt(this["cScale"+w],10),this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],25);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||Pe(this["cScale"+w],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{h:30,s:-30,l:-(8+w*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Ht(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Pe(this.primaryColor,{l:-30}),this.pie5=this.pie5||Pe(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Pe(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||Pe(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Pe(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Pe(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Pe(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||Pe(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||Pe(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((r=this.radar)==null?void 0:r.axisLabelFontSize)||12,curveOpacity:((a=this.radar)==null?void 0:a.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,xAxisTitleColor:((h=this.xyChart)==null?void 0:h.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((m=this.xyChart)==null?void 0:m.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((v=this.xyChart)==null?void 0:v.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((C=this.xyChart)==null?void 0:C.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Pe(this.primaryColor,{h:-30}),this.git4=this.git4||Pe(this.primaryColor,{h:-60}),this.git5=this.git5||Pe(this.primaryColor,{h:-90}),this.git6=this.git6||Pe(this.primaryColor,{h:60}),this.git7=this.git7||Pe(this.primaryColor,{h:120}),this.darkMode?(this.git0=Ht(this.git0,25),this.git1=Ht(this.git1,25),this.git2=Ht(this.git2,25),this.git3=Ht(this.git3,25),this.git4=Ht(this.git4,25),this.git5=Ht(this.git5,25),this.git6=Ht(this.git6,25),this.git7=Ht(this.git7,25)):(this.git0=Jt(this.git0,25),this.git1=Jt(this.git1,25),this.git2=Jt(this.git2,25),this.git3=Jt(this.git3,25),this.git4=Jt(this.git4,25),this.git5=Jt(this.git5,25),this.git6=Jt(this.git6,25),this.git7=Jt(this.git7,25)),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||At(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||At(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Np,"Theme"),Np),Owt=W(e=>{const t=new kwt;return t.calculate(e),t},"getThemeVariables"),Lp,$wt=(Lp=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Ht(this.contrast,55),this.background="#ffffff",this.tertiaryColor=Pe(this.primaryColor,{h:-160}),this.primaryBorderColor=Ri(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ri(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ri(this.tertiaryColor,this.darkMode),this.primaryTextColor=At(this.primaryColor),this.secondaryTextColor=At(this.secondaryColor),this.tertiaryTextColor=At(this.tertiaryColor),this.lineColor=At(this.background),this.textColor=At(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Ht(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,n,r,a,i,o,s,l,c,u,d,f,h,g,m,v,b,y,S,C,x;this.secondBkg=Ht(this.contrast,55),this.border2=this.contrast,this.actorBorder=Ht(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleInv"+w]=this["cScaleInv"+w]||At(this["cScale"+w]);for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this.darkMode?this["cScalePeer"+w]=this["cScalePeer"+w]||Ht(this["cScale"+w],10):this["cScalePeer"+w]=this["cScalePeer"+w]||Jt(this["cScale"+w],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["cScaleLabel"+w]=this["cScaleLabel"+w]||this.scaleLabelColor;for(let w=0;w<5;w++)this["surface"+w]=this["surface"+w]||Pe(this.mainBkg,{l:-(5+w*5)}),this["surfacePeer"+w]=this["surfacePeer"+w]||Pe(this.mainBkg,{l:-(8+w*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Ht(this.contrast,30),this.sectionBkgColor2=Ht(this.contrast,30),this.taskBorderColor=Jt(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Ht(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=Jt(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Pe(this.primaryColor,{h:64}),this.fillType3=Pe(this.secondaryColor,{h:64}),this.fillType4=Pe(this.primaryColor,{h:-64}),this.fillType5=Pe(this.secondaryColor,{h:-64}),this.fillType6=Pe(this.primaryColor,{h:128}),this.fillType7=Pe(this.secondaryColor,{h:128});for(let w=0;w<this.THEME_COLOR_LIMIT;w++)this["pie"+w]=this["cScale"+w];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Pe(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Pe(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Pe(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Pe(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Pe(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Pe(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||_0(this.quadrant1Fill)?Ht(this.quadrant1Fill):Jt(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((r=this.xyChart)==null?void 0:r.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((a=this.xyChart)==null?void 0:a.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((c=this.xyChart)==null?void 0:c.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((u=this.xyChart)==null?void 0:u.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((d=this.xyChart)==null?void 0:d.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((h=this.radar)==null?void 0:h.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((m=this.radar)==null?void 0:m.curveOpacity)||.5,curveStrokeWidth:((v=this.radar)==null?void 0:v.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((C=this.radar)==null?void 0:C.legendBoxSize)||12,legendFontSize:((x=this.radar)==null?void 0:x.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Jt(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||Pe(this.primaryColor,{h:-30}),this.git4=this.pie5||Pe(this.primaryColor,{h:-60}),this.git5=this.pie6||Pe(this.primaryColor,{h:-90}),this.git6=this.pie7||Pe(this.primaryColor,{h:60}),this.git7=this.pie8||Pe(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||At(this.git0),this.gitInv1=this.gitInv1||At(this.git1),this.gitInv2=this.gitInv2||At(this.git2),this.gitInv3=this.gitInv3||At(this.git3),this.gitInv4=this.gitInv4||At(this.git4),this.gitInv5=this.gitInv5||At(this.git5),this.gitInv6=this.gitInv6||At(this.git6),this.gitInv7=this.gitInv7||At(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y_,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X_}calculate(t){if(typeof t!="object"){this.updateColors();return}const n=Object.keys(t);n.forEach(r=>{this[r]=t[r]}),this.updateColors(),n.forEach(r=>{this[r]=t[r]})}},W(Lp,"Theme"),Lp),Iwt=W(e=>{const t=new $wt;return t.calculate(e),t},"getThemeVariables"),Vl={base:{getThemeVariables:wwt},dark:{getThemeVariables:Ewt},default:{getThemeVariables:Twt},forest:{getThemeVariables:Owt},neutral:{getThemeVariables:Iwt}},Hs={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Lbe={...Hs,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Vl.default.getThemeVariables(),sequence:{...Hs.sequence,messageFont:W(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:W(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:W(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...Hs.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Hs.c4,useWidth:void 0,personFont:W(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Hs.flowchart,inheritDir:!1},external_personFont:W(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:W(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:W(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:W(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:W(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:W(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:W(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:W(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:W(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:W(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:W(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:W(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:W(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:W(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:W(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:W(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:W(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:W(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:W(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:W(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:W(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Hs.pie,useWidth:984},xyChart:{...Hs.xyChart,useWidth:void 0},requirement:{...Hs.requirement,useWidth:void 0},packet:{...Hs.packet},radar:{...Hs.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},Dbe=W((e,t="")=>Object.keys(e).reduce((n,r)=>Array.isArray(e[r])?n:typeof e[r]=="object"&&e[r]!==null?[...n,t+r,...Dbe(e[r],"")]:[...n,t+r],[]),"keyify"),Awt=new Set(Dbe(Lbe,"")),jbe=Lbe,XC=W(e=>{if(et.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>XC(t));return}for(const t of Object.keys(e)){if(et.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Awt.has(t)||e[t]==null){et.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){et.debug("sanitizing object",t),XC(e[t]);continue}const n=["themeCSS","fontFamily","altFontFamily"];for(const r of n)t.includes(r)&&(et.debug("sanitizing css option",t),e[t]=Rwt(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const n=e.themeVariables[t];n!=null&&n.match&&!n.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}et.debug("After sanitization",e)}},"sanitizeDirective"),Rwt=W(e=>{let t=0,n=0;for(const r of e){if(t<n)return"{ /* ERROR: Unbalanced CSS */ }";r==="{"?t++:r==="}"&&n++}return t!==n?"{ /* ERROR: Unbalanced CSS */ }":e},"sanitizeCss"),Th=Object.freeze(jbe),qi=Sa({},Th),ZC,Ud=[],pb=Sa({},Th),Z_=W((e,t)=>{let n=Sa({},e),r={};for(const a of t)zbe(a),r=Sa(r,a);if(n=Sa(n,r),r.theme&&r.theme in Vl){const a=Sa({},ZC),i=Sa(a.themeVariables||{},r.themeVariables);n.theme&&n.theme in Vl&&(n.themeVariables=Vl[n.theme].getThemeVariables(i))}return pb=n,Hbe(pb),pb},"updateCurrentConfig"),Mwt=W(e=>(qi=Sa({},Th),qi=Sa(qi,e),e.theme&&Vl[e.theme]&&(qi.themeVariables=Vl[e.theme].getThemeVariables(e.themeVariables)),Z_(qi,Ud),qi),"setSiteConfig"),Pwt=W(e=>{ZC=Sa({},e)},"saveConfigFromInitialize"),Nwt=W(e=>(qi=Sa(qi,e),Z_(qi,Ud),qi),"updateSiteConfig"),Bbe=W(()=>Sa({},qi),"getSiteConfig"),Fbe=W(e=>(Hbe(e),Sa(pb,e),mi()),"setConfig"),mi=W(()=>Sa({},pb),"getConfig"),zbe=W(e=>{e&&(["secure",...qi.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(et.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&zbe(e[t])}))},"sanitize"),Lwt=W(e=>{var t;XC(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Ud.push(e),Z_(qi,Ud)},"addDirective"),QC=W((e=qi)=>{Ud=[],Z_(e,Ud)},"reset"),Dwt={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},_te={},jwt=W(e=>{_te[e]||(et.warn(Dwt[e]),_te[e]=!0)},"issueWarning"),Hbe=W(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&jwt("LAZY_LOAD_DEPRECATED")},"checkConfig"),n4t=W(()=>{let e={};ZC&&(e=Sa(e,ZC));for(const t of Ud)e=Sa(e,t);return e},"getUserDefinedConfig"),T0=/<br\s*\/?>/gi,Bwt=W(e=>e?qbe(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),Fwt=(()=>{let e=!1;return()=>{e||(Ube(),e=!0)}})();function Ube(){const e="data-temp-href-target";zd.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),zd.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}W(Ube,"setupDompurifyHooks");var Wbe=W(e=>(Fwt(),zd.sanitize(e)),"removeScript"),Tte=W((e,t)=>{var n;if(((n=t.flowchart)==null?void 0:n.htmlLabels)!==!1){const r=t.securityLevel;r==="antiscript"||r==="strict"?e=Wbe(e):r!=="loose"&&(e=qbe(e),e=e.replace(/</g,"<").replace(/>/g,">"),e=e.replace(/=/g,"="),e=Wwt(e))}return e},"sanitizeMore"),Zo=W((e,t)=>e&&(t.dompurifyConfig?e=zd.sanitize(Tte(e,t),t.dompurifyConfig).toString():e=zd.sanitize(Tte(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),zwt=W((e,t)=>typeof e=="string"?Zo(e,t):e.flat().map(n=>Zo(n,t)),"sanitizeTextOrArray"),Hwt=W(e=>T0.test(e),"hasBreaks"),Uwt=W(e=>e.split(T0),"splitBreaks"),Wwt=W(e=>e.replace(/#br#/g,"<br/>"),"placeholderToBreak"),qbe=W(e=>e.replace(T0,"#br#"),"breakToPlaceholder"),qwt=W(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),_a=W(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),Vwt=W(function(...e){const t=e.filter(n=>!isNaN(n));return Math.max(...t)},"getMax"),Gwt=W(function(...e){const t=e.filter(n=>!isNaN(n));return Math.min(...t)},"getMin"),kte=W(function(e){const t=e.split(/(,)/),n=[];for(let r=0;r<t.length;r++){let a=t[r];if(a===","&&r>0&&r+1<t.length){const i=t[r-1],o=t[r+1];Kwt(i,o)&&(a=i+","+o,r++,n.pop())}n.push(Ywt(a))}return n.join("")},"parseGenericTypes"),SD=W((e,t)=>Math.max(0,e.split(t).length-1),"countOccurrence"),Kwt=W((e,t)=>{const n=SD(e,"~"),r=SD(t,"~");return n===1&&r===1},"shouldCombineSets"),Ywt=W(e=>{const t=SD(e,"~");let n=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),n=!0);const r=[...e];let a=r.indexOf("~"),i=r.lastIndexOf("~");for(;a!==-1&&i!==-1&&a!==i;)r[a]="<",r[i]=">",a=r.indexOf("~"),i=r.lastIndexOf("~");return n&&r.unshift("~"),r.join("")},"processSet"),Ote=W(()=>window.MathMLElement!==void 0,"isMathMLSupported"),xD=/\$\$(.*)\$\$/g,kh=W(e=>{var t;return(((t=e.match(xD))==null?void 0:t.length)??0)>0},"hasKatex"),r4t=W(async(e,t)=>{const n=document.createElement("div");n.innerHTML=await yH(e,t),n.id="katex-temp",n.style.visibility="hidden",n.style.position="absolute",n.style.top="0";const r=document.querySelector("body");r==null||r.insertAdjacentElement("beforeend",n);const a={width:n.clientWidth,height:n.clientHeight};return n.remove(),a},"calculateMathMLDimensions"),Xwt=W(async(e,t)=>{if(!kh(e))return e;if(!(Ote()||t.legacyMathML||t.forceLegacyMathML))return e.replace(xD,"MathML is unsupported in this environment.");{const{default:n}=await Mn(async()=>{const{default:a}=await import("./katex-ChWnQ-fc.js");return{default:a}},[],import.meta.url),r=t.forceLegacyMathML||!Ote()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(T0).map(a=>kh(a)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${a}</div>`:`<div>${a}</div>`).join("").replace(xD,(a,i)=>n.renderToString(i,{throwOnError:!0,displayMode:!0,output:r}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),yH=W(async(e,t)=>Zo(await Xwt(e,t),t),"renderKatexSanitized"),wg={getRows:Bwt,sanitizeText:Zo,sanitizeTextOrArray:zwt,hasBreaks:Hwt,splitBreaks:Uwt,lineBreakRegex:T0,removeScript:Wbe,getUrl:qwt,evaluate:_a,getMax:Vwt,getMin:Gwt},Zwt=W(function(e,t){for(let n of t)e.attr(n[0],n[1])},"d3Attrs"),Qwt=W(function(e,t,n){let r=new Map;return n?(r.set("width","100%"),r.set("style",`max-width: ${t}px;`)):(r.set("height",e),r.set("width",t)),r},"calculateSvgSizeAttrs"),Vbe=W(function(e,t,n,r){const a=Qwt(t,n,r);Zwt(e,a)},"configureSvgSize"),Jwt=W(function(e,t,n,r){const a=t.node().getBBox(),i=a.width,o=a.height;et.info(`SVG bounds: ${i}x${o}`,a);let s=0,l=0;et.info(`Graph bounds: ${s}x${l}`,e),s=i+n*2,l=o+n*2,et.info(`Calculated bounds: ${s}x${l}`),Vbe(t,l,s,r);const c=`${a.x-n} ${a.y-n} ${a.width+2*n} ${a.height+2*n}`;t.attr("viewBox",c)},"setupGraphViewbox"),Xx={},eCt=W((e,t,n)=>{let r="";return e in Xx&&Xx[e]?r=Xx[e](n):et.warn(`No theme found for ${e}`),` & {
|
|
710
710
|
font-family: ${n.fontFamily};
|
|
711
711
|
font-size: ${n.fontSize};
|
|
712
712
|
fill: ${n.textColor}
|
|
@@ -783,7 +783,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
783
783
|
|
|
784
784
|
${t}
|
|
785
785
|
`},"getStyles"),tCt=W((e,t)=>{t!==void 0&&(Xx[e]=t)},"addStylesForDiagram"),nCt=eCt,Gbe={};Wxt(Gbe,{clear:()=>rCt,getAccDescription:()=>sCt,getAccTitle:()=>iCt,getDiagramTitle:()=>cCt,setAccDescription:()=>oCt,setAccTitle:()=>aCt,setDiagramTitle:()=>lCt});var SH="",xH="",wH="",CH=W(e=>Zo(e,mi()),"sanitizeText"),rCt=W(()=>{SH="",wH="",xH=""},"clear"),aCt=W(e=>{SH=CH(e).replace(/^\s+/g,"")},"setAccTitle"),iCt=W(()=>SH,"getAccTitle"),oCt=W(e=>{wH=CH(e).replace(/\n\s+/g,`
|
|
786
|
-
`)},"setAccDescription"),sCt=W(()=>wH,"getAccDescription"),lCt=W(e=>{xH=CH(e)},"setDiagramTitle"),cCt=W(()=>xH,"getDiagramTitle"),$te=et,uCt=vH,pr=mi,r4t=Fbe,a4t=Th,EH=W(e=>Zo(e,pr()),"sanitizeText"),dCt=Jwt,fCt=W(()=>Gbe,"getCommonDb"),JC={},e1=W((e,t,n)=>{var r;JC[e]&&$te.warn(`Diagram with id ${e} already registered. Overwriting.`),JC[e]=t,n&&Nbe(e,n),tCt(e,t.styles),(r=t.injectUtils)==null||r.call(t,$te,uCt,pr,EH,dCt,fCt(),()=>{})},"registerDiagram"),wD=W(e=>{if(e in JC)return JC[e];throw new pCt(e)},"getDiagram"),Dp,pCt=(Dp=class extends Error{constructor(t){super(`Diagram ${t} not found.`)}},W(Dp,"DiagramNotFoundError"),Dp),hCt={value:()=>{}};function Kbe(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Zx(n)}function Zx(e){this._=e}function gCt(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Zx.prototype=Kbe.prototype={constructor:Zx,on:function(e,t){var n=this._,r=gCt(e+"",n),a,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((a=(e=r[i]).type)&&(a=mCt(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(a=(e=r[i]).type)n[a]=Ite(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Ite(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Zx(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,i;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,a=i.length;r<a;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};function mCt(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Ite(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=hCt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var CD="http://www.w3.org/1999/xhtml";const Ate={svg:"http://www.w3.org/2000/svg",xhtml:CD,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Q_(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ate.hasOwnProperty(t)?{space:Ate[t],local:e}:e}function vCt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===CD&&t.documentElement.namespaceURI===CD?t.createElement(e):t.createElementNS(n,e)}}function bCt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ybe(e){var t=Q_(e);return(t.local?bCt:vCt)(t)}function yCt(){}function _H(e){return e==null?yCt:function(){return this.querySelector(e)}}function SCt(e){typeof e!="function"&&(e=_H(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=new Array(o),l,c,u=0;u<o;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),s[u]=c);return new bo(r,this._parents)}function xCt(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wCt(){return[]}function Xbe(e){return e==null?wCt:function(){return this.querySelectorAll(e)}}function CCt(e){return function(){return xCt(e.apply(this,arguments))}}function ECt(e){typeof e=="function"?e=CCt(e):e=Xbe(e);for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o=t[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&(r.push(e.call(l,l.__data__,c,o)),a.push(l));return new bo(r,a)}function Zbe(e){return function(){return this.matches(e)}}function Qbe(e){return function(t){return t.matches(e)}}var _Ct=Array.prototype.find;function TCt(e){return function(){return _Ct.call(this.children,e)}}function kCt(){return this.firstElementChild}function OCt(e){return this.select(e==null?kCt:TCt(typeof e=="function"?e:Qbe(e)))}var $Ct=Array.prototype.filter;function ICt(){return Array.from(this.children)}function ACt(e){return function(){return $Ct.call(this.children,e)}}function RCt(e){return this.selectAll(e==null?ICt:ACt(typeof e=="function"?e:Qbe(e)))}function MCt(e){typeof e!="function"&&(e=Zbe(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new bo(r,this._parents)}function Jbe(e){return new Array(e.length)}function PCt(){return new bo(this._enter||this._groups.map(Jbe),this._parents)}function t1(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}t1.prototype={constructor:t1,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function NCt(e){return function(){return e}}function LCt(e,t,n,r,a,i){for(var o=0,s,l=t.length,c=i.length;o<c;++o)(s=t[o])?(s.__data__=i[o],r[o]=s):n[o]=new t1(e,i[o]);for(;o<l;++o)(s=t[o])&&(a[o]=s)}function DCt(e,t,n,r,a,i,o){var s,l,c=new Map,u=t.length,d=i.length,f=new Array(u),h;for(s=0;s<u;++s)(l=t[s])&&(f[s]=h=o.call(l,l.__data__,s,t)+"",c.has(h)?a[s]=l:c.set(h,l));for(s=0;s<d;++s)h=o.call(e,i[s],s,i)+"",(l=c.get(h))?(r[s]=l,l.__data__=i[s],c.delete(h)):n[s]=new t1(e,i[s]);for(s=0;s<u;++s)(l=t[s])&&c.get(f[s])===l&&(a[s]=l)}function jCt(e){return e.__data__}function BCt(e,t){if(!arguments.length)return Array.from(this,jCt);var n=t?DCt:LCt,r=this._parents,a=this._groups;typeof e!="function"&&(e=NCt(e));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var u=r[c],d=a[c],f=d.length,h=FCt(e.call(u,u&&u.__data__,c,r)),g=h.length,m=s[c]=new Array(g),v=o[c]=new Array(g),b=l[c]=new Array(f);n(u,d,m,v,b,h,t);for(var y=0,S=0,C,x;y<g;++y)if(C=m[y]){for(y>=S&&(S=y+1);!(x=v[S])&&++S<g;);C._next=x||null}}return o=new bo(o,r),o._enter=s,o._exit=l,o}function FCt(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zCt(){return new bo(this._exit||this._groups.map(Jbe),this._parents)}function HCt(e,t,n){var r=this.enter(),a=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),r&&a?r.merge(a).order():a}function UCt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var c=n[l],u=r[l],d=c.length,f=s[l]=new Array(d),h,g=0;g<d;++g)(h=c[g]||u[g])&&(f[g]=h);for(;l<a;++l)s[l]=n[l];return new bo(s,this._parents)}function WCt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,i=r[a],o;--a>=0;)(o=r[a])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function qCt(e){e||(e=VCt);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o=n[i],s=o.length,l=a[i]=new Array(s),c,u=0;u<s;++u)(c=o[u])&&(l[u]=c);l.sort(t)}return new bo(a,this._parents).order()}function VCt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function GCt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function KCt(){return Array.from(this)}function YCt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null}function XCt(){let e=0;for(const t of this)++e;return e}function ZCt(){return!this.node()}function QCt(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],i=0,o=a.length,s;i<o;++i)(s=a[i])&&e.call(s,s.__data__,i,a);return this}function JCt(e){return function(){this.removeAttribute(e)}}function e1t(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t1t(e,t){return function(){this.setAttribute(e,t)}}function n1t(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function r1t(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function a1t(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function i1t(e,t){var n=Q_(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?e1t:JCt:typeof t=="function"?n.local?a1t:r1t:n.local?n1t:t1t)(n,t))}function eye(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function o1t(e){return function(){this.style.removeProperty(e)}}function s1t(e,t,n){return function(){this.style.setProperty(e,t,n)}}function l1t(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function c1t(e,t,n){return arguments.length>1?this.each((t==null?o1t:typeof t=="function"?l1t:s1t)(e,t,n??"")):Oh(this.node(),e)}function Oh(e,t){return e.style.getPropertyValue(t)||eye(e).getComputedStyle(e,null).getPropertyValue(t)}function u1t(e){return function(){delete this[e]}}function d1t(e,t){return function(){this[e]=t}}function f1t(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function p1t(e,t){return arguments.length>1?this.each((t==null?u1t:typeof t=="function"?f1t:d1t)(e,t)):this.node()[e]}function tye(e){return e.trim().split(/^|\s+/)}function TH(e){return e.classList||new nye(e)}function nye(e){this._node=e,this._names=tye(e.getAttribute("class")||"")}nye.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function rye(e,t){for(var n=TH(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function aye(e,t){for(var n=TH(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function h1t(e){return function(){rye(this,e)}}function g1t(e){return function(){aye(this,e)}}function m1t(e,t){return function(){(t.apply(this,arguments)?rye:aye)(this,e)}}function v1t(e,t){var n=tye(e+"");if(arguments.length<2){for(var r=TH(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?m1t:t?h1t:g1t)(n,t))}function b1t(){this.textContent=""}function y1t(e){return function(){this.textContent=e}}function S1t(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function x1t(e){return arguments.length?this.each(e==null?b1t:(typeof e=="function"?S1t:y1t)(e)):this.node().textContent}function w1t(){this.innerHTML=""}function C1t(e){return function(){this.innerHTML=e}}function E1t(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _1t(e){return arguments.length?this.each(e==null?w1t:(typeof e=="function"?E1t:C1t)(e)):this.node().innerHTML}function T1t(){this.nextSibling&&this.parentNode.appendChild(this)}function k1t(){return this.each(T1t)}function O1t(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $1t(){return this.each(O1t)}function I1t(e){var t=typeof e=="function"?e:Ybe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function A1t(){return null}function R1t(e,t){var n=typeof e=="function"?e:Ybe(e),r=t==null?A1t:typeof t=="function"?t:_H(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function M1t(){var e=this.parentNode;e&&e.removeChild(this)}function P1t(){return this.each(M1t)}function N1t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function L1t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D1t(e){return this.select(e?L1t:N1t)}function j1t(e){return arguments.length?this.property("__data__",e):this.node().__data__}function B1t(e){return function(t){e.call(this,t,this.__data__)}}function F1t(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function z1t(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function H1t(e,t,n){return function(){var r=this.__on,a,i=B1t(t);if(r){for(var o=0,s=r.length;o<s;++o)if((a=r[o]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(a):this.__on=[a]}}function U1t(e,t,n){var r=F1t(e+""),a,i=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,u;l<c;++l)for(a=0,u=s[l];a<i;++a)if((o=r[a]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?H1t:z1t,a=0;a<i;++a)this.each(s(r[a],t,n));return this}function iye(e,t,n){var r=eye(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function W1t(e,t){return function(){return iye(this,e,t)}}function q1t(e,t){return function(){return iye(this,e,t.apply(this,arguments))}}function V1t(e,t){return this.each((typeof t=="function"?q1t:W1t)(e,t))}function*G1t(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length,o;a<i;++a)(o=r[a])&&(yield o)}var oye=[null];function bo(e,t){this._groups=e,this._parents=t}function k0(){return new bo([[document.documentElement]],oye)}function K1t(){return this}bo.prototype=k0.prototype={constructor:bo,select:SCt,selectAll:ECt,selectChild:OCt,selectChildren:RCt,filter:MCt,data:BCt,enter:PCt,exit:zCt,join:HCt,merge:UCt,selection:K1t,order:WCt,sort:qCt,call:GCt,nodes:KCt,node:YCt,size:XCt,empty:ZCt,each:QCt,attr:i1t,style:c1t,property:p1t,classed:v1t,text:x1t,html:_1t,raise:k1t,lower:$1t,append:I1t,insert:R1t,remove:P1t,clone:D1t,datum:j1t,on:U1t,dispatch:V1t,[Symbol.iterator]:G1t};function er(e){return typeof e=="string"?new bo([[document.querySelector(e)]],[document.documentElement]):new bo([[e]],oye)}var $h=0,Av=0,bm=0,sye=1e3,n1,Rv,r1=0,Wd=0,J_=0,ky=typeof performance=="object"&&performance.now?performance:Date,lye=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kH(){return Wd||(lye(Y1t),Wd=ky.now()+J_)}function Y1t(){Wd=0}function a1(){this._call=this._time=this._next=null}a1.prototype=cye.prototype={constructor:a1,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?kH():+n)+(t==null?0:+t),!this._next&&Rv!==this&&(Rv?Rv._next=this:n1=this,Rv=this),this._call=e,this._time=n,ED()},stop:function(){this._call&&(this._call=null,this._time=1/0,ED())}};function cye(e,t,n){var r=new a1;return r.restart(e,t,n),r}function X1t(){kH(),++$h;for(var e=n1,t;e;)(t=Wd-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$h}function Rte(){Wd=(r1=ky.now())+J_,$h=Av=0;try{X1t()}finally{$h=0,Q1t(),Wd=0}}function Z1t(){var e=ky.now(),t=e-r1;t>sye&&(J_-=t,r1=e)}function Q1t(){for(var e,t=n1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:n1=n);Rv=e,ED(r)}function ED(e){if(!$h){Av&&(Av=clearTimeout(Av));var t=e-Wd;t>24?(e<1/0&&(Av=setTimeout(Rte,e-ky.now()-J_)),bm&&(bm=clearInterval(bm))):(bm||(r1=ky.now(),bm=setInterval(Z1t,sye)),$h=1,lye(Rte))}}function Mte(e,t,n){var r=new a1;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var J1t=Kbe("start","end","cancel","interrupt"),eEt=[],uye=0,Pte=1,_D=2,Qx=3,Nte=4,TD=5,Jx=6;function eT(e,t,n,r,a,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;tEt(e,n,{name:t,index:r,group:a,on:J1t,tween:eEt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:uye})}function OH(e,t){var n=js(e,t);if(n.state>uye)throw new Error("too late; already scheduled");return n}function Sl(e,t){var n=js(e,t);if(n.state>Qx)throw new Error("too late; already running");return n}function js(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tEt(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=cye(i,0,n.time);function i(c){n.state=Pte,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,d,f,h;if(n.state!==Pte)return l();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Qx)return Mte(o);h.state===Nte?(h.state=Jx,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Jx,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Mte(function(){n.state===Qx&&(n.state=Nte,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=_D,n.on.call("start",e,e.__data__,n.index,n.group),n.state===_D){for(n.state=Qx,a=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(a[++d]=h);a.length=d+1}}function s(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=TD,1),d=-1,f=a.length;++d<f;)a[d].call(e,u);n.state===TD&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Jx,n.timer.stop(),delete r[t];for(var c in r)return;delete e.__transition}}function nEt(e,t){var n=e.__transition,r,a,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}a=r.state>_D&&r.state<TD,r.state=Jx,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function rEt(e){return this.each(function(){nEt(this,e)})}function aEt(e,t){var n,r;return function(){var a=Sl(this,e),i=a.tween;if(i!==n){r=n=i;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}a.tween=r}}function iEt(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var i=Sl(this,e),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:t,value:n},l=0,c=a.length;l<c;++l)if(a[l].name===t){a[l]=s;break}l===c&&a.push(s)}i.tween=a}}function oEt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=js(this.node(),n).tween,a=0,i=r.length,o;a<i;++a)if((o=r[a]).name===e)return o.value;return null}return this.each((t==null?aEt:iEt)(n,e,t))}function $H(e,t,n){var r=e._id;return e.each(function(){var a=Sl(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return js(a,r).value[t]}}function dye(e,t){var n;return(typeof t=="number"?ds:t instanceof Dd?fC:(n=Dd(t))?(t=n,fC):ome)(e,t)}function sEt(e){return function(){this.removeAttribute(e)}}function lEt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cEt(e,t,n){var r,a=n+"",i;return function(){var o=this.getAttribute(e);return o===a?null:o===r?i:i=t(r=o,n)}}function uEt(e,t,n){var r,a=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===r?i:i=t(r=o,n)}}function dEt(e,t,n){var r,a,i;return function(){var o,s=n(this),l;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s)))}}function fEt(e,t,n){var r,a,i;return function(){var o,s=n(this),l;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s)))}}function pEt(e,t){var n=Q_(e),r=n==="transform"?Jct:dye;return this.attrTween(e,typeof t=="function"?(n.local?fEt:dEt)(n,r,$H(this,"attr."+e,t)):t==null?(n.local?lEt:sEt)(n):(n.local?uEt:cEt)(n,r,t))}function hEt(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gEt(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mEt(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&gEt(e,i)),n}return a._value=t,a}function vEt(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&hEt(e,i)),n}return a._value=t,a}function bEt(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Q_(e);return this.tween(n,(r.local?mEt:vEt)(r,t))}function yEt(e,t){return function(){OH(this,e).delay=+t.apply(this,arguments)}}function SEt(e,t){return t=+t,function(){OH(this,e).delay=t}}function xEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?yEt:SEt)(t,e)):js(this.node(),t).delay}function wEt(e,t){return function(){Sl(this,e).duration=+t.apply(this,arguments)}}function CEt(e,t){return t=+t,function(){Sl(this,e).duration=t}}function EEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wEt:CEt)(t,e)):js(this.node(),t).duration}function _Et(e,t){if(typeof t!="function")throw new Error;return function(){Sl(this,e).ease=t}}function TEt(e){var t=this._id;return arguments.length?this.each(_Et(t,e)):js(this.node(),t).ease}function kEt(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Sl(this,e).ease=n}}function OEt(e){if(typeof e!="function")throw new Error;return this.each(kEt(this._id,e))}function $Et(e){typeof e!="function"&&(e=Zbe(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new nc(r,this._parents,this._name,this._id)}function IEt(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l=t[s],c=n[s],u=l.length,d=o[s]=new Array(u),f,h=0;h<u;++h)(f=l[h]||c[h])&&(d[h]=f);for(;s<r;++s)o[s]=t[s];return new nc(o,this._parents,this._name,this._id)}function AEt(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function REt(e,t,n){var r,a,i=AEt(t)?OH:Sl;return function(){var o=i(this,e),s=o.on;s!==r&&(a=(r=s).copy()).on(t,n),o.on=a}}function MEt(e,t){var n=this._id;return arguments.length<2?js(this.node(),n).on.on(e):this.each(REt(n,e,t))}function PEt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function NEt(){return this.on("end.remove",PEt(this._id))}function LEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_H(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s=r[o],l=s.length,c=i[o]=new Array(l),u,d,f=0;f<l;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,eT(c[f],t,n,f,c,js(u,n)));return new nc(i,this._parents,t,n)}function DEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xbe(e));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l=r[s],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),h,g=js(u,n),m=0,v=f.length;m<v;++m)(h=f[m])&&eT(h,t,n,m,f,g);i.push(f),o.push(u)}return new nc(i,o,t,n)}var jEt=k0.prototype.constructor;function BEt(){return new jEt(this._groups,this._parents)}function FEt(e,t){var n,r,a;return function(){var i=Oh(this,e),o=(this.style.removeProperty(e),Oh(this,e));return i===o?null:i===n&&o===r?a:a=t(n=i,r=o)}}function fye(e){return function(){this.style.removeProperty(e)}}function zEt(e,t,n){var r,a=n+"",i;return function(){var o=Oh(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}function HEt(e,t,n){var r,a,i;return function(){var o=Oh(this,e),s=n(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),Oh(this,e))),o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s))}}function UEt(e,t){var n,r,a,i="style."+t,o="end."+i,s;return function(){var l=Sl(this,e),c=l.on,u=l.value[i]==null?s||(s=fye(t)):void 0;(c!==n||a!==u)&&(r=(n=c).copy()).on(o,a=u),l.on=r}}function WEt(e,t,n){var r=(e+="")=="transform"?Qct:dye;return t==null?this.styleTween(e,FEt(e,r)).on("end.style."+e,fye(e)):typeof t=="function"?this.styleTween(e,HEt(e,r,$H(this,"style."+e,t))).each(UEt(this._id,e)):this.styleTween(e,zEt(e,r,t),n).on("end.style."+e,null)}function qEt(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VEt(e,t,n){var r,a;function i(){var o=t.apply(this,arguments);return o!==a&&(r=(a=o)&&qEt(e,o,n)),r}return i._value=t,i}function GEt(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,VEt(e,t,n??""))}function KEt(e){return function(){this.textContent=e}}function YEt(e){return function(){var t=e(this);this.textContent=t??""}}function XEt(e){return this.tween("text",typeof e=="function"?YEt($H(this,"text",e)):KEt(e==null?"":e+""))}function ZEt(e){return function(t){this.textContent=e.call(this,t)}}function QEt(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&ZEt(a)),t}return r._value=e,r}function JEt(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,QEt(e))}function e_t(){for(var e=this._name,t=this._id,n=pye(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)if(l=o[c]){var u=js(l,t);eT(l,e,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new nc(r,this._parents,e,n)}function t_t(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(i,o){var s={value:o},l={value:function(){--a===0&&i()}};n.each(function(){var c=Sl(this,r),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),c.on=t}),a===0&&i()})}var n_t=0;function nc(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function pye(){return++n_t}var Ol=k0.prototype;nc.prototype={constructor:nc,select:LEt,selectAll:DEt,selectChild:Ol.selectChild,selectChildren:Ol.selectChildren,filter:$Et,merge:IEt,selection:BEt,transition:e_t,call:Ol.call,nodes:Ol.nodes,node:Ol.node,size:Ol.size,empty:Ol.empty,each:Ol.each,on:MEt,attr:pEt,attrTween:bEt,style:WEt,styleTween:GEt,text:XEt,textTween:JEt,remove:NEt,tween:oEt,delay:xEt,duration:EEt,ease:TEt,easeVarying:OEt,end:t_t,[Symbol.iterator]:Ol[Symbol.iterator]};function r_t(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var a_t={time:null,delay:0,duration:250,ease:r_t};function i_t(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function o_t(e){var t,n;e instanceof nc?(t=e._id,e=e._name):(t=pye(),(n=a_t).time=kH(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&eT(l,e,t,c,o,n||i_t(l,t));return new nc(r,this._parents,e,t)}k0.prototype.interrupt=rEt;k0.prototype.transition=o_t;function Mv(e,t,n){this.k=e,this.x=t,this.y=n}Mv.prototype={constructor:Mv,scale:function(e){return e===1?this:new Mv(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mv(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Mv.prototype;var s_t=W(e=>{var a;const{securityLevel:t}=pr();let n=er("body");if(t==="sandbox"){const o=((a=er(`#i${e}`).node())==null?void 0:a.contentDocument)??document;n=er(o.body)}return n.select(`#${e}`)},"selectSvgElement");function IH(e){return typeof e>"u"||e===null}W(IH,"isNothing");function hye(e){return typeof e=="object"&&e!==null}W(hye,"isObject");function gye(e){return Array.isArray(e)?e:IH(e)?[]:[e]}W(gye,"toArray");function mye(e,t){var n,r,a,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)a=i[n],e[a]=t[a];return e}W(mye,"extend");function vye(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}W(vye,"repeat");function bye(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}W(bye,"isNegativeZero");var l_t=IH,c_t=hye,u_t=gye,d_t=vye,f_t=bye,p_t=mye,xa={isNothing:l_t,isObject:c_t,toArray:u_t,repeat:d_t,isNegativeZero:f_t,extend:p_t};function AH(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
786
|
+
`)},"setAccDescription"),sCt=W(()=>wH,"getAccDescription"),lCt=W(e=>{xH=CH(e)},"setDiagramTitle"),cCt=W(()=>xH,"getDiagramTitle"),$te=et,uCt=vH,pr=mi,a4t=Fbe,i4t=Th,EH=W(e=>Zo(e,pr()),"sanitizeText"),dCt=Jwt,fCt=W(()=>Gbe,"getCommonDb"),JC={},e1=W((e,t,n)=>{var r;JC[e]&&$te.warn(`Diagram with id ${e} already registered. Overwriting.`),JC[e]=t,n&&Nbe(e,n),tCt(e,t.styles),(r=t.injectUtils)==null||r.call(t,$te,uCt,pr,EH,dCt,fCt(),()=>{})},"registerDiagram"),wD=W(e=>{if(e in JC)return JC[e];throw new pCt(e)},"getDiagram"),Dp,pCt=(Dp=class extends Error{constructor(t){super(`Diagram ${t} not found.`)}},W(Dp,"DiagramNotFoundError"),Dp),hCt={value:()=>{}};function Kbe(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Zx(n)}function Zx(e){this._=e}function gCt(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Zx.prototype=Kbe.prototype={constructor:Zx,on:function(e,t){var n=this._,r=gCt(e+"",n),a,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((a=(e=r[i]).type)&&(a=mCt(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(a=(e=r[i]).type)n[a]=Ite(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Ite(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Zx(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,i;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,a=i.length;r<a;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};function mCt(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Ite(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=hCt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var CD="http://www.w3.org/1999/xhtml";const Ate={svg:"http://www.w3.org/2000/svg",xhtml:CD,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Q_(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ate.hasOwnProperty(t)?{space:Ate[t],local:e}:e}function vCt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===CD&&t.documentElement.namespaceURI===CD?t.createElement(e):t.createElementNS(n,e)}}function bCt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ybe(e){var t=Q_(e);return(t.local?bCt:vCt)(t)}function yCt(){}function _H(e){return e==null?yCt:function(){return this.querySelector(e)}}function SCt(e){typeof e!="function"&&(e=_H(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=new Array(o),l,c,u=0;u<o;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),s[u]=c);return new bo(r,this._parents)}function xCt(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wCt(){return[]}function Xbe(e){return e==null?wCt:function(){return this.querySelectorAll(e)}}function CCt(e){return function(){return xCt(e.apply(this,arguments))}}function ECt(e){typeof e=="function"?e=CCt(e):e=Xbe(e);for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o=t[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&(r.push(e.call(l,l.__data__,c,o)),a.push(l));return new bo(r,a)}function Zbe(e){return function(){return this.matches(e)}}function Qbe(e){return function(t){return t.matches(e)}}var _Ct=Array.prototype.find;function TCt(e){return function(){return _Ct.call(this.children,e)}}function kCt(){return this.firstElementChild}function OCt(e){return this.select(e==null?kCt:TCt(typeof e=="function"?e:Qbe(e)))}var $Ct=Array.prototype.filter;function ICt(){return Array.from(this.children)}function ACt(e){return function(){return $Ct.call(this.children,e)}}function RCt(e){return this.selectAll(e==null?ICt:ACt(typeof e=="function"?e:Qbe(e)))}function MCt(e){typeof e!="function"&&(e=Zbe(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new bo(r,this._parents)}function Jbe(e){return new Array(e.length)}function PCt(){return new bo(this._enter||this._groups.map(Jbe),this._parents)}function t1(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}t1.prototype={constructor:t1,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function NCt(e){return function(){return e}}function LCt(e,t,n,r,a,i){for(var o=0,s,l=t.length,c=i.length;o<c;++o)(s=t[o])?(s.__data__=i[o],r[o]=s):n[o]=new t1(e,i[o]);for(;o<l;++o)(s=t[o])&&(a[o]=s)}function DCt(e,t,n,r,a,i,o){var s,l,c=new Map,u=t.length,d=i.length,f=new Array(u),h;for(s=0;s<u;++s)(l=t[s])&&(f[s]=h=o.call(l,l.__data__,s,t)+"",c.has(h)?a[s]=l:c.set(h,l));for(s=0;s<d;++s)h=o.call(e,i[s],s,i)+"",(l=c.get(h))?(r[s]=l,l.__data__=i[s],c.delete(h)):n[s]=new t1(e,i[s]);for(s=0;s<u;++s)(l=t[s])&&c.get(f[s])===l&&(a[s]=l)}function jCt(e){return e.__data__}function BCt(e,t){if(!arguments.length)return Array.from(this,jCt);var n=t?DCt:LCt,r=this._parents,a=this._groups;typeof e!="function"&&(e=NCt(e));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var u=r[c],d=a[c],f=d.length,h=FCt(e.call(u,u&&u.__data__,c,r)),g=h.length,m=s[c]=new Array(g),v=o[c]=new Array(g),b=l[c]=new Array(f);n(u,d,m,v,b,h,t);for(var y=0,S=0,C,x;y<g;++y)if(C=m[y]){for(y>=S&&(S=y+1);!(x=v[S])&&++S<g;);C._next=x||null}}return o=new bo(o,r),o._enter=s,o._exit=l,o}function FCt(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zCt(){return new bo(this._exit||this._groups.map(Jbe),this._parents)}function HCt(e,t,n){var r=this.enter(),a=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),r&&a?r.merge(a).order():a}function UCt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var c=n[l],u=r[l],d=c.length,f=s[l]=new Array(d),h,g=0;g<d;++g)(h=c[g]||u[g])&&(f[g]=h);for(;l<a;++l)s[l]=n[l];return new bo(s,this._parents)}function WCt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,i=r[a],o;--a>=0;)(o=r[a])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function qCt(e){e||(e=VCt);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o=n[i],s=o.length,l=a[i]=new Array(s),c,u=0;u<s;++u)(c=o[u])&&(l[u]=c);l.sort(t)}return new bo(a,this._parents).order()}function VCt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function GCt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function KCt(){return Array.from(this)}function YCt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null}function XCt(){let e=0;for(const t of this)++e;return e}function ZCt(){return!this.node()}function QCt(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],i=0,o=a.length,s;i<o;++i)(s=a[i])&&e.call(s,s.__data__,i,a);return this}function JCt(e){return function(){this.removeAttribute(e)}}function e1t(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t1t(e,t){return function(){this.setAttribute(e,t)}}function n1t(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function r1t(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function a1t(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function i1t(e,t){var n=Q_(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?e1t:JCt:typeof t=="function"?n.local?a1t:r1t:n.local?n1t:t1t)(n,t))}function eye(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function o1t(e){return function(){this.style.removeProperty(e)}}function s1t(e,t,n){return function(){this.style.setProperty(e,t,n)}}function l1t(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function c1t(e,t,n){return arguments.length>1?this.each((t==null?o1t:typeof t=="function"?l1t:s1t)(e,t,n??"")):Oh(this.node(),e)}function Oh(e,t){return e.style.getPropertyValue(t)||eye(e).getComputedStyle(e,null).getPropertyValue(t)}function u1t(e){return function(){delete this[e]}}function d1t(e,t){return function(){this[e]=t}}function f1t(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function p1t(e,t){return arguments.length>1?this.each((t==null?u1t:typeof t=="function"?f1t:d1t)(e,t)):this.node()[e]}function tye(e){return e.trim().split(/^|\s+/)}function TH(e){return e.classList||new nye(e)}function nye(e){this._node=e,this._names=tye(e.getAttribute("class")||"")}nye.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function rye(e,t){for(var n=TH(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function aye(e,t){for(var n=TH(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function h1t(e){return function(){rye(this,e)}}function g1t(e){return function(){aye(this,e)}}function m1t(e,t){return function(){(t.apply(this,arguments)?rye:aye)(this,e)}}function v1t(e,t){var n=tye(e+"");if(arguments.length<2){for(var r=TH(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?m1t:t?h1t:g1t)(n,t))}function b1t(){this.textContent=""}function y1t(e){return function(){this.textContent=e}}function S1t(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function x1t(e){return arguments.length?this.each(e==null?b1t:(typeof e=="function"?S1t:y1t)(e)):this.node().textContent}function w1t(){this.innerHTML=""}function C1t(e){return function(){this.innerHTML=e}}function E1t(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _1t(e){return arguments.length?this.each(e==null?w1t:(typeof e=="function"?E1t:C1t)(e)):this.node().innerHTML}function T1t(){this.nextSibling&&this.parentNode.appendChild(this)}function k1t(){return this.each(T1t)}function O1t(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $1t(){return this.each(O1t)}function I1t(e){var t=typeof e=="function"?e:Ybe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function A1t(){return null}function R1t(e,t){var n=typeof e=="function"?e:Ybe(e),r=t==null?A1t:typeof t=="function"?t:_H(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function M1t(){var e=this.parentNode;e&&e.removeChild(this)}function P1t(){return this.each(M1t)}function N1t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function L1t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D1t(e){return this.select(e?L1t:N1t)}function j1t(e){return arguments.length?this.property("__data__",e):this.node().__data__}function B1t(e){return function(t){e.call(this,t,this.__data__)}}function F1t(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function z1t(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function H1t(e,t,n){return function(){var r=this.__on,a,i=B1t(t);if(r){for(var o=0,s=r.length;o<s;++o)if((a=r[o]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(a):this.__on=[a]}}function U1t(e,t,n){var r=F1t(e+""),a,i=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,u;l<c;++l)for(a=0,u=s[l];a<i;++a)if((o=r[a]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?H1t:z1t,a=0;a<i;++a)this.each(s(r[a],t,n));return this}function iye(e,t,n){var r=eye(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function W1t(e,t){return function(){return iye(this,e,t)}}function q1t(e,t){return function(){return iye(this,e,t.apply(this,arguments))}}function V1t(e,t){return this.each((typeof t=="function"?q1t:W1t)(e,t))}function*G1t(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length,o;a<i;++a)(o=r[a])&&(yield o)}var oye=[null];function bo(e,t){this._groups=e,this._parents=t}function k0(){return new bo([[document.documentElement]],oye)}function K1t(){return this}bo.prototype=k0.prototype={constructor:bo,select:SCt,selectAll:ECt,selectChild:OCt,selectChildren:RCt,filter:MCt,data:BCt,enter:PCt,exit:zCt,join:HCt,merge:UCt,selection:K1t,order:WCt,sort:qCt,call:GCt,nodes:KCt,node:YCt,size:XCt,empty:ZCt,each:QCt,attr:i1t,style:c1t,property:p1t,classed:v1t,text:x1t,html:_1t,raise:k1t,lower:$1t,append:I1t,insert:R1t,remove:P1t,clone:D1t,datum:j1t,on:U1t,dispatch:V1t,[Symbol.iterator]:G1t};function er(e){return typeof e=="string"?new bo([[document.querySelector(e)]],[document.documentElement]):new bo([[e]],oye)}var $h=0,Av=0,bm=0,sye=1e3,n1,Rv,r1=0,Wd=0,J_=0,ky=typeof performance=="object"&&performance.now?performance:Date,lye=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kH(){return Wd||(lye(Y1t),Wd=ky.now()+J_)}function Y1t(){Wd=0}function a1(){this._call=this._time=this._next=null}a1.prototype=cye.prototype={constructor:a1,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?kH():+n)+(t==null?0:+t),!this._next&&Rv!==this&&(Rv?Rv._next=this:n1=this,Rv=this),this._call=e,this._time=n,ED()},stop:function(){this._call&&(this._call=null,this._time=1/0,ED())}};function cye(e,t,n){var r=new a1;return r.restart(e,t,n),r}function X1t(){kH(),++$h;for(var e=n1,t;e;)(t=Wd-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$h}function Rte(){Wd=(r1=ky.now())+J_,$h=Av=0;try{X1t()}finally{$h=0,Q1t(),Wd=0}}function Z1t(){var e=ky.now(),t=e-r1;t>sye&&(J_-=t,r1=e)}function Q1t(){for(var e,t=n1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:n1=n);Rv=e,ED(r)}function ED(e){if(!$h){Av&&(Av=clearTimeout(Av));var t=e-Wd;t>24?(e<1/0&&(Av=setTimeout(Rte,e-ky.now()-J_)),bm&&(bm=clearInterval(bm))):(bm||(r1=ky.now(),bm=setInterval(Z1t,sye)),$h=1,lye(Rte))}}function Mte(e,t,n){var r=new a1;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var J1t=Kbe("start","end","cancel","interrupt"),eEt=[],uye=0,Pte=1,_D=2,Qx=3,Nte=4,TD=5,Jx=6;function eT(e,t,n,r,a,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;tEt(e,n,{name:t,index:r,group:a,on:J1t,tween:eEt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:uye})}function OH(e,t){var n=js(e,t);if(n.state>uye)throw new Error("too late; already scheduled");return n}function Sl(e,t){var n=js(e,t);if(n.state>Qx)throw new Error("too late; already running");return n}function js(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tEt(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=cye(i,0,n.time);function i(c){n.state=Pte,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,d,f,h;if(n.state!==Pte)return l();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Qx)return Mte(o);h.state===Nte?(h.state=Jx,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Jx,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Mte(function(){n.state===Qx&&(n.state=Nte,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=_D,n.on.call("start",e,e.__data__,n.index,n.group),n.state===_D){for(n.state=Qx,a=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(a[++d]=h);a.length=d+1}}function s(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=TD,1),d=-1,f=a.length;++d<f;)a[d].call(e,u);n.state===TD&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Jx,n.timer.stop(),delete r[t];for(var c in r)return;delete e.__transition}}function nEt(e,t){var n=e.__transition,r,a,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}a=r.state>_D&&r.state<TD,r.state=Jx,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function rEt(e){return this.each(function(){nEt(this,e)})}function aEt(e,t){var n,r;return function(){var a=Sl(this,e),i=a.tween;if(i!==n){r=n=i;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}a.tween=r}}function iEt(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var i=Sl(this,e),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:t,value:n},l=0,c=a.length;l<c;++l)if(a[l].name===t){a[l]=s;break}l===c&&a.push(s)}i.tween=a}}function oEt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=js(this.node(),n).tween,a=0,i=r.length,o;a<i;++a)if((o=r[a]).name===e)return o.value;return null}return this.each((t==null?aEt:iEt)(n,e,t))}function $H(e,t,n){var r=e._id;return e.each(function(){var a=Sl(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return js(a,r).value[t]}}function dye(e,t){var n;return(typeof t=="number"?ds:t instanceof Dd?fC:(n=Dd(t))?(t=n,fC):ome)(e,t)}function sEt(e){return function(){this.removeAttribute(e)}}function lEt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cEt(e,t,n){var r,a=n+"",i;return function(){var o=this.getAttribute(e);return o===a?null:o===r?i:i=t(r=o,n)}}function uEt(e,t,n){var r,a=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===r?i:i=t(r=o,n)}}function dEt(e,t,n){var r,a,i;return function(){var o,s=n(this),l;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s)))}}function fEt(e,t,n){var r,a,i;return function(){var o,s=n(this),l;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s)))}}function pEt(e,t){var n=Q_(e),r=n==="transform"?Jct:dye;return this.attrTween(e,typeof t=="function"?(n.local?fEt:dEt)(n,r,$H(this,"attr."+e,t)):t==null?(n.local?lEt:sEt)(n):(n.local?uEt:cEt)(n,r,t))}function hEt(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gEt(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mEt(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&gEt(e,i)),n}return a._value=t,a}function vEt(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&hEt(e,i)),n}return a._value=t,a}function bEt(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Q_(e);return this.tween(n,(r.local?mEt:vEt)(r,t))}function yEt(e,t){return function(){OH(this,e).delay=+t.apply(this,arguments)}}function SEt(e,t){return t=+t,function(){OH(this,e).delay=t}}function xEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?yEt:SEt)(t,e)):js(this.node(),t).delay}function wEt(e,t){return function(){Sl(this,e).duration=+t.apply(this,arguments)}}function CEt(e,t){return t=+t,function(){Sl(this,e).duration=t}}function EEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wEt:CEt)(t,e)):js(this.node(),t).duration}function _Et(e,t){if(typeof t!="function")throw new Error;return function(){Sl(this,e).ease=t}}function TEt(e){var t=this._id;return arguments.length?this.each(_Et(t,e)):js(this.node(),t).ease}function kEt(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Sl(this,e).ease=n}}function OEt(e){if(typeof e!="function")throw new Error;return this.each(kEt(this._id,e))}function $Et(e){typeof e!="function"&&(e=Zbe(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new nc(r,this._parents,this._name,this._id)}function IEt(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l=t[s],c=n[s],u=l.length,d=o[s]=new Array(u),f,h=0;h<u;++h)(f=l[h]||c[h])&&(d[h]=f);for(;s<r;++s)o[s]=t[s];return new nc(o,this._parents,this._name,this._id)}function AEt(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function REt(e,t,n){var r,a,i=AEt(t)?OH:Sl;return function(){var o=i(this,e),s=o.on;s!==r&&(a=(r=s).copy()).on(t,n),o.on=a}}function MEt(e,t){var n=this._id;return arguments.length<2?js(this.node(),n).on.on(e):this.each(REt(n,e,t))}function PEt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function NEt(){return this.on("end.remove",PEt(this._id))}function LEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_H(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s=r[o],l=s.length,c=i[o]=new Array(l),u,d,f=0;f<l;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,eT(c[f],t,n,f,c,js(u,n)));return new nc(i,this._parents,t,n)}function DEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xbe(e));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l=r[s],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),h,g=js(u,n),m=0,v=f.length;m<v;++m)(h=f[m])&&eT(h,t,n,m,f,g);i.push(f),o.push(u)}return new nc(i,o,t,n)}var jEt=k0.prototype.constructor;function BEt(){return new jEt(this._groups,this._parents)}function FEt(e,t){var n,r,a;return function(){var i=Oh(this,e),o=(this.style.removeProperty(e),Oh(this,e));return i===o?null:i===n&&o===r?a:a=t(n=i,r=o)}}function fye(e){return function(){this.style.removeProperty(e)}}function zEt(e,t,n){var r,a=n+"",i;return function(){var o=Oh(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}function HEt(e,t,n){var r,a,i;return function(){var o=Oh(this,e),s=n(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),Oh(this,e))),o===l?null:o===r&&l===a?i:(a=l,i=t(r=o,s))}}function UEt(e,t){var n,r,a,i="style."+t,o="end."+i,s;return function(){var l=Sl(this,e),c=l.on,u=l.value[i]==null?s||(s=fye(t)):void 0;(c!==n||a!==u)&&(r=(n=c).copy()).on(o,a=u),l.on=r}}function WEt(e,t,n){var r=(e+="")=="transform"?Qct:dye;return t==null?this.styleTween(e,FEt(e,r)).on("end.style."+e,fye(e)):typeof t=="function"?this.styleTween(e,HEt(e,r,$H(this,"style."+e,t))).each(UEt(this._id,e)):this.styleTween(e,zEt(e,r,t),n).on("end.style."+e,null)}function qEt(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VEt(e,t,n){var r,a;function i(){var o=t.apply(this,arguments);return o!==a&&(r=(a=o)&&qEt(e,o,n)),r}return i._value=t,i}function GEt(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,VEt(e,t,n??""))}function KEt(e){return function(){this.textContent=e}}function YEt(e){return function(){var t=e(this);this.textContent=t??""}}function XEt(e){return this.tween("text",typeof e=="function"?YEt($H(this,"text",e)):KEt(e==null?"":e+""))}function ZEt(e){return function(t){this.textContent=e.call(this,t)}}function QEt(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&ZEt(a)),t}return r._value=e,r}function JEt(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,QEt(e))}function e_t(){for(var e=this._name,t=this._id,n=pye(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)if(l=o[c]){var u=js(l,t);eT(l,e,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new nc(r,this._parents,e,n)}function t_t(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(i,o){var s={value:o},l={value:function(){--a===0&&i()}};n.each(function(){var c=Sl(this,r),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),c.on=t}),a===0&&i()})}var n_t=0;function nc(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function pye(){return++n_t}var Ol=k0.prototype;nc.prototype={constructor:nc,select:LEt,selectAll:DEt,selectChild:Ol.selectChild,selectChildren:Ol.selectChildren,filter:$Et,merge:IEt,selection:BEt,transition:e_t,call:Ol.call,nodes:Ol.nodes,node:Ol.node,size:Ol.size,empty:Ol.empty,each:Ol.each,on:MEt,attr:pEt,attrTween:bEt,style:WEt,styleTween:GEt,text:XEt,textTween:JEt,remove:NEt,tween:oEt,delay:xEt,duration:EEt,ease:TEt,easeVarying:OEt,end:t_t,[Symbol.iterator]:Ol[Symbol.iterator]};function r_t(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var a_t={time:null,delay:0,duration:250,ease:r_t};function i_t(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function o_t(e){var t,n;e instanceof nc?(t=e._id,e=e._name):(t=pye(),(n=a_t).time=kH(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&eT(l,e,t,c,o,n||i_t(l,t));return new nc(r,this._parents,e,t)}k0.prototype.interrupt=rEt;k0.prototype.transition=o_t;function Mv(e,t,n){this.k=e,this.x=t,this.y=n}Mv.prototype={constructor:Mv,scale:function(e){return e===1?this:new Mv(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mv(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Mv.prototype;var s_t=W(e=>{var a;const{securityLevel:t}=pr();let n=er("body");if(t==="sandbox"){const o=((a=er(`#i${e}`).node())==null?void 0:a.contentDocument)??document;n=er(o.body)}return n.select(`#${e}`)},"selectSvgElement");function IH(e){return typeof e>"u"||e===null}W(IH,"isNothing");function hye(e){return typeof e=="object"&&e!==null}W(hye,"isObject");function gye(e){return Array.isArray(e)?e:IH(e)?[]:[e]}W(gye,"toArray");function mye(e,t){var n,r,a,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)a=i[n],e[a]=t[a];return e}W(mye,"extend");function vye(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}W(vye,"repeat");function bye(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}W(bye,"isNegativeZero");var l_t=IH,c_t=hye,u_t=gye,d_t=vye,f_t=bye,p_t=mye,xa={isNothing:l_t,isObject:c_t,toArray:u_t,repeat:d_t,isNegativeZero:f_t,extend:p_t};function AH(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
787
787
|
|
|
788
788
|
`+e.mark.snippet),r+" "+n):r}W(AH,"formatError");function Ih(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=AH(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}W(Ih,"YAMLException$1");Ih.prototype=Object.create(Error.prototype);Ih.prototype.constructor=Ih;Ih.prototype.toString=W(function(t){return this.name+": "+AH(this,t)},"toString");var Gi=Ih;function ew(e,t,n,r,a){var i="",o="",s=Math.floor(a/2)-1;return r-t>s&&(i=" ... ",t=r-s+i.length),n-r>s&&(o=" ...",n=r+s-o.length),{str:i+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+i.length}}W(ew,"getLine");function tw(e,t){return xa.repeat(" ",t-e.length)+e}W(tw,"padStart");function yye(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],a=[],i,o=-1;i=n.exec(e.buffer);)a.push(i.index),r.push(i.index+i[0].length),e.position<=i.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var s="",l,c,u=Math.min(e.line+t.linesAfter,a.length).toString().length,d=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(o-l<0);l++)c=ew(e.buffer,r[o-l],a[o-l],e.position-(r[o]-r[o-l]),d),s=xa.repeat(" ",t.indent)+tw((e.line-l+1).toString(),u)+" | "+c.str+`
|
|
789
789
|
`+s;for(c=ew(e.buffer,r[o],a[o],e.position,d),s+=xa.repeat(" ",t.indent)+tw((e.line+1).toString(),u)+" | "+c.str+`
|
|
@@ -819,7 +819,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
819
819
|
js-yaml/dist/js-yaml.mjs:
|
|
820
820
|
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
821
821
|
*/var li={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4},jte={arrow_point:9,arrow_cross:12.5,arrow_circle:12.5};function Pv(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=Pr(e),t=Pr(t);const[n,r]=[e.x,e.y],[a,i]=[t.x,t.y],o=a-n,s=i-r;return{angle:Math.atan(s/o),deltaX:o,deltaY:s}}W(Pv,"calculateDeltaAndAngle");var Pr=W(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),gTt=W(e=>({x:W(function(t,n,r){let a=0;const i=Pr(r[0]).x<Pr(r[r.length-1]).x?"left":"right";if(n===0&&Object.hasOwn(li,e.arrowTypeStart)){const{angle:h,deltaX:g}=Pv(r[0],r[1]);a=li[e.arrowTypeStart]*Math.cos(h)*(g>=0?1:-1)}else if(n===r.length-1&&Object.hasOwn(li,e.arrowTypeEnd)){const{angle:h,deltaX:g}=Pv(r[r.length-1],r[r.length-2]);a=li[e.arrowTypeEnd]*Math.cos(h)*(g>=0?1:-1)}const o=Math.abs(Pr(t).x-Pr(r[r.length-1]).x),s=Math.abs(Pr(t).y-Pr(r[r.length-1]).y),l=Math.abs(Pr(t).x-Pr(r[0]).x),c=Math.abs(Pr(t).y-Pr(r[0]).y),u=li[e.arrowTypeStart],d=li[e.arrowTypeEnd],f=1;if(o<d&&o>0&&s<d){let h=d+f-o;h*=i==="right"?-1:1,a-=h}if(l<u&&l>0&&c<u){let h=u+f-l;h*=i==="right"?-1:1,a+=h}return Pr(t).x+a},"x"),y:W(function(t,n,r){let a=0;const i=Pr(r[0]).y<Pr(r[r.length-1]).y?"down":"up";if(n===0&&Object.hasOwn(li,e.arrowTypeStart)){const{angle:h,deltaY:g}=Pv(r[0],r[1]);a=li[e.arrowTypeStart]*Math.abs(Math.sin(h))*(g>=0?1:-1)}else if(n===r.length-1&&Object.hasOwn(li,e.arrowTypeEnd)){const{angle:h,deltaY:g}=Pv(r[r.length-1],r[r.length-2]);a=li[e.arrowTypeEnd]*Math.abs(Math.sin(h))*(g>=0?1:-1)}const o=Math.abs(Pr(t).y-Pr(r[r.length-1]).y),s=Math.abs(Pr(t).x-Pr(r[r.length-1]).x),l=Math.abs(Pr(t).y-Pr(r[0]).y),c=Math.abs(Pr(t).x-Pr(r[0]).x),u=li[e.arrowTypeStart],d=li[e.arrowTypeEnd],f=1;if(o<d&&o>0&&s<d){let h=d+f-o;h*=i==="up"?-1:1,a-=h}if(l<u&&l>0&&c<u){let h=u+f-l;h*=i==="up"?-1:1,a+=h}return Pr(t).y+a},"y")}),"getLineFunctionsWithOffset"),DH=W(({flowchart:e})=>{var a,i;const t=((a=e==null?void 0:e.subGraphTitleMargin)==null?void 0:a.top)??0,n=((i=e==null?void 0:e.subGraphTitleMargin)==null?void 0:i.bottom)??0,r=t+n;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:n,subGraphTitleTotalMargin:r}},"getSubGraphTitleMargins"),mTt=W(e=>{const{handDrawnSeed:t}=pr();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),Cg=W(e=>{const t=vTt([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),vTt=W(e=>{const t=new Map;return e.forEach(n=>{const[r,a]=n.split(":");t.set(r.trim(),a==null?void 0:a.trim())}),t},"styles2Map"),Y0e=W(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),qt=W(e=>{const{stylesArray:t}=Cg(e),n=[],r=[],a=[],i=[];return t.forEach(o=>{const s=o[0];Y0e(s)?n.push(o.join(":")+" !important"):(r.push(o.join(":")+" !important"),s.includes("stroke")&&a.push(o.join(":")+" !important"),s==="fill"&&i.push(o.join(":")+" !important"))}),{labelStyles:n.join(";"),nodeStyles:r.join(";"),stylesArray:t,borderStyles:a,backgroundStyles:i}},"styles2String"),Wt=W((e,t)=>{var l;const{themeVariables:n,handDrawnSeed:r}=pr(),{nodeBorder:a,mainBkg:i}=n,{stylesMap:o}=Cg(e);return Object.assign({roughness:.7,fill:o.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:o.get("stroke")||a,seed:r,strokeWidth:((l=o.get("stroke-width"))==null?void 0:l.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:bTt(o.get("stroke-dasharray"))},t)},"userNodeOverrides"),bTt=W(e=>{if(!e)return[0,0];const t=e.trim().split(/\s+/).map(Number);if(t.length===1){const a=isNaN(t[0])?0:t[0];return[a,a]}const n=isNaN(t[0])?0:t[0],r=isNaN(t[1])?0:t[1];return[n,r]},"getStrokeDashArray"),ym={},ha={},Bte;function yTt(){return Bte||(Bte=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.BLANK_URL=ha.relativeFirstCharacters=ha.whitespaceEscapeCharsRegex=ha.urlSchemeRegex=ha.ctrlCharactersRegex=ha.htmlCtrlEntityRegex=ha.htmlEntitiesRegex=ha.invalidProtocolRegex=void 0,ha.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,ha.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,ha.htmlCtrlEntityRegex=/&(newline|tab);/gi,ha.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,ha.urlSchemeRegex=/^.+(:|:)/gim,ha.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,ha.relativeFirstCharacters=[".","/"],ha.BLANK_URL="about:blank"),ha}var Fte;function STt(){if(Fte)return ym;Fte=1,Object.defineProperty(ym,"__esModule",{value:!0}),ym.sanitizeUrl=void 0;var e=yTt();function t(o){return e.relativeFirstCharacters.indexOf(o[0])>-1}function n(o){var s=o.replace(e.ctrlCharactersRegex,"");return s.replace(e.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function r(o){return URL.canParse(o)}function a(o){try{return decodeURIComponent(o)}catch{return o}}function i(o){if(!o)return e.BLANK_URL;var s,l=a(o.trim());do l=n(l).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),l=a(l),s=l.match(e.ctrlCharactersRegex)||l.match(e.htmlEntitiesRegex)||l.match(e.htmlCtrlEntityRegex)||l.match(e.whitespaceEscapeCharsRegex);while(s&&s.length>0);var c=l;if(!c)return e.BLANK_URL;if(t(c))return c;var u=c.trimStart(),d=u.match(e.urlSchemeRegex);if(!d)return c;var f=d[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(f))return e.BLANK_URL;var h=u.replace(/\\/g,"/");if(f==="mailto:"||f.includes("://"))return h;if(f==="http:"||f==="https:"){if(!r(h))return e.BLANK_URL;var g=new URL(h);return g.protocol=g.protocol.toLowerCase(),g.hostname=g.hostname.toLowerCase(),g.toString()}return h}return ym.sanitizeUrl=i,ym}var xTt=STt(),X0e=typeof global=="object"&&global&&global.Object===Object&&global,wTt=typeof self=="object"&&self&&self.Object===Object&&self,xl=X0e||wTt||Function("return this")(),d1=xl.Symbol,Z0e=Object.prototype,CTt=Z0e.hasOwnProperty,ETt=Z0e.toString,Sm=d1?d1.toStringTag:void 0;function _Tt(e){var t=CTt.call(e,Sm),n=e[Sm];try{e[Sm]=void 0;var r=!0}catch{}var a=ETt.call(e);return r&&(t?e[Sm]=n:delete e[Sm]),a}var TTt=Object.prototype,kTt=TTt.toString;function OTt(e){return kTt.call(e)}var $Tt="[object Null]",ITt="[object Undefined]",zte=d1?d1.toStringTag:void 0;function Eg(e){return e==null?e===void 0?ITt:$Tt:zte&&zte in Object(e)?_Tt(e):OTt(e)}function Sf(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ATt="[object AsyncFunction]",RTt="[object Function]",MTt="[object GeneratorFunction]",PTt="[object Proxy]";function jH(e){if(!Sf(e))return!1;var t=Eg(e);return t==RTt||t==MTt||t==ATt||t==PTt}var zR=xl["__core-js_shared__"],Hte=function(){var e=/[^.]+$/.exec(zR&&zR.keys&&zR.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function NTt(e){return!!Hte&&Hte in e}var LTt=Function.prototype,DTt=LTt.toString;function xf(e){if(e!=null){try{return DTt.call(e)}catch{}try{return e+""}catch{}}return""}var jTt=/[\\^$.*+?()[\]{}|]/g,BTt=/^\[object .+?Constructor\]$/,FTt=Function.prototype,zTt=Object.prototype,HTt=FTt.toString,UTt=zTt.hasOwnProperty,WTt=RegExp("^"+HTt.call(UTt).replace(jTt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qTt(e){if(!Sf(e)||NTt(e))return!1;var t=jH(e)?WTt:BTt;return t.test(xf(e))}function VTt(e,t){return e==null?void 0:e[t]}function wf(e,t){var n=VTt(e,t);return qTt(n)?n:void 0}var Ry=wf(Object,"create");function GTt(){this.__data__=Ry?Ry(null):{},this.size=0}function KTt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var YTt="__lodash_hash_undefined__",XTt=Object.prototype,ZTt=XTt.hasOwnProperty;function QTt(e){var t=this.__data__;if(Ry){var n=t[e];return n===YTt?void 0:n}return ZTt.call(t,e)?t[e]:void 0}var JTt=Object.prototype,ekt=JTt.hasOwnProperty;function tkt(e){var t=this.__data__;return Ry?t[e]!==void 0:ekt.call(t,e)}var nkt="__lodash_hash_undefined__";function rkt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ry&&t===void 0?nkt:t,this}function Vd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Vd.prototype.clear=GTt;Vd.prototype.delete=KTt;Vd.prototype.get=QTt;Vd.prototype.has=tkt;Vd.prototype.set=rkt;function akt(){this.__data__=[],this.size=0}function rT(e,t){return e===t||e!==e&&t!==t}function aT(e,t){for(var n=e.length;n--;)if(rT(e[n][0],t))return n;return-1}var ikt=Array.prototype,okt=ikt.splice;function skt(e){var t=this.__data__,n=aT(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():okt.call(t,n,1),--this.size,!0}function lkt(e){var t=this.__data__,n=aT(t,e);return n<0?void 0:t[n][1]}function ckt(e){return aT(this.__data__,e)>-1}function ukt(e,t){var n=this.__data__,r=aT(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function fc(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}fc.prototype.clear=akt;fc.prototype.delete=skt;fc.prototype.get=lkt;fc.prototype.has=ckt;fc.prototype.set=ukt;var My=wf(xl,"Map");function dkt(){this.size=0,this.__data__={hash:new Vd,map:new(My||fc),string:new Vd}}function fkt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function iT(e,t){var n=e.__data__;return fkt(t)?n[typeof t=="string"?"string":"hash"]:n.map}function pkt(e){var t=iT(this,e).delete(e);return this.size-=t?1:0,t}function hkt(e){return iT(this,e).get(e)}function gkt(e){return iT(this,e).has(e)}function mkt(e,t){var n=iT(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function vu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}vu.prototype.clear=dkt;vu.prototype.delete=pkt;vu.prototype.get=hkt;vu.prototype.has=gkt;vu.prototype.set=mkt;var vkt="Expected a function";function $0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(vkt);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new($0.Cache||vu),n}$0.Cache=vu;function bkt(){this.__data__=new fc,this.size=0}function ykt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Skt(e){return this.__data__.get(e)}function xkt(e){return this.__data__.has(e)}var wkt=200;function Ckt(e,t){var n=this.__data__;if(n instanceof fc){var r=n.__data__;if(!My||r.length<wkt-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new vu(r)}return n.set(e,t),this.size=n.size,this}function _g(e){var t=this.__data__=new fc(e);this.size=t.size}_g.prototype.clear=bkt;_g.prototype.delete=ykt;_g.prototype.get=Skt;_g.prototype.has=xkt;_g.prototype.set=Ckt;var f1=function(){try{var e=wf(Object,"defineProperty");return e({},"",{}),e}catch{}}();function BH(e,t,n){t=="__proto__"&&f1?f1(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function HD(e,t,n){(n!==void 0&&!rT(e[t],n)||n===void 0&&!(t in e))&&BH(e,t,n)}function Ekt(e){return function(t,n,r){for(var a=-1,i=Object(t),o=r(t),s=o.length;s--;){var l=o[++a];if(n(i[l],l,i)===!1)break}return t}}var _kt=Ekt(),Q0e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ute=Q0e&&typeof module=="object"&&module&&!module.nodeType&&module,Tkt=Ute&&Ute.exports===Q0e,Wte=Tkt?xl.Buffer:void 0,qte=Wte?Wte.allocUnsafe:void 0;function kkt(e,t){if(t)return e.slice();var n=e.length,r=qte?qte(n):new e.constructor(n);return e.copy(r),r}var Vte=xl.Uint8Array;function Okt(e){var t=new e.constructor(e.byteLength);return new Vte(t).set(new Vte(e)),t}function $kt(e,t){var n=t?Okt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ikt(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Gte=Object.create,Akt=function(){function e(){}return function(t){if(!Sf(t))return{};if(Gte)return Gte(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function J0e(e,t){return function(n){return e(t(n))}}var eSe=J0e(Object.getPrototypeOf,Object),Rkt=Object.prototype;function oT(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Rkt;return e===n}function Mkt(e){return typeof e.constructor=="function"&&!oT(e)?Akt(eSe(e)):{}}function I0(e){return e!=null&&typeof e=="object"}var Pkt="[object Arguments]";function Kte(e){return I0(e)&&Eg(e)==Pkt}var tSe=Object.prototype,Nkt=tSe.hasOwnProperty,Lkt=tSe.propertyIsEnumerable,p1=Kte(function(){return arguments}())?Kte:function(e){return I0(e)&&Nkt.call(e,"callee")&&!Lkt.call(e,"callee")},h1=Array.isArray,Dkt=9007199254740991;function nSe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Dkt}function sT(e){return e!=null&&nSe(e.length)&&!jH(e)}function jkt(e){return I0(e)&&sT(e)}function Bkt(){return!1}var rSe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yte=rSe&&typeof module=="object"&&module&&!module.nodeType&&module,Fkt=Yte&&Yte.exports===rSe,Xte=Fkt?xl.Buffer:void 0,zkt=Xte?Xte.isBuffer:void 0,FH=zkt||Bkt,Hkt="[object Object]",Ukt=Function.prototype,Wkt=Object.prototype,aSe=Ukt.toString,qkt=Wkt.hasOwnProperty,Vkt=aSe.call(Object);function Gkt(e){if(!I0(e)||Eg(e)!=Hkt)return!1;var t=eSe(e);if(t===null)return!0;var n=qkt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&aSe.call(n)==Vkt}var Kkt="[object Arguments]",Ykt="[object Array]",Xkt="[object Boolean]",Zkt="[object Date]",Qkt="[object Error]",Jkt="[object Function]",eOt="[object Map]",tOt="[object Number]",nOt="[object Object]",rOt="[object RegExp]",aOt="[object Set]",iOt="[object String]",oOt="[object WeakMap]",sOt="[object ArrayBuffer]",lOt="[object DataView]",cOt="[object Float32Array]",uOt="[object Float64Array]",dOt="[object Int8Array]",fOt="[object Int16Array]",pOt="[object Int32Array]",hOt="[object Uint8Array]",gOt="[object Uint8ClampedArray]",mOt="[object Uint16Array]",vOt="[object Uint32Array]",$r={};$r[cOt]=$r[uOt]=$r[dOt]=$r[fOt]=$r[pOt]=$r[hOt]=$r[gOt]=$r[mOt]=$r[vOt]=!0;$r[Kkt]=$r[Ykt]=$r[sOt]=$r[Xkt]=$r[lOt]=$r[Zkt]=$r[Qkt]=$r[Jkt]=$r[eOt]=$r[tOt]=$r[nOt]=$r[rOt]=$r[aOt]=$r[iOt]=$r[oOt]=!1;function bOt(e){return I0(e)&&nSe(e.length)&&!!$r[Eg(e)]}function yOt(e){return function(t){return e(t)}}var iSe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hb=iSe&&typeof module=="object"&&module&&!module.nodeType&&module,SOt=hb&&hb.exports===iSe,HR=SOt&&X0e.process,Zte=function(){try{var e=hb&&hb.require&&hb.require("util").types;return e||HR&&HR.binding&&HR.binding("util")}catch{}}(),Qte=Zte&&Zte.isTypedArray,zH=Qte?yOt(Qte):bOt;function UD(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var xOt=Object.prototype,wOt=xOt.hasOwnProperty;function COt(e,t,n){var r=e[t];(!(wOt.call(e,t)&&rT(r,n))||n===void 0&&!(t in e))&&BH(e,t,n)}function EOt(e,t,n,r){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var s=t[i],l=void 0;l===void 0&&(l=e[s]),a?BH(n,s,l):COt(n,s,l)}return n}function _Ot(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var TOt=9007199254740991,kOt=/^(?:0|[1-9]\d*)$/;function oSe(e,t){var n=typeof e;return t=t??TOt,!!t&&(n=="number"||n!="symbol"&&kOt.test(e))&&e>-1&&e%1==0&&e<t}var OOt=Object.prototype,$Ot=OOt.hasOwnProperty;function IOt(e,t){var n=h1(e),r=!n&&p1(e),a=!n&&!r&&FH(e),i=!n&&!r&&!a&&zH(e),o=n||r||a||i,s=o?_Ot(e.length,String):[],l=s.length;for(var c in e)(t||$Ot.call(e,c))&&!(o&&(c=="length"||a&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||oSe(c,l)))&&s.push(c);return s}function AOt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ROt=Object.prototype,MOt=ROt.hasOwnProperty;function POt(e){if(!Sf(e))return AOt(e);var t=oT(e),n=[];for(var r in e)r=="constructor"&&(t||!MOt.call(e,r))||n.push(r);return n}function sSe(e){return sT(e)?IOt(e,!0):POt(e)}function NOt(e){return EOt(e,sSe(e))}function LOt(e,t,n,r,a,i,o){var s=UD(e,n),l=UD(t,n),c=o.get(l);if(c){HD(e,n,c);return}var u=i?i(s,l,n+"",e,t,o):void 0,d=u===void 0;if(d){var f=h1(l),h=!f&&FH(l),g=!f&&!h&&zH(l);u=l,f||h||g?h1(s)?u=s:jkt(s)?u=Ikt(s):h?(d=!1,u=kkt(l,!0)):g?(d=!1,u=$kt(l,!0)):u=[]:Gkt(l)||p1(l)?(u=s,p1(s)?u=NOt(s):(!Sf(s)||jH(s))&&(u=Mkt(l))):d=!1}d&&(o.set(l,u),a(u,l,r,i,o),o.delete(l)),HD(e,n,u)}function lSe(e,t,n,r,a){e!==t&&_kt(t,function(i,o){if(a||(a=new _g),Sf(i))LOt(e,t,o,n,lSe,r,a);else{var s=r?r(UD(e,o),i,o+"",e,t,a):void 0;s===void 0&&(s=i),HD(e,o,s)}},sSe)}function cSe(e){return e}function DOt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Jte=Math.max;function jOt(e,t,n){return t=Jte(t===void 0?e.length-1:t,0),function(){for(var r=arguments,a=-1,i=Jte(r.length-t,0),o=Array(i);++a<i;)o[a]=r[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=r[a];return s[t]=n(o),DOt(e,this,s)}}function BOt(e){return function(){return e}}var FOt=f1?function(e,t){return f1(e,"toString",{configurable:!0,enumerable:!1,value:BOt(t),writable:!0})}:cSe,zOt=800,HOt=16,UOt=Date.now;function WOt(e){var t=0,n=0;return function(){var r=UOt(),a=HOt-(r-n);if(n=r,a>0){if(++t>=zOt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var qOt=WOt(FOt);function VOt(e,t){return qOt(jOt(e,t,cSe),e+"")}function GOt(e,t,n){if(!Sf(n))return!1;var r=typeof t;return(r=="number"?sT(n)&&oSe(t,n.length):r=="string"&&t in n)?rT(n[t],e):!1}function KOt(e){return VOt(function(t,n){var r=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(a--,i):void 0,o&&GOt(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=Object(t);++r<a;){var s=n[r];s&&e(t,s,r,i)}return t})}var YOt=KOt(function(e,t,n){lSe(e,t,n)}),XOt="",ZOt={curveBasis:nb,curveBasisClosed:age,curveBasisOpen:oge,curveBumpX:p5,curveBumpY:h5,curveBundle:zit,curveCardinalClosed:Hit,curveCardinalOpen:Uit,curveCardinal:lge,curveCatmullRomClosed:Wit,curveCatmullRomOpen:qit,curveCatmullRom:uge,curveLinear:Nd,curveLinearClosed:hge,curveMonotoneX:S5,curveMonotoneY:x5,curveNatural:w5,curveStep:C5,curveStepAfter:_5,curveStepBefore:E5},QOt=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,JOt=W(function(e,t){const n=uSe(e,/(?:init\b)|(?:initialize\b)/);let r={};if(Array.isArray(n)){const o=n.map(s=>s.args);XC(o),r=Sa(r,[...o])}else r=n.args;if(!r)return;let a=bH(e,t);const i="config";return r[i]!==void 0&&(a==="flowchart-v2"&&(a="flowchart"),r[a]=r[i],delete r[i]),r},"detectInit"),uSe=W(function(e,t=null){var n,r;try{const a=new RegExp(`[%]{2}(?![{]${QOt.source})(?=[}][%]{2}).*
|
|
822
|
-
`,"ig");e=e.trim().replace(a,"").replace(/'/gm,'"'),et.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let i;const o=[];for(;(i=fb.exec(e))!==null;)if(i.index===fb.lastIndex&&fb.lastIndex++,i&&!t||t&&((n=i[1])!=null&&n.match(t))||t&&((r=i[2])!=null&&r.match(t))){const s=i[1]?i[1]:i[2],l=i[3]?i[3].trim():i[4]?JSON.parse(i[4].trim()):null;o.push({type:s,args:l})}return o.length===0?{type:e,args:null}:o.length===1?o[0]:o}catch(a){return et.error(`ERROR: ${a.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),e$t=W(function(e){return e.replace(fb,"")},"removeDirectives"),t$t=W(function(e,t){for(const[n,r]of t.entries())if(r.match(e))return n;return-1},"isSubstringInArray");function HH(e,t){if(!e)return t;const n=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return ZOt[n]??t}W(HH,"interpolateToCurve");function dSe(e,t){const n=e.trim();if(n)return t.securityLevel!=="loose"?xTt.sanitizeUrl(n):n}W(dSe,"formatUrl");var n$t=W((e,...t)=>{const n=e.split("."),r=n.length-1,a=n[r];let i=window;for(let o=0;o<r;o++)if(i=i[n[o]],!i){et.error(`Function name: ${e} not found in window`);return}i[a](...t)},"runFunc");function UH(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}W(UH,"distance");function fSe(e){let t,n=0;e.forEach(a=>{n+=UH(a,t),t=a});const r=n/2;return WH(e,r)}W(fSe,"traverseEdge");function pSe(e){return e.length===1?e[0]:fSe(e)}W(pSe,"calcLabelPosition");var ene=W((e,t=2)=>{const n=Math.pow(10,t);return Math.round(e*n)/n},"roundNumber"),WH=W((e,t)=>{let n,r=t;for(const a of e){if(n){const i=UH(a,n);if(i===0)return n;if(i<r)r-=i;else{const o=r/i;if(o<=0)return n;if(o>=1)return{x:a.x,y:a.y};if(o>0&&o<1)return{x:ene((1-o)*n.x+o*a.x,5),y:ene((1-o)*n.y+o*a.y,5)}}}n=a}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),r$t=W((e,t,n)=>{et.info(`our points ${JSON.stringify(t)}`),t[0]!==n&&(t=t.reverse());const a=WH(t,25),i=e?10:5,o=Math.atan2(t[0].y-a.y,t[0].x-a.x),s={x:0,y:0};return s.x=Math.sin(o)*i+(t[0].x+a.x)/2,s.y=-Math.cos(o)*i+(t[0].y+a.y)/2,s},"calcCardinalityPosition");function hSe(e,t,n){const r=structuredClone(n);et.info("our points",r),t!=="start_left"&&t!=="start_right"&&r.reverse();const a=25+e,i=WH(r,a),o=10+e*.5,s=Math.atan2(r[0].y-i.y,r[0].x-i.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(s+Math.PI)*o+(r[0].x+i.x)/2,l.y=-Math.cos(s+Math.PI)*o+(r[0].y+i.y)/2):t==="end_right"?(l.x=Math.sin(s-Math.PI)*o+(r[0].x+i.x)/2-5,l.y=-Math.cos(s-Math.PI)*o+(r[0].y+i.y)/2-5):t==="end_left"?(l.x=Math.sin(s)*o+(r[0].x+i.x)/2-5,l.y=-Math.cos(s)*o+(r[0].y+i.y)/2-5):(l.x=Math.sin(s)*o+(r[0].x+i.x)/2,l.y=-Math.cos(s)*o+(r[0].y+i.y)/2),l}W(hSe,"calcTerminalLabelPosition");function gSe(e){let t="",n="";for(const r of e)r!==void 0&&(r.startsWith("color:")||r.startsWith("text-align:")?n=n+r+";":t=t+r+";");return{style:t,labelStyle:n}}W(gSe,"getStylesFromArray");var tne=0,a$t=W(()=>(tne++,"id-"+Math.random().toString(36).substr(2,12)+"-"+tne),"generateId");function mSe(e){let t="";const n="0123456789abcdef",r=n.length;for(let a=0;a<e;a++)t+=n.charAt(Math.floor(Math.random()*r));return t}W(mSe,"makeRandomHex");var i$t=W(e=>mSe(e.length),"random"),o$t=W(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),s$t=W(function(e,t){const n=t.text.replace(wg.lineBreakRegex," "),[,r]=lT(t.fontSize),a=e.append("text");a.attr("x",t.x),a.attr("y",t.y),a.style("text-anchor",t.anchor),a.style("font-family",t.fontFamily),a.style("font-size",r),a.style("font-weight",t.fontWeight),a.attr("fill",t.fill),t.class!==void 0&&a.attr("class",t.class);const i=a.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.attr("fill",t.fill),i.text(n),a},"drawSimpleText"),l$t=$0((e,t,n)=>{if(!e||(n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},n),wg.lineBreakRegex.test(e)))return e;const r=e.split(" ").filter(Boolean),a=[];let i="";return r.forEach((o,s)=>{const l=rc(`${o} `,n),c=rc(i,n);if(l>t){const{hyphenatedStrings:f,remainingWord:h}=c$t(o,t,"-",n);a.push(i,...f),i=h}else c+l>=t?(a.push(i),i=o):i=[i,o].filter(Boolean).join(" ");s+1===r.length&&a.push(i)}),a.filter(o=>o!=="").join(n.joinWith)},(e,t,n)=>`${e}${t}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`),c$t=$0((e,t,n="-",r)=>{r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},r);const a=[...e],i=[];let o="";return a.forEach((s,l)=>{const c=`${o}${s}`;if(rc(c,r)>=t){const d=l+1,f=a.length===d,h=`${c}${n}`;i.push(f?c:h),o=""}else o=c}),{hyphenatedStrings:i,remainingWord:o}},(e,t,n="-",r)=>`${e}${t}${n}${r.fontSize}${r.fontWeight}${r.fontFamily}`);function vSe(e,t){return qH(e,t).height}W(vSe,"calculateTextHeight");function rc(e,t){return qH(e,t).width}W(rc,"calculateTextWidth");var qH=$0((e,t)=>{const{fontSize:n=12,fontFamily:r="Arial",fontWeight:a=400}=t;if(!e)return{width:0,height:0};const[,i]=lT(n),o=["sans-serif",r],s=e.split(wg.lineBreakRegex),l=[],c=er("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const f of o){let h=0;const g={width:0,height:0,lineHeight:0};for(const m of s){const v=o$t();v.text=m||XOt;const b=s$t(u,v).style("font-size",i).style("font-weight",a).style("font-family",f),y=(b._groups||b)[0][0].getBBox();if(y.width===0&&y.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,y.width)),h=Math.round(y.height),g.height+=h,g.lineHeight=Math.round(Math.max(g.lineHeight,h))}l.push(g)}u.remove();const d=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[d]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),jp,u$t=(jp=class{constructor(t=!1,n){this.count=0,this.count=n?n.length:0,this.next=t?()=>this.count++:()=>Date.now()}},W(jp,"InitIDGenerator"),jp),XS,d$t=W(function(e){return XS=XS||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),XS.innerHTML=e,unescape(XS.textContent)},"entityDecode");function VH(e){return"str"in e}W(VH,"isDetailedError");var f$t=W((e,t,n,r)=>{var i;if(!r)return;const a=(i=e.node())==null?void 0:i.getBBox();a&&e.append("text").text(r).attr("text-anchor","middle").attr("x",a.x+a.width/2).attr("y",-n).attr("class",t)},"insertTitle"),lT=W(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function GH(e,t){return YOt({},e,t)}W(GH,"cleanAndMerge");var bs={assignWithDepth:Sa,wrapLabel:l$t,calculateTextHeight:vSe,calculateTextWidth:rc,calculateTextDimensions:qH,cleanAndMerge:GH,detectInit:JOt,detectDirective:uSe,isSubstringInArray:t$t,interpolateToCurve:HH,calcLabelPosition:pSe,calcCardinalityPosition:r$t,calcTerminalLabelPosition:hSe,formatUrl:dSe,getStylesFromArray:gSe,generateId:a$t,random:i$t,runFunc:n$t,entityDecode:d$t,insertTitle:f$t,isLabelCoordinateInPath:bSe,parseFontSize:lT,InitIDGenerator:u$t},p$t=W(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(n){return n.substring(0,n.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(n){return n.substring(0,n.length-1)}),t=t.replace(/#\w+;/g,function(n){const r=n.substring(1,n.length-1);return/^\+?\d+$/.test(r)?"fl°°"+r+"¶ß":"fl°"+r+"¶ß"}),t},"encodeEntities"),Cf=W(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),i4t=W((e,t,{counter:n=0,prefix:r,suffix:a},i)=>i||`${r?`${r}_`:""}${e}_${t}_${n}${a?`_${a}`:""}`,"getEdgeId");function bi(e){return e??null}W(bi,"handleUndefinedAttr");function bSe(e,t){const n=Math.round(e.x),r=Math.round(e.y),a=t.replace(/(\d+\.\d+)/g,i=>Math.round(parseFloat(i)).toString());return a.includes(n.toString())||a.includes(r.toString())}W(bSe,"isLabelCoordinateInPath");const h$t=Object.freeze({left:0,top:0,width:16,height:16}),g1=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ySe=Object.freeze({...h$t,...g1}),g$t=Object.freeze({...ySe,body:"",hidden:!1}),m$t=Object.freeze({width:null,height:null}),v$t=Object.freeze({...m$t,...g1}),b$t=(e,t,n,r="")=>{const a=e.split(":");if(e.slice(0,1)==="@"){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const s=a.pop(),l=a.pop(),c={provider:a.length>0?a[0]:r,prefix:l,name:s};return UR(c)?c:null}const i=a[0],o=i.split("-");if(o.length>1){const s={provider:r,prefix:o.shift(),name:o.join("-")};return UR(s)?s:null}if(n&&r===""){const s={provider:r,prefix:"",name:i};return UR(s,n)?s:null}return null},UR=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function y$t(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function nne(e,t){const n=y$t(e,t);for(const r in g$t)r in g1?r in e&&!(r in n)&&(n[r]=g1[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function S$t(e,t){const n=e.icons,r=e.aliases||Object.create(null),a=Object.create(null);function i(o){if(n[o])return a[o]=[];if(!(o in a)){a[o]=null;const s=r[o]&&r[o].parent,l=s&&i(s);l&&(a[o]=[s].concat(l))}return a[o]}return(t||Object.keys(n).concat(Object.keys(r))).forEach(i),a}function rne(e,t,n){const r=e.icons,a=e.aliases||Object.create(null);let i={};function o(s){i=nne(r[s]||a[s],i)}return o(t),n.forEach(o),nne(e,i)}function x$t(e,t){if(e.icons[t])return rne(e,t,[]);const n=S$t(e,[t])[t];return n?rne(e,t,n):null}const w$t=/(-?[0-9.]*[0-9]+[0-9.]*)/g,C$t=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ane(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(w$t);if(r===null||!r.length)return e;const a=[];let i=r.shift(),o=C$t.test(i);for(;;){if(o){const s=parseFloat(i);isNaN(s)?a.push(i):a.push(Math.ceil(s*t*n)/n)}else a.push(i);if(i=r.shift(),i===void 0)return a.join("");o=!o}}function E$t(e,t="defs"){let n="";const r=e.indexOf("<"+t);for(;r>=0;){const a=e.indexOf(">",r),i=e.indexOf("</"+t);if(a===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(a+1,i).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function _$t(e,t){return e?"<defs>"+e+"</defs>"+t:t}function T$t(e,t,n){const r=E$t(e);return _$t(r.defs,t+r.content+n)}const k$t=e=>e==="unset"||e==="undefined"||e==="none";function O$t(e,t){const n={...ySe,...e},r={...v$t,...t},a={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(m=>{const v=[],b=m.hFlip,y=m.vFlip;let S=m.rotate;b?y?S+=2:(v.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),v.push("scale(-1 1)"),a.top=a.left=0):y&&(v.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),v.push("scale(1 -1)"),a.top=a.left=0);let C;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:C=a.height/2+a.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:C=a.width/2+a.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}S%2===1&&(a.left!==a.top&&(C=a.left,a.left=a.top,a.top=C),a.width!==a.height&&(C=a.width,a.width=a.height,a.height=C)),v.length&&(i=T$t(i,'<g transform="'+v.join(" ")+'">',"</g>"))});const o=r.width,s=r.height,l=a.width,c=a.height;let u,d;o===null?(d=s===null?"1em":s==="auto"?c:s,u=ane(d,l/c)):(u=o==="auto"?l:o,d=s===null?ane(u,c/l):s==="auto"?c:s);const f={},h=(m,v)=>{k$t(v)||(f[m]=v.toString())};h("width",u),h("height",d);const g=[a.left,a.top,l,c];return f.viewBox=g.join(" "),{attributes:f,viewBox:g,body:i}}const $$t=/\sid="(\S+)"/g,ine=new Map;function I$t(e){e=e.replace(/[0-9]+$/,"")||"a";const t=ine.get(e)||0;return ine.set(e,t+1),t?`${e}${t}`:e}function A$t(e){const t=[];let n;for(;n=$$t.exec(e);)t.push(n[1]);if(!t.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(a=>{const i=I$t(a),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}function R$t(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function KH(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ef=KH();function SSe(e){Ef=e}var gb={exec:()=>null};function or(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Pi.caret,"$1"),n=n.replace(a,o),r},getRegex:()=>new RegExp(n,t)};return r}var M$t=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Pi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},P$t=/^(?:[ \t]*(?:\n|$))+/,N$t=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,L$t=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,A0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,D$t=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,YH=/(?:[*+-]|\d{1,9}[.)])/,xSe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wSe=or(xSe).replace(/bull/g,YH).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),j$t=or(xSe).replace(/bull/g,YH).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),XH=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,B$t=/^[^\n]+/,ZH=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,F$t=or(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ZH).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),z$t=or(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,YH).getRegex(),cT="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",QH=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,H$t=or("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",QH).replace("tag",cT).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),CSe=or(XH).replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex(),U$t=or(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",CSe).getRegex(),JH={blockquote:U$t,code:N$t,def:F$t,fences:L$t,heading:D$t,hr:A0,html:H$t,lheading:wSe,list:z$t,newline:P$t,paragraph:CSe,table:gb,text:B$t},one=or("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex(),W$t={...JH,lheading:j$t,table:one,paragraph:or(XH).replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",one).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex()},q$t={...JH,html:or(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",QH).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gb,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:or(XH).replace("hr",A0).replace("heading",` *#{1,6} *[^
|
|
822
|
+
`,"ig");e=e.trim().replace(a,"").replace(/'/gm,'"'),et.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let i;const o=[];for(;(i=fb.exec(e))!==null;)if(i.index===fb.lastIndex&&fb.lastIndex++,i&&!t||t&&((n=i[1])!=null&&n.match(t))||t&&((r=i[2])!=null&&r.match(t))){const s=i[1]?i[1]:i[2],l=i[3]?i[3].trim():i[4]?JSON.parse(i[4].trim()):null;o.push({type:s,args:l})}return o.length===0?{type:e,args:null}:o.length===1?o[0]:o}catch(a){return et.error(`ERROR: ${a.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),e$t=W(function(e){return e.replace(fb,"")},"removeDirectives"),t$t=W(function(e,t){for(const[n,r]of t.entries())if(r.match(e))return n;return-1},"isSubstringInArray");function HH(e,t){if(!e)return t;const n=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return ZOt[n]??t}W(HH,"interpolateToCurve");function dSe(e,t){const n=e.trim();if(n)return t.securityLevel!=="loose"?xTt.sanitizeUrl(n):n}W(dSe,"formatUrl");var n$t=W((e,...t)=>{const n=e.split("."),r=n.length-1,a=n[r];let i=window;for(let o=0;o<r;o++)if(i=i[n[o]],!i){et.error(`Function name: ${e} not found in window`);return}i[a](...t)},"runFunc");function UH(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}W(UH,"distance");function fSe(e){let t,n=0;e.forEach(a=>{n+=UH(a,t),t=a});const r=n/2;return WH(e,r)}W(fSe,"traverseEdge");function pSe(e){return e.length===1?e[0]:fSe(e)}W(pSe,"calcLabelPosition");var ene=W((e,t=2)=>{const n=Math.pow(10,t);return Math.round(e*n)/n},"roundNumber"),WH=W((e,t)=>{let n,r=t;for(const a of e){if(n){const i=UH(a,n);if(i===0)return n;if(i<r)r-=i;else{const o=r/i;if(o<=0)return n;if(o>=1)return{x:a.x,y:a.y};if(o>0&&o<1)return{x:ene((1-o)*n.x+o*a.x,5),y:ene((1-o)*n.y+o*a.y,5)}}}n=a}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),r$t=W((e,t,n)=>{et.info(`our points ${JSON.stringify(t)}`),t[0]!==n&&(t=t.reverse());const a=WH(t,25),i=e?10:5,o=Math.atan2(t[0].y-a.y,t[0].x-a.x),s={x:0,y:0};return s.x=Math.sin(o)*i+(t[0].x+a.x)/2,s.y=-Math.cos(o)*i+(t[0].y+a.y)/2,s},"calcCardinalityPosition");function hSe(e,t,n){const r=structuredClone(n);et.info("our points",r),t!=="start_left"&&t!=="start_right"&&r.reverse();const a=25+e,i=WH(r,a),o=10+e*.5,s=Math.atan2(r[0].y-i.y,r[0].x-i.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(s+Math.PI)*o+(r[0].x+i.x)/2,l.y=-Math.cos(s+Math.PI)*o+(r[0].y+i.y)/2):t==="end_right"?(l.x=Math.sin(s-Math.PI)*o+(r[0].x+i.x)/2-5,l.y=-Math.cos(s-Math.PI)*o+(r[0].y+i.y)/2-5):t==="end_left"?(l.x=Math.sin(s)*o+(r[0].x+i.x)/2-5,l.y=-Math.cos(s)*o+(r[0].y+i.y)/2-5):(l.x=Math.sin(s)*o+(r[0].x+i.x)/2,l.y=-Math.cos(s)*o+(r[0].y+i.y)/2),l}W(hSe,"calcTerminalLabelPosition");function gSe(e){let t="",n="";for(const r of e)r!==void 0&&(r.startsWith("color:")||r.startsWith("text-align:")?n=n+r+";":t=t+r+";");return{style:t,labelStyle:n}}W(gSe,"getStylesFromArray");var tne=0,a$t=W(()=>(tne++,"id-"+Math.random().toString(36).substr(2,12)+"-"+tne),"generateId");function mSe(e){let t="";const n="0123456789abcdef",r=n.length;for(let a=0;a<e;a++)t+=n.charAt(Math.floor(Math.random()*r));return t}W(mSe,"makeRandomHex");var i$t=W(e=>mSe(e.length),"random"),o$t=W(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),s$t=W(function(e,t){const n=t.text.replace(wg.lineBreakRegex," "),[,r]=lT(t.fontSize),a=e.append("text");a.attr("x",t.x),a.attr("y",t.y),a.style("text-anchor",t.anchor),a.style("font-family",t.fontFamily),a.style("font-size",r),a.style("font-weight",t.fontWeight),a.attr("fill",t.fill),t.class!==void 0&&a.attr("class",t.class);const i=a.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.attr("fill",t.fill),i.text(n),a},"drawSimpleText"),l$t=$0((e,t,n)=>{if(!e||(n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},n),wg.lineBreakRegex.test(e)))return e;const r=e.split(" ").filter(Boolean),a=[];let i="";return r.forEach((o,s)=>{const l=rc(`${o} `,n),c=rc(i,n);if(l>t){const{hyphenatedStrings:f,remainingWord:h}=c$t(o,t,"-",n);a.push(i,...f),i=h}else c+l>=t?(a.push(i),i=o):i=[i,o].filter(Boolean).join(" ");s+1===r.length&&a.push(i)}),a.filter(o=>o!=="").join(n.joinWith)},(e,t,n)=>`${e}${t}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`),c$t=$0((e,t,n="-",r)=>{r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},r);const a=[...e],i=[];let o="";return a.forEach((s,l)=>{const c=`${o}${s}`;if(rc(c,r)>=t){const d=l+1,f=a.length===d,h=`${c}${n}`;i.push(f?c:h),o=""}else o=c}),{hyphenatedStrings:i,remainingWord:o}},(e,t,n="-",r)=>`${e}${t}${n}${r.fontSize}${r.fontWeight}${r.fontFamily}`);function vSe(e,t){return qH(e,t).height}W(vSe,"calculateTextHeight");function rc(e,t){return qH(e,t).width}W(rc,"calculateTextWidth");var qH=$0((e,t)=>{const{fontSize:n=12,fontFamily:r="Arial",fontWeight:a=400}=t;if(!e)return{width:0,height:0};const[,i]=lT(n),o=["sans-serif",r],s=e.split(wg.lineBreakRegex),l=[],c=er("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const f of o){let h=0;const g={width:0,height:0,lineHeight:0};for(const m of s){const v=o$t();v.text=m||XOt;const b=s$t(u,v).style("font-size",i).style("font-weight",a).style("font-family",f),y=(b._groups||b)[0][0].getBBox();if(y.width===0&&y.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,y.width)),h=Math.round(y.height),g.height+=h,g.lineHeight=Math.round(Math.max(g.lineHeight,h))}l.push(g)}u.remove();const d=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[d]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),jp,u$t=(jp=class{constructor(t=!1,n){this.count=0,this.count=n?n.length:0,this.next=t?()=>this.count++:()=>Date.now()}},W(jp,"InitIDGenerator"),jp),XS,d$t=W(function(e){return XS=XS||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),XS.innerHTML=e,unescape(XS.textContent)},"entityDecode");function VH(e){return"str"in e}W(VH,"isDetailedError");var f$t=W((e,t,n,r)=>{var i;if(!r)return;const a=(i=e.node())==null?void 0:i.getBBox();a&&e.append("text").text(r).attr("text-anchor","middle").attr("x",a.x+a.width/2).attr("y",-n).attr("class",t)},"insertTitle"),lT=W(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function GH(e,t){return YOt({},e,t)}W(GH,"cleanAndMerge");var bs={assignWithDepth:Sa,wrapLabel:l$t,calculateTextHeight:vSe,calculateTextWidth:rc,calculateTextDimensions:qH,cleanAndMerge:GH,detectInit:JOt,detectDirective:uSe,isSubstringInArray:t$t,interpolateToCurve:HH,calcLabelPosition:pSe,calcCardinalityPosition:r$t,calcTerminalLabelPosition:hSe,formatUrl:dSe,getStylesFromArray:gSe,generateId:a$t,random:i$t,runFunc:n$t,entityDecode:d$t,insertTitle:f$t,isLabelCoordinateInPath:bSe,parseFontSize:lT,InitIDGenerator:u$t},p$t=W(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(n){return n.substring(0,n.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(n){return n.substring(0,n.length-1)}),t=t.replace(/#\w+;/g,function(n){const r=n.substring(1,n.length-1);return/^\+?\d+$/.test(r)?"fl°°"+r+"¶ß":"fl°"+r+"¶ß"}),t},"encodeEntities"),Cf=W(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),o4t=W((e,t,{counter:n=0,prefix:r,suffix:a},i)=>i||`${r?`${r}_`:""}${e}_${t}_${n}${a?`_${a}`:""}`,"getEdgeId");function bi(e){return e??null}W(bi,"handleUndefinedAttr");function bSe(e,t){const n=Math.round(e.x),r=Math.round(e.y),a=t.replace(/(\d+\.\d+)/g,i=>Math.round(parseFloat(i)).toString());return a.includes(n.toString())||a.includes(r.toString())}W(bSe,"isLabelCoordinateInPath");const h$t=Object.freeze({left:0,top:0,width:16,height:16}),g1=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ySe=Object.freeze({...h$t,...g1}),g$t=Object.freeze({...ySe,body:"",hidden:!1}),m$t=Object.freeze({width:null,height:null}),v$t=Object.freeze({...m$t,...g1}),b$t=(e,t,n,r="")=>{const a=e.split(":");if(e.slice(0,1)==="@"){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const s=a.pop(),l=a.pop(),c={provider:a.length>0?a[0]:r,prefix:l,name:s};return UR(c)?c:null}const i=a[0],o=i.split("-");if(o.length>1){const s={provider:r,prefix:o.shift(),name:o.join("-")};return UR(s)?s:null}if(n&&r===""){const s={provider:r,prefix:"",name:i};return UR(s,n)?s:null}return null},UR=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function y$t(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function nne(e,t){const n=y$t(e,t);for(const r in g$t)r in g1?r in e&&!(r in n)&&(n[r]=g1[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function S$t(e,t){const n=e.icons,r=e.aliases||Object.create(null),a=Object.create(null);function i(o){if(n[o])return a[o]=[];if(!(o in a)){a[o]=null;const s=r[o]&&r[o].parent,l=s&&i(s);l&&(a[o]=[s].concat(l))}return a[o]}return(t||Object.keys(n).concat(Object.keys(r))).forEach(i),a}function rne(e,t,n){const r=e.icons,a=e.aliases||Object.create(null);let i={};function o(s){i=nne(r[s]||a[s],i)}return o(t),n.forEach(o),nne(e,i)}function x$t(e,t){if(e.icons[t])return rne(e,t,[]);const n=S$t(e,[t])[t];return n?rne(e,t,n):null}const w$t=/(-?[0-9.]*[0-9]+[0-9.]*)/g,C$t=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ane(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(w$t);if(r===null||!r.length)return e;const a=[];let i=r.shift(),o=C$t.test(i);for(;;){if(o){const s=parseFloat(i);isNaN(s)?a.push(i):a.push(Math.ceil(s*t*n)/n)}else a.push(i);if(i=r.shift(),i===void 0)return a.join("");o=!o}}function E$t(e,t="defs"){let n="";const r=e.indexOf("<"+t);for(;r>=0;){const a=e.indexOf(">",r),i=e.indexOf("</"+t);if(a===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(a+1,i).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function _$t(e,t){return e?"<defs>"+e+"</defs>"+t:t}function T$t(e,t,n){const r=E$t(e);return _$t(r.defs,t+r.content+n)}const k$t=e=>e==="unset"||e==="undefined"||e==="none";function O$t(e,t){const n={...ySe,...e},r={...v$t,...t},a={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(m=>{const v=[],b=m.hFlip,y=m.vFlip;let S=m.rotate;b?y?S+=2:(v.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),v.push("scale(-1 1)"),a.top=a.left=0):y&&(v.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),v.push("scale(1 -1)"),a.top=a.left=0);let C;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:C=a.height/2+a.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:C=a.width/2+a.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}S%2===1&&(a.left!==a.top&&(C=a.left,a.left=a.top,a.top=C),a.width!==a.height&&(C=a.width,a.width=a.height,a.height=C)),v.length&&(i=T$t(i,'<g transform="'+v.join(" ")+'">',"</g>"))});const o=r.width,s=r.height,l=a.width,c=a.height;let u,d;o===null?(d=s===null?"1em":s==="auto"?c:s,u=ane(d,l/c)):(u=o==="auto"?l:o,d=s===null?ane(u,c/l):s==="auto"?c:s);const f={},h=(m,v)=>{k$t(v)||(f[m]=v.toString())};h("width",u),h("height",d);const g=[a.left,a.top,l,c];return f.viewBox=g.join(" "),{attributes:f,viewBox:g,body:i}}const $$t=/\sid="(\S+)"/g,ine=new Map;function I$t(e){e=e.replace(/[0-9]+$/,"")||"a";const t=ine.get(e)||0;return ine.set(e,t+1),t?`${e}${t}`:e}function A$t(e){const t=[];let n;for(;n=$$t.exec(e);)t.push(n[1]);if(!t.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(a=>{const i=I$t(a),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}function R$t(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function KH(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ef=KH();function SSe(e){Ef=e}var gb={exec:()=>null};function or(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Pi.caret,"$1"),n=n.replace(a,o),r},getRegex:()=>new RegExp(n,t)};return r}var M$t=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Pi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},P$t=/^(?:[ \t]*(?:\n|$))+/,N$t=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,L$t=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,A0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,D$t=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,YH=/(?:[*+-]|\d{1,9}[.)])/,xSe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wSe=or(xSe).replace(/bull/g,YH).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),j$t=or(xSe).replace(/bull/g,YH).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),XH=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,B$t=/^[^\n]+/,ZH=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,F$t=or(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ZH).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),z$t=or(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,YH).getRegex(),cT="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",QH=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,H$t=or("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",QH).replace("tag",cT).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),CSe=or(XH).replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex(),U$t=or(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",CSe).getRegex(),JH={blockquote:U$t,code:N$t,def:F$t,fences:L$t,heading:D$t,hr:A0,html:H$t,lheading:wSe,list:z$t,newline:P$t,paragraph:CSe,table:gb,text:B$t},one=or("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex(),W$t={...JH,lheading:j$t,table:one,paragraph:or(XH).replace("hr",A0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",one).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cT).getRegex()},q$t={...JH,html:or(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",QH).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gb,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:or(XH).replace("hr",A0).replace("heading",` *#{1,6} *[^
|
|
823
823
|
]`).replace("lheading",wSe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},V$t=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,G$t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ESe=/^( {2,}|\\)\n(?!\s*$)/,K$t=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uT=/[\p{P}\p{S}]/u,eU=/[\s\p{P}\p{S}]/u,_Se=/[^\s\p{P}\p{S}]/u,Y$t=or(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,eU).getRegex(),TSe=/(?!~)[\p{P}\p{S}]/u,X$t=/(?!~)[\s\p{P}\p{S}]/u,Z$t=/(?:[^\s\p{P}\p{S}]|~)/u,Q$t=or(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",M$t?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),kSe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,J$t=or(kSe,"u").replace(/punct/g,uT).getRegex(),eIt=or(kSe,"u").replace(/punct/g,TSe).getRegex(),OSe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tIt=or(OSe,"gu").replace(/notPunctSpace/g,_Se).replace(/punctSpace/g,eU).replace(/punct/g,uT).getRegex(),nIt=or(OSe,"gu").replace(/notPunctSpace/g,Z$t).replace(/punctSpace/g,X$t).replace(/punct/g,TSe).getRegex(),rIt=or("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_Se).replace(/punctSpace/g,eU).replace(/punct/g,uT).getRegex(),aIt=or(/\\(punct)/,"gu").replace(/punct/g,uT).getRegex(),iIt=or(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),oIt=or(QH).replace("(?:-->|$)","-->").getRegex(),sIt=or("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",oIt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),m1=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,lIt=or(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",m1).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$Se=or(/^!?\[(label)\]\[(ref)\]/).replace("label",m1).replace("ref",ZH).getRegex(),ISe=or(/^!?\[(ref)\](?:\[\])?/).replace("ref",ZH).getRegex(),cIt=or("reflink|nolink(?!\\()","g").replace("reflink",$Se).replace("nolink",ISe).getRegex(),sne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tU={_backpedal:gb,anyPunctuation:aIt,autolink:iIt,blockSkip:Q$t,br:ESe,code:G$t,del:gb,emStrongLDelim:J$t,emStrongRDelimAst:tIt,emStrongRDelimUnd:rIt,escape:V$t,link:lIt,nolink:ISe,punctuation:Y$t,reflink:$Se,reflinkSearch:cIt,tag:sIt,text:K$t,url:gb},uIt={...tU,link:or(/^!?\[(label)\]\((.*?)\)/).replace("label",m1).getRegex(),reflink:or(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",m1).getRegex()},WD={...tU,emStrongRDelimAst:nIt,emStrongLDelim:eIt,url:or(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",sne).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:or(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",sne).getRegex()},dIt={...WD,br:or(ESe).replace("{2,}","*").getRegex(),text:or(WD.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ZS={normal:JH,gfm:W$t,pedantic:q$t},xm={normal:tU,gfm:WD,breaks:dIt,pedantic:uIt},fIt={"&":"&","<":"<",">":">",'"':""","'":"'"},lne=e=>fIt[e];function Vs(e,t){if(t){if(Pi.escapeTest.test(e))return e.replace(Pi.escapeReplace,lne)}else if(Pi.escapeTestNoEncode.test(e))return e.replace(Pi.escapeReplaceNoEncode,lne);return e}function cne(e){try{e=encodeURI(e).replace(Pi.percentDecode,"%")}catch{return null}return e}function une(e,t){var i;let n=e.replace(Pi.findPipe,(o,s,l)=>{let c=!1,u=s;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Pi.splitPipe),a=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;a<r.length;a++)r[a]=r[a].trim().replace(Pi.slashPipe,"|");return r}function wm(e,t,n){let r=e.length;if(r===0)return"";let a=0;for(;a<r&&e.charAt(r-a-1)===t;)a++;return e.slice(0,r-a)}function pIt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function dne(e,t,n,r,a){let i=t.href,o=t.title||null,s=e[1].replace(a.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,l}function hIt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let a=r[1];return t.split(`
|
|
824
824
|
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[s]=o;return s.length>=a.length?i.slice(a.length):i}).join(`
|
|
825
825
|
`)}var v1=class{constructor(t){Bt(this,"options");Bt(this,"rules");Bt(this,"lexer");this.options=t||Ef}space(t){let n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){let n=this.rules.block.code.exec(t);if(n){let r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:wm(r,`
|
|
@@ -889,7 +889,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error
|
|
|
889
889
|
`).forEach((u,d)=>{d!==0&&(i++,a.push([])),u.split(" ").forEach(f=>{f=f.replace(/'/g,"'"),f&&a[i].push({content:f,type:l})})}):s.type==="strong"||s.type==="em"?s.tokens.forEach(c=>{o(c,s.type)}):s.type==="html"&&a[i].push({content:s.text,type:"normal"})}return W(o,"processNode"),r.forEach(s=>{var l;s.type==="paragraph"?(l=s.tokens)==null||l.forEach(c=>{o(c)}):s.type==="html"?a[i].push({content:s.text,type:"normal"}):a[i].push({content:s.raw,type:"normal"})}),a}W(NSe,"markdownToLines");function LSe(e,{markdownAutoWrap:t}={}){const n=hr.lexer(e);function r(a){var i,o,s;return a.type==="text"?t===!1?a.text.replace(/\n */g,"<br/>").replace(/ /g," "):a.text.replace(/\n */g,"<br/>"):a.type==="strong"?`<strong>${(i=a.tokens)==null?void 0:i.map(r).join("")}</strong>`:a.type==="em"?`<em>${(o=a.tokens)==null?void 0:o.map(r).join("")}</em>`:a.type==="paragraph"?`<p>${(s=a.tokens)==null?void 0:s.map(r).join("")}</p>`:a.type==="space"?"":a.type==="html"?`${a.text}`:a.type==="escape"?a.text:(et.warn(`Unsupported markdown: ${a.type}`),a.raw)}return W(r,"output"),n.map(r).join("")}W(LSe,"markdownToHTML");function DSe(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}W(DSe,"splitTextToChars");function jSe(e,t){const n=DSe(t.content);return rU(e,[],n,t.type)}W(jSe,"splitWordToFitWidth");function rU(e,t,n,r){if(n.length===0)return[{content:t.join(""),type:r},{content:"",type:r}];const[a,...i]=n,o=[...t,a];return e([{content:o.join(""),type:r}])?rU(e,o,i,r):(t.length===0&&a&&(t.push(a),n.shift()),[{content:t.join(""),type:r},{content:n.join(""),type:r}])}W(rU,"splitWordToFitWidthRecursion");function BSe(e,t){if(e.some(({content:n})=>n.includes(`
|
|
890
890
|
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return y1(e,t)}W(BSe,"splitLineToFitWidth");function y1(e,t,n=[],r=[]){if(e.length===0)return r.length>0&&n.push(r),n.length>0?n:[];let a="";e[0].content===" "&&(a=" ",e.shift());const i=e.shift()??{content:" ",type:"normal"},o=[...r];if(a!==""&&o.push({content:a,type:"normal"}),o.push(i),t(o))return y1(e,t,n,o);if(r.length>0)n.push(r),e.unshift(i);else if(i.content){const[s,l]=jSe(t,i);n.push([s]),l.content&&e.unshift(l)}return y1(e,t,n)}W(y1,"splitLineToFitWidthRecursion");function KD(e,t){t&&e.attr("style",t)}W(KD,"applyStyle");async function FSe(e,t,n,r,a=!1,i=mi()){const o=e.append("foreignObject");o.attr("width",`${10*n}px`),o.attr("height",`${10*n}px`);const s=o.append("xhtml:div"),l=kh(t.label)?await yH(t.label.replace(wg.lineBreakRegex,`
|
|
891
891
|
`),i):Zo(t.label,i),c=t.isNode?"nodeLabel":"edgeLabel",u=s.append("span");u.html(l),KD(u,t.labelStyle),u.attr("class",`${c} ${r}`),KD(s,t.labelStyle),s.style("display","table-cell"),s.style("white-space","nowrap"),s.style("line-height","1.5"),s.style("max-width",n+"px"),s.style("text-align","center"),s.attr("xmlns","http://www.w3.org/1999/xhtml"),a&&s.attr("class","labelBkg");let d=s.node().getBoundingClientRect();return d.width===n&&(s.style("display","table"),s.style("white-space","break-spaces"),s.style("width",n+"px"),d=s.node().getBoundingClientRect()),o.node()}W(FSe,"addHtmlSpan");function dT(e,t,n){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*n-.1+"em").attr("dy",n+"em")}W(dT,"createTspan");function zSe(e,t,n){const r=e.append("text"),a=dT(r,1,t);fT(a,n);const i=a.node().getComputedTextLength();return r.remove(),i}W(zSe,"computeWidthOfText");function yIt(e,t,n){var o;const r=e.append("text"),a=dT(r,1,t);fT(a,[{content:n,type:"normal"}]);const i=(o=a.node())==null?void 0:o.getBoundingClientRect();return i&&r.remove(),i}W(yIt,"computeDimensionOfText");function HSe(e,t,n,r=!1){const i=t.append("g"),o=i.insert("rect").attr("class","background").attr("style","stroke: none"),s=i.append("text").attr("y","-10.1");let l=0;for(const c of n){const u=W(f=>zSe(i,1.1,f)<=e,"checkWidth"),d=u(c)?[c]:BSe(c,u);for(const f of d){const h=dT(s,l,1.1);fT(h,f),l++}}if(r){const c=s.node().getBBox(),u=2;return o.attr("x",c.x-u).attr("y",c.y-u).attr("width",c.width+2*u).attr("height",c.height+2*u),i.node()}else return s.node()}W(HSe,"createFormattedText");function fT(e,t){e.text(""),t.forEach((n,r)=>{const a=e.append("tspan").attr("font-style",n.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",n.type==="strong"?"bold":"normal");r===0?a.text(n.content):a.text(" "+n.content)})}W(fT,"updateTextContentAndStyles");async function USe(e,t={}){const n=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(a,i,o)=>(n.push((async()=>{const s=`${i}:${o}`;return await bIt(s)?await R0(s,void 0,{class:"label-icon"}):`<i class='${Zo(a,t).replace(":"," ")}'></i>`})()),a));const r=await Promise.all(n);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>r.shift()??"")}W(USe,"replaceIconSubstring");var bu=W(async(e,t="",{style:n="",isTitle:r=!1,classes:a="",useHtmlLabels:i=!0,isNode:o=!0,width:s=200,addSvgBackground:l=!1}={},c)=>{if(et.debug("XYZ createText",t,n,r,a,i,o,"addSvgBackground: ",l),i){const u=LSe(t,c),d=await USe(Cf(u),c),f=t.replace(/\\\\/g,"\\"),h={isNode:o,label:kh(t)?f:d,labelStyle:n.replace("fill:","color:")};return await FSe(e,h,s,a,l,c)}else{const u=t.replace(/<br\s*\/?>/g,"<br/>"),d=NSe(u.replace("<br>","<br/>"),c),f=HSe(s,e,d,t?l:!1);if(o){/stroke:/.exec(n)&&(n=n.replace("stroke:","lineColor:"));const h=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");er(f).attr("style",h)}else{const h=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");er(f).select("rect").attr("style",h.replace(/background:/g,"fill:"));const g=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");er(f).select("text").attr("style",g)}return f}},"createText");function WR(e,t,n){if(e&&e.length){const[r,a]=t,i=Math.PI/180*n,o=Math.cos(i),s=Math.sin(i);for(const l of e){const[c,u]=l;l[0]=(c-r)*o-(u-a)*s+r,l[1]=(c-r)*s+(u-a)*o+a}}}function SIt(e,t){return e[0]===t[0]&&e[1]===t[1]}function xIt(e,t,n,r=1){const a=n,i=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(a)for(const c of o)WR(c,s,a);const l=function(c,u,d){const f=[];for(const y of c){const S=[...y];SIt(S[0],S[S.length-1])||S.push([S[0][0],S[0][1]]),S.length>2&&f.push(S)}const h=[];u=Math.max(u,.1);const g=[];for(const y of f)for(let S=0;S<y.length-1;S++){const C=y[S],x=y[S+1];if(C[1]!==x[1]){const w=Math.min(C[1],x[1]);g.push({ymin:w,ymax:Math.max(C[1],x[1]),x:w===C[1]?C[0]:x[0],islope:(x[0]-C[0])/(x[1]-C[1])})}}if(g.sort((y,S)=>y.ymin<S.ymin?-1:y.ymin>S.ymin?1:y.x<S.x?-1:y.x>S.x?1:y.ymax===S.ymax?0:(y.ymax-S.ymax)/Math.abs(y.ymax-S.ymax)),!g.length)return h;let m=[],v=g[0].ymin,b=0;for(;m.length||g.length;){if(g.length){let y=-1;for(let S=0;S<g.length&&!(g[S].ymin>v);S++)y=S;g.splice(0,y+1).forEach(S=>{m.push({s:v,edge:S})})}if(m=m.filter(y=>!(y.edge.ymax<=v)),m.sort((y,S)=>y.edge.x===S.edge.x?0:(y.edge.x-S.edge.x)/Math.abs(y.edge.x-S.edge.x)),(d!==1||b%u==0)&&m.length>1)for(let y=0;y<m.length;y+=2){const S=y+1;if(S>=m.length)break;const C=m[y].edge,x=m[S].edge;h.push([[Math.round(C.x),v],[Math.round(x.x),v]])}v+=d,m.forEach(y=>{y.edge.x=y.edge.x+d*y.edge.islope}),b++}return h}(o,i,r);if(a){for(const c of o)WR(c,s,-a);(function(c,u,d){const f=[];c.forEach(h=>f.push(...h)),WR(f,u,d)})(l,s,-a)}return l}function M0(e,t){var n;const r=t.hachureAngle+90;let a=t.hachureGap;a<0&&(a=4*t.strokeWidth),a=Math.round(Math.max(a,.1));let i=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(i=a),xIt(e,a,r,i||1)}class aU{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){const r=M0(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){const r=[];for(const a of t)r.push(...this.helper.doubleLineOps(a[0][0],a[0][1],a[1][0],a[1][1],n));return r}}function pT(e){const t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}class wIt extends aU{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=4*n.strokeWidth),r=Math.max(r,.1);const a=M0(t,Object.assign({},n,{hachureGap:r})),i=Math.PI/180*n.hachureAngle,o=[],s=.5*r*Math.cos(i),l=.5*r*Math.sin(i);for(const[c,u]of a)pT([c,u])&&o.push([[c[0]-s,c[1]+l],[...u]],[[c[0]+s,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,n)}}}class CIt extends aU{fillPolygons(t,n){const r=this._fillPolygons(t,n),a=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),i=this._fillPolygons(t,a);return r.ops=r.ops.concat(i.ops),r}}class EIt{constructor(t){this.helper=t}fillPolygons(t,n){const r=M0(t,n=Object.assign({},n,{hachureAngle:0}));return this.dotsOnLines(r,n)}dotsOnLines(t,n){const r=[];let a=n.hachureGap;a<0&&(a=4*n.strokeWidth),a=Math.max(a,.1);let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const o=a/4;for(const s of t){const l=pT(s),c=l/a,u=Math.ceil(c)-1,d=l-u*a,f=(s[0][0]+s[1][0])/2-a/4,h=Math.min(s[0][1],s[1][1]);for(let g=0;g<u;g++){const m=h+d+g*a,v=f-o+2*Math.random()*o,b=m-o+2*Math.random()*o,y=this.helper.ellipse(v,b,i,i,n);r.push(...y.ops)}}return{type:"fillSketch",ops:r}}}class _It{constructor(t){this.helper=t}fillPolygons(t,n){const r=M0(t,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(t,n){const r=n.dashOffset<0?n.hachureGap<0?4*n.strokeWidth:n.hachureGap:n.dashOffset,a=n.dashGap<0?n.hachureGap<0?4*n.strokeWidth:n.hachureGap:n.dashGap,i=[];return t.forEach(o=>{const s=pT(o),l=Math.floor(s/(r+a)),c=(s+a-l*(r+a))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const f=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let h=0;h<l;h++){const g=h*(r+a),m=g+r,v=[u[0]+g*Math.cos(f)+c*Math.cos(f),u[1]+g*Math.sin(f)+c*Math.sin(f)],b=[u[0]+m*Math.cos(f)+c*Math.cos(f),u[1]+m*Math.sin(f)+c*Math.sin(f)];i.push(...this.helper.doubleLineOps(v[0],v[1],b[0],b[1],n))}}),i}}class TIt{constructor(t){this.helper=t}fillPolygons(t,n){const r=n.hachureGap<0?4*n.strokeWidth:n.hachureGap,a=n.zigzagOffset<0?r:n.zigzagOffset,i=M0(t,n=Object.assign({},n,{hachureGap:r+a}));return{type:"fillSketch",ops:this.zigzagLines(i,a,n)}}zigzagLines(t,n,r){const a=[];return t.forEach(i=>{const o=pT(i),s=Math.round(o/(2*n));let l=i[0],c=i[1];l[0]>c[0]&&(l=i[1],c=i[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;d<s;d++){const f=2*d*n,h=2*(d+1)*n,g=Math.sqrt(2*Math.pow(n,2)),m=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],v=[l[0]+h*Math.cos(u),l[1]+h*Math.sin(u)],b=[m[0]+g*Math.cos(u+Math.PI/4),m[1]+g*Math.sin(u+Math.PI/4)];a.push(...this.helper.doubleLineOps(m[0],m[1],b[0],b[1],r),...this.helper.doubleLineOps(b[0],b[1],v[0],v[1],r))}}),a}}const Fi={};class kIt{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const OIt=0,qR=1,fne=2,QS={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function VR(e,t){return e.type===t}function iU(e){const t=[],n=function(o){const s=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))s[s.length]={type:OIt,text:RegExp.$1},o=o.substr(RegExp.$1.length);else{if(!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];s[s.length]={type:qR,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return s[s.length]={type:fne,text:""},s}(e);let r="BOD",a=0,i=n[a];for(;!VR(i,fne);){let o=0;const s=[];if(r==="BOD"){if(i.text!=="M"&&i.text!=="m")return iU("M0,0"+e);a++,o=QS[i.text],r=i.text}else VR(i,qR)?o=QS[r]:(a++,o=QS[i.text],r=i.text);if(!(a+o<n.length))throw new Error("Path data ended short");for(let l=a;l<a+o;l++){const c=n[l];if(!VR(c,qR))throw new Error("Param not a number: "+r+","+c.text);s[s.length]=+c.text}if(typeof QS[r]!="number")throw new Error("Bad segment: "+r);{const l={key:r,data:s};t.push(l),a+=o,i=n[a],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}function WSe(e){let t=0,n=0,r=0,a=0;const i=[];for(const{key:o,data:s}of e)switch(o){case"M":i.push({key:"M",data:[...s]}),[t,n]=s,[r,a]=s;break;case"m":t+=s[0],n+=s[1],i.push({key:"M",data:[t,n]}),r=t,a=n;break;case"L":i.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],i.push({key:"L",data:[t,n]});break;case"C":i.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{const l=s.map((c,u)=>u%2?c+n:c+t);i.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":i.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{const l=s.map((c,u)=>u%2?c+n:c+t);i.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":i.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],i.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":i.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],i.push({key:"V",data:[n]});break;case"S":i.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{const l=s.map((c,u)=>u%2?c+n:c+t);i.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":i.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],i.push({key:"T",data:[t,n]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=r,n=a}return i}function qSe(e){const t=[];let n="",r=0,a=0,i=0,o=0,s=0,l=0;for(const{key:c,data:u}of e){switch(c){case"M":t.push({key:"M",data:[...u]}),[r,a]=u,[i,o]=u;break;case"C":t.push({key:"C",data:[...u]}),r=u[4],a=u[5],s=u[2],l=u[3];break;case"L":t.push({key:"L",data:[...u]}),[r,a]=u;break;case"H":r=u[0],t.push({key:"L",data:[r,a]});break;case"V":a=u[0],t.push({key:"L",data:[r,a]});break;case"S":{let d=0,f=0;n==="C"||n==="S"?(d=r+(r-s),f=a+(a-l)):(d=r,f=a),t.push({key:"C",data:[d,f,...u]}),s=u[0],l=u[1],r=u[2],a=u[3];break}case"T":{const[d,f]=u;let h=0,g=0;n==="Q"||n==="T"?(h=r+(r-s),g=a+(a-l)):(h=r,g=a);const m=r+2*(h-r)/3,v=a+2*(g-a)/3,b=d+2*(h-d)/3,y=f+2*(g-f)/3;t.push({key:"C",data:[m,v,b,y,d,f]}),s=h,l=g,r=d,a=f;break}case"Q":{const[d,f,h,g]=u,m=r+2*(d-r)/3,v=a+2*(f-a)/3,b=h+2*(d-h)/3,y=g+2*(f-g)/3;t.push({key:"C",data:[m,v,b,y,h,g]}),s=d,l=f,r=h,a=g;break}case"A":{const d=Math.abs(u[0]),f=Math.abs(u[1]),h=u[2],g=u[3],m=u[4],v=u[5],b=u[6];d===0||f===0?(t.push({key:"C",data:[r,a,v,b,v,b]}),r=v,a=b):(r!==v||a!==b)&&(VSe(r,a,v,b,d,f,h,g,m).forEach(function(y){t.push({key:"C",data:y})}),r=v,a=b);break}case"Z":t.push({key:"Z",data:[]}),r=i,a=o}n=c}return t}function Cm(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function VSe(e,t,n,r,a,i,o,s,l,c){const u=(d=o,Math.PI*d/180);var d;let f=[],h=0,g=0,m=0,v=0;if(c)[h,g,m,v]=c;else{[e,t]=Cm(e,t,-u),[n,r]=Cm(n,r,-u);const $=(e-n)/2,R=(t-r)/2;let A=$*$/(a*a)+R*R/(i*i);A>1&&(A=Math.sqrt(A),a*=A,i*=A);const P=a*a,N=i*i,L=P*N-P*R*R-N*$*$,j=P*R*R+N*$*$,D=(s===l?-1:1)*Math.sqrt(Math.abs(L/j));m=D*a*R/i+(e+n)/2,v=D*-i*$/a+(t+r)/2,h=Math.asin(parseFloat(((t-v)/i).toFixed(9))),g=Math.asin(parseFloat(((r-v)/i).toFixed(9))),e<m&&(h=Math.PI-h),n<m&&(g=Math.PI-g),h<0&&(h=2*Math.PI+h),g<0&&(g=2*Math.PI+g),l&&h>g&&(h-=2*Math.PI),!l&&g>h&&(g-=2*Math.PI)}let b=g-h;if(Math.abs(b)>120*Math.PI/180){const $=g,R=n,A=r;g=l&&g>h?h+120*Math.PI/180*1:h+120*Math.PI/180*-1,f=VSe(n=m+a*Math.cos(g),r=v+i*Math.sin(g),R,A,a,i,o,0,l,[g,$,m,v])}b=g-h;const y=Math.cos(h),S=Math.sin(h),C=Math.cos(g),x=Math.sin(g),w=Math.tan(b/4),_=4/3*a*w,T=4/3*i*w,k=[e,t],O=[e+_*S,t-T*y],I=[n+_*x,r-T*C],M=[n,r];if(O[0]=2*k[0]-O[0],O[1]=2*k[1]-O[1],c)return[O,I,M].concat(f);{f=[O,I,M].concat(f);const $=[];for(let R=0;R<f.length;R+=3){const A=Cm(f[R][0],f[R][1],u),P=Cm(f[R+1][0],f[R+1][1],u),N=Cm(f[R+2][0],f[R+2][1],u);$.push([A[0],A[1],P[0],P[1],N[0],N[1]])}return $}}const $It={randOffset:function(e,t){return bn(e,t)},randOffsetWithRange:function(e,t,n){return S1(e,t,n)},ellipse:function(e,t,n,r,a){const i=KSe(n,r,a);return YD(e,t,a,i).opset},doubleLineOps:function(e,t,n,r,a){return au(e,t,n,r,a,!0)}};function GSe(e,t,n,r,a){return{type:"path",ops:au(e,t,n,r,a)}}function nw(e,t,n){const r=(e||[]).length;if(r>2){const a=[];for(let i=0;i<r-1;i++)a.push(...au(e[i][0],e[i][1],e[i+1][0],e[i+1][1],n));return t&&a.push(...au(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:"path",ops:a}}return r===2?GSe(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:"path",ops:[]}}function IIt(e,t,n,r,a){return function(i,o){return nw(i,!0,o)}([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],a)}function pne(e,t){if(e.length){const n=typeof e[0][0]=="number"?[e]:e,r=JS(n[0],1*(1+.2*t.roughness),t),a=t.disableMultiStroke?[]:JS(n[0],1.5*(1+.22*t.roughness),mne(t));for(let i=1;i<n.length;i++){const o=n[i];if(o.length){const s=JS(o,1*(1+.2*t.roughness),t),l=t.disableMultiStroke?[]:JS(o,1.5*(1+.22*t.roughness),mne(t));for(const c of s)c.op!=="move"&&r.push(c);for(const c of l)c.op!=="move"&&a.push(c)}}return{type:"path",ops:r.concat(a)}}return{type:"path",ops:[]}}function KSe(e,t,n){const r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),a=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),i=2*Math.PI/a;let o=Math.abs(e/2),s=Math.abs(t/2);const l=1-n.curveFitting;return o+=bn(o*l,n),s+=bn(s*l,n),{increment:i,rx:o,ry:s}}function YD(e,t,n,r){const[a,i]=vne(r.increment,e,t,r.rx,r.ry,1,r.increment*S1(.1,S1(.4,1,n),n),n);let o=x1(a,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[s]=vne(r.increment,e,t,r.rx,r.ry,1.5,0,n),l=x1(s,null,n);o=o.concat(l)}return{estimatedPoints:i,opset:{type:"path",ops:o}}}function hne(e,t,n,r,a,i,o,s,l){const c=e,u=t;let d=Math.abs(n/2),f=Math.abs(r/2);d+=bn(.01*d,l),f+=bn(.01*f,l);let h=a,g=i;for(;h<0;)h+=2*Math.PI,g+=2*Math.PI;g-h>2*Math.PI&&(h=0,g=2*Math.PI);const m=2*Math.PI/l.curveStepCount,v=Math.min(m/2,(g-h)/2),b=bne(v,c,u,d,f,h,g,1,l);if(!l.disableMultiStroke){const y=bne(v,c,u,d,f,h,g,1.5,l);b.push(...y)}return o&&(s?b.push(...au(c,u,c+d*Math.cos(h),u+f*Math.sin(h),l),...au(c,u,c+d*Math.cos(g),u+f*Math.sin(g),l)):b.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(h),u+f*Math.sin(h)]})),{type:"path",ops:b}}function gne(e,t){const n=qSe(WSe(iU(e))),r=[];let a=[0,0],i=[0,0];for(const{key:o,data:s}of n)switch(o){case"M":i=[s[0],s[1]],a=[s[0],s[1]];break;case"L":r.push(...au(i[0],i[1],s[0],s[1],t)),i=[s[0],s[1]];break;case"C":{const[l,c,u,d,f,h]=s;r.push(...AIt(l,c,u,d,f,h,i,t)),i=[f,h];break}case"Z":r.push(...au(i[0],i[1],a[0],a[1],t)),i=[a[0],a[1]]}return{type:"path",ops:r}}function GR(e,t){const n=[];for(const r of e)if(r.length){const a=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:"move",data:[r[0][0]+bn(a,t),r[0][1]+bn(a,t)]});for(let o=1;o<i;o++)n.push({op:"lineTo",data:[r[o][0]+bn(a,t),r[o][1]+bn(a,t)]})}}return{type:"fillPath",ops:n}}function Kf(e,t){return function(n,r){let a=n.fillStyle||"hachure";if(!Fi[a])switch(a){case"zigzag":Fi[a]||(Fi[a]=new wIt(r));break;case"cross-hatch":Fi[a]||(Fi[a]=new CIt(r));break;case"dots":Fi[a]||(Fi[a]=new EIt(r));break;case"dashed":Fi[a]||(Fi[a]=new _It(r));break;case"zigzag-line":Fi[a]||(Fi[a]=new TIt(r));break;default:a="hachure",Fi[a]||(Fi[a]=new aU(r))}return Fi[a]}(t,$It).fillPolygons(e,t)}function mne(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function YSe(e){return e.randomizer||(e.randomizer=new kIt(e.seed||0)),e.randomizer.next()}function S1(e,t,n,r=1){return n.roughness*r*(YSe(n)*(t-e)+e)}function bn(e,t,n=1){return S1(-e,e,t,n)}function au(e,t,n,r,a,i=!1){const o=i?a.disableMultiStrokeFill:a.disableMultiStroke,s=XD(e,t,n,r,a,!0,!1);if(o)return s;const l=XD(e,t,n,r,a,!0,!0);return s.concat(l)}function XD(e,t,n,r,a,i,o){const s=Math.pow(e-n,2)+Math.pow(t-r,2),l=Math.sqrt(s);let c=1;c=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=a.maxRandomnessOffset||0;u*u*100>s&&(u=l/10);const d=u/2,f=.2+.2*YSe(a);let h=a.bowing*a.maxRandomnessOffset*(r-t)/200,g=a.bowing*a.maxRandomnessOffset*(e-n)/200;h=bn(h,a,c),g=bn(g,a,c);const m=[],v=()=>bn(d,a,c),b=()=>bn(u,a,c),y=a.preserveVertices;return o?m.push({op:"move",data:[e+(y?0:v()),t+(y?0:v())]}):m.push({op:"move",data:[e+(y?0:bn(u,a,c)),t+(y?0:bn(u,a,c))]}),o?m.push({op:"bcurveTo",data:[h+e+(n-e)*f+v(),g+t+(r-t)*f+v(),h+e+2*(n-e)*f+v(),g+t+2*(r-t)*f+v(),n+(y?0:v()),r+(y?0:v())]}):m.push({op:"bcurveTo",data:[h+e+(n-e)*f+b(),g+t+(r-t)*f+b(),h+e+2*(n-e)*f+b(),g+t+2*(r-t)*f+b(),n+(y?0:b()),r+(y?0:b())]}),m}function JS(e,t,n){if(!e.length)return[];const r=[];r.push([e[0][0]+bn(t,n),e[0][1]+bn(t,n)]),r.push([e[0][0]+bn(t,n),e[0][1]+bn(t,n)]);for(let a=1;a<e.length;a++)r.push([e[a][0]+bn(t,n),e[a][1]+bn(t,n)]),a===e.length-1&&r.push([e[a][0]+bn(t,n),e[a][1]+bn(t,n)]);return x1(r,null,n)}function x1(e,t,n){const r=e.length,a=[];if(r>3){const i=[],o=1-n.curveTightness;a.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<r;s++){const l=e[s];i[0]=[l[0],l[1]],i[1]=[l[0]+(o*e[s+1][0]-o*e[s-1][0])/6,l[1]+(o*e[s+1][1]-o*e[s-1][1])/6],i[2]=[e[s+1][0]+(o*e[s][0]-o*e[s+2][0])/6,e[s+1][1]+(o*e[s][1]-o*e[s+2][1])/6],i[3]=[e[s+1][0],e[s+1][1]],a.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}}else r===3?(a.push({op:"move",data:[e[1][0],e[1][1]]}),a.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&a.push(...XD(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return a}function vne(e,t,n,r,a,i,o,s){const l=[],c=[];if(s.roughness===0){e/=4,c.push([t+r*Math.cos(-e),n+a*Math.sin(-e)]);for(let u=0;u<=2*Math.PI;u+=e){const d=[t+r*Math.cos(u),n+a*Math.sin(u)];l.push(d),c.push(d)}c.push([t+r*Math.cos(0),n+a*Math.sin(0)]),c.push([t+r*Math.cos(e),n+a*Math.sin(e)])}else{const u=bn(.5,s)-Math.PI/2;c.push([bn(i,s)+t+.9*r*Math.cos(u-e),bn(i,s)+n+.9*a*Math.sin(u-e)]);const d=2*Math.PI+u-.01;for(let f=u;f<d;f+=e){const h=[bn(i,s)+t+r*Math.cos(f),bn(i,s)+n+a*Math.sin(f)];l.push(h),c.push(h)}c.push([bn(i,s)+t+r*Math.cos(u+2*Math.PI+.5*o),bn(i,s)+n+a*Math.sin(u+2*Math.PI+.5*o)]),c.push([bn(i,s)+t+.98*r*Math.cos(u+o),bn(i,s)+n+.98*a*Math.sin(u+o)]),c.push([bn(i,s)+t+.9*r*Math.cos(u+.5*o),bn(i,s)+n+.9*a*Math.sin(u+.5*o)])}return[c,l]}function bne(e,t,n,r,a,i,o,s,l){const c=i+bn(.1,l),u=[];u.push([bn(s,l)+t+.9*r*Math.cos(c-e),bn(s,l)+n+.9*a*Math.sin(c-e)]);for(let d=c;d<=o;d+=e)u.push([bn(s,l)+t+r*Math.cos(d),bn(s,l)+n+a*Math.sin(d)]);return u.push([t+r*Math.cos(o),n+a*Math.sin(o)]),u.push([t+r*Math.cos(o),n+a*Math.sin(o)]),x1(u,null,l)}function AIt(e,t,n,r,a,i,o,s){const l=[],c=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3];let u=[0,0];const d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let h=0;h<d;h++)h===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(f?0:bn(c[0],s)),o[1]+(f?0:bn(c[0],s))]}),u=f?[a,i]:[a+bn(c[h],s),i+bn(c[h],s)],l.push({op:"bcurveTo",data:[e+bn(c[h],s),t+bn(c[h],s),n+bn(c[h],s),r+bn(c[h],s),u[0],u[1]]});return l}function Em(e){return[...e]}function yne(e,t=0){const n=e.length;if(n<3)throw new Error("A curve must have at least three points.");const r=[];if(n===3)r.push(Em(e[0]),Em(e[1]),Em(e[2]),Em(e[2]));else{const a=[];a.push(e[0],e[0]);for(let s=1;s<e.length;s++)a.push(e[s]),s===e.length-1&&a.push(e[s]);const i=[],o=1-t;r.push(Em(a[0]));for(let s=1;s+2<a.length;s++){const l=a[s];i[0]=[l[0],l[1]],i[1]=[l[0]+(o*a[s+1][0]-o*a[s-1][0])/6,l[1]+(o*a[s+1][1]-o*a[s-1][1])/6],i[2]=[a[s+1][0]+(o*a[s][0]-o*a[s+2][0])/6,a[s+1][1]+(o*a[s][1]-o*a[s+2][1])/6],i[3]=[a[s+1][0],a[s+1][1]],r.push(i[1],i[2],i[3])}}return r}function rw(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function RIt(e,t,n){const r=rw(t,n);if(r===0)return rw(e,t);let a=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return a=Math.max(0,Math.min(1,a)),rw(e,Bu(t,n,a))}function Bu(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function ZD(e,t,n,r){const a=r||[];if(function(s,l){const c=s[l+0],u=s[l+1],d=s[l+2],f=s[l+3];let h=3*u[0]-2*c[0]-f[0];h*=h;let g=3*u[1]-2*c[1]-f[1];g*=g;let m=3*d[0]-2*f[0]-c[0];m*=m;let v=3*d[1]-2*f[1]-c[1];return v*=v,h<m&&(h=m),g<v&&(g=v),h+g}(e,t)<n){const s=e[t+0];a.length?(i=a[a.length-1],o=s,Math.sqrt(rw(i,o))>1&&a.push(s)):a.push(s),a.push(e[t+3])}else{const l=e[t+0],c=e[t+1],u=e[t+2],d=e[t+3],f=Bu(l,c,.5),h=Bu(c,u,.5),g=Bu(u,d,.5),m=Bu(f,h,.5),v=Bu(h,g,.5),b=Bu(m,v,.5);ZD([l,f,m,b],0,n,a),ZD([b,v,g,d],0,n,a)}var i,o;return a}function MIt(e,t){return w1(e,0,e.length,t)}function w1(e,t,n,r,a){const i=a||[],o=e[t],s=e[n-1];let l=0,c=1;for(let u=t+1;u<n-1;++u){const d=RIt(e[u],o,s);d>l&&(l=d,c=u)}return Math.sqrt(l)>r?(w1(e,t,c+1,r,i),w1(e,c,n,r,i)):(i.length||i.push(o),i.push(s)),i}function KR(e,t=.15,n){const r=[],a=(e.length-1)/3;for(let i=0;i<a;i++)ZD(e,3*i,t,r);return n&&n>0?w1(r,0,r.length,n):r}const eo="none";class C1{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,a,i){const o=this._o(i);return this._d("line",[GSe(t,n,r,a,o)],o)}rectangle(t,n,r,a,i){const o=this._o(i),s=[],l=IIt(t,n,r,a,o);if(o.fill){const c=[[t,n],[t+r,n],[t+r,n+a],[t,n+a]];o.fillStyle==="solid"?s.push(GR([c],o)):s.push(Kf([c],o))}return o.stroke!==eo&&s.push(l),this._d("rectangle",s,o)}ellipse(t,n,r,a,i){const o=this._o(i),s=[],l=KSe(r,a,o),c=YD(t,n,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=YD(t,n,o,l).opset;u.type="fillPath",s.push(u)}else s.push(Kf([c.estimatedPoints],o));return o.stroke!==eo&&s.push(c.opset),this._d("ellipse",s,o)}circle(t,n,r,a){const i=this.ellipse(t,n,r,r,a);return i.shape="circle",i}linearPath(t,n){const r=this._o(n);return this._d("linearPath",[nw(t,!1,r)],r)}arc(t,n,r,a,i,o,s=!1,l){const c=this._o(l),u=[],d=hne(t,n,r,a,i,o,s,!0,c);if(s&&c.fill)if(c.fillStyle==="solid"){const f=Object.assign({},c);f.disableMultiStroke=!0;const h=hne(t,n,r,a,i,o,!0,!1,f);h.type="fillPath",u.push(h)}else u.push(function(f,h,g,m,v,b,y){const S=f,C=h;let x=Math.abs(g/2),w=Math.abs(m/2);x+=bn(.01*x,y),w+=bn(.01*w,y);let _=v,T=b;for(;_<0;)_+=2*Math.PI,T+=2*Math.PI;T-_>2*Math.PI&&(_=0,T=2*Math.PI);const k=(T-_)/y.curveStepCount,O=[];for(let I=_;I<=T;I+=k)O.push([S+x*Math.cos(I),C+w*Math.sin(I)]);return O.push([S+x*Math.cos(T),C+w*Math.sin(T)]),O.push([S,C]),Kf([O],y)}(t,n,r,a,i,o,c));return c.stroke!==eo&&u.push(d),this._d("arc",u,c)}curve(t,n){const r=this._o(n),a=[],i=pne(t,r);if(r.fill&&r.fill!==eo)if(r.fillStyle==="solid"){const o=pne(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));a.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{const o=[],s=t;if(s.length){const l=typeof s[0][0]=="number"?[s]:s;for(const c of l)c.length<3?o.push(...c):c.length===3?o.push(...KR(yne([c[0],c[0],c[1],c[2]]),10,(1+r.roughness)/2)):o.push(...KR(yne(c),10,(1+r.roughness)/2))}o.length&&a.push(Kf([o],r))}return r.stroke!==eo&&a.push(i),this._d("curve",a,r)}polygon(t,n){const r=this._o(n),a=[],i=nw(t,!0,r);return r.fill&&(r.fillStyle==="solid"?a.push(GR([t],r)):a.push(Kf([t],r))),r.stroke!==eo&&a.push(i),this._d("polygon",a,r)}path(t,n){const r=this._o(n),a=[];if(!t)return this._d("path",a,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const i=r.fill&&r.fill!=="transparent"&&r.fill!==eo,o=r.stroke!==eo,s=!!(r.simplification&&r.simplification<1),l=function(u,d,f){const h=qSe(WSe(iU(u))),g=[];let m=[],v=[0,0],b=[];const y=()=>{b.length>=4&&m.push(...KR(b,d)),b=[]},S=()=>{y(),m.length&&(g.push(m),m=[])};for(const{key:x,data:w}of h)switch(x){case"M":S(),v=[w[0],w[1]],m.push(v);break;case"L":y(),m.push([w[0],w[1]]);break;case"C":if(!b.length){const _=m.length?m[m.length-1]:v;b.push([_[0],_[1]])}b.push([w[0],w[1]]),b.push([w[2],w[3]]),b.push([w[4],w[5]]);break;case"Z":y(),m.push([v[0],v[1]])}if(S(),!f)return g;const C=[];for(const x of g){const w=MIt(x,f);w.length&&C.push(w)}return C}(t,1,s?4-4*(r.simplification||1):(1+r.roughness)/2),c=gne(t,r);if(i)if(r.fillStyle==="solid")if(l.length===1){const u=gne(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));a.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else a.push(GR(l,r));else a.push(Kf(l,r));return o&&(s?l.forEach(u=>{a.push(nw(u,!1,r))}):a.push(c)),this._d("path",a,r)}opsToPath(t,n){let r="";for(const a of t.ops){const i=typeof n=="number"&&n>=0?a.data.map(o=>+o.toFixed(n)):a.data;switch(a.op){case"move":r+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":r+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":r+=`L${i[0]} ${i[1]} `}}return r.trim()}toPaths(t){const n=t.sets||[],r=t.options||this.defaultOptions,a=[];for(const i of n){let o=null;switch(i.type){case"path":o={d:this.opsToPath(i),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:eo};break;case"fillPath":o={d:this.opsToPath(i),stroke:eo,strokeWidth:0,fill:r.fill||eo};break;case"fillSketch":o=this.fillSketch(i,r)}o&&a.push(o)}return a}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||eo,strokeWidth:r,fill:eo}}_mergedShape(t){return t.filter((n,r)=>r===0||n.op!=="move")}}class PIt{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new C1(n)}draw(t){const n=t.sets||[],r=t.options||this.getDefaultOptions(),a=this.ctx,i=t.options.fixedDecimalPlaceDigits;for(const o of n)switch(o.type){case"path":a.save(),a.strokeStyle=r.stroke==="none"?"transparent":r.stroke,a.lineWidth=r.strokeWidth,r.strokeLineDash&&a.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(a.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(a,o,i),a.restore();break;case"fillPath":{a.save(),a.fillStyle=r.fill||"";const s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(a,o,i,s),a.restore();break}case"fillSketch":this.fillSketch(a,o,r)}}fillSketch(t,n,r){let a=r.fillWeight;a<0&&(a=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=a,this._drawToContext(t,n,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,r,a="nonzero"){t.beginPath();for(const i of n.ops){const o=typeof r=="number"&&r>=0?i.data.map(s=>+s.toFixed(r)):i.data;switch(i.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1])}}n.type==="fillPath"?t.fill(a):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,r,a,i){const o=this.gen.line(t,n,r,a,i);return this.draw(o),o}rectangle(t,n,r,a,i){const o=this.gen.rectangle(t,n,r,a,i);return this.draw(o),o}ellipse(t,n,r,a,i){const o=this.gen.ellipse(t,n,r,a,i);return this.draw(o),o}circle(t,n,r,a){const i=this.gen.circle(t,n,r,a);return this.draw(i),i}linearPath(t,n){const r=this.gen.linearPath(t,n);return this.draw(r),r}polygon(t,n){const r=this.gen.polygon(t,n);return this.draw(r),r}arc(t,n,r,a,i,o,s=!1,l){const c=this.gen.arc(t,n,r,a,i,o,s,l);return this.draw(c),c}curve(t,n){const r=this.gen.curve(t,n);return this.draw(r),r}path(t,n){const r=this.gen.path(t,n);return this.draw(r),r}}const ex="http://www.w3.org/2000/svg";class NIt{constructor(t,n){this.svg=t,this.gen=new C1(n)}draw(t){const n=t.sets||[],r=t.options||this.getDefaultOptions(),a=this.svg.ownerDocument||window.document,i=a.createElementNS(ex,"g"),o=t.options.fixedDecimalPlaceDigits;for(const s of n){let l=null;switch(s.type){case"path":l=a.createElementNS(ex,"path"),l.setAttribute("d",this.opsToPath(s,o)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":l=a.createElementNS(ex,"path"),l.setAttribute("d",this.opsToPath(s,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(a,s,r)}l&&i.appendChild(l)}return i}fillSketch(t,n,r){let a=r.fillWeight;a<0&&(a=r.strokeWidth/2);const i=t.createElementNS(ex,"path");return i.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),i.setAttribute("stroke",r.fill||""),i.setAttribute("stroke-width",a+""),i.setAttribute("fill","none"),r.fillLineDash&&i.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,r,a,i){const o=this.gen.line(t,n,r,a,i);return this.draw(o)}rectangle(t,n,r,a,i){const o=this.gen.rectangle(t,n,r,a,i);return this.draw(o)}ellipse(t,n,r,a,i){const o=this.gen.ellipse(t,n,r,a,i);return this.draw(o)}circle(t,n,r,a){const i=this.gen.circle(t,n,r,a);return this.draw(i)}linearPath(t,n){const r=this.gen.linearPath(t,n);return this.draw(r)}polygon(t,n){const r=this.gen.polygon(t,n);return this.draw(r)}arc(t,n,r,a,i,o,s=!1,l){const c=this.gen.arc(t,n,r,a,i,o,s,l);return this.draw(c)}curve(t,n){const r=this.gen.curve(t,n);return this.draw(r)}path(t,n){const r=this.gen.path(t,n);return this.draw(r)}}var Ut={canvas:(e,t)=>new PIt(e,t),svg:(e,t)=>new NIt(e,t),generator:e=>new C1(e),newSeed:()=>C1.newSeed()},un=W(async(e,t,n)=>{var d,f;let r;const a=t.useHtmlLabels||_a((d=pr())==null?void 0:d.htmlLabels);n?r=n:r="node default";const i=e.insert("g").attr("class",r).attr("id",t.domId||t.id),o=i.insert("g").attr("class","label").attr("style",bi(t.labelStyle));let s;t.label===void 0?s="":s=typeof t.label=="string"?t.label:t.label[0];const l=await bu(o,Zo(Cf(s),pr()),{useHtmlLabels:a,width:t.width||((f=pr().flowchart)==null?void 0:f.wrappingWidth),cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img});let c=l.getBBox();const u=((t==null?void 0:t.padding)??0)/2;if(a){const h=l.children[0],g=er(l),m=h.getElementsByTagName("img");if(m){const v=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...m].map(b=>new Promise(y=>{function S(){if(b.style.display="flex",b.style.flexDirection="column",v){const C=pr().fontSize?pr().fontSize:window.getComputedStyle(document.body).fontSize,x=5,[w=jbe.fontSize]=lT(C),_=w*x+"px";b.style.minWidth=_,b.style.maxWidth=_}else b.style.width="100%";y(b)}W(S,"setupImage"),setTimeout(()=>{b.complete&&S()}),b.addEventListener("error",S),b.addEventListener("load",S)})))}c=h.getBoundingClientRect(),g.attr("width",c.width),g.attr("height",c.height)}return a?o.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):o.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:i,bbox:c,halfPadding:u,label:o}},"labelHelper"),YR=W(async(e,t,n)=>{var l,c,u,d,f,h;const r=n.useHtmlLabels||_a((c=(l=pr())==null?void 0:l.flowchart)==null?void 0:c.htmlLabels),a=e.insert("g").attr("class","label").attr("style",n.labelStyle||""),i=await bu(a,Zo(Cf(t),pr()),{useHtmlLabels:r,width:n.width||((d=(u=pr())==null?void 0:u.flowchart)==null?void 0:d.wrappingWidth),style:n.labelStyle,addSvgBackground:!!n.icon||!!n.img});let o=i.getBBox();const s=n.padding/2;if(_a((h=(f=pr())==null?void 0:f.flowchart)==null?void 0:h.htmlLabels)){const g=i.children[0],m=er(i);o=g.getBoundingClientRect(),m.attr("width",o.width),m.attr("height",o.height)}return r?a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):a.attr("transform","translate(0, "+-o.height/2+")"),n.centerLabel&&a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:e,bbox:o,halfPadding:s,label:a}},"insertLabel"),Vt=W((e,t)=>{const n=t.node().getBBox();e.width=n.width,e.height=n.height},"updateNodeBounds"),on=W((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function Xn(e){const t=e.map((n,r)=>`${r===0?"M":"L"}${n.x},${n.y}`);return t.push("Z"),t.join(" ")}W(Xn,"createPathFromPoints");function iu(e,t,n,r,a,i){const o=[],l=n-e,c=r-t,u=l/i,d=2*Math.PI/u,f=t+c/2;for(let h=0;h<=50;h++){const g=h/50,m=e+g*l,v=f+a*Math.sin(d*(m-e));o.push({x:m,y:v})}return o}W(iu,"generateFullSineWavePoints");function Py(e,t,n,r,a,i){const o=[],s=a*Math.PI/180,u=(i*Math.PI/180-s)/(r-1);for(let d=0;d<r;d++){const f=s+d*u,h=e+n*Math.cos(f),g=t+n*Math.sin(f);o.push({x:-h,y:-g})}return o}W(Py,"generateCirclePoints");var LIt=W((e,t)=>{var n=e.x,r=e.y,a=t.x-n,i=t.y-r,o=e.width/2,s=e.height/2,l,c;return Math.abs(i)*o>Math.abs(a)*s?(i<0&&(s=-s),l=i===0?0:s*a/i,c=s):(a<0&&(o=-o),l=o,c=a===0?0:o*i/a),{x:n+l,y:r+c}},"intersectRect"),Tg=LIt;function XSe(e,t){t&&e.attr("style",t)}W(XSe,"applyStyle");async function ZSe(e){const t=er(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),n=t.append("xhtml:div"),r=pr();let a=e.label;e.label&&kh(e.label)&&(a=await yH(e.label.replace(wg.lineBreakRegex,`
|
|
892
|
-
`),r));const o='<span class="'+(e.isNode?"nodeLabel":"edgeLabel")+'" '+(e.labelStyle?'style="'+e.labelStyle+'"':"")+">"+a+"</span>";return n.html(Zo(o,r)),XSe(n,e.labelStyle),n.style("display","inline-block"),n.style("padding-right","1px"),n.style("white-space","nowrap"),n.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}W(ZSe,"addHtmlLabel");var DIt=W(async(e,t,n,r)=>{let a=e||"";if(typeof a=="object"&&(a=a[0]),_a(pr().flowchart.htmlLabels)){a=a.replace(/\\n|\n/g,"<br />"),et.info("vertexText"+a);const i={isNode:r,label:Cf(a).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await ZSe(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("style",t.replace("color:","fill:"));let o=[];typeof a=="string"?o=a.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(a)?o=a:o=[];for(const s of o){const l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),n?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=s.trim(),i.appendChild(l)}return i}},"createLabel"),dd=DIt,yu=W((e,t,n,r,a)=>["M",e+a,t,"H",e+n-a,"A",a,a,0,0,1,e+n,t+a,"V",t+r-a,"A",a,a,0,0,1,e+n-a,t+r,"H",e+a,"A",a,a,0,0,1,e,t+r-a,"V",t+a,"A",a,a,0,0,1,e+a,t,"Z"].join(" "),"createRoundedRectPathD"),QSe=W(async(e,t)=>{et.info("Creating subgraph rect for ",t.id,t);const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{clusterBkg:i,clusterBorder:o}=r,{labelStyles:s,nodeStyles:l,borderStyles:c,backgroundStyles:u}=qt(t),d=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_a(n.flowchart.htmlLabels),h=d.insert("g").attr("class","cluster-label "),g=await bu(h,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0});let m=g.getBBox();if(_a(n.flowchart.htmlLabels)){const _=g.children[0],T=er(g);m=_.getBoundingClientRect(),T.attr("width",m.width),T.attr("height",m.height)}const v=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;const b=t.height,y=t.x-v/2,S=t.y-b/2;et.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){const _=Ut.svg(d),T=Wt(t,{roughness:.7,fill:i,stroke:o,fillWeight:3,seed:a}),k=_.path(yu(y,S,v,b,0),T);C=d.insert(()=>(et.debug("Rough node insert CXC",k),k),":first-child"),C.select("path:nth-child(2)").attr("style",c.join(";")),C.select("path").attr("style",u.join(";").replace("fill","stroke"))}else C=d.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",y).attr("y",S).attr("width",v).attr("height",b);const{subGraphTitleTopMargin:x}=DH(n);if(h.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+x})`),s){const _=h.select("span");_&&_.attr("style",s)}const w=C.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return Tg(t,_)},{cluster:d,labelBBox:m}},"rect"),jIt=W((e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),a=0*t.padding,i=a/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-i).attr("y",t.y-t.height/2-i).attr("width",t.width+a).attr("height",t.height+a).attr("fill","none");const o=r.node().getBBox();return t.width=o.width,t.height=o.height,t.intersect=function(s){return Tg(t,s)},{cluster:n,labelBBox:{width:0,height:0}}},"noteGroup"),BIt=W(async(e,t)=>{const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{altBackground:i,compositeBackground:o,compositeTitleBackground:s,nodeBorder:l}=r,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),u=c.insert("g",":first-child"),d=c.insert("g").attr("class","cluster-label");let f=c.append("rect");const h=d.node().appendChild(await dd(t.label,t.labelStyle,void 0,!0));let g=h.getBBox();if(_a(n.flowchart.htmlLabels)){const k=h.children[0],O=er(h);g=k.getBoundingClientRect(),O.attr("width",g.width),O.attr("height",g.height)}const m=0*t.padding,v=m/2,b=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+m;t.width<=g.width+t.padding?t.diff=(b-t.width)/2-t.padding:t.diff=-t.padding;const y=t.height+m,S=t.height+m-g.height-6,C=t.x-b/2,x=t.y-y/2;t.width=b;const w=t.y-t.height/2-v+g.height+2;let _;if(t.look==="handDrawn"){const k=t.cssClasses.includes("statediagram-cluster-alt"),O=Ut.svg(c),I=t.rx||t.ry?O.path(yu(C,x,b,y,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:l,seed:a}):O.rectangle(C,x,b,y,{seed:a});_=c.insert(()=>I,":first-child");const M=O.rectangle(C,w,b,S,{fill:k?i:o,fillStyle:k?"hachure":"solid",stroke:l,seed:a});_=c.insert(()=>I,":first-child"),f=c.insert(()=>M)}else _=u.insert("rect",":first-child"),_.attr("class","outer").attr("x",C).attr("y",x).attr("width",b).attr("height",y).attr("data-look",t.look),f.attr("class","inner").attr("x",C).attr("y",w).attr("width",b).attr("height",S);d.attr("transform",`translate(${t.x-g.width/2}, ${x+1-(_a(n.flowchart.htmlLabels)?0:3)})`);const T=_.node().getBBox();return t.height=T.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(k){return Tg(t,k)},{cluster:c,labelBBox:g}},"roundedWithTitle"),FIt=W(async(e,t)=>{et.info("Creating subgraph rect for ",t.id,t);const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{clusterBkg:i,clusterBorder:o}=r,{labelStyles:s,nodeStyles:l,borderStyles:c,backgroundStyles:u}=qt(t),d=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_a(n.flowchart.htmlLabels),h=d.insert("g").attr("class","cluster-label "),g=await bu(h,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width});let m=g.getBBox();if(_a(n.flowchart.htmlLabels)){const _=g.children[0],T=er(g);m=_.getBoundingClientRect(),T.attr("width",m.width),T.attr("height",m.height)}const v=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;const b=t.height,y=t.x-v/2,S=t.y-b/2;et.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){const _=Ut.svg(d),T=Wt(t,{roughness:.7,fill:i,stroke:o,fillWeight:4,seed:a}),k=_.path(yu(y,S,v,b,t.rx),T);C=d.insert(()=>(et.debug("Rough node insert CXC",k),k),":first-child"),C.select("path:nth-child(2)").attr("style",c.join(";")),C.select("path").attr("style",u.join(";").replace("fill","stroke"))}else C=d.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",y).attr("y",S).attr("width",v).attr("height",b);const{subGraphTitleTopMargin:x}=DH(n);if(h.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+x})`),s){const _=h.select("span");_&&_.attr("style",s)}const w=C.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return Tg(t,_)},{cluster:d,labelBBox:m}},"kanbanSection"),zIt=W((e,t)=>{const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{nodeBorder:i}=r,o=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),s=o.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const u=t.height+l,d=t.x-c/2,f=t.y-u/2;t.width=c;let h;if(t.look==="handDrawn"){const v=Ut.svg(o).rectangle(d,f,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:a});h=o.insert(()=>v,":first-child")}else h=s.insert("rect",":first-child"),h.attr("class","divider").attr("x",d).attr("y",f).attr("width",c).attr("height",u).attr("data-look",t.look);const g=h.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return Tg(t,m)},{cluster:o,labelBBox:{}}},"divider"),HIt=QSe,UIt={rect:QSe,squareRect:HIt,roundedWithTitle:BIt,noteGroup:jIt,divider:zIt,kanbanSection:FIt},JSe=new Map,WIt=W(async(e,t)=>{const n=t.shape||"rect",r=await UIt[n](e,t);return JSe.set(t.id,r),r},"insertCluster"),d4t=W(()=>{JSe=new Map},"clear");function exe(e,t){return e.intersect(t)}W(exe,"intersectNode");var qIt=exe;function txe(e,t,n,r){var a=e.x,i=e.y,o=a-r.x,s=i-r.y,l=Math.sqrt(t*t*s*s+n*n*o*o),c=Math.abs(t*n*o/l);r.x<a&&(c=-c);var u=Math.abs(t*n*s/l);return r.y<i&&(u=-u),{x:a+c,y:i+u}}W(txe,"intersectEllipse");var nxe=txe;function rxe(e,t,n){return nxe(e,t,t,n)}W(rxe,"intersectCircle");var VIt=rxe;function axe(e,t,n,r){{const a=t.y-e.y,i=e.x-t.x,o=t.x*e.y-e.x*t.y,s=a*n.x+i*n.y+o,l=a*r.x+i*r.y+o,c=1e-6;if(s!==0&&l!==0&&QD(s,l))return;const u=r.y-n.y,d=n.x-r.x,f=r.x*n.y-n.x*r.y,h=u*e.x+d*e.y+f,g=u*t.x+d*t.y+f;if(Math.abs(h)<c&&Math.abs(g)<c&&QD(h,g))return;const m=a*d-u*i;if(m===0)return;const v=Math.abs(m/2);let b=i*f-d*o;const y=b<0?(b-v)/m:(b+v)/m;b=u*o-a*f;const S=b<0?(b-v)/m:(b+v)/m;return{x:y,y:S}}}W(axe,"intersectLine");function QD(e,t){return e*t>0}W(QD,"sameSign");var GIt=axe;function ixe(e,t,n){let r=e.x,a=e.y,i=[],o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(u){o=Math.min(o,u.x),s=Math.min(s,u.y)}):(o=Math.min(o,t.x),s=Math.min(s,t.y));let l=r-e.width/2-o,c=a-e.height/2-s;for(let u=0;u<t.length;u++){let d=t[u],f=t[u<t.length-1?u+1:0],h=GIt(e,n,{x:l+d.x,y:c+d.y},{x:l+f.x,y:c+f.y});h&&i.push(h)}return i.length?(i.length>1&&i.sort(function(u,d){let f=u.x-n.x,h=u.y-n.y,g=Math.sqrt(f*f+h*h),m=d.x-n.x,v=d.y-n.y,b=Math.sqrt(m*m+v*v);return g<b?-1:g===b?0:1}),i[0]):e}W(ixe,"intersectPolygon");var KIt=ixe,Nt={node:qIt,circle:VIt,ellipse:nxe,polygon:KIt,rect:Tg};function oxe(e,t){const{labelStyles:n}=qt(t);t.labelStyle=n;const r=on(t);let a=r;r||(a="anchor");const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=1,{cssStyles:s}=t,l=Ut.svg(i),c=Wt(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,o*2,c),d=i.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",bi(s)),Vt(t,d),t.intersect=function(f){return et.info("Circle intersect",t,o,f),Nt.circle(t,o,f)},i}W(oxe,"anchor");function JD(e,t,n,r,a,i,o){const l=(e+n)/2,c=(t+r)/2,u=Math.atan2(r-t,n-e),d=(n-e)/2,f=(r-t)/2,h=d/a,g=f/i,m=Math.sqrt(h**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const v=Math.sqrt(1-m**2),b=l+v*i*Math.sin(u)*(o?-1:1),y=c-v*a*Math.cos(u)*(o?-1:1),S=Math.atan2((t-y)/i,(e-b)/a);let x=Math.atan2((r-y)/i,(n-b)/a)-S;o&&x<0&&(x+=2*Math.PI),!o&&x>0&&(x-=2*Math.PI);const w=[];for(let _=0;_<20;_++){const T=_/19,k=S+T*x,O=b+a*Math.cos(k),I=y+i*Math.sin(k);w.push({x:O,y:I})}return w}W(JD,"generateArcPoints");async function sxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.width+t.padding+20,s=i.height+t.padding,l=s/2,c=l/(2.5+s/50),{cssStyles:u}=t,d=[{x:o/2,y:-s/2},{x:-o/2,y:-s/2},...JD(-o/2,-s/2,-o/2,s/2,c,l,!1),{x:o/2,y:s/2},...JD(o/2,s/2,o/2,-s/2,c,l,!0)],f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=Xn(d),m=f.path(g,h),v=a.insert(()=>m,":first-child");return v.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",u),r&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",r),v.attr("transform",`translate(${c/2}, 0)`),Vt(t,v),t.intersect=function(b){return Nt.polygon(t,d,b)},a}W(sxe,"bowTieRect");function Su(e,t,n,r){return e.insert("polygon",":first-child").attr("points",r.map(function(a){return a.x+","+a.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+n/2+")")}W(Su,"insertPolygonShape");async function lxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.height+t.padding,s=12,l=i.width+t.padding+s,c=0,u=l,d=-o,f=0,h=[{x:c+s,y:d},{x:u,y:d},{x:u,y:f},{x:c,y:f},{x:c,y:d+s},{x:c+s,y:d}];let g;const{cssStyles:m}=t;if(t.look==="handDrawn"){const v=Ut.svg(a),b=Wt(t,{}),y=Xn(h),S=v.path(y,b);g=a.insert(()=>S,":first-child").attr("transform",`translate(${-l/2}, ${o/2})`),m&&g.attr("style",m)}else g=Su(a,l,o,h);return r&&g.attr("style",r),Vt(t,g),t.intersect=function(v){return Nt.polygon(t,h,v)},a}W(lxe,"card");function cxe(e,t){const{nodeStyles:n}=qt(t);t.label="";const r=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,i=Math.max(28,t.width??0),o=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],s=Ut.svg(r),l=Wt(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Xn(o),u=s.path(c,l),d=r.insert(()=>u,":first-child");return a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",n),t.width=28,t.height=28,t.intersect=function(f){return Nt.polygon(t,o,f)},r}W(cxe,"choice");async function oU(e,t,n){const{labelStyles:r,nodeStyles:a}=qt(t);t.labelStyle=r;const{shapeSvg:i,bbox:o,halfPadding:s}=await un(e,t,on(t)),l=(n==null?void 0:n.padding)??s,c=o.width/2+l;let u;const{cssStyles:d}=t;if(t.look==="handDrawn"){const f=Ut.svg(i),h=Wt(t,{}),g=f.circle(0,0,c*2,h);u=i.insert(()=>g,":first-child"),u.attr("class","basic label-container").attr("style",bi(d))}else u=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",a).attr("r",c).attr("cx",0).attr("cy",0);return Vt(t,u),t.calcIntersect=function(f,h){const g=f.width/2;return Nt.circle(f,g,h)},t.intersect=function(f){return et.info("Circle intersect",t,c,f),Nt.circle(t,c,f)},i}W(oU,"circle");function uxe(e){const t=Math.cos(Math.PI/4),n=Math.sin(Math.PI/4),r=e*2,a={x:r/2*t,y:r/2*n},i={x:-(r/2)*t,y:r/2*n},o={x:-(r/2)*t,y:-(r/2)*n},s={x:r/2*t,y:-(r/2)*n};return`M ${i.x},${i.y} L ${s.x},${s.y}
|
|
892
|
+
`),r));const o='<span class="'+(e.isNode?"nodeLabel":"edgeLabel")+'" '+(e.labelStyle?'style="'+e.labelStyle+'"':"")+">"+a+"</span>";return n.html(Zo(o,r)),XSe(n,e.labelStyle),n.style("display","inline-block"),n.style("padding-right","1px"),n.style("white-space","nowrap"),n.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}W(ZSe,"addHtmlLabel");var DIt=W(async(e,t,n,r)=>{let a=e||"";if(typeof a=="object"&&(a=a[0]),_a(pr().flowchart.htmlLabels)){a=a.replace(/\\n|\n/g,"<br />"),et.info("vertexText"+a);const i={isNode:r,label:Cf(a).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await ZSe(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("style",t.replace("color:","fill:"));let o=[];typeof a=="string"?o=a.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(a)?o=a:o=[];for(const s of o){const l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),n?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=s.trim(),i.appendChild(l)}return i}},"createLabel"),dd=DIt,yu=W((e,t,n,r,a)=>["M",e+a,t,"H",e+n-a,"A",a,a,0,0,1,e+n,t+a,"V",t+r-a,"A",a,a,0,0,1,e+n-a,t+r,"H",e+a,"A",a,a,0,0,1,e,t+r-a,"V",t+a,"A",a,a,0,0,1,e+a,t,"Z"].join(" "),"createRoundedRectPathD"),QSe=W(async(e,t)=>{et.info("Creating subgraph rect for ",t.id,t);const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{clusterBkg:i,clusterBorder:o}=r,{labelStyles:s,nodeStyles:l,borderStyles:c,backgroundStyles:u}=qt(t),d=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_a(n.flowchart.htmlLabels),h=d.insert("g").attr("class","cluster-label "),g=await bu(h,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0});let m=g.getBBox();if(_a(n.flowchart.htmlLabels)){const _=g.children[0],T=er(g);m=_.getBoundingClientRect(),T.attr("width",m.width),T.attr("height",m.height)}const v=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;const b=t.height,y=t.x-v/2,S=t.y-b/2;et.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){const _=Ut.svg(d),T=Wt(t,{roughness:.7,fill:i,stroke:o,fillWeight:3,seed:a}),k=_.path(yu(y,S,v,b,0),T);C=d.insert(()=>(et.debug("Rough node insert CXC",k),k),":first-child"),C.select("path:nth-child(2)").attr("style",c.join(";")),C.select("path").attr("style",u.join(";").replace("fill","stroke"))}else C=d.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",y).attr("y",S).attr("width",v).attr("height",b);const{subGraphTitleTopMargin:x}=DH(n);if(h.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+x})`),s){const _=h.select("span");_&&_.attr("style",s)}const w=C.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return Tg(t,_)},{cluster:d,labelBBox:m}},"rect"),jIt=W((e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),a=0*t.padding,i=a/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-i).attr("y",t.y-t.height/2-i).attr("width",t.width+a).attr("height",t.height+a).attr("fill","none");const o=r.node().getBBox();return t.width=o.width,t.height=o.height,t.intersect=function(s){return Tg(t,s)},{cluster:n,labelBBox:{width:0,height:0}}},"noteGroup"),BIt=W(async(e,t)=>{const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{altBackground:i,compositeBackground:o,compositeTitleBackground:s,nodeBorder:l}=r,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),u=c.insert("g",":first-child"),d=c.insert("g").attr("class","cluster-label");let f=c.append("rect");const h=d.node().appendChild(await dd(t.label,t.labelStyle,void 0,!0));let g=h.getBBox();if(_a(n.flowchart.htmlLabels)){const k=h.children[0],O=er(h);g=k.getBoundingClientRect(),O.attr("width",g.width),O.attr("height",g.height)}const m=0*t.padding,v=m/2,b=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+m;t.width<=g.width+t.padding?t.diff=(b-t.width)/2-t.padding:t.diff=-t.padding;const y=t.height+m,S=t.height+m-g.height-6,C=t.x-b/2,x=t.y-y/2;t.width=b;const w=t.y-t.height/2-v+g.height+2;let _;if(t.look==="handDrawn"){const k=t.cssClasses.includes("statediagram-cluster-alt"),O=Ut.svg(c),I=t.rx||t.ry?O.path(yu(C,x,b,y,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:l,seed:a}):O.rectangle(C,x,b,y,{seed:a});_=c.insert(()=>I,":first-child");const M=O.rectangle(C,w,b,S,{fill:k?i:o,fillStyle:k?"hachure":"solid",stroke:l,seed:a});_=c.insert(()=>I,":first-child"),f=c.insert(()=>M)}else _=u.insert("rect",":first-child"),_.attr("class","outer").attr("x",C).attr("y",x).attr("width",b).attr("height",y).attr("data-look",t.look),f.attr("class","inner").attr("x",C).attr("y",w).attr("width",b).attr("height",S);d.attr("transform",`translate(${t.x-g.width/2}, ${x+1-(_a(n.flowchart.htmlLabels)?0:3)})`);const T=_.node().getBBox();return t.height=T.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(k){return Tg(t,k)},{cluster:c,labelBBox:g}},"roundedWithTitle"),FIt=W(async(e,t)=>{et.info("Creating subgraph rect for ",t.id,t);const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{clusterBkg:i,clusterBorder:o}=r,{labelStyles:s,nodeStyles:l,borderStyles:c,backgroundStyles:u}=qt(t),d=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_a(n.flowchart.htmlLabels),h=d.insert("g").attr("class","cluster-label "),g=await bu(h,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width});let m=g.getBBox();if(_a(n.flowchart.htmlLabels)){const _=g.children[0],T=er(g);m=_.getBoundingClientRect(),T.attr("width",m.width),T.attr("height",m.height)}const v=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;const b=t.height,y=t.x-v/2,S=t.y-b/2;et.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){const _=Ut.svg(d),T=Wt(t,{roughness:.7,fill:i,stroke:o,fillWeight:4,seed:a}),k=_.path(yu(y,S,v,b,t.rx),T);C=d.insert(()=>(et.debug("Rough node insert CXC",k),k),":first-child"),C.select("path:nth-child(2)").attr("style",c.join(";")),C.select("path").attr("style",u.join(";").replace("fill","stroke"))}else C=d.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",y).attr("y",S).attr("width",v).attr("height",b);const{subGraphTitleTopMargin:x}=DH(n);if(h.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+x})`),s){const _=h.select("span");_&&_.attr("style",s)}const w=C.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return Tg(t,_)},{cluster:d,labelBBox:m}},"kanbanSection"),zIt=W((e,t)=>{const n=pr(),{themeVariables:r,handDrawnSeed:a}=n,{nodeBorder:i}=r,o=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),s=o.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const u=t.height+l,d=t.x-c/2,f=t.y-u/2;t.width=c;let h;if(t.look==="handDrawn"){const v=Ut.svg(o).rectangle(d,f,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:a});h=o.insert(()=>v,":first-child")}else h=s.insert("rect",":first-child"),h.attr("class","divider").attr("x",d).attr("y",f).attr("width",c).attr("height",u).attr("data-look",t.look);const g=h.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return Tg(t,m)},{cluster:o,labelBBox:{}}},"divider"),HIt=QSe,UIt={rect:QSe,squareRect:HIt,roundedWithTitle:BIt,noteGroup:jIt,divider:zIt,kanbanSection:FIt},JSe=new Map,WIt=W(async(e,t)=>{const n=t.shape||"rect",r=await UIt[n](e,t);return JSe.set(t.id,r),r},"insertCluster"),f4t=W(()=>{JSe=new Map},"clear");function exe(e,t){return e.intersect(t)}W(exe,"intersectNode");var qIt=exe;function txe(e,t,n,r){var a=e.x,i=e.y,o=a-r.x,s=i-r.y,l=Math.sqrt(t*t*s*s+n*n*o*o),c=Math.abs(t*n*o/l);r.x<a&&(c=-c);var u=Math.abs(t*n*s/l);return r.y<i&&(u=-u),{x:a+c,y:i+u}}W(txe,"intersectEllipse");var nxe=txe;function rxe(e,t,n){return nxe(e,t,t,n)}W(rxe,"intersectCircle");var VIt=rxe;function axe(e,t,n,r){{const a=t.y-e.y,i=e.x-t.x,o=t.x*e.y-e.x*t.y,s=a*n.x+i*n.y+o,l=a*r.x+i*r.y+o,c=1e-6;if(s!==0&&l!==0&&QD(s,l))return;const u=r.y-n.y,d=n.x-r.x,f=r.x*n.y-n.x*r.y,h=u*e.x+d*e.y+f,g=u*t.x+d*t.y+f;if(Math.abs(h)<c&&Math.abs(g)<c&&QD(h,g))return;const m=a*d-u*i;if(m===0)return;const v=Math.abs(m/2);let b=i*f-d*o;const y=b<0?(b-v)/m:(b+v)/m;b=u*o-a*f;const S=b<0?(b-v)/m:(b+v)/m;return{x:y,y:S}}}W(axe,"intersectLine");function QD(e,t){return e*t>0}W(QD,"sameSign");var GIt=axe;function ixe(e,t,n){let r=e.x,a=e.y,i=[],o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(u){o=Math.min(o,u.x),s=Math.min(s,u.y)}):(o=Math.min(o,t.x),s=Math.min(s,t.y));let l=r-e.width/2-o,c=a-e.height/2-s;for(let u=0;u<t.length;u++){let d=t[u],f=t[u<t.length-1?u+1:0],h=GIt(e,n,{x:l+d.x,y:c+d.y},{x:l+f.x,y:c+f.y});h&&i.push(h)}return i.length?(i.length>1&&i.sort(function(u,d){let f=u.x-n.x,h=u.y-n.y,g=Math.sqrt(f*f+h*h),m=d.x-n.x,v=d.y-n.y,b=Math.sqrt(m*m+v*v);return g<b?-1:g===b?0:1}),i[0]):e}W(ixe,"intersectPolygon");var KIt=ixe,Nt={node:qIt,circle:VIt,ellipse:nxe,polygon:KIt,rect:Tg};function oxe(e,t){const{labelStyles:n}=qt(t);t.labelStyle=n;const r=on(t);let a=r;r||(a="anchor");const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=1,{cssStyles:s}=t,l=Ut.svg(i),c=Wt(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,o*2,c),d=i.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",bi(s)),Vt(t,d),t.intersect=function(f){return et.info("Circle intersect",t,o,f),Nt.circle(t,o,f)},i}W(oxe,"anchor");function JD(e,t,n,r,a,i,o){const l=(e+n)/2,c=(t+r)/2,u=Math.atan2(r-t,n-e),d=(n-e)/2,f=(r-t)/2,h=d/a,g=f/i,m=Math.sqrt(h**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const v=Math.sqrt(1-m**2),b=l+v*i*Math.sin(u)*(o?-1:1),y=c-v*a*Math.cos(u)*(o?-1:1),S=Math.atan2((t-y)/i,(e-b)/a);let x=Math.atan2((r-y)/i,(n-b)/a)-S;o&&x<0&&(x+=2*Math.PI),!o&&x>0&&(x-=2*Math.PI);const w=[];for(let _=0;_<20;_++){const T=_/19,k=S+T*x,O=b+a*Math.cos(k),I=y+i*Math.sin(k);w.push({x:O,y:I})}return w}W(JD,"generateArcPoints");async function sxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.width+t.padding+20,s=i.height+t.padding,l=s/2,c=l/(2.5+s/50),{cssStyles:u}=t,d=[{x:o/2,y:-s/2},{x:-o/2,y:-s/2},...JD(-o/2,-s/2,-o/2,s/2,c,l,!1),{x:o/2,y:s/2},...JD(o/2,s/2,o/2,-s/2,c,l,!0)],f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=Xn(d),m=f.path(g,h),v=a.insert(()=>m,":first-child");return v.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",u),r&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",r),v.attr("transform",`translate(${c/2}, 0)`),Vt(t,v),t.intersect=function(b){return Nt.polygon(t,d,b)},a}W(sxe,"bowTieRect");function Su(e,t,n,r){return e.insert("polygon",":first-child").attr("points",r.map(function(a){return a.x+","+a.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+n/2+")")}W(Su,"insertPolygonShape");async function lxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.height+t.padding,s=12,l=i.width+t.padding+s,c=0,u=l,d=-o,f=0,h=[{x:c+s,y:d},{x:u,y:d},{x:u,y:f},{x:c,y:f},{x:c,y:d+s},{x:c+s,y:d}];let g;const{cssStyles:m}=t;if(t.look==="handDrawn"){const v=Ut.svg(a),b=Wt(t,{}),y=Xn(h),S=v.path(y,b);g=a.insert(()=>S,":first-child").attr("transform",`translate(${-l/2}, ${o/2})`),m&&g.attr("style",m)}else g=Su(a,l,o,h);return r&&g.attr("style",r),Vt(t,g),t.intersect=function(v){return Nt.polygon(t,h,v)},a}W(lxe,"card");function cxe(e,t){const{nodeStyles:n}=qt(t);t.label="";const r=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,i=Math.max(28,t.width??0),o=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],s=Ut.svg(r),l=Wt(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Xn(o),u=s.path(c,l),d=r.insert(()=>u,":first-child");return a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",n),t.width=28,t.height=28,t.intersect=function(f){return Nt.polygon(t,o,f)},r}W(cxe,"choice");async function oU(e,t,n){const{labelStyles:r,nodeStyles:a}=qt(t);t.labelStyle=r;const{shapeSvg:i,bbox:o,halfPadding:s}=await un(e,t,on(t)),l=(n==null?void 0:n.padding)??s,c=o.width/2+l;let u;const{cssStyles:d}=t;if(t.look==="handDrawn"){const f=Ut.svg(i),h=Wt(t,{}),g=f.circle(0,0,c*2,h);u=i.insert(()=>g,":first-child"),u.attr("class","basic label-container").attr("style",bi(d))}else u=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",a).attr("r",c).attr("cx",0).attr("cy",0);return Vt(t,u),t.calcIntersect=function(f,h){const g=f.width/2;return Nt.circle(f,g,h)},t.intersect=function(f){return et.info("Circle intersect",t,c,f),Nt.circle(t,c,f)},i}W(oU,"circle");function uxe(e){const t=Math.cos(Math.PI/4),n=Math.sin(Math.PI/4),r=e*2,a={x:r/2*t,y:r/2*n},i={x:-(r/2)*t,y:r/2*n},o={x:-(r/2)*t,y:-(r/2)*n},s={x:r/2*t,y:-(r/2)*n};return`M ${i.x},${i.y} L ${s.x},${s.y}
|
|
893
893
|
M ${a.x},${a.y} L ${o.x},${o.y}`}W(uxe,"createLine");function dxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n,t.label="";const a=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),i=Math.max(30,(t==null?void 0:t.width)??0),{cssStyles:o}=t,s=Ut.svg(a),l=Wt(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=s.circle(0,0,i*2,l),u=uxe(i),d=s.path(u,l),f=a.insert(()=>c,":first-child");return f.insert(()=>d),o&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",o),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),Vt(t,f),t.intersect=function(h){return et.info("crossedCircle intersect",t,{radius:i,point:h}),Nt.circle(t,i,h)},a}W(dxe,"crossedCircle");function Rl(e,t,n,r=100,a=0,i=180){const o=[],s=a*Math.PI/180,u=(i*Math.PI/180-s)/(r-1);for(let d=0;d<r;d++){const f=s+d*u,h=e+n*Math.cos(f),g=t+n*Math.sin(f);o.push({x:-h,y:-g})}return o}W(Rl,"generateCirclePoints");async function fxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,d=[...Rl(s/2,-l/2,c,30,-90,0),{x:-s/2-c,y:c},...Rl(s/2+c*2,-c,c,20,-180,-270),...Rl(s/2+c*2,c,c,20,-90,-180),{x:-s/2-c,y:-l/2},...Rl(s/2,l/2,c,20,0,90)],f=[{x:s/2,y:-l/2-c},{x:-s/2,y:-l/2-c},...Rl(s/2,-l/2,c,20,-90,0),{x:-s/2-c,y:-c},...Rl(s/2+s*.1,-c,c,20,-180,-270),...Rl(s/2+s*.1,c,c,20,-90,-180),{x:-s/2-c,y:l/2},...Rl(s/2,l/2,c,20,0,90),{x:-s/2,y:l/2+c},{x:s/2,y:l/2+c}],h=Ut.svg(a),g=Wt(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const v=Xn(d).replace("Z",""),b=h.path(v,g),y=Xn(f),S=h.path(y,{...g}),C=a.insert("g",":first-child");return C.insert(()=>S,":first-child").attr("stroke-opacity",0),C.insert(()=>b,":first-child"),C.attr("class","text"),u&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",u),r&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",r),C.attr("transform",`translate(${c}, 0)`),o.attr("transform",`translate(${-s/2+c-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),Vt(t,C),t.intersect=function(x){return Nt.polygon(t,f,x)},a}W(fxe,"curlyBraceLeft");function Ml(e,t,n,r=100,a=0,i=180){const o=[],s=a*Math.PI/180,u=(i*Math.PI/180-s)/(r-1);for(let d=0;d<r;d++){const f=s+d*u,h=e+n*Math.cos(f),g=t+n*Math.sin(f);o.push({x:h,y:g})}return o}W(Ml,"generateCirclePoints");async function pxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,d=[...Ml(s/2,-l/2,c,20,-90,0),{x:s/2+c,y:-c},...Ml(s/2+c*2,-c,c,20,-180,-270),...Ml(s/2+c*2,c,c,20,-90,-180),{x:s/2+c,y:l/2},...Ml(s/2,l/2,c,20,0,90)],f=[{x:-s/2,y:-l/2-c},{x:s/2,y:-l/2-c},...Ml(s/2,-l/2,c,20,-90,0),{x:s/2+c,y:-c},...Ml(s/2+c*2,-c,c,20,-180,-270),...Ml(s/2+c*2,c,c,20,-90,-180),{x:s/2+c,y:l/2},...Ml(s/2,l/2,c,20,0,90),{x:s/2,y:l/2+c},{x:-s/2,y:l/2+c}],h=Ut.svg(a),g=Wt(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const v=Xn(d).replace("Z",""),b=h.path(v,g),y=Xn(f),S=h.path(y,{...g}),C=a.insert("g",":first-child");return C.insert(()=>S,":first-child").attr("stroke-opacity",0),C.insert(()=>b,":first-child"),C.attr("class","text"),u&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",u),r&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",r),C.attr("transform",`translate(${-c}, 0)`),o.attr("transform",`translate(${-s/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),Vt(t,C),t.intersect=function(x){return Nt.polygon(t,f,x)},a}W(pxe,"curlyBraceRight");function Ua(e,t,n,r=100,a=0,i=180){const o=[],s=a*Math.PI/180,u=(i*Math.PI/180-s)/(r-1);for(let d=0;d<r;d++){const f=s+d*u,h=e+n*Math.cos(f),g=t+n*Math.sin(f);o.push({x:-h,y:-g})}return o}W(Ua,"generateCirclePoints");async function hxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,d=[...Ua(s/2,-l/2,c,30,-90,0),{x:-s/2-c,y:c},...Ua(s/2+c*2,-c,c,20,-180,-270),...Ua(s/2+c*2,c,c,20,-90,-180),{x:-s/2-c,y:-l/2},...Ua(s/2,l/2,c,20,0,90)],f=[...Ua(-s/2+c+c/2,-l/2,c,20,-90,-180),{x:s/2-c/2,y:c},...Ua(-s/2-c/2,-c,c,20,0,90),...Ua(-s/2-c/2,c,c,20,-90,0),{x:s/2-c/2,y:-c},...Ua(-s/2+c+c/2,l/2,c,30,-180,-270)],h=[{x:s/2,y:-l/2-c},{x:-s/2,y:-l/2-c},...Ua(s/2,-l/2,c,20,-90,0),{x:-s/2-c,y:-c},...Ua(s/2+c*2,-c,c,20,-180,-270),...Ua(s/2+c*2,c,c,20,-90,-180),{x:-s/2-c,y:l/2},...Ua(s/2,l/2,c,20,0,90),{x:-s/2,y:l/2+c},{x:s/2-c-c/2,y:l/2+c},...Ua(-s/2+c+c/2,-l/2,c,20,-90,-180),{x:s/2-c/2,y:c},...Ua(-s/2-c/2,-c,c,20,0,90),...Ua(-s/2-c/2,c,c,20,-90,0),{x:s/2-c/2,y:-c},...Ua(-s/2+c+c/2,l/2,c,30,-180,-270)],g=Ut.svg(a),m=Wt(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const b=Xn(d).replace("Z",""),y=g.path(b,m),C=Xn(f).replace("Z",""),x=g.path(C,m),w=Xn(h),_=g.path(w,{...m}),T=a.insert("g",":first-child");return T.insert(()=>_,":first-child").attr("stroke-opacity",0),T.insert(()=>y,":first-child"),T.insert(()=>x,":first-child"),T.attr("class","text"),u&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",u),r&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",r),T.attr("transform",`translate(${c-c/4}, 0)`),o.attr("transform",`translate(${-s/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),Vt(t,T),t.intersect=function(k){return Nt.polygon(t,h,k)},a}W(hxe,"curlyBraces");async function gxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=80,s=20,l=Math.max(o,(i.width+(t.padding??0)*2)*1.25,(t==null?void 0:t.width)??0),c=Math.max(s,i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=c/2,{cssStyles:d}=t,f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=l,m=c,v=g-u,b=m/4,y=[{x:v,y:0},{x:b,y:0},{x:0,y:m/2},{x:b,y:m},{x:v,y:m},...Py(-v,-m/2,u,50,270,90)],S=Xn(y),C=f.path(S,h),x=a.insert(()=>C,":first-child");return x.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",d),r&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",r),x.attr("transform",`translate(${-l/2}, ${-c/2})`),Vt(t,x),t.intersect=function(w){return Nt.polygon(t,y,w)},a}W(gxe,"curvedTrapezoid");var YIt=W((e,t,n,r,a,i)=>[`M${e},${t+i}`,`a${a},${i} 0,0,0 ${n},0`,`a${a},${i} 0,0,0 ${-n},0`,`l0,${r}`,`a${a},${i} 0,0,0 ${n},0`,`l0,${-r}`].join(" "),"createCylinderPathD"),XIt=W((e,t,n,r,a,i)=>[`M${e},${t+i}`,`M${e+n},${t+i}`,`a${a},${i} 0,0,0 ${-n},0`,`l0,${r}`,`a${a},${i} 0,0,0 ${n},0`,`l0,${-r}`].join(" "),"createOuterCylinderPathD"),ZIt=W((e,t,n,r,a,i)=>[`M${e-n/2},${-r/2}`,`a${a},${i} 0,0,0 ${n},0`].join(" "),"createInnerCylinderPathD");async function mxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+t.padding,t.width??0),l=s/2,c=l/(2.5+s/50),u=Math.max(i.height+c+t.padding,t.height??0);let d;const{cssStyles:f}=t;if(t.look==="handDrawn"){const h=Ut.svg(a),g=XIt(0,0,s,u,l,c),m=ZIt(0,c,s,u,l,c),v=h.path(g,Wt(t,{})),b=h.path(m,Wt(t,{fill:"none"}));d=a.insert(()=>b,":first-child"),d=a.insert(()=>v,":first-child"),d.attr("class","basic label-container"),f&&d.attr("style",f)}else{const h=YIt(0,0,s,u,l,c);d=a.insert("path",":first-child").attr("d",h).attr("class","basic label-container").attr("style",bi(f)).attr("style",r)}return d.attr("label-offset-y",c),d.attr("transform",`translate(${-s/2}, ${-(u/2+c)})`),Vt(t,d),o.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+(t.padding??0)/1.5-(i.y-(i.top??0))})`),t.intersect=function(h){const g=Nt.rect(t,h),m=g.x-(t.x??0);if(l!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(g.y-(t.y??0))>(t.height??0)/2-c)){let v=c*c*(1-m*m/(l*l));v>0&&(v=Math.sqrt(v)),v=c-v,h.y-(t.y??0)>0&&(v=-v),g.y+=v}return g},a}W(mxe,"cylinder");async function vxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=i.width+t.padding,l=i.height+t.padding,c=l*.2,u=-s/2,d=-l/2-c/2,{cssStyles:f}=t,h=Ut.svg(a),g=Wt(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:u,y:d+c},{x:-u,y:d+c},{x:-u,y:-d},{x:u,y:-d},{x:u,y:d},{x:-u,y:d},{x:-u,y:d+c}],v=h.polygon(m.map(y=>[y.x,y.y]),g),b=a.insert(()=>v,":first-child");return b.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",f),r&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",r),o.attr("transform",`translate(${u+(t.padding??0)/2-(i.x-(i.left??0))}, ${d+c+(t.padding??0)/2-(i.y-(i.top??0))})`),Vt(t,b),t.intersect=function(y){return Nt.rect(t,y)},a}W(vxe,"dividedRectangle");async function bxe(e,t){var f,h;const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,halfPadding:o}=await un(e,t,on(t)),l=i.width/2+o+5,c=i.width/2+o;let u;const{cssStyles:d}=t;if(t.look==="handDrawn"){const g=Ut.svg(a),m=Wt(t,{roughness:.2,strokeWidth:2.5}),v=Wt(t,{roughness:.2,strokeWidth:1.5}),b=g.circle(0,0,l*2,m),y=g.circle(0,0,c*2,v);u=a.insert("g",":first-child"),u.attr("class",bi(t.cssClasses)).attr("style",bi(d)),(f=u.node())==null||f.appendChild(b),(h=u.node())==null||h.appendChild(y)}else{u=a.insert("g",":first-child");const g=u.insert("circle",":first-child"),m=u.insert("circle");u.attr("class","basic label-container").attr("style",r),g.attr("class","outer-circle").attr("style",r).attr("r",l).attr("cx",0).attr("cy",0),m.attr("class","inner-circle").attr("style",r).attr("r",c).attr("cx",0).attr("cy",0)}return Vt(t,u),t.intersect=function(g){return et.info("DoubleCircle intersect",t,l,g),Nt.circle(t,l,g)},a}W(bxe,"doublecircle");function yxe(e,t,{config:{themeVariables:n}}){const{labelStyles:r,nodeStyles:a}=qt(t);t.label="",t.labelStyle=r;const i=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),o=7,{cssStyles:s}=t,l=Ut.svg(i),{nodeBorder:c}=n,u=Wt(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(u.roughness=0);const d=l.circle(0,0,o*2,u),f=i.insert(()=>d,":first-child");return f.selectAll("path").attr("style",`fill: ${c} !important;`),s&&s.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",s),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),Vt(t,f),t.intersect=function(h){return et.info("filledCircle intersect",t,{radius:o,point:h}),Nt.circle(t,o,h)},i}W(yxe,"filledCircle");async function Sxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=i.width+(t.padding??0),l=s+i.height,c=s+i.height,u=[{x:0,y:-l},{x:c,y:-l},{x:c/2,y:0}],{cssStyles:d}=t,f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=Xn(u),m=f.path(g,h),v=a.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return d&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",d),r&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",r),t.width=s,t.height=l,Vt(t,v),o.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-l/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(b){return et.info("Triangle intersect",t,u,b),Nt.polygon(t,u,b)},a}W(Sxe,"flippedTriangle");function xxe(e,t,{dir:n,config:{state:r,themeVariables:a}}){const{nodeStyles:i}=qt(t);t.label="";const o=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),{cssStyles:s}=t;let l=Math.max(70,(t==null?void 0:t.width)??0),c=Math.max(10,(t==null?void 0:t.height)??0);n==="LR"&&(l=Math.max(10,(t==null?void 0:t.width)??0),c=Math.max(70,(t==null?void 0:t.height)??0));const u=-1*l/2,d=-1*c/2,f=Ut.svg(o),h=Wt(t,{stroke:a.lineColor,fill:a.lineColor});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=f.rectangle(u,d,l,c,h),m=o.insert(()=>g,":first-child");s&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",i),Vt(t,m);const v=(r==null?void 0:r.padding)??0;return t.width&&t.height&&(t.width+=v/2||0,t.height+=v/2||0),t.intersect=function(b){return Nt.rect(t,b)},o}W(xxe,"forkJoin");async function wxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const a=80,i=50,{shapeSvg:o,bbox:s}=await un(e,t,on(t)),l=Math.max(a,s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(i,s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=c/2,{cssStyles:d}=t,f=Ut.svg(o),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=[{x:-l/2,y:-c/2},{x:l/2-u,y:-c/2},...Py(-l/2+u,0,u,50,90,270),{x:l/2-u,y:c/2},{x:-l/2,y:c/2}],m=Xn(g),v=f.path(m,h),b=o.insert(()=>v,":first-child");return b.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",d),r&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",r),Vt(t,b),t.intersect=function(y){return et.info("Pill intersect",t,{radius:u,point:y}),Nt.polygon(t,g,y)},o}W(wxe,"halfRoundedRectangle");async function Cxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.height+(t.padding??0),s=i.width+(t.padding??0)*2.5,{cssStyles:l}=t,c=Ut.svg(a),u=Wt(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=s/2;const f=d/6;d=d+f;const h=o/2,g=h/2,m=d-g,v=[{x:-m,y:-h},{x:0,y:-h},{x:m,y:-h},{x:d,y:0},{x:m,y:h},{x:0,y:h},{x:-m,y:h},{x:-d,y:0}],b=Xn(v),y=c.path(b,u),S=a.insert(()=>y,":first-child");return S.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",l),r&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",r),t.width=s,t.height=o,Vt(t,S),t.intersect=function(C){return Nt.polygon(t,v,C)},a}W(Cxe,"hexagon");async function Exe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.label="",t.labelStyle=n;const{shapeSvg:a}=await un(e,t,on(t)),i=Math.max(30,(t==null?void 0:t.width)??0),o=Math.max(30,(t==null?void 0:t.height)??0),{cssStyles:s}=t,l=Ut.svg(a),c=Wt(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:i,y:0},{x:0,y:o},{x:i,y:o}],d=Xn(u),f=l.path(d,c),h=a.insert(()=>f,":first-child");return h.attr("class","basic label-container"),s&&t.look!=="handDrawn"&&h.selectChildren("path").attr("style",s),r&&t.look!=="handDrawn"&&h.selectChildren("path").attr("style",r),h.attr("transform",`translate(${-i/2}, ${-o/2})`),Vt(t,h),t.intersect=function(g){return et.info("Pill intersect",t,{points:u}),Nt.polygon(t,u,g)},a}W(Exe,"hourglass");async function _xe(e,t,{config:{themeVariables:n,flowchart:r}}){const{labelStyles:a}=qt(t);t.labelStyle=a;const i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),l=r==null?void 0:r.wrappingWidth;t.width=Math.max(s,l??0);const{shapeSvg:c,bbox:u,label:d}=await un(e,t,"icon-shape default"),f=t.pos==="t",h=s,g=s,{nodeBorder:m}=n,{stylesMap:v}=Cg(t),b=-g/2,y=-h/2,S=t.label?8:0,C=Ut.svg(c),x=Wt(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const w=C.rectangle(b,y,g,h,x),_=Math.max(g,u.width),T=h+u.height+S,k=C.rectangle(-_/2,-T/2,_,T,{...x,fill:"transparent",stroke:"none"}),O=c.insert(()=>w,":first-child"),I=c.insert(()=>k);if(t.icon){const M=c.append("g");M.html(`<g>${await R0(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);const $=M.node().getBBox(),R=$.width,A=$.height,P=$.x,N=$.y;M.attr("transform",`translate(${-R/2-P},${f?u.height/2+S/2-A/2-N:-u.height/2-S/2-A/2-N})`),M.attr("style",`color: ${v.get("stroke")??m};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-T/2:T/2-u.height})`),O.attr("transform",`translate(0,${f?u.height/2+S/2:-u.height/2-S/2})`),Vt(t,I),t.intersect=function(M){if(et.info("iconSquare intersect",t,M),!t.label)return Nt.rect(t,M);const $=t.x??0,R=t.y??0,A=t.height??0;let P=[];return f?P=[{x:$-u.width/2,y:R-A/2},{x:$+u.width/2,y:R-A/2},{x:$+u.width/2,y:R-A/2+u.height+S},{x:$+g/2,y:R-A/2+u.height+S},{x:$+g/2,y:R+A/2},{x:$-g/2,y:R+A/2},{x:$-g/2,y:R-A/2+u.height+S},{x:$-u.width/2,y:R-A/2+u.height+S}]:P=[{x:$-g/2,y:R-A/2},{x:$+g/2,y:R-A/2},{x:$+g/2,y:R-A/2+h},{x:$+u.width/2,y:R-A/2+h},{x:$+u.width/2/2,y:R+A/2},{x:$-u.width/2,y:R+A/2},{x:$-u.width/2,y:R-A/2+h},{x:$-g/2,y:R-A/2+h}],Nt.polygon(t,P,M)},c}W(_xe,"icon");async function Txe(e,t,{config:{themeVariables:n,flowchart:r}}){const{labelStyles:a}=qt(t);t.labelStyle=a;const i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),l=r==null?void 0:r.wrappingWidth;t.width=Math.max(s,l??0);const{shapeSvg:c,bbox:u,label:d}=await un(e,t,"icon-shape default"),f=20,h=t.label?8:0,g=t.pos==="t",{nodeBorder:m,mainBkg:v}=n,{stylesMap:b}=Cg(t),y=Ut.svg(c),S=Wt(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const C=b.get("fill");S.stroke=C??v;const x=c.append("g");t.icon&&x.html(`<g>${await R0(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);const w=x.node().getBBox(),_=w.width,T=w.height,k=w.x,O=w.y,I=Math.max(_,T)*Math.SQRT2+f*2,M=y.circle(0,0,I,S),$=Math.max(I,u.width),R=I+u.height+h,A=y.rectangle(-$/2,-R/2,$,R,{...S,fill:"transparent",stroke:"none"}),P=c.insert(()=>M,":first-child"),N=c.insert(()=>A);return x.attr("transform",`translate(${-_/2-k},${g?u.height/2+h/2-T/2-O:-u.height/2-h/2-T/2-O})`),x.attr("style",`color: ${b.get("stroke")??m};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${g?-R/2:R/2-u.height})`),P.attr("transform",`translate(0,${g?u.height/2+h/2:-u.height/2-h/2})`),Vt(t,N),t.intersect=function(L){return et.info("iconSquare intersect",t,L),Nt.rect(t,L)},c}W(Txe,"iconCircle");async function kxe(e,t,{config:{themeVariables:n,flowchart:r}}){const{labelStyles:a}=qt(t);t.labelStyle=a;const i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),l=r==null?void 0:r.wrappingWidth;t.width=Math.max(s,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:f}=await un(e,t,"icon-shape default"),h=t.pos==="t",g=s+d*2,m=s+d*2,{nodeBorder:v,mainBkg:b}=n,{stylesMap:y}=Cg(t),S=-m/2,C=-g/2,x=t.label?8:0,w=Ut.svg(c),_=Wt(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const T=y.get("fill");_.stroke=T??b;const k=w.path(yu(S,C,m,g,5),_),O=Math.max(m,u.width),I=g+u.height+x,M=w.rectangle(-O/2,-I/2,O,I,{..._,fill:"transparent",stroke:"none"}),$=c.insert(()=>k,":first-child").attr("class","icon-shape2"),R=c.insert(()=>M);if(t.icon){const A=c.append("g");A.html(`<g>${await R0(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);const P=A.node().getBBox(),N=P.width,L=P.height,j=P.x,D=P.y;A.attr("transform",`translate(${-N/2-j},${h?u.height/2+x/2-L/2-D:-u.height/2-x/2-L/2-D})`),A.attr("style",`color: ${y.get("stroke")??v};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${h?-I/2:I/2-u.height})`),$.attr("transform",`translate(0,${h?u.height/2+x/2:-u.height/2-x/2})`),Vt(t,R),t.intersect=function(A){if(et.info("iconSquare intersect",t,A),!t.label)return Nt.rect(t,A);const P=t.x??0,N=t.y??0,L=t.height??0;let j=[];return h?j=[{x:P-u.width/2,y:N-L/2},{x:P+u.width/2,y:N-L/2},{x:P+u.width/2,y:N-L/2+u.height+x},{x:P+m/2,y:N-L/2+u.height+x},{x:P+m/2,y:N+L/2},{x:P-m/2,y:N+L/2},{x:P-m/2,y:N-L/2+u.height+x},{x:P-u.width/2,y:N-L/2+u.height+x}]:j=[{x:P-m/2,y:N-L/2},{x:P+m/2,y:N-L/2},{x:P+m/2,y:N-L/2+g},{x:P+u.width/2,y:N-L/2+g},{x:P+u.width/2/2,y:N+L/2},{x:P-u.width/2,y:N+L/2},{x:P-u.width/2,y:N-L/2+g},{x:P-m/2,y:N-L/2+g}],Nt.polygon(t,j,A)},c}W(kxe,"iconRounded");async function Oxe(e,t,{config:{themeVariables:n,flowchart:r}}){const{labelStyles:a}=qt(t);t.labelStyle=a;const i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),l=r==null?void 0:r.wrappingWidth;t.width=Math.max(s,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:f}=await un(e,t,"icon-shape default"),h=t.pos==="t",g=s+d*2,m=s+d*2,{nodeBorder:v,mainBkg:b}=n,{stylesMap:y}=Cg(t),S=-m/2,C=-g/2,x=t.label?8:0,w=Ut.svg(c),_=Wt(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const T=y.get("fill");_.stroke=T??b;const k=w.path(yu(S,C,m,g,.1),_),O=Math.max(m,u.width),I=g+u.height+x,M=w.rectangle(-O/2,-I/2,O,I,{..._,fill:"transparent",stroke:"none"}),$=c.insert(()=>k,":first-child"),R=c.insert(()=>M);if(t.icon){const A=c.append("g");A.html(`<g>${await R0(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);const P=A.node().getBBox(),N=P.width,L=P.height,j=P.x,D=P.y;A.attr("transform",`translate(${-N/2-j},${h?u.height/2+x/2-L/2-D:-u.height/2-x/2-L/2-D})`),A.attr("style",`color: ${y.get("stroke")??v};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${h?-I/2:I/2-u.height})`),$.attr("transform",`translate(0,${h?u.height/2+x/2:-u.height/2-x/2})`),Vt(t,R),t.intersect=function(A){if(et.info("iconSquare intersect",t,A),!t.label)return Nt.rect(t,A);const P=t.x??0,N=t.y??0,L=t.height??0;let j=[];return h?j=[{x:P-u.width/2,y:N-L/2},{x:P+u.width/2,y:N-L/2},{x:P+u.width/2,y:N-L/2+u.height+x},{x:P+m/2,y:N-L/2+u.height+x},{x:P+m/2,y:N+L/2},{x:P-m/2,y:N+L/2},{x:P-m/2,y:N-L/2+u.height+x},{x:P-u.width/2,y:N-L/2+u.height+x}]:j=[{x:P-m/2,y:N-L/2},{x:P+m/2,y:N-L/2},{x:P+m/2,y:N-L/2+g},{x:P+u.width/2,y:N-L/2+g},{x:P+u.width/2/2,y:N+L/2},{x:P-u.width/2,y:N+L/2},{x:P-u.width/2,y:N-L/2+g},{x:P-m/2,y:N-L/2+g}],Nt.polygon(t,j,A)},c}W(Oxe,"iconSquare");async function $xe(e,t,{config:{flowchart:n}}){const r=new Image;r.src=(t==null?void 0:t.img)??"",await r.decode();const a=Number(r.naturalWidth.toString().replace("px","")),i=Number(r.naturalHeight.toString().replace("px",""));t.imageAspectRatio=a/i;const{labelStyles:o}=qt(t);t.labelStyle=o;const s=n==null?void 0:n.wrappingWidth;t.defaultWidth=n==null?void 0:n.wrappingWidth;const l=Math.max(t.label?s??0:0,(t==null?void 0:t.assetWidth)??a),c=t.constraint==="on"&&t!=null&&t.assetHeight?t.assetHeight*t.imageAspectRatio:l,u=t.constraint==="on"?c/t.imageAspectRatio:(t==null?void 0:t.assetHeight)??i;t.width=Math.max(c,s??0);const{shapeSvg:d,bbox:f,label:h}=await un(e,t,"image-shape default"),g=t.pos==="t",m=-c/2,v=-u/2,b=t.label?8:0,y=Ut.svg(d),S=Wt(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const C=y.rectangle(m,v,c,u,S),x=Math.max(c,f.width),w=u+f.height+b,_=y.rectangle(-x/2,-w/2,x,w,{...S,fill:"none",stroke:"none"}),T=d.insert(()=>C,":first-child"),k=d.insert(()=>_);if(t.img){const O=d.append("image");O.attr("href",t.img),O.attr("width",c),O.attr("height",u),O.attr("preserveAspectRatio","none"),O.attr("transform",`translate(${-c/2},${g?w/2-u:-w/2})`)}return h.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${g?-u/2-f.height/2-b/2:u/2-f.height/2+b/2})`),T.attr("transform",`translate(0,${g?f.height/2+b/2:-f.height/2-b/2})`),Vt(t,k),t.intersect=function(O){if(et.info("iconSquare intersect",t,O),!t.label)return Nt.rect(t,O);const I=t.x??0,M=t.y??0,$=t.height??0;let R=[];return g?R=[{x:I-f.width/2,y:M-$/2},{x:I+f.width/2,y:M-$/2},{x:I+f.width/2,y:M-$/2+f.height+b},{x:I+c/2,y:M-$/2+f.height+b},{x:I+c/2,y:M+$/2},{x:I-c/2,y:M+$/2},{x:I-c/2,y:M-$/2+f.height+b},{x:I-f.width/2,y:M-$/2+f.height+b}]:R=[{x:I-c/2,y:M-$/2},{x:I+c/2,y:M-$/2},{x:I+c/2,y:M-$/2+u},{x:I+f.width/2,y:M-$/2+u},{x:I+f.width/2/2,y:M+$/2},{x:I-f.width/2,y:M+$/2},{x:I-f.width/2,y:M-$/2+u},{x:I-c/2,y:M-$/2+u}],Nt.polygon(t,R,O)},d}W($xe,"imageSquare");async function Ixe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),s=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),l=[{x:0,y:0},{x:o,y:0},{x:o+3*s/6,y:-s},{x:-3*s/6,y:-s}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const d=Ut.svg(a),f=Wt(t,{}),h=Xn(l),g=d.path(h,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),u&&c.attr("style",u)}else c=Su(a,o,s,l);return r&&c.attr("style",r),t.width=o,t.height=s,Vt(t,c),t.intersect=function(d){return Nt.polygon(t,l,d)},a}W(Ixe,"inv_trapezoid");async function hT(e,t,n){const{labelStyles:r,nodeStyles:a}=qt(t);t.labelStyle=r;const{shapeSvg:i,bbox:o}=await un(e,t,on(t)),s=Math.max(o.width+n.labelPaddingX*2,(t==null?void 0:t.width)||0),l=Math.max(o.height+n.labelPaddingY*2,(t==null?void 0:t.height)||0),c=-s/2,u=-l/2;let d,{rx:f,ry:h}=t;const{cssStyles:g}=t;if(n!=null&&n.rx&&n.ry&&(f=n.rx,h=n.ry),t.look==="handDrawn"){const m=Ut.svg(i),v=Wt(t,{}),b=f||h?m.path(yu(c,u,s,l,f||0),v):m.rectangle(c,u,s,l,v);d=i.insert(()=>b,":first-child"),d.attr("class","basic label-container").attr("style",bi(g))}else d=i.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",a).attr("rx",bi(f)).attr("ry",bi(h)).attr("x",c).attr("y",u).attr("width",s).attr("height",l);return Vt(t,d),t.calcIntersect=function(m,v){return Nt.rect(m,v)},t.intersect=function(m){return Nt.rect(t,m)},i}W(hT,"drawRect");async function Axe(e,t){const{shapeSvg:n,bbox:r,label:a}=await un(e,t,"label"),i=n.insert("rect",":first-child");return i.attr("width",.1).attr("height",.1),n.attr("class","label edgeLabel"),a.attr("transform",`translate(${-(r.width/2)-(r.x-(r.left??0))}, ${-(r.height/2)-(r.y-(r.top??0))})`),Vt(t,i),t.intersect=function(l){return Nt.rect(t,l)},n}W(Axe,"labelRect");async function Rxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=Math.max(i.width+(t.padding??0),(t==null?void 0:t.width)??0),s=Math.max(i.height+(t.padding??0),(t==null?void 0:t.height)??0),l=[{x:0,y:0},{x:o+3*s/6,y:0},{x:o,y:-s},{x:-(3*s)/6,y:-s}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const d=Ut.svg(a),f=Wt(t,{}),h=Xn(l),g=d.path(h,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),u&&c.attr("style",u)}else c=Su(a,o,s,l);return r&&c.attr("style",r),t.width=o,t.height=s,Vt(t,c),t.intersect=function(d){return Nt.polygon(t,l,d)},a}W(Rxe,"lean_left");async function Mxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=Math.max(i.width+(t.padding??0),(t==null?void 0:t.width)??0),s=Math.max(i.height+(t.padding??0),(t==null?void 0:t.height)??0),l=[{x:-3*s/6,y:0},{x:o,y:0},{x:o+3*s/6,y:-s},{x:0,y:-s}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const d=Ut.svg(a),f=Wt(t,{}),h=Xn(l),g=d.path(h,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),u&&c.attr("style",u)}else c=Su(a,o,s,l);return r&&c.attr("style",r),t.width=o,t.height=s,Vt(t,c),t.intersect=function(d){return Nt.polygon(t,l,d)},a}W(Mxe,"lean_right");function Pxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.label="",t.labelStyle=n;const a=e.insert("g").attr("class",on(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,o=Math.max(35,(t==null?void 0:t.width)??0),s=Math.max(35,(t==null?void 0:t.height)??0),l=7,c=[{x:o,y:0},{x:0,y:s+l/2},{x:o-2*l,y:s+l/2},{x:0,y:2*s},{x:o,y:s-l/2},{x:2*l,y:s-l/2}],u=Ut.svg(a),d=Wt(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Xn(c),h=u.path(f,d),g=a.insert(()=>h,":first-child");return i&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",i),r&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",r),g.attr("transform",`translate(-${o/2},${-s})`),Vt(t,g),t.intersect=function(m){return et.info("lightningBolt intersect",t,m),Nt.polygon(t,c,m)},a}W(Pxe,"lightningBolt");var QIt=W((e,t,n,r,a,i,o)=>[`M${e},${t+i}`,`a${a},${i} 0,0,0 ${n},0`,`a${a},${i} 0,0,0 ${-n},0`,`l0,${r}`,`a${a},${i} 0,0,0 ${n},0`,`l0,${-r}`,`M${e},${t+i+o}`,`a${a},${i} 0,0,0 ${n},0`].join(" "),"createCylinderPathD"),JIt=W((e,t,n,r,a,i,o)=>[`M${e},${t+i}`,`M${e+n},${t+i}`,`a${a},${i} 0,0,0 ${-n},0`,`l0,${r}`,`a${a},${i} 0,0,0 ${n},0`,`l0,${-r}`,`M${e},${t+i+o}`,`a${a},${i} 0,0,0 ${n},0`].join(" "),"createOuterCylinderPathD"),eAt=W((e,t,n,r,a,i)=>[`M${e-n/2},${-r/2}`,`a${a},${i} 0,0,0 ${n},0`].join(" "),"createInnerCylinderPathD");async function Nxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0),t.width??0),l=s/2,c=l/(2.5+s/50),u=Math.max(i.height+c+(t.padding??0),t.height??0),d=u*.1;let f;const{cssStyles:h}=t;if(t.look==="handDrawn"){const g=Ut.svg(a),m=JIt(0,0,s,u,l,c,d),v=eAt(0,c,s,u,l,c),b=Wt(t,{}),y=g.path(m,b),S=g.path(v,b);a.insert(()=>S,":first-child").attr("class","line"),f=a.insert(()=>y,":first-child"),f.attr("class","basic label-container"),h&&f.attr("style",h)}else{const g=QIt(0,0,s,u,l,c,d);f=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",bi(h)).attr("style",r)}return f.attr("label-offset-y",c),f.attr("transform",`translate(${-s/2}, ${-(u/2+c)})`),Vt(t,f),o.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),t.intersect=function(g){const m=Nt.rect(t,g),v=m.x-(t.x??0);if(l!=0&&(Math.abs(v)<(t.width??0)/2||Math.abs(v)==(t.width??0)/2&&Math.abs(m.y-(t.y??0))>(t.height??0)/2-c)){let b=c*c*(1-v*v/(l*l));b>0&&(b=Math.sqrt(b)),b=c-b,g.y-(t.y??0)>0&&(b=-b),m.y+=b}return m},a}W(Nxe,"linedCylinder");async function Lxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,u=l+c,{cssStyles:d}=t,f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=[{x:-s/2-s/2*.1,y:-u/2},{x:-s/2-s/2*.1,y:u/2},...iu(-s/2-s/2*.1,u/2,s/2+s/2*.1,u/2,c,.8),{x:s/2+s/2*.1,y:-u/2},{x:-s/2-s/2*.1,y:-u/2},{x:-s/2,y:-u/2},{x:-s/2,y:u/2*1.1},{x:-s/2,y:-u/2}],m=f.polygon(g.map(b=>[b.x,b.y]),h),v=a.insert(()=>m,":first-child");return v.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",d),r&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",r),v.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-s/2+(t.padding??0)+s/2*.1/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),Vt(t,v),t.intersect=function(b){return Nt.polygon(t,g,b)},a}W(Lxe,"linedWaveEdgedRect");async function Dxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=5,u=-s/2,d=-l/2,{cssStyles:f}=t,h=Ut.svg(a),g=Wt(t,{}),m=[{x:u-c,y:d+c},{x:u-c,y:d+l+c},{x:u+s-c,y:d+l+c},{x:u+s-c,y:d+l},{x:u+s,y:d+l},{x:u+s,y:d+l-c},{x:u+s+c,y:d+l-c},{x:u+s+c,y:d-c},{x:u+c,y:d-c},{x:u+c,y:d},{x:u,y:d},{x:u,y:d+c}],v=[{x:u,y:d+c},{x:u+s-c,y:d+c},{x:u+s-c,y:d+l},{x:u+s,y:d+l},{x:u+s,y:d},{x:u,y:d}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Xn(m),y=h.path(b,g),S=Xn(v),C=h.path(S,{...g,fill:"none"}),x=a.insert(()=>C,":first-child");return x.insert(()=>y,":first-child"),x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),r&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",r),o.attr("transform",`translate(${-(i.width/2)-c-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),Vt(t,x),t.intersect=function(w){return Nt.polygon(t,m,w)},a}W(Dxe,"multiRect");async function jxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,u=l+c,d=-s/2,f=-u/2,h=5,{cssStyles:g}=t,m=iu(d-h,f+u+h,d+s-h,f+u+h,c,.8),v=m==null?void 0:m[m.length-1],b=[{x:d-h,y:f+h},{x:d-h,y:f+u+h},...m,{x:d+s-h,y:v.y-h},{x:d+s,y:v.y-h},{x:d+s,y:v.y-2*h},{x:d+s+h,y:v.y-2*h},{x:d+s+h,y:f-h},{x:d+h,y:f-h},{x:d+h,y:f},{x:d,y:f},{x:d,y:f+h}],y=[{x:d,y:f+h},{x:d+s-h,y:f+h},{x:d+s-h,y:v.y-h},{x:d+s,y:v.y-h},{x:d+s,y:f},{x:d,y:f}],S=Ut.svg(a),C=Wt(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const x=Xn(b),w=S.path(x,C),_=Xn(y),T=S.path(_,C),k=a.insert(()=>w,":first-child");return k.insert(()=>T),k.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",g),r&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",r),k.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-(i.width/2)-h-(i.x-(i.left??0))}, ${-(i.height/2)+h-c/2-(i.y-(i.top??0))})`),Vt(t,k),t.intersect=function(O){return Nt.polygon(t,b,O)},a}W(jxe,"multiWaveEdgedRectangle");async function Bxe(e,t,{config:{themeVariables:n}}){var y;const{labelStyles:r,nodeStyles:a}=qt(t);t.labelStyle=r,t.useHtmlLabels||((y=mi().flowchart)==null?void 0:y.htmlLabels)!==!1||(t.centerLabel=!0);const{shapeSvg:o,bbox:s,label:l}=await un(e,t,on(t)),c=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),d=-c/2,f=-u/2,{cssStyles:h}=t,g=Ut.svg(o),m=Wt(t,{fill:n.noteBkgColor,stroke:n.noteBorderColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const v=g.rectangle(d,f,c,u,m),b=o.insert(()=>v,":first-child");return b.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",h),a&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",a),l.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),Vt(t,b),t.intersect=function(S){return Nt.rect(t,S)},o}W(Bxe,"note");var tAt=W((e,t,n)=>[`M${e+n/2},${t}`,`L${e+n},${t-n/2}`,`L${e+n/2},${t-n}`,`L${e},${t-n/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Fxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.width+t.padding,s=i.height+t.padding,l=o+s,c=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let d;const{cssStyles:f}=t;if(t.look==="handDrawn"){const h=Ut.svg(a),g=Wt(t,{}),m=tAt(0,0,l),v=h.path(m,g);d=a.insert(()=>v,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),f&&d.attr("style",f)}else d=Su(a,l,l,u),d.attr("transform",`translate(${-l/2+c}, ${l/2})`);return r&&d.attr("style",r),Vt(t,d),t.calcIntersect=function(h,g){const m=h.width,v=[{x:m/2,y:0},{x:m,y:-m/2},{x:m/2,y:-m},{x:0,y:-m/2}],b=Nt.polygon(h,v,g);return{x:b.x-.5,y:b.y-.5}},t.intersect=function(h){return this.calcIntersect(t,h)},a}W(Fxe,"question");async function zxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0),(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0),(t==null?void 0:t.height)??0),c=-s/2,u=-l/2,d=u/2,f=[{x:c+d,y:u},{x:c,y:0},{x:c+d,y:-u},{x:-c,y:-u},{x:-c,y:u}],{cssStyles:h}=t,g=Ut.svg(a),m=Wt(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const v=Xn(f),b=g.path(v,m),y=a.insert(()=>b,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),r&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",r),y.attr("transform",`translate(${-d/2},0)`),o.attr("transform",`translate(${-d/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),Vt(t,y),t.intersect=function(S){return Nt.polygon(t,f,S)},a}W(zxe,"rect_left_inv_arrow");async function Hxe(e,t){var T,k;const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;let a;t.cssClasses?a="node "+t.cssClasses:a="node default";const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=i.insert("g"),s=i.insert("g").attr("class","label").attr("style",r),l=t.description,c=t.label,u=s.node().appendChild(await dd(c,t.labelStyle,!0,!0));let d={width:0,height:0};if(_a((k=(T=pr())==null?void 0:T.flowchart)==null?void 0:k.htmlLabels)){const O=u.children[0],I=er(u);d=O.getBoundingClientRect(),I.attr("width",d.width),I.attr("height",d.height)}et.info("Text 2",l);const f=l||[],h=u.getBBox(),g=s.node().appendChild(await dd(f.join?f.join("<br/>"):f,t.labelStyle,!0,!0)),m=g.children[0],v=er(g);d=m.getBoundingClientRect(),v.attr("width",d.width),v.attr("height",d.height);const b=(t.padding||0)/2;er(g).attr("transform","translate( "+(d.width>h.width?0:(h.width-d.width)/2)+", "+(h.height+b+5)+")"),er(u).attr("transform","translate( "+(d.width<h.width?0:-(h.width-d.width)/2)+", 0)"),d=s.node().getBBox(),s.attr("transform","translate("+-d.width/2+", "+(-d.height/2-b+3)+")");const y=d.width+(t.padding||0),S=d.height+(t.padding||0),C=-d.width/2-b,x=-d.height/2-b;let w,_;if(t.look==="handDrawn"){const O=Ut.svg(i),I=Wt(t,{}),M=O.path(yu(C,x,y,S,t.rx||0),I),$=O.line(-d.width/2-b,-d.height/2-b+h.height+b,d.width/2+b,-d.height/2-b+h.height+b,I);_=i.insert(()=>(et.debug("Rough node insert CXC",M),$),":first-child"),w=i.insert(()=>(et.debug("Rough node insert CXC",M),M),":first-child")}else w=o.insert("rect",":first-child"),_=o.insert("line"),w.attr("class","outer title-state").attr("style",r).attr("x",-d.width/2-b).attr("y",-d.height/2-b).attr("width",d.width+(t.padding||0)).attr("height",d.height+(t.padding||0)),_.attr("class","divider").attr("x1",-d.width/2-b).attr("x2",d.width/2+b).attr("y1",-d.height/2-b+h.height+b).attr("y2",-d.height/2-b+h.height+b);return Vt(t,w),t.intersect=function(O){return Nt.rect(t,O)},i}W(Hxe,"rectWithTitle");function Lv(e,t,n,r,a,i,o){const l=(e+n)/2,c=(t+r)/2,u=Math.atan2(r-t,n-e),d=(n-e)/2,f=(r-t)/2,h=d/a,g=f/i,m=Math.sqrt(h**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const v=Math.sqrt(1-m**2),b=l+v*i*Math.sin(u)*(o?-1:1),y=c-v*a*Math.cos(u)*(o?-1:1),S=Math.atan2((t-y)/i,(e-b)/a);let x=Math.atan2((r-y)/i,(n-b)/a)-S;o&&x<0&&(x+=2*Math.PI),!o&&x>0&&(x-=2*Math.PI);const w=[];for(let _=0;_<20;_++){const T=_/19,k=S+T*x,O=b+a*Math.cos(k),I=y+i*Math.sin(k);w.push({x:O,y:I})}return w}W(Lv,"generateArcPoints");async function Uxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=(t==null?void 0:t.padding)??0,s=(t==null?void 0:t.padding)??0,l=(t!=null&&t.width?t==null?void 0:t.width:i.width)+o*2,c=(t!=null&&t.height?t==null?void 0:t.height:i.height)+s*2,u=t.radius||5,d=t.taper||5,{cssStyles:f}=t,h=Ut.svg(a),g=Wt(t,{});t.stroke&&(g.stroke=t.stroke),t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:-l/2+d,y:-c/2},{x:l/2-d,y:-c/2},...Lv(l/2-d,-c/2,l/2,-c/2+d,u,u,!0),{x:l/2,y:-c/2+d},{x:l/2,y:c/2-d},...Lv(l/2,c/2-d,l/2-d,c/2,u,u,!0),{x:l/2-d,y:c/2},{x:-l/2+d,y:c/2},...Lv(-l/2+d,c/2,-l/2,c/2-d,u,u,!0),{x:-l/2,y:c/2-d},{x:-l/2,y:-c/2+d},...Lv(-l/2,-c/2+d,-l/2+d,-c/2,u,u,!0)],v=Xn(m),b=h.path(v,g),y=a.insert(()=>b,":first-child");return y.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",f),r&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",r),Vt(t,y),t.intersect=function(S){return Nt.polygon(t,m,S)},a}W(Uxe,"roundedRect");async function Wxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=(t==null?void 0:t.padding)??0,l=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=-i.width/2-s,d=-i.height/2-s,{cssStyles:f}=t,h=Ut.svg(a),g=Wt(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:u,y:d},{x:u+l+8,y:d},{x:u+l+8,y:d+c},{x:u-8,y:d+c},{x:u-8,y:d},{x:u,y:d},{x:u,y:d+c}],v=h.polygon(m.map(y=>[y.x,y.y]),g),b=a.insert(()=>v,":first-child");return b.attr("class","basic label-container").attr("style",bi(f)),r&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",r),f&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",r),o.attr("transform",`translate(${-l/2+4+(t.padding??0)-(i.x-(i.left??0))},${-c/2+(t.padding??0)-(i.y-(i.top??0))})`),Vt(t,b),t.intersect=function(y){return Nt.rect(t,y)},a}W(Wxe,"shadedProcess");async function qxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=-s/2,u=-l/2,{cssStyles:d}=t,f=Ut.svg(a),h=Wt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const g=[{x:c,y:u},{x:c,y:u+l},{x:c+s,y:u+l},{x:c+s,y:u-l/2}],m=Xn(g),v=f.path(m,h),b=a.insert(()=>v,":first-child");return b.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",d),r&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",r),b.attr("transform",`translate(0, ${l/4})`),o.attr("transform",`translate(${-s/2+(t.padding??0)-(i.x-(i.left??0))}, ${-l/4+(t.padding??0)-(i.y-(i.top??0))})`),Vt(t,b),t.intersect=function(y){return Nt.polygon(t,g,y)},a}W(qxe,"slopedRect");async function Vxe(e,t){const n={rx:0,ry:0,labelPaddingX:t.labelPaddingX??((t==null?void 0:t.padding)||0)*2,labelPaddingY:((t==null?void 0:t.padding)||0)*1};return hT(e,t,n)}W(Vxe,"squareRect");async function Gxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=i.height+t.padding,s=i.width+o/4+t.padding,l=o/2,{cssStyles:c}=t,u=Ut.svg(a),d=Wt(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=[{x:-s/2+l,y:-o/2},{x:s/2-l,y:-o/2},...Py(-s/2+l,0,l,50,90,270),{x:s/2-l,y:o/2},...Py(s/2-l,0,l,50,270,450)],h=Xn(f),g=u.path(h,d),m=a.insert(()=>g,":first-child");return m.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),r&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",r),Vt(t,m),t.intersect=function(v){return Nt.polygon(t,f,v)},a}W(Gxe,"stadium");async function Kxe(e,t){return hT(e,t,{rx:5,ry:5})}W(Kxe,"state");function Yxe(e,t,{config:{themeVariables:n}}){const{labelStyles:r,nodeStyles:a}=qt(t);t.labelStyle=r;const{cssStyles:i}=t,{lineColor:o,stateBorder:s,nodeBorder:l}=n,c=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),u=Ut.svg(c),d=Wt(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=u.circle(0,0,14,{...d,stroke:o,strokeWidth:2}),h=s??l,g=u.circle(0,0,5,{...d,fill:h,stroke:h,strokeWidth:2,fillStyle:"solid"}),m=c.insert(()=>f,":first-child");return m.insert(()=>g),i&&m.selectAll("path").attr("style",i),a&&m.selectAll("path").attr("style",a),Vt(t,m),t.intersect=function(v){return Nt.circle(t,7,v)},c}W(Yxe,"stateEnd");function Xxe(e,t,{config:{themeVariables:n}}){const{lineColor:r}=n,a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i;if(t.look==="handDrawn"){const s=Ut.svg(a).circle(0,0,14,mTt(r));i=a.insert(()=>s),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else i=a.insert("circle",":first-child"),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return Vt(t,i),t.intersect=function(o){return Nt.circle(t,7,o)},a}W(Xxe,"stateStart");async function Zxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=((t==null?void 0:t.padding)||0)/2,s=i.width+t.padding,l=i.height+t.padding,c=-i.width/2-o,u=-i.height/2-o,d=[{x:0,y:0},{x:s,y:0},{x:s,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:s+8,y:0},{x:s+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(t.look==="handDrawn"){const f=Ut.svg(a),h=Wt(t,{}),g=f.rectangle(c-8,u,s+16,l,h),m=f.line(c,u,c,u+l,h),v=f.line(c+s,u,c+s,u+l,h);a.insert(()=>m,":first-child"),a.insert(()=>v,":first-child");const b=a.insert(()=>g,":first-child"),{cssStyles:y}=t;b.attr("class","basic label-container").attr("style",bi(y)),Vt(t,b)}else{const f=Su(a,s,l,d);r&&f.attr("style",r),Vt(t,f)}return t.intersect=function(f){return Nt.polygon(t,d,f)},a}W(Zxe,"subroutine");async function Qxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),s=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),l=-o/2,c=-s/2,u=.2*s,d=.2*s,{cssStyles:f}=t,h=Ut.svg(a),g=Wt(t,{}),m=[{x:l-u/2,y:c},{x:l+o+u/2,y:c},{x:l+o+u/2,y:c+s},{x:l-u/2,y:c+s}],v=[{x:l+o-u/2,y:c+s},{x:l+o+u/2,y:c+s},{x:l+o+u/2,y:c+s-d}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Xn(m),y=h.path(b,g),S=Xn(v),C=h.path(S,{...g,fillStyle:"solid"}),x=a.insert(()=>C,":first-child");return x.insert(()=>y,":first-child"),x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),r&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",r),Vt(t,x),t.intersect=function(w){return Nt.polygon(t,m,w)},a}W(Qxe,"taggedRect");async function Jxe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i,label:o}=await un(e,t,on(t)),s=Math.max(i.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(i.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,u=.2*s,d=.2*l,f=l+c,{cssStyles:h}=t,g=Ut.svg(a),m=Wt(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const v=[{x:-s/2-s/2*.1,y:f/2},...iu(-s/2-s/2*.1,f/2,s/2+s/2*.1,f/2,c,.8),{x:s/2+s/2*.1,y:-f/2},{x:-s/2-s/2*.1,y:-f/2}],b=-s/2+s/2*.1,y=-f/2-d*.4,S=[{x:b+s-u,y:(y+l)*1.4},{x:b+s,y:y+l-d},{x:b+s,y:(y+l)*.9},...iu(b+s,(y+l)*1.3,b+s-u,(y+l)*1.5,-l*.03,.5)],C=Xn(v),x=g.path(C,m),w=Xn(S),_=g.path(w,{...m,fillStyle:"solid"}),T=a.insert(()=>_,":first-child");return T.insert(()=>x,":first-child"),T.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",h),r&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",r),T.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-s/2+(t.padding??0)-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),Vt(t,T),t.intersect=function(k){return Nt.polygon(t,v,k)},a}W(Jxe,"taggedWaveEdgedRectangle");async function ewe(e,t){const{labelStyles:n,nodeStyles:r}=qt(t);t.labelStyle=n;const{shapeSvg:a,bbox:i}=await un(e,t,on(t)),o=Math.max(i.width+t.padding,(t==null?void 0:t.width)||0),s=Math.max(i.height+t.padding,(t==null?void 0:t.height)||0),l=-o/2,c=-s/2,u=a.insert("rect",":first-child");return u.attr("class","text").attr("style",r).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",o).attr("height",s),Vt(t,u),t.intersect=function(d){return Nt.rect(t,d)},a}W(ewe,"text");var nAt=W((e,t,n,r,a,i)=>`M${e},${t}
|
|
894
894
|
a${a},${i} 0,0,1 0,${-r}
|
|
895
895
|
l${n},0
|
|
@@ -941,14 +941,14 @@ Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error
|
|
|
941
941
|
h${-l+2*u}
|
|
942
942
|
q-${u},0 -${u},-${u}
|
|
943
943
|
Z
|
|
944
|
-
`,f=a.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",r).attr("d",d);return a.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),s.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),a.append(()=>s.node()),Vt(t,f),t.calcIntersect=function(h,g){return Nt.rect(h,g)},t.intersect=function(h){return Nt.rect(t,h)},a}W(hwe,"defaultMindmapNode");async function gwe(e,t){const n={padding:t.padding??0};return oU(e,t,n)}W(gwe,"mindmapCircle");var oAt=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Vxe},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Uxe},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Gxe},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Zxe},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:mxe},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:oU},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:fwe},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:pwe},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Fxe},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Cxe},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Mxe},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Rxe},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:nwe},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:Ixe},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:bxe},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:ewe},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:lxe},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Wxe},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Xxe},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Yxe},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:xxe},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Exe},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:fxe},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:pxe},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:hxe},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Pxe},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:iwe},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:wxe},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:twe},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Nxe},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:gxe},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:vxe},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:awe},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:swe},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:yxe},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:rwe},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Sxe},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:qxe},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:jxe},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Dxe},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:sxe},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:dxe},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Jxe},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Qxe},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:owe},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:zxe},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Lxe}],sAt=W(()=>{const t=[...Object.entries({state:Kxe,choice:cxe,note:Bxe,rectWithTitle:Hxe,labelRect:Axe,iconSquare:Oxe,iconCircle:Txe,icon:_xe,iconRounded:kxe,imageSquare:$xe,anchor:oxe,kanbanItem:dwe,mindmapCircle:gwe,defaultMindmapNode:hwe,classBox:cwe,erBox:sU,requirementBox:uwe}),...oAt.flatMap(n=>[n.shortName,..."aliases"in n?n.aliases:[],..."internalAliases"in n?n.internalAliases:[]].map(a=>[a,n.handler]))];return Object.fromEntries(t)},"generateShapeMap"),mwe=sAt();function lAt(e){return e in mwe}W(lAt,"isValidShape");var gT=new Map;async function vwe(e,t,n){let r,a;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const i=t.shape?mwe[t.shape]:void 0;if(!i)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let o;n.config.securityLevel==="sandbox"?o="_top":t.linkTarget&&(o=t.linkTarget||"_blank"),r=e.insert("svg:a").attr("xlink:href",t.link).attr("target",o??null),a=await i(r,t,n)}else a=await i(e,t,n),r=a;return t.tooltip&&a.attr("title",t.tooltip),gT.set(t.id,r),t.haveCallback&&r.attr("class",r.attr("class")+" clickable"),r}W(vwe,"insertNode");var f4t=W((e,t)=>{gT.set(t.id,e)},"setNodeElem"),p4t=W(()=>{gT.clear()},"clear"),h4t=W(e=>{const t=gT.get(e.id);et.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const n=8,r=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+r-e.width/2)+", "+(e.y-e.height/2-n)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),r},"positionNode"),cAt=W((e,t,n,r,a,i)=>{t.arrowTypeStart&&Sne(e,"start",t.arrowTypeStart,n,r,a,i),t.arrowTypeEnd&&Sne(e,"end",t.arrowTypeEnd,n,r,a,i)},"addEdgeMarkers"),uAt={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Sne=W((e,t,n,r,a,i,o)=>{var d;const s=uAt[n];if(!s){et.warn(`Unknown arrow type: ${n}`);return}const l=s.type,u=`${a}_${i}-${l}${t==="start"?"Start":"End"}`;if(o&&o.trim()!==""){const f=o.replace(/[^\dA-Za-z]/g,"_"),h=`${u}_${f}`;if(!document.getElementById(h)){const g=document.getElementById(u);if(g){const m=g.cloneNode(!0);m.id=h,m.querySelectorAll("path, circle, line").forEach(b=>{b.setAttribute("stroke",o),s.fill&&b.setAttribute("fill",o)}),(d=g.parentNode)==null||d.appendChild(m)}}e.attr(`marker-${t}`,`url(${r}#${h})`)}else e.attr(`marker-${t}`,`url(${r}#${u})`)},"addEdgeMarker"),E1=new Map,Va=new Map,g4t=W(()=>{E1.clear(),Va.clear()},"clear"),tx=W(e=>e?e.reduce((n,r)=>n+";"+r,""):"","getLabelStyles"),dAt=W(async(e,t)=>{let n=_a(pr().flowchart.htmlLabels);const{labelStyles:r}=qt(t);t.labelStyle=r;const a=await bu(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:!0,isNode:!1});et.info("abc82",t,t.labelType);const i=e.insert("g").attr("class","edgeLabel"),o=i.insert("g").attr("class","label").attr("data-id",t.id);o.node().appendChild(a);let s=a.getBBox();if(n){const c=a.children[0],u=er(a);s=c.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}o.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),E1.set(t.id,i),t.width=s.width,t.height=s.height;let l;if(t.startLabelLeft){const c=await dd(t.startLabelLeft,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).startLeft=u,jv(l,t.startLabelLeft)}if(t.startLabelRight){const c=await dd(t.startLabelRight,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=u.node().appendChild(c),d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).startRight=u,jv(l,t.startLabelRight)}if(t.endLabelLeft){const c=await dd(t.endLabelLeft,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).endLeft=u,jv(l,t.endLabelLeft)}if(t.endLabelRight){const c=await dd(t.endLabelRight,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).endRight=u,jv(l,t.endLabelRight)}return a},"insertEdgeLabel");function jv(e,t){pr().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}W(jv,"setTerminalWidth");var fAt=W((e,t)=>{et.debug("Moving label abc88 ",e.id,e.label,E1.get(e.id),t);let n=t.updatedPath?t.updatedPath:t.originalPath;const r=pr(),{subGraphTitleTotalMargin:a}=DH(r);if(e.label){const i=E1.get(e.id);let o=e.x,s=e.y;if(n){const l=bs.calcLabelPosition(n);et.debug("Moving label "+e.label+" from (",o,",",s,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(o=l.x,s=l.y)}i.attr("transform",`translate(${o}, ${s+a/2})`)}if(e.startLabelLeft){const i=Va.get(e.id).startLeft;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.startLabelRight){const i=Va.get(e.id).startRight;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.endLabelLeft){const i=Va.get(e.id).endLeft;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.endLabelRight){const i=Va.get(e.id).endRight;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}},"positionEdgeLabel"),pAt=W((e,t)=>{const n=e.x,r=e.y,a=Math.abs(t.x-n),i=Math.abs(t.y-r),o=e.width/2,s=e.height/2;return a>=o||i>=s},"outsideNode"),hAt=W((e,t,n)=>{et.debug(`intersection calc abc89:
|
|
944
|
+
`,f=a.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",r).attr("d",d);return a.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),s.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),a.append(()=>s.node()),Vt(t,f),t.calcIntersect=function(h,g){return Nt.rect(h,g)},t.intersect=function(h){return Nt.rect(t,h)},a}W(hwe,"defaultMindmapNode");async function gwe(e,t){const n={padding:t.padding??0};return oU(e,t,n)}W(gwe,"mindmapCircle");var oAt=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Vxe},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Uxe},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Gxe},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Zxe},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:mxe},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:oU},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:fwe},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:pwe},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Fxe},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Cxe},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Mxe},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Rxe},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:nwe},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:Ixe},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:bxe},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:ewe},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:lxe},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Wxe},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Xxe},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Yxe},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:xxe},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Exe},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:fxe},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:pxe},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:hxe},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Pxe},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:iwe},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:wxe},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:twe},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Nxe},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:gxe},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:vxe},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:awe},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:swe},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:yxe},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:rwe},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Sxe},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:qxe},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:jxe},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Dxe},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:sxe},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:dxe},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Jxe},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Qxe},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:owe},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:zxe},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Lxe}],sAt=W(()=>{const t=[...Object.entries({state:Kxe,choice:cxe,note:Bxe,rectWithTitle:Hxe,labelRect:Axe,iconSquare:Oxe,iconCircle:Txe,icon:_xe,iconRounded:kxe,imageSquare:$xe,anchor:oxe,kanbanItem:dwe,mindmapCircle:gwe,defaultMindmapNode:hwe,classBox:cwe,erBox:sU,requirementBox:uwe}),...oAt.flatMap(n=>[n.shortName,..."aliases"in n?n.aliases:[],..."internalAliases"in n?n.internalAliases:[]].map(a=>[a,n.handler]))];return Object.fromEntries(t)},"generateShapeMap"),mwe=sAt();function lAt(e){return e in mwe}W(lAt,"isValidShape");var gT=new Map;async function vwe(e,t,n){let r,a;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const i=t.shape?mwe[t.shape]:void 0;if(!i)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let o;n.config.securityLevel==="sandbox"?o="_top":t.linkTarget&&(o=t.linkTarget||"_blank"),r=e.insert("svg:a").attr("xlink:href",t.link).attr("target",o??null),a=await i(r,t,n)}else a=await i(e,t,n),r=a;return t.tooltip&&a.attr("title",t.tooltip),gT.set(t.id,r),t.haveCallback&&r.attr("class",r.attr("class")+" clickable"),r}W(vwe,"insertNode");var p4t=W((e,t)=>{gT.set(t.id,e)},"setNodeElem"),h4t=W(()=>{gT.clear()},"clear"),g4t=W(e=>{const t=gT.get(e.id);et.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const n=8,r=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+r-e.width/2)+", "+(e.y-e.height/2-n)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),r},"positionNode"),cAt=W((e,t,n,r,a,i)=>{t.arrowTypeStart&&Sne(e,"start",t.arrowTypeStart,n,r,a,i),t.arrowTypeEnd&&Sne(e,"end",t.arrowTypeEnd,n,r,a,i)},"addEdgeMarkers"),uAt={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Sne=W((e,t,n,r,a,i,o)=>{var d;const s=uAt[n];if(!s){et.warn(`Unknown arrow type: ${n}`);return}const l=s.type,u=`${a}_${i}-${l}${t==="start"?"Start":"End"}`;if(o&&o.trim()!==""){const f=o.replace(/[^\dA-Za-z]/g,"_"),h=`${u}_${f}`;if(!document.getElementById(h)){const g=document.getElementById(u);if(g){const m=g.cloneNode(!0);m.id=h,m.querySelectorAll("path, circle, line").forEach(b=>{b.setAttribute("stroke",o),s.fill&&b.setAttribute("fill",o)}),(d=g.parentNode)==null||d.appendChild(m)}}e.attr(`marker-${t}`,`url(${r}#${h})`)}else e.attr(`marker-${t}`,`url(${r}#${u})`)},"addEdgeMarker"),E1=new Map,Va=new Map,m4t=W(()=>{E1.clear(),Va.clear()},"clear"),tx=W(e=>e?e.reduce((n,r)=>n+";"+r,""):"","getLabelStyles"),dAt=W(async(e,t)=>{let n=_a(pr().flowchart.htmlLabels);const{labelStyles:r}=qt(t);t.labelStyle=r;const a=await bu(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:!0,isNode:!1});et.info("abc82",t,t.labelType);const i=e.insert("g").attr("class","edgeLabel"),o=i.insert("g").attr("class","label").attr("data-id",t.id);o.node().appendChild(a);let s=a.getBBox();if(n){const c=a.children[0],u=er(a);s=c.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}o.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),E1.set(t.id,i),t.width=s.width,t.height=s.height;let l;if(t.startLabelLeft){const c=await dd(t.startLabelLeft,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).startLeft=u,jv(l,t.startLabelLeft)}if(t.startLabelRight){const c=await dd(t.startLabelRight,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=u.node().appendChild(c),d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).startRight=u,jv(l,t.startLabelRight)}if(t.endLabelLeft){const c=await dd(t.endLabelLeft,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).endLeft=u,jv(l,t.endLabelLeft)}if(t.endLabelRight){const c=await dd(t.endLabelRight,tx(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),d=u.insert("g").attr("class","inner");l=d.node().appendChild(c);const f=c.getBBox();d.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Va.get(t.id)||Va.set(t.id,{}),Va.get(t.id).endRight=u,jv(l,t.endLabelRight)}return a},"insertEdgeLabel");function jv(e,t){pr().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}W(jv,"setTerminalWidth");var fAt=W((e,t)=>{et.debug("Moving label abc88 ",e.id,e.label,E1.get(e.id),t);let n=t.updatedPath?t.updatedPath:t.originalPath;const r=pr(),{subGraphTitleTotalMargin:a}=DH(r);if(e.label){const i=E1.get(e.id);let o=e.x,s=e.y;if(n){const l=bs.calcLabelPosition(n);et.debug("Moving label "+e.label+" from (",o,",",s,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(o=l.x,s=l.y)}i.attr("transform",`translate(${o}, ${s+a/2})`)}if(e.startLabelLeft){const i=Va.get(e.id).startLeft;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.startLabelRight){const i=Va.get(e.id).startRight;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.endLabelLeft){const i=Va.get(e.id).endLeft;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}if(e.endLabelRight){const i=Va.get(e.id).endRight;let o=e.x,s=e.y;if(n){const l=bs.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",n);o=l.x,s=l.y}i.attr("transform",`translate(${o}, ${s})`)}},"positionEdgeLabel"),pAt=W((e,t)=>{const n=e.x,r=e.y,a=Math.abs(t.x-n),i=Math.abs(t.y-r),o=e.width/2,s=e.height/2;return a>=o||i>=s},"outsideNode"),hAt=W((e,t,n)=>{et.debug(`intersection calc abc89:
|
|
945
945
|
outsidePoint: ${JSON.stringify(t)}
|
|
946
946
|
insidePoint : ${JSON.stringify(n)}
|
|
947
947
|
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const r=e.x,a=e.y,i=Math.abs(r-n.x),o=e.width/2;let s=n.x<t.x?o-i:o+i;const l=e.height/2,c=Math.abs(t.y-n.y),u=Math.abs(t.x-n.x);if(Math.abs(a-t.y)*o>Math.abs(r-t.x)*l){let d=n.y<t.y?t.y-l-a:a-l-t.y;s=u*d/c;const f={x:n.x<t.x?n.x+s:n.x-u+s,y:n.y<t.y?n.y+c-d:n.y-c+d};return s===0&&(f.x=t.x,f.y=t.y),u===0&&(f.x=t.x),c===0&&(f.y=t.y),et.debug(`abc89 top/bottom calc, Q ${c}, q ${d}, R ${u}, r ${s}`,f),f}else{n.x<t.x?s=t.x-o-r:s=r-o-t.x;let d=c*s/u,f=n.x<t.x?n.x+u-s:n.x-u+s,h=n.y<t.y?n.y+d:n.y-d;return et.debug(`sides calc abc89, Q ${c}, q ${d}, R ${u}, r ${s}`,{_x:f,_y:h}),s===0&&(f=t.x,h=t.y),u===0&&(f=t.x),c===0&&(h=t.y),{x:f,y:h}}},"intersection"),xne=W((e,t)=>{et.warn("abc88 cutPathAtIntersect",e,t);let n=[],r=e[0],a=!1;return e.forEach(i=>{if(et.info("abc88 checking point",i,t),!pAt(t,i)&&!a){const o=hAt(t,r,i);et.debug("abc88 inside",i,r,o),et.debug("abc88 intersection",o,t);let s=!1;n.forEach(l=>{s=s||l.x===o.x&&l.y===o.y}),n.some(l=>l.x===o.x&&l.y===o.y)?et.warn("abc88 no intersect",o,n):n.push(o),a=!0}else et.warn("abc88 outside",i,r),r=i,a||n.push(i)}),et.debug("returning points",n),n},"cutPathAtIntersect");function bwe(e){const t=[],n=[];for(let r=1;r<e.length-1;r++){const a=e[r-1],i=e[r],o=e[r+1];(a.x===i.x&&i.y===o.y&&Math.abs(i.x-o.x)>5&&Math.abs(i.y-a.y)>5||a.y===i.y&&i.x===o.x&&Math.abs(i.x-a.x)>5&&Math.abs(i.y-o.y)>5)&&(t.push(i),n.push(r))}return{cornerPoints:t,cornerPointPositions:n}}W(bwe,"extractCornerPoints");var wne=W(function(e,t,n){const r=t.x-e.x,a=t.y-e.y,i=Math.sqrt(r*r+a*a),o=n/i;return{x:t.x-o*r,y:t.y-o*a}},"findAdjacentPoint"),gAt=W(function(e){const{cornerPointPositions:t}=bwe(e),n=[];for(let r=0;r<e.length;r++)if(t.includes(r)){const a=e[r-1],i=e[r+1],o=e[r],s=wne(a,o,5),l=wne(i,o,5),c=l.x-s.x,u=l.y-s.y;n.push(s);const d=Math.sqrt(2)*2;let f={x:o.x,y:o.y};if(Math.abs(i.x-a.x)>10&&Math.abs(i.y-a.y)>=10){et.debug("Corner point fixing",Math.abs(i.x-a.x),Math.abs(i.y-a.y));const h=5;o.x===s.x?f={x:c<0?s.x-h+d:s.x+h-d,y:u<0?s.y-d:s.y+d}:f={x:c<0?s.x-d:s.x+d,y:u<0?s.y-h+d:s.y+h-d}}else et.debug("Corner point skipping fixing",Math.abs(i.x-a.x),Math.abs(i.y-a.y));n.push(f,l)}else n.push(e[r]);return n},"fixCorners"),mAt=W((e,t,n)=>{const r=e-t-n,a=2,i=2,o=a+i,s=Math.floor(r/o),l=Array(s).fill(`${a} ${i}`).join(" ");return`0 ${t} ${l} ${n}`},"generateDashArray"),vAt=W(function(e,t,n,r,a,i,o,s=!1){var R;const{handDrawnSeed:l}=pr();let c=t.points,u=!1;const d=a;var f=i;const h=[];for(const A in t.cssCompiledStyles)Y0e(A)||h.push(t.cssCompiledStyles[A]);et.debug("UIO intersect check",t.points,f.x,d.x),f.intersect&&d.intersect&&!s&&(c=c.slice(1,t.points.length-1),c.unshift(d.intersect(c[0])),et.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],f,f.intersect(c[c.length-1])),c.push(f.intersect(c[c.length-1])));const g=btoa(JSON.stringify(c));t.toCluster&&(et.info("to cluster abc88",n.get(t.toCluster)),c=xne(t.points,n.get(t.toCluster).node),u=!0),t.fromCluster&&(et.debug("from cluster abc88",n.get(t.fromCluster),JSON.stringify(c,null,2)),c=xne(c.reverse(),n.get(t.fromCluster).node).reverse(),u=!0);let m=c.filter(A=>!Number.isNaN(A.y));m=gAt(m);let v=nb;switch(v=Nd,t.curve){case"linear":v=Nd;break;case"basis":v=nb;break;case"cardinal":v=lge;break;case"bumpX":v=p5;break;case"bumpY":v=h5;break;case"catmullRom":v=uge;break;case"monotoneX":v=S5;break;case"monotoneY":v=x5;break;case"natural":v=w5;break;case"step":v=C5;break;case"stepAfter":v=_5;break;case"stepBefore":v=E5;break;default:v=nb}const{x:b,y}=gTt(t),S=f5().x(b).y(y).curve(v);let C;switch(t.thickness){case"normal":C="edge-thickness-normal";break;case"thick":C="edge-thickness-thick";break;case"invisible":C="edge-thickness-invisible";break;default:C="edge-thickness-normal"}switch(t.pattern){case"solid":C+=" edge-pattern-solid";break;case"dotted":C+=" edge-pattern-dotted";break;case"dashed":C+=" edge-pattern-dashed";break;default:C+=" edge-pattern-solid"}let x,w=t.curve==="rounded"?ywe(Swe(m,t),5):S(m);const _=Array.isArray(t.style)?t.style:[t.style];let T=_.find(A=>A==null?void 0:A.startsWith("stroke:")),k=!1;if(t.look==="handDrawn"){const A=Ut.svg(e);Object.assign([],m);const P=A.path(w,{roughness:.3,seed:l});C+=" transition",x=er(P).select("path").attr("id",t.id).attr("class"," "+C+(t.classes?" "+t.classes:"")).attr("style",_?_.reduce((L,j)=>L+";"+j,""):"");let N=x.attr("d");x.attr("d",N),e.node().appendChild(x.node())}else{const A=h.join(";"),P=_?_.reduce((B,z)=>B+z+";",""):"";let N="";t.animate&&(N=" edge-animation-fast"),t.animation&&(N=" edge-animation-"+t.animation);const L=(A?A+";"+P+";":P)+";"+(_?_.reduce((B,z)=>B+";"+z,""):"");x=e.append("path").attr("d",w).attr("id",t.id).attr("class"," "+C+(t.classes?" "+t.classes:"")+(N??"")).attr("style",L),T=(R=L.match(/stroke:([^;]+)/))==null?void 0:R[1],k=t.animate===!0||!!t.animation||A.includes("animation");const j=x.node(),D=typeof j.getTotalLength=="function"?j.getTotalLength():0,H=jte[t.arrowTypeStart]||0,F=jte[t.arrowTypeEnd]||0;if(t.look==="neo"&&!k){const z=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?mAt(D,H,F):`0 ${H} ${D-H-F} ${F}`}; stroke-dashoffset: 0;`;x.attr("style",z+x.attr("style"))}}x.attr("data-edge",!0),x.attr("data-et","edge"),x.attr("data-id",t.id),x.attr("data-points",g),t.showPoints&&m.forEach(A=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",A.x).attr("cy",A.y)});let O="";(pr().flowchart.arrowMarkerAbsolute||pr().state.arrowMarkerAbsolute)&&(O=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,O=O.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),et.info("arrowTypeStart",t.arrowTypeStart),et.info("arrowTypeEnd",t.arrowTypeEnd),cAt(x,t,O,o,r,T);const I=Math.floor(c.length/2),M=c[I];bs.isLabelCoordinateInPath(M,x.attr("d"))||(u=!0);let $={};return u&&($.updatedPath=c),$.originalPath=t.points,$},"insertEdge");function ywe(e,t){if(e.length<2)return"";let n="";const r=e.length,a=1e-5;for(let i=0;i<r;i++){const o=e[i],s=e[i-1],l=e[i+1];if(i===0)n+=`M${o.x},${o.y}`;else if(i===r-1)n+=`L${o.x},${o.y}`;else{const c=o.x-s.x,u=o.y-s.y,d=l.x-o.x,f=l.y-o.y,h=Math.hypot(c,u),g=Math.hypot(d,f);if(h<a||g<a){n+=`L${o.x},${o.y}`;continue}const m=c/h,v=u/h,b=d/g,y=f/g,S=m*b+v*y,C=Math.max(-1,Math.min(1,S)),x=Math.acos(C);if(x<a||Math.abs(Math.PI-x)<a){n+=`L${o.x},${o.y}`;continue}const w=Math.min(t/Math.sin(x/2),h/2,g/2),_=o.x-m*w,T=o.y-v*w,k=o.x+b*w,O=o.y+y*w;n+=`L${_},${T}`,n+=`Q${o.x},${o.y} ${k},${O}`}}return n}W(ywe,"generateRoundedPath");function ej(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const n=t.x-e.x,r=t.y-e.y;return{angle:Math.atan2(r,n),deltaX:n,deltaY:r}}W(ej,"calculateDeltaAndAngle");function Swe(e,t){const n=e.map(a=>({...a}));if(e.length>=2&&li[t.arrowTypeStart]){const a=li[t.arrowTypeStart],i=e[0],o=e[1],{angle:s}=ej(i,o),l=a*Math.cos(s),c=a*Math.sin(s);n[0].x=i.x+l,n[0].y=i.y+c}const r=e.length;if(r>=2&&li[t.arrowTypeEnd]){const a=li[t.arrowTypeEnd],i=e[r-1],o=e[r-2],{angle:s}=ej(o,i),l=a*Math.cos(s),c=a*Math.sin(s);n[r-1].x=i.x-l,n[r-1].y=i.y-c}return n}W(Swe,"applyMarkerOffsetsToPoints");var bAt=W((e,t,n,r)=>{t.forEach(a=>{PAt[a](e,n,r)})},"insertMarkers"),yAt=W((e,t,n)=>{et.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),SAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),xAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),wAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),CAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),EAt=W((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),_At=W((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),TAt=W((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),kAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),OAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),$At=W((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),r.append("path").attr("d","M9,0 L9,18");const a=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),a.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),IAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),AAt=W((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),r.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const a=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),a.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),RAt=W((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
948
948
|
L20,10
|
|
949
949
|
M20,10
|
|
950
|
-
L0,20`)},"requirement_arrow"),MAt=W((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),PAt={extension:yAt,composition:SAt,aggregation:xAt,dependency:wAt,lollipop:CAt,point:EAt,circle:_At,cross:TAt,barb:kAt,only_one:OAt,zero_or_one:$At,one_or_more:IAt,zero_or_more:AAt,requirement_arrow:RAt,requirement_contains:MAt},NAt=bAt,LAt={common:wg,getConfig:mi,insertCluster:WIt,insertEdge:vAt,insertEdgeLabel:dAt,insertMarkers:NAt,insertNode:vwe,interpolateToCurve:HH,labelHelper:un,log:et,positionEdgeLabel:fAt},Ny={},xwe=W(e=>{for(const t of e)Ny[t.name]=t},"registerLayoutLoaders"),DAt=W(()=>{xwe([{name:"dagre",loader:W(async()=>await Mn(()=>import("./dagre-6UL2VRFP-
|
|
951
|
-
`);const r=s_t(t),a=r.append("g");r.attr("viewBox","0 0 2412 512"),Vbe(r,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),Bwe={draw:u2t},d2t=Bwe,f2t={db:{},renderer:Bwe,parser:{parse:W(()=>{},"parse")}},p2t=f2t,Fwe="flowchart-elk",h2t=W((e,t={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),g2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-
|
|
950
|
+
L0,20`)},"requirement_arrow"),MAt=W((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),PAt={extension:yAt,composition:SAt,aggregation:xAt,dependency:wAt,lollipop:CAt,point:EAt,circle:_At,cross:TAt,barb:kAt,only_one:OAt,zero_or_one:$At,one_or_more:IAt,zero_or_more:AAt,requirement_arrow:RAt,requirement_contains:MAt},NAt=bAt,LAt={common:wg,getConfig:mi,insertCluster:WIt,insertEdge:vAt,insertEdgeLabel:dAt,insertMarkers:NAt,insertNode:vwe,interpolateToCurve:HH,labelHelper:un,log:et,positionEdgeLabel:fAt},Ny={},xwe=W(e=>{for(const t of e)Ny[t.name]=t},"registerLayoutLoaders"),DAt=W(()=>{xwe([{name:"dagre",loader:W(async()=>await Mn(()=>import("./dagre-6UL2VRFP-C5EnKtVv.js"),__vite__mapDeps([3,4,5,6,7,8,1,2]),import.meta.url),"loader")},{name:"cose-bilkent",loader:W(async()=>await Mn(()=>import("./cose-bilkent-S5V4N54A-lKdHVs2U.js"),__vite__mapDeps([9,10,1,2]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");DAt();var v4t=W(async(e,t)=>{if(!(e.layoutAlgorithm in Ny))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=Ny[e.layoutAlgorithm];return(await n.loader()).render(e,t,LAt,{algorithm:n.algorithm})},"render"),b4t=W((e="",{fallback:t="dagre"}={})=>{if(e in Ny)return e;if(t in Ny)return et.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),jAt=J0e(Object.keys,Object),BAt=Object.prototype,FAt=BAt.hasOwnProperty;function zAt(e){if(!oT(e))return jAt(e);var t=[];for(var n in Object(e))FAt.call(e,n)&&n!="constructor"&&t.push(n);return t}var tj=wf(xl,"DataView"),nj=wf(xl,"Promise"),rj=wf(xl,"Set"),aj=wf(xl,"WeakMap"),Cne="[object Map]",HAt="[object Object]",Ene="[object Promise]",_ne="[object Set]",Tne="[object WeakMap]",kne="[object DataView]",UAt=xf(tj),WAt=xf(My),qAt=xf(nj),VAt=xf(rj),GAt=xf(aj),Fu=Eg;(tj&&Fu(new tj(new ArrayBuffer(1)))!=kne||My&&Fu(new My)!=Cne||nj&&Fu(nj.resolve())!=Ene||rj&&Fu(new rj)!=_ne||aj&&Fu(new aj)!=Tne)&&(Fu=function(e){var t=Eg(e),n=t==HAt?e.constructor:void 0,r=n?xf(n):"";if(r)switch(r){case UAt:return kne;case WAt:return Cne;case qAt:return Ene;case VAt:return _ne;case GAt:return Tne}return t});var KAt="[object Map]",YAt="[object Set]",XAt=Object.prototype,ZAt=XAt.hasOwnProperty;function One(e){if(e==null)return!0;if(sT(e)&&(h1(e)||typeof e=="string"||typeof e.splice=="function"||FH(e)||zH(e)||p1(e)))return!e.length;var t=Fu(e);if(t==KAt||t==YAt)return!e.size;if(oT(e))return!zAt(e).length;for(var n in e)if(ZAt.call(e,n))return!1;return!0}var wwe="c4",QAt=W(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),JAt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-BX7Tbmjk.js");return{diagram:t}},__vite__mapDeps([11,12,1,2]),import.meta.url);return{id:wwe,diagram:e}},"loader"),eRt={id:wwe,detector:QAt,loader:JAt},tRt=eRt,Cwe="flowchart",nRt=W((e,t)=>{var n,r;return((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),rRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-C8pbqvnc.js");return{diagram:t}},__vite__mapDeps([13,14,15,16,17,1,2]),import.meta.url);return{id:Cwe,diagram:e}},"loader"),aRt={id:Cwe,detector:nRt,loader:rRt},iRt=aRt,Ewe="flowchart-v2",oRt=W((e,t)=>{var n,r,a;return((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((a=t==null?void 0:t.flowchart)==null?void 0:a.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),sRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-C8pbqvnc.js");return{diagram:t}},__vite__mapDeps([13,14,15,16,17,1,2]),import.meta.url);return{id:Ewe,diagram:e}},"loader"),lRt={id:Ewe,detector:oRt,loader:sRt},cRt=lRt,_we="er",uRt=W(e=>/^\s*erDiagram/.test(e),"detector"),dRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-DLlcVzLB.js");return{diagram:t}},__vite__mapDeps([18,15,16,17,1,2]),import.meta.url);return{id:_we,diagram:e}},"loader"),fRt={id:_we,detector:uRt,loader:dRt},pRt=fRt,Twe="gitGraph",hRt=W(e=>/^\s*gitGraph/.test(e),"detector"),gRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./gitGraphDiagram-V2S2FVAM-DSZXQx4a.js");return{diagram:t}},__vite__mapDeps([19,20,21,22,1,2,5,7,8]),import.meta.url);return{id:Twe,diagram:e}},"loader"),mRt={id:Twe,detector:hRt,loader:gRt},vRt=mRt,kwe="gantt",bRt=W(e=>/^\s*gantt/.test(e),"detector"),yRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-BMn9n4pe.js");return{diagram:t}},__vite__mapDeps([23,1,2]),import.meta.url);return{id:kwe,diagram:e}},"loader"),SRt={id:kwe,detector:bRt,loader:yRt},xRt=SRt,Owe="info",wRt=W(e=>/^\s*info/.test(e),"detector"),CRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./infoDiagram-HS3SLOUP-Bk1va7Yc.js");return{diagram:t}},__vite__mapDeps([24,22,1,2,5,7,8]),import.meta.url);return{id:Owe,diagram:e}},"loader"),ERt={id:Owe,detector:wRt,loader:CRt},$we="pie",_Rt=W(e=>/^\s*pie/.test(e),"detector"),TRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-d92vh0NT.js");return{diagram:t}},__vite__mapDeps([25,20,22,1,2,5,7,8,26]),import.meta.url);return{id:$we,diagram:e}},"loader"),kRt={id:$we,detector:_Rt,loader:TRt},Iwe="quadrantChart",ORt=W(e=>/^\s*quadrantChart/.test(e),"detector"),$Rt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-D7XvGMsu.js");return{diagram:t}},__vite__mapDeps([27,1,2]),import.meta.url);return{id:Iwe,diagram:e}},"loader"),IRt={id:Iwe,detector:ORt,loader:$Rt},ARt=IRt,Awe="xychart",RRt=W(e=>/^\s*xychart(-beta)?/.test(e),"detector"),MRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-DdCk42LP.js");return{diagram:t}},__vite__mapDeps([28,1,2]),import.meta.url);return{id:Awe,diagram:e}},"loader"),PRt={id:Awe,detector:RRt,loader:MRt},NRt=PRt,Rwe="requirement",LRt=W(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),DRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-fU6nP0KD.js");return{diagram:t}},__vite__mapDeps([29,15,16,1,2]),import.meta.url);return{id:Rwe,diagram:e}},"loader"),jRt={id:Rwe,detector:LRt,loader:DRt},BRt=jRt,Mwe="sequence",FRt=W(e=>/^\s*sequenceDiagram/.test(e),"detector"),zRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-qnI_BC0O.js");return{diagram:t}},__vite__mapDeps([30,12,21,1,2]),import.meta.url);return{id:Mwe,diagram:e}},"loader"),HRt={id:Mwe,detector:FRt,loader:zRt},URt=HRt,Pwe="class",WRt=W((e,t)=>{var n;return((n=t==null?void 0:t.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),qRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-BAbGsHKp.js");return{diagram:t}},__vite__mapDeps([31,32,14,15,16,1,2]),import.meta.url);return{id:Pwe,diagram:e}},"loader"),VRt={id:Pwe,detector:WRt,loader:qRt},GRt=VRt,Nwe="classDiagram",KRt=W((e,t)=>{var n;return/^\s*classDiagram/.test(e)&&((n=t==null?void 0:t.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),YRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-BAbGsHKp.js");return{diagram:t}},__vite__mapDeps([33,32,14,15,16,1,2]),import.meta.url);return{id:Nwe,diagram:e}},"loader"),XRt={id:Nwe,detector:KRt,loader:YRt},ZRt=XRt,Lwe="state",QRt=W((e,t)=>{var n;return((n=t==null?void 0:t.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),JRt=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-C-VvT7hf.js");return{diagram:t}},__vite__mapDeps([34,35,15,16,4,5,6,7,1,2]),import.meta.url);return{id:Lwe,diagram:e}},"loader"),e2t={id:Lwe,detector:QRt,loader:JRt},t2t=e2t,Dwe="stateDiagram",n2t=W((e,t)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=t==null?void 0:t.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),r2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-C5I1eYNJ.js");return{diagram:t}},__vite__mapDeps([36,35,15,16,1,2]),import.meta.url);return{id:Dwe,diagram:e}},"loader"),a2t={id:Dwe,detector:n2t,loader:r2t},i2t=a2t,jwe="journey",o2t=W(e=>/^\s*journey/.test(e),"detector"),s2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-BL0e_AP8.js");return{diagram:t}},__vite__mapDeps([37,12,14,26,1,2]),import.meta.url);return{id:jwe,diagram:e}},"loader"),l2t={id:jwe,detector:o2t,loader:s2t},c2t=l2t,u2t=W((e,t,n)=>{et.debug(`rendering svg for syntax error
|
|
951
|
+
`);const r=s_t(t),a=r.append("g");r.attr("viewBox","0 0 2412 512"),Vbe(r,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),Bwe={draw:u2t},d2t=Bwe,f2t={db:{},renderer:Bwe,parser:{parse:W(()=>{},"parse")}},p2t=f2t,Fwe="flowchart-elk",h2t=W((e,t={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),g2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-C8pbqvnc.js");return{diagram:t}},__vite__mapDeps([13,14,15,16,17,1,2]),import.meta.url);return{id:Fwe,diagram:e}},"loader"),m2t={id:Fwe,detector:h2t,loader:g2t},v2t=m2t,zwe="timeline",b2t=W(e=>/^\s*timeline/.test(e),"detector"),y2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-CQ1Ts1zj.js");return{diagram:t}},__vite__mapDeps([38,26,1,2]),import.meta.url);return{id:zwe,diagram:e}},"loader"),S2t={id:zwe,detector:b2t,loader:y2t},x2t=S2t,Hwe="mindmap",w2t=W(e=>/^\s*mindmap/.test(e),"detector"),C2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-B2WskgZi.js");return{diagram:t}},__vite__mapDeps([39,15,16,1,2]),import.meta.url);return{id:Hwe,diagram:e}},"loader"),E2t={id:Hwe,detector:w2t,loader:C2t},_2t=E2t,Uwe="kanban",T2t=W(e=>/^\s*kanban/.test(e),"detector"),k2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DOrLV23M.js");return{diagram:t}},__vite__mapDeps([40,14,1,2]),import.meta.url);return{id:Uwe,diagram:e}},"loader"),O2t={id:Uwe,detector:T2t,loader:k2t},$2t=O2t,Wwe="sankey",I2t=W(e=>/^\s*sankey(-beta)?/.test(e),"detector"),A2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-C3swjjfS.js");return{diagram:t}},__vite__mapDeps([41,1,2]),import.meta.url);return{id:Wwe,diagram:e}},"loader"),R2t={id:Wwe,detector:I2t,loader:A2t},M2t=R2t,qwe="packet",P2t=W(e=>/^\s*packet(-beta)?/.test(e),"detector"),N2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-STkseHgn.js");return{diagram:t}},__vite__mapDeps([42,20,22,1,2,5,7,8]),import.meta.url);return{id:qwe,diagram:e}},"loader"),L2t={id:qwe,detector:P2t,loader:N2t},Vwe="radar",D2t=W(e=>/^\s*radar-beta/.test(e),"detector"),j2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-BdYKr9ab.js");return{diagram:t}},__vite__mapDeps([43,20,22,1,2,5,7,8]),import.meta.url);return{id:Vwe,diagram:e}},"loader"),B2t={id:Vwe,detector:D2t,loader:j2t},Gwe="block",F2t=W(e=>/^\s*block(-beta)?/.test(e),"detector"),z2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-BJiLHRN0.js");return{diagram:t}},__vite__mapDeps([44,14,8,5,4,17,1,2]),import.meta.url);return{id:Gwe,diagram:e}},"loader"),H2t={id:Gwe,detector:F2t,loader:z2t},U2t=H2t,Kwe="architecture",W2t=W(e=>/^\s*architecture/.test(e),"detector"),q2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-COcOCBA0.js");return{diagram:t}},__vite__mapDeps([45,20,22,1,2,5,7,8,10]),import.meta.url);return{id:Kwe,diagram:e}},"loader"),V2t={id:Kwe,detector:W2t,loader:q2t},G2t=V2t,Ywe="treemap",K2t=W(e=>/^\s*treemap/.test(e),"detector"),Y2t=W(async()=>{const{diagram:e}=await Mn(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-CwegSRqD.js");return{diagram:t}},__vite__mapDeps([46,16,20,22,1,2,5,7,8]),import.meta.url);return{id:Ywe,diagram:e}},"loader"),X2t={id:Ywe,detector:K2t,loader:Y2t},$ne=!1,mT=W(()=>{$ne||($ne=!0,e1("error",p2t,e=>e.toLowerCase().trim()==="error"),e1("---",{db:{clear:W(()=>{},"clear")},styles:{},renderer:{draw:W(()=>{},"draw")},parser:{parse:W(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:W(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),bD(v2t,_2t,G2t),bD(tRt,$2t,ZRt,GRt,pRt,xRt,ERt,kRt,BRt,URt,cRt,iRt,x2t,vRt,i2t,t2t,c2t,ARt,M2t,L2t,NRt,U2t,B2t,X2t))},"addDiagrams"),Z2t=W(async()=>{et.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Hd).map(async([n,{detector:r,loader:a}])=>{if(a)try{wD(n)}catch{try{const{diagram:i,id:o}=await a();e1(o,i,r)}catch(i){throw et.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete Hd[n],i}}}))).filter(n=>n.status==="rejected");if(t.length>0){et.error(`Failed to load ${t.length} external diagrams`);for(const n of t)et.error(n);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Q2t="graphics-document document";function Xwe(e,t){e.attr("role",Q2t),t!==""&&e.attr("aria-roledescription",t)}W(Xwe,"setA11yDiagramInfo");function Zwe(e,t,n,r){if(e.insert!==void 0){if(n){const a=`chart-desc-${r}`;e.attr("aria-describedby",a),e.insert("desc",":first-child").attr("id",a).text(n)}if(t){const a=`chart-title-${r}`;e.attr("aria-labelledby",a),e.insert("title",":first-child").attr("id",a).text(t)}}}W(Zwe,"addSVGa11yTitleDescription");var yd,ij=(yd=class{constructor(t,n,r,a,i){this.type=t,this.text=n,this.db=r,this.parser=a,this.renderer=i}static async fromText(t,n={}){var c,u;const r=mi(),a=bH(t,r);t=p$t(t)+`
|
|
952
952
|
`;try{wD(a)}catch{const d=Swt(a);if(!d)throw new Pbe(`Diagram ${a} not found.`);const{id:f,diagram:h}=await d();e1(f,h)}const{db:i,parser:o,renderer:s,init:l}=wD(a);return o.parser&&(o.parser.yy=i),(c=i.clear)==null||c.call(i),l==null||l(r),n.title&&((u=i.setDiagramTitle)==null||u.call(i,n.title)),await o.parse(t),new yd(a,t,i,o,s)}async render(t,n){await this.renderer.draw(this.text,t,n,this)}getParser(){return this.parser}getType(){return this.type}},W(yd,"Diagram"),yd),Ine=[],J2t=W(()=>{Ine.forEach(e=>{e()}),Ine=[]},"attachFunctions"),eMt=W(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Qwe(e){const t=e.match(Mbe);if(!t)return{text:e,metadata:{}};let n=hTt(t[1],{schema:pTt})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}W(Qwe,"extractFrontMatter");var tMt=W(e=>e.replace(/\r\n?/g,`
|
|
953
953
|
`).replace(/<(\w+)([^>]*)>/g,(t,n,r)=>"<"+n+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),nMt=W(e=>{const{text:t,metadata:n}=Qwe(e),{displayMode:r,title:a,config:i={}}=n;return r&&(i.gantt||(i.gantt={}),i.gantt.displayMode=r),{title:a,config:i,text:t}},"processFrontmatter"),rMt=W(e=>{const t=bs.detectInit(e)??{},n=bs.detectDirective(e,"wrap");return Array.isArray(n)?t.wrap=n.some(({type:r})=>r==="wrap"):(n==null?void 0:n.type)==="wrap"&&(t.wrap=!0),{text:e$t(e),directive:t}},"processDirectives");function lU(e){const t=tMt(e),n=nMt(t),r=rMt(n.text),a=GH(n.config,r.directive);return e=eMt(r.text),{code:e,title:n.title,config:a}}W(lU,"preprocessDiagram");function Jwe(e){const t=new TextEncoder().encode(e),n=Array.from(t,r=>String.fromCodePoint(r)).join("");return btoa(n)}W(Jwe,"toBase64");var aMt=5e4,iMt="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",oMt="sandbox",sMt="loose",lMt="http://www.w3.org/2000/svg",cMt="http://www.w3.org/1999/xlink",uMt="http://www.w3.org/1999/xhtml",dMt="100%",fMt="100%",pMt="border:0;margin:0;",hMt="margin:0",gMt="allow-top-navigation-by-user-activation allow-popups",mMt='The "iframe" tag is not supported by your browser.',vMt=["foreignobject"],bMt=["dominant-baseline"];function cU(e){const t=lU(e);return QC(),Lwt(t.config??{}),t}W(cU,"processAndSetConfigs");async function eCe(e,t){mT();try{const{code:n,config:r}=cU(e);return{diagramType:(await nCe(n)).type,config:r}}catch(n){if(t!=null&&t.suppressErrors)return!1;throw n}}W(eCe,"parse");var Ane=W((e,t,n=[])=>`
|
|
954
954
|
.${e} ${t} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),yMt=W((e,t=new Map)=>{var r;let n="";if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -980,7 +980,7 @@ ${r}
|
|
|
980
980
|
|
|
981
981
|
`)}}if(!S&&!b&&(!m||m.length===0))return;const x=[y,S,b].filter(Boolean).join(`
|
|
982
982
|
|
|
983
|
-
`);if(s(x),c(""),l(),a.size>0){const w=Array.from(x.matchAll(/@([^\\s]+)/g));if(w.length>0){const _=[];for(const T of w){const k=T[1],O=a.get(k);O&&_.push(O)}if(_.length>0){const T=JSON.stringify({type:"file_reference",paths:_.map(k=>k.path),display_text:x});await o(T,m,i,C)}else await o(x,m,i,C)}else await o(x,m,i,C)}else await o(x,m,i,C);u(null),d([]),f(new Map)},[e,l,a,r,s,i,n,o,d,c,f,u,t])}),tNt=({currentSessionId:e,currentChat:t,currentMessages:n,reasoningEffort:r,retryLastTurn:a,navigate:i})=>{const o=p.useCallback(async(l="regenerate")=>{if(!e||!t)return;const c=[...n];c.length===0||[...c].reverse().findIndex(d=>d.role==="user")===-1||await a(r,l)},[t,e,n,r,a]),s=p.useCallback((l,c)=>{const u=i(l,c);return u.applied?u.value:null},[i]);return{retryLastMessage:o,handleHistoryNavigate:s}},nNt=({referenceText:e,isToolSpecificMode:t,isRestrictConversation:n,allowedTools:r,autoToolPrefix:a})=>e?"Send a message (includes reference)":"Send a message... (type '/' for workflows)",rNt=p.lazy(()=>Mn(()=>import("./index-BMn0p5au.js"),__vite__mapDeps([47,1,2]),import.meta.url)),aNt=p.lazy(()=>Mn(()=>import("./index-CtzvedZy.js"),__vite__mapDeps([48,1,2,49]),import.meta.url)),iNt=p.lazy(()=>Mn(()=>import("./index-w0H73Qu_.js"),__vite__mapDeps([50,1,2]),import.meta.url)),oNt=p.lazy(()=>Mn(()=>import("./index-CQXrMvBL.js"),__vite__mapDeps([51,1,2]),import.meta.url)),{useToken:sNt}=pn,Gne="chat-send-message",Kne="reference-text",lNt="chat-model-options-cache-v1",cNt=24*60*60*1e3,Yne=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"},{value:"max",label:"Max"}],fCe=e=>`${lNt}:${e}`,uNt=e=>{if(typeof window>"u")return null;try{const t=localStorage.getItem(fCe(e));if(!t)return null;const n=JSON.parse(t);return!n||!Array.isArray(n.options)||Date.now()-n.timestamp>cNt?null:n.options.filter(r=>r&&typeof r.value=="string"&&r.value.trim().length>0&&typeof r.label=="string").map(r=>({value:r.value,label:r.label}))}catch{return null}},dNt=(e,t)=>{if(!(typeof window>"u"))try{const n={timestamp:Date.now(),options:t};localStorage.setItem(fCe(e),JSON.stringify(n))}catch{}},fNt=({sessionId:e,onWorkflowDraftChange:t,statusIndicator:n})=>{const r=p.useRef(null),{token:a}=sNt(),i=Ub(Oe=>Oe.open),o=Ue(Oe=>e??Oe.currentSessionId),s=Ue(Oe=>Oe.currentSessionId),l=Ue(hF(o)),c=(l==null?void 0:l.messages)||[],u=Ue(Oe=>Oe.addMessage),d=Ue(Oe=>Oe.updateSession),f=Ue(Oe=>Oe.processingChats),h=Ue(Oe=>Oe.setSessionProcessing),g=Ue(Oe=>Oe.pendingQuestionRespond),m=Ue(Oe=>Oe.setPendingQuestionRespond),v=pg(),b=Ue(Oe=>o?Oe.inputStates[o]:void 0),y=Ue(Oe=>Oe.setInputContent),S=Ue(Oe=>Oe.setReferenceText),C=Ue(Oe=>Oe.setInputReasoningEffort),x=Ho(Oe=>Oe.currentProvider),w=Ho(Oe=>Oe.providerConfig),[_,T]=p.useState([]),[k,O]=p.useState(!1),[I,M]=p.useState(null),[$,R]=p.useState(!1),A=(b==null?void 0:b.content)||"",P=(b==null?void 0:b.referenceText)||null,N=p.useMemo(()=>{var Oe;return(Oe=w.providers[x])==null?void 0:Oe.reasoning_effort},[w,x]),L=p.useMemo(()=>o?pF(o):void 0,[o]),j=(b==null?void 0:b.reasoningEffort)??L??N??"medium",D=p.useCallback(Oe=>{o&&y(o,Oe)},[o,y]),H=p.useCallback(Oe=>{o&&S(o,Oe)},[o,S]),F=p.useCallback(Oe=>{o&&C(o,Oe)},[o,C]),B=o?f.has(o):!1,{sendMessage:z,retryLastTurn:G,cancel:X}=Lhe({sessionId:o,addMessage:u,setSessionProcessing:h,updateSession:d});p.useEffect(()=>{if(typeof window>"u")return;const Oe=Fe=>{var st,gt,vt;const nt=Fe;if(!nt.detail)return;const ht=typeof nt.detail.sessionId=="string"?nt.detail.sessionId:null;if(!(ht?o===ht:o!==null&&o===s))return;nt.detail.handled=!0;const Xe=(st=nt.detail)==null?void 0:st.content;if(typeof Xe!="string"||Xe.trim().length===0){(vt=(gt=nt.detail)==null?void 0:gt.reject)==null||vt.call(gt,new Error("External send message content is empty"));return}z(Xe,void 0,j).then(()=>{var Et,ot;(ot=(Et=nt.detail)==null?void 0:Et.resolve)==null||ot.call(Et)}).catch(Et=>{var ot,dt;(dt=(ot=nt.detail)==null?void 0:ot.reject)==null||dt.call(ot,Et)})};return window.addEventListener(Gne,Oe),()=>{window.removeEventListener(Gne,Oe)}},[s,o,z,j]),p.useEffect(()=>{if(typeof window>"u")return;const Oe=Fe=>{const nt=Fe;if(!nt.detail||typeof nt.detail.text!="string")return;const ht=typeof nt.detail.sessionId=="string"?nt.detail.sessionId:null;if(!(ht?o===ht:o!==null&&o===s))return;const Xe=nt.detail.text.trim();Xe&&(nt.detail.handled=!0,H(Xe),requestAnimationFrame(()=>{var st;(st=r.current)==null||st.focus()}))};return window.addEventListener(Kne,Oe),()=>{window.removeEventListener(Kne,Oe)}},[s,o,H]);const Z=B,{message:q}=Ns.useApp(),Y=!1,te=!1,ee=[],Q=void 0,{recordEntry:ae,navigate:oe,acknowledgeManualInput:re}=KPt(o),{attachments:ie,setAttachments:ue,handleAttachmentsAdded:ge,handleAttachmentRemove:Te,handleClearAttachments:Se}=JPt(),fe=YPt({setContent:D,onWorkflowDraftChange:t,acknowledgeManualInput:re,currentSessionId:o,textAreaRef:r,content:A}),he=QPt({content:A,setContent:D,currentSessionId:o,currentChat:l,updateSession:d,messageApi:q}),{setShowFileSelector:ve}=he;p.useEffect(()=>{fe.showCommandSelector&&ve(!1)},[fe.showCommandSelector,ve]);const{handleSubmit:we}=eNt({attachments:ie,referenceText:P,selectedWorkflow:fe.selectedCommand,matchesWorkflowToken:fe.matchesCommandToken,fileReferences:he.fileReferences,reasoningEffort:j,sendMessage:z,recordEntry:ae,clearWorkflowDraft:fe.clearCommandDraft,setContent:D,setReferenceText:H,setAttachments:ue,setFileReferences:he.setFileReferences}),Re=!!(g&&g.sessionId===o),ce=p.useCallback(async Oe=>{const Fe=Oe.trim();if(!(!Fe||!o))try{const nt=v==null?void 0:v.trim(),ht=await fn.post(`respond/${o}`,{response:Fe,model:nt||void 0,reasoning_effort:j});q.success("Response submitted, AI will continue processing"),D(""),m(null);const Ge=ht==null?void 0:ht.auto_resume_status;Ge&&["started","already_running"].includes(Ge)&&h(o,!0)}catch(nt){console.error("[InputContainer] Failed to submit respond:",nt),q.error(nt instanceof Error?nt.message:"Submission failed")}},[o,v,j,q,D,m,h]),xe=p.useCallback(async(Oe,Fe)=>{Re?await ce(Oe):await we(Oe,Fe)},[Re,ce,we]),{retryLastMessage:Me,handleHistoryNavigate:Ie}=tNt({currentSessionId:o,currentChat:l,currentMessages:c,reasoningEffort:j,retryLastTurn:G,navigate:oe}),de=()=>H(null),me=p.useMemo(()=>{var Oe;return(Oe=w.providers)==null?void 0:Oe[x]},[w,x]),pe=p.useMemo(()=>!me||typeof me!="object"?!1:x==="copilot"?Object.keys(me).length>0:typeof me.api_key=="string"&&me.api_key.trim().length>0,[x,me]),Ae=p.useCallback(()=>pe?!1:(i("chat"),q.warning("Please configure provider first"),!0),[pe,q,i]);p.useEffect(()=>{const Oe=uNt(x);T(Oe??[]),M(null)},[x]);const ye=p.useCallback(Oe=>Oe instanceof Error&&Oe.message.trim()?Oe.message:"Unknown error",[]),Ce=p.useMemo(()=>({openai:[...wbe],anthropic:[...Cbe],gemini:[...Ebe],copilot:[...Txt]})[x]||[],[x]),Ee=p.useMemo(()=>{const Fe=[..._.length>0?_:Ce];return v&&!Fe.some(nt=>nt.value===v)&&Fe.unshift({value:v,label:v}),Fe},[_,Ce,v]),_e=p.useCallback(async(Oe,Fe)=>{if(!(!(Fe!=null&&Fe.force)&&_.length>0))try{O(!0),M(null);const ht=(Oe==="copilot"?await BE.getModels():await lo.fetchProviderModels(Oe)).map(Ge=>({value:Ge,label:Ge}));T(ht),dNt(Oe,ht)}catch(nt){M(ye(nt))}finally{O(!1)}},[ye,_.length]),je=p.useCallback(Oe=>{Oe&&(Ae()||k||_.length>0||_e(x))},[x,_e,k,_.length,Ae]),Ne=p.useCallback(async Oe=>{if(!(!Oe||Oe===v)&&!$)try{if(Ae())return;R(!0);const Fe=Ho.getState(),nt={...Fe.providerConfig.providers||{}};nt[x]={...nt[x]||{},model:Oe},await lo.saveProviderConfig({provider:x,providers:nt}),await Fe.loadProviderConfig(),q.success("Model updated")}catch(Fe){q.error(`Failed to update model: ${ye(Fe)}`)}finally{R(!1)}},[v,x,ye,$,q,Ae]),tt=p.useMemo(()=>nNt({referenceText:P,isToolSpecificMode:Y,isRestrictConversation:te,allowedTools:ee,autoToolPrefix:Q}),[P,Y,te,ee,Q]),ct=Re?"Type your custom answer here, press Enter to submit...":tt,Ke=p.useMemo(()=>{var Oe;return((Oe=Yne.find(Fe=>Fe.value===j))==null?void 0:Oe.label)??j},[j]),Ze=E.jsx(Qc,{trigger:["click"],placement:"topLeft",disabled:!v||Z,menu:{selectable:!0,selectedKeys:[j],items:Yne.map(Oe=>({key:Oe.value,label:Oe.label})),onClick:({key:Oe})=>{F(Oe)}},children:E.jsx(De,{type:"text",size:"small",disabled:!v||Z,style:{minWidth:88,padding:"0 12px",height:36,borderRadius:18,color:j==="medium"?a.colorTextSecondary:a.colorPrimary},title:`Reasoning: ${Ke}`,children:E.jsxs(He,{size:6,children:[E.jsx(B7e,{}),E.jsx("span",{children:Ke}),E.jsx(As,{style:{fontSize:10}})]})})}),ut=v||(pe?"Select Model":"Configure Provider"),Je=p.useMemo(()=>Ee.length>0?Ee.map(Oe=>({key:Oe.value,label:Oe.label})):[{key:"__no_models__",label:I||"No models available",disabled:!0}],[Ee,I]),qe=E.jsx(De,{type:"text",size:"small",disabled:Z||$,onClick:()=>{pe||Ae()},style:{minWidth:146,padding:"0 12px",height:36,borderRadius:18,color:I?a.colorError:a.colorTextSecondary},title:ut,children:E.jsxs(He,{size:6,children:[k?E.jsx(DE,{}):E.jsx(aF,{}),E.jsx("span",{style:{maxWidth:128,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ut}),E.jsx(As,{style:{fontSize:10}})]})}),Qe=pe?E.jsx(Qc,{trigger:["click"],placement:"topLeft",menu:{selectable:!0,selectedKeys:v?[v]:[],items:Je,style:{maxHeight:"50vh",overflowY:"auto"},onClick:({key:Oe})=>{Oe!=="__no_models__"&&Ne(String(Oe))}},onOpenChange:je,disabled:Z||$,children:qe}):qe;return E.jsxs("div",{style:{padding:`${a.paddingXXS}px ${a.paddingXS}px`,background:"transparent",borderTop:"none",boxShadow:"none",width:"100%",position:"relative",overflow:"visible"},children:[!v&&E.jsx(fr,{type:"warning",showIcon:!0,icon:E.jsx(iF,{}),message:pe?"No model selected":"Provider not configured",description:pe?"Select a model from the dropdown in the input toolbar.":"Open settings and configure a provider before selecting a model.",action:pe?void 0:E.jsx(He,{children:E.jsx("a",{onClick:()=>i("chat"),children:"Open Settings"})}),style:{marginBottom:a.marginSM}}),Y,P&&E.jsx(GPt,{text:P,onClose:de}),ie.length>0&&E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(rNt,{files:ie,onRemove:Te,onClear:Se})}),E.jsx(qPt,{value:A,onChange:fe.handleInputChange,onSubmit:xe,placeholder:ct,allowImages:!0,disabled:!v,statusIndicator:n??null,isWorkflowSelectorVisible:fe.showCommandSelector,textAreaRef:r,validateMessage:Oe=>({isValid:!0}),onAttachmentsAdded:ge,onWorkflowCommandChange:fe.handleCommandChange,onFileReferenceChange:he.handleFileReferenceChange,onFileReferenceButtonClick:he.handleFileReferenceButtonClick,leftControlsExtra:E.jsxs(He,{size:0,wrap:!0,children:[Qe,Ze]}),interaction:{isStreaming:Z,hasMessages:c.some(Oe=>Oe.role==="user"),allowRetry:!0,onRetry:Me,onCancel:X,onHistoryNavigate:Ie}}),E.jsx(p.Suspense,{fallback:null,children:E.jsx(aNt,{visible:fe.showCommandSelector,onSelect:fe.handleCommandSelect,onCancel:fe.handleCommandSelectorCancel,onAutoComplete:fe.handleAutoComplete,searchText:fe.commandSearchText})}),he.showFileSelector&&E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(oNt,{visible:he.showFileSelector,files:he.workspaceFiles,searchText:he.fileSearchText,loading:he.isWorkspaceLoading,error:he.workspaceError,onSelect:he.handleFileReferenceSelect,onCancel:he.handleFileSelectorCancel,onChangeWorkspace:()=>{he.setWorkspacePathInput((l==null?void 0:l.config.workspacePath)??""),he.setIsWorkspaceModalVisible(!0)}})}),E.jsx(p.Suspense,{fallback:null,children:E.jsx(iNt,{open:he.isWorkspaceModalVisible,initialPath:he.workspacePathInput,loading:he.isSavingWorkspace,onSubmit:he.handleWorkspaceModalSubmit,onCancel:he.handleWorkspaceModalCancel})})]})},{Text:$l}=Qt,pNt=220,hNt="chat-session-diff-collapse:",gNt=e=>e.split(/[\\/]/).pop()||e,pCe=e=>`${hNt}${e??"default"}`,JR=e=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(pCe(e));if(!t)return null;const n=JSON.parse(t);if(!n||typeof n!="object")return null;const r="isExpanded"in n&&typeof n.isExpanded=="boolean"?n.isExpanded:!0,a="expandedFiles"in n&&Array.isArray(n.expandedFiles)?n.expandedFiles.filter(i=>typeof i=="string"):[];return{isExpanded:r,expandedFiles:a}}catch{return null}},mNt=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pCe(e),JSON.stringify(t))}catch{}},vNt=({sessionDiffSummary:e,sessionId:t})=>{const{token:n}=pn.useToken(),r=!!(e&&e.files.length>0),[a,i]=p.useState(r),[o,s]=p.useState(r),[l,c]=p.useState(()=>{var g;return((g=JR(t))==null?void 0:g.isExpanded)??!0}),[u,d]=p.useState(()=>{var g;return new Set(((g=JR(t))==null?void 0:g.expandedFiles)??[])});p.useEffect(()=>{if(r){i(!0);const m=window.setTimeout(()=>s(!0),0);return()=>window.clearTimeout(m)}s(!1);const g=window.setTimeout(()=>i(!1),pNt);return()=>window.clearTimeout(g)},[r]);const f=p.useMemo(()=>e?e.files:[],[e]),h=p.useMemo(()=>{const g=new Map;return e&&e.files.forEach(m=>{g.set(m.filePath,jhe(m.unifiedDiff))}),g},[e]);return p.useEffect(()=>{const g=JR(t);c((g==null?void 0:g.isExpanded)??!0),d(new Set((g==null?void 0:g.expandedFiles)??[]))},[t]),p.useEffect(()=>{mNt(t,{isExpanded:l,expandedFiles:Array.from(u)})},[t,l,u]),p.useEffect(()=>{if(!e||e.files.length===0)return;const g=new Set(e.files.map(m=>m.filePath));d(m=>{const v=new Set;let b=!1;return m.forEach(y=>{g.has(y)?v.add(y):b=!0}),!b&&v.size===m.size?m:v})},[e]),!a||!e?null:E.jsx("div",{className:`active-tool-card-wrapper ${o?"visible":""}`,"aria-hidden":!o,"data-testid":"session-diff-card",children:E.jsx(Ot,{size:"small",style:{width:"100%",borderRadius:n.borderRadiusLG,border:`1px solid ${n.colorBorderSecondary}`,background:n.colorBgContainer,boxShadow:n.boxShadowSecondary},bodyStyle:{padding:`${n.paddingXS}px ${n.paddingSM}px`},children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:6,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:n.marginSM,cursor:"pointer"},onClick:()=>c(g=>!g),"data-testid":"session-diff-toggle",children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginSM,minWidth:0},children:[E.jsx(A7e,{style:{color:n.colorPrimary}}),E.jsx($l,{strong:!0,style:{whiteSpace:"nowrap"},children:"Session diffs"}),E.jsxs($l,{type:"secondary",style:{fontSize:n.fontSizeSM,whiteSpace:"nowrap"},children:["(",e.files.length," files /"," ",e.changedTools," tools)"]}),E.jsxs(He,{size:4,style:{marginInlineStart:n.marginXS},children:[E.jsxs($l,{style:{color:n.colorSuccess,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",e.totalAdded]}),E.jsxs($l,{style:{color:n.colorError,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",e.totalRemoved]})]})]}),E.jsx("div",{style:{color:n.colorTextSecondary},children:l?E.jsx(As,{}):E.jsx(tu,{})})]}),l&&E.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr",gap:6,maxHeight:280,overflowY:"auto"},"data-testid":"session-diff-file-list",children:f.map(g=>{const m=u.has(g.filePath),v=h.get(g.filePath)??[];return E.jsxs("div",{style:{border:`1px solid ${n.colorBorderSecondary}`,borderRadius:n.borderRadiusSM,overflow:"hidden",background:n.colorBgContainer},"data-testid":"session-diff-file-item","data-file-path":g.filePath,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:n.marginSM,padding:"4px 8px",borderRadius:n.borderRadiusSM,background:n.colorFillTertiary,cursor:"pointer"},onClick:()=>{d(b=>{const y=new Set(b);return y.has(g.filePath)?y.delete(g.filePath):y.add(g.filePath),y})},"data-testid":"session-diff-file-header","data-file-path":g.filePath,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginXS,minWidth:0,flex:1},children:[E.jsx("span",{style:{color:n.colorTextSecondary},children:m?E.jsx(As,{}):E.jsx(tu,{})}),E.jsx($l,{ellipsis:{tooltip:g.filePath},style:{flex:1,minWidth:0,fontSize:n.fontSizeSM},children:gNt(g.filePath)})]}),E.jsxs(He,{size:4,children:[E.jsxs($l,{style:{color:n.colorSuccess,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",g.added]}),E.jsxs($l,{style:{color:n.colorError,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",g.removed]})]})]}),m&&E.jsxs("div",{style:{borderTop:`1px solid ${n.colorBorderSecondary}`,maxHeight:220,overflow:"auto",background:n.colorBgContainer},"data-testid":"session-diff-file-panel","data-file-path":g.filePath,children:[v.length>0?v.map((b,y)=>{const S={margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:n.fontSizeSM,lineHeight:1.5,padding:"0 8px",fontFamily:"Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"};return b.kind==="add"?S.background=n.colorSuccessBg:b.kind==="remove"?S.background=n.colorErrorBg:b.kind==="modified_add"?(S.background=n.colorWarningBg,S.borderLeft=`3px solid ${n.colorSuccess}`):b.kind==="modified_remove"?(S.background=n.colorWarningBg,S.borderLeft=`3px solid ${n.colorError}`):b.kind==="hunk"?(S.background=n.colorFillSecondary,S.color=n.colorTextSecondary):b.kind==="meta"&&(S.background=n.colorFillTertiary,S.color=n.colorTextSecondary),E.jsx("pre",{style:S,"data-testid":"session-diff-line","data-kind":b.kind,children:b.text||" "},`${g.filePath}-${y}`)}):E.jsx($l,{type:"secondary",style:{display:"block",padding:"8px",fontSize:n.fontSizeSM},children:"No diff preview available."}),g.truncated&&E.jsx($l,{type:"secondary",style:{display:"block",padding:"6px 8px 8px",fontSize:n.fontSizeSM},children:"Diff truncated for display."})]})]},g.filePath)})})]})})})},bNt=({sessionId:e,isCenteredLayout:t,maxWidth:n,onWorkflowDraftChange:r,showMessagesView:a,sessionDiffSummary:i,contextUsageIndicator:o})=>E.jsx(rt,{justify:"center",className:`chat-view-input-container-wrapper ${a?"messages-view":"centered-view"}`,children:E.jsxs("div",{style:{width:"100%",maxWidth:a?"clamp(720px, 68vw, 1240px)":n,margin:a?"0 auto":void 0,position:"relative",paddingBottom:a?12:0},children:[a&&E.jsx(vNt,{sessionDiffSummary:i,sessionId:e}),E.jsx(fNt,{sessionId:e,isCenteredLayout:t,onWorkflowDraftChange:r,statusIndicator:o})]})});function Yf(e,t,n){let r=n.initialDeps??[],a;function i(){var o,s,l,c;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return a;r=d;let h;if(n.key&&((s=n.debug)!=null&&s.call(n))&&(h=Date.now()),a=t(...d),n.key&&((l=n.debug)!=null&&l.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-h)*100)/100,v=m/16,b=(y,S)=>{for(y=String(y);y.length<S;)y=" "+y;return y};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
|
|
983
|
+
`);if(s(x),c(""),l(),a.size>0){const w=Array.from(x.matchAll(/@([^\\s]+)/g));if(w.length>0){const _=[];for(const T of w){const k=T[1],O=a.get(k);O&&_.push(O)}if(_.length>0){const T=JSON.stringify({type:"file_reference",paths:_.map(k=>k.path),display_text:x});await o(T,m,i,C)}else await o(x,m,i,C)}else await o(x,m,i,C)}else await o(x,m,i,C);u(null),d([]),f(new Map)},[e,l,a,r,s,i,n,o,d,c,f,u,t])}),tNt=({currentSessionId:e,currentChat:t,currentMessages:n,reasoningEffort:r,retryLastTurn:a,navigate:i})=>{const o=p.useCallback(async(l="regenerate")=>{if(!e||!t)return;const c=[...n];c.length===0||[...c].reverse().findIndex(d=>d.role==="user")===-1||await a(r,l)},[t,e,n,r,a]),s=p.useCallback((l,c)=>{const u=i(l,c);return u.applied?u.value:null},[i]);return{retryLastMessage:o,handleHistoryNavigate:s}},nNt=({referenceText:e,isToolSpecificMode:t,isRestrictConversation:n,allowedTools:r,autoToolPrefix:a})=>e?"Send a message (includes reference)":"Send a message... (type '/' for workflows)",rNt=p.lazy(()=>Mn(()=>import("./index-CU3N9MO6.js"),__vite__mapDeps([47,1,2]),import.meta.url)),aNt=p.lazy(()=>Mn(()=>import("./index-8oAqABHX.js"),__vite__mapDeps([48,1,2,49]),import.meta.url)),iNt=p.lazy(()=>Mn(()=>import("./index-BVl_96QK.js"),__vite__mapDeps([50,1,2]),import.meta.url)),oNt=p.lazy(()=>Mn(()=>import("./index-CF41Z0g4.js"),__vite__mapDeps([51,1,2]),import.meta.url)),{useToken:sNt}=pn,Gne="chat-send-message",Kne="reference-text",lNt="chat-model-options-cache-v1",cNt=24*60*60*1e3,Yne=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"},{value:"max",label:"Max"}],fCe=e=>`${lNt}:${e}`,uNt=e=>{if(typeof window>"u")return null;try{const t=localStorage.getItem(fCe(e));if(!t)return null;const n=JSON.parse(t);return!n||!Array.isArray(n.options)||Date.now()-n.timestamp>cNt?null:n.options.filter(r=>r&&typeof r.value=="string"&&r.value.trim().length>0&&typeof r.label=="string").map(r=>({value:r.value,label:r.label}))}catch{return null}},dNt=(e,t)=>{if(!(typeof window>"u"))try{const n={timestamp:Date.now(),options:t};localStorage.setItem(fCe(e),JSON.stringify(n))}catch{}},fNt=({sessionId:e,onWorkflowDraftChange:t,statusIndicator:n})=>{const r=p.useRef(null),{token:a}=sNt(),i=Ub(Oe=>Oe.open),o=Ue(Oe=>e??Oe.currentSessionId),s=Ue(Oe=>Oe.currentSessionId),l=Ue(hF(o)),c=(l==null?void 0:l.messages)||[],u=Ue(Oe=>Oe.addMessage),d=Ue(Oe=>Oe.updateSession),f=Ue(Oe=>Oe.processingChats),h=Ue(Oe=>Oe.setSessionProcessing),g=Ue(Oe=>Oe.pendingQuestionRespond),m=Ue(Oe=>Oe.setPendingQuestionRespond),v=pg(),b=Ue(Oe=>o?Oe.inputStates[o]:void 0),y=Ue(Oe=>Oe.setInputContent),S=Ue(Oe=>Oe.setReferenceText),C=Ue(Oe=>Oe.setInputReasoningEffort),x=Ho(Oe=>Oe.currentProvider),w=Ho(Oe=>Oe.providerConfig),[_,T]=p.useState([]),[k,O]=p.useState(!1),[I,M]=p.useState(null),[$,R]=p.useState(!1),A=(b==null?void 0:b.content)||"",P=(b==null?void 0:b.referenceText)||null,N=p.useMemo(()=>{var Oe;return(Oe=w.providers[x])==null?void 0:Oe.reasoning_effort},[w,x]),L=p.useMemo(()=>o?pF(o):void 0,[o]),j=(b==null?void 0:b.reasoningEffort)??L??N??"medium",D=p.useCallback(Oe=>{o&&y(o,Oe)},[o,y]),H=p.useCallback(Oe=>{o&&S(o,Oe)},[o,S]),F=p.useCallback(Oe=>{o&&C(o,Oe)},[o,C]),B=o?f.has(o):!1,{sendMessage:z,retryLastTurn:G,cancel:X}=Lhe({sessionId:o,addMessage:u,setSessionProcessing:h,updateSession:d});p.useEffect(()=>{if(typeof window>"u")return;const Oe=Fe=>{var st,gt,vt;const nt=Fe;if(!nt.detail)return;const ht=typeof nt.detail.sessionId=="string"?nt.detail.sessionId:null;if(!(ht?o===ht:o!==null&&o===s))return;nt.detail.handled=!0;const Xe=(st=nt.detail)==null?void 0:st.content;if(typeof Xe!="string"||Xe.trim().length===0){(vt=(gt=nt.detail)==null?void 0:gt.reject)==null||vt.call(gt,new Error("External send message content is empty"));return}z(Xe,void 0,j).then(()=>{var Et,ot;(ot=(Et=nt.detail)==null?void 0:Et.resolve)==null||ot.call(Et)}).catch(Et=>{var ot,dt;(dt=(ot=nt.detail)==null?void 0:ot.reject)==null||dt.call(ot,Et)})};return window.addEventListener(Gne,Oe),()=>{window.removeEventListener(Gne,Oe)}},[s,o,z,j]),p.useEffect(()=>{if(typeof window>"u")return;const Oe=Fe=>{const nt=Fe;if(!nt.detail||typeof nt.detail.text!="string")return;const ht=typeof nt.detail.sessionId=="string"?nt.detail.sessionId:null;if(!(ht?o===ht:o!==null&&o===s))return;const Xe=nt.detail.text.trim();Xe&&(nt.detail.handled=!0,H(Xe),requestAnimationFrame(()=>{var st;(st=r.current)==null||st.focus()}))};return window.addEventListener(Kne,Oe),()=>{window.removeEventListener(Kne,Oe)}},[s,o,H]);const Z=B,{message:q}=Ns.useApp(),Y=!1,te=!1,ee=[],Q=void 0,{recordEntry:ae,navigate:oe,acknowledgeManualInput:re}=KPt(o),{attachments:ie,setAttachments:ue,handleAttachmentsAdded:ge,handleAttachmentRemove:Te,handleClearAttachments:Se}=JPt(),fe=YPt({setContent:D,onWorkflowDraftChange:t,acknowledgeManualInput:re,currentSessionId:o,textAreaRef:r,content:A}),he=QPt({content:A,setContent:D,currentSessionId:o,currentChat:l,updateSession:d,messageApi:q}),{setShowFileSelector:ve}=he;p.useEffect(()=>{fe.showCommandSelector&&ve(!1)},[fe.showCommandSelector,ve]);const{handleSubmit:we}=eNt({attachments:ie,referenceText:P,selectedWorkflow:fe.selectedCommand,matchesWorkflowToken:fe.matchesCommandToken,fileReferences:he.fileReferences,reasoningEffort:j,sendMessage:z,recordEntry:ae,clearWorkflowDraft:fe.clearCommandDraft,setContent:D,setReferenceText:H,setAttachments:ue,setFileReferences:he.setFileReferences}),Re=!!(g&&g.sessionId===o),ce=p.useCallback(async Oe=>{const Fe=Oe.trim();if(!(!Fe||!o))try{const nt=v==null?void 0:v.trim(),ht=await fn.post(`respond/${o}`,{response:Fe,model:nt||void 0,reasoning_effort:j});q.success("Response submitted, AI will continue processing"),D(""),m(null);const Ge=ht==null?void 0:ht.auto_resume_status;Ge&&["started","already_running"].includes(Ge)&&h(o,!0)}catch(nt){console.error("[InputContainer] Failed to submit respond:",nt),q.error(nt instanceof Error?nt.message:"Submission failed")}},[o,v,j,q,D,m,h]),xe=p.useCallback(async(Oe,Fe)=>{Re?await ce(Oe):await we(Oe,Fe)},[Re,ce,we]),{retryLastMessage:Me,handleHistoryNavigate:Ie}=tNt({currentSessionId:o,currentChat:l,currentMessages:c,reasoningEffort:j,retryLastTurn:G,navigate:oe}),de=()=>H(null),me=p.useMemo(()=>{var Oe;return(Oe=w.providers)==null?void 0:Oe[x]},[w,x]),pe=p.useMemo(()=>!me||typeof me!="object"?!1:x==="copilot"?Object.keys(me).length>0:typeof me.api_key=="string"&&me.api_key.trim().length>0,[x,me]),Ae=p.useCallback(()=>pe?!1:(i("chat"),q.warning("Please configure provider first"),!0),[pe,q,i]);p.useEffect(()=>{const Oe=uNt(x);T(Oe??[]),M(null)},[x]);const ye=p.useCallback(Oe=>Oe instanceof Error&&Oe.message.trim()?Oe.message:"Unknown error",[]),Ce=p.useMemo(()=>({openai:[...wbe],anthropic:[...Cbe],gemini:[...Ebe],copilot:[...Txt]})[x]||[],[x]),Ee=p.useMemo(()=>{const Fe=[..._.length>0?_:Ce];return v&&!Fe.some(nt=>nt.value===v)&&Fe.unshift({value:v,label:v}),Fe},[_,Ce,v]),_e=p.useCallback(async(Oe,Fe)=>{if(!(!(Fe!=null&&Fe.force)&&_.length>0))try{O(!0),M(null);const ht=(Oe==="copilot"?await BE.getModels():await lo.fetchProviderModels(Oe)).map(Ge=>({value:Ge,label:Ge}));T(ht),dNt(Oe,ht)}catch(nt){M(ye(nt))}finally{O(!1)}},[ye,_.length]),je=p.useCallback(Oe=>{Oe&&(Ae()||k||_.length>0||_e(x))},[x,_e,k,_.length,Ae]),Ne=p.useCallback(async Oe=>{if(!(!Oe||Oe===v)&&!$)try{if(Ae())return;R(!0);const Fe=Ho.getState(),nt={...Fe.providerConfig.providers||{}};nt[x]={...nt[x]||{},model:Oe},await lo.saveProviderConfig({provider:x,providers:nt}),await Fe.loadProviderConfig(),q.success("Model updated")}catch(Fe){q.error(`Failed to update model: ${ye(Fe)}`)}finally{R(!1)}},[v,x,ye,$,q,Ae]),tt=p.useMemo(()=>nNt({referenceText:P,isToolSpecificMode:Y,isRestrictConversation:te,allowedTools:ee,autoToolPrefix:Q}),[P,Y,te,ee,Q]),ct=Re?"Type your custom answer here, press Enter to submit...":tt,Ke=p.useMemo(()=>{var Oe;return((Oe=Yne.find(Fe=>Fe.value===j))==null?void 0:Oe.label)??j},[j]),Ze=E.jsx(Qc,{trigger:["click"],placement:"topLeft",disabled:!v||Z,menu:{selectable:!0,selectedKeys:[j],items:Yne.map(Oe=>({key:Oe.value,label:Oe.label})),onClick:({key:Oe})=>{F(Oe)}},children:E.jsx(De,{type:"text",size:"small",disabled:!v||Z,style:{minWidth:88,padding:"0 12px",height:36,borderRadius:18,color:j==="medium"?a.colorTextSecondary:a.colorPrimary},title:`Reasoning: ${Ke}`,children:E.jsxs(He,{size:6,children:[E.jsx(B7e,{}),E.jsx("span",{children:Ke}),E.jsx(As,{style:{fontSize:10}})]})})}),ut=v||(pe?"Select Model":"Configure Provider"),Je=p.useMemo(()=>Ee.length>0?Ee.map(Oe=>({key:Oe.value,label:Oe.label})):[{key:"__no_models__",label:I||"No models available",disabled:!0}],[Ee,I]),qe=E.jsx(De,{type:"text",size:"small",disabled:Z||$,onClick:()=>{pe||Ae()},style:{minWidth:146,padding:"0 12px",height:36,borderRadius:18,color:I?a.colorError:a.colorTextSecondary},title:ut,children:E.jsxs(He,{size:6,children:[k?E.jsx(DE,{}):E.jsx(aF,{}),E.jsx("span",{style:{maxWidth:128,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ut}),E.jsx(As,{style:{fontSize:10}})]})}),Qe=pe?E.jsx(Qc,{trigger:["click"],placement:"topLeft",menu:{selectable:!0,selectedKeys:v?[v]:[],items:Je,style:{maxHeight:"50vh",overflowY:"auto"},onClick:({key:Oe})=>{Oe!=="__no_models__"&&Ne(String(Oe))}},onOpenChange:je,disabled:Z||$,children:qe}):qe;return E.jsxs("div",{style:{padding:`${a.paddingXXS}px ${a.paddingXS}px`,background:"transparent",borderTop:"none",boxShadow:"none",width:"100%",position:"relative",overflow:"visible"},children:[!v&&E.jsx(fr,{type:"warning",showIcon:!0,icon:E.jsx(iF,{}),message:pe?"No model selected":"Provider not configured",description:pe?"Select a model from the dropdown in the input toolbar.":"Open settings and configure a provider before selecting a model.",action:pe?void 0:E.jsx(He,{children:E.jsx("a",{onClick:()=>i("chat"),children:"Open Settings"})}),style:{marginBottom:a.marginSM}}),Y,P&&E.jsx(GPt,{text:P,onClose:de}),ie.length>0&&E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(rNt,{files:ie,onRemove:Te,onClear:Se})}),E.jsx(qPt,{value:A,onChange:fe.handleInputChange,onSubmit:xe,placeholder:ct,allowImages:!0,disabled:!v,statusIndicator:n??null,isWorkflowSelectorVisible:fe.showCommandSelector,textAreaRef:r,validateMessage:Oe=>({isValid:!0}),onAttachmentsAdded:ge,onWorkflowCommandChange:fe.handleCommandChange,onFileReferenceChange:he.handleFileReferenceChange,onFileReferenceButtonClick:he.handleFileReferenceButtonClick,leftControlsExtra:E.jsxs(He,{size:0,wrap:!0,children:[Qe,Ze]}),interaction:{isStreaming:Z,hasMessages:c.some(Oe=>Oe.role==="user"),allowRetry:!0,onRetry:Me,onCancel:X,onHistoryNavigate:Ie}}),E.jsx(p.Suspense,{fallback:null,children:E.jsx(aNt,{visible:fe.showCommandSelector,onSelect:fe.handleCommandSelect,onCancel:fe.handleCommandSelectorCancel,onAutoComplete:fe.handleAutoComplete,searchText:fe.commandSearchText})}),he.showFileSelector&&E.jsx(p.Suspense,{fallback:E.jsx(ia,{size:"small"}),children:E.jsx(oNt,{visible:he.showFileSelector,files:he.workspaceFiles,searchText:he.fileSearchText,loading:he.isWorkspaceLoading,error:he.workspaceError,onSelect:he.handleFileReferenceSelect,onCancel:he.handleFileSelectorCancel,onChangeWorkspace:()=>{he.setWorkspacePathInput((l==null?void 0:l.config.workspacePath)??""),he.setIsWorkspaceModalVisible(!0)}})}),E.jsx(p.Suspense,{fallback:null,children:E.jsx(iNt,{open:he.isWorkspaceModalVisible,initialPath:he.workspacePathInput,loading:he.isSavingWorkspace,onSubmit:he.handleWorkspaceModalSubmit,onCancel:he.handleWorkspaceModalCancel})})]})},{Text:$l}=Qt,pNt=220,hNt="chat-session-diff-collapse:",gNt=e=>e.split(/[\\/]/).pop()||e,pCe=e=>`${hNt}${e??"default"}`,JR=e=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(pCe(e));if(!t)return null;const n=JSON.parse(t);if(!n||typeof n!="object")return null;const r="isExpanded"in n&&typeof n.isExpanded=="boolean"?n.isExpanded:!0,a="expandedFiles"in n&&Array.isArray(n.expandedFiles)?n.expandedFiles.filter(i=>typeof i=="string"):[];return{isExpanded:r,expandedFiles:a}}catch{return null}},mNt=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pCe(e),JSON.stringify(t))}catch{}},vNt=({sessionDiffSummary:e,sessionId:t})=>{const{token:n}=pn.useToken(),r=!!(e&&e.files.length>0),[a,i]=p.useState(r),[o,s]=p.useState(r),[l,c]=p.useState(()=>{var g;return((g=JR(t))==null?void 0:g.isExpanded)??!0}),[u,d]=p.useState(()=>{var g;return new Set(((g=JR(t))==null?void 0:g.expandedFiles)??[])});p.useEffect(()=>{if(r){i(!0);const m=window.setTimeout(()=>s(!0),0);return()=>window.clearTimeout(m)}s(!1);const g=window.setTimeout(()=>i(!1),pNt);return()=>window.clearTimeout(g)},[r]);const f=p.useMemo(()=>e?e.files:[],[e]),h=p.useMemo(()=>{const g=new Map;return e&&e.files.forEach(m=>{g.set(m.filePath,jhe(m.unifiedDiff))}),g},[e]);return p.useEffect(()=>{const g=JR(t);c((g==null?void 0:g.isExpanded)??!0),d(new Set((g==null?void 0:g.expandedFiles)??[]))},[t]),p.useEffect(()=>{mNt(t,{isExpanded:l,expandedFiles:Array.from(u)})},[t,l,u]),p.useEffect(()=>{if(!e||e.files.length===0)return;const g=new Set(e.files.map(m=>m.filePath));d(m=>{const v=new Set;let b=!1;return m.forEach(y=>{g.has(y)?v.add(y):b=!0}),!b&&v.size===m.size?m:v})},[e]),!a||!e?null:E.jsx("div",{className:`active-tool-card-wrapper ${o?"visible":""}`,"aria-hidden":!o,"data-testid":"session-diff-card",children:E.jsx(Ot,{size:"small",style:{width:"100%",borderRadius:n.borderRadiusLG,border:`1px solid ${n.colorBorderSecondary}`,background:n.colorBgContainer,boxShadow:n.boxShadowSecondary},bodyStyle:{padding:`${n.paddingXS}px ${n.paddingSM}px`},children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:6,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:n.marginSM,cursor:"pointer"},onClick:()=>c(g=>!g),"data-testid":"session-diff-toggle",children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginSM,minWidth:0},children:[E.jsx(A7e,{style:{color:n.colorPrimary}}),E.jsx($l,{strong:!0,style:{whiteSpace:"nowrap"},children:"Session diffs"}),E.jsxs($l,{type:"secondary",style:{fontSize:n.fontSizeSM,whiteSpace:"nowrap"},children:["(",e.files.length," files /"," ",e.changedTools," tools)"]}),E.jsxs(He,{size:4,style:{marginInlineStart:n.marginXS},children:[E.jsxs($l,{style:{color:n.colorSuccess,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",e.totalAdded]}),E.jsxs($l,{style:{color:n.colorError,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",e.totalRemoved]})]})]}),E.jsx("div",{style:{color:n.colorTextSecondary},children:l?E.jsx(As,{}):E.jsx(tu,{})})]}),l&&E.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr",gap:6,maxHeight:280,overflowY:"auto"},"data-testid":"session-diff-file-list",children:f.map(g=>{const m=u.has(g.filePath),v=h.get(g.filePath)??[];return E.jsxs("div",{style:{border:`1px solid ${n.colorBorderSecondary}`,borderRadius:n.borderRadiusSM,overflow:"hidden",background:n.colorBgContainer},"data-testid":"session-diff-file-item","data-file-path":g.filePath,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:n.marginSM,padding:"4px 8px",borderRadius:n.borderRadiusSM,background:n.colorFillTertiary,cursor:"pointer"},onClick:()=>{d(b=>{const y=new Set(b);return y.has(g.filePath)?y.delete(g.filePath):y.add(g.filePath),y})},"data-testid":"session-diff-file-header","data-file-path":g.filePath,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginXS,minWidth:0,flex:1},children:[E.jsx("span",{style:{color:n.colorTextSecondary},children:m?E.jsx(As,{}):E.jsx(tu,{})}),E.jsx($l,{ellipsis:{tooltip:g.filePath},style:{flex:1,minWidth:0,fontSize:n.fontSizeSM},children:gNt(g.filePath)})]}),E.jsxs(He,{size:4,children:[E.jsxs($l,{style:{color:n.colorSuccess,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",g.added]}),E.jsxs($l,{style:{color:n.colorError,fontSize:n.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",g.removed]})]})]}),m&&E.jsxs("div",{style:{borderTop:`1px solid ${n.colorBorderSecondary}`,maxHeight:220,overflow:"auto",background:n.colorBgContainer},"data-testid":"session-diff-file-panel","data-file-path":g.filePath,children:[v.length>0?v.map((b,y)=>{const S={margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:n.fontSizeSM,lineHeight:1.5,padding:"0 8px",fontFamily:"Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"};return b.kind==="add"?S.background=n.colorSuccessBg:b.kind==="remove"?S.background=n.colorErrorBg:b.kind==="modified_add"?(S.background=n.colorWarningBg,S.borderLeft=`3px solid ${n.colorSuccess}`):b.kind==="modified_remove"?(S.background=n.colorWarningBg,S.borderLeft=`3px solid ${n.colorError}`):b.kind==="hunk"?(S.background=n.colorFillSecondary,S.color=n.colorTextSecondary):b.kind==="meta"&&(S.background=n.colorFillTertiary,S.color=n.colorTextSecondary),E.jsx("pre",{style:S,"data-testid":"session-diff-line","data-kind":b.kind,children:b.text||" "},`${g.filePath}-${y}`)}):E.jsx($l,{type:"secondary",style:{display:"block",padding:"8px",fontSize:n.fontSizeSM},children:"No diff preview available."}),g.truncated&&E.jsx($l,{type:"secondary",style:{display:"block",padding:"6px 8px 8px",fontSize:n.fontSizeSM},children:"Diff truncated for display."})]})]},g.filePath)})})]})})})},bNt=({sessionId:e,isCenteredLayout:t,maxWidth:n,onWorkflowDraftChange:r,showMessagesView:a,sessionDiffSummary:i,contextUsageIndicator:o})=>E.jsx(rt,{justify:"center",className:`chat-view-input-container-wrapper ${a?"messages-view":"centered-view"}`,children:E.jsxs("div",{style:{width:"100%",maxWidth:a?"clamp(720px, 68vw, 1240px)":n,margin:a?"0 auto":void 0,position:"relative",paddingBottom:a?12:0},children:[a&&E.jsx(vNt,{sessionDiffSummary:i,sessionId:e}),E.jsx(fNt,{sessionId:e,isCenteredLayout:t,onWorkflowDraftChange:r,statusIndicator:o})]})});function Yf(e,t,n){let r=n.initialDeps??[],a;function i(){var o,s,l,c;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return a;r=d;let h;if(n.key&&((s=n.debug)!=null&&s.call(n))&&(h=Date.now()),a=t(...d),n.key&&((l=n.debug)!=null&&l.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-h)*100)/100,v=m/16,b=(y,S)=>{for(y=String(y);y.length<S;)y=" "+y;return y};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
|
|
984
984
|
font-size: .6rem;
|
|
985
985
|
font-weight: bold;
|
|
986
986
|
color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(c=n==null?void 0:n.onChange)==null||c.call(n,a),a}return i.updateDeps=o=>{r=o},i}function Xne(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const yNt=(e,t)=>Math.abs(e-t)<1.01,SNt=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}},Zne=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},xNt=e=>e,wNt=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let a=t;a<=n;a++)r.push(a);return r},CNt=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=o=>{const{width:s,height:l}=o;t({width:Math.round(s),height:Math.round(l)})};if(a(Zne(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const s=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){a({width:c.inlineSize,height:c.blockSize});return}}a(Zne(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Qne={passive:!0},Jne=typeof window>"u"?!0:"onscrollend"in window,ENt=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&Jne?()=>{}:SNt(r,()=>{t(a,!1)},e.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:d,isRtl:f}=e.options;a=d?n.scrollLeft*(f&&-1||1):n.scrollTop,i(),t(a,u)},s=o(!0),l=o(!1);l(),n.addEventListener("scroll",s,Qne);const c=e.options.useScrollendEvent&&Jne;return c&&n.addEventListener("scrollend",l,Qne),()=>{n.removeEventListener("scroll",s),c&&n.removeEventListener("scrollend",l)}},_Nt=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},TNt=(e,{adjustments:t=0,behavior:n},r)=>{var a,i;const o=e+t;(i=(a=r.scrollElement)==null?void 0:a.scrollTo)==null||i.call(a,{[r.options.horizontal?"left":"top"]:o,behavior:n})};class kNt{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(i=>{const o=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var a;(a=r())==null||a.disconnect(),n=null},observe:a=>{var i;return(i=r())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:a=>{var i;return(i=r())==null?void 0:i.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,a])=>{typeof a>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:xNt,rangeExtractor:wNt,onChange:()=>{},measureElement:_Nt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,a;(a=(r=this.options).onChange)==null||a.call(r,this,n)},this.maybeNotify=Yf(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const a=new Map,i=new Map;for(let o=r-1;o>=0;o--){const s=n[o];if(a.has(s.lane))continue;const l=i.get(s.lane);if(l==null||s.end>l.end?i.set(s.lane,s):s.end<l.end&&a.set(s.lane,!0),a.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,s)=>o.end===s.end?o.index-s.index:o.end-s.end)[0]:void 0},this.getMeasurementOptions=Yf(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,a,i,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o}),{key:!1}),this.getMeasurements=Yf(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o},s)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,l);for(let u=l;u<n;u++){const d=i(u),f=this.options.lanes===1?c[u-1]:this.getFurthestMeasurement(c,u),h=f?f.end+this.options.gap:r+a,g=s.get(d),m=typeof g=="number"?g:this.options.estimateSize(u),v=h+m,b=f?f.lane:u%this.options.lanes;c[u]={index:u,start:h,size:m,end:v,key:d,lane:b}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Yf(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,a,i)=>this.range=n.length>0&&r>0?ONt({measurements:n,outerSize:r,scrollOffset:a,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Yf(()=>{let n=null,r=null;const a=this.calculateRange();return a&&(n=a.startIndex,r=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,a,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,a=n.getAttribute(r);return a?parseInt(a,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const a=this.indexFromElement(n),i=this.measurementsCache[a];if(!i)return;const o=i.key,s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),n.isConnected&&this.resizeItem(a,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const a=this.measurementsCache[n];if(!a)return;const i=this.itemSizeCache.get(a.key)??a.size,o=r-i;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,o,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}this._measureElement(n,void 0)},this.getVirtualItems=Yf(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const a=[];for(let i=0,o=n.length;i<o;i++){const s=n[i],l=r[s];a.push(l)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Xne(r[hCe(0,r.length-1,a=>Xne(r[a]).start,n)])},this.getOffsetForAlignment=(n,r,a=0)=>{const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(a-i)/2:r==="end"&&(n-=i);const s=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.measurementsCache[n];if(!a)return;const i=this.getSize(),o=this.getScrollOffset();if(r==="auto")if(a.end>=o+i-this.options.scrollPaddingEnd)r="end";else if(a.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];const s=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,a.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:a}={})=>{a==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:a})},this.scrollToIndex=(n,{align:r="auto",behavior:a}={})=>{a==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const o=10,s=c=>{if(!this.targetWindow)return;const u=this.getOffsetForIndex(n,c);if(!u){console.warn("Failed to get offset for index:",n);return}const[d,f]=u;this._scrollToOffset(d,{adjustments:void 0,behavior:a}),this.targetWindow.requestAnimationFrame(()=>{const h=this.getScrollOffset(),g=this.getOffsetForIndex(n,f);if(!g){console.warn("Failed to get offset for index:",n);return}yNt(g[0],h)||l(f)})},l=c=>{this.targetWindow&&(i++,i<o?this.targetWindow.requestAnimationFrame(()=>s(c)):console.warn(`Failed to scroll to index ${n} after ${o} attempts.`))};s(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let a;if(r.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(s=>s===null);){const s=r[o];i[s.lane]===null&&(i[s.lane]=s.end),o--}a=Math.max(...i.filter(s=>s!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:a})=>{this.options.scrollToFn(n,{behavior:a,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const hCe=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else if(i>r)t=a-1;else return a}return e>0?e-1:0};function ONt({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const a=e.length-1,i=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:a};let o=hCe(0,a,i,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){const l=Array(r).fill(0);for(;s<a&&l.some(u=>u<n+t);){const u=e[s];l[u.lane]=u.end,s++}const c=Array(r).fill(n+t);for(;o>=0&&c.some(u=>u>=n);){const u=e[o];c[u.lane]=u.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}const ere=typeof document<"u"?p.useLayoutEffect:p.useEffect;function $Nt(e){const t=p.useReducer(()=>({}),{})[1],n={...e,onChange:(a,i)=>{var o;i?il.flushSync(t):t(),(o=e.onChange)==null||o.call(e,a,i)}},[r]=p.useState(()=>new kNt(n));return r.setOptions(n),ere(()=>r._didMount(),[]),ere(()=>r._willUpdate()),r}function INt(e){return $Nt({observeElementRect:CNt,observeElementOffset:ENt,scrollToFn:TNt,...e})}const{Text:tre,Paragraph:ANt}=Qt,RNt=({content:e,token:t,headingColor:n})=>E.jsx(Uc,{components:{p:({children:r})=>E.jsx(ANt,{style:{marginBottom:t.marginSM},children:r}),ol:({children:r})=>E.jsx("ol",{style:{marginBottom:t.marginSM,paddingLeft:20},children:r}),ul:({children:r})=>E.jsx("ul",{style:{marginBottom:t.marginSM,paddingLeft:20},children:r}),li:({children:r})=>E.jsx("li",{style:{marginBottom:t.marginXS},children:r}),h1:({children:r})=>E.jsx(tre,{strong:!0,style:{fontSize:t.fontSizeHeading3,marginBottom:t.marginSM,display:"block",color:n},children:r}),h2:({children:r})=>E.jsx(tre,{strong:!0,style:{fontSize:t.fontSizeHeading4,marginBottom:t.marginSM,display:"block",color:n},children:r})},children:e}),MNt=p.memo(RNt),PNt=({currentChat:e,message:t,systemPrompts:n})=>{var _;const[r,a]=p.useState(null),[i,o]=p.useState(null),[s,l]=p.useState(!1),[c,u]=p.useState(!1),d=p.useMemo(()=>Fw.getInstance(),[]),f=p.useMemo(()=>Rs.getInstance(),[]),h=t.role==="system"&&typeof t.content=="string"?t.content:"",g=t.role==="system"&&!t.id.startsWith("system-prompt-")&&h.trim().length>0;p.useEffect(()=>{t.role==="system"&&(o(null),u(!1))},[t.id,t.role,h]);const m=(e==null?void 0:e.id)??null,v=((_=e==null?void 0:e.config)==null?void 0:_.systemPromptId)??null,b=p.useMemo(()=>v?n.find(T=>T.id===v)??null:null,[v,n]),y=(b==null?void 0:b.content)??(r==null?void 0:r.content)??"",S=(b==null?void 0:b.description)??(r==null?void 0:r.description)??"",C=p.useRef(null);p.useEffect(()=>{a(null),C.current=null},[m,v]),p.useEffect(()=>{if(!v)return;const T=v;if(b!=null&&b.content)return;const k=`${m??"no-chat"}:${T}`;if(C.current===k)return;C.current=k;let O=!1;return(async()=>{try{const M=await d.findPresetById(T);if(O)return;const $=M?{content:M.content,description:M.description}:null;a(R=>!R&&!$||R&&$&&R.content===$.content&&R.description===$.description?R:$)}catch(M){console.error("Failed to load preset prompt:",M)}})(),()=>{O=!0}},[m,v,d,b==null?void 0:b.content]);const x=p.useCallback(async()=>{var T;if(!s){l(!0);try{if(m)try{const O=(T=(await f.getSessionSystemPrompt(m)).effective_system_prompt)==null?void 0:T.trim();if(O){o(O),u(!0);return}}catch(k){console.warn("Failed to load backend prompt snapshot:",k)}if(g){o(h),u(!0);return}console.warn("Enhanced prompt snapshot unavailable; keeping base prompt view.")}catch(k){console.error("Failed to load enhanced prompt:",k)}finally{l(!1)}}},[f,m,g,s,h]),w=p.useMemo(()=>c&&i?i:y||S||(t.role==="system"?h:"System prompt is being prepared..."),[c,i,y,S,t.role,h]);return{basePrompt:y,categoryDescription:S,enhancedPrompt:i,loadingEnhanced:s,loadEnhancedPrompt:x,promptToDisplay:w,showEnhanced:c,setShowEnhanced:u,systemMessageContent:h}},{Text:NNt}=Qt,{useToken:LNt}=pn,DNt=({currentChat:e,message:t})=>{const{token:n}=LNt(),r=Ue(d=>d.systemPrompts),{basePrompt:a,loadingEnhanced:i,loadEnhancedPrompt:o,promptToDisplay:s,showEnhanced:l,setShowEnhanced:c}=PNt({currentChat:e,message:t,systemPrompts:r}),u=p.useCallback(async d=>{try{await Ko(d)}catch(f){console.error("Failed to copy text:",f)}},[]);return E.jsx(Ot,{style:{width:"100%",maxWidth:"100%",background:n.colorBgContainer,borderRadius:n.borderRadiusLG,boxShadow:"none"},children:E.jsxs(He,{direction:"vertical",size:n.marginSM,style:{width:"100%"},children:[E.jsxs(rt,{justify:"space-between",align:"center",children:[E.jsx(rt,{align:"center",gap:n.marginXS,children:E.jsx(NNt,{type:"secondary",strong:!0,style:{fontSize:n.fontSizeSM},children:"System Prompt"})}),E.jsxs(He,{children:[a&&!l?E.jsx(De,{type:"text",size:"small",icon:E.jsx(rF,{}),onClick:o,loading:i,children:"View Enhanced"}):null,a&&l?E.jsx(De,{type:"text",size:"small",onClick:()=>c(!1),children:"View Base"}):null,E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),onClick:()=>u(s),children:"Copy"})]})]}),E.jsx(rt,{vertical:!0,style:{maxHeight:l?400:300,overflowY:"auto",paddingRight:n.paddingXS},children:E.jsx(MNt,{content:s,token:n,headingColor:n.colorPrimary})})]})})},gCe=p.memo(DNt);gCe.displayName="SystemMessageCard";const Nu=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],nre={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Nu,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Nu],h2:[["className","sr-only"]],img:[...Nu,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Nu,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Nu],table:[...Nu],ul:[...Nu,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},Ic={}.hasOwnProperty;function jNt(e,t){let n={type:"root",children:[]};const r={schema:t?{...nre,...t}:nre,stack:[]},a=mCe(r,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function mCe(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return BNt(e,n);case"doctype":return FNt(e,n);case"element":return zNt(e,n);case"root":return HNt(e,n);case"text":return UNt(e,n)}}}function BNt(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),i={type:"comment",value:r<0?n:n.slice(0,r)};return P0(i,t),i}}function FNt(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return P0(n,t),n}}function zNt(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=vCe(e,t.children),a=WNt(e,t.properties);e.stack.pop();let i=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(i=!0,e.schema.ancestors&&Ic.call(e.schema.ancestors,n))){const s=e.schema.ancestors[n];let l=-1;for(i=!1;++l<s.length;)e.stack.includes(s[l])&&(i=!0)}if(!i)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const o={type:"element",tagName:n,properties:a,children:r};return P0(o,t),o}function HNt(e,t){const r={type:"root",children:vCe(e,t.children)};return P0(r,t),r}function UNt(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return P0(r,t),r}function vCe(e,t){const n=[];if(Array.isArray(t)){const r=t;let a=-1;for(;++a<r.length;){const i=mCe(e,r[a]);i&&(Array.isArray(i)?n.push(...i):n.push(i))}}return n}function WNt(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,a=e.schema.required,i=r&&Ic.call(r,n)?r[n]:void 0,o=r&&Ic.call(r,"*")?r["*"]:void 0,s=t&&typeof t=="object"?t:{},l={};let c;for(c in s)if(Ic.call(s,c)){const u=s[c];let d=rre(e,are(i,c),c,u);d==null&&(d=rre(e,are(o,c),c,u)),d!=null&&(l[c]=d)}if(a&&Ic.call(a,n)){const u=a[n];for(c in u)Ic.call(u,c)&&!Ic.call(l,c)&&(l[c]=u[c])}return l}function rre(e,t,n,r){return t?Array.isArray(r)?qNt(e,t,n,r):bCe(e,t,n,r):void 0}function qNt(e,t,n,r){let a=-1;const i=[];for(;++a<r.length;){const o=bCe(e,t,n,r[a]);(typeof o=="number"||typeof o=="string")&&i.push(o)}return i}function bCe(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&VNt(e,n,r)){if(typeof t=="object"&&t.length>1){let a=!1,i=0;for(;++i<t.length;){const o=t[i];if(o&&typeof o=="object"&&"flags"in o){if(o.test(String(r))){a=!0;break}}else if(o===r){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function VNt(e,t,n){const r=e.schema.protocols&&Ic.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const a=String(n),i=a.indexOf(":"),o=a.indexOf("?"),s=a.indexOf("#"),l=a.indexOf("/");if(i<0||l>-1&&i>l||o>-1&&i>o||s>-1&&i>s)return!0;let c=-1;for(;++c<r.length;){const u=r[c];if(i===u.length&&a.slice(0,u.length)===u)return!0}return!1}function P0(e,t){const n=Kde(t);t.data&&(e.data=zb(t.data)),n&&(e.position=n)}function are(e,t){let n,r=-1;if(e)for(;++r<e.length;){const a=e[r],i=typeof a=="string"?a:a[0];if(i===t)return a;i==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function uU(e){return function(t){return jNt(t,e)}}function GNt(e){xfe(e,[/\r?\n|\r/g,KNt])}function KNt(){return{type:"break"}}function dU(){return function(e){GNt(e)}}const yCe=6048e5,YNt=864e5,ire=Symbol.for("constructDateFrom");function ou(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&ire in e?e[ire](t):e instanceof Date?new e.constructor(t):new Date(t)}function Bs(e,t){return ou(t||e,e)}let XNt={};function bT(){return XNt}function Ly(e,t){var s,l,c,u;const n=bT(),r=(t==null?void 0:t.weekStartsOn)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,a=Bs(e,t==null?void 0:t.in),i=a.getDay(),o=(i<r?7:0)+i-r;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function k1(e,t){return Ly(e,{...t,weekStartsOn:1})}function SCe(e,t){const n=Bs(e,t==null?void 0:t.in),r=n.getFullYear(),a=ou(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const i=k1(a),o=ou(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const s=k1(o);return n.getTime()>=i.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function ore(e){const t=Bs(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function ZNt(e,...t){const n=ou.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function sre(e,t){const n=Bs(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function QNt(e,t,n){const[r,a]=ZNt(n==null?void 0:n.in,e,t),i=sre(r),o=sre(a),s=+i-ore(i),l=+o-ore(o);return Math.round((s-l)/YNt)}function JNt(e,t){const n=SCe(e,t),r=ou(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),k1(r)}function eLt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function tLt(e){return!(!eLt(e)&&typeof e!="number"||isNaN(+Bs(e)))}function nLt(e,t){const n=Bs(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const rLt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},aLt=(e,t,n)=>{let r;const a=rLt[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function e2(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const iLt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},oLt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},sLt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},lLt={date:e2({formats:iLt,defaultWidth:"full"}),time:e2({formats:oLt,defaultWidth:"full"}),dateTime:e2({formats:sLt,defaultWidth:"full"})},cLt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},uLt=(e,t,n,r)=>cLt[e];function Tm(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=e.formattingValues[s]||e.formattingValues[o]}else{const o=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[s]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const dLt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},fLt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},pLt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},hLt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},gLt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},mLt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},vLt=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},bLt={ordinalNumber:vLt,era:Tm({values:dLt,defaultWidth:"wide"}),quarter:Tm({values:fLt,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Tm({values:pLt,defaultWidth:"wide"}),day:Tm({values:hLt,defaultWidth:"wide"}),dayPeriod:Tm({values:gLt,defaultWidth:"wide",formattingValues:mLt,defaultFormattingWidth:"wide"})};function km(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?SLt(s,d=>d.test(o)):yLt(s,d=>d.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function yLt(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function SLt(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function xLt(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=t.slice(a.length);return{value:o,rest:s}}}const wLt=/^(\d+)(th|st|nd|rd)?/i,CLt=/\d+/i,ELt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},_Lt={any:[/^b/i,/^(a|c)/i]},TLt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},kLt={any:[/1/i,/2/i,/3/i,/4/i]},OLt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},$Lt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ILt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ALt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},RLt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},MLt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},PLt={ordinalNumber:xLt({matchPattern:wLt,parsePattern:CLt,valueCallback:e=>parseInt(e,10)}),era:km({matchPatterns:ELt,defaultMatchWidth:"wide",parsePatterns:_Lt,defaultParseWidth:"any"}),quarter:km({matchPatterns:TLt,defaultMatchWidth:"wide",parsePatterns:kLt,defaultParseWidth:"any",valueCallback:e=>e+1}),month:km({matchPatterns:OLt,defaultMatchWidth:"wide",parsePatterns:$Lt,defaultParseWidth:"any"}),day:km({matchPatterns:ILt,defaultMatchWidth:"wide",parsePatterns:ALt,defaultParseWidth:"any"}),dayPeriod:km({matchPatterns:RLt,defaultMatchWidth:"any",parsePatterns:MLt,defaultParseWidth:"any"})},NLt={code:"en-US",formatDistance:aLt,formatLong:lLt,formatRelative:uLt,localize:bLt,match:PLt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function LLt(e,t){const n=Bs(e,t==null?void 0:t.in);return QNt(n,nLt(n))+1}function DLt(e,t){const n=Bs(e,t==null?void 0:t.in),r=+k1(n)-+JNt(n);return Math.round(r/yCe)+1}function xCe(e,t){var u,d,f,h;const n=Bs(e,t==null?void 0:t.in),r=n.getFullYear(),a=bT(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??a.firstWeekContainsDate??((h=(f=a.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,o=ou((t==null?void 0:t.in)||e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=Ly(o,t),l=ou((t==null?void 0:t.in)||e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=Ly(l,t);return+n>=+s?r+1:+n>=+c?r:r-1}function jLt(e,t){var s,l,c,u;const n=bT(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,a=xCe(e,t),i=ou((t==null?void 0:t.in)||e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),Ly(i,t)}function BLt(e,t){const n=Bs(e,t==null?void 0:t.in),r=+Ly(n,t)-+jLt(n,t);return Math.round(r/yCe)+1}function gr(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Cc={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return gr(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):gr(n+1,2)},d(e,t){return gr(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return gr(e.getHours()%12||12,t.length)},H(e,t){return gr(e.getHours(),t.length)},m(e,t){return gr(e.getMinutes(),t.length)},s(e,t){return gr(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return gr(a,t.length)}},Xf={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},lre={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Cc.y(e,t)},Y:function(e,t,n,r){const a=xCe(e,r),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return gr(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):gr(i,t.length)},R:function(e,t){const n=SCe(e);return gr(n,t.length)},u:function(e,t){const n=e.getFullYear();return gr(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return gr(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return gr(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Cc.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return gr(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=BLt(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):gr(a,t.length)},I:function(e,t,n){const r=DLt(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):gr(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Cc.d(e,t)},D:function(e,t,n){const r=LLt(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):gr(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return gr(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return gr(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return gr(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=Xf.noon:r===0?a=Xf.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=Xf.evening:r>=12?a=Xf.afternoon:r>=4?a=Xf.morning:a=Xf.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Cc.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Cc.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):gr(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):gr(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Cc.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Cc.s(e,t)},S:function(e,t){return Cc.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return ure(r);case"XXXX":case"XX":return zu(r);case"XXXXX":case"XXX":default:return zu(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return ure(r);case"xxxx":case"xx":return zu(r);case"xxxxx":case"xxx":default:return zu(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+cre(r,":");case"OOOO":default:return"GMT"+zu(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+cre(r,":");case"zzzz":default:return"GMT"+zu(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return gr(r,t.length)},T:function(e,t,n){return gr(+e,t.length)}};function cre(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+gr(i,2)}function ure(e,t){return e%60===0?(e>0?"-":"+")+gr(Math.abs(e)/60,2):zu(e,t)}function zu(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=gr(Math.trunc(r/60),2),i=gr(r%60,2);return n+a+t+i}const dre=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},wCe=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},FLt=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return dre(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",dre(r,t)).replace("{{time}}",wCe(a,t))},zLt={p:wCe,P:FLt},HLt=/^D+$/,ULt=/^Y+$/,WLt=["D","DD","YY","YYYY"];function qLt(e){return HLt.test(e)}function VLt(e){return ULt.test(e)}function GLt(e,t,n){const r=KLt(e,t,n);if(console.warn(r),WLt.includes(e))throw new RangeError(r)}function KLt(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const YLt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,XLt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ZLt=/^'([^]*?)'?$/,QLt=/''/g,JLt=/[a-zA-Z]/;function eDt(e,t,n){var u,d,f,h;const r=bT(),a=r.locale??NLt,i=r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=r.weekStartsOn??((h=(f=r.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??0,s=Bs(e,n==null?void 0:n.in);if(!tLt(s))throw new RangeError("Invalid time value");let l=t.match(XLt).map(g=>{const m=g[0];if(m==="p"||m==="P"){const v=zLt[m];return v(g,a.formatLong)}return g}).join("").match(YLt).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const m=g[0];if(m==="'")return{isToken:!1,value:tDt(g)};if(lre[m])return{isToken:!0,value:g};if(m.match(JLt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:g}});a.localize.preprocessor&&(l=a.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return l.map(g=>{if(!g.isToken)return g.value;const m=g.value;(VLt(m)||qLt(m))&&GLt(m,t,String(e));const v=lre[m[0]];return v(s,m,a.localize,c)}).join("")}function tDt(e){const t=e.match(ZLt);return t?t[1].replace(QLt,"'"):e}const{useToken:nDt}=pn,{Text:nx}=Qt,rDt=({images:e,className:t,style:n,maxHeight:r={single:400,multiple:200}})=>{const{token:a}=nDt();return!e||e.length===0?null:E.jsx(Ot,{className:t,style:{marginBottom:a.marginMD,...n},styles:{body:{padding:0}},variant:"borderless",children:E.jsx(rt,{wrap:"wrap",gap:a.marginSM,style:{width:"100%"},children:e.map(i=>E.jsxs(Ot,{size:"small",style:{flex:e.length===1?"1 1 100%":"1 1 200px",overflow:"hidden",borderRadius:a.borderRadius,border:`1px solid ${a.colorBorderSecondary}`,backgroundColor:a.colorBgLayout},styles:{body:{padding:0}},children:[E.jsxs("div",{style:{position:"relative"},children:[E.jsx(sue,{src:i.url||i.base64,alt:i.name,style:{width:"100%",height:"auto",maxHeight:e.length===1?r.single:r.multiple,objectFit:"cover"},preview:{mask:E.jsxs(rt,{align:"center",justify:"center",gap:a.marginXS,style:{color:a.colorTextLightSolid},children:[E.jsx(rF,{}),E.jsx(nx,{style:{color:a.colorTextLightSolid},children:"Preview"})]})}}),E.jsxs(rt,{vertical:!0,style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(transparent, rgba(0,0,0,0.7))",color:a.colorTextLightSolid,padding:`${a.paddingXS}px ${a.paddingSM}px`,fontSize:a.fontSizeSM},children:[E.jsx(nx,{style:{color:a.colorTextLightSolid},strong:!0,children:i.name}),i.size&&E.jsxs(nx,{style:{fontSize:a.fontSizeSM*.85,opacity:.8,color:a.colorTextLightSolid},children:[(i.size/1024).toFixed(1)," KB",i.width&&i.height&&` • ${i.width}×${i.height}`]})]})]}),(i.ocrText||i.ocrError)&&E.jsx("div",{style:{padding:a.paddingSM},children:E.jsx(gl,{ghost:!0,size:"small",items:[{key:"ocr",label:"OCR",children:E.jsxs(E.Fragment,{children:[i.ocrError&&E.jsx(nx,{type:"danger",children:i.ocrError}),i.ocrText&&E.jsx(Qt.Paragraph,{style:{marginTop:i.ocrError?a.marginXS:0,marginBottom:0,whiteSpace:"pre-wrap"},children:i.ocrText})]})}]})})]},i.id))})})},{useToken:aDt}=pn,{useBreakpoint:iDt}=CE,oDt=({buttons:e,isVisible:t,className:n,style:r,position:a={bottom:"8px",right:"8px"}})=>{const{token:i}=aDt(),o=iDt(),s=()=>(o.xs,"small");return E.jsx(rt,{justify:"flex-end",gap:i.marginXS,className:n,style:{marginTop:i.marginXS,position:"absolute",bottom:a.bottom,right:a.right,top:a.top,left:a.left,background:"transparent",zIndex:1,opacity:t?1:0,transition:"opacity 0.2s ease",pointerEvents:t?"auto":"none",...r},children:e.map(l=>E.jsx(wn,{title:l.title,children:E.jsx(De,{"data-testid":l["data-testid"]||l.key,icon:l.icon,size:s(),type:"text",onClick:l.onClick,disabled:l.disabled,style:{background:i.colorBgElevated,borderRadius:i.borderRadiusSM}})},l.key))})},sDt=e=>({key:"copy","data-testid":"copy-message",icon:E.jsx(Go,{}),title:"Copy message",onClick:e}),lDt=e=>({key:"reference",icon:E.jsx(mde,{}),title:"Reference message",onClick:e}),{Title:fre,Text:$o,Paragraph:pre}=Qt,{useToken:cDt}=pn,uDt=({plan:e,contextId:t,onExecute:n,onRefine:r,timestamp:a})=>{const{token:i}=cDt(),[o,s]=p.useState(!1),[l,c]=p.useState(""),u=()=>{l.trim()&&(r(l),c(""),s(!1))};return E.jsxs(Ot,{style:{marginBottom:i.marginMD,borderColor:i.colorPrimary,borderWidth:2,backgroundColor:i.colorPrimaryBg},title:E.jsxs(He,{children:[E.jsx(Hl,{style:{color:i.colorPrimary}}),E.jsx($o,{strong:!0,style:{color:i.colorPrimary},children:"Execution Plan"})]}),extra:a?E.jsx($o,{type:"secondary",style:{fontSize:i.fontSizeSM},children:a}):void 0,children:[E.jsxs(rt,{vertical:!0,style:{marginBottom:i.marginLG},children:[E.jsx(fre,{level:5,style:{marginBottom:i.marginXS},children:"Goal"}),E.jsx(pre,{style:{fontSize:15,marginBottom:0},children:e.goal})]}),E.jsxs(rt,{vertical:!0,style:{marginBottom:i.marginLG},children:[E.jsx(fre,{level:5,style:{marginBottom:i.marginMD},children:"Steps"}),E.jsx(zB,{direction:"vertical",current:-1,items:e.steps.map(d=>({title:E.jsxs($o,{strong:!0,children:["Step ",d.step_number,": ",d.action]}),description:E.jsxs(rt,{vertical:!0,children:[E.jsxs(pre,{style:{marginBottom:i.marginXS},children:[E.jsx($o,{type:"secondary",children:"Reason:"})," ",d.reason]}),E.jsxs(He,{wrap:!0,children:[E.jsxs($o,{type:"secondary",children:[E.jsx(t0,{})," Tools:"]}),d.tools_needed.map((f,h)=>E.jsx(Dn,{color:"blue",children:f},h))]}),E.jsx(rt,{style:{marginTop:i.marginXS},children:E.jsxs($o,{type:"secondary",children:[E.jsx(Nw,{})," Estimated: ",d.estimated_time]})})]}),icon:E.jsx($o,{children:d.step_number})}))})]}),E.jsxs(He,{direction:"vertical",style:{width:"100%",marginBottom:i.marginLG},children:[E.jsxs(rt,{align:"center",gap:i.marginXS,wrap:"wrap",children:[E.jsxs($o,{type:"secondary",children:[E.jsx(Nw,{})," Total Estimated Time:"," "]}),E.jsx(Dn,{color:"blue",children:e.estimated_total_time})]}),e.prerequisites&&e.prerequisites.length>0&&E.jsxs(rt,{vertical:!0,children:[E.jsx($o,{type:"secondary",children:"Prerequisites:"}),E.jsx(jr,{size:"small",dataSource:e.prerequisites,renderItem:(d,f)=>E.jsx(jr.Item,{style:{padding:0},children:E.jsx($o,{children:d})},`${d}-${f}`)})]})]}),e.risks&&e.risks.length>0&&E.jsx(gl,{ghost:!0,style:{marginBottom:i.marginLG},items:[{key:"risks",label:E.jsxs(He,{children:[E.jsx(lF,{style:{color:i.colorWarning}}),E.jsxs($o,{strong:!0,children:["Potential Risks (",e.risks.length,")"]})]}),children:E.jsx(jr,{size:"small",dataSource:e.risks,renderItem:(d,f)=>E.jsx(jr.Item,{style:{padding:0},children:E.jsx($o,{children:d})},`${d}-${f}`)})}]}),E.jsx(He,{style:{width:"100%",justifyContent:"flex-end"},children:o?E.jsxs(E.Fragment,{children:[E.jsx(De,{onClick:()=>s(!1),children:"Cancel"}),E.jsx(De,{type:"primary",onClick:u,disabled:!l.trim(),children:"Send Feedback"})]}):E.jsxs(E.Fragment,{children:[E.jsx(De,{onClick:()=>s(!0),children:"Refine Plan"}),E.jsx(De,{type:"primary",icon:E.jsx(AVe,{}),onClick:n,children:"Execute Plan"})]})}),o&&E.jsx(rt,{vertical:!0,style:{marginTop:i.marginMD},children:E.jsx(tn.TextArea,{value:l,onChange:d=>c(d.target.value),placeholder:"Provide feedback to refine the plan...",autoSize:{minRows:4,maxRows:10}})})]})},CCe=p.memo(uDt);CCe.displayName="PlanMessageCard";const{Title:dDt,Text:Zf,Paragraph:fDt}=Qt,{useToken:pDt}=pn,hDt=({question:e,contextId:t,onAnswer:n,disabled:r=!1,timestamp:a})=>{const{token:i}=pDt(),[o,s]=p.useState(e.default),[l,c]=p.useState(!1),u=async()=>{if(o){c(!0);try{await n(o)}catch(g){console.error("Failed to submit answer:",g)}finally{c(!1)}}},d=()=>{switch(e.severity){case"critical":return E.jsx(LE,{style:{color:i.colorError}});case"major":return E.jsx(lF,{style:{color:i.colorWarning}});case"minor":return E.jsx(zi,{style:{color:i.colorInfo}});default:return E.jsx(mVe,{style:{color:i.colorPrimary}})}},f=()=>{switch(e.severity){case"critical":return i.colorErrorBg;case"major":return i.colorWarningBg;case"minor":return i.colorInfoBg;default:return i.colorPrimaryBg}},h=()=>{switch(e.severity){case"critical":return i.colorError;case"major":return i.colorWarning;case"minor":return i.colorInfo;default:return i.colorPrimary}};return E.jsxs(Ot,{style:{marginBottom:i.marginMD,borderColor:h(),borderWidth:2,backgroundColor:f()},title:E.jsxs(He,{children:[d(),E.jsx(Zf,{strong:!0,style:{color:h()},children:"Agent Question"}),E.jsxs(Zf,{type:"secondary",style:{fontSize:12},children:["(",e.severity,")"]})]}),extra:a?E.jsx(Zf,{type:"secondary",style:{fontSize:i.fontSizeSM},children:a}):void 0,children:[E.jsx(rt,{vertical:!0,style:{marginBottom:i.marginLG},children:E.jsx(dDt,{level:5,style:{marginBottom:i.marginXS},children:e.question})}),e.context&&E.jsx(fr,{message:"Context",description:e.context,type:"info",showIcon:!0,style:{marginBottom:i.marginLG}}),E.jsxs(rt,{vertical:!0,style:{marginBottom:i.marginLG},children:[E.jsx(Zf,{strong:!0,style:{display:"block",marginBottom:i.marginSM},children:"Please choose an option:"}),E.jsx(Xa.Group,{value:o,onChange:g=>s(g.target.value),disabled:r||l,style:{width:"100%"},children:E.jsx(He,{direction:"vertical",style:{width:"100%"},children:e.options.map(g=>E.jsx(Ot,{size:"small",hoverable:!r&&!l,style:{borderColor:o===g.value?i.colorPrimary:i.colorBorder,backgroundColor:o===g.value?i.colorPrimaryBg:i.colorBgContainer,cursor:r||l?"not-allowed":"pointer"},onClick:()=>!r&&!l&&s(g.value),children:E.jsx(Xa,{value:g.value,style:{width:"100%"},children:E.jsxs(rt,{vertical:!0,children:[E.jsxs(rt,{align:"center",gap:i.marginXS,wrap:"wrap",children:[E.jsx(Zf,{strong:!0,children:g.label}),g.value===e.default&&E.jsx(Dn,{color:"blue",style:{marginLeft:i.marginXS},children:"Recommended"})]}),E.jsx(fDt,{type:"secondary",style:{marginTop:i.marginXXS,marginBottom:0},children:g.description})]})})},g.value))})})]}),e.allow_custom&&E.jsxs(rt,{vertical:!0,style:{marginBottom:i.marginMD},children:[E.jsx(Zf,{type:"secondary",style:{fontSize:12},children:"Or provide a custom answer:"}),E.jsx(tn.TextArea,{value:o&&!e.options.find(g=>g.value===o)?o:"",onChange:g=>s(g.target.value),placeholder:"Enter custom answer...",disabled:r||l,autoSize:{minRows:3,maxRows:8},style:{marginTop:i.marginXS}})]}),E.jsx(rt,{justify:"flex-end",children:E.jsx(De,{type:"primary",icon:E.jsx(Hl,{}),onClick:u,loading:l,disabled:r||!o,children:"Submit Answer"})})]})},ECe=p.memo(hDt);ECe.displayName="QuestionMessageCard";const{Text:hre}=Qt,gDt=({paths:e,displayText:t})=>{const{token:n}=pn.useToken(),r=t.replace(/@[^\s]+/g,"").trim();return E.jsxs(Ot,{size:"small",styles:{body:{padding:`${n.paddingSM}px ${n.paddingMD}px`}},style:{maxWidth:"100%"},children:[E.jsx(He,{direction:"vertical",size:n.marginXXS,children:e.map((a,i)=>{const o=a.split("/").pop()||a,s=a.substring(0,a.lastIndexOf("/"))||"",l=!o.includes(".");return E.jsxs(rt,{vertical:!0,children:[E.jsxs(He,{size:n.marginXS,align:"center",wrap:!0,children:[l?E.jsx(Y7,{style:{color:n.colorWarning,fontSize:n.fontSizeLG}}):E.jsx(bde,{style:{color:n.colorPrimary,fontSize:n.fontSizeLG}}),E.jsx(Dn,{color:l?"orange":"blue",style:{margin:0,fontFamily:n.fontFamilyCode,fontSize:n.fontSize},children:o})]}),s&&E.jsx(wn,{title:a,children:E.jsxs(He,{size:4,align:"center",style:{marginTop:4},children:[E.jsx(Y7,{style:{color:n.colorTextTertiary,fontSize:n.fontSizeSM}}),E.jsx(hre,{type:"secondary",style:{fontSize:n.fontSizeSM,fontFamily:n.fontFamilyCode,maxWidth:"400px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},copyable:{text:a},children:s})]})})]},i)})}),r&&E.jsx(hre,{style:{fontSize:n.fontSize,color:n.colorText,marginTop:n.marginXS,paddingTop:n.marginXS,borderTop:`1px solid ${n.colorBorderSecondary}`},children:r})]})},_Ce=p.memo(gDt);_Ce.displayName="FileReferenceCard";const mDt=({taskList:e})=>{const{token:t}=pn.useToken(),{Text:n}=Qt,r=s=>{switch(s){case"pending":return E.jsx(Dn,{icon:E.jsx(Nw,{}),color:"default",children:"Pending"});case"in_progress":return E.jsx(Dn,{icon:E.jsx(DE,{spin:!0}),color:"processing",children:"In Progress"});case"completed":return E.jsx(Dn,{icon:E.jsx(Hl,{}),color:"success",children:"Completed"});case"skipped":return E.jsx(Dn,{icon:E.jsx(jP,{}),color:"default",children:"Skipped"});case"failed":return E.jsx(Dn,{icon:E.jsx(cP,{}),color:"error",children:"Failed"});default:return null}},a=()=>{switch(e.status){case"active":return E.jsx(Dn,{color:"processing",children:"Active"});case"completed":return E.jsx(Dn,{color:"success",children:"Completed"});case"abandoned":return E.jsx(Dn,{color:"error",children:"Abandoned"});default:return null}},i=U.useMemo(()=>{if(e.items.length===0)return 0;const s=e.items.filter(l=>l.status==="completed").length;return Math.round(s/e.items.length*100)},[e.items]),o=U.useMemo(()=>e.items.find(s=>s.status==="in_progress"),[e.items]);return E.jsx(Ot,{size:"small",styles:{body:{padding:t.paddingSM}},style:{borderRadius:t.borderRadiusLG},children:E.jsxs(rt,{vertical:!0,gap:t.marginSM,children:[E.jsxs(rt,{align:"center",justify:"space-between",wrap:"wrap",gap:"small",children:[E.jsxs(He,{direction:"vertical",size:2,children:[E.jsx(n,{strong:!0,children:e.title}),e.description?E.jsx(n,{type:"secondary",children:e.description}):null]}),a()]}),E.jsxs(He,{direction:"vertical",size:4,children:[E.jsx($E,{percent:i,status:e.status==="completed"?"success":e.status==="abandoned"?"exception":"active",showInfo:!0}),E.jsxs(n,{type:"secondary",children:[i,"% Complete"]})]}),E.jsx(jr,{size:"small",dataSource:e.items,renderItem:s=>{var c;const l=(o==null?void 0:o.id)===s.id;return E.jsx(jr.Item,{style:{borderRadius:t.borderRadius,padding:t.paddingXS,background:l?t.colorPrimaryBg:"transparent",border:"1px solid",borderColor:l?t.colorPrimaryBorder:t.colorBorderSecondary},children:E.jsxs(rt,{vertical:!0,style:{width:"100%"},gap:4,children:[E.jsxs(rt,{align:"center",justify:"space-between",wrap:"wrap",gap:8,children:[E.jsx(n,{children:s.description}),r(s.status)]}),s.status==="failed"&&((c=s.metadata)!=null&&c.error)?E.jsx(n,{type:"danger",style:{fontSize:12},children:s.metadata.error}):null]})})}}),E.jsxs(rt,{align:"center",justify:"space-between",wrap:"wrap",gap:"small",children:[E.jsxs(n,{type:"secondary",style:{fontSize:12},children:[e.items.filter(s=>s.status==="completed").length," /"," ",e.items.length," tasks completed"]}),o?E.jsxs(n,{type:"secondary",style:{fontSize:12},children:["Current: ",o.description]}):null]})]})})},vDt=100,Hu=new Set;function bDt(e){if(Hu.has(e)&&Hu.delete(e),Hu.add(e),Hu.size>vDt){const t=Hu.values().next().value;t&&Hu.delete(t)}}function yDt(e){let t=2166136261;for(let n=0;n<e.length;n++)t=(t^e.charCodeAt(n))*16777619;return(t>>>0).toString(36)}const SDt=e=>{const t=yDt(e.chart),[n,r]=p.useState(()=>Hu.has(t)),a=p.useRef(null);return p.useEffect(()=>{if(n)return;const i=a.current;if(!i)return;const o=new IntersectionObserver(s=>{s.some(l=>l.isIntersecting)&&(bDt(t),r(!0),o.disconnect())},{rootMargin:"50px",threshold:.01});return o.observe(i),()=>o.disconnect()},[n,t]),E.jsx("div",{ref:a,style:{minHeight:n?"auto":"200px"},children:n?E.jsx(U.Suspense,{fallback:E.jsx(ia,{size:"small",tip:"Loading diagram..."}),children:E.jsx(xDt,{...e})}):E.jsx("div",{style:{minHeight:"200px"}})})},xDt=e=>{const[t,n]=p.useState(null);return p.useEffect(()=>{let r=!1;return Mn(()=>Promise.resolve().then(()=>Kjt),void 0,import.meta.url).then(a=>{r||n(()=>a.MermaidChart)}),()=>{r=!0}},[]),t?E.jsx(t,{...e}):E.jsx(ia,{size:"small",tip:"Loading diagram..."})},wDt=U.memo(SDt),CDt=({error:e,className:t,style:n,token:r,onFix:a,isFixing:i,fixError:o})=>{const s=e.split(`
|
|
@@ -1027,7 +1027,7 @@ ${a}`:`${r}
|
|
|
1027
1027
|
${t}`},nBt=(e,t)=>{const n=Qjt[e];if(!n)return null;const r=t.trim();if(!r)return"";if(e==="mermaid")return r;const a=eBt(r);return Jjt.test(a)?r:tBt(r,n)},UCe=(e,t,n,r,a="lazy")=>{try{if(!t||typeof t!="string")return console.warn("Invalid codeString provided to renderCodeBlock:",t),null;const i=e.toLowerCase().trim(),o=nBt(i,t);if(o!==null){const s=o.trim();return s?a==="eager"?E.jsx(O1,{chart:s,onFix:r}):E.jsx(wDt,{chart:s,onFix:r}):(console.warn("Empty Mermaid chart content"),null)}return E.jsx(Zjt,{language:i,codeString:t,token:n})}catch(i){return console.warn("Syntax highlighting failed:",i),E.jsxs(Ot,{size:"small",styles:{body:{padding:0}},style:{position:"relative",margin:`${n.marginXS}px 0`},onMouseEnter:o=>{const s=o.currentTarget.querySelector(".fallback-copy-btn");s&&(s.style.display="block")},onMouseLeave:o=>{const s=o.currentTarget.querySelector(".fallback-copy-btn");s&&(s.style.display="none")},children:[E.jsx("pre",{style:{backgroundColor:n.colorBgContainer,border:`1px solid ${n.colorBorder}`,padding:n.padding,borderRadius:n.borderRadiusSM,overflow:"auto",fontSize:n.fontSizeSM,paddingRight:"50px",margin:0},children:E.jsx("code",{style:{color:n.colorText},children:t})}),E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),className:"fallback-copy-btn",onClick:async()=>{try{await Ko(t),vn.success("Code copied to clipboard")}catch(o){console.error("Copy failed:",o),vn.error("Copy failed")}},style:{position:"absolute",top:n.paddingSM,right:n.paddingSM,backgroundColor:"rgba(0, 0, 0, 0.6)",color:"white",border:"none",borderRadius:n.borderRadiusSM,display:"none",zIndex:10}})]})}},Cre=(e,t)=>{if(typeof window>"u")return;const n=window.open(e,"_blank","noopener,noreferrer");if(n){n.opener=null;return}((t==null?void 0:t.allowLocationFallback)??!0)&&window.location.assign(e)},WCe=async e=>{var r;const t=e.trim();if(!t)return;if(FCe()){const a=(r=window.__TAURI_INTERNALS__)==null?void 0:r.invoke;if(typeof a=="function")try{await a("plugin:shell|open",{path:t});return}catch(i){console.warn("[openExternalLink] Failed to open via Tauri shell plugin, falling back to browser open.",i)}Cre(t,{allowLocationFallback:!1});return}Cre(t)},{Text:Ere}=Qt,qCe=(e,t)=>({p:({children:n})=>E.jsx(Ere,{style:{marginBottom:e.marginSM,display:"block"},children:n}),ol:({children:n})=>E.jsx("ol",{style:{marginBottom:e.marginSM,paddingLeft:20},children:n}),ul:({children:n})=>E.jsx("ul",{style:{marginBottom:e.marginSM,paddingLeft:20},children:n}),li:({children:n})=>E.jsx("li",{style:{marginBottom:e.marginXS},children:n}),code({className:n,children:r,inline:a,...i}){const o=/language-([^\s]+)/i.exec(n||""),s=o?o[1]:"",l=a??(!o&&!n),c=r?String(r).replace(/\n$/,""):"";return l?E.jsx(Ere,{code:!0,className:n,...i,children:r}):c.trim()?UCe(s,c,e,t==null?void 0:t.onFixMermaid,t==null?void 0:t.mermaidRenderMode):null},blockquote:({children:n})=>E.jsx(Ot,{size:"small",styles:{body:{padding:`${e.paddingXS}px ${e.padding}px`}},style:{borderLeft:`3px solid ${e.colorPrimary}`,background:e.colorPrimaryBg,margin:`${e.marginXS}px 0`,color:e.colorTextSecondary,fontStyle:"italic"},children:n}),a:({children:n,href:r})=>{const a=typeof r=="string"?r.trim():"";return a?E.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:i=>{i.preventDefault(),i.stopPropagation(),WCe(a)},style:{color:e.colorLink,textDecoration:"underline",overflowWrap:"anywhere"},children:n}):E.jsx(E.Fragment,{children:n})},table:({children:n})=>E.jsx(Ot,{size:"small",styles:{body:{padding:0}},style:{overflow:"auto",margin:`${e.marginSM}px 0`},children:E.jsx("table",{style:{width:"100%",borderCollapse:"collapse",border:`1px solid ${e.colorBorder}`},children:n})}),thead:({children:n})=>E.jsx("thead",{style:{backgroundColor:e.colorBgContainer},children:n}),tbody:({children:n})=>E.jsx("tbody",{children:n}),tr:({children:n})=>E.jsx("tr",{style:{borderBottom:`1px solid ${e.colorBorder}`},children:n}),th:({children:n})=>E.jsx("th",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,textAlign:"left",fontWeight:"bold",borderRight:`1px solid ${e.colorBorder}`},children:n}),td:({children:n})=>E.jsx("td",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,borderRight:`1px solid ${e.colorBorder}`},children:n}),input:({type:n,checked:r,disabled:a})=>n==="checkbox"?E.jsx("input",{type:"checkbox",checked:r,disabled:a,style:{marginRight:e.marginXS,accentColor:e.colorPrimary},readOnly:!0}):E.jsx("input",{type:n,checked:r,disabled:a})}),{Text:oi}=Qt,rBt=({content:e,toolName:t,status:n="success",timestamp:r,defaultCollapsed:a=!0,isLoading:i,errorMessage:o})=>{var m;const{token:s}=pn.useToken(),l=p.useMemo(()=>qN(e),[e]),c=p.useMemo(()=>typeof i=="boolean"?i:l.formattedText.trim().length===0,[l.formattedText,i]),u=p.useMemo(()=>eat(l.formattedText),[l.formattedText]),d=p.useMemo(()=>g0(e),[e]),f=p.useMemo(()=>d?jhe(d.diff.unified):[],[d]),h=async()=>{try{const v=l.isJson?Jp(l.parsedJson):l.formattedText;await Ko(v)}catch(v){console.error("[ToolResultCard] Failed to copy result:",v)}},g=p.useMemo(()=>{const v=e?e.slice(0,50).replace(/[^a-zA-Z0-9]/g,""):"empty";return`tool-result-${t}-${v}`},[t,e]);return E.jsx(gl,{defaultActiveKey:a?[]:[g],style:{backgroundColor:s.colorBgContainer,borderColor:s.colorBorderSecondary,borderWidth:1,borderStyle:"solid",borderRadius:s.borderRadiusLG},items:[{key:g,label:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:s.marginSM,width:"100%"},children:[E.jsx(aF,{style:{color:s.colorPrimary,flexShrink:0}}),E.jsx(oi,{strong:!0,style:{color:s.colorText,flexShrink:0},children:t}),E.jsx(oi,{type:"secondary",ellipsis:!0,style:{flex:1,minWidth:0,fontSize:s.fontSizeSM},children:c?"Waiting…":u}),E.jsx(Dn,{color:Bhe(n),style:{flexShrink:0,margin:0},children:n})]}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:s.marginSM,children:[r&&E.jsx(oi,{type:"secondary",style:{fontSize:s.fontSizeSM},children:new Date(r).toLocaleString()}),o&&E.jsx(fr,{type:"error",message:"Tool execution failed",description:o,showIcon:!0}),E.jsxs("div",{style:{position:"relative"},children:[E.jsx(wn,{title:"Copy result",children:E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),"aria-label":"Copy result",onClick:v=>{v.stopPropagation(),h()},style:{position:"absolute",top:8,right:8,zIndex:1}})}),c?E.jsx(oi,{type:"secondary",children:"Waiting for tool result..."}):d?E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:8,children:[d.message&&E.jsx(oi,{style:{fontSize:s.fontSizeSM},children:d.message}),E.jsxs(oi,{style:{fontSize:s.fontSizeSM},children:[E.jsx(oi,{strong:!0,children:"File:"})," ",E.jsx(oi,{code:!0,children:d.file_path})]}),d.workspace&&E.jsxs(oi,{style:{fontSize:s.fontSizeSM},children:[E.jsx(oi,{strong:!0,children:"Workspace:"})," ",E.jsx(oi,{code:!0,children:d.workspace})]}),(m=d.checkpoint)!=null&&m.created?E.jsxs(oi,{style:{fontSize:s.fontSizeSM},children:[E.jsx(oi,{strong:!0,children:"Checkpoint:"})," ",E.jsx(oi,{code:!0,children:d.checkpoint.path})]}):E.jsx(oi,{type:"secondary",style:{fontSize:s.fontSizeSM},children:"Checkpoint: none (new file)"}),E.jsx("div",{style:{border:`1px solid ${s.colorBorderSecondary}`,borderRadius:s.borderRadiusSM,maxHeight:400,overflow:"auto",background:s.colorBgContainer},children:f.map((v,b)=>{const y={margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:s.fontSizeSM,lineHeight:1.5,padding:"0 8px",fontFamily:"Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"};return v.kind==="add"?y.background=s.colorSuccessBg:v.kind==="remove"?y.background=s.colorErrorBg:v.kind==="modified_add"?(y.background=s.colorWarningBg,y.borderLeft=`3px solid ${s.colorSuccess}`):v.kind==="modified_remove"?(y.background=s.colorWarningBg,y.borderLeft=`3px solid ${s.colorError}`):v.kind==="hunk"?(y.background=s.colorFillSecondary,y.color=s.colorTextSecondary):v.kind==="meta"&&(y.background=s.colorFillTertiary,y.color=s.colorTextSecondary),E.jsx("pre",{style:y,children:v.text||" "},`${b}-${v.kind}`)})}),d.diff.truncated&&E.jsx(oi,{type:"secondary",style:{fontSize:s.fontSizeSM},children:"Diff truncated for display."})]}):l.isJson?E.jsx(Id,{language:"json",style:Ad,wrapLongLines:!0,customStyle:{margin:0,borderRadius:s.borderRadiusSM,backgroundColor:s.colorBgContainer,fontSize:s.fontSizeSM,maxHeight:400,overflow:"auto"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:l.formattedText}):E.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:s.fontSizeSM,backgroundColor:s.colorBgContainer,padding:s.paddingSM,borderRadius:s.borderRadiusSM,margin:0,maxHeight:400,overflow:"auto"},children:l.formattedText})]})]})}]})},mU=p.memo(rBt);mU.displayName="ToolResultCard";const{Text:Us}=Qt;function aBt(e,t){const n=Yd(e);if(n)return`MCP ${n.serverId}: ${n.toolName}`;const r=(o,s)=>{const l=typeof o=="string"?o:String(o??"");return!l||l.length<=s?l:l.substring(0,s).trimEnd()+"…"},a={file_read:o=>`Reading: ${r(o.path||o.file_path||"unknown",40)}`,file_write:o=>`Writing to: ${r(o.path||o.file_path||"unknown",35)}`,file_edit:o=>`Editing: ${r(o.path||o.file_path||"unknown",40)}`,bash:o=>`Executing: ${r(o.command,40)}`,grep:o=>`Searching: "${r(o.pattern,30)}"`,glob:o=>`Finding files: "${o.pattern}"`,read:o=>`Reading: ${o.file_path||"file"}`,write:o=>`Writing: ${o.file_path||"file"}`,edit:o=>`Editing: ${o.file_path||"file"}`,search:o=>`Searching: "${r(o.query||o.pattern,30)}"`,default:()=>`Calling ${e}`};return(a[e]||a.default)(t)}const iBt=({toolName:e,parameters:t,toolCallId:n,streamingOutput:r,defaultExpanded:a=!1})=>{const{token:i}=pn.useToken(),o=p.useMemo(()=>Yd(e),[e]),[s,l]=p.useState(a?[n]:[]),c=p.useRef(!1),u=p.useRef(null);p.useEffect(()=>{c.current||!r||r.trim().length===0||(l(m=>m.includes(n)?m:[n]),c.current=!0)},[r,n]),p.useEffect(()=>{if(!r||r.trim().length===0||!s.includes(n))return;const m=u.current;m&&(m.scrollTop=m.scrollHeight)},[r,s,n]);const d=p.useMemo(()=>aBt(e,t),[e,t]),f=p.useMemo(()=>Jp(t,2),[t]),h=async()=>{try{await Ko(f)}catch(m){console.error("[ToolCallCard] Failed to copy parameters:",m)}},g=p.useMemo(()=>{const m=["path","file_path","command","pattern","query","limit"];return Object.entries(t).sort((y,S)=>{const C=m.indexOf(y[0]),x=m.indexOf(S[0]);return C!==-1&&x!==-1?C-x:C!==-1?-1:x!==-1?1:0}).slice(0,3)},[t]);return E.jsx(gl,{activeKey:s,onChange:m=>{const v=Array.isArray(m)?m.map(String):m==null?[]:[String(m)];l(v),v.includes(n)&&(c.current=!0)},style:{backgroundColor:i.colorInfoBg,borderColor:i.colorInfoBorder,borderWidth:1,borderStyle:"solid",borderRadius:i.borderRadiusLG},items:[{key:n,label:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:i.marginSM,width:"100%"},children:[E.jsx(t0,{style:{color:i.colorPrimary,flexShrink:0}}),o?E.jsxs(He,{size:"small",wrap:!1,children:[E.jsx(Dn,{color:"purple",style:{marginInlineEnd:0},children:"MCP"}),E.jsx(Us,{strong:!0,style:{color:i.colorText},children:o.toolName}),E.jsx(Us,{type:"secondary",style:{fontSize:i.fontSizeSM},children:E.jsx(Us,{code:!0,style:{fontSize:i.fontSizeSM},children:o.serverId})})]}):E.jsx(Us,{strong:!0,style:{color:i.colorText,flexShrink:0},children:e}),E.jsx(Us,{type:"secondary",ellipsis:!0,style:{flex:1,minWidth:0,fontSize:i.fontSizeSM},children:d})]}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:i.marginSM,children:[r&&r.trim().length>0&&E.jsxs("div",{children:[E.jsx(Us,{strong:!0,style:{fontSize:i.fontSizeSM},children:"Live output:"}),E.jsx("div",{ref:u,style:{marginTop:i.marginXS,borderRadius:i.borderRadiusSM,backgroundColor:i.colorBgContainer,maxHeight:240,overflow:"auto"},children:E.jsx(Id,{language:"text",style:Ad,wrapLongLines:!0,customStyle:{margin:0,backgroundColor:"transparent",fontSize:i.fontSizeSM},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:r})})]}),g.length>0&&E.jsxs("div",{children:[E.jsx(Us,{strong:!0,style:{fontSize:i.fontSizeSM,marginBottom:i.marginXS,display:"block"},children:"Key parameters:"}),E.jsx("ul",{style:{margin:0,paddingLeft:i.paddingLG,fontSize:i.fontSizeSM},children:g.map(([m,v])=>E.jsxs("li",{children:[E.jsx(Us,{code:!0,style:{fontSize:i.fontSizeSM},children:m}),E.jsxs(Us,{style:{fontSize:i.fontSizeSM},children:[":"," ",typeof v=="string"?v:JSON.stringify(v)]})]},m))})]}),E.jsxs("div",{children:[E.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:i.marginXS},children:[E.jsx(Us,{strong:!0,style:{fontSize:i.fontSizeSM},children:"Full parameters:"}),E.jsx(wn,{title:"Copy parameters",children:E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),"aria-label":"Copy parameters",onClick:m=>{m.stopPropagation(),h()}})})]}),E.jsx(Id,{language:"json",style:Ad,wrapLongLines:!0,customStyle:{margin:0,borderRadius:i.borderRadiusSM,backgroundColor:i.colorBgContainer,fontSize:i.fontSizeSM,maxHeight:400,overflow:"auto"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})]})]})}]})},vU=p.memo(iBt);vU.displayName="ToolCallCard";const{Text:r2}=Qt,oBt=({content:e,workflowName:t,parameters:n,status:r="success",timestamp:a,onRetry:i,isLoading:o,errorMessage:s})=>{const{token:l}=pn.useToken(),[c,u]=p.useState(!1),d=p.useMemo(()=>qN(e),[e]),f=p.useMemo(()=>typeof o=="boolean"?o:d.formattedText.trim().length===0,[d.formattedText,o]),h=p.useMemo(()=>Qrt(d.formattedText),[d.formattedText]),g=d.isJson||h,m=!g||c,v=p.useMemo(()=>Jrt(d.formattedText),[d.formattedText]),b=p.useMemo(()=>{if(n==null)return null;if(typeof n=="string")return qN(n);try{return{isJson:!0,formattedText:JSON.stringify(n,null,2),parsedJson:n}}catch(C){return console.error("[WorkflowResultCard] Failed to stringify parameters:",C),{isJson:!1,formattedText:String(n)}}},[n]),y=async()=>{try{const C=d.isJson?Jp(d.parsedJson):d.formattedText;await Ko(C)}catch(C){console.error("[WorkflowResultCard] Failed to copy content:",C)}},S=async()=>{if(b)try{const C=b.isJson?Jp(b.parsedJson):b.formattedText;await Ko(C)}catch(C){console.error("[WorkflowResultCard] Failed to copy parameters:",C)}};return E.jsx(Ot,{size:"small",variant:"outlined",style:{borderRadius:l.borderRadiusLG,borderColor:l.colorBorderSecondary,backgroundColor:l.colorBgContainer},bodyStyle:{padding:l.paddingMD},children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:l.marginSM,children:[E.jsxs(rt,{align:"center",justify:"space-between",children:[E.jsxs(He,{size:l.marginXS,align:"center",children:[E.jsx(r7e,{style:{color:l.colorWarning}}),E.jsx(r2,{strong:!0,children:"User Workflow"}),E.jsx(Dn,{color:l.colorWarning,children:t}),E.jsx(Dn,{color:Bhe(r),children:r})]}),E.jsxs(He,{size:"small",children:[E.jsx(wn,{title:c?"Collapse result":"Expand result",children:g&&E.jsx(De,{type:"text",size:"small",icon:c?E.jsx(k7e,{}):E.jsx(D7e,{}),onClick:()=>u(C=>!C)})}),E.jsx(wn,{title:"Copy result",children:E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),onClick:y})}),i&&E.jsx(wn,{title:"Retry workflow",children:E.jsx(De,{type:"text",size:"small",icon:E.jsx(Zl,{}),onClick:i})})]})]}),a&&E.jsx(r2,{type:"secondary",style:{fontSize:l.fontSizeSM},children:new Date(a).toLocaleString()}),E.jsx(nl,{style:{margin:`${l.marginXS}px 0`}}),s&&E.jsx(fr,{type:"error",message:"Workflow execution failed",description:s,showIcon:!0,style:{marginBottom:l.marginXS}}),E.jsx(rt,{vertical:!0,style:{width:"100%"},children:f?E.jsx(ia,{tip:"Waiting for workflow result..."}):d.isJson?E.jsx(Id,{language:"json",style:Ad,wrapLongLines:!0,customStyle:{margin:0,borderRadius:l.borderRadiusSM,backgroundColor:l.colorBgContainer,fontSize:l.fontSizeSM,maxHeight:m?"none":280,overflow:m?"auto":"hidden"},children:d.formattedText}):E.jsxs("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:l.fontSizeSM,maxHeight:m?"none":280,overflow:m?"visible":"hidden",marginBottom:0},children:[m?d.formattedText:v.preview,!m&&v.isTruncated&&`
|
|
1028
1028
|
…`]})}),b&&E.jsxs(rt,{vertical:!0,style:{width:"100%"},children:[E.jsx(nl,{style:{margin:`${l.marginXS}px 0`},children:E.jsxs(He,{size:"small",children:[E.jsx(r2,{strong:!0,children:"Parameters"}),E.jsx(wn,{title:"Copy parameters",children:E.jsx(De,{type:"text",size:"small",icon:E.jsx(Go,{}),onClick:S})})]})}),b.isJson?E.jsx(Id,{language:"json",style:Ad,wrapLongLines:!0,customStyle:{margin:0,borderRadius:l.borderRadiusSM,backgroundColor:l.colorBgContainer,fontSize:l.fontSizeSM,maxHeight:220,overflow:"auto"},children:b.formattedText}):E.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:l.fontSizeSM,marginBottom:0},children:b.formattedText})]})]})})},VCe=p.memo(oBt);VCe.displayName="WorkflowResultCard";const{Text:rs}=Qt,sBt=e=>{var i;if(!e)return{cleanText:e,hints:[]};const t=e.split(`
|
|
1029
1029
|
`),n=[],r=[];for(const o of t){const s=o.trim(),l=s.match(/^\[User explicitly selected MCP tool:\s*(.+?)\s*\]$/);if(l){const u=l[1]??"",d=Yd(u);n.push({type:"mcp",label:u,serverId:d==null?void 0:d.serverId,toolName:d==null?void 0:d.toolName});continue}const c=s.match(/^\[User explicitly selected skill:\s*(.+?)\s*\]$/);if(c){const u=c[1]??"",d=u.match(/\(ID:\s*([^)]+)\)\s*$/i),f=(i=d==null?void 0:d[1])==null?void 0:i.trim(),h=d?u.replace(/\(ID:\s*([^)]+)\)\s*$/i,"").trim():u;n.push({type:"skill",label:h||u,skillId:f});continue}r.push(o)}return{cleanText:r.join(`
|
|
1030
|
-
`).trimStart(),hints:n}},lBt=({message:e,messageText:t,isUserToolCall:n,formatUserToolCall:r,markdownComponents:a,markdownPlugins:i,rehypePlugins:o})=>{var d;if(cCe(e)){const f=e.result.result??"",h=e.isError?f||"Tool execution failed.":void 0,g=!h&&f.trim().length===0;return e.result.display_preference==="Hidden"?null:E.jsx(mU,{content:f,toolName:e.toolName,status:e.isError?"error":g?"warning":"success",timestamp:e.createdAt,defaultCollapsed:!0,isLoading:g,errorMessage:h})}if(GMt(e)){const f=e.content??"",h=e.status==="error"?f||"Workflow execution failed.":void 0,g=!h&&f.trim().length===0;return E.jsx(VCe,{content:f,workflowName:e.workflowName,parameters:e.parameters,status:g?"warning":e.status??"success",timestamp:e.createdAt,isLoading:g,errorMessage:h})}if(VMt(e))return E.jsx(He,{direction:"vertical",style:{width:"100%"},children:e.toolCalls.map(f=>E.jsx(vU,{toolName:f.toolName,parameters:f.parameters,toolCallId:f.toolCallId,streamingOutput:f.streamingOutput,defaultExpanded:!1},f.toolCallId))});if(e.isAuthError)return E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"middle",children:[E.jsx(fr,{message:"Authentication Required",description:E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:t}),type:"error",showIcon:!0}),E.jsx(De,{type:"primary",icon:E.jsx(iF,{}),onClick:()=>{window.location.hash="/settings"},children:"Go to Settings"})]});const{cleanText:s,hints:l}=e.role==="user"?sBt(t):{cleanText:t,hints:[]},c=e.role==="assistant"&&e.type==="text"&&typeof((d=e.metadata)==null?void 0:d.reasoning)=="string"?e.metadata.reasoning:"",u=c.trim().length>0;return e.role==="assistant"&&!t&&!u?E.jsx(rs,{italic:!0,children:"Assistant is thinking..."}):E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"small",children:[u?E.jsx(gl,{size:"small",defaultActiveKey:["reasoning"],items:[{key:"reasoning",label:E.jsx(rs,{strong:!0,children:"Reasoning"}),children:E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:c})}]}):null,l.map((f,h)=>f.type==="mcp"?E.jsx(fr,{type:"info",showIcon:!1,message:E.jsxs(He,{wrap:!0,size:"small",children:[E.jsx(Dn,{color:"purple",children:"MCP"}),E.jsx(rs,{strong:!0,children:"Selected tool"}),f.serverId&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.serverId})}),f.toolName&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.toolName})})]}),style:{marginBottom:0}},`hint-mcp-${h}`):E.jsx(fr,{type:"success",showIcon:!1,message:E.jsxs(He,{wrap:!0,size:"small",children:[E.jsx(Dn,{color:"green",children:"Skill"}),E.jsx(rs,{strong:!0,children:"Selected"}),f.label&&E.jsx(rs,{children:f.label}),f.skillId&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.skillId})})]}),style:{marginBottom:0}},`hint-skill-${h}`)),s?E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:n?r(s):s}):null]})},cBt=p.memo(lBt),{Text:_re}=Qt,uBt=({role:e,formattedTimestamp:t,token:n})=>E.jsxs(rt,{align:"baseline",justify:"space-between",gap:n.marginXS,children:[E.jsx(_re,{type:"secondary",strong:!0,style:{fontSize:n.fontSizeSM},children:e==="user"?"You":e==="assistant"?"Assistant":e}),t&&E.jsx(_re,{type:"secondary",style:{fontSize:n.fontSizeSM,whiteSpace:"nowrap"},children:t})]}),bU=e=>{if(e.includes("```json")){const t=e.indexOf("```json")+7,n=e.indexOf("```",t);if(n>t)return e.substring(t,n).trim()}else if(e.includes("{")){const t=e.indexOf("{"),n=e.lastIndexOf("}");if(n>t)return e.substring(t,n+1).trim()}return null},dBt=e=>e==="text"||e==="plan"||e==="question"||e==="tool_call"||e==="tool_result",fBt=(e,t)=>{if(t)return t;if("message_type"in e&&e.message_type){const n=e.message_type;if(dBt(n))return n}if(e.role==="assistant"&&e.type==="text"){const n=typeof e.content=="string"?e.content:"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.goal&&a.steps&&Array.isArray(a.steps))return"plan";if(a.type==="question"&&a.question)return"question"}}catch{return"text"}}return"text"},pBt=(e,t)=>{if(t!=="plan"||e.role!=="assistant"||e.type!=="text")return null;const n=e.content??"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.goal&&a.steps)return{goal:a.goal,steps:a.steps.map(i=>({step_number:i.step_number||i.stepNumber||0,action:i.action||"",reason:i.reason||i.rationale||"",tools_needed:i.tools_needed||i.tools||[],estimated_time:i.estimated_time||i.estimatedTime||""})),estimated_total_time:a.estimated_total_time||a.estimatedTotalTime||"",risks:a.risks||[],prerequisites:a.prerequisites||[]}}}catch(r){console.error("Failed to parse plan:",r)}return null},hBt=(e,t)=>{if(t!=="question"||e.role!=="assistant"||e.type!=="text")return null;const n=e.content??"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.type==="question"&&a.question)return{type:"question",question:a.question,context:a.context||"",severity:a.severity||"minor",options:a.options||[],default:a.default,allow_custom:a.allow_custom||!1}}}catch(r){console.error("Failed to parse question:",r)}return null},GCe=e=>{if(e.role==="system")return typeof e.content=="string"?e.content:"";if(e.role==="user")return"type"in e&&e.type==="file_reference"?"":typeof e.content=="string"?e.content:"";if(e.role==="assistant"){if(e.type==="text")return typeof e.content=="string"?e.content:"";if(e.type==="tool_result")return`Tool ${e.toolName} Result: ${e.result.result}`;if(e.type==="tool_call")return`Requesting to call ${e.toolCalls.map(t=>t.toolName).join(", ")}`;if(e.type==="workflow_result")return e.content}return""},gBt=e=>{if(!e.startsWith("/"))return e;const t=e.split(" "),n=t[0].substring(1),r=t.slice(1).join(" ");if(n.startsWith("mcp__")){const i=n.slice(5),o=i.indexOf("__");if(o>0){const s=i.slice(0,o),l=i.slice(o+2);if(s&&l)return`🔌 MCP ${s}/${l}: ${r}`}}return`🔧 ${n.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}: ${r}`},Tre=e=>e.map(t=>({name:t.name,extensions:[...t.extensions]})),kre=e=>e.trim().slice(0,64).replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/-+/g,"-")||"message",mBt={marginSM:12,marginXS:6,paddingXS:6,paddingSM:10,padding:12,borderRadiusSM:8,fontSizeSM:12,colorPrimary:"#1677ff",colorPrimaryBg:"#e6f4ff",colorTextSecondary:"#595959",colorText:"#1f1f1f",colorLink:"#1677ff",colorBgContainer:"#ffffff",colorBorder:"#d9d9d9",boxShadowSecondary:"none"},vBt='[data-mermaid-loading="true"]';class KCe{static async exportMessageText(t){const{format:n,content:r,sessionId:a=null,messageId:i=null,filenamePrefix:o}=t,s=o||["chat-message",a?kre(a.slice(0,8)):null,i?kre(i.slice(0,8)):null].filter(Boolean).join("-"),l=n==="markdown"?Js.generateTimestampedFilename(s,"md"):Js.generateTimestampedFilename(s,"pdf");if(n==="markdown"){const c=await Js.saveTextFile(r,Tre(Js.FILTERS.MARKDOWN),l);return c.success?{success:!0,filename:c.filename}:{success:!1,error:c.error}}try{const c=await this.generatePdfFromText(r),u=await Js.saveBinaryFile(c,Tre(Js.FILTERS.PDF),l);return u.success?{success:!0,filename:u.filename}:{success:!1,error:u.error}}catch(c){return{success:!1,error:c instanceof Error?c.message:"Failed to export PDF"}}}static async generatePdfFromText(t){if(typeof document>"u")throw new Error("PDF export is unavailable in this environment");const n=(await Mn(async()=>{const{default:h}=await import("./html2canvas.esm-CBrSDip1.js");return{default:h}},[],import.meta.url)).default,{jsPDF:r}=await Mn(async()=>{const{jsPDF:h}=await import("./jspdf.es.min-
|
|
1030
|
+
`).trimStart(),hints:n}},lBt=({message:e,messageText:t,isUserToolCall:n,formatUserToolCall:r,markdownComponents:a,markdownPlugins:i,rehypePlugins:o})=>{var d;if(cCe(e)){const f=e.result.result??"",h=e.isError?f||"Tool execution failed.":void 0,g=!h&&f.trim().length===0;return e.result.display_preference==="Hidden"?null:E.jsx(mU,{content:f,toolName:e.toolName,status:e.isError?"error":g?"warning":"success",timestamp:e.createdAt,defaultCollapsed:!0,isLoading:g,errorMessage:h})}if(GMt(e)){const f=e.content??"",h=e.status==="error"?f||"Workflow execution failed.":void 0,g=!h&&f.trim().length===0;return E.jsx(VCe,{content:f,workflowName:e.workflowName,parameters:e.parameters,status:g?"warning":e.status??"success",timestamp:e.createdAt,isLoading:g,errorMessage:h})}if(VMt(e))return E.jsx(He,{direction:"vertical",style:{width:"100%"},children:e.toolCalls.map(f=>E.jsx(vU,{toolName:f.toolName,parameters:f.parameters,toolCallId:f.toolCallId,streamingOutput:f.streamingOutput,defaultExpanded:!1},f.toolCallId))});if(e.isAuthError)return E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"middle",children:[E.jsx(fr,{message:"Authentication Required",description:E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:t}),type:"error",showIcon:!0}),E.jsx(De,{type:"primary",icon:E.jsx(iF,{}),onClick:()=>{window.location.hash="/settings"},children:"Go to Settings"})]});const{cleanText:s,hints:l}=e.role==="user"?sBt(t):{cleanText:t,hints:[]},c=e.role==="assistant"&&e.type==="text"&&typeof((d=e.metadata)==null?void 0:d.reasoning)=="string"?e.metadata.reasoning:"",u=c.trim().length>0;return e.role==="assistant"&&!t&&!u?E.jsx(rs,{italic:!0,children:"Assistant is thinking..."}):E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:"small",children:[u?E.jsx(gl,{size:"small",defaultActiveKey:["reasoning"],items:[{key:"reasoning",label:E.jsx(rs,{strong:!0,children:"Reasoning"}),children:E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:c})}]}):null,l.map((f,h)=>f.type==="mcp"?E.jsx(fr,{type:"info",showIcon:!1,message:E.jsxs(He,{wrap:!0,size:"small",children:[E.jsx(Dn,{color:"purple",children:"MCP"}),E.jsx(rs,{strong:!0,children:"Selected tool"}),f.serverId&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.serverId})}),f.toolName&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.toolName})})]}),style:{marginBottom:0}},`hint-mcp-${h}`):E.jsx(fr,{type:"success",showIcon:!1,message:E.jsxs(He,{wrap:!0,size:"small",children:[E.jsx(Dn,{color:"green",children:"Skill"}),E.jsx(rs,{strong:!0,children:"Selected"}),f.label&&E.jsx(rs,{children:f.label}),f.skillId&&E.jsx(rs,{type:"secondary",children:E.jsx(rs,{code:!0,children:f.skillId})})]}),style:{marginBottom:0}},`hint-skill-${h}`)),s?E.jsx(Uc,{remarkPlugins:i,rehypePlugins:o,components:a,children:n?r(s):s}):null]})},cBt=p.memo(lBt),{Text:_re}=Qt,uBt=({role:e,formattedTimestamp:t,token:n})=>E.jsxs(rt,{align:"baseline",justify:"space-between",gap:n.marginXS,children:[E.jsx(_re,{type:"secondary",strong:!0,style:{fontSize:n.fontSizeSM},children:e==="user"?"You":e==="assistant"?"Assistant":e}),t&&E.jsx(_re,{type:"secondary",style:{fontSize:n.fontSizeSM,whiteSpace:"nowrap"},children:t})]}),bU=e=>{if(e.includes("```json")){const t=e.indexOf("```json")+7,n=e.indexOf("```",t);if(n>t)return e.substring(t,n).trim()}else if(e.includes("{")){const t=e.indexOf("{"),n=e.lastIndexOf("}");if(n>t)return e.substring(t,n+1).trim()}return null},dBt=e=>e==="text"||e==="plan"||e==="question"||e==="tool_call"||e==="tool_result",fBt=(e,t)=>{if(t)return t;if("message_type"in e&&e.message_type){const n=e.message_type;if(dBt(n))return n}if(e.role==="assistant"&&e.type==="text"){const n=typeof e.content=="string"?e.content:"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.goal&&a.steps&&Array.isArray(a.steps))return"plan";if(a.type==="question"&&a.question)return"question"}}catch{return"text"}}return"text"},pBt=(e,t)=>{if(t!=="plan"||e.role!=="assistant"||e.type!=="text")return null;const n=e.content??"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.goal&&a.steps)return{goal:a.goal,steps:a.steps.map(i=>({step_number:i.step_number||i.stepNumber||0,action:i.action||"",reason:i.reason||i.rationale||"",tools_needed:i.tools_needed||i.tools||[],estimated_time:i.estimated_time||i.estimatedTime||""})),estimated_total_time:a.estimated_total_time||a.estimatedTotalTime||"",risks:a.risks||[],prerequisites:a.prerequisites||[]}}}catch(r){console.error("Failed to parse plan:",r)}return null},hBt=(e,t)=>{if(t!=="question"||e.role!=="assistant"||e.type!=="text")return null;const n=e.content??"";try{const r=bU(n);if(r){const a=JSON.parse(r);if(a.type==="question"&&a.question)return{type:"question",question:a.question,context:a.context||"",severity:a.severity||"minor",options:a.options||[],default:a.default,allow_custom:a.allow_custom||!1}}}catch(r){console.error("Failed to parse question:",r)}return null},GCe=e=>{if(e.role==="system")return typeof e.content=="string"?e.content:"";if(e.role==="user")return"type"in e&&e.type==="file_reference"?"":typeof e.content=="string"?e.content:"";if(e.role==="assistant"){if(e.type==="text")return typeof e.content=="string"?e.content:"";if(e.type==="tool_result")return`Tool ${e.toolName} Result: ${e.result.result}`;if(e.type==="tool_call")return`Requesting to call ${e.toolCalls.map(t=>t.toolName).join(", ")}`;if(e.type==="workflow_result")return e.content}return""},gBt=e=>{if(!e.startsWith("/"))return e;const t=e.split(" "),n=t[0].substring(1),r=t.slice(1).join(" ");if(n.startsWith("mcp__")){const i=n.slice(5),o=i.indexOf("__");if(o>0){const s=i.slice(0,o),l=i.slice(o+2);if(s&&l)return`🔌 MCP ${s}/${l}: ${r}`}}return`🔧 ${n.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}: ${r}`},Tre=e=>e.map(t=>({name:t.name,extensions:[...t.extensions]})),kre=e=>e.trim().slice(0,64).replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/-+/g,"-")||"message",mBt={marginSM:12,marginXS:6,paddingXS:6,paddingSM:10,padding:12,borderRadiusSM:8,fontSizeSM:12,colorPrimary:"#1677ff",colorPrimaryBg:"#e6f4ff",colorTextSecondary:"#595959",colorText:"#1f1f1f",colorLink:"#1677ff",colorBgContainer:"#ffffff",colorBorder:"#d9d9d9",boxShadowSecondary:"none"},vBt='[data-mermaid-loading="true"]';class KCe{static async exportMessageText(t){const{format:n,content:r,sessionId:a=null,messageId:i=null,filenamePrefix:o}=t,s=o||["chat-message",a?kre(a.slice(0,8)):null,i?kre(i.slice(0,8)):null].filter(Boolean).join("-"),l=n==="markdown"?Js.generateTimestampedFilename(s,"md"):Js.generateTimestampedFilename(s,"pdf");if(n==="markdown"){const c=await Js.saveTextFile(r,Tre(Js.FILTERS.MARKDOWN),l);return c.success?{success:!0,filename:c.filename}:{success:!1,error:c.error}}try{const c=await this.generatePdfFromText(r),u=await Js.saveBinaryFile(c,Tre(Js.FILTERS.PDF),l);return u.success?{success:!0,filename:u.filename}:{success:!1,error:u.error}}catch(c){return{success:!1,error:c instanceof Error?c.message:"Failed to export PDF"}}}static async generatePdfFromText(t){if(typeof document>"u")throw new Error("PDF export is unavailable in this environment");const n=(await Mn(async()=>{const{default:h}=await import("./html2canvas.esm-CBrSDip1.js");return{default:h}},[],import.meta.url)).default,{jsPDF:r}=await Mn(async()=>{const{jsPDF:h}=await import("./jspdf.es.min-Cr0yMma9.js");return{jsPDF:h}},__vite__mapDeps([55,1,2]),import.meta.url),{createRoot:a}=await Mn(async()=>{const{createRoot:h}=await import("./main-r5-Ghhxx.js").then(g=>g.c);return{createRoot:h}},__vite__mapDeps([1,2]),import.meta.url),{flushSync:i}=await Mn(async()=>{const{flushSync:h}=await Promise.resolve().then(()=>Tae);return{flushSync:h}},void 0,import.meta.url),o=qCe(mBt,{mermaidRenderMode:"eager"}),s=document.createElement("div");s.style.position="fixed",s.style.left="0",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.zIndex="2147483647",s.style.background="rgba(0,0,0,0.15)",s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.fontFamily="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",s.style.fontSize="14px",s.style.color="#111";const l=document.createElement("div");l.style.background="#fff",l.style.border="1px solid rgba(0,0,0,0.12)",l.style.borderRadius="10px",l.style.padding="12px 14px",l.style.boxShadow="0 8px 24px rgba(0,0,0,0.12)",l.textContent="Exporting PDF...",s.appendChild(l);const c=document.createElement("div");c.style.position="fixed",c.style.left="0",c.style.top="0",c.style.zIndex="2147483646",c.style.pointerEvents="none",c.style.width="794px",c.style.background="#fff",c.style.color="#111",c.style.padding="24px",c.style.boxSizing="border-box",c.style.fontFamily="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",c.style.fontSize="14px",c.style.lineHeight="1.35";const u=document.createElement("style");u.textContent=`
|
|
1031
1031
|
.md-export { color: #111; }
|
|
1032
1032
|
.md-export h1 { font-size: 24px; margin: 0 0 16px; }
|
|
1033
1033
|
.md-export h2 { font-size: 18px; margin: 18px 0 12px; }
|
|
@@ -1037,11 +1037,16 @@ ${t}`},nBt=(e,t)=>{const n=Qjt[e];if(!n)return null;const r=t.trim();if(!r)retur
|
|
|
1037
1037
|
> `)}`,[]),f=p.useCallback(()=>{if(!n)return;const v=d(l||e),b=new CustomEvent("reference-text",{detail:{text:v,sessionId:n}});window.dispatchEvent(b)},[d,n,e,l]),h=p.useCallback(async v=>{var S;const b=l||e;if(!b){s.warning("Nothing to export");return}const y=await KCe.exportMessageText({format:v,content:b,sessionId:n??null,messageId:t??null});if(y.success)s.success(`Saved: ${y.filename}`);else{if((S=y.error)!=null&&S.toLowerCase().includes("cancel"))return;s.error(y.error||"Export failed")}},[s,n,t,e,l]),g=p.useCallback(v=>{v.preventDefault(),v.stopPropagation();const b=window.getSelection(),y=b?b.toString():"";y&&o.current&&b&&o.current.contains(b.anchorNode)?c(y):c("")},[o]);return{contextMenuItems:p.useMemo(()=>{const v=[...a&&i&&n&&t?[{key:"restore-chat",label:"Restore chat to this message",icon:E.jsx(K7e,{}),onClick:()=>{a()}},{key:"restore-chat-files",label:"Restore files + chat to this message",icon:E.jsx(xde,{}),onClick:()=>{i()}},{type:"divider"}]:[],{key:"copy",label:"Copy",icon:E.jsx(Go,{}),onClick:()=>{u(l||e)}},{key:"reference",label:"Reference message",icon:E.jsx(mde,{}),onClick:f},{type:"divider"},{key:"export-md",label:"Export as Markdown",icon:E.jsx(Yp,{}),onClick:()=>h("markdown")},{key:"export-pdf",label:"Export as PDF",icon:E.jsx(Yp,{}),onClick:()=>h("pdf")}];return r&&t&&v.push({key:"delete",label:"Delete message",icon:E.jsx(Zh,{}),onClick:()=>r(t),danger:!0}),v},[u,h,t,e,r,a,i,f,l,n]),handleMouseUp:g,copyToClipboard:u,referenceMessage:f}},yBt=({currentSessionId:e,updateSession:t,sendMessage:n})=>{const r=p.useCallback(async()=>{if(!e)return;const s=Ue.getState().chats.find(l=>l.id===e);if(s)try{t(e,{config:{...s.config,agentRole:"actor"}})}catch(l){console.error("Failed to switch to Actor role:",l)}},[e,t]),a=p.useCallback(async o=>{if(o.trim())try{await n(o.trim())}catch(s){console.error("Failed to send plan refinement:",s)}},[n]),i=p.useCallback(async o=>{if(o)try{await n(o)}catch(s){throw console.error("Failed to send answer:",s),s}},[n]);return{handleExecutePlan:r,handleRefinePlan:a,handleQuestionAnswer:i}},YCe=e=>{const t=e.match(/```mermaid\s*([\s\S]*?)```/i);return t?t[1].trim():e.trim()},SBt=(e,t,n)=>{const r=t.trim(),a=YCe(n);let i=!1;const o=e.replace(/```mermaid\s*([\s\S]*?)```/gi,(s,l)=>i||l.trim()!==r?s:(i=!0,`\`\`\`mermaid
|
|
1038
1038
|
${a}
|
|
1039
1039
|
\`\`\``));return i?o:null},xBt=(e,t)=>{const n=(t??"").trim(),r=["Original Mermaid code:","```mermaid",e.trim(),"```"];return n&&r.push("","Mermaid parser/render error:",n),r.push("","Please fix the Mermaid syntax while preserving the original meaning and labels."),r.join(`
|
|
1040
|
-
`)},wBt=async(e,t,n)=>{var s,l,c;const r=t==null?void 0:t.trim();if(!r)throw new Error("No model configured. Please select a default model in Provider Settings.");const o=((c=(l=(s=(await khe().chat.completions.create({model:r,messages:[{role:"system",content:"You fix Mermaid diagrams using the parser/render error context. Return only corrected Mermaid code without markdown fences or extra text."},{role:"user",content:xBt(e,n)}],temperature:0})).choices)==null?void 0:s[0])==null?void 0:l.message)==null?void 0:c.content)??"";return YCe(o)},CBt=e=>{const t=pg();return p.useCallback(async(n,r)=>{const a=Ue.getState(),i=a.currentSessionId,o=a.chats.find(h=>h.id===i);if(!i||!o)throw new Error("No active chat available");const s=o.messages.find(h=>h.id===e);if(!s||s.role!=="assistant"||s.type!=="text")throw new Error("Mermaid fix is only available for assistant text messages");const l=await wBt(n,t,r);if(!l)throw new Error("AI did not return a Mermaid fix");const c=SBt(s.content,n,l);if(!c)throw new Error("Unable to locate Mermaid block to update");await Lw.patchSessionMessage(i,e,{content:c});const u=Ue.getState(),d=u.chats.find(h=>h.id===i);if(!d)throw new Error("No active chat available");const f=d.messages.map(h=>h.id===e?{...h,content:c}:h);u.updateSession(i,{messages:f})},[e,t])},EBt=e=>e.xs?"100%":e.sm?"95%":"800px",{useToken:_Bt}=pn,{useBreakpoint:TBt}=CE,kBt="chat-send-message",OBt=({sessionId:e,message:t,onDelete:n,messageType:r})=>{const{role:a,id:i}=t,{token:o}=_Bt(),{message:s}=Ns.useApp(),l=TBt(),c=Ue(F=>F.updateSession),u=Ue(F=>F.loadChatHistory),d=Ue(F=>F.refreshChats),f=p.useRef(null),[h,g]=p.useState(!1),m=Ue(F=>e?F.processingChats.has(e):!1),v=p.useCallback(F=>typeof window>"u"?Promise.reject(new Error("window is unavailable")):new Promise((B,z)=>{const G={content:F,sessionId:e,handled:!1,resolve:B,reject:z};window.dispatchEvent(new CustomEvent(kBt,{detail:G})),G.handled||z(new Error("No chat message dispatcher available"))}),[]),b=p.useMemo(()=>{if(!t.createdAt)return null;const F=new Date(t.createdAt);if(Number.isNaN(F.getTime()))return null;try{return eDt(F,"MMM d, yyyy HH:mm")}catch{return F.toLocaleString()}},[t.createdAt]),y=p.useMemo(()=>fBt(t,r),[t,r]),S=p.useMemo(()=>pBt(t,y),[t,y]),C=p.useMemo(()=>hBt(t,y),[t,y]),x=p.useMemo(()=>GCe(t),[t]),w=CBt(i),_=p.useCallback(async F=>{var B;if(!e||!i){s.warning("Cannot restore this message");return}try{const z=await Lw.restoreSessionState(e,{target_message_id:i,restore_files:F});await u(e,{mode:"replace"}),await d();const G=((B=z.file_errors)==null?void 0:B.length)??0;if(G>0){s.warning(`Chat restored. ${G} file(s) could not be restored.`);return}F?s.success(`Files and chat restored (${z.messages_removed} message(s) removed).`):s.success(`Chat restored (${z.messages_removed} message(s) removed).`)}catch(z){const G=z instanceof Error?z.message:"Failed to restore session";s.error(G)}},[s,e,u,i,d]),T=p.useCallback(()=>{_(!1)},[_]),k=p.useCallback(()=>{_(!0)},[_]),{contextMenuItems:O,handleMouseUp:I,copyToClipboard:M,referenceMessage:$}=bBt({messageText:x,messageId:i,currentSessionId:e,onDelete:n,onRestoreChat:T,onRestoreFilesAndChat:k,cardRef:f}),R=p.useMemo(()=>a==="user"&&x.startsWith("/"),[a,x]),A=p.useMemo(()=>qCe(o,{onFixMermaid:w}),[o,w]),P=p.useMemo(()=>[VE,dU],[]),N=p.useMemo(()=>[uU],[]),L=p.useMemo(()=>[sDt(()=>M(x)),lDt($)],[x,M,$]),{handleExecutePlan:j,handleRefinePlan:D,handleQuestionAnswer:H}=yBt({currentSessionId:e,updateSession:c,sendMessage:v});return y==="plan"&&S&&a==="assistant"?E.jsx(CCe,{plan:S,contextId:e||"",onExecute:j,onRefine:D,timestamp:b??void 0}):y==="question"&&C&&a==="assistant"?E.jsx(ECe,{question:C,contextId:e||"",onAnswer:H,disabled:m||!1,timestamp:b??void 0}):YMt(t)?E.jsx(mDt,{taskList:t.taskList}):KMt(t)?(console.log("[MessageCard] Rendering FileReferenceCard for message:",t.id,"paths:",t.paths),E.jsx(rt,{justify:"flex-end",style:{width:"100%"},children:E.jsx(_Ce,{paths:t.paths,displayText:t.displayText,timestamp:b??void 0})})):E.jsx(rt,{vertical:!0,onContextMenu:F=>I(F),style:{width:"100%"},children:E.jsx(Qc,{menu:{items:O},trigger:["contextMenu"],children:E.jsx(Ot,{"data-testid":a==="assistant"?"assistant-message":"user-message",id:i?`message-${i}`:void 0,ref:f,style:{width:"100%",minWidth:"100%",maxWidth:EBt(l),margin:"0 auto",background:a==="user"?o.colorPrimaryBg:a==="assistant"?o.colorBgLayout:o.colorBgContainer,borderRadius:o.borderRadiusLG,boxShadow:"none",position:"relative",wordWrap:"break-word",overflowWrap:"break-word"},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:E.jsxs(He,{direction:"vertical",size:o.marginXS,style:{width:"100%",maxWidth:"100%"},children:[E.jsx(uBt,{role:a,formattedTimestamp:b,token:o}),t.role==="user"&&t.images&&E.jsx(rDt,{images:t.images}),E.jsx(rt,{vertical:!0,style:{width:"100%",maxWidth:"100%"},children:E.jsx(cBt,{message:t,messageText:x,isUserToolCall:R,formatUserToolCall:gBt,markdownComponents:A,markdownPlugins:P,rehypePlugins:N})}),E.jsx(oDt,{isVisible:h,position:{bottom:o.paddingXS,right:o.paddingXS},buttons:L})]})})})})},XCe=p.memo(OBt,(e,t)=>e.message===t.message&&e.messageType===t.messageType&&e.onDelete===t.onDelete);XCe.displayName="MessageCard";const{Text:vb}=Qt,{useToken:$Bt}=pn,IBt=e=>({p:({children:t})=>E.jsx(vb,{style:{marginBottom:e.marginSM,display:"block"},children:t}),ol:({children:t})=>E.jsx("ol",{style:{marginBottom:e.marginSM,paddingLeft:20},children:t}),ul:({children:t})=>E.jsx("ul",{style:{marginBottom:e.marginSM,paddingLeft:20},children:t}),li:({children:t})=>E.jsx("li",{style:{marginBottom:e.marginXS},children:t}),code({className:t,children:n,inline:r,...a}){const i=/language-([^\s]+)/i.exec(t||""),o=i?i[1]:"",s=r??(!i&&!t),l=n?String(n).replace(/\n$/,""):"";return s?E.jsx(vb,{code:!0,className:t,...a,children:n}):l.trim()?o.toLowerCase()==="mermaid"?E.jsx(Ot,{size:"small",styles:{body:{padding:0}},style:{position:"relative",maxWidth:"100%",overflow:"auto",marginBottom:e.marginSM},children:E.jsx("pre",{style:{margin:0,padding:e.paddingSM,background:e.colorBgContainer,borderRadius:e.borderRadiusSM,fontSize:"13px"},children:E.jsx("code",{children:l})})}):UCe(o,l,e,void 0):null},blockquote:({children:t})=>E.jsx(Ot,{size:"small",styles:{body:{padding:`${e.paddingXS}px ${e.padding}px`}},style:{borderLeft:`3px solid ${e.colorPrimary}`,background:e.colorPrimaryBg,margin:`${e.marginXS}px 0`,color:e.colorTextSecondary,fontStyle:"italic"},children:t}),a:({children:t,href:n})=>{const r=typeof n=="string"?n.trim():"";return r?E.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.preventDefault(),WCe(r)},style:{color:e.colorLink,textDecoration:"underline",overflowWrap:"anywhere"},children:t}):E.jsx(E.Fragment,{children:t})},table:({children:t})=>E.jsx(Ot,{size:"small",styles:{body:{padding:0}},style:{overflow:"auto",margin:`${e.marginSM}px 0`},children:E.jsx("table",{style:{width:"100%",borderCollapse:"collapse",border:`1px solid ${e.colorBorder}`},children:t})}),thead:({children:t})=>E.jsx("thead",{style:{backgroundColor:e.colorBgContainer},children:t}),tbody:({children:t})=>E.jsx("tbody",{children:t}),tr:({children:t})=>E.jsx("tr",{style:{borderBottom:`1px solid ${e.colorBorder}`},children:t}),th:({children:t})=>E.jsx("th",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,textAlign:"left",fontWeight:"bold",borderRight:`1px solid ${e.colorBorder}`},children:t}),td:({children:t})=>E.jsx("td",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,borderRight:`1px solid ${e.colorBorder}`},children:t}),input:({type:t,checked:n,disabled:r})=>t==="checkbox"?E.jsx("input",{type:"checkbox",checked:n,disabled:r,style:{marginRight:e.marginXS,accentColor:e.colorPrimary},readOnly:!0}):E.jsx("input",{type:t,checked:n,disabled:r})}),ZCe=p.memo(({sessionId:e})=>{const{token:t}=$Bt(),n=`streaming-${e}`,r=`streaming-reasoning-${e}`,[a,i]=p.useState(()=>Yr.getLatest(n)??""),[o,s]=p.useState(()=>Yr.getLatest(r)??"");p.useEffect(()=>Yr.subscribeMessage(n,d=>{i(d??"")}),[n]),p.useEffect(()=>Yr.subscribeMessage(r,d=>{s(d??"")}),[r]);const l=p.useMemo(()=>[VE,dU],[]),c=p.useMemo(()=>[uU],[]),u=p.useMemo(()=>IBt(t),[t]);return E.jsx(Ot,{"data-testid":"streaming-indicator",style:{width:"100%",minWidth:"100%",maxWidth:"800px",margin:"0 auto",background:t.colorBgLayout,borderRadius:t.borderRadiusLG,boxShadow:"none",position:"relative",wordWrap:"break-word",overflowWrap:"break-word"},children:E.jsxs(He,{direction:"vertical",size:t.marginXS,style:{width:"100%",maxWidth:"100%"},children:[E.jsx(rt,{align:"baseline",justify:"space-between",gap:t.marginXS,children:E.jsx(vb,{type:"secondary",strong:!0,style:{fontSize:t.fontSizeSM},children:"Assistant"})}),E.jsxs(rt,{vertical:!0,style:{width:"100%",maxWidth:"100%"},children:[o?E.jsx(gl,{size:"small",defaultActiveKey:["reasoning"],style:{marginBottom:t.marginSM,background:t.colorBgContainer,borderColor:t.colorBorderSecondary},items:[{key:"reasoning",label:E.jsx(vb,{strong:!0,children:"Reasoning"}),children:E.jsx(Uc,{remarkPlugins:l,rehypePlugins:c,components:u,children:o})}]}):null,a?E.jsx(Uc,{remarkPlugins:l,rehypePlugins:c,components:u,children:a}):E.jsx(vb,{italic:!0,children:"Assistant is thinking..."}),E.jsx("span",{className:"blinking-cursor",style:{display:"inline-block",marginLeft:"0.2em",color:t.colorText}})]})]})})});ZCe.displayName="StreamingMessageCard";const{Text:Io}=Qt,ABt="chat-session-tool-collapse:",QCe=(e,t)=>`${ABt}${e}:${t}`,a2=(e,t)=>{if(typeof window>"u")return null;try{const n=window.localStorage.getItem(QCe(e,t));if(!n)return null;const r=JSON.parse(n);if(!r||typeof r!="object")return null;const a="isExpanded"in r&&typeof r.isExpanded=="boolean"?r.isExpanded:!0,i="expandedTools"in r&&Array.isArray(r.expandedTools)?r.expandedTools.filter(o=>typeof o=="string"):[];return{isExpanded:a,expandedTools:i}}catch{return null}},RBt=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(QCe(e,t),JSON.stringify(n))}catch{}},i2=e=>{var t,n;return((n=(t=e.call.toolCalls)==null?void 0:t[0])==null?void 0:n.toolCallId)||e.call.id};function MBt(e,t){return e.result?e.result.isError?{icon:E.jsx(LE,{style:{color:t.colorError}}),color:t.colorError,text:"Error"}:{icon:E.jsx(Hl,{style:{color:t.colorSuccess}}),color:t.colorSuccess,text:"Done"}:{icon:E.jsx(DE,{spin:!0,style:{color:t.colorPrimary}}),color:t.colorPrimary,text:"Running"}}function PBt(e,t){const n=Yd(e);if(n)return`MCP ${n.serverId}: ${n.toolName}`;const r=(o,s)=>{const l=typeof o=="string"?o:String(o??"");return!l||l.length<=s?l:l.substring(0,s).trimEnd()+"…"},a={file_read:o=>`Reading: ${r(o.path||o.file_path||"unknown",35)}`,file_write:o=>`Writing: ${r(o.path||o.file_path||"unknown",35)}`,file_edit:o=>`Editing: ${r(o.path||o.file_path||"unknown",35)}`,bash:o=>`Executing: ${r(o.command,35)}`,grep:o=>`Searching: "${r(o.pattern,25)}"`,glob:o=>`Finding: "${o.pattern}"`,read:o=>`Reading: ${o.file_path||"file"}`,write:o=>`Writing: ${o.file_path||"file"}`,edit:o=>`Editing: ${o.file_path||"file"}`,search:o=>`Searching: "${r(o.query||o.pattern,25)}"`,default:()=>`${e}`};return(a[e]||a.default)(t)}const NBt=({tools:e,sessionId:t,defaultExpanded:n=!1})=>{const{token:r}=pn.useToken(),a=e.length===1,i=p.useMemo(()=>{var w,_,T;const C=e[0],x=(_=(w=C==null?void 0:C.call)==null?void 0:w.toolCalls)==null?void 0:_[0];return(x==null?void 0:x.toolCallId)||((T=C==null?void 0:C.call)==null?void 0:T.id)||"unknown"},[e]),o=p.useMemo(()=>{const C=e[0];return C?i2(C):null},[e]),[s,l]=p.useState(()=>{const C=a2(t,i);return C?C.isExpanded:n}),[c,u]=p.useState(()=>{const C=a2(t,i);return C?new Set(C.expandedTools):new Set(n&&o?[o]:[])});p.useEffect(()=>{const C=a2(t,i);if(C){l(C.isExpanded),u(new Set(C.expandedTools));return}l(n),u(new Set(n&&o?[o]:[]))},[n,o,t,i]),p.useEffect(()=>{const C=new Set(e.map(x=>i2(x)));u(x=>{const w=new Set;let _=!1;return x.forEach(T=>{C.has(T)?w.add(T):_=!0}),!_&&w.size===x.size?x:w})},[e]),p.useEffect(()=>{RBt(t,i,{isExpanded:s,expandedTools:Array.from(c)})},[t,i,s,c]);const{completedCount:d,pendingCount:f,hasErrors:h}=p.useMemo(()=>{let C=0,x=0,w=!1;return e.forEach(_=>{_.result?(C++,_.result.isError&&(w=!0)):x++}),{completedCount:C,pendingCount:x,hasErrors:w}},[e]),g=p.useMemo(()=>f>0?{color:"processing",text:`${d}/${e.length} completed`}:h?{color:"warning",text:`${d} completed with errors`}:{color:"success",text:`${d} completed`},[d,f,h,e.length]),m=p.useMemo(()=>{let C=0,x=0,w=0;return e.forEach(_=>{var O,I;const T=(I=(O=_.result)==null?void 0:O.result)==null?void 0:I.result;if(!T)return;const k=UN(T);k&&(C+=k.added,x+=k.removed,w+=1)}),{added:C,removed:x,changedTools:w}},[e]),v=p.useMemo(()=>{var w,_,T;if(e.length!==1)return"Tool Session";const C=(T=(_=(w=e[0])==null?void 0:w.call)==null?void 0:_.toolCalls)==null?void 0:T[0];if(!C)return"Tool Session";const x=Yd(C.toolName);return x?`MCP ${x.serverId}: ${x.toolName}`:C.toolName||"Tool Session"},[e]),b=p.useMemo(()=>e.map((C,x)=>{const w=C.call.toolCalls[0];if(!w)return null;const _=MBt(C,r),T=PBt(w.toolName,w.parameters),k=Yd(w.toolName),O=C.result?UN(C.result.result.result):null,I=C.result?g0(C.result.result.result):null;return{key:i2(C),label:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r.marginSM,width:"100%"},children:[E.jsxs("span",{style:{fontSize:r.fontSizeSM,color:r.colorTextTertiary,minWidth:20},children:[x+1,"."]}),E.jsx("span",{style:{flexShrink:0},children:_.icon}),k?E.jsxs(He,{size:"small",wrap:!1,children:[E.jsx(Dn,{color:"purple",style:{marginInlineEnd:0},children:"MCP"}),E.jsx(Io,{strong:!0,style:{fontSize:r.fontSizeSM},children:k.toolName}),E.jsx(Io,{type:"secondary",style:{fontSize:r.fontSizeSM},children:E.jsx(Io,{code:!0,style:{fontSize:r.fontSizeSM},children:k.serverId})})]}):E.jsx(Io,{strong:!0,style:{fontSize:r.fontSizeSM,flexShrink:0},children:w.toolName}),E.jsx(Io,{type:"secondary",ellipsis:!0,style:{flex:1,minWidth:0,fontSize:r.fontSizeSM},children:T}),I&&E.jsx(Io,{type:"secondary",ellipsis:!0,style:{maxWidth:180,fontSize:r.fontSizeSM},children:I.file_path.split(/[\\/]/).pop()||I.file_path}),O&&E.jsxs(He,{size:4,style:{marginLeft:r.marginXS},children:[E.jsxs(Io,{style:{color:r.colorSuccess,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",O.added]}),E.jsxs(Io,{style:{color:r.colorError,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",O.removed]})]})]}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:r.marginSM,children:[E.jsx(vU,{toolName:w.toolName,parameters:w.parameters,toolCallId:w.toolCallId,streamingOutput:w.streamingOutput,defaultExpanded:!1}),C.result&&C.result.result.display_preference!=="Hidden"&&E.jsx(mU,{content:C.result.result.result,toolName:w.toolName,status:C.result.isError?"error":"success",timestamp:C.result.createdAt,defaultCollapsed:!1})]}),style:{borderBottom:x<e.length-1?`1px solid ${r.colorBorderSecondary}`:void 0}}}).filter(C=>C!==null),[e,r]),y=E.jsx("div",{style:{padding:r.paddingSM},children:E.jsx(gl,{ghost:!0,activeKey:Array.from(c),onChange:C=>{const x=new Set(Array.isArray(C)?C:C?[C]:[]);u(x)},items:b})}),S={backgroundColor:r.colorBgElevated,border:`1px solid ${r.colorBorder}`,borderRadius:r.borderRadiusLG,overflow:"hidden"};return a?E.jsx("div",{style:{width:"100%"},children:E.jsx("div",{style:S,children:y})}):E.jsxs("div",{style:S,children:[E.jsxs("div",{style:{padding:`${r.paddingSM}px ${r.paddingMD}px`,backgroundColor:r.colorBgContainer,borderBottom:s?`1px solid ${r.colorBorder}`:void 0,cursor:"pointer",display:"flex",alignItems:"center",gap:r.marginSM},onClick:()=>l(!s),children:[E.jsx(t0,{style:{color:r.colorPrimary}}),E.jsx(Io,{strong:!0,style:{flex:1},children:v}),E.jsx(Gy,{count:e.length,style:{backgroundColor:r.colorPrimary}}),m.changedTools>0&&E.jsxs(He,{size:4,style:{marginInlineStart:r.marginXS},children:[E.jsxs(Io,{style:{color:r.colorSuccess,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",m.added]}),E.jsxs(Io,{style:{color:r.colorError,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",m.removed]})]}),E.jsx(Io,{type:"secondary",style:{fontSize:r.fontSizeSM},children:g.text}),E.jsx("div",{style:{marginLeft:r.marginXS},children:s?E.jsx(As,{style:{color:r.colorTextSecondary}}):E.jsx(tu,{style:{color:r.colorTextSecondary}})})]}),s&&y]})},JCe=p.memo(NBt);JCe.displayName="ToolSessionCard";const{Content:LBt}=Cs;function Ore(e){return"type"in e&&(e.type==="tool_session"||e.type==="compression_divider")?e.id:e.message.id}const DBt=({currentChat:e,currentSessionId:t,convertRenderableEntry:n,handleDeleteMessage:r,handleMessagesScroll:a,hasSystemPrompt:i,messagesListRef:o,renderableMessages:s,rowGap:l,showMessagesView:c,screens:u,workflowDraftId:d,interactionState:f,padding:h,selectionMode:g,selectedMessageIds:m,selectableMessageIds:v,onToggleMessageSelection:b})=>{const y=p.useRef(s);y.current=s;const S=p.useCallback(k=>{const O=y.current[k];return O?Ore(O):String(k)},[]),C=INt({count:s.length,getScrollElement:()=>o.current,estimateSize:()=>120,overscan:5,gap:l,getItemKey:S}),x=(k,O)=>{if(!g)return null;const I=v.has(k);return E.jsx(Zc,{checked:m.has(k),disabled:!I,onChange:()=>{I&&b(k)},style:{marginTop:8,marginLeft:O==="flex-end"?8:0,marginRight:O==="flex-start"?8:0}})},w=k=>{const O=n(k);return O.type==="compression_divider"?E.jsx(nl,{plain:!0,style:{margin:"6px 0 10px 0"},children:O.label}):O.type==="tool_session"?E.jsx(rt,{justify:"flex-start",style:{width:"100%",maxWidth:"100%"},children:E.jsx("div",{id:`message-${O.id}`,style:{width:"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(JCe,{tools:O.tools,sessionId:O.sessionId,createdAt:O.createdAt,defaultExpanded:!1})})}):O.message.role==="system"?E.jsxs(rt,{align:"flex-start",style:{width:"100%",maxWidth:"100%"},children:[x(O.message.id,"flex-start"),E.jsx("div",{style:{flex:1,minWidth:0},children:E.jsx(gCe,{currentChat:e,message:O.message})})]}):E.jsxs(rt,{justify:O.align,align:"flex-start",style:{width:"100%",maxWidth:"100%"},children:[O.align==="flex-start"&&x(O.message.id,O.align),E.jsx("div",{style:{width:O.message.role==="user"?"85%":"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(XCe,{sessionId:t,message:O.message,messageType:O.messageType,onDelete:O.message.id===d?void 0:r})}),O.align==="flex-end"&&x(O.message.id,O.align)]})},_=(c||i)&&s.length>0,T=C.getVirtualItems();return E.jsxs(LBt,{className:`chat-view-messages-list ${c?"visible":"hidden"}`,style:{flex:1,minHeight:0,padding:h,overflowY:"auto",opacity:c?1:0,scrollbarWidth:"none",msOverflowStyle:"none"},ref:o,onScroll:a,children:[_&&E.jsx("div",{style:{position:"relative",width:"100%",height:C.getTotalSize()},children:T.map(k=>{const O=s[k.index];if(!O)return null;const I=Ore(O);return E.jsx("div",{"data-chat-entry-id":I,"data-index":k.index,ref:C.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${k.start}px)`},children:w(O)},I)})}),f.matches("THINKING")&&t&&E.jsx("div",{style:{paddingTop:l},children:E.jsx(rt,{justify:"flex-start",style:{width:"100%",maxWidth:"100%"},children:E.jsx("div",{style:{width:"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(ZCe,{sessionId:t})})})})]})},{Text:$m}=Qt,jBt={pending:{icon:E.jsx(Nw,{}),color:"#8c8c8c",text:"Pending",tagColor:"default"},in_progress:{icon:E.jsx(oF,{spin:!0}),color:"#1890ff",text:"In Progress",tagColor:"processing"},completed:{icon:E.jsx(Hl,{}),color:"#52c41a",text:"Completed",tagColor:"success"},blocked:{icon:E.jsx(LE,{}),color:"#ff4d4f",text:"Blocked",tagColor:"error"}},BBt=({sessionId:e,initialCollapsed:t=!0})=>{const{token:n}=pn.useToken(),r=Ue(x=>x.chats.find(w=>w.id===e)),a=(r==null?void 0:r.kind)==="child"&&(r.parentSessionId||r.rootSessionId)||e,i=Ue(x=>x.taskLists[a]),o=Ue(x=>x.activeItems[a]),s=Ue(x=>x.evaluationStates[a]),[l,c]=p.useState(t),[u,d]=p.useState(!1),f=(s==null?void 0:s.isEvaluating)||!1,h=(s==null?void 0:s.reasoning)||null,g=i?{session_id:i.session_id,title:i.title,items:i.items,progress:{completed:i.items.filter(x=>x.status==="completed").length,total:i.items.length,percentage:i.items.length>0?Math.round(i.items.filter(x=>x.status==="completed").length/i.items.length*100):0}}:null;if(!g)return null;const m=()=>{u||c(!l)},v=x=>{x.stopPropagation(),d(!u),u||c(!1)},{title:b,items:y,progress:S}=g,C=S.percentage===100;return E.jsx(Ot,{size:"small",style:{marginBottom:16,borderRadius:8,boxShadow:f?`0 0 0 2px ${n.colorPrimaryBorder}`:"0 2px 8px rgba(0, 0, 0, 0.06)",opacity:l&&!u?.9:1},styles:{body:{padding:l?"12px 16px":16}},title:E.jsxs(He,{onClick:m,style:{cursor:"pointer",width:"100%"},children:[E.jsx(PVe,{style:{color:n.colorPrimary}}),E.jsx($m,{strong:!0,style:{fontSize:15},children:b||"Task List"}),f&&E.jsx(Dn,{icon:E.jsx(oF,{spin:!0}),color:"processing",children:"Evaluating"}),!l&&S.total>0&&E.jsx(Gy,{count:`${S.completed}/${S.total}`,style:{backgroundColor:C?"#52c41a":n.colorPrimary}})]}),extra:E.jsxs(He,{children:[S.total>0&&l&&E.jsxs($m,{type:"secondary",style:{fontSize:13},children:[S.completed,"/",S.total,C&&E.jsx(Hl,{style:{color:"#52c41a",marginLeft:4}})]}),E.jsx(wn,{title:u?"Unpin":"Pin",children:E.jsx("span",{onClick:v,style:{cursor:"pointer",color:u?n.colorPrimary:n.colorTextSecondary,fontSize:16},children:u?E.jsx(yde,{}):E.jsx(Sde,{})})}),!u&&E.jsx("span",{onClick:m,style:{cursor:"pointer",color:n.colorTextSecondary,fontSize:12,transform:l?"rotate(-90deg)":void 0,transition:"transform 0.2s"},children:l?E.jsx(tu,{}):E.jsx(As,{})})]}),children:!l&&E.jsxs(E.Fragment,{children:[h&&E.jsx(fr,{icon:E.jsx(aF,{}),message:"LLM Evaluation",description:h,type:"info",showIcon:!0,style:{marginBottom:16}}),S.total>0&&E.jsx("div",{style:{marginBottom:16},children:E.jsx($E,{percent:S.percentage,size:"small",status:C?"success":"active",format:x=>E.jsxs($m,{type:"secondary",children:[x,"%"]})})}),E.jsx(jr,{size:"small",dataSource:y,renderItem:x=>{const w=jBt[x.status],_=o===x.id;return E.jsx(jr.Item,{style:{padding:"12px 0",borderLeft:_?`3px solid ${n.colorPrimary}`:"3px solid transparent",paddingLeft:_?12:15,backgroundColor:_?n.colorPrimaryBg:"transparent",borderRadius:4,marginBottom:4},children:E.jsx("div",{style:{width:"100%"},children:E.jsxs(He,{align:"start",style:{width:"100%"},children:[E.jsx(wn,{title:w.text,children:E.jsx("span",{style:{color:w.color,fontSize:16},children:w.icon})}),E.jsxs("div",{style:{flex:1,minWidth:0},children:[E.jsx($m,{style:{textDecoration:x.status==="completed"?"line-through":"none",color:x.status==="completed"?n.colorTextSecondary:n.colorText,fontWeight:_?500:400},children:x.description}),E.jsx("div",{style:{marginTop:4},children:E.jsxs(He,{size:8,wrap:!0,children:[E.jsx(Dn,{color:w.tagColor,children:w.text}),x.tool_calls_count!==void 0&&x.tool_calls_count>0&&E.jsxs(Dn,{icon:E.jsx(t0,{}),color:"blue",children:[x.tool_calls_count," tools"]}),x.depends_on.length>0&&E.jsx(wn,{title:`Depends on: ${x.depends_on.join(", ")}`,children:E.jsxs(Dn,{icon:E.jsx(J7e,{}),children:[x.depends_on.length," deps"]})})]})}),x.notes&&E.jsx($m,{type:"secondary",style:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:n.colorFillQuaternary,borderRadius:4},children:x.notes})]})]})})})}})]})})},FBt="_questionCard_1emac_1",zBt="_questionHeader_1emac_8",HBt="_headerLeft_1emac_22",UBt="_questionIcon_1emac_30",WBt="_questionText_1emac_35",qBt="_collapseBtn_1emac_47",VBt="_questionBody_1emac_52",GBt="_optionsGroup_1emac_56",KBt="_optionItem_1emac_60",YBt="_customHint_1emac_72",XBt="_questionFooter_1emac_80",Ao={questionCard:FBt,questionHeader:zBt,headerLeft:HBt,questionIcon:UBt,questionText:WBt,collapseBtn:qBt,questionBody:VBt,optionsGroup:GBt,optionItem:KBt,customHint:YBt,questionFooter:XBt},{Text:ix}=Qt,{useToken:ZBt}=pn,QBt=({sessionId:e,onResponseSubmitted:t,onQuestionAppeared:n})=>{const{token:r}=ZBt(),[a,i]=p.useState(null),[o,s]=p.useState(null),[l,c]=p.useState(!1),[u,d]=p.useState(!0),[f,h]=p.useState(!1),g=p.useRef(0),m=p.useRef(n);m.current=n;const v=Ue(N=>N.setSessionProcessing),b=Ue(N=>N.setPendingQuestionRespond),y=pg(),S=Ue(N=>{var L;return e?(L=N.inputStates)==null?void 0:L[e]:void 0}),C=Ho(N=>N.currentProvider),x=Ho(N=>N.providerConfig),w=p.useMemo(()=>{var N;return(N=x.providers[C])==null?void 0:N.reasoning_effort},[x,C]),_=p.useMemo(()=>e?pF(e):void 0,[e]),T=(S==null?void 0:S.reasoningEffort)??_??w??"medium",k=Ue(N=>e?N.isSessionProcessing(e):!1),O=p.useCallback(async()=>{try{const N=await fn.get(`respond/${e}/pending`);N.has_pending_question?(i(N),g.current=0):(i(null),g.current+=1)}catch(N){if(N instanceof Error&&N.message.includes("404")){i(null),g.current+=1;return}console.error("Failed to fetch pending question:",N)}finally{d(!1)}},[e]);p.useEffect(()=>{g.current=0,d(!0)},[e]),p.useEffect(()=>{var N;a!=null&&a.has_pending_question?(s(null),b({sessionId:e,question:(a==null?void 0:a.question)||""}),h(!1),(N=m.current)==null||N.call(m)):b(null)},[a==null?void 0:a.tool_call_id,e,a==null?void 0:a.question,b]);const I=a!=null&&a.has_pending_question||k?3e3:15e3;p.useEffect(()=>{O();const N=setInterval(()=>{l||O()},I);return()=>clearInterval(N)},[O,l,I]);const M=p.useCallback(N=>{s(N)},[]);p.useEffect(()=>()=>{b(null)},[b]);const $=async()=>{if(!o||o==="custom"){vn.warning("Please select an option");return}c(!0);try{const N=y==null?void 0:y.trim(),L=await fn.post(`respond/${e}`,{response:o,model:N||void 0,reasoning_effort:T});vn.success("Response submitted, AI will continue processing"),i(null),s(null),g.current=0;const j=L==null?void 0:L.auto_resume_status;["started","already_running"].includes(j||"")?e&&v(e,!0):j==="invalid_model"||j==="not_requested"?vn.error("No model configured. Please select a default model in Provider Settings, then resume the agent."):j==="error"&&console.error("[QuestionDialog] Failed to auto-resume agent execution"),t==null||t()}catch(N){console.error("Failed to submit response:",N),vn.error(N instanceof Error?N.message:"Submission failed")}finally{c(!1)}};if(u||!(a!=null&&a.has_pending_question))return null;const{question:R,options:A,allow_custom:P}=a;return E.jsxs("div",{className:Ao.questionCard,style:{background:r.colorBgContainer,borderColor:r.colorBorderSecondary,border:`1px solid ${r.colorBorderSecondary}`},children:[E.jsxs("div",{className:Ao.questionHeader,"data-collapsed":f?"true":"false",onClick:()=>h(N=>!N),role:"button",tabIndex:0,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&h(L=>!L)},children:[E.jsxs("span",{className:Ao.headerLeft,children:[E.jsx("span",{className:Ao.questionIcon,children:"🤔"}),E.jsx(ix,{strong:!0,className:Ao.questionText,style:{color:r.colorPrimary},title:f?R:void 0,children:R})]}),E.jsx(De,{type:"text",size:"small",icon:f?E.jsx(As,{}):E.jsx(sF,{}),className:Ao.collapseBtn,tabIndex:-1})]}),!f&&E.jsxs("div",{className:Ao.questionBody,children:[E.jsx(Xa.Group,{className:Ao.optionsGroup,value:o,onChange:N=>M(N.target.value),children:E.jsxs(He,{direction:"vertical",size:4,style:{width:"100%"},children:[A==null?void 0:A.map((N,L)=>E.jsx(Xa,{value:N,className:Ao.optionItem,children:E.jsx(ix,{style:{color:r.colorText},children:N})},L)),P&&E.jsx(Xa,{value:"custom",className:Ao.optionItem,children:E.jsxs(He,{size:4,children:[E.jsx(NE,{}),E.jsx(ix,{style:{color:r.colorText},children:"Other (type below)"})]})})]})}),o==="custom"&&E.jsx("div",{className:Ao.customHint,children:E.jsx(ix,{type:"secondary",style:{fontSize:12},children:"↓ Type your answer in the input box below and press Enter"})}),o&&o!=="custom"&&E.jsx("div",{className:Ao.questionFooter,children:E.jsx(De,{type:"primary",size:"small",onClick:$,loading:l,children:"Confirm"})})]})]})};function e1e(e){return e.budgetLimit===0?0:e.totalTokens/e.budgetLimit*100}function JBt(e){const t=e1e(e);return t>=90?"error":t>=70?"warning":t>=50?"success":"default"}function Im(e){return e.toLocaleString()}const eFt=({usage:e,showDetails:t=!0,size:n="small",className:r=""})=>{const a=e1e(e),i=JBt(e),o=()=>a>=90?"#ff4d4f":a>=70?"#faad14":"#52c41a",s=E.jsxs("div",{style:{minWidth:180},children:[E.jsx("div",{style:{marginBottom:4,fontWeight:"bold"},children:"Token Usage"}),E.jsxs("div",{style:{fontSize:12},children:[Im(e.totalTokens)," /"," ",Im(e.budgetLimit)," tokens"]}),E.jsxs("div",{style:{fontSize:12,color:"#888"},children:[a.toFixed(1),"% used"]}),t&&E.jsxs("div",{style:{marginTop:6,borderTop:"1px solid #ddd",paddingTop:6,fontSize:11},children:[E.jsxs("div",{children:["System: ",Im(e.systemTokens)]}),e.summaryTokens>0&&E.jsxs("div",{children:["Summary: ",Im(e.summaryTokens)]}),E.jsxs("div",{children:["Messages: ",Im(e.windowTokens)]})]})]});return E.jsx(wn,{title:s,placement:"top",arrow:!0,children:E.jsxs(He,{className:`token-usage-display ${r}`,size:4,align:"center",style:{lineHeight:1},children:[E.jsx($E,{type:"line",percent:Math.min(a,100),size:{height:n==="small"?6:8,width:80},strokeColor:o(),showInfo:!1,style:{margin:0,lineHeight:1}}),E.jsxs("span",{style:{fontSize:n==="small"?11:12,color:i==="error"?"#ff4d4f":i==="warning"?"#faad14":"#52c41a",whiteSpace:"nowrap",fontWeight:500},children:[a.toFixed(0),"%"]})]})})},Zu=class Zu{static getInstance(){return Zu.instance||(Zu.instance=new Zu),Zu.instance}parseUserCommand(t){console.log(`[ToolService] parseUserCommand: Parsing content: "${t}"`);const n=t.trim();if(!n.startsWith("/"))return console.log('[ToolService] parseUserCommand: Content does not start with "/", not a tool command.'),null;const r=n.indexOf(" ");let a,i;if(r===-1?(a=n.substring(1),i=""):(a=n.substring(1,r),i=n.substring(r+1).trim()),a){const o={tool_name:a,user_description:i};return console.log("[ToolService] parseUserCommand: Successfully parsed command:",o),o}return console.log("[ToolService] parseUserCommand: Failed to parse tool name from content."),null}parseAIResponseToToolCall(t){return this.parseUserCommand(t)}async executeTool(t){console.log("[ToolService] executeTool: Attempting to execute tool via HTTP with request:",t);try{const n=await Bn.post("tools/execute",t),r=JSON.parse(n.result);return console.log("[ToolService] executeTool: Parsed structured result:",r),r}catch(n){throw console.error("[ToolService] executeTool: HTTP tool execution failed:",n),n instanceof Zp?new Error(`Workflow execution failed: ${n.message}`):n}}};Bt(Zu,"instance");let dj=Zu;const tFt=new dj,{Text:Ec}=Qt,{useToken:nFt}=pn,rFt="chat-session-sub-sessions-collapsed:",aFt=3,iFt=420,o2=e=>{const t=(e||"").trim().toLowerCase();return t?t==="started"||t==="already_running"?"running":t==="success"||t==="done"?"completed":t==="canceled"?"cancelled":t==="queued"||t==="created"?"pending":t:"pending"},oFt=(e,t)=>{if(t&&t.trim())return t;if(e.isRunning)return"running";if(e.lastRunStatus&&e.lastRunStatus.trim())return e.lastRunStatus;const n=e.messageCount??0;return n>2?"completed":(n>0,"pending")},t1e=e=>`${rFt}${e}`,s2=e=>{if(typeof window>"u")return!1;try{const t=window.localStorage.getItem(t1e(e));return t==="1"?!0:t==="0"?!1:null}catch{return null}},sFt=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(t1e(e),t?"1":"0")}catch{}},lFt=({parentSessionId:e})=>{const{token:t}=nFt(),n=pg(),[r,a]=p.useState(()=>s2(e)??!1),[i,o]=p.useState(null),[s,l]=p.useState(null),[c,u]=p.useState(null),d=Ue($=>$.subSessionsByParent),f=Ue($=>$.chats),h=Ue($=>$.loadChatHistory),g=Ue($=>$.refreshChats),m=Ue($=>$.setSessionProcessing),v=Ue($=>$.pinSession),b=Ue($=>$.unpinSession),y=Ue($=>$.deleteSession),S=Ue($=>$.upsertSubSessionProgress),C=Ue($=>$.clearSubSessionProgress),x=p.useMemo(()=>{const $=d[e]||{};return Object.entries($).map(([R,A])=>({childSessionId:R,...A}))},[e,d]),w=p.useMemo(()=>f.filter($=>$.kind==="child"&&$.parentSessionId===e).sort(($,R)=>{const A=Date.parse($.updatedAt||"")||0;return(Date.parse(R.updatedAt||"")||0)-A}),[f,e]),_=p.useMemo(()=>{const $=new Map(x.map(A=>[A.childSessionId,A])),R=[];for(const A of w){const P=$.get(A.id);R.push({childSessionId:A.id,title:(P==null?void 0:P.title)||A.title,status:o2(oFt(A,P==null?void 0:P.status)),error:(P==null?void 0:P.error)||A.lastRunError,lastHeartbeatAt:P==null?void 0:P.lastHeartbeatAt,lastEventAt:P==null?void 0:P.lastEventAt,outputPreview:P==null?void 0:P.outputPreview,pinned:A.pinned,updatedAt:A.updatedAt,isRunning:A.isRunning,messageCount:A.messageCount,lastRunStatus:A.lastRunStatus,lastRunError:A.lastRunError}),$.delete(A.id)}for(const A of $.values())R.push({childSessionId:A.childSessionId,title:A.title,status:o2(A.status),error:A.error,lastHeartbeatAt:A.lastHeartbeatAt,lastEventAt:A.lastEventAt,outputPreview:A.outputPreview});return R},[w,x]);p.useEffect(()=>{a(s2(e)??!1)},[e]),p.useEffect(()=>{s2(e)===null&&a(_.length>aFt)},[e,_.length]);const T=p.useCallback(()=>{a($=>{const R=!$;return sFt(e,R),R})},[e]),k=p.useCallback($=>$ instanceof Error&&$.message.trim()?$.message:"Failed to run child session",[]),O=p.useCallback(async($,R="regenerate")=>{if(!n){S(e,$,{status:"error",error:"No model configured. Please select a model first.",lastEventAt:new Date().toISOString()});return}o($),S(e,$,{status:"running",error:void 0,lastEventAt:new Date().toISOString()}),m($,!0);try{const A=R==="error_retry"?"error_retry":"after_last_user";await Lw.truncateSessionMessages($,{mode:A}),R==="regenerate"&&await h($,{mode:"replace"});const P=await Lw.execute($,n);if(P.status==="started"||P.status==="already_running")return;if(P.status==="completed"){m($,!1),S(e,$,{status:"completed",error:void 0,lastEventAt:new Date().toISOString()}),await g();return}throw new Error(`Execute failed: ${P.status}`)}catch(A){m($,!1),S(e,$,{status:"error",error:k(A),lastEventAt:new Date().toISOString()})}finally{o(A=>A===$?null:A)}},[n,h,e,g,m,k,S]),I=p.useCallback(async $=>{const R=typeof window<"u"?window.prompt.bind(window):null;if(!R)return;const A=R("Send a follow-up message to this child session:","Continue from where you left off.");if(A===null)return;const P=A.trim();if(!P){S(e,$,{status:"error",error:"Follow-up message cannot be empty.",lastEventAt:new Date().toISOString()});return}l($),S(e,$,{status:"running",error:void 0,lastEventAt:new Date().toISOString()}),m($,!0);try{const N=await tFt.executeTool({tool_name:"sub_session_manager",session_id:e,parameters:[{name:"action",value:"send_message"},{name:"child_session_id",value:$},{name:"message",value:P},{name:"auto_run",value:"true"}]});if(!N.success)throw new Error(N.result||"Follow-up failed");let L="running";try{JSON.parse(N.result).status==="pending"&&(L="pending")}catch{L="running"}S(e,$,{status:L,error:void 0,lastEventAt:new Date().toISOString()}),await g()}catch(N){m($,!1),S(e,$,{status:"error",error:N instanceof Error&&N.message.trim()?N.message:"Failed to continue child session",lastEventAt:new Date().toISOString()})}finally{l(N=>N===$?null:N)}},[e,g,m,S]),M=p.useCallback(async $=>{u($);try{await y($),C(e,$)}finally{u(R=>R===$?null:R)}},[C,y,e]);return _.length===0?null:E.jsx(Ot,{size:"small",style:{marginBottom:t.marginMD},"data-testid":"sub-sessions-panel",title:E.jsxs(Ec,{strong:!0,children:["Child Sessions ",E.jsxs(Ec,{type:"secondary",children:["(",_.length,")"]})]}),extra:E.jsx(De,{type:"text",size:"small",icon:r?E.jsx(As,{}):E.jsx(sF,{}),onClick:T,"data-testid":"sub-sessions-toggle",children:r?"Expand":"Collapse"}),children:r?E.jsxs(Ec,{type:"secondary","data-testid":"sub-sessions-collapsed-hint",children:["Hidden ",_.length," child sessions. Click Expand to view."]}):E.jsx(rt,{vertical:!0,gap:t.marginSM,"data-testid":"sub-sessions-list",style:{maxHeight:`${iFt}px`,overflowY:"auto",paddingRight:t.paddingXS},children:_.map($=>{const R=o2($.status),A=R==="running",P=i===$.childSessionId,N=s===$.childSessionId,L=c===$.childSessionId,j=P||N||L;return E.jsxs(rt,{align:"flex-start",justify:"space-between",gap:t.marginSM,style:{padding:t.paddingSM,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:t.borderRadius},children:[E.jsxs(rt,{vertical:!0,style:{flex:1,minWidth:0},children:[E.jsxs(rt,{align:"center",gap:t.marginXS,style:{minWidth:0},children:[E.jsxs(Ec,{strong:!0,ellipsis:!0,style:{minWidth:0},children:[$.title||"Child Session"," ",E.jsxs(Ec,{type:"secondary",children:["(",$.childSessionId,")"]})]}),E.jsx(Dn,{color:"geekblue",style:{marginInlineEnd:0,flex:"0 0 auto"},children:"Child"}),$.pinned?E.jsx(Dn,{color:"gold",style:{marginInlineEnd:0,flex:"0 0 auto"},children:"Pinned"}):null]}),E.jsxs(Ec,{type:"secondary",children:["Status: ",R,$.updatedAt?` • updated: ${$.updatedAt}`:"",$.lastHeartbeatAt?` • heartbeat: ${$.lastHeartbeatAt}`:""]}),$.outputPreview?E.jsx(Ec,{style:{marginTop:t.marginXS},ellipsis:!0,children:$.outputPreview}):null,$.error?E.jsx(Ec,{type:"danger",style:{marginTop:t.marginXS},children:$.error}):null]}),E.jsxs(rt,{gap:8,children:[E.jsx(De,{size:"small",disabled:j,onClick:()=>{J8($.childSessionId),h($.childSessionId)},children:"Open"}),E.jsx(De,{size:"small",loading:N,disabled:L||P||A,"data-testid":`sub-session-continue-${$.childSessionId}`,onClick:()=>{I($.childSessionId)},children:"Continue"}),E.jsx(Qc,{trigger:["click"],menu:{items:[{key:"regenerate",label:"Regenerate response"},{key:"error_retry",label:"Retry failed request"}],onClick:({key:D})=>{O($.childSessionId,D)}},disabled:L||A||N,children:E.jsx(De,{size:"small",loading:P,disabled:L||A||N,"data-testid":`sub-session-retry-${$.childSessionId}`,children:"Retry"})}),typeof $.pinned=="boolean"?E.jsx(De,{size:"small",disabled:j,onClick:()=>{$.pinned?b($.childSessionId):v($.childSessionId)},children:$.pinned?"Unpin":"Pin"}):null,E.jsx(De,{danger:!0,size:"small",loading:L,disabled:P,"data-testid":`sub-session-delete-${$.childSessionId}`,onClick:()=>{M($.childSessionId)},children:"Delete"})]})]},$.childSessionId)})})})},n1e="chat_scroll_anchors_v1";function cFt(e){if(!e||typeof e!="object")return!1;const t=e;return t.v===1&&typeof t.anchorId=="string"&&typeof t.offsetPx=="number"&&typeof t.ts=="number"}function r1e(){try{const e=localStorage.getItem(n1e);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object")return{};const n={};for(const[r,a]of Object.entries(t))cFt(a)&&(n[r]=a);return n}catch{return{}}}function uFt(e){try{localStorage.setItem(n1e,JSON.stringify(e))}catch(t){console.warn("[ScrollAnchor] Failed to write:",t)}}function dFt(e){return r1e()[e]??null}function fFt(e,t){const n=r1e();n[e]=t,uFt(n)}const l2=1,pFt=3,hFt=2e3;function gFt(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight);return Math.min(Math.max(0,t),n)}function mFt(e){const{scrollEl:t,getAnchorElement:n,offsetPx:r,isCancelled:a}=e;return new Promise(i=>{const o=performance.now();let s=0,l=-1,c=Number.NaN;const u=()=>{if(a()){i();return}const d=n();if(!d){requestAnimationFrame(u);return}const f=t.getBoundingClientRect(),g=d.getBoundingClientRect().top-f.top,m=gFt(t,t.scrollTop+(g-r));if(Math.abs(t.scrollTop-m)>l2)t.scrollTop=m,s=0;else{const b=Number.isFinite(c)?Math.abs(m-c)<=l2:!1,y=Math.abs(t.scrollTop-l)<=l2;s=b&&y?s+1:0}c=m,l=t.scrollTop;const v=performance.now()-o>hFt;if(s>=pFt||v){i();return}requestAnimationFrame(u)};requestAnimationFrame(u)})}const vFt=300,bFt=.5;function yFt(e){return"type"in e&&(e.type==="tool_session"||e.type==="compression_divider")?e.id:"message"in e&&e.message?e.message.id:null}function a1e(e){if("type"in e&&(e.type==="tool_session"||e.type==="compression_divider"))return e.createdAt;if("message"in e&&e.message)return e.message.createdAt}function $re(e){if(!e)return null;const t=Date.parse(e);return Number.isFinite(t)?t:null}function SFt(e,t){const n=$re(e.createdAt);if(n!=null){let r=null,a=Number.POSITIVE_INFINITY;for(let i=0;i<t.length;i++){const o=$re(a1e(t[i]));if(o==null)continue;const s=Math.abs(o-n);s<a&&(a=s,r=i)}if(r!=null)return r}if(typeof e.indexHint=="number"){const r=Math.max(0,Math.min(t.length-1,e.indexHint));return Number.isFinite(r)?r:null}return null}function yU(e){return Array.from(e.querySelectorAll("[data-chat-entry-id]"))}function xFt(e,t){const n=yU(e);for(const r of n)if(r.dataset.chatEntryId===t)return r;return null}function wFt(e,t){const n=yU(e);if(n.length===0)return null;const r=Math.max(0,Math.min(n.length-1,t));return n[r]??null}function CFt(e){const t=yU(e);if(t.length===0)return null;const n=e.getBoundingClientRect().top;for(const r of t)if(r.getBoundingClientRect().bottom>n)return r;return t[t.length-1]??null}function EFt(e){const{currentSessionId:t,messagesListRef:n,renderableMessages:r}=e,a=p.useRef(new Set),i=p.useRef(!1),o=p.useRef(0),s=p.useRef(null),l=p.useRef(null),c=p.useRef(!1);p.useEffect(()=>{const g=n.current;if(!g)return;const m=()=>{c.current=!0};return g.addEventListener("wheel",m,{passive:!0}),g.addEventListener("touchmove",m,{passive:!0}),g.addEventListener("pointerdown",m),()=>{g.removeEventListener("wheel",m),g.removeEventListener("touchmove",m),g.removeEventListener("pointerdown",m)}},[n]);const u=p.useMemo(()=>{const g=new Map;for(let m=0;m<r.length;m++){const v=yFt(r[m]);v&&g.set(v,m)}return g},[r]),d=p.useCallback(()=>{const g=n.current;if(!g||r.length===0)return null;const m=CFt(g);if(!m)return null;const v=m.dataset.chatEntryId;if(!v)return null;const b=g.getBoundingClientRect(),y=m.getBoundingClientRect(),S=u.get(v),C=typeof S=="number"?r[S]:void 0;return{v:1,anchorId:v,offsetPx:y.top-b.top,ts:Date.now(),indexHint:S,createdAt:C?a1e(C):void 0}},[u,n,r]),f=p.useCallback(g=>{if(i.current)return;const m=d();if(!m)return;const v=l.current;v&&v.anchorId===m.anchorId&&Math.abs(v.offsetPx-m.offsetPx)<=bFt||(fFt(g,m),l.current=m)},[d]),h=p.useCallback(g=>{if(!t||i.current)return;s.current&&clearTimeout(s.current);const m=t;s.current=setTimeout(()=>{f(m)},vFt)},[t,f]);return p.useEffect(()=>{const g=t;return()=>{g&&(s.current&&(clearTimeout(s.current),s.current=null),f(g))}},[t,f]),p.useLayoutEffect(()=>{if(!t)return;const g=n.current;if(!g||r.length===0||a.current.has(t))return;const m=dFt(t);if(!m){a.current.add(t);return}const v=u.get(m.anchorId),b=typeof v=="number"?v:SFt(m,r);if(b==null){a.current.add(t);return}s.current&&(clearTimeout(s.current),s.current=null);const y=++o.current;i.current=!0,c.current=!1,g.style.overflowAnchor="none";const S=()=>o.current!==y||c.current;return mFt({scrollEl:g,getAnchorElement:()=>xFt(g,m.anchorId)??wFt(g,b),offsetPx:m.offsetPx,isCancelled:S}).finally(()=>{o.current===y&&(i.current=!1,a.current.add(t),g.style.overflowAnchor="",f(t))}),()=>{o.current===y&&o.current++}},[t,u,r,r.length,n,f]),{handleScroll:h}}const _Ft=({currentSessionId:e,interactionState:t,messagesListRef:n,renderableMessages:r})=>{const[a,i]=p.useState(!1),[o,s]=p.useState(!1),l=p.useRef(!1),c=p.useRef(!0),{handleScroll:u}=EFt({currentSessionId:e,messagesListRef:n,renderableMessages:r}),d=p.useCallback(v=>{const b=n.current;if(!b)return;if(r.length===0){i(!1),s(!1);return}const y=b.scrollHeight-b.scrollTop-b.clientHeight,S=b.scrollTop,C=150,x=150,w=y<C,_=S<x;i(!w),s(!_&&r.length>3),y>C*2?l.current=!0:w&&(l.current=!1),u(v)},[r.length,u]),f=p.useCallback(()=>{const v=n.current;v&&r.length!==0&&requestAnimationFrame(()=>{v.scrollTo({top:v.scrollHeight,behavior:"smooth"})})},[r.length]),h=p.useCallback(()=>{const v=n.current;v&&requestAnimationFrame(()=>{v.scrollTo({top:0,behavior:"smooth"})})},[]),g=p.useCallback(()=>{l.current=!1},[]);p.useEffect(()=>{const v=b=>{var O,I;const S=(O=b.detail)==null?void 0:O.messageId;if(!S){console.error("No messageId provided for navigation");return}const C=r.findIndex(M=>"message"in M&&M.message?M.message.id===S:"id"in M?M.id===S:!1);if(C===-1){console.warn("Message not found for navigation:",S);return}const x=r[C],w=x&&"message"in x?x.message.id:x&&"id"in x?x.id:S,_=document.getElementById(`message-${w}`),T=Array.from(((I=n.current)==null?void 0:I.querySelectorAll("[data-chat-entry-id]"))||[]),k=_||T.find(M=>M.dataset.chatEntryId===w);if(!k){console.warn("Message element not found for navigation:",S);return}k.scrollIntoView({behavior:"smooth",block:"center"}),k.classList.add("highlight-message"),setTimeout(()=>{k.classList.remove("highlight-message")},2e3)};return window.addEventListener("navigate-to-message",v),()=>{window.removeEventListener("navigate-to-message",v)}},[r]);const m=p.useRef(t.value);return p.useEffect(()=>{const v=t.value;m.current==="IDLE"&&v==="THINKING"&&(g(),f()),m.current=v},[t.value,g,f]),p.useEffect(()=>Yr.subscribe(v=>{v.sessionId===e&&(l.current||v.content&&f())}),[e,f]),p.useEffect(()=>{!l.current&&r.length>0&&!c.current&&f(),c.current=!1},[r.length,f]),p.useEffect(()=>{if(!n.current){i(!1),s(!1);return}if(r.length===0){i(!1),s(!1);return}const b=()=>{const S=n.current;if(!S)return;const C=S.scrollHeight-S.scrollTop-S.clientHeight,x=S.scrollTop,w=150,_=150,T=C<w,k=x<_;i(!T),s(!k&&r.length>3)};b();let y=requestAnimationFrame(()=>{b(),y=requestAnimationFrame(b)});return()=>cancelAnimationFrame(y)},[r.length,e]),p.useEffect(()=>{c.current=!0,l.current=!1},[e]),{handleMessagesScroll:d,resetUserScroll:g,scrollToBottom:f,scrollToTop:h,showScrollToBottom:a,showScrollToTop:o}};function TFt(e){return"type"in e&&e.type==="tool_session"}function kFt(e){return"type"in e&&e.type==="compression_divider"}const Ire=e=>{const t=Date.parse(e||"");return Number.isFinite(t)?t:Number.MAX_SAFE_INTEGER},OFt=e=>"type"in e?e.createdAt:e.message.createdAt,$Ft=e=>!("type"in e)&&e.message.role==="system";function IFt(e){return e.role==="assistant"&&e.type==="tool_call"}function AFt(e){return e.role==="assistant"&&e.type==="tool_result"}function RFt(e){const t=[],n=new Map;for(const r of e){if(IFt(r)){const a=r.toolCalls||[];if(a.length===0){t.push(r);continue}a.forEach((i,o)=>{const s=i.toolCallId||`${r.id}-${o}`,c={call:{...r,id:`${r.id}:${s}`,toolCalls:[{...i,toolCallId:s}]}};n.set(s,c),t.push([c])});continue}if(AFt(r)){const a=r.toolCallId,i=a?n.get(a):void 0;if(i)i.result=r;else{const o=a||`unknown-${r.id}`,l={call:{role:"assistant",type:"tool_call",id:`synthetic-tool-call:${r.id}`,createdAt:r.createdAt,toolCalls:[{toolCallId:o,toolName:r.toolName||"unknown",parameters:{},streamingOutput:""}],isCompressed:r.isCompressed,compressedEventId:r.compressedEventId},result:r};t.push([l])}continue}t.push(r)}return t}const MFt=(e,t)=>{var o;const n=p.useMemo(()=>{var l;const s=t.find(c=>c.role==="system");return s||((l=e==null?void 0:e.config)!=null&&l.baseSystemPrompt?{id:`system-prompt-${e.id}`,role:"system",content:e.config.baseSystemPrompt,createdAt:new Date(e.createdAt).toISOString()}:null)},[e,t]),r=p.useCallback(s=>!1,[]),a=p.useCallback(s=>{if(kFt(s))return{type:"compression_divider",id:s.id,createdAt:s.createdAt,label:s.label};if(TFt(s))return{type:"tool_session",id:s.id,sessionId:s.sessionId,tools:s.tools,createdAt:s.createdAt};const l=s.message.role==="user"?"flex-end":"flex-start";let c=s.messageType;if(!c&&s.message.role==="assistant"&&"type"in s.message){const u=s.message.type;(u==="text"||u==="plan"||u==="question"||u==="tool_call"||u==="tool_result")&&(c=u)}return{type:"message",message:s.message,align:l,messageType:c}},[]),i=p.useMemo(()=>{var g;const s=t.filter(m=>{const v=m.role;return!(v!=="user"&&v!=="assistant"&&v!=="system"&&v!=="tool"||r(m))}),l=RFt(s),c=[];l.forEach((m,v)=>{var S,C,x,w;if(Array.isArray(m)){const _=m[0],T=(C=(S=_==null?void 0:_.call)==null?void 0:S.toolCalls)==null?void 0:C[0],k=(T==null?void 0:T.toolCallId)||((x=_==null?void 0:_.call)==null?void 0:x.id);c.push({type:"tool_session",id:`tool-session-${k||v}`,sessionId:(e==null?void 0:e.id)||"default",tools:m,createdAt:((w=_==null?void 0:_.call)==null?void 0:w.createdAt)||new Date().toISOString()});return}const b=m;let y;if(b.role==="assistant"&&"type"in b){const _=b.type;(_==="text"||_==="plan"||_==="question"||_==="tool_call"||_==="tool_result")&&(y=_)}c.push({message:b,messageType:y})}),!s.some(m=>m.role==="system")&&n&&c.unshift({message:n});const d=((g=e==null?void 0:e.config)==null?void 0:g.compressionEvents)||[],f=c.findIndex(m=>!$Ft(m)),h=f===-1?c.length:f;for(const m of d){const v={type:"compression_divider",id:`compression-divider-${m.id}`,createdAt:m.createdAt,label:`Context compressed - ${m.messagesCompressed} messages archived`},b=Ire(m.createdAt),y=c.findIndex((S,C)=>C>=h&&Ire(OFt(S))>b);y===-1?c.push(v):c.splice(y,0,v)}return c},[(o=e==null?void 0:e.config)==null?void 0:o.compressionEvents,e==null?void 0:e.id,t,r,n]);return{systemPromptMessage:n,renderableMessages:i,convertRenderableEntry:a}},fj="chat-toggle-batch-export-selection",{useToken:PFt}=pn,{useBreakpoint:NFt}=CE,{Text:LFt}=Qt,DFt=e=>e.role==="user"?"You":e.role==="assistant"?"Assistant":e.role==="system"?"System":"Message",jFt=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},BFt=e=>e.map(({message:t,text:n},r)=>{const a=DFt(t),i=jFt(t.createdAt);return[`## ${r+1}. ${a} · ${i}`,"",n].join(`
|
|
1040
|
+
`)},wBt=async(e,t,n)=>{var s,l,c;const r=t==null?void 0:t.trim();if(!r)throw new Error("No model configured. Please select a default model in Provider Settings.");const o=((c=(l=(s=(await khe().chat.completions.create({model:r,messages:[{role:"system",content:"You fix Mermaid diagrams using the parser/render error context. Return only corrected Mermaid code without markdown fences or extra text."},{role:"user",content:xBt(e,n)}],temperature:0})).choices)==null?void 0:s[0])==null?void 0:l.message)==null?void 0:c.content)??"";return YCe(o)},CBt=e=>{const t=pg();return p.useCallback(async(n,r)=>{const a=Ue.getState(),i=a.currentSessionId,o=a.chats.find(h=>h.id===i);if(!i||!o)throw new Error("No active chat available");const s=o.messages.find(h=>h.id===e);if(!s||s.role!=="assistant"||s.type!=="text")throw new Error("Mermaid fix is only available for assistant text messages");const l=await wBt(n,t,r);if(!l)throw new Error("AI did not return a Mermaid fix");const c=SBt(s.content,n,l);if(!c)throw new Error("Unable to locate Mermaid block to update");await Lw.patchSessionMessage(i,e,{content:c});const u=Ue.getState(),d=u.chats.find(h=>h.id===i);if(!d)throw new Error("No active chat available");const f=d.messages.map(h=>h.id===e?{...h,content:c}:h);u.updateSession(i,{messages:f})},[e,t])},EBt=e=>e.xs?"100%":e.sm?"95%":"800px",{useToken:_Bt}=pn,{useBreakpoint:TBt}=CE,kBt="chat-send-message",OBt=({sessionId:e,message:t,onDelete:n,messageType:r})=>{const{role:a,id:i}=t,{token:o}=_Bt(),{message:s}=Ns.useApp(),l=TBt(),c=Ue(F=>F.updateSession),u=Ue(F=>F.loadChatHistory),d=Ue(F=>F.refreshChats),f=p.useRef(null),[h,g]=p.useState(!1),m=Ue(F=>e?F.processingChats.has(e):!1),v=p.useCallback(F=>typeof window>"u"?Promise.reject(new Error("window is unavailable")):new Promise((B,z)=>{const G={content:F,sessionId:e,handled:!1,resolve:B,reject:z};window.dispatchEvent(new CustomEvent(kBt,{detail:G})),G.handled||z(new Error("No chat message dispatcher available"))}),[]),b=p.useMemo(()=>{if(!t.createdAt)return null;const F=new Date(t.createdAt);if(Number.isNaN(F.getTime()))return null;try{return eDt(F,"MMM d, yyyy HH:mm")}catch{return F.toLocaleString()}},[t.createdAt]),y=p.useMemo(()=>fBt(t,r),[t,r]),S=p.useMemo(()=>pBt(t,y),[t,y]),C=p.useMemo(()=>hBt(t,y),[t,y]),x=p.useMemo(()=>GCe(t),[t]),w=CBt(i),_=p.useCallback(async F=>{var B;if(!e||!i){s.warning("Cannot restore this message");return}try{const z=await Lw.restoreSessionState(e,{target_message_id:i,restore_files:F});await u(e,{mode:"replace"}),await d();const G=((B=z.file_errors)==null?void 0:B.length)??0;if(G>0){s.warning(`Chat restored. ${G} file(s) could not be restored.`);return}F?s.success(`Files and chat restored (${z.messages_removed} message(s) removed).`):s.success(`Chat restored (${z.messages_removed} message(s) removed).`)}catch(z){const G=z instanceof Error?z.message:"Failed to restore session";s.error(G)}},[s,e,u,i,d]),T=p.useCallback(()=>{_(!1)},[_]),k=p.useCallback(()=>{_(!0)},[_]),{contextMenuItems:O,handleMouseUp:I,copyToClipboard:M,referenceMessage:$}=bBt({messageText:x,messageId:i,currentSessionId:e,onDelete:n,onRestoreChat:T,onRestoreFilesAndChat:k,cardRef:f}),R=p.useMemo(()=>a==="user"&&x.startsWith("/"),[a,x]),A=p.useMemo(()=>qCe(o,{onFixMermaid:w}),[o,w]),P=p.useMemo(()=>[VE,dU],[]),N=p.useMemo(()=>[uU],[]),L=p.useMemo(()=>[sDt(()=>M(x)),lDt($)],[x,M,$]),{handleExecutePlan:j,handleRefinePlan:D,handleQuestionAnswer:H}=yBt({currentSessionId:e,updateSession:c,sendMessage:v});return y==="plan"&&S&&a==="assistant"?E.jsx(CCe,{plan:S,contextId:e||"",onExecute:j,onRefine:D,timestamp:b??void 0}):y==="question"&&C&&a==="assistant"?E.jsx(ECe,{question:C,contextId:e||"",onAnswer:H,disabled:m||!1,timestamp:b??void 0}):YMt(t)?E.jsx(mDt,{taskList:t.taskList}):KMt(t)?(console.log("[MessageCard] Rendering FileReferenceCard for message:",t.id,"paths:",t.paths),E.jsx(rt,{justify:"flex-end",style:{width:"100%"},children:E.jsx(_Ce,{paths:t.paths,displayText:t.displayText,timestamp:b??void 0})})):E.jsx(rt,{vertical:!0,onContextMenu:F=>I(F),style:{width:"100%"},children:E.jsx(Qc,{menu:{items:O},trigger:["contextMenu"],children:E.jsx(Ot,{"data-testid":a==="assistant"?"assistant-message":"user-message",id:i?`message-${i}`:void 0,ref:f,style:{width:"100%",minWidth:"100%",maxWidth:EBt(l),margin:"0 auto",background:a==="user"?o.colorPrimaryBg:a==="assistant"?o.colorBgLayout:o.colorBgContainer,borderRadius:o.borderRadiusLG,boxShadow:"none",position:"relative",wordWrap:"break-word",overflowWrap:"break-word"},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:E.jsxs(He,{direction:"vertical",size:o.marginXS,style:{width:"100%",maxWidth:"100%"},children:[E.jsx(uBt,{role:a,formattedTimestamp:b,token:o}),t.role==="user"&&t.images&&E.jsx(rDt,{images:t.images}),E.jsx(rt,{vertical:!0,style:{width:"100%",maxWidth:"100%"},children:E.jsx(cBt,{message:t,messageText:x,isUserToolCall:R,formatUserToolCall:gBt,markdownComponents:A,markdownPlugins:P,rehypePlugins:N})}),E.jsx(oDt,{isVisible:h,position:{bottom:o.paddingXS,right:o.paddingXS},buttons:L})]})})})})},XCe=p.memo(OBt,(e,t)=>e.message===t.message&&e.messageType===t.messageType&&e.onDelete===t.onDelete);XCe.displayName="MessageCard";const{Text:vb}=Qt,{useToken:$Bt}=pn,IBt=e=>({p:({children:t})=>E.jsx(vb,{style:{marginBottom:e.marginSM,display:"block"},children:t}),ol:({children:t})=>E.jsx("ol",{style:{marginBottom:e.marginSM,paddingLeft:20},children:t}),ul:({children:t})=>E.jsx("ul",{style:{marginBottom:e.marginSM,paddingLeft:20},children:t}),li:({children:t})=>E.jsx("li",{style:{marginBottom:e.marginXS},children:t}),code({className:t,children:n,inline:r,...a}){const i=/language-([^\s]+)/i.exec(t||""),o=i?i[1]:"",s=r??(!i&&!t),l=n?String(n).replace(/\n$/,""):"";return s?E.jsx(vb,{code:!0,className:t,...a,children:n}):l.trim()?o.toLowerCase()==="mermaid"?E.jsx(Ot,{size:"small",styles:{body:{padding:0}},style:{position:"relative",maxWidth:"100%",overflow:"auto",marginBottom:e.marginSM},children:E.jsx("pre",{style:{margin:0,padding:e.paddingSM,background:e.colorBgContainer,borderRadius:e.borderRadiusSM,fontSize:"13px"},children:E.jsx("code",{children:l})})}):UCe(o,l,e,void 0):null},blockquote:({children:t})=>E.jsx(Ot,{size:"small",styles:{body:{padding:`${e.paddingXS}px ${e.padding}px`}},style:{borderLeft:`3px solid ${e.colorPrimary}`,background:e.colorPrimaryBg,margin:`${e.marginXS}px 0`,color:e.colorTextSecondary,fontStyle:"italic"},children:t}),a:({children:t,href:n})=>{const r=typeof n=="string"?n.trim():"";return r?E.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.preventDefault(),WCe(r)},style:{color:e.colorLink,textDecoration:"underline",overflowWrap:"anywhere"},children:t}):E.jsx(E.Fragment,{children:t})},table:({children:t})=>E.jsx(Ot,{size:"small",styles:{body:{padding:0}},style:{overflow:"auto",margin:`${e.marginSM}px 0`},children:E.jsx("table",{style:{width:"100%",borderCollapse:"collapse",border:`1px solid ${e.colorBorder}`},children:t})}),thead:({children:t})=>E.jsx("thead",{style:{backgroundColor:e.colorBgContainer},children:t}),tbody:({children:t})=>E.jsx("tbody",{children:t}),tr:({children:t})=>E.jsx("tr",{style:{borderBottom:`1px solid ${e.colorBorder}`},children:t}),th:({children:t})=>E.jsx("th",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,textAlign:"left",fontWeight:"bold",borderRight:`1px solid ${e.colorBorder}`},children:t}),td:({children:t})=>E.jsx("td",{style:{padding:`${e.paddingXS}px ${e.paddingSM}px`,borderRight:`1px solid ${e.colorBorder}`},children:t}),input:({type:t,checked:n,disabled:r})=>t==="checkbox"?E.jsx("input",{type:"checkbox",checked:n,disabled:r,style:{marginRight:e.marginXS,accentColor:e.colorPrimary},readOnly:!0}):E.jsx("input",{type:t,checked:n,disabled:r})}),ZCe=p.memo(({sessionId:e})=>{const{token:t}=$Bt(),n=`streaming-${e}`,r=`streaming-reasoning-${e}`,[a,i]=p.useState(()=>Yr.getLatest(n)??""),[o,s]=p.useState(()=>Yr.getLatest(r)??"");p.useEffect(()=>Yr.subscribeMessage(n,d=>{i(d??"")}),[n]),p.useEffect(()=>Yr.subscribeMessage(r,d=>{s(d??"")}),[r]);const l=p.useMemo(()=>[VE,dU],[]),c=p.useMemo(()=>[uU],[]),u=p.useMemo(()=>IBt(t),[t]);return E.jsx(Ot,{"data-testid":"streaming-indicator",style:{width:"100%",minWidth:"100%",maxWidth:"800px",margin:"0 auto",background:t.colorBgLayout,borderRadius:t.borderRadiusLG,boxShadow:"none",position:"relative",wordWrap:"break-word",overflowWrap:"break-word"},children:E.jsxs(He,{direction:"vertical",size:t.marginXS,style:{width:"100%",maxWidth:"100%"},children:[E.jsx(rt,{align:"baseline",justify:"space-between",gap:t.marginXS,children:E.jsx(vb,{type:"secondary",strong:!0,style:{fontSize:t.fontSizeSM},children:"Assistant"})}),E.jsxs(rt,{vertical:!0,style:{width:"100%",maxWidth:"100%"},children:[o?E.jsx(gl,{size:"small",defaultActiveKey:["reasoning"],style:{marginBottom:t.marginSM,background:t.colorBgContainer,borderColor:t.colorBorderSecondary},items:[{key:"reasoning",label:E.jsx(vb,{strong:!0,children:"Reasoning"}),children:E.jsx(Uc,{remarkPlugins:l,rehypePlugins:c,components:u,children:o})}]}):null,a?E.jsx(Uc,{remarkPlugins:l,rehypePlugins:c,components:u,children:a}):E.jsx(vb,{italic:!0,children:"Assistant is thinking..."}),E.jsx("span",{className:"blinking-cursor",style:{display:"inline-block",marginLeft:"0.2em",color:t.colorText}})]})]})})});ZCe.displayName="StreamingMessageCard";const{Text:Io}=Qt,ABt="chat-session-tool-collapse:",QCe=(e,t)=>`${ABt}${e}:${t}`,a2=(e,t)=>{if(typeof window>"u")return null;try{const n=window.localStorage.getItem(QCe(e,t));if(!n)return null;const r=JSON.parse(n);if(!r||typeof r!="object")return null;const a="isExpanded"in r&&typeof r.isExpanded=="boolean"?r.isExpanded:!0,i="expandedTools"in r&&Array.isArray(r.expandedTools)?r.expandedTools.filter(o=>typeof o=="string"):[];return{isExpanded:a,expandedTools:i}}catch{return null}},RBt=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(QCe(e,t),JSON.stringify(n))}catch{}},i2=e=>{var t,n;return((n=(t=e.call.toolCalls)==null?void 0:t[0])==null?void 0:n.toolCallId)||e.call.id};function MBt(e,t){return e.result?e.result.isError?{icon:E.jsx(LE,{style:{color:t.colorError}}),color:t.colorError,text:"Error"}:{icon:E.jsx(Hl,{style:{color:t.colorSuccess}}),color:t.colorSuccess,text:"Done"}:{icon:E.jsx(DE,{spin:!0,style:{color:t.colorPrimary}}),color:t.colorPrimary,text:"Running"}}function PBt(e,t){const n=Yd(e);if(n)return`MCP ${n.serverId}: ${n.toolName}`;const r=(o,s)=>{const l=typeof o=="string"?o:String(o??"");return!l||l.length<=s?l:l.substring(0,s).trimEnd()+"…"},a={file_read:o=>`Reading: ${r(o.path||o.file_path||"unknown",35)}`,file_write:o=>`Writing: ${r(o.path||o.file_path||"unknown",35)}`,file_edit:o=>`Editing: ${r(o.path||o.file_path||"unknown",35)}`,bash:o=>`Executing: ${r(o.command,35)}`,grep:o=>`Searching: "${r(o.pattern,25)}"`,glob:o=>`Finding: "${o.pattern}"`,read:o=>`Reading: ${o.file_path||"file"}`,write:o=>`Writing: ${o.file_path||"file"}`,edit:o=>`Editing: ${o.file_path||"file"}`,search:o=>`Searching: "${r(o.query||o.pattern,25)}"`,default:()=>`${e}`};return(a[e]||a.default)(t)}const NBt=({tools:e,sessionId:t,defaultExpanded:n=!1})=>{const{token:r}=pn.useToken(),a=e.length===1,i=p.useMemo(()=>{var w,_,T;const C=e[0],x=(_=(w=C==null?void 0:C.call)==null?void 0:w.toolCalls)==null?void 0:_[0];return(x==null?void 0:x.toolCallId)||((T=C==null?void 0:C.call)==null?void 0:T.id)||"unknown"},[e]),o=p.useMemo(()=>{const C=e[0];return C?i2(C):null},[e]),[s,l]=p.useState(()=>{const C=a2(t,i);return C?C.isExpanded:n}),[c,u]=p.useState(()=>{const C=a2(t,i);return C?new Set(C.expandedTools):new Set(n&&o?[o]:[])});p.useEffect(()=>{const C=a2(t,i);if(C){l(C.isExpanded),u(new Set(C.expandedTools));return}l(n),u(new Set(n&&o?[o]:[]))},[n,o,t,i]),p.useEffect(()=>{const C=new Set(e.map(x=>i2(x)));u(x=>{const w=new Set;let _=!1;return x.forEach(T=>{C.has(T)?w.add(T):_=!0}),!_&&w.size===x.size?x:w})},[e]),p.useEffect(()=>{RBt(t,i,{isExpanded:s,expandedTools:Array.from(c)})},[t,i,s,c]);const{completedCount:d,pendingCount:f,hasErrors:h}=p.useMemo(()=>{let C=0,x=0,w=!1;return e.forEach(_=>{_.result?(C++,_.result.isError&&(w=!0)):x++}),{completedCount:C,pendingCount:x,hasErrors:w}},[e]),g=p.useMemo(()=>f>0?{color:"processing",text:`${d}/${e.length} completed`}:h?{color:"warning",text:`${d} completed with errors`}:{color:"success",text:`${d} completed`},[d,f,h,e.length]),m=p.useMemo(()=>{let C=0,x=0,w=0;return e.forEach(_=>{var O,I;const T=(I=(O=_.result)==null?void 0:O.result)==null?void 0:I.result;if(!T)return;const k=UN(T);k&&(C+=k.added,x+=k.removed,w+=1)}),{added:C,removed:x,changedTools:w}},[e]),v=p.useMemo(()=>{var w,_,T;if(e.length!==1)return"Tool Session";const C=(T=(_=(w=e[0])==null?void 0:w.call)==null?void 0:_.toolCalls)==null?void 0:T[0];if(!C)return"Tool Session";const x=Yd(C.toolName);return x?`MCP ${x.serverId}: ${x.toolName}`:C.toolName||"Tool Session"},[e]),b=p.useMemo(()=>e.map((C,x)=>{const w=C.call.toolCalls[0];if(!w)return null;const _=MBt(C,r),T=PBt(w.toolName,w.parameters),k=Yd(w.toolName),O=C.result?UN(C.result.result.result):null,I=C.result?g0(C.result.result.result):null;return{key:i2(C),label:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r.marginSM,width:"100%"},children:[E.jsxs("span",{style:{fontSize:r.fontSizeSM,color:r.colorTextTertiary,minWidth:20},children:[x+1,"."]}),E.jsx("span",{style:{flexShrink:0},children:_.icon}),k?E.jsxs(He,{size:"small",wrap:!1,children:[E.jsx(Dn,{color:"purple",style:{marginInlineEnd:0},children:"MCP"}),E.jsx(Io,{strong:!0,style:{fontSize:r.fontSizeSM},children:k.toolName}),E.jsx(Io,{type:"secondary",style:{fontSize:r.fontSizeSM},children:E.jsx(Io,{code:!0,style:{fontSize:r.fontSizeSM},children:k.serverId})})]}):E.jsx(Io,{strong:!0,style:{fontSize:r.fontSizeSM,flexShrink:0},children:w.toolName}),E.jsx(Io,{type:"secondary",ellipsis:!0,style:{flex:1,minWidth:0,fontSize:r.fontSizeSM},children:T}),I&&E.jsx(Io,{type:"secondary",ellipsis:!0,style:{maxWidth:180,fontSize:r.fontSizeSM},children:I.file_path.split(/[\\/]/).pop()||I.file_path}),O&&E.jsxs(He,{size:4,style:{marginLeft:r.marginXS},children:[E.jsxs(Io,{style:{color:r.colorSuccess,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",O.added]}),E.jsxs(Io,{style:{color:r.colorError,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",O.removed]})]})]}),children:E.jsxs(He,{direction:"vertical",style:{width:"100%"},size:r.marginSM,children:[E.jsx(vU,{toolName:w.toolName,parameters:w.parameters,toolCallId:w.toolCallId,streamingOutput:w.streamingOutput,defaultExpanded:!1}),C.result&&C.result.result.display_preference!=="Hidden"&&E.jsx(mU,{content:C.result.result.result,toolName:w.toolName,status:C.result.isError?"error":"success",timestamp:C.result.createdAt,defaultCollapsed:!1})]}),style:{borderBottom:x<e.length-1?`1px solid ${r.colorBorderSecondary}`:void 0}}}).filter(C=>C!==null),[e,r]),y=E.jsx("div",{style:{padding:r.paddingSM},children:E.jsx(gl,{ghost:!0,activeKey:Array.from(c),onChange:C=>{const x=new Set(Array.isArray(C)?C:C?[C]:[]);u(x)},items:b})}),S={backgroundColor:r.colorBgElevated,border:`1px solid ${r.colorBorder}`,borderRadius:r.borderRadiusLG,overflow:"hidden"};return a?E.jsx("div",{style:{width:"100%"},children:E.jsx("div",{style:S,children:y})}):E.jsxs("div",{style:S,children:[E.jsxs("div",{style:{padding:`${r.paddingSM}px ${r.paddingMD}px`,backgroundColor:r.colorBgContainer,borderBottom:s?`1px solid ${r.colorBorder}`:void 0,cursor:"pointer",display:"flex",alignItems:"center",gap:r.marginSM},onClick:()=>l(!s),children:[E.jsx(t0,{style:{color:r.colorPrimary}}),E.jsx(Io,{strong:!0,style:{flex:1},children:v}),E.jsx(Gy,{count:e.length,style:{backgroundColor:r.colorPrimary}}),m.changedTools>0&&E.jsxs(He,{size:4,style:{marginInlineStart:r.marginXS},children:[E.jsxs(Io,{style:{color:r.colorSuccess,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["+",m.added]}),E.jsxs(Io,{style:{color:r.colorError,fontSize:r.fontSizeSM,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:["-",m.removed]})]}),E.jsx(Io,{type:"secondary",style:{fontSize:r.fontSizeSM},children:g.text}),E.jsx("div",{style:{marginLeft:r.marginXS},children:s?E.jsx(As,{style:{color:r.colorTextSecondary}}):E.jsx(tu,{style:{color:r.colorTextSecondary}})})]}),s&&y]})},JCe=p.memo(NBt);JCe.displayName="ToolSessionCard";const{Content:LBt}=Cs;function Ore(e){return"type"in e&&(e.type==="tool_session"||e.type==="compression_divider")?e.id:e.message.id}const DBt=({currentChat:e,currentSessionId:t,convertRenderableEntry:n,handleDeleteMessage:r,handleMessagesScroll:a,hasSystemPrompt:i,messagesListRef:o,renderableMessages:s,rowGap:l,showMessagesView:c,screens:u,workflowDraftId:d,interactionState:f,padding:h,selectionMode:g,selectedMessageIds:m,selectableMessageIds:v,onToggleMessageSelection:b})=>{const y=p.useRef(s);y.current=s;const S=p.useCallback(k=>{const O=y.current[k];return O?Ore(O):String(k)},[]),C=INt({count:s.length,getScrollElement:()=>o.current,estimateSize:()=>120,overscan:5,gap:l,getItemKey:S}),x=(k,O)=>{if(!g)return null;const I=v.has(k);return E.jsx(Zc,{checked:m.has(k),disabled:!I,onChange:()=>{I&&b(k)},style:{marginTop:8,marginLeft:O==="flex-end"?8:0,marginRight:O==="flex-start"?8:0}})},w=k=>{const O=n(k);return O.type==="compression_divider"?E.jsx(nl,{plain:!0,style:{margin:"6px 0 10px 0"},children:O.label}):O.type==="tool_session"?E.jsx(rt,{justify:"flex-start",style:{width:"100%",maxWidth:"100%"},children:E.jsx("div",{id:`message-${O.id}`,style:{width:"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(JCe,{tools:O.tools,sessionId:O.sessionId,createdAt:O.createdAt,defaultExpanded:!1})})}):O.message.role==="system"?E.jsxs(rt,{align:"flex-start",style:{width:"100%",maxWidth:"100%"},children:[x(O.message.id,"flex-start"),E.jsx("div",{style:{flex:1,minWidth:0},children:E.jsx(gCe,{currentChat:e,message:O.message})})]}):E.jsxs(rt,{justify:O.align,align:"flex-start",style:{width:"100%",maxWidth:"100%"},children:[O.align==="flex-start"&&x(O.message.id,O.align),E.jsx("div",{style:{width:O.message.role==="user"?"85%":"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(XCe,{sessionId:t,message:O.message,messageType:O.messageType,onDelete:O.message.id===d?void 0:r})}),O.align==="flex-end"&&x(O.message.id,O.align)]})},_=(c||i)&&s.length>0,T=C.getVirtualItems();return E.jsxs(LBt,{className:`chat-view-messages-list ${c?"visible":"hidden"}`,style:{flex:1,minHeight:0,padding:h,overflowY:"auto",opacity:c?1:0,scrollbarWidth:"none",msOverflowStyle:"none"},ref:o,onScroll:a,children:[_&&E.jsx("div",{style:{position:"relative",width:"100%",height:C.getTotalSize()},children:T.map(k=>{const O=s[k.index];if(!O)return null;const I=Ore(O);return E.jsx("div",{"data-chat-entry-id":I,"data-index":k.index,ref:C.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${k.start}px)`},children:w(O)},I)})}),f.matches("THINKING")&&t&&E.jsx("div",{style:{paddingTop:l},children:E.jsx(rt,{justify:"flex-start",style:{width:"100%",maxWidth:"100%"},children:E.jsx("div",{style:{width:"100%",maxWidth:u.xs?"100%":"90%"},children:E.jsx(ZCe,{sessionId:t})})})})]})},{Text:$m}=Qt,jBt={pending:{icon:E.jsx(Nw,{}),color:"#8c8c8c",text:"Pending",tagColor:"default"},in_progress:{icon:E.jsx(oF,{spin:!0}),color:"#1890ff",text:"In Progress",tagColor:"processing"},completed:{icon:E.jsx(Hl,{}),color:"#52c41a",text:"Completed",tagColor:"success"},blocked:{icon:E.jsx(LE,{}),color:"#ff4d4f",text:"Blocked",tagColor:"error"}},BBt=({sessionId:e,initialCollapsed:t=!0})=>{const{token:n}=pn.useToken(),r=Ue(x=>x.chats.find(w=>w.id===e)),a=(r==null?void 0:r.kind)==="child"&&(r.parentSessionId||r.rootSessionId)||e,i=Ue(x=>x.taskLists[a]),o=Ue(x=>x.activeItems[a]),s=Ue(x=>x.evaluationStates[a]),[l,c]=p.useState(t),[u,d]=p.useState(!1),f=(s==null?void 0:s.isEvaluating)||!1,h=(s==null?void 0:s.reasoning)||null,g=i?{session_id:i.session_id,title:i.title,items:i.items,progress:{completed:i.items.filter(x=>x.status==="completed").length,total:i.items.length,percentage:i.items.length>0?Math.round(i.items.filter(x=>x.status==="completed").length/i.items.length*100):0}}:null;if(!g)return null;const m=()=>{u||c(!l)},v=x=>{x.stopPropagation(),d(!u),u||c(!1)},{title:b,items:y,progress:S}=g,C=S.percentage===100;return E.jsx(Ot,{size:"small",style:{marginBottom:16,borderRadius:8,boxShadow:f?`0 0 0 2px ${n.colorPrimaryBorder}`:"0 2px 8px rgba(0, 0, 0, 0.06)",opacity:l&&!u?.9:1},styles:{body:{padding:l?"12px 16px":16}},title:E.jsxs(He,{onClick:m,style:{cursor:"pointer",width:"100%"},children:[E.jsx(PVe,{style:{color:n.colorPrimary}}),E.jsx($m,{strong:!0,style:{fontSize:15},children:b||"Task List"}),f&&E.jsx(Dn,{icon:E.jsx(oF,{spin:!0}),color:"processing",children:"Evaluating"}),!l&&S.total>0&&E.jsx(Gy,{count:`${S.completed}/${S.total}`,style:{backgroundColor:C?"#52c41a":n.colorPrimary}})]}),extra:E.jsxs(He,{children:[S.total>0&&l&&E.jsxs($m,{type:"secondary",style:{fontSize:13},children:[S.completed,"/",S.total,C&&E.jsx(Hl,{style:{color:"#52c41a",marginLeft:4}})]}),E.jsx(wn,{title:u?"Unpin":"Pin",children:E.jsx("span",{onClick:v,style:{cursor:"pointer",color:u?n.colorPrimary:n.colorTextSecondary,fontSize:16},children:u?E.jsx(yde,{}):E.jsx(Sde,{})})}),!u&&E.jsx("span",{onClick:m,style:{cursor:"pointer",color:n.colorTextSecondary,fontSize:12,transform:l?"rotate(-90deg)":void 0,transition:"transform 0.2s"},children:l?E.jsx(tu,{}):E.jsx(As,{})})]}),children:!l&&E.jsxs(E.Fragment,{children:[h&&E.jsx(fr,{icon:E.jsx(aF,{}),message:"LLM Evaluation",description:h,type:"info",showIcon:!0,style:{marginBottom:16}}),S.total>0&&E.jsx("div",{style:{marginBottom:16},children:E.jsx($E,{percent:S.percentage,size:"small",status:C?"success":"active",format:x=>E.jsxs($m,{type:"secondary",children:[x,"%"]})})}),E.jsx(jr,{size:"small",dataSource:y,renderItem:x=>{const w=jBt[x.status],_=o===x.id;return E.jsx(jr.Item,{style:{padding:"12px 0",borderLeft:_?`3px solid ${n.colorPrimary}`:"3px solid transparent",paddingLeft:_?12:15,backgroundColor:_?n.colorPrimaryBg:"transparent",borderRadius:4,marginBottom:4},children:E.jsx("div",{style:{width:"100%"},children:E.jsxs(He,{align:"start",style:{width:"100%"},children:[E.jsx(wn,{title:w.text,children:E.jsx("span",{style:{color:w.color,fontSize:16},children:w.icon})}),E.jsxs("div",{style:{flex:1,minWidth:0},children:[E.jsx($m,{style:{textDecoration:x.status==="completed"?"line-through":"none",color:x.status==="completed"?n.colorTextSecondary:n.colorText,fontWeight:_?500:400},children:x.description}),E.jsx("div",{style:{marginTop:4},children:E.jsxs(He,{size:8,wrap:!0,children:[E.jsx(Dn,{color:w.tagColor,children:w.text}),x.tool_calls_count!==void 0&&x.tool_calls_count>0&&E.jsxs(Dn,{icon:E.jsx(t0,{}),color:"blue",children:[x.tool_calls_count," tools"]}),x.depends_on.length>0&&E.jsx(wn,{title:`Depends on: ${x.depends_on.join(", ")}`,children:E.jsxs(Dn,{icon:E.jsx(J7e,{}),children:[x.depends_on.length," deps"]})})]})}),x.notes&&E.jsx($m,{type:"secondary",style:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:n.colorFillQuaternary,borderRadius:4},children:x.notes})]})]})})})}})]})})},FBt="_questionCard_1emac_1",zBt="_questionHeader_1emac_8",HBt="_headerLeft_1emac_22",UBt="_questionIcon_1emac_30",WBt="_questionText_1emac_35",qBt="_collapseBtn_1emac_47",VBt="_questionBody_1emac_52",GBt="_optionsGroup_1emac_56",KBt="_optionItem_1emac_60",YBt="_customHint_1emac_72",XBt="_questionFooter_1emac_80",Ao={questionCard:FBt,questionHeader:zBt,headerLeft:HBt,questionIcon:UBt,questionText:WBt,collapseBtn:qBt,questionBody:VBt,optionsGroup:GBt,optionItem:KBt,customHint:YBt,questionFooter:XBt},{Text:ix}=Qt,{useToken:ZBt}=pn,QBt=e=>{const t=(e||"").replace(/\r\n?/g,`
|
|
1041
|
+
`).trim();return t?t.includes(`
|
|
1042
|
+
`)?t:t.replace(/\s+(?=\d+[).]\s)/g,`
|
|
1043
|
+
`).replace(/\s+(?=[一二三四五六七八九十]+[、.]\s)/g,`
|
|
1044
|
+
`).replace(/\s+(?=[-*•]\s)/g,`
|
|
1045
|
+
`):""},JBt=({sessionId:e,onResponseSubmitted:t,onQuestionAppeared:n})=>{const{token:r}=ZBt(),[a,i]=p.useState(null),[o,s]=p.useState(null),[l,c]=p.useState(!1),[u,d]=p.useState(!0),[f,h]=p.useState(!1),g=p.useRef(0),m=p.useRef(n);m.current=n;const v=Ue(L=>L.setSessionProcessing),b=Ue(L=>L.setPendingQuestionRespond),y=pg(),S=Ue(L=>{var j;return e?(j=L.inputStates)==null?void 0:j[e]:void 0}),C=Ho(L=>L.currentProvider),x=Ho(L=>L.providerConfig),w=p.useMemo(()=>{var L;return(L=x.providers[C])==null?void 0:L.reasoning_effort},[x,C]),_=p.useMemo(()=>e?pF(e):void 0,[e]),T=(S==null?void 0:S.reasoningEffort)??_??w??"medium",k=Ue(L=>e?L.isSessionProcessing(e):!1),O=p.useCallback(async()=>{try{const L=await fn.get(`respond/${e}/pending`);L.has_pending_question?(i(L),g.current=0):(i(null),g.current+=1)}catch(L){if(L instanceof Error&&L.message.includes("404")){i(null),g.current+=1;return}console.error("Failed to fetch pending question:",L)}finally{d(!1)}},[e]);p.useEffect(()=>{g.current=0,d(!0)},[e]),p.useEffect(()=>{var L;a!=null&&a.has_pending_question?(s(null),b({sessionId:e,question:(a==null?void 0:a.question)||""}),h(!1),(L=m.current)==null||L.call(m)):b(null)},[a==null?void 0:a.tool_call_id,e,a==null?void 0:a.question,b]);const I=a!=null&&a.has_pending_question||k?3e3:15e3;p.useEffect(()=>{O();const L=setInterval(()=>{l||O()},I);return()=>clearInterval(L)},[O,l,I]);const M=p.useCallback(L=>{s(L)},[]);p.useEffect(()=>()=>{b(null)},[b]);const $=async()=>{if(!o||o==="custom"){vn.warning("Please select an option");return}c(!0);try{const L=y==null?void 0:y.trim(),j=await fn.post(`respond/${e}`,{response:o,model:L||void 0,reasoning_effort:T});vn.success("Response submitted, AI will continue processing"),i(null),s(null),g.current=0;const D=j==null?void 0:j.auto_resume_status;["started","already_running"].includes(D||"")?e&&v(e,!0):D==="invalid_model"||D==="not_requested"?vn.error("No model configured. Please select a default model in Provider Settings, then resume the agent."):D==="error"&&console.error("[QuestionDialog] Failed to auto-resume agent execution"),t==null||t()}catch(L){console.error("Failed to submit response:",L),vn.error(L instanceof Error?L.message:"Submission failed")}finally{c(!1)}};if(u||!(a!=null&&a.has_pending_question))return null;const{question:R,options:A,allow_custom:P}=a,N=QBt(R);return E.jsxs("div",{className:Ao.questionCard,style:{background:r.colorBgContainer,borderColor:r.colorBorderSecondary,border:`1px solid ${r.colorBorderSecondary}`},children:[E.jsxs("div",{className:Ao.questionHeader,"data-collapsed":f?"true":"false",onClick:()=>h(L=>!L),role:"button",tabIndex:0,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&h(j=>!j)},children:[E.jsxs("span",{className:Ao.headerLeft,children:[E.jsx("span",{className:Ao.questionIcon,children:"🤔"}),E.jsx(ix,{strong:!0,className:Ao.questionText,style:{color:r.colorPrimary,whiteSpace:"pre-wrap"},title:f?N:void 0,children:N})]}),E.jsx(De,{type:"text",size:"small",icon:f?E.jsx(As,{}):E.jsx(sF,{}),className:Ao.collapseBtn,tabIndex:-1})]}),!f&&E.jsxs("div",{className:Ao.questionBody,children:[E.jsx(Xa.Group,{className:Ao.optionsGroup,value:o,onChange:L=>M(L.target.value),children:E.jsxs(He,{direction:"vertical",size:4,style:{width:"100%"},children:[A==null?void 0:A.map((L,j)=>E.jsx(Xa,{value:L,className:Ao.optionItem,children:E.jsx(ix,{style:{color:r.colorText},children:L})},j)),P&&E.jsx(Xa,{value:"custom",className:Ao.optionItem,children:E.jsxs(He,{size:4,children:[E.jsx(NE,{}),E.jsx(ix,{style:{color:r.colorText},children:"Other (type below)"})]})})]})}),o==="custom"&&E.jsx("div",{className:Ao.customHint,children:E.jsx(ix,{type:"secondary",style:{fontSize:12},children:"↓ Type your answer in the input box below and press Enter"})}),o&&o!=="custom"&&E.jsx("div",{className:Ao.questionFooter,children:E.jsx(De,{type:"primary",size:"small",onClick:$,loading:l,children:"Confirm"})})]})]})};function e1e(e){return e.budgetLimit===0?0:e.totalTokens/e.budgetLimit*100}function eFt(e){const t=e1e(e);return t>=90?"error":t>=70?"warning":t>=50?"success":"default"}function Im(e){return e.toLocaleString()}const tFt=({usage:e,showDetails:t=!0,size:n="small",className:r=""})=>{const a=e1e(e),i=eFt(e),o=()=>a>=90?"#ff4d4f":a>=70?"#faad14":"#52c41a",s=E.jsxs("div",{style:{minWidth:180},children:[E.jsx("div",{style:{marginBottom:4,fontWeight:"bold"},children:"Token Usage"}),E.jsxs("div",{style:{fontSize:12},children:[Im(e.totalTokens)," /"," ",Im(e.budgetLimit)," tokens"]}),E.jsxs("div",{style:{fontSize:12,color:"#888"},children:[a.toFixed(1),"% used"]}),t&&E.jsxs("div",{style:{marginTop:6,borderTop:"1px solid #ddd",paddingTop:6,fontSize:11},children:[E.jsxs("div",{children:["System: ",Im(e.systemTokens)]}),e.summaryTokens>0&&E.jsxs("div",{children:["Summary: ",Im(e.summaryTokens)]}),E.jsxs("div",{children:["Messages: ",Im(e.windowTokens)]})]})]});return E.jsx(wn,{title:s,placement:"top",arrow:!0,children:E.jsxs(He,{className:`token-usage-display ${r}`,size:4,align:"center",style:{lineHeight:1},children:[E.jsx($E,{type:"line",percent:Math.min(a,100),size:{height:n==="small"?6:8,width:80},strokeColor:o(),showInfo:!1,style:{margin:0,lineHeight:1}}),E.jsxs("span",{style:{fontSize:n==="small"?11:12,color:i==="error"?"#ff4d4f":i==="warning"?"#faad14":"#52c41a",whiteSpace:"nowrap",fontWeight:500},children:[a.toFixed(0),"%"]})]})})},Zu=class Zu{static getInstance(){return Zu.instance||(Zu.instance=new Zu),Zu.instance}parseUserCommand(t){console.log(`[ToolService] parseUserCommand: Parsing content: "${t}"`);const n=t.trim();if(!n.startsWith("/"))return console.log('[ToolService] parseUserCommand: Content does not start with "/", not a tool command.'),null;const r=n.indexOf(" ");let a,i;if(r===-1?(a=n.substring(1),i=""):(a=n.substring(1,r),i=n.substring(r+1).trim()),a){const o={tool_name:a,user_description:i};return console.log("[ToolService] parseUserCommand: Successfully parsed command:",o),o}return console.log("[ToolService] parseUserCommand: Failed to parse tool name from content."),null}parseAIResponseToToolCall(t){return this.parseUserCommand(t)}async executeTool(t){console.log("[ToolService] executeTool: Attempting to execute tool via HTTP with request:",t);try{const n=await Bn.post("tools/execute",t),r=JSON.parse(n.result);return console.log("[ToolService] executeTool: Parsed structured result:",r),r}catch(n){throw console.error("[ToolService] executeTool: HTTP tool execution failed:",n),n instanceof Zp?new Error(`Workflow execution failed: ${n.message}`):n}}};Bt(Zu,"instance");let dj=Zu;const nFt=new dj,{Text:Ec}=Qt,{useToken:rFt}=pn,aFt="chat-session-sub-sessions-collapsed:",iFt=3,oFt=420,o2=e=>{const t=(e||"").trim().toLowerCase();return t?t==="started"||t==="already_running"?"running":t==="success"||t==="done"?"completed":t==="canceled"?"cancelled":t==="queued"||t==="created"?"pending":t:"pending"},sFt=(e,t)=>{if(t&&t.trim())return t;if(e.isRunning)return"running";if(e.lastRunStatus&&e.lastRunStatus.trim())return e.lastRunStatus;const n=e.messageCount??0;return n>2?"completed":(n>0,"pending")},t1e=e=>`${aFt}${e}`,s2=e=>{if(typeof window>"u")return!1;try{const t=window.localStorage.getItem(t1e(e));return t==="1"?!0:t==="0"?!1:null}catch{return null}},lFt=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(t1e(e),t?"1":"0")}catch{}},cFt=({parentSessionId:e})=>{const{token:t}=rFt(),n=pg(),[r,a]=p.useState(()=>s2(e)??!1),[i,o]=p.useState(null),[s,l]=p.useState(null),[c,u]=p.useState(null),d=Ue($=>$.subSessionsByParent),f=Ue($=>$.chats),h=Ue($=>$.loadChatHistory),g=Ue($=>$.refreshChats),m=Ue($=>$.setSessionProcessing),v=Ue($=>$.pinSession),b=Ue($=>$.unpinSession),y=Ue($=>$.deleteSession),S=Ue($=>$.upsertSubSessionProgress),C=Ue($=>$.clearSubSessionProgress),x=p.useMemo(()=>{const $=d[e]||{};return Object.entries($).map(([R,A])=>({childSessionId:R,...A}))},[e,d]),w=p.useMemo(()=>f.filter($=>$.kind==="child"&&$.parentSessionId===e).sort(($,R)=>{const A=Date.parse($.updatedAt||"")||0;return(Date.parse(R.updatedAt||"")||0)-A}),[f,e]),_=p.useMemo(()=>{const $=new Map(x.map(A=>[A.childSessionId,A])),R=[];for(const A of w){const P=$.get(A.id);R.push({childSessionId:A.id,title:(P==null?void 0:P.title)||A.title,status:o2(sFt(A,P==null?void 0:P.status)),error:(P==null?void 0:P.error)||A.lastRunError,lastHeartbeatAt:P==null?void 0:P.lastHeartbeatAt,lastEventAt:P==null?void 0:P.lastEventAt,outputPreview:P==null?void 0:P.outputPreview,pinned:A.pinned,updatedAt:A.updatedAt,isRunning:A.isRunning,messageCount:A.messageCount,lastRunStatus:A.lastRunStatus,lastRunError:A.lastRunError}),$.delete(A.id)}for(const A of $.values())R.push({childSessionId:A.childSessionId,title:A.title,status:o2(A.status),error:A.error,lastHeartbeatAt:A.lastHeartbeatAt,lastEventAt:A.lastEventAt,outputPreview:A.outputPreview});return R},[w,x]);p.useEffect(()=>{a(s2(e)??!1)},[e]),p.useEffect(()=>{s2(e)===null&&a(_.length>iFt)},[e,_.length]);const T=p.useCallback(()=>{a($=>{const R=!$;return lFt(e,R),R})},[e]),k=p.useCallback($=>$ instanceof Error&&$.message.trim()?$.message:"Failed to run child session",[]),O=p.useCallback(async($,R="regenerate")=>{if(!n){S(e,$,{status:"error",error:"No model configured. Please select a model first.",lastEventAt:new Date().toISOString()});return}o($),S(e,$,{status:"running",error:void 0,lastEventAt:new Date().toISOString()}),m($,!0);try{const A=R==="error_retry"?"error_retry":"after_last_user";await Lw.truncateSessionMessages($,{mode:A}),R==="regenerate"&&await h($,{mode:"replace"});const P=await Lw.execute($,n);if(P.status==="started"||P.status==="already_running")return;if(P.status==="completed"){m($,!1),S(e,$,{status:"completed",error:void 0,lastEventAt:new Date().toISOString()}),await g();return}throw new Error(`Execute failed: ${P.status}`)}catch(A){m($,!1),S(e,$,{status:"error",error:k(A),lastEventAt:new Date().toISOString()})}finally{o(A=>A===$?null:A)}},[n,h,e,g,m,k,S]),I=p.useCallback(async $=>{const R=typeof window<"u"?window.prompt.bind(window):null;if(!R)return;const A=R("Send a follow-up message to this child session:","Continue from where you left off.");if(A===null)return;const P=A.trim();if(!P){S(e,$,{status:"error",error:"Follow-up message cannot be empty.",lastEventAt:new Date().toISOString()});return}l($),S(e,$,{status:"running",error:void 0,lastEventAt:new Date().toISOString()}),m($,!0);try{const N=await nFt.executeTool({tool_name:"sub_session_manager",session_id:e,parameters:[{name:"action",value:"send_message"},{name:"child_session_id",value:$},{name:"message",value:P},{name:"auto_run",value:"true"}]});if(!N.success)throw new Error(N.result||"Follow-up failed");let L="running";try{JSON.parse(N.result).status==="pending"&&(L="pending")}catch{L="running"}S(e,$,{status:L,error:void 0,lastEventAt:new Date().toISOString()}),await g()}catch(N){m($,!1),S(e,$,{status:"error",error:N instanceof Error&&N.message.trim()?N.message:"Failed to continue child session",lastEventAt:new Date().toISOString()})}finally{l(N=>N===$?null:N)}},[e,g,m,S]),M=p.useCallback(async $=>{u($);try{await y($),C(e,$)}finally{u(R=>R===$?null:R)}},[C,y,e]);return _.length===0?null:E.jsx(Ot,{size:"small",style:{marginBottom:t.marginMD},"data-testid":"sub-sessions-panel",title:E.jsxs(Ec,{strong:!0,children:["Child Sessions ",E.jsxs(Ec,{type:"secondary",children:["(",_.length,")"]})]}),extra:E.jsx(De,{type:"text",size:"small",icon:r?E.jsx(As,{}):E.jsx(sF,{}),onClick:T,"data-testid":"sub-sessions-toggle",children:r?"Expand":"Collapse"}),children:r?E.jsxs(Ec,{type:"secondary","data-testid":"sub-sessions-collapsed-hint",children:["Hidden ",_.length," child sessions. Click Expand to view."]}):E.jsx(rt,{vertical:!0,gap:t.marginSM,"data-testid":"sub-sessions-list",style:{maxHeight:`${oFt}px`,overflowY:"auto",paddingRight:t.paddingXS},children:_.map($=>{const R=o2($.status),A=R==="running",P=i===$.childSessionId,N=s===$.childSessionId,L=c===$.childSessionId,j=P||N||L;return E.jsxs(rt,{align:"flex-start",justify:"space-between",gap:t.marginSM,style:{padding:t.paddingSM,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:t.borderRadius},children:[E.jsxs(rt,{vertical:!0,style:{flex:1,minWidth:0},children:[E.jsxs(rt,{align:"center",gap:t.marginXS,style:{minWidth:0},children:[E.jsxs(Ec,{strong:!0,ellipsis:!0,style:{minWidth:0},children:[$.title||"Child Session"," ",E.jsxs(Ec,{type:"secondary",children:["(",$.childSessionId,")"]})]}),E.jsx(Dn,{color:"geekblue",style:{marginInlineEnd:0,flex:"0 0 auto"},children:"Child"}),$.pinned?E.jsx(Dn,{color:"gold",style:{marginInlineEnd:0,flex:"0 0 auto"},children:"Pinned"}):null]}),E.jsxs(Ec,{type:"secondary",children:["Status: ",R,$.updatedAt?` • updated: ${$.updatedAt}`:"",$.lastHeartbeatAt?` • heartbeat: ${$.lastHeartbeatAt}`:""]}),$.outputPreview?E.jsx(Ec,{style:{marginTop:t.marginXS},ellipsis:!0,children:$.outputPreview}):null,$.error?E.jsx(Ec,{type:"danger",style:{marginTop:t.marginXS},children:$.error}):null]}),E.jsxs(rt,{gap:8,children:[E.jsx(De,{size:"small",disabled:j,onClick:()=>{J8($.childSessionId),h($.childSessionId)},children:"Open"}),E.jsx(De,{size:"small",loading:N,disabled:L||P||A,"data-testid":`sub-session-continue-${$.childSessionId}`,onClick:()=>{I($.childSessionId)},children:"Continue"}),E.jsx(Qc,{trigger:["click"],menu:{items:[{key:"regenerate",label:"Regenerate response"},{key:"error_retry",label:"Retry failed request"}],onClick:({key:D})=>{O($.childSessionId,D)}},disabled:L||A||N,children:E.jsx(De,{size:"small",loading:P,disabled:L||A||N,"data-testid":`sub-session-retry-${$.childSessionId}`,children:"Retry"})}),typeof $.pinned=="boolean"?E.jsx(De,{size:"small",disabled:j,onClick:()=>{$.pinned?b($.childSessionId):v($.childSessionId)},children:$.pinned?"Unpin":"Pin"}):null,E.jsx(De,{danger:!0,size:"small",loading:L,disabled:P,"data-testid":`sub-session-delete-${$.childSessionId}`,onClick:()=>{M($.childSessionId)},children:"Delete"})]})]},$.childSessionId)})})})},n1e="chat_scroll_anchors_v1";function uFt(e){if(!e||typeof e!="object")return!1;const t=e;return t.v===1&&typeof t.anchorId=="string"&&typeof t.offsetPx=="number"&&typeof t.ts=="number"}function r1e(){try{const e=localStorage.getItem(n1e);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object")return{};const n={};for(const[r,a]of Object.entries(t))uFt(a)&&(n[r]=a);return n}catch{return{}}}function dFt(e){try{localStorage.setItem(n1e,JSON.stringify(e))}catch(t){console.warn("[ScrollAnchor] Failed to write:",t)}}function fFt(e){return r1e()[e]??null}function pFt(e,t){const n=r1e();n[e]=t,dFt(n)}const l2=1,hFt=3,gFt=2e3;function mFt(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight);return Math.min(Math.max(0,t),n)}function vFt(e){const{scrollEl:t,getAnchorElement:n,offsetPx:r,isCancelled:a}=e;return new Promise(i=>{const o=performance.now();let s=0,l=-1,c=Number.NaN;const u=()=>{if(a()){i();return}const d=n();if(!d){requestAnimationFrame(u);return}const f=t.getBoundingClientRect(),g=d.getBoundingClientRect().top-f.top,m=mFt(t,t.scrollTop+(g-r));if(Math.abs(t.scrollTop-m)>l2)t.scrollTop=m,s=0;else{const b=Number.isFinite(c)?Math.abs(m-c)<=l2:!1,y=Math.abs(t.scrollTop-l)<=l2;s=b&&y?s+1:0}c=m,l=t.scrollTop;const v=performance.now()-o>gFt;if(s>=hFt||v){i();return}requestAnimationFrame(u)};requestAnimationFrame(u)})}const bFt=300,yFt=.5;function SFt(e){return"type"in e&&(e.type==="tool_session"||e.type==="compression_divider")?e.id:"message"in e&&e.message?e.message.id:null}function a1e(e){if("type"in e&&(e.type==="tool_session"||e.type==="compression_divider"))return e.createdAt;if("message"in e&&e.message)return e.message.createdAt}function $re(e){if(!e)return null;const t=Date.parse(e);return Number.isFinite(t)?t:null}function xFt(e,t){const n=$re(e.createdAt);if(n!=null){let r=null,a=Number.POSITIVE_INFINITY;for(let i=0;i<t.length;i++){const o=$re(a1e(t[i]));if(o==null)continue;const s=Math.abs(o-n);s<a&&(a=s,r=i)}if(r!=null)return r}if(typeof e.indexHint=="number"){const r=Math.max(0,Math.min(t.length-1,e.indexHint));return Number.isFinite(r)?r:null}return null}function yU(e){return Array.from(e.querySelectorAll("[data-chat-entry-id]"))}function wFt(e,t){const n=yU(e);for(const r of n)if(r.dataset.chatEntryId===t)return r;return null}function CFt(e,t){const n=yU(e);if(n.length===0)return null;const r=Math.max(0,Math.min(n.length-1,t));return n[r]??null}function EFt(e){const t=yU(e);if(t.length===0)return null;const n=e.getBoundingClientRect().top;for(const r of t)if(r.getBoundingClientRect().bottom>n)return r;return t[t.length-1]??null}function _Ft(e){const{currentSessionId:t,messagesListRef:n,renderableMessages:r}=e,a=p.useRef(new Set),i=p.useRef(!1),o=p.useRef(0),s=p.useRef(null),l=p.useRef(null),c=p.useRef(!1);p.useEffect(()=>{const g=n.current;if(!g)return;const m=()=>{c.current=!0};return g.addEventListener("wheel",m,{passive:!0}),g.addEventListener("touchmove",m,{passive:!0}),g.addEventListener("pointerdown",m),()=>{g.removeEventListener("wheel",m),g.removeEventListener("touchmove",m),g.removeEventListener("pointerdown",m)}},[n]);const u=p.useMemo(()=>{const g=new Map;for(let m=0;m<r.length;m++){const v=SFt(r[m]);v&&g.set(v,m)}return g},[r]),d=p.useCallback(()=>{const g=n.current;if(!g||r.length===0)return null;const m=EFt(g);if(!m)return null;const v=m.dataset.chatEntryId;if(!v)return null;const b=g.getBoundingClientRect(),y=m.getBoundingClientRect(),S=u.get(v),C=typeof S=="number"?r[S]:void 0;return{v:1,anchorId:v,offsetPx:y.top-b.top,ts:Date.now(),indexHint:S,createdAt:C?a1e(C):void 0}},[u,n,r]),f=p.useCallback(g=>{if(i.current)return;const m=d();if(!m)return;const v=l.current;v&&v.anchorId===m.anchorId&&Math.abs(v.offsetPx-m.offsetPx)<=yFt||(pFt(g,m),l.current=m)},[d]),h=p.useCallback(g=>{if(!t||i.current)return;s.current&&clearTimeout(s.current);const m=t;s.current=setTimeout(()=>{f(m)},bFt)},[t,f]);return p.useEffect(()=>{const g=t;return()=>{g&&(s.current&&(clearTimeout(s.current),s.current=null),f(g))}},[t,f]),p.useLayoutEffect(()=>{if(!t)return;const g=n.current;if(!g||r.length===0||a.current.has(t))return;const m=fFt(t);if(!m){a.current.add(t);return}const v=u.get(m.anchorId),b=typeof v=="number"?v:xFt(m,r);if(b==null){a.current.add(t);return}s.current&&(clearTimeout(s.current),s.current=null);const y=++o.current;i.current=!0,c.current=!1,g.style.overflowAnchor="none";const S=()=>o.current!==y||c.current;return vFt({scrollEl:g,getAnchorElement:()=>wFt(g,m.anchorId)??CFt(g,b),offsetPx:m.offsetPx,isCancelled:S}).finally(()=>{o.current===y&&(i.current=!1,a.current.add(t),g.style.overflowAnchor="",f(t))}),()=>{o.current===y&&o.current++}},[t,u,r,r.length,n,f]),{handleScroll:h}}const TFt=({currentSessionId:e,interactionState:t,messagesListRef:n,renderableMessages:r})=>{const[a,i]=p.useState(!1),[o,s]=p.useState(!1),l=p.useRef(!1),c=p.useRef(!0),{handleScroll:u}=_Ft({currentSessionId:e,messagesListRef:n,renderableMessages:r}),d=p.useCallback(v=>{const b=n.current;if(!b)return;if(r.length===0){i(!1),s(!1);return}const y=b.scrollHeight-b.scrollTop-b.clientHeight,S=b.scrollTop,C=150,x=150,w=y<C,_=S<x;i(!w),s(!_&&r.length>3),y>C*2?l.current=!0:w&&(l.current=!1),u(v)},[r.length,u]),f=p.useCallback(()=>{const v=n.current;v&&r.length!==0&&requestAnimationFrame(()=>{v.scrollTo({top:v.scrollHeight,behavior:"smooth"})})},[r.length]),h=p.useCallback(()=>{const v=n.current;v&&requestAnimationFrame(()=>{v.scrollTo({top:0,behavior:"smooth"})})},[]),g=p.useCallback(()=>{l.current=!1},[]);p.useEffect(()=>{const v=b=>{var O,I;const S=(O=b.detail)==null?void 0:O.messageId;if(!S){console.error("No messageId provided for navigation");return}const C=r.findIndex(M=>"message"in M&&M.message?M.message.id===S:"id"in M?M.id===S:!1);if(C===-1){console.warn("Message not found for navigation:",S);return}const x=r[C],w=x&&"message"in x?x.message.id:x&&"id"in x?x.id:S,_=document.getElementById(`message-${w}`),T=Array.from(((I=n.current)==null?void 0:I.querySelectorAll("[data-chat-entry-id]"))||[]),k=_||T.find(M=>M.dataset.chatEntryId===w);if(!k){console.warn("Message element not found for navigation:",S);return}k.scrollIntoView({behavior:"smooth",block:"center"}),k.classList.add("highlight-message"),setTimeout(()=>{k.classList.remove("highlight-message")},2e3)};return window.addEventListener("navigate-to-message",v),()=>{window.removeEventListener("navigate-to-message",v)}},[r]);const m=p.useRef(t.value);return p.useEffect(()=>{const v=t.value;m.current==="IDLE"&&v==="THINKING"&&(g(),f()),m.current=v},[t.value,g,f]),p.useEffect(()=>Yr.subscribe(v=>{v.sessionId===e&&(l.current||v.content&&f())}),[e,f]),p.useEffect(()=>{!l.current&&r.length>0&&!c.current&&f(),c.current=!1},[r.length,f]),p.useEffect(()=>{if(!n.current){i(!1),s(!1);return}if(r.length===0){i(!1),s(!1);return}const b=()=>{const S=n.current;if(!S)return;const C=S.scrollHeight-S.scrollTop-S.clientHeight,x=S.scrollTop,w=150,_=150,T=C<w,k=x<_;i(!T),s(!k&&r.length>3)};b();let y=requestAnimationFrame(()=>{b(),y=requestAnimationFrame(b)});return()=>cancelAnimationFrame(y)},[r.length,e]),p.useEffect(()=>{c.current=!0,l.current=!1},[e]),{handleMessagesScroll:d,resetUserScroll:g,scrollToBottom:f,scrollToTop:h,showScrollToBottom:a,showScrollToTop:o}};function kFt(e){return"type"in e&&e.type==="tool_session"}function OFt(e){return"type"in e&&e.type==="compression_divider"}const Ire=e=>{const t=Date.parse(e||"");return Number.isFinite(t)?t:Number.MAX_SAFE_INTEGER},$Ft=e=>"type"in e?e.createdAt:e.message.createdAt,IFt=e=>!("type"in e)&&e.message.role==="system";function AFt(e){return e.role==="assistant"&&e.type==="tool_call"}function RFt(e){return e.role==="assistant"&&e.type==="tool_result"}function MFt(e){const t=[],n=new Map;for(const r of e){if(AFt(r)){const a=r.toolCalls||[];if(a.length===0){t.push(r);continue}a.forEach((i,o)=>{const s=i.toolCallId||`${r.id}-${o}`,c={call:{...r,id:`${r.id}:${s}`,toolCalls:[{...i,toolCallId:s}]}};n.set(s,c),t.push([c])});continue}if(RFt(r)){const a=r.toolCallId,i=a?n.get(a):void 0;if(i)i.result=r;else{const o=a||`unknown-${r.id}`,l={call:{role:"assistant",type:"tool_call",id:`synthetic-tool-call:${r.id}`,createdAt:r.createdAt,toolCalls:[{toolCallId:o,toolName:r.toolName||"unknown",parameters:{},streamingOutput:""}],isCompressed:r.isCompressed,compressedEventId:r.compressedEventId},result:r};t.push([l])}continue}t.push(r)}return t}const PFt=(e,t)=>{var o;const n=p.useMemo(()=>{var l;const s=t.find(c=>c.role==="system");return s||((l=e==null?void 0:e.config)!=null&&l.baseSystemPrompt?{id:`system-prompt-${e.id}`,role:"system",content:e.config.baseSystemPrompt,createdAt:new Date(e.createdAt).toISOString()}:null)},[e,t]),r=p.useCallback(s=>!1,[]),a=p.useCallback(s=>{if(OFt(s))return{type:"compression_divider",id:s.id,createdAt:s.createdAt,label:s.label};if(kFt(s))return{type:"tool_session",id:s.id,sessionId:s.sessionId,tools:s.tools,createdAt:s.createdAt};const l=s.message.role==="user"?"flex-end":"flex-start";let c=s.messageType;if(!c&&s.message.role==="assistant"&&"type"in s.message){const u=s.message.type;(u==="text"||u==="plan"||u==="question"||u==="tool_call"||u==="tool_result")&&(c=u)}return{type:"message",message:s.message,align:l,messageType:c}},[]),i=p.useMemo(()=>{var g;const s=t.filter(m=>{const v=m.role;return!(v!=="user"&&v!=="assistant"&&v!=="system"&&v!=="tool"||r(m))}),l=MFt(s),c=[];l.forEach((m,v)=>{var S,C,x,w;if(Array.isArray(m)){const _=m[0],T=(C=(S=_==null?void 0:_.call)==null?void 0:S.toolCalls)==null?void 0:C[0],k=(T==null?void 0:T.toolCallId)||((x=_==null?void 0:_.call)==null?void 0:x.id);c.push({type:"tool_session",id:`tool-session-${k||v}`,sessionId:(e==null?void 0:e.id)||"default",tools:m,createdAt:((w=_==null?void 0:_.call)==null?void 0:w.createdAt)||new Date().toISOString()});return}const b=m;let y;if(b.role==="assistant"&&"type"in b){const _=b.type;(_==="text"||_==="plan"||_==="question"||_==="tool_call"||_==="tool_result")&&(y=_)}c.push({message:b,messageType:y})}),!s.some(m=>m.role==="system")&&n&&c.unshift({message:n});const d=((g=e==null?void 0:e.config)==null?void 0:g.compressionEvents)||[],f=c.findIndex(m=>!IFt(m)),h=f===-1?c.length:f;for(const m of d){const v={type:"compression_divider",id:`compression-divider-${m.id}`,createdAt:m.createdAt,label:`Context compressed - ${m.messagesCompressed} messages archived`},b=Ire(m.createdAt),y=c.findIndex((S,C)=>C>=h&&Ire($Ft(S))>b);y===-1?c.push(v):c.splice(y,0,v)}return c},[(o=e==null?void 0:e.config)==null?void 0:o.compressionEvents,e==null?void 0:e.id,t,r,n]);return{systemPromptMessage:n,renderableMessages:i,convertRenderableEntry:a}},fj="chat-toggle-batch-export-selection",{useToken:NFt}=pn,{useBreakpoint:LFt}=CE,{Text:DFt}=Qt,jFt=e=>e.role==="user"?"You":e.role==="assistant"?"Assistant":e.role==="system"?"System":"Message",BFt=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},FFt=e=>e.map(({message:t,text:n},r)=>{const a=jFt(t),i=BFt(t.createdAt);return[`## ${r+1}. ${a} · ${i}`,"",n].join(`
|
|
1041
1046
|
`)}).join(`
|
|
1042
1047
|
|
|
1043
1048
|
---
|
|
1044
1049
|
|
|
1045
|
-
`),
|
|
1050
|
+
`),zFt=({sessionId:e,embedded:t=!1})=>{var Ee,_e,je;const{message:n}=Ns.useApp(),r=Ue(Ne=>e??Ne.currentSessionId),a=Ue(hF(r)),i=Ue(Ne=>Ne.deleteMessage),o=Ue(Ne=>Ne.loadChatHistory),s=Ue(Ne=>Ne.processingChats),l=Ue(Ne=>Ne.tokenUsages),c=Ue(Ne=>Ne.truncationOccurred),u=Ue(Ne=>Ne.segmentsRemoved),d=p.useMemo(()=>(a==null?void 0:a.messages)||[],[a]),f=p.useMemo(()=>!r||!a?r:a.kind==="child"&&(a.parentSessionId||a.rootSessionId)||r,[a,r]),h=Ue(Ne=>f?!!Ne.taskLists[f]:!1),g=Ue(Ne=>{if(!r)return!1;const tt=Ne.subSessionsByParent[r];return tt&&Object.keys(tt).length>0?!0:Ne.chats.some(ct=>ct.kind==="child"&&ct.parentSessionId===r)});p.useEffect(()=>{if(!r)return;const Ne=Ue.getState().chats.find(tt=>tt.id===r);Ne&&Array.isArray(Ne.messages)&&Ne.messages.length>0||o(r)},[r,o]);const m=r?s.has(r):!1,v=p.useMemo(()=>{var ut;if(!d||d.length===0)return null;const Ne=new Map;let tt=0,ct=0,Ke=0;for(const Je of d){if(!cCe(Je))continue;const qe=((ut=Je.result)==null?void 0:ut.result)??"",Qe=g0(qe),Oe=UN(qe);if(!Qe||!Oe)continue;Ke+=1,tt+=Oe.added,ct+=Oe.removed;const Fe=Ne.get(Qe.file_path);Fe?(Fe.added+=Oe.added,Fe.removed+=Oe.removed,Fe.diffChunks.push(Qe.diff.unified),Fe.truncated=Fe.truncated||!!Qe.diff.truncated):Ne.set(Qe.file_path,{added:Oe.added,removed:Oe.removed,diffChunks:[Qe.diff.unified],truncated:!!Qe.diff.truncated})}if(Ne.size===0)return null;const Ze=Array.from(Ne.entries()).map(([Je,qe])=>({filePath:Je,added:qe.added,removed:qe.removed,unifiedDiff:qe.diffChunks.join(`
|
|
1046
1051
|
|
|
1047
|
-
`),truncated:qe.truncated})).sort((Je,qe)=>Je.filePath.localeCompare(qe.filePath));return{totalAdded:tt,totalRemoved:ct,files:Ze,changedTools:Ke}},[d]),b=p.useMemo(()=>{const Ne=m?"THINKING":"IDLE";return{value:Ne,context:{streamingContent:null,toolCallRequest:null,parsedParameters:null},matches:tt=>tt===Ne}},[m]),y=p.useCallback(Ne=>{r&&i(r,Ne)},[r,i]),S=p.useRef(null),{token:C}=PFt(),x=NFt(),[w,_]=p.useState(null),[T,k]=p.useState(!1),[O,I]=p.useState(new Set),M=rr(Ne=>Ne.sidebar.collapsed),$=()=>t||x.xs||x.sm?"100%":x.md?"90%":x.lg?"85%":"1024px",R=()=>{let Ne;return t?Ne=C.paddingSM:x.xs?Ne=C.paddingXS:x.sm?Ne=C.paddingSM:Ne=C.padding,!t&&M?Ne+18:Ne};p.useEffect(()=>{_(null),k(!1),I(new Set)},[r]);const{systemPromptMessage:A,renderableMessages:P,convertRenderableEntry:N}=MFt(a,d),L=d.length>0,j=!!(w!=null&&w.content),D=!!A,H=r&&(L||D||j),F=t?190:0,B=p.useMemo(()=>{if(!(w!=null&&w.content))return P;const Ne={message:{id:w.id,role:"user",content:w.content,createdAt:w.createdAt},messageType:"text"};return[...P,Ne]},[P,w]),z=p.useMemo(()=>{const Ne=[];for(const tt of B){if(!("message"in tt))continue;const ct=GCe(tt.message).trim();ct&&Ne.push({id:tt.message.id,message:tt.message,text:ct})}return Ne},[B]),G=p.useMemo(()=>new Set(z.map(Ne=>Ne.id)),[z]);p.useEffect(()=>{I(Ne=>{let tt=!1;const ct=new Set;for(const Ke of Ne)G.has(Ke)?ct.add(Ke):tt=!0;return tt?ct:Ne})},[G]);const X=p.useMemo(()=>z.filter(Ne=>O.has(Ne.id)),[z,O]),Z=z.length>0,q=p.useCallback(Ne=>{I(tt=>{const ct=new Set(tt);return ct.has(Ne)?ct.delete(Ne):ct.add(Ne),ct})},[]),Y=p.useCallback(()=>{if(!Z){n.warning("No exportable messages");return}k(!0)},[n,Z]),te=p.useCallback(()=>{k(!1),I(new Set)},[]),ee=p.useCallback(()=>{if(T){te();return}Y()},[Y,te,T]),Q=p.useCallback(()=>{I(new Set(z.map(Ne=>Ne.id)))},[z]),ae=p.useCallback(()=>{I(new Set)},[]),oe=p.useCallback(async Ne=>{var Ke;if(!r){n.warning("No active chat");return}if(X.length===0){n.warning("Please select at least one message");return}const tt=BFt(X),ct=await KCe.exportMessageText({format:Ne,content:tt,sessionId:r,filenamePrefix:`chat-messages-${X.length}`});if(ct.success){n.success(`Saved: ${ct.filename}`);return}(Ke=ct.error)!=null&&Ke.toLowerCase().includes("cancel")||n.error(ct.error||"Export failed")},[n,r,X]);p.useEffect(()=>{if(typeof window>"u")return;const Ne=tt=>{var Ze;const Ke=((Ze=tt.detail)==null?void 0:Ze.sessionId)??null;!r||Ke!==r||ee()};return window.addEventListener(fj,Ne),()=>{window.removeEventListener(fj,Ne)}},[r,ee]);const re=a==null?void 0:a.id,ie=r?l[r]:null,ue=(Ee=a==null?void 0:a.config)==null?void 0:Ee.tokenUsage,ge=ie||ue||null,Te=r?c[r]:!1,Se=(_e=a==null?void 0:a.config)==null?void 0:_e.truncationOccurred,fe=Te||Se||!1,he=r?u[r]:0,ve=(je=a==null?void 0:a.config)==null?void 0:je.segmentsRemoved,we=he||ve||0,Re=C.marginMD,{handleMessagesScroll:ce,resetUserScroll:xe,scrollToBottom:Me,scrollToTop:Ie,showScrollToBottom:de,showScrollToTop:me}=_Ft({currentSessionId:r,interactionState:b,messagesListRef:S,renderableMessages:B}),pe=p.useCallback(()=>{xe(),Me()},[xe,Me]),Ae=()=>x.xs?16:32,ye=!!H&&Z&&(!t||T),Ce=ge&&ge.budgetLimit>0?E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:C.marginXS},children:[E.jsx(eFt,{usage:ge,showDetails:!0,size:"small"}),fe&&E.jsxs("span",{style:{fontSize:11,color:C.colorTextSecondary,whiteSpace:"nowrap"},children:["(",we," truncated)"]})]}):null;return E.jsx(Cs,{style:{flex:1,minHeight:0,height:"100%",background:C.colorBgContainer,position:"relative",overflow:"hidden"},children:E.jsxs(rt,{vertical:!0,style:{flex:1,minHeight:0,height:"100%"},children:[re&&h&&E.jsx("div",{style:{paddingTop:R(),paddingRight:R(),paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:E.jsx(BBt,{sessionId:re,initialCollapsed:!0})}),r&&g&&E.jsx("div",{style:{paddingTop:C.paddingXS,paddingRight:R(),paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:E.jsx(lFt,{parentSessionId:r})}),ye&&E.jsx("div",{style:{paddingTop:C.paddingXS,paddingRight:R()+F,paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:T?E.jsxs(rt,{align:"center",justify:"space-between",wrap:"wrap",gap:C.marginXS,children:[E.jsxs(LFt,{type:"secondary",children:["Selected ",X.length," /"," ",z.length]}),E.jsxs(He,{size:C.marginXS,wrap:!0,children:[E.jsx(De,{size:"small",onClick:Q,children:"Select all"}),E.jsx(De,{size:"small",onClick:ae,children:"Clear"}),E.jsx(De,{size:"small",icon:E.jsx(Yp,{}),onClick:()=>{oe("markdown")},disabled:X.length===0,children:"Export MD"}),E.jsx(De,{size:"small",type:"primary",icon:E.jsx(Yp,{}),onClick:()=>{oe("pdf")},disabled:X.length===0,children:"Export PDF"}),E.jsx(De,{size:"small",icon:E.jsx(Xh,{}),onClick:ee,children:"Done"})]})]}):E.jsx(rt,{justify:"flex-end",children:E.jsx(wn,{title:"Select messages to export",children:E.jsx(De,{"aria-label":"Select messages to export",icon:E.jsx(vde,{}),size:"small",onClick:ee})})})}),E.jsx(DBt,{currentChat:a,currentSessionId:r,convertRenderableEntry:N,handleDeleteMessage:y,handleMessagesScroll:ce,hasSystemPrompt:D,messagesListRef:S,renderableMessages:B,rowGap:Re,showMessagesView:!!H,screens:x,workflowDraftId:w==null?void 0:w.id,interactionState:b,padding:R(),selectionMode:T,selectedMessageIds:O,selectableMessageIds:G,onToggleMessageSelection:q}),(me||de)&&E.jsxs("div",{style:{position:"absolute",right:Ae(),bottom:x.xs?160:180,display:"flex",flexDirection:"column",gap:C.marginXS,zIndex:1e3},children:[me&&E.jsx(Jc,{type:"default",icon:E.jsx(sF,{}),style:{position:"relative",inset:"unset"},onClick:()=>{Ie()}}),de&&E.jsx(Jc,{type:"primary",icon:E.jsx(As,{}),style:{position:"relative",inset:"unset"},onClick:()=>{xe(),Me()}})]}),re&&E.jsx("div",{style:{padding:`0 ${R()}px`,maxWidth:H?$():"100%",margin:"0 auto",width:"100%"},children:E.jsx(QBt,{sessionId:re,onQuestionAppeared:pe})}),E.jsx(bNt,{sessionId:r,isCenteredLayout:!H,maxWidth:H?$():"100%",onWorkflowDraftChange:_,showMessagesView:!!H,sessionDiffSummary:v,contextUsageIndicator:Ce})]})})},Am=(e,t,n)=>Math.max(t,Math.min(n,e)),ox=(e,t)=>t==="horizontal"?e.clientWidth:e.clientHeight,i1e=({layout:e,first:t,second:n,sizesPx:r,defaultSplitRatio:a=.5,minFirstPx:i=0,minSecondPx:o=0,handleSizePx:s=6,disabled:l=!1,onResizeEnd:c,style:u,className:d})=>{const f=p.useRef(null),h=p.useRef(null),[g,m]=p.useState(null),[v,b]=p.useState(null),y=p.useMemo(()=>{if(!r)return null;const M=Number(r[0]);return Number.isFinite(M)?M:null},[r]);p.useLayoutEffect(()=>{if(y!==null||v!==null)return;const M=f.current;if(!M)return;const $=ox(M,e);if(!$)return;const R=Am(a,.1,.9),A=Math.round($*R);b(A)},[v,a,e,y]),p.useEffect(()=>{const M=f.current;if(!M||y!==null||v===null)return;const $=()=>{const R=ox(M,e);if(!R)return;const A=Math.max(i,R-o),P=Am(v,i,A);P!==v&&b(P)};return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[v,e,i,o,y]);const S=g??y??v??0,C=p.useCallback(M=>{if(l)return;const $=f.current;if(!$)return;M.preventDefault(),M.stopPropagation();const R=e==="horizontal"?M.clientX:M.clientY,A=ox($,e),P=S||Math.round(A*Am(a,.1,.9));h.current={pointerId:M.pointerId,startPos:R,startFirstPx:P,containerSize:A};try{M.currentTarget.setPointerCapture(M.pointerId)}catch{}},[a,l,S,e]),x=p.useCallback(M=>{const $=h.current;if(!$||M.pointerId!==$.pointerId)return;M.preventDefault(),M.stopPropagation();const A=(e==="horizontal"?M.clientX:M.clientY)-$.startPos,P=$.containerSize,N=Math.max(i,P-o),L=Am(Math.round($.startFirstPx+A),i,N);m(L)},[e,i,o]),w=p.useCallback(M=>{const $=h.current;if(!$||$.pointerId!==M)return;const R=f.current,A=R?ox(R,e):$.containerSize,P=g??$.startFirstPx,N=Math.max(i,A-o),L=Am(P,i,N),j=Math.max(o,A-L);m(null),b(L),h.current=null,c==null||c([L,j])},[e,g,i,o,c]),_=p.useCallback(M=>{M.preventDefault(),M.stopPropagation(),w(M.pointerId)},[w]),T=p.useCallback(M=>{M.preventDefault(),M.stopPropagation(),w(M.pointerId)},[w]),k=e==="horizontal",O=l?"default":k?"col-resize":"row-resize",I=Math.max(0,Math.round(s));return E.jsxs("div",{ref:f,className:d,style:{display:"flex",flexDirection:k?"row":"column",height:"100%",minHeight:0,minWidth:0,width:"100%",position:"relative",...u},children:[E.jsx("div",{style:{flex:`0 0 ${S}px`,minWidth:k?i:0,minHeight:k?0:i,overflow:"hidden",display:"flex"},children:E.jsx("div",{style:{flex:1,minHeight:0,minWidth:0},children:t})}),E.jsx("div",{style:{flex:"1 1 auto",minWidth:k?o:0,minHeight:k?0:o,overflow:"hidden",display:"flex"},children:E.jsx("div",{style:{flex:1,minHeight:0,minWidth:0},children:n})}),I>0?E.jsx("div",{role:"separator","aria-orientation":k?"vertical":"horizontal",onPointerDown:C,onPointerMove:x,onPointerUp:_,onPointerCancel:T,style:{position:"absolute",top:k?0:`${S-I/2}px`,left:k?`${S-I/2}px`:0,width:k?`${I}px`:"100%",height:k?"100%":`${I}px`,cursor:O,touchAction:"none",background:"transparent",zIndex:5}}):null]})},{useToken:zFt}=pn,HFt=4,UFt=({leafId:e})=>{const{token:t}=zFt(),n=rr(y=>y.tree),r=rr(y=>y.leafSessionIds),a=rr(y=>y.activeLeafId),i=rr(y=>y.setActiveLeafId),o=rr(y=>y.splitLeaf),s=rr(y=>y.closeLeaf),l=rr(y=>y.setLeafSessionId),c=Ue(y=>y.selectSession),u=r[e]??null,d=p.useMemo(()=>Do(n).length,[n]),f=d<HFt,h=d>1,m=h||!!u,v=d>1,b=a===e;return E.jsxs("div",{className:"chat-pane-shell",onMouseDownCapture:()=>{Lo("pane focus (mouse)",{leafId:e,sessionId:u,prevActiveLeafId:a}),i(e),u&&c(u)},onFocusCapture:()=>{Lo("pane focus (focus)",{leafId:e,sessionId:u,prevActiveLeafId:a}),i(e)},style:{height:"100%",minHeight:0,border:v?`1px solid ${b?t.colorPrimaryBorder:t.colorBorderSecondary}`:"none",borderRadius:v?t.borderRadiusLG:0,overflow:"hidden",background:t.colorBgContainer,position:"relative"},children:[E.jsx("div",{className:"chat-pane-actions",style:{background:t.colorBgElevated,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:10,padding:"2px 4px"},children:E.jsxs(rt,{gap:t.marginXS,children:[E.jsx(De,{size:"small",type:"text",icon:E.jsx(u7e,{}),disabled:!f,title:"Split Horizontal","aria-label":"Split Horizontal",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane split request",{leafId:e,layout:"horizontal"}),o(e,"horizontal");const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;C&&c(C)}}),E.jsx(De,{size:"small",type:"text",icon:E.jsx(f7e,{}),disabled:!f,title:"Split Vertical","aria-label":"Split Vertical",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane split request",{leafId:e,layout:"vertical"}),o(e,"vertical");const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;C&&c(C)}}),E.jsx(De,{size:"small",type:"text",icon:E.jsx(vde,{}),disabled:!u,title:"Select Messages to Export","aria-label":"Select Messages to Export",onClick:y=>{y.preventDefault(),y.stopPropagation(),u&&window.dispatchEvent(new CustomEvent(fj,{detail:{sessionId:u}}))}}),E.jsx(De,{size:"small",type:"text",danger:!0,icon:E.jsx(Xh,{}),disabled:!m,title:"Close","aria-label":"Close",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane close request",{leafId:e}),h?s(e):l(e,null);const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;c(C)}})]})}),u?E.jsx(FFt,{sessionId:u,embedded:!0}):E.jsxs(rt,{vertical:!0,align:"center",justify:"center",style:{height:"100%",minHeight:0,padding:t.paddingLG},children:[E.jsx("div",{style:{color:t.colorTextSecondary},children:"Select a session to start chatting"}),E.jsx("div",{style:{color:t.colorTextTertiary,fontSize:12},children:"Hover over top-right corner to split/close"})]})]})},WFt=({node:e})=>{const t=rr(r=>r.splitSizesPx[e.id]??null),n=rr(r=>r.setSplitSizesPx);return E.jsx(i1e,{layout:e.layout,sizesPx:t,defaultSplitRatio:.5,minFirstPx:240,minSecondPx:240,style:{height:"100%",minHeight:0},onResizeEnd:r=>{n(e.id,r)},first:E.jsx(pj,{node:e.children[0]}),second:E.jsx(pj,{node:e.children[1]})})},pj=({node:e})=>e.type==="leaf"?E.jsx(UFt,{leafId:e.id}):E.jsx(WFt,{node:e}),qFt=()=>{const e=rr(d=>d.tree),t=rr(d=>d.leafSessionIds),n=rr(d=>d.activeLeafId),r=rr(d=>d.setActiveLeafId),a=rr(d=>d.setLeafSessionId),i=rr(d=>d.clearSessionFromAllLeaves),o=Ue(d=>d.chats),s=Ue(d=>d.currentSessionId),l=p.useRef(!1),c=p.useMemo(()=>Do(e),[e]),u=p.useMemo(()=>new Set(o.map(d=>d.id)),[o]);return p.useEffect(()=>{c.length!==0&&(c.includes(n)||r(c[0]))},[n,c,r]),p.useEffect(()=>{for(const[d,f]of Object.entries(t))f&&!u.has(f)&&a(d,null)},[u,t,a]),p.useEffect(()=>{if(!s||l.current)return;if(!Object.values(t).some(Boolean)){a(n,s),l.current=!0;return}l.current=!0},[n,s,t,a]),p.useEffect(()=>{const d=new Set(Object.values(t).filter(Boolean));for(const f of d)u.has(f)||i(f)},[u,i,t]),E.jsx("div",{style:{height:"100%",minHeight:0,padding:0},children:E.jsx(pj,{node:e})})},VFt=({themeMode:e,onThemeModeChange:t,locale:n,onLocaleChange:r})=>{const a=Ub(T=>T.isOpen),i=Ub(T=>T.close),{token:o}=pn.useToken(),s=o_(),l=p.useMemo(()=>Rhe()==="macos",[]),c=Ho(T=>T.loadProviderConfig);p.useEffect(()=>{c()},[c]),qMt(),MMt(),p.useEffect(()=>{Mne.clear(),Pne()},[e]),p.useEffect(()=>{Mne.clear(),Pne()},[s]);const u=rr(T=>T.sidebar.collapsed),d=rr(T=>T.sidebar.widthPx),f=rr(T=>T.sidebar.minWidthPx),h=rr(T=>T.sidebar.maxWidthPx),g=rr(T=>T.setSidebarCollapsed),m=rr(T=>T.setSidebarWidthPx),v=18,b=0,S=!a&&u&&l?44:b,C=0,x=88,w=10,_="none";return E.jsx(Cs,{style:{minHeight:"100vh",height:"100vh",overflow:"hidden",background:o.colorBgLayout,display:"flex",flexDirection:"row",position:"relative"},children:E.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,height:"100%",width:"100%",boxSizing:"border-box",paddingTop:S,paddingLeft:b,paddingRight:b,paddingBottom:b,background:o.colorFillQuaternary},children:[a?E.jsx(Cs,{style:{flex:1,display:"flex",flexDirection:"column",background:o.colorBgContainer,minHeight:0,borderRadius:`${v}px 0 0 ${v}px`,border:_,overflow:"hidden",boxShadow:"-8px 0 20px rgba(0, 0, 0, 0.04)"},children:E.jsx(Hxt,{themeMode:e,onThemeModeChange:t,locale:n,onLocaleChange:r,onBack:i})}):E.jsxs(E.Fragment,{children:[E.jsx(Uxt,{}),E.jsx(i1e,{layout:"horizontal",style:{flex:1,minHeight:0,height:"100%",background:"transparent"},sizesPx:[u?C:d,0],minFirstPx:u?C:f,minSecondPx:320,disabled:u,handleSizePx:u?0:2,onResizeEnd:([T])=>{if(u)return;const k=Math.max(f,Math.min(h,T));m(k)},first:E.jsx("div",{style:{height:"100%",minHeight:0,borderRadius:`${v}px 0 0 ${v}px`,border:_,overflow:"hidden",background:o.colorFillQuaternary},children:E.jsx(Dnt,{})}),second:E.jsx("div",{style:{height:"100%",minHeight:0,borderRadius:`0 ${v}px ${v}px 0`,border:_,overflow:"hidden",background:o.colorBgContainer,boxShadow:"none"},children:E.jsx(Cs,{style:{display:"flex",flexDirection:"column",background:o.colorBgContainer,minHeight:0,height:"100%"},children:E.jsx(qFt,{})})})})]}),!a&&u?E.jsx(De,{"data-testid":"show-sidebar",type:"text",size:"small",icon:E.jsx(lVe,{}),onClick:()=>g(!1),title:"Show sidebar","aria-label":"Show sidebar",style:{position:"absolute",top:w,left:x,zIndex:40,width:28,height:28,borderRadius:8,border:`1px solid ${o.colorBorderSecondary}`,background:o.colorBgElevated,boxShadow:o.boxShadowTertiary}}):null]})})},Are={httpProxy:"",httpsProxy:"",proxyUsername:"",proxyPassword:"",rememberProxyAuth:!0},c2=e=>typeof e=="string"?e:"",GFt=()=>{const[e,t]=p.useState(0),[n,r]=p.useState(Are),[a,i]=p.useState(!1),[o,s]=p.useState(!1),[l,c]=p.useState(null),[u,d]=p.useState(!1),[f,h]=p.useState(null),[g,m]=p.useState(!1);p.useEffect(()=>{(async()=>{let _=!1;try{const T=Vi.getInstance(),k=await T.getBambooConfig(),O=c2(k.http_proxy),I=c2(k.https_proxy),M=await T.getProxyAuthStatus(),$=c2(M.username);r({httpProxy:O,httpsProxy:I,proxyUsername:$,proxyPassword:"",rememberProxyAuth:Are.rememberProxyAuth}),_=O.trim().length>0||I.trim().length>0,i(_)}catch(T){console.error("Failed to check config:",T),i(!1)}s(!0);try{const k=await Vi.getInstance().getSetupStatus();c({needsProxy:k.has_proxy_env,message:k.message}),i(_||k.has_proxy_env)}catch(T){console.error("Failed to check setup status:",T),c({needsProxy:!0,message:"Unable to load setup status. You can continue with manual proxy configuration."})}finally{s(!1)}})()},[]);const b=n.httpProxy.trim().length>0||n.httpsProxy.trim().length>0||a,y=w=>{r(_=>({..._,...w}))},S=async()=>{var I,M;const w=n.httpProxy.trim(),_=n.httpsProxy.trim(),T=!!(w||_),k=n.proxyUsername.trim(),O=!!k;try{if(h(null),m(!0),T){const R=Vi.getInstance(),A=await R.validateBambooConfigPatch({http_proxy:w,https_proxy:_});if(!A.valid){const N=((M=(I=A.errors)==null?void 0:I.proxy)==null?void 0:M[0])??Object.values(A.errors||{}).flat().filter(Boolean)[0];h((N==null?void 0:N.message)||"Proxy settings are invalid.");return}if(n.rememberProxyAuth&&!O&&n.proxyPassword.trim()){h("To store proxy credentials, please enter a username or uncheck 'Remember credentials'.");return}await R.setBambooConfig({http_proxy:w,https_proxy:_}),n.rememberProxyAuth&&O?await R.setProxyAuth({username:k,password:n.proxyPassword||""}):await R.clearProxyAuth()}await Vi.getInstance().markSetupComplete(),d(!0)}catch($){console.error("Failed to complete setup:",$);const R=$ instanceof Error&&$.message.trim()?$.message:T?"Failed to save proxy configuration. Please try again.":"Failed to complete setup. Please try again.";h(R)}finally{m(!1)}},C=async()=>{try{h(null),m(!0),await Vi.getInstance().markSetupComplete(),d(!0)}catch(w){console.error("Failed to mark setup complete:",w),h("Failed to complete setup. Please try again.")}finally{m(!1)}},x=p.useMemo(()=>[{title:"Welcome",content:E.jsxs("div",{children:[E.jsx("h1",{children:"Welcome to Bodhi"}),E.jsx("p",{children:"Let's set up your environment before entering the main app."}),E.jsx(fr,{message:"You can skip setup now and configure proxy settings later in System Settings.",type:"info",showIcon:!0,style:{marginBottom:16}}),E.jsxs("div",{className:"setup-page__actions",children:[E.jsx(De,{"data-testid":"setup-next",type:"primary",onClick:()=>t(1),children:"Next"}),E.jsx(De,{"data-testid":"setup-skip",onClick:()=>void C(),loading:g,children:"Skip for now"})]})]})},{title:"Proxy Configuration",content:E.jsxs("div",{children:[E.jsx("h2",{children:"Proxy Configuration"}),E.jsx(fr,{message:"If you're behind a corporate proxy, configure it below.",type:"info",showIcon:!0}),E.jsx(fr,{message:"Provider configuration is done later in Provider Settings. This setup step only stores network/proxy settings.",type:"info",showIcon:!0,style:{marginTop:16}}),o?E.jsx("div",{style:{marginTop:16},children:E.jsx(ia,{tip:"Detecting network environment..."})}):null,l?E.jsx(fr,{message:l.message,type:l.needsProxy?"warning":"success",showIcon:!0,style:{marginTop:16}}):null,!o&&!l&&!a?E.jsx(fr,{message:"No existing proxy was detected. You can leave these fields empty if your network does not require a proxy.",type:"success",showIcon:!0,style:{marginTop:16}}):null,f?E.jsx(fr,{message:f,type:"error",showIcon:!0,style:{marginTop:16}}):null,E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-http-proxy",children:"HTTP Proxy URL:"}),E.jsx(tn,{id:"setup-http-proxy",value:n.httpProxy,onChange:w=>y({httpProxy:w.target.value}),placeholder:"http://proxy.company.com:8080"})]}),E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-https-proxy",children:"HTTPS Proxy URL:"}),E.jsx(tn,{id:"setup-https-proxy",value:n.httpsProxy,onChange:w=>y({httpsProxy:w.target.value}),placeholder:"http://proxy.company.com:8080"})]}),b?E.jsxs(E.Fragment,{children:[E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-proxy-username",children:"Username"}),E.jsx(tn,{id:"setup-proxy-username",value:n.proxyUsername,onChange:w=>y({proxyUsername:w.target.value})})]}),E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-proxy-password",children:"Password"}),E.jsx(tn.Password,{id:"setup-proxy-password",value:n.proxyPassword,onChange:w=>y({proxyPassword:w.target.value})})]}),E.jsx("div",{style:{marginTop:16},children:E.jsx(Zc,{checked:n.rememberProxyAuth,onChange:w=>y({rememberProxyAuth:w.target.checked}),children:"Remember credentials (encrypted)"})})]}):null,E.jsxs("div",{className:"setup-page__actions",style:{marginTop:24},children:[E.jsx(De,{"data-testid":"setup-back",onClick:()=>t(0),children:"Back"}),E.jsx(De,{"data-testid":"setup-skip",onClick:()=>void C(),loading:g,children:"Skip for now"}),E.jsx(De,{"data-testid":"setup-complete",onClick:()=>void S(),type:"primary",loading:g,children:"Complete Setup"})]})]})}],[n,l,f,o,g,a,b]);return u?E.jsxs("div",{"data-testid":"setup-complete",className:"setup-complete",children:[E.jsx("h1",{children:"Setup Complete!"}),E.jsx("p",{children:"Please restart the application to apply all settings."}),E.jsx(De,{"data-testid":"setup-restart",onClick:()=>window.location.reload(),children:"Restart"})]}):E.jsx("div",{className:"setup-page",children:E.jsxs(Ot,{style:{maxWidth:600,margin:"40px auto"},children:[E.jsx(zB,{current:e,items:x.map(w=>({title:w.title}))}),E.jsx("div",{style:{marginTop:24},children:x[e].content})]})})};var Rm={},u2={exports:{}},Rre;function ca(){return Rre||(Rre=1,function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(u2)),u2.exports}var Mm={},Mre;function KFt(){if(Mre)return Mm;Mre=1,Object.defineProperty(Mm,"__esModule",{value:!0}),Mm.default=void 0;var e={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"};return Mm.default=e,Mm}var Pm={},Nm={},Lm={},d2={exports:{}},f2={exports:{}},p2={exports:{}},h2={exports:{}},Pre;function YFt(){return Pre||(Pre=1,function(e){var t=Zfe().default;function n(r,a){if(t(r)!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var o=i.call(r,a||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(h2)),h2.exports}var Nre;function XFt(){return Nre||(Nre=1,function(e){var t=Zfe().default,n=YFt();function r(a){var i=n(a,"string");return t(i)=="symbol"?i:i+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(p2)),p2.exports}var Lre;function ZFt(){return Lre||(Lre=1,function(e){var t=XFt();function n(r,a,i){return(a=t(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(f2)),f2.exports}var Dre;function D0(){return Dre||(Dre=1,function(e){var t=ZFt();function n(a,i){var o=Object.keys(a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);i&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),o.push.apply(o,s)}return o}function r(a){for(var i=1;i<arguments.length;i++){var o=arguments[i]!=null?arguments[i]:{};i%2?n(Object(o),!0).forEach(function(s){t(a,s,o[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(s){Object.defineProperty(a,s,Object.getOwnPropertyDescriptor(o,s))})}return a}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(d2)),d2.exports}var Dm={},jre;function j0(){return jre||(jre=1,Object.defineProperty(Dm,"__esModule",{value:!0}),Dm.commonLocale=void 0,Dm.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Dm}var Bre;function QFt(){if(Bre)return Lm;Bre=1;var e=ca().default;Object.defineProperty(Lm,"__esModule",{value:!0}),Lm.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});return Lm.default=r,Lm}var jm={},Fre;function o1e(){if(Fre)return jm;Fre=1,Object.defineProperty(jm,"__esModule",{value:!0}),jm.default=void 0;const e={placeholder:"Select time",rangePlaceholder:["Start time","End time"]};return jm.default=e,jm}var zre;function s1e(){if(zre)return Nm;zre=1;var e=ca().default;Object.defineProperty(Nm,"__esModule",{value:!0}),Nm.default=void 0;var t=e(QFt()),n=e(o1e());const r={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},t.default),timePickerLocale:Object.assign({},n.default)};return Nm.default=r,Nm}var Hre;function JFt(){if(Hre)return Pm;Hre=1;var e=ca().default;Object.defineProperty(Pm,"__esModule",{value:!0}),Pm.default=void 0;var t=e(s1e());return Pm.default=t.default,Pm}var Ure;function e3t(){if(Ure)return Rm;Ure=1;var e=ca().default;Object.defineProperty(Rm,"__esModule",{value:!0}),Rm.default=void 0;var t=e(KFt()),n=e(JFt()),r=e(s1e()),a=e(o1e());const i="${label} is not a valid ${type}",o={locale:"en",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};return Rm.default=o,Rm}var g2,Wre;function t3t(){return Wre||(Wre=1,g2=e3t()),g2}var n3t=t3t();const r3t=An(n3t);var Bm={},Fm={},qre;function a3t(){if(qre)return Fm;qre=1,Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.default=void 0;var e={items_per_page:"/ page",jump_to:"Aller à",jump_to_confirm:"confirmer",page:"Page",prev_page:"Page précédente",next_page:"Page suivante",prev_5:"5 Pages précédentes",next_5:"5 Pages suivantes",prev_3:"3 Pages précédentes",next_3:"3 Pages suivantes",page_size:"taille de la page"};return Fm.default=e,Fm}var zm={},Hm={},Um={},Vre;function i3t(){if(Vre)return Um;Vre=1;var e=ca().default;Object.defineProperty(Um,"__esModule",{value:!0}),Um.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"fr_FR",today:"Aujourd'hui",now:"Maintenant",backToToday:"Aujourd'hui",ok:"OK",clear:"Rétablir",week:"Semaine",month:"Mois",year:"Année",timeSelect:"Sélectionner l'heure",dateSelect:"Sélectionner la date",monthSelect:"Choisissez un mois",yearSelect:"Choisissez une année",decadeSelect:"Choisissez une décennie",dateFormat:"DD/MM/YYYY",dayFormat:"DD",dateTimeFormat:"DD/MM/YYYY HH:mm:ss",previousMonth:"Mois précédent (PageUp)",nextMonth:"Mois suivant (PageDown)",previousYear:"Année précédente (Ctrl + gauche)",nextYear:"Année prochaine (Ctrl + droite)",previousDecade:"Décennie précédente",nextDecade:"Décennie suivante",previousCentury:"Siècle précédent",nextCentury:"Siècle suivant"});return Um.default=r,Um}var Wm={},Gre;function l1e(){if(Gre)return Wm;Gre=1,Object.defineProperty(Wm,"__esModule",{value:!0}),Wm.default=void 0;const e={placeholder:"Sélectionner l'heure",rangePlaceholder:["Heure de début","Heure de fin"]};return Wm.default=e,Wm}var Kre;function c1e(){if(Kre)return Hm;Kre=1;var e=ca().default;Object.defineProperty(Hm,"__esModule",{value:!0}),Hm.default=void 0;var t=e(i3t()),n=e(l1e());const r={lang:Object.assign({placeholder:"Sélectionner une date",yearPlaceholder:"Sélectionner une année",quarterPlaceholder:"Sélectionner un trimestre",monthPlaceholder:"Sélectionner un mois",weekPlaceholder:"Sélectionner une semaine",rangePlaceholder:["Date de début","Date de fin"],rangeYearPlaceholder:["Année de début","Année de fin"],rangeMonthPlaceholder:["Mois de début","Mois de fin"],rangeWeekPlaceholder:["Semaine de début","Semaine de fin"]},t.default),timePickerLocale:Object.assign({},n.default)};return Hm.default=r,Hm}var Yre;function o3t(){if(Yre)return zm;Yre=1;var e=ca().default;Object.defineProperty(zm,"__esModule",{value:!0}),zm.default=void 0;var t=e(c1e());return zm.default=t.default,zm}var Xre;function s3t(){if(Xre)return Bm;Xre=1;var e=ca().default;Object.defineProperty(Bm,"__esModule",{value:!0}),Bm.default=void 0;var t=e(a3t()),n=e(o3t()),r=e(c1e()),a=e(l1e());const i="La valeur du champ ${label} n'est pas valide pour le type ${type}",o={locale:"fr",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,Table:{filterTitle:"Filtrer",filterConfirm:"OK",filterReset:"Réinitialiser",filterEmptyText:"Aucun filtre",filterCheckAll:"Tout sélectionner",filterSearchPlaceholder:"Chercher dans les filtres",emptyText:"Aucune donnée",selectAll:"Sélectionner la page actuelle",selectInvert:"Inverser la sélection de la page actuelle",selectNone:"Désélectionner toutes les données",selectionAll:"Sélectionner toutes les données",sortTitle:"Trier",expand:"Développer la ligne",collapse:"Réduire la ligne",triggerDesc:"Trier par ordre décroissant",triggerAsc:"Trier par ordre croissant",cancelSort:"Annuler le tri"},Tour:{Next:"Étape suivante",Previous:"Étape précédente",Finish:"Fin de la visite guidée"},Modal:{okText:"OK",cancelText:"Annuler",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Annuler"},Transfer:{titles:["",""],searchPlaceholder:"Rechercher",itemUnit:"élément",itemsUnit:"éléments",remove:"Désélectionner",selectCurrent:"Sélectionner la page actuelle",removeCurrent:"Désélectionner la page actuelle",selectAll:"Sélectionner toutes les données",removeAll:"Désélectionner toutes les données",selectInvert:"Inverser la sélection de la page actuelle"},Upload:{uploading:"Téléchargement...",removeFile:"Effacer le fichier",uploadError:"Erreur de téléchargement",previewFile:"Fichier de prévisualisation",downloadFile:"Télécharger un fichier"},Empty:{description:"Aucune donnée"},Icon:{icon:"icône"},Text:{edit:"Éditer",copy:"Copier",copied:"Copie effectuée",expand:"Développer"},Form:{optional:"(optionnel)",defaultValidateMessages:{default:"Erreur de validation pour le champ ${label}",required:"Le champ ${label} est obligatoire",enum:"La valeur du champ ${label} doit être parmi [${enum}]",whitespace:"La valeur du champ ${label} ne peut pas être vide",date:{format:"La valeur du champ ${label} n'est pas au format date",parse:"La valeur du champ ${label} ne peut pas être convertie vers une date",invalid:"La valeur du champ ${label} n'est pas une date valide"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"La taille du champ ${label} doit être de ${len} caractères",min:"La taille du champ ${label} doit être au minimum de ${min} caractères",max:"La taille du champ ${label} doit être au maximum de ${max} caractères",range:"La taille du champ ${label} doit être entre ${min} et ${max} caractères"},number:{len:"La valeur du champ ${label} doit être égale à ${len}",min:"La valeur du champ ${label} doit être plus grande que ${min}",max:"La valeur du champ ${label} doit être plus petit que ${max}",range:"La valeur du champ ${label} doit être entre ${min} et ${max}"},array:{len:"La taille du tableau ${label} doit être de ${len}",min:"La taille du tableau ${label} doit être au minimum de ${min}",max:"La taille du tableau ${label} doit être au maximum de ${max}",range:"La taille du tableau ${label} doit être entre ${min}-${max}"},pattern:{mismatch:"La valeur du champ ${label} ne correspond pas au modèle ${pattern}"}}},Image:{preview:"Aperçu"}};return Bm.default=o,Bm}var m2,Zre;function l3t(){return Zre||(Zre=1,m2=s3t()),m2}var c3t=l3t();const u3t=An(c3t);var qm={},Vm={},Qre;function d3t(){if(Qre)return Vm;Qre=1,Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.default=void 0;var e={items_per_page:"件 / ページ",jump_to:"移動",jump_to_confirm:"確認する",page:"ページ",prev_page:"前のページ",next_page:"次のページ",prev_5:"前 5ページ",next_5:"次 5ページ",prev_3:"前 3ページ",next_3:"次 3ページ",page_size:"ページサイズ"};return Vm.default=e,Vm}var Gm={},Km={},Ym={},Jre;function f3t(){if(Jre)return Ym;Jre=1;var e=ca().default;Object.defineProperty(Ym,"__esModule",{value:!0}),Ym.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"ja_JP",today:"今日",now:"現在時刻",backToToday:"今日に戻る",ok:"確定",timeSelect:"時間を選択",dateSelect:"日時を選択",weekSelect:"週を選択",clear:"クリア",week:"週",month:"月",year:"年",previousMonth:"前月 (ページアップキー)",nextMonth:"翌月 (ページダウンキー)",monthSelect:"月を選択",yearSelect:"年を選択",decadeSelect:"年代を選択",yearFormat:"YYYY年",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"前年 (Controlを押しながら左キー)",nextYear:"翌年 (Controlを押しながら右キー)",previousDecade:"前の年代",nextDecade:"次の年代",previousCentury:"前の世紀",nextCentury:"次の世紀",monthBeforeYear:!1});return Ym.default=r,Ym}var Xm={},eae;function u1e(){if(eae)return Xm;eae=1,Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.default=void 0;const e={placeholder:"時間を選択",rangePlaceholder:["開始時間","終了時間"]};return Xm.default=e,Xm}var tae;function d1e(){if(tae)return Km;tae=1;var e=ca().default;Object.defineProperty(Km,"__esModule",{value:!0}),Km.default=void 0;var t=e(f3t()),n=e(u1e());const r={lang:Object.assign({placeholder:"日付を選択",yearPlaceholder:"年を選択",quarterPlaceholder:"四半期を選択",monthPlaceholder:"月を選択",weekPlaceholder:"週を選択",rangePlaceholder:["開始日付","終了日付"],rangeYearPlaceholder:["開始年","終了年"],rangeMonthPlaceholder:["開始月","終了月"],rangeQuarterPlaceholder:["開始四半期","終了四半期"],rangeWeekPlaceholder:["開始週","終了週"],shortWeekDays:["日","月","火","水","木","金","土"],shortMonths:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},t.default),timePickerLocale:Object.assign({},n.default)};return Km.default=r,Km}var nae;function p3t(){if(nae)return Gm;nae=1;var e=ca().default;Object.defineProperty(Gm,"__esModule",{value:!0}),Gm.default=void 0;var t=e(d1e());return Gm.default=t.default,Gm}var rae;function h3t(){if(rae)return qm;rae=1;var e=ca().default;Object.defineProperty(qm,"__esModule",{value:!0}),qm.default=void 0;var t=e(d3t()),n=e(p3t()),r=e(d1e()),a=e(u1e());const i="${label}は有効な${type}ではありません",o={locale:"ja",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"選んでください"},Table:{filterTitle:"フィルター",filterConfirm:"OK",filterReset:"リセット",filterEmptyText:"フィルターなし",filterCheckAll:"すべてを選択",filterSearchPlaceholder:"フィルターで検索",emptyText:"データなし",selectAll:"ページ単位で選択",selectInvert:"ページ単位で反転",selectNone:"クリア",selectionAll:"すべてを選択",sortTitle:"ソート",expand:"展開する",collapse:"折り畳む",triggerDesc:"クリックで降順にソート",triggerAsc:"クリックで昇順にソート",cancelSort:"ソートをキャンセル"},Tour:{Next:"次",Previous:"前の",Finish:"仕上げる"},Modal:{okText:"OK",cancelText:"キャンセル",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"キャンセル"},Transfer:{titles:["",""],searchPlaceholder:"ここを検索",itemUnit:"アイテム",itemsUnit:"アイテム",remove:"削除",selectCurrent:"現在のページを選択",removeCurrent:"現在のページを削除",selectAll:"ページ単位で選択",deselectAll:"すべてのデータの選択を解除する",removeAll:"ページ単位で削除",selectInvert:"ページ単位で反転"},Upload:{uploading:"アップロード中...",removeFile:"ファイルを削除",uploadError:"アップロードエラー",previewFile:"ファイルをプレビュー",downloadFile:"ダウンロードファイル"},Empty:{description:"データがありません"},Icon:{icon:"アイコン"},Text:{edit:"編集",copy:"コピー",copied:"コピーされました",expand:"拡大する",collapse:"崩壊"},Form:{optional:"(オプション)",defaultValidateMessages:{default:"${label}のフィールド検証エラー",required:"${label}を入力してください",enum:"${label}は[${enum}]のいずれかである必要があります",whitespace:"${label}は空白文字にすることはできません",date:{format:"${label}の日付形式は不正です",parse:"${label}は日付に変換できません",invalid:"${label}は不正な日付です"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}は${len}文字である必要があります",min:"${label}は${min}文字以上である必要があります",max:"${label}は${max}文字以下である必要があります",range:"${label}は${min}-${max}文字の範囲である必要があります"},number:{len:"${label}は${len}と等しい必要があります",min:"${label}の最小値は${min}です",max:"${label}の最大値は${max}です",range:"${label}は${min}-${max}の範囲である必要があります"},array:{len:"${label}は${len}である必要があります",min:"${label}の最小は${min}です",max:"${label}の最大は${max}です",range:"${label}の合計は${min}-${max}の範囲である必要があります"},pattern:{mismatch:"${label}はパターン${pattern}と一致しません"}}},Image:{preview:"プレビュー"},QRCode:{expired:"QRコードの有効期限が切れました",refresh:"リフレッシュ",scanned:"スキャン済み"},ColorPicker:{presetEmpty:"空の",transparent:"透明",singleColor:"単色",gradientColor:"グラデーション"}};return qm.default=o,qm}var v2,aae;function g3t(){return aae||(aae=1,v2=h3t()),v2}var m3t=g3t();const v3t=An(m3t);var Zm={},Qm={},iae;function b3t(){if(iae)return Qm;iae=1,Object.defineProperty(Qm,"__esModule",{value:!0}),Qm.default=void 0;var e={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};return Qm.default=e,Qm}var Jm={},ev={},tv={},oae;function y3t(){if(oae)return tv;oae=1;var e=ca().default;Object.defineProperty(tv,"__esModule",{value:!0}),tv.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return tv.default=r,tv}var nv={},sae;function f1e(){if(sae)return nv;sae=1,Object.defineProperty(nv,"__esModule",{value:!0}),nv.default=void 0;const e={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};return nv.default=e,nv}var lae;function p1e(){if(lae)return ev;lae=1;var e=ca().default;Object.defineProperty(ev,"__esModule",{value:!0}),ev.default=void 0;var t=e(y3t()),n=e(f1e());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",ev.default=r,ev}var cae;function S3t(){if(cae)return Jm;cae=1;var e=ca().default;Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.default=void 0;var t=e(p1e());return Jm.default=t.default,Jm}var uae;function x3t(){if(uae)return Zm;uae=1;var e=ca().default;Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.default=void 0;var t=e(b3t()),n=e(S3t()),r=e(p1e()),a=e(f1e());const i="${label}不是一个有效的${type}",o={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return Zm.default=o,Zm}var b2,dae;function w3t(){return dae||(dae=1,b2=x3t()),b2}var C3t=w3t();const E3t=An(C3t);var rv={},av={},fae;function _3t(){if(fae)return av;fae=1,Object.defineProperty(av,"__esModule",{value:!0}),av.default=void 0;var e={items_per_page:"條/頁",jump_to:"跳至",jump_to_confirm:"確定",page:"頁",prev_page:"上一頁",next_page:"下一頁",prev_5:"向前 5 頁",next_5:"向後 5 頁",prev_3:"向前 3 頁",next_3:"向後 3 頁",page_size:"頁碼"};return av.default=e,av}var iv={},ov={},sv={},pae;function T3t(){if(pae)return sv;pae=1;var e=ca().default;Object.defineProperty(sv,"__esModule",{value:!0}),sv.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_TW",today:"今天",now:"此刻",backToToday:"返回今天",ok:"確定",timeSelect:"選擇時間",dateSelect:"選擇日期",weekSelect:"選擇周",clear:"清除",week:"週",month:"月",year:"年",previousMonth:"上個月 (翻頁上鍵)",nextMonth:"下個月 (翻頁下鍵)",monthSelect:"選擇月份",yearSelect:"選擇年份",decadeSelect:"選擇年代",yearFormat:"YYYY年",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"上一年 (Control鍵加左方向鍵)",nextYear:"下一年 (Control鍵加右方向鍵)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世紀",nextCentury:"下一世紀",cellDateFormat:"D",monthBeforeYear:!1});return sv.default=r,sv}var lv={},hae;function h1e(){if(hae)return lv;hae=1,Object.defineProperty(lv,"__esModule",{value:!0}),lv.default=void 0;const e={placeholder:"請選擇時間"};return lv.default=e,lv}var gae;function g1e(){if(gae)return ov;gae=1;var e=ca().default;Object.defineProperty(ov,"__esModule",{value:!0}),ov.default=void 0;var t=e(T3t()),n=e(h1e());const r={lang:Object.assign({placeholder:"請選擇日期",yearPlaceholder:"請選擇年份",quarterPlaceholder:"請選擇季度",monthPlaceholder:"請選擇月份",weekPlaceholder:"請選擇周",rangePlaceholder:["開始日期","結束日期"],rangeYearPlaceholder:["開始年份","結束年份"],rangeMonthPlaceholder:["開始月份","結束月份"],rangeQuarterPlaceholder:["開始季度","結束季度"],rangeWeekPlaceholder:["開始周","結束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="確 定",ov.default=r,ov}var mae;function k3t(){if(mae)return iv;mae=1;var e=ca().default;Object.defineProperty(iv,"__esModule",{value:!0}),iv.default=void 0;var t=e(g1e());return iv.default=t.default,iv}var vae;function O3t(){if(vae)return rv;vae=1;var e=ca().default;Object.defineProperty(rv,"__esModule",{value:!0}),rv.default=void 0;var t=e(_3t()),n=e(k3t()),r=e(g1e()),a=e(h1e());const i="${label}不是一個有效的${type}",o={locale:"zh-tw",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"請選擇"},Table:{filterTitle:"篩選器",filterConfirm:"確定",filterReset:"重置",filterEmptyText:"無篩選項",filterCheckAll:"全選",filterSearchPlaceholder:"在篩選項中搜尋",emptyText:"暫無數據",selectAll:"全部選取",selectInvert:"反向選取",selectNone:"清空所有",selectionAll:"全選所有",sortTitle:"排序",expand:"展開行",collapse:"關閉行",triggerDesc:"點擊降序",triggerAsc:"點擊升序",cancelSort:"取消排序"},Modal:{okText:"確定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"結束導覽"},Popconfirm:{okText:"確定",cancelText:"取消"},Transfer:{titles:["",""],searchPlaceholder:"搜尋資料",itemUnit:"項目",itemsUnit:"項目",remove:"删除",selectCurrent:"全選當頁",removeCurrent:"删除當頁",selectAll:"全選所有",removeAll:"删除全部",selectInvert:"反選當頁"},Upload:{uploading:"正在上傳...",removeFile:"刪除檔案",uploadError:"上傳失敗",previewFile:"檔案預覽",downloadFile:"下载文件"},Empty:{description:"無此資料"},Icon:{icon:"圖標"},Text:{edit:"編輯",copy:"複製",copied:"複製成功",expand:"展開",collapse:"收起"},Form:{optional:"(可選)",defaultValidateMessages:{default:"字段驗證錯誤${label}",required:"請輸入${label}",enum:"${label}必須是其中一個[${enum}]",whitespace:"${label}不能為空字符",date:{format:"${label}日期格式無效",parse:"${label}不能轉換為日期",invalid:"${label}是一個無效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}須為${len}個字符",min:"${label}最少${min}個字符",max:"${label}最多${max}個字符",range:"${label}須在${min}-${max}字符之間"},number:{len:"${label}必須等於${len}",min:"${label}最小值為${min}",max:"${label}最大值為${max}",range:"${label}須在${min}-${max}之間"},array:{len:"須為${len}個${label}",min:"最少${min}個${label}",max:"最多${max}個${label}",range:"${label}數量須在${min}-${max}之間"},pattern:{mismatch:"${label}與模式不匹配${pattern}"}}},Image:{preview:"預覽"},QRCode:{expired:"二維碼過期",refresh:"點擊刷新",scanned:"已掃描"},ColorPicker:{presetEmpty:"暫無",transparent:"透明",singleColor:"單色",gradientColor:"漸變色"}};return rv.default=o,rv}var y2,bae;function $3t(){return bae||(bae=1,y2=O3t()),y2}var I3t=$3t();const A3t=An(I3t),R3t=e=>{switch(e){case"zh-CN":return E3t;case"zh-TW":return A3t;case"fr-FR":return u3t;case"ja-JP":return v3t;default:return r3t}},yae="copilot_ui_theme_v1",M3t={colorPrimary:"#d9dada",colorPrimaryHover:"#e4e5e5",colorPrimaryActive:"#c8caca",colorInfo:"#d9dada",colorLink:"#8a8a8a",colorLinkHover:"#9c9c9c",colorLinkActive:"#767676",colorTextLightSolid:"#1f1f1f",borderRadius:6},P3t={colorPrimary:"#8f8f8f",colorInfo:"#8f8f8f",colorLink:"#c5c5c5",colorLinkHover:"#d7d7d7",colorLinkActive:"#a6a6a6",borderRadius:6};function N3t(){const{t:e}=br(),[t,n]=p.useState(()=>localStorage.getItem(yae)||"light"),[r,a]=p.useState(()=>w1e()),[i,o]=p.useState(null),[s,l]=p.useState(null),[c,u]=p.useState(0);if(p.useEffect(()=>{localStorage.setItem(yae,t)},[t]),p.useEffect(()=>{localStorage.setItem(C1e,r),E1e.changeLanguage(r)},[r]),p.useEffect(()=>{let f=!1;const h=Date.now(),g=async()=>{try{const v=await Vi.getInstance().getSetupStatus();if(f)return;l(null),o(v.is_complete)}catch(m){if(f)return;const v=Date.now()-h;if(v>=2e4){const S=Jh(),C=m instanceof Error&&m.message.trim()?m.message:"Unknown error";l(e("app.backendNotReachable",{baseUrl:S,message:C}));return}const y=Math.min(500+Math.floor(v/2),2e3);setTimeout(()=>{f||g()},y)}};return g(),()=>{f=!0}},[c,e]),p.useEffect(()=>{document.body.setAttribute("data-theme",t)},[t]),p.useEffect(()=>{var h;const f=(h=window.__TAURI_INTERNALS__)==null?void 0:h.invoke;typeof f=="function"&&f("set_window_theme",{theme:t}).catch(g=>{console.warn("[App] Failed to sync native window theme:",g)})},[t]),p.useEffect(()=>{i&&HGe()},[i]),i===null)return s?E.jsxs("div",{style:{padding:40,textAlign:"center"},children:[E.jsx("div",{style:{marginBottom:12},children:s}),E.jsx(De,{type:"primary",onClick:()=>{l(null),o(null),u(f=>f+1)},children:e("app.retry")})]}):E.jsx("div",{style:{padding:40,textAlign:"center"},children:e("app.loading")});const d=i?E.jsx(VFt,{themeMode:t,onThemeModeChange:n,locale:r,onLocaleChange:a}):E.jsx(GFt,{});return E.jsx(Ms,{locale:R3t(r),theme:{token:t==="dark"?P3t:M3t,algorithm:t==="dark"?pn.darkAlgorithm:pn.defaultAlgorithm},children:E.jsx(Ns,{children:E.jsx("div",{style:{position:"relative"},children:d})})})}const b4t=Object.freeze(Object.defineProperty({__proto__:null,default:N3t},Symbol.toStringTag,{value:"Module"}));export{f5 as $,lAt as A,De as B,i4t as C,rCt as D,a4t as E,wt as F,db as G,Wxt as H,tn as I,pTt as J,dCt as K,jr as L,qr as M,GH as N,jbe as O,Aw as P,mi as Q,Xp as R,i$t as S,Dn as T,s_t as U,mte as V,gC as W,Twt as X,ey as Y,yIt as Z,W as _,NE as a,fAt as a$,kh as a0,n4t as a1,lT as a2,XOt as a3,qwt as a4,yH as a5,kte as a6,nb as a7,a$t as a8,T0 as a9,_a as aA,bu as aB,DH as aC,USe as aD,Cf as aE,gSe as aF,kn as aG,dl as aH,He as aI,bde as aJ,Qt as aK,wn as aL,Xh as aM,pn as aN,Ot as aO,fr as aP,va as aQ,Y7 as aR,Zl as aS,ia as aT,NAt as aU,p4t as aV,g4t as aW,d4t as aX,Vt as aY,f4t as aZ,vAt as a_,Jwt as aa,_0 as ab,Ht as ac,Jt as ad,Gbe as ae,u5 as af,eh as ag,Yhe as ah,eC as ai,_r as aj,wY as ak,xY as al,h_ as am,Ds as an,X3t as ao,G3t as ap,K3t as aq,Y3t as ar,Q3t as as,Z3t as at,t4t as au,Une as av,WIt as aw,vwe as ax,h4t as ay,gTt as az,Zh as b,LE as b$,dAt as b0,VOt as b1,jkt as b2,BOt as b3,jH as b4,One as b5,mb as b6,Yd as b7,d5 as b8,D5 as b9,od as bA,mC as bB,kLe as bC,CLe as bD,mt as bE,se as bF,Ct as bG,Zr as bH,ne as bI,hE as bJ,Qj as bK,hn as bL,Xt as bM,_n as bN,J as bO,qo as bP,sa as bQ,Qr as bR,Ft as bS,ZPt as bT,i7e as bU,y7e as bV,Bn as bW,rt as bX,K7e as bY,DE as bZ,Hl as b_,R0 as ba,vIt as bb,mIt as bc,Ki as bd,jct as be,j5 as bf,nme as bg,S0 as bh,ime as bi,J3t as bj,Fdt as bk,ZZ as bl,XZ as bm,Ti as bn,Tme as bo,Q5 as bp,__ as bq,Out as br,kut as bs,sh as bt,Tut as bu,_ut as bv,vC as bw,w0 as bx,X5 as by,K5 as bz,oCt as c,nl as c0,Sf as c1,GOt as c2,sSe as c3,rT as c4,sT as c5,h1 as c6,cSe as c7,oSe as c8,COt as c9,_g as cA,vu as cB,Vte as cC,zH as cD,nSe as cE,rj as cF,tf as cG,V as cH,KOt as cI,oT as cJ,e4t as cK,b4t as cL,H5 as ca,qt as cb,Y0e as cc,qOt as cd,jOt as ce,_kt as cf,BH as cg,yOt as ch,YOt as ci,I0 as cj,Eg as ck,d1 as cl,IOt as cm,zAt as cn,$0 as co,p1 as cp,EOt as cq,eSe as cr,Okt as cs,$kt as ct,Fu as cu,Zte as cv,Ikt as cw,FH as cx,kkt as cy,Mkt as cz,iCt as d,aCt as e,pr as f,sCt as g,er as h,Vbe as i,Sa as j,rc as k,et as l,Zo as m,xTt as n,wg as o,vSe as p,r4t as q,v4t as r,vn as s,m4t as t,Ue as u,bs as v,l$t as w,lCt as x,cCt as y,hTt as z};
|
|
1052
|
+
`),truncated:qe.truncated})).sort((Je,qe)=>Je.filePath.localeCompare(qe.filePath));return{totalAdded:tt,totalRemoved:ct,files:Ze,changedTools:Ke}},[d]),b=p.useMemo(()=>{const Ne=m?"THINKING":"IDLE";return{value:Ne,context:{streamingContent:null,toolCallRequest:null,parsedParameters:null},matches:tt=>tt===Ne}},[m]),y=p.useCallback(Ne=>{r&&i(r,Ne)},[r,i]),S=p.useRef(null),{token:C}=NFt(),x=LFt(),[w,_]=p.useState(null),[T,k]=p.useState(!1),[O,I]=p.useState(new Set),M=rr(Ne=>Ne.sidebar.collapsed),$=()=>t||x.xs||x.sm?"100%":x.md?"90%":x.lg?"85%":"1024px",R=()=>{let Ne;return t?Ne=C.paddingSM:x.xs?Ne=C.paddingXS:x.sm?Ne=C.paddingSM:Ne=C.padding,!t&&M?Ne+18:Ne};p.useEffect(()=>{_(null),k(!1),I(new Set)},[r]);const{systemPromptMessage:A,renderableMessages:P,convertRenderableEntry:N}=PFt(a,d),L=d.length>0,j=!!(w!=null&&w.content),D=!!A,H=r&&(L||D||j),F=t?190:0,B=p.useMemo(()=>{if(!(w!=null&&w.content))return P;const Ne={message:{id:w.id,role:"user",content:w.content,createdAt:w.createdAt},messageType:"text"};return[...P,Ne]},[P,w]),z=p.useMemo(()=>{const Ne=[];for(const tt of B){if(!("message"in tt))continue;const ct=GCe(tt.message).trim();ct&&Ne.push({id:tt.message.id,message:tt.message,text:ct})}return Ne},[B]),G=p.useMemo(()=>new Set(z.map(Ne=>Ne.id)),[z]);p.useEffect(()=>{I(Ne=>{let tt=!1;const ct=new Set;for(const Ke of Ne)G.has(Ke)?ct.add(Ke):tt=!0;return tt?ct:Ne})},[G]);const X=p.useMemo(()=>z.filter(Ne=>O.has(Ne.id)),[z,O]),Z=z.length>0,q=p.useCallback(Ne=>{I(tt=>{const ct=new Set(tt);return ct.has(Ne)?ct.delete(Ne):ct.add(Ne),ct})},[]),Y=p.useCallback(()=>{if(!Z){n.warning("No exportable messages");return}k(!0)},[n,Z]),te=p.useCallback(()=>{k(!1),I(new Set)},[]),ee=p.useCallback(()=>{if(T){te();return}Y()},[Y,te,T]),Q=p.useCallback(()=>{I(new Set(z.map(Ne=>Ne.id)))},[z]),ae=p.useCallback(()=>{I(new Set)},[]),oe=p.useCallback(async Ne=>{var Ke;if(!r){n.warning("No active chat");return}if(X.length===0){n.warning("Please select at least one message");return}const tt=FFt(X),ct=await KCe.exportMessageText({format:Ne,content:tt,sessionId:r,filenamePrefix:`chat-messages-${X.length}`});if(ct.success){n.success(`Saved: ${ct.filename}`);return}(Ke=ct.error)!=null&&Ke.toLowerCase().includes("cancel")||n.error(ct.error||"Export failed")},[n,r,X]);p.useEffect(()=>{if(typeof window>"u")return;const Ne=tt=>{var Ze;const Ke=((Ze=tt.detail)==null?void 0:Ze.sessionId)??null;!r||Ke!==r||ee()};return window.addEventListener(fj,Ne),()=>{window.removeEventListener(fj,Ne)}},[r,ee]);const re=a==null?void 0:a.id,ie=r?l[r]:null,ue=(Ee=a==null?void 0:a.config)==null?void 0:Ee.tokenUsage,ge=ie||ue||null,Te=r?c[r]:!1,Se=(_e=a==null?void 0:a.config)==null?void 0:_e.truncationOccurred,fe=Te||Se||!1,he=r?u[r]:0,ve=(je=a==null?void 0:a.config)==null?void 0:je.segmentsRemoved,we=he||ve||0,Re=C.marginMD,{handleMessagesScroll:ce,resetUserScroll:xe,scrollToBottom:Me,scrollToTop:Ie,showScrollToBottom:de,showScrollToTop:me}=TFt({currentSessionId:r,interactionState:b,messagesListRef:S,renderableMessages:B}),pe=p.useCallback(()=>{xe(),Me()},[xe,Me]),Ae=()=>x.xs?16:32,ye=!!H&&Z&&(!t||T),Ce=ge&&ge.budgetLimit>0?E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:C.marginXS},children:[E.jsx(tFt,{usage:ge,showDetails:!0,size:"small"}),fe&&E.jsxs("span",{style:{fontSize:11,color:C.colorTextSecondary,whiteSpace:"nowrap"},children:["(",we," truncated)"]})]}):null;return E.jsx(Cs,{style:{flex:1,minHeight:0,height:"100%",background:C.colorBgContainer,position:"relative",overflow:"hidden"},children:E.jsxs(rt,{vertical:!0,style:{flex:1,minHeight:0,height:"100%"},children:[re&&h&&E.jsx("div",{style:{paddingTop:R(),paddingRight:R(),paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:E.jsx(BBt,{sessionId:re,initialCollapsed:!0})}),r&&g&&E.jsx("div",{style:{paddingTop:C.paddingXS,paddingRight:R(),paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:E.jsx(cFt,{parentSessionId:r})}),ye&&E.jsx("div",{style:{paddingTop:C.paddingXS,paddingRight:R()+F,paddingBottom:0,paddingLeft:R(),maxWidth:$(),margin:"0 auto",width:"100%"},children:T?E.jsxs(rt,{align:"center",justify:"space-between",wrap:"wrap",gap:C.marginXS,children:[E.jsxs(DFt,{type:"secondary",children:["Selected ",X.length," /"," ",z.length]}),E.jsxs(He,{size:C.marginXS,wrap:!0,children:[E.jsx(De,{size:"small",onClick:Q,children:"Select all"}),E.jsx(De,{size:"small",onClick:ae,children:"Clear"}),E.jsx(De,{size:"small",icon:E.jsx(Yp,{}),onClick:()=>{oe("markdown")},disabled:X.length===0,children:"Export MD"}),E.jsx(De,{size:"small",type:"primary",icon:E.jsx(Yp,{}),onClick:()=>{oe("pdf")},disabled:X.length===0,children:"Export PDF"}),E.jsx(De,{size:"small",icon:E.jsx(Xh,{}),onClick:ee,children:"Done"})]})]}):E.jsx(rt,{justify:"flex-end",children:E.jsx(wn,{title:"Select messages to export",children:E.jsx(De,{"aria-label":"Select messages to export",icon:E.jsx(vde,{}),size:"small",onClick:ee})})})}),E.jsx(DBt,{currentChat:a,currentSessionId:r,convertRenderableEntry:N,handleDeleteMessage:y,handleMessagesScroll:ce,hasSystemPrompt:D,messagesListRef:S,renderableMessages:B,rowGap:Re,showMessagesView:!!H,screens:x,workflowDraftId:w==null?void 0:w.id,interactionState:b,padding:R(),selectionMode:T,selectedMessageIds:O,selectableMessageIds:G,onToggleMessageSelection:q}),(me||de)&&E.jsxs("div",{style:{position:"absolute",right:Ae(),bottom:x.xs?160:180,display:"flex",flexDirection:"column",gap:C.marginXS,zIndex:1e3},children:[me&&E.jsx(Jc,{type:"default",icon:E.jsx(sF,{}),style:{position:"relative",inset:"unset"},onClick:()=>{Ie()}}),de&&E.jsx(Jc,{type:"primary",icon:E.jsx(As,{}),style:{position:"relative",inset:"unset"},onClick:()=>{xe(),Me()}})]}),re&&E.jsx("div",{style:{padding:`0 ${R()}px`,maxWidth:H?$():"100%",margin:"0 auto",width:"100%"},children:E.jsx(JBt,{sessionId:re,onQuestionAppeared:pe})}),E.jsx(bNt,{sessionId:r,isCenteredLayout:!H,maxWidth:H?$():"100%",onWorkflowDraftChange:_,showMessagesView:!!H,sessionDiffSummary:v,contextUsageIndicator:Ce})]})})},Am=(e,t,n)=>Math.max(t,Math.min(n,e)),ox=(e,t)=>t==="horizontal"?e.clientWidth:e.clientHeight,i1e=({layout:e,first:t,second:n,sizesPx:r,defaultSplitRatio:a=.5,minFirstPx:i=0,minSecondPx:o=0,handleSizePx:s=6,disabled:l=!1,onResizeEnd:c,style:u,className:d})=>{const f=p.useRef(null),h=p.useRef(null),[g,m]=p.useState(null),[v,b]=p.useState(null),y=p.useMemo(()=>{if(!r)return null;const M=Number(r[0]);return Number.isFinite(M)?M:null},[r]);p.useLayoutEffect(()=>{if(y!==null||v!==null)return;const M=f.current;if(!M)return;const $=ox(M,e);if(!$)return;const R=Am(a,.1,.9),A=Math.round($*R);b(A)},[v,a,e,y]),p.useEffect(()=>{const M=f.current;if(!M||y!==null||v===null)return;const $=()=>{const R=ox(M,e);if(!R)return;const A=Math.max(i,R-o),P=Am(v,i,A);P!==v&&b(P)};return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[v,e,i,o,y]);const S=g??y??v??0,C=p.useCallback(M=>{if(l)return;const $=f.current;if(!$)return;M.preventDefault(),M.stopPropagation();const R=e==="horizontal"?M.clientX:M.clientY,A=ox($,e),P=S||Math.round(A*Am(a,.1,.9));h.current={pointerId:M.pointerId,startPos:R,startFirstPx:P,containerSize:A};try{M.currentTarget.setPointerCapture(M.pointerId)}catch{}},[a,l,S,e]),x=p.useCallback(M=>{const $=h.current;if(!$||M.pointerId!==$.pointerId)return;M.preventDefault(),M.stopPropagation();const A=(e==="horizontal"?M.clientX:M.clientY)-$.startPos,P=$.containerSize,N=Math.max(i,P-o),L=Am(Math.round($.startFirstPx+A),i,N);m(L)},[e,i,o]),w=p.useCallback(M=>{const $=h.current;if(!$||$.pointerId!==M)return;const R=f.current,A=R?ox(R,e):$.containerSize,P=g??$.startFirstPx,N=Math.max(i,A-o),L=Am(P,i,N),j=Math.max(o,A-L);m(null),b(L),h.current=null,c==null||c([L,j])},[e,g,i,o,c]),_=p.useCallback(M=>{M.preventDefault(),M.stopPropagation(),w(M.pointerId)},[w]),T=p.useCallback(M=>{M.preventDefault(),M.stopPropagation(),w(M.pointerId)},[w]),k=e==="horizontal",O=l?"default":k?"col-resize":"row-resize",I=Math.max(0,Math.round(s));return E.jsxs("div",{ref:f,className:d,style:{display:"flex",flexDirection:k?"row":"column",height:"100%",minHeight:0,minWidth:0,width:"100%",position:"relative",...u},children:[E.jsx("div",{style:{flex:`0 0 ${S}px`,minWidth:k?i:0,minHeight:k?0:i,overflow:"hidden",display:"flex"},children:E.jsx("div",{style:{flex:1,minHeight:0,minWidth:0},children:t})}),E.jsx("div",{style:{flex:"1 1 auto",minWidth:k?o:0,minHeight:k?0:o,overflow:"hidden",display:"flex"},children:E.jsx("div",{style:{flex:1,minHeight:0,minWidth:0},children:n})}),I>0?E.jsx("div",{role:"separator","aria-orientation":k?"vertical":"horizontal",onPointerDown:C,onPointerMove:x,onPointerUp:_,onPointerCancel:T,style:{position:"absolute",top:k?0:`${S-I/2}px`,left:k?`${S-I/2}px`:0,width:k?`${I}px`:"100%",height:k?"100%":`${I}px`,cursor:O,touchAction:"none",background:"transparent",zIndex:5}}):null]})},{useToken:HFt}=pn,UFt=4,WFt=({leafId:e})=>{const{token:t}=HFt(),n=rr(y=>y.tree),r=rr(y=>y.leafSessionIds),a=rr(y=>y.activeLeafId),i=rr(y=>y.setActiveLeafId),o=rr(y=>y.splitLeaf),s=rr(y=>y.closeLeaf),l=rr(y=>y.setLeafSessionId),c=Ue(y=>y.selectSession),u=r[e]??null,d=p.useMemo(()=>Do(n).length,[n]),f=d<UFt,h=d>1,m=h||!!u,v=d>1,b=a===e;return E.jsxs("div",{className:"chat-pane-shell",onMouseDownCapture:()=>{Lo("pane focus (mouse)",{leafId:e,sessionId:u,prevActiveLeafId:a}),i(e),u&&c(u)},onFocusCapture:()=>{Lo("pane focus (focus)",{leafId:e,sessionId:u,prevActiveLeafId:a}),i(e)},style:{height:"100%",minHeight:0,border:v?`1px solid ${b?t.colorPrimaryBorder:t.colorBorderSecondary}`:"none",borderRadius:v?t.borderRadiusLG:0,overflow:"hidden",background:t.colorBgContainer,position:"relative"},children:[E.jsx("div",{className:"chat-pane-actions",style:{background:t.colorBgElevated,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:10,padding:"2px 4px"},children:E.jsxs(rt,{gap:t.marginXS,children:[E.jsx(De,{size:"small",type:"text",icon:E.jsx(u7e,{}),disabled:!f,title:"Split Horizontal","aria-label":"Split Horizontal",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane split request",{leafId:e,layout:"horizontal"}),o(e,"horizontal");const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;C&&c(C)}}),E.jsx(De,{size:"small",type:"text",icon:E.jsx(f7e,{}),disabled:!f,title:"Split Vertical","aria-label":"Split Vertical",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane split request",{leafId:e,layout:"vertical"}),o(e,"vertical");const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;C&&c(C)}}),E.jsx(De,{size:"small",type:"text",icon:E.jsx(vde,{}),disabled:!u,title:"Select Messages to Export","aria-label":"Select Messages to Export",onClick:y=>{y.preventDefault(),y.stopPropagation(),u&&window.dispatchEvent(new CustomEvent(fj,{detail:{sessionId:u}}))}}),E.jsx(De,{size:"small",type:"text",danger:!0,icon:E.jsx(Xh,{}),disabled:!m,title:"Close","aria-label":"Close",onClick:y=>{y.preventDefault(),y.stopPropagation(),Lo("pane close request",{leafId:e}),h?s(e):l(e,null);const S=rr.getState(),C=S.leafSessionIds[S.activeLeafId]??null;c(C)}})]})}),u?E.jsx(zFt,{sessionId:u,embedded:!0}):E.jsxs(rt,{vertical:!0,align:"center",justify:"center",style:{height:"100%",minHeight:0,padding:t.paddingLG},children:[E.jsx("div",{style:{color:t.colorTextSecondary},children:"Select a session to start chatting"}),E.jsx("div",{style:{color:t.colorTextTertiary,fontSize:12},children:"Hover over top-right corner to split/close"})]})]})},qFt=({node:e})=>{const t=rr(r=>r.splitSizesPx[e.id]??null),n=rr(r=>r.setSplitSizesPx);return E.jsx(i1e,{layout:e.layout,sizesPx:t,defaultSplitRatio:.5,minFirstPx:240,minSecondPx:240,style:{height:"100%",minHeight:0},onResizeEnd:r=>{n(e.id,r)},first:E.jsx(pj,{node:e.children[0]}),second:E.jsx(pj,{node:e.children[1]})})},pj=({node:e})=>e.type==="leaf"?E.jsx(WFt,{leafId:e.id}):E.jsx(qFt,{node:e}),VFt=()=>{const e=rr(d=>d.tree),t=rr(d=>d.leafSessionIds),n=rr(d=>d.activeLeafId),r=rr(d=>d.setActiveLeafId),a=rr(d=>d.setLeafSessionId),i=rr(d=>d.clearSessionFromAllLeaves),o=Ue(d=>d.chats),s=Ue(d=>d.currentSessionId),l=p.useRef(!1),c=p.useMemo(()=>Do(e),[e]),u=p.useMemo(()=>new Set(o.map(d=>d.id)),[o]);return p.useEffect(()=>{c.length!==0&&(c.includes(n)||r(c[0]))},[n,c,r]),p.useEffect(()=>{for(const[d,f]of Object.entries(t))f&&!u.has(f)&&a(d,null)},[u,t,a]),p.useEffect(()=>{if(!s||l.current)return;if(!Object.values(t).some(Boolean)){a(n,s),l.current=!0;return}l.current=!0},[n,s,t,a]),p.useEffect(()=>{const d=new Set(Object.values(t).filter(Boolean));for(const f of d)u.has(f)||i(f)},[u,i,t]),E.jsx("div",{style:{height:"100%",minHeight:0,padding:0},children:E.jsx(pj,{node:e})})},GFt=({themeMode:e,onThemeModeChange:t,locale:n,onLocaleChange:r})=>{const a=Ub(T=>T.isOpen),i=Ub(T=>T.close),{token:o}=pn.useToken(),s=o_(),l=p.useMemo(()=>Rhe()==="macos",[]),c=Ho(T=>T.loadProviderConfig);p.useEffect(()=>{c()},[c]),qMt(),MMt(),p.useEffect(()=>{Mne.clear(),Pne()},[e]),p.useEffect(()=>{Mne.clear(),Pne()},[s]);const u=rr(T=>T.sidebar.collapsed),d=rr(T=>T.sidebar.widthPx),f=rr(T=>T.sidebar.minWidthPx),h=rr(T=>T.sidebar.maxWidthPx),g=rr(T=>T.setSidebarCollapsed),m=rr(T=>T.setSidebarWidthPx),v=18,b=0,S=!a&&u&&l?44:b,C=0,x=88,w=10,_="none";return E.jsx(Cs,{style:{minHeight:"100vh",height:"100vh",overflow:"hidden",background:o.colorBgLayout,display:"flex",flexDirection:"row",position:"relative"},children:E.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,height:"100%",width:"100%",boxSizing:"border-box",paddingTop:S,paddingLeft:b,paddingRight:b,paddingBottom:b,background:o.colorFillQuaternary},children:[a?E.jsx(Cs,{style:{flex:1,display:"flex",flexDirection:"column",background:o.colorBgContainer,minHeight:0,borderRadius:`${v}px 0 0 ${v}px`,border:_,overflow:"hidden",boxShadow:"-8px 0 20px rgba(0, 0, 0, 0.04)"},children:E.jsx(Hxt,{themeMode:e,onThemeModeChange:t,locale:n,onLocaleChange:r,onBack:i})}):E.jsxs(E.Fragment,{children:[E.jsx(Uxt,{}),E.jsx(i1e,{layout:"horizontal",style:{flex:1,minHeight:0,height:"100%",background:"transparent"},sizesPx:[u?C:d,0],minFirstPx:u?C:f,minSecondPx:320,disabled:u,handleSizePx:u?0:2,onResizeEnd:([T])=>{if(u)return;const k=Math.max(f,Math.min(h,T));m(k)},first:E.jsx("div",{style:{height:"100%",minHeight:0,borderRadius:`${v}px 0 0 ${v}px`,border:_,overflow:"hidden",background:o.colorFillQuaternary},children:E.jsx(Dnt,{})}),second:E.jsx("div",{style:{height:"100%",minHeight:0,borderRadius:`0 ${v}px ${v}px 0`,border:_,overflow:"hidden",background:o.colorBgContainer,boxShadow:"none"},children:E.jsx(Cs,{style:{display:"flex",flexDirection:"column",background:o.colorBgContainer,minHeight:0,height:"100%"},children:E.jsx(VFt,{})})})})]}),!a&&u?E.jsx(De,{"data-testid":"show-sidebar",type:"text",size:"small",icon:E.jsx(lVe,{}),onClick:()=>g(!1),title:"Show sidebar","aria-label":"Show sidebar",style:{position:"absolute",top:w,left:x,zIndex:40,width:28,height:28,borderRadius:8,border:`1px solid ${o.colorBorderSecondary}`,background:o.colorBgElevated,boxShadow:o.boxShadowTertiary}}):null]})})},Are={httpProxy:"",httpsProxy:"",proxyUsername:"",proxyPassword:"",rememberProxyAuth:!0},c2=e=>typeof e=="string"?e:"",KFt=()=>{const[e,t]=p.useState(0),[n,r]=p.useState(Are),[a,i]=p.useState(!1),[o,s]=p.useState(!1),[l,c]=p.useState(null),[u,d]=p.useState(!1),[f,h]=p.useState(null),[g,m]=p.useState(!1);p.useEffect(()=>{(async()=>{let _=!1;try{const T=Vi.getInstance(),k=await T.getBambooConfig(),O=c2(k.http_proxy),I=c2(k.https_proxy),M=await T.getProxyAuthStatus(),$=c2(M.username);r({httpProxy:O,httpsProxy:I,proxyUsername:$,proxyPassword:"",rememberProxyAuth:Are.rememberProxyAuth}),_=O.trim().length>0||I.trim().length>0,i(_)}catch(T){console.error("Failed to check config:",T),i(!1)}s(!0);try{const k=await Vi.getInstance().getSetupStatus();c({needsProxy:k.has_proxy_env,message:k.message}),i(_||k.has_proxy_env)}catch(T){console.error("Failed to check setup status:",T),c({needsProxy:!0,message:"Unable to load setup status. You can continue with manual proxy configuration."})}finally{s(!1)}})()},[]);const b=n.httpProxy.trim().length>0||n.httpsProxy.trim().length>0||a,y=w=>{r(_=>({..._,...w}))},S=async()=>{var I,M;const w=n.httpProxy.trim(),_=n.httpsProxy.trim(),T=!!(w||_),k=n.proxyUsername.trim(),O=!!k;try{if(h(null),m(!0),T){const R=Vi.getInstance(),A=await R.validateBambooConfigPatch({http_proxy:w,https_proxy:_});if(!A.valid){const N=((M=(I=A.errors)==null?void 0:I.proxy)==null?void 0:M[0])??Object.values(A.errors||{}).flat().filter(Boolean)[0];h((N==null?void 0:N.message)||"Proxy settings are invalid.");return}if(n.rememberProxyAuth&&!O&&n.proxyPassword.trim()){h("To store proxy credentials, please enter a username or uncheck 'Remember credentials'.");return}await R.setBambooConfig({http_proxy:w,https_proxy:_}),n.rememberProxyAuth&&O?await R.setProxyAuth({username:k,password:n.proxyPassword||""}):await R.clearProxyAuth()}await Vi.getInstance().markSetupComplete(),d(!0)}catch($){console.error("Failed to complete setup:",$);const R=$ instanceof Error&&$.message.trim()?$.message:T?"Failed to save proxy configuration. Please try again.":"Failed to complete setup. Please try again.";h(R)}finally{m(!1)}},C=async()=>{try{h(null),m(!0),await Vi.getInstance().markSetupComplete(),d(!0)}catch(w){console.error("Failed to mark setup complete:",w),h("Failed to complete setup. Please try again.")}finally{m(!1)}},x=p.useMemo(()=>[{title:"Welcome",content:E.jsxs("div",{children:[E.jsx("h1",{children:"Welcome to Bodhi"}),E.jsx("p",{children:"Let's set up your environment before entering the main app."}),E.jsx(fr,{message:"You can skip setup now and configure proxy settings later in System Settings.",type:"info",showIcon:!0,style:{marginBottom:16}}),E.jsxs("div",{className:"setup-page__actions",children:[E.jsx(De,{"data-testid":"setup-next",type:"primary",onClick:()=>t(1),children:"Next"}),E.jsx(De,{"data-testid":"setup-skip",onClick:()=>void C(),loading:g,children:"Skip for now"})]})]})},{title:"Proxy Configuration",content:E.jsxs("div",{children:[E.jsx("h2",{children:"Proxy Configuration"}),E.jsx(fr,{message:"If you're behind a corporate proxy, configure it below.",type:"info",showIcon:!0}),E.jsx(fr,{message:"Provider configuration is done later in Provider Settings. This setup step only stores network/proxy settings.",type:"info",showIcon:!0,style:{marginTop:16}}),o?E.jsx("div",{style:{marginTop:16},children:E.jsx(ia,{tip:"Detecting network environment..."})}):null,l?E.jsx(fr,{message:l.message,type:l.needsProxy?"warning":"success",showIcon:!0,style:{marginTop:16}}):null,!o&&!l&&!a?E.jsx(fr,{message:"No existing proxy was detected. You can leave these fields empty if your network does not require a proxy.",type:"success",showIcon:!0,style:{marginTop:16}}):null,f?E.jsx(fr,{message:f,type:"error",showIcon:!0,style:{marginTop:16}}):null,E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-http-proxy",children:"HTTP Proxy URL:"}),E.jsx(tn,{id:"setup-http-proxy",value:n.httpProxy,onChange:w=>y({httpProxy:w.target.value}),placeholder:"http://proxy.company.com:8080"})]}),E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-https-proxy",children:"HTTPS Proxy URL:"}),E.jsx(tn,{id:"setup-https-proxy",value:n.httpsProxy,onChange:w=>y({httpsProxy:w.target.value}),placeholder:"http://proxy.company.com:8080"})]}),b?E.jsxs(E.Fragment,{children:[E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-proxy-username",children:"Username"}),E.jsx(tn,{id:"setup-proxy-username",value:n.proxyUsername,onChange:w=>y({proxyUsername:w.target.value})})]}),E.jsxs("div",{style:{marginTop:16},children:[E.jsx("label",{htmlFor:"setup-proxy-password",children:"Password"}),E.jsx(tn.Password,{id:"setup-proxy-password",value:n.proxyPassword,onChange:w=>y({proxyPassword:w.target.value})})]}),E.jsx("div",{style:{marginTop:16},children:E.jsx(Zc,{checked:n.rememberProxyAuth,onChange:w=>y({rememberProxyAuth:w.target.checked}),children:"Remember credentials (encrypted)"})})]}):null,E.jsxs("div",{className:"setup-page__actions",style:{marginTop:24},children:[E.jsx(De,{"data-testid":"setup-back",onClick:()=>t(0),children:"Back"}),E.jsx(De,{"data-testid":"setup-skip",onClick:()=>void C(),loading:g,children:"Skip for now"}),E.jsx(De,{"data-testid":"setup-complete",onClick:()=>void S(),type:"primary",loading:g,children:"Complete Setup"})]})]})}],[n,l,f,o,g,a,b]);return u?E.jsxs("div",{"data-testid":"setup-complete",className:"setup-complete",children:[E.jsx("h1",{children:"Setup Complete!"}),E.jsx("p",{children:"Please restart the application to apply all settings."}),E.jsx(De,{"data-testid":"setup-restart",onClick:()=>window.location.reload(),children:"Restart"})]}):E.jsx("div",{className:"setup-page",children:E.jsxs(Ot,{style:{maxWidth:600,margin:"40px auto"},children:[E.jsx(zB,{current:e,items:x.map(w=>({title:w.title}))}),E.jsx("div",{style:{marginTop:24},children:x[e].content})]})})};var Rm={},u2={exports:{}},Rre;function ca(){return Rre||(Rre=1,function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(u2)),u2.exports}var Mm={},Mre;function YFt(){if(Mre)return Mm;Mre=1,Object.defineProperty(Mm,"__esModule",{value:!0}),Mm.default=void 0;var e={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"};return Mm.default=e,Mm}var Pm={},Nm={},Lm={},d2={exports:{}},f2={exports:{}},p2={exports:{}},h2={exports:{}},Pre;function XFt(){return Pre||(Pre=1,function(e){var t=Zfe().default;function n(r,a){if(t(r)!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var o=i.call(r,a||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(h2)),h2.exports}var Nre;function ZFt(){return Nre||(Nre=1,function(e){var t=Zfe().default,n=XFt();function r(a){var i=n(a,"string");return t(i)=="symbol"?i:i+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(p2)),p2.exports}var Lre;function QFt(){return Lre||(Lre=1,function(e){var t=ZFt();function n(r,a,i){return(a=t(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(f2)),f2.exports}var Dre;function D0(){return Dre||(Dre=1,function(e){var t=QFt();function n(a,i){var o=Object.keys(a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);i&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),o.push.apply(o,s)}return o}function r(a){for(var i=1;i<arguments.length;i++){var o=arguments[i]!=null?arguments[i]:{};i%2?n(Object(o),!0).forEach(function(s){t(a,s,o[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(s){Object.defineProperty(a,s,Object.getOwnPropertyDescriptor(o,s))})}return a}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(d2)),d2.exports}var Dm={},jre;function j0(){return jre||(jre=1,Object.defineProperty(Dm,"__esModule",{value:!0}),Dm.commonLocale=void 0,Dm.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Dm}var Bre;function JFt(){if(Bre)return Lm;Bre=1;var e=ca().default;Object.defineProperty(Lm,"__esModule",{value:!0}),Lm.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});return Lm.default=r,Lm}var jm={},Fre;function o1e(){if(Fre)return jm;Fre=1,Object.defineProperty(jm,"__esModule",{value:!0}),jm.default=void 0;const e={placeholder:"Select time",rangePlaceholder:["Start time","End time"]};return jm.default=e,jm}var zre;function s1e(){if(zre)return Nm;zre=1;var e=ca().default;Object.defineProperty(Nm,"__esModule",{value:!0}),Nm.default=void 0;var t=e(JFt()),n=e(o1e());const r={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},t.default),timePickerLocale:Object.assign({},n.default)};return Nm.default=r,Nm}var Hre;function e3t(){if(Hre)return Pm;Hre=1;var e=ca().default;Object.defineProperty(Pm,"__esModule",{value:!0}),Pm.default=void 0;var t=e(s1e());return Pm.default=t.default,Pm}var Ure;function t3t(){if(Ure)return Rm;Ure=1;var e=ca().default;Object.defineProperty(Rm,"__esModule",{value:!0}),Rm.default=void 0;var t=e(YFt()),n=e(e3t()),r=e(s1e()),a=e(o1e());const i="${label} is not a valid ${type}",o={locale:"en",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};return Rm.default=o,Rm}var g2,Wre;function n3t(){return Wre||(Wre=1,g2=t3t()),g2}var r3t=n3t();const a3t=An(r3t);var Bm={},Fm={},qre;function i3t(){if(qre)return Fm;qre=1,Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.default=void 0;var e={items_per_page:"/ page",jump_to:"Aller à",jump_to_confirm:"confirmer",page:"Page",prev_page:"Page précédente",next_page:"Page suivante",prev_5:"5 Pages précédentes",next_5:"5 Pages suivantes",prev_3:"3 Pages précédentes",next_3:"3 Pages suivantes",page_size:"taille de la page"};return Fm.default=e,Fm}var zm={},Hm={},Um={},Vre;function o3t(){if(Vre)return Um;Vre=1;var e=ca().default;Object.defineProperty(Um,"__esModule",{value:!0}),Um.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"fr_FR",today:"Aujourd'hui",now:"Maintenant",backToToday:"Aujourd'hui",ok:"OK",clear:"Rétablir",week:"Semaine",month:"Mois",year:"Année",timeSelect:"Sélectionner l'heure",dateSelect:"Sélectionner la date",monthSelect:"Choisissez un mois",yearSelect:"Choisissez une année",decadeSelect:"Choisissez une décennie",dateFormat:"DD/MM/YYYY",dayFormat:"DD",dateTimeFormat:"DD/MM/YYYY HH:mm:ss",previousMonth:"Mois précédent (PageUp)",nextMonth:"Mois suivant (PageDown)",previousYear:"Année précédente (Ctrl + gauche)",nextYear:"Année prochaine (Ctrl + droite)",previousDecade:"Décennie précédente",nextDecade:"Décennie suivante",previousCentury:"Siècle précédent",nextCentury:"Siècle suivant"});return Um.default=r,Um}var Wm={},Gre;function l1e(){if(Gre)return Wm;Gre=1,Object.defineProperty(Wm,"__esModule",{value:!0}),Wm.default=void 0;const e={placeholder:"Sélectionner l'heure",rangePlaceholder:["Heure de début","Heure de fin"]};return Wm.default=e,Wm}var Kre;function c1e(){if(Kre)return Hm;Kre=1;var e=ca().default;Object.defineProperty(Hm,"__esModule",{value:!0}),Hm.default=void 0;var t=e(o3t()),n=e(l1e());const r={lang:Object.assign({placeholder:"Sélectionner une date",yearPlaceholder:"Sélectionner une année",quarterPlaceholder:"Sélectionner un trimestre",monthPlaceholder:"Sélectionner un mois",weekPlaceholder:"Sélectionner une semaine",rangePlaceholder:["Date de début","Date de fin"],rangeYearPlaceholder:["Année de début","Année de fin"],rangeMonthPlaceholder:["Mois de début","Mois de fin"],rangeWeekPlaceholder:["Semaine de début","Semaine de fin"]},t.default),timePickerLocale:Object.assign({},n.default)};return Hm.default=r,Hm}var Yre;function s3t(){if(Yre)return zm;Yre=1;var e=ca().default;Object.defineProperty(zm,"__esModule",{value:!0}),zm.default=void 0;var t=e(c1e());return zm.default=t.default,zm}var Xre;function l3t(){if(Xre)return Bm;Xre=1;var e=ca().default;Object.defineProperty(Bm,"__esModule",{value:!0}),Bm.default=void 0;var t=e(i3t()),n=e(s3t()),r=e(c1e()),a=e(l1e());const i="La valeur du champ ${label} n'est pas valide pour le type ${type}",o={locale:"fr",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,Table:{filterTitle:"Filtrer",filterConfirm:"OK",filterReset:"Réinitialiser",filterEmptyText:"Aucun filtre",filterCheckAll:"Tout sélectionner",filterSearchPlaceholder:"Chercher dans les filtres",emptyText:"Aucune donnée",selectAll:"Sélectionner la page actuelle",selectInvert:"Inverser la sélection de la page actuelle",selectNone:"Désélectionner toutes les données",selectionAll:"Sélectionner toutes les données",sortTitle:"Trier",expand:"Développer la ligne",collapse:"Réduire la ligne",triggerDesc:"Trier par ordre décroissant",triggerAsc:"Trier par ordre croissant",cancelSort:"Annuler le tri"},Tour:{Next:"Étape suivante",Previous:"Étape précédente",Finish:"Fin de la visite guidée"},Modal:{okText:"OK",cancelText:"Annuler",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Annuler"},Transfer:{titles:["",""],searchPlaceholder:"Rechercher",itemUnit:"élément",itemsUnit:"éléments",remove:"Désélectionner",selectCurrent:"Sélectionner la page actuelle",removeCurrent:"Désélectionner la page actuelle",selectAll:"Sélectionner toutes les données",removeAll:"Désélectionner toutes les données",selectInvert:"Inverser la sélection de la page actuelle"},Upload:{uploading:"Téléchargement...",removeFile:"Effacer le fichier",uploadError:"Erreur de téléchargement",previewFile:"Fichier de prévisualisation",downloadFile:"Télécharger un fichier"},Empty:{description:"Aucune donnée"},Icon:{icon:"icône"},Text:{edit:"Éditer",copy:"Copier",copied:"Copie effectuée",expand:"Développer"},Form:{optional:"(optionnel)",defaultValidateMessages:{default:"Erreur de validation pour le champ ${label}",required:"Le champ ${label} est obligatoire",enum:"La valeur du champ ${label} doit être parmi [${enum}]",whitespace:"La valeur du champ ${label} ne peut pas être vide",date:{format:"La valeur du champ ${label} n'est pas au format date",parse:"La valeur du champ ${label} ne peut pas être convertie vers une date",invalid:"La valeur du champ ${label} n'est pas une date valide"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"La taille du champ ${label} doit être de ${len} caractères",min:"La taille du champ ${label} doit être au minimum de ${min} caractères",max:"La taille du champ ${label} doit être au maximum de ${max} caractères",range:"La taille du champ ${label} doit être entre ${min} et ${max} caractères"},number:{len:"La valeur du champ ${label} doit être égale à ${len}",min:"La valeur du champ ${label} doit être plus grande que ${min}",max:"La valeur du champ ${label} doit être plus petit que ${max}",range:"La valeur du champ ${label} doit être entre ${min} et ${max}"},array:{len:"La taille du tableau ${label} doit être de ${len}",min:"La taille du tableau ${label} doit être au minimum de ${min}",max:"La taille du tableau ${label} doit être au maximum de ${max}",range:"La taille du tableau ${label} doit être entre ${min}-${max}"},pattern:{mismatch:"La valeur du champ ${label} ne correspond pas au modèle ${pattern}"}}},Image:{preview:"Aperçu"}};return Bm.default=o,Bm}var m2,Zre;function c3t(){return Zre||(Zre=1,m2=l3t()),m2}var u3t=c3t();const d3t=An(u3t);var qm={},Vm={},Qre;function f3t(){if(Qre)return Vm;Qre=1,Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.default=void 0;var e={items_per_page:"件 / ページ",jump_to:"移動",jump_to_confirm:"確認する",page:"ページ",prev_page:"前のページ",next_page:"次のページ",prev_5:"前 5ページ",next_5:"次 5ページ",prev_3:"前 3ページ",next_3:"次 3ページ",page_size:"ページサイズ"};return Vm.default=e,Vm}var Gm={},Km={},Ym={},Jre;function p3t(){if(Jre)return Ym;Jre=1;var e=ca().default;Object.defineProperty(Ym,"__esModule",{value:!0}),Ym.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"ja_JP",today:"今日",now:"現在時刻",backToToday:"今日に戻る",ok:"確定",timeSelect:"時間を選択",dateSelect:"日時を選択",weekSelect:"週を選択",clear:"クリア",week:"週",month:"月",year:"年",previousMonth:"前月 (ページアップキー)",nextMonth:"翌月 (ページダウンキー)",monthSelect:"月を選択",yearSelect:"年を選択",decadeSelect:"年代を選択",yearFormat:"YYYY年",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"前年 (Controlを押しながら左キー)",nextYear:"翌年 (Controlを押しながら右キー)",previousDecade:"前の年代",nextDecade:"次の年代",previousCentury:"前の世紀",nextCentury:"次の世紀",monthBeforeYear:!1});return Ym.default=r,Ym}var Xm={},eae;function u1e(){if(eae)return Xm;eae=1,Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.default=void 0;const e={placeholder:"時間を選択",rangePlaceholder:["開始時間","終了時間"]};return Xm.default=e,Xm}var tae;function d1e(){if(tae)return Km;tae=1;var e=ca().default;Object.defineProperty(Km,"__esModule",{value:!0}),Km.default=void 0;var t=e(p3t()),n=e(u1e());const r={lang:Object.assign({placeholder:"日付を選択",yearPlaceholder:"年を選択",quarterPlaceholder:"四半期を選択",monthPlaceholder:"月を選択",weekPlaceholder:"週を選択",rangePlaceholder:["開始日付","終了日付"],rangeYearPlaceholder:["開始年","終了年"],rangeMonthPlaceholder:["開始月","終了月"],rangeQuarterPlaceholder:["開始四半期","終了四半期"],rangeWeekPlaceholder:["開始週","終了週"],shortWeekDays:["日","月","火","水","木","金","土"],shortMonths:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},t.default),timePickerLocale:Object.assign({},n.default)};return Km.default=r,Km}var nae;function h3t(){if(nae)return Gm;nae=1;var e=ca().default;Object.defineProperty(Gm,"__esModule",{value:!0}),Gm.default=void 0;var t=e(d1e());return Gm.default=t.default,Gm}var rae;function g3t(){if(rae)return qm;rae=1;var e=ca().default;Object.defineProperty(qm,"__esModule",{value:!0}),qm.default=void 0;var t=e(f3t()),n=e(h3t()),r=e(d1e()),a=e(u1e());const i="${label}は有効な${type}ではありません",o={locale:"ja",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"選んでください"},Table:{filterTitle:"フィルター",filterConfirm:"OK",filterReset:"リセット",filterEmptyText:"フィルターなし",filterCheckAll:"すべてを選択",filterSearchPlaceholder:"フィルターで検索",emptyText:"データなし",selectAll:"ページ単位で選択",selectInvert:"ページ単位で反転",selectNone:"クリア",selectionAll:"すべてを選択",sortTitle:"ソート",expand:"展開する",collapse:"折り畳む",triggerDesc:"クリックで降順にソート",triggerAsc:"クリックで昇順にソート",cancelSort:"ソートをキャンセル"},Tour:{Next:"次",Previous:"前の",Finish:"仕上げる"},Modal:{okText:"OK",cancelText:"キャンセル",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"キャンセル"},Transfer:{titles:["",""],searchPlaceholder:"ここを検索",itemUnit:"アイテム",itemsUnit:"アイテム",remove:"削除",selectCurrent:"現在のページを選択",removeCurrent:"現在のページを削除",selectAll:"ページ単位で選択",deselectAll:"すべてのデータの選択を解除する",removeAll:"ページ単位で削除",selectInvert:"ページ単位で反転"},Upload:{uploading:"アップロード中...",removeFile:"ファイルを削除",uploadError:"アップロードエラー",previewFile:"ファイルをプレビュー",downloadFile:"ダウンロードファイル"},Empty:{description:"データがありません"},Icon:{icon:"アイコン"},Text:{edit:"編集",copy:"コピー",copied:"コピーされました",expand:"拡大する",collapse:"崩壊"},Form:{optional:"(オプション)",defaultValidateMessages:{default:"${label}のフィールド検証エラー",required:"${label}を入力してください",enum:"${label}は[${enum}]のいずれかである必要があります",whitespace:"${label}は空白文字にすることはできません",date:{format:"${label}の日付形式は不正です",parse:"${label}は日付に変換できません",invalid:"${label}は不正な日付です"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}は${len}文字である必要があります",min:"${label}は${min}文字以上である必要があります",max:"${label}は${max}文字以下である必要があります",range:"${label}は${min}-${max}文字の範囲である必要があります"},number:{len:"${label}は${len}と等しい必要があります",min:"${label}の最小値は${min}です",max:"${label}の最大値は${max}です",range:"${label}は${min}-${max}の範囲である必要があります"},array:{len:"${label}は${len}である必要があります",min:"${label}の最小は${min}です",max:"${label}の最大は${max}です",range:"${label}の合計は${min}-${max}の範囲である必要があります"},pattern:{mismatch:"${label}はパターン${pattern}と一致しません"}}},Image:{preview:"プレビュー"},QRCode:{expired:"QRコードの有効期限が切れました",refresh:"リフレッシュ",scanned:"スキャン済み"},ColorPicker:{presetEmpty:"空の",transparent:"透明",singleColor:"単色",gradientColor:"グラデーション"}};return qm.default=o,qm}var v2,aae;function m3t(){return aae||(aae=1,v2=g3t()),v2}var v3t=m3t();const b3t=An(v3t);var Zm={},Qm={},iae;function y3t(){if(iae)return Qm;iae=1,Object.defineProperty(Qm,"__esModule",{value:!0}),Qm.default=void 0;var e={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};return Qm.default=e,Qm}var Jm={},ev={},tv={},oae;function S3t(){if(oae)return tv;oae=1;var e=ca().default;Object.defineProperty(tv,"__esModule",{value:!0}),tv.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return tv.default=r,tv}var nv={},sae;function f1e(){if(sae)return nv;sae=1,Object.defineProperty(nv,"__esModule",{value:!0}),nv.default=void 0;const e={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};return nv.default=e,nv}var lae;function p1e(){if(lae)return ev;lae=1;var e=ca().default;Object.defineProperty(ev,"__esModule",{value:!0}),ev.default=void 0;var t=e(S3t()),n=e(f1e());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",ev.default=r,ev}var cae;function x3t(){if(cae)return Jm;cae=1;var e=ca().default;Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.default=void 0;var t=e(p1e());return Jm.default=t.default,Jm}var uae;function w3t(){if(uae)return Zm;uae=1;var e=ca().default;Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.default=void 0;var t=e(y3t()),n=e(x3t()),r=e(p1e()),a=e(f1e());const i="${label}不是一个有效的${type}",o={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return Zm.default=o,Zm}var b2,dae;function C3t(){return dae||(dae=1,b2=w3t()),b2}var E3t=C3t();const _3t=An(E3t);var rv={},av={},fae;function T3t(){if(fae)return av;fae=1,Object.defineProperty(av,"__esModule",{value:!0}),av.default=void 0;var e={items_per_page:"條/頁",jump_to:"跳至",jump_to_confirm:"確定",page:"頁",prev_page:"上一頁",next_page:"下一頁",prev_5:"向前 5 頁",next_5:"向後 5 頁",prev_3:"向前 3 頁",next_3:"向後 3 頁",page_size:"頁碼"};return av.default=e,av}var iv={},ov={},sv={},pae;function k3t(){if(pae)return sv;pae=1;var e=ca().default;Object.defineProperty(sv,"__esModule",{value:!0}),sv.default=void 0;var t=e(D0()),n=j0(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_TW",today:"今天",now:"此刻",backToToday:"返回今天",ok:"確定",timeSelect:"選擇時間",dateSelect:"選擇日期",weekSelect:"選擇周",clear:"清除",week:"週",month:"月",year:"年",previousMonth:"上個月 (翻頁上鍵)",nextMonth:"下個月 (翻頁下鍵)",monthSelect:"選擇月份",yearSelect:"選擇年份",decadeSelect:"選擇年代",yearFormat:"YYYY年",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"上一年 (Control鍵加左方向鍵)",nextYear:"下一年 (Control鍵加右方向鍵)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世紀",nextCentury:"下一世紀",cellDateFormat:"D",monthBeforeYear:!1});return sv.default=r,sv}var lv={},hae;function h1e(){if(hae)return lv;hae=1,Object.defineProperty(lv,"__esModule",{value:!0}),lv.default=void 0;const e={placeholder:"請選擇時間"};return lv.default=e,lv}var gae;function g1e(){if(gae)return ov;gae=1;var e=ca().default;Object.defineProperty(ov,"__esModule",{value:!0}),ov.default=void 0;var t=e(k3t()),n=e(h1e());const r={lang:Object.assign({placeholder:"請選擇日期",yearPlaceholder:"請選擇年份",quarterPlaceholder:"請選擇季度",monthPlaceholder:"請選擇月份",weekPlaceholder:"請選擇周",rangePlaceholder:["開始日期","結束日期"],rangeYearPlaceholder:["開始年份","結束年份"],rangeMonthPlaceholder:["開始月份","結束月份"],rangeQuarterPlaceholder:["開始季度","結束季度"],rangeWeekPlaceholder:["開始周","結束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="確 定",ov.default=r,ov}var mae;function O3t(){if(mae)return iv;mae=1;var e=ca().default;Object.defineProperty(iv,"__esModule",{value:!0}),iv.default=void 0;var t=e(g1e());return iv.default=t.default,iv}var vae;function $3t(){if(vae)return rv;vae=1;var e=ca().default;Object.defineProperty(rv,"__esModule",{value:!0}),rv.default=void 0;var t=e(T3t()),n=e(O3t()),r=e(g1e()),a=e(h1e());const i="${label}不是一個有效的${type}",o={locale:"zh-tw",Pagination:t.default,DatePicker:r.default,TimePicker:a.default,Calendar:n.default,global:{placeholder:"請選擇"},Table:{filterTitle:"篩選器",filterConfirm:"確定",filterReset:"重置",filterEmptyText:"無篩選項",filterCheckAll:"全選",filterSearchPlaceholder:"在篩選項中搜尋",emptyText:"暫無數據",selectAll:"全部選取",selectInvert:"反向選取",selectNone:"清空所有",selectionAll:"全選所有",sortTitle:"排序",expand:"展開行",collapse:"關閉行",triggerDesc:"點擊降序",triggerAsc:"點擊升序",cancelSort:"取消排序"},Modal:{okText:"確定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"結束導覽"},Popconfirm:{okText:"確定",cancelText:"取消"},Transfer:{titles:["",""],searchPlaceholder:"搜尋資料",itemUnit:"項目",itemsUnit:"項目",remove:"删除",selectCurrent:"全選當頁",removeCurrent:"删除當頁",selectAll:"全選所有",removeAll:"删除全部",selectInvert:"反選當頁"},Upload:{uploading:"正在上傳...",removeFile:"刪除檔案",uploadError:"上傳失敗",previewFile:"檔案預覽",downloadFile:"下载文件"},Empty:{description:"無此資料"},Icon:{icon:"圖標"},Text:{edit:"編輯",copy:"複製",copied:"複製成功",expand:"展開",collapse:"收起"},Form:{optional:"(可選)",defaultValidateMessages:{default:"字段驗證錯誤${label}",required:"請輸入${label}",enum:"${label}必須是其中一個[${enum}]",whitespace:"${label}不能為空字符",date:{format:"${label}日期格式無效",parse:"${label}不能轉換為日期",invalid:"${label}是一個無效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}須為${len}個字符",min:"${label}最少${min}個字符",max:"${label}最多${max}個字符",range:"${label}須在${min}-${max}字符之間"},number:{len:"${label}必須等於${len}",min:"${label}最小值為${min}",max:"${label}最大值為${max}",range:"${label}須在${min}-${max}之間"},array:{len:"須為${len}個${label}",min:"最少${min}個${label}",max:"最多${max}個${label}",range:"${label}數量須在${min}-${max}之間"},pattern:{mismatch:"${label}與模式不匹配${pattern}"}}},Image:{preview:"預覽"},QRCode:{expired:"二維碼過期",refresh:"點擊刷新",scanned:"已掃描"},ColorPicker:{presetEmpty:"暫無",transparent:"透明",singleColor:"單色",gradientColor:"漸變色"}};return rv.default=o,rv}var y2,bae;function I3t(){return bae||(bae=1,y2=$3t()),y2}var A3t=I3t();const R3t=An(A3t),M3t=e=>{switch(e){case"zh-CN":return _3t;case"zh-TW":return R3t;case"fr-FR":return d3t;case"ja-JP":return b3t;default:return a3t}},yae="copilot_ui_theme_v1",P3t={colorPrimary:"#d9dada",colorPrimaryHover:"#e4e5e5",colorPrimaryActive:"#c8caca",colorInfo:"#d9dada",colorLink:"#8a8a8a",colorLinkHover:"#9c9c9c",colorLinkActive:"#767676",colorTextLightSolid:"#1f1f1f",borderRadius:6},N3t={colorPrimary:"#8f8f8f",colorInfo:"#8f8f8f",colorLink:"#c5c5c5",colorLinkHover:"#d7d7d7",colorLinkActive:"#a6a6a6",borderRadius:6};function L3t(){const{t:e}=br(),[t,n]=p.useState(()=>localStorage.getItem(yae)||"light"),[r,a]=p.useState(()=>w1e()),[i,o]=p.useState(null),[s,l]=p.useState(null),[c,u]=p.useState(0);if(p.useEffect(()=>{localStorage.setItem(yae,t)},[t]),p.useEffect(()=>{localStorage.setItem(C1e,r),E1e.changeLanguage(r)},[r]),p.useEffect(()=>{let f=!1;const h=Date.now(),g=async()=>{try{const v=await Vi.getInstance().getSetupStatus();if(f)return;l(null),o(v.is_complete)}catch(m){if(f)return;const v=Date.now()-h;if(v>=2e4){const S=Jh(),C=m instanceof Error&&m.message.trim()?m.message:"Unknown error";l(e("app.backendNotReachable",{baseUrl:S,message:C}));return}const y=Math.min(500+Math.floor(v/2),2e3);setTimeout(()=>{f||g()},y)}};return g(),()=>{f=!0}},[c,e]),p.useEffect(()=>{document.body.setAttribute("data-theme",t)},[t]),p.useEffect(()=>{var h;const f=(h=window.__TAURI_INTERNALS__)==null?void 0:h.invoke;typeof f=="function"&&f("set_window_theme",{theme:t}).catch(g=>{console.warn("[App] Failed to sync native window theme:",g)})},[t]),p.useEffect(()=>{i&&HGe()},[i]),i===null)return s?E.jsxs("div",{style:{padding:40,textAlign:"center"},children:[E.jsx("div",{style:{marginBottom:12},children:s}),E.jsx(De,{type:"primary",onClick:()=>{l(null),o(null),u(f=>f+1)},children:e("app.retry")})]}):E.jsx("div",{style:{padding:40,textAlign:"center"},children:e("app.loading")});const d=i?E.jsx(GFt,{themeMode:t,onThemeModeChange:n,locale:r,onLocaleChange:a}):E.jsx(KFt,{});return E.jsx(Ms,{locale:M3t(r),theme:{token:t==="dark"?N3t:P3t,algorithm:t==="dark"?pn.darkAlgorithm:pn.defaultAlgorithm},children:E.jsx(Ns,{children:E.jsx("div",{style:{position:"relative"},children:d})})})}const y4t=Object.freeze(Object.defineProperty({__proto__:null,default:L3t},Symbol.toStringTag,{value:"Module"}));export{f5 as $,lAt as A,De as B,o4t as C,rCt as D,i4t as E,wt as F,db as G,Wxt as H,tn as I,pTt as J,dCt as K,jr as L,qr as M,GH as N,jbe as O,Aw as P,mi as Q,Xp as R,i$t as S,Dn as T,s_t as U,mte as V,gC as W,Twt as X,ey as Y,yIt as Z,W as _,NE as a,fAt as a$,kh as a0,r4t as a1,lT as a2,XOt as a3,qwt as a4,yH as a5,kte as a6,nb as a7,a$t as a8,T0 as a9,_a as aA,bu as aB,DH as aC,USe as aD,Cf as aE,gSe as aF,kn as aG,dl as aH,He as aI,bde as aJ,Qt as aK,wn as aL,Xh as aM,pn as aN,Ot as aO,fr as aP,va as aQ,Y7 as aR,Zl as aS,ia as aT,NAt as aU,h4t as aV,m4t as aW,f4t as aX,Vt as aY,p4t as aZ,vAt as a_,Jwt as aa,_0 as ab,Ht as ac,Jt as ad,Gbe as ae,u5 as af,eh as ag,Yhe as ah,eC as ai,_r as aj,wY as ak,xY as al,h_ as am,Ds as an,Z3t as ao,K3t as ap,Y3t as aq,X3t as ar,J3t as as,Q3t as at,n4t as au,Une as av,WIt as aw,vwe as ax,g4t as ay,gTt as az,Zh as b,LE as b$,dAt as b0,VOt as b1,jkt as b2,BOt as b3,jH as b4,One as b5,mb as b6,Yd as b7,d5 as b8,D5 as b9,od as bA,mC as bB,kLe as bC,CLe as bD,mt as bE,se as bF,Ct as bG,Zr as bH,ne as bI,hE as bJ,Qj as bK,hn as bL,Xt as bM,_n as bN,J as bO,qo as bP,sa as bQ,Qr as bR,Ft as bS,ZPt as bT,i7e as bU,y7e as bV,Bn as bW,rt as bX,K7e as bY,DE as bZ,Hl as b_,R0 as ba,vIt as bb,mIt as bc,Ki as bd,jct as be,j5 as bf,nme as bg,S0 as bh,ime as bi,e4t as bj,Fdt as bk,ZZ as bl,XZ as bm,Ti as bn,Tme as bo,Q5 as bp,__ as bq,Out as br,kut as bs,sh as bt,Tut as bu,_ut as bv,vC as bw,w0 as bx,X5 as by,K5 as bz,oCt as c,nl as c0,Sf as c1,GOt as c2,sSe as c3,rT as c4,sT as c5,h1 as c6,cSe as c7,oSe as c8,COt as c9,_g as cA,vu as cB,Vte as cC,zH as cD,nSe as cE,rj as cF,tf as cG,V as cH,KOt as cI,oT as cJ,t4t as cK,y4t as cL,H5 as ca,qt as cb,Y0e as cc,qOt as cd,jOt as ce,_kt as cf,BH as cg,yOt as ch,YOt as ci,I0 as cj,Eg as ck,d1 as cl,IOt as cm,zAt as cn,$0 as co,p1 as cp,EOt as cq,eSe as cr,Okt as cs,$kt as ct,Fu as cu,Zte as cv,Ikt as cw,FH as cx,kkt as cy,Mkt as cz,iCt as d,aCt as e,pr as f,sCt as g,er as h,Vbe as i,Sa as j,rc as k,et as l,Zo as m,xTt as n,wg as o,vSe as p,a4t as q,b4t as r,vn as s,v4t as t,Ue as u,bs as v,l$t as w,lCt as x,cCt as y,hTt as z};
|