@marimo-team/frontend 0.13.1-dev9 → 0.13.2-dev3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-Bq_VgIpU.js → ConnectedDataExplorerComponent-Dq_Tdxnu.js} +3 -3
- package/dist/assets/{VegaLite-Bo7xvKwV.js → VegaLite-tL3m5XVX.js} +2 -2
- package/dist/assets/_baseEach-BbaGBH6b.js +1 -0
- package/dist/assets/_baseMap-Dhykr5mK.js +1 -0
- package/dist/assets/_baseUniq-DwI7aCVR.js +1 -0
- package/dist/assets/_createAggregator-Ch46xhpY.js +1 -0
- package/dist/assets/{any-language-editor-B7p4bMHf.js → any-language-editor-Dyuzp2aA.js} +1 -1
- package/dist/assets/{architectureDiagram-IEHRJDOE-DuNgL5JP.js → architectureDiagram-IEHRJDOE-BwHxLqFy.js} +1 -1
- package/dist/assets/{blockDiagram-JOT3LUYC-nwvofaQ6.js → blockDiagram-JOT3LUYC-CpbiNf54.js} +1 -1
- package/dist/assets/{c4Diagram-VJAJSXHY-CczKKibc.js → c4Diagram-VJAJSXHY-BZ_DR6_B.js} +1 -1
- package/dist/assets/channel-KKnVogjf.js +1 -0
- package/dist/assets/{chunk-4BMEZGHF-SaugYair.js → chunk-4BMEZGHF-DD-xkyBA.js} +1 -1
- package/dist/assets/{chunk-A2AXSNBT-1SCSHWtk.js → chunk-A2AXSNBT-DWgYxA6-.js} +1 -1
- package/dist/assets/{chunk-AEK57VVT-LPkfZaVy.js → chunk-AEK57VVT-Cbq3fTiz.js} +1 -1
- package/dist/assets/{chunk-D6G4REZN-CMW2vGYf.js → chunk-D6G4REZN-CZ1gVegu.js} +1 -1
- package/dist/assets/{chunk-RZ5BOZE2-D3Khvkaf.js → chunk-RZ5BOZE2-D_iX56cm.js} +1 -1
- package/dist/assets/{chunk-XZIHB7SX-DxuOwhbL.js → chunk-XZIHB7SX-RKqzOsP6.js} +1 -1
- package/dist/assets/{circle-play-CO2gy8ab.js → circle-play-DA5m954p.js} +1 -1
- package/dist/assets/classDiagram-GIVACNV2-I0bXHj9f.js +1 -0
- package/dist/assets/classDiagram-v2-COTLJTTW-I0bXHj9f.js +1 -0
- package/dist/assets/clone-DDJrKwkg.js +1 -0
- package/dist/assets/{compile-Dgd9eU8p.js → compile-BnTi-jLK.js} +1 -1
- package/dist/assets/{dagre-OKDRZEBW-DnKbB2sE.js → dagre-OKDRZEBW-Dx7cHZR3.js} +1 -1
- package/dist/assets/data-editor-CE8Jl2Lx.js +1 -0
- package/dist/assets/{diagram-SSKATNLV-DIUNbzW8.js → diagram-SSKATNLV-1QoftnEP.js} +1 -1
- package/dist/assets/{diagram-VNBRO52H-nTcAF3yR.js → diagram-VNBRO52H-CpksamPY.js} +1 -1
- package/dist/assets/edit-page-BpPQnKSC.js +8 -0
- package/dist/assets/{erDiagram-Q7BY3M3F-B_Ou1L_N.js → erDiagram-Q7BY3M3F-B1vdB-QF.js} +1 -1
- package/dist/assets/{flowDiagram-4HSFHLVR-BKJVGgr8.js → flowDiagram-4HSFHLVR-Bk-fMHax.js} +1 -1
- package/dist/assets/{ganttDiagram-APWFNJXF-XHfSZlsk.js → ganttDiagram-APWFNJXF-C2umrQIo.js} +1 -1
- package/dist/assets/{gitGraphDiagram-7IBYFJ6S-BWa6X55G.js → gitGraphDiagram-7IBYFJ6S-e_fHhekq.js} +1 -1
- package/dist/assets/{graph-vL7TN2GK.js → graph-BNQTUVgt.js} +1 -1
- package/dist/assets/{home-page-awvkvMSH.js → home-page-BMdPEpeH.js} +2 -2
- package/dist/assets/{index-WPk7q7oz.js → index-8GUCLGOC.js} +1 -1
- package/dist/assets/index-BKN3-Jbd.js +1 -0
- package/dist/assets/{index-CYQKwUsI.js → index-BR31dY1Y.js} +1 -1
- package/dist/assets/index-CBYlZPe-.js +79 -0
- package/dist/assets/{index-1sVADZoz.js → index-D0ws5d87.js} +1 -1
- package/dist/assets/{index-CuiSbb8h.js → index-D7t9lGhi.js} +1 -1
- package/dist/assets/index-DAadTlZB.js +1 -0
- package/dist/assets/{index-BwzwaBGa.js → index-DC-7Pye5.js} +1 -1
- package/dist/assets/{index-BJb4-zwn.js → index-DELon3O0.js} +1 -1
- package/dist/assets/{index-D6izodNI.js → index-DN7hnjTF.js} +1 -1
- package/dist/assets/index-DQ-mLFwY.css +1 -0
- package/dist/assets/{index-CirH6K9J.js → index-DSfAeyoS.js} +1 -1
- package/dist/assets/index-Df9lAQea.js +1 -0
- package/dist/assets/index-DfWmnnlJ.js +1 -0
- package/dist/assets/{index-jD9j3yLZ.js → index-F7ylV5xL.js} +1 -1
- package/dist/assets/{index-BmpfsiQp.js → index-IGOuIS_r.js} +1 -1
- package/dist/assets/{index-KOTN0Ix1.js → index-h_TP-WMN.js} +1 -1
- package/dist/assets/{index-jcm5oShO.js → index-rUJBrbw2.js} +1 -1
- package/dist/assets/index-wDsvO-_0.js +1 -0
- package/dist/assets/infoDiagram-PH2N3AL5-CDJ4_F80.js +1 -0
- package/dist/assets/{journeyDiagram-U35MCT3I-CKCqq8gm.js → journeyDiagram-U35MCT3I-Bp5eSwtQ.js} +1 -1
- package/dist/assets/{kanban-definition-NDS4AKOZ-CKtDvlWQ.js → kanban-definition-NDS4AKOZ-DYabXGYw.js} +1 -1
- package/dist/assets/{layout-Y5Qfqyxn.js → layout-Ciq0LIT4.js} +1 -1
- package/dist/assets/{linear-D9PajNQl.js → linear-xxzP0NOE.js} +1 -1
- package/dist/assets/{mermaid-uo9TLHWr.js → mermaid-CuLRZCyq.js} +3 -3
- package/dist/assets/min-BGzKxLRu.js +1 -0
- package/dist/assets/{mindmap-definition-ALO5MXBD-D8AO3cdJ.js → mindmap-definition-ALO5MXBD-CoP-KhTm.js} +1 -1
- package/dist/assets/{pieDiagram-IB7DONF6-CQE84tPa.js → pieDiagram-IB7DONF6-Dd9yoqpC.js} +1 -1
- package/dist/assets/{quadrantDiagram-7GDLP6J5-DJXihUR5.js → quadrantDiagram-7GDLP6J5-Bgd9A6oL.js} +1 -1
- package/dist/assets/{radar-MK3ICKWK-BXg6jrNT.js → radar-MK3ICKWK-BVDhd2Ix.js} +1 -1
- package/dist/assets/{react-plotly-1eDUvRY9.js → react-plotly-B5H0McW6.js} +1 -1
- package/dist/assets/{requirementDiagram-KVF5MWMF-kZxLz3XY.js → requirementDiagram-KVF5MWMF-CR5kd9XE.js} +1 -1
- package/dist/assets/run-page-C10rssTu.js +1 -0
- package/dist/assets/{sankeyDiagram-QLVOVGJD-C8adyrIi.js → sankeyDiagram-QLVOVGJD-C-_1WukJ.js} +1 -1
- package/dist/assets/{sequenceDiagram-X6HHIX6F-BkfeTPAG.js → sequenceDiagram-X6HHIX6F-DU2h9iy-.js} +1 -1
- package/dist/assets/slides-component-BcKrBrax.js +1 -0
- package/dist/assets/sortBy-frwTH6Xi.js +1 -0
- package/dist/assets/{stateDiagram-DGXRK772-DOPNJppg.js → stateDiagram-DGXRK772-DUQjBbaH.js} +1 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-gxsQGVf9.js +1 -0
- package/dist/assets/{terminal-5TdYl-XL.js → terminal-DPm5wxuG.js} +1 -1
- package/dist/assets/time-BaboqOAs.js +1 -0
- package/dist/assets/{timeline-definition-BDJGKUSR-B3A4OGp0.js → timeline-definition-BDJGKUSR-BVWZZyJi.js} +1 -1
- package/dist/assets/{tracing-CsFPUs6f.js → tracing-DRLx-Gc7.js} +3 -3
- package/dist/assets/tree-BFulurPc.js +8 -0
- package/dist/assets/{useMarimoWebSocket-Cu69Y6bO.js → useMarimoWebSocket-BWqeReBq.js} +4 -4
- package/dist/assets/vega-component-BZAojS_v.js +1 -0
- package/dist/assets/{xychartDiagram-VJFVF3MP-UCqpYY1Y.js → xychartDiagram-VJFVF3MP-CyOgHs8-.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +7 -6
- package/dist/assets/_baseEach-Bs4xWtI7.js +0 -1
- package/dist/assets/_baseMap-B3hk2zt0.js +0 -1
- package/dist/assets/_baseUniq-BQlu1urX.js +0 -1
- package/dist/assets/_createAggregator-DnQCfU4N.js +0 -1
- package/dist/assets/channel-CNUnqU_r.js +0 -1
- package/dist/assets/chart-spec-DLgsAYWA.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-Bsg2u2kP.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-Bsg2u2kP.js +0 -1
- package/dist/assets/clone-vc-e9h6v.js +0 -1
- package/dist/assets/data-editor-CKJqadUq.js +0 -1
- package/dist/assets/edit-page-DTdGaOv3.js +0 -8
- package/dist/assets/index-B7XBqr52.js +0 -1
- package/dist/assets/index-BYpFD5y3.css +0 -1
- package/dist/assets/index-BdbB3TXR.js +0 -1
- package/dist/assets/index-BgXba7q5.js +0 -1
- package/dist/assets/index-Cp9clns9.js +0 -79
- package/dist/assets/index-D4JI66Es.js +0 -1
- package/dist/assets/infoDiagram-PH2N3AL5-DgN8rtUm.js +0 -1
- package/dist/assets/min-CzfQZWDV.js +0 -1
- package/dist/assets/run-page-B0khdWn3.js +0 -1
- package/dist/assets/slides-component-CiGLo8z7.js +0 -1
- package/dist/assets/sortBy-vaTw-Lkk.js +0 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-Dl9g8isk.js +0 -1
- package/dist/assets/time-TZAnUVTH.js +0 -1
- package/dist/assets/tree-dblc4J78.js +0 -8
- package/dist/assets/vega-component-B1Qccxkz.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./index-CBYlZPe-.js";const s=e=>e.flatMap(t),t=e=>T(n(e)).map(r),r=e=>e.replace(/ +/g," ").trim(),n=e=>({type:"mandatory_block",items:E(e,0)[0]}),E=(e,s,t)=>{const r=[];for(;e[s];){const[n,E]=i(e,s);if(r.push(n),"|"!==e[s=E]){if("}"===e[s]||"]"===e[s]){if(t!==e[s])throw new Error(`Unbalanced parenthesis in: ${e}`);return[r,++s]}if(s===e.length){if(t)throw new Error(`Unbalanced parenthesis in: ${e}`);return[r,s]}throw new Error(`Unexpected "${e[s]}"`)}s++}return[r,s]},i=(e,s)=>{const t=[];for(;;){const[r,n]=a(e,s);if(!r)break;t.push(r),s=n}return 1===t.length?[t[0],s]:[{type:"concatenation",items:t},s]},a=(e,s)=>{if("{"===e[s])return o(e,s+1);if("["===e[s])return _(e,s+1);{let t="";for(;e[s]&&/[A-Za-z0-9_ ]/.test(e[s]);)t+=e[s],s++;return[t,s]}},o=(e,s)=>{const[t,r]=E(e,s,"}");return[{type:"mandatory_block",items:t},r]},_=(e,s)=>{const[t,r]=E(e,s,"]");return[{type:"optional_block",items:t},r]},T=e=>{if("string"==typeof e)return[e];if("concatenation"===e.type)return e.items.map(T).reduce(l,[""]);if("mandatory_block"===e.type)return e.items.flatMap(T);if("optional_block"===e.type)return["",...e.items.flatMap(T)];throw new Error(`Unknown node type: ${e}`)},l=(e,s)=>{const t=[];for(const r of e)for(const e of s)t.push(r+e);return t};var R,A;(A=R=R||(R={})).QUOTED_IDENTIFIER="QUOTED_IDENTIFIER",A.IDENTIFIER="IDENTIFIER",A.STRING="STRING",A.VARIABLE="VARIABLE",A.RESERVED_DATA_TYPE="RESERVED_DATA_TYPE",A.RESERVED_PARAMETERIZED_DATA_TYPE="RESERVED_PARAMETERIZED_DATA_TYPE",A.RESERVED_KEYWORD="RESERVED_KEYWORD",A.RESERVED_FUNCTION_NAME="RESERVED_FUNCTION_NAME",A.RESERVED_PHRASE="RESERVED_PHRASE",A.RESERVED_SET_OPERATION="RESERVED_SET_OPERATION",A.RESERVED_CLAUSE="RESERVED_CLAUSE",A.RESERVED_SELECT="RESERVED_SELECT",A.RESERVED_JOIN="RESERVED_JOIN",A.ARRAY_IDENTIFIER="ARRAY_IDENTIFIER",A.ARRAY_KEYWORD="ARRAY_KEYWORD",A.CASE="CASE",A.END="END",A.WHEN="WHEN",A.ELSE="ELSE",A.THEN="THEN",A.LIMIT="LIMIT",A.BETWEEN="BETWEEN",A.AND="AND",A.OR="OR",A.XOR="XOR",A.OPERATOR="OPERATOR",A.COMMA="COMMA",A.ASTERISK="ASTERISK",A.PROPERTY_ACCESS_OPERATOR="PROPERTY_ACCESS_OPERATOR",A.OPEN_PAREN="OPEN_PAREN",A.CLOSE_PAREN="CLOSE_PAREN",A.LINE_COMMENT="LINE_COMMENT",A.BLOCK_COMMENT="BLOCK_COMMENT",A.DISABLE_COMMENT="DISABLE_COMMENT",A.NUMBER="NUMBER",A.NAMED_PARAMETER="NAMED_PARAMETER",A.QUOTED_PARAMETER="QUOTED_PARAMETER",A.NUMBERED_PARAMETER="NUMBERED_PARAMETER",A.POSITIONAL_PARAMETER="POSITIONAL_PARAMETER",A.CUSTOM_PARAMETER="CUSTOM_PARAMETER",A.DELIMITER="DELIMITER",A.EOF="EOF";const p=e=>({type:R.EOF,raw:"«EOF»",text:"«EOF»",start:e});p(1/0);const S=e=>s=>s.type===e.type&&s.text===e.text;S({text:"ARRAY",type:R.RESERVED_DATA_TYPE}),S({text:"BY",type:R.RESERVED_KEYWORD}),S({text:"SET",type:R.RESERVED_CLAUSE}),S({text:"STRUCT",type:R.RESERVED_DATA_TYPE}),S({text:"WINDOW",type:R.RESERVED_CLAUSE}),S({text:"VALUES",type:R.RESERVED_CLAUSE});const I=s(["SELECT [ALL | DISTINCT]"]),N=s(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY [ALL]","HAVING","WINDOW","PARTITION BY","ORDER BY [ALL]","LIMIT","OFFSET","USING SAMPLE","QUALIFY","INSERT [OR REPLACE] INTO","VALUES","DEFAULT VALUES","SET","RETURNING"]),c=s(["CREATE [OR REPLACE] [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"]),m=s(["UPDATE","ON CONFLICT","DELETE FROM","DROP TABLE [IF EXISTS]","TRUNCATE","ALTER TABLE","ADD [COLUMN] [IF NOT EXISTS]","ADD PRIMARY KEY","DROP [COLUMN] [IF EXISTS]","ALTER [COLUMN]","RENAME [COLUMN]","RENAME TO","SET [DATA] TYPE","{SET | DROP} DEFAULT","{SET | DROP} NOT NULL","CREATE [OR REPLACE] [TEMPORARY | TEMP] {MACRO | FUNCTION}","DROP MACRO [TABLE] [IF EXISTS]","DROP FUNCTION [IF EXISTS]","CREATE [UNIQUE] INDEX [IF NOT EXISTS]","DROP INDEX [IF EXISTS]","CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS]","DROP SCHEMA [IF EXISTS]","CREATE [OR REPLACE] [PERSISTENT | TEMPORARY] SECRET [IF NOT EXISTS]","DROP [PERSISTENT | TEMPORARY] SECRET [IF EXISTS]","CREATE [OR REPLACE] [TEMPORARY | TEMP] SEQUENCE","DROP SEQUENCE [IF EXISTS]","CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]","DROP VIEW [IF EXISTS]","ALTER VIEW","CREATE TYPE","DROP TYPE [IF EXISTS]","ANALYZE","ATTACH [DATABASE] [IF NOT EXISTS]","DETACH [DATABASE] [IF EXISTS]","CALL","[FORCE] CHECKPOINT","COMMENT ON [TABLE | COLUMN | VIEW | INDEX | SEQUENCE | TYPE | MACRO | MACRO TABLE]","COPY [FROM DATABASE]","DESCRIBE","EXPORT DATABASE","IMPORT DATABASE","INSTALL","LOAD","PIVOT","PIVOT_WIDER","UNPIVOT","EXPLAIN [ANALYZE]","SET {LOCAL | SESSION | GLOBAL}","RESET [LOCAL | SESSION | GLOBAL]","{SET | RESET} VARIABLE","SUMMARIZE","BEGIN TRANSACTION","ROLLBACK","COMMIT","ABORT","USE","VACUUM [ANALYZE]","PREPARE","EXECUTE","DEALLOCATE [PREPARE]"]),h=s(["UNION [ALL | BY NAME]","EXCEPT [ALL]","INTERSECT [ALL]"]),u=s(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","{NATURAL | ASOF} [INNER] JOIN","{NATURAL | ASOF} {LEFT | RIGHT | FULL} [OUTER] JOIN","POSITIONAL JOIN","ANTI JOIN","SEMI JOIN"]),O=s(["{ROWS | RANGE | GROUPS} BETWEEN","SIMILAR TO","IS [NOT] DISTINCT FROM","TIMESTAMP WITH TIME ZONE"]),y={name:"duckdb",tokenizerOptions:{reservedSelect:I,reservedClauses:[...N,...c,...m],reservedSetOperations:h,reservedJoins:u,reservedPhrases:O,supportsXor:!0,reservedKeywords:["ALL","ANALYSE","ANALYZE","AND","ANY","AS","ASC","ATTACH","ASYMMETRIC","BOTH","CASE","CAST","CHECK","COLLATE","COLUMN","CONSTRAINT","CREATE","DEFAULT","DEFERRABLE","DESC","DESCRIBE","DETACH","DISTINCT","DO","ELSE","END","EXCEPT","FALSE","FETCH","FOR","FOREIGN","FROM","GRANT","GROUP","HAVING","IN","INITIALLY","INTERSECT","INTO","LATERAL","LEADING","LIMIT","NOT","NULL","OFFSET","ON","ONLY","OR","ORDER","PIVOT","PIVOT_LONGER","PIVOT_WIDER","PLACING","PRIMARY","REFERENCES","RETURNING","SELECT","SHOW","SOME","SUMMARIZE","SYMMETRIC","TABLE","THEN","TO","TRAILING","TRUE","UNION","UNIQUE","UNPIVOT","USING","VARIADIC","WHEN","WHERE","WINDOW","WITH"],reservedDataTypes:["ARRAY","BIGINT","BINARY","BIT","BITSTRING","BLOB","BOOL","BOOLEAN","BPCHAR","BYTEA","CHAR","DATE","DATETIME","DEC","DECIMAL","DOUBLE","ENUM","FLOAT","FLOAT4","FLOAT8","GUID","HUGEINT","INET","INT","INT1","INT128","INT16","INT2","INT32","INT4","INT64","INT8","INTEGER","INTEGRAL","INTERVAL","JSON","LIST","LOGICAL","LONG","MAP","NUMERIC","NVARCHAR","OID","REAL","ROW","SHORT","SIGNED","SMALLINT","STRING","STRUCT","TEXT","TIME","TIMESTAMP_MS","TIMESTAMP_NS","TIMESTAMP_S","TIMESTAMP_US","TIMESTAMP","TIMESTAMPTZ","TIMETZ","TINYINT","UBIGINT","UHUGEINT","UINT128","UINT16","UINT32","UINT64","UINT8","UINTEGER","UNION","USMALLINT","UTINYINT","UUID","VARBINARY","VARCHAR"],reservedFunctionNames:["ABS","ACOS","ADD","ADD_PARQUET_KEY","AGE","AGGREGATE","ALIAS","ALL_PROFILING_OUTPUT","ANY_VALUE","APPLY","APPROX_COUNT_DISTINCT","APPROX_QUANTILE","ARBITRARY","ARGMAX","ARGMIN","ARG_MAX","ARG_MAX_NULL","ARG_MIN","ARG_MIN_NULL","ARRAY_AGG","ARRAY_AGGR","ARRAY_AGGREGATE","ARRAY_APPEND","ARRAY_APPLY","ARRAY_CAT","ARRAY_CONCAT","ARRAY_CONTAINS","ARRAY_COSINE_SIMILARITY","ARRAY_CROSS_PRODUCT","ARRAY_DISTANCE","ARRAY_DISTINCT","ARRAY_DOT_PRODUCT","ARRAY_EXTRACT","ARRAY_FILTER","ARRAY_GRADE_UP","ARRAY_HAS","ARRAY_HAS_ALL","ARRAY_HAS_ANY","ARRAY_INDEXOF","ARRAY_INNER_PRODUCT","ARRAY_INTERSECT","ARRAY_LENGTH","ARRAY_POP_BACK","ARRAY_POP_FRONT","ARRAY_POSITION","ARRAY_PREPEND","ARRAY_PUSH_BACK","ARRAY_PUSH_FRONT","ARRAY_REDUCE","ARRAY_RESIZE","ARRAY_REVERSE","ARRAY_REVERSE_SORT","ARRAY_SELECT","ARRAY_SLICE","ARRAY_SORT","ARRAY_TO_JSON","ARRAY_TO_STRING","ARRAY_TRANSFORM","ARRAY_UNIQUE","ARRAY_VALUE","ARRAY_WHERE","ARRAY_ZIP","ARROW_SCAN","ARROW_SCAN_DUMB","ASCII","ASIN","ATAN","ATAN2","AVG","BASE64","BIN","BITSTRING","BITSTRING_AGG","BIT_AND","BIT_COUNT","BIT_LENGTH","BIT_OR","BIT_POSITION","BIT_XOR","BOOL_AND","BOOL_OR","CARDINALITY","CBRT","CEIL","CEILING","CENTURY","CHECKPOINT","CHR","COLLATIONS","COL_DESCRIPTION","COMBINE","CONCAT","CONCAT_WS","CONSTANT_OR_NULL","CONTAINS","COPY_DATABASE","CORR","COS","COT","COUNT","COUNT_IF","COUNT_STAR","COVAR_POP","COVAR_SAMP","CREATE_SORT_KEY","CURRENT_CATALOG","CURRENT_DATABASE","CURRENT_DATE","CURRENT_LOCALTIME","CURRENT_LOCALTIMESTAMP","CURRENT_QUERY","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SCHEMAS","CURRENT_SETTING","CURRENT_USER","CURRVAL","DAMERAU_LEVENSHTEIN","DATABASE_LIST","DATABASE_SIZE","DATEDIFF","DATEPART","DATESUB","DATETRUNC","DATE_ADD","DATE_DIFF","DATE_PART","DATE_SUB","DATE_TRUNC","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DECADE","DECODE","DEGREES","DISABLE_CHECKPOINT_ON_SHUTDOWN","DISABLE_OBJECT_CACHE","DISABLE_OPTIMIZER","DISABLE_PRINT_PROGRESS_BAR","DISABLE_PROFILE","DISABLE_PROFILING","DISABLE_PROGRESS_BAR","DISABLE_VERIFICATION","DISABLE_VERIFY_EXTERNAL","DISABLE_VERIFY_FETCH_ROW","DISABLE_VERIFY_PARALLELISM","DISABLE_VERIFY_SERIALIZER","DIVIDE","DUCKDB_COLUMNS","DUCKDB_CONSTRAINTS","DUCKDB_DATABASES","DUCKDB_DEPENDENCIES","DUCKDB_EXTENSIONS","DUCKDB_FUNCTIONS","DUCKDB_INDEXES","DUCKDB_KEYWORDS","DUCKDB_MEMORY","DUCKDB_OPTIMIZERS","DUCKDB_SCHEMAS","DUCKDB_SECRETS","DUCKDB_SEQUENCES","DUCKDB_SETTINGS","DUCKDB_TABLES","DUCKDB_TEMPORARY_FILES","DUCKDB_TYPES","DUCKDB_VIEWS","EDIT","EDITDIST3","ELEMENT_AT","ENABLE_CHECKPOINT_ON_SHUTDOWN","ENABLE_OBJECT_CACHE","ENABLE_OPTIMIZER","ENABLE_PRINT_PROGRESS_BAR","ENABLE_PROFILE","ENABLE_PROFILING","ENABLE_PROGRESS_BAR","ENABLE_VERIFICATION","ENCODE","ENDS_WITH","ENTROPY","ENUM_CODE","ENUM_FIRST","ENUM_LAST","ENUM_RANGE","ENUM_RANGE_BOUNDARY","EPOCH","EPOCH_MS","EPOCH_NS","EPOCH_US","ERA","ERROR","EVEN","EXP","FACTORIAL","FAVG","FDIV","FILTER","FINALIZE","FIRST","FLATTEN","FLOOR","FMOD","FORCE_CHECKPOINT","FORMAT","FORMATREADABLEDECIMALSIZE","FORMATREADABLESIZE","FORMAT_BYTES","FORMAT_PG_TYPE","FORMAT_TYPE","FROM_BASE64","FROM_BINARY","FROM_HEX","FROM_JSON","FROM_JSON_STRICT","FSUM","FUNCTIONS","GAMMA","GCD","GENERATE_SERIES","GENERATE_SUBSCRIPTS","GEN_RANDOM_UUID","GEOMEAN","GEOMETRIC_MEAN","GETENV","GET_BIT","GET_BLOCK_SIZE","GET_CURRENT_TIME","GET_CURRENT_TIMESTAMP","GLOB","GRADE_UP","GREATEST","GREATEST_COMMON_DIVISOR","GROUP_CONCAT","HAMMING","HASH","HAS_ANY_COLUMN_PRIVILEGE","HAS_COLUMN_PRIVILEGE","HAS_DATABASE_PRIVILEGE","HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE","HAS_FUNCTION_PRIVILEGE","HAS_LANGUAGE_PRIVILEGE","HAS_SCHEMA_PRIVILEGE","HAS_SEQUENCE_PRIVILEGE","HAS_SERVER_PRIVILEGE","HAS_TABLESPACE_PRIVILEGE","HAS_TABLE_PRIVILEGE","HEX","HISTOGRAM","HOUR","ICU_CALENDAR_NAMES","ICU_SORT_KEY","ILIKE_ESCAPE","IMPORT_DATABASE","INDEX_SCAN","INET_CLIENT_ADDR","INET_CLIENT_PORT","INET_SERVER_ADDR","INET_SERVER_PORT","INSTR","IN_SEARCH_PATH","ISFINITE","ISINF","ISNAN","ISODOW","ISOYEAR","JACCARD","JARO_SIMILARITY","JARO_WINKLER_SIMILARITY","JSON_ARRAY","JSON_ARRAY_LENGTH","JSON_CONTAINS","JSON_DESERIALIZE_SQL","JSON_EXECUTE_SERIALIZED_SQL","JSON_EXTRACT","JSON_EXTRACT_PATH","JSON_EXTRACT_PATH_TEXT","JSON_EXTRACT_STRING","JSON_GROUP_ARRAY","JSON_GROUP_OBJECT","JSON_GROUP_STRUCTURE","JSON_KEYS","JSON_MERGE_PATCH","JSON_OBJECT","JSON_QUOTE","JSON_SERIALIZE_PLAN","JSON_SERIALIZE_SQL","JSON_STRUCTURE","JSON_TRANSFORM","JSON_TRANSFORM_STRICT","JSON_TYPE","JSON_VALID","JULIAN","KAHAN_SUM","KURTOSIS","KURTOSIS_POP","LAST","LAST_DAY","LCASE","LCM","LEAST","LEAST_COMMON_MULTIPLE","LEFT","LEFT_GRAPHEME","LEN","LENGTH","LENGTH_GRAPHEME","LEVENSHTEIN","LGAMMA","LIKE_ESCAPE","LIST","LISTAGG","LIST_AGGR","LIST_AGGREGATE","LIST_ANY_VALUE","LIST_APPEND","LIST_APPLY","LIST_APPROX_COUNT_DISTINCT","LIST_AVG","LIST_BIT_AND","LIST_BIT_OR","LIST_BIT_XOR","LIST_BOOL_AND","LIST_BOOL_OR","LIST_CAT","LIST_CONCAT","LIST_CONTAINS","LIST_COSINE_SIMILARITY","LIST_COUNT","LIST_DISTANCE","LIST_DISTINCT","LIST_DOT_PRODUCT","LIST_ELEMENT","LIST_ENTROPY","LIST_EXTRACT","LIST_FILTER","LIST_FIRST","LIST_GRADE_UP","LIST_HAS","LIST_HAS_ALL","LIST_HAS_ANY","LIST_HISTOGRAM","LIST_INDEXOF","LIST_INNER_PRODUCT","LIST_INTERSECT","LIST_KURTOSIS","LIST_KURTOSIS_POP","LIST_LAST","LIST_MAD","LIST_MAX","LIST_MEDIAN","LIST_MIN","LIST_MODE","LIST_PACK","LIST_POSITION","LIST_PREPEND","LIST_PRODUCT","LIST_REDUCE","LIST_RESIZE","LIST_REVERSE","LIST_REVERSE_SORT","LIST_SELECT","LIST_SEM","LIST_SKEWNESS","LIST_SLICE","LIST_SORT","LIST_STDDEV_POP","LIST_STDDEV_SAMP","LIST_STRING_AGG","LIST_SUM","LIST_TRANSFORM","LIST_UNIQUE","LIST_VALUE","LIST_VAR_POP","LIST_VAR_SAMP","LIST_WHERE","LIST_ZIP","LN","LOG","LOG10","LOG2","LOWER","LPAD","LSMODE","LTRIM","MAD","MAKE_DATE","MAKE_TIME","MAKE_TIMESTAMP","MAKE_TIMESTAMPTZ","MAP","MAP_CONCAT","MAP_ENTRIES","MAP_EXTRACT","MAP_FROM_ENTRIES","MAP_KEYS","MAP_VALUES","MAX","MAX_BY","MD5","MD5_NUMBER","MD5_NUMBER_LOWER","MD5_NUMBER_UPPER","MEAN","MEDIAN","METADATA_INFO","MICROSECOND","MILLENNIUM","MILLISECOND","MIN","MINUTE","MIN_BY","MISMATCHES","MOD","MODE","MONTH","MONTHNAME","MULTIPLY","NEXTAFTER","NEXTVAL","NFC_NORMALIZE","NOT_ILIKE_ESCAPE","NOT_LIKE_ESCAPE","NOW","NULLIF","OBJ_DESCRIPTION","OCTET_LENGTH","ORD","PARQUET_FILE_METADATA","PARQUET_KV_METADATA","PARQUET_METADATA","PARQUET_SCAN","PARQUET_SCHEMA","PARSE_DIRNAME","PARSE_DIRPATH","PARSE_FILENAME","PARSE_PATH","PG_COLLATION_IS_VISIBLE","PG_CONF_LOAD_TIME","PG_CONVERSION_IS_VISIBLE","PG_FUNCTION_IS_VISIBLE","PG_GET_CONSTRAINTDEF","PG_GET_EXPR","PG_GET_VIEWDEF","PG_HAS_ROLE","PG_IS_OTHER_TEMP_SCHEMA","PG_MY_TEMP_SCHEMA","PG_OPCLASS_IS_VISIBLE","PG_OPERATOR_IS_VISIBLE","PG_OPFAMILY_IS_VISIBLE","PG_POSTMASTER_START_TIME","PG_SIZE_PRETTY","PG_TABLE_IS_VISIBLE","PG_TIMEZONE_NAMES","PG_TS_CONFIG_IS_VISIBLE","PG_TS_DICT_IS_VISIBLE","PG_TS_PARSER_IS_VISIBLE","PG_TS_TEMPLATE_IS_VISIBLE","PG_TYPEOF","PG_TYPE_IS_VISIBLE","PI","PLATFORM","POSITION","POW","POWER","PRAGMA_COLLATIONS","PRAGMA_DATABASE_SIZE","PRAGMA_METADATA_INFO","PRAGMA_PLATFORM","PRAGMA_SHOW","PRAGMA_STORAGE_INFO","PRAGMA_TABLE_INFO","PRAGMA_USER_AGENT","PRAGMA_VERSION","PREFIX","PRINTF","PRODUCT","QUANTILE","QUANTILE_CONT","QUANTILE_DISC","QUARTER","RADIANS","RANDOM","RANGE","READFILE","READ_BLOB","READ_CSV","READ_CSV_AUTO","READ_JSON","READ_JSON_AUTO","READ_JSON_OBJECTS","READ_JSON_OBJECTS_AUTO","READ_NDJSON","READ_NDJSON_AUTO","READ_NDJSON_OBJECTS","READ_PARQUET","READ_TEXT","REDUCE","REGEXP_ESCAPE","REGEXP_EXTRACT","REGEXP_EXTRACT_ALL","REGEXP_FULL_MATCH","REGEXP_MATCHES","REGEXP_REPLACE","REGEXP_SPLIT_TO_ARRAY","REGEXP_SPLIT_TO_TABLE","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","REPEAT","REPEAT_ROW","REPLACE","RESERVOIR_QUANTILE","REVERSE","RIGHT","RIGHT_GRAPHEME","ROUND","ROUNDBANKERS","ROUND_EVEN","ROW","ROW_TO_JSON","RPAD","RTRIM","SECOND","SEM","SEQ_SCAN","SESSION_USER","SETSEED","SET_BIT","SHA256","SHA3","SHELL_ADD_SCHEMA","SHELL_ESCAPE_CRNL","SHELL_IDQUOTE","SHELL_MODULE_SCHEMA","SHELL_PUTSNL","SHOBJ_DESCRIPTION","SHOW","SHOW_DATABASES","SHOW_TABLES","SHOW_TABLES_EXPANDED","SIGN","SIGNBIT","SIN","SKEWNESS","SNIFF_CSV","SPLIT","SPLIT_PART","SQL_AUTO_COMPLETE","SQRT","STARTS_WITH","STATS","STDDEV","STDDEV_POP","STDDEV_SAMP","STORAGE_INFO","STRFTIME","STRING_AGG","STRING_SPLIT","STRING_SPLIT_REGEX","STRING_TO_ARRAY","STRIP_ACCENTS","STRLEN","STRPOS","STRPTIME","STRUCT_EXTRACT","STRUCT_INSERT","STRUCT_PACK","STR_SPLIT","STR_SPLIT_REGEX","SUBSTR","SUBSTRING","SUBSTRING_GRAPHEME","SUBTRACT","SUFFIX","SUM","SUMKAHAN","SUMMARY","SUM_NO_OVERFLOW","TABLE_INFO","TAN","TEST_ALL_TYPES","TEST_VECTOR_TYPES","TIMEZONE","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIME_BUCKET","TODAY","TO_BASE","TO_BASE64","TO_BINARY","TO_CENTURIES","TO_DAYS","TO_DECADES","TO_HEX","TO_HOURS","TO_JSON","TO_MICROSECONDS","TO_MILLENNIA","TO_MILLISECONDS","TO_MINUTES","TO_MONTHS","TO_SECONDS","TO_TIMESTAMP","TO_WEEKS","TO_YEARS","TRANSACTION_TIMESTAMP","TRANSLATE","TRIM","TRUNC","TRY_STRPTIME","TXID_CURRENT","TYPEOF","UCASE","UNBIN","UNHEX","UNICODE","UNION_EXTRACT","UNION_TAG","UNION_VALUE","UNNEST","UNPIVOT_LIST","UPPER","USER","USER_AGENT","UUID","VARIANCE","VAR_POP","VAR_SAMP","VECTOR_TYPE","VERIFY_EXTERNAL","VERIFY_FETCH_ROW","VERIFY_PARALLELISM","VERIFY_SERIALIZER","VERSION","WEEK","WEEKDAY","WEEKOFYEAR","WHICH_SECRET","WRITEFILE","XOR","YEAR","YEARWEEK","CAST","COALESCE","NULL","RANK","ROW_NUMBER"],nestedBlockComments:!0,extraParens:["[]","{}"],stringTypes:["$$","''-qq",{quote:"''-qq-bs",prefixes:["E"],requirePrefix:!0},{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:['""-qq'],identChars:{rest:"$"},paramTypes:{positional:!0,numbered:["$"],quoted:["$"]},operators:["//","%","**","^","!","&","|","~","<<",">>","::","==","->",":",":=","=>","~~","!~~","~~*","!~~*","~~~","~","!~","~*","!~*","^@","||",">>=","<<="]},formatOptions:{alwaysDenseOperators:["::"],onelineClauses:[...c,...m],tabularOnelineClauses:m}},L=e=>e[e.length-1],d=e=>e.sort(((e,s)=>s.length-e.length||e.localeCompare(s))),C=e=>e.replace(/\s+/gu," "),f=e=>/\n/.test(e),D=e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),P=/\s+/uy,b=e=>new RegExp(`(?:${e})`,"uy"),x=e=>e.split("").map((e=>/ /gu.test(e)?"\\s+":`[${e.toUpperCase()}${e.toLowerCase()}]`)).join(""),M=(e,s=[])=>{const t="open"===e?0:1,r=["()",...s].map((e=>e[t]));return b(r.map(D).join("|"))},$=e=>b(`${d(e).map(D).join("|")}`),g=(e,s={})=>{if(0===e.length)return/^\b$/u;const t=(({rest:e,dashes:s})=>e||s?`(?![${e||""}${s?"-":""}])`:"")(s),r=d(e).map(D).join("|").replace(/ /gu,"\\s+");return new RegExp(`(?:${r})${t}\\b`,"iuy")},U=(e,s)=>{if(!e.length)return;const t=e.map(D).join("|");return b(`(?:${t})(?:${s})`)},w={"``":"(?:`[^`]*`)+","[]":String.raw`(?:\[[^\]]*\])(?:\][^\]]*\])*`,'""-qq':String.raw`(?:"[^"]*")+`,'""-bs':String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")`,'""-qq-bs':String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")+`,'""-raw':String.raw`(?:"[^"]*")`,"''-qq":String.raw`(?:'[^']*')+`,"''-bs":String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')`,"''-qq-bs":String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')+`,"''-raw":String.raw`(?:'[^']*')`,$$:String.raw`(?<tag>\$\w*\$)[\s\S]*?\k<tag>`,"'''..'''":String.raw`'''[^\\]*?(?:\\.[^\\]*?)*?'''`,'""".."""':String.raw`"""[^\\]*?(?:\\.[^\\]*?)*?"""`,"{}":String.raw`(?:\{[^\}]*\})`,"q''":(()=>{const e={"<":">","[":"]","(":")","{":"}"},s=Object.entries(e).map((([e,s])=>"{left}(?:(?!{right}').)*?{right}".replace(/{left}/g,D(e)).replace(/{right}/g,D(s)))),t=D(Object.keys(e).join(""));return`[Qq]'(?:${String.raw`(?<tag>[^\s${t}])(?:(?!\k<tag>').)*?\k<tag>`}|${s.join("|")})'`})()},B=e=>"string"==typeof e?w[e]:"regex"in e?e.regex:(({prefixes:e,requirePrefix:s})=>`(?:${e.map(x).join("|")}${s?"":"|"})`)(e)+w[e.quote],G=e=>e.map(B).join("|"),Y=e=>b(G(e)),F=(e={})=>b(V(e)),V=({first:e,rest:s,dashes:t,allowFirstCharNumber:r}={})=>{const n="\\p{Alphabetic}\\p{Mark}_",E="\\p{Decimal_Number}",i=D(null!=e?e:""),a=D(null!=s?s:""),o=r?`[${n}${E}${i}][${n}${E}${a}]*`:`[${n}${i}][${n}${E}${a}]*`;return t?(e=>e+"(?:-"+e+")*")(o):o};function W(e,s){const t=e.slice(0,s).split(/\n/);return{line:t.length,col:t[t.length-1].length+1}}class H{constructor(e,s){this.rules=e,this.dialectName=s,this.input="",this.index=0}tokenize(e){this.input=e,this.index=0;const s=[];let t;for(;this.index<this.input.length;){const e=this.getWhitespace();if(this.index<this.input.length){if(t=this.getNextToken(),!t)throw this.createParseError();s.push(Object.assign(Object.assign({},t),{precedingWhitespace:e}))}}return s}createParseError(){const e=this.input.slice(this.index,this.index+10),{line:s,col:t}=W(this.input,this.index);return new Error(`Parse error: Unexpected "${e}" at line ${s} column ${t}.\n${this.dialectInfo()}`)}dialectInfo(){return"sql"===this.dialectName?'This likely happens because you\'re using the default "sql" dialect.\nIf possible, please select a more specific dialect (like sqlite, postgresql, etc).':`SQL dialect used: "${this.dialectName}".`}getWhitespace(){P.lastIndex=this.index;const e=P.exec(this.input);if(e)return this.index+=e[0].length,e[0]}getNextToken(){for(const e of this.rules){const s=this.match(e);if(s)return s}}match(e){e.regex.lastIndex=this.index;const s=e.regex.exec(this.input);if(s){const t=s[0],r={type:e.type,raw:t,text:e.text?e.text(t):t,start:this.index};return e.key&&(r.key=e.key(t)),this.index+=t.length,r}}}const v=/\/\*/uy,k=/[\s\S]/uy,K=/\*\//uy;class X{constructor(){this.lastIndex=0}exec(e){let s,t="",r=0;if(!(s=this.matchSection(v,e)))return null;for(t+=s,r++;r>0;)if(s=this.matchSection(v,e))t+=s,r++;else if(s=this.matchSection(K,e))t+=s,r--;else{if(!(s=this.matchSection(k,e)))return null;t+=s}return[t]}matchSection(e,s){e.lastIndex=this.lastIndex;const t=e.exec(s);return t&&(this.lastIndex+=t[0].length),t?t[0]:null}}class J{constructor(e,s){this.cfg=e,this.dialectName=s,this.rulesBeforeParams=this.buildRulesBeforeParams(e),this.rulesAfterParams=this.buildRulesAfterParams(e)}tokenize(e,s){const t=[...this.rulesBeforeParams,...this.buildParamRules(this.cfg,s),...this.rulesAfterParams],r=new H(t,this.dialectName).tokenize(e);return this.cfg.postProcess?this.cfg.postProcess(r):r}buildRulesBeforeParams(e){var s,t,r;return this.validRules([{type:R.BLOCK_COMMENT,regex:/(\/\* *sql-formatter-disable *\*\/[\s\S]*?(?:\/\* *sql-formatter-enable *\*\/|$))/uy},{type:R.BLOCK_COMMENT,regex:e.nestedBlockComments?new X:/(\/\*[^]*?\*\/)/uy},{type:R.LINE_COMMENT,regex:(r=null!==(s=e.lineCommentTypes)&&void 0!==s?s:["--"],new RegExp(`(?:${r.map(D).join("|")}).*?(?=\r\n|\r|\n|$)`,"uy"))},{type:R.QUOTED_IDENTIFIER,regex:Y(e.identTypes)},{type:R.NUMBER,regex:/(?:0x[0-9a-fA-F]+|0b[01]+|(?:-\s*)?(?:[0-9]*\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+(?:\.[0-9]+)?)?)(?![\w\p{Alphabetic}])/uy},{type:R.RESERVED_PHRASE,regex:g(null!==(t=e.reservedPhrases)&&void 0!==t?t:[],e.identChars),text:q},{type:R.CASE,regex:/CASE\b/iuy,text:q},{type:R.END,regex:/END\b/iuy,text:q},{type:R.BETWEEN,regex:/BETWEEN\b/iuy,text:q},{type:R.LIMIT,regex:e.reservedClauses.includes("LIMIT")?/LIMIT\b/iuy:void 0,text:q},{type:R.RESERVED_CLAUSE,regex:g(e.reservedClauses,e.identChars),text:q},{type:R.RESERVED_SELECT,regex:g(e.reservedSelect,e.identChars),text:q},{type:R.RESERVED_SET_OPERATION,regex:g(e.reservedSetOperations,e.identChars),text:q},{type:R.WHEN,regex:/WHEN\b/iuy,text:q},{type:R.ELSE,regex:/ELSE\b/iuy,text:q},{type:R.THEN,regex:/THEN\b/iuy,text:q},{type:R.RESERVED_JOIN,regex:g(e.reservedJoins,e.identChars),text:q},{type:R.AND,regex:/AND\b/iuy,text:q},{type:R.OR,regex:/OR\b/iuy,text:q},{type:R.XOR,regex:e.supportsXor?/XOR\b/iuy:void 0,text:q},...e.operatorKeyword?[{type:R.OPERATOR,regex:/OPERATOR *\([^)]+\)/iuy}]:[],{type:R.RESERVED_FUNCTION_NAME,regex:g(e.reservedFunctionNames,e.identChars),text:q},{type:R.RESERVED_DATA_TYPE,regex:g(e.reservedDataTypes,e.identChars),text:q},{type:R.RESERVED_KEYWORD,regex:g(e.reservedKeywords,e.identChars),text:q}])}buildRulesAfterParams(e){var s,t,r;return this.validRules([{type:R.VARIABLE,regex:e.variableTypes?(r=e.variableTypes,b(r.map((e=>"regex"in e?e.regex:B(e))).join("|"))):void 0},{type:R.STRING,regex:Y(e.stringTypes)},{type:R.IDENTIFIER,regex:F(e.identChars)},{type:R.DELIMITER,regex:/[;]/uy},{type:R.COMMA,regex:/[,]/y},{type:R.OPEN_PAREN,regex:M("open",e.extraParens)},{type:R.CLOSE_PAREN,regex:M("close",e.extraParens)},{type:R.OPERATOR,regex:$(["+","-","/",">","<","=","<>","<=",">=","!=",...null!==(s=e.operators)&&void 0!==s?s:[]])},{type:R.ASTERISK,regex:/[*]/uy},{type:R.PROPERTY_ACCESS_OPERATOR,regex:$([".",...null!==(t=e.propertyAccessOperators)&&void 0!==t?t:[]])}])}buildParamRules(e,s){var t,r,n,E,i;const a={named:(null==s?void 0:s.named)||(null===(t=e.paramTypes)||void 0===t?void 0:t.named)||[],quoted:(null==s?void 0:s.quoted)||(null===(r=e.paramTypes)||void 0===r?void 0:r.quoted)||[],numbered:(null==s?void 0:s.numbered)||(null===(n=e.paramTypes)||void 0===n?void 0:n.numbered)||[],positional:"boolean"==typeof(null==s?void 0:s.positional)?s.positional:null===(E=e.paramTypes)||void 0===E?void 0:E.positional,custom:(null==s?void 0:s.custom)||(null===(i=e.paramTypes)||void 0===i?void 0:i.custom)||[]};return this.validRules([{type:R.NAMED_PARAMETER,regex:U(a.named,V(e.paramChars||e.identChars)),key:e=>e.slice(1)},{type:R.QUOTED_PARAMETER,regex:U(a.quoted,G(e.identTypes)),key:e=>(({tokenKey:e,quoteChar:s})=>e.replace(new RegExp(D("\\"+s),"gu"),s))({tokenKey:e.slice(2,-1),quoteChar:e.slice(-1)})},{type:R.NUMBERED_PARAMETER,regex:U(a.numbered,"[0-9]+"),key:e=>e.slice(1)},{type:R.POSITIONAL_PARAMETER,regex:a.positional?/[?]/y:void 0},...a.custom.map((e=>{var s;return{type:R.CUSTOM_PARAMETER,regex:b(e.regex),key:null!==(s=e.key)&&void 0!==s?s:e=>e}}))])}validRules(e){return e.filter((e=>Boolean(e.regex)))}}const q=e=>C(e.toUpperCase()),j=new Map,Q=e=>({tokenizer:new J(e.tokenizerOptions,e.name),formatOptions:Z(e.formatOptions)}),Z=e=>{var s;return{alwaysDenseOperators:e.alwaysDenseOperators||[],onelineClauses:Object.fromEntries(e.onelineClauses.map((e=>[e,!0]))),tabularOnelineClauses:Object.fromEntries((null!==(s=e.tabularOnelineClauses)&&void 0!==s?s:e.onelineClauses).map((e=>[e,!0])))}};function z(e){return"tabularLeft"===e.indentStyle||"tabularRight"===e.indentStyle}class ee{constructor(e){this.params=e,this.index=0}get({key:e,text:s}){return this.params?e?this.params[e]:this.params[this.index++]:s}getPositionalParameterIndex(){return this.index}setPositionalParameterIndex(e){this.index=e}}var se,te,re,ne,Ee={exports:{}};const ie=e((se||(se=1,re=Ee.exports,ne=function(){function e(s,t,r){return this.id=++e.highestId,this.name=s,this.symbols=t,this.postprocess=r,this}function s(e,s,t,r){this.rule=e,this.dot=s,this.reference=t,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}function t(e,s){this.grammar=e,this.index=s,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(e,s){this.rules=e,this.start=s||this.rules[0].name;var t=this.byName={};this.rules.forEach((function(e){t.hasOwnProperty(e.name)||(t[e.name]=[]),t[e.name].push(e)}))}function n(){this.reset("")}function E(e,s,E){if(e instanceof r){var i=e;E=s}else i=r.fromCompiled(e,s);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new n},E||{})this.options[a]=E[a];this.lexer=this.options.lexer,this.lexerState=void 0;var o=new t(i,0);this.table=[o],o.wants[i.start]=[],o.predict(i.start),o.process(),this.current=0}function i(e){var s=typeof e;if("string"===s)return e;if("object"===s){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var s=void 0===e?this.symbols.map(i).join(" "):this.symbols.slice(0,e).map(i).join(" ")+" ● "+this.symbols.slice(e).map(i).join(" ");return this.name+" → "+s},s.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},s.prototype.nextState=function(e){var t=new s(this.rule,this.dot+1,this.reference,this.wantedBy);return t.left=this,t.right=e,t.isComplete&&(t.data=t.build(),t.right=void 0),t},s.prototype.build=function(){var e=[],s=this;do{e.push(s.right.data),s=s.left}while(s.left);return e.reverse(),e},s.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,E.fail))},t.prototype.process=function(e){for(var s=this.states,t=this.wants,r=this.completed,n=0;n<s.length;n++){var i=s[n];if(i.isComplete){if(i.finish(),i.data!==E.fail){for(var a=i.wantedBy,o=a.length;o--;){var _=a[o];this.complete(_,i)}if(i.reference===this.index){var T=i.rule.name;(this.completed[T]=this.completed[T]||[]).push(i)}}}else{if("string"!=typeof(T=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(t[T]){if(t[T].push(i),r.hasOwnProperty(T)){var l=r[T];for(o=0;o<l.length;o++){var R=l[o];this.complete(i,R)}}}else t[T]=[i],this.predict(T)}}},t.prototype.predict=function(e){for(var t=this.grammar.byName[e]||[],r=0;r<t.length;r++){var n=t[r],E=this.wants[e],i=new s(n,0,this.index,E);this.states.push(i)}},t.prototype.complete=function(e,s){var t=e.nextState(s);this.states.push(t)},r.fromCompiled=function(s,t){var n=s.Lexer;s.ParserStart&&(t=s.ParserStart,s=s.ParserRules);var E=new r(s=s.map((function(s){return new e(s.name,s.symbols,s.postprocess)})),t);return E.lexer=n,E},n.prototype.reset=function(e,s){this.buffer=e,this.index=0,this.line=s?s.line:1,this.lastLineBreak=s?-s.col:0},n.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},n.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},n.prototype.formatError=function(e,s){var t=this.buffer;if("string"==typeof t){var r=t.split("\n").slice(Math.max(0,this.line-5),this.line),n=t.indexOf("\n",this.index);-1===n&&(n=t.length);var E=this.index-this.lastLineBreak,i=String(this.line).length;return s+=" at line "+this.line+" col "+E+":\n\n",s+=r.map((function(e,s){return a(this.line-r.length+s+1,i)+" "+e}),this).join("\n"),s+="\n"+a("",i+E)+"^\n"}return s+" at index "+(this.index-1);function a(e,s){var t=String(e);return Array(s-t.length+1).join(" ")+t}},E.fail={},E.prototype.feed=function(e){var s,r=this.lexer;for(r.reset(e,this.lexerState);;){try{if(!(s=r.next()))break}catch(I){var E=new t(this.grammar,this.current+1);throw this.table.push(E),(o=new Error(this.reportLexerError(I))).offset=this.current,o.token=I.token,o}var i=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;E=new t(this.grammar,a),this.table.push(E);for(var o,_=void 0!==s.text?s.text:s.value,T=r.constructor===n?s.value:s,l=i.scannable,R=l.length;R--;){var A=l[R],p=A.rule.symbols[A.dot];if(p.test?p.test(T):p.type?p.type===s.type:p.literal===_){var S=A.nextState({data:T,token:s,isToken:!0,reference:a-1});E.states.push(S)}}if(E.process(),0===E.states.length)throw(o=new Error(this.reportError(s))).offset=this.current,o.token=s,o;this.options.keepHistory&&(i.lexerState=r.save()),this.current++}return i&&(this.lexerState=r.save()),this.results=this.finish(),this},E.prototype.reportLexerError=function(e){var s,t,r=e.token;return r?(s="input "+JSON.stringify(r.text[0])+" (lexer error)",t=this.lexer.formatError(r,"Syntax error")):(s="input (lexer error)",t=e.message),this.reportErrorCommon(t,s)},E.prototype.reportError=function(e){var s=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e),t=this.lexer.formatError(e,"Syntax error");return this.reportErrorCommon(t,s)},E.prototype.reportErrorCommon=function(e,s){var t=[];t.push(e);var r=this.table.length-2,n=this.table[r],E=n.states.filter((function(e){var s=e.rule.symbols[e.dot];return s&&"string"!=typeof s}));return 0===E.length?(t.push("Unexpected "+s+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(n.states,t)):(t.push("Unexpected "+s+". Instead, I was expecting to see one of the following:\n"),E.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var s=e[0],r=s.rule.symbols[s.dot],n=this.getSymbolDisplay(r);t.push("A "+n+" based on:"),this.displayStateStack(e,t)}),this)),t.push(""),t.join("\n")},E.prototype.displayStateStack=function(e,s){for(var t,r=0,n=0;n<e.length;n++){var E=e[n],i=E.rule.toString(E.dot);i===t?r++:(r>0&&s.push(" ^ "+r+" more lines identical to this"),r=0,s.push(" "+i)),t=i}},E.prototype.getSymbolDisplay=function(e){return function(e){var s=typeof e;if("string"===s)return e;if("object"===s){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},E.prototype.buildFirstStateStack=function(e,s){if(-1!==s.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var t=e.wantedBy[0],r=[e].concat(s),n=this.buildFirstStateStack(t,r);return null===n?null:[e].concat(n)},E.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},E.prototype.restore=function(e){var s=e.index;this.current=s,this.table[s]=e,this.table.splice(s+1),this.lexerState=e.lexerState,this.results=this.finish()},E.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},E.prototype.finish=function(){var e=[],s=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(t){t.rule.name===s&&t.dot===t.rule.symbols.length&&0===t.reference&&t.data!==E.fail&&e.push(t)})),e.map((function(e){return e.data}))},{Parser:E,Grammar:r,Rule:e}},(te=Ee).exports?te.exports=ne():re.nearley=ne()),Ee.exports));const ae=(e,s,t)=>{if((r=e.type)===R.RESERVED_DATA_TYPE||r===R.RESERVED_KEYWORD||r===R.RESERVED_FUNCTION_NAME||r===R.RESERVED_PHRASE||r===R.RESERVED_CLAUSE||r===R.RESERVED_SELECT||r===R.RESERVED_SET_OPERATION||r===R.RESERVED_JOIN||r===R.ARRAY_KEYWORD||r===R.CASE||r===R.END||r===R.WHEN||r===R.ELSE||r===R.THEN||r===R.LIMIT||r===R.BETWEEN||r===R.AND||r===R.OR||r===R.XOR){const r=Re(t,s);if(r&&r.type===R.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:R.IDENTIFIER,text:e.raw});const n=Ae(t,s);if(n&&n.type===R.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:R.IDENTIFIER,text:e.raw})}var r;return e},oe=(e,s,t)=>{if(e.type===R.RESERVED_FUNCTION_NAME){const r=Ae(t,s);if(!r||!pe(r))return Object.assign(Object.assign({},e),{type:R.IDENTIFIER,text:e.raw})}return e},_e=(e,s,t)=>{if(e.type===R.RESERVED_DATA_TYPE){const r=Ae(t,s);if(r&&pe(r))return Object.assign(Object.assign({},e),{type:R.RESERVED_PARAMETERIZED_DATA_TYPE})}return e},Te=(e,s,t)=>{if(e.type===R.IDENTIFIER){const r=Ae(t,s);if(r&&Se(r))return Object.assign(Object.assign({},e),{type:R.ARRAY_IDENTIFIER})}return e},le=(e,s,t)=>{if(e.type===R.RESERVED_DATA_TYPE){const r=Ae(t,s);if(r&&Se(r))return Object.assign(Object.assign({},e),{type:R.ARRAY_KEYWORD})}return e},Re=(e,s)=>Ae(e,s,-1),Ae=(e,s,t=1)=>{let r=1;for(;e[s+r*t]&&Ie(e[s+r*t]);)r++;return e[s+r*t]},pe=e=>e.type===R.OPEN_PAREN&&"("===e.text,Se=e=>e.type===R.OPEN_PAREN&&"["===e.text,Ie=e=>e.type===R.BLOCK_COMMENT||e.type===R.LINE_COMMENT;class Ne{constructor(e){this.tokenize=e,this.index=0,this.tokens=[],this.input=""}reset(e,s){this.input=e,this.index=0,this.tokens=this.tokenize(e)}next(){return this.tokens[this.index++]}save(){}formatError(e){const{line:s,col:t}=W(this.input,e.start);return`Parse error at token: ${e.text} at line ${s} column ${t}`}has(e){return e in R}}var ce,me;function he(e){return e[0]}(me=ce=ce||(ce={})).statement="statement",me.clause="clause",me.set_operation="set_operation",me.function_call="function_call",me.parameterized_data_type="parameterized_data_type",me.array_subscript="array_subscript",me.property_access="property_access",me.parenthesis="parenthesis",me.between_predicate="between_predicate",me.case_expression="case_expression",me.case_when="case_when",me.case_else="case_else",me.limit_clause="limit_clause",me.all_columns_asterisk="all_columns_asterisk",me.literal="literal",me.identifier="identifier",me.keyword="keyword",me.data_type="data_type",me.parameter="parameter",me.operator="operator",me.comma="comma",me.line_comment="line_comment",me.block_comment="block_comment",me.disable_comment="disable_comment";const ue=new Ne((e=>[])),Oe=([[e]])=>e,ye=e=>({type:ce.keyword,tokenType:e.type,text:e.text,raw:e.raw}),Le=e=>({type:ce.data_type,text:e.text,raw:e.raw}),de=(e,{leading:s,trailing:t})=>((null==s?void 0:s.length)&&(e=Object.assign(Object.assign({},e),{leadingComments:s})),(null==t?void 0:t.length)&&(e=Object.assign(Object.assign({},e),{trailingComments:t})),e),Ce=(e,{leading:s,trailing:t})=>{if(null==s?void 0:s.length){const[t,...r]=e;e=[de(t,{leading:s}),...r]}if(null==t?void 0:t.length){const s=e.slice(0,-1),r=e[e.length-1];e=[...s,de(r,{trailing:t})]}return e},fe={Lexer:ue,ParserRules:[{name:"main$ebnf$1",symbols:[]},{name:"main$ebnf$1",symbols:["main$ebnf$1","statement"],postprocess:e=>e[0].concat([e[1]])},{name:"main",symbols:["main$ebnf$1"],postprocess:([e])=>{const s=e[e.length-1];return s&&!s.hasSemicolon?s.children.length>0?e:e.slice(0,-1):e}},{name:"statement$subexpression$1",symbols:[ue.has("DELIMITER")?{type:"DELIMITER"}:DELIMITER]},{name:"statement$subexpression$1",symbols:[ue.has("EOF")?{type:"EOF"}:EOF]},{name:"statement",symbols:["expressions_or_clauses","statement$subexpression$1"],postprocess:([e,[s]])=>({type:ce.statement,children:e,hasSemicolon:s.type===R.DELIMITER})},{name:"expressions_or_clauses$ebnf$1",symbols:[]},{name:"expressions_or_clauses$ebnf$1",symbols:["expressions_or_clauses$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"expressions_or_clauses$ebnf$2",symbols:[]},{name:"expressions_or_clauses$ebnf$2",symbols:["expressions_or_clauses$ebnf$2","clause"],postprocess:e=>e[0].concat([e[1]])},{name:"expressions_or_clauses",symbols:["expressions_or_clauses$ebnf$1","expressions_or_clauses$ebnf$2"],postprocess:([e,s])=>[...e,...s]},{name:"clause$subexpression$1",symbols:["limit_clause"]},{name:"clause$subexpression$1",symbols:["select_clause"]},{name:"clause$subexpression$1",symbols:["other_clause"]},{name:"clause$subexpression$1",symbols:["set_operation"]},{name:"clause",symbols:["clause$subexpression$1"],postprocess:Oe},{name:"limit_clause$ebnf$1$subexpression$1$ebnf$1",symbols:["free_form_sql"]},{name:"limit_clause$ebnf$1$subexpression$1$ebnf$1",symbols:["limit_clause$ebnf$1$subexpression$1$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"limit_clause$ebnf$1$subexpression$1",symbols:[ue.has("COMMA")?{type:"COMMA"}:COMMA,"limit_clause$ebnf$1$subexpression$1$ebnf$1"]},{name:"limit_clause$ebnf$1",symbols:["limit_clause$ebnf$1$subexpression$1"],postprocess:he},{name:"limit_clause$ebnf$1",symbols:[],postprocess:()=>null},{name:"limit_clause",symbols:[ue.has("LIMIT")?{type:"LIMIT"}:LIMIT,"_","expression_chain_","limit_clause$ebnf$1"],postprocess:([e,s,t,r])=>{if(r){const[n,E]=r;return{type:ce.limit_clause,limitKw:de(ye(e),{trailing:s}),offset:t,count:E}}return{type:ce.limit_clause,limitKw:de(ye(e),{trailing:s}),count:t}}},{name:"select_clause$subexpression$1$ebnf$1",symbols:[]},{name:"select_clause$subexpression$1$ebnf$1",symbols:["select_clause$subexpression$1$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"select_clause$subexpression$1",symbols:["all_columns_asterisk","select_clause$subexpression$1$ebnf$1"]},{name:"select_clause$subexpression$1$ebnf$2",symbols:[]},{name:"select_clause$subexpression$1$ebnf$2",symbols:["select_clause$subexpression$1$ebnf$2","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"select_clause$subexpression$1",symbols:["asteriskless_free_form_sql","select_clause$subexpression$1$ebnf$2"]},{name:"select_clause",symbols:[ue.has("RESERVED_SELECT")?{type:"RESERVED_SELECT"}:RESERVED_SELECT,"select_clause$subexpression$1"],postprocess:([e,[s,t]])=>({type:ce.clause,nameKw:ye(e),children:[s,...t]})},{name:"select_clause",symbols:[ue.has("RESERVED_SELECT")?{type:"RESERVED_SELECT"}:RESERVED_SELECT],postprocess:([e])=>({type:ce.clause,nameKw:ye(e),children:[]})},{name:"all_columns_asterisk",symbols:[ue.has("ASTERISK")?{type:"ASTERISK"}:ASTERISK],postprocess:()=>({type:ce.all_columns_asterisk})},{name:"other_clause$ebnf$1",symbols:[]},{name:"other_clause$ebnf$1",symbols:["other_clause$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"other_clause",symbols:[ue.has("RESERVED_CLAUSE")?{type:"RESERVED_CLAUSE"}:RESERVED_CLAUSE,"other_clause$ebnf$1"],postprocess:([e,s])=>({type:ce.clause,nameKw:ye(e),children:s})},{name:"set_operation$ebnf$1",symbols:[]},{name:"set_operation$ebnf$1",symbols:["set_operation$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"set_operation",symbols:[ue.has("RESERVED_SET_OPERATION")?{type:"RESERVED_SET_OPERATION"}:RESERVED_SET_OPERATION,"set_operation$ebnf$1"],postprocess:([e,s])=>({type:ce.set_operation,nameKw:ye(e),children:s})},{name:"expression_chain_$ebnf$1",symbols:["expression_with_comments_"]},{name:"expression_chain_$ebnf$1",symbols:["expression_chain_$ebnf$1","expression_with_comments_"],postprocess:e=>e[0].concat([e[1]])},{name:"expression_chain_",symbols:["expression_chain_$ebnf$1"],postprocess:he},{name:"expression_chain$ebnf$1",symbols:[]},{name:"expression_chain$ebnf$1",symbols:["expression_chain$ebnf$1","_expression_with_comments"],postprocess:e=>e[0].concat([e[1]])},{name:"expression_chain",symbols:["expression","expression_chain$ebnf$1"],postprocess:([e,s])=>[e,...s]},{name:"andless_expression_chain$ebnf$1",symbols:[]},{name:"andless_expression_chain$ebnf$1",symbols:["andless_expression_chain$ebnf$1","_andless_expression_with_comments"],postprocess:e=>e[0].concat([e[1]])},{name:"andless_expression_chain",symbols:["andless_expression","andless_expression_chain$ebnf$1"],postprocess:([e,s])=>[e,...s]},{name:"expression_with_comments_",symbols:["expression","_"],postprocess:([e,s])=>de(e,{trailing:s})},{name:"_expression_with_comments",symbols:["_","expression"],postprocess:([e,s])=>de(s,{leading:e})},{name:"_andless_expression_with_comments",symbols:["_","andless_expression"],postprocess:([e,s])=>de(s,{leading:e})},{name:"free_form_sql$subexpression$1",symbols:["asteriskless_free_form_sql"]},{name:"free_form_sql$subexpression$1",symbols:["asterisk"]},{name:"free_form_sql",symbols:["free_form_sql$subexpression$1"],postprocess:Oe},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["asteriskless_andless_expression"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["logic_operator"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["comma"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["comment"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["other_keyword"]},{name:"asteriskless_free_form_sql",symbols:["asteriskless_free_form_sql$subexpression$1"],postprocess:Oe},{name:"expression$subexpression$1",symbols:["andless_expression"]},{name:"expression$subexpression$1",symbols:["logic_operator"]},{name:"expression",symbols:["expression$subexpression$1"],postprocess:Oe},{name:"andless_expression$subexpression$1",symbols:["asteriskless_andless_expression"]},{name:"andless_expression$subexpression$1",symbols:["asterisk"]},{name:"andless_expression",symbols:["andless_expression$subexpression$1"],postprocess:Oe},{name:"asteriskless_andless_expression$subexpression$1",symbols:["atomic_expression"]},{name:"asteriskless_andless_expression$subexpression$1",symbols:["between_predicate"]},{name:"asteriskless_andless_expression$subexpression$1",symbols:["case_expression"]},{name:"asteriskless_andless_expression",symbols:["asteriskless_andless_expression$subexpression$1"],postprocess:Oe},{name:"atomic_expression$subexpression$1",symbols:["array_subscript"]},{name:"atomic_expression$subexpression$1",symbols:["function_call"]},{name:"atomic_expression$subexpression$1",symbols:["property_access"]},{name:"atomic_expression$subexpression$1",symbols:["parenthesis"]},{name:"atomic_expression$subexpression$1",symbols:["curly_braces"]},{name:"atomic_expression$subexpression$1",symbols:["square_brackets"]},{name:"atomic_expression$subexpression$1",symbols:["operator"]},{name:"atomic_expression$subexpression$1",symbols:["identifier"]},{name:"atomic_expression$subexpression$1",symbols:["parameter"]},{name:"atomic_expression$subexpression$1",symbols:["literal"]},{name:"atomic_expression$subexpression$1",symbols:["data_type"]},{name:"atomic_expression$subexpression$1",symbols:["keyword"]},{name:"atomic_expression",symbols:["atomic_expression$subexpression$1"],postprocess:Oe},{name:"array_subscript",symbols:[ue.has("ARRAY_IDENTIFIER")?{type:"ARRAY_IDENTIFIER"}:ARRAY_IDENTIFIER,"_","square_brackets"],postprocess:([e,s,t])=>({type:ce.array_subscript,array:de({type:ce.identifier,quoted:!1,text:e.text},{trailing:s}),parenthesis:t})},{name:"array_subscript",symbols:[ue.has("ARRAY_KEYWORD")?{type:"ARRAY_KEYWORD"}:ARRAY_KEYWORD,"_","square_brackets"],postprocess:([e,s,t])=>({type:ce.array_subscript,array:de(ye(e),{trailing:s}),parenthesis:t})},{name:"function_call",symbols:[ue.has("RESERVED_FUNCTION_NAME")?{type:"RESERVED_FUNCTION_NAME"}:RESERVED_FUNCTION_NAME,"_","parenthesis"],postprocess:([e,s,t])=>({type:ce.function_call,nameKw:de(ye(e),{trailing:s}),parenthesis:t})},{name:"parenthesis",symbols:[{literal:"("},"expressions_or_clauses",{literal:")"}],postprocess:([e,s,t])=>({type:ce.parenthesis,children:s,openParen:"(",closeParen:")"})},{name:"curly_braces$ebnf$1",symbols:[]},{name:"curly_braces$ebnf$1",symbols:["curly_braces$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"curly_braces",symbols:[{literal:"{"},"curly_braces$ebnf$1",{literal:"}"}],postprocess:([e,s,t])=>({type:ce.parenthesis,children:s,openParen:"{",closeParen:"}"})},{name:"square_brackets$ebnf$1",symbols:[]},{name:"square_brackets$ebnf$1",symbols:["square_brackets$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"square_brackets",symbols:[{literal:"["},"square_brackets$ebnf$1",{literal:"]"}],postprocess:([e,s,t])=>({type:ce.parenthesis,children:s,openParen:"[",closeParen:"]"})},{name:"property_access$subexpression$1",symbols:["identifier"]},{name:"property_access$subexpression$1",symbols:["array_subscript"]},{name:"property_access$subexpression$1",symbols:["all_columns_asterisk"]},{name:"property_access$subexpression$1",symbols:["parameter"]},{name:"property_access",symbols:["atomic_expression","_",ue.has("PROPERTY_ACCESS_OPERATOR")?{type:"PROPERTY_ACCESS_OPERATOR"}:PROPERTY_ACCESS_OPERATOR,"_","property_access$subexpression$1"],postprocess:([e,s,t,r,[n]])=>({type:ce.property_access,object:de(e,{trailing:s}),operator:t.text,property:de(n,{leading:r})})},{name:"between_predicate",symbols:[ue.has("BETWEEN")?{type:"BETWEEN"}:BETWEEN,"_","andless_expression_chain","_",ue.has("AND")?{type:"AND"}:AND,"_","andless_expression"],postprocess:([e,s,t,r,n,E,i])=>({type:ce.between_predicate,betweenKw:ye(e),expr1:Ce(t,{leading:s,trailing:r}),andKw:ye(n),expr2:[de(i,{leading:E})]})},{name:"case_expression$ebnf$1",symbols:["expression_chain_"],postprocess:he},{name:"case_expression$ebnf$1",symbols:[],postprocess:()=>null},{name:"case_expression$ebnf$2",symbols:[]},{name:"case_expression$ebnf$2",symbols:["case_expression$ebnf$2","case_clause"],postprocess:e=>e[0].concat([e[1]])},{name:"case_expression",symbols:[ue.has("CASE")?{type:"CASE"}:CASE,"_","case_expression$ebnf$1","case_expression$ebnf$2",ue.has("END")?{type:"END"}:END],postprocess:([e,s,t,r,n])=>({type:ce.case_expression,caseKw:de(ye(e),{trailing:s}),endKw:ye(n),expr:t||[],clauses:r})},{name:"case_clause",symbols:[ue.has("WHEN")?{type:"WHEN"}:WHEN,"_","expression_chain_",ue.has("THEN")?{type:"THEN"}:THEN,"_","expression_chain_"],postprocess:([e,s,t,r,n,E])=>({type:ce.case_when,whenKw:de(ye(e),{trailing:s}),thenKw:de(ye(r),{trailing:n}),condition:t,result:E})},{name:"case_clause",symbols:[ue.has("ELSE")?{type:"ELSE"}:ELSE,"_","expression_chain_"],postprocess:([e,s,t])=>({type:ce.case_else,elseKw:de(ye(e),{trailing:s}),result:t})},{name:"comma$subexpression$1",symbols:[ue.has("COMMA")?{type:"COMMA"}:COMMA]},{name:"comma",symbols:["comma$subexpression$1"],postprocess:([[e]])=>({type:ce.comma})},{name:"asterisk$subexpression$1",symbols:[ue.has("ASTERISK")?{type:"ASTERISK"}:ASTERISK]},{name:"asterisk",symbols:["asterisk$subexpression$1"],postprocess:([[e]])=>({type:ce.operator,text:e.text})},{name:"operator$subexpression$1",symbols:[ue.has("OPERATOR")?{type:"OPERATOR"}:OPERATOR]},{name:"operator",symbols:["operator$subexpression$1"],postprocess:([[e]])=>({type:ce.operator,text:e.text})},{name:"identifier$subexpression$1",symbols:[ue.has("IDENTIFIER")?{type:"IDENTIFIER"}:IDENTIFIER]},{name:"identifier$subexpression$1",symbols:[ue.has("QUOTED_IDENTIFIER")?{type:"QUOTED_IDENTIFIER"}:QUOTED_IDENTIFIER]},{name:"identifier$subexpression$1",symbols:[ue.has("VARIABLE")?{type:"VARIABLE"}:VARIABLE]},{name:"identifier",symbols:["identifier$subexpression$1"],postprocess:([[e]])=>({type:ce.identifier,quoted:"IDENTIFIER"!==e.type,text:e.text})},{name:"parameter$subexpression$1",symbols:[ue.has("NAMED_PARAMETER")?{type:"NAMED_PARAMETER"}:NAMED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[ue.has("QUOTED_PARAMETER")?{type:"QUOTED_PARAMETER"}:QUOTED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[ue.has("NUMBERED_PARAMETER")?{type:"NUMBERED_PARAMETER"}:NUMBERED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[ue.has("POSITIONAL_PARAMETER")?{type:"POSITIONAL_PARAMETER"}:POSITIONAL_PARAMETER]},{name:"parameter$subexpression$1",symbols:[ue.has("CUSTOM_PARAMETER")?{type:"CUSTOM_PARAMETER"}:CUSTOM_PARAMETER]},{name:"parameter",symbols:["parameter$subexpression$1"],postprocess:([[e]])=>({type:ce.parameter,key:e.key,text:e.text})},{name:"literal$subexpression$1",symbols:[ue.has("NUMBER")?{type:"NUMBER"}:NUMBER]},{name:"literal$subexpression$1",symbols:[ue.has("STRING")?{type:"STRING"}:STRING]},{name:"literal",symbols:["literal$subexpression$1"],postprocess:([[e]])=>({type:ce.literal,text:e.text})},{name:"keyword$subexpression$1",symbols:[ue.has("RESERVED_KEYWORD")?{type:"RESERVED_KEYWORD"}:RESERVED_KEYWORD]},{name:"keyword$subexpression$1",symbols:[ue.has("RESERVED_PHRASE")?{type:"RESERVED_PHRASE"}:RESERVED_PHRASE]},{name:"keyword$subexpression$1",symbols:[ue.has("RESERVED_JOIN")?{type:"RESERVED_JOIN"}:RESERVED_JOIN]},{name:"keyword",symbols:["keyword$subexpression$1"],postprocess:([[e]])=>ye(e)},{name:"data_type$subexpression$1",symbols:[ue.has("RESERVED_DATA_TYPE")?{type:"RESERVED_DATA_TYPE"}:RESERVED_DATA_TYPE]},{name:"data_type",symbols:["data_type$subexpression$1"],postprocess:([[e]])=>Le(e)},{name:"data_type",symbols:[ue.has("RESERVED_PARAMETERIZED_DATA_TYPE")?{type:"RESERVED_PARAMETERIZED_DATA_TYPE"}:RESERVED_PARAMETERIZED_DATA_TYPE,"_","parenthesis"],postprocess:([e,s,t])=>({type:ce.parameterized_data_type,dataType:de(Le(e),{trailing:s}),parenthesis:t})},{name:"logic_operator$subexpression$1",symbols:[ue.has("AND")?{type:"AND"}:AND]},{name:"logic_operator$subexpression$1",symbols:[ue.has("OR")?{type:"OR"}:OR]},{name:"logic_operator$subexpression$1",symbols:[ue.has("XOR")?{type:"XOR"}:XOR]},{name:"logic_operator",symbols:["logic_operator$subexpression$1"],postprocess:([[e]])=>ye(e)},{name:"other_keyword$subexpression$1",symbols:[ue.has("WHEN")?{type:"WHEN"}:WHEN]},{name:"other_keyword$subexpression$1",symbols:[ue.has("THEN")?{type:"THEN"}:THEN]},{name:"other_keyword$subexpression$1",symbols:[ue.has("ELSE")?{type:"ELSE"}:ELSE]},{name:"other_keyword$subexpression$1",symbols:[ue.has("END")?{type:"END"}:END]},{name:"other_keyword",symbols:["other_keyword$subexpression$1"],postprocess:([[e]])=>ye(e)},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1","comment"],postprocess:e=>e[0].concat([e[1]])},{name:"_",symbols:["_$ebnf$1"],postprocess:([e])=>e},{name:"comment",symbols:[ue.has("LINE_COMMENT")?{type:"LINE_COMMENT"}:LINE_COMMENT],postprocess:([e])=>({type:ce.line_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:"comment",symbols:[ue.has("BLOCK_COMMENT")?{type:"BLOCK_COMMENT"}:BLOCK_COMMENT],postprocess:([e])=>({type:ce.block_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:"comment",symbols:[ue.has("DISABLE_COMMENT")?{type:"DISABLE_COMMENT"}:DISABLE_COMMENT],postprocess:([e])=>({type:ce.disable_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})}],ParserStart:"main"},{Parser:De,Grammar:Pe}=ie;var be,xe;(xe=be=be||(be={}))[xe.SPACE=0]="SPACE",xe[xe.NO_SPACE=1]="NO_SPACE",xe[xe.NO_NEWLINE=2]="NO_NEWLINE",xe[xe.NEWLINE=3]="NEWLINE",xe[xe.MANDATORY_NEWLINE=4]="MANDATORY_NEWLINE",xe[xe.INDENT=5]="INDENT",xe[xe.SINGLE_INDENT=6]="SINGLE_INDENT";class Me{constructor(e){this.indentation=e,this.items=[]}add(...e){for(const s of e)switch(s){case be.SPACE:this.items.push(be.SPACE);break;case be.NO_SPACE:this.trimHorizontalWhitespace();break;case be.NO_NEWLINE:this.trimWhitespace();break;case be.NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(be.NEWLINE);break;case be.MANDATORY_NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(be.MANDATORY_NEWLINE);break;case be.INDENT:this.addIndentation();break;case be.SINGLE_INDENT:this.items.push(be.SINGLE_INDENT);break;default:this.items.push(s)}}trimHorizontalWhitespace(){for(;$e(L(this.items));)this.items.pop()}trimWhitespace(){for(;ge(L(this.items));)this.items.pop()}addNewline(e){if(this.items.length>0)switch(L(this.items)){case be.NEWLINE:this.items.pop(),this.items.push(e);break;case be.MANDATORY_NEWLINE:break;default:this.items.push(e)}}addIndentation(){for(let e=0;e<this.indentation.getLevel();e++)this.items.push(be.SINGLE_INDENT)}toString(){return this.items.map((e=>this.itemToString(e))).join("")}getLayoutItems(){return this.items}itemToString(e){switch(e){case be.SPACE:return" ";case be.NEWLINE:case be.MANDATORY_NEWLINE:return"\n";case be.SINGLE_INDENT:return this.indentation.getSingleIndent();default:return e}}}const $e=e=>e===be.SPACE||e===be.SINGLE_INDENT,ge=e=>e===be.SPACE||e===be.SINGLE_INDENT||e===be.NEWLINE;function Ue(e,s){if("standard"===s)return e;let t=[];return e.length>=10&&e.includes(" ")&&([e,...t]=e.split(" ")),(e="tabularLeft"===s?e.padEnd(9," "):e.padStart(9," "))+["",...t].join(" ")}function we(e){return(e=>e===R.AND||e===R.OR||e===R.XOR)(e)||e===R.RESERVED_CLAUSE||e===R.RESERVED_SELECT||e===R.RESERVED_SET_OPERATION||e===R.RESERVED_JOIN||e===R.LIMIT}const Be="top-level";class Ge{constructor(e){this.indent=e,this.indentTypes=[]}getSingleIndent(){return this.indent}getLevel(){return this.indentTypes.length}increaseTopLevel(){this.indentTypes.push(Be)}increaseBlockLevel(){this.indentTypes.push("block-level")}decreaseTopLevel(){this.indentTypes.length>0&&L(this.indentTypes)===Be&&this.indentTypes.pop()}decreaseBlockLevel(){for(;this.indentTypes.length>0;){if(this.indentTypes.pop()!==Be)break}}}class Ye extends Me{constructor(e){super(new Ge("")),this.expressionWidth=e,this.length=0,this.trailingSpace=!1}add(...e){if(e.forEach((e=>this.addToLength(e))),this.length>this.expressionWidth)throw new Fe;super.add(...e)}addToLength(e){if("string"==typeof e)this.length+=e.length,this.trailingSpace=!1;else{if(e===be.MANDATORY_NEWLINE||e===be.NEWLINE)throw new Fe;e===be.INDENT||e===be.SINGLE_INDENT||e===be.SPACE?this.trailingSpace||(this.length++,this.trailingSpace=!0):e!==be.NO_NEWLINE&&e!==be.NO_SPACE||this.trailingSpace&&(this.trailingSpace=!1,this.length--)}}}class Fe extends Error{}class Ve{constructor({cfg:e,dialectCfg:s,params:t,layout:r,inline:n=!1}){this.inline=!1,this.nodes=[],this.index=-1,this.cfg=e,this.dialectCfg=s,this.inline=n,this.params=t,this.layout=r}format(e){for(this.nodes=e,this.index=0;this.index<this.nodes.length;this.index++)this.formatNode(this.nodes[this.index]);return this.layout}formatNode(e){this.formatComments(e.leadingComments),this.formatNodeWithoutComments(e),this.formatComments(e.trailingComments)}formatNodeWithoutComments(e){switch(e.type){case ce.function_call:return this.formatFunctionCall(e);case ce.parameterized_data_type:return this.formatParameterizedDataType(e);case ce.array_subscript:return this.formatArraySubscript(e);case ce.property_access:return this.formatPropertyAccess(e);case ce.parenthesis:return this.formatParenthesis(e);case ce.between_predicate:return this.formatBetweenPredicate(e);case ce.case_expression:return this.formatCaseExpression(e);case ce.case_when:return this.formatCaseWhen(e);case ce.case_else:return this.formatCaseElse(e);case ce.clause:return this.formatClause(e);case ce.set_operation:return this.formatSetOperation(e);case ce.limit_clause:return this.formatLimitClause(e);case ce.all_columns_asterisk:return this.formatAllColumnsAsterisk(e);case ce.literal:return this.formatLiteral(e);case ce.identifier:return this.formatIdentifier(e);case ce.parameter:return this.formatParameter(e);case ce.operator:return this.formatOperator(e);case ce.comma:return this.formatComma(e);case ce.line_comment:return this.formatLineComment(e);case ce.block_comment:case ce.disable_comment:return this.formatBlockComment(e);case ce.data_type:return this.formatDataType(e);case ce.keyword:return this.formatKeywordNode(e)}}formatFunctionCall(e){this.withComments(e.nameKw,(()=>{this.layout.add(this.showFunctionKw(e.nameKw))})),this.formatNode(e.parenthesis)}formatParameterizedDataType(e){this.withComments(e.dataType,(()=>{this.layout.add(this.showDataType(e.dataType))})),this.formatNode(e.parenthesis)}formatArraySubscript(e){let s;switch(e.array.type){case ce.data_type:s=this.showDataType(e.array);break;case ce.keyword:s=this.showKw(e.array);break;default:s=this.showIdentifier(e.array)}this.withComments(e.array,(()=>{this.layout.add(s)})),this.formatNode(e.parenthesis)}formatPropertyAccess(e){this.formatNode(e.object),this.layout.add(be.NO_SPACE,e.operator),this.formatNode(e.property)}formatParenthesis(e){const s=this.formatInlineExpression(e.children);s?(this.layout.add(e.openParen),this.layout.add(...s.getLayoutItems()),this.layout.add(be.NO_SPACE,e.closeParen,be.SPACE)):(this.layout.add(e.openParen,be.NEWLINE),z(this.cfg)?(this.layout.add(be.INDENT),this.layout=this.formatSubExpression(e.children)):(this.layout.indentation.increaseBlockLevel(),this.layout.add(be.INDENT),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseBlockLevel()),this.layout.add(be.NEWLINE,be.INDENT,e.closeParen,be.SPACE))}formatBetweenPredicate(e){this.layout.add(this.showKw(e.betweenKw),be.SPACE),this.layout=this.formatSubExpression(e.expr1),this.layout.add(be.NO_SPACE,be.SPACE,this.showNonTabularKw(e.andKw),be.SPACE),this.layout=this.formatSubExpression(e.expr2),this.layout.add(be.SPACE)}formatCaseExpression(e){this.formatNode(e.caseKw),this.layout.indentation.increaseBlockLevel(),this.layout=this.formatSubExpression(e.expr),this.layout=this.formatSubExpression(e.clauses),this.layout.indentation.decreaseBlockLevel(),this.layout.add(be.NEWLINE,be.INDENT),this.formatNode(e.endKw)}formatCaseWhen(e){this.layout.add(be.NEWLINE,be.INDENT),this.formatNode(e.whenKw),this.layout=this.formatSubExpression(e.condition),this.formatNode(e.thenKw),this.layout=this.formatSubExpression(e.result)}formatCaseElse(e){this.layout.add(be.NEWLINE,be.INDENT),this.formatNode(e.elseKw),this.layout=this.formatSubExpression(e.result)}formatClause(e){this.isOnelineClause(e)?this.formatClauseInOnelineStyle(e):z(this.cfg)?this.formatClauseInTabularStyle(e):this.formatClauseInIndentedStyle(e)}isOnelineClause(e){return z(this.cfg)?this.dialectCfg.tabularOnelineClauses[e.nameKw.text]:this.dialectCfg.onelineClauses[e.nameKw.text]}formatClauseInIndentedStyle(e){this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e.nameKw),be.NEWLINE),this.layout.indentation.increaseTopLevel(),this.layout.add(be.INDENT),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseTopLevel()}formatClauseInOnelineStyle(e){this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e.nameKw),be.SPACE),this.layout=this.formatSubExpression(e.children)}formatClauseInTabularStyle(e){this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e.nameKw),be.SPACE),this.layout.indentation.increaseTopLevel(),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseTopLevel()}formatSetOperation(e){this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e.nameKw),be.NEWLINE),this.layout.add(be.INDENT),this.layout=this.formatSubExpression(e.children)}formatLimitClause(e){this.withComments(e.limitKw,(()=>{this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e.limitKw))})),this.layout.indentation.increaseTopLevel(),z(this.cfg)?this.layout.add(be.SPACE):this.layout.add(be.NEWLINE,be.INDENT),e.offset?(this.layout=this.formatSubExpression(e.offset),this.layout.add(be.NO_SPACE,",",be.SPACE),this.layout=this.formatSubExpression(e.count)):this.layout=this.formatSubExpression(e.count),this.layout.indentation.decreaseTopLevel()}formatAllColumnsAsterisk(e){this.layout.add("*",be.SPACE)}formatLiteral(e){this.layout.add(e.text,be.SPACE)}formatIdentifier(e){this.layout.add(this.showIdentifier(e),be.SPACE)}formatParameter(e){this.layout.add(this.params.get(e),be.SPACE)}formatOperator({text:e}){this.cfg.denseOperators||this.dialectCfg.alwaysDenseOperators.includes(e)?this.layout.add(be.NO_SPACE,e):":"===e?this.layout.add(be.NO_SPACE,e,be.SPACE):this.layout.add(e,be.SPACE)}formatComma(e){this.inline?this.layout.add(be.NO_SPACE,",",be.SPACE):this.layout.add(be.NO_SPACE,",",be.NEWLINE,be.INDENT)}withComments(e,s){this.formatComments(e.leadingComments),s(),this.formatComments(e.trailingComments)}formatComments(e){e&&e.forEach((e=>{e.type===ce.line_comment?this.formatLineComment(e):this.formatBlockComment(e)}))}formatLineComment(e){f(e.precedingWhitespace||"")?this.layout.add(be.NEWLINE,be.INDENT,e.text,be.MANDATORY_NEWLINE,be.INDENT):this.layout.getLayoutItems().length>0?this.layout.add(be.NO_NEWLINE,be.SPACE,e.text,be.MANDATORY_NEWLINE,be.INDENT):this.layout.add(e.text,be.MANDATORY_NEWLINE,be.INDENT)}formatBlockComment(e){e.type===ce.block_comment&&this.isMultilineBlockComment(e)?(this.splitBlockComment(e.text).forEach((e=>{this.layout.add(be.NEWLINE,be.INDENT,e)})),this.layout.add(be.NEWLINE,be.INDENT)):this.layout.add(e.text,be.SPACE)}isMultilineBlockComment(e){return f(e.text)||f(e.precedingWhitespace||"")}isDocComment(e){const s=e.split(/\n/);return/^\/\*\*?$/.test(s[0])&&s.slice(1,s.length-1).every((e=>/^\s*\*/.test(e)))&&/^\s*\*\/$/.test(L(s))}splitBlockComment(e){return this.isDocComment(e)?e.split(/\n/).map((e=>/^\s*\*/.test(e)?" "+e.replace(/^\s*/,""):e)):e.split(/\n/).map((e=>e.replace(/^\s*/,"")))}formatSubExpression(e){return new Ve({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:this.layout,inline:this.inline}).format(e)}formatInlineExpression(e){const s=this.params.getPositionalParameterIndex();try{return new Ve({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:new Ye(this.cfg.expressionWidth),inline:!0}).format(e)}catch(t){if(t instanceof Fe)return void this.params.setPositionalParameterIndex(s);throw t}}formatKeywordNode(e){switch(e.tokenType){case R.RESERVED_JOIN:return this.formatJoin(e);case R.AND:case R.OR:case R.XOR:return this.formatLogicalOperator(e);default:return this.formatKeyword(e)}}formatJoin(e){z(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e),be.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e),be.SPACE)}formatKeyword(e){this.layout.add(this.showKw(e),be.SPACE)}formatLogicalOperator(e){"before"===this.cfg.logicalOperatorNewline?z(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e),be.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(be.NEWLINE,be.INDENT,this.showKw(e),be.SPACE):this.layout.add(this.showKw(e),be.NEWLINE,be.INDENT)}formatDataType(e){this.layout.add(this.showDataType(e),be.SPACE)}showKw(e){return we(e.tokenType)?Ue(this.showNonTabularKw(e),this.cfg.indentStyle):this.showNonTabularKw(e)}showNonTabularKw(e){switch(this.cfg.keywordCase){case"preserve":return C(e.raw);case"upper":return e.text;case"lower":return e.text.toLowerCase()}}showFunctionKw(e){return we(e.tokenType)?Ue(this.showNonTabularFunctionKw(e),this.cfg.indentStyle):this.showNonTabularFunctionKw(e)}showNonTabularFunctionKw(e){switch(this.cfg.functionCase){case"preserve":return C(e.raw);case"upper":return e.text;case"lower":return e.text.toLowerCase()}}showIdentifier(e){if(e.quoted)return e.text;switch(this.cfg.identifierCase){case"preserve":return e.text;case"upper":return e.text.toUpperCase();case"lower":return e.text.toLowerCase()}}showDataType(e){switch(this.cfg.dataTypeCase){case"preserve":return C(e.raw);case"upper":return e.text;case"lower":return e.text.toLowerCase()}}}class We{constructor(e,s){this.dialect=e,this.cfg=s,this.params=new ee(this.cfg.params)}format(e){const s=this.parse(e);return this.formatAst(s).trimEnd()}parse(e){return function(e){let s={};const t=new Ne((t=>{return[...(r=e.tokenize(t,s),r.map(ae).map(oe).map(_e).map(Te).map(le)),p(t.length)];var r})),r=new De(Pe.fromCompiled(fe),{lexer:t});return{parse:(e,t)=>{s=t;const{results:n}=r.feed(e);if(1===n.length)return n[0];throw 0===n.length?new Error("Parse error: Invalid SQL"):new Error(`Parse error: Ambiguous grammar\n${JSON.stringify(n,void 0,2)}`)}}}(this.dialect.tokenizer).parse(e,this.cfg.paramTypes||{})}formatAst(e){return e.map((e=>this.formatStatement(e))).join("\n".repeat(this.cfg.linesBetweenQueries+1))}formatStatement(e){const s=new Ve({cfg:this.cfg,dialectCfg:this.dialect.formatOptions,params:this.params,layout:new Me(new Ge((t=this.cfg,"tabularLeft"===t.indentStyle||"tabularRight"===t.indentStyle?" ".repeat(10):t.useTabs?"\t":" ".repeat(t.tabWidth))))}).format(e.children);var t;return e.hasSemicolon&&(this.cfg.newlineBeforeSemicolon?s.add(be.NEWLINE,";"):s.add(be.NO_NEWLINE,";")),s.toString()}}class He extends Error{}function ve(e){const s=["multilineLists","newlineBeforeOpenParen","newlineBeforeCloseParen","aliasAs","commaPosition","tabulateAlias"];for(const r of s)if(r in e)throw new He(`${r} config is no more supported.`);if(e.expressionWidth<=0)throw new He(`expressionWidth config must be positive number. Received ${e.expressionWidth} instead.`);var t;if(e.params&&!((t=e.params)instanceof Array?t:Object.values(t)).every((e=>"string"==typeof e))&&console.warn('WARNING: All "params" option values should be strings.'),e.paramTypes&&!function(e){if(e.custom&&Array.isArray(e.custom))return e.custom.every((e=>""!==e.regex));return!0}(e.paramTypes))throw new He("Empty regex given in custom paramTypes. That would result in matching infinite amount of parameters.");return e}const ke={tabWidth:2,useTabs:!1,keywordCase:"preserve",identifierCase:"preserve",dataTypeCase:"preserve",functionCase:"preserve",indentStyle:"standard",logicalOperatorNewline:"before",expressionWidth:50,linesBetweenQueries:1,denseOperators:!1,newlineBeforeSemicolon:!1},Ke=(e,s)=>{var{dialect:t}=s,r=function(e,s){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)s.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(t[r[n]]=e[r[n]])}return t}(s,["dialect"]);if("string"!=typeof e)throw new Error("Invalid query argument. Expected string, instead got "+typeof e);const n=ve(Object.assign(Object.assign({},ke),r));return new We((e=>{let s=j.get(e);return s||(s=Q(e),j.set(e,s)),s})(t),n).format(e)};export{He as ConfigError,y as duckdb,s as expandPhrases,Ke as formatDialect};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as r,l as s,I as t,d as e,K as a}from"./mermaid-CuLRZCyq.js";import{p as o}from"./radar-MK3ICKWK-BVDhd2Ix.js";import"./index-CBYlZPe-.js";import"./transform-DjHZbYKP.js";import"./timer-DFzT7np-.js";import"./step-5BjdtTEt.js";import"./_baseEach-BbaGBH6b.js";import"./_baseUniq-DwI7aCVR.js";import"./min-BGzKxLRu.js";import"./_baseMap-Dhykr5mK.js";import"./clone-DDJrKwkg.js";import"./_createAggregator-Ch46xhpY.js";var i={parse:r((async r=>{const t=await o("info",r);s.debug(t)}),"parse")},n={version:a.version},p={parser:i,db:{getVersion:r((()=>n.version),"getVersion")},renderer:{draw:r(((r,a,o)=>{s.debug("rendering info diagram\n"+r);const i=t(a);e(i,100,400,!0);i.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)}),"draw")}};export{p as diagram};
|
package/dist/assets/{journeyDiagram-U35MCT3I-CKCqq8gm.js → journeyDiagram-U35MCT3I-Bp5eSwtQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,g as e,f as n,d as i}from"./chunk-D6G4REZN-CMW2vGYf.js";import{_ as s,g as r,s as a,a as o,b as c,q as l,p as h,c as u,d as p,y}from"./mermaid-uo9TLHWr.js";import{s as d}from"./transform-DjHZbYKP.js";import{d as f}from"./arc-cUKDg37C.js";import"./index-Cp9clns9.js";import"./step-5BjdtTEt.js";import"./timer-DFzT7np-.js";var g=function(){var t=s((function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n}),"o"),e=[6,8,10,11,12,14,16,17,18],n=[1,9],i=[1,10],r=[1,11],a=[1,12],o=[1,13],c=[1,14],l={trace:s((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s((function(t,e,n,i,s,r,a){var o=r.length-1;switch(s){case 1:return r[o-1];case 2:case 6:case 7:this.$=[];break;case 3:r[o-1].push(r[o]),this.$=r[o-1];break;case 4:case 5:this.$=r[o];break;case 8:i.setDiagramTitle(r[o].substr(6)),this.$=r[o].substr(6);break;case 9:this.$=r[o].trim(),i.setAccTitle(this.$);break;case 10:case 11:this.$=r[o].trim(),i.setAccDescription(this.$);break;case 12:i.addSection(r[o].substr(8)),this.$=r[o].substr(8);break;case 13:i.addTask(r[o-1],r[o]),this.$="task"}}),"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:n,12:i,14:r,16:a,17:o,18:c},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:n,12:i,14:r,16:a,17:o,18:c},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:s((function(t){var e=this,n=[0],i=[],r=[null],a=[],o=this.table,c="",l=0,h=0,u=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(y.yy[d]=this.yy[d]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;a.push(f);var g=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=i.pop()||p.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s((function(t){n.length=n.length-2*t,r.length=r.length-t,a.length=a.length-t}),"popStack"),s(m,"lex");for(var x,k,_,b,w,v,$,T,M={};;){if(k=n[n.length-1],this.defaultActions[k]?_=this.defaultActions[k]:(null==x&&(x=m()),_=o[k]&&o[k][x]),void 0===_||!_.length||!_[0]){var S="";for(w in T=[],o[k])this.terminals_[w]&&w>2&&T.push("'"+this.terminals_[w]+"'");S=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[x]||x)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==x?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(S,{text:p.match,token:this.terminals_[x]||x,line:p.yylineno,loc:f,expected:T})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+x);switch(_[0]){case 1:n.push(x),r.push(p.yytext),a.push(p.yylloc),n.push(_[1]),x=null,h=p.yyleng,c=p.yytext,l=p.yylineno,f=p.yylloc;break;case 2:if(v=this.productions_[_[1]][1],M.$=r[r.length-v],M._$={first_line:a[a.length-(v||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(v||1)].first_column,last_column:a[a.length-1].last_column},g&&(M._$.range=[a[a.length-(v||1)].range[0],a[a.length-1].range[1]]),void 0!==(b=this.performAction.apply(M,[c,h,l,y.yy,_[1],r,a].concat(u))))return b;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),a=a.slice(0,-1*v)),n.push(this.productions_[_[1]][0]),r.push(M.$),a.push(M._$),$=o[n[n.length-2]][n[n.length-1]],n.push($);break;case 3:return!0}}return!0}),"parse")},h=function(){return{EOF:1,parseError:s((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:s((function(t,e){return this.yy=e||this.yy||{},this._input=t,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:s((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:s((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var s=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:s((function(){return this._more=!0,this}),"more"),reject:s((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:s((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:s((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:s((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:s((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:s((function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(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))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1}),"test_match"),next:s((function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:s((function(){var t=this.next();return t||this.lex()}),"lex"),begin:s((function(t){this.conditionStack.push(t)}),"begin"),popState:s((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:s((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:s((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:s((function(t){this.begin(t)}),"pushState"),stateStackSize:s((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:s((function(t,e,n,i){switch(n){case 0:case 1:case 3:case 4:break;case 2:return 10;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}}),"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}}}();function u(){this.yy={}}return l.lexer=h,s(u,"Parser"),u.prototype=l,l.Parser=u,new u}();g.parser=g;var m=g,x="",k=[],_=[],b=[],w=s((function(){k.length=0,_.length=0,x="",b.length=0,y()}),"clear"),v=s((function(t){x=t,k.push(t)}),"addSection"),$=s((function(){return k}),"getSections"),T=s((function(){let t=A();let e=0;for(;!t&&e<100;)t=A(),e++;return _.push(...b),_}),"getTasks"),M=s((function(){const t=[];_.forEach((e=>{e.people&&t.push(...e.people)}));return[...new Set(t)].sort()}),"updateActors"),S=s((function(t,e){const n=e.substr(1).split(":");let i=0,s=[];1===n.length?(i=Number(n[0]),s=[]):(i=Number(n[0]),s=n[1].split(","));const r=s.map((t=>t.trim())),a={section:x,type:x,people:r,task:t,score:i};b.push(a)}),"addTask"),E=s((function(t){const e={section:x,type:x,description:t,task:t,classes:[]};_.push(e)}),"addTaskOrg"),A=s((function(){const t=s((function(t){return b[t].processed}),"compileTask");let e=!0;for(const[n,i]of b.entries())t(n),e=e&&i.processed;return e}),"compileTasks"),I=s((function(){return M()}),"getActors"),P={getConfig:s((()=>u().journey),"getConfig"),clear:w,setDiagramTitle:h,getDiagramTitle:l,setAccTitle:c,getAccTitle:o,setAccDescription:a,getAccDescription:r,addSection:v,getSections:$,getTasks:T,addTask:S,addTaskOrg:E,getActors:I},j=s((t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.textColor};\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ${t.textColor}\n }\n\n .legend {\n fill: ${t.textColor};\n font-family: ${t.fontFamily};\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ${t.textColor}\n }\n\n .face {\n ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ${t.fillType0?`fill: ${t.fillType0}`:""};\n }\n .task-type-1, .section-type-1 {\n ${t.fillType0?`fill: ${t.fillType1}`:""};\n }\n .task-type-2, .section-type-2 {\n ${t.fillType0?`fill: ${t.fillType2}`:""};\n }\n .task-type-3, .section-type-3 {\n ${t.fillType0?`fill: ${t.fillType3}`:""};\n }\n .task-type-4, .section-type-4 {\n ${t.fillType0?`fill: ${t.fillType4}`:""};\n }\n .task-type-5, .section-type-5 {\n ${t.fillType0?`fill: ${t.fillType5}`:""};\n }\n .task-type-6, .section-type-6 {\n ${t.fillType0?`fill: ${t.fillType6}`:""};\n }\n .task-type-7, .section-type-7 {\n ${t.fillType0?`fill: ${t.fillType7}`:""};\n }\n\n .actor-0 {\n ${t.actor0?`fill: ${t.actor0}`:""};\n }\n .actor-1 {\n ${t.actor1?`fill: ${t.actor1}`:""};\n }\n .actor-2 {\n ${t.actor2?`fill: ${t.actor2}`:""};\n }\n .actor-3 {\n ${t.actor3?`fill: ${t.actor3}`:""};\n }\n .actor-4 {\n ${t.actor4?`fill: ${t.actor4}`:""};\n }\n .actor-5 {\n ${t.actor5?`fill: ${t.actor5}`:""};\n }\n`),"getStyles"),C=s((function(t,e){return i(t,e)}),"drawRect"),V=s((function(t,e){const n=15,i=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",n).attr("stroke-width",2).attr("overflow","visible"),r=t.append("g");function a(t){const i=f().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",i).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function o(t){const i=f().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",i).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function c(t){t.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return r.append("circle").attr("cx",e.cx-5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",e.cx+5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s(a,"smile"),s(o,"sad"),s(c,"ambivalent"),e.score>3?a(r):e.score<3?o(r):c(r),i}),"drawFace"),F=s((function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n}),"drawCircle"),L=s((function(t,e){return n(t,e)}),"drawText"),O=s((function(t,e){function n(t,e,n,i,s){return t+","+e+" "+(t+n)+","+e+" "+(t+n)+","+(e+i-s)+" "+(t+n-1.2*s)+","+(e+i)+" "+t+","+(e+i)}s(n,"genPoints");const i=t.append("polygon");i.attr("points",n(e.x,e.y,50,20,7)),i.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,L(t,e)}),"drawLabel"),D=s((function(t,n,i){const s=t.append("g"),r=e();r.x=n.x,r.y=n.y,r.fill=n.fill,r.width=i.width*n.taskCount+i.diagramMarginX*(n.taskCount-1),r.height=i.height,r.class="journey-section section-type-"+n.num,r.rx=3,r.ry=3,C(s,r),z(i)(n.text,s,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+n.num},i,n.colour)}),"drawSection"),B=-1,N=s((function(t,n,i){const s=n.x+i.width/2,r=t.append("g");B++;r.append("line").attr("id","task"+B).attr("x1",s).attr("y1",n.y).attr("x2",s).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),V(r,{cx:s,cy:300+30*(5-n.score),score:n.score});const a=e();a.x=n.x,a.y=n.y,a.fill=n.fill,a.width=i.width,a.height=i.height,a.class="task task-type-"+n.num,a.rx=3,a.ry=3,C(r,a);let o=n.x+14;n.people.forEach((t=>{const e=n.actors[t].color,i={cx:o,cy:n.y,r:7,fill:e,stroke:"#000",title:t,pos:n.actors[t].position};F(r,i),o+=10})),z(i)(n.task,r,a.x,a.y,a.width,a.height,{class:"task"},i,n.colour)}),"drawTask"),R=s((function(e,n){t(e,n)}),"drawBackgroundRect"),z=function(){function t(t,e,n,s,r,a,o,c){i(e.append("text").attr("x",n+r/2).attr("y",s+a/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function e(t,e,n,s,r,a,o,c,l){const{taskFontSize:h,taskFontFamily:u}=c,p=t.split(/<br\s*\/?>/gi);for(let y=0;y<p.length;y++){const t=y*h-h*(p.length-1)/2,c=e.append("text").attr("x",n+r/2).attr("y",s).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",u);c.append("tspan").attr("x",n+r/2).attr("dy",t).text(p[y]),c.attr("y",s+a/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(c,o)}}function n(t,n,s,r,a,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",s).attr("y",r).attr("width",a).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,s,r,a,o,c,l),i(u,c)}function i(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return s(t,"byText"),s(e,"byTspan"),s(n,"byFo"),s(i,"_setTextAttrs"),function(i){return"fo"===i.textPlacement?n:"old"===i.textPlacement?t:e}}(),Y={drawRect:C,drawCircle:F,drawSection:D,drawText:L,drawLabel:O,drawTask:N,drawBackgroundRect:R,initGraphics:s((function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")}),"initGraphics")},q=s((function(t){Object.keys(t).forEach((function(e){X[e]=t[e]}))}),"setConf"),G={};function W(t){const e=u().journey;let n=60;Object.keys(G).forEach((i=>{const s=G[i].color,r={cx:20,cy:n,r:7,fill:s,stroke:"#000",pos:G[i].position};Y.drawCircle(t,r);const a={x:40,y:n+7,fill:"#666",text:i,textMargin:5|e.boxTextMargin};Y.drawText(t,a),n+=20}))}s(W,"drawActorLegend");var X=u().journey,Z=X.leftMargin,U=s((function(t,e,n,i){const s=u().journey,r=u().securityLevel;let a;"sandbox"===r&&(a=d("#i"+e));const o=d("sandbox"===r?a.nodes()[0].contentDocument.body:"body");H.init();const c=o.select("#"+e);Y.initGraphics(c);const l=i.db.getTasks(),h=i.db.getDiagramTitle(),y=i.db.getActors();for(const u in G)delete G[u];let f=0;y.forEach((t=>{G[t]={color:s.actorColours[f%s.actorColours.length],position:f},f++})),W(c),H.insert(0,0,Z,50*Object.keys(G).length),Q(c,l,0);const g=H.getBounds();h&&c.append("text").text(h).attr("x",Z).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const m=g.stopy-g.starty+2*s.diagramMarginY,x=Z+g.stopx+2*s.diagramMarginX;p(c,m,x,s.useMaxWidth),c.append("line").attr("x1",Z).attr("y1",4*s.height).attr("x2",x-Z-4).attr("y2",4*s.height).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const k=h?70:0;c.attr("viewBox",`${g.startx} -25 ${x} ${m+k}`),c.attr("preserveAspectRatio","xMinYMin meet"),c.attr("height",m+k+25)}),"draw"),H={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:s((function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0}),"init"),updateVal:s((function(t,e,n,i){void 0===t[e]?t[e]=n:t[e]=i(n,t[e])}),"updateVal"),updateBounds:s((function(t,e,n,i){const r=u().journey,a=this;let o=0;function c(c){return s((function(s){o++;const l=a.sequenceItems.length-o+1;a.updateVal(s,"starty",e-l*r.boxMargin,Math.min),a.updateVal(s,"stopy",i+l*r.boxMargin,Math.max),a.updateVal(H.data,"startx",t-l*r.boxMargin,Math.min),a.updateVal(H.data,"stopx",n+l*r.boxMargin,Math.max),"activation"!==c&&(a.updateVal(s,"startx",t-l*r.boxMargin,Math.min),a.updateVal(s,"stopx",n+l*r.boxMargin,Math.max),a.updateVal(H.data,"starty",e-l*r.boxMargin,Math.min),a.updateVal(H.data,"stopy",i+l*r.boxMargin,Math.max))}),"updateItemBounds")}s(c,"updateFn"),this.sequenceItems.forEach(c())}),"updateBounds"),insert:s((function(t,e,n,i){const s=Math.min(t,n),r=Math.max(t,n),a=Math.min(e,i),o=Math.max(e,i);this.updateVal(H.data,"startx",s,Math.min),this.updateVal(H.data,"starty",a,Math.min),this.updateVal(H.data,"stopx",r,Math.max),this.updateVal(H.data,"stopy",o,Math.max),this.updateBounds(s,a,r,o)}),"insert"),bumpVerticalPos:s((function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos}),"bumpVerticalPos"),getVerticalPos:s((function(){return this.verticalPos}),"getVerticalPos"),getBounds:s((function(){return this.data}),"getBounds")},J=X.sectionFills,K=X.sectionColours,Q=s((function(t,e,n){const i=u().journey;let s="";const r=n+(2*i.height+i.diagramMarginY);let a=0,o="#CCC",c="black",l=0;for(const[h,u]of e.entries()){if(s!==u.section){o=J[a%J.length],l=a%J.length,c=K[a%K.length];let n=0;const r=u.section;for(let t=h;t<e.length&&e[t].section==r;t++)n+=1;const p={x:h*i.taskMargin+h*i.width+Z,y:50,text:u.section,fill:o,num:l,colour:c,taskCount:n};Y.drawSection(t,p,i),s=u.section,a++}const n=u.people.reduce(((t,e)=>(G[e]&&(t[e]=G[e]),t)),{});u.x=h*i.taskMargin+h*i.width+Z,u.y=r,u.width=i.diagramMarginX,u.height=i.diagramMarginY,u.colour=c,u.fill=o,u.num=l,u.actors=n,Y.drawTask(t,u,i),H.insert(u.x,u.y,u.x+u.width+i.taskMargin,450)}}),"drawTasks"),tt={setConf:q,draw:U},et={parser:m,db:P,renderer:tt,styles:j,init:s((t=>{tt.setConf(t.journey),P.clear()}),"init")};export{et as diagram};
|
|
1
|
+
import{a as t,g as e,f as n,d as i}from"./chunk-D6G4REZN-CZ1gVegu.js";import{_ as s,g as r,s as a,a as o,b as c,q as l,p as h,c as u,d as p,y}from"./mermaid-CuLRZCyq.js";import{s as d}from"./transform-DjHZbYKP.js";import{d as f}from"./arc-cUKDg37C.js";import"./index-CBYlZPe-.js";import"./step-5BjdtTEt.js";import"./timer-DFzT7np-.js";var g=function(){var t=s((function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n}),"o"),e=[6,8,10,11,12,14,16,17,18],n=[1,9],i=[1,10],r=[1,11],a=[1,12],o=[1,13],c=[1,14],l={trace:s((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s((function(t,e,n,i,s,r,a){var o=r.length-1;switch(s){case 1:return r[o-1];case 2:case 6:case 7:this.$=[];break;case 3:r[o-1].push(r[o]),this.$=r[o-1];break;case 4:case 5:this.$=r[o];break;case 8:i.setDiagramTitle(r[o].substr(6)),this.$=r[o].substr(6);break;case 9:this.$=r[o].trim(),i.setAccTitle(this.$);break;case 10:case 11:this.$=r[o].trim(),i.setAccDescription(this.$);break;case 12:i.addSection(r[o].substr(8)),this.$=r[o].substr(8);break;case 13:i.addTask(r[o-1],r[o]),this.$="task"}}),"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:n,12:i,14:r,16:a,17:o,18:c},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:n,12:i,14:r,16:a,17:o,18:c},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:s((function(t){var e=this,n=[0],i=[],r=[null],a=[],o=this.table,c="",l=0,h=0,u=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(y.yy[d]=this.yy[d]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;a.push(f);var g=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=i.pop()||p.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s((function(t){n.length=n.length-2*t,r.length=r.length-t,a.length=a.length-t}),"popStack"),s(m,"lex");for(var x,k,_,b,w,v,$,T,M={};;){if(k=n[n.length-1],this.defaultActions[k]?_=this.defaultActions[k]:(null==x&&(x=m()),_=o[k]&&o[k][x]),void 0===_||!_.length||!_[0]){var S="";for(w in T=[],o[k])this.terminals_[w]&&w>2&&T.push("'"+this.terminals_[w]+"'");S=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[x]||x)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==x?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(S,{text:p.match,token:this.terminals_[x]||x,line:p.yylineno,loc:f,expected:T})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+x);switch(_[0]){case 1:n.push(x),r.push(p.yytext),a.push(p.yylloc),n.push(_[1]),x=null,h=p.yyleng,c=p.yytext,l=p.yylineno,f=p.yylloc;break;case 2:if(v=this.productions_[_[1]][1],M.$=r[r.length-v],M._$={first_line:a[a.length-(v||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(v||1)].first_column,last_column:a[a.length-1].last_column},g&&(M._$.range=[a[a.length-(v||1)].range[0],a[a.length-1].range[1]]),void 0!==(b=this.performAction.apply(M,[c,h,l,y.yy,_[1],r,a].concat(u))))return b;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),a=a.slice(0,-1*v)),n.push(this.productions_[_[1]][0]),r.push(M.$),a.push(M._$),$=o[n[n.length-2]][n[n.length-1]],n.push($);break;case 3:return!0}}return!0}),"parse")},h=function(){return{EOF:1,parseError:s((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:s((function(t,e){return this.yy=e||this.yy||{},this._input=t,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:s((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:s((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var s=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:s((function(){return this._more=!0,this}),"more"),reject:s((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:s((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:s((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:s((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:s((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:s((function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(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))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1}),"test_match"),next:s((function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:s((function(){var t=this.next();return t||this.lex()}),"lex"),begin:s((function(t){this.conditionStack.push(t)}),"begin"),popState:s((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:s((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:s((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:s((function(t){this.begin(t)}),"pushState"),stateStackSize:s((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:s((function(t,e,n,i){switch(n){case 0:case 1:case 3:case 4:break;case 2:return 10;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}}),"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}}}();function u(){this.yy={}}return l.lexer=h,s(u,"Parser"),u.prototype=l,l.Parser=u,new u}();g.parser=g;var m=g,x="",k=[],_=[],b=[],w=s((function(){k.length=0,_.length=0,x="",b.length=0,y()}),"clear"),v=s((function(t){x=t,k.push(t)}),"addSection"),$=s((function(){return k}),"getSections"),T=s((function(){let t=A();let e=0;for(;!t&&e<100;)t=A(),e++;return _.push(...b),_}),"getTasks"),M=s((function(){const t=[];_.forEach((e=>{e.people&&t.push(...e.people)}));return[...new Set(t)].sort()}),"updateActors"),S=s((function(t,e){const n=e.substr(1).split(":");let i=0,s=[];1===n.length?(i=Number(n[0]),s=[]):(i=Number(n[0]),s=n[1].split(","));const r=s.map((t=>t.trim())),a={section:x,type:x,people:r,task:t,score:i};b.push(a)}),"addTask"),E=s((function(t){const e={section:x,type:x,description:t,task:t,classes:[]};_.push(e)}),"addTaskOrg"),A=s((function(){const t=s((function(t){return b[t].processed}),"compileTask");let e=!0;for(const[n,i]of b.entries())t(n),e=e&&i.processed;return e}),"compileTasks"),I=s((function(){return M()}),"getActors"),P={getConfig:s((()=>u().journey),"getConfig"),clear:w,setDiagramTitle:h,getDiagramTitle:l,setAccTitle:c,getAccTitle:o,setAccDescription:a,getAccDescription:r,addSection:v,getSections:$,getTasks:T,addTask:S,addTaskOrg:E,getActors:I},j=s((t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.textColor};\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ${t.textColor}\n }\n\n .legend {\n fill: ${t.textColor};\n font-family: ${t.fontFamily};\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ${t.textColor}\n }\n\n .face {\n ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ${t.fillType0?`fill: ${t.fillType0}`:""};\n }\n .task-type-1, .section-type-1 {\n ${t.fillType0?`fill: ${t.fillType1}`:""};\n }\n .task-type-2, .section-type-2 {\n ${t.fillType0?`fill: ${t.fillType2}`:""};\n }\n .task-type-3, .section-type-3 {\n ${t.fillType0?`fill: ${t.fillType3}`:""};\n }\n .task-type-4, .section-type-4 {\n ${t.fillType0?`fill: ${t.fillType4}`:""};\n }\n .task-type-5, .section-type-5 {\n ${t.fillType0?`fill: ${t.fillType5}`:""};\n }\n .task-type-6, .section-type-6 {\n ${t.fillType0?`fill: ${t.fillType6}`:""};\n }\n .task-type-7, .section-type-7 {\n ${t.fillType0?`fill: ${t.fillType7}`:""};\n }\n\n .actor-0 {\n ${t.actor0?`fill: ${t.actor0}`:""};\n }\n .actor-1 {\n ${t.actor1?`fill: ${t.actor1}`:""};\n }\n .actor-2 {\n ${t.actor2?`fill: ${t.actor2}`:""};\n }\n .actor-3 {\n ${t.actor3?`fill: ${t.actor3}`:""};\n }\n .actor-4 {\n ${t.actor4?`fill: ${t.actor4}`:""};\n }\n .actor-5 {\n ${t.actor5?`fill: ${t.actor5}`:""};\n }\n`),"getStyles"),C=s((function(t,e){return i(t,e)}),"drawRect"),V=s((function(t,e){const n=15,i=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",n).attr("stroke-width",2).attr("overflow","visible"),r=t.append("g");function a(t){const i=f().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",i).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function o(t){const i=f().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",i).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function c(t){t.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return r.append("circle").attr("cx",e.cx-5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",e.cx+5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s(a,"smile"),s(o,"sad"),s(c,"ambivalent"),e.score>3?a(r):e.score<3?o(r):c(r),i}),"drawFace"),F=s((function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n}),"drawCircle"),L=s((function(t,e){return n(t,e)}),"drawText"),O=s((function(t,e){function n(t,e,n,i,s){return t+","+e+" "+(t+n)+","+e+" "+(t+n)+","+(e+i-s)+" "+(t+n-1.2*s)+","+(e+i)+" "+t+","+(e+i)}s(n,"genPoints");const i=t.append("polygon");i.attr("points",n(e.x,e.y,50,20,7)),i.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,L(t,e)}),"drawLabel"),D=s((function(t,n,i){const s=t.append("g"),r=e();r.x=n.x,r.y=n.y,r.fill=n.fill,r.width=i.width*n.taskCount+i.diagramMarginX*(n.taskCount-1),r.height=i.height,r.class="journey-section section-type-"+n.num,r.rx=3,r.ry=3,C(s,r),z(i)(n.text,s,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+n.num},i,n.colour)}),"drawSection"),B=-1,N=s((function(t,n,i){const s=n.x+i.width/2,r=t.append("g");B++;r.append("line").attr("id","task"+B).attr("x1",s).attr("y1",n.y).attr("x2",s).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),V(r,{cx:s,cy:300+30*(5-n.score),score:n.score});const a=e();a.x=n.x,a.y=n.y,a.fill=n.fill,a.width=i.width,a.height=i.height,a.class="task task-type-"+n.num,a.rx=3,a.ry=3,C(r,a);let o=n.x+14;n.people.forEach((t=>{const e=n.actors[t].color,i={cx:o,cy:n.y,r:7,fill:e,stroke:"#000",title:t,pos:n.actors[t].position};F(r,i),o+=10})),z(i)(n.task,r,a.x,a.y,a.width,a.height,{class:"task"},i,n.colour)}),"drawTask"),R=s((function(e,n){t(e,n)}),"drawBackgroundRect"),z=function(){function t(t,e,n,s,r,a,o,c){i(e.append("text").attr("x",n+r/2).attr("y",s+a/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function e(t,e,n,s,r,a,o,c,l){const{taskFontSize:h,taskFontFamily:u}=c,p=t.split(/<br\s*\/?>/gi);for(let y=0;y<p.length;y++){const t=y*h-h*(p.length-1)/2,c=e.append("text").attr("x",n+r/2).attr("y",s).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",u);c.append("tspan").attr("x",n+r/2).attr("dy",t).text(p[y]),c.attr("y",s+a/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(c,o)}}function n(t,n,s,r,a,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",s).attr("y",r).attr("width",a).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,s,r,a,o,c,l),i(u,c)}function i(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return s(t,"byText"),s(e,"byTspan"),s(n,"byFo"),s(i,"_setTextAttrs"),function(i){return"fo"===i.textPlacement?n:"old"===i.textPlacement?t:e}}(),Y={drawRect:C,drawCircle:F,drawSection:D,drawText:L,drawLabel:O,drawTask:N,drawBackgroundRect:R,initGraphics:s((function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")}),"initGraphics")},q=s((function(t){Object.keys(t).forEach((function(e){W[e]=t[e]}))}),"setConf"),X={};function G(t){const e=u().journey;let n=60;Object.keys(X).forEach((i=>{const s=X[i].color,r={cx:20,cy:n,r:7,fill:s,stroke:"#000",pos:X[i].position};Y.drawCircle(t,r);const a={x:40,y:n+7,fill:"#666",text:i,textMargin:5|e.boxTextMargin};Y.drawText(t,a),n+=20}))}s(G,"drawActorLegend");var W=u().journey,Z=W.leftMargin,U=s((function(t,e,n,i){const s=u().journey,r=u().securityLevel;let a;"sandbox"===r&&(a=d("#i"+e));const o=d("sandbox"===r?a.nodes()[0].contentDocument.body:"body");H.init();const c=o.select("#"+e);Y.initGraphics(c);const l=i.db.getTasks(),h=i.db.getDiagramTitle(),y=i.db.getActors();for(const u in X)delete X[u];let f=0;y.forEach((t=>{X[t]={color:s.actorColours[f%s.actorColours.length],position:f},f++})),G(c),H.insert(0,0,Z,50*Object.keys(X).length),Q(c,l,0);const g=H.getBounds();h&&c.append("text").text(h).attr("x",Z).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const m=g.stopy-g.starty+2*s.diagramMarginY,x=Z+g.stopx+2*s.diagramMarginX;p(c,m,x,s.useMaxWidth),c.append("line").attr("x1",Z).attr("y1",4*s.height).attr("x2",x-Z-4).attr("y2",4*s.height).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const k=h?70:0;c.attr("viewBox",`${g.startx} -25 ${x} ${m+k}`),c.attr("preserveAspectRatio","xMinYMin meet"),c.attr("height",m+k+25)}),"draw"),H={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:s((function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0}),"init"),updateVal:s((function(t,e,n,i){void 0===t[e]?t[e]=n:t[e]=i(n,t[e])}),"updateVal"),updateBounds:s((function(t,e,n,i){const r=u().journey,a=this;let o=0;function c(c){return s((function(s){o++;const l=a.sequenceItems.length-o+1;a.updateVal(s,"starty",e-l*r.boxMargin,Math.min),a.updateVal(s,"stopy",i+l*r.boxMargin,Math.max),a.updateVal(H.data,"startx",t-l*r.boxMargin,Math.min),a.updateVal(H.data,"stopx",n+l*r.boxMargin,Math.max),"activation"!==c&&(a.updateVal(s,"startx",t-l*r.boxMargin,Math.min),a.updateVal(s,"stopx",n+l*r.boxMargin,Math.max),a.updateVal(H.data,"starty",e-l*r.boxMargin,Math.min),a.updateVal(H.data,"stopy",i+l*r.boxMargin,Math.max))}),"updateItemBounds")}s(c,"updateFn"),this.sequenceItems.forEach(c())}),"updateBounds"),insert:s((function(t,e,n,i){const s=Math.min(t,n),r=Math.max(t,n),a=Math.min(e,i),o=Math.max(e,i);this.updateVal(H.data,"startx",s,Math.min),this.updateVal(H.data,"starty",a,Math.min),this.updateVal(H.data,"stopx",r,Math.max),this.updateVal(H.data,"stopy",o,Math.max),this.updateBounds(s,a,r,o)}),"insert"),bumpVerticalPos:s((function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos}),"bumpVerticalPos"),getVerticalPos:s((function(){return this.verticalPos}),"getVerticalPos"),getBounds:s((function(){return this.data}),"getBounds")},J=W.sectionFills,K=W.sectionColours,Q=s((function(t,e,n){const i=u().journey;let s="";const r=n+(2*i.height+i.diagramMarginY);let a=0,o="#CCC",c="black",l=0;for(const[h,u]of e.entries()){if(s!==u.section){o=J[a%J.length],l=a%J.length,c=K[a%K.length];let n=0;const r=u.section;for(let t=h;t<e.length&&e[t].section==r;t++)n+=1;const p={x:h*i.taskMargin+h*i.width+Z,y:50,text:u.section,fill:o,num:l,colour:c,taskCount:n};Y.drawSection(t,p,i),s=u.section,a++}const n=u.people.reduce(((t,e)=>(X[e]&&(t[e]=X[e]),t)),{});u.x=h*i.taskMargin+h*i.width+Z,u.y=r,u.width=i.diagramMarginX,u.height=i.diagramMarginY,u.colour=c,u.fill=o,u.num=l,u.actors=n,Y.drawTask(t,u,i),H.insert(u.x,u.y,u.x+u.width+i.taskMargin,450)}}),"drawTasks"),tt={setConf:q,draw:U},et={parser:m,db:P,renderer:tt,styles:j,init:s((t=>{tt.setConf(t.journey),P.clear()}),"init")};export{et as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,l as e,c as n,I as i,Y as s,$ as r,a0 as o,S as a,G as l,h as c,t as h,J as u,T as d,V as g,W as p}from"./mermaid-uo9TLHWr.js";import"./index-Cp9clns9.js";import"./transform-DjHZbYKP.js";import"./timer-DFzT7np-.js";import"./step-5BjdtTEt.js";var y=function(){var e=t((function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n}),"o"),n=[1,4],i=[1,13],s=[1,12],r=[1,15],o=[1,16],a=[1,20],l=[1,19],c=[6,7,8],h=[1,26],u=[1,24],d=[1,25],g=[6,7,11],p=[1,31],y=[6,7,11,24],f=[1,6,13,16,17,20,23],m=[1,35],_=[1,36],b=[1,6,7,11,13,16,17,20,23],k=[1,38],E={trace:t((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:t((function(t,e,n,i,s,r,o){var a=r.length-1;switch(s){case 6:case 7:return i;case 8:i.getLogger().trace("Stop NL ");break;case 9:i.getLogger().trace("Stop EOF ");break;case 11:i.getLogger().trace("Stop NL2 ");break;case 12:i.getLogger().trace("Stop EOF2 ");break;case 15:i.getLogger().info("Node: ",r[a-1].id),i.addNode(r[a-2].length,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 16:i.getLogger().info("Node: ",r[a].id),i.addNode(r[a-1].length,r[a].id,r[a].descr,r[a].type);break;case 17:i.getLogger().trace("Icon: ",r[a]),i.decorateNode({icon:r[a]});break;case 18:case 23:i.decorateNode({class:r[a]});break;case 19:i.getLogger().trace("SPACELIST");break;case 20:i.getLogger().trace("Node: ",r[a-1].id),i.addNode(0,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 21:i.getLogger().trace("Node: ",r[a].id),i.addNode(0,r[a].id,r[a].descr,r[a].type);break;case 22:i.decorateNode({icon:r[a]});break;case 27:i.getLogger().trace("node found ..",r[a-2]),this.$={id:r[a-1],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 28:this.$={id:r[a],descr:r[a],type:0};break;case 29:i.getLogger().trace("node found ..",r[a-3]),this.$={id:r[a-3],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 30:this.$=r[a-1]+r[a];break;case 31:this.$=r[a]}}),"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:i,7:[1,10],9:9,12:11,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},e(c,[2,3]),{1:[2,2]},e(c,[2,4]),e(c,[2,5]),{1:[2,6],6:i,12:21,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},{6:i,9:22,12:11,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},{6:h,7:u,10:23,11:d},e(g,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:a,23:l}),e(g,[2,19]),e(g,[2,21],{15:30,24:p}),e(g,[2,22]),e(g,[2,23]),e(y,[2,25]),e(y,[2,26]),e(y,[2,28],{20:[1,32]}),{21:[1,33]},{6:h,7:u,10:34,11:d},{1:[2,7],6:i,12:21,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},e(f,[2,14],{7:m,11:_}),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(g,[2,16],{15:37,24:p}),e(g,[2,17]),e(g,[2,18]),e(g,[2,20],{24:k}),e(y,[2,31]),{21:[1,39]},{22:[1,40]},e(f,[2,13],{7:m,11:_}),e(b,[2,11]),e(b,[2,12]),e(g,[2,15],{24:k}),e(y,[2,30]),{22:[1,41]},e(y,[2,27]),e(y,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:t((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:t((function(e){var n=this,i=[0],s=[],r=[null],o=[],a=this.table,l="",c=0,h=0,u=o.slice.call(arguments,1),d=Object.create(this.lexer),g={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(g.yy[p]=this.yy[p]);d.setInput(e,g.yy),g.yy.lexer=d,g.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var y=d.yylloc;o.push(y);var f=d.options&&d.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||d.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t((function(t){i.length=i.length-2*t,r.length=r.length-t,o.length=o.length-t}),"popStack"),t(m,"lex");for(var _,b,k,E,S,N,v,x,L={};;){if(b=i[i.length-1],this.defaultActions[b]?k=this.defaultActions[b]:(null==_&&(_=m()),k=a[b]&&a[b][_]),void 0===k||!k.length||!k[0]){var D="";for(S in x=[],a[b])this.terminals_[S]&&S>2&&x.push("'"+this.terminals_[S]+"'");D=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==_?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(D,{text:d.match,token:this.terminals_[_]||_,line:d.yylineno,loc:y,expected:x})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+_);switch(k[0]){case 1:i.push(_),r.push(d.yytext),o.push(d.yylloc),i.push(k[1]),_=null,h=d.yyleng,l=d.yytext,c=d.yylineno,y=d.yylloc;break;case 2:if(N=this.productions_[k[1]][1],L.$=r[r.length-N],L._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},f&&(L._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),void 0!==(E=this.performAction.apply(L,[l,h,c,g.yy,k[1],r,o].concat(u))))return E;N&&(i=i.slice(0,-1*N*2),r=r.slice(0,-1*N),o=o.slice(0,-1*N)),i.push(this.productions_[k[1]][0]),r.push(L.$),o.push(L._$),v=a[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0}),"parse")},S=function(){return{EOF:1,parseError:t((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:t((function(t,e){return this.yy=e||this.yy||{},this._input=t,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:t((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:t((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var s=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:t((function(){return this._more=!0,this}),"more"),reject:t((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:t((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:t((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:t((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:t((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:t((function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(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))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1}),"test_match"),next:t((function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:t((function(){var t=this.next();return t||this.lex()}),"lex"),begin:t((function(t){this.conditionStack.push(t)}),"begin"),popState:t((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:t((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:t((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:t((function(t){this.begin(t)}),"pushState"),stateStackSize:t((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:t((function(t,e,n,i){switch(n){case 0:return this.pushState("shapeData"),e.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const n=/\n\s*/g;return e.yytext=e.yytext.replace(n,"<br/>"),24;case 4:return 24;case 5:case 10:case 29:case 32:this.popState();break;case 6:return t.getLogger().trace("Found comment",e.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 11:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return t.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:t.getLogger().trace("end icon"),this.popState();break;case 16:return t.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return t.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:case 21:case 22:case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 30:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return t.getLogger().trace("description:",e.yytext),"NODE_DESCR";case 33:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),t.getLogger().trace("node end ...",e.yytext),"NODE_DEND";case 36:case 39:case 40:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 37:case 38:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 41:case 42:return t.getLogger().trace("Long description:",e.yytext),21}}),"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}}}();function N(){this.yy={}}return E.lexer=S,t(N,"Parser"),N.prototype=E,E.Parser=N,new N}();y.parser=y;var f=y,m=[],_=[],b=0,k={},E=t((()=>{m=[],_=[],b=0,k={}}),"clear"),S=t((t=>{if(0===m.length)return null;const e=m[0].level;let n=null;for(let i=m.length-1;i>=0;i--)if(m[i].level!==e||n||(n=m[i]),m[i].level<e)throw new Error('Items without section detected, found section ("'+m[i].label+'")');return t===(null==n?void 0:n.level)?null:n}),"getSection"),N=t((function(){return _}),"getSections"),v=t((function(){const t=[],e=N(),i=n();for(const n of e){const e={id:n.id,label:c(n.label??"",i),isGroup:!0,ticket:n.ticket,shape:"kanbanSection",level:n.level,look:i.look};t.push(e);const s=m.filter((t=>t.parentId===n.id));for(const r of s){const e={id:r.id,parentId:n.id,label:c(r.label??"",i),isGroup:!1,ticket:null==r?void 0:r.ticket,priority:null==r?void 0:r.priority,assigned:null==r?void 0:r.assigned,icon:null==r?void 0:r.icon,shape:"kanbanItem",level:r.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(e)}}return{nodes:t,edges:[],other:{},config:n()}}),"getData"),x=t(((t,e,i,s,r)=>{var o,a;const d=n();let g=(null==(o=d.mindmap)?void 0:o.padding)??l.mindmap.padding;switch(s){case L.ROUNDED_RECT:case L.RECT:case L.HEXAGON:g*=2}const p={id:c(e,d)||"kbn"+b++,level:t,label:c(i,d),width:(null==(a=d.mindmap)?void 0:a.maxNodeWidth)??l.mindmap.maxNodeWidth,padding:g,isGroup:!1};if(void 0!==r){let t;t=r.includes("\n")?r+"\n":"{\n"+r+"\n}";const e=h(t,{schema:u});if(e.shape&&(e.shape!==e.shape.toLowerCase()||e.shape.includes("_")))throw new Error(`No such shape: ${e.shape}. Shape names should be lowercase.`);(null==e?void 0:e.shape)&&"kanbanItem"===e.shape&&(p.shape=null==e?void 0:e.shape),(null==e?void 0:e.label)&&(p.label=null==e?void 0:e.label),(null==e?void 0:e.icon)&&(p.icon=null==e?void 0:e.icon.toString()),(null==e?void 0:e.assigned)&&(p.assigned=null==e?void 0:e.assigned.toString()),(null==e?void 0:e.ticket)&&(p.ticket=null==e?void 0:e.ticket.toString()),(null==e?void 0:e.priority)&&(p.priority=null==e?void 0:e.priority)}const y=S(t);y?p.parentId=y.id||"kbn"+b++:_.push(p),m.push(p)}),"addNode"),L={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},D={clear:E,addNode:x,getSections:N,getData:v,nodeType:L,getType:t(((t,n)=>{switch(e.debug("In get type",t,n),t){case"[":return L.RECT;case"(":return")"===n?L.ROUNDED_RECT:L.CLOUD;case"((":return L.CIRCLE;case")":return L.CLOUD;case"))":return L.BANG;case"{{":return L.HEXAGON;default:return L.DEFAULT}}),"getType"),setElementForId:t(((t,e)=>{k[t]=e}),"setElementForId"),decorateNode:t((t=>{if(!t)return;const e=n(),i=m[m.length-1];t.icon&&(i.icon=c(t.icon,e)),t.class&&(i.cssClasses=c(t.class,e))}),"decorateNode"),type2Str:t((t=>{switch(t){case L.DEFAULT:return"no-border";case L.RECT:return"rect";case L.ROUNDED_RECT:return"rounded-rect";case L.CIRCLE:return"circle";case L.CLOUD:return"cloud";case L.BANG:return"bang";case L.HEXAGON:return"hexgon";default:return"no-border"}}),"type2Str"),getLogger:t((()=>e),"getLogger"),getElementById:t((t=>k[t]),"getElementById")},I={draw:t((async(t,c,h,u)=>{var d,g,p,y,f;e.debug("Rendering kanban diagram\n"+t);const m=u.db.getData(),_=n();_.htmlLabels=!1;const b=i(c),k=b.append("g");k.attr("class","sections");const E=b.append("g");E.attr("class","items");const S=m.nodes.filter((t=>t.isGroup));let N=0;const v=[];let x=25;for(const e of S){const t=(null==(d=null==_?void 0:_.kanban)?void 0:d.sectionWidth)||200;N+=1,e.x=t*N+10*(N-1)/2,e.width=t,e.y=0,e.height=3*t,e.rx=5,e.ry=5,e.cssClasses=e.cssClasses+" section-"+N;const n=await s(k,e);x=Math.max(x,null==(g=null==n?void 0:n.labelBBox)?void 0:g.height),v.push(n)}let L=0;for(const e of S){const t=v[L];L+=1;const n=(null==(p=null==_?void 0:_.kanban)?void 0:p.sectionWidth)||200,i=3*-n/2+x;let s=i;const a=m.nodes.filter((t=>t.parentId===e.id));for(const h of a){if(h.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");h.x=e.x,h.width=n-15;const t=(await r(E,h,{config:_})).node().getBBox();h.y=s+t.height/2,await o(h),s=h.y+t.height/2+5}const l=t.cluster.select("rect"),c=Math.max(s-i+30,50)+(x-25);l.attr("height",c)}a(void 0,b,(null==(y=_.mindmap)?void 0:y.padding)??l.kanban.padding,(null==(f=_.mindmap)?void 0:f.useMaxWidth)??l.kanban.useMaxWidth)}),"draw")},O=t((e=>{let n="";for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e["lineColor"+t]=e["lineColor"+t]||e["cScaleInv"+t],d(e["lineColor"+t])?e["lineColor"+t]=g(e["lineColor"+t],20):e["lineColor"+t]=p(e["lineColor"+t],20);const i=t(((t,n)=>e.darkMode?p(t,n):g(t,n)),"adjuster");for(let t=0;t<e.THEME_COLOR_LIMIT;t++){const s=""+(17-3*t);n+=`\n .section-${t-1} rect, .section-${t-1} path, .section-${t-1} circle, .section-${t-1} polygon, .section-${t-1} path {\n fill: ${i(e["cScale"+t],10)};\n stroke: ${i(e["cScale"+t],10)};\n\n }\n .section-${t-1} text {\n fill: ${e["cScaleLabel"+t]};\n }\n .node-icon-${t-1} {\n font-size: 40px;\n color: ${e["cScaleLabel"+t]};\n }\n .section-edge-${t-1}{\n stroke: ${e["cScale"+t]};\n }\n .edge-depth-${t-1}{\n stroke-width: ${s};\n }\n .section-${t-1} line {\n stroke: ${e["cScaleInv"+t]} ;\n stroke-width: 3;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${e.background};\n stroke: ${e.nodeBorder};\n stroke-width: 1px;\n }\n\n .kanban-ticket-link {\n fill: ${e.background};\n stroke: ${e.nodeBorder};\n text-decoration: underline;\n }\n `}return n}),"genSections"),C={db:D,renderer:I,parser:f,styles:t((t=>`\n .edge {\n stroke-width: 3;\n }\n ${O(t)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .cluster-label, .label {\n color: ${t.textColor};\n fill: ${t.textColor};\n }\n .kanban-label {\n dy: 1em;\n alignment-baseline: middle;\n text-anchor: middle;\n dominant-baseline: middle;\n text-align: center;\n }\n`),"getStyles")};export{C as diagram};
|
|
1
|
+
import{_ as t,l as e,c as n,I as i,Y as s,$ as r,a0 as o,S as a,G as l,h as c,t as h,J as u,T as d,V as g,W as p}from"./mermaid-CuLRZCyq.js";import"./index-CBYlZPe-.js";import"./transform-DjHZbYKP.js";import"./timer-DFzT7np-.js";import"./step-5BjdtTEt.js";var y=function(){var e=t((function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n}),"o"),n=[1,4],i=[1,13],s=[1,12],r=[1,15],o=[1,16],a=[1,20],l=[1,19],c=[6,7,8],h=[1,26],u=[1,24],d=[1,25],g=[6,7,11],p=[1,31],y=[6,7,11,24],f=[1,6,13,16,17,20,23],m=[1,35],_=[1,36],b=[1,6,7,11,13,16,17,20,23],k=[1,38],E={trace:t((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:t((function(t,e,n,i,s,r,o){var a=r.length-1;switch(s){case 6:case 7:return i;case 8:i.getLogger().trace("Stop NL ");break;case 9:i.getLogger().trace("Stop EOF ");break;case 11:i.getLogger().trace("Stop NL2 ");break;case 12:i.getLogger().trace("Stop EOF2 ");break;case 15:i.getLogger().info("Node: ",r[a-1].id),i.addNode(r[a-2].length,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 16:i.getLogger().info("Node: ",r[a].id),i.addNode(r[a-1].length,r[a].id,r[a].descr,r[a].type);break;case 17:i.getLogger().trace("Icon: ",r[a]),i.decorateNode({icon:r[a]});break;case 18:case 23:i.decorateNode({class:r[a]});break;case 19:i.getLogger().trace("SPACELIST");break;case 20:i.getLogger().trace("Node: ",r[a-1].id),i.addNode(0,r[a-1].id,r[a-1].descr,r[a-1].type,r[a]);break;case 21:i.getLogger().trace("Node: ",r[a].id),i.addNode(0,r[a].id,r[a].descr,r[a].type);break;case 22:i.decorateNode({icon:r[a]});break;case 27:i.getLogger().trace("node found ..",r[a-2]),this.$={id:r[a-1],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 28:this.$={id:r[a],descr:r[a],type:0};break;case 29:i.getLogger().trace("node found ..",r[a-3]),this.$={id:r[a-3],descr:r[a-1],type:i.getType(r[a-2],r[a])};break;case 30:this.$=r[a-1]+r[a];break;case 31:this.$=r[a]}}),"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:i,7:[1,10],9:9,12:11,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},e(c,[2,3]),{1:[2,2]},e(c,[2,4]),e(c,[2,5]),{1:[2,6],6:i,12:21,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},{6:i,9:22,12:11,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},{6:h,7:u,10:23,11:d},e(g,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:a,23:l}),e(g,[2,19]),e(g,[2,21],{15:30,24:p}),e(g,[2,22]),e(g,[2,23]),e(y,[2,25]),e(y,[2,26]),e(y,[2,28],{20:[1,32]}),{21:[1,33]},{6:h,7:u,10:34,11:d},{1:[2,7],6:i,12:21,13:s,14:14,16:r,17:o,18:17,19:18,20:a,23:l},e(f,[2,14],{7:m,11:_}),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(g,[2,16],{15:37,24:p}),e(g,[2,17]),e(g,[2,18]),e(g,[2,20],{24:k}),e(y,[2,31]),{21:[1,39]},{22:[1,40]},e(f,[2,13],{7:m,11:_}),e(b,[2,11]),e(b,[2,12]),e(g,[2,15],{24:k}),e(y,[2,30]),{22:[1,41]},e(y,[2,27]),e(y,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:t((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:t((function(e){var n=this,i=[0],s=[],r=[null],o=[],a=this.table,l="",c=0,h=0,u=o.slice.call(arguments,1),d=Object.create(this.lexer),g={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(g.yy[p]=this.yy[p]);d.setInput(e,g.yy),g.yy.lexer=d,g.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var y=d.yylloc;o.push(y);var f=d.options&&d.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||d.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t((function(t){i.length=i.length-2*t,r.length=r.length-t,o.length=o.length-t}),"popStack"),t(m,"lex");for(var _,b,k,E,S,N,v,x,L={};;){if(b=i[i.length-1],this.defaultActions[b]?k=this.defaultActions[b]:(null==_&&(_=m()),k=a[b]&&a[b][_]),void 0===k||!k.length||!k[0]){var D="";for(S in x=[],a[b])this.terminals_[S]&&S>2&&x.push("'"+this.terminals_[S]+"'");D=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==_?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(D,{text:d.match,token:this.terminals_[_]||_,line:d.yylineno,loc:y,expected:x})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+_);switch(k[0]){case 1:i.push(_),r.push(d.yytext),o.push(d.yylloc),i.push(k[1]),_=null,h=d.yyleng,l=d.yytext,c=d.yylineno,y=d.yylloc;break;case 2:if(N=this.productions_[k[1]][1],L.$=r[r.length-N],L._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},f&&(L._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),void 0!==(E=this.performAction.apply(L,[l,h,c,g.yy,k[1],r,o].concat(u))))return E;N&&(i=i.slice(0,-1*N*2),r=r.slice(0,-1*N),o=o.slice(0,-1*N)),i.push(this.productions_[k[1]][0]),r.push(L.$),o.push(L._$),v=a[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0}),"parse")},S=function(){return{EOF:1,parseError:t((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:t((function(t,e){return this.yy=e||this.yy||{},this._input=t,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:t((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:t((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var s=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:t((function(){return this._more=!0,this}),"more"),reject:t((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:t((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:t((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:t((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:t((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:t((function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(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))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1}),"test_match"),next:t((function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:t((function(){var t=this.next();return t||this.lex()}),"lex"),begin:t((function(t){this.conditionStack.push(t)}),"begin"),popState:t((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:t((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:t((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:t((function(t){this.begin(t)}),"pushState"),stateStackSize:t((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:t((function(t,e,n,i){switch(n){case 0:return this.pushState("shapeData"),e.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const n=/\n\s*/g;return e.yytext=e.yytext.replace(n,"<br/>"),24;case 4:return 24;case 5:case 10:case 29:case 32:this.popState();break;case 6:return t.getLogger().trace("Found comment",e.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 11:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return t.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:t.getLogger().trace("end icon"),this.popState();break;case 16:return t.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return t.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:case 21:case 22:case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 30:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return t.getLogger().trace("description:",e.yytext),"NODE_DESCR";case 33:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),t.getLogger().trace("node end ...",e.yytext),"NODE_DEND";case 36:case 39:case 40:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 37:case 38:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 41:case 42:return t.getLogger().trace("Long description:",e.yytext),21}}),"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}}}();function N(){this.yy={}}return E.lexer=S,t(N,"Parser"),N.prototype=E,E.Parser=N,new N}();y.parser=y;var f=y,m=[],_=[],b=0,k={},E=t((()=>{m=[],_=[],b=0,k={}}),"clear"),S=t((t=>{if(0===m.length)return null;const e=m[0].level;let n=null;for(let i=m.length-1;i>=0;i--)if(m[i].level!==e||n||(n=m[i]),m[i].level<e)throw new Error('Items without section detected, found section ("'+m[i].label+'")');return t===(null==n?void 0:n.level)?null:n}),"getSection"),N=t((function(){return _}),"getSections"),v=t((function(){const t=[],e=N(),i=n();for(const n of e){const e={id:n.id,label:c(n.label??"",i),isGroup:!0,ticket:n.ticket,shape:"kanbanSection",level:n.level,look:i.look};t.push(e);const s=m.filter((t=>t.parentId===n.id));for(const r of s){const e={id:r.id,parentId:n.id,label:c(r.label??"",i),isGroup:!1,ticket:null==r?void 0:r.ticket,priority:null==r?void 0:r.priority,assigned:null==r?void 0:r.assigned,icon:null==r?void 0:r.icon,shape:"kanbanItem",level:r.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(e)}}return{nodes:t,edges:[],other:{},config:n()}}),"getData"),x=t(((t,e,i,s,r)=>{var o,a;const d=n();let g=(null==(o=d.mindmap)?void 0:o.padding)??l.mindmap.padding;switch(s){case L.ROUNDED_RECT:case L.RECT:case L.HEXAGON:g*=2}const p={id:c(e,d)||"kbn"+b++,level:t,label:c(i,d),width:(null==(a=d.mindmap)?void 0:a.maxNodeWidth)??l.mindmap.maxNodeWidth,padding:g,isGroup:!1};if(void 0!==r){let t;t=r.includes("\n")?r+"\n":"{\n"+r+"\n}";const e=h(t,{schema:u});if(e.shape&&(e.shape!==e.shape.toLowerCase()||e.shape.includes("_")))throw new Error(`No such shape: ${e.shape}. Shape names should be lowercase.`);(null==e?void 0:e.shape)&&"kanbanItem"===e.shape&&(p.shape=null==e?void 0:e.shape),(null==e?void 0:e.label)&&(p.label=null==e?void 0:e.label),(null==e?void 0:e.icon)&&(p.icon=null==e?void 0:e.icon.toString()),(null==e?void 0:e.assigned)&&(p.assigned=null==e?void 0:e.assigned.toString()),(null==e?void 0:e.ticket)&&(p.ticket=null==e?void 0:e.ticket.toString()),(null==e?void 0:e.priority)&&(p.priority=null==e?void 0:e.priority)}const y=S(t);y?p.parentId=y.id||"kbn"+b++:_.push(p),m.push(p)}),"addNode"),L={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},D={clear:E,addNode:x,getSections:N,getData:v,nodeType:L,getType:t(((t,n)=>{switch(e.debug("In get type",t,n),t){case"[":return L.RECT;case"(":return")"===n?L.ROUNDED_RECT:L.CLOUD;case"((":return L.CIRCLE;case")":return L.CLOUD;case"))":return L.BANG;case"{{":return L.HEXAGON;default:return L.DEFAULT}}),"getType"),setElementForId:t(((t,e)=>{k[t]=e}),"setElementForId"),decorateNode:t((t=>{if(!t)return;const e=n(),i=m[m.length-1];t.icon&&(i.icon=c(t.icon,e)),t.class&&(i.cssClasses=c(t.class,e))}),"decorateNode"),type2Str:t((t=>{switch(t){case L.DEFAULT:return"no-border";case L.RECT:return"rect";case L.ROUNDED_RECT:return"rounded-rect";case L.CIRCLE:return"circle";case L.CLOUD:return"cloud";case L.BANG:return"bang";case L.HEXAGON:return"hexgon";default:return"no-border"}}),"type2Str"),getLogger:t((()=>e),"getLogger"),getElementById:t((t=>k[t]),"getElementById")},I={draw:t((async(t,c,h,u)=>{var d,g,p,y,f;e.debug("Rendering kanban diagram\n"+t);const m=u.db.getData(),_=n();_.htmlLabels=!1;const b=i(c),k=b.append("g");k.attr("class","sections");const E=b.append("g");E.attr("class","items");const S=m.nodes.filter((t=>t.isGroup));let N=0;const v=[];let x=25;for(const e of S){const t=(null==(d=null==_?void 0:_.kanban)?void 0:d.sectionWidth)||200;N+=1,e.x=t*N+10*(N-1)/2,e.width=t,e.y=0,e.height=3*t,e.rx=5,e.ry=5,e.cssClasses=e.cssClasses+" section-"+N;const n=await s(k,e);x=Math.max(x,null==(g=null==n?void 0:n.labelBBox)?void 0:g.height),v.push(n)}let L=0;for(const e of S){const t=v[L];L+=1;const n=(null==(p=null==_?void 0:_.kanban)?void 0:p.sectionWidth)||200,i=3*-n/2+x;let s=i;const a=m.nodes.filter((t=>t.parentId===e.id));for(const h of a){if(h.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");h.x=e.x,h.width=n-15;const t=(await r(E,h,{config:_})).node().getBBox();h.y=s+t.height/2,await o(h),s=h.y+t.height/2+5}const l=t.cluster.select("rect"),c=Math.max(s-i+30,50)+(x-25);l.attr("height",c)}a(void 0,b,(null==(y=_.mindmap)?void 0:y.padding)??l.kanban.padding,(null==(f=_.mindmap)?void 0:f.useMaxWidth)??l.kanban.useMaxWidth)}),"draw")},O=t((e=>{let n="";for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e["lineColor"+t]=e["lineColor"+t]||e["cScaleInv"+t],d(e["lineColor"+t])?e["lineColor"+t]=g(e["lineColor"+t],20):e["lineColor"+t]=p(e["lineColor"+t],20);const i=t(((t,n)=>e.darkMode?p(t,n):g(t,n)),"adjuster");for(let t=0;t<e.THEME_COLOR_LIMIT;t++){const s=""+(17-3*t);n+=`\n .section-${t-1} rect, .section-${t-1} path, .section-${t-1} circle, .section-${t-1} polygon, .section-${t-1} path {\n fill: ${i(e["cScale"+t],10)};\n stroke: ${i(e["cScale"+t],10)};\n\n }\n .section-${t-1} text {\n fill: ${e["cScaleLabel"+t]};\n }\n .node-icon-${t-1} {\n font-size: 40px;\n color: ${e["cScaleLabel"+t]};\n }\n .section-edge-${t-1}{\n stroke: ${e["cScale"+t]};\n }\n .edge-depth-${t-1}{\n stroke-width: ${s};\n }\n .section-${t-1} line {\n stroke: ${e["cScaleInv"+t]} ;\n stroke-width: 3;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${e.background};\n stroke: ${e.nodeBorder};\n stroke-width: 1px;\n }\n\n .kanban-ticket-link {\n fill: ${e.background};\n stroke: ${e.nodeBorder};\n text-decoration: underline;\n }\n `}return n}),"genSections"),C={db:D,renderer:I,parser:f,styles:t((t=>`\n .edge {\n stroke-width: 3;\n }\n ${O(t)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .cluster-label, .label {\n color: ${t.textColor};\n fill: ${t.textColor};\n }\n .kanban-label {\n dy: 1em;\n alignment-baseline: middle;\n text-anchor: middle;\n dominant-baseline: middle;\n text-align: center;\n }\n`),"getStyles")};export{C as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as e}from"./graph-vL7TN2GK.js";import{b as n,e as r,c as t,i as o,f as i,v as a,r as u}from"./_baseUniq-BQlu1urX.js";import{b as d,a as c,m as s,c as f,h,f as g,l as v,d as l}from"./min-CzfQZWDV.js";import{c2 as p,bS as w,d7 as m,ay as b,d8 as y,d0 as k,d9 as x,da as E,M as N,ak as O,db as _,dc as I}from"./index-Cp9clns9.js";import{c as P,a as j}from"./_baseEach-Bs4xWtI7.js";import{s as R}from"./sortBy-vaTw-Lkk.js";function T(e,n){return e>n}function M(e,n){var r={};return n=j(n),P(e,(function(e,t,o){m(r,t,n(e,t,o))})),r}function L(e){return e&&e.length?d(e,b,T):void 0}function C(e,n){return e&&e.length?d(e,j(n),c):void 0}var S=0;function G(e){var n=++S;return y(e)+n}class F{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,n=e._prev;if(n!==e)return V(n),n}enqueue(e){var n=this._sentinel;e._prev&&e._next&&V(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n}toString(){for(var e=[],n=this._sentinel,r=n._prev;r!==n;)e.push(JSON.stringify(r,B)),r=r._prev;return"["+e.join(", ")+"]"}}function V(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function B(e,n){if("_next"!==e&&"_prev"!==e)return n}var q=N(1);function Y(n,r){if(n.nodeCount()<=1)return[];var o=function(n,r){var o=new e,i=0,a=0;t(n.nodes(),(function(e){o.setNode(e,{v:e,in:0,out:0})})),t(n.edges(),(function(e){var n=o.edge(e.v,e.w)||0,t=r(e),u=n+t;o.setEdge(e.v,e.w,u),a=Math.max(a,o.node(e.v).out+=t),i=Math.max(i,o.node(e.w).in+=t)}));var u=E(a+i+3).map((function(){return new F})),d=i+1;return t(o.nodes(),(function(e){D(u,d,o.node(e))})),{graph:o,buckets:u,zeroIdx:d}}(n,r||q),i=function(e,n,r){var t,o=[],i=n[n.length-1],a=n[0];for(;e.nodeCount();){for(;t=a.dequeue();)z(e,n,r,t);for(;t=i.dequeue();)z(e,n,r,t);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(t=n[u].dequeue()){o=o.concat(z(e,n,r,t,!0));break}}return o}(o.graph,o.buckets,o.zeroIdx);return x(s(i,(function(e){return n.outEdges(e.v,e.w)})))}function z(e,n,r,o,i){var a=i?[]:void 0;return t(e.inEdges(o.v),(function(t){var o=e.edge(t),u=e.node(t.v);i&&a.push({v:t.v,w:t.w}),u.out-=o,D(n,r,u)})),t(e.outEdges(o.v),(function(t){var o=e.edge(t),i=t.w,a=e.node(i);a.in-=o,D(n,r,a)})),e.removeNode(o.v),a}function D(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function A(e){var n,r="greedy"===e.graph().acyclicer?Y(e,(n=e,function(e){return n.edge(e).weight})):function(e){var n=[],r={},o={};function i(a){Object.prototype.hasOwnProperty.call(o,a)||(o[a]=!0,r[a]=!0,t(e.outEdges(a),(function(e){Object.prototype.hasOwnProperty.call(r,e.w)?n.push(e):i(e.w)})),delete r[a])}return t(e.nodes(),i),n}(e);t(r,(function(n){var r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,G("rev"))}))}function J(e,n,r,t){var o;do{o=G(t)}while(e.hasNode(o));return r.dummy=n,e.setNode(o,r),o}function U(n){var r=new e({multigraph:n.isMultigraph()}).setGraph(n.graph());return t(n.nodes(),(function(e){n.children(e).length||r.setNode(e,n.node(e))})),t(n.edges(),(function(e){r.setEdge(e,n.edge(e))})),r}function H(e,n){var r,t,o=e.x,i=e.y,a=n.x-o,u=n.y-i,d=e.width/2,c=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*d>Math.abs(a)*c?(u<0&&(c=-c),r=c*a/u,t=c):(a<0&&(d=-d),r=d,t=d*u/a),{x:o+r,y:i+t}}function K(e){var n=s(E(W(e)+1),(function(){return[]}));return t(e.nodes(),(function(r){var t=e.node(r),i=t.rank;o(i)||(n[i][t.order]=r)})),n}function Q(e,n,r,t){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=t),J(e,"border",o,n)}function W(e){return L(s(e.nodes(),(function(n){var r=e.node(n).rank;if(!o(r))return r})))}function X(e,n){return n()}function Z(e,n,r,t,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],d=J(e,"border",a,r);o[n][i]=d,e.setParent(d,t),u&&e.setEdge(u,d,{weight:1})}function $(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){t(e.nodes(),(function(n){re(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);t(r.points,re),Object.prototype.hasOwnProperty.call(r,"y")&&re(r)}))}(e),"lr"!==n&&"rl"!==n||(!function(e){t(e.nodes(),(function(n){te(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);t(r.points,te),Object.prototype.hasOwnProperty.call(r,"x")&&te(r)}))}(e),ee(e))}function ee(e){t(e.nodes(),(function(n){ne(e.node(n))})),t(e.edges(),(function(n){ne(e.edge(n))}))}function ne(e){var n=e.width;e.width=e.height,e.height=n}function re(e){e.y=-e.y}function te(e){var n=e.x;e.x=e.y,e.y=n}function oe(e){e.graph().dummyChains=[],t(e.edges(),(function(n){!function(e,n){var r=n.v,t=e.node(r).rank,o=n.w,i=e.node(o).rank,a=n.name,u=e.edge(n),d=u.labelRank;if(i===t+1)return;e.removeEdge(n);var c,s,f=void 0;for(s=0,++t;t<i;++s,++t)u.points=[],c=J(e,"edge",f={width:0,height:0,edgeLabel:u,edgeObj:n,rank:t},"_d"),t===d&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),e.setEdge(r,c,{weight:u.weight},a),0===s&&e.graph().dummyChains.push(c),r=c;e.setEdge(r,o,{weight:u.weight},a)}(e,n)}))}function ie(e){var n={};t(e.sources(),(function r(t){var o=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return o.rank;n[t]=!0;var i=f(s(e.outEdges(t),(function(n){return r(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))}function ae(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function ue(n){var r,t,o=new e({directed:!1}),i=n.nodes()[0],a=n.nodeCount();for(o.setNode(i,{});de(o,n)<a;)r=ce(o,n),t=o.hasNode(r.v)?ae(n,r):-ae(n,r),se(o,n,t);return o}function de(e,n){return t(e.nodes(),(function r(o){t(n.nodeEdges(o),(function(t){var i=t.v,a=o===i?t.w:i;e.hasNode(a)||ae(n,t)||(e.setNode(a,{}),e.setEdge(o,a,{}),r(a))}))})),e.nodeCount()}function ce(e,n){return C(n.edges(),(function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return ae(n,r)}))}function se(e,n,r){t(e.nodes(),(function(e){n.node(e).rank+=r}))}function fe(e,n,r){O(n)||(n=[n]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return t(n,(function(n){if(!e.hasNode(n))throw new Error("Graph does not have node: "+n);he(e,n,"post"===r,a,o,i)})),i}function he(e,n,r,o,i,a){Object.prototype.hasOwnProperty.call(o,n)||(o[n]=!0,r||a.push(n),t(i(n),(function(n){he(e,n,r,o,i,a)})),r&&a.push(n))}function ge(n){n=function(n){var r=(new e).setGraph(n.graph());return t(n.nodes(),(function(e){r.setNode(e,n.node(e))})),t(n.edges(),(function(e){var t=r.edge(e.v,e.w)||{weight:0,minlen:1},o=n.edge(e);r.setEdge(e.v,e.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})})),r}(n),ie(n);var r,o=ue(n);for(pe(o),ve(o,n);r=me(o);)ye(o,n,r,be(o,n,r))}function ve(e,n){var r=function(e,n){return fe(e,n,"post")}(e,e.nodes());r=r.slice(0,r.length-1),t(r,(function(r){!function(e,n,r){var t=e.node(r),o=t.parent;e.edge(r,o).cutvalue=le(e,n,r)}(e,n,r)}))}function le(e,n,r){var o=e.node(r).parent,i=!0,a=n.edge(r,o),u=0;return a||(i=!1,a=n.edge(o,r)),u=a.weight,t(n.nodeEdges(r),(function(t){var a,d,c=t.v===r,s=c?t.w:t.v;if(s!==o){var f=c===i,h=n.edge(t).weight;if(u+=f?h:-h,a=r,d=s,e.hasEdge(a,d)){var g=e.edge(r,s).cutvalue;u+=f?-g:g}}})),u}function pe(e,n){arguments.length<2&&(n=e.nodes()[0]),we(e,{},1,n)}function we(e,n,r,o,i){var a=r,u=e.node(o);return n[o]=!0,t(e.neighbors(o),(function(t){Object.prototype.hasOwnProperty.call(n,t)||(r=we(e,n,r,t,o))})),u.low=a,u.lim=r++,i?u.parent=i:delete u.parent,r}function me(e){return g(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function be(e,n,r){var t=r.v,o=r.w;n.hasEdge(t,o)||(t=r.w,o=r.v);var a=e.node(t),u=e.node(o),d=a,c=!1;return a.lim>u.lim&&(d=u,c=!0),C(i(n.edges(),(function(n){return c===ke(e,e.node(n.v),d)&&c!==ke(e,e.node(n.w),d)})),(function(e){return ae(n,e)}))}function ye(e,n,r,o){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(o.v,o.w,{}),pe(e),ve(e,n),function(e,n){var r=g(e.nodes(),(function(e){return!n.node(e).parent})),o=function(e,n){return fe(e,n,"pre")}(e,r);o=o.slice(1),t(o,(function(r){var t=e.node(r).parent,o=n.edge(r,t),i=!1;o||(o=n.edge(t,r),i=!0),n.node(r).rank=n.node(t).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function ke(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function xe(e){switch(e.graph().ranker){case"network-simplex":default:Ne(e);break;case"tight-tree":!function(e){ie(e),ue(e)}(e);break;case"longest-path":Ee(e)}}new Error,ge.initLowLimValues=pe,ge.initCutValues=ve,ge.calcCutValue=le,ge.leaveEdge=me,ge.enterEdge=be,ge.exchangeEdges=ye;var Ee=ie;function Ne(e){ge(e)}function Oe(e){var n=J(e,"root",{},"_root"),r=function(e){var n={};function r(o,i){var a=e.children(o);a&&a.length&&t(a,(function(e){r(e,i+1)})),n[o]=i}return t(e.children(),(function(e){r(e,1)})),n}(e),o=L(a(r))-1,i=2*o+1;e.graph().nestingRoot=n,t(e.edges(),(function(n){e.edge(n).minlen*=i}));var d=function(e){return u(e.edges(),(function(n,r){return n+e.edge(r).weight}),0)}(e)+1;t(e.children(),(function(t){_e(e,n,i,d,o,r,t)})),e.graph().nodeRankFactor=i}function _e(e,n,r,o,i,a,u){var d=e.children(u);if(d.length){var c=Q(e,"_bt"),s=Q(e,"_bb"),f=e.node(u);e.setParent(c,u),f.borderTop=c,e.setParent(s,u),f.borderBottom=s,t(d,(function(t){_e(e,n,r,o,i,a,t);var d=e.node(t),f=d.borderTop?d.borderTop:t,h=d.borderBottom?d.borderBottom:t,g=d.borderTop?o:2*o,v=f!==h?1:i-a[u]+1;e.setEdge(c,f,{weight:g,minlen:v,nestingEdge:!0}),e.setEdge(h,s,{weight:g,minlen:v,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,c,{weight:0,minlen:i+a[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})}function Ie(n,r,i){var a=function(e){var n;for(;e.hasNode(n=G("_root")););return n}(n),u=new e({compound:!0}).setGraph({root:a}).setDefaultNodeLabel((function(e){return n.node(e)}));return t(n.nodes(),(function(e){var d=n.node(e),c=n.parent(e);(d.rank===r||d.minRank<=r&&r<=d.maxRank)&&(u.setNode(e),u.setParent(e,c||a),t(n[i](e),(function(r){var t=r.v===e?r.w:r.v,i=u.edge(t,e),a=o(i)?0:i.weight;u.setEdge(t,e,{weight:n.edge(r).weight+a})})),Object.prototype.hasOwnProperty.call(d,"minRank")&&u.setNode(e,{borderLeft:d.borderLeft[r],borderRight:d.borderRight[r]}))})),u}function Pe(e,n){for(var r=0,t=1;t<n.length;++t)r+=je(e,n[t-1],n[t]);return r}function je(e,n,r){for(var o,i,a=(o=r,i=s(r,(function(e,n){return n})),function(e,n,r){for(var t=-1,o=e.length,i=n.length,a={};++t<o;){var u=t<i?n[t]:void 0;r(a,e[t],u)}return a}(o||[],i||[],k)),u=x(s(n,(function(n){return R(s(e.outEdges(n),(function(n){return{pos:a[n.w],weight:e.edge(n).weight}})),"pos")}))),d=1;d<r.length;)d<<=1;var c=2*d-1;d-=1;var f=s(new Array(c),(function(){return 0})),h=0;return t(u.forEach((function(e){var n=e.pos+d;f[n]+=e.weight;for(var r=0;n>0;)n%2&&(r+=f[n+1]),f[n=n-1>>1]+=e.weight;h+=e.weight*r}))),h}function Re(e,n){var r={};return t(e,(function(e,n){var t=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};o(e.barycenter)||(t.barycenter=e.barycenter,t.weight=e.weight)})),t(n.edges(),(function(e){var n=r[e.v],t=r[e.w];o(n)||o(t)||(t.indegree++,n.out.push(r[e.w]))})),function(e){var n=[];function r(e){return function(n){n.merged||(o(n.barycenter)||o(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight);n.weight&&(r+=n.barycenter*n.weight,t+=n.weight);e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function a(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}for(;e.length;){var u=e.pop();n.push(u),t(u.in.reverse(),r(u)),t(u.out,a(u))}return s(i(n,(function(e){return!e.merged})),(function(e){return _(e,["vs","i","barycenter","weight"])}))}(i(r,(function(e){return!e.indegree})))}function Te(e,n){var r,o=function(e,n){var r={lhs:[],rhs:[]};return t(e,(function(e){n(e)?r.lhs.push(e):r.rhs.push(e)})),r}(e,(function(e){return Object.prototype.hasOwnProperty.call(e,"barycenter")})),i=o.lhs,a=R(o.rhs,(function(e){return-e.i})),u=[],d=0,c=0,s=0;i.sort((r=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:r?n.i-e.i:e.i-n.i})),s=Me(u,a,s),t(i,(function(e){s+=e.vs.length,u.push(e.vs),d+=e.barycenter*e.weight,c+=e.weight,s=Me(u,a,s)}));var f={vs:x(u)};return c&&(f.barycenter=d/c,f.weight=c),f}function Me(e,n,r){for(var t;n.length&&(t=v(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Le(e,n,r,a){var d=e.children(n),c=e.node(n),f=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,g={};f&&(d=i(d,(function(e){return e!==f&&e!==h})));var v=function(e,n){return s(n,(function(n){var r=e.inEdges(n);if(r.length){var t=u(r,(function(n,r){var t=e.edge(r),o=e.node(r.v);return{sum:n.sum+t.weight*o.order,weight:n.weight+t.weight}}),{sum:0,weight:0});return{v:n,barycenter:t.sum/t.weight,weight:t.weight}}return{v:n}}))}(e,d);t(v,(function(n){if(e.children(n.v).length){var t=Le(e,n.v,r,a);g[n.v]=t,Object.prototype.hasOwnProperty.call(t,"barycenter")&&(u=t,o((i=n).barycenter)?(i.barycenter=u.barycenter,i.weight=u.weight):(i.barycenter=(i.barycenter*i.weight+u.barycenter*u.weight)/(i.weight+u.weight),i.weight+=u.weight))}var i,u}));var l=Re(v,r);!function(e,n){t(e,(function(e){e.vs=x(e.vs.map((function(e){return n[e]?n[e].vs:e})))}))}(l,g);var p=Te(l,a);if(f&&(p.vs=x([f,p.vs,h]),e.predecessors(f).length)){var w=e.node(e.predecessors(f)[0]),m=e.node(e.predecessors(h)[0]);Object.prototype.hasOwnProperty.call(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+w.order+m.order)/(p.weight+2),p.weight+=2}return p}function Ce(e){var r=W(e),o=Se(e,E(1,r+1),"inEdges"),a=Se(e,E(r-1,-1,-1),"outEdges"),u=function(e){var n={},r=i(e.nodes(),(function(n){return!e.children(n).length})),o=L(s(r,(function(n){return e.node(n).rank}))),a=s(E(o+1),(function(){return[]})),u=R(r,(function(n){return e.node(n).rank}));return t(u,(function r(o){if(!h(n,o)){n[o]=!0;var i=e.node(o);a[i.rank].push(o),t(e.successors(o),r)}})),a}(e);Fe(e,u);for(var d,c=Number.POSITIVE_INFINITY,f=0,g=0;g<4;++f,++g){Ge(f%2?o:a,f%4>=2);var v=Pe(e,u=K(e));v<c&&(g=0,d=n(u,5),c=v)}Fe(e,d)}function Se(e,n,r){return s(n,(function(n){return Ie(e,n,r)}))}function Ge(n,r){var o=new e;t(n,(function(e){var n=e.graph().root,i=Le(e,n,o,r);t(i.vs,(function(n,r){e.node(n).order=r})),function(e,n,r){var o,i={};t(r,(function(r){for(var t,a,u=e.parent(r);u;){if((t=e.parent(u))?(a=i[t],i[t]=u):(a=o,o=u),a&&a!==u)return void n.setEdge(a,u);u=t}}))}(e,o,i.vs)}))}function Fe(e,n){t(n,(function(n){t(n,(function(n,r){e.node(n).order=r}))}))}function Ve(e){var n=function(e){var n={},r=0;function o(i){var a=r;t(e.children(i),o),n[i]={low:a,lim:r++}}return t(e.children(),o),n}(e);t(e.graph().dummyChains,(function(r){for(var t=e.node(r),o=t.edgeObj,i=function(e,n,r,t){var o,i,a=[],u=[],d=Math.min(n[r].low,n[t].low),c=Math.max(n[r].lim,n[t].lim);o=r;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>d||c>n[o].lim));i=o,o=t;for(;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,d=0,c=a[d],s=!0;r!==o.w;){if(t=e.node(r),s){for(;(c=a[d])!==u&&e.node(c).maxRank<t.rank;)d++;c===u&&(s=!1)}if(!s){for(;d<a.length-1&&e.node(c=a[d+1]).minRank<=t.rank;)d++;c=a[d]}e.setParent(r,c),r=e.successors(r)[0]}}))}function Be(e,n){var r={};return u(n,(function(n,o){var i=0,a=0,u=n.length,d=v(o);return t(o,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return g(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),f=s?e.node(s).order:u;(s||n===d)&&(t(o.slice(a,c+1),(function(n){t(e.predecessors(n),(function(t){var o=e.node(t),a=o.order;!(a<i||f<a)||o.dummy&&e.node(n).dummy||qe(r,t,n)}))})),a=c+1,i=f)})),o})),r}function qe(e,n,r){if(n>r){var t=n;n=r,r=t}var o=e[n];o||(e[n]=o={}),o[r]=!0}function Ye(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function ze(n,r,o,i,a){var u={},d=function(n,r,o,i){var a=new e,u=n.graph(),d=function(e,n,r){return function(t,o,i){var a,u=t.node(o),d=t.node(i),c=0;if(c+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=r?a:-a),a=0,c+=(u.dummy?n:e)/2,c+=(d.dummy?n:e)/2,c+=d.width/2,Object.prototype.hasOwnProperty.call(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":a=d.width/2;break;case"r":a=-d.width/2}return a&&(c+=r?a:-a),a=0,c}}(u.nodesep,u.edgesep,i);return t(r,(function(e){var r;t(e,(function(e){var t=o[e];if(a.setNode(t),r){var i=o[r],u=a.edge(i,t);a.setEdge(i,t,Math.max(d(n,e,r),u||0))}r=e}))})),a}(n,r,o,a),c=a?"borderLeft":"borderRight";function s(e,n){for(var r=d.nodes(),t=r.pop(),o={};t;)o[t]?e(t):(o[t]=!0,r.push(t),r=r.concat(n(t))),t=r.pop()}return s((function(e){u[e]=d.inEdges(e).reduce((function(e,n){return Math.max(e,u[n.v]+d.edge(n))}),0)}),d.predecessors.bind(d)),s((function(e){var r=d.outEdges(e).reduce((function(e,n){return Math.min(e,u[n.w]-d.edge(n))}),Number.POSITIVE_INFINITY),t=n.node(e);r!==Number.POSITIVE_INFINITY&&t.borderType!==c&&(u[e]=Math.max(u[e],r))}),d.successors.bind(d)),t(i,(function(e){u[e]=u[o[e]]})),u}function De(e,n){return C(a(n),(function(n){var t,o,i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return o=function(n,r){var t=function(e,n){return e.node(n).width}(e,r)/2;i=Math.max(n+t,i),a=Math.min(n-t,a)},null==(t=n)||p(t,r(o),w),i-a}))}function Ae(e){var n,r=K(e),o=I(Be(e,r),function(e,n){var r={};function o(n,o,i,a,u){var d;t(E(o,i),(function(o){d=n[o],e.node(d).dummy&&t(e.predecessors(d),(function(n){var t=e.node(n);t.dummy&&(t.order<a||t.order>u)&&qe(r,n,d)}))}))}return u(n,(function(n,r){var i,a=-1,u=0;return t(r,(function(t,d){if("border"===e.node(t).dummy){var c=e.predecessors(t);c.length&&(i=e.node(c[0]).order,o(r,u,d,a,i),u=d,a=i)}o(r,u,r.length,i,n.length)})),r})),r}(e,r)),i={};t(["u","d"],(function(u){n="u"===u?r:a(r).reverse(),t(["l","r"],(function(r){"r"===r&&(n=s(n,(function(e){return a(e).reverse()})));var d=("u"===u?e.predecessors:e.successors).bind(e),c=function(e,n,r,o){var i={},a={},u={};return t(n,(function(e){t(e,(function(e,n){i[e]=e,a[e]=e,u[e]=n}))})),t(n,(function(e){var n=-1;t(e,(function(e){var t=o(e);if(t.length)for(var d=((t=R(t,(function(e){return u[e]}))).length-1)/2,c=Math.floor(d),s=Math.ceil(d);c<=s;++c){var f=t[c];a[e]===e&&n<u[f]&&!Ye(r,e,f)&&(a[f]=e,a[e]=i[e]=i[f],n=u[f])}}))})),{root:i,align:a}}(0,n,o,d),f=ze(e,n,c.root,c.align,"r"===r);"r"===r&&(f=M(f,(function(e){return-e}))),i[u+r]=f}))}));var d=De(e,i);return function(e,n){var r=a(n),o=f(r),i=L(r);t(["u","d"],(function(r){t(["l","r"],(function(t){var u,d=r+t,c=e[d];if(c!==n){var s=a(c);(u="l"===t?o-f(s):i-L(s))&&(e[d]=M(c,(function(e){return e+u})))}}))}))}(i,d),function(e,n){return M(e.ul,(function(r,t){if(n)return e[n.toLowerCase()][t];var o=R(s(e,t));return(o[1]+o[2])/2}))}(i,e.graph().align)}function Je(e){var n,o;(function(e){var n=K(e),r=e.graph().ranksep,o=0;t(n,(function(n){var i=L(s(n,(function(n){return e.node(n).height})));t(n,(function(n){e.node(n).y=o+i/2})),o+=i+r}))})(e=U(e)),n=Ae(e),o=function(n,r){e.node(r).x=n},n&&P(n,r(o))}function Ue(n,r){var i=X;i("layout",(()=>{var r=i(" buildLayoutGraph",(()=>function(n){var r=new e({multigraph:!0,compound:!0}),o=rn(n.graph());return r.setGraph(I({},Ke,nn(o,He),_(o,Qe))),t(n.nodes(),(function(e){var t=rn(n.node(e));r.setNode(e,l(nn(t,We),Xe)),r.setParent(e,n.parent(e))})),t(n.edges(),(function(e){var t=rn(n.edge(e));r.setEdge(e,I({},$e,nn(t,Ze),_(t,en)))})),r}(n)));i(" runLayout",(()=>function(e,n){n(" makeSpaceForEdgeLabels",(()=>function(e){var n=e.graph();n.ranksep/=2,t(e.edges(),(function(r){var t=e.edge(r);t.minlen*=2,"c"!==t.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?t.width+=t.labeloffset:t.height+=t.labeloffset)}))}(e))),n(" removeSelfEdges",(()=>function(e){t(e.edges(),(function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e))),n(" acyclic",(()=>A(e))),n(" nestingGraph.run",(()=>Oe(e))),n(" rank",(()=>xe(U(e)))),n(" injectEdgeLabelProxies",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),o={rank:(e.node(n.w).rank-t.rank)/2+t.rank,e:n};J(e,"edge-proxy",o,"_ep")}}))}(e))),n(" removeEmptyRanks",(()=>function(e){var n=f(s(e.nodes(),(function(n){return e.node(n).rank}))),r=[];t(e.nodes(),(function(t){var o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)}));var i=0,a=e.graph().nodeRankFactor;t(r,(function(n,r){o(n)&&r%a!=0?--i:i&&t(n,(function(n){e.node(n).rank+=i}))}))}(e))),n(" nestingGraph.cleanup",(()=>function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,t(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}(e))),n(" normalizeRanks",(()=>function(e){var n=f(s(e.nodes(),(function(n){return e.node(n).rank})));t(e.nodes(),(function(r){var t=e.node(r);h(t,"rank")&&(t.rank-=n)}))}(e))),n(" assignRankMinMax",(()=>function(e){var n=0;t(e.nodes(),(function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=L(n,t.maxRank))})),e.graph().maxRank=n}(e))),n(" removeEdgeLabelProxies",(()=>function(e){t(e.nodes(),(function(n){var r=e.node(n);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))}))}(e))),n(" normalize.run",(()=>oe(e))),n(" parentDummyChains",(()=>Ve(e))),n(" addBorderSegments",(()=>function(e){t(e.children(),(function n(r){var o=e.children(r),i=e.node(r);if(o.length&&t(o,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,u=i.maxRank+1;a<u;++a)Z(e,"borderLeft","_bl",r,i,a),Z(e,"borderRight","_br",r,i,a)}}))}(e))),n(" order",(()=>Ce(e))),n(" insertSelfEdges",(()=>function(e){var n=K(e);t(n,(function(n){var r=0;t(n,(function(n,o){var i=e.node(n);i.order=o+r,t(i.selfEdges,(function(n){J(e,"selfedge",{width:n.label.width,height:n.label.height,rank:i.rank,order:o+ ++r,e:n.e,label:n.label},"_se")})),delete i.selfEdges}))}))}(e))),n(" adjustCoordinateSystem",(()=>function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ee(e)}(e))),n(" position",(()=>Je(e))),n(" positionSelfEdges",(()=>function(e){t(e.nodes(),(function(n){var r=e.node(n);if("selfedge"===r.dummy){var t=e.node(r.e.v),o=t.x+t.width/2,i=t.y,a=r.x-o,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],r.label.x=r.x,r.label.y=r.y}}))}(e))),n(" removeBorderNodes",(()=>function(e){t(e.nodes(),(function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),o=e.node(r.borderBottom),i=e.node(v(r.borderLeft)),a=e.node(v(r.borderRight));r.width=Math.abs(a.x-i.x),r.height=Math.abs(o.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}})),t(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e))),n(" normalize.undo",(()=>function(e){t(e.graph().dummyChains,(function(n){var r,t=e.node(n),o=t.edgeLabel;for(e.setEdge(t.edgeObj,o);t.dummy;)r=e.successors(n)[0],e.removeNode(n),o.points.push({x:t.x,y:t.y}),"edge-label"===t.dummy&&(o.x=t.x,o.y=t.y,o.width=t.width,o.height=t.height),n=r,t=e.node(n)}))}(e))),n(" fixupEdgeLabelCoords",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(e))),n(" undoCoordinateSystem",(()=>$(e))),n(" translateGraph",(()=>function(e){var n=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,a=e.graph(),u=a.marginx||0,d=a.marginy||0;function c(e){var t=e.x,a=e.y,u=e.width,d=e.height;n=Math.min(n,t-u/2),r=Math.max(r,t+u/2),o=Math.min(o,a-d/2),i=Math.max(i,a+d/2)}t(e.nodes(),(function(n){c(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);Object.prototype.hasOwnProperty.call(r,"x")&&c(r)})),n-=u,o-=d,t(e.nodes(),(function(r){var t=e.node(r);t.x-=n,t.y-=o})),t(e.edges(),(function(r){var i=e.edge(r);t(i.points,(function(e){e.x-=n,e.y-=o})),Object.prototype.hasOwnProperty.call(i,"x")&&(i.x-=n),Object.prototype.hasOwnProperty.call(i,"y")&&(i.y-=o)})),a.width=r-n+u,a.height=i-o+d}(e))),n(" assignNodeIntersects",(()=>function(e){t(e.edges(),(function(n){var r,t,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(r=o.points[0],t=o.points[o.points.length-1]):(o.points=[],r=a,t=i),o.points.unshift(H(i,r)),o.points.push(H(a,t))}))}(e))),n(" reversePoints",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);r.reversed&&r.points.reverse()}))}(e))),n(" acyclic.undo",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}}))}(e)))}(r,i))),i(" updateInputGraph",(()=>function(e,n){t(e.nodes(),(function(r){var t=e.node(r),o=n.node(r);t&&(t.x=o.x,t.y=o.y,n.children(r).length&&(t.width=o.width,t.height=o.height))})),t(e.edges(),(function(r){var t=e.edge(r),o=n.edge(r);t.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(t.x=o.x,t.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(n,r)))}))}var He=["nodesep","edgesep","ranksep","marginx","marginy"],Ke={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Qe=["acyclicer","ranker","rankdir","align"],We=["width","height"],Xe={width:0,height:0},Ze=["minlen","weight","width","height","labeloffset"],$e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},en=["labelpos"];function nn(e,n){return M(_(e,n),Number)}function rn(e){var n={};return t(e,(function(e,r){n[r.toLowerCase()]=e})),n}export{Ue as l};
|
|
1
|
+
import{G as e}from"./graph-BNQTUVgt.js";import{b as n,e as r,c as t,i as o,f as i,v as a,r as u}from"./_baseUniq-DwI7aCVR.js";import{b as d,a as c,m as s,c as f,h,f as g,l as v,d as l}from"./min-BGzKxLRu.js";import{bY as p,bM as w,d1 as m,as as b,d2 as y,cW as x,d3 as k,d4 as E,D as N,ae as O,d5 as _,d6 as I}from"./index-CBYlZPe-.js";import{c as P,a as j}from"./_baseEach-BbaGBH6b.js";import{s as R}from"./sortBy-frwTH6Xi.js";function T(e,n){return e>n}function M(e,n){var r={};return n=j(n),P(e,(function(e,t,o){m(r,t,n(e,t,o))})),r}function L(e){return e&&e.length?d(e,b,T):void 0}function C(e,n){return e&&e.length?d(e,j(n),c):void 0}var S=0;function G(e){var n=++S;return y(e)+n}class F{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,n=e._prev;if(n!==e)return V(n),n}enqueue(e){var n=this._sentinel;e._prev&&e._next&&V(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n}toString(){for(var e=[],n=this._sentinel,r=n._prev;r!==n;)e.push(JSON.stringify(r,B)),r=r._prev;return"["+e.join(", ")+"]"}}function V(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function B(e,n){if("_next"!==e&&"_prev"!==e)return n}var q=N(1);function Y(n,r){if(n.nodeCount()<=1)return[];var o=function(n,r){var o=new e,i=0,a=0;t(n.nodes(),(function(e){o.setNode(e,{v:e,in:0,out:0})})),t(n.edges(),(function(e){var n=o.edge(e.v,e.w)||0,t=r(e),u=n+t;o.setEdge(e.v,e.w,u),a=Math.max(a,o.node(e.v).out+=t),i=Math.max(i,o.node(e.w).in+=t)}));var u=E(a+i+3).map((function(){return new F})),d=i+1;return t(o.nodes(),(function(e){D(u,d,o.node(e))})),{graph:o,buckets:u,zeroIdx:d}}(n,r||q),i=function(e,n,r){var t,o=[],i=n[n.length-1],a=n[0];for(;e.nodeCount();){for(;t=a.dequeue();)z(e,n,r,t);for(;t=i.dequeue();)z(e,n,r,t);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(t=n[u].dequeue()){o=o.concat(z(e,n,r,t,!0));break}}return o}(o.graph,o.buckets,o.zeroIdx);return k(s(i,(function(e){return n.outEdges(e.v,e.w)})))}function z(e,n,r,o,i){var a=i?[]:void 0;return t(e.inEdges(o.v),(function(t){var o=e.edge(t),u=e.node(t.v);i&&a.push({v:t.v,w:t.w}),u.out-=o,D(n,r,u)})),t(e.outEdges(o.v),(function(t){var o=e.edge(t),i=t.w,a=e.node(i);a.in-=o,D(n,r,a)})),e.removeNode(o.v),a}function D(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function A(e){var n,r="greedy"===e.graph().acyclicer?Y(e,(n=e,function(e){return n.edge(e).weight})):function(e){var n=[],r={},o={};function i(a){Object.prototype.hasOwnProperty.call(o,a)||(o[a]=!0,r[a]=!0,t(e.outEdges(a),(function(e){Object.prototype.hasOwnProperty.call(r,e.w)?n.push(e):i(e.w)})),delete r[a])}return t(e.nodes(),i),n}(e);t(r,(function(n){var r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,G("rev"))}))}function J(e,n,r,t){var o;do{o=G(t)}while(e.hasNode(o));return r.dummy=n,e.setNode(o,r),o}function U(n){var r=new e({multigraph:n.isMultigraph()}).setGraph(n.graph());return t(n.nodes(),(function(e){n.children(e).length||r.setNode(e,n.node(e))})),t(n.edges(),(function(e){r.setEdge(e,n.edge(e))})),r}function W(e,n){var r,t,o=e.x,i=e.y,a=n.x-o,u=n.y-i,d=e.width/2,c=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*d>Math.abs(a)*c?(u<0&&(c=-c),r=c*a/u,t=c):(a<0&&(d=-d),r=d,t=d*u/a),{x:o+r,y:i+t}}function H(e){var n=s(E(Q(e)+1),(function(){return[]}));return t(e.nodes(),(function(r){var t=e.node(r),i=t.rank;o(i)||(n[i][t.order]=r)})),n}function K(e,n,r,t){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=t),J(e,"border",o,n)}function Q(e){return L(s(e.nodes(),(function(n){var r=e.node(n).rank;if(!o(r))return r})))}function X(e,n){return n()}function Z(e,n,r,t,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],d=J(e,"border",a,r);o[n][i]=d,e.setParent(d,t),u&&e.setEdge(u,d,{weight:1})}function $(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){t(e.nodes(),(function(n){re(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);t(r.points,re),Object.prototype.hasOwnProperty.call(r,"y")&&re(r)}))}(e),"lr"!==n&&"rl"!==n||(!function(e){t(e.nodes(),(function(n){te(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);t(r.points,te),Object.prototype.hasOwnProperty.call(r,"x")&&te(r)}))}(e),ee(e))}function ee(e){t(e.nodes(),(function(n){ne(e.node(n))})),t(e.edges(),(function(n){ne(e.edge(n))}))}function ne(e){var n=e.width;e.width=e.height,e.height=n}function re(e){e.y=-e.y}function te(e){var n=e.x;e.x=e.y,e.y=n}function oe(e){e.graph().dummyChains=[],t(e.edges(),(function(n){!function(e,n){var r=n.v,t=e.node(r).rank,o=n.w,i=e.node(o).rank,a=n.name,u=e.edge(n),d=u.labelRank;if(i===t+1)return;e.removeEdge(n);var c,s,f=void 0;for(s=0,++t;t<i;++s,++t)u.points=[],c=J(e,"edge",f={width:0,height:0,edgeLabel:u,edgeObj:n,rank:t},"_d"),t===d&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),e.setEdge(r,c,{weight:u.weight},a),0===s&&e.graph().dummyChains.push(c),r=c;e.setEdge(r,o,{weight:u.weight},a)}(e,n)}))}function ie(e){var n={};t(e.sources(),(function r(t){var o=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return o.rank;n[t]=!0;var i=f(s(e.outEdges(t),(function(n){return r(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))}function ae(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function ue(n){var r,t,o=new e({directed:!1}),i=n.nodes()[0],a=n.nodeCount();for(o.setNode(i,{});de(o,n)<a;)r=ce(o,n),t=o.hasNode(r.v)?ae(n,r):-ae(n,r),se(o,n,t);return o}function de(e,n){return t(e.nodes(),(function r(o){t(n.nodeEdges(o),(function(t){var i=t.v,a=o===i?t.w:i;e.hasNode(a)||ae(n,t)||(e.setNode(a,{}),e.setEdge(o,a,{}),r(a))}))})),e.nodeCount()}function ce(e,n){return C(n.edges(),(function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return ae(n,r)}))}function se(e,n,r){t(e.nodes(),(function(e){n.node(e).rank+=r}))}function fe(e,n,r){O(n)||(n=[n]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return t(n,(function(n){if(!e.hasNode(n))throw new Error("Graph does not have node: "+n);he(e,n,"post"===r,a,o,i)})),i}function he(e,n,r,o,i,a){Object.prototype.hasOwnProperty.call(o,n)||(o[n]=!0,r||a.push(n),t(i(n),(function(n){he(e,n,r,o,i,a)})),r&&a.push(n))}function ge(n){n=function(n){var r=(new e).setGraph(n.graph());return t(n.nodes(),(function(e){r.setNode(e,n.node(e))})),t(n.edges(),(function(e){var t=r.edge(e.v,e.w)||{weight:0,minlen:1},o=n.edge(e);r.setEdge(e.v,e.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})})),r}(n),ie(n);var r,o=ue(n);for(pe(o),ve(o,n);r=me(o);)ye(o,n,r,be(o,n,r))}function ve(e,n){var r=function(e,n){return fe(e,n,"post")}(e,e.nodes());r=r.slice(0,r.length-1),t(r,(function(r){!function(e,n,r){var t=e.node(r),o=t.parent;e.edge(r,o).cutvalue=le(e,n,r)}(e,n,r)}))}function le(e,n,r){var o=e.node(r).parent,i=!0,a=n.edge(r,o),u=0;return a||(i=!1,a=n.edge(o,r)),u=a.weight,t(n.nodeEdges(r),(function(t){var a,d,c=t.v===r,s=c?t.w:t.v;if(s!==o){var f=c===i,h=n.edge(t).weight;if(u+=f?h:-h,a=r,d=s,e.hasEdge(a,d)){var g=e.edge(r,s).cutvalue;u+=f?-g:g}}})),u}function pe(e,n){arguments.length<2&&(n=e.nodes()[0]),we(e,{},1,n)}function we(e,n,r,o,i){var a=r,u=e.node(o);return n[o]=!0,t(e.neighbors(o),(function(t){Object.prototype.hasOwnProperty.call(n,t)||(r=we(e,n,r,t,o))})),u.low=a,u.lim=r++,i?u.parent=i:delete u.parent,r}function me(e){return g(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function be(e,n,r){var t=r.v,o=r.w;n.hasEdge(t,o)||(t=r.w,o=r.v);var a=e.node(t),u=e.node(o),d=a,c=!1;return a.lim>u.lim&&(d=u,c=!0),C(i(n.edges(),(function(n){return c===xe(e,e.node(n.v),d)&&c!==xe(e,e.node(n.w),d)})),(function(e){return ae(n,e)}))}function ye(e,n,r,o){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(o.v,o.w,{}),pe(e),ve(e,n),function(e,n){var r=g(e.nodes(),(function(e){return!n.node(e).parent})),o=function(e,n){return fe(e,n,"pre")}(e,r);o=o.slice(1),t(o,(function(r){var t=e.node(r).parent,o=n.edge(r,t),i=!1;o||(o=n.edge(t,r),i=!0),n.node(r).rank=n.node(t).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function xe(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function ke(e){switch(e.graph().ranker){case"network-simplex":default:Ne(e);break;case"tight-tree":!function(e){ie(e),ue(e)}(e);break;case"longest-path":Ee(e)}}new Error,ge.initLowLimValues=pe,ge.initCutValues=ve,ge.calcCutValue=le,ge.leaveEdge=me,ge.enterEdge=be,ge.exchangeEdges=ye;var Ee=ie;function Ne(e){ge(e)}function Oe(e){var n=J(e,"root",{},"_root"),r=function(e){var n={};function r(o,i){var a=e.children(o);a&&a.length&&t(a,(function(e){r(e,i+1)})),n[o]=i}return t(e.children(),(function(e){r(e,1)})),n}(e),o=L(a(r))-1,i=2*o+1;e.graph().nestingRoot=n,t(e.edges(),(function(n){e.edge(n).minlen*=i}));var d=function(e){return u(e.edges(),(function(n,r){return n+e.edge(r).weight}),0)}(e)+1;t(e.children(),(function(t){_e(e,n,i,d,o,r,t)})),e.graph().nodeRankFactor=i}function _e(e,n,r,o,i,a,u){var d=e.children(u);if(d.length){var c=K(e,"_bt"),s=K(e,"_bb"),f=e.node(u);e.setParent(c,u),f.borderTop=c,e.setParent(s,u),f.borderBottom=s,t(d,(function(t){_e(e,n,r,o,i,a,t);var d=e.node(t),f=d.borderTop?d.borderTop:t,h=d.borderBottom?d.borderBottom:t,g=d.borderTop?o:2*o,v=f!==h?1:i-a[u]+1;e.setEdge(c,f,{weight:g,minlen:v,nestingEdge:!0}),e.setEdge(h,s,{weight:g,minlen:v,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,c,{weight:0,minlen:i+a[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})}function Ie(n,r,i){var a=function(e){var n;for(;e.hasNode(n=G("_root")););return n}(n),u=new e({compound:!0}).setGraph({root:a}).setDefaultNodeLabel((function(e){return n.node(e)}));return t(n.nodes(),(function(e){var d=n.node(e),c=n.parent(e);(d.rank===r||d.minRank<=r&&r<=d.maxRank)&&(u.setNode(e),u.setParent(e,c||a),t(n[i](e),(function(r){var t=r.v===e?r.w:r.v,i=u.edge(t,e),a=o(i)?0:i.weight;u.setEdge(t,e,{weight:n.edge(r).weight+a})})),Object.prototype.hasOwnProperty.call(d,"minRank")&&u.setNode(e,{borderLeft:d.borderLeft[r],borderRight:d.borderRight[r]}))})),u}function Pe(e,n){for(var r=0,t=1;t<n.length;++t)r+=je(e,n[t-1],n[t]);return r}function je(e,n,r){for(var o,i,a=(o=r,i=s(r,(function(e,n){return n})),function(e,n,r){for(var t=-1,o=e.length,i=n.length,a={};++t<o;){var u=t<i?n[t]:void 0;r(a,e[t],u)}return a}(o||[],i||[],x)),u=k(s(n,(function(n){return R(s(e.outEdges(n),(function(n){return{pos:a[n.w],weight:e.edge(n).weight}})),"pos")}))),d=1;d<r.length;)d<<=1;var c=2*d-1;d-=1;var f=s(new Array(c),(function(){return 0})),h=0;return t(u.forEach((function(e){var n=e.pos+d;f[n]+=e.weight;for(var r=0;n>0;)n%2&&(r+=f[n+1]),f[n=n-1>>1]+=e.weight;h+=e.weight*r}))),h}function Re(e,n){var r={};return t(e,(function(e,n){var t=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};o(e.barycenter)||(t.barycenter=e.barycenter,t.weight=e.weight)})),t(n.edges(),(function(e){var n=r[e.v],t=r[e.w];o(n)||o(t)||(t.indegree++,n.out.push(r[e.w]))})),function(e){var n=[];function r(e){return function(n){n.merged||(o(n.barycenter)||o(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight);n.weight&&(r+=n.barycenter*n.weight,t+=n.weight);e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function a(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}for(;e.length;){var u=e.pop();n.push(u),t(u.in.reverse(),r(u)),t(u.out,a(u))}return s(i(n,(function(e){return!e.merged})),(function(e){return _(e,["vs","i","barycenter","weight"])}))}(i(r,(function(e){return!e.indegree})))}function Te(e,n){var r,o=function(e,n){var r={lhs:[],rhs:[]};return t(e,(function(e){n(e)?r.lhs.push(e):r.rhs.push(e)})),r}(e,(function(e){return Object.prototype.hasOwnProperty.call(e,"barycenter")})),i=o.lhs,a=R(o.rhs,(function(e){return-e.i})),u=[],d=0,c=0,s=0;i.sort((r=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:r?n.i-e.i:e.i-n.i})),s=Me(u,a,s),t(i,(function(e){s+=e.vs.length,u.push(e.vs),d+=e.barycenter*e.weight,c+=e.weight,s=Me(u,a,s)}));var f={vs:k(u)};return c&&(f.barycenter=d/c,f.weight=c),f}function Me(e,n,r){for(var t;n.length&&(t=v(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Le(e,n,r,a){var d=e.children(n),c=e.node(n),f=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,g={};f&&(d=i(d,(function(e){return e!==f&&e!==h})));var v=function(e,n){return s(n,(function(n){var r=e.inEdges(n);if(r.length){var t=u(r,(function(n,r){var t=e.edge(r),o=e.node(r.v);return{sum:n.sum+t.weight*o.order,weight:n.weight+t.weight}}),{sum:0,weight:0});return{v:n,barycenter:t.sum/t.weight,weight:t.weight}}return{v:n}}))}(e,d);t(v,(function(n){if(e.children(n.v).length){var t=Le(e,n.v,r,a);g[n.v]=t,Object.prototype.hasOwnProperty.call(t,"barycenter")&&(u=t,o((i=n).barycenter)?(i.barycenter=u.barycenter,i.weight=u.weight):(i.barycenter=(i.barycenter*i.weight+u.barycenter*u.weight)/(i.weight+u.weight),i.weight+=u.weight))}var i,u}));var l=Re(v,r);!function(e,n){t(e,(function(e){e.vs=k(e.vs.map((function(e){return n[e]?n[e].vs:e})))}))}(l,g);var p=Te(l,a);if(f&&(p.vs=k([f,p.vs,h]),e.predecessors(f).length)){var w=e.node(e.predecessors(f)[0]),m=e.node(e.predecessors(h)[0]);Object.prototype.hasOwnProperty.call(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+w.order+m.order)/(p.weight+2),p.weight+=2}return p}function Ce(e){var r=Q(e),o=Se(e,E(1,r+1),"inEdges"),a=Se(e,E(r-1,-1,-1),"outEdges"),u=function(e){var n={},r=i(e.nodes(),(function(n){return!e.children(n).length})),o=L(s(r,(function(n){return e.node(n).rank}))),a=s(E(o+1),(function(){return[]})),u=R(r,(function(n){return e.node(n).rank}));return t(u,(function r(o){if(!h(n,o)){n[o]=!0;var i=e.node(o);a[i.rank].push(o),t(e.successors(o),r)}})),a}(e);Fe(e,u);for(var d,c=Number.POSITIVE_INFINITY,f=0,g=0;g<4;++f,++g){Ge(f%2?o:a,f%4>=2);var v=Pe(e,u=H(e));v<c&&(g=0,d=n(u,5),c=v)}Fe(e,d)}function Se(e,n,r){return s(n,(function(n){return Ie(e,n,r)}))}function Ge(n,r){var o=new e;t(n,(function(e){var n=e.graph().root,i=Le(e,n,o,r);t(i.vs,(function(n,r){e.node(n).order=r})),function(e,n,r){var o,i={};t(r,(function(r){for(var t,a,u=e.parent(r);u;){if((t=e.parent(u))?(a=i[t],i[t]=u):(a=o,o=u),a&&a!==u)return void n.setEdge(a,u);u=t}}))}(e,o,i.vs)}))}function Fe(e,n){t(n,(function(n){t(n,(function(n,r){e.node(n).order=r}))}))}function Ve(e){var n=function(e){var n={},r=0;function o(i){var a=r;t(e.children(i),o),n[i]={low:a,lim:r++}}return t(e.children(),o),n}(e);t(e.graph().dummyChains,(function(r){for(var t=e.node(r),o=t.edgeObj,i=function(e,n,r,t){var o,i,a=[],u=[],d=Math.min(n[r].low,n[t].low),c=Math.max(n[r].lim,n[t].lim);o=r;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>d||c>n[o].lim));i=o,o=t;for(;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,d=0,c=a[d],s=!0;r!==o.w;){if(t=e.node(r),s){for(;(c=a[d])!==u&&e.node(c).maxRank<t.rank;)d++;c===u&&(s=!1)}if(!s){for(;d<a.length-1&&e.node(c=a[d+1]).minRank<=t.rank;)d++;c=a[d]}e.setParent(r,c),r=e.successors(r)[0]}}))}function Be(e,n){var r={};return u(n,(function(n,o){var i=0,a=0,u=n.length,d=v(o);return t(o,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return g(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),f=s?e.node(s).order:u;(s||n===d)&&(t(o.slice(a,c+1),(function(n){t(e.predecessors(n),(function(t){var o=e.node(t),a=o.order;!(a<i||f<a)||o.dummy&&e.node(n).dummy||qe(r,t,n)}))})),a=c+1,i=f)})),o})),r}function qe(e,n,r){if(n>r){var t=n;n=r,r=t}var o=e[n];o||(e[n]=o={}),o[r]=!0}function Ye(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function ze(n,r,o,i,a){var u={},d=function(n,r,o,i){var a=new e,u=n.graph(),d=function(e,n,r){return function(t,o,i){var a,u=t.node(o),d=t.node(i),c=0;if(c+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=r?a:-a),a=0,c+=(u.dummy?n:e)/2,c+=(d.dummy?n:e)/2,c+=d.width/2,Object.prototype.hasOwnProperty.call(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":a=d.width/2;break;case"r":a=-d.width/2}return a&&(c+=r?a:-a),a=0,c}}(u.nodesep,u.edgesep,i);return t(r,(function(e){var r;t(e,(function(e){var t=o[e];if(a.setNode(t),r){var i=o[r],u=a.edge(i,t);a.setEdge(i,t,Math.max(d(n,e,r),u||0))}r=e}))})),a}(n,r,o,a),c=a?"borderLeft":"borderRight";function s(e,n){for(var r=d.nodes(),t=r.pop(),o={};t;)o[t]?e(t):(o[t]=!0,r.push(t),r=r.concat(n(t))),t=r.pop()}return s((function(e){u[e]=d.inEdges(e).reduce((function(e,n){return Math.max(e,u[n.v]+d.edge(n))}),0)}),d.predecessors.bind(d)),s((function(e){var r=d.outEdges(e).reduce((function(e,n){return Math.min(e,u[n.w]-d.edge(n))}),Number.POSITIVE_INFINITY),t=n.node(e);r!==Number.POSITIVE_INFINITY&&t.borderType!==c&&(u[e]=Math.max(u[e],r))}),d.successors.bind(d)),t(i,(function(e){u[e]=u[o[e]]})),u}function De(e,n){return C(a(n),(function(n){var t,o,i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return o=function(n,r){var t=function(e,n){return e.node(n).width}(e,r)/2;i=Math.max(n+t,i),a=Math.min(n-t,a)},null==(t=n)||p(t,r(o),w),i-a}))}function Ae(e){var n,r=H(e),o=I(Be(e,r),function(e,n){var r={};function o(n,o,i,a,u){var d;t(E(o,i),(function(o){d=n[o],e.node(d).dummy&&t(e.predecessors(d),(function(n){var t=e.node(n);t.dummy&&(t.order<a||t.order>u)&&qe(r,n,d)}))}))}return u(n,(function(n,r){var i,a=-1,u=0;return t(r,(function(t,d){if("border"===e.node(t).dummy){var c=e.predecessors(t);c.length&&(i=e.node(c[0]).order,o(r,u,d,a,i),u=d,a=i)}o(r,u,r.length,i,n.length)})),r})),r}(e,r)),i={};t(["u","d"],(function(u){n="u"===u?r:a(r).reverse(),t(["l","r"],(function(r){"r"===r&&(n=s(n,(function(e){return a(e).reverse()})));var d=("u"===u?e.predecessors:e.successors).bind(e),c=function(e,n,r,o){var i={},a={},u={};return t(n,(function(e){t(e,(function(e,n){i[e]=e,a[e]=e,u[e]=n}))})),t(n,(function(e){var n=-1;t(e,(function(e){var t=o(e);if(t.length)for(var d=((t=R(t,(function(e){return u[e]}))).length-1)/2,c=Math.floor(d),s=Math.ceil(d);c<=s;++c){var f=t[c];a[e]===e&&n<u[f]&&!Ye(r,e,f)&&(a[f]=e,a[e]=i[e]=i[f],n=u[f])}}))})),{root:i,align:a}}(0,n,o,d),f=ze(e,n,c.root,c.align,"r"===r);"r"===r&&(f=M(f,(function(e){return-e}))),i[u+r]=f}))}));var d=De(e,i);return function(e,n){var r=a(n),o=f(r),i=L(r);t(["u","d"],(function(r){t(["l","r"],(function(t){var u,d=r+t,c=e[d];if(c!==n){var s=a(c);(u="l"===t?o-f(s):i-L(s))&&(e[d]=M(c,(function(e){return e+u})))}}))}))}(i,d),function(e,n){return M(e.ul,(function(r,t){if(n)return e[n.toLowerCase()][t];var o=R(s(e,t));return(o[1]+o[2])/2}))}(i,e.graph().align)}function Je(e){var n,o;(function(e){var n=H(e),r=e.graph().ranksep,o=0;t(n,(function(n){var i=L(s(n,(function(n){return e.node(n).height})));t(n,(function(n){e.node(n).y=o+i/2})),o+=i+r}))})(e=U(e)),n=Ae(e),o=function(n,r){e.node(r).x=n},n&&P(n,r(o))}function Ue(n,r){var i=X;i("layout",(()=>{var r=i(" buildLayoutGraph",(()=>function(n){var r=new e({multigraph:!0,compound:!0}),o=rn(n.graph());return r.setGraph(I({},He,nn(o,We),_(o,Ke))),t(n.nodes(),(function(e){var t=rn(n.node(e));r.setNode(e,l(nn(t,Qe),Xe)),r.setParent(e,n.parent(e))})),t(n.edges(),(function(e){var t=rn(n.edge(e));r.setEdge(e,I({},$e,nn(t,Ze),_(t,en)))})),r}(n)));i(" runLayout",(()=>function(e,n){n(" makeSpaceForEdgeLabels",(()=>function(e){var n=e.graph();n.ranksep/=2,t(e.edges(),(function(r){var t=e.edge(r);t.minlen*=2,"c"!==t.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?t.width+=t.labeloffset:t.height+=t.labeloffset)}))}(e))),n(" removeSelfEdges",(()=>function(e){t(e.edges(),(function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e))),n(" acyclic",(()=>A(e))),n(" nestingGraph.run",(()=>Oe(e))),n(" rank",(()=>ke(U(e)))),n(" injectEdgeLabelProxies",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),o={rank:(e.node(n.w).rank-t.rank)/2+t.rank,e:n};J(e,"edge-proxy",o,"_ep")}}))}(e))),n(" removeEmptyRanks",(()=>function(e){var n=f(s(e.nodes(),(function(n){return e.node(n).rank}))),r=[];t(e.nodes(),(function(t){var o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)}));var i=0,a=e.graph().nodeRankFactor;t(r,(function(n,r){o(n)&&r%a!=0?--i:i&&t(n,(function(n){e.node(n).rank+=i}))}))}(e))),n(" nestingGraph.cleanup",(()=>function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,t(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}(e))),n(" normalizeRanks",(()=>function(e){var n=f(s(e.nodes(),(function(n){return e.node(n).rank})));t(e.nodes(),(function(r){var t=e.node(r);h(t,"rank")&&(t.rank-=n)}))}(e))),n(" assignRankMinMax",(()=>function(e){var n=0;t(e.nodes(),(function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=L(n,t.maxRank))})),e.graph().maxRank=n}(e))),n(" removeEdgeLabelProxies",(()=>function(e){t(e.nodes(),(function(n){var r=e.node(n);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))}))}(e))),n(" normalize.run",(()=>oe(e))),n(" parentDummyChains",(()=>Ve(e))),n(" addBorderSegments",(()=>function(e){t(e.children(),(function n(r){var o=e.children(r),i=e.node(r);if(o.length&&t(o,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,u=i.maxRank+1;a<u;++a)Z(e,"borderLeft","_bl",r,i,a),Z(e,"borderRight","_br",r,i,a)}}))}(e))),n(" order",(()=>Ce(e))),n(" insertSelfEdges",(()=>function(e){var n=H(e);t(n,(function(n){var r=0;t(n,(function(n,o){var i=e.node(n);i.order=o+r,t(i.selfEdges,(function(n){J(e,"selfedge",{width:n.label.width,height:n.label.height,rank:i.rank,order:o+ ++r,e:n.e,label:n.label},"_se")})),delete i.selfEdges}))}))}(e))),n(" adjustCoordinateSystem",(()=>function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ee(e)}(e))),n(" position",(()=>Je(e))),n(" positionSelfEdges",(()=>function(e){t(e.nodes(),(function(n){var r=e.node(n);if("selfedge"===r.dummy){var t=e.node(r.e.v),o=t.x+t.width/2,i=t.y,a=r.x-o,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],r.label.x=r.x,r.label.y=r.y}}))}(e))),n(" removeBorderNodes",(()=>function(e){t(e.nodes(),(function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),o=e.node(r.borderBottom),i=e.node(v(r.borderLeft)),a=e.node(v(r.borderRight));r.width=Math.abs(a.x-i.x),r.height=Math.abs(o.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}})),t(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e))),n(" normalize.undo",(()=>function(e){t(e.graph().dummyChains,(function(n){var r,t=e.node(n),o=t.edgeLabel;for(e.setEdge(t.edgeObj,o);t.dummy;)r=e.successors(n)[0],e.removeNode(n),o.points.push({x:t.x,y:t.y}),"edge-label"===t.dummy&&(o.x=t.x,o.y=t.y,o.width=t.width,o.height=t.height),n=r,t=e.node(n)}))}(e))),n(" fixupEdgeLabelCoords",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(e))),n(" undoCoordinateSystem",(()=>$(e))),n(" translateGraph",(()=>function(e){var n=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,a=e.graph(),u=a.marginx||0,d=a.marginy||0;function c(e){var t=e.x,a=e.y,u=e.width,d=e.height;n=Math.min(n,t-u/2),r=Math.max(r,t+u/2),o=Math.min(o,a-d/2),i=Math.max(i,a+d/2)}t(e.nodes(),(function(n){c(e.node(n))})),t(e.edges(),(function(n){var r=e.edge(n);Object.prototype.hasOwnProperty.call(r,"x")&&c(r)})),n-=u,o-=d,t(e.nodes(),(function(r){var t=e.node(r);t.x-=n,t.y-=o})),t(e.edges(),(function(r){var i=e.edge(r);t(i.points,(function(e){e.x-=n,e.y-=o})),Object.prototype.hasOwnProperty.call(i,"x")&&(i.x-=n),Object.prototype.hasOwnProperty.call(i,"y")&&(i.y-=o)})),a.width=r-n+u,a.height=i-o+d}(e))),n(" assignNodeIntersects",(()=>function(e){t(e.edges(),(function(n){var r,t,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(r=o.points[0],t=o.points[o.points.length-1]):(o.points=[],r=a,t=i),o.points.unshift(W(i,r)),o.points.push(W(a,t))}))}(e))),n(" reversePoints",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);r.reversed&&r.points.reverse()}))}(e))),n(" acyclic.undo",(()=>function(e){t(e.edges(),(function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}}))}(e)))}(r,i))),i(" updateInputGraph",(()=>function(e,n){t(e.nodes(),(function(r){var t=e.node(r),o=n.node(r);t&&(t.x=o.x,t.y=o.y,n.children(r).length&&(t.width=o.width,t.height=o.height))})),t(e.edges(),(function(r){var t=e.edge(r),o=n.edge(r);t.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(t.x=o.x,t.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(n,r)))}))}var We=["nodesep","edgesep","ranksep","marginx","marginy"],He={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ke=["acyclicer","ranker","rankdir","align"],Qe=["width","height"],Xe={width:0,height:0},Ze=["minlen","weight","width","height","labeloffset"],$e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},en=["labelpos"];function nn(e,n){return M(_(e,n),Number)}function rn(e){var n={};return t(e,(function(e,r){n[r.toLowerCase()]=e})),n}export{Ue as l};
|