adminizer 5.2.0-build.33 → 5.2.0-build.35
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/assets/{abnfDiagram-VCTEODGH-BnsIqosm.js → abnfDiagram-VCTEODGH-VlwaoUTb.js} +1 -1
- package/assets/{add-LtDQwU4b.js → add-CqSZIEWV.js} +1 -1
- package/assets/{add-group-B7P_c4C8.js → add-group-BOsQ0Q3j.js} +1 -1
- package/assets/{add-user-BsX7SMOH.js → add-user-L2wD_b_T.js} +1 -1
- package/assets/ai-assistant/agent.es.js +20488 -19277
- package/assets/app-Bon67K9l.css +1 -0
- package/assets/app-CWlMJiPe.js +138 -0
- package/assets/{architectureDiagram-5GKGNRK7-CHxPdttY.js → architectureDiagram-5GKGNRK7-u57qIB-M.js} +2 -2
- package/assets/{blockDiagram-I7D4REHJ-BYTzbRFE.js → blockDiagram-I7D4REHJ-DV90TjcV.js} +4 -4
- package/assets/{c4Diagram-7LVT6UL2-CI7dW3xq.js → c4Diagram-7LVT6UL2-t5nM_yE6.js} +1 -1
- package/assets/{catalog-BiMamMLN.js → catalog-D6aEgpu7.js} +1 -1
- package/assets/channel-BObXBllO.js +1 -0
- package/assets/{chunk-2Q5K7J3B-Hi-aK_Ha.js → chunk-2Q5K7J3B-Bvean9Oy.js} +1 -1
- package/assets/{chunk-5VM5RSS4-DgcY5Qji.js → chunk-5VM5RSS4-C4yczpcm.js} +1 -1
- package/assets/{chunk-F27PBJKO-DKXOt00w.js → chunk-F27PBJKO-CZQTtsTa.js} +1 -1
- package/assets/{chunk-IMKFNOWR-D4WeUgcs.js → chunk-IMKFNOWR-CvCLehQX.js} +1 -1
- package/assets/{chunk-JWPE2WC7-Ce6Rxa30.js → chunk-JWPE2WC7-BEsqzX-T.js} +1 -1
- package/assets/{chunk-POPQ4Y6H-D0kDsnoE.js → chunk-POPQ4Y6H-BPKiJml-.js} +1 -1
- package/assets/{chunk-SVP7TREG-CYirWYWz.js → chunk-SVP7TREG-BVkc4_Yf.js} +4 -4
- package/assets/{chunk-TICWLB2K-HEf09VbM.js → chunk-TICWLB2K-nbzNG2Lg.js} +1 -1
- package/assets/{chunk-XXDRQBXY-_0ZRO4MZ.js → chunk-XXDRQBXY-BAn4BRVo.js} +1 -1
- package/assets/classDiagram-ZZMXUADV-Dyvh9xeB.js +1 -0
- package/assets/classDiagram-v2-VYDZK3BY-Dyvh9xeB.js +1 -0
- package/assets/controls/ckeditor.es.js +9602 -9418
- package/assets/controls/jsoneditor.es.js +672 -674
- package/assets/controls/toast-ui.es.js +14597 -14596
- package/assets/{cose-bilkent-JH36ORCC-Btol7060.js → cose-bilkent-JH36ORCC-DjIWkId6.js} +1 -1
- package/assets/{cynefin-OW5HDTMX-Olv1bWeO.js → cynefin-OW5HDTMX-DA3WSPz5.js} +1 -1
- package/assets/{cynefinDiagram-5FMLGOSQ-CK0ep8mN.js → cynefinDiagram-5FMLGOSQ-CctOa4fE.js} +2 -2
- package/assets/cytoscape.esm-BHa1VTXv.js +321 -0
- package/assets/d3-scale-4DPf7zan.js +1 -0
- package/assets/{dagre-GXQ25YYZ-D_Tgq3Xg.js → dagre-GXQ25YYZ-BeP3E0b5.js} +2 -2
- package/assets/{dashboard-D7Vrpy3X.js → dashboard-C0pXUDqP.js} +1 -1
- package/assets/{diagram-S7CK7UJ4-Cylxlvfi.js → diagram-S7CK7UJ4-B85fwkaf.js} +3 -3
- package/assets/diagram-UQ7AKVKN-CqkEko9N.js +41 -0
- package/assets/{diagram-VSXAHHWV-DBLNVtPt.js → diagram-VSXAHHWV-x-PrtWHy.js} +1 -1
- package/assets/diagram-VX7I27RA-BYJBRYa8.js +24 -0
- package/assets/{diagram-Z3DM3KII-B6K8hUqN.js → diagram-Z3DM3KII-DCiL-xro.js} +1 -1
- package/assets/{docs-Ce8UYCsn.js → docs-Db-NexCf.js} +1 -1
- package/assets/{ebnfDiagram-PWID7BFC-D5fzOhJr.js → ebnfDiagram-PWID7BFC-CwM3RllY.js} +1 -1
- package/assets/{erDiagram-RLTQ6QDP-B1b5aX0r.js → erDiagram-RLTQ6QDP-D_h8KziD.js} +1 -1
- package/assets/{flowDiagram-HODETNUW-DUt4TmGE.js → flowDiagram-HODETNUW-DGimFqFm.js} +4 -4
- package/assets/ganttDiagram-EL5Y4UJY-CJpR4o0I.js +292 -0
- package/assets/{gitGraphDiagram-WWUBYQGX-BCagtg-j.js → gitGraphDiagram-WWUBYQGX-Dg_f7BHs.js} +1 -1
- package/assets/{history-Bq0XZ13j.js → history-DXiUYmwU.js} +1 -1
- package/assets/{infoDiagram-27XIBGKW-CtqP-RaE.js → infoDiagram-27XIBGKW-wV9lWzkf.js} +1 -1
- package/assets/{init-user-BCb4NPxa.js → init-user-pCW_Q05s.js} +1 -1
- package/assets/{ishikawaDiagram-5VMMS53U-CU7tu3i5.js → ishikawaDiagram-5VMMS53U-BsTDr38x.js} +3 -3
- package/assets/{journeyDiagram-3NMN7TZE-DcGtNnor.js → journeyDiagram-3NMN7TZE-CNHbwqwc.js} +2 -2
- package/assets/{kanban-definition-UXKFOSKX-Da1vwxDK.js → kanban-definition-UXKFOSKX-CVhJsHlN.js} +6 -6
- package/assets/layout-BfAIponG.js +1 -0
- package/assets/{list-Co2Yh_RS.js → list-DUvMtSpV.js} +1 -1
- package/assets/login-E_Y7wut5.js +1 -0
- package/assets/manifest.json +285 -326
- package/assets/{media-manager-BhrlfUDZ.js → media-manager-SrUV61oz.js} +1 -1
- package/assets/mermaid.core-dItKH28w.js +310 -0
- package/assets/{mindmap-definition-YA3MSWOX-DwC--3ep.js → mindmap-definition-YA3MSWOX-CeNd0CHT.js} +1 -1
- package/assets/{module-CBCiLH2M.js → module-BLZcWhbK.js} +1 -1
- package/assets/{notification-Dv_yjwYp.js → notification-Dud_cS95.js} +1 -1
- package/assets/{pegDiagram-XKGWAZYB-Bfjta7he.js → pegDiagram-XKGWAZYB-XkpCeLx7.js} +1 -1
- package/assets/pieDiagram-E7YTZNPT-IfctYNg6.js +39 -0
- package/assets/{quadrantDiagram-AXDQQJYC-DMsQ6bx3.js → quadrantDiagram-AXDQQJYC-Dl71kVWH.js} +4 -4
- package/assets/{railroadDiagram-O6MQD6OU-OMQR6DgW.js → railroadDiagram-O6MQD6OU-DFZCwxEi.js} +1 -1
- package/assets/{register-bvLgzRnh.js → register-CLXNA3RH.js} +1 -1
- package/assets/{requirementDiagram-BXWQKSXE-4eXUH2nw.js → requirementDiagram-BXWQKSXE-gwMr2hhN.js} +1 -1
- package/assets/{ru-GghByIKs.js → ru-BuRkfrV3.js} +1 -1
- package/assets/sankeyDiagram-P5KCCOFB-D4m9TUBM.js +40 -0
- package/assets/{sequenceDiagram-WJ2MYXX4-Cb-fxQnC.js → sequenceDiagram-WJ2MYXX4-JrZmoS_N.js} +1 -1
- package/assets/{sizeCapture-INFHLROL-DgQ7-zHE.js → sizeCapture-INFHLROL-Bi7VDSTt.js} +1 -1
- package/assets/stateDiagram-D77RDMKH-CoOTX1h8.js +1 -0
- package/assets/stateDiagram-v2-MP3YSRHH-DSV0uD3M.js +1 -0
- package/assets/{swimlanes-42K2YHIH-yCzVS5Kf.js → swimlanes-42K2YHIH-CgtKaw_1.js} +1 -1
- package/assets/swimlanesDiagram-VR7AAH4N-tGoQkrWA.js +8 -0
- package/assets/{timeline-definition-24CTP7MA-DZ-J8WVk.js → timeline-definition-24CTP7MA-DrSuUziH.js} +2 -2
- package/assets/{use-appearance-CNzjRFkO.js → use-appearance-CSP6Ml4F.js} +1 -1
- package/assets/{user-filters-list-XZQeWIcY.js → user-filters-list-Cv2Z3Fwm.js} +1 -1
- package/assets/{vennDiagram-4TSXK5OY-DmJwiSA5.js → vennDiagram-4TSXK5OY-BIeLKAIy.js} +5 -5
- package/assets/{wardleyDiagram-VM6X3IG4-CBtPOf2I.js → wardleyDiagram-VM6X3IG4-CwmxxXr9.js} +2 -2
- package/assets/{welcome-hJX9AsIB.js → welcome-CXTRhMo9.js} +1 -1
- package/assets/with-app-layout-DVk7VpSG.js +37 -0
- package/assets/xychartDiagram-S5SC5T6Z-DCx2Vin2.js +7 -0
- package/controllers/login.d.ts +1 -1
- package/controllers/login.js +18 -17
- package/interfaces/adminpanelConfig.d.ts +7 -0
- package/interfaces/global.d.ts +0 -1
- package/lib/app-manager/ContextHandler.d.ts +12 -1
- package/lib/app-manager/ContextHandler.js +9 -0
- package/lib/helper/pretend.d.ts +4 -0
- package/lib/helper/pretend.js +27 -0
- package/package.json +1 -1
- package/system/bindInertia.js +6 -1
- package/system/bindReqFunctions.js +13 -4
- package/translations/ru.json +1 -0
- package/assets/app-DM8KzeFz.css +0 -1
- package/assets/app-D_WEQ9Ix.js +0 -138
- package/assets/arc-CqLlrEwa.js +0 -1
- package/assets/channel-TXm2e8eJ.js +0 -1
- package/assets/classDiagram-ZZMXUADV-DhaqWTWz.js +0 -1
- package/assets/classDiagram-v2-VYDZK3BY-DhaqWTWz.js +0 -1
- package/assets/cytoscape.esm-BDkkwuE4.js +0 -321
- package/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/assets/diagram-UQ7AKVKN-DTi2F_20.js +0 -41
- package/assets/diagram-VX7I27RA-CahscuCU.js +0 -24
- package/assets/ganttDiagram-EL5Y4UJY-CK-rD_6X.js +0 -292
- package/assets/init-Gi6I4Gst.js +0 -1
- package/assets/layout-wE9NXraK.js +0 -1
- package/assets/linear-Cl40xh64.js +0 -1
- package/assets/login-Cl1b-jvN.js +0 -1
- package/assets/mermaid.core-DFiCyHcW.js +0 -310
- package/assets/ordinal-Cboi1Yqb.js +0 -1
- package/assets/pieDiagram-E7YTZNPT-DR6xKA3p.js +0 -39
- package/assets/sankeyDiagram-P5KCCOFB-Cl9Yn7o4.js +0 -40
- package/assets/stateDiagram-D77RDMKH-BIK_kLM3.js +0 -1
- package/assets/stateDiagram-v2-MP3YSRHH-B6Bu0mpm.js +0 -1
- package/assets/swimlanesDiagram-VR7AAH4N-DFHYvxlZ.js +0 -8
- package/assets/with-app-layout-ORRLIlc0.js +0 -34
- package/assets/xychartDiagram-S5SC5T6Z-Drb6_i6k.js +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as pi,g as mi,o as $t,n as yi,a as bi,b as Ai,_ as n,l as Ut,D as wi,d as Ci,p as Si,y as Tt,i as Ri,A as Gt,B as _i,H as ki,I as Ti,J as Wt}from"./mermaid.core-dItKH28w.js";import{b as Xt,l as Nt}from"./d3-scale-4DPf7zan.js";import"./app-CWlMJiPe.js";import"./isObject-DL-BuaBl.js";var St=(function(){var e=n(function(V,r,g,u){for(g=g||{},u=V.length;u--;g[V[u]]=r);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],a=[1,5],h=[1,6],l=[1,7],y=[1,5,10,12,14,16,18,19,21,23,36,37,38],d=[1,25],p=[1,26],_=[1,28],k=[1,29],P=[1,30],F=[1,31],W=[1,32],v=[1,33],z=[1,34],b=[1,35],T=[1,36],c=[1,37],I=[1,43],O=[1,42],X=[1,47],N=[1,50],S=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[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],w=[1,65],M=[26,28],R={trace:n(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:n(function(r,g,u,x,C,o,lt){var f=o.length-1;switch(C){case 5:x.setOrientation(o[f]);break;case 9:x.setDiagramTitle(o[f].text.trim());break;case 12:x.setLineData({text:"",type:"text"},o[f]);break;case 13:x.setLineData(o[f-1],o[f]);break;case 14:x.setBarData({text:"",type:"text"},o[f]);break;case 15:x.setBarData(o[f-1],o[f]);break;case 16:this.$=o[f].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=o[f].trim(),x.setAccDescription(this.$);break;case 19:this.$=o[f-1];break;case 20:case 30:this.$=[o[f-2],...o[f]];break;case 21:case 31:this.$=[o[f]];break;case 22:this.$={value:Number(o[f-1]),label:o[f]};break;case 23:this.$={value:Number(o[f]),label:""};break;case 24:x.setXAxisTitle(o[f]);break;case 25:x.setXAxisTitle(o[f-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(o[f]);break;case 28:x.setXAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 29:this.$=o[f-1];break;case 32:x.setYAxisTitle(o[f]);break;case 33:x.setYAxisTitle(o[f-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 39:this.$={text:o[f],type:"text"};break;case 40:this.$={text:o[f],type:"text"};break;case 41:this.$={text:o[f],type:"markdown"};break;case 42:this.$=o[f];break;case 43:this.$=o[f-1]+""+o[f];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:a,37:h,38:l}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:a,37:h,38:l}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:h,38:l}),{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(y,[2,36]),e(y,[2,37]),e(y,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:a,37:h,38:l}),{1:[2,3]},e(y,[2,5]),e(t,[2,7],{4:22,36:a,37:h,38:l}),{11:23,30:d,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},{11:39,13:38,24:I,29:O,30:d,31:40,32:41,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},{11:45,15:44,29:X,30:d,35:46,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},{11:49,17:48,24:N,30:d,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},{11:52,17:51,24:N,30:d,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(H,[2,39],{41:55,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(S,[2,10]),e(S,[2,24],{32:41,31:56,24:I,29:O}),e(S,[2,26]),e(S,[2,27]),{33:[1,57]},{11:59,30:d,34:58,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},e(S,[2,11]),e(S,[2,32],{35:60,29:X}),e(S,[2,34]),{33:[1,61]},e(S,[2,12]),{17:62,24:N},{25:63,27:64,29:w},e(S,[2,14]),{17:66,24:N},e(S,[2,16]),e(S,[2,17]),e(A,[2,43]),e(S,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(S,[2,33]),{29:[1,70]},e(S,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(M,[2,23],{30:[1,73]}),e(S,[2,15]),e(S,[2,28]),e(S,[2,29]),{11:59,30:d,34:74,39:24,40:p,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:z,49:b,50:T,51:c},e(S,[2,35]),e(S,[2,19]),{25:75,27:64,29:w},e(M,[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:n(function(r,g){if(g.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=g,u}},"parseError"),parse:n(function(r){var g=this,u=[0],x=[],C=[null],o=[],lt=this.table,f="",xt=0,zt=0,ui=2,Ot=1,xi=o.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);D.setInput(r,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var At=D.yylloc;o.push(At);var di=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(E){u.length=u.length-2*E,C.length=C.length-E,o.length=o.length-E}n(fi,"popStack");function Vt(){var E;return E=x.pop()||D.lex()||Ot,typeof E!="number"&&(E instanceof Array&&(x=E,E=x.pop()),E=g.symbols_[E]||E),E}n(Vt,"lex");for(var L,U,B,wt,j={},dt,Y,Ft,ft;;){if(U=u[u.length-1],this.defaultActions[U]?B=this.defaultActions[U]:((L===null||typeof L>"u")&&(L=Vt()),B=lt[U]&<[U][L]),typeof B>"u"||!B.length||!B[0]){var Ct="";ft=[];for(dt in lt[U])this.terminals_[dt]&&dt>ui&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?Ct="Parse error on line "+(xt+1)+`:
|
|
2
|
+
`+D.showPosition()+`
|
|
3
|
+
Expecting `+ft.join(", ")+", got '"+(this.terminals_[L]||L)+"'":Ct="Parse error on line "+(xt+1)+": Unexpected "+(L==Ot?"end of input":"'"+(this.terminals_[L]||L)+"'"),this.parseError(Ct,{text:D.match,token:this.terminals_[L]||L,line:D.yylineno,loc:At,expected:ft})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+L);switch(B[0]){case 1:u.push(L),C.push(D.yytext),o.push(D.yylloc),u.push(B[1]),L=null,zt=D.yyleng,f=D.yytext,xt=D.yylineno,At=D.yylloc;break;case 2:if(Y=this.productions_[B[1]][1],j.$=C[C.length-Y],j._$={first_line:o[o.length-(Y||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(Y||1)].first_column,last_column:o[o.length-1].last_column},di&&(j._$.range=[o[o.length-(Y||1)].range[0],o[o.length-1].range[1]]),wt=this.performAction.apply(j,[f,zt,xt,$.yy,B[1],C,o].concat(xi)),typeof wt<"u")return wt;Y&&(u=u.slice(0,-1*Y*2),C=C.slice(0,-1*Y),o=o.slice(0,-1*Y)),u.push(this.productions_[B[1]][0]),C.push(j.$),o.push(j._$),Ft=lt[u[u.length-2]][u[u.length-1]],u.push(Ft);break;case 3:return!0}}return!0},"parse")},rt=(function(){var V={EOF:1,parseError:n(function(g,u){if(this.yy.parser)this.yy.parser.parseError(g,u);else throw new Error(g)},"parseError"),setInput:n(function(r,g){return 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]),this.offset=0,this},"setInput"),input:n(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);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:n(function(r){var g=r.length,u=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 x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===x.length?this.yylloc.first_column:0)+x[x.length-u.length].length-u[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(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
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(r){this.unput(this.match.slice(r))},"less"),pastInput:n(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:n(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var r=this.pastInput(),g=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
5
|
+
`+g+"^"},"showPosition"),test_match:n(function(r,g){var u,x,C;if(this.options.backtrack_lexer&&(C={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&&(C.yylloc.range=this.yylloc.range.slice(0))),x=r[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.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]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var o in C)this[o]=C[o];return!1}return!1},"test_match"),next:n(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,g,u,x;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),o=0;o<C.length;o++)if(u=this._input.match(this.rules[C[o]]),u&&(!g||u[0].length>g[0].length)){if(g=u,x=o,this.options.backtrack_lexer){if(r=this.test_match(u,C[o]),r!==!1)return r;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(r=this.test_match(g,C[x]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:n(function(){var g=this.next();return g||this.lex()},"lex"),begin:n(function(g){this.conditionStack.push(g)},"begin"),popState:n(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:n(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:n(function(g){this.begin(g)},"pushState"),stateStackSize:n(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:n(function(g,u,x,C){switch(x){case 0:break;case 1:break;case 2:return this.popState(),36;case 3:return this.popState(),36;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";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";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 33;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 29;case 25:return this.popState(),26;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 V})();R.lexer=rt;function q(){this.yy={}}return n(q,"Parser"),q.prototype=R,R.Parser=q,new q})();St.parser=St;var Di=St;function pt(e){return e.type==="bar"}n(pt,"isBarPlot");function mt(e){return e.type==="band"}n(mt,"isBandAxisData");function Q(e){return e.type==="linear"}n(Q,"isLinearAxisData");var K,Dt=(K=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((h,l)=>Math.max(l.length,h),0)*i,height:i};const s={width:0,height:0},a=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const h of t){const l=Ti(a,1,h),y=l?l.width:h.length*i,d=l?l.height:i;s.width=Math.max(s.width,y),s.height=Math.max(s.height,d)}return a.remove(),s}},n(K,"TextDimensionCalculatorWithFont"),K),Yt=.7,Ht=.2,J,qt=(J=class{constructor(t,i,s,a){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=a,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}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){Yt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(Yt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),a=Ht*t.width;this.outerPadding=Math.min(s.width/2,a);let h=s.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(h=Math.max(h,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height))),h+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,h<=i&&(i-=h,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),a=Ht*t.height;this.outerPadding=Math.min(s.height/2,a);const h=s.width+this.axisConfig.labelPadding*2;h<=i&&(i-=h,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){const i=this.normalizedLabelRotationInRad;return i===0?0:Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.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&&t.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"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.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}))})}return this.showTitle&&t.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"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.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&&t.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"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.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}))})}return this.showTitle&&t.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"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.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&&t.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"}))}),this.showTick){const i=this.boundingRect.y;t.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}))})}return this.showTitle&&t.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"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},n(J,"BaseAxis"),J),Z,Pi=(Z=class extends qt{constructor(t,i,s,a,h){super(t,a,h,i),this.categories=s,this.scale=Xt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=Xt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Ut.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},n(Z,"BandAxis"),Z),tt,Li=(tt=class extends qt{constructor(t,i,s,a,h){super(t,a,h,i),this.domain=s,this.scale=Nt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=Nt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},n(tt,"LinearAxis"),tt);function Rt(e,t,i,s){const a=new Dt(s);return mt(e)?new Pi(t,i,e.categories,e.title,a):new Li(t,i,[e.min,e.max],e.title,a)}n(Rt,"getAxis");var it,vi=(it=class{constructor(t,i,s,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),a=i.height+2*this.chartConfig.titlePadding;return i.width<=s&&i.height<=a&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=a,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.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}]}),t}},n(it,"ChartTitle"),it);function jt(e,t,i,s){const a=new Dt(s);return new vi(a,e,t,i)}n(jt,"getChartTitleComponent");var Ei=.75,Ii=.5,Mi=.35;function _t(e){return{fontSize:e,markerSize:e*Ei,markerSpacing:e*Mi,itemSpacing:e*Ii}}n(_t,"getLegendLayout");var et,Bi=(et=class{constructor(t,i,s,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter(p=>p.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};const{fontSize:i,markerSize:s,markerSpacing:a,itemSpacing:h}=_t(this.chartConfig.legendFontSize),l=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(p=>p.title),i),y=this.chartConfig.legendPadding*2+s+a+l.width,d=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*h;return y<=t.width&&d<=t.height?(this.boundingRect.width=y,this.boundingRect.height=d):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];const{fontSize:t,markerSize:i,markerSpacing:s,itemSpacing:a}=_t(this.chartConfig.legendFontSize),h=t+a,l=this.boundingRect.x+this.chartConfig.legendPadding,y=this.boundingRect.y+this.chartConfig.legendPadding,d=[],p=[];for(const[_,k]of this.visiblePlots.entries())if(pt(k))d.push({x:l,y:y+_*h,width:i,height:i,fill:k.fill,strokeFill:k.fill,strokeWidth:0});else{const P=y+_*h+i/2;p.push({path:`M ${l},${P} L ${l+i},${P}`,strokeFill:k.strokeFill,strokeWidth:k.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:d},{groupTexts:["legend","markers"],type:"path",data:p},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((_,k)=>({text:_.title,x:l+i+s,y:y+k*h+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}},n(et,"ChartLegend"),et);function Qt(e,t,i,s){const a=new Dt(s);return new Bi(a,e,t,i)}n(Qt,"getChartLegendComponent");var st,zi=(st=class{constructor(t,i,s,a,h){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=a,this.plotIndex=h}getDrawableElement(){const t=this.plotData.data.map(a=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]);let i;if(this.orientation==="horizontal"?i=Wt().y(a=>a[0]).x(a=>a[1])(t):i=Wt().x(a=>a[0]).y(a=>a[1])(t),!i)return[];const 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){const l=[];for(const[y,[d,p]]of t.entries()){const _=this.plotData.pointLabels[y];_&&(this.orientation==="horizontal"?l.push({x:p+10,y:d,text:_,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):l.push({x:d,y:p-10,text:_,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}l.length>0&&s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:l})}return s}},n(st,"LinePlot"),st),at,Oi=(at=class{constructor(t,i,s,a,h,l){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=a,this.orientation=h,this.plotIndex=l}getDrawableElement(){const t=this.barData.data.map(h=>[this.xAxis.getScaleValue(h[0]),this.yAxis.getScaleValue(h[1])]),s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),a=s/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(h=>({x:this.boundingRect.x,y:h[0]-a,height:s,width:h[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(h=>({x:h[0]-a,y:h[1],width:s,height:this.boundingRect.y+this.boundingRect.height-h[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},n(at,"BarPlot"),at),nt,Vi=(nt=class{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const a=new zi(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break;case"bar":{const a=new Oi(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break}return t}},n(nt,"BasePlot"),nt);function Kt(e,t,i){return new Vi(e,t,i)}n(Kt,"getPlotComponent");var ot,Fi=(ot=class{constructor(t,i,s,a){this.chartConfig=t,this.chartData=i,this.componentStore={title:jt(t,i,s,a),plot:Kt(t,i,s),legend:Qt(t,i,s,a),xAxis:Rt(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},a),yAxis:Rt(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},a)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,a=0,h={width:0,height:0},l=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),y=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),d=this.componentStore.plot.calculateSpace({width:l,height:y});t-=d.width,i-=d.height,d=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),a=d.height,i-=d.height,this.componentStore.xAxis.setAxisPosition("bottom"),d=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=d.height,this.componentStore.yAxis.setAxisPosition("left"),d=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=d.width,t-=d.width,h=this.componentStore.legend.calculateSpace({width:t,height:y}),t-=h.width,t>0&&(l+=t,t=0),i>0&&(y+=i,i=0),this.componentStore.plot.calculateSpace({width:l,height:y}),this.componentStore.plot.setBoundingBoxXY({x:s,y:a}),this.componentStore.legend.setBoundingBoxXY({x:s+l,y:a+Math.max((y-h.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+l]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:a+y}),this.componentStore.yAxis.setRange([a,a+y]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(p=>pt(p))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,a=0,h=0,l={width:0,height:0},y=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),d=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:y,height:d});t-=p.width,i-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=p.height,i-=p.height,this.componentStore.xAxis.setAxisPosition("left"),p=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=p.width,a=p.width,this.componentStore.yAxis.setAxisPosition("top"),p=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=p.height,h=s+p.height,l=this.componentStore.legend.calculateSpace({width:t,height:d}),t-=l.width,t>0&&(y+=t,t=0),i>0&&(d+=i,i=0),this.componentStore.plot.calculateSpace({width:y,height:d}),this.componentStore.plot.setBoundingBoxXY({x:a,y:h}),this.componentStore.legend.setBoundingBoxXY({x:a+y,y:h+Math.max((d-l.height)/2,0)}),this.componentStore.yAxis.setRange([a,a+y]),this.componentStore.yAxis.setBoundingBoxXY({x:a,y:s}),this.componentStore.xAxis.setRange([h,h+d]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:h}),this.chartData.plots.some(_=>pt(_))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},n(ot,"Orchestrator"),ot),ht,Wi=(ht=class{static build(t,i,s,a){return new Fi(t,i,s,a).getDrawableElement()}},n(ht,"XYChartBuilder"),ht),ct=0,Jt,gt=vt(),ut=Lt(),m=Et(),kt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,Pt=!1;function Lt(){const e=ki(),t=Tt();return Gt(e.xyChart,t.themeVariables.xyChart)}n(Lt,"getChartDefaultThemeConfig");function vt(){const e=Tt();return Gt(_i.xyChart,e.xyChart)}n(vt,"getChartDefaultConfig");function Et(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}n(Et,"getChartDefaultData");function G(e){const t=Tt();return Ri(e.trim(),t)}n(G,"textSanitizer");function Zt(e){Jt=e}n(Zt,"setTmpSVGG");function ti(e){e==="horizontal"?gt.chartOrientation="horizontal":gt.chartOrientation="vertical"}n(ti,"setOrientation");function ii(e){m.xAxis.title=G(e.text)}n(ii,"setXAxisTitle");function It(e,t){m.xAxis={type:"linear",title:m.xAxis.title,min:e,max:t},yt=!0}n(It,"setXAxisRangeData");function ei(e){m.xAxis={type:"band",title:m.xAxis.title,categories:e.map(t=>G(t.text))},yt=!0}n(ei,"setXAxisBand");function si(e){m.yAxis.title=G(e.text)}n(si,"setYAxisTitle");function ai(e,t){m.yAxis={type:"linear",title:m.yAxis.title,min:e,max:t},Pt=!0}n(ai,"setYAxisRangeData");function ni(e){const t=Math.min(...e),i=Math.max(...e),s=Q(m.yAxis)?m.yAxis.min:1/0,a=Q(m.yAxis)?m.yAxis.max:-1/0;m.yAxis={type:"linear",title:m.yAxis.title,min:Math.min(s,t),max:Math.max(a,i)}}n(ni,"setYAxisRangeFromPlotData");function Mt(e){let t=[];if(e.length===0)return t;if(!yt){const i=Q(m.xAxis)?m.xAxis.min:1/0,s=Q(m.xAxis)?m.xAxis.max:-1/0;It(Math.min(i,1),Math.max(s,e.length))}if(mt(m.xAxis)&&e.length>m.xAxis.categories.length&&(e=e.slice(0,m.xAxis.categories.length)),Pt||ni(e),mt(m.xAxis)&&(t=m.xAxis.categories.map((i,s)=>[i,e[s]])),Q(m.xAxis)){const i=m.xAxis.min,s=m.xAxis.max;if(e.length===1)t=[[`${i}`,e[0]]];else{const a=(s-i)/(e.length-1);t=e.map((h,l)=>[`${i+l*a}`,h])}}return t}n(Mt,"transformDataWithoutCategory");function Bt(e){return kt[e===0?0:e%kt.length]}n(Bt,"getPlotColorFromPalette");function oi(e,t){const i=t.map(l=>l.value),s=t.map(l=>l.label?G(l.label):""),a=Mt(i),h=s.some(l=>l!=="");m.plots.push({type:"line",title:G(e.text),strokeFill:Bt(ct),strokeWidth:2,data:a,...h?{pointLabels:s}:{}}),ct++}n(oi,"setLineData");function hi(e,t){const i=t.map(a=>a.value),s=Mt(i);m.plots.push({type:"bar",title:G(e.text),fill:Bt(ct),data:s}),ct++}n(hi,"setBarData");function ri(){if(m.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return m.title=$t(),Wi.build(gt,m,ut,Jt)}n(ri,"getDrawableElem");function li(){return ut}n(li,"getChartThemeConfig");function ci(){return gt}n(ci,"getChartConfig");function gi(){return m}n(gi,"getXYChartData");var Xi=n(function(){Si(),ct=0,gt=vt(),m=Et(),ut=Lt(),kt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,Pt=!1},"clear"),Ni={getDrawableElem:ri,clear:Xi,setAccTitle:Ai,getAccTitle:bi,setDiagramTitle:yi,getDiagramTitle:$t,getAccDescription:mi,setAccDescription:pi,setOrientation:ti,setXAxisTitle:ii,setXAxisRangeData:It,setXAxisBand:ei,setYAxisTitle:si,setYAxisRangeData:ai,setLineData:oi,setBarData:hi,setTmpSVGG:Zt,getChartThemeConfig:li,getChartConfig:ci,getXYChartData:gi},Yi=n((e,t,i,s)=>{const a=s.db,h=a.getChartThemeConfig(),l=a.getChartConfig(),y=a.getXYChartData().plots[0].data.map(b=>b[1]);function d(b){return b==="top"?"text-before-edge":"middle"}n(d,"getDominantBaseLine");function p(b){return b==="left"?"start":b==="right"?"end":"middle"}n(p,"getTextAnchor");function _(b){return`translate(${b.x}, ${b.y}) rotate(${b.rotation||0})`}n(_,"getTextTransformation"),Ut.debug(`Rendering xychart chart
|
|
7
|
+
`+e);const k=wi(t),P=k.append("g").attr("class","main"),F=P.append("rect").attr("width",l.width).attr("height",l.height).attr("class","background");Ci(k,l.height,l.width,!0),k.attr("viewBox",`0 0 ${l.width} ${l.height}`),F.attr("fill",h.backgroundColor),a.setTmpSVGG(k.append("g").attr("class","mermaid-tmp-group"));const W=a.getDrawableElem(),v={};function z(b){let T=P,c="";for(const[I]of b.entries()){let O=P;I>0&&v[c]&&(O=v[c]),c+=b[I],T=v[c],T||(T=v[c]=O.append("g").attr("class",b[I]))}return T}n(z,"getGroup");for(const b of W){if(b.data.length===0)continue;const T=z(b.groupTexts);switch(b.type){case"rect":if(T.selectAll("rect").data(b.data).enter().append("rect").attr("x",c=>c.x).attr("y",c=>c.y).attr("width",c=>c.width).attr("height",c=>c.height).attr("fill",c=>c.fill).attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth),l.showDataLabel){const c=l.showDataLabelOutsideBar;if(l.chartOrientation==="horizontal"){let I=function(w,M){const{data:R,label:rt}=w;return M*rt.length*O<=R.width-X};n(I,"fitsHorizontally");const O=.7,X=10,N=b.data.map((w,M)=>({data:w,label:y[M].toString()})).filter(w=>w.data.width>0&&w.data.height>0),S=N.map(w=>{const{data:M}=w;let R=M.height*.7;for(;!I(w,R)&&R>0;)R-=1;return R}),H=Math.floor(Math.min(...S)),A=n(w=>c?w.data.x+w.data.width+X:w.data.x+w.data.width-X,"determineLabelXPosition");T.selectAll("text").data(N).enter().append("text").attr("x",A).attr("y",w=>w.data.y+w.data.height/2).attr("text-anchor",c?"start":"end").attr("dominant-baseline","middle").attr("fill",h.dataLabelColor).attr("font-size",`${H}px`).text(w=>w.label)}else{let I=function(A,w,M){const{data:R,label:rt}=A,V=w*rt.length*.7,r=R.x+R.width/2,g=r-V/2,u=r+V/2,x=g>=R.x&&u<=R.x+R.width,C=R.y+M+w<=R.y+R.height;return x&&C};n(I,"fitsInBar");const O=10,X=b.data.map((A,w)=>({data:A,label:y[w].toString()})).filter(A=>A.data.width>0&&A.data.height>0),N=X.map(A=>{const{data:w,label:M}=A;let R=w.width/(M.length*.7);for(;!I(A,R,O)&&R>0;)R-=1;return R}),S=Math.floor(Math.min(...N)),H=n(A=>c?A.data.y-O:A.data.y+O,"determineLabelYPosition");T.selectAll("text").data(X).enter().append("text").attr("x",A=>A.data.x+A.data.width/2).attr("y",H).attr("text-anchor","middle").attr("dominant-baseline",c?"auto":"hanging").attr("fill",h.dataLabelColor).attr("font-size",`${S}px`).text(A=>A.label)}}break;case"text":T.selectAll("text").data(b.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",c=>c.fill).attr("font-size",c=>c.fontSize).attr("dominant-baseline",c=>d(c.verticalPos)).attr("text-anchor",c=>p(c.horizontalPos)).attr("transform",c=>_(c)).text(c=>c.text);break;case"path":T.selectAll("path").data(b.data).enter().append("path").attr("d",c=>c.path).attr("fill",c=>c.fill?c.fill:"none").attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth);break}}},"draw"),Hi={draw:Yi},ji={parser:Di,db:Ni,renderer:Hi};export{ji as diagram};
|
package/controllers/login.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function login(req: ReqType, res: ResType): Promise<void |
|
|
1
|
+
export default function login(req: ReqType, res: ResType): Promise<void | ResType>;
|
package/controllers/login.js
CHANGED
|
@@ -3,7 +3,8 @@ import passwordHash from "password-hash";
|
|
|
3
3
|
import { inertiaLoginHelper } from "../helpers/inertiaAutHelper.js";
|
|
4
4
|
import { Adminizer } from "../lib/Adminizer.js";
|
|
5
5
|
import { signUser } from "../lib/helper/jwt.js";
|
|
6
|
-
import {
|
|
6
|
+
import { clearPretendedUserId, setPretendedUserId } from "../lib/helper/pretend.js";
|
|
7
|
+
import { parse, serialize } from "cookie";
|
|
7
8
|
export default async function login(req, res) {
|
|
8
9
|
const powCaptcha = new POWCaptcha();
|
|
9
10
|
if (req.originalUrl.indexOf("login") >= 0) {
|
|
@@ -23,23 +24,23 @@ export default async function login(req, res) {
|
|
|
23
24
|
return res.status(500).send({ error: e.message || 'Internal Server Error' });
|
|
24
25
|
}
|
|
25
26
|
if (req.body.pretend) {
|
|
26
|
-
|
|
27
|
+
// Checked before the lookup result, so a non-administrator cannot probe logins.
|
|
28
|
+
// While pretending, req.user is the pretended user: pretending further
|
|
29
|
+
// is only possible if that user is an administrator too.
|
|
30
|
+
const authToken = parse(req.headers.cookie || '').adminizer_jwt;
|
|
31
|
+
if (!authToken || !req.user || !req.user.isAdministrator) {
|
|
32
|
+
return res.sendStatus(403);
|
|
33
|
+
}
|
|
34
|
+
if (!user || user.id === undefined) {
|
|
27
35
|
return res.sendStatus(404);
|
|
28
36
|
}
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
// Marked on the server against this token; see lib/helper/pretend.
|
|
38
|
+
setPretendedUserId(authToken, user.id);
|
|
39
|
+
// Force full page reload after pretend
|
|
40
|
+
if (req.headers['x-inertia']) {
|
|
41
|
+
return res.writeHead(409, { 'x-inertia-location': `${req.adminizer.config.routePrefix}/` }).end();
|
|
31
42
|
}
|
|
32
|
-
req.
|
|
33
|
-
return req.session.save((err) => {
|
|
34
|
-
if (err) {
|
|
35
|
-
return res.status(500).send({ error: 'Session save failed' });
|
|
36
|
-
}
|
|
37
|
-
// Force full page reload after pretend
|
|
38
|
-
if (req.headers['x-inertia']) {
|
|
39
|
-
return res.writeHead(409, { 'x-inertia-location': `${req.adminizer.config.routePrefix}/` }).end();
|
|
40
|
-
}
|
|
41
|
-
return res.redirect(`${req.adminizer.config.routePrefix}/`);
|
|
42
|
-
});
|
|
43
|
+
return res.redirect(`${req.adminizer.config.routePrefix}/`);
|
|
43
44
|
}
|
|
44
45
|
// Verify CAPTCHA solution if enabled
|
|
45
46
|
if (req.adminizer.config.auth.captcha !== false) {
|
|
@@ -105,8 +106,8 @@ export default async function login(req, res) {
|
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
else if (req.originalUrl.indexOf("logout") >= 0) {
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
// Logout while pretending only drops the mark: back to the administrator.
|
|
110
|
+
if (clearPretendedUserId(parse(req.headers.cookie || '').adminizer_jwt)) {
|
|
110
111
|
// Force full page reload after unpretend
|
|
111
112
|
if (req.headers['x-inertia']) {
|
|
112
113
|
return res.writeHead(409, { 'x-inertia-location': `${req.adminizer.config.routePrefix}/` }).end();
|
|
@@ -116,6 +116,13 @@ export interface AdminpanelConfig {
|
|
|
116
116
|
brand?: {
|
|
117
117
|
link: boolean | string | HrefConfig;
|
|
118
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* Extra items of the user menu (the dropdown under the user in the
|
|
121
|
+
* sidebar), drawn above «Log out» in every layout context. A context adds
|
|
122
|
+
* its own through `userMenu` of the context. Titles are translated;
|
|
123
|
+
* `accessRightsToken` hides an item from users lacking it.
|
|
124
|
+
*/
|
|
125
|
+
userMenu?: HrefConfig[];
|
|
119
126
|
/**
|
|
120
127
|
* Left-side navigation bar
|
|
121
128
|
* */
|
package/interfaces/global.d.ts
CHANGED
|
@@ -56,6 +56,11 @@ export interface AdminContext {
|
|
|
56
56
|
* inherited as well until `page()` or `menuItem()` adds an item to it.
|
|
57
57
|
*/
|
|
58
58
|
navbar?: "inherit" | AdminContextNavbar;
|
|
59
|
+
/**
|
|
60
|
+
* Items of the user menu (above «Log out»), after the global
|
|
61
|
+
* `config.userMenu`. Left out, a context shows the default context's.
|
|
62
|
+
*/
|
|
63
|
+
userMenu?: HrefConfig[];
|
|
59
64
|
/**
|
|
60
65
|
* Users lacking the token neither see the context in the switcher nor get
|
|
61
66
|
* its shell, and may not open the pages declared to belong to it.
|
|
@@ -65,7 +70,7 @@ export interface AdminContext {
|
|
|
65
70
|
switcher?: boolean;
|
|
66
71
|
}
|
|
67
72
|
/** What may be changed about the built-in context mounted at `routePrefix`. */
|
|
68
|
-
export type DefaultAdminContextOptions = Partial<Pick<AdminContext, "title" | "icon" | "layout" | "navbar" | "switcher" | "home">>;
|
|
73
|
+
export type DefaultAdminContextOptions = Partial<Pick<AdminContext, "title" | "icon" | "layout" | "navbar" | "switcher" | "home" | "userMenu">>;
|
|
69
74
|
/** A page of a context: a route under its prefix, a menu item and breadcrumbs in one call. */
|
|
70
75
|
export interface AdminContextPage<Component = string> {
|
|
71
76
|
/** Unique within the context; also the id of the menu item. */
|
|
@@ -205,6 +210,12 @@ export declare class ContextHandler {
|
|
|
205
210
|
remember(req: ReqType, res: ResType, context: AdminContext): void;
|
|
206
211
|
/** The untranslated menu of a context for this user. */
|
|
207
212
|
listMenuItems(context: AdminContext, user: User): Promise<MenuItem[]>;
|
|
213
|
+
/**
|
|
214
|
+
* The untranslated user-menu items of a context for this user: the global
|
|
215
|
+
* `config.userMenu`, then the context's own (the default context's when it
|
|
216
|
+
* has none), without the ones the user may not open.
|
|
217
|
+
*/
|
|
218
|
+
listUserMenuItems(context: AdminContext, user: User): Promise<HrefConfig[]>;
|
|
208
219
|
getSections(context: AdminContext): Record<string, NavbarSectionConfig>;
|
|
209
220
|
/**
|
|
210
221
|
* The layout of a context with inheritance from the default context
|
|
@@ -239,6 +239,15 @@ export class ContextHandler {
|
|
|
239
239
|
}
|
|
240
240
|
return menu;
|
|
241
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* The untranslated user-menu items of a context for this user: the global
|
|
244
|
+
* `config.userMenu`, then the context's own (the default context's when it
|
|
245
|
+
* has none), without the ones the user may not open.
|
|
246
|
+
*/
|
|
247
|
+
async listUserMenuItems(context, user) {
|
|
248
|
+
const own = context.userMenu ?? (context.id === DEFAULT_ADMIN_CONTEXT_ID ? [] : this.getDefault().userMenu ?? []);
|
|
249
|
+
return filterAccessibleHrefItems(this.adminizer, user, [...(this.adminizer.config.userMenu ?? []), ...own]);
|
|
250
|
+
}
|
|
242
251
|
getSections(context) {
|
|
243
252
|
if (typeof context.navbar === "object")
|
|
244
253
|
return { ...(context.navbar.sections ?? {}) };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function setPretendedUserId(token: string, userId: number): void;
|
|
2
|
+
export declare function getPretendedUserId(token: string | undefined): number | undefined;
|
|
3
|
+
/** Returns whether the token was pretending. */
|
|
4
|
+
export declare function clearPretendedUserId(token: string | undefined): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createHash } from "crypto";
|
|
2
|
+
/**
|
|
3
|
+
* "Pretend to be a user": which auth token is currently acting as which user.
|
|
4
|
+
*
|
|
5
|
+
* Kept in a variable of the process on purpose, not in the session: the session cookie
|
|
6
|
+
* is not issued behind a proxy that terminates https, so a session lives for one request
|
|
7
|
+
* there. The price is that the mark is gone after a restart (the administrator is simply
|
|
8
|
+
* back under their own account) and is not shared between several workers.
|
|
9
|
+
*
|
|
10
|
+
* Keyed by the token, not by the administrator: pretending in one browser must not
|
|
11
|
+
* switch the other logins of the same administrator.
|
|
12
|
+
*/
|
|
13
|
+
const pretendedByToken = new Map();
|
|
14
|
+
/** The token itself is not kept in memory, only its digest. */
|
|
15
|
+
function keyOf(token) {
|
|
16
|
+
return createHash("sha256").update(token).digest("hex");
|
|
17
|
+
}
|
|
18
|
+
export function setPretendedUserId(token, userId) {
|
|
19
|
+
pretendedByToken.set(keyOf(token), userId);
|
|
20
|
+
}
|
|
21
|
+
export function getPretendedUserId(token) {
|
|
22
|
+
return token ? pretendedByToken.get(keyOf(token)) : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Returns whether the token was pretending. */
|
|
25
|
+
export function clearPretendedUserId(token) {
|
|
26
|
+
return token ? pretendedByToken.delete(keyOf(token)) : false;
|
|
27
|
+
}
|
package/package.json
CHANGED
package/system/bindInertia.js
CHANGED
|
@@ -177,7 +177,7 @@ export function bindInertia(adminizer) {
|
|
|
177
177
|
}
|
|
178
178
|
req.Inertia.shareProps({
|
|
179
179
|
auth: {
|
|
180
|
-
user: toPublicUser(req.
|
|
180
|
+
user: toPublicUser(req.user)
|
|
181
181
|
},
|
|
182
182
|
routePrefix: req.adminizer.config.routePrefix,
|
|
183
183
|
i18n: {
|
|
@@ -190,6 +190,11 @@ export function bindInertia(adminizer) {
|
|
|
190
190
|
adminContexts: async () => (await resolveContext()).contexts
|
|
191
191
|
.filter((item) => item.switcher !== false)
|
|
192
192
|
.map(contextProps),
|
|
193
|
+
// Extra items of the user menu (config.userMenu + the context's userMenu).
|
|
194
|
+
userMenu: async () => req.user
|
|
195
|
+
? (await adminizer.contextHandler.listUserMenuItems((await resolveContext()).context, req.user))
|
|
196
|
+
.map((item) => ({ id: item.id, title: req.i18n.__(item.title), link: item.link, type: item.type, icon: item.icon ?? null }))
|
|
197
|
+
: [],
|
|
193
198
|
// Auto breadcrumbs. A function prop is evaluated by the Inertia
|
|
194
199
|
// adapter only when the key is rendered and only when the page did
|
|
195
200
|
// not send `breadcrumbs` of its own — page props override shared
|
|
@@ -2,6 +2,7 @@ import { Adminizer } from "../lib/Adminizer.js";
|
|
|
2
2
|
import { I18n } from "../lib/I18n.js";
|
|
3
3
|
import { parse } from "cookie";
|
|
4
4
|
import { verifyUser } from "../lib/helper/jwt.js";
|
|
5
|
+
import { getPretendedUserId } from "../lib/helper/pretend.js";
|
|
5
6
|
const ADMINIZER_REQUEST_DEPRECATION_MESSAGE = "req.adminizer is deprecated and will no longer be available starting with Adminizer v6. Use req.runtime instead.";
|
|
6
7
|
export function createDeprecatedAdminizerProxy(adminizer, warn = (message) => Adminizer.log.warn(message)) {
|
|
7
8
|
let warned = false;
|
|
@@ -64,12 +65,20 @@ export default function bindReqFunctions(adminizer) {
|
|
|
64
65
|
const user = verifyUser(token, adminizer.jwtSecret);
|
|
65
66
|
if (user) {
|
|
66
67
|
// Load user with groups (Sequelize adapter auto-populates associations in _findOne)
|
|
67
|
-
|
|
68
|
+
const userModel = adminizer.modelHandler.internal("auth").get("User");
|
|
69
|
+
req.user = await userModel.findOne({ where: { id: user.id } });
|
|
70
|
+
// "Pretend to be a user": this token may be marked as acting as another user.
|
|
71
|
+
// Both users are read from the database on every request, so the mark stops
|
|
72
|
+
// working as soon as the administrator loses the flag or the user is removed.
|
|
73
|
+
const pretendedUserId = getPretendedUserId(token);
|
|
74
|
+
if (pretendedUserId !== undefined && req.user?.isAdministrator) {
|
|
75
|
+
const pretended = await userModel.findOne({ where: { id: pretendedUserId } });
|
|
76
|
+
if (pretended) {
|
|
77
|
+
req.user = pretended;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
|
-
if (req.session.userPretended) {
|
|
71
|
-
req.user = req.session.userPretended;
|
|
72
|
-
}
|
|
73
82
|
if (typeof adminizer.config.translation !== "boolean" && req.i18n?.setLocale) {
|
|
74
83
|
const configuredLocales = adminizer.config.translation?.locales || [];
|
|
75
84
|
const normalizeLocale = (value) => {
|