@kabmo-labs/kabmo 0.53.2 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +529 -518
- package/dist/client/static/js/{Body-vaa10tcd.js → Body-x5grdps8.js} +1 -1
- package/dist/client/static/js/{CsvGrid-wabx4e6w.js → CsvGrid-248v9yzf.js} +1 -1
- package/dist/client/static/js/{DocxView-22b3mhh5.js → DocxView-5we92k2h.js} +1 -1
- package/dist/client/static/js/{DrawioView-e02qhkp2.js → DrawioView-c6xmw4qq.js} +1 -1
- package/dist/client/static/js/{HtmlPreview-q7hwcf4s.js → HtmlPreview-r3qxgqg6.js} +1 -1
- package/dist/client/static/js/{ImageView-fxb60ge7.js → ImageView-cr4fea18.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-cey5agsf.js → LayoutWrapper-j12z0djx.js} +2 -2
- package/dist/client/static/js/MergeDiffView-y0we0194.js +1 -0
- package/dist/client/static/js/{Modal-e4yq7p5f.js → Modal-cqceypcn.js} +11 -11
- package/dist/client/static/js/{PdfView-pf3angsq.js → PdfView-xdgn31cm.js} +1 -1
- package/dist/client/static/js/{SessionsView-mcvhpx0b.js → SessionsView-ms6z44e2.js} +1 -1
- package/dist/client/static/js/{SheetView-5ha5vvsr.js → SheetView-peqm9vft.js} +1 -1
- package/dist/client/static/js/{SvgPreview-45wqjw0b.js → SvgPreview-rdf4wbzr.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-gnf6krbs.js → abnfDiagram-O67JEVCF-48z2x5vg.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-00fd0wsg.js → architectureDiagram-NJMV4G6O-n1pr5s6j.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-9c2sm96a.js → blockDiagram-BEXU5L5S-p19shaft.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-pemygn0s.js → c4Diagram-YGBWAQC7-qcd46ts2.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-h7r3sx3s.js → classDiagram-v2-NBCMYWYE-scyhe133.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-krx9crwv.js → cose-bilkent-JH36ORCC-srnnj3f7.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-5rp2btew.js → cynefinDiagram-VND7K2PF-1zfrnyay.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-q57cnz52.js → dagre-6A5THRUB-hepk25pz.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-0bptn06k.js → diagram-22UHCM2B-wy2y0323.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-60snxawz.js → diagram-3UASUU5V-j904f93p.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-bb0kewfp.js → diagram-ATOU4E4O-2mmxccm2.js} +2 -2
- package/dist/client/static/js/{diagram-CDSNMT55-3cdkns0z.js → diagram-CDSNMT55-cfhk73ty.js} +3 -3
- package/dist/client/static/js/{diagram-MLGK6HIB-03mbhzeq.js → diagram-MLGK6HIB-ryf8j6hf.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-bcvzqqf4.js → diagram-MPIPVDR6-8k5e36sd.js} +2 -2
- package/dist/client/static/js/{dockerfile-7kqkk4tz.js → dockerfile-1e7deann.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-sg6kwnbx.js → ebnfDiagram-ZINNZB2B-5kkbbbhv.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-5b8v0sdv.js → elk-276RUBZZ-jqc4mzvc.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-xbs156j5.js → erDiagram-OPXOYQCR-kx15t6f0.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-dpjz82p8.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4p7pfk6c.js → ganttDiagram-FUAMR5RP-3hv8pej4.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-3xqwr9pf.js → gitGraphDiagram-X574FWY7-a4mq8vwz.js} +2 -2
- package/dist/client/static/js/{index-1regq9wd.js → index-01rdknec.js} +1 -1
- package/dist/client/static/js/{index-e2esj214.js → index-0j5ng1qc.js} +1 -1
- package/dist/client/static/js/{index-yf5a6t3p.js → index-0z7kerp1.js} +1 -1
- package/dist/client/static/js/{index-p75b7phb.js → index-1ye834yz.js} +1 -1
- package/dist/client/static/js/{index-1d8ff4t7.js → index-317v49ey.js} +2 -2
- package/dist/client/static/js/{index-x0y2c61e.js → index-3kenmzbe.js} +1 -1
- package/dist/client/static/js/{index-26a4afcr.js → index-40fdtqvw.js} +1 -1
- package/dist/client/static/js/{index-cj8v7b50.js → index-40ydm28n.js} +1 -1
- package/dist/client/static/js/{index-3bmn5cc5.js → index-51wzt3ma.js} +1 -1
- package/dist/client/static/js/{index-trrmbq0h.js → index-8hnem33f.js} +1 -1
- package/dist/client/static/js/{index-pak6t03c.js → index-937bn0d2.js} +1 -1
- package/dist/client/static/js/{index-nnhs52db.js → index-9cr6p86f.js} +1 -1
- package/dist/client/static/js/{index-rtpg4t84.js → index-9gddw5qy.js} +1 -1
- package/dist/client/static/js/{index-ryww3xxj.js → index-bf54x0w8.js} +1 -1
- package/dist/client/static/js/{index-hwq7zgqd.js → index-br27jz2t.js} +1 -1
- package/dist/client/static/js/{index-ayx3q8t9.js → index-demg0p74.js} +1 -1
- package/dist/client/static/js/{index-0btbxkxf.js → index-e2y4hkps.js} +1 -1
- package/dist/client/static/js/{index-vwxt5ss9.js → index-eb43hnd3.js} +1 -1
- package/dist/client/static/js/{index-mtjbp5ga.js → index-exyg9sna.js} +1 -1
- package/dist/client/static/js/{index-xqkcx4az.js → index-fanhvjk8.js} +1 -1
- package/dist/client/static/js/{index-ng3e6k6x.js → index-g3x4w48f.js} +1 -1
- package/dist/client/static/js/{index-c8ta3k4g.js → index-jvn2xfpt.js} +135 -135
- package/dist/client/static/js/{index-5qtnmn76.js → index-k4kwrze2.js} +1 -1
- package/dist/client/static/js/{index-cysdvwqw.js → index-kevqayd9.js} +1 -1
- package/dist/client/static/js/{index-hp3s5r3g.js → index-kvker1ps.js} +1 -1
- package/dist/client/static/js/{index-nmhwjwmt.js → index-kz5d00m5.js} +1 -1
- package/dist/client/static/js/{index-pdkt3r4r.js → index-m85c740p.js} +1 -1
- package/dist/client/static/js/{index-z7gd7nvb.js → index-n3cts2j1.js} +1 -1
- package/dist/client/static/js/{index-jf8zcg99.js → index-n4pm0hrh.js} +4 -4
- package/dist/client/static/js/{index-3amzzsdk.js → index-n5194pe6.js} +11 -11
- package/dist/client/static/js/{index-qj9tcz44.js → index-p8bta9ae.js} +1 -1
- package/dist/client/static/js/{index-45vcpqp9.js → index-pszsxhjr.js} +1 -1
- package/dist/client/static/js/{index-mgs5nscx.js → index-rtfw07hy.js} +1 -1
- package/dist/client/static/js/{index-cy6ceab8.js → index-v90zd3sq.js} +1 -1
- package/dist/client/static/js/{index-zc3snsr9.js → index-vxe4e903.js} +1 -1
- package/dist/client/static/js/{index-gzz6snng.js → index-w4dep7k6.js} +1 -1
- package/dist/client/static/js/{index-j9t5xc3y.js → index-x5c5yxhj.js} +1 -1
- package/dist/client/static/js/{index-jg6ecfc7.js → index-xhcbaaga.js} +2 -2
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-c362sv3t.js → infoDiagram-VRGFBTTK-wtnqb06v.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yc8ts8wj.js → ishikawaDiagram-OU5B5YK6-eta0jnvr.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-178c75fy.js → journeyDiagram-ZHPQQLJL-4e572kkp.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-w6g3n001.js → kanban-definition-PNTS6WVX-yrtnn4zy.js} +1 -1
- package/dist/client/static/js/{mermaid.core-vcdgn378.js → mermaid.core-195b0fb6.js} +3 -3
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-t9e8arca.js → mindmap-definition-NLK3R4M7-pphjnkvt.js} +1 -1
- package/dist/client/static/js/one-dark-pro-asy2qj2p.js +1 -0
- package/dist/client/static/js/one-light-fya1pbbx.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-nehn0x9n.js → pegDiagram-GJSIUBJH-kgffb9p3.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-p1t3ctd4.js → pieDiagram-5QR66LMP-efech3mm.js} +2 -2
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-614rtbfe.js → quadrantDiagram-O4NWA36T-khf9cv3t.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-2vpr6pw8.js → railroadDiagram-XR7U4H2S-ye68kdx2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b91s5q3p.js → requirementDiagram-PLB6GJNP-3s4smnme.js} +1 -1
- package/dist/client/static/js/{rust-jj206pb7.js → rust-tdrnaxp3.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-4101kt9r.js → sankeyDiagram-IPEJSGJF-9pqd25mc.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yq0cxg8c.js → sequenceDiagram-PO4LG4MO-rka8ct43.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-jkvq39vz.js → sizeCapture-INFHLROL-g5wkzry8.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y0h7w5rw.js → stateDiagram-v2-GCMORJYK-gy1zab2j.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-1y073wzx.js → swimlanes-2SLR337P-kr35nmd2.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-8ahz3c68.js → swimlanesDiagram-TC7HE7FX-qnhxxmjr.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-yjb0g0ys.js → timeline-definition-EJHVYXUP-sg151mkc.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-8xjkxrkv.js → usecaseDiagram-POWQR4AR-f91g61p3.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-18wjbwtg.js → vennDiagram-UO4OBE2U-zbhr4eqf.js} +2 -2
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-xqrfsrwp.js → wardleyDiagram-VNRHLVJA-6302414n.js} +2 -2
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-azygghkz.js → xychartDiagram-PMCCYNJV-0a47th65.js} +2 -2
- package/package.json +1 -1
- package/src/client/App.tsx +4 -0
- package/src/client/bootstrap.d.ts +11 -0
- package/src/client/data/settings/omp-schema.json +11 -1
- package/src/client/hooks/shell/last-opened-session.test.ts +166 -0
- package/src/client/hooks/shell/last-opened-session.ts +74 -0
- package/src/client/lib/router/open-session.test.ts +8 -0
- package/src/client/lib/router/open-session.ts +9 -4
- package/src/client/main.tsx +7 -0
- package/src/server/lib/db/schema.ts +10 -0
- package/src/server/lib/sessions/last-opened-client.server.ts +86 -0
- package/src/server/lib/sessions/last-opened-client.test.ts +91 -0
- package/src/server/lib/sessions/last-opened.server.test.ts +127 -0
- package/src/server/lib/sessions/last-opened.server.ts +129 -0
- package/src/server/plugins/ssr.ts +40 -17
- package/src/server/routes/sessions/index.ts +14 -0
- package/src/server/routes/sessions/last-opened.test.ts +139 -0
- package/src/server/routes/sessions/last-opened.ts +66 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +15 -0
- package/dist/client/static/js/MergeDiffView-1z9mwf73.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-sasgvf55.js +0 -1
- package/dist/client/static/js/one-dark-pro-17hh3q12.js +0 -1
- package/dist/client/static/js/one-light-cntgvscy.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{t,l,Yt,Y,C,te,ne,M,O,G,z,j,q,H,_o,nr,sl,Ae,
|
|
1
|
+
import{t,l,Yt,Y,C,te,ne,M,O,G,z,j,q,H,_o,nr,sl,Ae,ce,$g}from"./index-n5194pe6.js";import{Aa}from"./index-kvker1ps.js";function Rt(e,i,s){e=+e,i=+i,s=(a=arguments.length)<2?(i=e,e=0,1):a<3?1:+s;var n=-1,a=Math.max(0,Math.ceil((i-e)/s))|0,h=Array(a);while(++n<a)h[n]=e+n*s;return h}function ct(){var e=nr().unknown(void 0),{domain:i,range:s}=e,n=0,a=1,h,c,x=!1,f=0,R=0,D=0.5;delete e.unknown;function _(){var y=i().length,V=a<n,L=V?a:n,E=V?n:a;if(h=(E-L)/Math.max(1,y-f+R*2),x)h=Math.floor(h);if(L+=(E-L-h*(y-f))*D,c=h*(1-f),x)L=Math.round(L),c=Math.round(c);var F=Rt(y).map(function(Z){return L+h*Z});return s(V?F.reverse():F)}return e.domain=function(y){return arguments.length?(i(y),_()):i()},e.range=function(y){return arguments.length?([n,a]=y,n=+n,a=+a,_()):[n,a]},e.rangeRound=function(y){return[n,a]=y,n=+n,a=+a,x=!0,_()},e.bandwidth=function(){return c},e.step=function(){return h},e.round=function(y){return arguments.length?(x=!!y,_()):x},e.padding=function(y){return arguments.length?(f=Math.min(1,R=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(R=+y,_()):R},e.align=function(y){return arguments.length?(D=Math.max(0,Math.min(1,y)),_()):D},e.copy=function(){return ct(i(),[n,a]).round(x).paddingInner(f).paddingOuter(R).align(D)},_o.apply(_(),arguments)}var _t=function(){var e=t(function(U,r,g,d){for(g=g||{},d=U.length;d--;g[U[d]]=r);return g},"o"),i=[1,10,12,14,16,18,19,21,23],s=[2,6],n=[1,3],a=[1,5],h=[1,6],c=[1,7],x=[1,5,10,12,14,16,18,19,21,23,36,37,38],f=[1,25],R=[1,26],D=[1,28],_=[1,29],y=[1,30],V=[1,31],L=[1,32],E=[1,33],F=[1,34],Z=[1,35],tt=[1,36],w=[1,37],X=[1,43],u=[1,42],W=[1,47],N=[1,50],A=[1,10,12,14,16,18,19,21,23,36,37,38],it=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],I=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],rt=[1,65],v=[26,28],k={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:t(function(r,g,d,p,S,o,st){var m=o.length-1;switch(S){case 5:p.setOrientation(o[m]);break;case 9:p.setDiagramTitle(o[m].text.trim());break;case 12:p.setLineData({text:"",type:"text"},o[m]);break;case 13:p.setLineData(o[m-1],o[m]);break;case 14:p.setBarData({text:"",type:"text"},o[m]);break;case 15:p.setBarData(o[m-1],o[m]);break;case 16:this.$=o[m].trim(),p.setAccTitle(this.$);break;case 17:case 18:this.$=o[m].trim(),p.setAccDescription(this.$);break;case 19:this.$=o[m-1];break;case 20:case 30:this.$=[o[m-2],...o[m]];break;case 21:case 31:this.$=[o[m]];break;case 22:this.$={value:Number(o[m-1]),label:o[m]};break;case 23:this.$={value:Number(o[m]),label:""};break;case 24:p.setXAxisTitle(o[m]);break;case 25:p.setXAxisTitle(o[m-1]);break;case 26:p.setXAxisTitle({type:"text",text:""});break;case 27:p.setXAxisBand(o[m]);break;case 28:p.setXAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 29:this.$=o[m-1];break;case 32:p.setYAxisTitle(o[m]);break;case 33:p.setYAxisTitle(o[m-1]);break;case 34:p.setYAxisTitle({type:"text",text:""});break;case 35:p.setYAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 39:this.$={text:o[m],type:"text"};break;case 40:this.$={text:o[m],type:"text"};break;case 41:this.$={text:o[m],type:"markdown"};break;case 42:this.$=o[m];break;case 43:this.$=o[m-1]+""+o[m];break}},"anonymous"),table:[e(i,s,{3:1,4:2,7:4,5:n,36:a,37:h,38:c}),{1:[3]},e(i,s,{4:2,7:4,3:8,5:n,36:a,37:h,38:c}),e(i,s,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:a,37:h,38:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(x,[2,36]),e(x,[2,37]),e(x,[2,38]),{1:[2,1]},e(i,s,{4:2,7:4,3:21,5:n,36:a,37:h,38:c}),{1:[2,3]},e(x,[2,5]),e(i,[2,7],{4:22,36:a,37:h,38:c}),{11:23,30:f,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},{11:39,13:38,24:X,29:u,30:f,31:40,32:41,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},{11:45,15:44,29:W,30:f,35:46,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},{11:49,17:48,24:N,30:f,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},{11:52,17:51,24:N,30:f,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},{20:[1,53]},{22:[1,54]},e(A,[2,18]),{1:[2,2]},e(A,[2,8]),e(A,[2,9]),e(it,[2,39],{41:55,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w}),e(it,[2,40]),e(it,[2,41]),e(I,[2,42]),e(I,[2,44]),e(I,[2,45]),e(I,[2,46]),e(I,[2,47]),e(I,[2,48]),e(I,[2,49]),e(I,[2,50]),e(I,[2,51]),e(I,[2,52]),e(I,[2,53]),e(A,[2,10]),e(A,[2,24],{32:41,31:56,24:X,29:u}),e(A,[2,26]),e(A,[2,27]),{33:[1,57]},{11:59,30:f,34:58,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},e(A,[2,11]),e(A,[2,32],{35:60,29:W}),e(A,[2,34]),{33:[1,61]},e(A,[2,12]),{17:62,24:N},{25:63,27:64,29:rt},e(A,[2,14]),{17:66,24:N},e(A,[2,16]),e(A,[2,17]),e(I,[2,43]),e(A,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(A,[2,33]),{29:[1,70]},e(A,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(v,[2,23],{30:[1,73]}),e(A,[2,15]),e(A,[2,28]),e(A,[2,29]),{11:59,30:f,34:74,39:24,40:R,41:27,42:D,43:_,44:y,45:V,46:L,47:E,48:F,49:Z,50:tt,51:w},e(A,[2,35]),e(A,[2,19]),{25:75,27:64,29:rt},e(v,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:t(function(r,g){if(g.recoverable)this.trace(r);else{var d=Error(r);throw d.hash=g,d}},"parseError"),parse:t(function(r){var g=this,d=[0],p=[],S=[null],o=[],st=this.table,m="",xt=0,Vt=0,Ft=0,de=2,Wt=1,xe=o.slice.call(arguments,1),P=Object.create(this.lexer),nt={yy:{}};for(var wt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,wt))nt.yy[wt]=this.yy[wt];if(P.setInput(r,nt.yy),nt.yy.lexer=P,nt.yy.parser=this,typeof P.yylloc>"u")P.yylloc={};var kt=P.yylloc;o.push(kt);var fe=P.options&&P.options.ranges;if(typeof nt.yy.parseError==="function")this.parseError=nt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function pe(K){d.length=d.length-2*K,S.length=S.length-K,o.length=o.length-K}t(pe,"popStack");function Xt(){var K=p.pop()||P.lex()||Wt;if(typeof K!=="number"){if(K instanceof Array)p=K,K=p.pop();K=g.symbols_[K]||K}return K}t(Xt,"lex");var B,At,at,Q,Be,Ct,ht={},ft,et,Nt,pt;while(!0){if(at=d[d.length-1],this.defaultActions[at])Q=this.defaultActions[at];else{if(B===null||typeof B>"u")B=Xt();Q=st[at]&&st[at][B]}if(typeof Q>"u"||!Q.length||!Q[0]){var St="";pt=[];for(ft in st[at])if(this.terminals_[ft]&&ft>de)pt.push("'"+this.terminals_[ft]+"'");if(P.showPosition)St="Parse error on line "+(xt+1)+`:
|
|
2
2
|
`+P.showPosition()+`
|
|
3
3
|
Expecting `+pt.join(", ")+", got '"+(this.terminals_[B]||B)+"'";else St="Parse error on line "+(xt+1)+": Unexpected "+(B==Wt?"end of input":"'"+(this.terminals_[B]||B)+"'");this.parseError(St,{text:P.match,token:this.terminals_[B]||B,line:P.yylineno,loc:kt,expected:pt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+at+", token: "+B);switch(Q[0]){case 1:if(d.push(B),S.push(P.yytext),o.push(P.yylloc),d.push(Q[1]),B=null,!At){if(Vt=P.yyleng,m=P.yytext,xt=P.yylineno,kt=P.yylloc,Ft>0)Ft--}else B=At,At=null;break;case 2:if(et=this.productions_[Q[1]][1],ht.$=S[S.length-et],ht._$={first_line:o[o.length-(et||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(et||1)].first_column,last_column:o[o.length-1].last_column},fe)ht._$.range=[o[o.length-(et||1)].range[0],o[o.length-1].range[1]];if(Ct=this.performAction.apply(ht,[m,Vt,xt,nt.yy,Q[1],S,o].concat(xe)),typeof Ct<"u")return Ct;if(et)d=d.slice(0,-1*et*2),S=S.slice(0,-1*et),o=o.slice(0,-1*et);d.push(this.productions_[Q[1]][0]),S.push(ht.$),o.push(ht._$),Nt=st[d[d.length-2]][d[d.length-1]],d.push(Nt);break;case 3:return!0}}return!0},"parse")},J=function(){var U={EOF:1,parseError:t(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw Error(g)},"parseError"),setInput:t(function(r,g){if(this.yy=g||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var g=r.match(/(?:\r\n?|\n).*/g);if(g)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),r},"input"),unput:t(function(r){var g=r.length,d=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var p=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1)this.yylineno-=d.length-1;var S=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===p.length?this.yylloc.first_column:0)+p[p.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges)this.yylloc.range=[S[0],S[0]+this.yyleng-g];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(r){this.unput(this.match.slice(r))},"less"),pastInput:t(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var r=this.match;if(r.length<20)r+=this._input.substr(0,20-r.length);return(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var r=this.pastInput(),g=Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
5
5
|
`+g+"^"},"showPosition"),test_match:t(function(r,g){var d,p,S;if(this.options.backtrack_lexer){if(S={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)S.yylloc.range=this.yylloc.range.slice(0)}if(p=r[0].match(/(?:\r\n?|\n).*/g),p)this.yylineno+=p.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],d=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(d)return d;else if(this._backtrack){for(var o in S)this[o]=S[o];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var r,g,d,p;if(!this._more)this.yytext="",this.match="";var S=this._currentRules();for(var o=0;o<S.length;o++)if(d=this._input.match(this.rules[S[o]]),d&&(!g||d[0].length>g[0].length)){if(g=d,p=o,this.options.backtrack_lexer)if(r=this.test_match(d,S[o]),r!==!1)return r;else if(this._backtrack){g=!1;continue}else return!1;else if(!this.options.flex)break}if(g){if(r=this.test_match(g,S[p]),r!==!1)return r;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,d,p,S){var o=S;switch(p){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return U}();k.lexer=J;function T(){this.yy={}}return t(T,"Parser"),T.prototype=k,k.Parser=T,new T}();_t.parser=_t;var me=_t;function mt(e){return e.type==="bar"}t(mt,"isBarPlot");function bt(e){return e.type==="band"}t(bt,"isBandAxisData");function lt(e){return e.type==="linear"}t(lt,"isLinearAxisData");var Pt=class{constructor(e){this.parentGroup=e}static{t(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,i){if(!this.parentGroup)return{width:e.reduce((a,h)=>Math.max(h.length,a),0)*i,height:i};let s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let a of e){let h=$g(n,1,a),c=h?h.width:a.length*i,x=h?h.height:i;s.width=Math.max(s.width,c),s.height=Math.max(s.height,x)}return n.remove(),s}},Ht=0.7,$t=0.2,Ut=class{constructor(e,i,s,n){this.axisConfig=e,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{t(this,"BaseAxis")}setRange(e){if(this.range=e,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=e[1]-e[0];else this.boundingRect.width=e[1]-e[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((e)=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if(Ht*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor(Ht*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let i=e.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=$t*e.width;this.outerPadding=Math.min(s.width/2,n);let a=s.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height));if(a+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width,this.boundingRect.height=e.height-i}calculateSpaceIfDrawnVertical(e){let i=e.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=$t*e.height;this.outerPadding=Math.min(s.height/2,n);let a=s.width+this.axisConfig.labelPadding*2;if(a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width-i,this.boundingRect.height=e.height}calculateSpace(e){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(e);else this.calculateSpaceIfDrawnHorizontally(e);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let i=this.normalizedLabelRotationInRad;if(i===0)return 0;return Math.sin(i)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},be=class extends Ut{static{t(this,"BandAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.categories=s,this.scale=ct().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=ct().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),l.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},ye=class extends Ut{static{t(this,"LinearAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.domain=s,this.scale=Aa().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=Aa().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function Tt(e,i,s,n){let a=new Pt(n);if(bt(e))return new be(i,s,e.categories,e.title,a);return new ye(i,s,[e.min,e.max],e.title,a)}t(Tt,"getAxis");var we=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{t(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,e.width),n=i.height+2*this.chartConfig.titlePadding;if(i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];if(this.showChartTitle)e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return e}};function qt(e,i,s,n){let a=new Pt(n);return new we(a,e,i,s)}t(qt,"getChartTitleComponent");var ke=0.75,Ce=0.5,Se=0.35;function Dt(e){return{fontSize:e,markerSize:e*ke,markerSpacing:e*Se,itemSpacing:e*Ce}}t(Dt,"getLegendLayout");var Re=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{t(this,"ChartLegend")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter((f)=>f.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:a}=Dt(this.chartConfig.legendFontSize),h=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((f)=>f.title),i),c=this.chartConfig.legendPadding*2+s+n+h.width,x=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;if(c<=e.width&&x<=e.height)this.boundingRect.width=c,this.boundingRect.height=x;else this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:e,markerSize:i,markerSpacing:s,itemSpacing:n}=Dt(this.chartConfig.legendFontSize),a=e+n,h=this.boundingRect.x+this.chartConfig.legendPadding,c=this.boundingRect.y+this.chartConfig.legendPadding,x=[],f=[];for(let[R,D]of this.visiblePlots.entries())if(mt(D))x.push({x:h,y:c+R*a,width:i,height:i,fill:D.fill,strokeFill:D.fill,strokeWidth:0});else{let _=c+R*a+i/2;f.push({path:`M ${h},${_} L ${h+i},${_}`,strokeFill:D.strokeFill,strokeWidth:D.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:x},{groupTexts:["legend","markers"],type:"path",data:f},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((R,D)=>({text:R.title,x:h+i+s,y:c+D*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:e,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function Gt(e,i,s,n){let a=new Pt(n);return new Re(a,e,i,s)}t(Gt,"getChartLegendComponent");var _e=class{constructor(e,i,s,n,a){this.plotData=e,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=a}static{t(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i;if(this.orientation==="horizontal")i=sl().y((n)=>n[0]).x((n)=>n[1])(e);else i=sl().x((n)=>n[0]).y((n)=>n[1])(e);if(!i)return[];let s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let h=[];for(let[c,[x,f]]of e.entries()){let R=this.plotData.pointLabels[c];if(!R)continue;if(this.orientation==="horizontal")h.push({x:f+10,y:x,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else h.push({x,y:f-10,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(h.length>0)s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:h})}return s}},Te=class{constructor(e,i,s,n,a,h){this.barData=e,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=a,this.plotIndex=h}static{t(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map((a)=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=0.05,s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=s/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:this.boundingRect.x,y:a[0]-n,height:s,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:a[0]-n,y:a[1],width:s,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},De=class{constructor(e,i,s){this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}static{t(this,"BasePlot")}setAxes(e,i){this.xAxis=e,this.yAxis=i}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{let n=new _e(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break;case"bar":{let n=new Te(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break}return e}};function jt(e,i,s){return new De(e,i,s)}t(jt,"getPlotComponent");var ve=class{constructor(e,i,s,n){this.chartConfig=e,this.chartData=i,this.componentStore={title:qt(e,i,s,n),plot:jt(e,i,s),legend:Gt(e,i,s,n),xAxis:Tt(i.xAxis,e.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:Tt(i.yAxis,e.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}static{t(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a={width:0,height:0},h=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),x=this.componentStore.plot.calculateSpace({width:h,height:c});if(e-=x.width,i-=x.height,x=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=x.height,i-=x.height,this.componentStore.xAxis.setAxisPosition("bottom"),x=this.componentStore.xAxis.calculateSpace({width:e,height:i}),i-=x.height,this.componentStore.yAxis.setAxisPosition("left"),x=this.componentStore.yAxis.calculateSpace({width:e,height:i}),s=x.width,e-=x.width,a=this.componentStore.legend.calculateSpace({width:e,height:c}),e-=a.width,e>0)h+=e,e=0;if(i>0)c+=i,i=0;if(this.componentStore.plot.calculateSpace({width:h,height:c}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:n+Math.max((c-a.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+h]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((f)=>mt(f)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a=0,h={width:0,height:0},c=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),x=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),f=this.componentStore.plot.calculateSpace({width:c,height:x});if(e-=f.width,i-=f.height,f=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=f.height,i-=f.height,this.componentStore.xAxis.setAxisPosition("left"),f=this.componentStore.xAxis.calculateSpace({width:e,height:i}),e-=f.width,n=f.width,this.componentStore.yAxis.setAxisPosition("top"),f=this.componentStore.yAxis.calculateSpace({width:e,height:i}),i-=f.height,a=s+f.height,h=this.componentStore.legend.calculateSpace({width:e,height:x}),e-=h.width,e>0)c+=e,e=0;if(i>0)x+=i,i=0;if(this.componentStore.plot.calculateSpace({width:c,height:x}),this.componentStore.plot.setBoundingBoxXY({x:n,y:a}),this.componentStore.legend.setBoundingBoxXY({x:n+c,y:a+Math.max((x-h.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([a,a+x]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some((R)=>mt(R)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))e.push(...i.getDrawableElements());return e}},Pe=class{static{t(this,"XYChartBuilder")}static build(e,i,s,n){return new ve(e,i,s,n).getDrawableElement()}},gt=0,Qt,ut=It(),dt=Et(),b=Mt(),vt=dt.plotColorPalette.split(",").map((e)=>e.trim()),yt=!1,Lt=!1;function Et(){let e=Yt(),i=C();return le(e.xyChart,i.themeVariables.xyChart)}t(Et,"getChartDefaultThemeConfig");function It(){let e=C();return le(Y.xyChart,e.xyChart)}t(It,"getChartDefaultConfig");function Mt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}t(Mt,"getChartDefaultData");function ot(e){let i=C();return te(e.trim(),i)}t(ot,"textSanitizer");function Kt(e){Qt=e}t(Kt,"setTmpSVGG");function Zt(e){if(e==="horizontal")ut.chartOrientation="horizontal";else ut.chartOrientation="vertical"}t(Zt,"setOrientation");function Jt(e){b.xAxis.title=ot(e.text)}t(Jt,"setXAxisTitle");function Bt(e,i){b.xAxis={type:"linear",title:b.xAxis.title,min:e,max:i},yt=!0}t(Bt,"setXAxisRangeData");function ee(e){b.xAxis={type:"band",title:b.xAxis.title,categories:e.map((i)=>ot(i.text))},yt=!0}t(ee,"setXAxisBand");function ie(e){b.yAxis.title=ot(e.text)}t(ie,"setYAxisTitle");function se(e,i){b.yAxis={type:"linear",title:b.yAxis.title,min:e,max:i},Lt=!0}t(se,"setYAxisRangeData");function ae(e){let i=Math.min(...e),s=Math.max(...e),n=lt(b.yAxis)?b.yAxis.min:1/0,a=lt(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(n,i),max:Math.max(a,s)}}t(ae,"setYAxisRangeFromPlotData");function zt(e){let i=[];if(e.length===0)return i;if(!yt){let s=lt(b.xAxis)?b.xAxis.min:1/0,n=lt(b.xAxis)?b.xAxis.max:-1/0;Bt(Math.min(s,1),Math.max(n,e.length))}if(bt(b.xAxis)&&e.length>b.xAxis.categories.length)e=e.slice(0,b.xAxis.categories.length);if(!Lt)ae(e);if(bt(b.xAxis))i=b.xAxis.categories.map((s,n)=>[s,e[n]]);if(lt(b.xAxis)){let s=b.xAxis.min,n=b.xAxis.max;if(e.length===1)i=[[`${s}`,e[0]]];else{let a=(n-s)/(e.length-1);i=e.map((h,c)=>[`${s+c*a}`,h])}}return i}t(zt,"transformDataWithoutCategory");function Ot(e){return vt[e===0?0:e%vt.length]}t(Ot,"getPlotColorFromPalette");function oe(e,i){let s=i.map((c)=>c.value),n=i.map((c)=>c.label?ot(c.label):""),a=zt(s),h=n.some((c)=>c!=="");b.plots.push({type:"line",title:ot(e.text),strokeFill:Ot(gt),strokeWidth:2,data:a,...h?{pointLabels:n}:{}}),gt++}t(oe,"setLineData");function re(e,i){let s=i.map((a)=>a.value),n=zt(s);b.plots.push({type:"bar",title:ot(e.text),fill:Ot(gt),data:n}),gt++}t(re,"setBarData");function he(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=H(),Pe.build(ut,b,dt,Qt)}t(he,"getDrawableElem");function ce(){return dt}t(ce,"getChartThemeConfig");function ge(){return ut}t(ge,"getChartConfig");function ue(){return b}t(ue,"getXYChartData");var Le=t(function(){M(),gt=0,ut=It(),b=Mt(),dt=Et(),vt=dt.plotColorPalette.split(",").map((e)=>e.trim()),yt=!1,Lt=!1},"clear"),Ee={getDrawableElem:he,clear:Le,setAccTitle:O,getAccTitle:G,setDiagramTitle:q,getDiagramTitle:H,getAccDescription:j,setAccDescription:z,setOrientation:Zt,setXAxisTitle:Jt,setXAxisRangeData:Bt,setXAxisBand:ee,setYAxisTitle:ie,setYAxisRangeData:se,setLineData:oe,setBarData:re,setTmpSVGG:Kt,getChartThemeConfig:ce,getChartConfig:ge,getXYChartData:ue},Ie=t((e,i,s,n)=>{let a=n.db,h=a.getChartThemeConfig(),c=a.getChartConfig(),x=a.getXYChartData().plots[0].data.map((w)=>w[1]);function f(w){return w==="top"?"text-before-edge":"middle"}t(f,"getDominantBaseLine");function R(w){return w==="left"?"start":w==="right"?"end":"middle"}t(R,"getTextAnchor");function D(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}t(D,"getTextTransformation"),l.debug(`Rendering xychart chart
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,d,p,S){var o=S;switch(p){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return U}();k.lexer=J;function T(){this.yy={}}return t(T,"Parser"),T.prototype=k,k.Parser=T,new T}();_t.parser=_t;var me=_t;function mt(e){return e.type==="bar"}t(mt,"isBarPlot");function bt(e){return e.type==="band"}t(bt,"isBandAxisData");function lt(e){return e.type==="linear"}t(lt,"isLinearAxisData");var Pt=class{constructor(e){this.parentGroup=e}static{t(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,i){if(!this.parentGroup)return{width:e.reduce((a,h)=>Math.max(h.length,a),0)*i,height:i};let s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let a of e){let h=$g(n,1,a),c=h?h.width:a.length*i,x=h?h.height:i;s.width=Math.max(s.width,c),s.height=Math.max(s.height,x)}return n.remove(),s}},Ht=0.7,$t=0.2,Ut=class{constructor(e,i,s,n){this.axisConfig=e,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{t(this,"BaseAxis")}setRange(e){if(this.range=e,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=e[1]-e[0];else this.boundingRect.width=e[1]-e[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((e)=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if(Ht*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor(Ht*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let i=e.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=$t*e.width;this.outerPadding=Math.min(s.width/2,n);let a=s.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height));if(a+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width,this.boundingRect.height=e.height-i}calculateSpaceIfDrawnVertical(e){let i=e.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=$t*e.height;this.outerPadding=Math.min(s.height/2,n);let a=s.width+this.axisConfig.labelPadding*2;if(a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width-i,this.boundingRect.height=e.height}calculateSpace(e){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(e);else this.calculateSpaceIfDrawnHorizontally(e);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let i=this.normalizedLabelRotationInRad;if(i===0)return 0;return Math.sin(i)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},be=class extends Ut{static{t(this,"BandAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.categories=s,this.scale=ct().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=ct().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),l.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},ye=class extends Ut{static{t(this,"LinearAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.domain=s,this.scale=Aa().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=Aa().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function Tt(e,i,s,n){let a=new Pt(n);if(bt(e))return new be(i,s,e.categories,e.title,a);return new ye(i,s,[e.min,e.max],e.title,a)}t(Tt,"getAxis");var we=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{t(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,e.width),n=i.height+2*this.chartConfig.titlePadding;if(i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];if(this.showChartTitle)e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return e}};function qt(e,i,s,n){let a=new Pt(n);return new we(a,e,i,s)}t(qt,"getChartTitleComponent");var ke=0.75,Ce=0.5,Se=0.35;function Dt(e){return{fontSize:e,markerSize:e*ke,markerSpacing:e*Se,itemSpacing:e*Ce}}t(Dt,"getLegendLayout");var Re=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{t(this,"ChartLegend")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter((f)=>f.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:a}=Dt(this.chartConfig.legendFontSize),h=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((f)=>f.title),i),c=this.chartConfig.legendPadding*2+s+n+h.width,x=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;if(c<=e.width&&x<=e.height)this.boundingRect.width=c,this.boundingRect.height=x;else this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:e,markerSize:i,markerSpacing:s,itemSpacing:n}=Dt(this.chartConfig.legendFontSize),a=e+n,h=this.boundingRect.x+this.chartConfig.legendPadding,c=this.boundingRect.y+this.chartConfig.legendPadding,x=[],f=[];for(let[R,D]of this.visiblePlots.entries())if(mt(D))x.push({x:h,y:c+R*a,width:i,height:i,fill:D.fill,strokeFill:D.fill,strokeWidth:0});else{let _=c+R*a+i/2;f.push({path:`M ${h},${_} L ${h+i},${_}`,strokeFill:D.strokeFill,strokeWidth:D.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:x},{groupTexts:["legend","markers"],type:"path",data:f},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((R,D)=>({text:R.title,x:h+i+s,y:c+D*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:e,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function Gt(e,i,s,n){let a=new Pt(n);return new Re(a,e,i,s)}t(Gt,"getChartLegendComponent");var _e=class{constructor(e,i,s,n,a){this.plotData=e,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=a}static{t(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i;if(this.orientation==="horizontal")i=sl().y((n)=>n[0]).x((n)=>n[1])(e);else i=sl().x((n)=>n[0]).y((n)=>n[1])(e);if(!i)return[];let s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let h=[];for(let[c,[x,f]]of e.entries()){let R=this.plotData.pointLabels[c];if(!R)continue;if(this.orientation==="horizontal")h.push({x:f+10,y:x,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else h.push({x,y:f-10,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(h.length>0)s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:h})}return s}},Te=class{constructor(e,i,s,n,a,h){this.barData=e,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=a,this.plotIndex=h}static{t(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map((a)=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=0.05,s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=s/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:this.boundingRect.x,y:a[0]-n,height:s,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:a[0]-n,y:a[1],width:s,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},De=class{constructor(e,i,s){this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}static{t(this,"BasePlot")}setAxes(e,i){this.xAxis=e,this.yAxis=i}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{let n=new _e(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break;case"bar":{let n=new Te(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break}return e}};function jt(e,i,s){return new De(e,i,s)}t(jt,"getPlotComponent");var ve=class{constructor(e,i,s,n){this.chartConfig=e,this.chartData=i,this.componentStore={title:qt(e,i,s,n),plot:jt(e,i,s),legend:Gt(e,i,s,n),xAxis:Tt(i.xAxis,e.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:Tt(i.yAxis,e.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}static{t(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a={width:0,height:0},h=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),x=this.componentStore.plot.calculateSpace({width:h,height:c});if(e-=x.width,i-=x.height,x=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=x.height,i-=x.height,this.componentStore.xAxis.setAxisPosition("bottom"),x=this.componentStore.xAxis.calculateSpace({width:e,height:i}),i-=x.height,this.componentStore.yAxis.setAxisPosition("left"),x=this.componentStore.yAxis.calculateSpace({width:e,height:i}),s=x.width,e-=x.width,a=this.componentStore.legend.calculateSpace({width:e,height:c}),e-=a.width,e>0)h+=e,e=0;if(i>0)c+=i,i=0;if(this.componentStore.plot.calculateSpace({width:h,height:c}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:n+Math.max((c-a.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+h]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((f)=>mt(f)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a=0,h={width:0,height:0},c=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),x=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),f=this.componentStore.plot.calculateSpace({width:c,height:x});if(e-=f.width,i-=f.height,f=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=f.height,i-=f.height,this.componentStore.xAxis.setAxisPosition("left"),f=this.componentStore.xAxis.calculateSpace({width:e,height:i}),e-=f.width,n=f.width,this.componentStore.yAxis.setAxisPosition("top"),f=this.componentStore.yAxis.calculateSpace({width:e,height:i}),i-=f.height,a=s+f.height,h=this.componentStore.legend.calculateSpace({width:e,height:x}),e-=h.width,e>0)c+=e,e=0;if(i>0)x+=i,i=0;if(this.componentStore.plot.calculateSpace({width:c,height:x}),this.componentStore.plot.setBoundingBoxXY({x:n,y:a}),this.componentStore.legend.setBoundingBoxXY({x:n+c,y:a+Math.max((x-h.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([a,a+x]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some((R)=>mt(R)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))e.push(...i.getDrawableElements());return e}},Pe=class{static{t(this,"XYChartBuilder")}static build(e,i,s,n){return new ve(e,i,s,n).getDrawableElement()}},gt=0,Qt,ut=It(),dt=Et(),b=Mt(),vt=dt.plotColorPalette.split(",").map((e)=>e.trim()),yt=!1,Lt=!1;function Et(){let e=Yt(),i=C();return ce(e.xyChart,i.themeVariables.xyChart)}t(Et,"getChartDefaultThemeConfig");function It(){let e=C();return ce(Y.xyChart,e.xyChart)}t(It,"getChartDefaultConfig");function Mt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}t(Mt,"getChartDefaultData");function ot(e){let i=C();return te(e.trim(),i)}t(ot,"textSanitizer");function Kt(e){Qt=e}t(Kt,"setTmpSVGG");function Zt(e){if(e==="horizontal")ut.chartOrientation="horizontal";else ut.chartOrientation="vertical"}t(Zt,"setOrientation");function Jt(e){b.xAxis.title=ot(e.text)}t(Jt,"setXAxisTitle");function Bt(e,i){b.xAxis={type:"linear",title:b.xAxis.title,min:e,max:i},yt=!0}t(Bt,"setXAxisRangeData");function ee(e){b.xAxis={type:"band",title:b.xAxis.title,categories:e.map((i)=>ot(i.text))},yt=!0}t(ee,"setXAxisBand");function ie(e){b.yAxis.title=ot(e.text)}t(ie,"setYAxisTitle");function se(e,i){b.yAxis={type:"linear",title:b.yAxis.title,min:e,max:i},Lt=!0}t(se,"setYAxisRangeData");function ae(e){let i=Math.min(...e),s=Math.max(...e),n=lt(b.yAxis)?b.yAxis.min:1/0,a=lt(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(n,i),max:Math.max(a,s)}}t(ae,"setYAxisRangeFromPlotData");function zt(e){let i=[];if(e.length===0)return i;if(!yt){let s=lt(b.xAxis)?b.xAxis.min:1/0,n=lt(b.xAxis)?b.xAxis.max:-1/0;Bt(Math.min(s,1),Math.max(n,e.length))}if(bt(b.xAxis)&&e.length>b.xAxis.categories.length)e=e.slice(0,b.xAxis.categories.length);if(!Lt)ae(e);if(bt(b.xAxis))i=b.xAxis.categories.map((s,n)=>[s,e[n]]);if(lt(b.xAxis)){let s=b.xAxis.min,n=b.xAxis.max;if(e.length===1)i=[[`${s}`,e[0]]];else{let a=(n-s)/(e.length-1);i=e.map((h,c)=>[`${s+c*a}`,h])}}return i}t(zt,"transformDataWithoutCategory");function Ot(e){return vt[e===0?0:e%vt.length]}t(Ot,"getPlotColorFromPalette");function oe(e,i){let s=i.map((c)=>c.value),n=i.map((c)=>c.label?ot(c.label):""),a=zt(s),h=n.some((c)=>c!=="");b.plots.push({type:"line",title:ot(e.text),strokeFill:Ot(gt),strokeWidth:2,data:a,...h?{pointLabels:n}:{}}),gt++}t(oe,"setLineData");function re(e,i){let s=i.map((a)=>a.value),n=zt(s);b.plots.push({type:"bar",title:ot(e.text),fill:Ot(gt),data:n}),gt++}t(re,"setBarData");function he(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=H(),Pe.build(ut,b,dt,Qt)}t(he,"getDrawableElem");function le(){return dt}t(le,"getChartThemeConfig");function ge(){return ut}t(ge,"getChartConfig");function ue(){return b}t(ue,"getXYChartData");var Le=t(function(){M(),gt=0,ut=It(),b=Mt(),dt=Et(),vt=dt.plotColorPalette.split(",").map((e)=>e.trim()),yt=!1,Lt=!1},"clear"),Ee={getDrawableElem:he,clear:Le,setAccTitle:O,getAccTitle:G,setDiagramTitle:q,getDiagramTitle:H,getAccDescription:j,setAccDescription:z,setOrientation:Zt,setXAxisTitle:Jt,setXAxisRangeData:Bt,setXAxisBand:ee,setYAxisTitle:ie,setYAxisRangeData:se,setLineData:oe,setBarData:re,setTmpSVGG:Kt,getChartThemeConfig:le,getChartConfig:ge,getXYChartData:ue},Ie=t((e,i,s,n)=>{let a=n.db,h=a.getChartThemeConfig(),c=a.getChartConfig(),x=a.getXYChartData().plots[0].data.map((w)=>w[1]);function f(w){return w==="top"?"text-before-edge":"middle"}t(f,"getDominantBaseLine");function R(w){return w==="left"?"start":w==="right"?"end":"middle"}t(R,"getTextAnchor");function D(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}t(D,"getTextTransformation"),l.debug(`Rendering xychart chart
|
|
7
7
|
`+e);let _=Ae(i),y=_.append("g").attr("class","main"),V=y.append("rect").attr("width",c.width).attr("height",c.height).attr("class","background");ne(_,c.height,c.width,!0),_.attr("viewBox",`0 0 ${c.width} ${c.height}`),V.attr("fill",h.backgroundColor),a.setTmpSVGG(_.append("g").attr("class","mermaid-tmp-group"));let L=a.getDrawableElem(),E={};function F(w){let X=y,u="";for(let[W]of w.entries()){let N=y;if(W>0&&E[u])N=E[u];if(u+=w[W],X=E[u],!X)X=E[u]=N.append("g").attr("class",w[W])}return X}t(F,"getGroup");for(let w of L){if(w.data.length===0)continue;let X=F(w.groupTexts);switch(w.type){case"rect":if(X.selectAll("rect").data(w.data).enter().append("rect").attr("x",(u)=>u.x).attr("y",(u)=>u.y).attr("width",(u)=>u.width).attr("height",(u)=>u.height).attr("fill",(u)=>u.fill).attr("stroke",(u)=>u.strokeFill).attr("stroke-width",(u)=>u.strokeWidth),c.showDataLabel){let u=c.showDataLabelOutsideBar;if(c.chartOrientation==="horizontal"){let W=function(k,J){let{data:T,label:U}=k;return J*U.length*N<=T.width-A};var Z=W;t(W,"fitsHorizontally");let N=0.7,A=10,it=w.data.map((k,J)=>({data:k,label:x[J].toString()})).filter((k)=>k.data.width>0&&k.data.height>0),I=it.map((k)=>{let{data:J}=k,T=J.height*0.7;while(!W(k,T)&&T>0)T-=1;return T}),rt=Math.floor(Math.min(...I)),v=t((k)=>{if(u)return k.data.x+k.data.width+A;else return k.data.x+k.data.width-A},"determineLabelXPosition");X.selectAll("text").data(it).enter().append("text").attr("x",v).attr("y",(k)=>k.data.y+k.data.height/2).attr("text-anchor",u?"start":"end").attr("dominant-baseline","middle").attr("fill",h.dataLabelColor).attr("font-size",`${rt}px`).text((k)=>k.label)}else{let W=function(v,k,J){let{data:T,label:U}=v,r=0.7,g=k*U.length*0.7,d=T.x+T.width/2,p=d-g/2,S=d+g/2,o=p>=T.x&&S<=T.x+T.width,st=T.y+J+k<=T.y+T.height;return o&&st};var tt=W;t(W,"fitsInBar");let N=10,A=w.data.map((v,k)=>({data:v,label:x[k].toString()})).filter((v)=>v.data.width>0&&v.data.height>0),it=A.map((v)=>{let{data:k,label:J}=v,T=k.width/(J.length*0.7);while(!W(v,T,N)&&T>0)T-=1;return T}),I=Math.floor(Math.min(...it)),rt=t((v)=>{if(u)return v.data.y-N;else return v.data.y+N},"determineLabelYPosition");X.selectAll("text").data(A).enter().append("text").attr("x",(v)=>v.data.x+v.data.width/2).attr("y",rt).attr("text-anchor","middle").attr("dominant-baseline",u?"auto":"hanging").attr("fill",h.dataLabelColor).attr("font-size",`${I}px`).text((v)=>v.label)}}break;case"text":X.selectAll("text").data(w.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(u)=>u.fill).attr("font-size",(u)=>u.fontSize).attr("dominant-baseline",(u)=>f(u.verticalPos)).attr("text-anchor",(u)=>R(u.horizontalPos)).attr("transform",(u)=>D(u)).text((u)=>u.text);break;case"path":X.selectAll("path").data(w.data).enter().append("path").attr("d",(u)=>u.path).attr("fill",(u)=>u.fill?u.fill:"none").attr("stroke",(u)=>u.strokeFill).attr("stroke-width",(u)=>u.strokeWidth);break}}},"draw"),Me={draw:Ie},Ke={parser:me,db:Ee,renderer:Me};export{Ke as diagram};
|
package/package.json
CHANGED
package/src/client/App.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import { CommandPalette } from '@/client/components/common/command-palette';
|
|
|
21
21
|
import { ChordHint } from '@/client/components/common/command-palette/ChordHint';
|
|
22
22
|
import { KeyBindingCheatsheet } from '@/client/components/common/key-binding-cheatsheet';
|
|
23
23
|
import { closeKeyBindingHelp } from '@/client/lib/commands/overlays';
|
|
24
|
+
import { useSessionOpenRecorder } from '@/client/hooks/shell/last-opened-session';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* The mobile and desktop layouts are mutually exclusive screen trees — exactly
|
|
@@ -60,6 +61,9 @@ export function App({ initialIsMobile = false, production = false, appSettings =
|
|
|
60
61
|
useCommandRuntime();
|
|
61
62
|
usePluginCommands();
|
|
62
63
|
const overlays = useOverlays();
|
|
64
|
+
// What a native shell restores on its next launch. One call per page: an
|
|
65
|
+
// unauthenticated screen has no session to record.
|
|
66
|
+
useSessionOpenRecorder(authState !== 'required');
|
|
63
67
|
|
|
64
68
|
// Initialize with server-detected User-Agent to eliminate SSR flash. The
|
|
65
69
|
// device decides the layout on every load — the manual switch below is
|
|
@@ -50,6 +50,17 @@ export interface KabmoBootstrap {
|
|
|
50
50
|
* tell them from a desktop where an APK is useless.
|
|
51
51
|
*/
|
|
52
52
|
isAndroid?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The session this install opened last, when it still exists.
|
|
55
|
+
*
|
|
56
|
+
* Keyed by the request's `kabmo_client` cookie, so a phone and a desktop
|
|
57
|
+
* pointed at one console keep separate pointers. The native shells load the
|
|
58
|
+
* console with no query, so this is what lets a cold start select the previous
|
|
59
|
+
* chat in its FIRST render instead of painting the empty workspace and
|
|
60
|
+
* navigating afterwards. A browser ignores it (its landing stays), and an
|
|
61
|
+
* unauthenticated request carries `null`.
|
|
62
|
+
*/
|
|
63
|
+
lastOpenedSessionId?: string | null;
|
|
53
64
|
}
|
|
54
65
|
|
|
55
66
|
declare global {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "@oh-my-pi/pi-coding-agent 10 tabs /
|
|
2
|
+
"source": "@oh-my-pi/pi-coding-agent 10 tabs / 648 settings",
|
|
3
3
|
"tabs": [
|
|
4
4
|
{
|
|
5
5
|
"id": "appearance",
|
|
@@ -7489,6 +7489,16 @@
|
|
|
7489
7489
|
"description": "Automatically background long-running bash commands and deliver the result later"
|
|
7490
7490
|
}
|
|
7491
7491
|
},
|
|
7492
|
+
"bash.reapBackground": {
|
|
7493
|
+
"type": "boolean",
|
|
7494
|
+
"default": true,
|
|
7495
|
+
"ui": {
|
|
7496
|
+
"tab": "shell",
|
|
7497
|
+
"group": "Bash",
|
|
7498
|
+
"label": "Reap Background Processes",
|
|
7499
|
+
"description": "Remind the agent about processes its bash calls left running (`cmd &`, `nohup`) when it stops, and kill the `&` ones at session end unless registered as services; off in RPC mode"
|
|
7500
|
+
}
|
|
7501
|
+
},
|
|
7492
7502
|
"bash.gitGuard": {
|
|
7493
7503
|
"type": "boolean",
|
|
7494
7504
|
"default": false,
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Cold-start session continuity, from the page's side.
|
|
8
|
+
*
|
|
9
|
+
* The two halves are invisible when wrong: a restore that ignores the shell
|
|
10
|
+
* leaves every relaunch on the empty workspace, and a restore that overrides an
|
|
11
|
+
* explicit deep link opens the wrong chat. The recorder's failure mode is the
|
|
12
|
+
* same shape one launch later — the app remembers a session the user never
|
|
13
|
+
* opened, or loses the one they did.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { Window } from 'happy-dom';
|
|
18
|
+
import { h, render } from 'preact';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
|
|
21
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
22
|
+
import {
|
|
23
|
+
restoreLastOpenedSession,
|
|
24
|
+
useSessionOpenRecorder,
|
|
25
|
+
} from '@/client/hooks/shell/last-opened-session';
|
|
26
|
+
|
|
27
|
+
const nativeFetch = globalThis.fetch;
|
|
28
|
+
let container: HTMLElement | undefined;
|
|
29
|
+
let requests: string[];
|
|
30
|
+
|
|
31
|
+
function pointAt(search: string): void {
|
|
32
|
+
window.history.replaceState(null, '', `/${search}`);
|
|
33
|
+
window.dispatchEvent(new Event('popstate'));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function asDesktopShell(): void {
|
|
37
|
+
(window as unknown as Record<string, unknown>).__kabmoDesktop = {
|
|
38
|
+
platform: 'macos',
|
|
39
|
+
shellVersion: '0.0.0',
|
|
40
|
+
overlayTitlebar: true,
|
|
41
|
+
};
|
|
42
|
+
// The desktop trio installs BOTH, and `hasShellBridge` asks the transport —
|
|
43
|
+
// the identity alone is what draws the titlebar, not what answers commands.
|
|
44
|
+
(window as unknown as Record<string, unknown>).__kabmoCall = async () => null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function asBrowser(): void {
|
|
48
|
+
const win = window as unknown as Record<string, unknown>;
|
|
49
|
+
delete win.__kabmoDesktop;
|
|
50
|
+
delete win.kabmoHost;
|
|
51
|
+
delete win.webkit;
|
|
52
|
+
delete win.__kabmoCall;
|
|
53
|
+
delete win.__kabmoShellHost;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Probe({ enabled }: { enabled: boolean }) {
|
|
57
|
+
useSessionOpenRecorder(enabled);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
beforeAll(() => {
|
|
62
|
+
installDomGlobals(new Window({ url: 'http://localhost/' }));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
pointAt('');
|
|
67
|
+
asBrowser();
|
|
68
|
+
requests = [];
|
|
69
|
+
globalThis.fetch = (async (input: RequestInfo | URL) => {
|
|
70
|
+
requests.push(String(input));
|
|
71
|
+
return new Response(null, { status: 200 });
|
|
72
|
+
}) as unknown as typeof fetch;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
afterEach(() => {
|
|
76
|
+
if (container) {
|
|
77
|
+
render(null, container);
|
|
78
|
+
container.remove();
|
|
79
|
+
container = undefined;
|
|
80
|
+
}
|
|
81
|
+
asBrowser();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
afterAll(() => {
|
|
85
|
+
pointAt('');
|
|
86
|
+
globalThis.fetch = nativeFetch;
|
|
87
|
+
restoreDomGlobals();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('restoreLastOpenedSession', () => {
|
|
91
|
+
test('a browser keeps its landing', () => {
|
|
92
|
+
expect(restoreLastOpenedSession('session-a')).toBe(false);
|
|
93
|
+
expect(window.location.search).toBe('');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('a desktop shell selects the remembered session without adding history', () => {
|
|
97
|
+
asDesktopShell();
|
|
98
|
+
const before = window.history.length;
|
|
99
|
+
expect(restoreLastOpenedSession('session-a')).toBe(true);
|
|
100
|
+
expect(new URL(window.location.href).searchParams.get('sessionId')).toBe('session-a');
|
|
101
|
+
expect(window.history.length).toBe(before);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('a phone shell selects it too', () => {
|
|
105
|
+
(window as unknown as Record<string, unknown>).kabmoHost = { post: () => {} };
|
|
106
|
+
expect(restoreLastOpenedSession('session-b')).toBe(true);
|
|
107
|
+
expect(new URL(window.location.href).searchParams.get('sessionId')).toBe('session-b');
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('an explicit deep link wins over the remembered session', () => {
|
|
111
|
+
asDesktopShell();
|
|
112
|
+
pointAt('?sessionId=mine');
|
|
113
|
+
expect(restoreLastOpenedSession('remembered')).toBe(false);
|
|
114
|
+
expect(new URL(window.location.href).searchParams.get('sessionId')).toBe('mine');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('nothing remembered and nothing valid change nothing', () => {
|
|
118
|
+
asDesktopShell();
|
|
119
|
+
expect(restoreLastOpenedSession(null)).toBe(false);
|
|
120
|
+
expect(restoreLastOpenedSession(' ')).toBe(false);
|
|
121
|
+
expect(window.location.search).toBe('');
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('useSessionOpenRecorder', () => {
|
|
126
|
+
function mount(enabled: boolean): void {
|
|
127
|
+
container = document.createElement('div');
|
|
128
|
+
document.body.append(container);
|
|
129
|
+
act(() => render(h(Probe, { enabled }), container!));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
test('records the selected session once', async () => {
|
|
133
|
+
pointAt('?sessionId=session-a');
|
|
134
|
+
await act(async () => mount(true));
|
|
135
|
+
expect(requests).toEqual(['/api/sessions/session-a/opened']);
|
|
136
|
+
|
|
137
|
+
// A re-render for the same selection must not repeat the write.
|
|
138
|
+
await act(async () => render(h(Probe, { enabled: true }), container!));
|
|
139
|
+
expect(requests).toHaveLength(1);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('skips a pending chat and records the adopted id', async () => {
|
|
143
|
+
pointAt('?sessionId=new-1761000000000');
|
|
144
|
+
await act(async () => mount(true));
|
|
145
|
+
expect(requests).toEqual([]);
|
|
146
|
+
|
|
147
|
+
await act(async () => pointAt('?sessionId=adopted'));
|
|
148
|
+
expect(requests).toEqual(['/api/sessions/adopted/opened']);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test('a different session is recorded', async () => {
|
|
152
|
+
pointAt('?sessionId=session-a');
|
|
153
|
+
await act(async () => mount(true));
|
|
154
|
+
await act(async () => pointAt('?sessionId=session-b'));
|
|
155
|
+
expect(requests).toEqual([
|
|
156
|
+
'/api/sessions/session-a/opened',
|
|
157
|
+
'/api/sessions/session-b/opened',
|
|
158
|
+
]);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('an unauthenticated screen records nothing', async () => {
|
|
162
|
+
pointAt('?sessionId=session-a');
|
|
163
|
+
await act(async () => mount(false));
|
|
164
|
+
expect(requests).toEqual([]);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Cold-start session continuity for the native shells.
|
|
8
|
+
*
|
|
9
|
+
* A shell opens the console's origin with no query, so the page used to answer
|
|
10
|
+
* with its empty workspace — even though the user had a chat open when they
|
|
11
|
+
* closed the app. Two halves fix that, and they live together because they are
|
|
12
|
+
* one rule seen from each side of the launch:
|
|
13
|
+
*
|
|
14
|
+
* - **Restore** runs BEFORE hydration (`main.tsx`), from the id the server read
|
|
15
|
+
* for this install's `kabmo_client` cookie on the very request that served
|
|
16
|
+
* this document. A `replaceState` there means the first render already names
|
|
17
|
+
* the session: no landing flash, and no history entry for a place the user
|
|
18
|
+
* never chose.
|
|
19
|
+
* - **Record** runs on every URL selection (`App`), so the next launch restores
|
|
20
|
+
* whatever this one left on screen. The write is keyed by the same cookie, so
|
|
21
|
+
* a phone, a desktop shell and a browser each keep their own pointer even
|
|
22
|
+
* when they share one console.
|
|
23
|
+
*
|
|
24
|
+
* Restore is inert outside a shell — `hasShellBridge()` is false in every
|
|
25
|
+
* browser — which is what keeps the browser's landing exactly where it was.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { useEffect, useRef } from 'preact/hooks';
|
|
29
|
+
import { hasShellBridge } from '@/client/lib/shell/transport';
|
|
30
|
+
import { openSessionInUrl } from '@/client/lib/router/open-session';
|
|
31
|
+
import { useSearchParams } from '@/client/lib/router/search-params';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Select the remembered session on a cold start, when this page is inside a
|
|
35
|
+
* native shell and the URL names nothing.
|
|
36
|
+
*
|
|
37
|
+
* Returns whether the URL moved. A deep link that already selected a session
|
|
38
|
+
* wins: the user (or a notification) asked for that one explicitly.
|
|
39
|
+
*/
|
|
40
|
+
export function restoreLastOpenedSession(sessionId: string | null | undefined): boolean {
|
|
41
|
+
if (typeof window === 'undefined') return false;
|
|
42
|
+
if (!hasShellBridge()) return false;
|
|
43
|
+
const id = typeof sessionId === 'string' ? sessionId.trim() : '';
|
|
44
|
+
if (!id) return false;
|
|
45
|
+
if (new URLSearchParams(window.location.search).get('sessionId')) return false;
|
|
46
|
+
return openSessionInUrl(id, { replace: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Remember every session the URL selects.
|
|
51
|
+
*
|
|
52
|
+
* `enabled` is the authentication state: a page showing the login screen has no
|
|
53
|
+
* session to remember and its endpoint would answer 401.
|
|
54
|
+
*
|
|
55
|
+
* A pending id (`new-…`, `__new__…`) is skipped because there is no session to
|
|
56
|
+
* reopen yet; the spawn's adoption switches the URL to the real id, which this
|
|
57
|
+
* hook records on its next run. A failed POST is deliberately silent: the
|
|
58
|
+
* previous record still describes a session the user actually opened, and
|
|
59
|
+
* there is no action on this screen to report it against.
|
|
60
|
+
*/
|
|
61
|
+
export function useSessionOpenRecorder(enabled: boolean): void {
|
|
62
|
+
const [searchParams] = useSearchParams();
|
|
63
|
+
const sessionId = searchParams.get('sessionId');
|
|
64
|
+
const sent = useRef<string | null>(null);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!enabled) return;
|
|
68
|
+
const id = sessionId?.trim();
|
|
69
|
+
if (!id || id.startsWith('new-') || id.startsWith('__new__')) return;
|
|
70
|
+
if (sent.current === id) return;
|
|
71
|
+
sent.current = id;
|
|
72
|
+
void fetch(`/api/sessions/${encodeURIComponent(id)}/opened`, { method: 'POST' }).catch(() => {});
|
|
73
|
+
}, [enabled, sessionId]);
|
|
74
|
+
}
|
|
@@ -58,6 +58,14 @@ describe('openSessionInUrl', () => {
|
|
|
58
58
|
expect(events).toBe(1);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
test('a restore replaces the entry instead of adding one', () => {
|
|
62
|
+
go('');
|
|
63
|
+
const before = window.history.length;
|
|
64
|
+
expect(openSessionInUrl('restored', { replace: true })).toBe(true);
|
|
65
|
+
expect(new URL(window.location.href).searchParams.get('sessionId')).toBe('restored');
|
|
66
|
+
expect(window.history.length).toBe(before);
|
|
67
|
+
});
|
|
68
|
+
|
|
61
69
|
test('a blank id changes nothing', () => {
|
|
62
70
|
go('?sessionId=keep');
|
|
63
71
|
expect(openSessionInUrl(' ')).toBe(false);
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* subagent view of a SESSION would hide the transcript the notification named.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
export function openSessionInUrl(sessionId: string): boolean {
|
|
19
|
+
export function openSessionInUrl(sessionId: string, options: { replace?: boolean } = {}): boolean {
|
|
20
20
|
if (typeof window === 'undefined') return false;
|
|
21
21
|
const id = sessionId.trim();
|
|
22
22
|
if (!id) return false;
|
|
@@ -24,9 +24,14 @@ export function openSessionInUrl(sessionId: string): boolean {
|
|
|
24
24
|
const url = new URL(window.location.href);
|
|
25
25
|
url.searchParams.set('sessionId', id);
|
|
26
26
|
url.searchParams.delete('subagent');
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
//
|
|
27
|
+
// `replace` is for a selection the user did not make — the session a native
|
|
28
|
+
// shell restored on launch. A history entry there would make Back return to
|
|
29
|
+
// the empty workspace the restore just replaced, which is not a place the
|
|
30
|
+
// user went.
|
|
31
|
+
if (options.replace) window.history.replaceState(null, '', url);
|
|
32
|
+
else window.history.pushState(null, '', url);
|
|
33
|
+
// Changing history does NOT fire `popstate`, so the search-param store has to
|
|
34
|
+
// be told; otherwise only a reload would show the new selection. A plain Event is
|
|
30
35
|
// enough — the store re-reads `location.search`, which pushState already moved
|
|
31
36
|
// — and it avoids depending on a constructor some environments lack.
|
|
32
37
|
window.dispatchEvent(new Event('popstate'));
|
package/src/client/main.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import { installFileLaunchHandler } from '@/client/lib/launch/file-handlers';
|
|
|
24
24
|
import { installOpenPaths } from '@/client/lib/native/open-paths';
|
|
25
25
|
import { installCommandRunner } from '@/client/lib/native/run-command';
|
|
26
26
|
import { installDeviceFiles } from '@/client/lib/launch/device-files';
|
|
27
|
+
import { restoreLastOpenedSession } from '@/client/hooks/shell/last-opened-session';
|
|
27
28
|
|
|
28
29
|
import '@/client/tailwind.css';
|
|
29
30
|
import '@/client/glass.css';
|
|
@@ -174,6 +175,12 @@ installDeviceFiles();
|
|
|
174
175
|
void bootSyntax().then(() => warmSyntaxTokenizers());
|
|
175
176
|
|
|
176
177
|
if (root) {
|
|
178
|
+
// BEFORE hydration: a shell relaunch with no query in the URL resumes the
|
|
179
|
+
// session this console opened last, so the first render already names it.
|
|
180
|
+
// After `installShellTransport`, which is what lets a phone identify itself,
|
|
181
|
+
// and before `hydrate`, so no component ever paints the empty workspace on
|
|
182
|
+
// the way to the restored chat.
|
|
183
|
+
restoreLastOpenedSession(bootstrap?.lastOpenedSessionId);
|
|
177
184
|
hydrate(
|
|
178
185
|
<App
|
|
179
186
|
initialIsMobile={bootstrap?.initialIsMobile}
|
|
@@ -92,6 +92,16 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
92
92
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
93
93
|
);
|
|
94
94
|
|
|
95
|
+
-- The session each CLIENT opens last — one row per WebView/app install,
|
|
96
|
+
-- identified by the kabmo_client cookie. A native shell restores its own
|
|
97
|
+
-- row on a cold start, so a phone and a desktop pointed at the same console
|
|
98
|
+
-- do not fight over one pointer. See lib/sessions/last-opened.server.ts.
|
|
99
|
+
CREATE TABLE IF NOT EXISTS last_opened_sessions (
|
|
100
|
+
client_id TEXT PRIMARY KEY,
|
|
101
|
+
session_id TEXT NOT NULL,
|
|
102
|
+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
103
|
+
);
|
|
104
|
+
|
|
95
105
|
-- The sidebar's subagent badge, saved per file version so a restart does
|
|
96
106
|
-- not re-derive it by streaming every transcript (see
|
|
97
107
|
-- lib/omp/session/subagent-presence-store). Derived data: deleting the
|