/* Copyright (c) 2006, Ivan Sagalaev. All rights reserved. SPDX-License-Identifier: BSD-3-Clause */ 'use strict';function escape$$module$third_party$javascript$highlightjs$src$lib$regex(value){return new RegExp(value.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function source$$module$third_party$javascript$highlightjs$src$lib$regex(re){if(!re)return null;if(typeof re==="string")return re;return re.source}function lookahead$$module$third_party$javascript$highlightjs$src$lib$regex(re){return concat$$module$third_party$javascript$highlightjs$src$lib$regex("(?=",re,")")} function anyNumberOfTimes$$module$third_party$javascript$highlightjs$src$lib$regex(re){return concat$$module$third_party$javascript$highlightjs$src$lib$regex("(",re,")*")}function optional$$module$third_party$javascript$highlightjs$src$lib$regex(re){return concat$$module$third_party$javascript$highlightjs$src$lib$regex("(",re,")?")} function concat$$module$third_party$javascript$highlightjs$src$lib$regex(...args){const joined=args.map(x=>{return source$$module$third_party$javascript$highlightjs$src$lib$regex(x)}).join("");return joined}function either$$module$third_party$javascript$highlightjs$src$lib$regex(...args){const joined="("+args.map(x=>{return source$$module$third_party$javascript$highlightjs$src$lib$regex(x)}).join("|")+")";return joined} function countMatchGroups$$module$third_party$javascript$highlightjs$src$lib$regex(re){return(new RegExp(re.toString()+"|")).exec("").length-1}function startsWith$$module$third_party$javascript$highlightjs$src$lib$regex(re,lexeme){const match=re&&re.exec(lexeme);return match&&match.index===0} function join$$module$third_party$javascript$highlightjs$src$lib$regex(regexps,separator="|"){const backreferenceRe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;let numCaptures=0;let ret="";for(let i=0;i0)ret=ret+separator;ret=ret+"(";for(;re.length>0;){const match=backreferenceRe.exec(re);if(match==null){ret=ret+re;break}ret=ret+re.substring(0, match.index);re=re.substring(match.index+match[0].length);if(match[0][0]==="\\"&&match[1])ret=ret+("\\"+String(Number(match[1])+offset));else{ret=ret+match[0];if(match[0]==="(")numCaptures++}}ret=ret+")"}return ret}var module$third_party$javascript$highlightjs$src$lib$regex={};module$third_party$javascript$highlightjs$src$lib$regex.anyNumberOfTimes=anyNumberOfTimes$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.concat=concat$$module$third_party$javascript$highlightjs$src$lib$regex; module$third_party$javascript$highlightjs$src$lib$regex.countMatchGroups=countMatchGroups$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.either=either$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.escape=escape$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.join=join$$module$third_party$javascript$highlightjs$src$lib$regex; module$third_party$javascript$highlightjs$src$lib$regex.lookahead=lookahead$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.optional=optional$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.source=source$$module$third_party$javascript$highlightjs$src$lib$regex;module$third_party$javascript$highlightjs$src$lib$regex.startsWith=startsWith$$module$third_party$javascript$highlightjs$src$lib$regex;var $jscompDefaultExport$$module$third_party$javascript$highlightjs$src$languages$sql=function(hljs){function reduceRelevancy(list,{exceptions,when}={}){const qualifyFn=when;exceptions=exceptions||[];return list.map(item=>{if(item.match(/\|\d+$/)||exceptions.includes(item))return item;else if(qualifyFn(item))return`${item}|0`;else return item})}const COMMENT_MODE=hljs.COMMENT("--","$");const STRING={className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]};const QUOTED_IDENTIFIER= {begin:/"/,end:/"/,contains:[{begin:/""/}]};const LITERALS=["true","false","unknown"];const MULTI_WORD_TYPES=["double precision","large object","with timezone","without timezone"];const TYPES=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"];const NON_RESERVED_WORDS=["add","asc","collation","desc","final", "first","last","view"];const RESERVED_WORDS=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate", "collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal", "decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold", "hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches", "max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex", "power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint", "some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest", "update ","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"];const RESERVED_FUNCTIONS=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object", "json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh", "translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"];const POSSIBLE_WITHOUT_PARENS=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"];const COMBOS=["create table","insert into","primary key","foreign key","not null", "alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"];const FUNCTIONS=RESERVED_FUNCTIONS;const KEYWORDS=[...RESERVED_WORDS,...NON_RESERVED_WORDS].filter(keyword=>{return!RESERVED_FUNCTIONS.includes(keyword)});const VARIABLE={className:"variable",begin:/@[a-z0-9]+/};const OPERATOR={className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0};const FUNCTION_CALL= {begin:concat$$module$third_party$javascript$highlightjs$src$lib$regex(/\b/,either$$module$third_party$javascript$highlightjs$src$lib$regex(...FUNCTIONS),/\s*\(/),keywords:{built_in:FUNCTIONS}};return{name:"SQL",case_insensitive:true,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:reduceRelevancy(KEYWORDS,{when:x=>{return x.length<3}}),literal:LITERALS,type:TYPES,built_in:POSSIBLE_WITHOUT_PARENS},contains:[{begin:either$$module$third_party$javascript$highlightjs$src$lib$regex(...COMBOS), keywords:{$pattern:/[\w\.]+/,keyword:KEYWORDS.concat(COMBOS),literal:LITERALS,type:TYPES}},{className:"type",begin:either$$module$third_party$javascript$highlightjs$src$lib$regex(...MULTI_WORD_TYPES)},FUNCTION_CALL,VARIABLE,STRING,QUOTED_IDENTIFIER,hljs.C_NUMBER_MODE,hljs.C_BLOCK_COMMENT_MODE,COMMENT_MODE,OPERATOR]}};var module$third_party$javascript$highlightjs$src$languages$sql={};module$third_party$javascript$highlightjs$src$languages$sql.default=$jscompDefaultExport$$module$third_party$javascript$highlightjs$src$languages$sql;globalThis.hljs_sql=$jscompDefaultExport$$module$third_party$javascript$highlightjs$src$languages$sql;var module$third_party$javascript$highlightjs$export_shims$export_sql={};