@fc-components/monaco-editor 0.2.1 → 0.3.2
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/expr/__tests__/__mocks__/monaco-editor.d.ts +28 -0
- package/dist/expr/completion/getCompletionProvider.d.ts +4 -0
- package/dist/expr/expr.d.ts +83 -0
- package/dist/expr/index.d.ts +3 -0
- package/dist/expr/parser/index.d.ts +3 -0
- package/dist/expr/parser/lexer.d.ts +27 -0
- package/dist/expr/parser/parser.d.ts +66 -0
- package/dist/expr/parser/types.d.ts +32 -0
- package/dist/expr/types.d.ts +17 -0
- package/dist/expr/validation.d.ts +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/monaco-editor.cjs.development.js +1987 -3
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +1991 -8
- package/dist/monaco-editor.esm.js.map +1 -1
- package/dist/sql/format.d.ts +1 -0
- package/dist/sql/index.d.ts +9 -2
- package/package.json +6 -1
- package/src/expr/__tests__/__mocks__/monaco-editor.ts +34 -0
- package/src/expr/__tests__/expr.test.tsx +339 -0
- package/src/expr/completion/getCompletionProvider.ts +133 -0
- package/src/expr/expr.ts +229 -0
- package/src/expr/index.tsx +322 -0
- package/src/expr/parser/index.ts +3 -0
- package/src/expr/parser/lexer.ts +377 -0
- package/src/expr/parser/parser.ts +581 -0
- package/src/expr/parser/types.ts +77 -0
- package/src/expr/types.ts +17 -0
- package/src/expr/validation.ts +209 -0
- package/src/index.tsx +2 -0
- package/src/sql/format.ts +13 -0
- package/src/sql/index.tsx +91 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=e(require("react-monaco-editor")),i=require("monaco-editor"),a=require("monaco-promql"),o=require("@fc-components/lezer-metricsql"),s=require("uuid"),l=require("@emotion/css");function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){c(a,r,i,o,s,"next",e)}function s(e){c(a,r,i,o,s,"throw",e)}o(void 0)}))}}function m(e,t,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&_(i,n.prototype),i}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(){return(h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var l=Object.create((r&&r.prototype instanceof s?r:s).prototype);return b(l,"_invoke",function(n,r,i){var a,s,l,u=0,c=i||[],d=!1,m={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,s=0,l=e,m.n=n,o}};function f(n,r){for(s=n,l=r,t=0;!d&&u&&!i&&t<c.length;t++){var i,a=c[t],f=m.p,h=a[2];n>3?(i=h===r)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((i=n<2&&f<a[1])?(s=0,m.v=r,m.n=a[1]):f<h&&(i=n<3||a[0]>r||r>h)&&(a[4]=n,a[5]=r,m.n=h,s=0))}if(i||n>1)return o;throw d=!0,r}return function(i,c,h){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&f(c,h),s=c,l=h;(t=s<2?e:l)||!d;){a||(s?s<3?(s>1&&(m.n=-1),f(s,l)):m.n=l:m.v=l);try{if(u=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(d=m.n<0)?l:n.call(r,m))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,i,a),!0),l}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(b(t={},r,(function(){return this})),t),d=u.prototype=s.prototype=Object.create(c);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,b(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=u,b(d,"constructor",u),b(u,"constructor",l),l.displayName="GeneratorFunction",b(u,i,"GeneratorFunction"),b(d),b(d,i,"Generator"),b(d,r,(function(){return this})),b(d,"toString",(function(){return"[object Generator]"})),(p=function(){return{w:a,m:m}})()}function b(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(b=function(e,t,n,r){if(t)i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{function a(t,n){b(e,t,(function(e){return this._invoke(t,n,e)}))}a("next",0),a("throw",1),a("return",2)}})(e,t,n,r)}function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return t||(t=e.slice(0)),e.raw=t,e}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return m(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}for(var x={wordPattern:/(-?\d*\.\d\w*)|([^`~!#%^&*()\-=+\[{\]}\\|;:'",.<>\/?\s]+)/g,comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{}},E=["sum","min","max","avg","group","stddev","stdvar","count","count_values","bottomk","topk","quantile","quantiles","distinct","geomean","histogram","mad","mode","any","bottomk_avg","bottomk_max","bottomk_median","bottomk_last","bottomk_min","topk_avg","topk_max","topk_median","topk_last","topk_min","outliers_mad","outliersk","share","sum2","zscore"],w=["abs","absent","ceil","changes","clamp_max","clamp_min","day_of_month","day_of_week","days_in_month","delta","deriv","exp","floor","histogram_quantile","histogram_avg","histogram_count","histogram_sum","histogram_fraction","histogram_stddev","histogram_stdvar","holt_winters","hour","idelta","increase","irate","label_join","label_replace","ln","log2","log10","minute","month","predict_linear","rate","resets","round","scalar","sort","sort_desc","sqrt","time","timestamp","vector","year","aggr_over_time","alias","ascent_over_time","bitmap_and","bitmap_or","bitmap_xor","buckets_limit","changes_prometheus","count_eq_over_time","count_gt_over_time","count_le_over_time","count_ne_over_time","decreases_over_time","default_rollup","delta_prometheus","deriv_fast","descent_over_time","distinct_over_time","drop_common_labels","duration_over_time","first_over_time","geomean_over_time","histogram_avg","histogram_over_time","histogram_quantiles","histogram_share","hoeffding_bound_lower","hoeffding_bound_upper","ideriv","increase_prometheus","increase_pure","increases_over_time","integrate","interpolate","keep_last_value","keep_next_value","label_copy","label_del","label_graphite_group","label_keep","label_lowercase","label_map","label_match","label_mismatch","label_move","label_set","label_transform","label_uppercase","label_value","lag","lifetime","limit_offset","mad_over_time","median_over_time","mode_over_time","now","prometheus_buckets","quantiles_over_time","rand","rand_exponential","rand_normal","range_avg","range_first","range_last","range_linear_regression","range_mad","range_max","range_min","range_normalize","range_over_time","range_quantile","range_stddev","range_stdvar","range_sum","range_trim_outliers","range_trim_spikes","range_trim_zscore","range_zscore","rate_over_sum","remove_resets","rollup","rollup_candlestick","rollup_delta","rollup_deriv","rollup_increase","rollup_rate","rollup_scrape_interval","running_avg","running_max","running_min","running_sum","scrape_interval","share_eq_over_time","share_gt_over_time","share_le_over_time","smooth_exponential","smooth_exponential","sort_by_label_desc","sort_by_label_numeric","sort_by_label_numeric_desc","stale_samples_over_time","step","sum2_over_time","tfirst_over_time","timestamp_with_name","timezone_offset","tlast_change_over_time","tlast_over_time","tmax_over_time","tmin_over_time","union","zscore_over_time","avg_daily","median_daily","avg_weekly","median_weekly","median_weekly_with_trends"],C=[],L=0,k=E;L<k.length;L++)C.push(k[L]+"_over_time");var S=["on","ignoring","group_right","group_left","by","without"],R=["with"],I="("+S.reduce((function(e,t){return e+"|"+t}))+")",O=["offset"],A={ignoreCase:!1,defaultToken:"",tokenPostfix:".promql",keywords:E.concat(w).concat(C).concat(S).concat(O).concat(R),operators:["+","-","*","/","%","^","==","!=",">","<",">=","<=","and","or","unless"],vectorMatching:I,symbols:/[=><!~?:&|+\-*\/^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,integersuffix:/(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/,floatsuffix:/[fFlL]?/,tokenizer:{root:[[/@vectorMatching\s*(?=\()/,"type","@clauses"],[/[a-z_]\w*(?=\s*(=|!=|=~|!~))/,"tag"],[/(^#.*$)/,"comment"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":"type","@default":"identifier"}}],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string_double"],[/'/,"string","@string_single"],[/`/,"string","@string_backtick"],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/\d+[smhdwy]/,"number"],[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/,"number.float"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/,"number.hex"],[/0[0-7']*[0-7](@integersuffix)/,"number.octal"],[/0[bB][0-1']*[0-1](@integersuffix)/,"number.binary"],[/\d[\d']*\d(@integersuffix)/,"number"],[/\d(@integersuffix)/,"number"]],string_double:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],string_single:[[/[^\\']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,"string","@pop"]],string_backtick:[[/[^\\`$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,"string","@pop"]],clauses:[[/[^(,)]/,"tag"],[/\)/,"identifier","@pop"]],whitespace:[[/[ \t\r\n]+/,"white"]]}},M=[].concat([{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"group",insertText:"group",documentation:"All values in the resulting vector are 1"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"count_values",insertText:"count_values",documentation:"Count number of elements with the same value"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"},{label:"quantile",insertText:"quantile",documentation:"Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions"}],[{label:"acos",insertText:"acos",detail:"acos(v instant-vector)",documentation:"calculates the arccosine of all elements in v"},{label:"acosh",insertText:"acosh",detail:"acosh(v instant-vector)",documentation:"calculates the inverse hyperbolic cosine of all elements in v"},{label:"asin",insertText:"asin",detail:"asin(v instant-vector)",documentation:"calculates the arcsine of all elements in v"},{label:"asinh",insertText:"asinh",detail:"asinh(v instant-vector)",documentation:"calculates the inverse hyperbolic sine of all elements in v"},{label:"atan",insertText:"atan",detail:"atan(v instant-vector)",documentation:"calculates the arctangent of all elements in v"},{label:"atanh",insertText:"atanh",detail:"atanh(v instant-vector)",documentation:"calculates the inverse hyperbolic tangent of all elements in v"},{label:"cos",insertText:"cos",detail:"cos(v instant-vector)",documentation:"calculates the cosine of all elements in v"},{label:"cosh",insertText:"cosh",detail:"cosh(v instant-vector)",documentation:"calculates the hyperbolic cosine of all elements in v"},{label:"sin",insertText:"sin",detail:"sin(v instant-vector)",documentation:"calculates the sine of all elements in v"},{label:"sinh",insertText:"sinh",detail:"sinh(v instant-vector)",documentation:"calculates the hyperbolic sine of all elements in v"},{label:"tan",insertText:"tan",detail:"tan(v instant-vector)",documentation:"calculates the tangent of all elements in v"},{label:"tanh",insertText:"tanh",detail:"tanh(v instant-vector)",documentation:"calculates the hyperbolic tangent of all elements in v"}],[{insertText:"abs",label:"abs",detail:"abs(v instant-vector)",documentation:"Returns the input vector with all sample values converted to their absolute value."},{insertText:"absent",label:"absent",detail:"absent(v instant-vector)",documentation:"Returns an empty vector if the vector passed to it has any elements and a 1-element vector with the value 1 if the vector passed to it has no elements. This is useful for alerting on when no time series exist for a given metric name and label combination."},{insertText:"absent_over_time",label:"absent_over_time",detail:"absent(v range-vector)",documentation:"Returns an empty vector if the range vector passed to it has any elements and a 1-element vector with the value 1 if the range vector passed to it has no elements."},{insertText:"ceil",label:"ceil",detail:"ceil(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` up to the nearest integer."},{insertText:"changes",label:"changes",detail:"changes(v range-vector)",documentation:"For each input time series, `changes(v range-vector)` returns the number of times its value has changed within the provided time range as an instant vector."},{insertText:"clamp",label:"clamp",detail:"clamp(v instant-vector, min scalar, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min` and an upper limit of `max`."},{insertText:"clamp_max",label:"clamp_max",detail:"clamp_max(v instant-vector, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have an upper limit of `max`."},{insertText:"clamp_min",label:"clamp_min",detail:"clamp_min(v instant-vector, min scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min`."},{insertText:"count_scalar",label:"count_scalar",detail:"count_scalar(v instant-vector)",documentation:"Returns the number of elements in a time series vector as a scalar. This is in contrast to the `count()` aggregation operator, which always returns a vector (an empty one if the input vector is empty) and allows grouping by labels via a `by` clause."},{insertText:"deg",label:"deg",detail:"deg(v instant-vector)",documentation:"Converts radians to degrees for all elements in v"},{insertText:"day_of_month",label:"day_of_month",detail:"day_of_month(v=vector(time()) instant-vector)",documentation:"Returns the day of the month for each of the given times in UTC. Returned values are from 1 to 31."},{insertText:"day_of_week",label:"day_of_week",detail:"day_of_week(v=vector(time()) instant-vector)",documentation:"Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc."},{insertText:"day_of_year",label:"day_of_year",detail:"day_of_year(v=vector(time()) instant-vector)",documentation:"Returns the day of the year for each of the given times in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years."},{insertText:"days_in_month",label:"days_in_month",detail:"days_in_month(v=vector(time()) instant-vector)",documentation:"Returns number of days in the month for each of the given times in UTC. Returned values are from 28 to 31."},{insertText:"delta",label:"delta",detail:"delta(v range-vector)",documentation:"Calculates the difference between the first and last value of each time series element in a range vector `v`, returning an instant vector with the given deltas and equivalent labels. The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers."},{insertText:"deriv",label:"deriv",detail:"deriv(v range-vector)",documentation:"Calculates the per-second derivative of the time series in a range vector `v`, using simple linear regression."},{insertText:"drop_common_labels",label:"drop_common_labels",detail:"drop_common_labels(instant-vector)",documentation:"Drops all labels that have the same name and value across all series in the input vector."},{insertText:"exp",label:"exp",detail:"exp(v instant-vector)",documentation:"Calculates the exponential function for all elements in `v`.\nSpecial cases are:\n* `Exp(+Inf) = +Inf` \n* `Exp(NaN) = NaN`"},{insertText:"floor",label:"floor",detail:"floor(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` down to the nearest integer."},{insertText:"histogram_quantile",label:"histogram_quantile",detail:"histogram_quantile(φ float, b instant-vector)",documentation:"Calculates the φ-quantile (0 ≤ φ ≤ 1) from the buckets `b` of a histogram. The samples in `b` are the counts of observations in each bucket. Each sample must have a label `le` where the label value denotes the inclusive upper bound of the bucket. (Samples without such a label are silently ignored.) The histogram metric type automatically provides time series with the `_bucket` suffix and the appropriate labels."},{insertText:"holt_winters",label:"holt_winters",detail:"holt_winters(v range-vector, sf scalar, tf scalar)",documentation:"Produces a smoothed value for time series based on the range in `v`. The lower the smoothing factor `sf`, the more importance is given to old data. The higher the trend factor `tf`, the more trends in the data is considered. Both `sf` and `tf` must be between 0 and 1."},{insertText:"hour",label:"hour",detail:"hour(v=vector(time()) instant-vector)",documentation:"Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23."},{insertText:"idelta",label:"idelta",detail:"idelta(v range-vector)",documentation:"Calculates the difference between the last two samples in the range vector `v`, returning an instant vector with the given deltas and equivalent labels."},{insertText:"increase",label:"increase",detail:"increase(v range-vector)",documentation:"Calculates the increase in the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. The increase is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if a counter increases only by integer increments."},{insertText:"irate",label:"irate",detail:"irate(v range-vector)",documentation:"Calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for."},{insertText:"label_join",label:"label_join",detail:"label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...)",documentation:"For each timeseries in `v`, joins all the values of all the `src_labels` using `separator` and returns the timeseries with the label `dst_label` containing the joined value. There can be any number of `src_labels` in this function."},{insertText:"label_replace",label:"label_replace",detail:"label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)",documentation:"For each timeseries in `v`, `label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)` matches the regular expression `regex` against the label `src_label`. If it matches, then the timeseries is returned with the label `dst_label` replaced by the expansion of `replacement`. `$1` is replaced with the first matching subgroup, `$2` with the second etc. If the regular expression doesn't match then the timeseries is returned unchanged."},{insertText:"ln",label:"ln",detail:"ln(v instant-vector)",documentation:"Calculates the natural logarithm for all elements in `v`.\nSpecial cases are:\n * `ln(+Inf) = +Inf`\n * `ln(0) = -Inf`\n * `ln(x < 0) = NaN`\n * `ln(NaN) = NaN`"},{insertText:"log2",label:"log2",detail:"log2(v instant-vector)",documentation:"Calculates the binary logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"log10",label:"log10",detail:"log10(v instant-vector)",documentation:"Calculates the decimal logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"minute",label:"minute",detail:"minute(v=vector(time()) instant-vector)",documentation:"Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59."},{insertText:"month",label:"month",detail:"month(v=vector(time()) instant-vector)",documentation:"Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc."},{insertText:"pi",label:"pi",detail:"pi()",documentation:"Returns pi"},{insertText:"predict_linear",label:"predict_linear",detail:"predict_linear(v range-vector, t scalar)",documentation:"Predicts the value of time series `t` seconds from now, based on the range vector `v`, using simple linear regression."},{insertText:"rad",label:"rad",detail:"rad(v instant-vector)",documentation:"Converts degrees to radians for all elements in v"},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the per-second average rate of increase of the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. Also, the calculation extrapolates to the ends of the time range, allowing for missed scrapes or imperfect alignment of scrape cycles with the range's time period."},{insertText:"resets",label:"resets",detail:"resets(v range-vector)",documentation:"For each input time series, `resets(v range-vector)` returns the number of counter resets within the provided time range as an instant vector. Any decrease in the value between two consecutive samples is interpreted as a counter reset."},{insertText:"round",label:"round",detail:"round(v instant-vector, to_nearest=1 scalar)",documentation:"Rounds the sample values of all elements in `v` to the nearest integer. Ties are resolved by rounding up. The optional `to_nearest` argument allows specifying the nearest multiple to which the sample values should be rounded. This multiple may also be a fraction."},{insertText:"scalar",label:"scalar",detail:"scalar(v instant-vector)",documentation:"Given a single-element input vector, `scalar(v instant-vector)` returns the sample value of that single element as a scalar. If the input vector does not have exactly one element, `scalar` will return `NaN`."},{insertText:"sgn",label:"sgn",detail:"sgn(v instant-vector)",documentation:"Returns a vector with all sample values converted to their sign, defined as this: 1 if v is positive, -1 if v is negative and 0 if v is equal to zero."},{insertText:"sort",label:"sort",detail:"sort(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in ascending order."},{insertText:"sort_desc",label:"sort_desc",detail:"sort_desc(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in descending order."},{insertText:"sqrt",label:"sqrt",detail:"sqrt(v instant-vector)",documentation:"Calculates the square root of all elements in `v`."},{insertText:"time",label:"time",detail:"time()",documentation:"Returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated."},{insertText:"timestamp",label:"timestamp",detail:"timestamp(v instant-vector)",documentation:"Returns the timestamp of each of the samples of the given vector as the number of seconds since January 1, 1970 UTC."},{insertText:"vector",label:"vector",detail:"vector(s scalar)",documentation:"Returns the scalar `s` as a vector with no labels."},{insertText:"year",label:"year",detail:"year(v=vector(time()) instant-vector)",documentation:"Returns the year for each of the given times in UTC."},{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average value of all points in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum value of all points in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum value of all points in the specified interval."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."},{insertText:"last_over_time",label:"last_over_time",detail:"last_over_time(range-vector)",documentation:"The most recent point value in specified interval."},{insertText:"present_over_time",label:"present_over_time",detail:"present_over_time(range-vector)",documentation:"The value 1 for any series in the specified interval."},{insertText:"histogram_avg",label:"histogram_avg",detail:"histogram_avg(v instant-vector)",documentation:"Returns the arithmetic average of observed values stored in a native histogram. Samples that are not native histograms are ignored and do not show up in the returned vector."},{insertText:"histogram_count",label:"histogram_count",detail:"histogram_count(v instant-vector)",documentation:"Returns the count of observations stored in a native histogram."},{insertText:"histogram_sum",label:"histogram_sum",detail:"histogram_sum(v instant-vector)",documentation:"Returns the sum of observations stored in a native histogram."},{insertText:"histogram_fraction",label:"histogram_fraction",detail:"histogram_fraction(lower scalar, upper scalar, v instant-vector)",documentation:"Returns the estimated fraction of observations between the provided lower and upper values."},{insertText:"histogram_stddev",label:"histogram_stddev",detail:"histogram_stddev(v instant-vector)",documentation:"Returns the estimated standard deviation of observations in a native histogram, based on the geometric mean of the buckets where the observations lie."},{insertText:"histogram_stdvar",label:"histogram_stdvar",detail:"histogram_stdvar(v instant-vector)",documentation:"Returns the estimated standard variance of observations in a native histogram."}]),P=function(e){function t(t){return e.call(this,"should never happen")||this}var n,r;return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,_(n,r),t}(N(Error));function q(e,t,n){return t&&0!==t.length?e+"{"+[].concat(t).filter((function(e){return e.name!==n&&""!==e.value})).map((function(e){return""+e.name+e.op+'"'+e.value.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'})).join(",")+"}":e}var U=400,D=422,F=503,B=function(){function e(e){var t,n=this;this.lookbackInterval=432e5,this.variablesNames=[],this.httpMethod="GET",this.apiPrefix="/api/v1",this.enableRequests=!0,this.customRequest=function(e,t){return fetch(e,t)},this.fetchSeries=function(){var e=d(p().m((function e(t,r){var i,a,o,s,l;return p().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return i=new Date,a=new Date(i.getTime()-n.lookbackInterval),o=n.apiPrefix+"/series",s={start:a.toISOString(),end:i.toISOString()},t&&(s["match[]"]=t),"none"!==r&&(s=h({},s,{limit:null!=r?r:"40000"})),l=n.buildRequest(o,new URLSearchParams(s)),e.n=2,n.request(l.uri,{method:n.httpMethod,body:l.body}).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.fetchLabels=function(){var e=d(p().m((function e(t){var r,i,a,o,s;return p().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return r=new Date,i=new Date(r.getTime()-n.lookbackInterval),a=n.apiPrefix+"/labels",o={start:i.toISOString(),end:r.toISOString()},t&&(o["match[]"]=t),s=n.buildRequest(a,new URLSearchParams(o)),e.n=2,n.request(s.uri,{method:n.httpMethod,body:s.body}).then((function(e){return n.labelKeys=e,e})).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.fetchLabelValues=function(){var e=d(p().m((function e(t,r){var i,a,o,s,l;return p().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return i=new Date,a=new Date(i.getTime()-n.lookbackInterval),o=n.apiPrefix+"/label/"+t+"/values",s={start:a.toISOString(),end:i.toISOString()},r&&(s["match[]"]=r),l=n.buildRequest(o,new URLSearchParams(s)),e.n=2,n.request(l.uri,{method:n.httpMethod,body:l.body}).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.start=d(p().m((function e(){var t;return p().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,n.fetchLabelValues("__name__",q("",[],"__name__"));case 1:if(t=e.v){e.n=2;break}t=[];case 2:return n.metrics=t,e.a(2,Promise.all([n.loadMetricsMetadata()]))}}),e)}))),this.inputInRange="",this.metricNamesSuggestionLimit=1e3,this.suggestionsIncomplete=!1,this.url=e.url?e.url:"",this.errorHandler=e.httpErrorHandler,e.lookbackInterval&&(this.lookbackInterval=e.lookbackInterval),e.variablesNames&&(this.variablesNames=[].concat(e.variablesNames)),this.durationVariablesCompletion=null==(t=e.durationVariablesCompletion)||t,e.request&&(this.customRequest=e.request),e.httpMethod&&(this.httpMethod=e.httpMethod),e.apiPrefix&&(this.apiPrefix=e.apiPrefix),void 0!==e.enableRequests&&(this.enableRequests=!!e.enableRequests),this.metrics=[],this.labelKeys=[]}var t,n,r=e.prototype;return r.getVariablesNames=function(){return this.variablesNames},r.setVariablesNames=function(e){this.variablesNames=[].concat(e)},r.buildRequest=function(e,t){var n=e,r=t;return"GET"===this.httpMethod&&(n=n+"?"+t,r=null),{uri:n,body:r}},r.request=function(e,t){var n=this;return this.customRequest(this.url+e,t).then((function(e){if(!e.ok&&![U,D,F].includes(e.status))throw new Error(e.statusText);return e})).then((function(e){return e.json()})).then((function(e){if("error"===e.status){var t=new Error(void 0!==e.error?e.error:'missing "error" field in response JSON');throw n.errorHandler&&n.errorHandler(t),t}if(void 0===e.data){var r=new Error(void 0!==e.error?e.error:'missing "data" field in response JSON');throw n.errorHandler&&n.errorHandler(r),r}return e.data})).catch((function(e){throw n.errorHandler&&n.errorHandler(e),e}))},r.getAllMetricNames=function(){return this.metrics},r.loadMetricsMetadata=function(){var e=d(p().m((function e(){var t;return p().w((function(e){for(;;)switch(e.n){case 0:if(this.enableRequests){e.n=1;break}return this.metricsMetadata={},e.a(2,this.metricsMetadata);case 1:return t=this.buildRequest(this.apiPrefix+"/metadata",new URLSearchParams({})),e.n=2,this.request(t.uri,{method:this.httpMethod,body:t.body}).catch((function(){return{}}));case 2:return this.metricsMetadata=e.v,e.a(2,this.metricsMetadata||{})}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.metricNamesToMetrics=function(e){var t=this;return e.map((function(e){var n,r,i,a=null==(n=t.metricsMetadata)?void 0:n[e];return{name:e,help:null!=(r=null==a?void 0:a.help)?r:"",type:null!=(i=null==a?void 0:a.type)?i:""}}))},r.setInputInRange=function(e){this.inputInRange=e},r.enableAutocompleteSuggestionsUpdate=function(){this.suggestionsIncomplete=!0,dispatchEvent(new CustomEvent("codeModeSuggestionsIncomplete",{detail:{limit:this.metricNamesSuggestionLimit}}))},t=e,(n=[{key:"monacoSettings",get:function(){return{enableAutocompleteSuggestionsUpdate:this.enableAutocompleteSuggestionsUpdate.bind(this),inputInRange:this.inputInRange,setInputInRange:this.setInputInRange.bind(this),suggestionsIncomplete:this.suggestionsIncomplete}}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,T(r.key),r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t}();function W(e,t){switch(t){case"parent":return e.parent;case"firstChild":return e.firstChild;case"lastChild":return e.lastChild;case"nextSibling":return e.nextSibling;default:throw new P(t)}}function V(e,t){for(var n,r=e,i=f(t);!(n=i()).done;){var a=n.value,o=a[1];if(null===(r=W(r,a[0])))return null;if(r.type.id!==o)return null}return r}function H(e,t){return t.slice(e.from,e.to)}function K(e,t){return e.every((function(e,n){return e===t[n]}))}var z=[{path:[o.LabelName,o.UnquotedLabelMatcher],fun:X},{path:[o.UnquotedLabelMatcher,o.LabelMatchers],fun:X},{path:[o.LabelMatchers,o.VectorSelector],fun:J},{path:[o.LabelMatchers,o.VectorSelector,o.PromQL],fun:J},{path:[o.PromQL],fun:$},{path:[o.VectorSelector,o.PromQL],fun:$},{path:[o.Identifier,o.VectorSelector],fun:$},{path:[o.Identifier,o.VectorSelector,o.PromQL],fun:$},{path:[o.FunctionCallBody],fun:function(){return{type:"IN_FUNCTION"}}},{path:[o.StringLiteral,o.UnquotedLabelMatcher],fun:Y},{path:[0,o.BinaryExpr,o.PromQL],fun:$},{path:[0,o.UnquotedLabelMatcher],fun:function(e,t,n){var r=V(e,[["parent",o.UnquotedLabelMatcher]]);if(null===r)return null;var i=V(r,[["firstChild",o.LabelName]]);return null!==i&&null!==V(i,[["nextSibling",o.MatchOp]])?Y(e,t):X(r,t,n)}},{path:[0,o.NumberDurationLiteralInDurationContext,o.MatrixSelector],fun:function(){return{type:"IN_DURATION"}}},{path:[o.GroupingLabels],fun:function(e,t,n){var r=V(e,[["parent",o.AggregateModifier],["parent",o.AggregateExpr]]);if(null===r)return null;var i=r.getChild(o.FunctionCallBody);if(null===i)return null;var a=function e(t,n){if(t.type.id===n)return t;for(var r,i=f(Q(t));!(r=i()).done;){var a=e(r.value,n);if(null!==a)return a}return null}(i,o.Identifier);return null===a?null:{type:"IN_GROUPING",metricName:H(a,t),otherLabels:[]}}},{path:[o.WithExpr],fun:Z},{path:[o.WithExpr,o.PromQL],fun:Z},{path:[o.WithAssignment,o.WithExpr],fun:Z}],j=new Map([[o.EqlSingle,"="],[o.EqlRegex,"=~"],[o.Neq,"!="],[o.NeqRegex,"!~"]]);function G(e,t){return e.type.id!==o.LabelMatchers?[]:e.getChildren(o.UnquotedLabelMatcher).map((function(e){return function(e,t){if(e.type.id!==o.UnquotedLabelMatcher)return null;var n=V(e,[["firstChild",o.LabelName]]);if(null===n)return null;var r=V(n,[["nextSibling",o.MatchOp]]);if(null===r)return null;var i=function(e){var t,n=e.firstChild;return null===n?null:null!=(t=j.get(n.type.id))?t:null}(r);if(null===i)return null;var a=V(e,[["lastChild",o.StringLiteral]]);return null===a?null:{name:H(n,t),value:function(e){var t=e.slice(1,e.length-1);if(e.startsWith('"')&&e.endsWith('"'))return t.replace(/\\"/,'"');if(e.startsWith("'")&&e.endsWith("'"))return t.replace(/\\'/,"'");if(e.startsWith("`")&&e.endsWith("`"))return t;throw new Error("FIXME: invalid string literal")}(H(a,t)),op:i}}(e,t)})).filter(ee)}function Q(e){for(var t=e.firstChild,n=[];null!==t;)n.push(t),t=t.nextSibling;return n}function Y(e,t,n){var r=!e.type.isError,i=r?e.from+1:e.from,a=V(e,[["parent",o.UnquotedLabelMatcher]]);if(null===a)return null;var s=V(a,[["firstChild",o.LabelName]]);if(null===s)return null;var l=H(s,t),u=V(a,[["parent",o.LabelMatchers]]);if(null===u)return null;var c=G(u,t).filter((function(e){return e.name!==l})),d=V(u,[["parent",o.VectorSelector],["firstChild",o.Identifier]]);return null===d?{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",labelName:l,betweenQuotes:r,otherLabels:c,valueStartPos:i}:{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",metricName:H(d,t),labelName:l,betweenQuotes:r,otherLabels:c,valueStartPos:i}}function $(){return{type:"AT_ROOT"}}function Z(e,t,n){for(var r=e.type.id===o.WithExpr?e:e.parent;r&&r.type.id!==o.WithExpr;)r=r.parent;if(!r)return null;var i=Q(r).find((function(e){return")"===H(e,t)}));return i&&n>i.to?{type:"IN_WITH_BODY"}:null}function X(e,t,n){var r=e;if(e.type.isError){var i=e.parent;if(null===i||i.type.id!==o.UnquotedLabelMatcher)return null;r=i}else e.type.id===o.LabelName&&(r=V(e,[["parent",o.UnquotedLabelMatcher]]));if(null===r||r.type.id!==o.UnquotedLabelMatcher)return null;var a=V(r,[["firstChild",o.LabelName]]);if(null===a)return null;if(n>a.to)return null;var s=V(r,[["parent",o.LabelMatchers]]);if(null===s)return null;var l=H(a,t),u=G(s,t).filter((function(e){return e.name!==l})),c=null!==V(a,[["nextSibling",o.MatchOp]]),d=V(s,[["parent",o.VectorSelector],["firstChild",o.Identifier]]);return null===d?{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:u,hasOperator:c}:{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",metricName:H(d,t),otherLabels:u,hasOperator:c}}function J(e,t,n){var r=V(e,[["firstChild",o.UnquotedLabelMatcher]]);if(null!==r&&!t.slice(r.to,n).includes(","))return null;var i=V(e,[["parent",o.VectorSelector],["firstChild",o.Identifier]]),a=G(e,t);return null===i?{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:a,hasOperator:!1}:{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",metricName:H(i,t),otherLabels:a,hasOperator:!1}}function ee(e){return null!=e}function te(e){var t=e.getAllMetricNames();return e.metricNamesToMetrics(t).map((function(e){return{type:"METRIC_NAME",label:e.name,insertText:e.name,detail:e.name+" : "+e.type,documentation:e.help}}))}var ne=M.map((function(e){var t;return{type:"FUNCTION",label:e.label,insertText:null!=(t=e.insertText)?t:"",detail:e.detail,documentation:e.documentation}}));function re(e){return ie.apply(this,arguments)}function ie(){return(ie=d(p().m((function e(t){var n;return p().w((function(e){for(;;)switch(e.n){case 0:return n=te(t),e.a(2,[ae].concat(ne,n))}}),e)})))).apply(this,arguments)}var ae={type:"FUNCTION",label:"with",insertText:"with (",detail:"with (cte_name = expr, ...) expr",documentation:"Define Common Table Expressions (CTEs) for use in the query. MetricsQL extension."},oe=["1m","5m","10m","30m","1h","1d"].map((function(e){return{type:"DURATION",label:e,insertText:e}})),se=["$__interval","$__range","$__rate_interval"].map((function(e){return{type:"DURATION",label:e,insertText:e}}));function le(e,t,n){return ue.apply(this,arguments)}function ue(){return(ue=d(p().m((function e(t,n,r){var i,a,o,s,l,u,c,d,m;return p().w((function(e){for(;;)switch(e.n){case 0:if(void 0!==t&&""!==t){e.n=2;break}return i=q("",n),e.n=1,r.fetchLabels(i);case 1:return e.a(2,e.v);case 2:return a=q(t,n),e.n=3,r.fetchSeries(a);case 3:o=e.v,s=new Set,l=f(o);case 4:if((u=l()).done){e.n=9;break}c=0,d=Object.entries(u.value);case 5:if(!(c<d.length)){e.n=8;break}if("__name__"!==(m=d[c][0])){e.n=6;break}return e.a(3,7);case 6:s.add(m);case 7:c++,e.n=5;break;case 8:e.n=4;break;case 9:return e.a(2,Array.from(s));case 10:return e.a(2)}}),e)})))).apply(this,arguments)}function ce(e,t,n,r,i){return de.apply(this,arguments)}function de(){return(de=d(p().m((function e(t,n,r,i,a){return p().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,le(t,i,a);case 1:return e.a(2,e.v.map((function(e){return{type:"LABEL_NAME",label:e,insertText:""+e+n,triggerOnInsert:r}})))}}),e)})))).apply(this,arguments)}function me(){return(me=d(p().m((function e(t,n,r,i){return p().w((function(e){for(;;)switch(e.n){case 0:return e.a(2,ce(t,n?"":"=",!0,r,i))}}),e)})))).apply(this,arguments)}function fe(){return(fe=d(p().m((function e(t,n,r){return p().w((function(e){for(;;)switch(e.n){case 0:return e.a(2,ce(t,"",!1,n,r))}}),e)})))).apply(this,arguments)}function he(e,t,n,r){return ge.apply(this,arguments)}function ge(){return(ge=d(p().m((function e(t,n,r,i){var a,o,s,l,u,c,d,m,h,g,v,b;return p().w((function(e){for(;;)switch(e.n){case 0:if(void 0!==t&&""!==t){e.n=2;break}return a=q("",r),e.n=1,i.fetchLabelValues(n,a);case 1:return e.a(2,e.v);case 2:return o=q(t,r,n),e.n=3,i.fetchSeries(o);case 3:s=e.v,l=new Set,u=f(s);case 4:if((c=u()).done){e.n=9;break}d=0,m=Object.entries(c.value);case 5:if(!(d<m.length)){e.n=8;break}if(v=(h=m[d])[1],"__name__"!==(g=h[0])){e.n=6;break}return e.a(3,7);case 6:g===n&&v&&l.add(v);case 7:d++,e.n=5;break;case 8:e.n=4;break;case 9:return b=i.getVariablesNames(),e.a(2,b.concat(Array.from(l)));case 10:return e.a(2)}}),e)})))).apply(this,arguments)}function ve(){return(ve=d(p().m((function e(t,n,r,i,a){return p().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,he(t,n,i,a);case 1:return e.a(2,e.v.map((function(e){return{type:"LABEL_VALUE",label:e,insertText:r?e:'"'+e+'"'}})))}}),e)})))).apply(this,arguments)}function pe(e,t){switch(e){case"DURATION":return t.languages.CompletionItemKind.Unit;case"FUNCTION":return t.languages.CompletionItemKind.Variable;case"HISTORY":return t.languages.CompletionItemKind.Snippet;case"LABEL_NAME":return t.languages.CompletionItemKind.Enum;case"LABEL_VALUE":return t.languages.CompletionItemKind.EnumMember;case"METRIC_NAME":return t.languages.CompletionItemKind.Constructor;default:throw new P(e)}}function be(e,t){var n=[];return t.parse(e).iterate({enter:function(t){if(0===t.type.id){var r=t.node;n.push({node:r,text:e.substring(r.from,r.to)})}}}),n}function _e(e){return null!==e}var ye,Te,Ne,xe,Ee=["error"],we=a.promLanguageDefinition.id,Ce={small:{className:"ant-input-sm",top:1,bottom:1},middle:{className:"ant-input-md",top:1,bottom:1},large:{className:"ant-input-lg",top:3,bottom:2}},Le={light:"n9e-light",dark:"n9e-dark"},ke=l.css(ye||(ye=y(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),Se=l.css(Te||(Te=y(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important; /* 完全透明 */\n }\n"]))),Re={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"#"},brackets:[["{","}"],["[","]"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{offSide:!0}},Ie={tokenPostfix:".yaml",brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.square",open:"[",close:"]"}],keywords:["true","false","null","True","False","Null","TRUE","FALSE","NULL","yes","no","Yes","No","YES","NO","on","off","On","Off","ON","OFF"],numberInteger:/(?:0|[+-]?[0-9]+)/,numberFloat:/(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,numberOctal:/0o[0-7]+/,numberHex:/0x[0-9a-fA-F]+/,numberInfinity:/[+-]?\.(?:inf|Inf|INF)/,numberNaN:/\.(?:nan|Nan|NAN)/,numberDate:/\d{4}-\d{2}-\d{2}(?:[Tt ]\d{1,2}:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d{1,2}(?::\d{2})?))?)?/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,tokenizer:{root:[{include:"@whitespace"},{include:"@comment"},[/^---/,"meta.document"],[/^\.{3}/,"meta.document"],[/^(\s*)([^:\s]+)(\s*)(:)/,["white","key","white","delimiter"]],[/(\s*)([^:\s]+)(\s*)(:)/,["white","key","white","delimiter"]],[/\{/,"@brackets","@flowMap"],[/\[/,"@brackets","@flowSequence"],[/[|>][-+]?(\d+)?/,"string.block","@blockScalar"],[/@numberInfinity/,"number.infinity"],[/@numberNaN/,"number.nan"],[/@numberDate/,"number.date"],[/@numberHex/,"number.hex"],[/@numberOctal/,"number.octal"],[/@numberFloat/,"number.float"],[/@numberInteger/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/&\w+/,"tag.anchor"],[/\*\w+/,"tag.alias"],[/![\w\-\/]+/,"tag"],[/[^\s\[\{\,]+/,{cases:{"@keywords":"keyword","@default":"string.unquoted"}}],[/^(\s*)(-\s)/,["white","delimiter"]],[/(\s*)(-\s)/,["white","delimiter"]]],whitespace:[[/[ \t\r\n]+/,"white"]],comment:[[/#.*$/,"comment"]],doubleQuotedString:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],singleQuotedString:[[/[^\\']+/,"string"],[/''/,"string.escape"],[/'/,"string","@pop"]],blockScalar:[[/^(\s*).+$/,"string.block"],[/^(?!\s)/,"","@pop"]],flowMap:[{include:"@whitespace"},{include:"@comment"},[/\}/,"@brackets","@pop"],[/,/,"delimiter"],[/:/,"delimiter"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/[^\s\,\}\:]+/,"string.unquoted"]],flowSequence:[{include:"@whitespace"},{include:"@comment"},[/\]/,"@brackets","@pop"],[/,/,"delimiter"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/[^\s\,\]]+/,"string.unquoted"]]}};function Oe(e,t){switch(e){case"KEYWORD":return t.languages.CompletionItemKind.Keyword;case"VALUE":return t.languages.CompletionItemKind.Value;case"KEY":return t.languages.CompletionItemKind.Property;case"BOOLEAN":return t.languages.CompletionItemKind.Constant;case"NUMBER":return t.languages.CompletionItemKind.Value;case"STRING":default:return t.languages.CompletionItemKind.Text}}function Ae(e){return!e.trim()||(e.length-e.trimLeft().length)%2==0}var Me,Pe,qe={small:{className:"ant-input-sm",top:1,bottom:1},middle:{className:"ant-input-md",top:1,bottom:1},large:{className:"ant-input-lg",top:3,bottom:2}},Ue={light:"yaml-light",dark:"yaml-dark"},De=l.css(Ne||(Ne=y(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),Fe=l.css(xe||(xe=y(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"]))),Be={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],folding:{offSide:!1}},We={defaultToken:"",tokenPostfix:".sql",ignoreCase:!0,brackets:[{open:"(",close:")",token:"delimiter.parenthesis"},{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"}],keywords:["SELECT","FROM","WHERE","AND","OR","NOT","JOIN","INNER","LEFT","RIGHT","FULL","OUTER","ON","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","PRIMARY","KEY","FOREIGN","CONSTRAINT","UNIQUE","INDEX","VIEW","DATABASE","SCHEMA","AS","DISTINCT","CASE","WHEN","THEN","ELSE","END","CAST","BETWEEN","IN","LIKE","IS","NULL","TRUE","FALSE","WITH","UNION","EXCEPT","INTERSECT"],operators:["=",">","<","!","%","&","|","^","~","?",":","+","-","*","/"],builtinFunctions:["COUNT","SUM","AVG","MIN","MAX","UPPER","LOWER","LENGTH","SUBSTRING","TRIM","ROUND","ABS","COALESCE","NULLIF","IFNULL","CONCAT","DATE","NOW","YEAR","MONTH","DAY","HOUR","MINUTE","SECOND"],escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\|;,.?*+^$\\]/,regexpattern:/(\{[0-9]+\})|(\{[0-9]*,[0-9]*\})|(\?(?:\?)?|[*+]|\^|\$|\|\\)/,tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@pseudo-columns"},[/[;,.]/,"delimiter"],[/[{}()\[\]]/,"@brackets"],{include:"@builtinVariables"},{include:"@numbers"},{include:"@strings"},[/[a-zA-Z_#][a-zA-Z0-9_$#@]*(?=\s*\()/,{cases:{"@builtinFunctions":"keyword.function","@default":"identifier.function"}}],[/[a-zA-Z_#][a-zA-Z0-9_$#@]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],"pseudo-columns":[[/[$][A-Za-z_][A-Za-z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}],[/@[A-Za-z_][A-Za-z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}]],builtinVariables:[[/@@?[a-zA-Z_][a-zA-Z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}]],numbers:[[/0[xX][0-9a-fA-F]*[0-9a-fA-F]/,"number.hex"],[/0[0-7]+(?!\d)/,"number.octal"],[/(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?/,"number"]],strings:[[/'/,{token:"string",next:"@string"}],[/"/,{token:"string.double",next:"@string_double"}],[/`/,{token:"string.backtick",next:"@string_backtick"}]],string:[[/[^'\\]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,{token:"string",next:"@pop"}]],string_double:[[/[^"\\]+/,"string.double"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.double",next:"@pop"}]],string_backtick:[[/[^`\\]+/,"string.backtick"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,{token:"string.backtick",next:"@pop"}]]}},Ve=["SELECT","FROM","WHERE","AND","OR","NOT","JOIN","INNER","LEFT","RIGHT","FULL","OUTER","ON","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","PRIMARY","KEY","FOREIGN","CONSTRAINT","UNIQUE","INDEX","VIEW","DATABASE","SCHEMA","AS","DISTINCT","CASE","WHEN","THEN","ELSE","END","CAST","BETWEEN","IN","LIKE","IS","NULL","TRUE","FALSE","WITH","UNION","EXCEPT","INTERSECT","ASC","DESC","ALL","ANY","EXISTS","CROSS"],He=[{name:"COUNT",signature:"COUNT(expression)",description:"Returns the number of rows"},{name:"SUM",signature:"SUM(expression)",description:"Returns the sum of values"},{name:"AVG",signature:"AVG(expression)",description:"Returns the average value"},{name:"MIN",signature:"MIN(expression)",description:"Returns the minimum value"},{name:"MAX",signature:"MAX(expression)",description:"Returns the maximum value"},{name:"UPPER",signature:"UPPER(string)",description:"Converts string to uppercase"},{name:"LOWER",signature:"LOWER(string)",description:"Converts string to lowercase"},{name:"LENGTH",signature:"LENGTH(string)",description:"Returns the length of string"},{name:"SUBSTRING",signature:"SUBSTRING(string, start, length)",description:"Extracts substring"},{name:"TRIM",signature:"TRIM(string)",description:"Removes leading and trailing spaces"},{name:"ROUND",signature:"ROUND(number, decimals)",description:"Rounds a number"},{name:"ABS",signature:"ABS(number)",description:"Returns absolute value"},{name:"COALESCE",signature:"COALESCE(value1, value2, ...)",description:"Returns first non-null value"},{name:"NULLIF",signature:"NULLIF(value1, value2)",description:"Returns null if two values are equal"},{name:"IFNULL",signature:"IFNULL(value, default)",description:"Returns alternative if null"},{name:"CONCAT",signature:"CONCAT(string1, string2, ...)",description:"Concatenates strings"},{name:"DATE",signature:"DATE(date)",description:"Extracts date part"},{name:"NOW",signature:"NOW()",description:"Returns current date and time"}],Ke={small:{className:"ant-input-sm",top:1,bottom:1,minHeight:24},middle:{className:"ant-input-md",top:1,bottom:1,minHeight:32},large:{className:"ant-input-lg",top:3,bottom:2,minHeight:40}},ze={light:"sql-light",dark:"sql-dark"},je=l.css(Me||(Me=y(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),Ge=l.css(Pe||(Pe=y(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));exports.PromQLMonacoEditor=function(e){var u=s.v4(),c=e.className,d=e.size,m=void 0===d?"middle":d,g=e.theme,v=void 0===g?"light":g,p=e.value,b=e.placeholder,_=e.interpolateString,y=e.enableAutocomplete,T=void 0===y||y,N=e.enableRequests,E=void 0===N||N,w=e.readOnly,C=void 0!==w&&w,L=e.disabled,k=void 0!==L&&L,S=e.onChange,R=e.onEnter,I=e.onBlur,O=e.editorDidMount,M=t.useRef(null),q=t.useRef(null),U=t.useRef(null),D=t.useRef(null),F=t.useRef(""),W=t.useRef(0),V=function(e){return{placeholder:l.css({"::after":{content:"'"+e+"'",opacity:.6}})}}(b);return t.useEffect((function(){return i.languages.register({id:we,aliases:a.promLanguageDefinition.aliases,extensions:a.promLanguageDefinition.extensions,mimetypes:a.promLanguageDefinition.mimetypes}),i.languages.setMonarchTokensProvider(we,A),i.languages.setLanguageConfiguration(we,x),function(){null==M.current||M.current(),U.current=null}}),[]),t.useEffect((function(){var t=D.current;if(t){if(M.current&&(M.current(),M.current=null),U.current=null,T){var n=new B({url:e.url,lookbackInterval:e.lookbackInterval,variablesNames:e.variablesNames,durationVariablesCompletion:e.durationVariablesCompletion,request:e.request,httpMethod:e.httpMethod,apiPrefix:e.apiPrefix,httpErrorHandler:e.httpErrorHandler,enableRequests:E});U.current=n,n.start();var r=function(e,t){return{triggerCharacters:["{",",","[","(","=","~"," ",'"'],provideCompletionItems:function(n,r){var i=n.getWordAtPosition(r),a=null!=i?e.Range.lift({startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:i.startColumn,endColumn:i.endColumn}):e.Range.fromPositions(r),s={column:r.column,lineNumber:r.lineNumber};if(t.monacoSettings.setInputInRange(n.getValueInRange(a)),window.getSelection){var l,u=null==(l=window.getSelection())?void 0:l.toString();u&&u.length>0&&(s.column=s.column-u.length)}var c=n.getOffsetAt(s),d=function(e,t){if(""===e)return{type:"EMPTY"};if(function(e,t){var n=e.match(/^with\s*\(/i);if(!n)return!1;var r=function(e,t){for(var n=0,r=t;r<e.length;r++)if("("===e[r]&&n++,")"===e[r]&&0==--n)return r;return-1}(e,n[0].length-1);return-1!==r&&t>r}(e,t))return{type:"IN_WITH_BODY"};for(var n=o.parser.parse(e),r=function(e,t){for(var n=e.cursorAt(t);;){if(n.from===t&&n.to===t){var r=n.node;if(r.type.isError)return r}if(!n.next())break}return null}(n,t),i=null!=r?r.cursor():n.cursorAt(t),a=i.node,s=[i.type.id];i.parent();)s.push(i.type.id);for(var l,u=f(z);!(l=u()).done;){var c=l.value;if(K(c.path,s))return c.fun(a,e,t)}return null}(n.getValue(),c);return(null!=d?function(e,t){switch(e.type){case"IN_DURATION":return Promise.resolve(t.durationVariablesCompletion?se.concat(oe):oe);case"IN_FUNCTION":return re(t);case"IN_WITH_BODY":case"AT_ROOT":return re(t);case"EMPTY":var n=te(t);return Promise.resolve([].concat([],[ae],ne,n));case"IN_LABEL_SELECTOR_NO_LABEL_NAME":return function(e,t,n,r){return me.apply(this,arguments)}(e.metricName,e.hasOperator,e.otherLabels,t);case"IN_GROUPING":return function(e,t,n){return fe.apply(this,arguments)}(e.metricName,e.otherLabels,t);case"IN_LABEL_SELECTOR_WITH_LABEL_NAME":return function(e,t,n,r,i){return ve.apply(this,arguments)}(e.metricName,e.labelName,e.betweenQuotes,e.otherLabels,t);default:throw new P(e)}}(d,t):Promise.resolve([])).then((function(i){var o=i.length.toString().length,s=a;if(d&&"IN_LABEL_SELECTOR_WITH_LABEL_NAME"===d.type&&d.betweenQuotes){var l=n.getPositionAt(d.valueStartPos);s=e.Range.lift({startLineNumber:l.lineNumber,endLineNumber:r.lineNumber,startColumn:l.column,endColumn:r.column})}return{suggestions:i.map((function(t,n){return{kind:pe(t.type,e),label:t.label,insertText:t.insertText,detail:t.detail,documentation:t.documentation,sortText:n.toString().padStart(o,"0"),range:s,command:t.triggerOnInsert?{id:"editor.action.triggerSuggest",title:""}:void 0}})),incomplete:t.monacoSettings.suggestionsIncomplete}}))}}}(i,n),a=h({},r,{provideCompletionItems:function(e,n,i,a){var o;return(null==(o=t.getModel())?void 0:o.id)!==e.id?{suggestions:[]}:r.provideCompletionItems(e,n,i,a)}}),s=i.languages.registerCompletionItemProvider(we,a);M.current=s.dispose}var l=t.getModel();if(l&&l.deltaDecorations(l.getAllDecorations().map((function(e){return e.id})),[]),b){var u=[{range:new i.Range(1,1,1,1),options:{className:V.placeholder,isWholeLine:!0}}],c=[],d=function(){var e=t.getModel();if(e){var n=0===e.getValueLength()?u:[];c=e.deltaDecorations(c,n)}};d(),t.onDidChangeModelContent(d)}}}),[T,e.url,e.lookbackInterval,JSON.stringify(e.variablesNames),e.durationVariablesCompletion,e.httpMethod,e.apiPrefix,b,E]),n.createElement("div",{className:"ant-input"+(m?" "+Ce[m].className:"")+(k?" ant-input-disabled "+ke:"")+(C?" "+Se:"")+(c?" "+c:"")},n.createElement("div",{ref:q},n.createElement(r,{width:"100%",height:"100%",language:"promql",theme:Le[v],value:p,onChange:S,editorDidMount:function(e){D.current=e,i.editor.defineTheme("n9e-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}}),i.editor.defineTheme("n9e-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}});var t=e.createContextKey("isEditorFocused"+u,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==I||I(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0)}));var n=function(){var t=q.current;if(null!==t){var n=e.getContentHeight();t.style.height=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+u),i.editor.addKeybindingRule({keybinding:i.KeyCode.Enter,command:"-",when:"!suggestWidgetVisible"}),e.addCommand(i.KeyCode.Enter,(function(){null==R||R(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+u),F.current=e.getValue(),W.current=0,e.onDidChangeModelContent((function(){var t=e.getModel();if(t){var n=t.getValue(),r=(function(e,t,n,r){if(!e)return!1;var i=be(t,r);if(!i.length)return!1;var a=i;if(e!==t){var o=be(e,r);a=i.flatMap((function(e){return o.filter((function(t){return e.text===t.text}))||e}))}return a.map((function(t){return function(e,t,n){if(1===t.length){var r=n.node.from===n.node.to,i=r&&n.node.parent?n.node.parent:n.node,a=r?e.substring(i.from,i.to):n.text;return{startLineNumber:1,startColumn:i.from+1,endLineNumber:1,endColumn:i.to+1,error:a}}for(var o=0,s=0;s<t.length;s++){if(!(n.node.from>o+t[s].length))return{startLineNumber:s+1,startColumn:n.node.from-o+1,endLineNumber:s+1,endColumn:n.node.to-o+1,error:n.text};o+=t[s].length+1}return null}(e,n,t)})).filter(_e)}(n,_?_(n):n,t.getLinesContent(),o.parser)||[]).map((function(e){var t=e.error,n=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,Ee);return h({message:(t?'Error parsing "'+t+'"':"Parse error")+". The query appears to be incorrect and could fail to be executed.",severity:i.MarkerSeverity.Error},n)}));if(i.editor.setModelMarkers(t,"owner",r),n.length<F.current.length&&T){var a=Date.now();a-W.current>=1e3&&(W.current=a,setTimeout((function(){e.trigger("keyboard","editor.action.triggerSuggest",{})}),0))}F.current=n}})),null==O||O(e)},options:{readOnly:C,codeLens:!1,contextmenu:!1,fixedOverflowWidgets:!0,folding:!1,fontSize:12,lineDecorationsWidth:0,lineNumbers:"off",minimap:{enabled:!1},overviewRulerBorder:!1,overviewRulerLanes:0,padding:{top:Ce[m].top,bottom:Ce[m].bottom},renderLineHighlight:"none",scrollbar:{vertical:"hidden",verticalScrollbarSize:8,horizontal:"hidden",horizontalScrollbarSize:0,alwaysConsumeMouseWheel:!1},scrollBeyondLastLine:!1,suggest:{showWords:!1,filterGraceful:!1,snippetsPreventQuickSuggestions:!1,shareSuggestSelections:!1},suggestFontSize:12,wordWrap:"on",automaticLayout:!0,occurrencesHighlight:"off"}})))},exports.SqlMonacoEditor=function(e){var a=s.v4(),o=e.className,l=e.maxHeight,u=e.fontSize,c=e.size,d=void 0===c?"middle":c,m=e.theme,f=void 0===m?"light":m,h=e.value,g=void 0===h?"":h,v=e.placeholder,p=e.enableAutocomplete,b=void 0===p||p,_=e.readOnly,y=void 0!==_&&_,T=e.disabled,N=void 0!==T&&T,x=e.onChange,E=e.onEnter,w=e.onBlur,C=e.onFocus,L=e.editorDidMount,k=t.useRef(null),S=t.useRef(null),R=t.useRef(null),I=t.useRef([]);return t.useEffect((function(){if(i.languages.getLanguages().some((function(e){return"sql"===e.id}))||(i.languages.register({id:"sql"}),i.languages.setMonarchTokensProvider("sql",We),i.languages.setLanguageConfiguration("sql",Be)),b){var e=i.languages.registerCompletionItemProvider("sql",{provideCompletionItems:function(e,t,n,r){var a=e.getWordUntilPosition(t),o=new i.Range(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn);return{suggestions:[].concat(Ve.map((function(e){return{label:e,kind:i.languages.CompletionItemKind.Keyword,insertText:e,range:o,sortText:"1"+e}})),He.map((function(e){return{label:e.name,kind:i.languages.CompletionItemKind.Function,insertText:e.name,detail:e.signature,documentation:e.description,range:o,sortText:"2"+e.name}})))}}});I.current.push(e)}return function(){I.current.forEach((function(e){return e.dispose()})),I.current=[]}}),[b]),n.createElement("div",{className:"ant-input"+(d?" "+Ke[d].className:"")+(N?" ant-input-disabled "+je:"")+(y?" "+Ge:"")+(o?" "+o:""),style:{display:"block",resize:"vertical",overflow:"auto",minHeight:Ke[d].minHeight,maxHeight:l}},n.createElement("div",{ref:k,style:{height:"100%"}},n.createElement(r,{width:"100%",height:"100%",language:"sql",theme:ze[f],value:g,onChange:x,editorDidMount:function(e){S.current=e,R.current=e.getModel(),i.editor.defineTheme("sql-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}}),i.editor.defineTheme("sql-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}});var t=e.createContextKey("isEditorFocused"+a,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==w||w(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0),null==C||C(e.getValue())}));var n=function(){var t=k.current;if(null!==t){var n=e.getContentHeight();t.style.minHeight=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+a),i.editor.addKeybindingRule({keybinding:i.KeyCode.Enter,command:"-",when:"!suggestWidgetVisible"}),e.addCommand(i.KeyCode.Enter,(function(){null==E||E(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+a),null==L||L(e)},options:{minimap:{enabled:!1},autoClosingBrackets:"always",autoClosingQuotes:"always",autoIndent:"full",formatOnPaste:!0,formatOnType:!0,readOnly:y||N,scrollBeyondLastLine:!1,smoothScrolling:!0,fontSize:u,tabSize:2,wordWrap:"on",automaticLayout:!0,fixedOverflowWidgets:!0,glyphMargin:!1,lineNumbers:"off",lineNumbersMinChars:0,folding:!1,lineDecorationsWidth:0,overviewRulerBorder:!1,overviewRulerLanes:0,placeholder:v,renderLineHighlight:"none",occurrencesHighlight:"off",scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1}}})))},exports.YamlMonacoEditor=function(e){var a=s.v4(),o=e.size,u=void 0===o?"middle":o,c=e.theme,d=void 0===c?"light":c,m=e.value,g=e.placeholder,v=e.enableAutocomplete,p=void 0===v||v,b=e.readOnly,_=void 0!==b&&b,y=e.disabled,T=void 0!==y&&y,N=e.schemas,x=void 0===N?[]:N,E=e.onChange,w=e.onEnter,C=e.onBlur,L=e.editorDidMount,k=t.useRef(null),S=t.useRef(null),R=t.useRef(null),I=function(e){return{placeholder:l.css({"::after":{content:"'"+e+"'",opacity:.6}})}}(g);return t.useEffect((function(){return i.languages.register({id:"yaml",aliases:["YAML","yaml"],extensions:[".yaml",".yml"],mimetypes:["application/x-yaml","text/x-yaml"]}),i.languages.setMonarchTokensProvider("yaml",Ie),i.languages.setLanguageConfiguration("yaml",Re),function(){null==k.current||k.current()}}),[]),t.useEffect((function(){var e=R.current;if(e){if(k.current&&(k.current(),k.current=null),p){var t=function(e,t){void 0===t&&(t=[]);var n=function(e,t,n){void 0===n&&(n=[]);var i=[];if(!e||!e.properties)return i;if(0===n.length){var a=e.properties[t];return a&&a.enum?r(a):i}for(var o,s=e,l=f(n);!(o=l()).done;){var u=o.value;if(!s.properties||!s.properties[u])return i;"array"===(s=s.properties[u]).type&&s.items&&(s=s.items)}if(s.properties&&s.properties[t]){var c=s.properties[t];if(c.enum)return r(c)}return i},r=function(e){var t=[];return e.enum?(e.enum.forEach((function(n,r){var i=e.description||"Enum value: "+n;e.enumDescriptions&&e.enumDescriptions[r]&&(i=e.enumDescriptions[r]),t.push({label:n,insertText:n,detail:i,documentation:i,type:"VALUE"})})),t):t},i=function(e,t){void 0===t&&(t=[]);for(var n,r=[],i=e,a=f(t);!(n=a()).done;){var o=n.value;if(!i.properties||!i.properties[o])return r;"array"===(i=i.properties[o]).type&&i.items&&(i=i.items)}if(i.properties)for(var s=0,l=Object.entries(i.properties);s<l.length;s++){var u=l[s],c=u[0],d=u[1],m=c+": ",h=!1;"object"===d.type?(m=c+":\n ",h=!0):"array"===d.type?(m=c+":\n - ",h=!0):(d.enum&&d.enum.length>0||"boolean"===d.type||"number"===d.type)&&(h=!0),r.push({label:c,insertText:m,detail:d.description||"Property: "+c,documentation:d.description,type:"KEY",triggerOnInsert:h})}return r},a=function(e,t,n){if(void 0===n&&(n=[]),!e||!e.properties)return null;if(0===n.length){var r=e.properties[t];return r?r.type:null}for(var i,a=e,o=f(n);!(i=o()).done;){var s=i.value;if(!a.properties||!a.properties[s])return null;"array"===(a=a.properties[s]).type&&a.items&&(a=a.items)}return a.properties&&a.properties[t]?a.properties[t].type:null},o=function(e,r){var o=e.getWordAtPosition(r),l=o?o.word:"",u=function(e,t){var n=e.getLineContent(t.lineNumber),r=t.column,i=n.substring(0,r-1),a=n.trim(),o=i.indexOf(":"),s=-1!==o,l=!1,u=null;if(s){var c=i.substring(0,o).trim();c.startsWith("- ")?c=c.substring(2).trim():"-"===c&&(c=""),u=c;var d=i.substring(o+1);l=0===d.length||/^\s+$/.test(d)}var m=a.includes(":")&&!a.endsWith(":")&&a.split(":")[1].trim().length>0;return{isInKeyPosition:!s||a.endsWith(":"),isInValuePosition:l&&!m,isAtEndOfCompletedValue:m,currentKey:u,line:a,beforeCursor:i,afterCursor:n.substring(r-1)}}(e,r),c=s(e,r),d=[];if(u.isAtEndOfCompletedValue)return[];if(u.isInValuePosition&&u.currentKey){var m=function(e,r){void 0===r&&(r=[]);for(var i,a=[],o=f(t);!(i=o()).done;){var s=n(i.value.schema,e,r);a.push.apply(a,s)}return a}(u.currentKey,c);if(m.length>0)d.push.apply(d,m);else{var h=function(e,n){void 0===n&&(n=[]);for(var r,i=f(t);!(r=i()).done;){var o=a(r.value.schema,e,n);if(o)return o}return null}(u.currentKey,c);"boolean"===h?d.push({label:"true",insertText:"true",detail:"Boolean true value",type:"BOOLEAN"},{label:"false",insertText:"false",detail:"Boolean false value",type:"BOOLEAN"}):"number"===h&&d.push({label:"0",insertText:"0",detail:"Number value",type:"NUMBER"})}}else if(u.isInKeyPosition&&!u.isInValuePosition){var g=function(e){void 0===e&&(e=[]);for(var n,r=[],a=new Set,o=f(t);!(n=o()).done;)for(var s,l=f(i(n.value.schema,e));!(s=l()).done;){var u=s.value;a.has(u.label)||(a.add(u.label),r.push(u))}return r}(c);d.push.apply(d,g)}return d.filter((function(e){return!l||e.label.toLowerCase().includes(l.toLowerCase())}))},s=function(e,t){var n=[],r=e.getLinesContent(),i=t.lineNumber-1;if(i>=r.length)return n;for(var a=l(r[i]),o=i;o>=0;o--){var s=r[o],u=l(s),c=s.trim();if(c&&!c.startsWith("#")&&u<a){if(c.startsWith("-")){a=u;continue}if(c.includes(":")){var d=c.split(":")[0].trim();d&&(n.unshift(d),a=u)}}}return n},l=function(e){return e.length-e.trimLeft().length};return{triggerCharacters:[":"," ","-","\n","\t"],provideCompletionItems:function(t,n){var r=t.getWordAtPosition(n),i=null!=r?e.Range.lift({startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn}):e.Range.fromPositions(n);return{suggestions:o(t,n).map((function(t,n){return{kind:Oe(t.type,e),label:t.label,insertText:t.insertText,detail:t.detail,documentation:t.documentation,sortText:n.toString().padStart(3,"0"),range:i,command:t.triggerOnInsert?{id:"editor.action.triggerSuggest",title:""}:void 0}}))}}}}(i,x),n=h({},t,{provideCompletionItems:function(n,r,i,a){var o;return(null==(o=e.getModel())?void 0:o.id)!==n.id?{suggestions:[]}:t.provideCompletionItems(n,r,i,a)}}),r=i.languages.registerCompletionItemProvider("yaml",n);k.current=r.dispose}var a=e.getModel();if(a&&a.deltaDecorations(a.getAllDecorations().map((function(e){return e.id})),[]),g){var o=[{range:new i.Range(1,1,1,1),options:{className:I.placeholder,isWholeLine:!0}}],s=[],l=function(){var t=e.getModel();if(t){var n=0===t.getValueLength()?o:[];s=t.deltaDecorations(s,n)}};l(),e.onDidChangeModelContent(l)}}}),[p,JSON.stringify(x),g]),n.createElement("div",{className:"ant-input"+(u?" "+qe[u].className:"")+(T?" ant-input-disabled "+De:"")+(_?" "+Fe:"")},n.createElement("div",{ref:S},n.createElement(r,{width:"100%",height:"100%",language:"yaml",theme:Ue[d],value:m,onChange:E,editorDidMount:function(e){R.current=e,i.editor.defineTheme("yaml-light",{base:"vs",inherit:!0,rules:[{token:"key",foreground:"0000FF"},{token:"string",foreground:"008000"},{token:"number",foreground:"098658"},{token:"comment",foreground:"008000",fontStyle:"italic"},{token:"delimiter",foreground:"000000"},{token:"tag",foreground:"800080"},{token:"keyword",foreground:"0000FF",fontStyle:"bold"}],colors:{"editor.background":"#00000000",focusBorder:"#00000000","editor.lineHighlightBackground":"#00000000","editor.lineHighlightBorder":"#00000000"}}),i.editor.defineTheme("yaml-dark",{base:"vs-dark",inherit:!0,rules:[{token:"key",foreground:"9CDCFE"},{token:"string",foreground:"CE9178"},{token:"number",foreground:"B5CEA8"},{token:"comment",foreground:"6A9955",fontStyle:"italic"},{token:"delimiter",foreground:"D4D4D4"},{token:"tag",foreground:"C586C0"},{token:"keyword",foreground:"569CD6",fontStyle:"bold"}],colors:{"editor.background":"#00000000",focusBorder:"#00000000","editor.lineHighlightBackground":"#00000000","editor.lineHighlightBorder":"#00000000"}});var t=e.createContextKey("isEditorFocused"+a,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==C||C(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0)}));var n=function(){var t=S.current;if(null!==t){var n=Math.max(e.getContentHeight(),20);t.style.height=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+a),w&&e.addCommand(i.KeyCode.Enter,(function(){w(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+a),e.onDidChangeModelContent((function(){var t=e.getModel();if(t){var n=function(e,t){void 0===t&&(t=[]);var n=[];if(!e.trim())return n;try{for(var r=e.split("\n"),i=0;i<r.length;i++){var a=r[i],o=i+1;a.trim()&&!Ae(a)&&n.push({message:"Invalid indentation. YAML requires consistent indentation.",startLineNumber:o,endLineNumber:o,startColumn:1,endColumn:a.length+1,severity:"error"});var s=a.match(/^(\s*)([^:\s]+)(:)(\S)/);if(s){var l=s[1].length+s[2].length+2;n.push({message:'Missing space after colon. Use ": " instead of ":"',startLineNumber:o,endLineNumber:o,startColumn:l,endColumn:l+1,severity:"error"})}var u=a.match(/^(\s*)-(\S)/);if(u){var c=u[1].length+2;n.push({message:'Missing space after dash. Use "- " instead of "-"',startLineNumber:o,endLineNumber:o,startColumn:c,endColumn:c+1,severity:"error"})}}t.length>0&&n.push.apply(n,[])}catch(e){n.push({message:"YAML parsing error: "+e,startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:1,severity:"error"})}return n}(t.getValue(),x).map((function(e){return{message:e.message,severity:"error"===e.severity?i.MarkerSeverity.Error:"warning"===e.severity?i.MarkerSeverity.Warning:i.MarkerSeverity.Info,startLineNumber:e.startLineNumber,endLineNumber:e.endLineNumber,startColumn:e.startColumn,endColumn:e.endColumn}}));i.editor.setModelMarkers(t,"yaml",n)}})),null==L||L(e)},options:{readOnly:_,codeLens:!1,contextmenu:!1,fixedOverflowWidgets:!0,folding:!0,fontSize:12,lineDecorationsWidth:0,lineNumbers:"on",minimap:{enabled:!1},overviewRulerBorder:!1,overviewRulerLanes:0,padding:{top:qe[u].top,bottom:qe[u].bottom},renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!1,hideCursorInOverviewRuler:!0,scrollbar:{vertical:"auto",verticalScrollbarSize:8,horizontal:"auto",horizontalScrollbarSize:8,alwaysConsumeMouseWheel:!1},scrollBeyondLastLine:!1,suggest:{showWords:!0,filterGraceful:!0,snippetsPreventQuickSuggestions:!1,shareSuggestSelections:!1},quickSuggestions:{other:!0,comments:!1,strings:!0},quickSuggestionsDelay:0,suggestFontSize:12,wordWrap:"on",automaticLayout:!0,occurrencesHighlight:"off"}})))};
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=e(require("react-monaco-editor")),i=require("monaco-editor"),a=require("monaco-promql"),s=require("@fc-components/lezer-metricsql"),o=require("uuid"),l=require("@emotion/css"),u=require("sql-formatter");function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function m(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function s(e){d(a,r,i,s,o,"next",e)}function o(e){d(a,r,i,s,o,"throw",e)}s(void 0)}))}}function h(e,t,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&_(i,n.prototype),i}function p(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var l=Object.create((r&&r.prototype instanceof o?r:o).prototype);return y(l,"_invoke",function(n,r,i){var a,o,l,u=0,c=i||[],d=!1,m={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return a=t,o=0,l=e,m.n=n,s}};function h(n,r){for(o=n,l=r,t=0;!d&&u&&!i&&t<c.length;t++){var i,a=c[t],h=m.p,p=a[2];n>3?(i=p===r)&&(l=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=h&&((i=n<2&&h<a[1])?(o=0,m.v=r,m.n=a[1]):h<p&&(i=n<3||a[0]>r||r>p)&&(a[4]=n,a[5]=r,m.n=p,o=0))}if(i||n>1)return s;throw d=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&h(c,p),o=c,l=p;(t=o<2?e:l)||!d;){a||(o?o<3?(o>1&&(m.n=-1),h(o,l)):m.n=l:m.v=l);try{if(u=2,a){if(o||(i="next"),t=a[i]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=a.return)&&t.call(a),o<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((t=(d=m.n<0)?l:n.call(r,m))!==s)break}catch(t){a=e,o=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,i,a),!0),l}var s={};function o(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(y(t={},r,(function(){return this})),t),d=u.prototype=o.prototype=Object.create(c);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,y(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=u,y(d,"constructor",u),y(u,"constructor",l),l.displayName="GeneratorFunction",y(u,i,"GeneratorFunction"),y(d),y(d,i,"Generator"),y(d,r,(function(){return this})),y(d,"toString",(function(){return"[object Generator]"})),(b=function(){return{w:a,m:m}})()}function y(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(y=function(e,t,n,r){if(t)i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{function a(t,n){y(e,t,(function(e){return this._invoke(t,n,e)}))}a("next",0),a("throw",1),a("return",2)}})(e,t,n,r)}function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t){return t||(t=e.slice(0)),e.raw=t,e}function k(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function E(e){var t="function"==typeof Map?new Map:void 0;return(E=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return h(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}for(var C={wordPattern:/(-?\d*\.\d\w*)|([^`~!#%^&*()\-=+\[{\]}\\|;:'",.<>\/?\s]+)/g,comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{}},w=["sum","min","max","avg","group","stddev","stdvar","count","count_values","bottomk","topk","quantile","quantiles","distinct","geomean","histogram","mad","mode","any","bottomk_avg","bottomk_max","bottomk_median","bottomk_last","bottomk_min","topk_avg","topk_max","topk_median","topk_last","topk_min","outliers_mad","outliersk","share","sum2","zscore"],N=["abs","absent","ceil","changes","clamp_max","clamp_min","day_of_month","day_of_week","days_in_month","delta","deriv","exp","floor","histogram_quantile","histogram_avg","histogram_count","histogram_sum","histogram_fraction","histogram_stddev","histogram_stdvar","holt_winters","hour","idelta","increase","irate","label_join","label_replace","ln","log2","log10","minute","month","predict_linear","rate","resets","round","scalar","sort","sort_desc","sqrt","time","timestamp","vector","year","aggr_over_time","alias","ascent_over_time","bitmap_and","bitmap_or","bitmap_xor","buckets_limit","changes_prometheus","count_eq_over_time","count_gt_over_time","count_le_over_time","count_ne_over_time","decreases_over_time","default_rollup","delta_prometheus","deriv_fast","descent_over_time","distinct_over_time","drop_common_labels","duration_over_time","first_over_time","geomean_over_time","histogram_avg","histogram_over_time","histogram_quantiles","histogram_share","hoeffding_bound_lower","hoeffding_bound_upper","ideriv","increase_prometheus","increase_pure","increases_over_time","integrate","interpolate","keep_last_value","keep_next_value","label_copy","label_del","label_graphite_group","label_keep","label_lowercase","label_map","label_match","label_mismatch","label_move","label_set","label_transform","label_uppercase","label_value","lag","lifetime","limit_offset","mad_over_time","median_over_time","mode_over_time","now","prometheus_buckets","quantiles_over_time","rand","rand_exponential","rand_normal","range_avg","range_first","range_last","range_linear_regression","range_mad","range_max","range_min","range_normalize","range_over_time","range_quantile","range_stddev","range_stdvar","range_sum","range_trim_outliers","range_trim_spikes","range_trim_zscore","range_zscore","rate_over_sum","remove_resets","rollup","rollup_candlestick","rollup_delta","rollup_deriv","rollup_increase","rollup_rate","rollup_scrape_interval","running_avg","running_max","running_min","running_sum","scrape_interval","share_eq_over_time","share_gt_over_time","share_le_over_time","smooth_exponential","smooth_exponential","sort_by_label_desc","sort_by_label_numeric","sort_by_label_numeric_desc","stale_samples_over_time","step","sum2_over_time","tfirst_over_time","timestamp_with_name","timezone_offset","tlast_change_over_time","tlast_over_time","tmax_over_time","tmin_over_time","union","zscore_over_time","avg_daily","median_daily","avg_weekly","median_weekly","median_weekly_with_trends"],T=[],L=0,S=w;L<S.length;L++)T.push(S[L]+"_over_time");var R=["on","ignoring","group_right","group_left","by","without"],O=["with"],I="("+R.reduce((function(e,t){return e+"|"+t}))+")",A=["offset"],M={ignoreCase:!1,defaultToken:"",tokenPostfix:".promql",keywords:w.concat(N).concat(T).concat(R).concat(A).concat(O),operators:["+","-","*","/","%","^","==","!=",">","<",">=","<=","and","or","unless"],vectorMatching:I,symbols:/[=><!~?:&|+\-*\/^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,integersuffix:/(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/,floatsuffix:/[fFlL]?/,tokenizer:{root:[[/@vectorMatching\s*(?=\()/,"type","@clauses"],[/[a-z_]\w*(?=\s*(=|!=|=~|!~))/,"tag"],[/(^#.*$)/,"comment"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":"type","@default":"identifier"}}],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string_double"],[/'/,"string","@string_single"],[/`/,"string","@string_backtick"],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/\d+[smhdwy]/,"number"],[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/,"number.float"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/,"number.hex"],[/0[0-7']*[0-7](@integersuffix)/,"number.octal"],[/0[bB][0-1']*[0-1](@integersuffix)/,"number.binary"],[/\d[\d']*\d(@integersuffix)/,"number"],[/\d(@integersuffix)/,"number"]],string_double:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],string_single:[[/[^\\']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,"string","@pop"]],string_backtick:[[/[^\\`$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,"string","@pop"]],clauses:[[/[^(,)]/,"tag"],[/\)/,"identifier","@pop"]],whitespace:[[/[ \t\r\n]+/,"white"]]}},B=[].concat([{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"group",insertText:"group",documentation:"All values in the resulting vector are 1"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"count_values",insertText:"count_values",documentation:"Count number of elements with the same value"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"},{label:"quantile",insertText:"quantile",documentation:"Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions"}],[{label:"acos",insertText:"acos",detail:"acos(v instant-vector)",documentation:"calculates the arccosine of all elements in v"},{label:"acosh",insertText:"acosh",detail:"acosh(v instant-vector)",documentation:"calculates the inverse hyperbolic cosine of all elements in v"},{label:"asin",insertText:"asin",detail:"asin(v instant-vector)",documentation:"calculates the arcsine of all elements in v"},{label:"asinh",insertText:"asinh",detail:"asinh(v instant-vector)",documentation:"calculates the inverse hyperbolic sine of all elements in v"},{label:"atan",insertText:"atan",detail:"atan(v instant-vector)",documentation:"calculates the arctangent of all elements in v"},{label:"atanh",insertText:"atanh",detail:"atanh(v instant-vector)",documentation:"calculates the inverse hyperbolic tangent of all elements in v"},{label:"cos",insertText:"cos",detail:"cos(v instant-vector)",documentation:"calculates the cosine of all elements in v"},{label:"cosh",insertText:"cosh",detail:"cosh(v instant-vector)",documentation:"calculates the hyperbolic cosine of all elements in v"},{label:"sin",insertText:"sin",detail:"sin(v instant-vector)",documentation:"calculates the sine of all elements in v"},{label:"sinh",insertText:"sinh",detail:"sinh(v instant-vector)",documentation:"calculates the hyperbolic sine of all elements in v"},{label:"tan",insertText:"tan",detail:"tan(v instant-vector)",documentation:"calculates the tangent of all elements in v"},{label:"tanh",insertText:"tanh",detail:"tanh(v instant-vector)",documentation:"calculates the hyperbolic tangent of all elements in v"}],[{insertText:"abs",label:"abs",detail:"abs(v instant-vector)",documentation:"Returns the input vector with all sample values converted to their absolute value."},{insertText:"absent",label:"absent",detail:"absent(v instant-vector)",documentation:"Returns an empty vector if the vector passed to it has any elements and a 1-element vector with the value 1 if the vector passed to it has no elements. This is useful for alerting on when no time series exist for a given metric name and label combination."},{insertText:"absent_over_time",label:"absent_over_time",detail:"absent(v range-vector)",documentation:"Returns an empty vector if the range vector passed to it has any elements and a 1-element vector with the value 1 if the range vector passed to it has no elements."},{insertText:"ceil",label:"ceil",detail:"ceil(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` up to the nearest integer."},{insertText:"changes",label:"changes",detail:"changes(v range-vector)",documentation:"For each input time series, `changes(v range-vector)` returns the number of times its value has changed within the provided time range as an instant vector."},{insertText:"clamp",label:"clamp",detail:"clamp(v instant-vector, min scalar, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min` and an upper limit of `max`."},{insertText:"clamp_max",label:"clamp_max",detail:"clamp_max(v instant-vector, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have an upper limit of `max`."},{insertText:"clamp_min",label:"clamp_min",detail:"clamp_min(v instant-vector, min scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min`."},{insertText:"count_scalar",label:"count_scalar",detail:"count_scalar(v instant-vector)",documentation:"Returns the number of elements in a time series vector as a scalar. This is in contrast to the `count()` aggregation operator, which always returns a vector (an empty one if the input vector is empty) and allows grouping by labels via a `by` clause."},{insertText:"deg",label:"deg",detail:"deg(v instant-vector)",documentation:"Converts radians to degrees for all elements in v"},{insertText:"day_of_month",label:"day_of_month",detail:"day_of_month(v=vector(time()) instant-vector)",documentation:"Returns the day of the month for each of the given times in UTC. Returned values are from 1 to 31."},{insertText:"day_of_week",label:"day_of_week",detail:"day_of_week(v=vector(time()) instant-vector)",documentation:"Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc."},{insertText:"day_of_year",label:"day_of_year",detail:"day_of_year(v=vector(time()) instant-vector)",documentation:"Returns the day of the year for each of the given times in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years."},{insertText:"days_in_month",label:"days_in_month",detail:"days_in_month(v=vector(time()) instant-vector)",documentation:"Returns number of days in the month for each of the given times in UTC. Returned values are from 28 to 31."},{insertText:"delta",label:"delta",detail:"delta(v range-vector)",documentation:"Calculates the difference between the first and last value of each time series element in a range vector `v`, returning an instant vector with the given deltas and equivalent labels. The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers."},{insertText:"deriv",label:"deriv",detail:"deriv(v range-vector)",documentation:"Calculates the per-second derivative of the time series in a range vector `v`, using simple linear regression."},{insertText:"drop_common_labels",label:"drop_common_labels",detail:"drop_common_labels(instant-vector)",documentation:"Drops all labels that have the same name and value across all series in the input vector."},{insertText:"exp",label:"exp",detail:"exp(v instant-vector)",documentation:"Calculates the exponential function for all elements in `v`.\nSpecial cases are:\n* `Exp(+Inf) = +Inf` \n* `Exp(NaN) = NaN`"},{insertText:"floor",label:"floor",detail:"floor(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` down to the nearest integer."},{insertText:"histogram_quantile",label:"histogram_quantile",detail:"histogram_quantile(φ float, b instant-vector)",documentation:"Calculates the φ-quantile (0 ≤ φ ≤ 1) from the buckets `b` of a histogram. The samples in `b` are the counts of observations in each bucket. Each sample must have a label `le` where the label value denotes the inclusive upper bound of the bucket. (Samples without such a label are silently ignored.) The histogram metric type automatically provides time series with the `_bucket` suffix and the appropriate labels."},{insertText:"holt_winters",label:"holt_winters",detail:"holt_winters(v range-vector, sf scalar, tf scalar)",documentation:"Produces a smoothed value for time series based on the range in `v`. The lower the smoothing factor `sf`, the more importance is given to old data. The higher the trend factor `tf`, the more trends in the data is considered. Both `sf` and `tf` must be between 0 and 1."},{insertText:"hour",label:"hour",detail:"hour(v=vector(time()) instant-vector)",documentation:"Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23."},{insertText:"idelta",label:"idelta",detail:"idelta(v range-vector)",documentation:"Calculates the difference between the last two samples in the range vector `v`, returning an instant vector with the given deltas and equivalent labels."},{insertText:"increase",label:"increase",detail:"increase(v range-vector)",documentation:"Calculates the increase in the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. The increase is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if a counter increases only by integer increments."},{insertText:"irate",label:"irate",detail:"irate(v range-vector)",documentation:"Calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for."},{insertText:"label_join",label:"label_join",detail:"label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...)",documentation:"For each timeseries in `v`, joins all the values of all the `src_labels` using `separator` and returns the timeseries with the label `dst_label` containing the joined value. There can be any number of `src_labels` in this function."},{insertText:"label_replace",label:"label_replace",detail:"label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)",documentation:"For each timeseries in `v`, `label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)` matches the regular expression `regex` against the label `src_label`. If it matches, then the timeseries is returned with the label `dst_label` replaced by the expansion of `replacement`. `$1` is replaced with the first matching subgroup, `$2` with the second etc. If the regular expression doesn't match then the timeseries is returned unchanged."},{insertText:"ln",label:"ln",detail:"ln(v instant-vector)",documentation:"Calculates the natural logarithm for all elements in `v`.\nSpecial cases are:\n * `ln(+Inf) = +Inf`\n * `ln(0) = -Inf`\n * `ln(x < 0) = NaN`\n * `ln(NaN) = NaN`"},{insertText:"log2",label:"log2",detail:"log2(v instant-vector)",documentation:"Calculates the binary logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"log10",label:"log10",detail:"log10(v instant-vector)",documentation:"Calculates the decimal logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"minute",label:"minute",detail:"minute(v=vector(time()) instant-vector)",documentation:"Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59."},{insertText:"month",label:"month",detail:"month(v=vector(time()) instant-vector)",documentation:"Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc."},{insertText:"pi",label:"pi",detail:"pi()",documentation:"Returns pi"},{insertText:"predict_linear",label:"predict_linear",detail:"predict_linear(v range-vector, t scalar)",documentation:"Predicts the value of time series `t` seconds from now, based on the range vector `v`, using simple linear regression."},{insertText:"rad",label:"rad",detail:"rad(v instant-vector)",documentation:"Converts degrees to radians for all elements in v"},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the per-second average rate of increase of the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. Also, the calculation extrapolates to the ends of the time range, allowing for missed scrapes or imperfect alignment of scrape cycles with the range's time period."},{insertText:"resets",label:"resets",detail:"resets(v range-vector)",documentation:"For each input time series, `resets(v range-vector)` returns the number of counter resets within the provided time range as an instant vector. Any decrease in the value between two consecutive samples is interpreted as a counter reset."},{insertText:"round",label:"round",detail:"round(v instant-vector, to_nearest=1 scalar)",documentation:"Rounds the sample values of all elements in `v` to the nearest integer. Ties are resolved by rounding up. The optional `to_nearest` argument allows specifying the nearest multiple to which the sample values should be rounded. This multiple may also be a fraction."},{insertText:"scalar",label:"scalar",detail:"scalar(v instant-vector)",documentation:"Given a single-element input vector, `scalar(v instant-vector)` returns the sample value of that single element as a scalar. If the input vector does not have exactly one element, `scalar` will return `NaN`."},{insertText:"sgn",label:"sgn",detail:"sgn(v instant-vector)",documentation:"Returns a vector with all sample values converted to their sign, defined as this: 1 if v is positive, -1 if v is negative and 0 if v is equal to zero."},{insertText:"sort",label:"sort",detail:"sort(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in ascending order."},{insertText:"sort_desc",label:"sort_desc",detail:"sort_desc(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in descending order."},{insertText:"sqrt",label:"sqrt",detail:"sqrt(v instant-vector)",documentation:"Calculates the square root of all elements in `v`."},{insertText:"time",label:"time",detail:"time()",documentation:"Returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated."},{insertText:"timestamp",label:"timestamp",detail:"timestamp(v instant-vector)",documentation:"Returns the timestamp of each of the samples of the given vector as the number of seconds since January 1, 1970 UTC."},{insertText:"vector",label:"vector",detail:"vector(s scalar)",documentation:"Returns the scalar `s` as a vector with no labels."},{insertText:"year",label:"year",detail:"year(v=vector(time()) instant-vector)",documentation:"Returns the year for each of the given times in UTC."},{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average value of all points in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum value of all points in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum value of all points in the specified interval."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."},{insertText:"last_over_time",label:"last_over_time",detail:"last_over_time(range-vector)",documentation:"The most recent point value in specified interval."},{insertText:"present_over_time",label:"present_over_time",detail:"present_over_time(range-vector)",documentation:"The value 1 for any series in the specified interval."},{insertText:"histogram_avg",label:"histogram_avg",detail:"histogram_avg(v instant-vector)",documentation:"Returns the arithmetic average of observed values stored in a native histogram. Samples that are not native histograms are ignored and do not show up in the returned vector."},{insertText:"histogram_count",label:"histogram_count",detail:"histogram_count(v instant-vector)",documentation:"Returns the count of observations stored in a native histogram."},{insertText:"histogram_sum",label:"histogram_sum",detail:"histogram_sum(v instant-vector)",documentation:"Returns the sum of observations stored in a native histogram."},{insertText:"histogram_fraction",label:"histogram_fraction",detail:"histogram_fraction(lower scalar, upper scalar, v instant-vector)",documentation:"Returns the estimated fraction of observations between the provided lower and upper values."},{insertText:"histogram_stddev",label:"histogram_stddev",detail:"histogram_stddev(v instant-vector)",documentation:"Returns the estimated standard deviation of observations in a native histogram, based on the geometric mean of the buckets where the observations lie."},{insertText:"histogram_stdvar",label:"histogram_stdvar",detail:"histogram_stdvar(v instant-vector)",documentation:"Returns the estimated standard variance of observations in a native histogram."}]),P=function(e){function t(t){return e.call(this,"should never happen")||this}var n,r;return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,_(n,r),t}(E(Error));function q(e,t,n){return t&&0!==t.length?e+"{"+[].concat(t).filter((function(e){return e.name!==n&&""!==e.value})).map((function(e){return""+e.name+e.op+'"'+e.value.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'})).join(",")+"}":e}var F=400,V=422,K=503,U=function(){function e(e){var t,n=this;this.lookbackInterval=432e5,this.variablesNames=[],this.httpMethod="GET",this.apiPrefix="/api/v1",this.enableRequests=!0,this.customRequest=function(e,t){return fetch(e,t)},this.fetchSeries=function(){var e=m(b().m((function e(t,r){var i,a,s,o,l;return b().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return i=new Date,a=new Date(i.getTime()-n.lookbackInterval),s=n.apiPrefix+"/series",o={start:a.toISOString(),end:i.toISOString()},t&&(o["match[]"]=t),"none"!==r&&(o=g({},o,{limit:null!=r?r:"40000"})),l=n.buildRequest(s,new URLSearchParams(o)),e.n=2,n.request(l.uri,{method:n.httpMethod,body:l.body}).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.fetchLabels=function(){var e=m(b().m((function e(t){var r,i,a,s,o;return b().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return r=new Date,i=new Date(r.getTime()-n.lookbackInterval),a=n.apiPrefix+"/labels",s={start:i.toISOString(),end:r.toISOString()},t&&(s["match[]"]=t),o=n.buildRequest(a,new URLSearchParams(s)),e.n=2,n.request(o.uri,{method:n.httpMethod,body:o.body}).then((function(e){return n.labelKeys=e,e})).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.fetchLabelValues=function(){var e=m(b().m((function e(t,r){var i,a,s,o,l;return b().w((function(e){for(;;)switch(e.n){case 0:if(n.enableRequests){e.n=1;break}return e.a(2,[]);case 1:return i=new Date,a=new Date(i.getTime()-n.lookbackInterval),s=n.apiPrefix+"/label/"+t+"/values",o={start:a.toISOString(),end:i.toISOString()},r&&(o["match[]"]=r),l=n.buildRequest(s,new URLSearchParams(o)),e.n=2,n.request(l.uri,{method:n.httpMethod,body:l.body}).catch((function(){return[]}));case 2:return e.a(2,e.v)}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.start=m(b().m((function e(){var t;return b().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,n.fetchLabelValues("__name__",q("",[],"__name__"));case 1:if(t=e.v){e.n=2;break}t=[];case 2:return n.metrics=t,e.a(2,Promise.all([n.loadMetricsMetadata()]))}}),e)}))),this.inputInRange="",this.metricNamesSuggestionLimit=1e3,this.suggestionsIncomplete=!1,this.url=e.url?e.url:"",this.errorHandler=e.httpErrorHandler,e.lookbackInterval&&(this.lookbackInterval=e.lookbackInterval),e.variablesNames&&(this.variablesNames=[].concat(e.variablesNames)),this.durationVariablesCompletion=null==(t=e.durationVariablesCompletion)||t,e.request&&(this.customRequest=e.request),e.httpMethod&&(this.httpMethod=e.httpMethod),e.apiPrefix&&(this.apiPrefix=e.apiPrefix),void 0!==e.enableRequests&&(this.enableRequests=!!e.enableRequests),this.metrics=[],this.labelKeys=[]}var t,n,r=e.prototype;return r.getVariablesNames=function(){return this.variablesNames},r.setVariablesNames=function(e){this.variablesNames=[].concat(e)},r.buildRequest=function(e,t){var n=e,r=t;return"GET"===this.httpMethod&&(n=n+"?"+t,r=null),{uri:n,body:r}},r.request=function(e,t){var n=this;return this.customRequest(this.url+e,t).then((function(e){if(!e.ok&&![F,V,K].includes(e.status))throw new Error(e.statusText);return e})).then((function(e){return e.json()})).then((function(e){if("error"===e.status){var t=new Error(void 0!==e.error?e.error:'missing "error" field in response JSON');throw n.errorHandler&&n.errorHandler(t),t}if(void 0===e.data){var r=new Error(void 0!==e.error?e.error:'missing "data" field in response JSON');throw n.errorHandler&&n.errorHandler(r),r}return e.data})).catch((function(e){throw n.errorHandler&&n.errorHandler(e),e}))},r.getAllMetricNames=function(){return this.metrics},r.loadMetricsMetadata=function(){var e=m(b().m((function e(){var t;return b().w((function(e){for(;;)switch(e.n){case 0:if(this.enableRequests){e.n=1;break}return this.metricsMetadata={},e.a(2,this.metricsMetadata);case 1:return t=this.buildRequest(this.apiPrefix+"/metadata",new URLSearchParams({})),e.n=2,this.request(t.uri,{method:this.httpMethod,body:t.body}).catch((function(){return{}}));case 2:return this.metricsMetadata=e.v,e.a(2,this.metricsMetadata||{})}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.metricNamesToMetrics=function(e){var t=this;return e.map((function(e){var n,r,i,a=null==(n=t.metricsMetadata)?void 0:n[e];return{name:e,help:null!=(r=null==a?void 0:a.help)?r:"",type:null!=(i=null==a?void 0:a.type)?i:""}}))},r.setInputInRange=function(e){this.inputInRange=e},r.enableAutocompleteSuggestionsUpdate=function(){this.suggestionsIncomplete=!0,dispatchEvent(new CustomEvent("codeModeSuggestionsIncomplete",{detail:{limit:this.metricNamesSuggestionLimit}}))},t=e,(n=[{key:"monacoSettings",get:function(){return{enableAutocompleteSuggestionsUpdate:this.enableAutocompleteSuggestionsUpdate.bind(this),inputInRange:this.inputInRange,setInputInRange:this.setInputInRange.bind(this),suggestionsIncomplete:this.suggestionsIncomplete}}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,k(r.key),r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t}();function D(e,t){switch(t){case"parent":return e.parent;case"firstChild":return e.firstChild;case"lastChild":return e.lastChild;case"nextSibling":return e.nextSibling;default:throw new P(t)}}function W(e,t){for(var n,r=e,i=p(t);!(n=i()).done;){var a=n.value,s=a[1];if(null===(r=D(r,a[0])))return null;if(r.type.id!==s)return null}return r}function H(e,t){return t.slice(e.from,e.to)}function z(e,t){return e.every((function(e,n){return e===t[n]}))}var j=[{path:[s.LabelName,s.UnquotedLabelMatcher],fun:X},{path:[s.UnquotedLabelMatcher,s.LabelMatchers],fun:X},{path:[s.LabelMatchers,s.VectorSelector],fun:ee},{path:[s.LabelMatchers,s.VectorSelector,s.PromQL],fun:ee},{path:[s.PromQL],fun:J},{path:[s.VectorSelector,s.PromQL],fun:J},{path:[s.Identifier,s.VectorSelector],fun:J},{path:[s.Identifier,s.VectorSelector,s.PromQL],fun:J},{path:[s.FunctionCallBody],fun:function(){return{type:"IN_FUNCTION"}}},{path:[s.StringLiteral,s.UnquotedLabelMatcher],fun:$},{path:[0,s.BinaryExpr,s.PromQL],fun:J},{path:[0,s.UnquotedLabelMatcher],fun:function(e,t,n){var r=W(e,[["parent",s.UnquotedLabelMatcher]]);if(null===r)return null;var i=W(r,[["firstChild",s.LabelName]]);return null!==i&&null!==W(i,[["nextSibling",s.MatchOp]])?$(e,t):X(r,t,n)}},{path:[0,s.NumberDurationLiteralInDurationContext,s.MatrixSelector],fun:function(){return{type:"IN_DURATION"}}},{path:[s.GroupingLabels],fun:function(e,t,n){var r=W(e,[["parent",s.AggregateModifier],["parent",s.AggregateExpr]]);if(null===r)return null;var i=r.getChild(s.FunctionCallBody);if(null===i)return null;var a=function e(t,n){if(t.type.id===n)return t;for(var r,i=p(Y(t));!(r=i()).done;){var a=e(r.value,n);if(null!==a)return a}return null}(i,s.Identifier);return null===a?null:{type:"IN_GROUPING",metricName:H(a,t),otherLabels:[]}}},{path:[s.WithExpr],fun:Z},{path:[s.WithExpr,s.PromQL],fun:Z},{path:[s.WithAssignment,s.WithExpr],fun:Z}],G=new Map([[s.EqlSingle,"="],[s.EqlRegex,"=~"],[s.Neq,"!="],[s.NeqRegex,"!~"]]);function Q(e,t){return e.type.id!==s.LabelMatchers?[]:e.getChildren(s.UnquotedLabelMatcher).map((function(e){return function(e,t){if(e.type.id!==s.UnquotedLabelMatcher)return null;var n=W(e,[["firstChild",s.LabelName]]);if(null===n)return null;var r=W(n,[["nextSibling",s.MatchOp]]);if(null===r)return null;var i=function(e){var t,n=e.firstChild;return null===n?null:null!=(t=G.get(n.type.id))?t:null}(r);if(null===i)return null;var a=W(e,[["lastChild",s.StringLiteral]]);return null===a?null:{name:H(n,t),value:function(e){var t=e.slice(1,e.length-1);if(e.startsWith('"')&&e.endsWith('"'))return t.replace(/\\"/,'"');if(e.startsWith("'")&&e.endsWith("'"))return t.replace(/\\'/,"'");if(e.startsWith("`")&&e.endsWith("`"))return t;throw new Error("FIXME: invalid string literal")}(H(a,t)),op:i}}(e,t)})).filter(te)}function Y(e){for(var t=e.firstChild,n=[];null!==t;)n.push(t),t=t.nextSibling;return n}function $(e,t,n){var r=!e.type.isError,i=r?e.from+1:e.from,a=W(e,[["parent",s.UnquotedLabelMatcher]]);if(null===a)return null;var o=W(a,[["firstChild",s.LabelName]]);if(null===o)return null;var l=H(o,t),u=W(a,[["parent",s.LabelMatchers]]);if(null===u)return null;var c=Q(u,t).filter((function(e){return e.name!==l})),d=W(u,[["parent",s.VectorSelector],["firstChild",s.Identifier]]);return null===d?{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",labelName:l,betweenQuotes:r,otherLabels:c,valueStartPos:i}:{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",metricName:H(d,t),labelName:l,betweenQuotes:r,otherLabels:c,valueStartPos:i}}function J(){return{type:"AT_ROOT"}}function Z(e,t,n){for(var r=e.type.id===s.WithExpr?e:e.parent;r&&r.type.id!==s.WithExpr;)r=r.parent;if(!r)return null;var i=Y(r).find((function(e){return")"===H(e,t)}));return i&&n>i.to?{type:"IN_WITH_BODY"}:null}function X(e,t,n){var r=e;if(e.type.isError){var i=e.parent;if(null===i||i.type.id!==s.UnquotedLabelMatcher)return null;r=i}else e.type.id===s.LabelName&&(r=W(e,[["parent",s.UnquotedLabelMatcher]]));if(null===r||r.type.id!==s.UnquotedLabelMatcher)return null;var a=W(r,[["firstChild",s.LabelName]]);if(null===a)return null;if(n>a.to)return null;var o=W(r,[["parent",s.LabelMatchers]]);if(null===o)return null;var l=H(a,t),u=Q(o,t).filter((function(e){return e.name!==l})),c=null!==W(a,[["nextSibling",s.MatchOp]]),d=W(o,[["parent",s.VectorSelector],["firstChild",s.Identifier]]);return null===d?{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:u,hasOperator:c}:{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",metricName:H(d,t),otherLabels:u,hasOperator:c}}function ee(e,t,n){var r=W(e,[["firstChild",s.UnquotedLabelMatcher]]);if(null!==r&&!t.slice(r.to,n).includes(","))return null;var i=W(e,[["parent",s.VectorSelector],["firstChild",s.Identifier]]),a=Q(e,t);return null===i?{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:a,hasOperator:!1}:{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",metricName:H(i,t),otherLabels:a,hasOperator:!1}}function te(e){return null!=e}function ne(e){var t=e.getAllMetricNames();return e.metricNamesToMetrics(t).map((function(e){return{type:"METRIC_NAME",label:e.name,insertText:e.name,detail:e.name+" : "+e.type,documentation:e.help}}))}var re=B.map((function(e){var t;return{type:"FUNCTION",label:e.label,insertText:null!=(t=e.insertText)?t:"",detail:e.detail,documentation:e.documentation}}));function ie(e){return ae.apply(this,arguments)}function ae(){return(ae=m(b().m((function e(t){var n;return b().w((function(e){for(;;)switch(e.n){case 0:return n=ne(t),e.a(2,[se].concat(re,n))}}),e)})))).apply(this,arguments)}var se={type:"FUNCTION",label:"with",insertText:"with (",detail:"with (cte_name = expr, ...) expr",documentation:"Define Common Table Expressions (CTEs) for use in the query. MetricsQL extension."},oe=["1m","5m","10m","30m","1h","1d"].map((function(e){return{type:"DURATION",label:e,insertText:e}})),le=["$__interval","$__range","$__rate_interval"].map((function(e){return{type:"DURATION",label:e,insertText:e}}));function ue(e,t,n){return ce.apply(this,arguments)}function ce(){return(ce=m(b().m((function e(t,n,r){var i,a,s,o,l,u,c,d,m;return b().w((function(e){for(;;)switch(e.n){case 0:if(void 0!==t&&""!==t){e.n=2;break}return i=q("",n),e.n=1,r.fetchLabels(i);case 1:return e.a(2,e.v);case 2:return a=q(t,n),e.n=3,r.fetchSeries(a);case 3:s=e.v,o=new Set,l=p(s);case 4:if((u=l()).done){e.n=9;break}c=0,d=Object.entries(u.value);case 5:if(!(c<d.length)){e.n=8;break}if("__name__"!==(m=d[c][0])){e.n=6;break}return e.a(3,7);case 6:o.add(m);case 7:c++,e.n=5;break;case 8:e.n=4;break;case 9:return e.a(2,Array.from(o));case 10:return e.a(2)}}),e)})))).apply(this,arguments)}function de(e,t,n,r,i){return me.apply(this,arguments)}function me(){return(me=m(b().m((function e(t,n,r,i,a){return b().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,ue(t,i,a);case 1:return e.a(2,e.v.map((function(e){return{type:"LABEL_NAME",label:e,insertText:""+e+n,triggerOnInsert:r}})))}}),e)})))).apply(this,arguments)}function he(){return(he=m(b().m((function e(t,n,r,i){return b().w((function(e){for(;;)switch(e.n){case 0:return e.a(2,de(t,n?"":"=",!0,r,i))}}),e)})))).apply(this,arguments)}function pe(){return(pe=m(b().m((function e(t,n,r){return b().w((function(e){for(;;)switch(e.n){case 0:return e.a(2,de(t,"",!1,n,r))}}),e)})))).apply(this,arguments)}function ge(e,t,n,r){return fe.apply(this,arguments)}function fe(){return(fe=m(b().m((function e(t,n,r,i){var a,s,o,l,u,c,d,m,h,g,f,v;return b().w((function(e){for(;;)switch(e.n){case 0:if(void 0!==t&&""!==t){e.n=2;break}return a=q("",r),e.n=1,i.fetchLabelValues(n,a);case 1:return e.a(2,e.v);case 2:return s=q(t,r,n),e.n=3,i.fetchSeries(s);case 3:o=e.v,l=new Set,u=p(o);case 4:if((c=u()).done){e.n=9;break}d=0,m=Object.entries(c.value);case 5:if(!(d<m.length)){e.n=8;break}if(f=(h=m[d])[1],"__name__"!==(g=h[0])){e.n=6;break}return e.a(3,7);case 6:g===n&&f&&l.add(f);case 7:d++,e.n=5;break;case 8:e.n=4;break;case 9:return v=i.getVariablesNames(),e.a(2,v.concat(Array.from(l)));case 10:return e.a(2)}}),e)})))).apply(this,arguments)}function ve(){return(ve=m(b().m((function e(t,n,r,i,a){return b().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,ge(t,n,i,a);case 1:return e.a(2,e.v.map((function(e){return{type:"LABEL_VALUE",label:e,insertText:r?e:'"'+e+'"'}})))}}),e)})))).apply(this,arguments)}function be(e,t){switch(e){case"DURATION":return t.languages.CompletionItemKind.Unit;case"FUNCTION":return t.languages.CompletionItemKind.Variable;case"HISTORY":return t.languages.CompletionItemKind.Snippet;case"LABEL_NAME":return t.languages.CompletionItemKind.Enum;case"LABEL_VALUE":return t.languages.CompletionItemKind.EnumMember;case"METRIC_NAME":return t.languages.CompletionItemKind.Constructor;default:throw new P(e)}}function ye(e,t){var n=[];return t.parse(e).iterate({enter:function(t){if(0===t.type.id){var r=t.node;n.push({node:r,text:e.substring(r.from,r.to)})}}}),n}function _e(e){return null!==e}var xe,ke,Ee,Ce,we=["error"],Ne=a.promLanguageDefinition.id,Te={small:{className:"ant-input-sm",top:1,bottom:1},middle:{className:"ant-input-md",top:1,bottom:1},large:{className:"ant-input-lg",top:3,bottom:2}},Le={light:"n9e-light",dark:"n9e-dark"},Se=l.css(xe||(xe=x(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),Re=l.css(ke||(ke=x(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important; /* 完全透明 */\n }\n"]))),Oe={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"#"},brackets:[["{","}"],["[","]"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{offSide:!0}},Ie={tokenPostfix:".yaml",brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.square",open:"[",close:"]"}],keywords:["true","false","null","True","False","Null","TRUE","FALSE","NULL","yes","no","Yes","No","YES","NO","on","off","On","Off","ON","OFF"],numberInteger:/(?:0|[+-]?[0-9]+)/,numberFloat:/(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,numberOctal:/0o[0-7]+/,numberHex:/0x[0-9a-fA-F]+/,numberInfinity:/[+-]?\.(?:inf|Inf|INF)/,numberNaN:/\.(?:nan|Nan|NAN)/,numberDate:/\d{4}-\d{2}-\d{2}(?:[Tt ]\d{1,2}:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d{1,2}(?::\d{2})?))?)?/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,tokenizer:{root:[{include:"@whitespace"},{include:"@comment"},[/^---/,"meta.document"],[/^\.{3}/,"meta.document"],[/^(\s*)([^:\s]+)(\s*)(:)/,["white","key","white","delimiter"]],[/(\s*)([^:\s]+)(\s*)(:)/,["white","key","white","delimiter"]],[/\{/,"@brackets","@flowMap"],[/\[/,"@brackets","@flowSequence"],[/[|>][-+]?(\d+)?/,"string.block","@blockScalar"],[/@numberInfinity/,"number.infinity"],[/@numberNaN/,"number.nan"],[/@numberDate/,"number.date"],[/@numberHex/,"number.hex"],[/@numberOctal/,"number.octal"],[/@numberFloat/,"number.float"],[/@numberInteger/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/&\w+/,"tag.anchor"],[/\*\w+/,"tag.alias"],[/![\w\-\/]+/,"tag"],[/[^\s\[\{\,]+/,{cases:{"@keywords":"keyword","@default":"string.unquoted"}}],[/^(\s*)(-\s)/,["white","delimiter"]],[/(\s*)(-\s)/,["white","delimiter"]]],whitespace:[[/[ \t\r\n]+/,"white"]],comment:[[/#.*$/,"comment"]],doubleQuotedString:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],singleQuotedString:[[/[^\\']+/,"string"],[/''/,"string.escape"],[/'/,"string","@pop"]],blockScalar:[[/^(\s*).+$/,"string.block"],[/^(?!\s)/,"","@pop"]],flowMap:[{include:"@whitespace"},{include:"@comment"},[/\}/,"@brackets","@pop"],[/,/,"delimiter"],[/:/,"delimiter"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/[^\s\,\}\:]+/,"string.unquoted"]],flowSequence:[{include:"@whitespace"},{include:"@comment"},[/\]/,"@brackets","@pop"],[/,/,"delimiter"],[/"/,"string","@doubleQuotedString"],[/'/,"string","@singleQuotedString"],[/[^\s\,\]]+/,"string.unquoted"]]}};function Ae(e,t){switch(e){case"KEYWORD":return t.languages.CompletionItemKind.Keyword;case"VALUE":return t.languages.CompletionItemKind.Value;case"KEY":return t.languages.CompletionItemKind.Property;case"BOOLEAN":return t.languages.CompletionItemKind.Constant;case"NUMBER":return t.languages.CompletionItemKind.Value;case"STRING":default:return t.languages.CompletionItemKind.Text}}function Me(e){return!e.trim()||(e.length-e.trimLeft().length)%2==0}var Be,Pe,qe,Fe,Ve={small:{className:"ant-input-sm",top:1,bottom:1},middle:{className:"ant-input-md",top:1,bottom:1},large:{className:"ant-input-lg",top:3,bottom:2}},Ke={light:"yaml-light",dark:"yaml-dark"},Ue=l.css(Ee||(Ee=x(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),De=l.css(Ce||(Ce=x(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"]))),We={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],folding:{offSide:!1}},He={defaultToken:"",tokenPostfix:".sql",ignoreCase:!0,brackets:[{open:"(",close:")",token:"delimiter.parenthesis"},{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"}],keywords:["SELECT","FROM","WHERE","AND","OR","NOT","JOIN","INNER","LEFT","RIGHT","FULL","OUTER","ON","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","PRIMARY","KEY","FOREIGN","CONSTRAINT","UNIQUE","INDEX","VIEW","DATABASE","SCHEMA","AS","DISTINCT","CASE","WHEN","THEN","ELSE","END","CAST","BETWEEN","IN","LIKE","IS","NULL","TRUE","FALSE","WITH","UNION","EXCEPT","INTERSECT"],operators:["=",">","<","!","%","&","|","^","~","?",":","+","-","*","/"],builtinFunctions:["COUNT","SUM","AVG","MIN","MAX","UPPER","LOWER","LENGTH","SUBSTRING","TRIM","ROUND","ABS","COALESCE","NULLIF","IFNULL","CONCAT","DATE","NOW","YEAR","MONTH","DAY","HOUR","MINUTE","SECOND"],escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\|;,.?*+^$\\]/,regexpattern:/(\{[0-9]+\})|(\{[0-9]*,[0-9]*\})|(\?(?:\?)?|[*+]|\^|\$|\|\\)/,tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@pseudo-columns"},[/[;,.]/,"delimiter"],[/[{}()\[\]]/,"@brackets"],{include:"@builtinVariables"},{include:"@numbers"},{include:"@strings"},[/[a-zA-Z_#][a-zA-Z0-9_$#@]*(?=\s*\()/,{cases:{"@builtinFunctions":"keyword.function","@default":"identifier.function"}}],[/[a-zA-Z_#][a-zA-Z0-9_$#@]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],"pseudo-columns":[[/[$][A-Za-z_][A-Za-z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}],[/@[A-Za-z_][A-Za-z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}]],builtinVariables:[[/@@?[a-zA-Z_][a-zA-Z0-9_]*/,{cases:{"@keywords":"keyword","@default":"variable"}}]],numbers:[[/0[xX][0-9a-fA-F]*[0-9a-fA-F]/,"number.hex"],[/0[0-7]+(?!\d)/,"number.octal"],[/(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?/,"number"]],strings:[[/'/,{token:"string",next:"@string"}],[/"/,{token:"string.double",next:"@string_double"}],[/`/,{token:"string.backtick",next:"@string_backtick"}]],string:[[/[^'\\]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,{token:"string",next:"@pop"}]],string_double:[[/[^"\\]+/,"string.double"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.double",next:"@pop"}]],string_backtick:[[/[^`\\]+/,"string.backtick"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,{token:"string.backtick",next:"@pop"}]]}},ze=["SELECT","FROM","WHERE","AND","OR","NOT","JOIN","INNER","LEFT","RIGHT","FULL","OUTER","ON","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","PRIMARY","KEY","FOREIGN","CONSTRAINT","UNIQUE","INDEX","VIEW","DATABASE","SCHEMA","AS","DISTINCT","CASE","WHEN","THEN","ELSE","END","CAST","BETWEEN","IN","LIKE","IS","NULL","TRUE","FALSE","WITH","UNION","EXCEPT","INTERSECT","ASC","DESC","ALL","ANY","EXISTS","CROSS"],je=[{name:"COUNT",signature:"COUNT(expression)",description:"Returns the number of rows"},{name:"SUM",signature:"SUM(expression)",description:"Returns the sum of values"},{name:"AVG",signature:"AVG(expression)",description:"Returns the average value"},{name:"MIN",signature:"MIN(expression)",description:"Returns the minimum value"},{name:"MAX",signature:"MAX(expression)",description:"Returns the maximum value"},{name:"UPPER",signature:"UPPER(string)",description:"Converts string to uppercase"},{name:"LOWER",signature:"LOWER(string)",description:"Converts string to lowercase"},{name:"LENGTH",signature:"LENGTH(string)",description:"Returns the length of string"},{name:"SUBSTRING",signature:"SUBSTRING(string, start, length)",description:"Extracts substring"},{name:"TRIM",signature:"TRIM(string)",description:"Removes leading and trailing spaces"},{name:"ROUND",signature:"ROUND(number, decimals)",description:"Rounds a number"},{name:"ABS",signature:"ABS(number)",description:"Returns absolute value"},{name:"COALESCE",signature:"COALESCE(value1, value2, ...)",description:"Returns first non-null value"},{name:"NULLIF",signature:"NULLIF(value1, value2)",description:"Returns null if two values are equal"},{name:"IFNULL",signature:"IFNULL(value, default)",description:"Returns alternative if null"},{name:"CONCAT",signature:"CONCAT(string1, string2, ...)",description:"Concatenates strings"},{name:"DATE",signature:"DATE(date)",description:"Extracts date part"},{name:"NOW",signature:"NOW()",description:"Returns current date and time"}],Ge={small:{className:"ant-input-sm",top:1,bottom:1,minHeight:24},middle:{className:"ant-input-md",top:1,bottom:1,minHeight:32},large:{className:"ant-input-lg",top:3,bottom:2,minHeight:40}},Qe={light:"sql-light",dark:"sql-dark"},Ye=l.css(Be||(Be=x(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),$e=l.css(Pe||(Pe=x(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"]))),Je=l.css(qe||(qe=x(["\n position: absolute;\n top: 4px;\n right: 4px;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n padding: 0;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: inherit;\n opacity: 0.6;\n transition: opacity 0.15s;\n\n &:hover {\n opacity: 1;\n background: var(--format-btn-hover-bg, rgba(128, 128, 128, 0.15));\n }\n"]))),Ze=t.forwardRef((function(e,a){var s=o.v4(),l=e.className,c=e.maxHeight,d=e.fontSize,m=e.size,h=void 0===m?"middle":m,p=e.theme,g=void 0===p?"light":p,f=e.value,v=void 0===f?"":f,b=e.placeholder,y=e.enableFormat,_=void 0!==y&&y,x=e.enableAutocomplete,k=void 0===x||x,E=e.readOnly,C=void 0!==E&&E,w=e.disabled,N=void 0!==w&&w,T=e.onChange,L=e.onEnter,S=e.onBlur,R=e.onFocus,O=e.editorDidMount,I=e.renderFormatButton,A=t.useRef(null),M=t.useRef(null),B=t.useRef(null),P=t.useRef([]);t.useEffect((function(){if(i.languages.getLanguages().some((function(e){return"sql"===e.id}))||(i.languages.register({id:"sql"}),i.languages.setMonarchTokensProvider("sql",He),i.languages.setLanguageConfiguration("sql",We)),k){var e=i.languages.registerCompletionItemProvider("sql",{provideCompletionItems:function(e,t,n,r){var a=e.getWordUntilPosition(t),s=new i.Range(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn);return{suggestions:[].concat(ze.map((function(e){return{label:e,kind:i.languages.CompletionItemKind.Keyword,insertText:e,range:s,sortText:"1"+e}})),je.map((function(e){return{label:e.name,kind:i.languages.CompletionItemKind.Function,insertText:e.name,detail:e.signature,documentation:e.description,range:s,sortText:"2"+e.name}})))}}});P.current.push(e)}return function(){P.current.forEach((function(e){return e.dispose()})),P.current=[]}}),[k]);var q=t.useCallback((function(){var e=M.current;if(e){var t=function(e){try{return u.format(e,{tabWidth:2,keywordCase:"upper"})}catch(t){return e}}(e.getValue());e.setValue(t)}}),[]);return t.useImperativeHandle(a,(function(){return{format:q}})),n.createElement("div",{className:"ant-input"+(h?" "+Ge[h].className:"")+(N?" ant-input-disabled "+Ye:"")+(C?" "+$e:"")+(l?" "+l:""),style:{display:"block",resize:"vertical",overflow:"auto",position:"relative",minHeight:Ge[h].minHeight,maxHeight:c}},n.createElement("div",{ref:A,style:{height:"100%"}},n.createElement(r,{width:"100%",height:"100%",language:"sql",theme:Qe[g],value:v,onChange:T,editorDidMount:function(e){M.current=e,B.current=e.getModel(),i.editor.defineTheme("sql-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}}),i.editor.defineTheme("sql-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}});var t=e.createContextKey("isEditorFocused"+s,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==S||S(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0),null==R||R(e.getValue())}));var n=function(){var t=A.current;if(null!==t){var n=e.getContentHeight();t.style.minHeight=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+s),i.editor.addKeybindingRule({keybinding:i.KeyCode.Enter,command:"-",when:"!suggestWidgetVisible"}),e.addCommand(i.KeyCode.Enter,(function(){null==L||L(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+s),null==O||O(e)},options:{minimap:{enabled:!1},autoClosingBrackets:"always",autoClosingQuotes:"always",autoIndent:"full",formatOnPaste:!0,formatOnType:!0,readOnly:C||N,scrollBeyondLastLine:!1,smoothScrolling:!0,fontSize:d,tabSize:2,wordWrap:"on",automaticLayout:!0,fixedOverflowWidgets:!0,glyphMargin:!1,lineNumbers:"off",lineNumbersMinChars:0,folding:!1,lineDecorationsWidth:0,overviewRulerBorder:!1,overviewRulerLanes:0,placeholder:b,renderLineHighlight:"none",occurrencesHighlight:"off",scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1}}})),_&&(I?I(q):n.createElement("button",{onClick:q,className:Je,title:"Format SQL",style:{"--format-btn-hover-bg":"dark"===g?"rgba(255,255,255,0.2)":"rgba(128,128,128,0.15)"}},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"}),n.createElement("path",{d:"m14 7 3 3"}),n.createElement("path",{d:"M5 6v4"}),n.createElement("path",{d:"M19 14v4"}),n.createElement("path",{d:"M10 2v2"}),n.createElement("path",{d:"M7 8H3"}),n.createElement("path",{d:"M21 16h-4"}),n.createElement("path",{d:"M11 3H9"})))))})),Xe={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],folding:{offSide:!1}},et={defaultToken:"",tokenPostfix:".expr",brackets:[{open:"(",close:")",token:"delimiter.parenthesis"},{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"}],keywords:["let","true","false","nil","in","not","and","or","if","else"],builtinFunctions:[].concat(["trim","trimPrefix","trimSuffix","upper","lower","split","splitAfter","replace","repeat","indexOf","lastIndexOf","hasPrefix","hasSuffix","contains","startsWith","endsWith"],["now","duration","date","timezone"],["max","min","abs","ceil","floor","round"],["all","any","one","none","map","filter","find","findIndex","findLast","findLastIndex","groupBy","count","concat","flatten","uniq","join","reduce","sum","mean","median","first","last","take","reverse","sort","sortBy"],["keys","values"],["type","int","float","string","toJSON","fromJSON","toBase64","fromBase64","toPairs","fromPairs"],["len","get"],["bitand","bitor","bitxor","bitnand","bitnot","bitshl","bitshr","bitushr"]),operators:["+","-","*","/","%","^","**","==","!=","<",">","<=",">=","!","&&","||","?:","??",".","?.","in","matches","..","|"],escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,hexdigits:/[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,octdigits:/[0-7]+(_+[0-7]+)*/,bindigits:/[01]+(_+[01]+)*/,tokenizer:{root:[{include:"@whitespace"},{include:"@comments"},{include:"@numbers"},{include:"@strings"},{include:"@bytes"},[/[a-zA-Z_]\w*(?=\s*\()/,{cases:{"@builtinFunctions":"keyword.function","@default":"identifier.function"}}],[/[a-zA-Z_]\w*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[?][?:]/,"operator"],[/[?][.]/,"operator"],[/[.]{2}/,"operator"],[/[*]{2}/,"operator"],[/[|]/,"operator"],[/[+\-*/%^]/,"operator"],[/==|!=|<=|>=|<|>/,"operator"],[/!|&&|\|\|/,"operator"],[/[=]/,"operator"],[/[.~]/,"operator"],[/[,;]/,"delimiter"],[/[{}()\[\]]/,"@brackets"]],whitespace:[[/[ \t\r\n]+/,"white"]],comments:[[/\/\/.*$/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],numbers:[[/0[xX]@hexdigits/,"number.hex"],[/0[oO]@octdigits/,"number.octal"],[/0[bB]@bindigits/,"number.binary"],[/(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?/,"number"]],strings:[[/"/,{token:"string.double",next:"@string_double"}],[/'/,{token:"string",next:"@string_single"}],[/`/,{token:"string.backtick",next:"@string_backtick"}]],string_double:[[/[^"\\]+/,"string.double"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.double",next:"@pop"}]],string_single:[[/[^'\\]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,{token:"string",next:"@pop"}]],string_backtick:[[/[^`]+/,"string.backtick"],[/`/,{token:"string.backtick",next:"@pop"}]],bytes:[[/[bB]"/,{token:"string.bytes",next:"@bytes_double"}],[/[bB]'/,{token:"string.bytes",next:"@bytes_single"}]],bytes_double:[[/[^"\\]+/,"string.bytes"],[/\\(?:[abfnrtv\\"]|x[0-9A-Fa-f]{2}|[0-7]{3})/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.bytes",next:"@pop"}]],bytes_single:[[/[^'\\]+/,"string.bytes"],[/\\(?:[abfnrtv\\']|x[0-9A-Fa-f]{2}|[0-7]{3})/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,{token:"string.bytes",next:"@pop"}]]}},tt=["let","true","false","nil","in","not","and","or","if","else"],nt=[{name:"trim",signature:"trim(str[, chars])",description:"Removes white spaces from both ends of a string",category:"string"},{name:"trimPrefix",signature:"trimPrefix(str, prefix)",description:"Removes the specified prefix from the string",category:"string"},{name:"trimSuffix",signature:"trimSuffix(str, suffix)",description:"Removes the specified suffix from the string",category:"string"},{name:"upper",signature:"upper(str)",description:"Converts all characters to uppercase",category:"string"},{name:"lower",signature:"lower(str)",description:"Converts all characters to lowercase",category:"string"},{name:"split",signature:"split(str, delimiter[, n])",description:"Splits a string at each instance of the delimiter",category:"string"},{name:"splitAfter",signature:"splitAfter(str, delimiter[, n])",description:"Splits a string after each instance of the delimiter",category:"string"},{name:"replace",signature:"replace(str, old, new)",description:"Replaces all occurrences of old with new",category:"string"},{name:"repeat",signature:"repeat(str, n)",description:"Repeats a string n times",category:"string"},{name:"indexOf",signature:"indexOf(str, substring)",description:"Returns the index of the first occurrence of substring",category:"string"},{name:"lastIndexOf",signature:"lastIndexOf(str, substring)",description:"Returns the index of the last occurrence of substring",category:"string"},{name:"hasPrefix",signature:"hasPrefix(str, prefix)",description:"Returns true if string starts with the given prefix",category:"string"},{name:"hasSuffix",signature:"hasSuffix(str, suffix)",description:"Returns true if string ends with the given suffix",category:"string"},{name:"contains",signature:"contains(str, substr)",description:"Returns true if string contains the given substring",category:"string"},{name:"startsWith",signature:"startsWith(str, prefix)",description:"Returns true if string starts with the given prefix",category:"string"},{name:"endsWith",signature:"endsWith(str, suffix)",description:"Returns true if string ends with the given suffix",category:"string"},{name:"now",signature:"now()",description:"Returns the current date as a time.Time value",category:"date"},{name:"duration",signature:"duration(str)",description:"Returns time.Duration value of the given string",category:"date"},{name:"date",signature:"date(str[, format[, timezone]])",description:"Converts the given string into a date representation",category:"date"},{name:"timezone",signature:"timezone(str)",description:"Returns the timezone of the given string",category:"date"},{name:"max",signature:"max(n1, n2)",description:"Returns the maximum of two numbers",category:"number"},{name:"min",signature:"min(n1, n2)",description:"Returns the minimum of two numbers",category:"number"},{name:"abs",signature:"abs(n)",description:"Returns the absolute value of a number",category:"number"},{name:"ceil",signature:"ceil(n)",description:"Returns the least integer value greater than or equal to x",category:"number"},{name:"floor",signature:"floor(n)",description:"Returns the greatest integer value less than or equal to x",category:"number"},{name:"round",signature:"round(n)",description:"Returns the nearest integer, rounding half away from zero",category:"number"},{name:"all",signature:"all(array, predicate)",description:"Returns true if all elements satisfy the predicate",category:"array"},{name:"any",signature:"any(array, predicate)",description:"Returns true if any elements satisfy the predicate",category:"array"},{name:"one",signature:"one(array, predicate)",description:"Returns true if exactly one element satisfies the predicate",category:"array"},{name:"none",signature:"none(array, predicate)",description:"Returns true if no elements satisfy the predicate",category:"array"},{name:"map",signature:"map(array, predicate)",description:"Returns new array by applying the predicate to each element",category:"array"},{name:"filter",signature:"filter(array, predicate)",description:"Returns new array by filtering elements by predicate",category:"array"},{name:"find",signature:"find(array, predicate)",description:"Finds the first element satisfying the predicate",category:"array"},{name:"findIndex",signature:"findIndex(array, predicate)",description:"Finds the index of the first element satisfying the predicate",category:"array"},{name:"findLast",signature:"findLast(array, predicate)",description:"Finds the last element satisfying the predicate",category:"array"},{name:"findLastIndex",signature:"findLastIndex(array, predicate)",description:"Finds the index of the last element satisfying the predicate",category:"array"},{name:"groupBy",signature:"groupBy(array, predicate)",description:"Groups elements by the result of the predicate",category:"array"},{name:"count",signature:"count(array[, predicate])",description:"Returns the number of elements satisfying the predicate",category:"array"},{name:"concat",signature:"concat(array1, array2[, ...])",description:"Concatenates two or more arrays",category:"array"},{name:"flatten",signature:"flatten(array)",description:"Flattens an array into one-dimensional array",category:"array"},{name:"uniq",signature:"uniq(array)",description:"Removes duplicates from an array",category:"array"},{name:"join",signature:"join(array[, delimiter])",description:"Joins an array of strings into a single string",category:"array"},{name:"reduce",signature:"reduce(array, predicate[, initial])",description:"Reduces an array to a single value",category:"array"},{name:"sum",signature:"sum(array[, predicate])",description:"Returns the sum of all numbers in an array",category:"array"},{name:"mean",signature:"mean(array)",description:"Returns the average of all numbers in an array",category:"array"},{name:"median",signature:"median(array)",description:"Returns the median of all numbers in an array",category:"array"},{name:"first",signature:"first(array)",description:"Returns the first element from an array",category:"array"},{name:"last",signature:"last(array)",description:"Returns the last element from an array",category:"array"},{name:"take",signature:"take(array, n)",description:"Returns the first n elements from an array",category:"array"},{name:"reverse",signature:"reverse(array)",description:"Returns a new reversed copy of the array",category:"array"},{name:"sort",signature:"sort(array[, order])",description:"Sorts an array in ascending or descending order",category:"array"},{name:"sortBy",signature:"sortBy(array[, predicate, order])",description:"Sorts an array by the result of the predicate",category:"array"},{name:"keys",signature:"keys(map)",description:"Returns an array containing the keys of the map",category:"map"},{name:"values",signature:"values(map)",description:"Returns an array containing the values of the map",category:"map"},{name:"type",signature:"type(v)",description:"Returns the type of the given value",category:"conversion"},{name:"int",signature:"int(v)",description:"Returns the integer value of a number or string",category:"conversion"},{name:"float",signature:"float(v)",description:"Returns the float value of a number or string",category:"conversion"},{name:"string",signature:"string(v)",description:"Converts a value to its string representation",category:"conversion"},{name:"toJSON",signature:"toJSON(v)",description:"Converts a value to JSON string representation",category:"conversion"},{name:"fromJSON",signature:"fromJSON(v)",description:"Parses a JSON string to a value",category:"conversion"},{name:"toBase64",signature:"toBase64(v)",description:"Encodes a string into Base64 format",category:"conversion"},{name:"fromBase64",signature:"fromBase64(v)",description:"Decodes a Base64 encoded string",category:"conversion"},{name:"toPairs",signature:"toPairs(map)",description:"Converts a map to an array of key-value pairs",category:"conversion"},{name:"fromPairs",signature:"fromPairs(array)",description:"Converts an array of key-value pairs to a map",category:"conversion"},{name:"len",signature:"len(v)",description:"Returns the length of an array, map, or string",category:"misc"},{name:"get",signature:"get(v, index)",description:"Retrieves element at the specified index from an array or map",category:"misc"},{name:"bitand",signature:"bitand(int, int)",description:"Returns the bitwise AND of two integers",category:"bitwise"},{name:"bitor",signature:"bitor(int, int)",description:"Returns the bitwise OR of two integers",category:"bitwise"},{name:"bitxor",signature:"bitxor(int, int)",description:"Returns the bitwise XOR of two integers",category:"bitwise"},{name:"bitnand",signature:"bitnand(int, int)",description:"Returns the bitwise AND NOT of two integers",category:"bitwise"},{name:"bitnot",signature:"bitnot(int)",description:"Returns the bitwise NOT of an integer",category:"bitwise"},{name:"bitshl",signature:"bitshl(int, int)",description:"Returns the Left Shift of an integer",category:"bitwise"},{name:"bitshr",signature:"bitshr(int, int)",description:"Returns the Right Shift of an integer",category:"bitwise"},{name:"bitushr",signature:"bitushr(int, int)",description:"Returns the unsigned Right Shift of an integer",category:"bitwise"}];!function(e){e.Identifier="Identifier",e.Number="Number",e.String="String",e.Operator="Operator",e.Bracket="Bracket",e.EOF="EOF"}(Fe||(Fe={}));var rt,it,at={kind:Fe.EOF,value:"",start:0,end:0,line:0,column:0},st={"??":1,"||":2,or:2,"&&":3,and:3,"==":4,"!=":4,"<":5,">":5,"<=":5,">=":5,in:5,matches:5,contains:5,startsWith:5,endsWith:5,"+":6,"-":6,"*":7,"/":7,"%":7,"^":8,"**":8},ot=new Set(["!","not","-"]),lt=new Set(["<",">","<=",">=","==","!="]),ut=new Set(["let","if","else","not","and","or","in","matches","contains","startsWith","endsWith","hasPrefix","hasSuffix"]),ct=function(){function e(){this.input="",this.pos=0,this.line=1,this.column=1,this.startLine=1,this.startColumn=1}var t=e.prototype;return t.reset=function(e){this.input=e,this.pos=0,this.line=1,this.column=1,this.startLine=1,this.startColumn=1},t.next=function(){if(this.skipWhitespace(),this.skipComments(),this.pos>=this.input.length)return g({},at,{start:this.pos,end:this.pos,line:this.line,column:this.column});this.startLine=this.line,this.startColumn=this.column;var e=this.input[this.pos];if('"'===e||"'"===e)return this.readString(e);if("`"===e)return this.readBacktickString();if(("b"===e||"B"===e)&&this.pos+1<this.input.length){var t=this.input[this.pos+1];if('"'===t||"'"===t)return this.readByteLiteral()}return this.isDigit(e)||"."===e&&this.pos+1<this.input.length&&this.isDigit(this.input[this.pos+1])?this.readNumber():this.isIdentStart(e)?this.readIdentOrKeyword():this.readOperatorOrBracket()},t.skipWhitespace=function(){for(;this.pos<this.input.length;){var e=this.input[this.pos];if(" "===e||"\t"===e||"\r"===e)this.pos++,this.column++;else{if("\n"!==e)break;this.pos++,this.line++,this.column=1}}},t.skipComments=function(){for(;this.pos<this.input.length;)if("/"===this.input[this.pos]&&this.pos+1<this.input.length&&"/"===this.input[this.pos+1]){for(this.pos+=2,this.column+=2;this.pos<this.input.length&&"\n"!==this.input[this.pos];)this.pos++,this.column++;this.skipWhitespace()}else{if(!("/"===this.input[this.pos]&&this.pos+1<this.input.length&&"*"===this.input[this.pos+1]))break;for(this.pos+=2,this.column+=2;this.pos<this.input.length;){if("*"===this.input[this.pos]&&this.pos+1<this.input.length&&"/"===this.input[this.pos+1]){this.pos+=2,this.column+=2;break}"\n"===this.input[this.pos]?(this.line++,this.column=1):this.column++,this.pos++}this.skipWhitespace()}},t.readString=function(e){var t=this.pos;this.pos++,this.column++;for(var n="";this.pos<this.input.length;){var r=this.input[this.pos];if("\\"===r){if(this.pos+1>=this.input.length)break;var i=this.input[this.pos+1];switch(i){case"n":n+="\n";break;case"t":n+="\t";break;case"r":n+="\r";break;case"\\":n+="\\";break;case e:n+=e;break;case"x":var a=this.input.substr(this.pos+2,2);n+=String.fromCharCode(parseInt(a,16)),this.pos+=2,this.column+=2;break;case"u":var s=this.input.substr(this.pos+2,4);n+=String.fromCharCode(parseInt(s,16)),this.pos+=2,this.column+=2;break;default:n+=i}this.pos+=2,this.column+=2}else{if(r===e)return this.pos++,this.column++,this.makeToken(Fe.String,n,t);n+=r,this.pos++,this.column++,"\n"===r&&(this.line++,this.column=1)}}return this.makeToken(Fe.String,n,t)},t.readBacktickString=function(){var e=this.pos;this.pos++,this.column++;for(var t="";this.pos<this.input.length;){var n=this.input[this.pos];if("`"===n)return this.pos++,this.column++,this.makeToken(Fe.String,t,e);t+=n,this.pos++,"\n"===n?(this.line++,this.column=1):this.column++}return this.makeToken(Fe.String,t,e)},t.readByteLiteral=function(){var e=this.pos;this.pos++,this.column++;var t=this.input[this.pos];this.pos++,this.column++;for(var n="";this.pos<this.input.length;){var r=this.input[this.pos];if("\\"===r){if(this.pos+1>=this.input.length)break;var i=this.input[this.pos+1];switch(i){case"n":n+="\n";break;case"t":n+="\t";break;case"r":n+="\r";break;case"\\":n+="\\";break;case t:n+=t;break;case"x":var a=this.input.substr(this.pos+2,2);n+=String.fromCharCode(parseInt(a,16)),this.pos+=2,this.column+=2;break;default:if(this.isDigit(i)){var s=this.input.substr(this.pos+1,3);n+=String.fromCharCode(parseInt(s,8)),this.pos+=2,this.column+=2;break}n+=i}this.pos+=2,this.column+=2}else{if(r===t)return this.pos++,this.column++,this.makeToken(Fe.String,n,e);n+=r,this.pos++,this.column++}}return this.makeToken(Fe.String,n,e)},t.readNumber=function(){for(var e=this.pos,t="";this.pos<this.input.length;){var n=this.input[this.pos];if(!(this.isDigit(n)||"."===n||"e"===n||"E"===n||"+"===n||"-"===n||"_"===n||"x"===n||"X"===n||"o"===n||"O"===n||"b"===n||"B"===n||n>="a"&&n<="f"||n>="A"&&n<="F"))break;t+=n,this.pos++,this.column++}return this.makeToken(Fe.Number,t,e)},t.readIdentOrKeyword=function(){for(var e=this.pos,t="";this.pos<this.input.length;){var n=this.input[this.pos];if(!this.isIdentPart(n))break;t+=n,this.pos++,this.column++}return ut.has(t)?this.makeToken(Fe.Operator,t,e):this.makeToken(Fe.Identifier,t,e)},t.readOperatorOrBracket=function(){var e=this.pos,t=this.input[this.pos];if("()[]{}".includes(t))return this.pos++,this.column++,this.makeToken(Fe.Bracket,t,e);var n=this.input.substr(this.pos,2),r=this.input.substr(this.pos,3);return["...","<<=",">>="].includes(r)?(this.pos+=3,this.column+=3,this.makeToken(Fe.Operator,r,e)):["==","!=","<=",">=","&&","||","??","?.","..","**","//","::","->"].includes(n)?(this.pos+=2,this.column+=2,this.makeToken(Fe.Operator,n,e)):("+-*/%^=<>!&|?.,;:#@$~".includes(t),this.pos++,this.column++,this.makeToken(Fe.Operator,t,e))},t.isDigit=function(e){return e>="0"&&e<="9"},t.isIdentStart=function(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||"$"===e},t.isIdentPart=function(e){return this.isIdentStart(e)||this.isDigit(e)},t.makeToken=function(e,t,n){return{kind:e,value:t,start:n,end:this.pos,line:this.startLine,column:this.startColumn}},e}(),dt=new(function(){function e(){this.current=g({},at),this.errors=[],this.lexer=new ct}var t=e.prototype;return t.parse=function(e){return this.errors=[],this.lexer.reset(e),this.advance(),0===e.trim().length?[]:(this.parseSequenceExpression(),this.curKind()!==Fe.EOF&&0===this.errors.length&&this.error('unexpected token "'+this.curVal()+'"'),this.errors)},t.advance=function(){this.current=this.lexer.next()},t.curKind=function(){return this.current.kind},t.curVal=function(){return this.current.value},t.expect=function(e,t){return this.curKind()!==e||void 0!==t&&this.curVal()!==t?(this.error(t?'expected "'+t+'" but got "'+this.curVal()+'"':'unexpected token "'+this.curVal()+'"'),!1):(this.advance(),!0)},t.error=function(e){if(0===this.errors.length){var t=this.current.line,n=this.current.column+this.curVal().length;this.errors.push({message:e,startLine:this.current.line,startColumn:this.current.column,endLine:t,endColumn:n})}},t.errorAt=function(e,t){0===this.errors.length&&this.errors.push({message:t,startLine:e.line,startColumn:e.column,endLine:e.line,endColumn:e.column+e.value.length})},t.parseSequenceExpression=function(){if(!(this.errors.length>0))for(this.parseExpression(0);";"===this.curVal()&&0===this.errors.length&&(this.advance(),this.curKind()!==Fe.EOF);)this.parseExpression(0)},t.parseExpression=function(e){if(!(this.errors.length>0))if(0!==e||"let"!==this.curVal())if(0!==e||"if"!==this.curVal()){if(ot.has(this.curVal())&&this.curKind()===Fe.Operator){var t=this.current;if(this.advance(),this.curKind()===Fe.EOF)return void this.errorAt(t,"unexpected token EOF");if(this.errors.length>0)return;if(this.parsePrimary(),this.errors.length>0)return;this.parsePostfixExpression()}else if(this.parsePrimary(),!(this.errors.length>0||(this.parsePostfixExpression(),this.errors.length>0))){for(;this.curKind()===Fe.Operator&&0===this.errors.length;){var n=this.curVal(),r=this.current;if("|"===n){if(this.advance(),this.curKind()===Fe.EOF)return void this.errorAt(r,"unexpected token EOF");if(this.curKind()===Fe.Identifier){if(this.advance(),this.parseArguments(),";"===this.curVal())break;continue}return void this.error('expected identifier after pipe "|" but got "'+this.curVal()+'"')}if(";"===n)break;var i=st[n];if(void 0===i||i<e)break;if("not"===n){this.advance();var a=this.curVal(),s=st[a];if(void 0!==s&&s>=e){this.advance(),this.parseExpression(s+1);continue}return void this.error('unexpected token "'+a+'" after "not"')}if(lt.has(n)){if(this.advance(),this.curKind()===Fe.EOF)return void this.errorAt(r,"unexpected token EOF");for(this.parseExpression(i+1);this.curKind()===Fe.Operator&<.has(this.curVal())&&0===this.errors.length;){var o=this.current;if(this.advance(),this.curKind()===Fe.EOF)return void this.errorAt(o,"unexpected token EOF");this.parseExpression((st[this.curVal()]||0)+1)}}else{if(this.advance(),this.curKind()===Fe.EOF)return void this.errorAt(r,"unexpected token EOF");this.parseExpression(i+1),0===e&&"?"===this.curVal()&&this.parseConditional()}}0===e&&"?"===this.curVal()&&this.parseConditional()}}else this.parseConditionalIf();else this.parseVariableDeclaration()},t.parsePrimary=function(){if(!(this.errors.length>0))return this.curKind()===Fe.Bracket&&"("===this.curVal()?(this.advance(),this.parseSequenceExpression(),void this.expect(Fe.Bracket,")")):"#"!==this.curVal()&&"."!==this.curVal()||this.curKind()!==Fe.Operator?void this.parseSecondary():(this.advance(),this.curKind()===Fe.Identifier&&this.advance(),void this.parsePostfixExpression())},t.parseSecondary=function(){if(!(this.errors.length>0)){var e=this.current;switch(e.kind){case Fe.Identifier:this.advance(),this.curKind()===Fe.Bracket&&"("===this.curVal()&&this.parseArguments();break;case Fe.Number:case Fe.String:this.advance();break;case Fe.Bracket:"["===e.value?this.parseArrayExpression():"{"===e.value?this.parseMapExpression():this.error('unexpected token "'+e.value+'"');break;default:this.error('unexpected token "'+e.value+'"')}}},t.parsePostfixExpression=function(){for(;0===this.errors.length;){var e=this.current;if(e.kind!==Fe.Operator||"."!==e.value&&"?."!==e.value)if(e.kind!==Fe.Bracket||"["!==e.value){if(e.kind!==Fe.Bracket||"("!==e.value)break;this.parseArguments()}else this.advance(),this.curKind()===Fe.Operator&&":"===this.curVal()?(this.advance(),this.curKind()===Fe.Bracket&&"]"===this.curVal()||this.parseExpression(0),this.expect(Fe.Bracket,"]")):(this.parseExpression(0),this.curKind()===Fe.Operator&&":"===this.curVal()&&(this.advance(),this.curKind()===Fe.Bracket&&"]"===this.curVal()||this.parseExpression(0)),this.expect(Fe.Bracket,"]"));else if(this.advance(),this.curKind()===Fe.Identifier||this.curKind()===Fe.Operator)this.advance(),this.curKind()===Fe.Bracket&&"("===this.curVal()&&this.parseArguments();else{if(this.curKind()!==Fe.Bracket||"["!==this.curVal()||"?."!==e.value)return void this.error('expected property name after "'+e.value+'" but got "'+this.curVal()+'"');this.advance(),this.parseExpression(0),this.expect(Fe.Bracket,"]")}}},t.parseVariableDeclaration=function(){this.expect(Fe.Operator,"let"),this.errors.length>0||(this.curKind()===Fe.Identifier?(this.advance(),this.expect(Fe.Operator,"=")&&(this.parseExpression(0),this.errors.length>0||";"===this.curVal()&&(this.advance(),this.curKind()!==Fe.EOF&&this.parseSequenceExpression()))):this.error('expected variable name after "let" but got "'+this.curVal()+'"'))},t.parseConditionalIf=function(){this.advance(),this.errors.length>0||(this.parseExpression(0),this.errors.length>0||this.expect(Fe.Bracket,"{")&&(this.parseSequenceExpression(),this.errors.length>0||this.expect(Fe.Bracket,"}")&&this.expect(Fe.Operator,"else")&&("if"!==this.curVal()?this.expect(Fe.Bracket,"{")&&(this.parseSequenceExpression(),this.errors.length>0||this.expect(Fe.Bracket,"}")):this.parseConditionalIf())))},t.parseConditional=function(){if("?"===this.curVal()){if(this.advance(),":"===this.curVal())return this.advance(),void this.parseExpression(0);this.parseExpression(0),this.errors.length>0||this.expect(Fe.Operator,":")&&this.parseExpression(0)}},t.parseArguments=function(){if(this.expect(Fe.Bracket,"(")){for(;this.curKind()!==Fe.Bracket||")"!==this.curVal();){if(this.curKind()===Fe.EOF)return void this.error('unexpected end of expression, expected ")"');if(","!==this.curVal()){if(this.curKind()===Fe.Bracket&&"{"===this.curVal()?(this.advance(),this.parseSequenceExpression(),this.expect(Fe.Bracket,"}")):this.parseExpression(0),this.errors.length>0)return;if(","===this.curVal()&&(this.advance(),this.curKind()===Fe.Bracket&&")"===this.curVal()))break}else this.advance()}this.expect(Fe.Bracket,")")}},t.parseArrayExpression=function(){if(this.expect(Fe.Bracket,"["),!(this.errors.length>0))if(this.curKind()!==Fe.Bracket||"]"!==this.curVal()){for(;0===this.errors.length;){if(this.parseExpression(0),this.errors.length>0)return;if(this.curKind()===Fe.Bracket&&"]"===this.curVal())break;if(","!==this.curVal())return void this.error('expected "," or "]" but got "'+this.curVal()+'"');if(this.advance(),this.curKind()===Fe.Bracket&&"]"===this.curVal())break}this.expect(Fe.Bracket,"]")}else this.advance()},t.parseMapExpression=function(){if(this.expect(Fe.Bracket,"{"),!(this.errors.length>0))if(this.curKind()!==Fe.Bracket||"}"!==this.curVal()){for(;0===this.errors.length;){if(this.curKind()===Fe.Identifier||this.curKind()===Fe.String||this.curKind()===Fe.Number)this.advance();else{if(this.curKind()!==Fe.Bracket||"("!==this.curVal())return void this.error('map key must be a string, number, identifier, or parenthesized expression, got "'+this.curVal()+'"');this.advance(),this.parseExpression(0),this.expect(Fe.Bracket,")")}if(!this.expect(Fe.Operator,":"))return;if(this.parseExpression(0),this.errors.length>0)return;if(this.curKind()===Fe.Bracket&&"}"===this.curVal())break;if(","!==this.curVal())return void this.error('expected "," or "}" but got "'+this.curVal()+'"');if(this.advance(),this.curKind()===Fe.Bracket&&"}"===this.curVal())break}this.expect(Fe.Bracket,"}")}else this.advance()},e}()),mt={small:{className:"ant-input-sm",top:1,bottom:1,minHeight:24},middle:{className:"ant-input-md",top:1,bottom:1,minHeight:32},large:{className:"ant-input-lg",top:3,bottom:2,minHeight:40}},ht={light:"expr-light",dark:"expr-dark"},pt=l.css(rt||(rt=x(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"]))),gt=l.css(it||(it=x(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));exports.ExprMonacoEditor=function(e){var a=o.v4(),s=e.className,l=e.maxHeight,u=e.fontSize,c=e.size,d=void 0===c?"middle":c,m=e.theme,h=void 0===m?"light":m,g=e.value,f=void 0===g?"":g,v=e.placeholder,b=e.enableAutocomplete,y=void 0===b||b,_=e.readOnly,x=void 0!==_&&_,k=e.disabled,E=void 0!==k&&k,C=e.onChange,w=e.onEnter,N=e.onBlur,T=e.onFocus,L=e.editorDidMount,S=t.useRef(null),R=t.useRef(null),O=t.useRef(null),I=t.useRef([]);return t.useEffect((function(){if(i.languages.getLanguages().some((function(e){return"expr"===e.id}))||(i.languages.register({id:"expr"}),i.languages.setMonarchTokensProvider("expr",et),i.languages.setLanguageConfiguration("expr",Xe)),y){var e=i.languages.registerCompletionItemProvider("expr",{provideCompletionItems:function(e,t,n,r){var a=e.getWordUntilPosition(t),s=new i.Range(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn);return{suggestions:[].concat(tt.map((function(e){return{label:e,kind:i.languages.CompletionItemKind.Keyword,insertText:e,range:s,sortText:"1"+e}})),nt.map((function(e){return{label:e.name,kind:i.languages.CompletionItemKind.Function,insertText:e.name,detail:e.signature,documentation:e.description+" ("+e.category+")",range:s,sortText:"2"+e.name,insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet}})))}}});I.current.push(e)}return function(){I.current.forEach((function(e){return e.dispose()})),I.current=[]}}),[y]),n.createElement("div",{className:"ant-input"+(d?" "+mt[d].className:"")+(E?" ant-input-disabled "+pt:"")+(x?" "+gt:"")+(s?" "+s:""),style:{display:"block",resize:"vertical",overflow:"auto",minHeight:mt[d].minHeight,maxHeight:l}},n.createElement("div",{ref:S,style:{height:"100%"}},n.createElement(r,{language:"expr",theme:ht[h],value:f,onChange:function(e,t){null==C||C(e)},options:{placeholder:v,selectOnLineNumbers:!0,fontSize:u||12,roundedSelection:!1,scrollBeyondLastLine:!1,readOnly:x||E,minimap:{enabled:!1},lineNumbers:"off",lineNumbersMinChars:0,glyphMargin:!1,folding:!1,lineDecorationsWidth:0,overviewRulerLanes:0,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,hover:{enabled:!0,delay:200},fixedOverflowWidgets:!0,renderLineHighlight:"none",renderValidationDecorations:"on",scrollbar:{vertical:"hidden",horizontal:"auto"},automaticLayout:!0,wordWrap:"on"},editorDidMount:function(e){R.current=e,O.current=e.getModel(),i.editor.defineTheme("expr-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}}),i.editor.defineTheme("expr-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}});var t=e.createContextKey("isEditorFocused"+a,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==N||N(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0),null==T||T(e.getValue())}));var n=function(){var t=S.current;if(null!==t){var n=e.getContentHeight();t.style.minHeight=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+a),i.editor.addKeybindingRule({keybinding:i.KeyCode.Enter,command:"-",when:"!suggestWidgetVisible"}),e.addCommand(i.KeyCode.Enter,(function(){null==w||w(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+a);var r=e.getModel(),s=[];if(r){var o=function(){var e=function(e){var t=[];if(!e||0===e.trim().length)return t;for(var n,r=p(dt.parse(e));!(n=r()).done;){var a=n.value;t.push({severity:i.MarkerSeverity.Error,startLineNumber:a.startLine,startColumn:a.startColumn,endLineNumber:a.endLine,endColumn:a.endColumn,message:a.message})}var s=function(e){var t=[],n=e.split("\n"),r=!1;return n.forEach((function(e,n){var a=n+1;if(r){if(-1!==e.indexOf("*/")&&(r=!1),r||e.trim().startsWith("/*"))return}else{var s=e.indexOf("/*");-1!==s&&-1===e.indexOf("*/",s+2)&&(r=!0)}var o=e.trim();if(!o.startsWith("//")&&!o.startsWith("/*")){(function(e){return(e.replace(/\/\*[\s\S]*?\*\//g,"").match(/'/g)||[]).length})(e)%2!=0&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unclosed single quote '",source:"expr"}),function(e){return(e.replace(/\/\*[\s\S]*?\*\//g,"").match(/"/g)||[]).length}(e)%2!=0&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:'Unclosed double quote "',source:"expr"}),(e.match(/`/g)||[]).length%2!=0&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unclosed backtick `",source:"expr"});var l=(e.match(/\(/g)||[]).length,u=(e.match(/\)/g)||[]).length;l>u?t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched opening parenthesis",source:"expr"}):u>l&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched closing parenthesis",source:"expr"});var c=(e.match(/\[/g)||[]).length,d=(e.match(/\]/g)||[]).length;c>d?t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched opening bracket",source:"expr"}):d>c&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched closing bracket",source:"expr"});var m=(e.match(/\{/g)||[]).length,h=(e.match(/\}/g)||[]).length;m>h?t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched opening curly brace",source:"expr"}):h>m&&t.push({severity:i.MarkerSeverity.Warning,startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:e.length+1,message:"Unmatched closing curly brace",source:"expr"})}})),t}(e);return t.push.apply(t,s),t}(r.getValue()).map((function(e){return{range:new i.Range(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),options:{className:"expr-error-squiggly",hoverMessage:{value:e.message},minimap:{color:"#e51400",position:1},overviewRuler:{color:"#e51400",position:i.editor.OverviewRulerLane.Right}}}}));s=r.deltaDecorations(s,e)},l=r.onDidChangeContent(o);I.current.push(l),o()}var u=document.createElement("style");u.textContent="\n .expr-error-squiggly {\n background: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' preserveAspectRatio='none'%3E%3Cpath d='M0,2.5 L1.5,1 L3,2.5 L4.5,1 L6,2.5' stroke='%23e51400' stroke-width='0.6' fill='none'/%3E%3C/svg%3E\") repeat-x left bottom;\n background-size: 6px 3px;\n padding-bottom: 3px;\n }\n ",document.head.appendChild(u),I.current.push({dispose:function(){return u.remove()}}),null==L||L(e)}})))},exports.PromQLMonacoEditor=function(e){var u=o.v4(),c=e.className,d=e.size,m=void 0===d?"middle":d,h=e.theme,f=void 0===h?"light":h,v=e.value,b=e.placeholder,y=e.interpolateString,_=e.enableAutocomplete,x=void 0===_||_,k=e.enableRequests,E=void 0===k||k,w=e.readOnly,N=void 0!==w&&w,T=e.disabled,L=void 0!==T&&T,S=e.onChange,R=e.onEnter,O=e.onBlur,I=e.editorDidMount,A=t.useRef(null),B=t.useRef(null),q=t.useRef(null),F=t.useRef(null),V=t.useRef(""),K=t.useRef(0),D=function(e){return{placeholder:l.css({"::after":{content:"'"+e+"'",opacity:.6}})}}(b);return t.useEffect((function(){return i.languages.register({id:Ne,aliases:a.promLanguageDefinition.aliases,extensions:a.promLanguageDefinition.extensions,mimetypes:a.promLanguageDefinition.mimetypes}),i.languages.setMonarchTokensProvider(Ne,M),i.languages.setLanguageConfiguration(Ne,C),function(){null==A.current||A.current(),q.current=null}}),[]),t.useEffect((function(){var t=F.current;if(t){if(A.current&&(A.current(),A.current=null),q.current=null,x){var n=new U({url:e.url,lookbackInterval:e.lookbackInterval,variablesNames:e.variablesNames,durationVariablesCompletion:e.durationVariablesCompletion,request:e.request,httpMethod:e.httpMethod,apiPrefix:e.apiPrefix,httpErrorHandler:e.httpErrorHandler,enableRequests:E});q.current=n,n.start();var r=function(e,t){return{triggerCharacters:["{",",","[","(","=","~"," ",'"'],provideCompletionItems:function(n,r){var i=n.getWordAtPosition(r),a=null!=i?e.Range.lift({startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:i.startColumn,endColumn:i.endColumn}):e.Range.fromPositions(r),o={column:r.column,lineNumber:r.lineNumber};if(t.monacoSettings.setInputInRange(n.getValueInRange(a)),window.getSelection){var l,u=null==(l=window.getSelection())?void 0:l.toString();u&&u.length>0&&(o.column=o.column-u.length)}var c=n.getOffsetAt(o),d=function(e,t){if(""===e)return{type:"EMPTY"};if(function(e,t){var n=e.match(/^with\s*\(/i);if(!n)return!1;var r=function(e,t){for(var n=0,r=t;r<e.length;r++)if("("===e[r]&&n++,")"===e[r]&&0==--n)return r;return-1}(e,n[0].length-1);return-1!==r&&t>r}(e,t))return{type:"IN_WITH_BODY"};for(var n=s.parser.parse(e),r=function(e,t){for(var n=e.cursorAt(t);;){if(n.from===t&&n.to===t){var r=n.node;if(r.type.isError)return r}if(!n.next())break}return null}(n,t),i=null!=r?r.cursor():n.cursorAt(t),a=i.node,o=[i.type.id];i.parent();)o.push(i.type.id);for(var l,u=p(j);!(l=u()).done;){var c=l.value;if(z(c.path,o))return c.fun(a,e,t)}return null}(n.getValue(),c);return(null!=d?function(e,t){switch(e.type){case"IN_DURATION":return Promise.resolve(t.durationVariablesCompletion?le.concat(oe):oe);case"IN_FUNCTION":return ie(t);case"IN_WITH_BODY":case"AT_ROOT":return ie(t);case"EMPTY":var n=ne(t);return Promise.resolve([].concat([],[se],re,n));case"IN_LABEL_SELECTOR_NO_LABEL_NAME":return function(e,t,n,r){return he.apply(this,arguments)}(e.metricName,e.hasOperator,e.otherLabels,t);case"IN_GROUPING":return function(e,t,n){return pe.apply(this,arguments)}(e.metricName,e.otherLabels,t);case"IN_LABEL_SELECTOR_WITH_LABEL_NAME":return function(e,t,n,r,i){return ve.apply(this,arguments)}(e.metricName,e.labelName,e.betweenQuotes,e.otherLabels,t);default:throw new P(e)}}(d,t):Promise.resolve([])).then((function(i){var s=i.length.toString().length,o=a;if(d&&"IN_LABEL_SELECTOR_WITH_LABEL_NAME"===d.type&&d.betweenQuotes){var l=n.getPositionAt(d.valueStartPos);o=e.Range.lift({startLineNumber:l.lineNumber,endLineNumber:r.lineNumber,startColumn:l.column,endColumn:r.column})}return{suggestions:i.map((function(t,n){return{kind:be(t.type,e),label:t.label,insertText:t.insertText,detail:t.detail,documentation:t.documentation,sortText:n.toString().padStart(s,"0"),range:o,command:t.triggerOnInsert?{id:"editor.action.triggerSuggest",title:""}:void 0}})),incomplete:t.monacoSettings.suggestionsIncomplete}}))}}}(i,n),a=g({},r,{provideCompletionItems:function(e,n,i,a){var s;return(null==(s=t.getModel())?void 0:s.id)!==e.id?{suggestions:[]}:r.provideCompletionItems(e,n,i,a)}}),o=i.languages.registerCompletionItemProvider(Ne,a);A.current=o.dispose}var l=t.getModel();if(l&&l.deltaDecorations(l.getAllDecorations().map((function(e){return e.id})),[]),b){var u=[{range:new i.Range(1,1,1,1),options:{className:D.placeholder,isWholeLine:!0}}],c=[],d=function(){var e=t.getModel();if(e){var n=0===e.getValueLength()?u:[];c=e.deltaDecorations(c,n)}};d(),t.onDidChangeModelContent(d)}}}),[x,e.url,e.lookbackInterval,JSON.stringify(e.variablesNames),e.durationVariablesCompletion,e.httpMethod,e.apiPrefix,b,E]),n.createElement("div",{className:"ant-input"+(m?" "+Te[m].className:"")+(L?" ant-input-disabled "+Se:"")+(N?" "+Re:"")+(c?" "+c:"")},n.createElement("div",{ref:B},n.createElement(r,{width:"100%",height:"100%",language:"promql",theme:Le[f],value:v,onChange:S,editorDidMount:function(e){F.current=e,i.editor.defineTheme("n9e-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}}),i.editor.defineTheme("n9e-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000",focusBorder:"#00000000"}});var t=e.createContextKey("isEditorFocused"+u,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==O||O(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0)}));var n=function(){var t=B.current;if(null!==t){var n=e.getContentHeight();t.style.height=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+u),i.editor.addKeybindingRule({keybinding:i.KeyCode.Enter,command:"-",when:"!suggestWidgetVisible"}),e.addCommand(i.KeyCode.Enter,(function(){null==R||R(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+u),V.current=e.getValue(),K.current=0,e.onDidChangeModelContent((function(){var t=e.getModel();if(t){var n=t.getValue(),r=(function(e,t,n,r){if(!e)return!1;var i=ye(t,r);if(!i.length)return!1;var a=i;if(e!==t){var s=ye(e,r);a=i.flatMap((function(e){return s.filter((function(t){return e.text===t.text}))||e}))}return a.map((function(t){return function(e,t,n){if(1===t.length){var r=n.node.from===n.node.to,i=r&&n.node.parent?n.node.parent:n.node,a=r?e.substring(i.from,i.to):n.text;return{startLineNumber:1,startColumn:i.from+1,endLineNumber:1,endColumn:i.to+1,error:a}}for(var s=0,o=0;o<t.length;o++){if(!(n.node.from>s+t[o].length))return{startLineNumber:o+1,startColumn:n.node.from-s+1,endLineNumber:o+1,endColumn:n.node.to-s+1,error:n.text};s+=t[o].length+1}return null}(e,n,t)})).filter(_e)}(n,y?y(n):n,t.getLinesContent(),s.parser)||[]).map((function(e){var t=e.error,n=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,we);return g({message:(t?'Error parsing "'+t+'"':"Parse error")+". The query appears to be incorrect and could fail to be executed.",severity:i.MarkerSeverity.Error},n)}));if(i.editor.setModelMarkers(t,"owner",r),n.length<V.current.length&&x){var a=Date.now();a-K.current>=1e3&&(K.current=a,setTimeout((function(){e.trigger("keyboard","editor.action.triggerSuggest",{})}),0))}V.current=n}})),null==I||I(e)},options:{readOnly:N,codeLens:!1,contextmenu:!1,fixedOverflowWidgets:!0,folding:!1,fontSize:12,lineDecorationsWidth:0,lineNumbers:"off",minimap:{enabled:!1},overviewRulerBorder:!1,overviewRulerLanes:0,padding:{top:Te[m].top,bottom:Te[m].bottom},renderLineHighlight:"none",scrollbar:{vertical:"hidden",verticalScrollbarSize:8,horizontal:"hidden",horizontalScrollbarSize:0,alwaysConsumeMouseWheel:!1},scrollBeyondLastLine:!1,suggest:{showWords:!1,filterGraceful:!1,snippetsPreventQuickSuggestions:!1,shareSuggestSelections:!1},suggestFontSize:12,wordWrap:"on",automaticLayout:!0,occurrencesHighlight:"off"}})))},exports.SqlMonacoEditor=Ze,exports.YamlMonacoEditor=function(e){var a=o.v4(),s=e.size,u=void 0===s?"middle":s,c=e.theme,d=void 0===c?"light":c,m=e.value,h=e.placeholder,f=e.enableAutocomplete,v=void 0===f||f,b=e.readOnly,y=void 0!==b&&b,_=e.disabled,x=void 0!==_&&_,k=e.schemas,E=void 0===k?[]:k,C=e.onChange,w=e.onEnter,N=e.onBlur,T=e.editorDidMount,L=t.useRef(null),S=t.useRef(null),R=t.useRef(null),O=function(e){return{placeholder:l.css({"::after":{content:"'"+e+"'",opacity:.6}})}}(h);return t.useEffect((function(){return i.languages.register({id:"yaml",aliases:["YAML","yaml"],extensions:[".yaml",".yml"],mimetypes:["application/x-yaml","text/x-yaml"]}),i.languages.setMonarchTokensProvider("yaml",Ie),i.languages.setLanguageConfiguration("yaml",Oe),function(){null==L.current||L.current()}}),[]),t.useEffect((function(){var e=R.current;if(e){if(L.current&&(L.current(),L.current=null),v){var t=function(e,t){void 0===t&&(t=[]);var n=function(e,t,n){void 0===n&&(n=[]);var i=[];if(!e||!e.properties)return i;if(0===n.length){var a=e.properties[t];return a&&a.enum?r(a):i}for(var s,o=e,l=p(n);!(s=l()).done;){var u=s.value;if(!o.properties||!o.properties[u])return i;"array"===(o=o.properties[u]).type&&o.items&&(o=o.items)}if(o.properties&&o.properties[t]){var c=o.properties[t];if(c.enum)return r(c)}return i},r=function(e){var t=[];return e.enum?(e.enum.forEach((function(n,r){var i=e.description||"Enum value: "+n;e.enumDescriptions&&e.enumDescriptions[r]&&(i=e.enumDescriptions[r]),t.push({label:n,insertText:n,detail:i,documentation:i,type:"VALUE"})})),t):t},i=function(e,t){void 0===t&&(t=[]);for(var n,r=[],i=e,a=p(t);!(n=a()).done;){var s=n.value;if(!i.properties||!i.properties[s])return r;"array"===(i=i.properties[s]).type&&i.items&&(i=i.items)}if(i.properties)for(var o=0,l=Object.entries(i.properties);o<l.length;o++){var u=l[o],c=u[0],d=u[1],m=c+": ",h=!1;"object"===d.type?(m=c+":\n ",h=!0):"array"===d.type?(m=c+":\n - ",h=!0):(d.enum&&d.enum.length>0||"boolean"===d.type||"number"===d.type)&&(h=!0),r.push({label:c,insertText:m,detail:d.description||"Property: "+c,documentation:d.description,type:"KEY",triggerOnInsert:h})}return r},a=function(e,t,n){if(void 0===n&&(n=[]),!e||!e.properties)return null;if(0===n.length){var r=e.properties[t];return r?r.type:null}for(var i,a=e,s=p(n);!(i=s()).done;){var o=i.value;if(!a.properties||!a.properties[o])return null;"array"===(a=a.properties[o]).type&&a.items&&(a=a.items)}return a.properties&&a.properties[t]?a.properties[t].type:null},s=function(e,r){var s=e.getWordAtPosition(r),l=s?s.word:"",u=function(e,t){var n=e.getLineContent(t.lineNumber),r=t.column,i=n.substring(0,r-1),a=n.trim(),s=i.indexOf(":"),o=-1!==s,l=!1,u=null;if(o){var c=i.substring(0,s).trim();c.startsWith("- ")?c=c.substring(2).trim():"-"===c&&(c=""),u=c;var d=i.substring(s+1);l=0===d.length||/^\s+$/.test(d)}var m=a.includes(":")&&!a.endsWith(":")&&a.split(":")[1].trim().length>0;return{isInKeyPosition:!o||a.endsWith(":"),isInValuePosition:l&&!m,isAtEndOfCompletedValue:m,currentKey:u,line:a,beforeCursor:i,afterCursor:n.substring(r-1)}}(e,r),c=o(e,r),d=[];if(u.isAtEndOfCompletedValue)return[];if(u.isInValuePosition&&u.currentKey){var m=function(e,r){void 0===r&&(r=[]);for(var i,a=[],s=p(t);!(i=s()).done;){var o=n(i.value.schema,e,r);a.push.apply(a,o)}return a}(u.currentKey,c);if(m.length>0)d.push.apply(d,m);else{var h=function(e,n){void 0===n&&(n=[]);for(var r,i=p(t);!(r=i()).done;){var s=a(r.value.schema,e,n);if(s)return s}return null}(u.currentKey,c);"boolean"===h?d.push({label:"true",insertText:"true",detail:"Boolean true value",type:"BOOLEAN"},{label:"false",insertText:"false",detail:"Boolean false value",type:"BOOLEAN"}):"number"===h&&d.push({label:"0",insertText:"0",detail:"Number value",type:"NUMBER"})}}else if(u.isInKeyPosition&&!u.isInValuePosition){var g=function(e){void 0===e&&(e=[]);for(var n,r=[],a=new Set,s=p(t);!(n=s()).done;)for(var o,l=p(i(n.value.schema,e));!(o=l()).done;){var u=o.value;a.has(u.label)||(a.add(u.label),r.push(u))}return r}(c);d.push.apply(d,g)}return d.filter((function(e){return!l||e.label.toLowerCase().includes(l.toLowerCase())}))},o=function(e,t){var n=[],r=e.getLinesContent(),i=t.lineNumber-1;if(i>=r.length)return n;for(var a=l(r[i]),s=i;s>=0;s--){var o=r[s],u=l(o),c=o.trim();if(c&&!c.startsWith("#")&&u<a){if(c.startsWith("-")){a=u;continue}if(c.includes(":")){var d=c.split(":")[0].trim();d&&(n.unshift(d),a=u)}}}return n},l=function(e){return e.length-e.trimLeft().length};return{triggerCharacters:[":"," ","-","\n","\t"],provideCompletionItems:function(t,n){var r=t.getWordAtPosition(n),i=null!=r?e.Range.lift({startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn}):e.Range.fromPositions(n);return{suggestions:s(t,n).map((function(t,n){return{kind:Ae(t.type,e),label:t.label,insertText:t.insertText,detail:t.detail,documentation:t.documentation,sortText:n.toString().padStart(3,"0"),range:i,command:t.triggerOnInsert?{id:"editor.action.triggerSuggest",title:""}:void 0}}))}}}}(i,E),n=g({},t,{provideCompletionItems:function(n,r,i,a){var s;return(null==(s=e.getModel())?void 0:s.id)!==n.id?{suggestions:[]}:t.provideCompletionItems(n,r,i,a)}}),r=i.languages.registerCompletionItemProvider("yaml",n);L.current=r.dispose}var a=e.getModel();if(a&&a.deltaDecorations(a.getAllDecorations().map((function(e){return e.id})),[]),h){var s=[{range:new i.Range(1,1,1,1),options:{className:O.placeholder,isWholeLine:!0}}],o=[],l=function(){var t=e.getModel();if(t){var n=0===t.getValueLength()?s:[];o=t.deltaDecorations(o,n)}};l(),e.onDidChangeModelContent(l)}}}),[v,JSON.stringify(E),h]),n.createElement("div",{className:"ant-input"+(u?" "+Ve[u].className:"")+(x?" ant-input-disabled "+Ue:"")+(y?" "+De:"")},n.createElement("div",{ref:S},n.createElement(r,{width:"100%",height:"100%",language:"yaml",theme:Ke[d],value:m,onChange:C,editorDidMount:function(e){R.current=e,i.editor.defineTheme("yaml-light",{base:"vs",inherit:!0,rules:[{token:"key",foreground:"0000FF"},{token:"string",foreground:"008000"},{token:"number",foreground:"098658"},{token:"comment",foreground:"008000",fontStyle:"italic"},{token:"delimiter",foreground:"000000"},{token:"tag",foreground:"800080"},{token:"keyword",foreground:"0000FF",fontStyle:"bold"}],colors:{"editor.background":"#00000000",focusBorder:"#00000000","editor.lineHighlightBackground":"#00000000","editor.lineHighlightBorder":"#00000000"}}),i.editor.defineTheme("yaml-dark",{base:"vs-dark",inherit:!0,rules:[{token:"key",foreground:"9CDCFE"},{token:"string",foreground:"CE9178"},{token:"number",foreground:"B5CEA8"},{token:"comment",foreground:"6A9955",fontStyle:"italic"},{token:"delimiter",foreground:"D4D4D4"},{token:"tag",foreground:"C586C0"},{token:"keyword",foreground:"569CD6",fontStyle:"bold"}],colors:{"editor.background":"#00000000",focusBorder:"#00000000","editor.lineHighlightBackground":"#00000000","editor.lineHighlightBorder":"#00000000"}});var t=e.createContextKey("isEditorFocused"+a,!1);e.onDidBlurEditorWidget((function(){t.set(!1),null==N||N(e.getValue());var n=e.getPosition();if(n){var r=new i.Selection(n.lineNumber,n.column,n.lineNumber,n.column);e.setSelection(r)}})),e.onDidFocusEditorText((function(){t.set(!0)}));var n=function(){var t=S.current;if(null!==t){var n=Math.max(e.getContentHeight(),20);t.style.height=n+"px",t.style.width="100%",e.layout({width:t.clientWidth,height:n})}};e.onDidContentSizeChange(n),n(),i.editor.addKeybindingRule({keybinding:i.KeyMod.CtrlCmd|i.KeyCode.KeyF,command:null}),e.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,(function(){var t=e.getPosition();t&&(e.executeEdits("shift-enter",[{range:new i.Range(t.lineNumber,t.column,t.lineNumber,t.column),text:"\n"}]),e.setPosition({lineNumber:t.lineNumber+1,column:1}))}),"isEditorFocused"+a),w&&e.addCommand(i.KeyCode.Enter,(function(){w(e.getValue())}),"!suggestWidgetVisible && isEditorFocused"+a),e.onDidChangeModelContent((function(){var t=e.getModel();if(t){var n=function(e,t){void 0===t&&(t=[]);var n=[];if(!e.trim())return n;try{for(var r=e.split("\n"),i=0;i<r.length;i++){var a=r[i],s=i+1;a.trim()&&!Me(a)&&n.push({message:"Invalid indentation. YAML requires consistent indentation.",startLineNumber:s,endLineNumber:s,startColumn:1,endColumn:a.length+1,severity:"error"});var o=a.match(/^(\s*)([^:\s]+)(:)(\S)/);if(o){var l=o[1].length+o[2].length+2;n.push({message:'Missing space after colon. Use ": " instead of ":"',startLineNumber:s,endLineNumber:s,startColumn:l,endColumn:l+1,severity:"error"})}var u=a.match(/^(\s*)-(\S)/);if(u){var c=u[1].length+2;n.push({message:'Missing space after dash. Use "- " instead of "-"',startLineNumber:s,endLineNumber:s,startColumn:c,endColumn:c+1,severity:"error"})}}t.length>0&&n.push.apply(n,[])}catch(e){n.push({message:"YAML parsing error: "+e,startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:1,severity:"error"})}return n}(t.getValue(),E).map((function(e){return{message:e.message,severity:"error"===e.severity?i.MarkerSeverity.Error:"warning"===e.severity?i.MarkerSeverity.Warning:i.MarkerSeverity.Info,startLineNumber:e.startLineNumber,endLineNumber:e.endLineNumber,startColumn:e.startColumn,endColumn:e.endColumn}}));i.editor.setModelMarkers(t,"yaml",n)}})),null==T||T(e)},options:{readOnly:y,codeLens:!1,contextmenu:!1,fixedOverflowWidgets:!0,folding:!0,fontSize:12,lineDecorationsWidth:0,lineNumbers:"on",minimap:{enabled:!1},overviewRulerBorder:!1,overviewRulerLanes:0,padding:{top:Ve[u].top,bottom:Ve[u].bottom},renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!1,hideCursorInOverviewRuler:!0,scrollbar:{vertical:"auto",verticalScrollbarSize:8,horizontal:"auto",horizontalScrollbarSize:8,alwaysConsumeMouseWheel:!1},scrollBeyondLastLine:!1,suggest:{showWords:!0,filterGraceful:!0,snippetsPreventQuickSuggestions:!1,shareSuggestSelections:!1},quickSuggestions:{other:!0,comments:!1,strings:!0},quickSuggestionsDelay:0,suggestFontSize:12,wordWrap:"on",automaticLayout:!0,occurrencesHighlight:"off"}})))};
|
|
2
2
|
//# sourceMappingURL=monaco-editor.cjs.production.min.js.map
|