`):
+ *
+ * ```javascript
+ * var hljs = require('highlight.js') // https://highlightjs.org/
+ *
+ * // Actual default values
+ * var md = require('markdown-it')({
+ * highlight: function (str, lang) {
+ * if (lang && hljs.getLanguage(lang)) {
+ * try {
+ * return '' +
+ * hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
+ * '
';
+ * } catch (__) {}
+ * }
+ *
+ * return '' + md.utils.escapeHtml(str) + '
';
+ * }
+ * });
+ * ```
+ *
+ **/
+function MarkdownIt(presetName, options) {
+ if (!(this instanceof MarkdownIt)) {
+ return new MarkdownIt(presetName, options);
+ }
+ if (!options) {
+ if (!isString(presetName)) {
+ options = presetName || {};
+ presetName = 'default';
+ }
+ }
+
+ /**
+ * MarkdownIt#inline -> ParserInline
+ *
+ * Instance of [[ParserInline]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.inline = new ParserInline();
+
+ /**
+ * MarkdownIt#block -> ParserBlock
+ *
+ * Instance of [[ParserBlock]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.block = new ParserBlock();
+
+ /**
+ * MarkdownIt#core -> Core
+ *
+ * Instance of [[Core]] chain executor. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.core = new Core();
+
+ /**
+ * MarkdownIt#renderer -> Renderer
+ *
+ * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
+ * rules for new token types, generated by plugins.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * function myToken(tokens, idx, options, env, self) {
+ * //...
+ * return result;
+ * };
+ *
+ * md.renderer.rules['my_token'] = myToken
+ * ```
+ *
+ * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs).
+ **/
+ this.renderer = new Renderer();
+
+ /**
+ * MarkdownIt#linkify -> LinkifyIt
+ *
+ * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
+ * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.mjs)
+ * rule.
+ **/
+ this.linkify = new LinkifyIt();
+
+ /**
+ * MarkdownIt#validateLink(url) -> Boolean
+ *
+ * Link validation function. CommonMark allows too much in links. By default
+ * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
+ * except some embedded image types.
+ *
+ * You can change this behaviour:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ * // enable everything
+ * md.validateLink = function () { return true; }
+ * ```
+ **/
+ this.validateLink = validateLink;
+
+ /**
+ * MarkdownIt#normalizeLink(url) -> String
+ *
+ * Function used to encode link url to a machine-readable format,
+ * which includes url-encoding, punycode, etc.
+ **/
+ this.normalizeLink = normalizeLink;
+
+ /**
+ * MarkdownIt#normalizeLinkText(url) -> String
+ *
+ * Function used to decode link url to a human-readable format`
+ **/
+ this.normalizeLinkText = normalizeLinkText;
+
+ // Expose utils & helpers for easy acces from plugins
+
+ /**
+ * MarkdownIt#utils -> utils
+ *
+ * Assorted utility functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.mjs).
+ **/
+ this.utils = utils;
+
+ /**
+ * MarkdownIt#helpers -> helpers
+ *
+ * Link components parser functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
+ **/
+ this.helpers = assign({}, helpers);
+ this.options = {};
+ this.configure(presetName);
+ if (options) {
+ this.set(options);
+ }
+}
+
+/** chainable
+ * MarkdownIt.set(options)
+ *
+ * Set parser options (in the same format as in constructor). Probably, you
+ * will never need it, but you can change options after constructor call.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .set({ html: true, breaks: true })
+ * .set({ typographer, true });
+ * ```
+ *
+ * __Note:__ To achieve the best possible performance, don't modify a
+ * `markdown-it` instance options on the fly. If you need multiple configurations
+ * it's best to create multiple instances and initialize each with separate
+ * config.
+ **/
+MarkdownIt.prototype.set = function (options) {
+ assign(this.options, options);
+ return this;
+};
+
+/** chainable, internal
+ * MarkdownIt.configure(presets)
+ *
+ * Batch load of all options and compenent settings. This is internal method,
+ * and you probably will not need it. But if you will - see available presets
+ * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
+ *
+ * We strongly recommend to use presets instead of direct config loads. That
+ * will give better compatibility with next versions.
+ **/
+MarkdownIt.prototype.configure = function (presets) {
+ const self = this;
+ if (isString(presets)) {
+ const presetName = presets;
+ presets = config[presetName];
+ if (!presets) {
+ throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
+ }
+ }
+ if (!presets) {
+ throw new Error('Wrong `markdown-it` preset, can\'t be empty');
+ }
+ if (presets.options) {
+ self.set(presets.options);
+ }
+ if (presets.components) {
+ Object.keys(presets.components).forEach(function (name) {
+ if (presets.components[name].rules) {
+ self[name].ruler.enableOnly(presets.components[name].rules);
+ }
+ if (presets.components[name].rules2) {
+ self[name].ruler2.enableOnly(presets.components[name].rules2);
+ }
+ });
+ }
+ return this;
+};
+
+/** chainable
+ * MarkdownIt.enable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to enable
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable list or rules. It will automatically find appropriate components,
+ * containing rules with given names. If rule not found, and `ignoreInvalid`
+ * not set - throws exception.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .enable(['sub', 'sup'])
+ * .disable('smartquotes');
+ * ```
+ **/
+MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
+ let result = [];
+ if (!Array.isArray(list)) {
+ list = [list];
+ }
+ ['core', 'block', 'inline'].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.enable(list, true));
+ }, this);
+ result = result.concat(this.inline.ruler2.enable(list, true));
+ const missed = list.filter(function (name) {
+ return result.indexOf(name) < 0;
+ });
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
+ }
+ return this;
+};
+
+/** chainable
+ * MarkdownIt.disable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to disable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * The same as [[MarkdownIt.enable]], but turn specified rules off.
+ **/
+MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
+ let result = [];
+ if (!Array.isArray(list)) {
+ list = [list];
+ }
+ ['core', 'block', 'inline'].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.disable(list, true));
+ }, this);
+ result = result.concat(this.inline.ruler2.disable(list, true));
+ const missed = list.filter(function (name) {
+ return result.indexOf(name) < 0;
+ });
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
+ }
+ return this;
+};
+
+/** chainable
+ * MarkdownIt.use(plugin, params)
+ *
+ * Load specified plugin with given params into current parser instance.
+ * It's just a sugar to call `plugin(md, params)` with curring.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var iterator = require('markdown-it-for-inline');
+ * var md = require('markdown-it')()
+ * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
+ * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
+ * });
+ * ```
+ **/
+MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
+ const args = [this].concat(Array.prototype.slice.call(arguments, 1));
+ plugin.apply(plugin, args);
+ return this;
+};
+
+/** internal
+ * MarkdownIt.parse(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Parse input string and return list of block tokens (special token type
+ * "inline" will contain list of inline tokens). You should not call this
+ * method directly, until you write custom renderer (for example, to produce
+ * AST).
+ *
+ * `env` is used to pass data between "distributed" rules and return additional
+ * metadata like reference info, needed for the renderer. It also can be used to
+ * inject data in specific cases. Usually, you will be ok to pass `{}`,
+ * and then pass updated object to renderer.
+ **/
+MarkdownIt.prototype.parse = function (src, env) {
+ if (typeof src !== 'string') {
+ throw new Error('Input data should be a String');
+ }
+ const state = new this.core.State(src, this, env);
+ this.core.process(state);
+ return state.tokens;
+};
+
+/**
+ * MarkdownIt.render(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Render markdown string into html. It does all magic for you :).
+ *
+ * `env` can be used to inject additional metadata (`{}` by default).
+ * But you will not need it with high probability. See also comment
+ * in [[MarkdownIt.parse]].
+ **/
+MarkdownIt.prototype.render = function (src, env) {
+ env = env || {};
+ return this.renderer.render(this.parse(src, env), this.options, env);
+};
+
+/** internal
+ * MarkdownIt.parseInline(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
+ * block tokens list with the single `inline` element, containing parsed inline
+ * tokens in `children` property. Also updates `env` object.
+ **/
+MarkdownIt.prototype.parseInline = function (src, env) {
+ const state = new this.core.State(src, this, env);
+ state.inlineMode = true;
+ this.core.process(state);
+ return state.tokens;
+};
+
+/**
+ * MarkdownIt.renderInline(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
+ * will NOT be wrapped into `` tags.
+ **/
+MarkdownIt.prototype.renderInline = function (src, env) {
+ env = env || {};
+ return this.renderer.render(this.parseInline(src, env), this.options, env);
+};
+module.exports = MarkdownIt;
+
+/***/ }),
+
+/***/ "../node_modules/mdurl/build/index.cjs.js":
+/*!************************************************!*\
+ !*** ../node_modules/mdurl/build/index.cjs.js ***!
+ \************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+/* eslint-disable no-bitwise */
+const decodeCache = {};
+function getDecodeCache(exclude) {
+ let cache = decodeCache[exclude];
+ if (cache) {
+ return cache;
+ }
+ cache = decodeCache[exclude] = [];
+ for (let i = 0; i < 128; i++) {
+ const ch = String.fromCharCode(i);
+ cache.push(ch);
+ }
+ for (let i = 0; i < exclude.length; i++) {
+ const ch = exclude.charCodeAt(i);
+ cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
+ }
+ return cache;
+}
+
+// Decode percent-encoded string.
+//
+function decode(string, exclude) {
+ if (typeof exclude !== 'string') {
+ exclude = decode.defaultChars;
+ }
+ const cache = getDecodeCache(exclude);
+ return string.replace(/(%[a-f0-9]{2})+/gi, function (seq) {
+ let result = '';
+ for (let i = 0, l = seq.length; i < l; i += 3) {
+ const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
+ if (b1 < 0x80) {
+ result += cache[b1];
+ continue;
+ }
+ if ((b1 & 0xE0) === 0xC0 && i + 3 < l) {
+ // 110xxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ if ((b2 & 0xC0) === 0x80) {
+ const chr = b1 << 6 & 0x7C0 | b2 & 0x3F;
+ if (chr < 0x80) {
+ result += '\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+ i += 3;
+ continue;
+ }
+ }
+ if ((b1 & 0xF0) === 0xE0 && i + 6 < l) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
+ const chr = b1 << 12 & 0xF000 | b2 << 6 & 0xFC0 | b3 & 0x3F;
+ if (chr < 0x800 || chr >= 0xD800 && chr <= 0xDFFF) {
+ result += '\ufffd\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+ i += 6;
+ continue;
+ }
+ }
+ if ((b1 & 0xF8) === 0xF0 && i + 9 < l) {
+ // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+ const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
+ let chr = b1 << 18 & 0x1C0000 | b2 << 12 & 0x3F000 | b3 << 6 & 0xFC0 | b4 & 0x3F;
+ if (chr < 0x10000 || chr > 0x10FFFF) {
+ result += '\ufffd\ufffd\ufffd\ufffd';
+ } else {
+ chr -= 0x10000;
+ result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
+ }
+ i += 9;
+ continue;
+ }
+ }
+ result += '\ufffd';
+ }
+ return result;
+ });
+}
+decode.defaultChars = ';/?:@&=+$,#';
+decode.componentChars = '';
+const encodeCache = {};
+
+// Create a lookup array where anything but characters in `chars` string
+// and alphanumeric chars is percent-encoded.
+//
+function getEncodeCache(exclude) {
+ let cache = encodeCache[exclude];
+ if (cache) {
+ return cache;
+ }
+ cache = encodeCache[exclude] = [];
+ for (let i = 0; i < 128; i++) {
+ const ch = String.fromCharCode(i);
+ if (/^[0-9a-z]$/i.test(ch)) {
+ // always allow unencoded alphanumeric characters
+ cache.push(ch);
+ } else {
+ cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
+ }
+ }
+ for (let i = 0; i < exclude.length; i++) {
+ cache[exclude.charCodeAt(i)] = exclude[i];
+ }
+ return cache;
+}
+
+// Encode unsafe characters with percent-encoding, skipping already
+// encoded sequences.
+//
+// - string - string to encode
+// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
+// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
+//
+function encode(string, exclude, keepEscaped) {
+ if (typeof exclude !== 'string') {
+ // encode(string, keepEscaped)
+ keepEscaped = exclude;
+ exclude = encode.defaultChars;
+ }
+ if (typeof keepEscaped === 'undefined') {
+ keepEscaped = true;
+ }
+ const cache = getEncodeCache(exclude);
+ let result = '';
+ for (let i = 0, l = string.length; i < l; i++) {
+ const code = string.charCodeAt(i);
+ if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
+ if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
+ result += string.slice(i, i + 3);
+ i += 2;
+ continue;
+ }
+ }
+ if (code < 128) {
+ result += cache[code];
+ continue;
+ }
+ if (code >= 0xD800 && code <= 0xDFFF) {
+ if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
+ const nextCode = string.charCodeAt(i + 1);
+ if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
+ result += encodeURIComponent(string[i] + string[i + 1]);
+ i++;
+ continue;
+ }
+ }
+ result += '%EF%BF%BD';
+ continue;
+ }
+ result += encodeURIComponent(string[i]);
+ }
+ return result;
+}
+encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
+encode.componentChars = "-_.!~*'()";
+function format(url) {
+ let result = '';
+ result += url.protocol || '';
+ result += url.slashes ? '//' : '';
+ result += url.auth ? url.auth + '@' : '';
+ if (url.hostname && url.hostname.indexOf(':') !== -1) {
+ // ipv6 address
+ result += '[' + url.hostname + ']';
+ } else {
+ result += url.hostname || '';
+ }
+ result += url.port ? ':' + url.port : '';
+ result += url.pathname || '';
+ result += url.search || '';
+ result += url.hash || '';
+ return result;
+}
+
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+//
+// Changes from joyent/node:
+//
+// 1. No leading slash in paths,
+// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
+//
+// 2. Backslashes are not replaced with slashes,
+// so `http:\\example.org\` is treated like a relative path
+//
+// 3. Trailing colon is treated like a part of the path,
+// i.e. in `http://example.org:foo` pathname is `:foo`
+//
+// 4. Nothing is URL-encoded in the resulting object,
+// (in joyent/node some chars in auth and paths are encoded)
+//
+// 5. `url.parse()` does not have `parseQueryString` argument
+//
+// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
+// which can be constructed using other parts of the url.
+//
+
+function Url() {
+ this.protocol = null;
+ this.slashes = null;
+ this.auth = null;
+ this.port = null;
+ this.hostname = null;
+ this.hash = null;
+ this.search = null;
+ this.pathname = null;
+}
+
+// Reference: RFC 3986, RFC 1808, RFC 2396
+
+// define these here so at least they only have to be
+// compiled once on the first module load.
+const protocolPattern = /^([a-z0-9.+-]+:)/i;
+const portPattern = /:[0-9]*$/;
+
+// Special case for a simple path URL
+/* eslint-disable-next-line no-useless-escape */
+const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
+
+// RFC 2396: characters reserved for delimiting URLs.
+// We actually just auto-escape these.
+const delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'];
+
+// RFC 2396: characters not allowed for various reasons.
+const unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims);
+
+// Allowed by RFCs, but cause of XSS attacks. Always escape these.
+const autoEscape = ['\''].concat(unwise);
+// Characters that are never ever allowed in a hostname.
+// Note that any invalid chars are also handled, but these
+// are the ones that are *expected* to be seen, so we fast-path
+// them.
+const nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape);
+const hostEndingChars = ['/', '?', '#'];
+const hostnameMaxLen = 255;
+const hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
+const hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
+// protocols that can allow "unsafe" and "unwise" chars.
+// protocols that never have a hostname.
+const hostlessProtocol = {
+ javascript: true,
+ 'javascript:': true
+};
+// protocols that always contain a // bit.
+const slashedProtocol = {
+ http: true,
+ https: true,
+ ftp: true,
+ gopher: true,
+ file: true,
+ 'http:': true,
+ 'https:': true,
+ 'ftp:': true,
+ 'gopher:': true,
+ 'file:': true
+};
+function urlParse(url, slashesDenoteHost) {
+ if (url && url instanceof Url) return url;
+ const u = new Url();
+ u.parse(url, slashesDenoteHost);
+ return u;
+}
+Url.prototype.parse = function (url, slashesDenoteHost) {
+ let lowerProto, hec, slashes;
+ let rest = url;
+
+ // trim before proceeding.
+ // This is to support parse stuff like " http://foo.com \n"
+ rest = rest.trim();
+ if (!slashesDenoteHost && url.split('#').length === 1) {
+ // Try fast path regexp
+ const simplePath = simplePathPattern.exec(rest);
+ if (simplePath) {
+ this.pathname = simplePath[1];
+ if (simplePath[2]) {
+ this.search = simplePath[2];
+ }
+ return this;
+ }
+ }
+ let proto = protocolPattern.exec(rest);
+ if (proto) {
+ proto = proto[0];
+ lowerProto = proto.toLowerCase();
+ this.protocol = proto;
+ rest = rest.substr(proto.length);
+ }
+
+ // figure out if it's got a host
+ // user@server is *always* interpreted as a hostname, and url
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
+ // how the browser resolves relative URLs.
+ /* eslint-disable-next-line no-useless-escape */
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
+ slashes = rest.substr(0, 2) === '//';
+ if (slashes && !(proto && hostlessProtocol[proto])) {
+ rest = rest.substr(2);
+ this.slashes = true;
+ }
+ }
+ if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
+ // there's a hostname.
+ // the first instance of /, ?, ;, or # ends the host.
+ //
+ // If there is an @ in the hostname, then non-host chars *are* allowed
+ // to the left of the last @ sign, unless some host-ending character
+ // comes *before* the @-sign.
+ // URLs are obnoxious.
+ //
+ // ex:
+ // http://a@b@c/ => user:a@b host:c
+ // http://a@b?@c => user:a host:c path:/?@c
+
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
+ // Review our test case against browsers more comprehensively.
+
+ // find the first instance of any hostEndingChars
+ let hostEnd = -1;
+ for (let i = 0; i < hostEndingChars.length; i++) {
+ hec = rest.indexOf(hostEndingChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
+ }
+
+ // at this point, either we have an explicit point where the
+ // auth portion cannot go past, or the last @ char is the decider.
+ let auth, atSign;
+ if (hostEnd === -1) {
+ // atSign can be anywhere.
+ atSign = rest.lastIndexOf('@');
+ } else {
+ // atSign must be in auth portion.
+ // http://a@b/c@d => host:b auth:a path:/c@d
+ atSign = rest.lastIndexOf('@', hostEnd);
+ }
+
+ // Now we have a portion which is definitely the auth.
+ // Pull that off.
+ if (atSign !== -1) {
+ auth = rest.slice(0, atSign);
+ rest = rest.slice(atSign + 1);
+ this.auth = auth;
+ }
+
+ // the host is the remaining to the left of the first non-host char
+ hostEnd = -1;
+ for (let i = 0; i < nonHostChars.length; i++) {
+ hec = rest.indexOf(nonHostChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
+ }
+ // if we still have not hit it, then the entire thing is a host.
+ if (hostEnd === -1) {
+ hostEnd = rest.length;
+ }
+ if (rest[hostEnd - 1] === ':') {
+ hostEnd--;
+ }
+ const host = rest.slice(0, hostEnd);
+ rest = rest.slice(hostEnd);
+
+ // pull out port.
+ this.parseHost(host);
+
+ // we've indicated that there is a hostname,
+ // so even if it's empty, it has to be present.
+ this.hostname = this.hostname || '';
+
+ // if hostname begins with [ and ends with ]
+ // assume that it's an IPv6 address.
+ const ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
+
+ // validate a little.
+ if (!ipv6Hostname) {
+ const hostparts = this.hostname.split(/\./);
+ for (let i = 0, l = hostparts.length; i < l; i++) {
+ const part = hostparts[i];
+ if (!part) {
+ continue;
+ }
+ if (!part.match(hostnamePartPattern)) {
+ let newpart = '';
+ for (let j = 0, k = part.length; j < k; j++) {
+ if (part.charCodeAt(j) > 127) {
+ // we replace non-ASCII char with a temporary placeholder
+ // we need this to make sure size of hostname is not
+ // broken by replacing non-ASCII by nothing
+ newpart += 'x';
+ } else {
+ newpart += part[j];
+ }
+ }
+ // we test again with ASCII char only
+ if (!newpart.match(hostnamePartPattern)) {
+ const validParts = hostparts.slice(0, i);
+ const notHost = hostparts.slice(i + 1);
+ const bit = part.match(hostnamePartStart);
+ if (bit) {
+ validParts.push(bit[1]);
+ notHost.unshift(bit[2]);
+ }
+ if (notHost.length) {
+ rest = notHost.join('.') + rest;
+ }
+ this.hostname = validParts.join('.');
+ break;
+ }
+ }
+ }
+ }
+ if (this.hostname.length > hostnameMaxLen) {
+ this.hostname = '';
+ }
+
+ // strip [ and ] from the hostname
+ // the host field still retains them, though
+ if (ipv6Hostname) {
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
+ }
+ }
+
+ // chop off from the tail first.
+ const hash = rest.indexOf('#');
+ if (hash !== -1) {
+ // got a fragment string.
+ this.hash = rest.substr(hash);
+ rest = rest.slice(0, hash);
+ }
+ const qm = rest.indexOf('?');
+ if (qm !== -1) {
+ this.search = rest.substr(qm);
+ rest = rest.slice(0, qm);
+ }
+ if (rest) {
+ this.pathname = rest;
+ }
+ if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
+ this.pathname = '';
+ }
+ return this;
+};
+Url.prototype.parseHost = function (host) {
+ let port = portPattern.exec(host);
+ if (port) {
+ port = port[0];
+ if (port !== ':') {
+ this.port = port.substr(1);
+ }
+ host = host.substr(0, host.length - port.length);
+ }
+ if (host) {
+ this.hostname = host;
+ }
+};
+exports.decode = decode;
+exports.encode = encode;
+exports.format = format;
+exports.parse = urlParse;
+
+/***/ }),
+
+/***/ "../node_modules/uc.micro/build/index.cjs.js":
+/*!***************************************************!*\
+ !*** ../node_modules/uc.micro/build/index.cjs.js ***!
+ \***************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+var regex$5 = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
+var regex$4 = /[\0-\x1F\x7F-\x9F]/;
+var regex$3 = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;
+var regex$2 = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
+var regex$1 = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
+var regex = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
+exports.Any = regex$5;
+exports.Cc = regex$4;
+exports.Cf = regex$3;
+exports.P = regex$2;
+exports.S = regex$1;
+exports.Z = regex;
+
+/***/ }),
+
+/***/ "./components/GraphiQL.tsx":
+/*!*********************************!*\
+ !*** ./components/GraphiQL.tsx ***!
+ \*********************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.GraphiQL = GraphiQL;
+exports.GraphiQLInterface = GraphiQLInterface;
+var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
+var _react2 = __webpack_require__(/*! @graphiql/react */ "../../graphiql-react/dist/index.js");
+function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
+function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
+function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
+ * Copyright (c) 2020 GraphQL Contributors.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+const majorVersion = parseInt(_react.default.version.slice(0, 2), 10);
+if (majorVersion < 16) {
+ throw new Error(['GraphiQL 0.18.0 and after is not compatible with React 15 or below.', 'If you are using a CDN source (jsdelivr, unpkg, etc), follow this example:', 'https://github.com/graphql/graphiql/blob/master/examples/graphiql-cdn/index.html#L49'].join('\n'));
+}
+
+/**
+ * API docs for this live here:
+ *
+ * https://graphiql-test.netlify.app/typedoc/modules/graphiql.html#graphiqlprops
+ */
+
+/**
+ * The top-level React component for GraphiQL, intended to encompass the entire
+ * browser viewport.
+ *
+ * @see https://github.com/graphql/graphiql#usage
+ */
+
+function GraphiQL({
+ dangerouslyAssumeSchemaIsValid,
+ defaultQuery,
+ defaultTabs,
+ externalFragments,
+ fetcher,
+ getDefaultFieldNames,
+ headers,
+ inputValueDeprecation,
+ introspectionQueryName,
+ maxHistoryLength,
+ onEditOperationName,
+ onSchemaChange,
+ onTabChange,
+ onTogglePluginVisibility,
+ operationName,
+ plugins,
+ query,
+ response,
+ schema,
+ schemaDescription,
+ shouldPersistHeaders,
+ storage,
+ validationRules,
+ variables,
+ visiblePlugin,
+ defaultHeaders,
+ ...props
+}) {
+ var _props$disableTabs;
+ // Ensure props are correct
+ if (typeof fetcher !== 'function') {
+ throw new TypeError('The `GraphiQL` component requires a `fetcher` function to be passed as prop.');
+ }
+ return /*#__PURE__*/_react.default.createElement(_react2.GraphiQLProvider, {
+ getDefaultFieldNames: getDefaultFieldNames,
+ dangerouslyAssumeSchemaIsValid: dangerouslyAssumeSchemaIsValid,
+ defaultQuery: defaultQuery,
+ defaultHeaders: defaultHeaders,
+ defaultTabs: defaultTabs,
+ externalFragments: externalFragments,
+ fetcher: fetcher,
+ headers: headers,
+ inputValueDeprecation: inputValueDeprecation,
+ introspectionQueryName: introspectionQueryName,
+ maxHistoryLength: maxHistoryLength,
+ onEditOperationName: onEditOperationName,
+ onSchemaChange: onSchemaChange,
+ onTabChange: onTabChange,
+ onTogglePluginVisibility: onTogglePluginVisibility,
+ plugins: plugins,
+ visiblePlugin: visiblePlugin,
+ operationName: operationName,
+ query: query,
+ response: response,
+ schema: schema,
+ schemaDescription: schemaDescription,
+ shouldPersistHeaders: shouldPersistHeaders,
+ storage: storage,
+ validationRules: validationRules,
+ variables: variables
+ }, /*#__PURE__*/_react.default.createElement(GraphiQLInterface, _extends({
+ showPersistHeadersSettings: shouldPersistHeaders !== false,
+ disableTabs: (_props$disableTabs = props.disableTabs) !== null && _props$disableTabs !== void 0 ? _props$disableTabs : false,
+ forcedTheme: props.forcedTheme
+ }, props)));
+}
+
+// Export main windows/panes to be used separately if desired.
+GraphiQL.Logo = GraphiQLLogo;
+GraphiQL.Toolbar = GraphiQLToolbar;
+GraphiQL.Footer = GraphiQLFooter;
+const THEMES = ['light', 'dark', 'system'];
+function GraphiQLInterface(props) {
+ var _props$isHeadersEdito, _pluginContext$visibl, _props$toolbar, _props$toolbar2;
+ const isHeadersEditorEnabled = (_props$isHeadersEdito = props.isHeadersEditorEnabled) !== null && _props$isHeadersEdito !== void 0 ? _props$isHeadersEdito : true;
+ const editorContext = (0, _react2.useEditorContext)({
+ nonNull: true
+ });
+ const executionContext = (0, _react2.useExecutionContext)({
+ nonNull: true
+ });
+ const schemaContext = (0, _react2.useSchemaContext)({
+ nonNull: true
+ });
+ const storageContext = (0, _react2.useStorageContext)();
+ const pluginContext = (0, _react2.usePluginContext)();
+ const forcedTheme = (0, _react.useMemo)(() => props.forcedTheme && THEMES.includes(props.forcedTheme) ? props.forcedTheme : undefined, [props.forcedTheme]);
+ const copy = (0, _react2.useCopyQuery)({
+ onCopyQuery: props.onCopyQuery
+ });
+ const merge = (0, _react2.useMergeQuery)();
+ const prettify = (0, _react2.usePrettifyEditors)();
+ const {
+ theme,
+ setTheme
+ } = (0, _react2.useTheme)();
+ (0, _react.useEffect)(() => {
+ if (forcedTheme === 'system') {
+ setTheme(null);
+ } else if (forcedTheme === 'light' || forcedTheme === 'dark') {
+ setTheme(forcedTheme);
+ }
+ }, [forcedTheme, setTheme]);
+ const PluginContent = pluginContext === null || pluginContext === void 0 ? void 0 : (_pluginContext$visibl = pluginContext.visiblePlugin) === null || _pluginContext$visibl === void 0 ? void 0 : _pluginContext$visibl.content;
+ const pluginResize = (0, _react2.useDragResize)({
+ defaultSizeRelation: 1 / 3,
+ direction: 'horizontal',
+ initiallyHidden: pluginContext !== null && pluginContext !== void 0 && pluginContext.visiblePlugin ? undefined : 'first',
+ onHiddenElementChange(resizableElement) {
+ if (resizableElement === 'first') {
+ pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.setVisiblePlugin(null);
+ }
+ },
+ sizeThresholdSecond: 200,
+ storageKey: 'docExplorerFlex'
+ });
+ const editorResize = (0, _react2.useDragResize)({
+ direction: 'horizontal',
+ storageKey: 'editorFlex'
+ });
+ const editorToolsResize = (0, _react2.useDragResize)({
+ defaultSizeRelation: 3,
+ direction: 'vertical',
+ initiallyHidden: (() => {
+ if (props.defaultEditorToolsVisibility === 'variables' || props.defaultEditorToolsVisibility === 'headers') {
+ return;
+ }
+ if (typeof props.defaultEditorToolsVisibility === 'boolean') {
+ return props.defaultEditorToolsVisibility ? undefined : 'second';
+ }
+ return editorContext.initialVariables || editorContext.initialHeaders ? undefined : 'second';
+ })(),
+ sizeThresholdSecond: 60,
+ storageKey: 'secondaryEditorFlex'
+ });
+ const [activeSecondaryEditor, setActiveSecondaryEditor] = (0, _react.useState)(() => {
+ if (props.defaultEditorToolsVisibility === 'variables' || props.defaultEditorToolsVisibility === 'headers') {
+ return props.defaultEditorToolsVisibility;
+ }
+ return !editorContext.initialVariables && editorContext.initialHeaders && isHeadersEditorEnabled ? 'headers' : 'variables';
+ });
+ const [showDialog, setShowDialog] = (0, _react.useState)(null);
+ const [clearStorageStatus, setClearStorageStatus] = (0, _react.useState)(null);
+ const children = _react.default.Children.toArray(props.children);
+ const logo = children.find(child => isChildComponentType(child, GraphiQL.Logo)) || /*#__PURE__*/_react.default.createElement(GraphiQL.Logo, null);
+ const toolbar = children.find(child => isChildComponentType(child, GraphiQL.Toolbar)) || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, {
+ onClick: prettify,
+ label: "Prettify query (Shift-Ctrl-P)"
+ }, /*#__PURE__*/_react.default.createElement(_react2.PrettifyIcon, {
+ className: "graphiql-toolbar-icon",
+ "aria-hidden": "true"
+ })), /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, {
+ onClick: merge,
+ label: "Merge fragments into query (Shift-Ctrl-M)"
+ }, /*#__PURE__*/_react.default.createElement(_react2.MergeIcon, {
+ className: "graphiql-toolbar-icon",
+ "aria-hidden": "true"
+ })), /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, {
+ onClick: copy,
+ label: "Copy query (Shift-Ctrl-C)"
+ }, /*#__PURE__*/_react.default.createElement(_react2.CopyIcon, {
+ className: "graphiql-toolbar-icon",
+ "aria-hidden": "true"
+ })), (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.additionalContent, ((_props$toolbar2 = props.toolbar) === null || _props$toolbar2 === void 0 ? void 0 : _props$toolbar2.additionalComponent) && /*#__PURE__*/_react.default.createElement(props.toolbar.additionalComponent, null));
+ const footer = children.find(child => isChildComponentType(child, GraphiQL.Footer));
+ const onClickReference = (0, _react.useCallback)(() => {
+ if (pluginResize.hiddenElement === 'first') {
+ pluginResize.setHiddenElement(null);
+ }
+ }, [pluginResize]);
+ const handleClearData = (0, _react.useCallback)(() => {
+ try {
+ storageContext === null || storageContext === void 0 ? void 0 : storageContext.clear();
+ setClearStorageStatus('success');
+ } catch {
+ setClearStorageStatus('error');
+ }
+ }, [storageContext]);
+ const handlePersistHeaders = (0, _react.useCallback)(event => {
+ editorContext.setShouldPersistHeaders(event.currentTarget.dataset.value === 'true');
+ }, [editorContext]);
+ const handleChangeTheme = (0, _react.useCallback)(event => {
+ const selectedTheme = event.currentTarget.dataset.theme;
+ setTheme(selectedTheme || null);
+ }, [setTheme]);
+ const handleAddTab = editorContext.addTab;
+ const handleRefetchSchema = schemaContext.introspect;
+ const handleReorder = editorContext.moveTab;
+ const handleShowDialog = (0, _react.useCallback)(event => {
+ setShowDialog(event.currentTarget.dataset.value);
+ }, []);
+ const handlePluginClick = (0, _react.useCallback)(e => {
+ const context = pluginContext;
+ const pluginIndex = Number(e.currentTarget.dataset.index);
+ const plugin = context.plugins.find((_, index) => pluginIndex === index);
+ const isVisible = plugin === context.visiblePlugin;
+ if (isVisible) {
+ context.setVisiblePlugin(null);
+ pluginResize.setHiddenElement('first');
+ } else {
+ context.setVisiblePlugin(plugin);
+ pluginResize.setHiddenElement(null);
+ }
+ }, [pluginContext, pluginResize]);
+ const handleToolsTabClick = (0, _react.useCallback)(event => {
+ if (editorToolsResize.hiddenElement === 'second') {
+ editorToolsResize.setHiddenElement(null);
+ }
+ setActiveSecondaryEditor(event.currentTarget.dataset.name);
+ }, [editorToolsResize]);
+ const toggleEditorTools = (0, _react.useCallback)(() => {
+ editorToolsResize.setHiddenElement(editorToolsResize.hiddenElement === 'second' ? null : 'second');
+ }, [editorToolsResize]);
+ const handleOpenShortKeysDialog = (0, _react.useCallback)(isOpen => {
+ if (!isOpen) {
+ setShowDialog(null);
+ }
+ }, []);
+ const handleOpenSettingsDialog = (0, _react.useCallback)(isOpen => {
+ if (!isOpen) {
+ setShowDialog(null);
+ setClearStorageStatus(null);
+ }
+ }, []);
+ const addTab = /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ label: "Add tab"
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ className: "graphiql-tab-add",
+ onClick: handleAddTab,
+ "aria-label": "Add tab"
+ }, /*#__PURE__*/_react.default.createElement(_react2.PlusIcon, {
+ "aria-hidden": "true"
+ })));
+ const className = props.className ? ` ${props.className}` : '';
+ return /*#__PURE__*/_react.default.createElement(_react2.Tooltip.Provider, null, /*#__PURE__*/_react.default.createElement("div", {
+ "data-testid": "graphiql-container",
+ className: `graphiql-container${className}`
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-sidebar"
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-sidebar-section"
+ }, pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.plugins.map((plugin, index) => {
+ const isVisible = plugin === pluginContext.visiblePlugin;
+ const label = `${isVisible ? 'Hide' : 'Show'} ${plugin.title}`;
+ const Icon = plugin.icon;
+ return /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ key: plugin.title,
+ label: label
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ className: isVisible ? 'active' : '',
+ onClick: handlePluginClick,
+ "data-index": index,
+ "aria-label": label
+ }, /*#__PURE__*/_react.default.createElement(Icon, {
+ "aria-hidden": "true"
+ })));
+ })), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-sidebar-section"
+ }, /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ label: "Re-fetch GraphQL schema"
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ disabled: schemaContext.isFetching,
+ onClick: handleRefetchSchema,
+ "aria-label": "Re-fetch GraphQL schema"
+ }, /*#__PURE__*/_react.default.createElement(_react2.ReloadIcon, {
+ className: schemaContext.isFetching ? 'graphiql-spin' : '',
+ "aria-hidden": "true"
+ }))), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ label: "Open short keys dialog"
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ "data-value": "short-keys",
+ onClick: handleShowDialog,
+ "aria-label": "Open short keys dialog"
+ }, /*#__PURE__*/_react.default.createElement(_react2.KeyboardShortcutIcon, {
+ "aria-hidden": "true"
+ }))), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ label: "Open settings dialog"
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ "data-value": "settings",
+ onClick: handleShowDialog,
+ "aria-label": "Open settings dialog"
+ }, /*#__PURE__*/_react.default.createElement(_react2.SettingsIcon, {
+ "aria-hidden": "true"
+ }))))), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-main"
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ ref: pluginResize.firstRef,
+ style: {
+ // Make sure the container shrinks when containing long
+ // non-breaking texts
+ minWidth: '200px'
+ }
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-plugin"
+ }, PluginContent ? /*#__PURE__*/_react.default.createElement(PluginContent, null) : null)), (pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.visiblePlugin) && /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-horizontal-drag-bar",
+ ref: pluginResize.dragBarRef
+ }), /*#__PURE__*/_react.default.createElement("div", {
+ ref: pluginResize.secondRef,
+ className: "graphiql-sessions"
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-session-header"
+ }, !props.disableTabs && /*#__PURE__*/_react.default.createElement(_react2.Tabs, {
+ values: editorContext.tabs,
+ onReorder: handleReorder,
+ "aria-label": "Select active operation"
+ }, editorContext.tabs.length > 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, editorContext.tabs.map((tab, index) => /*#__PURE__*/_react.default.createElement(_react2.Tab, {
+ key: tab.id,
+ value: tab,
+ isActive: index === editorContext.activeTabIndex
+ }, /*#__PURE__*/_react.default.createElement(_react2.Tab.Button, {
+ "aria-controls": "graphiql-session",
+ id: `graphiql-session-tab-${index}`,
+ onClick: () => {
+ executionContext.stop();
+ editorContext.changeTab(index);
+ }
+ }, tab.title), /*#__PURE__*/_react.default.createElement(_react2.Tab.Close, {
+ onClick: () => {
+ if (editorContext.activeTabIndex === index) {
+ executionContext.stop();
+ }
+ editorContext.closeTab(index);
+ }
+ }))), addTab)), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-session-header-right"
+ }, editorContext.tabs.length === 1 && addTab, logo)), /*#__PURE__*/_react.default.createElement("div", {
+ role: "tabpanel",
+ id: "graphiql-session",
+ className: "graphiql-session",
+ "aria-labelledby": `graphiql-session-tab-${editorContext.activeTabIndex}`
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ ref: editorResize.firstRef
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: `graphiql-editors${editorContext.tabs.length === 1 ? ' full-height' : ''}`
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ ref: editorToolsResize.firstRef
+ }, /*#__PURE__*/_react.default.createElement("section", {
+ className: "graphiql-query-editor",
+ "aria-label": "Query Editor"
+ }, /*#__PURE__*/_react.default.createElement(_react2.QueryEditor, {
+ editorTheme: props.editorTheme,
+ keyMap: props.keyMap,
+ onClickReference: onClickReference,
+ onCopyQuery: props.onCopyQuery,
+ onEdit: props.onEditQuery,
+ readOnly: props.readOnly
+ }), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-toolbar",
+ role: "toolbar",
+ "aria-label": "Editor Commands"
+ }, /*#__PURE__*/_react.default.createElement(_react2.ExecuteButton, null), toolbar))), /*#__PURE__*/_react.default.createElement("div", {
+ ref: editorToolsResize.dragBarRef
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-editor-tools"
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ className: activeSecondaryEditor === 'variables' && editorToolsResize.hiddenElement !== 'second' ? 'active' : '',
+ onClick: handleToolsTabClick,
+ "data-name": "variables"
+ }, "Variables"), isHeadersEditorEnabled && /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ className: activeSecondaryEditor === 'headers' && editorToolsResize.hiddenElement !== 'second' ? 'active' : '',
+ onClick: handleToolsTabClick,
+ "data-name": "headers"
+ }, "Headers"), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
+ label: editorToolsResize.hiddenElement === 'second' ? 'Show editor tools' : 'Hide editor tools'
+ }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, {
+ type: "button",
+ onClick: toggleEditorTools,
+ "aria-label": editorToolsResize.hiddenElement === 'second' ? 'Show editor tools' : 'Hide editor tools',
+ className: "graphiql-toggle-editor-tools"
+ }, editorToolsResize.hiddenElement === 'second' ? /*#__PURE__*/_react.default.createElement(_react2.ChevronUpIcon, {
+ className: "graphiql-chevron-icon",
+ "aria-hidden": "true"
+ }) : /*#__PURE__*/_react.default.createElement(_react2.ChevronDownIcon, {
+ className: "graphiql-chevron-icon",
+ "aria-hidden": "true"
+ }))))), /*#__PURE__*/_react.default.createElement("div", {
+ ref: editorToolsResize.secondRef
+ }, /*#__PURE__*/_react.default.createElement("section", {
+ className: "graphiql-editor-tool",
+ "aria-label": activeSecondaryEditor === 'variables' ? 'Variables' : 'Headers'
+ }, /*#__PURE__*/_react.default.createElement(_react2.VariableEditor, {
+ editorTheme: props.editorTheme,
+ isHidden: activeSecondaryEditor !== 'variables',
+ keyMap: props.keyMap,
+ onEdit: props.onEditVariables,
+ onClickReference: onClickReference,
+ readOnly: props.readOnly
+ }), isHeadersEditorEnabled && /*#__PURE__*/_react.default.createElement(_react2.HeaderEditor, {
+ editorTheme: props.editorTheme,
+ isHidden: activeSecondaryEditor !== 'headers',
+ keyMap: props.keyMap,
+ onEdit: props.onEditHeaders,
+ readOnly: props.readOnly
+ }))))), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-horizontal-drag-bar",
+ ref: editorResize.dragBarRef
+ }), /*#__PURE__*/_react.default.createElement("div", {
+ ref: editorResize.secondRef
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-response"
+ }, executionContext.isFetching ? /*#__PURE__*/_react.default.createElement(_react2.Spinner, null) : null, /*#__PURE__*/_react.default.createElement(_react2.ResponseEditor, {
+ editorTheme: props.editorTheme,
+ responseTooltip: props.responseTooltip,
+ keyMap: props.keyMap
+ }), footer))))), /*#__PURE__*/_react.default.createElement(_react2.Dialog, {
+ open: showDialog === 'short-keys',
+ onOpenChange: handleOpenShortKeysDialog
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-header"
+ }, /*#__PURE__*/_react.default.createElement(_react2.Dialog.Title, {
+ className: "graphiql-dialog-title"
+ }, "Short Keys"), /*#__PURE__*/_react.default.createElement(_react2.Dialog.Close, null)), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section"
+ }, /*#__PURE__*/_react.default.createElement(ShortKeys, {
+ keyMap: props.keyMap || 'sublime'
+ }))), /*#__PURE__*/_react.default.createElement(_react2.Dialog, {
+ open: showDialog === 'settings',
+ onOpenChange: handleOpenSettingsDialog
+ }, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-header"
+ }, /*#__PURE__*/_react.default.createElement(_react2.Dialog.Title, {
+ className: "graphiql-dialog-title"
+ }, "Settings"), /*#__PURE__*/_react.default.createElement(_react2.Dialog.Close, null)), props.showPersistHeadersSettings ? /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section"
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-title"
+ }, "Persist headers"), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-caption"
+ }, "Save headers upon reloading.", ' ', /*#__PURE__*/_react.default.createElement("span", {
+ className: "graphiql-warning-text"
+ }, "Only enable if you trust this device."))), /*#__PURE__*/_react.default.createElement(_react2.ButtonGroup, null, /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ id: "enable-persist-headers",
+ className: editorContext.shouldPersistHeaders ? 'active' : '',
+ "data-value": "true",
+ onClick: handlePersistHeaders
+ }, "On"), /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ id: "disable-persist-headers",
+ className: editorContext.shouldPersistHeaders ? '' : 'active',
+ onClick: handlePersistHeaders
+ }, "Off"))) : null, !forcedTheme && /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section"
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-title"
+ }, "Theme"), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-caption"
+ }, "Adjust how the interface appears.")), /*#__PURE__*/_react.default.createElement(_react2.ButtonGroup, null, /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ className: theme === null ? 'active' : '',
+ onClick: handleChangeTheme
+ }, "System"), /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ className: theme === 'light' ? 'active' : '',
+ "data-theme": "light",
+ onClick: handleChangeTheme
+ }, "Light"), /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ className: theme === 'dark' ? 'active' : '',
+ "data-theme": "dark",
+ onClick: handleChangeTheme
+ }, "Dark"))), storageContext ? /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section"
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-title"
+ }, "Clear storage"), /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-dialog-section-caption"
+ }, "Remove all locally stored data and start fresh.")), /*#__PURE__*/_react.default.createElement(_react2.Button, {
+ type: "button",
+ state: clearStorageStatus || undefined,
+ disabled: clearStorageStatus === 'success',
+ onClick: handleClearData
+ }, {
+ success: 'Cleared data',
+ error: 'Failed'
+ }[clearStorageStatus] || 'Clear data')) : null)));
+}
+const modifier = typeof window !== 'undefined' && window.navigator.platform.toLowerCase().indexOf('mac') === 0 ? 'Cmd' : 'Ctrl';
+const SHORT_KEYS = Object.entries({
+ 'Search in editor': [modifier, 'F'],
+ 'Search in documentation': [modifier, 'K'],
+ 'Execute query': [modifier, 'Enter'],
+ 'Prettify editors': ['Ctrl', 'Shift', 'P'],
+ 'Merge fragments definitions into operation definition': ['Ctrl', 'Shift', 'M'],
+ 'Copy query': ['Ctrl', 'Shift', 'C'],
+ 'Re-fetch schema using introspection': ['Ctrl', 'Shift', 'R']
+});
+function ShortKeys({
+ keyMap
+}) {
+ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("table", {
+ className: "graphiql-table"
+ }, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", null, "Short Key"), /*#__PURE__*/_react.default.createElement("th", null, "Function"))), /*#__PURE__*/_react.default.createElement("tbody", null, SHORT_KEYS.map(([title, keys]) => /*#__PURE__*/_react.default.createElement("tr", {
+ key: title
+ }, /*#__PURE__*/_react.default.createElement("td", null, keys.map((key, index, array) => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
+ key: key
+ }, /*#__PURE__*/_react.default.createElement("code", {
+ className: "graphiql-key"
+ }, key), index !== array.length - 1 && ' + '))), /*#__PURE__*/_react.default.createElement("td", null, title))))), /*#__PURE__*/_react.default.createElement("p", null, "The editors use", ' ', /*#__PURE__*/_react.default.createElement("a", {
+ href: "https://codemirror.net/5/doc/manual.html#keymaps",
+ target: "_blank",
+ rel: "noopener noreferrer"
+ }, "CodeMirror Key Maps"), ' ', "that add more short keys. This instance of Graph", /*#__PURE__*/_react.default.createElement("em", null, "i"), "QL uses", ' ', /*#__PURE__*/_react.default.createElement("code", null, keyMap), "."));
+}
+
+// Configure the UI by providing this Component as a child of GraphiQL.
+function GraphiQLLogo(props) {
+ return /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-logo"
+ }, props.children || /*#__PURE__*/_react.default.createElement("a", {
+ className: "graphiql-logo-link",
+ href: "https://github.com/graphql/graphiql",
+ target: "_blank",
+ rel: "noreferrer"
+ }, "Graph", /*#__PURE__*/_react.default.createElement("em", null, "i"), "QL"));
+}
+GraphiQLLogo.displayName = 'GraphiQLLogo';
+
+// Configure the UI by providing this Component as a child of GraphiQL.
+function GraphiQLToolbar(props) {
+ // eslint-disable-next-line react/jsx-no-useless-fragment
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
+}
+GraphiQLToolbar.displayName = 'GraphiQLToolbar';
+
+// Configure the UI by providing this Component as a child of GraphiQL.
+function GraphiQLFooter(props) {
+ return /*#__PURE__*/_react.default.createElement("div", {
+ className: "graphiql-footer"
+ }, props.children);
+}
+GraphiQLFooter.displayName = 'GraphiQLFooter';
+
+// Determines if the React child is of the same type of the provided React component
+function isChildComponentType(child, component) {
+ var _child$type;
+ if (child !== null && child !== void 0 && (_child$type = child.type) !== null && _child$type !== void 0 && _child$type.displayName && child.type.displayName === component.displayName) {
+ return true;
+ }
+ return child.type === component;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/index.js":
+/*!***************************************************!*\
+ !*** ../../graphql-language-service/esm/index.js ***!
+ \***************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+Object.defineProperty(exports, "CharacterStream", ({
+ enumerable: true,
+ get: function () {
+ return _parser.CharacterStream;
+ }
+}));
+Object.defineProperty(exports, "CompletionItemKind", ({
+ enumerable: true,
+ get: function () {
+ return _types.CompletionItemKind;
+ }
+}));
+Object.defineProperty(exports, "DIAGNOSTIC_SEVERITY", ({
+ enumerable: true,
+ get: function () {
+ return _interface.DIAGNOSTIC_SEVERITY;
+ }
+}));
+Object.defineProperty(exports, "FileChangeTypeKind", ({
+ enumerable: true,
+ get: function () {
+ return _types.FileChangeTypeKind;
+ }
+}));
+Object.defineProperty(exports, "GraphQLDocumentMode", ({
+ enumerable: true,
+ get: function () {
+ return _parser.GraphQLDocumentMode;
+ }
+}));
+Object.defineProperty(exports, "LexRules", ({
+ enumerable: true,
+ get: function () {
+ return _parser.LexRules;
+ }
+}));
+Object.defineProperty(exports, "ParseRules", ({
+ enumerable: true,
+ get: function () {
+ return _parser.ParseRules;
+ }
+}));
+Object.defineProperty(exports, "Position", ({
+ enumerable: true,
+ get: function () {
+ return _utils.Position;
+ }
+}));
+Object.defineProperty(exports, "Range", ({
+ enumerable: true,
+ get: function () {
+ return _utils.Range;
+ }
+}));
+Object.defineProperty(exports, "RuleKinds", ({
+ enumerable: true,
+ get: function () {
+ return _parser.RuleKinds;
+ }
+}));
+Object.defineProperty(exports, "SEVERITY", ({
+ enumerable: true,
+ get: function () {
+ return _interface.SEVERITY;
+ }
+}));
+Object.defineProperty(exports, "SuggestionCommand", ({
+ enumerable: true,
+ get: function () {
+ return _interface.SuggestionCommand;
+ }
+}));
+Object.defineProperty(exports, "canUseDirective", ({
+ enumerable: true,
+ get: function () {
+ return _interface.canUseDirective;
+ }
+}));
+Object.defineProperty(exports, "collectVariables", ({
+ enumerable: true,
+ get: function () {
+ return _utils.collectVariables;
+ }
+}));
+Object.defineProperty(exports, "getASTNodeAtPosition", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getASTNodeAtPosition;
+ }
+}));
+Object.defineProperty(exports, "getAutocompleteSuggestions", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getAutocompleteSuggestions;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionQueryResultForArgument", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDefinitionQueryResultForArgument;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionQueryResultForDefinitionNode", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDefinitionQueryResultForDefinitionNode;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionQueryResultForField", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDefinitionQueryResultForField;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionQueryResultForFragmentSpread", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDefinitionQueryResultForFragmentSpread;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionQueryResultForNamedType", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDefinitionQueryResultForNamedType;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionState", ({
+ enumerable: true,
+ get: function () {
+ return _parser.getDefinitionState;
+ }
+}));
+Object.defineProperty(exports, "getDiagnostics", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getDiagnostics;
+ }
+}));
+Object.defineProperty(exports, "getFieldDef", ({
+ enumerable: true,
+ get: function () {
+ return _parser.getFieldDef;
+ }
+}));
+Object.defineProperty(exports, "getFragmentDefinitions", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getFragmentDefinitions;
+ }
+}));
+Object.defineProperty(exports, "getFragmentDependencies", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getFragmentDependencies;
+ }
+}));
+Object.defineProperty(exports, "getFragmentDependenciesForAST", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getFragmentDependenciesForAST;
+ }
+}));
+Object.defineProperty(exports, "getHoverInformation", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getHoverInformation;
+ }
+}));
+Object.defineProperty(exports, "getOperationASTFacts", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getOperationASTFacts;
+ }
+}));
+Object.defineProperty(exports, "getOperationFacts", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getOperationFacts;
+ }
+}));
+Object.defineProperty(exports, "getOutline", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getOutline;
+ }
+}));
+Object.defineProperty(exports, "getQueryFacts", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getQueryFacts;
+ }
+}));
+Object.defineProperty(exports, "getRange", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getRange;
+ }
+}));
+Object.defineProperty(exports, "getTokenAtPosition", ({
+ enumerable: true,
+ get: function () {
+ return _parser.getTokenAtPosition;
+ }
+}));
+Object.defineProperty(exports, "getTypeInfo", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getTypeInfo;
+ }
+}));
+Object.defineProperty(exports, "getVariableCompletions", ({
+ enumerable: true,
+ get: function () {
+ return _interface.getVariableCompletions;
+ }
+}));
+Object.defineProperty(exports, "getVariablesJSONSchema", ({
+ enumerable: true,
+ get: function () {
+ return _utils.getVariablesJSONSchema;
+ }
+}));
+Object.defineProperty(exports, "isIgnored", ({
+ enumerable: true,
+ get: function () {
+ return _parser.isIgnored;
+ }
+}));
+Object.defineProperty(exports, "list", ({
+ enumerable: true,
+ get: function () {
+ return _parser.list;
+ }
+}));
+Object.defineProperty(exports, "offsetToPosition", ({
+ enumerable: true,
+ get: function () {
+ return _utils.offsetToPosition;
+ }
+}));
+Object.defineProperty(exports, "onlineParser", ({
+ enumerable: true,
+ get: function () {
+ return _parser.onlineParser;
+ }
+}));
+Object.defineProperty(exports, "opt", ({
+ enumerable: true,
+ get: function () {
+ return _parser.opt;
+ }
+}));
+Object.defineProperty(exports, "p", ({
+ enumerable: true,
+ get: function () {
+ return _parser.p;
+ }
+}));
+Object.defineProperty(exports, "pointToOffset", ({
+ enumerable: true,
+ get: function () {
+ return _utils.pointToOffset;
+ }
+}));
+Object.defineProperty(exports, "t", ({
+ enumerable: true,
+ get: function () {
+ return _parser.t;
+ }
+}));
+Object.defineProperty(exports, "validateQuery", ({
+ enumerable: true,
+ get: function () {
+ return _interface.validateQuery;
+ }
+}));
+Object.defineProperty(exports, "validateWithCustomRules", ({
+ enumerable: true,
+ get: function () {
+ return _utils.validateWithCustomRules;
+ }
+}));
+var _interface = __webpack_require__(/*! ./interface */ "../../graphql-language-service/esm/interface/index.js");
+var _parser = __webpack_require__(/*! ./parser */ "../../graphql-language-service/esm/parser/index.js");
+var _types = __webpack_require__(/*! ./types */ "../../graphql-language-service/esm/types.js");
+var _utils = __webpack_require__(/*! ./utils */ "../../graphql-language-service/esm/utils/index.js");
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/autocompleteUtils.js":
+/*!*************************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/autocompleteUtils.js ***!
+ \*************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.getInsertText = exports.getInputInsertText = exports.getFieldInsertText = void 0;
+exports.hintList = hintList;
+exports.objectValues = objectValues;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+function objectValues(object) {
+ const keys = Object.keys(object);
+ const len = keys.length;
+ const values = new Array(len);
+ for (let i = 0; i < len; ++i) {
+ values[i] = object[keys[i]];
+ }
+ return values;
+}
+function hintList(token, list) {
+ return filterAndSortList(list, normalizeText(token.string));
+}
+function filterAndSortList(list, text) {
+ if (!text || text.trim() === '' || text.trim() === ':' || text.trim() === '{') {
+ return filterNonEmpty(list, entry => !entry.isDeprecated);
+ }
+ const byProximity = list.map(entry => ({
+ proximity: getProximity(normalizeText(entry.label), text),
+ entry
+ }));
+ return filterNonEmpty(filterNonEmpty(byProximity, pair => pair.proximity <= 2), pair => !pair.entry.isDeprecated).sort((a, b) => (a.entry.isDeprecated ? 1 : 0) - (b.entry.isDeprecated ? 1 : 0) || a.proximity - b.proximity || a.entry.label.length - b.entry.label.length).map(pair => pair.entry);
+}
+function filterNonEmpty(array, predicate) {
+ const filtered = array.filter(predicate);
+ return filtered.length === 0 ? array : filtered;
+}
+function normalizeText(text) {
+ return text.toLowerCase().replaceAll(/\W/g, '');
+}
+function getProximity(suggestion, text) {
+ let proximity = lexicalDistance(text, suggestion);
+ if (suggestion.length > text.length) {
+ proximity -= suggestion.length - text.length - 1;
+ proximity += suggestion.indexOf(text) === 0 ? 0 : 0.5;
+ }
+ return proximity;
+}
+function lexicalDistance(a, b) {
+ let i;
+ let j;
+ const d = [];
+ const aLength = a.length;
+ const bLength = b.length;
+ for (i = 0; i <= aLength; i++) {
+ d[i] = [i];
+ }
+ for (j = 1; j <= bLength; j++) {
+ d[0][j] = j;
+ }
+ for (i = 1; i <= aLength; i++) {
+ for (j = 1; j <= bLength; j++) {
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);
+ }
+ }
+ }
+ return d[aLength][bLength];
+}
+const insertSuffix = n => ` {\n $${n !== null && n !== void 0 ? n : 1}\n}`;
+const getInsertText = (prefix, type, fallback) => {
+ if (!type) {
+ return fallback !== null && fallback !== void 0 ? fallback : prefix;
+ }
+ const namedType = (0, _graphql.getNamedType)(type);
+ if ((0, _graphql.isObjectType)(namedType) || (0, _graphql.isInputObjectType)(namedType) || (0, _graphql.isListType)(namedType) || (0, _graphql.isAbstractType)(namedType)) {
+ return prefix + insertSuffix();
+ }
+ return fallback !== null && fallback !== void 0 ? fallback : prefix;
+};
+exports.getInsertText = getInsertText;
+const getInputInsertText = (prefix, type, fallback) => {
+ if ((0, _graphql.isListType)(type)) {
+ const baseType = (0, _graphql.getNamedType)(type.ofType);
+ return prefix + `[${getInsertText('', baseType, '$1')}]`;
+ }
+ return getInsertText(prefix, type, fallback);
+};
+exports.getInputInsertText = getInputInsertText;
+const getFieldInsertText = field => {
+ const requiredArgs = field.args.filter(arg => arg.type.toString().endsWith('!'));
+ if (!requiredArgs.length) {
+ return;
+ }
+ return field.name + `(${requiredArgs.map((arg, i) => `${arg.name}: $${i + 1}`)}) ${getInsertText('', field.type, '\n')}`;
+};
+exports.getFieldInsertText = getFieldInsertText;
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js":
+/*!**********************************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js ***!
+ \**********************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.SuggestionCommand = void 0;
+exports.canUseDirective = canUseDirective;
+exports.getAutocompleteSuggestions = getAutocompleteSuggestions;
+exports.getFragmentDefinitions = getFragmentDefinitions;
+Object.defineProperty(exports, "getTypeInfo", ({
+ enumerable: true,
+ get: function () {
+ return _parser.getTypeInfo;
+ }
+}));
+exports.getVariableCompletions = getVariableCompletions;
+Object.defineProperty(exports, "runOnlineParser", ({
+ enumerable: true,
+ get: function () {
+ return _parser.runOnlineParser;
+ }
+}));
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _types = __webpack_require__(/*! ../types */ "../../graphql-language-service/esm/types.js");
+var _parser = __webpack_require__(/*! ../parser */ "../../graphql-language-service/esm/parser/index.js");
+var _autocompleteUtils = __webpack_require__(/*! ./autocompleteUtils */ "../../graphql-language-service/esm/interface/autocompleteUtils.js");
+var _vscodeLanguageserverTypes = __webpack_require__(/*! vscode-languageserver-types */ "../../../node_modules/vscode-languageserver-types/lib/esm/main.js");
+const SuggestionCommand = exports.SuggestionCommand = {
+ command: 'editor.action.triggerSuggest',
+ title: 'Suggestions'
+};
+const collectFragmentDefs = op => {
+ const externalFragments = [];
+ if (op) {
+ try {
+ (0, _graphql.visit)((0, _graphql.parse)(op), {
+ FragmentDefinition(def) {
+ externalFragments.push(def);
+ }
+ });
+ } catch (_a) {
+ return [];
+ }
+ }
+ return externalFragments;
+};
+function getAutocompleteSuggestions(schema, queryText, cursor, contextToken, fragmentDefs, options) {
+ var _a;
+ const opts = Object.assign(Object.assign({}, options), {
+ schema
+ });
+ const context = (0, _parser.getContextAtPosition)(queryText, cursor, schema, contextToken, options);
+ if (!context) {
+ return [];
+ }
+ const {
+ state,
+ typeInfo,
+ mode,
+ token
+ } = context;
+ const {
+ kind,
+ step,
+ prevState
+ } = state;
+ if (kind === _parser.RuleKinds.DOCUMENT) {
+ if (mode === _parser.GraphQLDocumentMode.TYPE_SYSTEM) {
+ return getSuggestionsForTypeSystemDefinitions(token);
+ }
+ if (mode === _parser.GraphQLDocumentMode.EXECUTABLE) {
+ return getSuggestionsForExecutableDefinitions(token);
+ }
+ return getSuggestionsForUnknownDocumentMode(token);
+ }
+ if (kind === _parser.RuleKinds.EXTEND_DEF) {
+ return getSuggestionsForExtensionDefinitions(token);
+ }
+ if (((_a = prevState === null || prevState === void 0 ? void 0 : prevState.prevState) === null || _a === void 0 ? void 0 : _a.kind) === _parser.RuleKinds.EXTENSION_DEFINITION && state.name) {
+ return (0, _autocompleteUtils.hintList)(token, []);
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.SCALAR_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isScalarType).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.OBJECT_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isObjectType)(type) && !type.name.startsWith('__')).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.INTERFACE_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isInterfaceType).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.UNION_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isUnionType).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.ENUM_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isEnumType)(type) && !type.name.startsWith('__')).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isInputObjectType).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ if (kind === _parser.RuleKinds.IMPLEMENTS || kind === _parser.RuleKinds.NAMED_TYPE && (prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _parser.RuleKinds.IMPLEMENTS) {
+ return getSuggestionsForImplements(token, state, schema, queryText, typeInfo);
+ }
+ if (kind === _parser.RuleKinds.SELECTION_SET || kind === _parser.RuleKinds.FIELD || kind === _parser.RuleKinds.ALIASED_FIELD) {
+ return getSuggestionsForFieldNames(token, typeInfo, opts);
+ }
+ if (kind === _parser.RuleKinds.ARGUMENTS || kind === _parser.RuleKinds.ARGUMENT && step === 0) {
+ const {
+ argDefs
+ } = typeInfo;
+ if (argDefs) {
+ return (0, _autocompleteUtils.hintList)(token, argDefs.map(argDef => {
+ var _a;
+ return {
+ label: argDef.name,
+ insertText: (0, _autocompleteUtils.getInputInsertText)(argDef.name + ': ', argDef.type),
+ insertTextMode: _vscodeLanguageserverTypes.InsertTextMode.adjustIndentation,
+ insertTextFormat: _types.InsertTextFormat.Snippet,
+ command: SuggestionCommand,
+ labelDetails: {
+ detail: ' ' + String(argDef.type)
+ },
+ documentation: (_a = argDef.description) !== null && _a !== void 0 ? _a : undefined,
+ kind: _types.CompletionItemKind.Variable,
+ type: argDef.type
+ };
+ }));
+ }
+ }
+ if ((kind === _parser.RuleKinds.OBJECT_VALUE || kind === _parser.RuleKinds.OBJECT_FIELD && step === 0) && typeInfo.objectFieldDefs) {
+ const objectFields = (0, _autocompleteUtils.objectValues)(typeInfo.objectFieldDefs);
+ const completionKind = kind === _parser.RuleKinds.OBJECT_VALUE ? _types.CompletionItemKind.Value : _types.CompletionItemKind.Field;
+ return (0, _autocompleteUtils.hintList)(token, objectFields.map(field => {
+ var _a;
+ return {
+ label: field.name,
+ detail: String(field.type),
+ documentation: (_a = field === null || field === void 0 ? void 0 : field.description) !== null && _a !== void 0 ? _a : undefined,
+ kind: completionKind,
+ type: field.type,
+ insertText: (0, _autocompleteUtils.getInputInsertText)(field.name + ': ', field.type),
+ insertTextMode: _vscodeLanguageserverTypes.InsertTextMode.adjustIndentation,
+ insertTextFormat: _types.InsertTextFormat.Snippet,
+ command: SuggestionCommand
+ };
+ }));
+ }
+ if (kind === _parser.RuleKinds.ENUM_VALUE || kind === _parser.RuleKinds.LIST_VALUE && step === 1 || kind === _parser.RuleKinds.OBJECT_FIELD && step === 2 || kind === _parser.RuleKinds.ARGUMENT && step === 2) {
+ return getSuggestionsForInputValues(token, typeInfo, queryText, schema);
+ }
+ if (kind === _parser.RuleKinds.VARIABLE && step === 1) {
+ const namedInputType = (0, _graphql.getNamedType)(typeInfo.inputType);
+ const variableDefinitions = getVariableCompletions(queryText, schema, token);
+ return (0, _autocompleteUtils.hintList)(token, variableDefinitions.filter(v => v.detail === (namedInputType === null || namedInputType === void 0 ? void 0 : namedInputType.name)));
+ }
+ if (kind === _parser.RuleKinds.TYPE_CONDITION && step === 1 || kind === _parser.RuleKinds.NAMED_TYPE && prevState != null && prevState.kind === _parser.RuleKinds.TYPE_CONDITION) {
+ return getSuggestionsForFragmentTypeConditions(token, typeInfo, schema, kind);
+ }
+ if (kind === _parser.RuleKinds.FRAGMENT_SPREAD && step === 1) {
+ return getSuggestionsForFragmentSpread(token, typeInfo, schema, queryText, Array.isArray(fragmentDefs) ? fragmentDefs : collectFragmentDefs(fragmentDefs));
+ }
+ const unwrappedState = unwrapType(state);
+ if (unwrappedState.kind === _parser.RuleKinds.FIELD_DEF) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isOutputType)(type) && !type.name.startsWith('__')).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function,
+ insertText: (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) ? type.name + '\n' : type.name,
+ insertTextMode: _vscodeLanguageserverTypes.InsertTextMode.adjustIndentation
+ })));
+ }
+ if (unwrappedState.kind === _parser.RuleKinds.INPUT_VALUE_DEF && step === 2) {
+ return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isInputType)(type) && !type.name.startsWith('__')).map(type => ({
+ label: type.name,
+ kind: _types.CompletionItemKind.Function,
+ insertText: (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) ? type.name + '\n$1' : type.name,
+ insertTextMode: _vscodeLanguageserverTypes.InsertTextMode.adjustIndentation,
+ insertTextFormat: _types.InsertTextFormat.Snippet
+ })));
+ }
+ if (kind === _parser.RuleKinds.VARIABLE_DEFINITION && step === 2 || kind === _parser.RuleKinds.LIST_TYPE && step === 1 || kind === _parser.RuleKinds.NAMED_TYPE && prevState && (prevState.kind === _parser.RuleKinds.VARIABLE_DEFINITION || prevState.kind === _parser.RuleKinds.LIST_TYPE || prevState.kind === _parser.RuleKinds.NON_NULL_TYPE)) {
+ return getSuggestionsForVariableDefinition(token, schema, kind);
+ }
+ if (kind === _parser.RuleKinds.DIRECTIVE) {
+ return getSuggestionsForDirective(token, state, schema, kind);
+ }
+ if (kind === _parser.RuleKinds.DIRECTIVE_DEF) {
+ return getSuggestionsForDirectiveArguments(token, state, schema, kind);
+ }
+ return [];
+}
+const typeSystemCompletionItems = [{
+ label: 'type',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'interface',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'union',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'input',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'scalar',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'schema',
+ kind: _types.CompletionItemKind.Function
+}];
+const executableCompletionItems = [{
+ label: 'query',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'mutation',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'subscription',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: 'fragment',
+ kind: _types.CompletionItemKind.Function
+}, {
+ label: '{',
+ kind: _types.CompletionItemKind.Constructor
+}];
+function getSuggestionsForTypeSystemDefinitions(token) {
+ return (0, _autocompleteUtils.hintList)(token, [{
+ label: 'extend',
+ kind: _types.CompletionItemKind.Function
+ }, ...typeSystemCompletionItems]);
+}
+function getSuggestionsForExecutableDefinitions(token) {
+ return (0, _autocompleteUtils.hintList)(token, executableCompletionItems);
+}
+function getSuggestionsForUnknownDocumentMode(token) {
+ return (0, _autocompleteUtils.hintList)(token, [{
+ label: 'extend',
+ kind: _types.CompletionItemKind.Function
+ }, ...executableCompletionItems, ...typeSystemCompletionItems]);
+}
+function getSuggestionsForExtensionDefinitions(token) {
+ return (0, _autocompleteUtils.hintList)(token, typeSystemCompletionItems);
+}
+function getSuggestionsForFieldNames(token, typeInfo, options) {
+ var _a;
+ if (typeInfo.parentType) {
+ const {
+ parentType
+ } = typeInfo;
+ let fields = [];
+ if ('getFields' in parentType) {
+ fields = (0, _autocompleteUtils.objectValues)(parentType.getFields());
+ }
+ if ((0, _graphql.isCompositeType)(parentType)) {
+ fields.push(_graphql.TypeNameMetaFieldDef);
+ }
+ if (parentType === ((_a = options === null || options === void 0 ? void 0 : options.schema) === null || _a === void 0 ? void 0 : _a.getQueryType())) {
+ fields.push(_graphql.SchemaMetaFieldDef, _graphql.TypeMetaFieldDef);
+ }
+ return (0, _autocompleteUtils.hintList)(token, fields.map((field, index) => {
+ var _a;
+ const suggestion = {
+ sortText: String(index) + field.name,
+ label: field.name,
+ detail: String(field.type),
+ documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined,
+ deprecated: Boolean(field.deprecationReason),
+ isDeprecated: Boolean(field.deprecationReason),
+ deprecationReason: field.deprecationReason,
+ kind: _types.CompletionItemKind.Field,
+ labelDetails: {
+ detail: ' ' + field.type.toString()
+ },
+ type: field.type
+ };
+ if (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) {
+ suggestion.insertText = (0, _autocompleteUtils.getFieldInsertText)(field);
+ if (!suggestion.insertText) {
+ suggestion.insertText = (0, _autocompleteUtils.getInsertText)(field.name, field.type, field.name + (token.state.needsAdvance ? '' : '\n'));
+ }
+ if (suggestion.insertText) {
+ suggestion.insertTextFormat = _types.InsertTextFormat.Snippet;
+ suggestion.insertTextMode = _vscodeLanguageserverTypes.InsertTextMode.adjustIndentation;
+ suggestion.command = SuggestionCommand;
+ }
+ }
+ return suggestion;
+ }));
+ }
+ return [];
+}
+function getSuggestionsForInputValues(token, typeInfo, queryText, schema) {
+ const namedInputType = (0, _graphql.getNamedType)(typeInfo.inputType);
+ const queryVariables = getVariableCompletions(queryText, schema, token).filter(v => v.detail === (namedInputType === null || namedInputType === void 0 ? void 0 : namedInputType.name));
+ if (namedInputType instanceof _graphql.GraphQLEnumType) {
+ const values = namedInputType.getValues();
+ return (0, _autocompleteUtils.hintList)(token, values.map(value => {
+ var _a;
+ return {
+ label: value.name,
+ detail: String(namedInputType),
+ documentation: (_a = value.description) !== null && _a !== void 0 ? _a : undefined,
+ deprecated: Boolean(value.deprecationReason),
+ isDeprecated: Boolean(value.deprecationReason),
+ deprecationReason: value.deprecationReason,
+ kind: _types.CompletionItemKind.EnumMember,
+ type: namedInputType
+ };
+ }).concat(queryVariables));
+ }
+ if (namedInputType === _graphql.GraphQLBoolean) {
+ return (0, _autocompleteUtils.hintList)(token, queryVariables.concat([{
+ label: 'true',
+ detail: String(_graphql.GraphQLBoolean),
+ documentation: 'Not false.',
+ kind: _types.CompletionItemKind.Variable,
+ type: _graphql.GraphQLBoolean
+ }, {
+ label: 'false',
+ detail: String(_graphql.GraphQLBoolean),
+ documentation: 'Not true.',
+ kind: _types.CompletionItemKind.Variable,
+ type: _graphql.GraphQLBoolean
+ }]));
+ }
+ return queryVariables;
+}
+function getSuggestionsForImplements(token, tokenState, schema, documentText, typeInfo) {
+ if (tokenState.needsSeparator) {
+ return [];
+ }
+ const typeMap = schema.getTypeMap();
+ const schemaInterfaces = (0, _autocompleteUtils.objectValues)(typeMap).filter(_graphql.isInterfaceType);
+ const schemaInterfaceNames = schemaInterfaces.map(({
+ name
+ }) => name);
+ const inlineInterfaces = new Set();
+ (0, _parser.runOnlineParser)(documentText, (_, state) => {
+ var _a, _b, _c, _d, _e;
+ if (state.name) {
+ if (state.kind === _parser.RuleKinds.INTERFACE_DEF && !schemaInterfaceNames.includes(state.name)) {
+ inlineInterfaces.add(state.name);
+ }
+ if (state.kind === _parser.RuleKinds.NAMED_TYPE && ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) === _parser.RuleKinds.IMPLEMENTS) {
+ if (typeInfo.interfaceDef) {
+ const existingType = (_b = typeInfo.interfaceDef) === null || _b === void 0 ? void 0 : _b.getInterfaces().find(({
+ name
+ }) => name === state.name);
+ if (existingType) {
+ return;
+ }
+ const type = schema.getType(state.name);
+ const interfaceConfig = (_c = typeInfo.interfaceDef) === null || _c === void 0 ? void 0 : _c.toConfig();
+ typeInfo.interfaceDef = new _graphql.GraphQLInterfaceType(Object.assign(Object.assign({}, interfaceConfig), {
+ interfaces: [...interfaceConfig.interfaces, type || new _graphql.GraphQLInterfaceType({
+ name: state.name,
+ fields: {}
+ })]
+ }));
+ } else if (typeInfo.objectTypeDef) {
+ const existingType = (_d = typeInfo.objectTypeDef) === null || _d === void 0 ? void 0 : _d.getInterfaces().find(({
+ name
+ }) => name === state.name);
+ if (existingType) {
+ return;
+ }
+ const type = schema.getType(state.name);
+ const objectTypeConfig = (_e = typeInfo.objectTypeDef) === null || _e === void 0 ? void 0 : _e.toConfig();
+ typeInfo.objectTypeDef = new _graphql.GraphQLObjectType(Object.assign(Object.assign({}, objectTypeConfig), {
+ interfaces: [...objectTypeConfig.interfaces, type || new _graphql.GraphQLInterfaceType({
+ name: state.name,
+ fields: {}
+ })]
+ }));
+ }
+ }
+ }
+ });
+ const currentTypeToExtend = typeInfo.interfaceDef || typeInfo.objectTypeDef;
+ const siblingInterfaces = (currentTypeToExtend === null || currentTypeToExtend === void 0 ? void 0 : currentTypeToExtend.getInterfaces()) || [];
+ const siblingInterfaceNames = siblingInterfaces.map(({
+ name
+ }) => name);
+ const possibleInterfaces = schemaInterfaces.concat([...inlineInterfaces].map(name => ({
+ name
+ }))).filter(({
+ name
+ }) => name !== (currentTypeToExtend === null || currentTypeToExtend === void 0 ? void 0 : currentTypeToExtend.name) && !siblingInterfaceNames.includes(name));
+ return (0, _autocompleteUtils.hintList)(token, possibleInterfaces.map(type => {
+ const result = {
+ label: type.name,
+ kind: _types.CompletionItemKind.Interface,
+ type
+ };
+ if (type === null || type === void 0 ? void 0 : type.description) {
+ result.documentation = type.description;
+ }
+ return result;
+ }));
+}
+function getSuggestionsForFragmentTypeConditions(token, typeInfo, schema, _kind) {
+ let possibleTypes;
+ if (typeInfo.parentType) {
+ if ((0, _graphql.isAbstractType)(typeInfo.parentType)) {
+ const abstractType = (0, _graphql.assertAbstractType)(typeInfo.parentType);
+ const possibleObjTypes = schema.getPossibleTypes(abstractType);
+ const possibleIfaceMap = Object.create(null);
+ for (const type of possibleObjTypes) {
+ for (const iface of type.getInterfaces()) {
+ possibleIfaceMap[iface.name] = iface;
+ }
+ }
+ possibleTypes = possibleObjTypes.concat((0, _autocompleteUtils.objectValues)(possibleIfaceMap));
+ } else {
+ possibleTypes = [typeInfo.parentType];
+ }
+ } else {
+ const typeMap = schema.getTypeMap();
+ possibleTypes = (0, _autocompleteUtils.objectValues)(typeMap).filter(type => (0, _graphql.isCompositeType)(type) && !type.name.startsWith('__'));
+ }
+ return (0, _autocompleteUtils.hintList)(token, possibleTypes.map(type => {
+ const namedType = (0, _graphql.getNamedType)(type);
+ return {
+ label: String(type),
+ documentation: (namedType === null || namedType === void 0 ? void 0 : namedType.description) || '',
+ kind: _types.CompletionItemKind.Field
+ };
+ }));
+}
+function getSuggestionsForFragmentSpread(token, typeInfo, schema, queryText, fragmentDefs) {
+ if (!queryText) {
+ return [];
+ }
+ const typeMap = schema.getTypeMap();
+ const defState = (0, _parser.getDefinitionState)(token.state);
+ const fragments = getFragmentDefinitions(queryText);
+ if (fragmentDefs && fragmentDefs.length > 0) {
+ fragments.push(...fragmentDefs);
+ }
+ const relevantFrags = fragments.filter(frag => typeMap[frag.typeCondition.name.value] && !(defState && defState.kind === _parser.RuleKinds.FRAGMENT_DEFINITION && defState.name === frag.name.value) && (0, _graphql.isCompositeType)(typeInfo.parentType) && (0, _graphql.isCompositeType)(typeMap[frag.typeCondition.name.value]) && (0, _graphql.doTypesOverlap)(schema, typeInfo.parentType, typeMap[frag.typeCondition.name.value]));
+ return (0, _autocompleteUtils.hintList)(token, relevantFrags.map(frag => ({
+ label: frag.name.value,
+ detail: String(typeMap[frag.typeCondition.name.value]),
+ documentation: `fragment ${frag.name.value} on ${frag.typeCondition.name.value}`,
+ labelDetails: {
+ detail: `fragment ${frag.name.value} on ${frag.typeCondition.name.value}`
+ },
+ kind: _types.CompletionItemKind.Field,
+ type: typeMap[frag.typeCondition.name.value]
+ })));
+}
+const getParentDefinition = (state, kind) => {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
+ if (((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) === kind) {
+ return state.prevState;
+ }
+ if (((_c = (_b = state.prevState) === null || _b === void 0 ? void 0 : _b.prevState) === null || _c === void 0 ? void 0 : _c.kind) === kind) {
+ return state.prevState.prevState;
+ }
+ if (((_f = (_e = (_d = state.prevState) === null || _d === void 0 ? void 0 : _d.prevState) === null || _e === void 0 ? void 0 : _e.prevState) === null || _f === void 0 ? void 0 : _f.kind) === kind) {
+ return state.prevState.prevState.prevState;
+ }
+ if (((_k = (_j = (_h = (_g = state.prevState) === null || _g === void 0 ? void 0 : _g.prevState) === null || _h === void 0 ? void 0 : _h.prevState) === null || _j === void 0 ? void 0 : _j.prevState) === null || _k === void 0 ? void 0 : _k.kind) === kind) {
+ return state.prevState.prevState.prevState.prevState;
+ }
+};
+function getVariableCompletions(queryText, schema, token) {
+ let variableName = null;
+ let variableType;
+ const definitions = Object.create({});
+ (0, _parser.runOnlineParser)(queryText, (_, state) => {
+ var _a;
+ if ((state === null || state === void 0 ? void 0 : state.kind) === _parser.RuleKinds.VARIABLE && state.name) {
+ variableName = state.name;
+ }
+ if ((state === null || state === void 0 ? void 0 : state.kind) === _parser.RuleKinds.NAMED_TYPE && variableName) {
+ const parentDefinition = getParentDefinition(state, _parser.RuleKinds.TYPE);
+ if (parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type) {
+ variableType = schema.getType(parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type);
+ }
+ }
+ if (variableName && variableType && !definitions[variableName]) {
+ const replaceString = token.string === '$' || ((_a = token === null || token === void 0 ? void 0 : token.state) === null || _a === void 0 ? void 0 : _a.kind) === 'Variable' ? variableName : '$' + variableName;
+ definitions[variableName] = {
+ detail: variableType.toString(),
+ insertText: replaceString,
+ label: '$' + variableName,
+ rawInsert: replaceString,
+ type: variableType,
+ kind: _types.CompletionItemKind.Variable
+ };
+ variableName = null;
+ variableType = null;
+ }
+ });
+ return (0, _autocompleteUtils.objectValues)(definitions);
+}
+function getFragmentDefinitions(queryText) {
+ const fragmentDefs = [];
+ (0, _parser.runOnlineParser)(queryText, (_, state) => {
+ if (state.kind === _parser.RuleKinds.FRAGMENT_DEFINITION && state.name && state.type) {
+ fragmentDefs.push({
+ kind: _parser.RuleKinds.FRAGMENT_DEFINITION,
+ name: {
+ kind: _graphql.Kind.NAME,
+ value: state.name
+ },
+ selectionSet: {
+ kind: _parser.RuleKinds.SELECTION_SET,
+ selections: []
+ },
+ typeCondition: {
+ kind: _parser.RuleKinds.NAMED_TYPE,
+ name: {
+ kind: _graphql.Kind.NAME,
+ value: state.type
+ }
+ }
+ });
+ }
+ });
+ return fragmentDefs;
+}
+function getSuggestionsForVariableDefinition(token, schema, _kind) {
+ const inputTypeMap = schema.getTypeMap();
+ const inputTypes = (0, _autocompleteUtils.objectValues)(inputTypeMap).filter(_graphql.isInputType);
+ return (0, _autocompleteUtils.hintList)(token, inputTypes.map(type => ({
+ label: type.name,
+ documentation: (type === null || type === void 0 ? void 0 : type.description) || '',
+ kind: _types.CompletionItemKind.Variable
+ })));
+}
+function getSuggestionsForDirective(token, state, schema, _kind) {
+ var _a;
+ if ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) {
+ const directives = schema.getDirectives().filter(directive => canUseDirective(state.prevState, directive));
+ return (0, _autocompleteUtils.hintList)(token, directives.map(directive => ({
+ label: directive.name,
+ documentation: (directive === null || directive === void 0 ? void 0 : directive.description) || '',
+ kind: _types.CompletionItemKind.Function
+ })));
+ }
+ return [];
+}
+function getSuggestionsForDirectiveArguments(token, state, schema, _kind) {
+ const directive = schema.getDirectives().find(d => d.name === state.name);
+ return (0, _autocompleteUtils.hintList)(token, (directive === null || directive === void 0 ? void 0 : directive.args.map(arg => ({
+ label: arg.name,
+ documentation: arg.description || '',
+ kind: _types.CompletionItemKind.Field
+ }))) || []);
+}
+function canUseDirective(state, directive) {
+ if (!(state === null || state === void 0 ? void 0 : state.kind)) {
+ return false;
+ }
+ const {
+ kind,
+ prevState
+ } = state;
+ const {
+ locations
+ } = directive;
+ switch (kind) {
+ case _parser.RuleKinds.QUERY:
+ return locations.includes(_graphql.DirectiveLocation.QUERY);
+ case _parser.RuleKinds.MUTATION:
+ return locations.includes(_graphql.DirectiveLocation.MUTATION);
+ case _parser.RuleKinds.SUBSCRIPTION:
+ return locations.includes(_graphql.DirectiveLocation.SUBSCRIPTION);
+ case _parser.RuleKinds.FIELD:
+ case _parser.RuleKinds.ALIASED_FIELD:
+ return locations.includes(_graphql.DirectiveLocation.FIELD);
+ case _parser.RuleKinds.FRAGMENT_DEFINITION:
+ return locations.includes(_graphql.DirectiveLocation.FRAGMENT_DEFINITION);
+ case _parser.RuleKinds.FRAGMENT_SPREAD:
+ return locations.includes(_graphql.DirectiveLocation.FRAGMENT_SPREAD);
+ case _parser.RuleKinds.INLINE_FRAGMENT:
+ return locations.includes(_graphql.DirectiveLocation.INLINE_FRAGMENT);
+ case _parser.RuleKinds.SCHEMA_DEF:
+ return locations.includes(_graphql.DirectiveLocation.SCHEMA);
+ case _parser.RuleKinds.SCALAR_DEF:
+ return locations.includes(_graphql.DirectiveLocation.SCALAR);
+ case _parser.RuleKinds.OBJECT_TYPE_DEF:
+ return locations.includes(_graphql.DirectiveLocation.OBJECT);
+ case _parser.RuleKinds.FIELD_DEF:
+ return locations.includes(_graphql.DirectiveLocation.FIELD_DEFINITION);
+ case _parser.RuleKinds.INTERFACE_DEF:
+ return locations.includes(_graphql.DirectiveLocation.INTERFACE);
+ case _parser.RuleKinds.UNION_DEF:
+ return locations.includes(_graphql.DirectiveLocation.UNION);
+ case _parser.RuleKinds.ENUM_DEF:
+ return locations.includes(_graphql.DirectiveLocation.ENUM);
+ case _parser.RuleKinds.ENUM_VALUE:
+ return locations.includes(_graphql.DirectiveLocation.ENUM_VALUE);
+ case _parser.RuleKinds.INPUT_DEF:
+ return locations.includes(_graphql.DirectiveLocation.INPUT_OBJECT);
+ case _parser.RuleKinds.INPUT_VALUE_DEF:
+ const prevStateKind = prevState === null || prevState === void 0 ? void 0 : prevState.kind;
+ switch (prevStateKind) {
+ case _parser.RuleKinds.ARGUMENTS_DEF:
+ return locations.includes(_graphql.DirectiveLocation.ARGUMENT_DEFINITION);
+ case _parser.RuleKinds.INPUT_DEF:
+ return locations.includes(_graphql.DirectiveLocation.INPUT_FIELD_DEFINITION);
+ }
+ }
+ return false;
+}
+function unwrapType(state) {
+ if (state.prevState && state.kind && [_parser.RuleKinds.NAMED_TYPE, _parser.RuleKinds.LIST_TYPE, _parser.RuleKinds.TYPE, _parser.RuleKinds.NON_NULL_TYPE].includes(state.kind)) {
+ return unwrapType(state.prevState);
+ }
+ return state;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/getDefinition.js":
+/*!*********************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/getDefinition.js ***!
+ \*********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.LANGUAGE = void 0;
+exports.getDefinitionQueryResultForArgument = getDefinitionQueryResultForArgument;
+exports.getDefinitionQueryResultForDefinitionNode = getDefinitionQueryResultForDefinitionNode;
+exports.getDefinitionQueryResultForField = getDefinitionQueryResultForField;
+exports.getDefinitionQueryResultForFragmentSpread = getDefinitionQueryResultForFragmentSpread;
+exports.getDefinitionQueryResultForNamedType = getDefinitionQueryResultForNamedType;
+var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js");
+var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
+ function adopt(value) {
+ return value instanceof P ? value : new P(function (resolve) {
+ resolve(value);
+ });
+ }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+const LANGUAGE = exports.LANGUAGE = 'GraphQL';
+function assert(value, message) {
+ if (!value) {
+ throw new Error(message);
+ }
+}
+function getRange(text, node) {
+ const location = node.loc;
+ assert(location, 'Expected ASTNode to have a location.');
+ return (0, _utils.locToRange)(text, location);
+}
+function getPosition(text, node) {
+ const location = node.loc;
+ assert(location, 'Expected ASTNode to have a location.');
+ return (0, _utils.offsetToPosition)(text, location.start);
+}
+function getDefinitionQueryResultForNamedType(text, node, dependencies) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const name = node.name.value;
+ const defNodes = dependencies.filter(({
+ definition
+ }) => definition.name && definition.name.value === name);
+ if (defNodes.length === 0) {
+ throw new Error(`Definition not found for GraphQL type ${name}`);
+ }
+ const definitions = defNodes.map(({
+ filePath,
+ content,
+ definition
+ }) => getDefinitionForNodeDefinition(filePath || '', content, definition));
+ return {
+ definitions,
+ queryRange: definitions.map(_ => getRange(text, node)),
+ printedName: name
+ };
+ });
+}
+function getDefinitionQueryResultForField(fieldName, typeName, dependencies) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ const defNodes = dependencies.filter(({
+ definition
+ }) => definition.name && definition.name.value === typeName);
+ if (defNodes.length === 0) {
+ throw new Error(`Definition not found for GraphQL type ${typeName}`);
+ }
+ const definitions = [];
+ for (const {
+ filePath,
+ content,
+ definition
+ } of defNodes) {
+ const fieldDefinition = (_a = definition.fields) === null || _a === void 0 ? void 0 : _a.find(item => item.name.value === fieldName);
+ if (fieldDefinition == null) {
+ continue;
+ }
+ definitions.push(getDefinitionForFieldDefinition(filePath || '', content, fieldDefinition));
+ }
+ return {
+ definitions,
+ queryRange: [],
+ printedName: [typeName, fieldName].join('.')
+ };
+ });
+}
+function getDefinitionQueryResultForArgument(argumentName, fieldName, typeName, dependencies) {
+ var _a, _b, _c;
+ return __awaiter(this, void 0, void 0, function* () {
+ const definitions = [];
+ for (const {
+ filePath,
+ content,
+ definition
+ } of dependencies) {
+ const argDefinition = (_c = (_b = (_a = definition.fields) === null || _a === void 0 ? void 0 : _a.find(item => item.name.value === fieldName)) === null || _b === void 0 ? void 0 : _b.arguments) === null || _c === void 0 ? void 0 : _c.find(item => item.name.value === argumentName);
+ if (argDefinition == null) {
+ continue;
+ }
+ definitions.push(getDefinitionForArgumentDefinition(filePath || '', content, argDefinition));
+ }
+ return {
+ definitions,
+ queryRange: [],
+ printedName: `${[typeName, fieldName].join('.')}(${argumentName})`
+ };
+ });
+}
+function getDefinitionQueryResultForFragmentSpread(text, fragment, dependencies) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const name = fragment.name.value;
+ const defNodes = dependencies.filter(({
+ definition
+ }) => definition.name.value === name);
+ if (defNodes.length === 0) {
+ throw new Error(`Definition not found for GraphQL fragment ${name}`);
+ }
+ const definitions = defNodes.map(({
+ filePath,
+ content,
+ definition
+ }) => getDefinitionForFragmentDefinition(filePath || '', content, definition));
+ return {
+ definitions,
+ queryRange: definitions.map(_ => getRange(text, fragment)),
+ printedName: name
+ };
+ });
+}
+function getDefinitionQueryResultForDefinitionNode(path, text, definition) {
+ var _a;
+ return {
+ definitions: [getDefinitionForFragmentDefinition(path, text, definition)],
+ queryRange: definition.name ? [getRange(text, definition.name)] : [],
+ printedName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value
+ };
+}
+function getDefinitionForFragmentDefinition(path, text, definition) {
+ const {
+ name
+ } = definition;
+ if (!name) {
+ throw new Error('Expected ASTNode to have a Name.');
+ }
+ return {
+ path,
+ position: getPosition(text, definition),
+ range: getRange(text, definition),
+ name: name.value || '',
+ language: LANGUAGE,
+ projectRoot: path
+ };
+}
+function getDefinitionForNodeDefinition(path, text, definition) {
+ const {
+ name
+ } = definition;
+ assert(name, 'Expected ASTNode to have a Name.');
+ return {
+ path,
+ position: getPosition(text, definition),
+ range: getRange(text, definition),
+ name: name.value || '',
+ language: LANGUAGE,
+ projectRoot: path
+ };
+}
+function getDefinitionForFieldDefinition(path, text, definition) {
+ const {
+ name
+ } = definition;
+ assert(name, 'Expected ASTNode to have a Name.');
+ return {
+ path,
+ position: getPosition(text, definition),
+ range: getRange(text, definition),
+ name: name.value || '',
+ language: LANGUAGE,
+ projectRoot: path
+ };
+}
+function getDefinitionForArgumentDefinition(path, text, definition) {
+ const {
+ name
+ } = definition;
+ assert(name, 'Expected ASTNode to have a Name.');
+ return {
+ path,
+ position: getPosition(text, definition),
+ range: getRange(text, definition),
+ name: name.value || '',
+ language: LANGUAGE,
+ projectRoot: path
+ };
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/getDiagnostics.js":
+/*!**********************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/getDiagnostics.js ***!
+ \**********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.SEVERITY = exports.DIAGNOSTIC_SEVERITY = void 0;
+exports.getDiagnostics = getDiagnostics;
+exports.getRange = getRange;
+exports.validateQuery = validateQuery;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _parser = __webpack_require__(/*! ../parser */ "../../graphql-language-service/esm/parser/index.js");
+var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js");
+const SEVERITY = exports.SEVERITY = {
+ Error: 'Error',
+ Warning: 'Warning',
+ Information: 'Information',
+ Hint: 'Hint'
+};
+const DIAGNOSTIC_SEVERITY = exports.DIAGNOSTIC_SEVERITY = {
+ [SEVERITY.Error]: 1,
+ [SEVERITY.Warning]: 2,
+ [SEVERITY.Information]: 3,
+ [SEVERITY.Hint]: 4
+};
+const invariant = (condition, message) => {
+ if (!condition) {
+ throw new Error(message);
+ }
+};
+function getDiagnostics(query, schema = null, customRules, isRelayCompatMode, externalFragments) {
+ var _a, _b;
+ let ast = null;
+ let fragments = '';
+ if (externalFragments) {
+ fragments = typeof externalFragments === 'string' ? externalFragments : externalFragments.reduce((acc, node) => acc + (0, _graphql.print)(node) + '\n\n', '');
+ }
+ const enhancedQuery = fragments ? `${query}\n\n${fragments}` : query;
+ try {
+ ast = (0, _graphql.parse)(enhancedQuery);
+ } catch (error) {
+ if (error instanceof _graphql.GraphQLError) {
+ const range = getRange((_b = (_a = error.locations) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : {
+ line: 0,
+ column: 0
+ }, enhancedQuery);
+ return [{
+ severity: DIAGNOSTIC_SEVERITY.Error,
+ message: error.message,
+ source: 'GraphQL: Syntax',
+ range
+ }];
+ }
+ throw error;
+ }
+ return validateQuery(ast, schema, customRules, isRelayCompatMode);
+}
+function validateQuery(ast, schema = null, customRules, isRelayCompatMode) {
+ if (!schema) {
+ return [];
+ }
+ const validationErrorAnnotations = (0, _utils.validateWithCustomRules)(schema, ast, customRules, isRelayCompatMode).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'));
+ const deprecationWarningAnnotations = (0, _graphql.validate)(schema, ast, [_graphql.NoDeprecatedCustomRule]).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));
+ return validationErrorAnnotations.concat(deprecationWarningAnnotations);
+}
+function annotations(error, severity, type) {
+ if (!error.nodes) {
+ return [];
+ }
+ const highlightedNodes = [];
+ for (const [i, node] of error.nodes.entries()) {
+ const highlightNode = node.kind !== 'Variable' && 'name' in node && node.name !== undefined ? node.name : 'variable' in node && node.variable !== undefined ? node.variable : node;
+ if (highlightNode) {
+ invariant(error.locations, 'GraphQL validation error requires locations.');
+ const loc = error.locations[i];
+ const highlightLoc = getLocation(highlightNode);
+ const end = loc.column + (highlightLoc.end - highlightLoc.start);
+ highlightedNodes.push({
+ source: `GraphQL: ${type}`,
+ message: error.message,
+ severity,
+ range: new _utils.Range(new _utils.Position(loc.line - 1, loc.column - 1), new _utils.Position(loc.line - 1, end))
+ });
+ }
+ }
+ return highlightedNodes;
+}
+function getRange(location, queryText) {
+ const parser = (0, _parser.onlineParser)();
+ const state = parser.startState();
+ const lines = queryText.split('\n');
+ invariant(lines.length >= location.line, 'Query text must have more lines than where the error happened');
+ let stream = null;
+ for (let i = 0; i < location.line; i++) {
+ stream = new _parser.CharacterStream(lines[i]);
+ while (!stream.eol()) {
+ const style = parser.token(stream, state);
+ if (style === 'invalidchar') {
+ break;
+ }
+ }
+ }
+ invariant(stream, 'Expected Parser stream to be available.');
+ const line = location.line - 1;
+ const start = stream.getStartOfToken();
+ const end = stream.getCurrentPosition();
+ return new _utils.Range(new _utils.Position(line, start), new _utils.Position(line, end));
+}
+function getLocation(node) {
+ const typeCastedNode = node;
+ const location = typeCastedNode.loc;
+ invariant(location, 'Expected ASTNode to have a location.');
+ return location;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/getHoverInformation.js":
+/*!***************************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/getHoverInformation.js ***!
+ \***************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.getHoverInformation = getHoverInformation;
+exports.renderArg = renderArg;
+exports.renderDirective = renderDirective;
+exports.renderEnumValue = renderEnumValue;
+exports.renderField = renderField;
+exports.renderType = renderType;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _parser = __webpack_require__(/*! ../parser */ "../../graphql-language-service/esm/parser/index.js");
+function getHoverInformation(schema, queryText, cursor, contextToken, config) {
+ const options = Object.assign(Object.assign({}, config), {
+ schema
+ });
+ const context = (0, _parser.getContextAtPosition)(queryText, cursor, schema, contextToken);
+ if (!context) {
+ return '';
+ }
+ const {
+ typeInfo,
+ token
+ } = context;
+ const {
+ kind,
+ step
+ } = token.state;
+ if (kind === 'Field' && step === 0 && typeInfo.fieldDef || kind === 'AliasedField' && step === 2 && typeInfo.fieldDef || kind === 'ObjectField' && step === 0 && typeInfo.fieldDef) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderField(into, typeInfo, options);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.fieldDef);
+ return into.join('').trim();
+ }
+ if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderDirective(into, typeInfo, options);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.directiveDef);
+ return into.join('').trim();
+ }
+ if (kind === 'Variable' && typeInfo.type) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderType(into, typeInfo, options, typeInfo.type);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.type);
+ return into.join('').trim();
+ }
+ if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderArg(into, typeInfo, options);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.argDef);
+ return into.join('').trim();
+ }
+ if (kind === 'EnumValue' && typeInfo.enumValue && 'description' in typeInfo.enumValue) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderEnumValue(into, typeInfo, options);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.enumValue);
+ return into.join('').trim();
+ }
+ if (kind === 'NamedType' && typeInfo.type && 'description' in typeInfo.type) {
+ const into = [];
+ renderMdCodeStart(into, options);
+ renderType(into, typeInfo, options, typeInfo.type);
+ renderMdCodeEnd(into, options);
+ renderDescription(into, options, typeInfo.type);
+ return into.join('').trim();
+ }
+ return '';
+}
+function renderMdCodeStart(into, options) {
+ if (options.useMarkdown) {
+ text(into, '```graphql\n');
+ }
+}
+function renderMdCodeEnd(into, options) {
+ if (options.useMarkdown) {
+ text(into, '\n```');
+ }
+}
+function renderField(into, typeInfo, options) {
+ renderQualifiedField(into, typeInfo, options);
+ renderTypeAnnotation(into, typeInfo, options, typeInfo.type);
+}
+function renderQualifiedField(into, typeInfo, options) {
+ if (!typeInfo.fieldDef) {
+ return;
+ }
+ const fieldName = typeInfo.fieldDef.name;
+ if (fieldName.slice(0, 2) !== '__') {
+ renderType(into, typeInfo, options, typeInfo.parentType);
+ text(into, '.');
+ }
+ text(into, fieldName);
+}
+function renderDirective(into, typeInfo, _options) {
+ if (!typeInfo.directiveDef) {
+ return;
+ }
+ const name = '@' + typeInfo.directiveDef.name;
+ text(into, name);
+}
+function renderArg(into, typeInfo, options) {
+ if (typeInfo.directiveDef) {
+ renderDirective(into, typeInfo, options);
+ } else if (typeInfo.fieldDef) {
+ renderQualifiedField(into, typeInfo, options);
+ }
+ if (!typeInfo.argDef) {
+ return;
+ }
+ const {
+ name
+ } = typeInfo.argDef;
+ text(into, '(');
+ text(into, name);
+ renderTypeAnnotation(into, typeInfo, options, typeInfo.inputType);
+ text(into, ')');
+}
+function renderTypeAnnotation(into, typeInfo, options, t) {
+ text(into, ': ');
+ renderType(into, typeInfo, options, t);
+}
+function renderEnumValue(into, typeInfo, options) {
+ if (!typeInfo.enumValue) {
+ return;
+ }
+ const {
+ name
+ } = typeInfo.enumValue;
+ renderType(into, typeInfo, options, typeInfo.inputType);
+ text(into, '.');
+ text(into, name);
+}
+function renderType(into, typeInfo, options, t) {
+ if (!t) {
+ return;
+ }
+ if (t instanceof _graphql.GraphQLNonNull) {
+ renderType(into, typeInfo, options, t.ofType);
+ text(into, '!');
+ } else if (t instanceof _graphql.GraphQLList) {
+ text(into, '[');
+ renderType(into, typeInfo, options, t.ofType);
+ text(into, ']');
+ } else {
+ text(into, t.name);
+ }
+}
+function renderDescription(into, options, def) {
+ if (!def) {
+ return;
+ }
+ const description = typeof def.description === 'string' ? def.description : null;
+ if (description) {
+ text(into, '\n\n');
+ text(into, description);
+ }
+ renderDeprecation(into, options, def);
+}
+function renderDeprecation(into, _options, def) {
+ if (!def) {
+ return;
+ }
+ const reason = def.deprecationReason || null;
+ if (!reason) {
+ return;
+ }
+ text(into, '\n\n');
+ text(into, 'Deprecated: ');
+ text(into, reason);
+}
+function text(into, content) {
+ into.push(content);
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/getOutline.js":
+/*!******************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/getOutline.js ***!
+ \******************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.getOutline = getOutline;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js");
+const {
+ INLINE_FRAGMENT
+} = _graphql.Kind;
+const OUTLINEABLE_KINDS = {
+ Field: true,
+ OperationDefinition: true,
+ Document: true,
+ SelectionSet: true,
+ Name: true,
+ FragmentDefinition: true,
+ FragmentSpread: true,
+ InlineFragment: true,
+ ObjectTypeDefinition: true,
+ InputObjectTypeDefinition: true,
+ InterfaceTypeDefinition: true,
+ EnumTypeDefinition: true,
+ EnumValueDefinition: true,
+ InputValueDefinition: true,
+ FieldDefinition: true
+};
+function getOutline(documentText) {
+ let ast;
+ try {
+ ast = (0, _graphql.parse)(documentText);
+ } catch (_a) {
+ return null;
+ }
+ const visitorFns = outlineTreeConverter(documentText);
+ const outlineTrees = (0, _graphql.visit)(ast, {
+ leave(node) {
+ if (visitorFns !== undefined && node.kind in visitorFns) {
+ return visitorFns[node.kind](node);
+ }
+ return null;
+ }
+ });
+ return {
+ outlineTrees
+ };
+}
+function outlineTreeConverter(docText) {
+ const meta = node => {
+ return {
+ representativeName: node.name,
+ startPosition: (0, _utils.offsetToPosition)(docText, node.loc.start),
+ endPosition: (0, _utils.offsetToPosition)(docText, node.loc.end),
+ kind: node.kind,
+ children: node.selectionSet || node.fields || node.values || node.arguments || []
+ };
+ };
+ return {
+ Field(node) {
+ const tokenizedText = node.alias ? [buildToken('plain', node.alias), buildToken('plain', ': ')] : [];
+ tokenizedText.push(buildToken('plain', node.name));
+ return Object.assign({
+ tokenizedText
+ }, meta(node));
+ },
+ OperationDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', node.operation), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ Document: node => node.definitions,
+ SelectionSet: node => concatMap(node.selections, child => {
+ return child.kind === INLINE_FRAGMENT ? child.selectionSet : child;
+ }),
+ Name: node => node.value,
+ FragmentDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', 'fragment'), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ InterfaceTypeDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', 'interface'), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ EnumTypeDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', 'enum'), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ EnumValueDefinition: node => Object.assign({
+ tokenizedText: [buildToken('plain', node.name)]
+ }, meta(node)),
+ ObjectTypeDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', 'type'), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ InputObjectTypeDefinition: node => Object.assign({
+ tokenizedText: [buildToken('keyword', 'input'), buildToken('whitespace', ' '), buildToken('class-name', node.name)]
+ }, meta(node)),
+ FragmentSpread: node => Object.assign({
+ tokenizedText: [buildToken('plain', '...'), buildToken('class-name', node.name)]
+ }, meta(node)),
+ InputValueDefinition(node) {
+ return Object.assign({
+ tokenizedText: [buildToken('plain', node.name)]
+ }, meta(node));
+ },
+ FieldDefinition(node) {
+ return Object.assign({
+ tokenizedText: [buildToken('plain', node.name)]
+ }, meta(node));
+ },
+ InlineFragment: node => node.selectionSet
+ };
+}
+function buildToken(kind, value) {
+ return {
+ kind,
+ value
+ };
+}
+function concatMap(arr, fn) {
+ const res = [];
+ for (let i = 0; i < arr.length; i++) {
+ const x = fn(arr[i], i);
+ if (Array.isArray(x)) {
+ res.push(...x);
+ } else {
+ res.push(x);
+ }
+ }
+ return res;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/interface/index.js":
+/*!*************************************************************!*\
+ !*** ../../graphql-language-service/esm/interface/index.js ***!
+ \*************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+var _exportNames = {
+ getOutline: true,
+ getHoverInformation: true
+};
+Object.defineProperty(exports, "getHoverInformation", ({
+ enumerable: true,
+ get: function () {
+ return _getHoverInformation.getHoverInformation;
+ }
+}));
+Object.defineProperty(exports, "getOutline", ({
+ enumerable: true,
+ get: function () {
+ return _getOutline.getOutline;
+ }
+}));
+var _autocompleteUtils = __webpack_require__(/*! ./autocompleteUtils */ "../../graphql-language-service/esm/interface/autocompleteUtils.js");
+Object.keys(_autocompleteUtils).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _autocompleteUtils[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _autocompleteUtils[key];
+ }
+ });
+});
+var _getAutocompleteSuggestions = __webpack_require__(/*! ./getAutocompleteSuggestions */ "../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js");
+Object.keys(_getAutocompleteSuggestions).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _getAutocompleteSuggestions[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _getAutocompleteSuggestions[key];
+ }
+ });
+});
+var _getDefinition = __webpack_require__(/*! ./getDefinition */ "../../graphql-language-service/esm/interface/getDefinition.js");
+Object.keys(_getDefinition).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _getDefinition[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _getDefinition[key];
+ }
+ });
+});
+var _getDiagnostics = __webpack_require__(/*! ./getDiagnostics */ "../../graphql-language-service/esm/interface/getDiagnostics.js");
+Object.keys(_getDiagnostics).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _getDiagnostics[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _getDiagnostics[key];
+ }
+ });
+});
+var _getOutline = __webpack_require__(/*! ./getOutline */ "../../graphql-language-service/esm/interface/getOutline.js");
+var _getHoverInformation = __webpack_require__(/*! ./getHoverInformation */ "../../graphql-language-service/esm/interface/getHoverInformation.js");
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/CharacterStream.js":
+/*!********************************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/CharacterStream.js ***!
+ \********************************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+class CharacterStream {
+ constructor(sourceText) {
+ this._start = 0;
+ this._pos = 0;
+ this.getStartOfToken = () => this._start;
+ this.getCurrentPosition = () => this._pos;
+ this.eol = () => this._sourceText.length === this._pos;
+ this.sol = () => this._pos === 0;
+ this.peek = () => {
+ return this._sourceText.charAt(this._pos) || null;
+ };
+ this.next = () => {
+ const char = this._sourceText.charAt(this._pos);
+ this._pos++;
+ return char;
+ };
+ this.eat = pattern => {
+ const isMatched = this._testNextCharacter(pattern);
+ if (isMatched) {
+ this._start = this._pos;
+ this._pos++;
+ return this._sourceText.charAt(this._pos - 1);
+ }
+ return undefined;
+ };
+ this.eatWhile = match => {
+ let isMatched = this._testNextCharacter(match);
+ let didEat = false;
+ if (isMatched) {
+ didEat = isMatched;
+ this._start = this._pos;
+ }
+ while (isMatched) {
+ this._pos++;
+ isMatched = this._testNextCharacter(match);
+ didEat = true;
+ }
+ return didEat;
+ };
+ this.eatSpace = () => this.eatWhile(/[\s\u00a0]/);
+ this.skipToEnd = () => {
+ this._pos = this._sourceText.length;
+ };
+ this.skipTo = position => {
+ this._pos = position;
+ };
+ this.match = (pattern, consume = true, caseFold = false) => {
+ let token = null;
+ let match = null;
+ if (typeof pattern === 'string') {
+ const regex = new RegExp(pattern, caseFold ? 'i' : 'g');
+ match = regex.test(this._sourceText.slice(this._pos, this._pos + pattern.length));
+ token = pattern;
+ } else if (pattern instanceof RegExp) {
+ match = this._sourceText.slice(this._pos).match(pattern);
+ token = match === null || match === void 0 ? void 0 : match[0];
+ }
+ if (match != null && (typeof pattern === 'string' || match instanceof Array && this._sourceText.startsWith(match[0], this._pos))) {
+ if (consume) {
+ this._start = this._pos;
+ if (token && token.length) {
+ this._pos += token.length;
+ }
+ }
+ return match;
+ }
+ return false;
+ };
+ this.backUp = num => {
+ this._pos -= num;
+ };
+ this.column = () => this._pos;
+ this.indentation = () => {
+ const match = this._sourceText.match(/\s*/);
+ let indent = 0;
+ if (match && match.length !== 0) {
+ const whiteSpaces = match[0];
+ let pos = 0;
+ while (whiteSpaces.length > pos) {
+ if (whiteSpaces.charCodeAt(pos) === 9) {
+ indent += 2;
+ } else {
+ indent++;
+ }
+ pos++;
+ }
+ }
+ return indent;
+ };
+ this.current = () => this._sourceText.slice(this._start, this._pos);
+ this._sourceText = sourceText;
+ }
+ _testNextCharacter(pattern) {
+ const character = this._sourceText.charAt(this._pos);
+ let isMatched = false;
+ if (typeof pattern === 'string') {
+ isMatched = character === pattern;
+ } else {
+ isMatched = pattern instanceof RegExp ? pattern.test(character) : pattern(character);
+ }
+ return isMatched;
+ }
+}
+exports["default"] = CharacterStream;
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/RuleHelpers.js":
+/*!****************************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/RuleHelpers.js ***!
+ \****************************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.butNot = butNot;
+exports.list = list;
+exports.opt = opt;
+exports.p = p;
+exports.t = t;
+function opt(ofRule) {
+ return {
+ ofRule
+ };
+}
+function list(ofRule, separator) {
+ return {
+ ofRule,
+ isList: true,
+ separator
+ };
+}
+function butNot(rule, exclusions) {
+ const ruleMatch = rule.match;
+ rule.match = token => {
+ let check = false;
+ if (ruleMatch) {
+ check = ruleMatch(token);
+ }
+ return check && exclusions.every(exclusion => exclusion.match && !exclusion.match(token));
+ };
+ return rule;
+}
+function t(kind, style) {
+ return {
+ style,
+ match: token => token.kind === kind
+ };
+}
+function p(value, style) {
+ return {
+ style: style || 'punctuation',
+ match: token => token.kind === 'Punctuation' && token.value === value
+ };
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/Rules.js":
+/*!**********************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/Rules.js ***!
+ \**********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.isIgnored = exports.ParseRules = exports.LexRules = void 0;
+var _RuleHelpers = __webpack_require__(/*! ./RuleHelpers */ "../../graphql-language-service/esm/parser/RuleHelpers.js");
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+const isIgnored = ch => ch === ' ' || ch === '\t' || ch === ',' || ch === '\n' || ch === '\r' || ch === '\uFEFF' || ch === '\u00A0';
+exports.isIgnored = isIgnored;
+const LexRules = exports.LexRules = {
+ Name: /^[_A-Za-z][_0-9A-Za-z]*/,
+ Punctuation: /^(?:!|\$|\(|\)|\.\.\.|:|=|&|@|\[|]|\{|\||\})/,
+ Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,
+ String: /^(?:"""(?:\\"""|[^"]|"[^"]|""[^"])*(?:""")?|"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?)/,
+ Comment: /^#.*/
+};
+const ParseRules = exports.ParseRules = {
+ Document: [(0, _RuleHelpers.list)('Definition')],
+ Definition(token) {
+ switch (token.value) {
+ case '{':
+ return 'ShortQuery';
+ case 'query':
+ return 'Query';
+ case 'mutation':
+ return 'Mutation';
+ case 'subscription':
+ return 'Subscription';
+ case 'fragment':
+ return _graphql.Kind.FRAGMENT_DEFINITION;
+ case 'schema':
+ return 'SchemaDef';
+ case 'scalar':
+ return 'ScalarDef';
+ case 'type':
+ return 'ObjectTypeDef';
+ case 'interface':
+ return 'InterfaceDef';
+ case 'union':
+ return 'UnionDef';
+ case 'enum':
+ return 'EnumDef';
+ case 'input':
+ return 'InputDef';
+ case 'extend':
+ return 'ExtendDef';
+ case 'directive':
+ return 'DirectiveDef';
+ }
+ },
+ ShortQuery: ['SelectionSet'],
+ Query: [word('query'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'],
+ Mutation: [word('mutation'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'],
+ Subscription: [word('subscription'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'],
+ VariableDefinitions: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('VariableDefinition'), (0, _RuleHelpers.p)(')')],
+ VariableDefinition: ['Variable', (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.opt)('DefaultValue')],
+ Variable: [(0, _RuleHelpers.p)('$', 'variable'), name('variable')],
+ DefaultValue: [(0, _RuleHelpers.p)('='), 'Value'],
+ SelectionSet: [(0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('Selection'), (0, _RuleHelpers.p)('}')],
+ Selection(token, stream) {
+ return token.value === '...' ? stream.match(/[\s\u00a0,]*(on\b|@|{)/, false) ? 'InlineFragment' : 'FragmentSpread' : stream.match(/[\s\u00a0,]*:/, false) ? 'AliasedField' : 'Field';
+ },
+ AliasedField: [name('property'), (0, _RuleHelpers.p)(':'), name('qualifier'), (0, _RuleHelpers.opt)('Arguments'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.opt)('SelectionSet')],
+ Field: [name('property'), (0, _RuleHelpers.opt)('Arguments'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.opt)('SelectionSet')],
+ Arguments: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('Argument'), (0, _RuleHelpers.p)(')')],
+ Argument: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Value'],
+ FragmentSpread: [(0, _RuleHelpers.p)('...'), name('def'), (0, _RuleHelpers.list)('Directive')],
+ InlineFragment: [(0, _RuleHelpers.p)('...'), (0, _RuleHelpers.opt)('TypeCondition'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'],
+ FragmentDefinition: [word('fragment'), (0, _RuleHelpers.opt)((0, _RuleHelpers.butNot)(name('def'), [word('on')])), 'TypeCondition', (0, _RuleHelpers.list)('Directive'), 'SelectionSet'],
+ TypeCondition: [word('on'), 'NamedType'],
+ Value(token) {
+ switch (token.kind) {
+ case 'Number':
+ return 'NumberValue';
+ case 'String':
+ return 'StringValue';
+ case 'Punctuation':
+ switch (token.value) {
+ case '[':
+ return 'ListValue';
+ case '{':
+ return 'ObjectValue';
+ case '$':
+ return 'Variable';
+ case '&':
+ return 'NamedType';
+ }
+ return null;
+ case 'Name':
+ switch (token.value) {
+ case 'true':
+ case 'false':
+ return 'BooleanValue';
+ }
+ if (token.value === 'null') {
+ return 'NullValue';
+ }
+ return 'EnumValue';
+ }
+ },
+ NumberValue: [(0, _RuleHelpers.t)('Number', 'number')],
+ StringValue: [{
+ style: 'string',
+ match: token => token.kind === 'String',
+ update(state, token) {
+ if (token.value.startsWith('"""')) {
+ state.inBlockstring = !token.value.slice(3).endsWith('"""');
+ }
+ }
+ }],
+ BooleanValue: [(0, _RuleHelpers.t)('Name', 'builtin')],
+ NullValue: [(0, _RuleHelpers.t)('Name', 'keyword')],
+ EnumValue: [name('string-2')],
+ ListValue: [(0, _RuleHelpers.p)('['), (0, _RuleHelpers.list)('Value'), (0, _RuleHelpers.p)(']')],
+ ObjectValue: [(0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('ObjectField'), (0, _RuleHelpers.p)('}')],
+ ObjectField: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Value'],
+ Type(token) {
+ return token.value === '[' ? 'ListType' : 'NonNullType';
+ },
+ ListType: [(0, _RuleHelpers.p)('['), 'Type', (0, _RuleHelpers.p)(']'), (0, _RuleHelpers.opt)((0, _RuleHelpers.p)('!'))],
+ NonNullType: ['NamedType', (0, _RuleHelpers.opt)((0, _RuleHelpers.p)('!'))],
+ NamedType: [type('atom')],
+ Directive: [(0, _RuleHelpers.p)('@', 'meta'), name('meta'), (0, _RuleHelpers.opt)('Arguments')],
+ DirectiveDef: [word('directive'), (0, _RuleHelpers.p)('@', 'meta'), name('meta'), (0, _RuleHelpers.opt)('ArgumentsDef'), word('on'), (0, _RuleHelpers.list)('DirectiveLocation', (0, _RuleHelpers.p)('|'))],
+ InterfaceDef: [word('interface'), name('atom'), (0, _RuleHelpers.opt)('Implements'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('FieldDef'), (0, _RuleHelpers.p)('}')],
+ Implements: [word('implements'), (0, _RuleHelpers.list)('NamedType', (0, _RuleHelpers.p)('&'))],
+ DirectiveLocation: [name('string-2')],
+ SchemaDef: [word('schema'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('OperationTypeDef'), (0, _RuleHelpers.p)('}')],
+ OperationTypeDef: [name('keyword'), (0, _RuleHelpers.p)(':'), name('atom')],
+ ScalarDef: [word('scalar'), name('atom'), (0, _RuleHelpers.list)('Directive')],
+ ObjectTypeDef: [word('type'), name('atom'), (0, _RuleHelpers.opt)('Implements'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('FieldDef'), (0, _RuleHelpers.p)('}')],
+ FieldDef: [name('property'), (0, _RuleHelpers.opt)('ArgumentsDef'), (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.list)('Directive')],
+ ArgumentsDef: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('InputValueDef'), (0, _RuleHelpers.p)(')')],
+ InputValueDef: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.opt)('DefaultValue'), (0, _RuleHelpers.list)('Directive')],
+ UnionDef: [word('union'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('='), (0, _RuleHelpers.list)('UnionMember', (0, _RuleHelpers.p)('|'))],
+ UnionMember: ['NamedType'],
+ EnumDef: [word('enum'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('EnumValueDef'), (0, _RuleHelpers.p)('}')],
+ EnumValueDef: [name('string-2'), (0, _RuleHelpers.list)('Directive')],
+ InputDef: [word('input'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('InputValueDef'), (0, _RuleHelpers.p)('}')],
+ ExtendDef: [word('extend'), 'ExtensionDefinition'],
+ ExtensionDefinition(token) {
+ switch (token.value) {
+ case 'schema':
+ return _graphql.Kind.SCHEMA_EXTENSION;
+ case 'scalar':
+ return _graphql.Kind.SCALAR_TYPE_EXTENSION;
+ case 'type':
+ return _graphql.Kind.OBJECT_TYPE_EXTENSION;
+ case 'interface':
+ return _graphql.Kind.INTERFACE_TYPE_EXTENSION;
+ case 'union':
+ return _graphql.Kind.UNION_TYPE_EXTENSION;
+ case 'enum':
+ return _graphql.Kind.ENUM_TYPE_EXTENSION;
+ case 'input':
+ return _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION;
+ }
+ },
+ [_graphql.Kind.SCHEMA_EXTENSION]: ['SchemaDef'],
+ [_graphql.Kind.SCALAR_TYPE_EXTENSION]: ['ScalarDef'],
+ [_graphql.Kind.OBJECT_TYPE_EXTENSION]: ['ObjectTypeDef'],
+ [_graphql.Kind.INTERFACE_TYPE_EXTENSION]: ['InterfaceDef'],
+ [_graphql.Kind.UNION_TYPE_EXTENSION]: ['UnionDef'],
+ [_graphql.Kind.ENUM_TYPE_EXTENSION]: ['EnumDef'],
+ [_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION]: ['InputDef']
+};
+function word(value) {
+ return {
+ style: 'keyword',
+ match: token => token.kind === 'Name' && token.value === value
+ };
+}
+function name(style) {
+ return {
+ style,
+ match: token => token.kind === 'Name',
+ update(state, token) {
+ state.name = token.value;
+ }
+ };
+}
+function type(style) {
+ return {
+ style,
+ match: token => token.kind === 'Name',
+ update(state, token) {
+ var _a;
+ if ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.prevState) {
+ state.name = token.value;
+ state.prevState.prevState.type = token.value;
+ }
+ }
+ };
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/api.js":
+/*!********************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/api.js ***!
+ \********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.TYPE_SYSTEM_KINDS = exports.GraphQLDocumentMode = void 0;
+exports.getContextAtPosition = getContextAtPosition;
+exports.getDocumentMode = getDocumentMode;
+exports.getTokenAtPosition = getTokenAtPosition;
+exports.runOnlineParser = runOnlineParser;
+var _ = __webpack_require__(/*! . */ "../../graphql-language-service/esm/parser/index.js");
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+function runOnlineParser(queryText, callback) {
+ const lines = queryText.split('\n');
+ const parser = (0, _.onlineParser)();
+ let state = parser.startState();
+ let style = '';
+ let stream = new _.CharacterStream('');
+ for (let i = 0; i < lines.length; i++) {
+ stream = new _.CharacterStream(lines[i]);
+ while (!stream.eol()) {
+ style = parser.token(stream, state);
+ const code = callback(stream, state, style, i);
+ if (code === 'BREAK') {
+ break;
+ }
+ }
+ callback(stream, state, style, i);
+ if (!state.kind) {
+ state = parser.startState();
+ }
+ }
+ return {
+ start: stream.getStartOfToken(),
+ end: stream.getCurrentPosition(),
+ string: stream.current(),
+ state,
+ style
+ };
+}
+var GraphQLDocumentMode;
+(function (GraphQLDocumentMode) {
+ GraphQLDocumentMode["TYPE_SYSTEM"] = "TYPE_SYSTEM";
+ GraphQLDocumentMode["EXECUTABLE"] = "EXECUTABLE";
+ GraphQLDocumentMode["UNKNOWN"] = "UNKNOWN";
+})(GraphQLDocumentMode || (exports.GraphQLDocumentMode = GraphQLDocumentMode = {}));
+const TYPE_SYSTEM_KINDS = exports.TYPE_SYSTEM_KINDS = [_graphql.Kind.SCHEMA_DEFINITION, _graphql.Kind.OPERATION_TYPE_DEFINITION, _graphql.Kind.SCALAR_TYPE_DEFINITION, _graphql.Kind.OBJECT_TYPE_DEFINITION, _graphql.Kind.INTERFACE_TYPE_DEFINITION, _graphql.Kind.UNION_TYPE_DEFINITION, _graphql.Kind.ENUM_TYPE_DEFINITION, _graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION, _graphql.Kind.DIRECTIVE_DEFINITION, _graphql.Kind.SCHEMA_EXTENSION, _graphql.Kind.SCALAR_TYPE_EXTENSION, _graphql.Kind.OBJECT_TYPE_EXTENSION, _graphql.Kind.INTERFACE_TYPE_EXTENSION, _graphql.Kind.UNION_TYPE_EXTENSION, _graphql.Kind.ENUM_TYPE_EXTENSION, _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION];
+const getParsedMode = sdl => {
+ let mode = GraphQLDocumentMode.UNKNOWN;
+ if (sdl) {
+ try {
+ (0, _graphql.visit)((0, _graphql.parse)(sdl), {
+ enter(node) {
+ if (node.kind === 'Document') {
+ mode = GraphQLDocumentMode.EXECUTABLE;
+ return;
+ }
+ if (TYPE_SYSTEM_KINDS.includes(node.kind)) {
+ mode = GraphQLDocumentMode.TYPE_SYSTEM;
+ return _graphql.BREAK;
+ }
+ return false;
+ }
+ });
+ } catch (_a) {
+ return mode;
+ }
+ }
+ return mode;
+};
+function getDocumentMode(documentText, uri) {
+ if (uri === null || uri === void 0 ? void 0 : uri.endsWith('.graphqls')) {
+ return GraphQLDocumentMode.TYPE_SYSTEM;
+ }
+ return getParsedMode(documentText);
+}
+function getTokenAtPosition(queryText, cursor, offset = 0) {
+ let styleAtCursor = null;
+ let stateAtCursor = null;
+ let stringAtCursor = null;
+ const token = runOnlineParser(queryText, (stream, state, style, index) => {
+ if (index !== cursor.line || stream.getCurrentPosition() + offset < cursor.character + 1) {
+ return;
+ }
+ styleAtCursor = style;
+ stateAtCursor = Object.assign({}, state);
+ stringAtCursor = stream.current();
+ return 'BREAK';
+ });
+ return {
+ start: token.start,
+ end: token.end,
+ string: stringAtCursor || token.string,
+ state: stateAtCursor || token.state,
+ style: styleAtCursor || token.style
+ };
+}
+function getContextAtPosition(queryText, cursor, schema, contextToken, options) {
+ const token = contextToken || getTokenAtPosition(queryText, cursor, 1);
+ if (!token) {
+ return null;
+ }
+ const state = token.state.kind === 'Invalid' ? token.state.prevState : token.state;
+ if (!state) {
+ return null;
+ }
+ const typeInfo = (0, _.getTypeInfo)(schema, token.state);
+ const mode = (options === null || options === void 0 ? void 0 : options.mode) || getDocumentMode(queryText, options === null || options === void 0 ? void 0 : options.uri);
+ return {
+ token,
+ state,
+ typeInfo,
+ mode
+ };
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/getTypeInfo.js":
+/*!****************************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/getTypeInfo.js ***!
+ \****************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.forEachState = forEachState;
+exports.getDefinitionState = getDefinitionState;
+exports.getFieldDef = getFieldDef;
+exports.getTypeInfo = getTypeInfo;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _ = __webpack_require__(/*! . */ "../../graphql-language-service/esm/parser/index.js");
+function getFieldDef(schema, type, fieldName) {
+ if (fieldName === _graphql.SchemaMetaFieldDef.name && schema.getQueryType() === type) {
+ return _graphql.SchemaMetaFieldDef;
+ }
+ if (fieldName === _graphql.TypeMetaFieldDef.name && schema.getQueryType() === type) {
+ return _graphql.TypeMetaFieldDef;
+ }
+ if (fieldName === _graphql.TypeNameMetaFieldDef.name && (0, _graphql.isCompositeType)(type)) {
+ return _graphql.TypeNameMetaFieldDef;
+ }
+ if ('getFields' in type) {
+ return type.getFields()[fieldName];
+ }
+ return null;
+}
+function forEachState(stack, fn) {
+ const reverseStateStack = [];
+ let state = stack;
+ while (state === null || state === void 0 ? void 0 : state.kind) {
+ reverseStateStack.push(state);
+ state = state.prevState;
+ }
+ for (let i = reverseStateStack.length - 1; i >= 0; i--) {
+ fn(reverseStateStack[i]);
+ }
+}
+function getDefinitionState(tokenState) {
+ let definitionState;
+ forEachState(tokenState, state => {
+ switch (state.kind) {
+ case 'Query':
+ case 'ShortQuery':
+ case 'Mutation':
+ case 'Subscription':
+ case 'FragmentDefinition':
+ definitionState = state;
+ break;
+ }
+ });
+ return definitionState;
+}
+function getTypeInfo(schema, tokenState) {
+ let argDef;
+ let argDefs;
+ let directiveDef;
+ let enumValue;
+ let fieldDef;
+ let inputType;
+ let objectTypeDef;
+ let objectFieldDefs;
+ let parentType;
+ let type;
+ let interfaceDef;
+ forEachState(tokenState, state => {
+ var _a;
+ switch (state.kind) {
+ case _.RuleKinds.QUERY:
+ case 'ShortQuery':
+ type = schema.getQueryType();
+ break;
+ case _.RuleKinds.MUTATION:
+ type = schema.getMutationType();
+ break;
+ case _.RuleKinds.SUBSCRIPTION:
+ type = schema.getSubscriptionType();
+ break;
+ case _.RuleKinds.INLINE_FRAGMENT:
+ case _.RuleKinds.FRAGMENT_DEFINITION:
+ if (state.type) {
+ type = schema.getType(state.type);
+ }
+ break;
+ case _.RuleKinds.FIELD:
+ case _.RuleKinds.ALIASED_FIELD:
+ {
+ if (!type || !state.name) {
+ fieldDef = null;
+ } else {
+ fieldDef = parentType ? getFieldDef(schema, parentType, state.name) : null;
+ type = fieldDef ? fieldDef.type : null;
+ }
+ break;
+ }
+ case _.RuleKinds.SELECTION_SET:
+ parentType = (0, _graphql.getNamedType)(type);
+ break;
+ case _.RuleKinds.DIRECTIVE:
+ directiveDef = state.name ? schema.getDirective(state.name) : null;
+ break;
+ case _.RuleKinds.INTERFACE_DEF:
+ if (state.name) {
+ objectTypeDef = null;
+ interfaceDef = new _graphql.GraphQLInterfaceType({
+ name: state.name,
+ interfaces: [],
+ fields: {}
+ });
+ }
+ break;
+ case _.RuleKinds.OBJECT_TYPE_DEF:
+ if (state.name) {
+ interfaceDef = null;
+ objectTypeDef = new _graphql.GraphQLObjectType({
+ name: state.name,
+ interfaces: [],
+ fields: {}
+ });
+ }
+ break;
+ case _.RuleKinds.ARGUMENTS:
+ {
+ if (state.prevState) {
+ switch (state.prevState.kind) {
+ case _.RuleKinds.FIELD:
+ argDefs = fieldDef && fieldDef.args;
+ break;
+ case _.RuleKinds.DIRECTIVE:
+ argDefs = directiveDef && directiveDef.args;
+ break;
+ case _.RuleKinds.ALIASED_FIELD:
+ {
+ const name = (_a = state.prevState) === null || _a === void 0 ? void 0 : _a.name;
+ if (!name) {
+ argDefs = null;
+ break;
+ }
+ const field = parentType ? getFieldDef(schema, parentType, name) : null;
+ if (!field) {
+ argDefs = null;
+ break;
+ }
+ argDefs = field.args;
+ break;
+ }
+ default:
+ argDefs = null;
+ break;
+ }
+ } else {
+ argDefs = null;
+ }
+ break;
+ }
+ case _.RuleKinds.ARGUMENT:
+ if (argDefs) {
+ for (let i = 0; i < argDefs.length; i++) {
+ if (argDefs[i].name === state.name) {
+ argDef = argDefs[i];
+ break;
+ }
+ }
+ }
+ inputType = argDef === null || argDef === void 0 ? void 0 : argDef.type;
+ break;
+ case _.RuleKinds.VARIABLE_DEFINITION:
+ case _.RuleKinds.VARIABLE:
+ type = inputType;
+ break;
+ case _.RuleKinds.ENUM_VALUE:
+ const enumType = (0, _graphql.getNamedType)(inputType);
+ enumValue = enumType instanceof _graphql.GraphQLEnumType ? enumType.getValues().find(val => val.value === state.name) : null;
+ break;
+ case _.RuleKinds.LIST_VALUE:
+ const nullableType = (0, _graphql.getNullableType)(inputType);
+ inputType = nullableType instanceof _graphql.GraphQLList ? nullableType.ofType : null;
+ break;
+ case _.RuleKinds.OBJECT_VALUE:
+ const objectType = (0, _graphql.getNamedType)(inputType);
+ objectFieldDefs = objectType instanceof _graphql.GraphQLInputObjectType ? objectType.getFields() : null;
+ break;
+ case _.RuleKinds.OBJECT_FIELD:
+ const objectField = state.name && objectFieldDefs ? objectFieldDefs[state.name] : null;
+ inputType = objectField === null || objectField === void 0 ? void 0 : objectField.type;
+ fieldDef = objectField;
+ type = fieldDef ? fieldDef.type : null;
+ break;
+ case _.RuleKinds.NAMED_TYPE:
+ if (state.name) {
+ type = schema.getType(state.name);
+ }
+ break;
+ }
+ });
+ return {
+ argDef,
+ argDefs,
+ directiveDef,
+ enumValue,
+ fieldDef,
+ inputType,
+ objectFieldDefs,
+ parentType,
+ type,
+ interfaceDef,
+ objectTypeDef
+ };
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/index.js":
+/*!**********************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/index.js ***!
+ \**********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+var _exportNames = {
+ CharacterStream: true,
+ LexRules: true,
+ ParseRules: true,
+ isIgnored: true,
+ butNot: true,
+ list: true,
+ opt: true,
+ p: true,
+ t: true,
+ onlineParser: true,
+ runOnlineParser: true,
+ getTokenAtPosition: true,
+ getContextAtPosition: true,
+ GraphQLDocumentMode: true,
+ getDocumentMode: true,
+ getTypeInfo: true,
+ getDefinitionState: true,
+ getFieldDef: true
+};
+Object.defineProperty(exports, "CharacterStream", ({
+ enumerable: true,
+ get: function () {
+ return _CharacterStream.default;
+ }
+}));
+Object.defineProperty(exports, "GraphQLDocumentMode", ({
+ enumerable: true,
+ get: function () {
+ return _api.GraphQLDocumentMode;
+ }
+}));
+Object.defineProperty(exports, "LexRules", ({
+ enumerable: true,
+ get: function () {
+ return _Rules.LexRules;
+ }
+}));
+Object.defineProperty(exports, "ParseRules", ({
+ enumerable: true,
+ get: function () {
+ return _Rules.ParseRules;
+ }
+}));
+Object.defineProperty(exports, "butNot", ({
+ enumerable: true,
+ get: function () {
+ return _RuleHelpers.butNot;
+ }
+}));
+Object.defineProperty(exports, "getContextAtPosition", ({
+ enumerable: true,
+ get: function () {
+ return _api.getContextAtPosition;
+ }
+}));
+Object.defineProperty(exports, "getDefinitionState", ({
+ enumerable: true,
+ get: function () {
+ return _getTypeInfo.getDefinitionState;
+ }
+}));
+Object.defineProperty(exports, "getDocumentMode", ({
+ enumerable: true,
+ get: function () {
+ return _api.getDocumentMode;
+ }
+}));
+Object.defineProperty(exports, "getFieldDef", ({
+ enumerable: true,
+ get: function () {
+ return _getTypeInfo.getFieldDef;
+ }
+}));
+Object.defineProperty(exports, "getTokenAtPosition", ({
+ enumerable: true,
+ get: function () {
+ return _api.getTokenAtPosition;
+ }
+}));
+Object.defineProperty(exports, "getTypeInfo", ({
+ enumerable: true,
+ get: function () {
+ return _getTypeInfo.getTypeInfo;
+ }
+}));
+Object.defineProperty(exports, "isIgnored", ({
+ enumerable: true,
+ get: function () {
+ return _Rules.isIgnored;
+ }
+}));
+Object.defineProperty(exports, "list", ({
+ enumerable: true,
+ get: function () {
+ return _RuleHelpers.list;
+ }
+}));
+Object.defineProperty(exports, "onlineParser", ({
+ enumerable: true,
+ get: function () {
+ return _onlineParser.default;
+ }
+}));
+Object.defineProperty(exports, "opt", ({
+ enumerable: true,
+ get: function () {
+ return _RuleHelpers.opt;
+ }
+}));
+Object.defineProperty(exports, "p", ({
+ enumerable: true,
+ get: function () {
+ return _RuleHelpers.p;
+ }
+}));
+Object.defineProperty(exports, "runOnlineParser", ({
+ enumerable: true,
+ get: function () {
+ return _api.runOnlineParser;
+ }
+}));
+Object.defineProperty(exports, "t", ({
+ enumerable: true,
+ get: function () {
+ return _RuleHelpers.t;
+ }
+}));
+var _CharacterStream = _interopRequireDefault(__webpack_require__(/*! ./CharacterStream */ "../../graphql-language-service/esm/parser/CharacterStream.js"));
+var _Rules = __webpack_require__(/*! ./Rules */ "../../graphql-language-service/esm/parser/Rules.js");
+var _RuleHelpers = __webpack_require__(/*! ./RuleHelpers */ "../../graphql-language-service/esm/parser/RuleHelpers.js");
+var _onlineParser = _interopRequireDefault(__webpack_require__(/*! ./onlineParser */ "../../graphql-language-service/esm/parser/onlineParser.js"));
+var _api = __webpack_require__(/*! ./api */ "../../graphql-language-service/esm/parser/api.js");
+var _getTypeInfo = __webpack_require__(/*! ./getTypeInfo */ "../../graphql-language-service/esm/parser/getTypeInfo.js");
+var _types = __webpack_require__(/*! ./types */ "../../graphql-language-service/esm/parser/types.js");
+Object.keys(_types).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
+ if (key in exports && exports[key] === _types[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _types[key];
+ }
+ });
+});
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/onlineParser.js":
+/*!*****************************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/onlineParser.js ***!
+ \*****************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = onlineParser;
+var _Rules = __webpack_require__(/*! ./Rules */ "../../graphql-language-service/esm/parser/Rules.js");
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+function onlineParser(options = {
+ eatWhitespace: stream => stream.eatWhile(_Rules.isIgnored),
+ lexRules: _Rules.LexRules,
+ parseRules: _Rules.ParseRules,
+ editorConfig: {}
+}) {
+ return {
+ startState() {
+ const initialState = {
+ level: 0,
+ step: 0,
+ name: null,
+ kind: null,
+ type: null,
+ rule: null,
+ needsSeparator: false,
+ prevState: null
+ };
+ pushRule(options.parseRules, initialState, _graphql.Kind.DOCUMENT);
+ return initialState;
+ },
+ token(stream, state) {
+ return getToken(stream, state, options);
+ }
+ };
+}
+function getToken(stream, state, options) {
+ var _a;
+ if (state.inBlockstring) {
+ if (stream.match(/.*"""/)) {
+ state.inBlockstring = false;
+ return 'string';
+ }
+ stream.skipToEnd();
+ return 'string';
+ }
+ const {
+ lexRules,
+ parseRules,
+ eatWhitespace,
+ editorConfig
+ } = options;
+ if (state.rule && state.rule.length === 0) {
+ popRule(state);
+ } else if (state.needsAdvance) {
+ state.needsAdvance = false;
+ advanceRule(state, true);
+ }
+ if (stream.sol()) {
+ const tabSize = (editorConfig === null || editorConfig === void 0 ? void 0 : editorConfig.tabSize) || 2;
+ state.indentLevel = Math.floor(stream.indentation() / tabSize);
+ }
+ if (eatWhitespace(stream)) {
+ return 'ws';
+ }
+ const token = lex(lexRules, stream);
+ if (!token) {
+ const matchedSomething = stream.match(/\S+/);
+ if (!matchedSomething) {
+ stream.match(/\s/);
+ }
+ pushRule(SpecialParseRules, state, 'Invalid');
+ return 'invalidchar';
+ }
+ if (token.kind === 'Comment') {
+ pushRule(SpecialParseRules, state, 'Comment');
+ return 'comment';
+ }
+ const backupState = assign({}, state);
+ if (token.kind === 'Punctuation') {
+ if (/^[{([]/.test(token.value)) {
+ if (state.indentLevel !== undefined) {
+ state.levels = (state.levels || []).concat(state.indentLevel + 1);
+ }
+ } else if (/^[})\]]/.test(token.value)) {
+ const levels = state.levels = (state.levels || []).slice(0, -1);
+ if (state.indentLevel && levels.length > 0 && levels.at(-1) < state.indentLevel) {
+ state.indentLevel = levels.at(-1);
+ }
+ }
+ }
+ while (state.rule) {
+ let expected = typeof state.rule === 'function' ? state.step === 0 ? state.rule(token, stream) : null : state.rule[state.step];
+ if (state.needsSeparator) {
+ expected = expected === null || expected === void 0 ? void 0 : expected.separator;
+ }
+ if (expected) {
+ if (expected.ofRule) {
+ expected = expected.ofRule;
+ }
+ if (typeof expected === 'string') {
+ pushRule(parseRules, state, expected);
+ continue;
+ }
+ if ((_a = expected.match) === null || _a === void 0 ? void 0 : _a.call(expected, token)) {
+ if (expected.update) {
+ expected.update(state, token);
+ }
+ if (token.kind === 'Punctuation') {
+ advanceRule(state, true);
+ } else {
+ state.needsAdvance = true;
+ }
+ return expected.style;
+ }
+ }
+ unsuccessful(state);
+ }
+ assign(state, backupState);
+ pushRule(SpecialParseRules, state, 'Invalid');
+ return 'invalidchar';
+}
+function assign(to, from) {
+ const keys = Object.keys(from);
+ for (let i = 0; i < keys.length; i++) {
+ to[keys[i]] = from[keys[i]];
+ }
+ return to;
+}
+const SpecialParseRules = {
+ Invalid: [],
+ Comment: []
+};
+function pushRule(rules, state, ruleKind) {
+ if (!rules[ruleKind]) {
+ throw new TypeError('Unknown rule: ' + ruleKind);
+ }
+ state.prevState = Object.assign({}, state);
+ state.kind = ruleKind;
+ state.name = null;
+ state.type = null;
+ state.rule = rules[ruleKind];
+ state.step = 0;
+ state.needsSeparator = false;
+}
+function popRule(state) {
+ if (!state.prevState) {
+ return;
+ }
+ state.kind = state.prevState.kind;
+ state.name = state.prevState.name;
+ state.type = state.prevState.type;
+ state.rule = state.prevState.rule;
+ state.step = state.prevState.step;
+ state.needsSeparator = state.prevState.needsSeparator;
+ state.prevState = state.prevState.prevState;
+}
+function advanceRule(state, successful) {
+ var _a;
+ if (isList(state) && state.rule) {
+ const step = state.rule[state.step];
+ if (step.separator) {
+ const {
+ separator
+ } = step;
+ state.needsSeparator = !state.needsSeparator;
+ if (!state.needsSeparator && separator.ofRule) {
+ return;
+ }
+ }
+ if (successful) {
+ return;
+ }
+ }
+ state.needsSeparator = false;
+ state.step++;
+ while (state.rule && !(Array.isArray(state.rule) && state.step < state.rule.length)) {
+ popRule(state);
+ if (state.rule) {
+ if (isList(state)) {
+ if ((_a = state.rule) === null || _a === void 0 ? void 0 : _a[state.step].separator) {
+ state.needsSeparator = !state.needsSeparator;
+ }
+ } else {
+ state.needsSeparator = false;
+ state.step++;
+ }
+ }
+ }
+}
+function isList(state) {
+ const step = Array.isArray(state.rule) && typeof state.rule[state.step] !== 'string' && state.rule[state.step];
+ return step && step.isList;
+}
+function unsuccessful(state) {
+ while (state.rule && !(Array.isArray(state.rule) && state.rule[state.step].ofRule)) {
+ popRule(state);
+ }
+ if (state.rule) {
+ advanceRule(state, false);
+ }
+}
+function lex(lexRules, stream) {
+ const kinds = Object.keys(lexRules);
+ for (let i = 0; i < kinds.length; i++) {
+ const match = stream.match(lexRules[kinds[i]]);
+ if (match && match instanceof Array) {
+ return {
+ kind: kinds[i],
+ value: match[0]
+ };
+ }
+ }
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/parser/types.js":
+/*!**********************************************************!*\
+ !*** ../../graphql-language-service/esm/parser/types.js ***!
+ \**********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.RuleKinds = exports.AdditionalRuleKinds = void 0;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+const AdditionalRuleKinds = exports.AdditionalRuleKinds = {
+ ALIASED_FIELD: 'AliasedField',
+ ARGUMENTS: 'Arguments',
+ SHORT_QUERY: 'ShortQuery',
+ QUERY: 'Query',
+ MUTATION: 'Mutation',
+ SUBSCRIPTION: 'Subscription',
+ TYPE_CONDITION: 'TypeCondition',
+ INVALID: 'Invalid',
+ COMMENT: 'Comment',
+ SCHEMA_DEF: 'SchemaDef',
+ SCALAR_DEF: 'ScalarDef',
+ OBJECT_TYPE_DEF: 'ObjectTypeDef',
+ OBJECT_VALUE: 'ObjectValue',
+ LIST_VALUE: 'ListValue',
+ INTERFACE_DEF: 'InterfaceDef',
+ UNION_DEF: 'UnionDef',
+ ENUM_DEF: 'EnumDef',
+ ENUM_VALUE: 'EnumValue',
+ FIELD_DEF: 'FieldDef',
+ INPUT_DEF: 'InputDef',
+ INPUT_VALUE_DEF: 'InputValueDef',
+ ARGUMENTS_DEF: 'ArgumentsDef',
+ EXTEND_DEF: 'ExtendDef',
+ EXTENSION_DEFINITION: 'ExtensionDefinition',
+ DIRECTIVE_DEF: 'DirectiveDef',
+ IMPLEMENTS: 'Implements',
+ VARIABLE_DEFINITIONS: 'VariableDefinitions',
+ TYPE: 'Type',
+ VARIABLE: 'Variable'
+};
+const RuleKinds = exports.RuleKinds = Object.assign(Object.assign({}, _graphql.Kind), AdditionalRuleKinds);
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/types.js":
+/*!***************************************************!*\
+ !*** ../../graphql-language-service/esm/types.js ***!
+ \***************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.FileChangeTypeKind = exports.CompletionItemKind = void 0;
+Object.defineProperty(exports, "GraphQLDocumentMode", ({
+ enumerable: true,
+ get: function () {
+ return _parser.GraphQLDocumentMode;
+ }
+}));
+Object.defineProperty(exports, "InsertTextFormat", ({
+ enumerable: true,
+ get: function () {
+ return _vscodeLanguageserverTypes.InsertTextFormat;
+ }
+}));
+var _vscodeLanguageserverTypes = __webpack_require__(/*! vscode-languageserver-types */ "../../../node_modules/vscode-languageserver-types/lib/esm/main.js");
+var _parser = __webpack_require__(/*! ./parser */ "../../graphql-language-service/esm/parser/index.js");
+const FileChangeTypeKind = exports.FileChangeTypeKind = {
+ Created: 1,
+ Changed: 2,
+ Deleted: 3
+};
+var CompletionItemKind;
+(function (CompletionItemKind) {
+ CompletionItemKind.Text = 1;
+ CompletionItemKind.Method = 2;
+ CompletionItemKind.Function = 3;
+ CompletionItemKind.Constructor = 4;
+ CompletionItemKind.Field = 5;
+ CompletionItemKind.Variable = 6;
+ CompletionItemKind.Class = 7;
+ CompletionItemKind.Interface = 8;
+ CompletionItemKind.Module = 9;
+ CompletionItemKind.Property = 10;
+ CompletionItemKind.Unit = 11;
+ CompletionItemKind.Value = 12;
+ CompletionItemKind.Enum = 13;
+ CompletionItemKind.Keyword = 14;
+ CompletionItemKind.Snippet = 15;
+ CompletionItemKind.Color = 16;
+ CompletionItemKind.File = 17;
+ CompletionItemKind.Reference = 18;
+ CompletionItemKind.Folder = 19;
+ CompletionItemKind.EnumMember = 20;
+ CompletionItemKind.Constant = 21;
+ CompletionItemKind.Struct = 22;
+ CompletionItemKind.Event = 23;
+ CompletionItemKind.Operator = 24;
+ CompletionItemKind.TypeParameter = 25;
+})(CompletionItemKind || (exports.CompletionItemKind = CompletionItemKind = {}));
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/Range.js":
+/*!*********************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/Range.js ***!
+ \*********************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.Range = exports.Position = void 0;
+exports.locToRange = locToRange;
+exports.offsetToPosition = offsetToPosition;
+class Range {
+ constructor(start, end) {
+ this.containsPosition = position => {
+ if (this.start.line === position.line) {
+ return this.start.character <= position.character;
+ }
+ if (this.end.line === position.line) {
+ return this.end.character >= position.character;
+ }
+ return this.start.line <= position.line && this.end.line >= position.line;
+ };
+ this.start = start;
+ this.end = end;
+ }
+ setStart(line, character) {
+ this.start = new Position(line, character);
+ }
+ setEnd(line, character) {
+ this.end = new Position(line, character);
+ }
+}
+exports.Range = Range;
+class Position {
+ constructor(line, character) {
+ this.lessThanOrEqualTo = position => this.line < position.line || this.line === position.line && this.character <= position.character;
+ this.line = line;
+ this.character = character;
+ }
+ setLine(line) {
+ this.line = line;
+ }
+ setCharacter(character) {
+ this.character = character;
+ }
+}
+exports.Position = Position;
+function offsetToPosition(text, loc) {
+ const EOL = '\n';
+ const buf = text.slice(0, loc);
+ const lines = buf.split(EOL).length - 1;
+ const lastLineIndex = buf.lastIndexOf(EOL);
+ return new Position(lines, loc - lastLineIndex - 1);
+}
+function locToRange(text, loc) {
+ const start = offsetToPosition(text, loc.start);
+ const end = offsetToPosition(text, loc.end);
+ return new Range(start, end);
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/collectVariables.js":
+/*!********************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/collectVariables.js ***!
+ \********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.collectVariables = collectVariables;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+function collectVariables(schema, documentAST) {
+ const variableToType = Object.create(null);
+ for (const definition of documentAST.definitions) {
+ if (definition.kind === 'OperationDefinition') {
+ const {
+ variableDefinitions
+ } = definition;
+ if (variableDefinitions) {
+ for (const {
+ variable,
+ type
+ } of variableDefinitions) {
+ const inputType = (0, _graphql.typeFromAST)(schema, type);
+ if (inputType) {
+ variableToType[variable.name.value] = inputType;
+ } else if (type.kind === _graphql.Kind.NAMED_TYPE && type.name.value === 'Float') {
+ variableToType[variable.name.value] = _graphql.GraphQLFloat;
+ }
+ }
+ }
+ }
+ }
+ return variableToType;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/fragmentDependencies.js":
+/*!************************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/fragmentDependencies.js ***!
+ \************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _nullthrows = _interopRequireDefault(__webpack_require__(/*! nullthrows */ "../../../node_modules/nullthrows/nullthrows.js"));
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const getFragmentDependencies = (operationString, fragmentDefinitions) => {
+ if (!fragmentDefinitions) {
+ return [];
+ }
+ let parsedOperation;
+ try {
+ parsedOperation = (0, _graphql.parse)(operationString);
+ } catch (_a) {
+ return [];
+ }
+ return getFragmentDependenciesForAST(parsedOperation, fragmentDefinitions);
+};
+exports.getFragmentDependencies = getFragmentDependencies;
+const getFragmentDependenciesForAST = (parsedOperation, fragmentDefinitions) => {
+ if (!fragmentDefinitions) {
+ return [];
+ }
+ const existingFrags = new Map();
+ const referencedFragNames = new Set();
+ (0, _graphql.visit)(parsedOperation, {
+ FragmentDefinition(node) {
+ existingFrags.set(node.name.value, true);
+ },
+ FragmentSpread(node) {
+ if (!referencedFragNames.has(node.name.value)) {
+ referencedFragNames.add(node.name.value);
+ }
+ }
+ });
+ const asts = new Set();
+ for (const name of referencedFragNames) {
+ if (!existingFrags.has(name) && fragmentDefinitions.has(name)) {
+ asts.add((0, _nullthrows.default)(fragmentDefinitions.get(name)));
+ }
+ }
+ const referencedFragments = [];
+ for (const ast of asts) {
+ (0, _graphql.visit)(ast, {
+ FragmentSpread(node) {
+ if (!referencedFragNames.has(node.name.value) && fragmentDefinitions.get(node.name.value)) {
+ asts.add((0, _nullthrows.default)(fragmentDefinitions.get(node.name.value)));
+ referencedFragNames.add(node.name.value);
+ }
+ }
+ });
+ if (!existingFrags.has(ast.name.value)) {
+ referencedFragments.push(ast);
+ }
+ }
+ return referencedFragments;
+};
+exports.getFragmentDependenciesForAST = getFragmentDependenciesForAST;
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/getASTNodeAtPosition.js":
+/*!************************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/getASTNodeAtPosition.js ***!
+ \************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.getASTNodeAtPosition = getASTNodeAtPosition;
+exports.pointToOffset = pointToOffset;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+function getASTNodeAtPosition(query, ast, point) {
+ const offset = pointToOffset(query, point);
+ let nodeContainingPosition;
+ (0, _graphql.visit)(ast, {
+ enter(node) {
+ if (node.kind !== 'Name' && node.loc && node.loc.start <= offset && offset <= node.loc.end) {
+ nodeContainingPosition = node;
+ } else {
+ return false;
+ }
+ },
+ leave(node) {
+ if (node.loc && node.loc.start <= offset && offset <= node.loc.end) {
+ return false;
+ }
+ }
+ });
+ return nodeContainingPosition;
+}
+function pointToOffset(text, point) {
+ const linesUntilPosition = text.split('\n').slice(0, point.line);
+ return point.character + linesUntilPosition.map(line => line.length + 1).reduce((a, b) => a + b, 0);
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/getOperationFacts.js":
+/*!*********************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/getOperationFacts.js ***!
+ \*********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = getOperationFacts;
+exports.getOperationASTFacts = getOperationASTFacts;
+exports.getQueryFacts = void 0;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+var _collectVariables = __webpack_require__(/*! ./collectVariables */ "../../graphql-language-service/esm/utils/collectVariables.js");
+function getOperationASTFacts(documentAST, schema) {
+ const variableToType = schema ? (0, _collectVariables.collectVariables)(schema, documentAST) : undefined;
+ const operations = [];
+ (0, _graphql.visit)(documentAST, {
+ OperationDefinition(node) {
+ operations.push(node);
+ }
+ });
+ return {
+ variableToType,
+ operations
+ };
+}
+function getOperationFacts(schema, documentString) {
+ if (!documentString) {
+ return;
+ }
+ try {
+ const documentAST = (0, _graphql.parse)(documentString);
+ return Object.assign(Object.assign({}, getOperationASTFacts(documentAST, schema)), {
+ documentAST
+ });
+ } catch (_a) {
+ return;
+ }
+}
+const getQueryFacts = exports.getQueryFacts = getOperationFacts;
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/getVariablesJSONSchema.js":
+/*!**************************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/getVariablesJSONSchema.js ***!
+ \**************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.defaultJSONSchemaOptions = void 0;
+exports.getVariablesJSONSchema = getVariablesJSONSchema;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+const defaultJSONSchemaOptions = exports.defaultJSONSchemaOptions = {
+ useMarkdownDescription: false
+};
+function text(into, newText) {
+ into.push(newText);
+}
+function renderType(into, t) {
+ if ((0, _graphql.isNonNullType)(t)) {
+ renderType(into, t.ofType);
+ text(into, '!');
+ } else if ((0, _graphql.isListType)(t)) {
+ text(into, '[');
+ renderType(into, t.ofType);
+ text(into, ']');
+ } else {
+ text(into, t.name);
+ }
+}
+function renderDefinitionDescription(t, useMarkdown, description) {
+ const into = [];
+ const type = 'type' in t ? t.type : t;
+ if ('type' in t && t.description) {
+ text(into, t.description);
+ text(into, '\n\n');
+ }
+ text(into, renderTypeToString(type, useMarkdown));
+ if (description) {
+ text(into, '\n');
+ text(into, description);
+ } else if (!(0, _graphql.isScalarType)(type) && 'description' in type && type.description) {
+ text(into, '\n');
+ text(into, type.description);
+ } else if ('ofType' in type && !(0, _graphql.isScalarType)(type.ofType) && 'description' in type.ofType && type.ofType.description) {
+ text(into, '\n');
+ text(into, type.ofType.description);
+ }
+ return into.join('');
+}
+function renderTypeToString(t, useMarkdown) {
+ const into = [];
+ if (useMarkdown) {
+ text(into, '```graphql\n');
+ }
+ renderType(into, t);
+ if (useMarkdown) {
+ text(into, '\n```');
+ }
+ return into.join('');
+}
+const defaultScalarTypesMap = {
+ Int: {
+ type: 'integer'
+ },
+ String: {
+ type: 'string'
+ },
+ Float: {
+ type: 'number'
+ },
+ ID: {
+ type: 'string'
+ },
+ Boolean: {
+ type: 'boolean'
+ },
+ DateTime: {
+ type: 'string'
+ }
+};
+class Marker {
+ constructor() {
+ this.set = new Set();
+ }
+ mark(name) {
+ if (this.set.has(name)) {
+ return false;
+ }
+ this.set.add(name);
+ return true;
+ }
+}
+function getJSONSchemaFromGraphQLType(fieldOrType, options) {
+ var _a, _b;
+ let definition = Object.create(null);
+ const definitions = Object.create(null);
+ const isField = ('type' in fieldOrType);
+ const type = isField ? fieldOrType.type : fieldOrType;
+ const baseType = (0, _graphql.isNonNullType)(type) ? type.ofType : type;
+ const required = (0, _graphql.isNonNullType)(type);
+ if ((0, _graphql.isScalarType)(baseType)) {
+ if ((_a = options === null || options === void 0 ? void 0 : options.scalarSchemas) === null || _a === void 0 ? void 0 : _a[baseType.name]) {
+ definition = JSON.parse(JSON.stringify(options.scalarSchemas[baseType.name]));
+ } else {
+ definition.type = ['string', 'number', 'boolean', 'integer'];
+ }
+ if (!required) {
+ if (Array.isArray(definition.type)) {
+ definition.type.push('null');
+ } else if (definition.type) {
+ definition.type = [definition.type, 'null'];
+ } else if (definition.enum) {
+ definition.enum.push(null);
+ } else if (definition.oneOf) {
+ definition.oneOf.push({
+ type: 'null'
+ });
+ } else {
+ definition = {
+ oneOf: [definition, {
+ type: 'null'
+ }]
+ };
+ }
+ }
+ } else if ((0, _graphql.isEnumType)(baseType)) {
+ definition.enum = baseType.getValues().map(val => val.name);
+ if (!required) {
+ definition.enum.push(null);
+ }
+ } else if ((0, _graphql.isListType)(baseType)) {
+ if (required) {
+ definition.type = 'array';
+ } else {
+ definition.type = ['array', 'null'];
+ }
+ const {
+ definition: def,
+ definitions: defs
+ } = getJSONSchemaFromGraphQLType(baseType.ofType, options);
+ definition.items = def;
+ if (defs) {
+ for (const defName of Object.keys(defs)) {
+ definitions[defName] = defs[defName];
+ }
+ }
+ } else if ((0, _graphql.isInputObjectType)(baseType)) {
+ if (required) {
+ definition.$ref = `#/definitions/${baseType.name}`;
+ } else {
+ definition.oneOf = [{
+ $ref: `#/definitions/${baseType.name}`
+ }, {
+ type: 'null'
+ }];
+ }
+ if ((_b = options === null || options === void 0 ? void 0 : options.definitionMarker) === null || _b === void 0 ? void 0 : _b.mark(baseType.name)) {
+ const fields = baseType.getFields();
+ const fieldDef = {
+ type: 'object',
+ properties: {},
+ required: []
+ };
+ fieldDef.description = renderDefinitionDescription(baseType);
+ if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
+ fieldDef.markdownDescription = renderDefinitionDescription(baseType, true);
+ }
+ for (const fieldName of Object.keys(fields)) {
+ const field = fields[fieldName];
+ const {
+ required: fieldRequired,
+ definition: fieldDefinition,
+ definitions: typeDefinitions
+ } = getJSONSchemaFromGraphQLType(field, options);
+ fieldDef.properties[fieldName] = fieldDefinition;
+ if (fieldRequired) {
+ fieldDef.required.push(fieldName);
+ }
+ if (typeDefinitions) {
+ for (const [defName, value] of Object.entries(typeDefinitions)) {
+ definitions[defName] = value;
+ }
+ }
+ }
+ definitions[baseType.name] = fieldDef;
+ }
+ }
+ if ('defaultValue' in fieldOrType && fieldOrType.defaultValue !== undefined) {
+ definition.default = fieldOrType.defaultValue;
+ }
+ const {
+ description
+ } = definition;
+ definition.description = renderDefinitionDescription(fieldOrType, false, description);
+ if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
+ definition.markdownDescription = renderDefinitionDescription(fieldOrType, true, description);
+ }
+ return {
+ required,
+ definition,
+ definitions
+ };
+}
+function getVariablesJSONSchema(variableToType, options) {
+ var _a;
+ const jsonSchema = {
+ $schema: 'http://json-schema.org/draft-04/schema',
+ type: 'object',
+ properties: {},
+ required: []
+ };
+ const runtimeOptions = Object.assign(Object.assign({}, options), {
+ definitionMarker: new Marker(),
+ scalarSchemas: Object.assign(Object.assign({}, defaultScalarTypesMap), options === null || options === void 0 ? void 0 : options.scalarSchemas)
+ });
+ if (variableToType) {
+ for (const [variableName, type] of Object.entries(variableToType)) {
+ const {
+ definition,
+ required,
+ definitions
+ } = getJSONSchemaFromGraphQLType(type, runtimeOptions);
+ jsonSchema.properties[variableName] = definition;
+ if (required) {
+ (_a = jsonSchema.required) === null || _a === void 0 ? void 0 : _a.push(variableName);
+ }
+ if (definitions) {
+ jsonSchema.definitions = Object.assign(Object.assign({}, jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.definitions), definitions);
+ }
+ }
+ }
+ return jsonSchema;
+}
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/index.js":
+/*!*********************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/index.js ***!
+ \*********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+Object.defineProperty(exports, "Position", ({
+ enumerable: true,
+ get: function () {
+ return _Range.Position;
+ }
+}));
+Object.defineProperty(exports, "Range", ({
+ enumerable: true,
+ get: function () {
+ return _Range.Range;
+ }
+}));
+Object.defineProperty(exports, "collectVariables", ({
+ enumerable: true,
+ get: function () {
+ return _collectVariables.collectVariables;
+ }
+}));
+Object.defineProperty(exports, "getASTNodeAtPosition", ({
+ enumerable: true,
+ get: function () {
+ return _getASTNodeAtPosition.getASTNodeAtPosition;
+ }
+}));
+Object.defineProperty(exports, "getFragmentDependencies", ({
+ enumerable: true,
+ get: function () {
+ return _fragmentDependencies.getFragmentDependencies;
+ }
+}));
+Object.defineProperty(exports, "getFragmentDependenciesForAST", ({
+ enumerable: true,
+ get: function () {
+ return _fragmentDependencies.getFragmentDependenciesForAST;
+ }
+}));
+Object.defineProperty(exports, "getOperationASTFacts", ({
+ enumerable: true,
+ get: function () {
+ return _getOperationFacts.getOperationASTFacts;
+ }
+}));
+Object.defineProperty(exports, "getOperationFacts", ({
+ enumerable: true,
+ get: function () {
+ return _getOperationFacts.default;
+ }
+}));
+Object.defineProperty(exports, "getQueryFacts", ({
+ enumerable: true,
+ get: function () {
+ return _getOperationFacts.getQueryFacts;
+ }
+}));
+Object.defineProperty(exports, "getVariablesJSONSchema", ({
+ enumerable: true,
+ get: function () {
+ return _getVariablesJSONSchema.getVariablesJSONSchema;
+ }
+}));
+Object.defineProperty(exports, "locToRange", ({
+ enumerable: true,
+ get: function () {
+ return _Range.locToRange;
+ }
+}));
+Object.defineProperty(exports, "offsetToPosition", ({
+ enumerable: true,
+ get: function () {
+ return _Range.offsetToPosition;
+ }
+}));
+Object.defineProperty(exports, "pointToOffset", ({
+ enumerable: true,
+ get: function () {
+ return _getASTNodeAtPosition.pointToOffset;
+ }
+}));
+Object.defineProperty(exports, "validateWithCustomRules", ({
+ enumerable: true,
+ get: function () {
+ return _validateWithCustomRules.validateWithCustomRules;
+ }
+}));
+var _fragmentDependencies = __webpack_require__(/*! ./fragmentDependencies */ "../../graphql-language-service/esm/utils/fragmentDependencies.js");
+var _getVariablesJSONSchema = __webpack_require__(/*! ./getVariablesJSONSchema */ "../../graphql-language-service/esm/utils/getVariablesJSONSchema.js");
+var _getASTNodeAtPosition = __webpack_require__(/*! ./getASTNodeAtPosition */ "../../graphql-language-service/esm/utils/getASTNodeAtPosition.js");
+var _Range = __webpack_require__(/*! ./Range */ "../../graphql-language-service/esm/utils/Range.js");
+var _validateWithCustomRules = __webpack_require__(/*! ./validateWithCustomRules */ "../../graphql-language-service/esm/utils/validateWithCustomRules.js");
+var _collectVariables = __webpack_require__(/*! ./collectVariables */ "../../graphql-language-service/esm/utils/collectVariables.js");
+var _getOperationFacts = _interopRequireWildcard(__webpack_require__(/*! ./getOperationFacts */ "../../graphql-language-service/esm/utils/getOperationFacts.js"));
+function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
+function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
+
+/***/ }),
+
+/***/ "../../graphql-language-service/esm/utils/validateWithCustomRules.js":
+/*!***************************************************************************!*\
+ !*** ../../graphql-language-service/esm/utils/validateWithCustomRules.js ***!
+ \***************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.validateWithCustomRules = validateWithCustomRules;
+var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
+const specifiedSDLRules = [_graphql.LoneSchemaDefinitionRule, _graphql.UniqueOperationTypesRule, _graphql.UniqueTypeNamesRule, _graphql.UniqueEnumValueNamesRule, _graphql.UniqueFieldDefinitionNamesRule, _graphql.UniqueDirectiveNamesRule, _graphql.KnownTypeNamesRule, _graphql.KnownDirectivesRule, _graphql.UniqueDirectivesPerLocationRule, _graphql.PossibleTypeExtensionsRule, _graphql.UniqueArgumentNamesRule, _graphql.UniqueInputFieldNamesRule, _graphql.UniqueVariableNamesRule, _graphql.FragmentsOnCompositeTypesRule, _graphql.ProvidedRequiredArgumentsRule];
+function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) {
+ const rules = _graphql.specifiedRules.filter(rule => {
+ if (rule === _graphql.NoUnusedFragmentsRule || rule === _graphql.ExecutableDefinitionsRule) {
+ return false;
+ }
+ if (isRelayCompatMode && rule === _graphql.KnownFragmentNamesRule) {
+ return false;
+ }
+ return true;
+ });
+ if (customRules) {
+ Array.prototype.push.apply(rules, customRules);
+ }
+ if (isSchemaDocument) {
+ Array.prototype.push.apply(rules, specifiedSDLRules);
+ }
+ const errors = (0, _graphql.validate)(schema, ast, rules);
+ return errors.filter(error => {
+ if (error.message.includes('Unknown directive') && error.nodes) {
+ const node = error.nodes[0];
+ if (node && node.kind === _graphql.Kind.DIRECTIVE) {
+ const name = node.name.value;
+ if (name === 'arguments' || name === 'argumentDefinitions') {
+ return false;
+ }
+ }
+ }
+ return true;
+ });
+}
+
+/***/ }),
+
+/***/ "./style.css":
+/*!*******************!*\
+ !*** ./style.css ***!
+ \*******************/
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "../../graphiql-react/dist/style.css":
+/*!*******************************************!*\
+ !*** ../../graphiql-react/dist/style.css ***!
+ \*******************************************/
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "../../graphiql-react/font/fira-code.css":
+/*!***********************************************!*\
+ !*** ../../graphiql-react/font/fira-code.css ***!
+ \***********************************************/
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "../../graphiql-react/font/roboto.css":
+/*!********************************************!*\
+ !*** ../../graphiql-react/font/roboto.css ***!
+ \********************************************/
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "react":
+/*!************************!*\
+ !*** external "React" ***!
+ \************************/
+/***/ (function(module) {
+
+module.exports = window["React"];
+
+/***/ }),
+
+/***/ "react-dom":
+/*!***************************!*\
+ !*** external "ReactDOM" ***!
+ \***************************/
+/***/ (function(module) {
+
+module.exports = window["ReactDOM"];
+
+/***/ }),
+
+/***/ "../../../node_modules/@headlessui/react/dist/headlessui.dev.cjs":
+/*!***********************************************************************!*\
+ !*** ../../../node_modules/@headlessui/react/dist/headlessui.dev.cjs ***!
+ \***********************************************************************/
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+
+var __create = Object.create;
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __getProtoOf = Object.getPrototypeOf;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
+};
+var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
+ // If the importer is in node compatibility mode or this is not an ESM
+ // file that has been converted to a CommonJS file using a Babel-
+ // compatible transform (i.e. "__esModule" has not been set), then set
+ // "default" to the CommonJS "module.exports" for node compatibility.
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
+ mod
+));
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+var __publicField = (obj, key, value) => {
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+};
+
+// src/index.ts
+var src_exports = {};
+__export(src_exports, {
+ Combobox: () => Combobox,
+ Dialog: () => Dialog,
+ Disclosure: () => Disclosure,
+ FocusTrap: () => FocusTrap,
+ Listbox: () => Listbox,
+ Menu: () => Menu,
+ Popover: () => Popover,
+ Portal: () => Portal,
+ RadioGroup: () => RadioGroup,
+ Switch: () => Switch,
+ Tab: () => Tab,
+ Transition: () => Transition
+});
+module.exports = __toCommonJS(src_exports);
+
+// src/components/combobox/combobox.tsx
+var import_react19 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/hooks/use-computed.ts
+var import_react3 = __webpack_require__(/*! react */ "react");
+
+// src/hooks/use-iso-morphic-effect.ts
+var import_react = __webpack_require__(/*! react */ "react");
+
+// src/utils/env.ts
+var Env = class {
+ constructor() {
+ __publicField(this, "current", this.detect());
+ __publicField(this, "handoffState", "pending");
+ __publicField(this, "currentId", 0);
+ }
+ set(env2) {
+ if (this.current === env2)
+ return;
+ this.handoffState = "pending";
+ this.currentId = 0;
+ this.current = env2;
+ }
+ reset() {
+ this.set(this.detect());
+ }
+ nextId() {
+ return ++this.currentId;
+ }
+ get isServer() {
+ return this.current === "server";
+ }
+ get isClient() {
+ return this.current === "client";
+ }
+ detect() {
+ if (typeof window === "undefined" || typeof document === "undefined") {
+ return "server";
+ }
+ return "client";
+ }
+ handoff() {
+ if (this.handoffState === "pending") {
+ this.handoffState = "complete";
+ }
+ }
+ get isHandoffComplete() {
+ return this.handoffState === "complete";
+ }
+};
+var env = new Env();
+
+// src/hooks/use-iso-morphic-effect.ts
+var useIsoMorphicEffect = (effect, deps) => {
+ if (env.isServer) {
+ (0, import_react.useEffect)(effect, deps);
+ } else {
+ (0, import_react.useLayoutEffect)(effect, deps);
+ }
+};
+
+// src/hooks/use-latest-value.ts
+var import_react2 = __webpack_require__(/*! react */ "react");
+function useLatestValue(value) {
+ let cache = (0, import_react2.useRef)(value);
+ useIsoMorphicEffect(() => {
+ cache.current = value;
+ }, [value]);
+ return cache;
+}
+
+// src/hooks/use-computed.ts
+function useComputed(cb, dependencies) {
+ let [value, setValue] = (0, import_react3.useState)(cb);
+ let cbRef = useLatestValue(cb);
+ useIsoMorphicEffect(() => setValue(cbRef.current), [cbRef, setValue, ...dependencies]);
+ return value;
+}
+
+// src/hooks/use-disposables.ts
+var import_react4 = __webpack_require__(/*! react */ "react");
+
+// src/utils/micro-task.ts
+function microTask(cb) {
+ if (typeof queueMicrotask === "function") {
+ queueMicrotask(cb);
+ } else {
+ Promise.resolve().then(cb).catch(
+ (e) => setTimeout(() => {
+ throw e;
+ })
+ );
+ }
+}
+
+// src/utils/disposables.ts
+function disposables() {
+ let _disposables = [];
+ let api = {
+ addEventListener(element, name, listener, options) {
+ element.addEventListener(name, listener, options);
+ return api.add(() => element.removeEventListener(name, listener, options));
+ },
+ requestAnimationFrame(...args) {
+ let raf = requestAnimationFrame(...args);
+ return api.add(() => cancelAnimationFrame(raf));
+ },
+ nextFrame(...args) {
+ return api.requestAnimationFrame(() => {
+ return api.requestAnimationFrame(...args);
+ });
+ },
+ setTimeout(...args) {
+ let timer = setTimeout(...args);
+ return api.add(() => clearTimeout(timer));
+ },
+ microTask(...args) {
+ let task = { current: true };
+ microTask(() => {
+ if (task.current) {
+ args[0]();
+ }
+ });
+ return api.add(() => {
+ task.current = false;
+ });
+ },
+ style(node, property, value) {
+ let previous = node.style.getPropertyValue(property);
+ Object.assign(node.style, { [property]: value });
+ return this.add(() => {
+ Object.assign(node.style, { [property]: previous });
+ });
+ },
+ group(cb) {
+ let d = disposables();
+ cb(d);
+ return this.add(() => d.dispose());
+ },
+ add(cb) {
+ _disposables.push(cb);
+ return () => {
+ let idx = _disposables.indexOf(cb);
+ if (idx >= 0) {
+ for (let dispose of _disposables.splice(idx, 1)) {
+ dispose();
+ }
+ }
+ };
+ },
+ dispose() {
+ for (let dispose of _disposables.splice(0)) {
+ dispose();
+ }
+ }
+ };
+ return api;
+}
+
+// src/hooks/use-disposables.ts
+function useDisposables() {
+ let [d] = (0, import_react4.useState)(disposables);
+ (0, import_react4.useEffect)(() => () => d.dispose(), [d]);
+ return d;
+}
+
+// src/hooks/use-event.ts
+var import_react5 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var useEvent = (
+ // TODO: Add React.useEvent ?? once the useEvent hook is available
+ function useEvent2(cb) {
+ let cache = useLatestValue(cb);
+ return import_react5.default.useCallback((...args) => cache.current(...args), [cache]);
+ }
+);
+
+// src/hooks/use-id.ts
+var import_react7 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/hooks/use-server-handoff-complete.ts
+var import_react6 = __webpack_require__(/*! react */ "react");
+function useServerHandoffComplete() {
+ let [complete, setComplete] = (0, import_react6.useState)(env.isHandoffComplete);
+ if (complete && env.isHandoffComplete === false) {
+ setComplete(false);
+ }
+ (0, import_react6.useEffect)(() => {
+ if (complete === true)
+ return;
+ setComplete(true);
+ }, [complete]);
+ (0, import_react6.useEffect)(() => env.handoff(), []);
+ return complete;
+}
+
+// src/hooks/use-id.ts
+var _a;
+var useId = (
+ // Prefer React's `useId` if it's available.
+ // @ts-expect-error - `useId` doesn't exist in React < 18.
+ (_a = import_react7.default.useId) != null ? _a : function useId2() {
+ let ready = useServerHandoffComplete();
+ let [id, setId] = import_react7.default.useState(ready ? () => env.nextId() : null);
+ useIsoMorphicEffect(() => {
+ if (id === null)
+ setId(env.nextId());
+ }, [id]);
+ return id != null ? "" + id : void 0;
+ }
+);
+
+// src/hooks/use-outside-click.ts
+var import_react10 = __webpack_require__(/*! react */ "react");
+
+// src/utils/match.ts
+function match(value, lookup, ...args) {
+ if (value in lookup) {
+ let returnValue = lookup[value];
+ return typeof returnValue === "function" ? returnValue(...args) : returnValue;
+ }
+ let error = new Error(
+ `Tried to handle "${value}" but there is no handler defined. Only defined handlers are: ${Object.keys(
+ lookup
+ ).map((key) => `"${key}"`).join(", ")}.`
+ );
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(error, match);
+ throw error;
+}
+
+// src/utils/owner.ts
+function getOwnerDocument(element) {
+ if (env.isServer)
+ return null;
+ if (element instanceof Node)
+ return element.ownerDocument;
+ if (element == null ? void 0 : element.hasOwnProperty("current")) {
+ if (element.current instanceof Node)
+ return element.current.ownerDocument;
+ }
+ return document;
+}
+
+// src/utils/focus-management.ts
+var focusableSelector = [
+ "[contentEditable=true]",
+ "[tabindex]",
+ "a[href]",
+ "area[href]",
+ "button:not([disabled])",
+ "iframe",
+ "input:not([disabled])",
+ "select:not([disabled])",
+ "textarea:not([disabled])"
+].map(
+ false ? (
+ // TODO: Remove this once JSDOM fixes the issue where an element that is
+ // "hidden" can be the document.activeElement, because this is not possible
+ // in real browsers.
+ 0
+ ) : (selector) => `${selector}:not([tabindex='-1'])`
+).join(",");
+function getFocusableElements(container = document.body) {
+ if (container == null)
+ return [];
+ return Array.from(container.querySelectorAll(focusableSelector)).sort(
+ // We want to move `tabIndex={0}` to the end of the list, this is what the browser does as well.
+ (a, z) => Math.sign((a.tabIndex || Number.MAX_SAFE_INTEGER) - (z.tabIndex || Number.MAX_SAFE_INTEGER))
+ );
+}
+function isFocusableElement(element, mode = 0 /* Strict */) {
+ var _a3;
+ if (element === ((_a3 = getOwnerDocument(element)) == null ? void 0 : _a3.body))
+ return false;
+ return match(mode, {
+ [0 /* Strict */]() {
+ return element.matches(focusableSelector);
+ },
+ [1 /* Loose */]() {
+ let next = element;
+ while (next !== null) {
+ if (next.matches(focusableSelector))
+ return true;
+ next = next.parentElement;
+ }
+ return false;
+ }
+ });
+}
+function restoreFocusIfNecessary(element) {
+ let ownerDocument = getOwnerDocument(element);
+ disposables().nextFrame(() => {
+ if (ownerDocument && !isFocusableElement(ownerDocument.activeElement, 0 /* Strict */)) {
+ focusElement(element);
+ }
+ });
+}
+if (typeof window !== "undefined" && typeof document !== "undefined") {
+ document.addEventListener(
+ "keydown",
+ (event) => {
+ if (event.metaKey || event.altKey || event.ctrlKey) {
+ return;
+ }
+ document.documentElement.dataset.headlessuiFocusVisible = "";
+ },
+ true
+ );
+ document.addEventListener(
+ "click",
+ (event) => {
+ if (event.detail === 1 /* Mouse */) {
+ delete document.documentElement.dataset.headlessuiFocusVisible;
+ } else if (event.detail === 0 /* Keyboard */) {
+ document.documentElement.dataset.headlessuiFocusVisible = "";
+ }
+ },
+ true
+ );
+}
+function focusElement(element) {
+ element == null ? void 0 : element.focus({ preventScroll: true });
+}
+var selectableSelector = ["textarea", "input"].join(",");
+function isSelectableElement(element) {
+ var _a3, _b;
+ return (_b = (_a3 = element == null ? void 0 : element.matches) == null ? void 0 : _a3.call(element, selectableSelector)) != null ? _b : false;
+}
+function sortByDomNode(nodes, resolveKey = (i) => i) {
+ return nodes.slice().sort((aItem, zItem) => {
+ let a = resolveKey(aItem);
+ let z = resolveKey(zItem);
+ if (a === null || z === null)
+ return 0;
+ let position = a.compareDocumentPosition(z);
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING)
+ return -1;
+ if (position & Node.DOCUMENT_POSITION_PRECEDING)
+ return 1;
+ return 0;
+ });
+}
+function focusFrom(current, focus) {
+ return focusIn(getFocusableElements(), focus, { relativeTo: current });
+}
+function focusIn(container, focus, {
+ sorted = true,
+ relativeTo = null,
+ skipElements = []
+} = {}) {
+ let ownerDocument = Array.isArray(container) ? container.length > 0 ? container[0].ownerDocument : document : container.ownerDocument;
+ let elements = Array.isArray(container) ? sorted ? sortByDomNode(container) : container : getFocusableElements(container);
+ if (skipElements.length > 0 && elements.length > 1) {
+ elements = elements.filter((x) => !skipElements.includes(x));
+ }
+ relativeTo = relativeTo != null ? relativeTo : ownerDocument.activeElement;
+ let direction = (() => {
+ if (focus & (1 /* First */ | 4 /* Next */))
+ return 1 /* Next */;
+ if (focus & (2 /* Previous */ | 8 /* Last */))
+ return -1 /* Previous */;
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
+ })();
+ let startIndex = (() => {
+ if (focus & 1 /* First */)
+ return 0;
+ if (focus & 2 /* Previous */)
+ return Math.max(0, elements.indexOf(relativeTo)) - 1;
+ if (focus & 4 /* Next */)
+ return Math.max(0, elements.indexOf(relativeTo)) + 1;
+ if (focus & 8 /* Last */)
+ return elements.length - 1;
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
+ })();
+ let focusOptions = focus & 32 /* NoScroll */ ? { preventScroll: true } : {};
+ let offset = 0;
+ let total = elements.length;
+ let next = void 0;
+ do {
+ if (offset >= total || offset + total <= 0)
+ return 0 /* Error */;
+ let nextIdx = startIndex + offset;
+ if (focus & 16 /* WrapAround */) {
+ nextIdx = (nextIdx + total) % total;
+ } else {
+ if (nextIdx < 0)
+ return 3 /* Underflow */;
+ if (nextIdx >= total)
+ return 1 /* Overflow */;
+ }
+ next = elements[nextIdx];
+ next == null ? void 0 : next.focus(focusOptions);
+ offset += direction;
+ } while (next !== ownerDocument.activeElement);
+ if (focus & (4 /* Next */ | 2 /* Previous */) && isSelectableElement(next)) {
+ next.select();
+ }
+ return 2 /* Success */;
+}
+
+// src/hooks/use-document-event.ts
+var import_react8 = __webpack_require__(/*! react */ "react");
+function useDocumentEvent(type, listener, options) {
+ let listenerRef = useLatestValue(listener);
+ (0, import_react8.useEffect)(() => {
+ function handler(event) {
+ listenerRef.current(event);
+ }
+ document.addEventListener(type, handler, options);
+ return () => document.removeEventListener(type, handler, options);
+ }, [type, options]);
+}
+
+// src/hooks/use-window-event.ts
+var import_react9 = __webpack_require__(/*! react */ "react");
+function useWindowEvent(type, listener, options) {
+ let listenerRef = useLatestValue(listener);
+ (0, import_react9.useEffect)(() => {
+ function handler(event) {
+ listenerRef.current(event);
+ }
+ window.addEventListener(type, handler, options);
+ return () => window.removeEventListener(type, handler, options);
+ }, [type, options]);
+}
+
+// src/hooks/use-outside-click.ts
+function useOutsideClick(containers, cb, enabled = true) {
+ let enabledRef = (0, import_react10.useRef)(false);
+ (0, import_react10.useEffect)(
+ false ? 0 : () => {
+ requestAnimationFrame(() => {
+ enabledRef.current = enabled;
+ });
+ },
+ [enabled]
+ );
+ function handleOutsideClick(event, resolveTarget) {
+ if (!enabledRef.current)
+ return;
+ if (event.defaultPrevented)
+ return;
+ let target = resolveTarget(event);
+ if (target === null) {
+ return;
+ }
+ if (!target.getRootNode().contains(target))
+ return;
+ let _containers = function resolve(containers2) {
+ if (typeof containers2 === "function") {
+ return resolve(containers2());
+ }
+ if (Array.isArray(containers2)) {
+ return containers2;
+ }
+ if (containers2 instanceof Set) {
+ return containers2;
+ }
+ return [containers2];
+ }(containers);
+ for (let container of _containers) {
+ if (container === null)
+ continue;
+ let domNode = container instanceof HTMLElement ? container : container.current;
+ if (domNode == null ? void 0 : domNode.contains(target)) {
+ return;
+ }
+ if (event.composed && event.composedPath().includes(domNode)) {
+ return;
+ }
+ }
+ if (
+ // This check alllows us to know whether or not we clicked on a "focusable" element like a
+ // button or an input. This is a backwards compatibility check so that you can open a
and click on another which should close Menu A and open Menu B. We might
+ // revisit that so that you will require 2 clicks instead.
+ !isFocusableElement(target, 1 /* Loose */) && // This could be improved, but the `Combobox.Button` adds tabIndex={-1} to make it
+ // unfocusable via the keyboard so that tabbing to the next item from the input doesn't
+ // first go to the button.
+ target.tabIndex !== -1
+ ) {
+ event.preventDefault();
+ }
+ return cb(event, target);
+ }
+ let initialClickTarget = (0, import_react10.useRef)(null);
+ useDocumentEvent(
+ "mousedown",
+ (event) => {
+ var _a3, _b;
+ if (enabledRef.current) {
+ initialClickTarget.current = ((_b = (_a3 = event.composedPath) == null ? void 0 : _a3.call(event)) == null ? void 0 : _b[0]) || event.target;
+ }
+ },
+ true
+ );
+ useDocumentEvent(
+ "click",
+ (event) => {
+ if (!initialClickTarget.current) {
+ return;
+ }
+ handleOutsideClick(event, () => {
+ return initialClickTarget.current;
+ });
+ initialClickTarget.current = null;
+ },
+ // We will use the `capture` phase so that layers in between with `event.stopPropagation()`
+ // don't "cancel" this outside click check. E.g.: A `Menu` inside a `DialogPanel` if the `Menu`
+ // is open, and you click outside of it in the `DialogPanel` the `Menu` should close. However,
+ // the `DialogPanel` has a `onClick(e) { e.stopPropagation() }` which would cancel this.
+ true
+ );
+ useWindowEvent(
+ "blur",
+ (event) => handleOutsideClick(
+ event,
+ () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null
+ ),
+ true
+ );
+}
+
+// src/hooks/use-resolve-button-type.ts
+var import_react11 = __webpack_require__(/*! react */ "react");
+function resolveType(props) {
+ var _a3;
+ if (props.type)
+ return props.type;
+ let tag = (_a3 = props.as) != null ? _a3 : "button";
+ if (typeof tag === "string" && tag.toLowerCase() === "button")
+ return "button";
+ return void 0;
+}
+function useResolveButtonType(props, ref) {
+ let [type, setType] = (0, import_react11.useState)(() => resolveType(props));
+ useIsoMorphicEffect(() => {
+ setType(resolveType(props));
+ }, [props.type, props.as]);
+ useIsoMorphicEffect(() => {
+ if (type)
+ return;
+ if (!ref.current)
+ return;
+ if (ref.current instanceof HTMLButtonElement && !ref.current.hasAttribute("type")) {
+ setType("button");
+ }
+ }, [type, ref]);
+ return type;
+}
+
+// src/hooks/use-sync-refs.ts
+var import_react12 = __webpack_require__(/*! react */ "react");
+var Optional = Symbol();
+function optionalRef(cb, isOptional = true) {
+ return Object.assign(cb, { [Optional]: isOptional });
+}
+function useSyncRefs(...refs) {
+ let cache = (0, import_react12.useRef)(refs);
+ (0, import_react12.useEffect)(() => {
+ cache.current = refs;
+ }, [refs]);
+ let syncRefs = useEvent((value) => {
+ for (let ref of cache.current) {
+ if (ref == null)
+ continue;
+ if (typeof ref === "function")
+ ref(value);
+ else
+ ref.current = value;
+ }
+ });
+ return refs.every(
+ (ref) => ref == null || // @ts-expect-error
+ (ref == null ? void 0 : ref[Optional])
+ ) ? void 0 : syncRefs;
+}
+
+// src/hooks/use-tree-walker.ts
+var import_react13 = __webpack_require__(/*! react */ "react");
+function useTreeWalker({
+ container,
+ accept,
+ walk,
+ enabled = true
+}) {
+ let acceptRef = (0, import_react13.useRef)(accept);
+ let walkRef = (0, import_react13.useRef)(walk);
+ (0, import_react13.useEffect)(() => {
+ acceptRef.current = accept;
+ walkRef.current = walk;
+ }, [accept, walk]);
+ useIsoMorphicEffect(() => {
+ if (!container)
+ return;
+ if (!enabled)
+ return;
+ let ownerDocument = getOwnerDocument(container);
+ if (!ownerDocument)
+ return;
+ let accept2 = acceptRef.current;
+ let walk2 = walkRef.current;
+ let acceptNode = Object.assign((node) => accept2(node), { acceptNode: accept2 });
+ let walker = ownerDocument.createTreeWalker(
+ container,
+ NodeFilter.SHOW_ELEMENT,
+ acceptNode,
+ // @ts-expect-error This `false` is a simple small fix for older browsers
+ false
+ );
+ while (walker.nextNode())
+ walk2(walker.currentNode);
+ }, [container, enabled, acceptRef, walkRef]);
+}
+
+// src/utils/calculate-active-index.ts
+function assertNever(x) {
+ throw new Error("Unexpected object: " + x);
+}
+function calculateActiveIndex(action, resolvers) {
+ let items = resolvers.resolveItems();
+ if (items.length <= 0)
+ return null;
+ let currentActiveIndex = resolvers.resolveActiveIndex();
+ let activeIndex = currentActiveIndex != null ? currentActiveIndex : -1;
+ let nextActiveIndex = (() => {
+ switch (action.focus) {
+ case 0 /* First */:
+ return items.findIndex((item) => !resolvers.resolveDisabled(item));
+ case 1 /* Previous */: {
+ let idx = items.slice().reverse().findIndex((item, idx2, all) => {
+ if (activeIndex !== -1 && all.length - idx2 - 1 >= activeIndex)
+ return false;
+ return !resolvers.resolveDisabled(item);
+ });
+ if (idx === -1)
+ return idx;
+ return items.length - 1 - idx;
+ }
+ case 2 /* Next */:
+ return items.findIndex((item, idx) => {
+ if (idx <= activeIndex)
+ return false;
+ return !resolvers.resolveDisabled(item);
+ });
+ case 3 /* Last */: {
+ let idx = items.slice().reverse().findIndex((item) => !resolvers.resolveDisabled(item));
+ if (idx === -1)
+ return idx;
+ return items.length - 1 - idx;
+ }
+ case 4 /* Specific */:
+ return items.findIndex((item) => resolvers.resolveId(item) === action.id);
+ case 5 /* Nothing */:
+ return null;
+ default:
+ assertNever(action);
+ }
+ })();
+ return nextActiveIndex === -1 ? currentActiveIndex : nextActiveIndex;
+}
+
+// src/utils/render.ts
+var import_react14 = __webpack_require__(/*! react */ "react");
+
+// src/utils/class-names.ts
+function classNames(...classes) {
+ return classes.filter(Boolean).join(" ");
+}
+
+// src/utils/render.ts
+function render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag,
+ features,
+ visible = true,
+ name
+}) {
+ let props = mergeProps(theirProps, ourProps);
+ if (visible)
+ return _render(props, slot, defaultTag, name);
+ let featureFlags = features != null ? features : 0 /* None */;
+ if (featureFlags & 2 /* Static */) {
+ let { static: isStatic = false, ...rest } = props;
+ if (isStatic)
+ return _render(rest, slot, defaultTag, name);
+ }
+ if (featureFlags & 1 /* RenderStrategy */) {
+ let { unmount = true, ...rest } = props;
+ let strategy = unmount ? 0 /* Unmount */ : 1 /* Hidden */;
+ return match(strategy, {
+ [0 /* Unmount */]() {
+ return null;
+ },
+ [1 /* Hidden */]() {
+ return _render(
+ { ...rest, ...{ hidden: true, style: { display: "none" } } },
+ slot,
+ defaultTag,
+ name
+ );
+ }
+ });
+ }
+ return _render(props, slot, defaultTag, name);
+}
+function _render(props, slot = {}, tag, name) {
+ let {
+ as: Component = tag,
+ children,
+ refName = "ref",
+ ...rest
+ } = omit(props, ["unmount", "static"]);
+ let refRelatedProps = props.ref !== void 0 ? { [refName]: props.ref } : {};
+ let resolvedChildren = typeof children === "function" ? children(slot) : children;
+ if ("className" in rest && rest.className && typeof rest.className === "function") {
+ rest.className = rest.className(slot);
+ }
+ let dataAttributes = {};
+ if (slot) {
+ let exposeState = false;
+ let states = [];
+ for (let [k, v] of Object.entries(slot)) {
+ if (typeof v === "boolean") {
+ exposeState = true;
+ }
+ if (v === true) {
+ states.push(k);
+ }
+ }
+ if (exposeState)
+ dataAttributes[`data-headlessui-state`] = states.join(" ");
+ }
+ if (Component === import_react14.Fragment) {
+ if (Object.keys(compact(rest)).length > 0) {
+ if (!(0, import_react14.isValidElement)(resolvedChildren) || Array.isArray(resolvedChildren) && resolvedChildren.length > 1) {
+ throw new Error(
+ [
+ 'Passing props on "Fragment"!',
+ "",
+ `The current component <${name} /> is rendering a "Fragment".`,
+ `However we need to passthrough the following props:`,
+ Object.keys(rest).map((line) => ` - ${line}`).join("\n"),
+ "",
+ "You can apply a few solutions:",
+ [
+ 'Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',
+ "Render a single element as the child so that we can forward the props onto that element."
+ ].map((line) => ` - ${line}`).join("\n")
+ ].join("\n")
+ );
+ }
+ let childProps = resolvedChildren.props;
+ let newClassName = typeof (childProps == null ? void 0 : childProps.className) === "function" ? (...args) => classNames(childProps == null ? void 0 : childProps.className(...args), rest.className) : classNames(childProps == null ? void 0 : childProps.className, rest.className);
+ let classNameProps = newClassName ? { className: newClassName } : {};
+ return (0, import_react14.cloneElement)(
+ resolvedChildren,
+ Object.assign(
+ {},
+ // Filter out undefined values so that they don't override the existing values
+ mergeProps(resolvedChildren.props, compact(omit(rest, ["ref"]))),
+ dataAttributes,
+ refRelatedProps,
+ mergeRefs(resolvedChildren.ref, refRelatedProps.ref),
+ classNameProps
+ )
+ );
+ }
+ }
+ return (0, import_react14.createElement)(
+ Component,
+ Object.assign(
+ {},
+ omit(rest, ["ref"]),
+ Component !== import_react14.Fragment && refRelatedProps,
+ Component !== import_react14.Fragment && dataAttributes
+ ),
+ resolvedChildren
+ );
+}
+function mergeRefs(...refs) {
+ return {
+ ref: refs.every((ref) => ref == null) ? void 0 : (value) => {
+ for (let ref of refs) {
+ if (ref == null)
+ continue;
+ if (typeof ref === "function")
+ ref(value);
+ else
+ ref.current = value;
+ }
+ }
+ };
+}
+function mergeProps(...listOfProps) {
+ var _a3;
+ if (listOfProps.length === 0)
+ return {};
+ if (listOfProps.length === 1)
+ return listOfProps[0];
+ let target = {};
+ let eventHandlers = {};
+ for (let props of listOfProps) {
+ for (let prop in props) {
+ if (prop.startsWith("on") && typeof props[prop] === "function") {
+ (_a3 = eventHandlers[prop]) != null ? _a3 : eventHandlers[prop] = [];
+ eventHandlers[prop].push(props[prop]);
+ } else {
+ target[prop] = props[prop];
+ }
+ }
+ }
+ if (target.disabled || target["aria-disabled"]) {
+ return Object.assign(
+ target,
+ // Set all event listeners that we collected to `undefined`. This is
+ // important because of the `cloneElement` from above, which merges the
+ // existing and new props, they don't just override therefore we have to
+ // explicitly nullify them.
+ Object.fromEntries(Object.keys(eventHandlers).map((eventName) => [eventName, void 0]))
+ );
+ }
+ for (let eventName in eventHandlers) {
+ Object.assign(target, {
+ [eventName](event, ...args) {
+ let handlers = eventHandlers[eventName];
+ for (let handler of handlers) {
+ if ((event instanceof Event || (event == null ? void 0 : event.nativeEvent) instanceof Event) && event.defaultPrevented) {
+ return;
+ }
+ handler(event, ...args);
+ }
+ }
+ });
+ }
+ return target;
+}
+function forwardRefWithAs(component) {
+ var _a3;
+ return Object.assign((0, import_react14.forwardRef)(component), {
+ displayName: (_a3 = component.displayName) != null ? _a3 : component.name
+ });
+}
+function compact(object) {
+ let clone = Object.assign({}, object);
+ for (let key in clone) {
+ if (clone[key] === void 0)
+ delete clone[key];
+ }
+ return clone;
+}
+function omit(object, keysToOmit = []) {
+ let clone = Object.assign({}, object);
+ for (let key of keysToOmit) {
+ if (key in clone)
+ delete clone[key];
+ }
+ return clone;
+}
+
+// src/utils/bugs.ts
+function isDisabledReactIssue7711(element) {
+ let parent = element.parentElement;
+ let legend = null;
+ while (parent && !(parent instanceof HTMLFieldSetElement)) {
+ if (parent instanceof HTMLLegendElement)
+ legend = parent;
+ parent = parent.parentElement;
+ }
+ let isParentDisabled = (parent == null ? void 0 : parent.getAttribute("disabled")) === "";
+ if (isParentDisabled && isFirstLegend(legend))
+ return false;
+ return isParentDisabled;
+}
+function isFirstLegend(element) {
+ if (!element)
+ return false;
+ let previous = element.previousElementSibling;
+ while (previous !== null) {
+ if (previous instanceof HTMLLegendElement)
+ return false;
+ previous = previous.previousElementSibling;
+ }
+ return true;
+}
+
+// src/utils/form.ts
+function objectToFormEntries(source = {}, parentKey = null, entries = []) {
+ for (let [key, value] of Object.entries(source)) {
+ append(entries, composeKey(parentKey, key), value);
+ }
+ return entries;
+}
+function composeKey(parent, key) {
+ return parent ? parent + "[" + key + "]" : key;
+}
+function append(entries, key, value) {
+ if (Array.isArray(value)) {
+ for (let [subkey, subvalue] of value.entries()) {
+ append(entries, composeKey(key, subkey.toString()), subvalue);
+ }
+ } else if (value instanceof Date) {
+ entries.push([key, value.toISOString()]);
+ } else if (typeof value === "boolean") {
+ entries.push([key, value ? "1" : "0"]);
+ } else if (typeof value === "string") {
+ entries.push([key, value]);
+ } else if (typeof value === "number") {
+ entries.push([key, `${value}`]);
+ } else if (value === null || value === void 0) {
+ entries.push([key, ""]);
+ } else {
+ objectToFormEntries(value, key, entries);
+ }
+}
+function attemptSubmit(element) {
+ var _a3;
+ let form = (_a3 = element == null ? void 0 : element.form) != null ? _a3 : element.closest("form");
+ if (!form)
+ return;
+ for (let element2 of form.elements) {
+ if (element2.tagName === "INPUT" && element2.type === "submit" || element2.tagName === "BUTTON" && element2.type === "submit" || element2.nodeName === "INPUT" && element2.type === "image") {
+ element2.click();
+ return;
+ }
+ }
+}
+
+// src/internal/hidden.tsx
+var DEFAULT_VISUALLY_HIDDEN_TAG = "div";
+function VisuallyHidden(props, ref) {
+ let { features = 1 /* None */, ...theirProps } = props;
+ let ourProps = {
+ ref,
+ "aria-hidden": (features & 2 /* Focusable */) === 2 /* Focusable */ ? true : void 0,
+ style: {
+ position: "fixed",
+ top: 1,
+ left: 1,
+ width: 1,
+ height: 0,
+ padding: 0,
+ margin: -1,
+ overflow: "hidden",
+ clip: "rect(0, 0, 0, 0)",
+ whiteSpace: "nowrap",
+ borderWidth: "0",
+ ...(features & 4 /* Hidden */) === 4 /* Hidden */ && !((features & 2 /* Focusable */) === 2 /* Focusable */) && { display: "none" }
+ }
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot: {},
+ defaultTag: DEFAULT_VISUALLY_HIDDEN_TAG,
+ name: "Hidden"
+ });
+}
+var Hidden = forwardRefWithAs(VisuallyHidden);
+
+// src/internal/open-closed.tsx
+var import_react15 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var Context = (0, import_react15.createContext)(null);
+Context.displayName = "OpenClosedContext";
+function useOpenClosed() {
+ return (0, import_react15.useContext)(Context);
+}
+function OpenClosedProvider({ value, children }) {
+ return /* @__PURE__ */ import_react15.default.createElement(Context.Provider, { value }, children);
+}
+
+// src/hooks/use-controllable.ts
+var import_react16 = __webpack_require__(/*! react */ "react");
+function useControllable(controlledValue, onChange, defaultValue) {
+ let [internalValue, setInternalValue] = (0, import_react16.useState)(defaultValue);
+ let isControlled = controlledValue !== void 0;
+ let wasControlled = (0, import_react16.useRef)(isControlled);
+ let didWarnOnUncontrolledToControlled = (0, import_react16.useRef)(false);
+ let didWarnOnControlledToUncontrolled = (0, import_react16.useRef)(false);
+ if (isControlled && !wasControlled.current && !didWarnOnUncontrolledToControlled.current) {
+ didWarnOnUncontrolledToControlled.current = true;
+ wasControlled.current = isControlled;
+ console.error(
+ "A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen."
+ );
+ } else if (!isControlled && wasControlled.current && !didWarnOnControlledToUncontrolled.current) {
+ didWarnOnControlledToUncontrolled.current = true;
+ wasControlled.current = isControlled;
+ console.error(
+ "A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen."
+ );
+ }
+ return [
+ isControlled ? controlledValue : internalValue,
+ useEvent((value) => {
+ if (isControlled) {
+ return onChange == null ? void 0 : onChange(value);
+ } else {
+ setInternalValue(value);
+ return onChange == null ? void 0 : onChange(value);
+ }
+ })
+ ];
+}
+
+// src/hooks/use-watch.ts
+var import_react17 = __webpack_require__(/*! react */ "react");
+function useWatch(cb, dependencies) {
+ let track = (0, import_react17.useRef)([]);
+ let action = useEvent(cb);
+ (0, import_react17.useEffect)(() => {
+ let oldValues = [...track.current];
+ for (let [idx, value] of dependencies.entries()) {
+ if (track.current[idx] !== value) {
+ let returnValue = action(dependencies, oldValues);
+ track.current = dependencies;
+ return returnValue;
+ }
+ }
+ }, [action, ...dependencies]);
+}
+
+// src/hooks/use-tracked-pointer.ts
+var import_react18 = __webpack_require__(/*! react */ "react");
+function eventToPosition(evt) {
+ return [evt.screenX, evt.screenY];
+}
+function useTrackedPointer() {
+ let lastPos = (0, import_react18.useRef)([-1, -1]);
+ return {
+ wasMoved(evt) {
+ if (false) {}
+ let newPos = eventToPosition(evt);
+ if (lastPos.current[0] === newPos[0] && lastPos.current[1] === newPos[1]) {
+ return false;
+ }
+ lastPos.current = newPos;
+ return true;
+ },
+ update(evt) {
+ lastPos.current = eventToPosition(evt);
+ }
+ };
+}
+
+// src/utils/platform.ts
+function isIOS() {
+ return (
+ // Check if it is an iPhone
+ /iPhone/gi.test(window.navigator.platform) || // Check if it is an iPad. iPad reports itself as "MacIntel", but we can check if it is a touch
+ // screen. Let's hope that Apple doesn't release a touch screen Mac (or maybe this would then
+ // work as expected 🤔).
+ /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0
+ );
+}
+function isAndroid() {
+ return /Android/gi.test(window.navigator.userAgent);
+}
+function isMobile() {
+ return isIOS() || isAndroid();
+}
+
+// src/components/combobox/combobox.tsx
+function adjustOrderedState(state, adjustment = (i) => i) {
+ let currentActiveOption = state.activeOptionIndex !== null ? state.options[state.activeOptionIndex] : null;
+ let sortedOptions = sortByDomNode(
+ adjustment(state.options.slice()),
+ (option) => option.dataRef.current.domRef.current
+ );
+ let adjustedActiveOptionIndex = currentActiveOption ? sortedOptions.indexOf(currentActiveOption) : null;
+ if (adjustedActiveOptionIndex === -1) {
+ adjustedActiveOptionIndex = null;
+ }
+ return {
+ options: sortedOptions,
+ activeOptionIndex: adjustedActiveOptionIndex
+ };
+}
+var reducers = {
+ [1 /* CloseCombobox */](state) {
+ var _a3;
+ if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled)
+ return state;
+ if (state.comboboxState === 1 /* Closed */)
+ return state;
+ return { ...state, activeOptionIndex: null, comboboxState: 1 /* Closed */ };
+ },
+ [0 /* OpenCombobox */](state) {
+ var _a3;
+ if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled)
+ return state;
+ if (state.comboboxState === 0 /* Open */)
+ return state;
+ let activeOptionIndex = state.activeOptionIndex;
+ if (state.dataRef.current) {
+ let { isSelected } = state.dataRef.current;
+ let optionIdx = state.options.findIndex((option) => isSelected(option.dataRef.current.value));
+ if (optionIdx !== -1) {
+ activeOptionIndex = optionIdx;
+ }
+ }
+ return { ...state, comboboxState: 0 /* Open */, activeOptionIndex };
+ },
+ [2 /* GoToOption */](state, action) {
+ var _a3, _b, _c, _d;
+ if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled)
+ return state;
+ if (((_b = state.dataRef.current) == null ? void 0 : _b.optionsRef.current) && !((_c = state.dataRef.current) == null ? void 0 : _c.optionsPropsRef.current.static) && state.comboboxState === 1 /* Closed */) {
+ return state;
+ }
+ let adjustedState = adjustOrderedState(state);
+ if (adjustedState.activeOptionIndex === null) {
+ let localActiveOptionIndex = adjustedState.options.findIndex(
+ (option) => !option.dataRef.current.disabled
+ );
+ if (localActiveOptionIndex !== -1) {
+ adjustedState.activeOptionIndex = localActiveOptionIndex;
+ }
+ }
+ let activeOptionIndex = calculateActiveIndex(action, {
+ resolveItems: () => adjustedState.options,
+ resolveActiveIndex: () => adjustedState.activeOptionIndex,
+ resolveId: (item) => item.id,
+ resolveDisabled: (item) => item.dataRef.current.disabled
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ activeOptionIndex,
+ activationTrigger: (_d = action.trigger) != null ? _d : 1 /* Other */
+ };
+ },
+ [3 /* RegisterOption */]: (state, action) => {
+ var _a3, _b;
+ let option = { id: action.id, dataRef: action.dataRef };
+ let adjustedState = adjustOrderedState(state, (options) => [...options, option]);
+ if (state.activeOptionIndex === null) {
+ if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.isSelected(action.dataRef.current.value)) {
+ adjustedState.activeOptionIndex = adjustedState.options.indexOf(option);
+ }
+ }
+ let nextState = {
+ ...state,
+ ...adjustedState,
+ activationTrigger: 1 /* Other */
+ };
+ if (((_b = state.dataRef.current) == null ? void 0 : _b.__demoMode) && state.dataRef.current.value === void 0) {
+ nextState.activeOptionIndex = 0;
+ }
+ return nextState;
+ },
+ [4 /* UnregisterOption */]: (state, action) => {
+ let adjustedState = adjustOrderedState(state, (options) => {
+ let idx = options.findIndex((a) => a.id === action.id);
+ if (idx !== -1)
+ options.splice(idx, 1);
+ return options;
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ activationTrigger: 1 /* Other */
+ };
+ },
+ [5 /* RegisterLabel */]: (state, action) => {
+ return {
+ ...state,
+ labelId: action.id
+ };
+ }
+};
+var ComboboxActionsContext = (0, import_react19.createContext)(null);
+ComboboxActionsContext.displayName = "ComboboxActionsContext";
+function useActions(component) {
+ let context = (0, import_react19.useContext)(ComboboxActionsContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useActions);
+ throw err;
+ }
+ return context;
+}
+var ComboboxDataContext = (0, import_react19.createContext)(null);
+ComboboxDataContext.displayName = "ComboboxDataContext";
+function useData(component) {
+ let context = (0, import_react19.useContext)(ComboboxDataContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useData);
+ throw err;
+ }
+ return context;
+}
+function stateReducer(state, action) {
+ return match(action.type, reducers, state, action);
+}
+var DEFAULT_COMBOBOX_TAG = import_react19.Fragment;
+function ComboboxFn(props, ref) {
+ let {
+ value: controlledValue,
+ defaultValue,
+ onChange: controlledOnChange,
+ form: formName,
+ name,
+ by = (a, z) => a === z,
+ disabled = false,
+ __demoMode = false,
+ nullable = false,
+ multiple = false,
+ ...theirProps
+ } = props;
+ let [value = multiple ? [] : void 0, theirOnChange] = useControllable(
+ controlledValue,
+ controlledOnChange,
+ defaultValue
+ );
+ let [state, dispatch] = (0, import_react19.useReducer)(stateReducer, {
+ dataRef: (0, import_react19.createRef)(),
+ comboboxState: __demoMode ? 0 /* Open */ : 1 /* Closed */,
+ options: [],
+ activeOptionIndex: null,
+ activationTrigger: 1 /* Other */,
+ labelId: null
+ });
+ let defaultToFirstOption = (0, import_react19.useRef)(false);
+ let optionsPropsRef = (0, import_react19.useRef)({ static: false, hold: false });
+ let labelRef = (0, import_react19.useRef)(null);
+ let inputRef = (0, import_react19.useRef)(null);
+ let buttonRef = (0, import_react19.useRef)(null);
+ let optionsRef = (0, import_react19.useRef)(null);
+ let compare = useEvent(
+ // @ts-expect-error Eventually we'll want to tackle this, but for now this will do.
+ typeof by === "string" ? (a, z) => {
+ let property = by;
+ return (a == null ? void 0 : a[property]) === (z == null ? void 0 : z[property]);
+ } : by
+ );
+ let isSelected = (0, import_react19.useCallback)(
+ (compareValue) => match(data.mode, {
+ [1 /* Multi */]: () => value.some((option) => compare(option, compareValue)),
+ [0 /* Single */]: () => compare(value, compareValue)
+ }),
+ [value]
+ );
+ let data = (0, import_react19.useMemo)(
+ () => ({
+ ...state,
+ optionsPropsRef,
+ labelRef,
+ inputRef,
+ buttonRef,
+ optionsRef,
+ value,
+ defaultValue,
+ disabled,
+ mode: multiple ? 1 /* Multi */ : 0 /* Single */,
+ get activeOptionIndex() {
+ if (defaultToFirstOption.current && state.activeOptionIndex === null && state.options.length > 0) {
+ let localActiveOptionIndex = state.options.findIndex(
+ (option) => !option.dataRef.current.disabled
+ );
+ if (localActiveOptionIndex !== -1) {
+ return localActiveOptionIndex;
+ }
+ }
+ return state.activeOptionIndex;
+ },
+ compare,
+ isSelected,
+ nullable,
+ __demoMode
+ }),
+ [value, defaultValue, disabled, multiple, nullable, __demoMode, state]
+ );
+ let lastActiveOption = (0, import_react19.useRef)(
+ data.activeOptionIndex !== null ? data.options[data.activeOptionIndex] : null
+ );
+ (0, import_react19.useEffect)(() => {
+ let currentActiveOption = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex] : null;
+ if (lastActiveOption.current !== currentActiveOption) {
+ lastActiveOption.current = currentActiveOption;
+ }
+ });
+ useIsoMorphicEffect(() => {
+ state.dataRef.current = data;
+ }, [data]);
+ useOutsideClick(
+ [data.buttonRef, data.inputRef, data.optionsRef],
+ () => actions.closeCombobox(),
+ data.comboboxState === 0 /* Open */
+ );
+ let slot = (0, import_react19.useMemo)(
+ () => ({
+ open: data.comboboxState === 0 /* Open */,
+ disabled,
+ activeIndex: data.activeOptionIndex,
+ activeOption: data.activeOptionIndex === null ? null : data.options[data.activeOptionIndex].dataRef.current.value,
+ value
+ }),
+ [data, disabled, value]
+ );
+ let selectOption = useEvent((id) => {
+ let option = data.options.find((item) => item.id === id);
+ if (!option)
+ return;
+ onChange(option.dataRef.current.value);
+ });
+ let selectActiveOption = useEvent(() => {
+ if (data.activeOptionIndex !== null) {
+ let { dataRef, id } = data.options[data.activeOptionIndex];
+ onChange(dataRef.current.value);
+ actions.goToOption(4 /* Specific */, id);
+ }
+ });
+ let openCombobox = useEvent(() => {
+ dispatch({ type: 0 /* OpenCombobox */ });
+ defaultToFirstOption.current = true;
+ });
+ let closeCombobox = useEvent(() => {
+ dispatch({ type: 1 /* CloseCombobox */ });
+ defaultToFirstOption.current = false;
+ });
+ let goToOption = useEvent((focus, id, trigger) => {
+ defaultToFirstOption.current = false;
+ if (focus === 4 /* Specific */) {
+ return dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id, trigger });
+ }
+ return dispatch({ type: 2 /* GoToOption */, focus, trigger });
+ });
+ let registerOption = useEvent((id, dataRef) => {
+ dispatch({ type: 3 /* RegisterOption */, id, dataRef });
+ return () => {
+ var _a3;
+ if (((_a3 = lastActiveOption.current) == null ? void 0 : _a3.id) === id) {
+ defaultToFirstOption.current = true;
+ }
+ dispatch({ type: 4 /* UnregisterOption */, id });
+ };
+ });
+ let registerLabel = useEvent((id) => {
+ dispatch({ type: 5 /* RegisterLabel */, id });
+ return () => dispatch({ type: 5 /* RegisterLabel */, id: null });
+ });
+ let onChange = useEvent((value2) => {
+ return match(data.mode, {
+ [0 /* Single */]() {
+ return theirOnChange == null ? void 0 : theirOnChange(value2);
+ },
+ [1 /* Multi */]() {
+ let copy = data.value.slice();
+ let idx = copy.findIndex((item) => compare(item, value2));
+ if (idx === -1) {
+ copy.push(value2);
+ } else {
+ copy.splice(idx, 1);
+ }
+ return theirOnChange == null ? void 0 : theirOnChange(copy);
+ }
+ });
+ });
+ let actions = (0, import_react19.useMemo)(
+ () => ({
+ onChange,
+ registerOption,
+ registerLabel,
+ goToOption,
+ closeCombobox,
+ openCombobox,
+ selectActiveOption,
+ selectOption
+ }),
+ []
+ );
+ let ourProps = ref === null ? {} : { ref };
+ let form = (0, import_react19.useRef)(null);
+ let d = useDisposables();
+ (0, import_react19.useEffect)(() => {
+ if (!form.current)
+ return;
+ if (defaultValue === void 0)
+ return;
+ d.addEventListener(form.current, "reset", () => {
+ onChange(defaultValue);
+ });
+ }, [
+ form,
+ onChange
+ /* Explicitly ignoring `defaultValue` */
+ ]);
+ return /* @__PURE__ */ import_react19.default.createElement(ComboboxActionsContext.Provider, { value: actions }, /* @__PURE__ */ import_react19.default.createElement(ComboboxDataContext.Provider, { value: data }, /* @__PURE__ */ import_react19.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(data.comboboxState, {
+ [0 /* Open */]: 1 /* Open */,
+ [1 /* Closed */]: 2 /* Closed */
+ })
+ },
+ name != null && value != null && objectToFormEntries({ [name]: value }).map(([name2, value2], idx) => /* @__PURE__ */ import_react19.default.createElement(
+ Hidden,
+ {
+ features: 4 /* Hidden */,
+ ref: idx === 0 ? (element) => {
+ var _a3;
+ form.current = (_a3 = element == null ? void 0 : element.closest("form")) != null ? _a3 : null;
+ } : void 0,
+ ...compact({
+ key: name2,
+ as: "input",
+ type: "hidden",
+ hidden: true,
+ readOnly: true,
+ form: formName,
+ name: name2,
+ value: value2
+ })
+ }
+ )),
+ render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_COMBOBOX_TAG,
+ name: "Combobox"
+ })
+ )));
+}
+var DEFAULT_INPUT_TAG = "input";
+function InputFn(props, ref) {
+ var _a3, _b, _c, _d;
+ let internalId = useId();
+ let {
+ id = `headlessui-combobox-input-${internalId}`,
+ onChange,
+ displayValue,
+ // @ts-ignore: We know this MAY NOT exist for a given tag but we only care when it _does_ exist.
+ type = "text",
+ ...theirProps
+ } = props;
+ let data = useData("Combobox.Input");
+ let actions = useActions("Combobox.Input");
+ let inputRef = useSyncRefs(data.inputRef, ref);
+ let isTyping = (0, import_react19.useRef)(false);
+ let d = useDisposables();
+ let currentDisplayValue = function() {
+ var _a4;
+ if (typeof displayValue === "function" && data.value !== void 0) {
+ return (_a4 = displayValue(data.value)) != null ? _a4 : "";
+ } else if (typeof data.value === "string") {
+ return data.value;
+ } else {
+ return "";
+ }
+ }();
+ useWatch(
+ ([currentDisplayValue2, state], [oldCurrentDisplayValue, oldState]) => {
+ if (isTyping.current)
+ return;
+ if (!data.inputRef.current)
+ return;
+ if (oldState === 0 /* Open */ && state === 1 /* Closed */) {
+ data.inputRef.current.value = currentDisplayValue2;
+ } else if (currentDisplayValue2 !== oldCurrentDisplayValue) {
+ data.inputRef.current.value = currentDisplayValue2;
+ }
+ },
+ [currentDisplayValue, data.comboboxState]
+ );
+ useWatch(
+ ([newState], [oldState]) => {
+ if (newState === 0 /* Open */ && oldState === 1 /* Closed */) {
+ let input = data.inputRef.current;
+ if (!input)
+ return;
+ let currentValue = input.value;
+ let { selectionStart, selectionEnd, selectionDirection } = input;
+ input.value = "";
+ input.value = currentValue;
+ if (selectionDirection !== null) {
+ input.setSelectionRange(selectionStart, selectionEnd, selectionDirection);
+ } else {
+ input.setSelectionRange(selectionStart, selectionEnd);
+ }
+ }
+ },
+ [data.comboboxState]
+ );
+ let isComposing = (0, import_react19.useRef)(false);
+ let composedChangeEvent = (0, import_react19.useRef)(null);
+ let handleCompositionStart = useEvent(() => {
+ isComposing.current = true;
+ });
+ let handleCompositionEnd = useEvent(() => {
+ d.nextFrame(() => {
+ isComposing.current = false;
+ if (composedChangeEvent.current) {
+ actions.openCombobox();
+ onChange == null ? void 0 : onChange(composedChangeEvent.current);
+ composedChangeEvent.current = null;
+ }
+ });
+ });
+ let handleKeyDown = useEvent((event) => {
+ isTyping.current = true;
+ switch (event.key) {
+ case "Backspace" /* Backspace */:
+ case "Delete" /* Delete */:
+ if (data.mode !== 0 /* Single */)
+ return;
+ if (!data.nullable)
+ return;
+ let input = event.currentTarget;
+ d.requestAnimationFrame(() => {
+ if (input.value === "") {
+ actions.onChange(null);
+ if (data.optionsRef.current) {
+ data.optionsRef.current.scrollTop = 0;
+ }
+ actions.goToOption(5 /* Nothing */);
+ }
+ });
+ break;
+ case "Enter" /* Enter */:
+ isTyping.current = false;
+ if (data.comboboxState !== 0 /* Open */)
+ return;
+ if (isComposing.current)
+ return;
+ event.preventDefault();
+ event.stopPropagation();
+ if (data.activeOptionIndex === null) {
+ actions.closeCombobox();
+ return;
+ }
+ actions.selectActiveOption();
+ if (data.mode === 0 /* Single */) {
+ actions.closeCombobox();
+ }
+ break;
+ case "ArrowDown" /* ArrowDown */:
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return match(data.comboboxState, {
+ [0 /* Open */]: () => {
+ actions.goToOption(2 /* Next */);
+ },
+ [1 /* Closed */]: () => {
+ actions.openCombobox();
+ }
+ });
+ case "ArrowUp" /* ArrowUp */:
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return match(data.comboboxState, {
+ [0 /* Open */]: () => {
+ actions.goToOption(1 /* Previous */);
+ },
+ [1 /* Closed */]: () => {
+ actions.openCombobox();
+ d.nextFrame(() => {
+ if (!data.value) {
+ actions.goToOption(3 /* Last */);
+ }
+ });
+ }
+ });
+ case "Home" /* Home */:
+ if (event.shiftKey) {
+ break;
+ }
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(0 /* First */);
+ case "PageUp" /* PageUp */:
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(0 /* First */);
+ case "End" /* End */:
+ if (event.shiftKey) {
+ break;
+ }
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(3 /* Last */);
+ case "PageDown" /* PageDown */:
+ isTyping.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(3 /* Last */);
+ case "Escape" /* Escape */:
+ isTyping.current = false;
+ if (data.comboboxState !== 0 /* Open */)
+ return;
+ event.preventDefault();
+ if (data.optionsRef.current && !data.optionsPropsRef.current.static) {
+ event.stopPropagation();
+ }
+ return actions.closeCombobox();
+ case "Tab" /* Tab */:
+ isTyping.current = false;
+ if (data.comboboxState !== 0 /* Open */)
+ return;
+ if (data.mode === 0 /* Single */)
+ actions.selectActiveOption();
+ actions.closeCombobox();
+ break;
+ }
+ });
+ let handleChange = useEvent((event) => {
+ if (isComposing.current) {
+ composedChangeEvent.current = event;
+ return;
+ }
+ actions.openCombobox();
+ onChange == null ? void 0 : onChange(event);
+ });
+ let handleBlur = useEvent(() => {
+ isTyping.current = false;
+ });
+ let labelledby = useComputed(() => {
+ if (!data.labelId)
+ return void 0;
+ return [data.labelId].join(" ");
+ }, [data.labelId]);
+ let slot = (0, import_react19.useMemo)(
+ () => ({ open: data.comboboxState === 0 /* Open */, disabled: data.disabled }),
+ [data]
+ );
+ let ourProps = {
+ ref: inputRef,
+ id,
+ role: "combobox",
+ type,
+ "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id,
+ "aria-expanded": data.disabled ? void 0 : data.comboboxState === 0 /* Open */,
+ "aria-activedescendant": data.activeOptionIndex === null ? void 0 : (_b = data.options[data.activeOptionIndex]) == null ? void 0 : _b.id,
+ "aria-labelledby": labelledby,
+ "aria-autocomplete": "list",
+ defaultValue: (_d = (_c = props.defaultValue) != null ? _c : data.defaultValue !== void 0 ? displayValue == null ? void 0 : displayValue(data.defaultValue) : null) != null ? _d : data.defaultValue,
+ disabled: data.disabled,
+ onCompositionStart: handleCompositionStart,
+ onCompositionEnd: handleCompositionEnd,
+ onKeyDown: handleKeyDown,
+ onChange: handleChange,
+ onBlur: handleBlur
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_INPUT_TAG,
+ name: "Combobox.Input"
+ });
+}
+var DEFAULT_BUTTON_TAG = "button";
+function ButtonFn(props, ref) {
+ var _a3;
+ let data = useData("Combobox.Button");
+ let actions = useActions("Combobox.Button");
+ let buttonRef = useSyncRefs(data.buttonRef, ref);
+ let internalId = useId();
+ let { id = `headlessui-combobox-button-${internalId}`, ...theirProps } = props;
+ let d = useDisposables();
+ let handleKeyDown = useEvent((event) => {
+ switch (event.key) {
+ case "ArrowDown" /* ArrowDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ if (data.comboboxState === 1 /* Closed */) {
+ actions.openCombobox();
+ }
+ return d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ case "ArrowUp" /* ArrowUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ if (data.comboboxState === 1 /* Closed */) {
+ actions.openCombobox();
+ d.nextFrame(() => {
+ if (!data.value) {
+ actions.goToOption(3 /* Last */);
+ }
+ });
+ }
+ return d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ case "Escape" /* Escape */:
+ if (data.comboboxState !== 0 /* Open */)
+ return;
+ event.preventDefault();
+ if (data.optionsRef.current && !data.optionsPropsRef.current.static) {
+ event.stopPropagation();
+ }
+ actions.closeCombobox();
+ return d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ default:
+ return;
+ }
+ });
+ let handleClick = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ if (data.comboboxState === 0 /* Open */) {
+ actions.closeCombobox();
+ } else {
+ event.preventDefault();
+ actions.openCombobox();
+ }
+ d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ });
+ let labelledby = useComputed(() => {
+ if (!data.labelId)
+ return void 0;
+ return [data.labelId, id].join(" ");
+ }, [data.labelId, id]);
+ let slot = (0, import_react19.useMemo)(
+ () => ({
+ open: data.comboboxState === 0 /* Open */,
+ disabled: data.disabled,
+ value: data.value
+ }),
+ [data]
+ );
+ let ourProps = {
+ ref: buttonRef,
+ id,
+ type: useResolveButtonType(props, data.buttonRef),
+ tabIndex: -1,
+ "aria-haspopup": "listbox",
+ "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id,
+ "aria-expanded": data.disabled ? void 0 : data.comboboxState === 0 /* Open */,
+ "aria-labelledby": labelledby,
+ disabled: data.disabled,
+ onClick: handleClick,
+ onKeyDown: handleKeyDown
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BUTTON_TAG,
+ name: "Combobox.Button"
+ });
+}
+var DEFAULT_LABEL_TAG = "label";
+function LabelFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-combobox-label-${internalId}`, ...theirProps } = props;
+ let data = useData("Combobox.Label");
+ let actions = useActions("Combobox.Label");
+ let labelRef = useSyncRefs(data.labelRef, ref);
+ useIsoMorphicEffect(() => actions.registerLabel(id), [id]);
+ let handleClick = useEvent(() => {
+ var _a3;
+ return (_a3 = data.inputRef.current) == null ? void 0 : _a3.focus({ preventScroll: true });
+ });
+ let slot = (0, import_react19.useMemo)(
+ () => ({ open: data.comboboxState === 0 /* Open */, disabled: data.disabled }),
+ [data]
+ );
+ let ourProps = { ref: labelRef, id, onClick: handleClick };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_LABEL_TAG,
+ name: "Combobox.Label"
+ });
+}
+var DEFAULT_OPTIONS_TAG = "ul";
+var OptionsRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */;
+function OptionsFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-combobox-options-${internalId}`, hold = false, ...theirProps } = props;
+ let data = useData("Combobox.Options");
+ let optionsRef = useSyncRefs(data.optionsRef, ref);
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return data.comboboxState === 0 /* Open */;
+ })();
+ useIsoMorphicEffect(() => {
+ var _a3;
+ data.optionsPropsRef.current.static = (_a3 = props.static) != null ? _a3 : false;
+ }, [data.optionsPropsRef, props.static]);
+ useIsoMorphicEffect(() => {
+ data.optionsPropsRef.current.hold = hold;
+ }, [data.optionsPropsRef, hold]);
+ useTreeWalker({
+ container: data.optionsRef.current,
+ enabled: data.comboboxState === 0 /* Open */,
+ accept(node) {
+ if (node.getAttribute("role") === "option")
+ return NodeFilter.FILTER_REJECT;
+ if (node.hasAttribute("role"))
+ return NodeFilter.FILTER_SKIP;
+ return NodeFilter.FILTER_ACCEPT;
+ },
+ walk(node) {
+ node.setAttribute("role", "none");
+ }
+ });
+ let labelledby = useComputed(
+ () => {
+ var _a3, _b;
+ return (_b = data.labelId) != null ? _b : (_a3 = data.buttonRef.current) == null ? void 0 : _a3.id;
+ },
+ [data.labelId, data.buttonRef.current]
+ );
+ let slot = (0, import_react19.useMemo)(
+ () => ({ open: data.comboboxState === 0 /* Open */ }),
+ [data]
+ );
+ let ourProps = {
+ "aria-labelledby": labelledby,
+ role: "listbox",
+ "aria-multiselectable": data.mode === 1 /* Multi */ ? true : void 0,
+ id,
+ ref: optionsRef
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OPTIONS_TAG,
+ features: OptionsRenderFeatures,
+ visible,
+ name: "Combobox.Options"
+ });
+}
+var DEFAULT_OPTION_TAG = "li";
+function OptionFn(props, ref) {
+ var _a3, _b;
+ let internalId = useId();
+ let {
+ id = `headlessui-combobox-option-${internalId}`,
+ disabled = false,
+ value,
+ ...theirProps
+ } = props;
+ let data = useData("Combobox.Option");
+ let actions = useActions("Combobox.Option");
+ let active = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex].id === id : false;
+ let selected = data.isSelected(value);
+ let internalOptionRef = (0, import_react19.useRef)(null);
+ let bag = useLatestValue({
+ disabled,
+ value,
+ domRef: internalOptionRef,
+ textValue: (_b = (_a3 = internalOptionRef.current) == null ? void 0 : _a3.textContent) == null ? void 0 : _b.toLowerCase()
+ });
+ let optionRef = useSyncRefs(ref, internalOptionRef);
+ let select = useEvent(() => actions.selectOption(id));
+ useIsoMorphicEffect(() => actions.registerOption(id, bag), [bag, id]);
+ let enableScrollIntoView = (0, import_react19.useRef)(data.__demoMode ? false : true);
+ useIsoMorphicEffect(() => {
+ if (!data.__demoMode)
+ return;
+ let d = disposables();
+ d.requestAnimationFrame(() => {
+ enableScrollIntoView.current = true;
+ });
+ return d.dispose;
+ }, []);
+ useIsoMorphicEffect(() => {
+ if (data.comboboxState !== 0 /* Open */)
+ return;
+ if (!active)
+ return;
+ if (!enableScrollIntoView.current)
+ return;
+ if (data.activationTrigger === 0 /* Pointer */)
+ return;
+ let d = disposables();
+ d.requestAnimationFrame(() => {
+ var _a4, _b2;
+ (_b2 = (_a4 = internalOptionRef.current) == null ? void 0 : _a4.scrollIntoView) == null ? void 0 : _b2.call(_a4, { block: "nearest" });
+ });
+ return d.dispose;
+ }, [
+ internalOptionRef,
+ active,
+ data.comboboxState,
+ data.activationTrigger,
+ /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */
+ data.activeOptionIndex
+ ]);
+ let handleClick = useEvent((event) => {
+ if (disabled)
+ return event.preventDefault();
+ select();
+ if (data.mode === 0 /* Single */) {
+ actions.closeCombobox();
+ }
+ if (!isMobile()) {
+ requestAnimationFrame(() => {
+ var _a4;
+ return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus();
+ });
+ }
+ });
+ let handleFocus = useEvent(() => {
+ if (disabled)
+ return actions.goToOption(5 /* Nothing */);
+ actions.goToOption(4 /* Specific */, id);
+ });
+ let pointer = useTrackedPointer();
+ let handleEnter = useEvent((evt) => pointer.update(evt));
+ let handleMove = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (active)
+ return;
+ actions.goToOption(4 /* Specific */, id, 0 /* Pointer */);
+ });
+ let handleLeave = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (!active)
+ return;
+ if (data.optionsPropsRef.current.hold)
+ return;
+ actions.goToOption(5 /* Nothing */);
+ });
+ let slot = (0, import_react19.useMemo)(
+ () => ({ active, selected, disabled }),
+ [active, selected, disabled]
+ );
+ let ourProps = {
+ id,
+ ref: optionRef,
+ role: "option",
+ tabIndex: disabled === true ? void 0 : -1,
+ "aria-disabled": disabled === true ? true : void 0,
+ // According to the WAI-ARIA best practices, we should use aria-checked for
+ // multi-select,but Voice-Over disagrees. So we use aria-checked instead for
+ // both single and multi-select.
+ "aria-selected": selected,
+ disabled: void 0,
+ // Never forward the `disabled` prop
+ onClick: handleClick,
+ onFocus: handleFocus,
+ onPointerEnter: handleEnter,
+ onMouseEnter: handleEnter,
+ onPointerMove: handleMove,
+ onMouseMove: handleMove,
+ onPointerLeave: handleLeave,
+ onMouseLeave: handleLeave
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OPTION_TAG,
+ name: "Combobox.Option"
+ });
+}
+var ComboboxRoot = forwardRefWithAs(ComboboxFn);
+var Button = forwardRefWithAs(ButtonFn);
+var Input = forwardRefWithAs(InputFn);
+var Label = forwardRefWithAs(LabelFn);
+var Options = forwardRefWithAs(OptionsFn);
+var Option = forwardRefWithAs(OptionFn);
+var Combobox = Object.assign(ComboboxRoot, { Input, Button, Label, Options, Option });
+
+// src/components/dialog/dialog.tsx
+var import_react31 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/components/focus-trap/focus-trap.tsx
+var import_react25 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/hooks/use-tab-direction.ts
+var import_react20 = __webpack_require__(/*! react */ "react");
+function useTabDirection() {
+ let direction = (0, import_react20.useRef)(0 /* Forwards */);
+ useWindowEvent(
+ "keydown",
+ (event) => {
+ if (event.key === "Tab") {
+ direction.current = event.shiftKey ? 1 /* Backwards */ : 0 /* Forwards */;
+ }
+ },
+ true
+ );
+ return direction;
+}
+
+// src/hooks/use-is-mounted.ts
+var import_react21 = __webpack_require__(/*! react */ "react");
+function useIsMounted() {
+ let mounted = (0, import_react21.useRef)(false);
+ useIsoMorphicEffect(() => {
+ mounted.current = true;
+ return () => {
+ mounted.current = false;
+ };
+ }, []);
+ return mounted;
+}
+
+// src/hooks/use-owner.ts
+var import_react22 = __webpack_require__(/*! react */ "react");
+function useOwnerDocument(...args) {
+ return (0, import_react22.useMemo)(() => getOwnerDocument(...args), [...args]);
+}
+
+// src/hooks/use-event-listener.ts
+var import_react23 = __webpack_require__(/*! react */ "react");
+function useEventListener(element, type, listener, options) {
+ let listenerRef = useLatestValue(listener);
+ (0, import_react23.useEffect)(() => {
+ element = element != null ? element : window;
+ function handler(event) {
+ listenerRef.current(event);
+ }
+ element.addEventListener(type, handler, options);
+ return () => element.removeEventListener(type, handler, options);
+ }, [element, type, options]);
+}
+
+// src/utils/document-ready.ts
+function onDocumentReady(cb) {
+ function check() {
+ if (document.readyState === "loading")
+ return;
+ cb();
+ document.removeEventListener("DOMContentLoaded", check);
+ }
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
+ document.addEventListener("DOMContentLoaded", check);
+ check();
+ }
+}
+
+// src/hooks/use-on-unmount.ts
+var import_react24 = __webpack_require__(/*! react */ "react");
+function useOnUnmount(cb) {
+ let stableCb = useEvent(cb);
+ let trulyUnmounted = (0, import_react24.useRef)(false);
+ (0, import_react24.useEffect)(() => {
+ trulyUnmounted.current = false;
+ return () => {
+ trulyUnmounted.current = true;
+ microTask(() => {
+ if (!trulyUnmounted.current)
+ return;
+ stableCb();
+ });
+ };
+ }, [stableCb]);
+}
+
+// src/components/focus-trap/focus-trap.tsx
+function resolveContainers(containers) {
+ if (!containers)
+ return /* @__PURE__ */ new Set();
+ if (typeof containers === "function")
+ return new Set(containers());
+ let all = /* @__PURE__ */ new Set();
+ for (let container of containers.current) {
+ if (container.current instanceof HTMLElement) {
+ all.add(container.current);
+ }
+ }
+ return all;
+}
+var DEFAULT_FOCUS_TRAP_TAG = "div";
+var Features3 = /* @__PURE__ */ ((Features4) => {
+ Features4[Features4["None"] = 1] = "None";
+ Features4[Features4["InitialFocus"] = 2] = "InitialFocus";
+ Features4[Features4["TabLock"] = 4] = "TabLock";
+ Features4[Features4["FocusLock"] = 8] = "FocusLock";
+ Features4[Features4["RestoreFocus"] = 16] = "RestoreFocus";
+ Features4[Features4["All"] = 30] = "All";
+ return Features4;
+})(Features3 || {});
+function FocusTrapFn(props, ref) {
+ let container = (0, import_react25.useRef)(null);
+ let focusTrapRef = useSyncRefs(container, ref);
+ let { initialFocus, containers, features = 30 /* All */, ...theirProps } = props;
+ if (!useServerHandoffComplete()) {
+ features = 1 /* None */;
+ }
+ let ownerDocument = useOwnerDocument(container);
+ useRestoreFocus({ ownerDocument }, Boolean(features & 16 /* RestoreFocus */));
+ let previousActiveElement = useInitialFocus(
+ { ownerDocument, container, initialFocus },
+ Boolean(features & 2 /* InitialFocus */)
+ );
+ useFocusLock(
+ { ownerDocument, container, containers, previousActiveElement },
+ Boolean(features & 8 /* FocusLock */)
+ );
+ let direction = useTabDirection();
+ let handleFocus = useEvent((e) => {
+ let el = container.current;
+ if (!el)
+ return;
+ let wrapper = false ? 0 : (cb) => cb();
+ wrapper(() => {
+ match(direction.current, {
+ [0 /* Forwards */]: () => {
+ focusIn(el, 1 /* First */, { skipElements: [e.relatedTarget] });
+ },
+ [1 /* Backwards */]: () => {
+ focusIn(el, 8 /* Last */, { skipElements: [e.relatedTarget] });
+ }
+ });
+ });
+ });
+ let d = useDisposables();
+ let recentlyUsedTabKey = (0, import_react25.useRef)(false);
+ let ourProps = {
+ ref: focusTrapRef,
+ onKeyDown(e) {
+ if (e.key == "Tab") {
+ recentlyUsedTabKey.current = true;
+ d.requestAnimationFrame(() => {
+ recentlyUsedTabKey.current = false;
+ });
+ }
+ },
+ onBlur(e) {
+ let allContainers = resolveContainers(containers);
+ if (container.current instanceof HTMLElement)
+ allContainers.add(container.current);
+ let relatedTarget = e.relatedTarget;
+ if (!(relatedTarget instanceof HTMLElement))
+ return;
+ if (relatedTarget.dataset.headlessuiFocusGuard === "true") {
+ return;
+ }
+ if (!contains(allContainers, relatedTarget)) {
+ if (recentlyUsedTabKey.current) {
+ focusIn(
+ container.current,
+ match(direction.current, {
+ [0 /* Forwards */]: () => 4 /* Next */,
+ [1 /* Backwards */]: () => 2 /* Previous */
+ }) | 16 /* WrapAround */,
+ { relativeTo: e.target }
+ );
+ } else if (e.target instanceof HTMLElement) {
+ focusElement(e.target);
+ }
+ }
+ }
+ };
+ return /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, Boolean(features & 4 /* TabLock */) && /* @__PURE__ */ import_react25.default.createElement(
+ Hidden,
+ {
+ as: "button",
+ type: "button",
+ "data-headlessui-focus-guard": true,
+ onFocus: handleFocus,
+ features: 2 /* Focusable */
+ }
+ ), render({
+ ourProps,
+ theirProps,
+ defaultTag: DEFAULT_FOCUS_TRAP_TAG,
+ name: "FocusTrap"
+ }), Boolean(features & 4 /* TabLock */) && /* @__PURE__ */ import_react25.default.createElement(
+ Hidden,
+ {
+ as: "button",
+ type: "button",
+ "data-headlessui-focus-guard": true,
+ onFocus: handleFocus,
+ features: 2 /* Focusable */
+ }
+ ));
+}
+var FocusTrapRoot = forwardRefWithAs(FocusTrapFn);
+var FocusTrap = Object.assign(FocusTrapRoot, {
+ features: Features3
+});
+var history = [];
+onDocumentReady(() => {
+ function handle(e) {
+ if (!(e.target instanceof HTMLElement))
+ return;
+ if (e.target === document.body)
+ return;
+ if (history[0] === e.target)
+ return;
+ history.unshift(e.target);
+ history = history.filter((x) => x != null && x.isConnected);
+ history.splice(10);
+ }
+ window.addEventListener("click", handle, { capture: true });
+ window.addEventListener("mousedown", handle, { capture: true });
+ window.addEventListener("focus", handle, { capture: true });
+ document.body.addEventListener("click", handle, { capture: true });
+ document.body.addEventListener("mousedown", handle, { capture: true });
+ document.body.addEventListener("focus", handle, { capture: true });
+});
+function useRestoreElement(enabled = true) {
+ let localHistory = (0, import_react25.useRef)(history.slice());
+ useWatch(
+ ([newEnabled], [oldEnabled]) => {
+ if (oldEnabled === true && newEnabled === false) {
+ microTask(() => {
+ localHistory.current.splice(0);
+ });
+ }
+ if (oldEnabled === false && newEnabled === true) {
+ localHistory.current = history.slice();
+ }
+ },
+ [enabled, history, localHistory]
+ );
+ return useEvent(() => {
+ var _a3;
+ return (_a3 = localHistory.current.find((x) => x != null && x.isConnected)) != null ? _a3 : null;
+ });
+}
+function useRestoreFocus({ ownerDocument }, enabled) {
+ let getRestoreElement = useRestoreElement(enabled);
+ useWatch(() => {
+ if (enabled)
+ return;
+ if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) === (ownerDocument == null ? void 0 : ownerDocument.body)) {
+ focusElement(getRestoreElement());
+ }
+ }, [enabled]);
+ useOnUnmount(() => {
+ if (!enabled)
+ return;
+ focusElement(getRestoreElement());
+ });
+}
+function useInitialFocus({
+ ownerDocument,
+ container,
+ initialFocus
+}, enabled) {
+ let previousActiveElement = (0, import_react25.useRef)(null);
+ let mounted = useIsMounted();
+ useWatch(() => {
+ if (!enabled)
+ return;
+ let containerElement = container.current;
+ if (!containerElement)
+ return;
+ microTask(() => {
+ if (!mounted.current) {
+ return;
+ }
+ let activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement;
+ if (initialFocus == null ? void 0 : initialFocus.current) {
+ if ((initialFocus == null ? void 0 : initialFocus.current) === activeElement) {
+ previousActiveElement.current = activeElement;
+ return;
+ }
+ } else if (containerElement.contains(activeElement)) {
+ previousActiveElement.current = activeElement;
+ return;
+ }
+ if (initialFocus == null ? void 0 : initialFocus.current) {
+ focusElement(initialFocus.current);
+ } else {
+ if (focusIn(containerElement, 1 /* First */) === 0 /* Error */) {
+ console.warn("There are no focusable elements inside the ");
+ }
+ }
+ previousActiveElement.current = ownerDocument == null ? void 0 : ownerDocument.activeElement;
+ });
+ }, [enabled]);
+ return previousActiveElement;
+}
+function useFocusLock({
+ ownerDocument,
+ container,
+ containers,
+ previousActiveElement
+}, enabled) {
+ let mounted = useIsMounted();
+ useEventListener(
+ ownerDocument == null ? void 0 : ownerDocument.defaultView,
+ "focus",
+ (event) => {
+ if (!enabled)
+ return;
+ if (!mounted.current)
+ return;
+ let allContainers = resolveContainers(containers);
+ if (container.current instanceof HTMLElement)
+ allContainers.add(container.current);
+ let previous = previousActiveElement.current;
+ if (!previous)
+ return;
+ let toElement = event.target;
+ if (toElement && toElement instanceof HTMLElement) {
+ if (!contains(allContainers, toElement)) {
+ event.preventDefault();
+ event.stopPropagation();
+ focusElement(previous);
+ } else {
+ previousActiveElement.current = toElement;
+ focusElement(toElement);
+ }
+ } else {
+ focusElement(previousActiveElement.current);
+ }
+ },
+ true
+ );
+}
+function contains(containers, element) {
+ for (let container of containers) {
+ if (container.contains(element))
+ return true;
+ }
+ return false;
+}
+
+// src/components/portal/portal.tsx
+var import_react27 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var import_react_dom = __webpack_require__(/*! react-dom */ "react-dom");
+
+// src/internal/portal-force-root.tsx
+var import_react26 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var ForcePortalRootContext = (0, import_react26.createContext)(false);
+function usePortalRoot() {
+ return (0, import_react26.useContext)(ForcePortalRootContext);
+}
+function ForcePortalRoot(props) {
+ return /* @__PURE__ */ import_react26.default.createElement(ForcePortalRootContext.Provider, { value: props.force }, props.children);
+}
+
+// src/components/portal/portal.tsx
+function usePortalTarget(ref) {
+ let forceInRoot = usePortalRoot();
+ let groupTarget = (0, import_react27.useContext)(PortalGroupContext);
+ let ownerDocument = useOwnerDocument(ref);
+ let [target, setTarget] = (0, import_react27.useState)(() => {
+ if (!forceInRoot && groupTarget !== null)
+ return null;
+ if (env.isServer)
+ return null;
+ let existingRoot = ownerDocument == null ? void 0 : ownerDocument.getElementById("headlessui-portal-root");
+ if (existingRoot)
+ return existingRoot;
+ if (ownerDocument === null)
+ return null;
+ let root = ownerDocument.createElement("div");
+ root.setAttribute("id", "headlessui-portal-root");
+ return ownerDocument.body.appendChild(root);
+ });
+ (0, import_react27.useEffect)(() => {
+ if (target === null)
+ return;
+ if (!(ownerDocument == null ? void 0 : ownerDocument.body.contains(target))) {
+ ownerDocument == null ? void 0 : ownerDocument.body.appendChild(target);
+ }
+ }, [target, ownerDocument]);
+ (0, import_react27.useEffect)(() => {
+ if (forceInRoot)
+ return;
+ if (groupTarget === null)
+ return;
+ setTarget(groupTarget.current);
+ }, [groupTarget, setTarget, forceInRoot]);
+ return target;
+}
+var DEFAULT_PORTAL_TAG = import_react27.Fragment;
+function PortalFn(props, ref) {
+ let theirProps = props;
+ let internalPortalRootRef = (0, import_react27.useRef)(null);
+ let portalRef = useSyncRefs(
+ optionalRef((ref2) => {
+ internalPortalRootRef.current = ref2;
+ }),
+ ref
+ );
+ let ownerDocument = useOwnerDocument(internalPortalRootRef);
+ let target = usePortalTarget(internalPortalRootRef);
+ let [element] = (0, import_react27.useState)(
+ () => {
+ var _a3;
+ return env.isServer ? null : (_a3 = ownerDocument == null ? void 0 : ownerDocument.createElement("div")) != null ? _a3 : null;
+ }
+ );
+ let parent = (0, import_react27.useContext)(PortalParentContext);
+ let ready = useServerHandoffComplete();
+ useIsoMorphicEffect(() => {
+ if (!target || !element)
+ return;
+ if (!target.contains(element)) {
+ element.setAttribute("data-headlessui-portal", "");
+ target.appendChild(element);
+ }
+ }, [target, element]);
+ useIsoMorphicEffect(() => {
+ if (!element)
+ return;
+ if (!parent)
+ return;
+ return parent.register(element);
+ }, [parent, element]);
+ useOnUnmount(() => {
+ var _a3;
+ if (!target || !element)
+ return;
+ if (element instanceof Node && target.contains(element)) {
+ target.removeChild(element);
+ }
+ if (target.childNodes.length <= 0) {
+ (_a3 = target.parentElement) == null ? void 0 : _a3.removeChild(target);
+ }
+ });
+ if (!ready)
+ return null;
+ let ourProps = { ref: portalRef };
+ return !target || !element ? null : (0, import_react_dom.createPortal)(
+ render({
+ ourProps,
+ theirProps,
+ defaultTag: DEFAULT_PORTAL_TAG,
+ name: "Portal"
+ }),
+ element
+ );
+}
+var DEFAULT_GROUP_TAG = import_react27.Fragment;
+var PortalGroupContext = (0, import_react27.createContext)(null);
+function GroupFn(props, ref) {
+ let { target, ...theirProps } = props;
+ let groupRef = useSyncRefs(ref);
+ let ourProps = { ref: groupRef };
+ return /* @__PURE__ */ import_react27.default.createElement(PortalGroupContext.Provider, { value: target }, render({
+ ourProps,
+ theirProps,
+ defaultTag: DEFAULT_GROUP_TAG,
+ name: "Popover.Group"
+ }));
+}
+var PortalParentContext = (0, import_react27.createContext)(null);
+function useNestedPortals() {
+ let parent = (0, import_react27.useContext)(PortalParentContext);
+ let portals = (0, import_react27.useRef)([]);
+ let register = useEvent((portal) => {
+ portals.current.push(portal);
+ if (parent)
+ parent.register(portal);
+ return () => unregister(portal);
+ });
+ let unregister = useEvent((portal) => {
+ let idx = portals.current.indexOf(portal);
+ if (idx !== -1)
+ portals.current.splice(idx, 1);
+ if (parent)
+ parent.unregister(portal);
+ });
+ let api = (0, import_react27.useMemo)(
+ () => ({ register, unregister, portals }),
+ [register, unregister, portals]
+ );
+ return [
+ portals,
+ (0, import_react27.useMemo)(() => {
+ return function PortalWrapper({ children }) {
+ return /* @__PURE__ */ import_react27.default.createElement(PortalParentContext.Provider, { value: api }, children);
+ };
+ }, [api])
+ ];
+}
+var PortalRoot = forwardRefWithAs(PortalFn);
+var Group = forwardRefWithAs(GroupFn);
+var Portal = Object.assign(PortalRoot, { Group });
+
+// src/components/description/description.tsx
+var import_react28 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var DescriptionContext = (0, import_react28.createContext)(null);
+function useDescriptionContext() {
+ let context = (0, import_react28.useContext)(DescriptionContext);
+ if (context === null) {
+ let err = new Error(
+ "You used a component, but it is not inside a relevant parent."
+ );
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useDescriptionContext);
+ throw err;
+ }
+ return context;
+}
+function useDescriptions() {
+ let [descriptionIds, setDescriptionIds] = (0, import_react28.useState)([]);
+ return [
+ // The actual id's as string or undefined
+ descriptionIds.length > 0 ? descriptionIds.join(" ") : void 0,
+ // The provider component
+ (0, import_react28.useMemo)(() => {
+ return function DescriptionProvider(props) {
+ let register = useEvent((value) => {
+ setDescriptionIds((existing) => [...existing, value]);
+ return () => setDescriptionIds((existing) => {
+ let clone = existing.slice();
+ let idx = clone.indexOf(value);
+ if (idx !== -1)
+ clone.splice(idx, 1);
+ return clone;
+ });
+ });
+ let contextBag = (0, import_react28.useMemo)(
+ () => ({ register, slot: props.slot, name: props.name, props: props.props }),
+ [register, props.slot, props.name, props.props]
+ );
+ return /* @__PURE__ */ import_react28.default.createElement(DescriptionContext.Provider, { value: contextBag }, props.children);
+ };
+ }, [setDescriptionIds])
+ ];
+}
+var DEFAULT_DESCRIPTION_TAG = "p";
+function DescriptionFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-description-${internalId}`, ...theirProps } = props;
+ let context = useDescriptionContext();
+ let descriptionRef = useSyncRefs(ref);
+ useIsoMorphicEffect(() => context.register(id), [id, context.register]);
+ let ourProps = { ref: descriptionRef, ...context.props, id };
+ return render({
+ ourProps,
+ theirProps,
+ slot: context.slot || {},
+ defaultTag: DEFAULT_DESCRIPTION_TAG,
+ name: context.name || "Description"
+ });
+}
+var DescriptionRoot = forwardRefWithAs(DescriptionFn);
+var Description = Object.assign(DescriptionRoot, {
+ //
+});
+
+// src/internal/stack-context.tsx
+var import_react29 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var StackContext = (0, import_react29.createContext)(() => {
+});
+StackContext.displayName = "StackContext";
+function useStackContext() {
+ return (0, import_react29.useContext)(StackContext);
+}
+function StackProvider({
+ children,
+ onUpdate,
+ type,
+ element,
+ enabled
+}) {
+ let parentUpdate = useStackContext();
+ let notify = useEvent((...args) => {
+ onUpdate == null ? void 0 : onUpdate(...args);
+ parentUpdate(...args);
+ });
+ useIsoMorphicEffect(() => {
+ let shouldNotify = enabled === void 0 || enabled === true;
+ shouldNotify && notify(0 /* Add */, type, element);
+ return () => {
+ shouldNotify && notify(1 /* Remove */, type, element);
+ };
+ }, [notify, type, element, enabled]);
+ return /* @__PURE__ */ import_react29.default.createElement(StackContext.Provider, { value: notify }, children);
+}
+
+// src/use-sync-external-store-shim/index.ts
+var React11 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/use-sync-external-store-shim/useSyncExternalStoreShimClient.ts
+var React10 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+function isPolyfill(x, y) {
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
+}
+var is = typeof Object.is === "function" ? Object.is : isPolyfill;
+var { useState: useState8, useEffect: useEffect14, useLayoutEffect: useLayoutEffect2, useDebugValue } = React10;
+var didWarnOld18Alpha = false;
+var didWarnUncachedGetSnapshot = false;
+function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
+ if (true) {
+ if (!didWarnOld18Alpha) {
+ if ("startTransition" in React10) {
+ didWarnOld18Alpha = true;
+ console.error(
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
+ );
+ }
+ }
+ }
+ const value = getSnapshot();
+ if (true) {
+ if (!didWarnUncachedGetSnapshot) {
+ const cachedValue = getSnapshot();
+ if (!is(value, cachedValue)) {
+ console.error("The result of getSnapshot should be cached to avoid an infinite loop");
+ didWarnUncachedGetSnapshot = true;
+ }
+ }
+ }
+ const [{ inst }, forceUpdate] = useState8({ inst: { value, getSnapshot } });
+ useLayoutEffect2(() => {
+ inst.value = value;
+ inst.getSnapshot = getSnapshot;
+ if (checkIfSnapshotChanged(inst)) {
+ forceUpdate({ inst });
+ }
+ }, [subscribe, value, getSnapshot]);
+ useEffect14(() => {
+ if (checkIfSnapshotChanged(inst)) {
+ forceUpdate({ inst });
+ }
+ const handleStoreChange = () => {
+ if (checkIfSnapshotChanged(inst)) {
+ forceUpdate({ inst });
+ }
+ };
+ return subscribe(handleStoreChange);
+ }, [subscribe]);
+ useDebugValue(value);
+ return value;
+}
+function checkIfSnapshotChanged(inst) {
+ const latestGetSnapshot = inst.getSnapshot;
+ const prevValue = inst.value;
+ try {
+ const nextValue = latestGetSnapshot();
+ return !is(prevValue, nextValue);
+ } catch (error) {
+ return true;
+ }
+}
+
+// src/use-sync-external-store-shim/useSyncExternalStoreShimServer.ts
+function useSyncExternalStore2(subscribe, getSnapshot, getServerSnapshot) {
+ return getSnapshot();
+}
+
+// src/use-sync-external-store-shim/index.ts
+var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
+var isServerEnvironment = !canUseDOM;
+var shim = isServerEnvironment ? useSyncExternalStore2 : useSyncExternalStore;
+var useSyncExternalStore3 = "useSyncExternalStore" in React11 ? ((r) => r.useSyncExternalStore)(React11) : shim;
+
+// src/hooks/use-store.ts
+function useStore(store) {
+ return useSyncExternalStore3(store.subscribe, store.getSnapshot, store.getSnapshot);
+}
+
+// src/utils/store.ts
+function createStore(initial, actions) {
+ let state = initial();
+ let listeners = /* @__PURE__ */ new Set();
+ return {
+ getSnapshot() {
+ return state;
+ },
+ subscribe(onChange) {
+ listeners.add(onChange);
+ return () => listeners.delete(onChange);
+ },
+ dispatch(key, ...args) {
+ let newState = actions[key].call(state, ...args);
+ if (newState) {
+ state = newState;
+ listeners.forEach((listener) => listener());
+ }
+ }
+ };
+}
+
+// src/hooks/document-overflow/adjust-scrollbar-padding.ts
+function adjustScrollbarPadding() {
+ let scrollbarWidthBefore;
+ return {
+ before({ doc }) {
+ var _a3;
+ let documentElement = doc.documentElement;
+ let ownerWindow = (_a3 = doc.defaultView) != null ? _a3 : window;
+ scrollbarWidthBefore = ownerWindow.innerWidth - documentElement.clientWidth;
+ },
+ after({ doc, d }) {
+ let documentElement = doc.documentElement;
+ let scrollbarWidthAfter = documentElement.clientWidth - documentElement.offsetWidth;
+ let scrollbarWidth = scrollbarWidthBefore - scrollbarWidthAfter;
+ d.style(documentElement, "paddingRight", `${scrollbarWidth}px`);
+ }
+ };
+}
+
+// src/hooks/document-overflow/handle-ios-locking.ts
+function handleIOSLocking() {
+ if (!isIOS()) {
+ return {};
+ }
+ let scrollPosition;
+ return {
+ before() {
+ scrollPosition = window.pageYOffset;
+ },
+ after({ doc, d, meta }) {
+ function inAllowedContainer(el) {
+ return meta.containers.flatMap((resolve) => resolve()).some((container) => container.contains(el));
+ }
+ d.style(doc.body, "marginTop", `-${scrollPosition}px`);
+ window.scrollTo(0, 0);
+ let scrollToElement = null;
+ d.addEventListener(
+ doc,
+ "click",
+ (e) => {
+ if (!(e.target instanceof HTMLElement)) {
+ return;
+ }
+ try {
+ let anchor = e.target.closest("a");
+ if (!anchor)
+ return;
+ let { hash } = new URL(anchor.href);
+ let el = doc.querySelector(hash);
+ if (el && !inAllowedContainer(el)) {
+ scrollToElement = el;
+ }
+ } catch (err) {
+ }
+ },
+ true
+ );
+ d.addEventListener(
+ doc,
+ "touchmove",
+ (e) => {
+ if (e.target instanceof HTMLElement && !inAllowedContainer(e.target)) {
+ e.preventDefault();
+ }
+ },
+ { passive: false }
+ );
+ d.add(() => {
+ window.scrollTo(0, window.pageYOffset + scrollPosition);
+ if (scrollToElement && scrollToElement.isConnected) {
+ scrollToElement.scrollIntoView({ block: "nearest" });
+ scrollToElement = null;
+ }
+ });
+ }
+ };
+}
+
+// src/hooks/document-overflow/prevent-scroll.ts
+function preventScroll() {
+ return {
+ before({ doc, d }) {
+ d.style(doc.documentElement, "overflow", "hidden");
+ }
+ };
+}
+
+// src/hooks/document-overflow/overflow-store.ts
+function buildMeta(fns) {
+ let tmp = {};
+ for (let fn of fns) {
+ Object.assign(tmp, fn(tmp));
+ }
+ return tmp;
+}
+var overflows = createStore(() => /* @__PURE__ */ new Map(), {
+ PUSH(doc, meta) {
+ var _a3;
+ let entry = (_a3 = this.get(doc)) != null ? _a3 : {
+ doc,
+ count: 0,
+ d: disposables(),
+ meta: /* @__PURE__ */ new Set()
+ };
+ entry.count++;
+ entry.meta.add(meta);
+ this.set(doc, entry);
+ return this;
+ },
+ POP(doc, meta) {
+ let entry = this.get(doc);
+ if (entry) {
+ entry.count--;
+ entry.meta.delete(meta);
+ }
+ return this;
+ },
+ SCROLL_PREVENT({ doc, d, meta }) {
+ let ctx = {
+ doc,
+ d,
+ meta: buildMeta(meta)
+ };
+ let steps = [
+ handleIOSLocking(),
+ adjustScrollbarPadding(),
+ preventScroll()
+ ];
+ steps.forEach(({ before }) => before == null ? void 0 : before(ctx));
+ steps.forEach(({ after }) => after == null ? void 0 : after(ctx));
+ },
+ SCROLL_ALLOW({ d }) {
+ d.dispose();
+ },
+ TEARDOWN({ doc }) {
+ this.delete(doc);
+ }
+});
+overflows.subscribe(() => {
+ let docs = overflows.getSnapshot();
+ let styles = /* @__PURE__ */ new Map();
+ for (let [doc] of docs) {
+ styles.set(doc, doc.documentElement.style.overflow);
+ }
+ for (let entry of docs.values()) {
+ let isHidden = styles.get(entry.doc) === "hidden";
+ let isLocked = entry.count !== 0;
+ let willChange = isLocked && !isHidden || !isLocked && isHidden;
+ if (willChange) {
+ overflows.dispatch(entry.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", entry);
+ }
+ if (entry.count === 0) {
+ overflows.dispatch("TEARDOWN", entry);
+ }
+ }
+});
+
+// src/hooks/document-overflow/use-document-overflow.ts
+function useDocumentOverflowLockedEffect(doc, shouldBeLocked, meta) {
+ let store = useStore(overflows);
+ let entry = doc ? store.get(doc) : void 0;
+ let locked = entry ? entry.count > 0 : false;
+ useIsoMorphicEffect(() => {
+ if (!doc || !shouldBeLocked) {
+ return;
+ }
+ overflows.dispatch("PUSH", doc, meta);
+ return () => overflows.dispatch("POP", doc, meta);
+ }, [shouldBeLocked, doc]);
+ return locked;
+}
+
+// src/hooks/use-inert.tsx
+var originals = /* @__PURE__ */ new Map();
+var counts = /* @__PURE__ */ new Map();
+function useInert(node, enabled = true) {
+ useIsoMorphicEffect(() => {
+ var _a3;
+ if (!enabled)
+ return;
+ let element = typeof node === "function" ? node() : node.current;
+ if (!element)
+ return;
+ function cleanup() {
+ var _a4;
+ if (!element)
+ return;
+ let count2 = (_a4 = counts.get(element)) != null ? _a4 : 1;
+ if (count2 === 1)
+ counts.delete(element);
+ else
+ counts.set(element, count2 - 1);
+ if (count2 !== 1)
+ return;
+ let original = originals.get(element);
+ if (!original)
+ return;
+ if (original["aria-hidden"] === null)
+ element.removeAttribute("aria-hidden");
+ else
+ element.setAttribute("aria-hidden", original["aria-hidden"]);
+ element.inert = original.inert;
+ originals.delete(element);
+ }
+ let count = (_a3 = counts.get(element)) != null ? _a3 : 0;
+ counts.set(element, count + 1);
+ if (count !== 0)
+ return cleanup;
+ originals.set(element, {
+ "aria-hidden": element.getAttribute("aria-hidden"),
+ inert: element.inert
+ });
+ element.setAttribute("aria-hidden", "true");
+ element.inert = true;
+ return cleanup;
+ }, [node, enabled]);
+}
+
+// src/hooks/use-root-containers.tsx
+var import_react30 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+function useRootContainers({
+ defaultContainers = [],
+ portals
+} = {}) {
+ let mainTreeNodeRef = (0, import_react30.useRef)(null);
+ let ownerDocument = useOwnerDocument(mainTreeNodeRef);
+ let resolveContainers2 = useEvent(() => {
+ var _a3;
+ let containers = [];
+ for (let container of defaultContainers) {
+ if (container === null)
+ continue;
+ if (container instanceof HTMLElement) {
+ containers.push(container);
+ } else if ("current" in container && container.current instanceof HTMLElement) {
+ containers.push(container.current);
+ }
+ }
+ if (portals == null ? void 0 : portals.current) {
+ for (let portal of portals.current) {
+ containers.push(portal);
+ }
+ }
+ for (let container of (_a3 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("html > *, body > *")) != null ? _a3 : []) {
+ if (container === document.body)
+ continue;
+ if (container === document.head)
+ continue;
+ if (!(container instanceof HTMLElement))
+ continue;
+ if (container.id === "headlessui-portal-root")
+ continue;
+ if (container.contains(mainTreeNodeRef.current))
+ continue;
+ if (containers.some((defaultContainer) => container.contains(defaultContainer)))
+ continue;
+ containers.push(container);
+ }
+ return containers;
+ });
+ return {
+ resolveContainers: resolveContainers2,
+ contains: useEvent(
+ (element) => resolveContainers2().some((container) => container.contains(element))
+ ),
+ mainTreeNodeRef,
+ MainTreeNode: (0, import_react30.useMemo)(() => {
+ return function MainTreeNode() {
+ return /* @__PURE__ */ import_react30.default.createElement(Hidden, { features: 4 /* Hidden */, ref: mainTreeNodeRef });
+ };
+ }, [mainTreeNodeRef])
+ };
+}
+
+// src/components/dialog/dialog.tsx
+var reducers2 = {
+ [0 /* SetTitleId */](state, action) {
+ if (state.titleId === action.id)
+ return state;
+ return { ...state, titleId: action.id };
+ }
+};
+var DialogContext = (0, import_react31.createContext)(null);
+DialogContext.displayName = "DialogContext";
+function useDialogContext(component) {
+ let context = (0, import_react31.useContext)(DialogContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useDialogContext);
+ throw err;
+ }
+ return context;
+}
+function useScrollLock(ownerDocument, enabled, resolveAllowedContainers = () => [document.body]) {
+ useDocumentOverflowLockedEffect(ownerDocument, enabled, (meta) => {
+ var _a3;
+ return {
+ containers: [...(_a3 = meta.containers) != null ? _a3 : [], resolveAllowedContainers]
+ };
+ });
+}
+function stateReducer2(state, action) {
+ return match(action.type, reducers2, state, action);
+}
+var DEFAULT_DIALOG_TAG = "div";
+var DialogRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */;
+function DialogFn(props, ref) {
+ var _a3;
+ let internalId = useId();
+ let {
+ id = `headlessui-dialog-${internalId}`,
+ open,
+ onClose,
+ initialFocus,
+ __demoMode = false,
+ ...theirProps
+ } = props;
+ let [nestedDialogCount, setNestedDialogCount] = (0, import_react31.useState)(0);
+ let usesOpenClosedState = useOpenClosed();
+ if (open === void 0 && usesOpenClosedState !== null) {
+ open = (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ let internalDialogRef = (0, import_react31.useRef)(null);
+ let dialogRef = useSyncRefs(internalDialogRef, ref);
+ let ownerDocument = useOwnerDocument(internalDialogRef);
+ let hasOpen = props.hasOwnProperty("open") || usesOpenClosedState !== null;
+ let hasOnClose = props.hasOwnProperty("onClose");
+ if (!hasOpen && !hasOnClose) {
+ throw new Error(
+ `You have to provide an \`open\` and an \`onClose\` prop to the \`Dialog\` component.`
+ );
+ }
+ if (!hasOpen) {
+ throw new Error(
+ `You provided an \`onClose\` prop to the \`Dialog\`, but forgot an \`open\` prop.`
+ );
+ }
+ if (!hasOnClose) {
+ throw new Error(
+ `You provided an \`open\` prop to the \`Dialog\`, but forgot an \`onClose\` prop.`
+ );
+ }
+ if (typeof open !== "boolean") {
+ throw new Error(
+ `You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${open}`
+ );
+ }
+ if (typeof onClose !== "function") {
+ throw new Error(
+ `You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${onClose}`
+ );
+ }
+ let dialogState = open ? 0 /* Open */ : 1 /* Closed */;
+ let [state, dispatch] = (0, import_react31.useReducer)(stateReducer2, {
+ titleId: null,
+ descriptionId: null,
+ panelRef: (0, import_react31.createRef)()
+ });
+ let close = useEvent(() => onClose(false));
+ let setTitleId = useEvent((id2) => dispatch({ type: 0 /* SetTitleId */, id: id2 }));
+ let ready = useServerHandoffComplete();
+ let enabled = ready ? __demoMode ? false : dialogState === 0 /* Open */ : false;
+ let hasNestedDialogs = nestedDialogCount > 1;
+ let hasParentDialog = (0, import_react31.useContext)(DialogContext) !== null;
+ let [portals, PortalWrapper] = useNestedPortals();
+ let {
+ resolveContainers: resolveRootContainers,
+ mainTreeNodeRef,
+ MainTreeNode
+ } = useRootContainers({
+ portals,
+ defaultContainers: [(_a3 = state.panelRef.current) != null ? _a3 : internalDialogRef.current]
+ });
+ let position = !hasNestedDialogs ? "leaf" : "parent";
+ let isClosing = usesOpenClosedState !== null ? (usesOpenClosedState & 4 /* Closing */) === 4 /* Closing */ : false;
+ let inertOthersEnabled = (() => {
+ if (hasParentDialog)
+ return false;
+ if (isClosing)
+ return false;
+ return enabled;
+ })();
+ let resolveRootOfMainTreeNode = (0, import_react31.useCallback)(() => {
+ var _a4, _b;
+ return (_b = Array.from((_a4 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("body > *")) != null ? _a4 : []).find((root) => {
+ if (root.id === "headlessui-portal-root")
+ return false;
+ return root.contains(mainTreeNodeRef.current) && root instanceof HTMLElement;
+ })) != null ? _b : null;
+ }, [mainTreeNodeRef]);
+ useInert(resolveRootOfMainTreeNode, inertOthersEnabled);
+ let inertParentDialogs = (() => {
+ if (hasNestedDialogs)
+ return true;
+ return enabled;
+ })();
+ let resolveRootOfParentDialog = (0, import_react31.useCallback)(() => {
+ var _a4, _b;
+ return (_b = Array.from((_a4 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("[data-headlessui-portal]")) != null ? _a4 : []).find(
+ (root) => root.contains(mainTreeNodeRef.current) && root instanceof HTMLElement
+ )) != null ? _b : null;
+ }, [mainTreeNodeRef]);
+ useInert(resolveRootOfParentDialog, inertParentDialogs);
+ let outsideClickEnabled = (() => {
+ if (!enabled)
+ return false;
+ if (hasNestedDialogs)
+ return false;
+ return true;
+ })();
+ useOutsideClick(resolveRootContainers, close, outsideClickEnabled);
+ let escapeToCloseEnabled = (() => {
+ if (hasNestedDialogs)
+ return false;
+ if (dialogState !== 0 /* Open */)
+ return false;
+ return true;
+ })();
+ useEventListener(ownerDocument == null ? void 0 : ownerDocument.defaultView, "keydown", (event) => {
+ if (!escapeToCloseEnabled)
+ return;
+ if (event.defaultPrevented)
+ return;
+ if (event.key !== "Escape" /* Escape */)
+ return;
+ event.preventDefault();
+ event.stopPropagation();
+ close();
+ });
+ let scrollLockEnabled = (() => {
+ if (isClosing)
+ return false;
+ if (dialogState !== 0 /* Open */)
+ return false;
+ if (hasParentDialog)
+ return false;
+ return true;
+ })();
+ useScrollLock(ownerDocument, scrollLockEnabled, resolveRootContainers);
+ (0, import_react31.useEffect)(() => {
+ if (dialogState !== 0 /* Open */)
+ return;
+ if (!internalDialogRef.current)
+ return;
+ let observer = new ResizeObserver((entries) => {
+ for (let entry of entries) {
+ let rect = entry.target.getBoundingClientRect();
+ if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) {
+ close();
+ }
+ }
+ });
+ observer.observe(internalDialogRef.current);
+ return () => observer.disconnect();
+ }, [dialogState, internalDialogRef, close]);
+ let [describedby, DescriptionProvider] = useDescriptions();
+ let contextBag = (0, import_react31.useMemo)(
+ () => [{ dialogState, close, setTitleId }, state],
+ [dialogState, state, close, setTitleId]
+ );
+ let slot = (0, import_react31.useMemo)(
+ () => ({ open: dialogState === 0 /* Open */ }),
+ [dialogState]
+ );
+ let ourProps = {
+ ref: dialogRef,
+ id,
+ role: "dialog",
+ "aria-modal": dialogState === 0 /* Open */ ? true : void 0,
+ "aria-labelledby": state.titleId,
+ "aria-describedby": describedby
+ };
+ return /* @__PURE__ */ import_react31.default.createElement(
+ StackProvider,
+ {
+ type: "Dialog",
+ enabled: dialogState === 0 /* Open */,
+ element: internalDialogRef,
+ onUpdate: useEvent((message, type) => {
+ if (type !== "Dialog")
+ return;
+ match(message, {
+ [0 /* Add */]: () => setNestedDialogCount((count) => count + 1),
+ [1 /* Remove */]: () => setNestedDialogCount((count) => count - 1)
+ });
+ })
+ },
+ /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: true }, /* @__PURE__ */ import_react31.default.createElement(Portal, null, /* @__PURE__ */ import_react31.default.createElement(DialogContext.Provider, { value: contextBag }, /* @__PURE__ */ import_react31.default.createElement(Portal.Group, { target: internalDialogRef }, /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: false }, /* @__PURE__ */ import_react31.default.createElement(DescriptionProvider, { slot, name: "Dialog.Description" }, /* @__PURE__ */ import_react31.default.createElement(
+ FocusTrap,
+ {
+ initialFocus,
+ containers: resolveRootContainers,
+ features: enabled ? match(position, {
+ parent: FocusTrap.features.RestoreFocus,
+ leaf: FocusTrap.features.All & ~FocusTrap.features.FocusLock
+ }) : FocusTrap.features.None
+ },
+ /* @__PURE__ */ import_react31.default.createElement(PortalWrapper, null, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_DIALOG_TAG,
+ features: DialogRenderFeatures,
+ visible: dialogState === 0 /* Open */,
+ name: "Dialog"
+ }))
+ ))))))),
+ /* @__PURE__ */ import_react31.default.createElement(MainTreeNode, null)
+ );
+}
+var DEFAULT_OVERLAY_TAG = "div";
+function OverlayFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-dialog-overlay-${internalId}`, ...theirProps } = props;
+ let [{ dialogState, close }] = useDialogContext("Dialog.Overlay");
+ let overlayRef = useSyncRefs(ref);
+ let handleClick = useEvent((event) => {
+ if (event.target !== event.currentTarget)
+ return;
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ event.preventDefault();
+ event.stopPropagation();
+ close();
+ });
+ let slot = (0, import_react31.useMemo)(
+ () => ({ open: dialogState === 0 /* Open */ }),
+ [dialogState]
+ );
+ let ourProps = {
+ ref: overlayRef,
+ id,
+ "aria-hidden": true,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OVERLAY_TAG,
+ name: "Dialog.Overlay"
+ });
+}
+var DEFAULT_BACKDROP_TAG = "div";
+function BackdropFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-dialog-backdrop-${internalId}`, ...theirProps } = props;
+ let [{ dialogState }, state] = useDialogContext("Dialog.Backdrop");
+ let backdropRef = useSyncRefs(ref);
+ (0, import_react31.useEffect)(() => {
+ if (state.panelRef.current === null) {
+ throw new Error(
+ `A component is being used, but a component is missing.`
+ );
+ }
+ }, [state.panelRef]);
+ let slot = (0, import_react31.useMemo)(
+ () => ({ open: dialogState === 0 /* Open */ }),
+ [dialogState]
+ );
+ let ourProps = {
+ ref: backdropRef,
+ id,
+ "aria-hidden": true
+ };
+ return /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: true }, /* @__PURE__ */ import_react31.default.createElement(Portal, null, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BACKDROP_TAG,
+ name: "Dialog.Backdrop"
+ })));
+}
+var DEFAULT_PANEL_TAG = "div";
+function PanelFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-dialog-panel-${internalId}`, ...theirProps } = props;
+ let [{ dialogState }, state] = useDialogContext("Dialog.Panel");
+ let panelRef = useSyncRefs(ref, state.panelRef);
+ let slot = (0, import_react31.useMemo)(
+ () => ({ open: dialogState === 0 /* Open */ }),
+ [dialogState]
+ );
+ let handleClick = useEvent((event) => {
+ event.stopPropagation();
+ });
+ let ourProps = {
+ ref: panelRef,
+ id,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_PANEL_TAG,
+ name: "Dialog.Panel"
+ });
+}
+var DEFAULT_TITLE_TAG = "h2";
+function TitleFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-dialog-title-${internalId}`, ...theirProps } = props;
+ let [{ dialogState, setTitleId }] = useDialogContext("Dialog.Title");
+ let titleRef = useSyncRefs(ref);
+ (0, import_react31.useEffect)(() => {
+ setTitleId(id);
+ return () => setTitleId(null);
+ }, [id, setTitleId]);
+ let slot = (0, import_react31.useMemo)(
+ () => ({ open: dialogState === 0 /* Open */ }),
+ [dialogState]
+ );
+ let ourProps = { ref: titleRef, id };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_TITLE_TAG,
+ name: "Dialog.Title"
+ });
+}
+var DialogRoot = forwardRefWithAs(DialogFn);
+var Backdrop = forwardRefWithAs(BackdropFn);
+var Panel = forwardRefWithAs(PanelFn);
+var Overlay = forwardRefWithAs(OverlayFn);
+var Title = forwardRefWithAs(TitleFn);
+var Dialog = Object.assign(DialogRoot, {
+ Backdrop,
+ Panel,
+ Overlay,
+ Title,
+ Description
+});
+
+// src/components/disclosure/disclosure.tsx
+var import_react33 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/utils/start-transition.ts
+var import_react32 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var _a2;
+var startTransition = (
+ // Prefer React's `startTransition` if it's available.
+ // @ts-expect-error - `startTransition` doesn't exist in React < 18.
+ (_a2 = import_react32.default.startTransition) != null ? _a2 : function startTransition2(cb) {
+ cb();
+ }
+);
+
+// src/components/disclosure/disclosure.tsx
+var reducers3 = {
+ [0 /* ToggleDisclosure */]: (state) => ({
+ ...state,
+ disclosureState: match(state.disclosureState, {
+ [0 /* Open */]: 1 /* Closed */,
+ [1 /* Closed */]: 0 /* Open */
+ })
+ }),
+ [1 /* CloseDisclosure */]: (state) => {
+ if (state.disclosureState === 1 /* Closed */)
+ return state;
+ return { ...state, disclosureState: 1 /* Closed */ };
+ },
+ [4 /* LinkPanel */](state) {
+ if (state.linkedPanel === true)
+ return state;
+ return { ...state, linkedPanel: true };
+ },
+ [5 /* UnlinkPanel */](state) {
+ if (state.linkedPanel === false)
+ return state;
+ return { ...state, linkedPanel: false };
+ },
+ [2 /* SetButtonId */](state, action) {
+ if (state.buttonId === action.buttonId)
+ return state;
+ return { ...state, buttonId: action.buttonId };
+ },
+ [3 /* SetPanelId */](state, action) {
+ if (state.panelId === action.panelId)
+ return state;
+ return { ...state, panelId: action.panelId };
+ }
+};
+var DisclosureContext = (0, import_react33.createContext)(null);
+DisclosureContext.displayName = "DisclosureContext";
+function useDisclosureContext(component) {
+ let context = (0, import_react33.useContext)(DisclosureContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useDisclosureContext);
+ throw err;
+ }
+ return context;
+}
+var DisclosureAPIContext = (0, import_react33.createContext)(null);
+DisclosureAPIContext.displayName = "DisclosureAPIContext";
+function useDisclosureAPIContext(component) {
+ let context = (0, import_react33.useContext)(DisclosureAPIContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useDisclosureAPIContext);
+ throw err;
+ }
+ return context;
+}
+var DisclosurePanelContext = (0, import_react33.createContext)(null);
+DisclosurePanelContext.displayName = "DisclosurePanelContext";
+function useDisclosurePanelContext() {
+ return (0, import_react33.useContext)(DisclosurePanelContext);
+}
+function stateReducer3(state, action) {
+ return match(action.type, reducers3, state, action);
+}
+var DEFAULT_DISCLOSURE_TAG = import_react33.Fragment;
+function DisclosureFn(props, ref) {
+ let { defaultOpen = false, ...theirProps } = props;
+ let internalDisclosureRef = (0, import_react33.useRef)(null);
+ let disclosureRef = useSyncRefs(
+ ref,
+ optionalRef(
+ (ref2) => {
+ internalDisclosureRef.current = ref2;
+ },
+ props.as === void 0 || // @ts-expect-error The `as` prop _can_ be a Fragment
+ props.as === import_react33.Fragment
+ )
+ );
+ let panelRef = (0, import_react33.useRef)(null);
+ let buttonRef = (0, import_react33.useRef)(null);
+ let reducerBag = (0, import_react33.useReducer)(stateReducer3, {
+ disclosureState: defaultOpen ? 0 /* Open */ : 1 /* Closed */,
+ linkedPanel: false,
+ buttonRef,
+ panelRef,
+ buttonId: null,
+ panelId: null
+ });
+ let [{ disclosureState, buttonId }, dispatch] = reducerBag;
+ let close = useEvent((focusableElement) => {
+ dispatch({ type: 1 /* CloseDisclosure */ });
+ let ownerDocument = getOwnerDocument(internalDisclosureRef);
+ if (!ownerDocument)
+ return;
+ if (!buttonId)
+ return;
+ let restoreElement = (() => {
+ if (!focusableElement)
+ return ownerDocument.getElementById(buttonId);
+ if (focusableElement instanceof HTMLElement)
+ return focusableElement;
+ if (focusableElement.current instanceof HTMLElement)
+ return focusableElement.current;
+ return ownerDocument.getElementById(buttonId);
+ })();
+ restoreElement == null ? void 0 : restoreElement.focus();
+ });
+ let api = (0, import_react33.useMemo)(() => ({ close }), [close]);
+ let slot = (0, import_react33.useMemo)(
+ () => ({ open: disclosureState === 0 /* Open */, close }),
+ [disclosureState, close]
+ );
+ let ourProps = {
+ ref: disclosureRef
+ };
+ return /* @__PURE__ */ import_react33.default.createElement(DisclosureContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react33.default.createElement(DisclosureAPIContext.Provider, { value: api }, /* @__PURE__ */ import_react33.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(disclosureState, {
+ [0 /* Open */]: 1 /* Open */,
+ [1 /* Closed */]: 2 /* Closed */
+ })
+ },
+ render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_DISCLOSURE_TAG,
+ name: "Disclosure"
+ })
+ )));
+}
+var DEFAULT_BUTTON_TAG2 = "button";
+function ButtonFn2(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-disclosure-button-${internalId}`, ...theirProps } = props;
+ let [state, dispatch] = useDisclosureContext("Disclosure.Button");
+ let panelContext = useDisclosurePanelContext();
+ let isWithinPanel = panelContext === null ? false : panelContext === state.panelId;
+ let internalButtonRef = (0, import_react33.useRef)(null);
+ let buttonRef = useSyncRefs(internalButtonRef, ref, !isWithinPanel ? state.buttonRef : null);
+ (0, import_react33.useEffect)(() => {
+ if (isWithinPanel)
+ return;
+ dispatch({ type: 2 /* SetButtonId */, buttonId: id });
+ return () => {
+ dispatch({ type: 2 /* SetButtonId */, buttonId: null });
+ };
+ }, [id, dispatch, isWithinPanel]);
+ let handleKeyDown = useEvent((event) => {
+ var _a3;
+ if (isWithinPanel) {
+ if (state.disclosureState === 1 /* Closed */)
+ return;
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 0 /* ToggleDisclosure */ });
+ (_a3 = state.buttonRef.current) == null ? void 0 : _a3.focus();
+ break;
+ }
+ } else {
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 0 /* ToggleDisclosure */ });
+ break;
+ }
+ }
+ });
+ let handleKeyUp = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ event.preventDefault();
+ break;
+ }
+ });
+ let handleClick = useEvent((event) => {
+ var _a3;
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return;
+ if (props.disabled)
+ return;
+ if (isWithinPanel) {
+ dispatch({ type: 0 /* ToggleDisclosure */ });
+ (_a3 = state.buttonRef.current) == null ? void 0 : _a3.focus();
+ } else {
+ dispatch({ type: 0 /* ToggleDisclosure */ });
+ }
+ });
+ let slot = (0, import_react33.useMemo)(
+ () => ({ open: state.disclosureState === 0 /* Open */ }),
+ [state]
+ );
+ let type = useResolveButtonType(props, internalButtonRef);
+ let ourProps = isWithinPanel ? { ref: buttonRef, type, onKeyDown: handleKeyDown, onClick: handleClick } : {
+ ref: buttonRef,
+ id,
+ type,
+ "aria-expanded": props.disabled ? void 0 : state.disclosureState === 0 /* Open */,
+ "aria-controls": state.linkedPanel ? state.panelId : void 0,
+ onKeyDown: handleKeyDown,
+ onKeyUp: handleKeyUp,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BUTTON_TAG2,
+ name: "Disclosure.Button"
+ });
+}
+var DEFAULT_PANEL_TAG2 = "div";
+var PanelRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */;
+function PanelFn2(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-disclosure-panel-${internalId}`, ...theirProps } = props;
+ let [state, dispatch] = useDisclosureContext("Disclosure.Panel");
+ let { close } = useDisclosureAPIContext("Disclosure.Panel");
+ let panelRef = useSyncRefs(ref, state.panelRef, (el) => {
+ startTransition(() => dispatch({ type: el ? 4 /* LinkPanel */ : 5 /* UnlinkPanel */ }));
+ });
+ (0, import_react33.useEffect)(() => {
+ dispatch({ type: 3 /* SetPanelId */, panelId: id });
+ return () => {
+ dispatch({ type: 3 /* SetPanelId */, panelId: null });
+ };
+ }, [id, dispatch]);
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return state.disclosureState === 0 /* Open */;
+ })();
+ let slot = (0, import_react33.useMemo)(
+ () => ({ open: state.disclosureState === 0 /* Open */, close }),
+ [state, close]
+ );
+ let ourProps = {
+ ref: panelRef,
+ id
+ };
+ return /* @__PURE__ */ import_react33.default.createElement(DisclosurePanelContext.Provider, { value: state.panelId }, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_PANEL_TAG2,
+ features: PanelRenderFeatures,
+ visible,
+ name: "Disclosure.Panel"
+ }));
+}
+var DisclosureRoot = forwardRefWithAs(DisclosureFn);
+var Button2 = forwardRefWithAs(ButtonFn2);
+var Panel2 = forwardRefWithAs(PanelFn2);
+var Disclosure = Object.assign(DisclosureRoot, { Button: Button2, Panel: Panel2 });
+
+// src/components/listbox/listbox.tsx
+var import_react35 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/hooks/use-text-value.ts
+var import_react34 = __webpack_require__(/*! react */ "react");
+
+// src/utils/get-text-value.ts
+var emojiRegex = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
+function getTextContents(element) {
+ var _a3, _b;
+ let currentInnerText = (_a3 = element.innerText) != null ? _a3 : "";
+ let copy = element.cloneNode(true);
+ if (!(copy instanceof HTMLElement)) {
+ return currentInnerText;
+ }
+ let dropped = false;
+ for (let child of copy.querySelectorAll('[hidden],[aria-hidden],[role="img"]')) {
+ child.remove();
+ dropped = true;
+ }
+ let value = dropped ? (_b = copy.innerText) != null ? _b : "" : currentInnerText;
+ if (emojiRegex.test(value)) {
+ value = value.replace(emojiRegex, "");
+ }
+ return value;
+}
+function getTextValue(element) {
+ let label = element.getAttribute("aria-label");
+ if (typeof label === "string")
+ return label.trim();
+ let labelledby = element.getAttribute("aria-labelledby");
+ if (labelledby) {
+ let labels = labelledby.split(" ").map((labelledby2) => {
+ let labelEl = document.getElementById(labelledby2);
+ if (labelEl) {
+ let label2 = labelEl.getAttribute("aria-label");
+ if (typeof label2 === "string")
+ return label2.trim();
+ return getTextContents(labelEl).trim();
+ }
+ return null;
+ }).filter(Boolean);
+ if (labels.length > 0)
+ return labels.join(", ");
+ }
+ return getTextContents(element).trim();
+}
+
+// src/hooks/use-text-value.ts
+function useTextValue(element) {
+ let cacheKey = (0, import_react34.useRef)("");
+ let cacheValue = (0, import_react34.useRef)("");
+ return useEvent(() => {
+ let el = element.current;
+ if (!el)
+ return "";
+ let currentKey = el.innerText;
+ if (cacheKey.current === currentKey) {
+ return cacheValue.current;
+ }
+ let value = getTextValue(el).trim().toLowerCase();
+ cacheKey.current = currentKey;
+ cacheValue.current = value;
+ return value;
+ });
+}
+
+// src/components/listbox/listbox.tsx
+function adjustOrderedState2(state, adjustment = (i) => i) {
+ let currentActiveOption = state.activeOptionIndex !== null ? state.options[state.activeOptionIndex] : null;
+ let sortedOptions = sortByDomNode(
+ adjustment(state.options.slice()),
+ (option) => option.dataRef.current.domRef.current
+ );
+ let adjustedActiveOptionIndex = currentActiveOption ? sortedOptions.indexOf(currentActiveOption) : null;
+ if (adjustedActiveOptionIndex === -1) {
+ adjustedActiveOptionIndex = null;
+ }
+ return {
+ options: sortedOptions,
+ activeOptionIndex: adjustedActiveOptionIndex
+ };
+}
+var reducers4 = {
+ [1 /* CloseListbox */](state) {
+ if (state.dataRef.current.disabled)
+ return state;
+ if (state.listboxState === 1 /* Closed */)
+ return state;
+ return { ...state, activeOptionIndex: null, listboxState: 1 /* Closed */ };
+ },
+ [0 /* OpenListbox */](state) {
+ if (state.dataRef.current.disabled)
+ return state;
+ if (state.listboxState === 0 /* Open */)
+ return state;
+ let activeOptionIndex = state.activeOptionIndex;
+ let { isSelected } = state.dataRef.current;
+ let optionIdx = state.options.findIndex((option) => isSelected(option.dataRef.current.value));
+ if (optionIdx !== -1) {
+ activeOptionIndex = optionIdx;
+ }
+ return { ...state, listboxState: 0 /* Open */, activeOptionIndex };
+ },
+ [2 /* GoToOption */](state, action) {
+ var _a3;
+ if (state.dataRef.current.disabled)
+ return state;
+ if (state.listboxState === 1 /* Closed */)
+ return state;
+ let adjustedState = adjustOrderedState2(state);
+ let activeOptionIndex = calculateActiveIndex(action, {
+ resolveItems: () => adjustedState.options,
+ resolveActiveIndex: () => adjustedState.activeOptionIndex,
+ resolveId: (option) => option.id,
+ resolveDisabled: (option) => option.dataRef.current.disabled
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ searchQuery: "",
+ activeOptionIndex,
+ activationTrigger: (_a3 = action.trigger) != null ? _a3 : 1 /* Other */
+ };
+ },
+ [3 /* Search */]: (state, action) => {
+ if (state.dataRef.current.disabled)
+ return state;
+ if (state.listboxState === 1 /* Closed */)
+ return state;
+ let wasAlreadySearching = state.searchQuery !== "";
+ let offset = wasAlreadySearching ? 0 : 1;
+ let searchQuery = state.searchQuery + action.value.toLowerCase();
+ let reOrderedOptions = state.activeOptionIndex !== null ? state.options.slice(state.activeOptionIndex + offset).concat(state.options.slice(0, state.activeOptionIndex + offset)) : state.options;
+ let matchingOption = reOrderedOptions.find(
+ (option) => {
+ var _a3;
+ return !option.dataRef.current.disabled && ((_a3 = option.dataRef.current.textValue) == null ? void 0 : _a3.startsWith(searchQuery));
+ }
+ );
+ let matchIdx = matchingOption ? state.options.indexOf(matchingOption) : -1;
+ if (matchIdx === -1 || matchIdx === state.activeOptionIndex)
+ return { ...state, searchQuery };
+ return {
+ ...state,
+ searchQuery,
+ activeOptionIndex: matchIdx,
+ activationTrigger: 1 /* Other */
+ };
+ },
+ [4 /* ClearSearch */](state) {
+ if (state.dataRef.current.disabled)
+ return state;
+ if (state.listboxState === 1 /* Closed */)
+ return state;
+ if (state.searchQuery === "")
+ return state;
+ return { ...state, searchQuery: "" };
+ },
+ [5 /* RegisterOption */]: (state, action) => {
+ let option = { id: action.id, dataRef: action.dataRef };
+ let adjustedState = adjustOrderedState2(state, (options) => [...options, option]);
+ if (state.activeOptionIndex === null) {
+ if (state.dataRef.current.isSelected(action.dataRef.current.value)) {
+ adjustedState.activeOptionIndex = adjustedState.options.indexOf(option);
+ }
+ }
+ return { ...state, ...adjustedState };
+ },
+ [6 /* UnregisterOption */]: (state, action) => {
+ let adjustedState = adjustOrderedState2(state, (options) => {
+ let idx = options.findIndex((a) => a.id === action.id);
+ if (idx !== -1)
+ options.splice(idx, 1);
+ return options;
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ activationTrigger: 1 /* Other */
+ };
+ },
+ [7 /* RegisterLabel */]: (state, action) => {
+ return {
+ ...state,
+ labelId: action.id
+ };
+ }
+};
+var ListboxActionsContext = (0, import_react35.createContext)(null);
+ListboxActionsContext.displayName = "ListboxActionsContext";
+function useActions2(component) {
+ let context = (0, import_react35.useContext)(ListboxActionsContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useActions2);
+ throw err;
+ }
+ return context;
+}
+var ListboxDataContext = (0, import_react35.createContext)(null);
+ListboxDataContext.displayName = "ListboxDataContext";
+function useData2(component) {
+ let context = (0, import_react35.useContext)(ListboxDataContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useData2);
+ throw err;
+ }
+ return context;
+}
+function stateReducer4(state, action) {
+ return match(action.type, reducers4, state, action);
+}
+var DEFAULT_LISTBOX_TAG = import_react35.Fragment;
+function ListboxFn(props, ref) {
+ let {
+ value: controlledValue,
+ defaultValue,
+ form: formName,
+ name,
+ onChange: controlledOnChange,
+ by = (a, z) => a === z,
+ disabled = false,
+ horizontal = false,
+ multiple = false,
+ ...theirProps
+ } = props;
+ const orientation = horizontal ? "horizontal" : "vertical";
+ let listboxRef = useSyncRefs(ref);
+ let [value = multiple ? [] : void 0, theirOnChange] = useControllable(
+ controlledValue,
+ controlledOnChange,
+ defaultValue
+ );
+ let [state, dispatch] = (0, import_react35.useReducer)(stateReducer4, {
+ dataRef: (0, import_react35.createRef)(),
+ listboxState: 1 /* Closed */,
+ options: [],
+ searchQuery: "",
+ labelId: null,
+ activeOptionIndex: null,
+ activationTrigger: 1 /* Other */
+ });
+ let optionsPropsRef = (0, import_react35.useRef)({ static: false, hold: false });
+ let labelRef = (0, import_react35.useRef)(null);
+ let buttonRef = (0, import_react35.useRef)(null);
+ let optionsRef = (0, import_react35.useRef)(null);
+ let compare = useEvent(
+ typeof by === "string" ? (a, z) => {
+ let property = by;
+ return (a == null ? void 0 : a[property]) === (z == null ? void 0 : z[property]);
+ } : by
+ );
+ let isSelected = (0, import_react35.useCallback)(
+ (compareValue) => match(data.mode, {
+ [1 /* Multi */]: () => value.some((option) => compare(option, compareValue)),
+ [0 /* Single */]: () => compare(value, compareValue)
+ }),
+ [value]
+ );
+ let data = (0, import_react35.useMemo)(
+ () => ({
+ ...state,
+ value,
+ disabled,
+ mode: multiple ? 1 /* Multi */ : 0 /* Single */,
+ orientation,
+ compare,
+ isSelected,
+ optionsPropsRef,
+ labelRef,
+ buttonRef,
+ optionsRef
+ }),
+ [value, disabled, multiple, state]
+ );
+ useIsoMorphicEffect(() => {
+ state.dataRef.current = data;
+ }, [data]);
+ useOutsideClick(
+ [data.buttonRef, data.optionsRef],
+ (event, target) => {
+ var _a3;
+ dispatch({ type: 1 /* CloseListbox */ });
+ if (!isFocusableElement(target, 1 /* Loose */)) {
+ event.preventDefault();
+ (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus();
+ }
+ },
+ data.listboxState === 0 /* Open */
+ );
+ let slot = (0, import_react35.useMemo)(
+ () => ({ open: data.listboxState === 0 /* Open */, disabled, value }),
+ [data, disabled, value]
+ );
+ let selectOption = useEvent((id) => {
+ let option = data.options.find((item) => item.id === id);
+ if (!option)
+ return;
+ onChange(option.dataRef.current.value);
+ });
+ let selectActiveOption = useEvent(() => {
+ if (data.activeOptionIndex !== null) {
+ let { dataRef, id } = data.options[data.activeOptionIndex];
+ onChange(dataRef.current.value);
+ dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id });
+ }
+ });
+ let openListbox = useEvent(() => dispatch({ type: 0 /* OpenListbox */ }));
+ let closeListbox = useEvent(() => dispatch({ type: 1 /* CloseListbox */ }));
+ let goToOption = useEvent((focus, id, trigger) => {
+ if (focus === 4 /* Specific */) {
+ return dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id, trigger });
+ }
+ return dispatch({ type: 2 /* GoToOption */, focus, trigger });
+ });
+ let registerOption = useEvent((id, dataRef) => {
+ dispatch({ type: 5 /* RegisterOption */, id, dataRef });
+ return () => dispatch({ type: 6 /* UnregisterOption */, id });
+ });
+ let registerLabel = useEvent((id) => {
+ dispatch({ type: 7 /* RegisterLabel */, id });
+ return () => dispatch({ type: 7 /* RegisterLabel */, id: null });
+ });
+ let onChange = useEvent((value2) => {
+ return match(data.mode, {
+ [0 /* Single */]() {
+ return theirOnChange == null ? void 0 : theirOnChange(value2);
+ },
+ [1 /* Multi */]() {
+ let copy = data.value.slice();
+ let idx = copy.findIndex((item) => compare(item, value2));
+ if (idx === -1) {
+ copy.push(value2);
+ } else {
+ copy.splice(idx, 1);
+ }
+ return theirOnChange == null ? void 0 : theirOnChange(copy);
+ }
+ });
+ });
+ let search = useEvent((value2) => dispatch({ type: 3 /* Search */, value: value2 }));
+ let clearSearch = useEvent(() => dispatch({ type: 4 /* ClearSearch */ }));
+ let actions = (0, import_react35.useMemo)(
+ () => ({
+ onChange,
+ registerOption,
+ registerLabel,
+ goToOption,
+ closeListbox,
+ openListbox,
+ selectActiveOption,
+ selectOption,
+ search,
+ clearSearch
+ }),
+ []
+ );
+ let ourProps = { ref: listboxRef };
+ let form = (0, import_react35.useRef)(null);
+ let d = useDisposables();
+ (0, import_react35.useEffect)(() => {
+ if (!form.current)
+ return;
+ if (defaultValue === void 0)
+ return;
+ d.addEventListener(form.current, "reset", () => {
+ onChange(defaultValue);
+ });
+ }, [
+ form,
+ onChange
+ /* Explicitly ignoring `defaultValue` */
+ ]);
+ return /* @__PURE__ */ import_react35.default.createElement(ListboxActionsContext.Provider, { value: actions }, /* @__PURE__ */ import_react35.default.createElement(ListboxDataContext.Provider, { value: data }, /* @__PURE__ */ import_react35.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(data.listboxState, {
+ [0 /* Open */]: 1 /* Open */,
+ [1 /* Closed */]: 2 /* Closed */
+ })
+ },
+ name != null && value != null && objectToFormEntries({ [name]: value }).map(([name2, value2], idx) => /* @__PURE__ */ import_react35.default.createElement(
+ Hidden,
+ {
+ features: 4 /* Hidden */,
+ ref: idx === 0 ? (element) => {
+ var _a3;
+ form.current = (_a3 = element == null ? void 0 : element.closest("form")) != null ? _a3 : null;
+ } : void 0,
+ ...compact({
+ key: name2,
+ as: "input",
+ type: "hidden",
+ hidden: true,
+ readOnly: true,
+ form: formName,
+ name: name2,
+ value: value2
+ })
+ }
+ )),
+ render({ ourProps, theirProps, slot, defaultTag: DEFAULT_LISTBOX_TAG, name: "Listbox" })
+ )));
+}
+var DEFAULT_BUTTON_TAG3 = "button";
+function ButtonFn3(props, ref) {
+ var _a3;
+ let internalId = useId();
+ let { id = `headlessui-listbox-button-${internalId}`, ...theirProps } = props;
+ let data = useData2("Listbox.Button");
+ let actions = useActions2("Listbox.Button");
+ let buttonRef = useSyncRefs(data.buttonRef, ref);
+ let d = useDisposables();
+ let handleKeyDown = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ case "ArrowDown" /* ArrowDown */:
+ event.preventDefault();
+ actions.openListbox();
+ d.nextFrame(() => {
+ if (!data.value)
+ actions.goToOption(0 /* First */);
+ });
+ break;
+ case "ArrowUp" /* ArrowUp */:
+ event.preventDefault();
+ actions.openListbox();
+ d.nextFrame(() => {
+ if (!data.value)
+ actions.goToOption(3 /* Last */);
+ });
+ break;
+ }
+ });
+ let handleKeyUp = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ event.preventDefault();
+ break;
+ }
+ });
+ let handleClick = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ if (data.listboxState === 0 /* Open */) {
+ actions.closeListbox();
+ d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ } else {
+ event.preventDefault();
+ actions.openListbox();
+ }
+ });
+ let labelledby = useComputed(() => {
+ if (!data.labelId)
+ return void 0;
+ return [data.labelId, id].join(" ");
+ }, [data.labelId, id]);
+ let slot = (0, import_react35.useMemo)(
+ () => ({
+ open: data.listboxState === 0 /* Open */,
+ disabled: data.disabled,
+ value: data.value
+ }),
+ [data]
+ );
+ let ourProps = {
+ ref: buttonRef,
+ id,
+ type: useResolveButtonType(props, data.buttonRef),
+ "aria-haspopup": "listbox",
+ "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id,
+ "aria-expanded": data.disabled ? void 0 : data.listboxState === 0 /* Open */,
+ "aria-labelledby": labelledby,
+ disabled: data.disabled,
+ onKeyDown: handleKeyDown,
+ onKeyUp: handleKeyUp,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BUTTON_TAG3,
+ name: "Listbox.Button"
+ });
+}
+var DEFAULT_LABEL_TAG2 = "label";
+function LabelFn2(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-listbox-label-${internalId}`, ...theirProps } = props;
+ let data = useData2("Listbox.Label");
+ let actions = useActions2("Listbox.Label");
+ let labelRef = useSyncRefs(data.labelRef, ref);
+ useIsoMorphicEffect(() => actions.registerLabel(id), [id]);
+ let handleClick = useEvent(() => {
+ var _a3;
+ return (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus({ preventScroll: true });
+ });
+ let slot = (0, import_react35.useMemo)(
+ () => ({ open: data.listboxState === 0 /* Open */, disabled: data.disabled }),
+ [data]
+ );
+ let ourProps = { ref: labelRef, id, onClick: handleClick };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_LABEL_TAG2,
+ name: "Listbox.Label"
+ });
+}
+var DEFAULT_OPTIONS_TAG2 = "ul";
+var OptionsRenderFeatures2 = 1 /* RenderStrategy */ | 2 /* Static */;
+function OptionsFn2(props, ref) {
+ var _a3;
+ let internalId = useId();
+ let { id = `headlessui-listbox-options-${internalId}`, ...theirProps } = props;
+ let data = useData2("Listbox.Options");
+ let actions = useActions2("Listbox.Options");
+ let optionsRef = useSyncRefs(data.optionsRef, ref);
+ let d = useDisposables();
+ let searchDisposables = useDisposables();
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return data.listboxState === 0 /* Open */;
+ })();
+ (0, import_react35.useEffect)(() => {
+ var _a4;
+ let container = data.optionsRef.current;
+ if (!container)
+ return;
+ if (data.listboxState !== 0 /* Open */)
+ return;
+ if (container === ((_a4 = getOwnerDocument(container)) == null ? void 0 : _a4.activeElement))
+ return;
+ container.focus({ preventScroll: true });
+ }, [data.listboxState, data.optionsRef]);
+ let handleKeyDown = useEvent((event) => {
+ searchDisposables.dispose();
+ switch (event.key) {
+ case " " /* Space */:
+ if (data.searchQuery !== "") {
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.search(event.key);
+ }
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ event.stopPropagation();
+ if (data.activeOptionIndex !== null) {
+ let { dataRef } = data.options[data.activeOptionIndex];
+ actions.onChange(dataRef.current.value);
+ }
+ if (data.mode === 0 /* Single */) {
+ actions.closeListbox();
+ disposables().nextFrame(() => {
+ var _a4;
+ return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ }
+ break;
+ case match(data.orientation, { vertical: "ArrowDown" /* ArrowDown */, horizontal: "ArrowRight" /* ArrowRight */ }):
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(2 /* Next */);
+ case match(data.orientation, { vertical: "ArrowUp" /* ArrowUp */, horizontal: "ArrowLeft" /* ArrowLeft */ }):
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(1 /* Previous */);
+ case "Home" /* Home */:
+ case "PageUp" /* PageUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(0 /* First */);
+ case "End" /* End */:
+ case "PageDown" /* PageDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ return actions.goToOption(3 /* Last */);
+ case "Escape" /* Escape */:
+ event.preventDefault();
+ event.stopPropagation();
+ actions.closeListbox();
+ return d.nextFrame(() => {
+ var _a4;
+ return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ case "Tab" /* Tab */:
+ event.preventDefault();
+ event.stopPropagation();
+ break;
+ default:
+ if (event.key.length === 1) {
+ actions.search(event.key);
+ searchDisposables.setTimeout(() => actions.clearSearch(), 350);
+ }
+ break;
+ }
+ });
+ let labelledby = useComputed(
+ () => {
+ var _a4, _b, _c;
+ return (_c = (_a4 = data.labelRef.current) == null ? void 0 : _a4.id) != null ? _c : (_b = data.buttonRef.current) == null ? void 0 : _b.id;
+ },
+ [data.labelRef.current, data.buttonRef.current]
+ );
+ let slot = (0, import_react35.useMemo)(
+ () => ({ open: data.listboxState === 0 /* Open */ }),
+ [data]
+ );
+ let ourProps = {
+ "aria-activedescendant": data.activeOptionIndex === null ? void 0 : (_a3 = data.options[data.activeOptionIndex]) == null ? void 0 : _a3.id,
+ "aria-multiselectable": data.mode === 1 /* Multi */ ? true : void 0,
+ "aria-labelledby": labelledby,
+ "aria-orientation": data.orientation,
+ id,
+ onKeyDown: handleKeyDown,
+ role: "listbox",
+ tabIndex: 0,
+ ref: optionsRef
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OPTIONS_TAG2,
+ features: OptionsRenderFeatures2,
+ visible,
+ name: "Listbox.Options"
+ });
+}
+var DEFAULT_OPTION_TAG2 = "li";
+function OptionFn2(props, ref) {
+ let internalId = useId();
+ let {
+ id = `headlessui-listbox-option-${internalId}`,
+ disabled = false,
+ value,
+ ...theirProps
+ } = props;
+ let data = useData2("Listbox.Option");
+ let actions = useActions2("Listbox.Option");
+ let active = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex].id === id : false;
+ let selected = data.isSelected(value);
+ let internalOptionRef = (0, import_react35.useRef)(null);
+ let getTextValue2 = useTextValue(internalOptionRef);
+ let bag = useLatestValue({
+ disabled,
+ value,
+ domRef: internalOptionRef,
+ get textValue() {
+ return getTextValue2();
+ }
+ });
+ let optionRef = useSyncRefs(ref, internalOptionRef);
+ useIsoMorphicEffect(() => {
+ if (data.listboxState !== 0 /* Open */)
+ return;
+ if (!active)
+ return;
+ if (data.activationTrigger === 0 /* Pointer */)
+ return;
+ let d = disposables();
+ d.requestAnimationFrame(() => {
+ var _a3, _b;
+ (_b = (_a3 = internalOptionRef.current) == null ? void 0 : _a3.scrollIntoView) == null ? void 0 : _b.call(_a3, { block: "nearest" });
+ });
+ return d.dispose;
+ }, [
+ internalOptionRef,
+ active,
+ data.listboxState,
+ data.activationTrigger,
+ /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */
+ data.activeOptionIndex
+ ]);
+ useIsoMorphicEffect(() => actions.registerOption(id, bag), [bag, id]);
+ let handleClick = useEvent((event) => {
+ if (disabled)
+ return event.preventDefault();
+ actions.onChange(value);
+ if (data.mode === 0 /* Single */) {
+ actions.closeListbox();
+ disposables().nextFrame(() => {
+ var _a3;
+ return (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus({ preventScroll: true });
+ });
+ }
+ });
+ let handleFocus = useEvent(() => {
+ if (disabled)
+ return actions.goToOption(5 /* Nothing */);
+ actions.goToOption(4 /* Specific */, id);
+ });
+ let pointer = useTrackedPointer();
+ let handleEnter = useEvent((evt) => pointer.update(evt));
+ let handleMove = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (active)
+ return;
+ actions.goToOption(4 /* Specific */, id, 0 /* Pointer */);
+ });
+ let handleLeave = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (!active)
+ return;
+ actions.goToOption(5 /* Nothing */);
+ });
+ let slot = (0, import_react35.useMemo)(
+ () => ({ active, selected, disabled }),
+ [active, selected, disabled]
+ );
+ let ourProps = {
+ id,
+ ref: optionRef,
+ role: "option",
+ tabIndex: disabled === true ? void 0 : -1,
+ "aria-disabled": disabled === true ? true : void 0,
+ // According to the WAI-ARIA best practices, we should use aria-checked for
+ // multi-select,but Voice-Over disagrees. So we use aria-checked instead for
+ // both single and multi-select.
+ "aria-selected": selected,
+ disabled: void 0,
+ // Never forward the `disabled` prop
+ onClick: handleClick,
+ onFocus: handleFocus,
+ onPointerEnter: handleEnter,
+ onMouseEnter: handleEnter,
+ onPointerMove: handleMove,
+ onMouseMove: handleMove,
+ onPointerLeave: handleLeave,
+ onMouseLeave: handleLeave
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OPTION_TAG2,
+ name: "Listbox.Option"
+ });
+}
+var ListboxRoot = forwardRefWithAs(ListboxFn);
+var Button3 = forwardRefWithAs(ButtonFn3);
+var Label2 = forwardRefWithAs(LabelFn2);
+var Options2 = forwardRefWithAs(OptionsFn2);
+var Option2 = forwardRefWithAs(OptionFn2);
+var Listbox = Object.assign(ListboxRoot, { Button: Button3, Label: Label2, Options: Options2, Option: Option2 });
+
+// src/components/menu/menu.tsx
+var import_react36 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+function adjustOrderedState3(state, adjustment = (i) => i) {
+ let currentActiveItem = state.activeItemIndex !== null ? state.items[state.activeItemIndex] : null;
+ let sortedItems = sortByDomNode(
+ adjustment(state.items.slice()),
+ (item) => item.dataRef.current.domRef.current
+ );
+ let adjustedActiveItemIndex = currentActiveItem ? sortedItems.indexOf(currentActiveItem) : null;
+ if (adjustedActiveItemIndex === -1) {
+ adjustedActiveItemIndex = null;
+ }
+ return {
+ items: sortedItems,
+ activeItemIndex: adjustedActiveItemIndex
+ };
+}
+var reducers5 = {
+ [1 /* CloseMenu */](state) {
+ if (state.menuState === 1 /* Closed */)
+ return state;
+ return { ...state, activeItemIndex: null, menuState: 1 /* Closed */ };
+ },
+ [0 /* OpenMenu */](state) {
+ if (state.menuState === 0 /* Open */)
+ return state;
+ return {
+ ...state,
+ /* We can turn off demo mode once we re-open the `Menu` */
+ __demoMode: false,
+ menuState: 0 /* Open */
+ };
+ },
+ [2 /* GoToItem */]: (state, action) => {
+ var _a3;
+ let adjustedState = adjustOrderedState3(state);
+ let activeItemIndex = calculateActiveIndex(action, {
+ resolveItems: () => adjustedState.items,
+ resolveActiveIndex: () => adjustedState.activeItemIndex,
+ resolveId: (item) => item.id,
+ resolveDisabled: (item) => item.dataRef.current.disabled
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ searchQuery: "",
+ activeItemIndex,
+ activationTrigger: (_a3 = action.trigger) != null ? _a3 : 1 /* Other */
+ };
+ },
+ [3 /* Search */]: (state, action) => {
+ let wasAlreadySearching = state.searchQuery !== "";
+ let offset = wasAlreadySearching ? 0 : 1;
+ let searchQuery = state.searchQuery + action.value.toLowerCase();
+ let reOrderedItems = state.activeItemIndex !== null ? state.items.slice(state.activeItemIndex + offset).concat(state.items.slice(0, state.activeItemIndex + offset)) : state.items;
+ let matchingItem = reOrderedItems.find(
+ (item) => {
+ var _a3;
+ return ((_a3 = item.dataRef.current.textValue) == null ? void 0 : _a3.startsWith(searchQuery)) && !item.dataRef.current.disabled;
+ }
+ );
+ let matchIdx = matchingItem ? state.items.indexOf(matchingItem) : -1;
+ if (matchIdx === -1 || matchIdx === state.activeItemIndex)
+ return { ...state, searchQuery };
+ return {
+ ...state,
+ searchQuery,
+ activeItemIndex: matchIdx,
+ activationTrigger: 1 /* Other */
+ };
+ },
+ [4 /* ClearSearch */](state) {
+ if (state.searchQuery === "")
+ return state;
+ return { ...state, searchQuery: "", searchActiveItemIndex: null };
+ },
+ [5 /* RegisterItem */]: (state, action) => {
+ let adjustedState = adjustOrderedState3(state, (items) => [
+ ...items,
+ { id: action.id, dataRef: action.dataRef }
+ ]);
+ return { ...state, ...adjustedState };
+ },
+ [6 /* UnregisterItem */]: (state, action) => {
+ let adjustedState = adjustOrderedState3(state, (items) => {
+ let idx = items.findIndex((a) => a.id === action.id);
+ if (idx !== -1)
+ items.splice(idx, 1);
+ return items;
+ });
+ return {
+ ...state,
+ ...adjustedState,
+ activationTrigger: 1 /* Other */
+ };
+ }
+};
+var MenuContext = (0, import_react36.createContext)(null);
+MenuContext.displayName = "MenuContext";
+function useMenuContext(component) {
+ let context = (0, import_react36.useContext)(MenuContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useMenuContext);
+ throw err;
+ }
+ return context;
+}
+function stateReducer5(state, action) {
+ return match(action.type, reducers5, state, action);
+}
+var DEFAULT_MENU_TAG = import_react36.Fragment;
+function MenuFn(props, ref) {
+ let { __demoMode = false, ...theirProps } = props;
+ let reducerBag = (0, import_react36.useReducer)(stateReducer5, {
+ __demoMode,
+ menuState: __demoMode ? 0 /* Open */ : 1 /* Closed */,
+ buttonRef: (0, import_react36.createRef)(),
+ itemsRef: (0, import_react36.createRef)(),
+ items: [],
+ searchQuery: "",
+ activeItemIndex: null,
+ activationTrigger: 1 /* Other */
+ });
+ let [{ menuState, itemsRef, buttonRef }, dispatch] = reducerBag;
+ let menuRef = useSyncRefs(ref);
+ useOutsideClick(
+ [buttonRef, itemsRef],
+ (event, target) => {
+ var _a3;
+ dispatch({ type: 1 /* CloseMenu */ });
+ if (!isFocusableElement(target, 1 /* Loose */)) {
+ event.preventDefault();
+ (_a3 = buttonRef.current) == null ? void 0 : _a3.focus();
+ }
+ },
+ menuState === 0 /* Open */
+ );
+ let close = useEvent(() => {
+ dispatch({ type: 1 /* CloseMenu */ });
+ });
+ let slot = (0, import_react36.useMemo)(
+ () => ({ open: menuState === 0 /* Open */, close }),
+ [menuState, close]
+ );
+ let ourProps = { ref: menuRef };
+ return /* @__PURE__ */ import_react36.default.createElement(MenuContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react36.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(menuState, {
+ [0 /* Open */]: 1 /* Open */,
+ [1 /* Closed */]: 2 /* Closed */
+ })
+ },
+ render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_MENU_TAG,
+ name: "Menu"
+ })
+ ));
+}
+var DEFAULT_BUTTON_TAG4 = "button";
+function ButtonFn4(props, ref) {
+ var _a3;
+ let internalId = useId();
+ let { id = `headlessui-menu-button-${internalId}`, ...theirProps } = props;
+ let [state, dispatch] = useMenuContext("Menu.Button");
+ let buttonRef = useSyncRefs(state.buttonRef, ref);
+ let d = useDisposables();
+ let handleKeyDown = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ case "ArrowDown" /* ArrowDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 0 /* OpenMenu */ });
+ d.nextFrame(() => dispatch({ type: 2 /* GoToItem */, focus: 0 /* First */ }));
+ break;
+ case "ArrowUp" /* ArrowUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 0 /* OpenMenu */ });
+ d.nextFrame(() => dispatch({ type: 2 /* GoToItem */, focus: 3 /* Last */ }));
+ break;
+ }
+ });
+ let handleKeyUp = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ event.preventDefault();
+ break;
+ }
+ });
+ let handleClick = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ if (props.disabled)
+ return;
+ if (state.menuState === 0 /* Open */) {
+ dispatch({ type: 1 /* CloseMenu */ });
+ d.nextFrame(() => {
+ var _a4;
+ return (_a4 = state.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true });
+ });
+ } else {
+ event.preventDefault();
+ dispatch({ type: 0 /* OpenMenu */ });
+ }
+ });
+ let slot = (0, import_react36.useMemo)(
+ () => ({ open: state.menuState === 0 /* Open */ }),
+ [state]
+ );
+ let ourProps = {
+ ref: buttonRef,
+ id,
+ type: useResolveButtonType(props, state.buttonRef),
+ "aria-haspopup": "menu",
+ "aria-controls": (_a3 = state.itemsRef.current) == null ? void 0 : _a3.id,
+ "aria-expanded": props.disabled ? void 0 : state.menuState === 0 /* Open */,
+ onKeyDown: handleKeyDown,
+ onKeyUp: handleKeyUp,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BUTTON_TAG4,
+ name: "Menu.Button"
+ });
+}
+var DEFAULT_ITEMS_TAG = "div";
+var ItemsRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */;
+function ItemsFn(props, ref) {
+ var _a3, _b;
+ let internalId = useId();
+ let { id = `headlessui-menu-items-${internalId}`, ...theirProps } = props;
+ let [state, dispatch] = useMenuContext("Menu.Items");
+ let itemsRef = useSyncRefs(state.itemsRef, ref);
+ let ownerDocument = useOwnerDocument(state.itemsRef);
+ let searchDisposables = useDisposables();
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return state.menuState === 0 /* Open */;
+ })();
+ (0, import_react36.useEffect)(() => {
+ let container = state.itemsRef.current;
+ if (!container)
+ return;
+ if (state.menuState !== 0 /* Open */)
+ return;
+ if (container === (ownerDocument == null ? void 0 : ownerDocument.activeElement))
+ return;
+ container.focus({ preventScroll: true });
+ }, [state.menuState, state.itemsRef, ownerDocument]);
+ useTreeWalker({
+ container: state.itemsRef.current,
+ enabled: state.menuState === 0 /* Open */,
+ accept(node) {
+ if (node.getAttribute("role") === "menuitem")
+ return NodeFilter.FILTER_REJECT;
+ if (node.hasAttribute("role"))
+ return NodeFilter.FILTER_SKIP;
+ return NodeFilter.FILTER_ACCEPT;
+ },
+ walk(node) {
+ node.setAttribute("role", "none");
+ }
+ });
+ let handleKeyDown = useEvent((event) => {
+ var _a4, _b2;
+ searchDisposables.dispose();
+ switch (event.key) {
+ case " " /* Space */:
+ if (state.searchQuery !== "") {
+ event.preventDefault();
+ event.stopPropagation();
+ return dispatch({ type: 3 /* Search */, value: event.key });
+ }
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 1 /* CloseMenu */ });
+ if (state.activeItemIndex !== null) {
+ let { dataRef } = state.items[state.activeItemIndex];
+ (_b2 = (_a4 = dataRef.current) == null ? void 0 : _a4.domRef.current) == null ? void 0 : _b2.click();
+ }
+ restoreFocusIfNecessary(state.buttonRef.current);
+ break;
+ case "ArrowDown" /* ArrowDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ return dispatch({ type: 2 /* GoToItem */, focus: 2 /* Next */ });
+ case "ArrowUp" /* ArrowUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ return dispatch({ type: 2 /* GoToItem */, focus: 1 /* Previous */ });
+ case "Home" /* Home */:
+ case "PageUp" /* PageUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ return dispatch({ type: 2 /* GoToItem */, focus: 0 /* First */ });
+ case "End" /* End */:
+ case "PageDown" /* PageDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ return dispatch({ type: 2 /* GoToItem */, focus: 3 /* Last */ });
+ case "Escape" /* Escape */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 1 /* CloseMenu */ });
+ disposables().nextFrame(() => {
+ var _a5;
+ return (_a5 = state.buttonRef.current) == null ? void 0 : _a5.focus({ preventScroll: true });
+ });
+ break;
+ case "Tab" /* Tab */:
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 1 /* CloseMenu */ });
+ disposables().nextFrame(() => {
+ focusFrom(
+ state.buttonRef.current,
+ event.shiftKey ? 2 /* Previous */ : 4 /* Next */
+ );
+ });
+ break;
+ default:
+ if (event.key.length === 1) {
+ dispatch({ type: 3 /* Search */, value: event.key });
+ searchDisposables.setTimeout(() => dispatch({ type: 4 /* ClearSearch */ }), 350);
+ }
+ break;
+ }
+ });
+ let handleKeyUp = useEvent((event) => {
+ switch (event.key) {
+ case " " /* Space */:
+ event.preventDefault();
+ break;
+ }
+ });
+ let slot = (0, import_react36.useMemo)(
+ () => ({ open: state.menuState === 0 /* Open */ }),
+ [state]
+ );
+ let ourProps = {
+ "aria-activedescendant": state.activeItemIndex === null ? void 0 : (_a3 = state.items[state.activeItemIndex]) == null ? void 0 : _a3.id,
+ "aria-labelledby": (_b = state.buttonRef.current) == null ? void 0 : _b.id,
+ id,
+ onKeyDown: handleKeyDown,
+ onKeyUp: handleKeyUp,
+ role: "menu",
+ tabIndex: 0,
+ ref: itemsRef
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_ITEMS_TAG,
+ features: ItemsRenderFeatures,
+ visible,
+ name: "Menu.Items"
+ });
+}
+var DEFAULT_ITEM_TAG = import_react36.Fragment;
+function ItemFn(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-menu-item-${internalId}`, disabled = false, ...theirProps } = props;
+ let [state, dispatch] = useMenuContext("Menu.Item");
+ let active = state.activeItemIndex !== null ? state.items[state.activeItemIndex].id === id : false;
+ let internalItemRef = (0, import_react36.useRef)(null);
+ let itemRef = useSyncRefs(ref, internalItemRef);
+ useIsoMorphicEffect(() => {
+ if (state.__demoMode)
+ return;
+ if (state.menuState !== 0 /* Open */)
+ return;
+ if (!active)
+ return;
+ if (state.activationTrigger === 0 /* Pointer */)
+ return;
+ let d = disposables();
+ d.requestAnimationFrame(() => {
+ var _a3, _b;
+ (_b = (_a3 = internalItemRef.current) == null ? void 0 : _a3.scrollIntoView) == null ? void 0 : _b.call(_a3, { block: "nearest" });
+ });
+ return d.dispose;
+ }, [
+ state.__demoMode,
+ internalItemRef,
+ active,
+ state.menuState,
+ state.activationTrigger,
+ /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */
+ state.activeItemIndex
+ ]);
+ let getTextValue2 = useTextValue(internalItemRef);
+ let bag = (0, import_react36.useRef)({
+ disabled,
+ domRef: internalItemRef,
+ get textValue() {
+ return getTextValue2();
+ }
+ });
+ useIsoMorphicEffect(() => {
+ bag.current.disabled = disabled;
+ }, [bag, disabled]);
+ useIsoMorphicEffect(() => {
+ dispatch({ type: 5 /* RegisterItem */, id, dataRef: bag });
+ return () => dispatch({ type: 6 /* UnregisterItem */, id });
+ }, [bag, id]);
+ let close = useEvent(() => {
+ dispatch({ type: 1 /* CloseMenu */ });
+ });
+ let handleClick = useEvent((event) => {
+ if (disabled)
+ return event.preventDefault();
+ dispatch({ type: 1 /* CloseMenu */ });
+ restoreFocusIfNecessary(state.buttonRef.current);
+ });
+ let handleFocus = useEvent(() => {
+ if (disabled)
+ return dispatch({ type: 2 /* GoToItem */, focus: 5 /* Nothing */ });
+ dispatch({ type: 2 /* GoToItem */, focus: 4 /* Specific */, id });
+ });
+ let pointer = useTrackedPointer();
+ let handleEnter = useEvent((evt) => pointer.update(evt));
+ let handleMove = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (active)
+ return;
+ dispatch({
+ type: 2 /* GoToItem */,
+ focus: 4 /* Specific */,
+ id,
+ trigger: 0 /* Pointer */
+ });
+ });
+ let handleLeave = useEvent((evt) => {
+ if (!pointer.wasMoved(evt))
+ return;
+ if (disabled)
+ return;
+ if (!active)
+ return;
+ dispatch({ type: 2 /* GoToItem */, focus: 5 /* Nothing */ });
+ });
+ let slot = (0, import_react36.useMemo)(
+ () => ({ active, disabled, close }),
+ [active, disabled, close]
+ );
+ let ourProps = {
+ id,
+ ref: itemRef,
+ role: "menuitem",
+ tabIndex: disabled === true ? void 0 : -1,
+ "aria-disabled": disabled === true ? true : void 0,
+ disabled: void 0,
+ // Never forward the `disabled` prop
+ onClick: handleClick,
+ onFocus: handleFocus,
+ onPointerEnter: handleEnter,
+ onMouseEnter: handleEnter,
+ onPointerMove: handleMove,
+ onMouseMove: handleMove,
+ onPointerLeave: handleLeave,
+ onMouseLeave: handleLeave
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_ITEM_TAG,
+ name: "Menu.Item"
+ });
+}
+var MenuRoot = forwardRefWithAs(MenuFn);
+var Button4 = forwardRefWithAs(ButtonFn4);
+var Items = forwardRefWithAs(ItemsFn);
+var Item = forwardRefWithAs(ItemFn);
+var Menu = Object.assign(MenuRoot, { Button: Button4, Items, Item });
+
+// src/components/popover/popover.tsx
+var import_react37 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var reducers6 = {
+ [0 /* TogglePopover */]: (state) => {
+ let nextState = {
+ ...state,
+ popoverState: match(state.popoverState, {
+ [0 /* Open */]: 1 /* Closed */,
+ [1 /* Closed */]: 0 /* Open */
+ })
+ };
+ if (nextState.popoverState === 0 /* Open */) {
+ nextState.__demoMode = false;
+ }
+ return nextState;
+ },
+ [1 /* ClosePopover */](state) {
+ if (state.popoverState === 1 /* Closed */)
+ return state;
+ return { ...state, popoverState: 1 /* Closed */ };
+ },
+ [2 /* SetButton */](state, action) {
+ if (state.button === action.button)
+ return state;
+ return { ...state, button: action.button };
+ },
+ [3 /* SetButtonId */](state, action) {
+ if (state.buttonId === action.buttonId)
+ return state;
+ return { ...state, buttonId: action.buttonId };
+ },
+ [4 /* SetPanel */](state, action) {
+ if (state.panel === action.panel)
+ return state;
+ return { ...state, panel: action.panel };
+ },
+ [5 /* SetPanelId */](state, action) {
+ if (state.panelId === action.panelId)
+ return state;
+ return { ...state, panelId: action.panelId };
+ }
+};
+var PopoverContext = (0, import_react37.createContext)(null);
+PopoverContext.displayName = "PopoverContext";
+function usePopoverContext(component) {
+ let context = (0, import_react37.useContext)(PopoverContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, usePopoverContext);
+ throw err;
+ }
+ return context;
+}
+var PopoverAPIContext = (0, import_react37.createContext)(null);
+PopoverAPIContext.displayName = "PopoverAPIContext";
+function usePopoverAPIContext(component) {
+ let context = (0, import_react37.useContext)(PopoverAPIContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, usePopoverAPIContext);
+ throw err;
+ }
+ return context;
+}
+var PopoverGroupContext = (0, import_react37.createContext)(null);
+PopoverGroupContext.displayName = "PopoverGroupContext";
+function usePopoverGroupContext() {
+ return (0, import_react37.useContext)(PopoverGroupContext);
+}
+var PopoverPanelContext = (0, import_react37.createContext)(null);
+PopoverPanelContext.displayName = "PopoverPanelContext";
+function usePopoverPanelContext() {
+ return (0, import_react37.useContext)(PopoverPanelContext);
+}
+function stateReducer6(state, action) {
+ return match(action.type, reducers6, state, action);
+}
+var DEFAULT_POPOVER_TAG = "div";
+function PopoverFn(props, ref) {
+ var _a3;
+ let { __demoMode = false, ...theirProps } = props;
+ let internalPopoverRef = (0, import_react37.useRef)(null);
+ let popoverRef = useSyncRefs(
+ ref,
+ optionalRef((ref2) => {
+ internalPopoverRef.current = ref2;
+ })
+ );
+ let buttons = (0, import_react37.useRef)([]);
+ let reducerBag = (0, import_react37.useReducer)(stateReducer6, {
+ __demoMode,
+ popoverState: __demoMode ? 0 /* Open */ : 1 /* Closed */,
+ buttons,
+ button: null,
+ buttonId: null,
+ panel: null,
+ panelId: null,
+ beforePanelSentinel: (0, import_react37.createRef)(),
+ afterPanelSentinel: (0, import_react37.createRef)()
+ });
+ let [
+ { popoverState, button, buttonId, panel, panelId, beforePanelSentinel, afterPanelSentinel },
+ dispatch
+ ] = reducerBag;
+ let ownerDocument = useOwnerDocument((_a3 = internalPopoverRef.current) != null ? _a3 : button);
+ let isPortalled = (0, import_react37.useMemo)(() => {
+ if (!button)
+ return false;
+ if (!panel)
+ return false;
+ for (let root2 of document.querySelectorAll("body > *")) {
+ if (Number(root2 == null ? void 0 : root2.contains(button)) ^ Number(root2 == null ? void 0 : root2.contains(panel))) {
+ return true;
+ }
+ }
+ let elements = getFocusableElements();
+ let buttonIdx = elements.indexOf(button);
+ let beforeIdx = (buttonIdx + elements.length - 1) % elements.length;
+ let afterIdx = (buttonIdx + 1) % elements.length;
+ let beforeElement = elements[beforeIdx];
+ let afterElement = elements[afterIdx];
+ if (!panel.contains(beforeElement) && !panel.contains(afterElement)) {
+ return true;
+ }
+ return false;
+ }, [button, panel]);
+ let buttonIdRef = useLatestValue(buttonId);
+ let panelIdRef = useLatestValue(panelId);
+ let registerBag = (0, import_react37.useMemo)(
+ () => ({
+ buttonId: buttonIdRef,
+ panelId: panelIdRef,
+ close: () => dispatch({ type: 1 /* ClosePopover */ })
+ }),
+ [buttonIdRef, panelIdRef, dispatch]
+ );
+ let groupContext = usePopoverGroupContext();
+ let registerPopover = groupContext == null ? void 0 : groupContext.registerPopover;
+ let isFocusWithinPopoverGroup = useEvent(() => {
+ var _a4;
+ return (_a4 = groupContext == null ? void 0 : groupContext.isFocusWithinPopoverGroup()) != null ? _a4 : (ownerDocument == null ? void 0 : ownerDocument.activeElement) && ((button == null ? void 0 : button.contains(ownerDocument.activeElement)) || (panel == null ? void 0 : panel.contains(ownerDocument.activeElement)));
+ });
+ (0, import_react37.useEffect)(() => registerPopover == null ? void 0 : registerPopover(registerBag), [registerPopover, registerBag]);
+ let [portals, PortalWrapper] = useNestedPortals();
+ let root = useRootContainers({
+ portals,
+ defaultContainers: [button, panel]
+ });
+ useEventListener(
+ ownerDocument == null ? void 0 : ownerDocument.defaultView,
+ "focus",
+ (event) => {
+ var _a4, _b, _c, _d;
+ if (event.target === window)
+ return;
+ if (!(event.target instanceof HTMLElement))
+ return;
+ if (popoverState !== 0 /* Open */)
+ return;
+ if (isFocusWithinPopoverGroup())
+ return;
+ if (!button)
+ return;
+ if (!panel)
+ return;
+ if (root.contains(event.target))
+ return;
+ if ((_b = (_a4 = beforePanelSentinel.current) == null ? void 0 : _a4.contains) == null ? void 0 : _b.call(_a4, event.target))
+ return;
+ if ((_d = (_c = afterPanelSentinel.current) == null ? void 0 : _c.contains) == null ? void 0 : _d.call(_c, event.target))
+ return;
+ dispatch({ type: 1 /* ClosePopover */ });
+ },
+ true
+ );
+ useOutsideClick(
+ root.resolveContainers,
+ (event, target) => {
+ dispatch({ type: 1 /* ClosePopover */ });
+ if (!isFocusableElement(target, 1 /* Loose */)) {
+ event.preventDefault();
+ button == null ? void 0 : button.focus();
+ }
+ },
+ popoverState === 0 /* Open */
+ );
+ let close = useEvent(
+ (focusableElement) => {
+ dispatch({ type: 1 /* ClosePopover */ });
+ let restoreElement = (() => {
+ if (!focusableElement)
+ return button;
+ if (focusableElement instanceof HTMLElement)
+ return focusableElement;
+ if ("current" in focusableElement && focusableElement.current instanceof HTMLElement)
+ return focusableElement.current;
+ return button;
+ })();
+ restoreElement == null ? void 0 : restoreElement.focus();
+ }
+ );
+ let api = (0, import_react37.useMemo)(
+ () => ({ close, isPortalled }),
+ [close, isPortalled]
+ );
+ let slot = (0, import_react37.useMemo)(
+ () => ({ open: popoverState === 0 /* Open */, close }),
+ [popoverState, close]
+ );
+ let ourProps = { ref: popoverRef };
+ return /* @__PURE__ */ import_react37.default.createElement(PopoverPanelContext.Provider, { value: null }, /* @__PURE__ */ import_react37.default.createElement(PopoverContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react37.default.createElement(PopoverAPIContext.Provider, { value: api }, /* @__PURE__ */ import_react37.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(popoverState, {
+ [0 /* Open */]: 1 /* Open */,
+ [1 /* Closed */]: 2 /* Closed */
+ })
+ },
+ /* @__PURE__ */ import_react37.default.createElement(PortalWrapper, null, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_POPOVER_TAG,
+ name: "Popover"
+ }), /* @__PURE__ */ import_react37.default.createElement(root.MainTreeNode, null))
+ ))));
+}
+var DEFAULT_BUTTON_TAG5 = "button";
+function ButtonFn5(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-popover-button-${internalId}`, ...theirProps } = props;
+ let [state, dispatch] = usePopoverContext("Popover.Button");
+ let { isPortalled } = usePopoverAPIContext("Popover.Button");
+ let internalButtonRef = (0, import_react37.useRef)(null);
+ let sentinelId = `headlessui-focus-sentinel-${useId()}`;
+ let groupContext = usePopoverGroupContext();
+ let closeOthers = groupContext == null ? void 0 : groupContext.closeOthers;
+ let panelContext = usePopoverPanelContext();
+ let isWithinPanel = panelContext !== null;
+ (0, import_react37.useEffect)(() => {
+ if (isWithinPanel)
+ return;
+ dispatch({ type: 3 /* SetButtonId */, buttonId: id });
+ return () => {
+ dispatch({ type: 3 /* SetButtonId */, buttonId: null });
+ };
+ }, [isWithinPanel, id, dispatch]);
+ let [uniqueIdentifier] = (0, import_react37.useState)(() => Symbol());
+ let buttonRef = useSyncRefs(
+ internalButtonRef,
+ ref,
+ isWithinPanel ? null : (button) => {
+ if (button) {
+ state.buttons.current.push(uniqueIdentifier);
+ } else {
+ let idx = state.buttons.current.indexOf(uniqueIdentifier);
+ if (idx !== -1)
+ state.buttons.current.splice(idx, 1);
+ }
+ if (state.buttons.current.length > 1) {
+ console.warn(
+ "You are already using a but only 1 is supported."
+ );
+ }
+ button && dispatch({ type: 2 /* SetButton */, button });
+ }
+ );
+ let withinPanelButtonRef = useSyncRefs(internalButtonRef, ref);
+ let ownerDocument = useOwnerDocument(internalButtonRef);
+ let handleKeyDown = useEvent((event) => {
+ var _a3, _b, _c;
+ if (isWithinPanel) {
+ if (state.popoverState === 1 /* Closed */)
+ return;
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ (_b = (_a3 = event.target).click) == null ? void 0 : _b.call(_a3);
+ dispatch({ type: 1 /* ClosePopover */ });
+ (_c = state.button) == null ? void 0 : _c.focus();
+ break;
+ }
+ } else {
+ switch (event.key) {
+ case " " /* Space */:
+ case "Enter" /* Enter */:
+ event.preventDefault();
+ event.stopPropagation();
+ if (state.popoverState === 1 /* Closed */)
+ closeOthers == null ? void 0 : closeOthers(state.buttonId);
+ dispatch({ type: 0 /* TogglePopover */ });
+ break;
+ case "Escape" /* Escape */:
+ if (state.popoverState !== 0 /* Open */)
+ return closeOthers == null ? void 0 : closeOthers(state.buttonId);
+ if (!internalButtonRef.current)
+ return;
+ if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) && !internalButtonRef.current.contains(ownerDocument.activeElement)) {
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 1 /* ClosePopover */ });
+ break;
+ }
+ }
+ });
+ let handleKeyUp = useEvent((event) => {
+ if (isWithinPanel)
+ return;
+ if (event.key === " " /* Space */) {
+ event.preventDefault();
+ }
+ });
+ let handleClick = useEvent((event) => {
+ var _a3, _b;
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return;
+ if (props.disabled)
+ return;
+ if (isWithinPanel) {
+ dispatch({ type: 1 /* ClosePopover */ });
+ (_a3 = state.button) == null ? void 0 : _a3.focus();
+ } else {
+ event.preventDefault();
+ event.stopPropagation();
+ if (state.popoverState === 1 /* Closed */)
+ closeOthers == null ? void 0 : closeOthers(state.buttonId);
+ dispatch({ type: 0 /* TogglePopover */ });
+ (_b = state.button) == null ? void 0 : _b.focus();
+ }
+ });
+ let handleMouseDown = useEvent((event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ });
+ let visible = state.popoverState === 0 /* Open */;
+ let slot = (0, import_react37.useMemo)(() => ({ open: visible }), [visible]);
+ let type = useResolveButtonType(props, internalButtonRef);
+ let ourProps = isWithinPanel ? {
+ ref: withinPanelButtonRef,
+ type,
+ onKeyDown: handleKeyDown,
+ onClick: handleClick
+ } : {
+ ref: buttonRef,
+ id: state.buttonId,
+ type,
+ "aria-expanded": props.disabled ? void 0 : state.popoverState === 0 /* Open */,
+ "aria-controls": state.panel ? state.panelId : void 0,
+ onKeyDown: handleKeyDown,
+ onKeyUp: handleKeyUp,
+ onClick: handleClick,
+ onMouseDown: handleMouseDown
+ };
+ let direction = useTabDirection();
+ let handleFocus = useEvent(() => {
+ let el = state.panel;
+ if (!el)
+ return;
+ function run() {
+ let result = match(direction.current, {
+ [0 /* Forwards */]: () => focusIn(el, 1 /* First */),
+ [1 /* Backwards */]: () => focusIn(el, 8 /* Last */)
+ });
+ if (result === 0 /* Error */) {
+ focusIn(
+ getFocusableElements().filter((el2) => el2.dataset.headlessuiFocusGuard !== "true"),
+ match(direction.current, {
+ [0 /* Forwards */]: 4 /* Next */,
+ [1 /* Backwards */]: 2 /* Previous */
+ }),
+ { relativeTo: state.button }
+ );
+ }
+ }
+ if (false) {} else {
+ run();
+ }
+ });
+ return /* @__PURE__ */ import_react37.default.createElement(import_react37.default.Fragment, null, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_BUTTON_TAG5,
+ name: "Popover.Button"
+ }), visible && !isWithinPanel && isPortalled && /* @__PURE__ */ import_react37.default.createElement(
+ Hidden,
+ {
+ id: sentinelId,
+ features: 2 /* Focusable */,
+ "data-headlessui-focus-guard": true,
+ as: "button",
+ type: "button",
+ onFocus: handleFocus
+ }
+ ));
+}
+var DEFAULT_OVERLAY_TAG2 = "div";
+var OverlayRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */;
+function OverlayFn2(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-popover-overlay-${internalId}`, ...theirProps } = props;
+ let [{ popoverState }, dispatch] = usePopoverContext("Popover.Overlay");
+ let overlayRef = useSyncRefs(ref);
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return popoverState === 0 /* Open */;
+ })();
+ let handleClick = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ dispatch({ type: 1 /* ClosePopover */ });
+ });
+ let slot = (0, import_react37.useMemo)(
+ () => ({ open: popoverState === 0 /* Open */ }),
+ [popoverState]
+ );
+ let ourProps = {
+ ref: overlayRef,
+ id,
+ "aria-hidden": true,
+ onClick: handleClick
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OVERLAY_TAG2,
+ features: OverlayRenderFeatures,
+ visible,
+ name: "Popover.Overlay"
+ });
+}
+var DEFAULT_PANEL_TAG3 = "div";
+var PanelRenderFeatures2 = 1 /* RenderStrategy */ | 2 /* Static */;
+function PanelFn3(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-popover-panel-${internalId}`, focus = false, ...theirProps } = props;
+ let [state, dispatch] = usePopoverContext("Popover.Panel");
+ let { close, isPortalled } = usePopoverAPIContext("Popover.Panel");
+ let beforePanelSentinelId = `headlessui-focus-sentinel-before-${useId()}`;
+ let afterPanelSentinelId = `headlessui-focus-sentinel-after-${useId()}`;
+ let internalPanelRef = (0, import_react37.useRef)(null);
+ let panelRef = useSyncRefs(internalPanelRef, ref, (panel) => {
+ dispatch({ type: 4 /* SetPanel */, panel });
+ });
+ let ownerDocument = useOwnerDocument(internalPanelRef);
+ useIsoMorphicEffect(() => {
+ dispatch({ type: 5 /* SetPanelId */, panelId: id });
+ return () => {
+ dispatch({ type: 5 /* SetPanelId */, panelId: null });
+ };
+ }, [id, dispatch]);
+ let usesOpenClosedState = useOpenClosed();
+ let visible = (() => {
+ if (usesOpenClosedState !== null) {
+ return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ return state.popoverState === 0 /* Open */;
+ })();
+ let handleKeyDown = useEvent((event) => {
+ var _a3;
+ switch (event.key) {
+ case "Escape" /* Escape */:
+ if (state.popoverState !== 0 /* Open */)
+ return;
+ if (!internalPanelRef.current)
+ return;
+ if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) && !internalPanelRef.current.contains(ownerDocument.activeElement)) {
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ dispatch({ type: 1 /* ClosePopover */ });
+ (_a3 = state.button) == null ? void 0 : _a3.focus();
+ break;
+ }
+ });
+ (0, import_react37.useEffect)(() => {
+ var _a3;
+ if (props.static)
+ return;
+ if (state.popoverState === 1 /* Closed */ && ((_a3 = props.unmount) != null ? _a3 : true)) {
+ dispatch({ type: 4 /* SetPanel */, panel: null });
+ }
+ }, [state.popoverState, props.unmount, props.static, dispatch]);
+ (0, import_react37.useEffect)(() => {
+ if (state.__demoMode)
+ return;
+ if (!focus)
+ return;
+ if (state.popoverState !== 0 /* Open */)
+ return;
+ if (!internalPanelRef.current)
+ return;
+ let activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement;
+ if (internalPanelRef.current.contains(activeElement))
+ return;
+ focusIn(internalPanelRef.current, 1 /* First */);
+ }, [state.__demoMode, focus, internalPanelRef, state.popoverState]);
+ let slot = (0, import_react37.useMemo)(
+ () => ({ open: state.popoverState === 0 /* Open */, close }),
+ [state, close]
+ );
+ let ourProps = {
+ ref: panelRef,
+ id,
+ onKeyDown: handleKeyDown,
+ onBlur: focus && state.popoverState === 0 /* Open */ ? (event) => {
+ var _a3, _b, _c, _d, _e;
+ let el = event.relatedTarget;
+ if (!el)
+ return;
+ if (!internalPanelRef.current)
+ return;
+ if ((_a3 = internalPanelRef.current) == null ? void 0 : _a3.contains(el))
+ return;
+ dispatch({ type: 1 /* ClosePopover */ });
+ if (((_c = (_b = state.beforePanelSentinel.current) == null ? void 0 : _b.contains) == null ? void 0 : _c.call(_b, el)) || ((_e = (_d = state.afterPanelSentinel.current) == null ? void 0 : _d.contains) == null ? void 0 : _e.call(_d, el))) {
+ el.focus({ preventScroll: true });
+ }
+ } : void 0,
+ tabIndex: -1
+ };
+ let direction = useTabDirection();
+ let handleBeforeFocus = useEvent(() => {
+ let el = internalPanelRef.current;
+ if (!el)
+ return;
+ function run() {
+ match(direction.current, {
+ [0 /* Forwards */]: () => {
+ var _a3;
+ let result = focusIn(el, 1 /* First */);
+ if (result === 0 /* Error */) {
+ (_a3 = state.afterPanelSentinel.current) == null ? void 0 : _a3.focus();
+ }
+ },
+ [1 /* Backwards */]: () => {
+ var _a3;
+ (_a3 = state.button) == null ? void 0 : _a3.focus({ preventScroll: true });
+ }
+ });
+ }
+ if (false) {} else {
+ run();
+ }
+ });
+ let handleAfterFocus = useEvent(() => {
+ let el = internalPanelRef.current;
+ if (!el)
+ return;
+ function run() {
+ match(direction.current, {
+ [0 /* Forwards */]: () => {
+ var _a3;
+ if (!state.button)
+ return;
+ let elements = getFocusableElements();
+ let idx = elements.indexOf(state.button);
+ let before = elements.slice(0, idx + 1);
+ let after = elements.slice(idx + 1);
+ let combined = [...after, ...before];
+ for (let element of combined.slice()) {
+ if (element.dataset.headlessuiFocusGuard === "true" || ((_a3 = state.panel) == null ? void 0 : _a3.contains(element))) {
+ let idx2 = combined.indexOf(element);
+ if (idx2 !== -1)
+ combined.splice(idx2, 1);
+ }
+ }
+ focusIn(combined, 1 /* First */, { sorted: false });
+ },
+ [1 /* Backwards */]: () => {
+ var _a3;
+ let result = focusIn(el, 2 /* Previous */);
+ if (result === 0 /* Error */) {
+ (_a3 = state.button) == null ? void 0 : _a3.focus();
+ }
+ }
+ });
+ }
+ if (false) {} else {
+ run();
+ }
+ });
+ return /* @__PURE__ */ import_react37.default.createElement(PopoverPanelContext.Provider, { value: id }, visible && isPortalled && /* @__PURE__ */ import_react37.default.createElement(
+ Hidden,
+ {
+ id: beforePanelSentinelId,
+ ref: state.beforePanelSentinel,
+ features: 2 /* Focusable */,
+ "data-headlessui-focus-guard": true,
+ as: "button",
+ type: "button",
+ onFocus: handleBeforeFocus
+ }
+ ), render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_PANEL_TAG3,
+ features: PanelRenderFeatures2,
+ visible,
+ name: "Popover.Panel"
+ }), visible && isPortalled && /* @__PURE__ */ import_react37.default.createElement(
+ Hidden,
+ {
+ id: afterPanelSentinelId,
+ ref: state.afterPanelSentinel,
+ features: 2 /* Focusable */,
+ "data-headlessui-focus-guard": true,
+ as: "button",
+ type: "button",
+ onFocus: handleAfterFocus
+ }
+ ));
+}
+var DEFAULT_GROUP_TAG2 = "div";
+function GroupFn2(props, ref) {
+ let internalGroupRef = (0, import_react37.useRef)(null);
+ let groupRef = useSyncRefs(internalGroupRef, ref);
+ let [popovers, setPopovers] = (0, import_react37.useState)([]);
+ let unregisterPopover = useEvent((registerbag) => {
+ setPopovers((existing) => {
+ let idx = existing.indexOf(registerbag);
+ if (idx !== -1) {
+ let clone = existing.slice();
+ clone.splice(idx, 1);
+ return clone;
+ }
+ return existing;
+ });
+ });
+ let registerPopover = useEvent((registerbag) => {
+ setPopovers((existing) => [...existing, registerbag]);
+ return () => unregisterPopover(registerbag);
+ });
+ let isFocusWithinPopoverGroup = useEvent(() => {
+ var _a3;
+ let ownerDocument = getOwnerDocument(internalGroupRef);
+ if (!ownerDocument)
+ return false;
+ let element = ownerDocument.activeElement;
+ if ((_a3 = internalGroupRef.current) == null ? void 0 : _a3.contains(element))
+ return true;
+ return popovers.some((bag) => {
+ var _a4, _b;
+ return ((_a4 = ownerDocument.getElementById(bag.buttonId.current)) == null ? void 0 : _a4.contains(element)) || ((_b = ownerDocument.getElementById(bag.panelId.current)) == null ? void 0 : _b.contains(element));
+ });
+ });
+ let closeOthers = useEvent((buttonId) => {
+ for (let popover of popovers) {
+ if (popover.buttonId.current !== buttonId)
+ popover.close();
+ }
+ });
+ let contextBag = (0, import_react37.useMemo)(
+ () => ({
+ registerPopover,
+ unregisterPopover,
+ isFocusWithinPopoverGroup,
+ closeOthers
+ }),
+ [registerPopover, unregisterPopover, isFocusWithinPopoverGroup, closeOthers]
+ );
+ let slot = (0, import_react37.useMemo)(() => ({}), []);
+ let theirProps = props;
+ let ourProps = { ref: groupRef };
+ return /* @__PURE__ */ import_react37.default.createElement(PopoverGroupContext.Provider, { value: contextBag }, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_GROUP_TAG2,
+ name: "Popover.Group"
+ }));
+}
+var PopoverRoot = forwardRefWithAs(PopoverFn);
+var Button5 = forwardRefWithAs(ButtonFn5);
+var Overlay2 = forwardRefWithAs(OverlayFn2);
+var Panel3 = forwardRefWithAs(PanelFn3);
+var Group2 = forwardRefWithAs(GroupFn2);
+var Popover = Object.assign(PopoverRoot, { Button: Button5, Overlay: Overlay2, Panel: Panel3, Group: Group2 });
+
+// src/components/radio-group/radio-group.tsx
+var import_react40 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/hooks/use-flags.ts
+var import_react38 = __webpack_require__(/*! react */ "react");
+function useFlags(initialFlags = 0) {
+ let [flags, setFlags] = (0, import_react38.useState)(initialFlags);
+ let mounted = useIsMounted();
+ let addFlag = (0, import_react38.useCallback)(
+ (flag) => {
+ if (!mounted.current)
+ return;
+ setFlags((flags2) => flags2 | flag);
+ },
+ [flags, mounted]
+ );
+ let hasFlag = (0, import_react38.useCallback)((flag) => Boolean(flags & flag), [flags]);
+ let removeFlag = (0, import_react38.useCallback)(
+ (flag) => {
+ if (!mounted.current)
+ return;
+ setFlags((flags2) => flags2 & ~flag);
+ },
+ [setFlags, mounted]
+ );
+ let toggleFlag = (0, import_react38.useCallback)(
+ (flag) => {
+ if (!mounted.current)
+ return;
+ setFlags((flags2) => flags2 ^ flag);
+ },
+ [setFlags]
+ );
+ return { flags, addFlag, hasFlag, removeFlag, toggleFlag };
+}
+
+// src/components/label/label.tsx
+var import_react39 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var LabelContext = (0, import_react39.createContext)(
+ null
+);
+function useLabelContext() {
+ let context = (0, import_react39.useContext)(LabelContext);
+ if (context === null) {
+ let err = new Error("You used a component, but it is not inside a relevant parent.");
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useLabelContext);
+ throw err;
+ }
+ return context;
+}
+function useLabels() {
+ let [labelIds, setLabelIds] = (0, import_react39.useState)([]);
+ return [
+ // The actual id's as string or undefined.
+ labelIds.length > 0 ? labelIds.join(" ") : void 0,
+ // The provider component
+ (0, import_react39.useMemo)(() => {
+ return function LabelProvider(props) {
+ let register = useEvent((value) => {
+ setLabelIds((existing) => [...existing, value]);
+ return () => setLabelIds((existing) => {
+ let clone = existing.slice();
+ let idx = clone.indexOf(value);
+ if (idx !== -1)
+ clone.splice(idx, 1);
+ return clone;
+ });
+ });
+ let contextBag = (0, import_react39.useMemo)(
+ () => ({ register, slot: props.slot, name: props.name, props: props.props }),
+ [register, props.slot, props.name, props.props]
+ );
+ return /* @__PURE__ */ import_react39.default.createElement(LabelContext.Provider, { value: contextBag }, props.children);
+ };
+ }, [setLabelIds])
+ ];
+}
+var DEFAULT_LABEL_TAG3 = "label";
+function LabelFn3(props, ref) {
+ let internalId = useId();
+ let { id = `headlessui-label-${internalId}`, passive = false, ...theirProps } = props;
+ let context = useLabelContext();
+ let labelRef = useSyncRefs(ref);
+ useIsoMorphicEffect(() => context.register(id), [id, context.register]);
+ let ourProps = { ref: labelRef, ...context.props, id };
+ if (passive) {
+ if ("onClick" in ourProps) {
+ delete ourProps["htmlFor"];
+ delete ourProps["onClick"];
+ }
+ if ("onClick" in theirProps) {
+ delete theirProps["onClick"];
+ }
+ }
+ return render({
+ ourProps,
+ theirProps,
+ slot: context.slot || {},
+ defaultTag: DEFAULT_LABEL_TAG3,
+ name: context.name || "Label"
+ });
+}
+var LabelRoot = forwardRefWithAs(LabelFn3);
+var Label3 = Object.assign(LabelRoot, {
+ //
+});
+
+// src/components/radio-group/radio-group.tsx
+var reducers7 = {
+ [0 /* RegisterOption */](state, action) {
+ let nextOptions = [
+ ...state.options,
+ { id: action.id, element: action.element, propsRef: action.propsRef }
+ ];
+ return {
+ ...state,
+ options: sortByDomNode(nextOptions, (option) => option.element.current)
+ };
+ },
+ [1 /* UnregisterOption */](state, action) {
+ let options = state.options.slice();
+ let idx = state.options.findIndex((radio) => radio.id === action.id);
+ if (idx === -1)
+ return state;
+ options.splice(idx, 1);
+ return { ...state, options };
+ }
+};
+var RadioGroupDataContext = (0, import_react40.createContext)(null);
+RadioGroupDataContext.displayName = "RadioGroupDataContext";
+function useData3(component) {
+ let context = (0, import_react40.useContext)(RadioGroupDataContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useData3);
+ throw err;
+ }
+ return context;
+}
+var RadioGroupActionsContext = (0, import_react40.createContext)(null);
+RadioGroupActionsContext.displayName = "RadioGroupActionsContext";
+function useActions3(component) {
+ let context = (0, import_react40.useContext)(RadioGroupActionsContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useActions3);
+ throw err;
+ }
+ return context;
+}
+function stateReducer7(state, action) {
+ return match(action.type, reducers7, state, action);
+}
+var DEFAULT_RADIO_GROUP_TAG = "div";
+function RadioGroupFn(props, ref) {
+ let internalId = useId();
+ let {
+ id = `headlessui-radiogroup-${internalId}`,
+ value: controlledValue,
+ defaultValue,
+ form: formName,
+ name,
+ onChange: controlledOnChange,
+ by = (a, z) => a === z,
+ disabled = false,
+ ...theirProps
+ } = props;
+ let compare = useEvent(
+ typeof by === "string" ? (a, z) => {
+ let property = by;
+ return (a == null ? void 0 : a[property]) === (z == null ? void 0 : z[property]);
+ } : by
+ );
+ let [state, dispatch] = (0, import_react40.useReducer)(stateReducer7, { options: [] });
+ let options = state.options;
+ let [labelledby, LabelProvider] = useLabels();
+ let [describedby, DescriptionProvider] = useDescriptions();
+ let internalRadioGroupRef = (0, import_react40.useRef)(null);
+ let radioGroupRef = useSyncRefs(internalRadioGroupRef, ref);
+ let [value, onChange] = useControllable(controlledValue, controlledOnChange, defaultValue);
+ let firstOption = (0, import_react40.useMemo)(
+ () => options.find((option) => {
+ if (option.propsRef.current.disabled)
+ return false;
+ return true;
+ }),
+ [options]
+ );
+ let containsCheckedOption = (0, import_react40.useMemo)(
+ () => options.some((option) => compare(option.propsRef.current.value, value)),
+ [options, value]
+ );
+ let triggerChange = useEvent((nextValue) => {
+ var _a3;
+ if (disabled)
+ return false;
+ if (compare(nextValue, value))
+ return false;
+ let nextOption = (_a3 = options.find(
+ (option) => compare(option.propsRef.current.value, nextValue)
+ )) == null ? void 0 : _a3.propsRef.current;
+ if (nextOption == null ? void 0 : nextOption.disabled)
+ return false;
+ onChange == null ? void 0 : onChange(nextValue);
+ return true;
+ });
+ useTreeWalker({
+ container: internalRadioGroupRef.current,
+ accept(node) {
+ if (node.getAttribute("role") === "radio")
+ return NodeFilter.FILTER_REJECT;
+ if (node.hasAttribute("role"))
+ return NodeFilter.FILTER_SKIP;
+ return NodeFilter.FILTER_ACCEPT;
+ },
+ walk(node) {
+ node.setAttribute("role", "none");
+ }
+ });
+ let handleKeyDown = useEvent((event) => {
+ let container = internalRadioGroupRef.current;
+ if (!container)
+ return;
+ let ownerDocument = getOwnerDocument(container);
+ let all = options.filter((option) => option.propsRef.current.disabled === false).map((radio) => radio.element.current);
+ switch (event.key) {
+ case "Enter" /* Enter */:
+ attemptSubmit(event.currentTarget);
+ break;
+ case "ArrowLeft" /* ArrowLeft */:
+ case "ArrowUp" /* ArrowUp */:
+ {
+ event.preventDefault();
+ event.stopPropagation();
+ let result = focusIn(all, 2 /* Previous */ | 16 /* WrapAround */);
+ if (result === 2 /* Success */) {
+ let activeOption = options.find(
+ (option) => option.element.current === (ownerDocument == null ? void 0 : ownerDocument.activeElement)
+ );
+ if (activeOption)
+ triggerChange(activeOption.propsRef.current.value);
+ }
+ }
+ break;
+ case "ArrowRight" /* ArrowRight */:
+ case "ArrowDown" /* ArrowDown */:
+ {
+ event.preventDefault();
+ event.stopPropagation();
+ let result = focusIn(all, 4 /* Next */ | 16 /* WrapAround */);
+ if (result === 2 /* Success */) {
+ let activeOption = options.find(
+ (option) => option.element.current === (ownerDocument == null ? void 0 : ownerDocument.activeElement)
+ );
+ if (activeOption)
+ triggerChange(activeOption.propsRef.current.value);
+ }
+ }
+ break;
+ case " " /* Space */:
+ {
+ event.preventDefault();
+ event.stopPropagation();
+ let activeOption = options.find(
+ (option) => option.element.current === (ownerDocument == null ? void 0 : ownerDocument.activeElement)
+ );
+ if (activeOption)
+ triggerChange(activeOption.propsRef.current.value);
+ }
+ break;
+ }
+ });
+ let registerOption = useEvent((option) => {
+ dispatch({ type: 0 /* RegisterOption */, ...option });
+ return () => dispatch({ type: 1 /* UnregisterOption */, id: option.id });
+ });
+ let radioGroupData = (0, import_react40.useMemo)(
+ () => ({ value, firstOption, containsCheckedOption, disabled, compare, ...state }),
+ [value, firstOption, containsCheckedOption, disabled, compare, state]
+ );
+ let radioGroupActions = (0, import_react40.useMemo)(
+ () => ({ registerOption, change: triggerChange }),
+ [registerOption, triggerChange]
+ );
+ let ourProps = {
+ ref: radioGroupRef,
+ id,
+ role: "radiogroup",
+ "aria-labelledby": labelledby,
+ "aria-describedby": describedby,
+ onKeyDown: handleKeyDown
+ };
+ let slot = (0, import_react40.useMemo)(() => ({ value }), [value]);
+ let form = (0, import_react40.useRef)(null);
+ let d = useDisposables();
+ (0, import_react40.useEffect)(() => {
+ if (!form.current)
+ return;
+ if (defaultValue === void 0)
+ return;
+ d.addEventListener(form.current, "reset", () => {
+ triggerChange(defaultValue);
+ });
+ }, [
+ form,
+ triggerChange
+ /* Explicitly ignoring `defaultValue` */
+ ]);
+ return /* @__PURE__ */ import_react40.default.createElement(DescriptionProvider, { name: "RadioGroup.Description" }, /* @__PURE__ */ import_react40.default.createElement(LabelProvider, { name: "RadioGroup.Label" }, /* @__PURE__ */ import_react40.default.createElement(RadioGroupActionsContext.Provider, { value: radioGroupActions }, /* @__PURE__ */ import_react40.default.createElement(RadioGroupDataContext.Provider, { value: radioGroupData }, name != null && value != null && objectToFormEntries({ [name]: value }).map(([name2, value2], idx) => /* @__PURE__ */ import_react40.default.createElement(
+ Hidden,
+ {
+ features: 4 /* Hidden */,
+ ref: idx === 0 ? (element) => {
+ var _a3;
+ form.current = (_a3 = element == null ? void 0 : element.closest("form")) != null ? _a3 : null;
+ } : void 0,
+ ...compact({
+ key: name2,
+ as: "input",
+ type: "radio",
+ checked: value2 != null,
+ hidden: true,
+ readOnly: true,
+ form: formName,
+ name: name2,
+ value: value2
+ })
+ }
+ )), render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_RADIO_GROUP_TAG,
+ name: "RadioGroup"
+ })))));
+}
+var DEFAULT_OPTION_TAG3 = "div";
+function OptionFn3(props, ref) {
+ var _a3;
+ let internalId = useId();
+ let {
+ id = `headlessui-radiogroup-option-${internalId}`,
+ value,
+ disabled = false,
+ ...theirProps
+ } = props;
+ let internalOptionRef = (0, import_react40.useRef)(null);
+ let optionRef = useSyncRefs(internalOptionRef, ref);
+ let [labelledby, LabelProvider] = useLabels();
+ let [describedby, DescriptionProvider] = useDescriptions();
+ let { addFlag, removeFlag, hasFlag } = useFlags(1 /* Empty */);
+ let propsRef = useLatestValue({ value, disabled });
+ let data = useData3("RadioGroup.Option");
+ let actions = useActions3("RadioGroup.Option");
+ useIsoMorphicEffect(
+ () => actions.registerOption({ id, element: internalOptionRef, propsRef }),
+ [id, actions, internalOptionRef, props]
+ );
+ let handleClick = useEvent((event) => {
+ var _a4;
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ if (!actions.change(value))
+ return;
+ addFlag(2 /* Active */);
+ (_a4 = internalOptionRef.current) == null ? void 0 : _a4.focus();
+ });
+ let handleFocus = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ addFlag(2 /* Active */);
+ });
+ let handleBlur = useEvent(() => removeFlag(2 /* Active */));
+ let isFirstOption = ((_a3 = data.firstOption) == null ? void 0 : _a3.id) === id;
+ let isDisabled = data.disabled || disabled;
+ let checked = data.compare(data.value, value);
+ let ourProps = {
+ ref: optionRef,
+ id,
+ role: "radio",
+ "aria-checked": checked ? "true" : "false",
+ "aria-labelledby": labelledby,
+ "aria-describedby": describedby,
+ "aria-disabled": isDisabled ? true : void 0,
+ tabIndex: (() => {
+ if (isDisabled)
+ return -1;
+ if (checked)
+ return 0;
+ if (!data.containsCheckedOption && isFirstOption)
+ return 0;
+ return -1;
+ })(),
+ onClick: isDisabled ? void 0 : handleClick,
+ onFocus: isDisabled ? void 0 : handleFocus,
+ onBlur: isDisabled ? void 0 : handleBlur
+ };
+ let slot = (0, import_react40.useMemo)(
+ () => ({ checked, disabled: isDisabled, active: hasFlag(2 /* Active */) }),
+ [checked, isDisabled, hasFlag]
+ );
+ return /* @__PURE__ */ import_react40.default.createElement(DescriptionProvider, { name: "RadioGroup.Description" }, /* @__PURE__ */ import_react40.default.createElement(LabelProvider, { name: "RadioGroup.Label" }, render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_OPTION_TAG3,
+ name: "RadioGroup.Option"
+ })));
+}
+var RadioGroupRoot = forwardRefWithAs(RadioGroupFn);
+var Option3 = forwardRefWithAs(OptionFn3);
+var RadioGroup = Object.assign(RadioGroupRoot, {
+ Option: Option3,
+ Label: Label3,
+ Description
+});
+
+// src/components/switch/switch.tsx
+var import_react41 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var GroupContext = (0, import_react41.createContext)(null);
+GroupContext.displayName = "GroupContext";
+var DEFAULT_GROUP_TAG3 = import_react41.Fragment;
+function GroupFn3(props) {
+ var _a3;
+ let [switchElement, setSwitchElement] = (0, import_react41.useState)(null);
+ let [labelledby, LabelProvider] = useLabels();
+ let [describedby, DescriptionProvider] = useDescriptions();
+ let context = (0, import_react41.useMemo)(
+ () => ({ switch: switchElement, setSwitch: setSwitchElement, labelledby, describedby }),
+ [switchElement, setSwitchElement, labelledby, describedby]
+ );
+ let ourProps = {};
+ let theirProps = props;
+ return /* @__PURE__ */ import_react41.default.createElement(DescriptionProvider, { name: "Switch.Description" }, /* @__PURE__ */ import_react41.default.createElement(
+ LabelProvider,
+ {
+ name: "Switch.Label",
+ props: {
+ htmlFor: (_a3 = context.switch) == null ? void 0 : _a3.id,
+ onClick(event) {
+ if (!switchElement)
+ return;
+ if (event.currentTarget.tagName === "LABEL") {
+ event.preventDefault();
+ }
+ switchElement.click();
+ switchElement.focus({ preventScroll: true });
+ }
+ }
+ },
+ /* @__PURE__ */ import_react41.default.createElement(GroupContext.Provider, { value: context }, render({
+ ourProps,
+ theirProps,
+ defaultTag: DEFAULT_GROUP_TAG3,
+ name: "Switch.Group"
+ }))
+ ));
+}
+var DEFAULT_SWITCH_TAG = "button";
+function SwitchFn(props, ref) {
+ let internalId = useId();
+ let {
+ id = `headlessui-switch-${internalId}`,
+ checked: controlledChecked,
+ defaultChecked = false,
+ onChange: controlledOnChange,
+ name,
+ value,
+ form,
+ ...theirProps
+ } = props;
+ let groupContext = (0, import_react41.useContext)(GroupContext);
+ let internalSwitchRef = (0, import_react41.useRef)(null);
+ let switchRef = useSyncRefs(
+ internalSwitchRef,
+ ref,
+ groupContext === null ? null : groupContext.setSwitch
+ );
+ let [checked, onChange] = useControllable(controlledChecked, controlledOnChange, defaultChecked);
+ let toggle = useEvent(() => onChange == null ? void 0 : onChange(!checked));
+ let handleClick = useEvent((event) => {
+ if (isDisabledReactIssue7711(event.currentTarget))
+ return event.preventDefault();
+ event.preventDefault();
+ toggle();
+ });
+ let handleKeyUp = useEvent((event) => {
+ if (event.key === " " /* Space */) {
+ event.preventDefault();
+ toggle();
+ } else if (event.key === "Enter" /* Enter */) {
+ attemptSubmit(event.currentTarget);
+ }
+ });
+ let handleKeyPress = useEvent((event) => event.preventDefault());
+ let slot = (0, import_react41.useMemo)(() => ({ checked }), [checked]);
+ let ourProps = {
+ id,
+ ref: switchRef,
+ role: "switch",
+ type: useResolveButtonType(props, internalSwitchRef),
+ tabIndex: 0,
+ "aria-checked": checked,
+ "aria-labelledby": groupContext == null ? void 0 : groupContext.labelledby,
+ "aria-describedby": groupContext == null ? void 0 : groupContext.describedby,
+ onClick: handleClick,
+ onKeyUp: handleKeyUp,
+ onKeyPress: handleKeyPress
+ };
+ let d = useDisposables();
+ (0, import_react41.useEffect)(() => {
+ var _a3;
+ let form2 = (_a3 = internalSwitchRef.current) == null ? void 0 : _a3.closest("form");
+ if (!form2)
+ return;
+ if (defaultChecked === void 0)
+ return;
+ d.addEventListener(form2, "reset", () => {
+ onChange(defaultChecked);
+ });
+ }, [
+ internalSwitchRef,
+ onChange
+ /* Explicitly ignoring `defaultValue` */
+ ]);
+ return /* @__PURE__ */ import_react41.default.createElement(import_react41.default.Fragment, null, name != null && checked && /* @__PURE__ */ import_react41.default.createElement(
+ Hidden,
+ {
+ features: 4 /* Hidden */,
+ ...compact({
+ as: "input",
+ type: "checkbox",
+ hidden: true,
+ readOnly: true,
+ form,
+ checked,
+ name,
+ value
+ })
+ }
+ ), render({ ourProps, theirProps, slot, defaultTag: DEFAULT_SWITCH_TAG, name: "Switch" }));
+}
+var SwitchRoot = forwardRefWithAs(SwitchFn);
+var Group3 = GroupFn3;
+var Switch = Object.assign(SwitchRoot, {
+ Group: Group3,
+ Label: Label3,
+ Description
+});
+
+// src/components/tabs/tabs.tsx
+var import_react43 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/internal/focus-sentinel.tsx
+var import_react42 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+function FocusSentinel({ onFocus }) {
+ let [enabled, setEnabled] = (0, import_react42.useState)(true);
+ if (!enabled)
+ return null;
+ return /* @__PURE__ */ import_react42.default.createElement(
+ Hidden,
+ {
+ as: "button",
+ type: "button",
+ features: 2 /* Focusable */,
+ onFocus: (event) => {
+ event.preventDefault();
+ let frame;
+ let tries = 50;
+ function forwardFocus() {
+ if (tries-- <= 0) {
+ if (frame)
+ cancelAnimationFrame(frame);
+ return;
+ }
+ if (onFocus()) {
+ setEnabled(false);
+ cancelAnimationFrame(frame);
+ return;
+ }
+ frame = requestAnimationFrame(forwardFocus);
+ }
+ frame = requestAnimationFrame(forwardFocus);
+ }
+ }
+ );
+}
+
+// src/utils/stable-collection.tsx
+var React23 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+var StableCollectionContext = React23.createContext(null);
+function createCollection() {
+ return {
+ /** @type {Map>} */
+ groups: /* @__PURE__ */ new Map(),
+ get(group, key) {
+ var _a3;
+ let list = this.groups.get(group);
+ if (!list) {
+ list = /* @__PURE__ */ new Map();
+ this.groups.set(group, list);
+ }
+ let renders = (_a3 = list.get(key)) != null ? _a3 : 0;
+ list.set(key, renders + 1);
+ let index = Array.from(list.keys()).indexOf(key);
+ function release() {
+ let renders2 = list.get(key);
+ if (renders2 > 1) {
+ list.set(key, renders2 - 1);
+ } else {
+ list.delete(key);
+ }
+ }
+ return [index, release];
+ }
+ };
+}
+function StableCollection({ children }) {
+ let collection = React23.useRef(createCollection());
+ return /* @__PURE__ */ React23.createElement(StableCollectionContext.Provider, { value: collection }, children);
+}
+function useStableCollectionIndex(group) {
+ let collection = React23.useContext(StableCollectionContext);
+ if (!collection)
+ throw new Error("You must wrap your component in a ");
+ let key = useStableCollectionKey();
+ let [idx, cleanupIdx] = collection.current.get(group, key);
+ React23.useEffect(() => cleanupIdx, []);
+ return idx;
+}
+function useStableCollectionKey() {
+ var _a3, _b, _c;
+ let owner = (
+ // @ts-ignore
+ (_c = (_b = (_a3 = React23.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) == null ? void 0 : _a3.ReactCurrentOwner) == null ? void 0 : _b.current) != null ? _c : null
+ );
+ if (!owner)
+ return Symbol();
+ let indexes = [];
+ let fiber = owner;
+ while (fiber) {
+ indexes.push(fiber.index);
+ fiber = fiber.return;
+ }
+ return "$." + indexes.join(".");
+}
+
+// src/components/tabs/tabs.tsx
+var reducers8 = {
+ [0 /* SetSelectedIndex */](state, action) {
+ var _a3;
+ let tabs = sortByDomNode(state.tabs, (tab) => tab.current);
+ let panels = sortByDomNode(state.panels, (panel) => panel.current);
+ let focusableTabs = tabs.filter((tab) => {
+ var _a4;
+ return !((_a4 = tab.current) == null ? void 0 : _a4.hasAttribute("disabled"));
+ });
+ let nextState = { ...state, tabs, panels };
+ if (
+ // Underflow
+ action.index < 0 || // Overflow
+ action.index > tabs.length - 1
+ ) {
+ let direction = match(Math.sign(action.index - state.selectedIndex), {
+ [-1 /* Less */]: () => 1 /* Backwards */,
+ [0 /* Equal */]: () => {
+ return match(Math.sign(action.index), {
+ [-1 /* Less */]: () => 0 /* Forwards */,
+ [0 /* Equal */]: () => 0 /* Forwards */,
+ [1 /* Greater */]: () => 1 /* Backwards */
+ });
+ },
+ [1 /* Greater */]: () => 0 /* Forwards */
+ });
+ if (focusableTabs.length === 0) {
+ return nextState;
+ }
+ return {
+ ...nextState,
+ selectedIndex: match(direction, {
+ [0 /* Forwards */]: () => tabs.indexOf(focusableTabs[0]),
+ [1 /* Backwards */]: () => tabs.indexOf(focusableTabs[focusableTabs.length - 1])
+ })
+ };
+ }
+ let before = tabs.slice(0, action.index);
+ let after = tabs.slice(action.index);
+ let next = [...after, ...before].find((tab) => focusableTabs.includes(tab));
+ if (!next)
+ return nextState;
+ let selectedIndex = (_a3 = tabs.indexOf(next)) != null ? _a3 : state.selectedIndex;
+ if (selectedIndex === -1)
+ selectedIndex = state.selectedIndex;
+ return { ...nextState, selectedIndex };
+ },
+ [1 /* RegisterTab */](state, action) {
+ var _a3;
+ if (state.tabs.includes(action.tab))
+ return state;
+ let activeTab = state.tabs[state.selectedIndex];
+ let adjustedTabs = sortByDomNode([...state.tabs, action.tab], (tab) => tab.current);
+ let selectedIndex = (_a3 = adjustedTabs.indexOf(activeTab)) != null ? _a3 : state.selectedIndex;
+ if (selectedIndex === -1)
+ selectedIndex = state.selectedIndex;
+ return { ...state, tabs: adjustedTabs, selectedIndex };
+ },
+ [2 /* UnregisterTab */](state, action) {
+ return { ...state, tabs: state.tabs.filter((tab) => tab !== action.tab) };
+ },
+ [3 /* RegisterPanel */](state, action) {
+ if (state.panels.includes(action.panel))
+ return state;
+ return {
+ ...state,
+ panels: sortByDomNode([...state.panels, action.panel], (panel) => panel.current)
+ };
+ },
+ [4 /* UnregisterPanel */](state, action) {
+ return { ...state, panels: state.panels.filter((panel) => panel !== action.panel) };
+ }
+};
+var TabsDataContext = (0, import_react43.createContext)(null);
+TabsDataContext.displayName = "TabsDataContext";
+function useData4(component) {
+ let context = (0, import_react43.useContext)(TabsDataContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useData4);
+ throw err;
+ }
+ return context;
+}
+var TabsActionsContext = (0, import_react43.createContext)(null);
+TabsActionsContext.displayName = "TabsActionsContext";
+function useActions4(component) {
+ let context = (0, import_react43.useContext)(TabsActionsContext);
+ if (context === null) {
+ let err = new Error(`<${component} /> is missing a parent component.`);
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(err, useActions4);
+ throw err;
+ }
+ return context;
+}
+function stateReducer8(state, action) {
+ return match(action.type, reducers8, state, action);
+}
+var DEFAULT_TABS_TAG = import_react43.Fragment;
+function GroupFn4(props, ref) {
+ let {
+ defaultIndex = 0,
+ vertical = false,
+ manual = false,
+ onChange,
+ selectedIndex = null,
+ ...theirProps
+ } = props;
+ const orientation = vertical ? "vertical" : "horizontal";
+ const activation = manual ? "manual" : "auto";
+ let isControlled = selectedIndex !== null;
+ let tabsRef = useSyncRefs(ref);
+ let [state, dispatch] = (0, import_react43.useReducer)(stateReducer8, {
+ selectedIndex: selectedIndex != null ? selectedIndex : defaultIndex,
+ tabs: [],
+ panels: []
+ });
+ let slot = (0, import_react43.useMemo)(() => ({ selectedIndex: state.selectedIndex }), [state.selectedIndex]);
+ let onChangeRef = useLatestValue(onChange || (() => {
+ }));
+ let stableTabsRef = useLatestValue(state.tabs);
+ let tabsData = (0, import_react43.useMemo)(
+ () => ({ orientation, activation, ...state }),
+ [orientation, activation, state]
+ );
+ let registerTab = useEvent((tab) => {
+ dispatch({ type: 1 /* RegisterTab */, tab });
+ return () => dispatch({ type: 2 /* UnregisterTab */, tab });
+ });
+ let registerPanel = useEvent((panel) => {
+ dispatch({ type: 3 /* RegisterPanel */, panel });
+ return () => dispatch({ type: 4 /* UnregisterPanel */, panel });
+ });
+ let change = useEvent((index) => {
+ if (realSelectedIndex.current !== index) {
+ onChangeRef.current(index);
+ }
+ if (!isControlled) {
+ dispatch({ type: 0 /* SetSelectedIndex */, index });
+ }
+ });
+ let realSelectedIndex = useLatestValue(isControlled ? props.selectedIndex : state.selectedIndex);
+ let tabsActions = (0, import_react43.useMemo)(() => ({ registerTab, registerPanel, change }), []);
+ useIsoMorphicEffect(() => {
+ dispatch({ type: 0 /* SetSelectedIndex */, index: selectedIndex != null ? selectedIndex : defaultIndex });
+ }, [
+ selectedIndex
+ /* Deliberately skipping defaultIndex */
+ ]);
+ useIsoMorphicEffect(() => {
+ if (realSelectedIndex.current === void 0)
+ return;
+ if (state.tabs.length <= 0)
+ return;
+ let sorted = sortByDomNode(state.tabs, (tab) => tab.current);
+ let didOrderChange = sorted.some((tab, i) => state.tabs[i] !== tab);
+ if (didOrderChange) {
+ change(sorted.indexOf(state.tabs[realSelectedIndex.current]));
+ }
+ });
+ let ourProps = { ref: tabsRef };
+ return /* @__PURE__ */ import_react43.default.createElement(StableCollection, null, /* @__PURE__ */ import_react43.default.createElement(TabsActionsContext.Provider, { value: tabsActions }, /* @__PURE__ */ import_react43.default.createElement(TabsDataContext.Provider, { value: tabsData }, tabsData.tabs.length <= 0 && /* @__PURE__ */ import_react43.default.createElement(
+ FocusSentinel,
+ {
+ onFocus: () => {
+ var _a3, _b;
+ for (let tab of stableTabsRef.current) {
+ if (((_a3 = tab.current) == null ? void 0 : _a3.tabIndex) === 0) {
+ (_b = tab.current) == null ? void 0 : _b.focus();
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ ), render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_TABS_TAG,
+ name: "Tabs"
+ }))));
+}
+var DEFAULT_LIST_TAG = "div";
+function ListFn(props, ref) {
+ let { orientation, selectedIndex } = useData4("Tab.List");
+ let listRef = useSyncRefs(ref);
+ let slot = { selectedIndex };
+ let theirProps = props;
+ let ourProps = {
+ ref: listRef,
+ role: "tablist",
+ "aria-orientation": orientation
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_LIST_TAG,
+ name: "Tabs.List"
+ });
+}
+var DEFAULT_TAB_TAG = "button";
+function TabFn(props, ref) {
+ var _a3, _b;
+ let internalId = useId();
+ let { id = `headlessui-tabs-tab-${internalId}`, ...theirProps } = props;
+ let { orientation, activation, selectedIndex, tabs, panels } = useData4("Tab");
+ let actions = useActions4("Tab");
+ let data = useData4("Tab");
+ let internalTabRef = (0, import_react43.useRef)(null);
+ let tabRef = useSyncRefs(internalTabRef, ref);
+ useIsoMorphicEffect(() => actions.registerTab(internalTabRef), [actions, internalTabRef]);
+ let mySSRIndex = useStableCollectionIndex("tabs");
+ let myIndex = tabs.indexOf(internalTabRef);
+ if (myIndex === -1)
+ myIndex = mySSRIndex;
+ let selected = myIndex === selectedIndex;
+ let activateUsing = useEvent((cb) => {
+ var _a4;
+ let result = cb();
+ if (result === 2 /* Success */ && activation === "auto") {
+ let newTab = (_a4 = getOwnerDocument(internalTabRef)) == null ? void 0 : _a4.activeElement;
+ let idx = data.tabs.findIndex((tab) => tab.current === newTab);
+ if (idx !== -1)
+ actions.change(idx);
+ }
+ return result;
+ });
+ let handleKeyDown = useEvent((event) => {
+ let list = tabs.map((tab) => tab.current).filter(Boolean);
+ if (event.key === " " /* Space */ || event.key === "Enter" /* Enter */) {
+ event.preventDefault();
+ event.stopPropagation();
+ actions.change(myIndex);
+ return;
+ }
+ switch (event.key) {
+ case "Home" /* Home */:
+ case "PageUp" /* PageUp */:
+ event.preventDefault();
+ event.stopPropagation();
+ return activateUsing(() => focusIn(list, 1 /* First */));
+ case "End" /* End */:
+ case "PageDown" /* PageDown */:
+ event.preventDefault();
+ event.stopPropagation();
+ return activateUsing(() => focusIn(list, 8 /* Last */));
+ }
+ let result = activateUsing(() => {
+ return match(orientation, {
+ vertical() {
+ if (event.key === "ArrowUp" /* ArrowUp */)
+ return focusIn(list, 2 /* Previous */ | 16 /* WrapAround */);
+ if (event.key === "ArrowDown" /* ArrowDown */)
+ return focusIn(list, 4 /* Next */ | 16 /* WrapAround */);
+ return 0 /* Error */;
+ },
+ horizontal() {
+ if (event.key === "ArrowLeft" /* ArrowLeft */)
+ return focusIn(list, 2 /* Previous */ | 16 /* WrapAround */);
+ if (event.key === "ArrowRight" /* ArrowRight */)
+ return focusIn(list, 4 /* Next */ | 16 /* WrapAround */);
+ return 0 /* Error */;
+ }
+ });
+ });
+ if (result === 2 /* Success */) {
+ return event.preventDefault();
+ }
+ });
+ let ready = (0, import_react43.useRef)(false);
+ let handleSelection = useEvent(() => {
+ var _a4;
+ if (ready.current)
+ return;
+ ready.current = true;
+ (_a4 = internalTabRef.current) == null ? void 0 : _a4.focus();
+ actions.change(myIndex);
+ microTask(() => {
+ ready.current = false;
+ });
+ });
+ let handleMouseDown = useEvent((event) => {
+ event.preventDefault();
+ });
+ let slot = (0, import_react43.useMemo)(() => ({ selected }), [selected]);
+ let ourProps = {
+ ref: tabRef,
+ onKeyDown: handleKeyDown,
+ onMouseDown: handleMouseDown,
+ onClick: handleSelection,
+ id,
+ role: "tab",
+ type: useResolveButtonType(props, internalTabRef),
+ "aria-controls": (_b = (_a3 = panels[myIndex]) == null ? void 0 : _a3.current) == null ? void 0 : _b.id,
+ "aria-selected": selected,
+ tabIndex: selected ? 0 : -1
+ };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_TAB_TAG,
+ name: "Tabs.Tab"
+ });
+}
+var DEFAULT_PANELS_TAG = "div";
+function PanelsFn(props, ref) {
+ let { selectedIndex } = useData4("Tab.Panels");
+ let panelsRef = useSyncRefs(ref);
+ let slot = (0, import_react43.useMemo)(() => ({ selectedIndex }), [selectedIndex]);
+ let theirProps = props;
+ let ourProps = { ref: panelsRef };
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_PANELS_TAG,
+ name: "Tabs.Panels"
+ });
+}
+var DEFAULT_PANEL_TAG4 = "div";
+var PanelRenderFeatures3 = 1 /* RenderStrategy */ | 2 /* Static */;
+function PanelFn4(props, ref) {
+ var _a3, _b, _c, _d;
+ let internalId = useId();
+ let { id = `headlessui-tabs-panel-${internalId}`, tabIndex = 0, ...theirProps } = props;
+ let { selectedIndex, tabs, panels } = useData4("Tab.Panel");
+ let actions = useActions4("Tab.Panel");
+ let internalPanelRef = (0, import_react43.useRef)(null);
+ let panelRef = useSyncRefs(internalPanelRef, ref);
+ useIsoMorphicEffect(() => actions.registerPanel(internalPanelRef), [actions, internalPanelRef]);
+ let mySSRIndex = useStableCollectionIndex("panels");
+ let myIndex = panels.indexOf(internalPanelRef);
+ if (myIndex === -1)
+ myIndex = mySSRIndex;
+ let selected = myIndex === selectedIndex;
+ let slot = (0, import_react43.useMemo)(() => ({ selected }), [selected]);
+ let ourProps = {
+ ref: panelRef,
+ id,
+ role: "tabpanel",
+ "aria-labelledby": (_b = (_a3 = tabs[myIndex]) == null ? void 0 : _a3.current) == null ? void 0 : _b.id,
+ tabIndex: selected ? tabIndex : -1
+ };
+ if (!selected && ((_c = theirProps.unmount) != null ? _c : true) && !((_d = theirProps.static) != null ? _d : false)) {
+ return /* @__PURE__ */ import_react43.default.createElement(Hidden, { as: "span", ...ourProps });
+ }
+ return render({
+ ourProps,
+ theirProps,
+ slot,
+ defaultTag: DEFAULT_PANEL_TAG4,
+ features: PanelRenderFeatures3,
+ visible: selected,
+ name: "Tabs.Panel"
+ });
+}
+var TabRoot = forwardRefWithAs(TabFn);
+var Group4 = forwardRefWithAs(GroupFn4);
+var List = forwardRefWithAs(ListFn);
+var Panels = forwardRefWithAs(PanelsFn);
+var Panel4 = forwardRefWithAs(PanelFn4);
+var Tab = Object.assign(TabRoot, { Group: Group4, List, Panels, Panel: Panel4 });
+
+// src/components/transitions/transition.tsx
+var import_react44 = __toESM(__webpack_require__(/*! react */ "react"), 1);
+
+// src/utils/once.ts
+function once(cb) {
+ let state = { called: false };
+ return (...args) => {
+ if (state.called)
+ return;
+ state.called = true;
+ return cb(...args);
+ };
+}
+
+// src/components/transitions/utils/transition.ts
+function addClasses(node, ...classes) {
+ node && classes.length > 0 && node.classList.add(...classes);
+}
+function removeClasses(node, ...classes) {
+ node && classes.length > 0 && node.classList.remove(...classes);
+}
+function waitForTransition(node, done) {
+ let d = disposables();
+ if (!node)
+ return d.dispose;
+ let { transitionDuration, transitionDelay } = getComputedStyle(node);
+ let [durationMs, delayMs] = [transitionDuration, transitionDelay].map((value) => {
+ let [resolvedValue = 0] = value.split(",").filter(Boolean).map((v) => v.includes("ms") ? parseFloat(v) : parseFloat(v) * 1e3).sort((a, z) => z - a);
+ return resolvedValue;
+ });
+ let totalDuration = durationMs + delayMs;
+ if (totalDuration !== 0) {
+ if (false) {} else {
+ d.group((d2) => {
+ d2.setTimeout(() => {
+ done();
+ d2.dispose();
+ }, totalDuration);
+ d2.addEventListener(node, "transitionrun", (event) => {
+ if (event.target !== event.currentTarget)
+ return;
+ d2.dispose();
+ });
+ });
+ let dispose = d.addEventListener(node, "transitionend", (event) => {
+ if (event.target !== event.currentTarget)
+ return;
+ done();
+ dispose();
+ });
+ }
+ } else {
+ done();
+ }
+ d.add(() => done());
+ return d.dispose;
+}
+function transition(node, classes, show, done) {
+ let direction = show ? "enter" : "leave";
+ let d = disposables();
+ let _done = done !== void 0 ? once(done) : () => {
+ };
+ if (direction === "enter") {
+ node.removeAttribute("hidden");
+ node.style.display = "";
+ }
+ let base = match(direction, {
+ enter: () => classes.enter,
+ leave: () => classes.leave
+ });
+ let to = match(direction, {
+ enter: () => classes.enterTo,
+ leave: () => classes.leaveTo
+ });
+ let from = match(direction, {
+ enter: () => classes.enterFrom,
+ leave: () => classes.leaveFrom
+ });
+ removeClasses(
+ node,
+ ...classes.enter,
+ ...classes.enterTo,
+ ...classes.enterFrom,
+ ...classes.leave,
+ ...classes.leaveFrom,
+ ...classes.leaveTo,
+ ...classes.entered
+ );
+ addClasses(node, ...base, ...from);
+ d.nextFrame(() => {
+ removeClasses(node, ...from);
+ addClasses(node, ...to);
+ waitForTransition(node, () => {
+ removeClasses(node, ...base);
+ addClasses(node, ...classes.entered);
+ return _done();
+ });
+ });
+ return d.dispose;
+}
+
+// src/hooks/use-transition.ts
+function useTransition({ container, direction, classes, onStart, onStop }) {
+ let mounted = useIsMounted();
+ let d = useDisposables();
+ let latestDirection = useLatestValue(direction);
+ useIsoMorphicEffect(() => {
+ let dd = disposables();
+ d.add(dd.dispose);
+ let node = container.current;
+ if (!node)
+ return;
+ if (latestDirection.current === "idle")
+ return;
+ if (!mounted.current)
+ return;
+ dd.dispose();
+ onStart.current(latestDirection.current);
+ dd.add(
+ transition(node, classes.current, latestDirection.current === "enter", () => {
+ dd.dispose();
+ onStop.current(latestDirection.current);
+ })
+ );
+ return dd.dispose;
+ }, [direction]);
+}
+
+// src/components/transitions/transition.tsx
+function splitClasses(classes = "") {
+ return classes.split(" ").filter((className) => className.trim().length > 1);
+}
+var TransitionContext = (0, import_react44.createContext)(null);
+TransitionContext.displayName = "TransitionContext";
+function useTransitionContext() {
+ let context = (0, import_react44.useContext)(TransitionContext);
+ if (context === null) {
+ throw new Error(
+ "A is used but it is missing a parent or ."
+ );
+ }
+ return context;
+}
+function useParentNesting() {
+ let context = (0, import_react44.useContext)(NestingContext);
+ if (context === null) {
+ throw new Error(
+ "A is used but it is missing a parent or ."
+ );
+ }
+ return context;
+}
+var NestingContext = (0, import_react44.createContext)(null);
+NestingContext.displayName = "NestingContext";
+function hasChildren(bag) {
+ if ("children" in bag)
+ return hasChildren(bag.children);
+ return bag.current.filter(({ el }) => el.current !== null).filter(({ state }) => state === "visible" /* Visible */).length > 0;
+}
+function useNesting(done, parent) {
+ let doneRef = useLatestValue(done);
+ let transitionableChildren = (0, import_react44.useRef)([]);
+ let mounted = useIsMounted();
+ let d = useDisposables();
+ let unregister = useEvent((container, strategy = 1 /* Hidden */) => {
+ let idx = transitionableChildren.current.findIndex(({ el }) => el === container);
+ if (idx === -1)
+ return;
+ match(strategy, {
+ [0 /* Unmount */]() {
+ transitionableChildren.current.splice(idx, 1);
+ },
+ [1 /* Hidden */]() {
+ transitionableChildren.current[idx].state = "hidden" /* Hidden */;
+ }
+ });
+ d.microTask(() => {
+ var _a3;
+ if (!hasChildren(transitionableChildren) && mounted.current) {
+ (_a3 = doneRef.current) == null ? void 0 : _a3.call(doneRef);
+ }
+ });
+ });
+ let register = useEvent((container) => {
+ let child = transitionableChildren.current.find(({ el }) => el === container);
+ if (!child) {
+ transitionableChildren.current.push({ el: container, state: "visible" /* Visible */ });
+ } else if (child.state !== "visible" /* Visible */) {
+ child.state = "visible" /* Visible */;
+ }
+ return () => unregister(container, 0 /* Unmount */);
+ });
+ let todos = (0, import_react44.useRef)([]);
+ let wait = (0, import_react44.useRef)(Promise.resolve());
+ let chains = (0, import_react44.useRef)({
+ enter: [],
+ leave: [],
+ idle: []
+ });
+ let onStart = useEvent(
+ (container, direction, cb) => {
+ todos.current.splice(0);
+ if (parent) {
+ parent.chains.current[direction] = parent.chains.current[direction].filter(
+ ([containerInParent]) => containerInParent !== container
+ );
+ }
+ parent == null ? void 0 : parent.chains.current[direction].push([
+ container,
+ new Promise((resolve) => {
+ todos.current.push(resolve);
+ })
+ ]);
+ parent == null ? void 0 : parent.chains.current[direction].push([
+ container,
+ new Promise((resolve) => {
+ Promise.all(chains.current[direction].map(([_container, promise]) => promise)).then(
+ () => resolve()
+ );
+ })
+ ]);
+ if (direction === "enter") {
+ wait.current = wait.current.then(() => parent == null ? void 0 : parent.wait.current).then(() => cb(direction));
+ } else {
+ cb(direction);
+ }
+ }
+ );
+ let onStop = useEvent(
+ (_container, direction, cb) => {
+ Promise.all(chains.current[direction].splice(0).map(([_container2, promise]) => promise)).then(() => {
+ var _a3;
+ (_a3 = todos.current.shift()) == null ? void 0 : _a3();
+ }).then(() => cb(direction));
+ }
+ );
+ return (0, import_react44.useMemo)(
+ () => ({
+ children: transitionableChildren,
+ register,
+ unregister,
+ onStart,
+ onStop,
+ wait,
+ chains
+ }),
+ [register, unregister, transitionableChildren, onStart, onStop, chains, wait]
+ );
+}
+function noop() {
+}
+var eventNames = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
+function ensureEventHooksExist(events) {
+ var _a3;
+ let result = {};
+ for (let name of eventNames) {
+ result[name] = (_a3 = events[name]) != null ? _a3 : noop;
+ }
+ return result;
+}
+function useEvents(events) {
+ let eventsRef = (0, import_react44.useRef)(ensureEventHooksExist(events));
+ (0, import_react44.useEffect)(() => {
+ eventsRef.current = ensureEventHooksExist(events);
+ }, [events]);
+ return eventsRef;
+}
+var DEFAULT_TRANSITION_CHILD_TAG = "div";
+var TransitionChildRenderFeatures = 1 /* RenderStrategy */;
+function TransitionChildFn(props, ref) {
+ let {
+ // Event "handlers"
+ beforeEnter,
+ afterEnter,
+ beforeLeave,
+ afterLeave,
+ // Class names
+ enter,
+ enterFrom,
+ enterTo,
+ entered,
+ leave,
+ leaveFrom,
+ leaveTo,
+ // @ts-expect-error
+ ...rest
+ } = props;
+ let container = (0, import_react44.useRef)(null);
+ let transitionRef = useSyncRefs(container, ref);
+ let strategy = rest.unmount ? 0 /* Unmount */ : 1 /* Hidden */;
+ let { show, appear, initial } = useTransitionContext();
+ let [state, setState] = (0, import_react44.useState)(show ? "visible" /* Visible */ : "hidden" /* Hidden */);
+ let parentNesting = useParentNesting();
+ let { register, unregister } = parentNesting;
+ let prevShow = (0, import_react44.useRef)(null);
+ (0, import_react44.useEffect)(() => register(container), [register, container]);
+ (0, import_react44.useEffect)(() => {
+ if (strategy !== 1 /* Hidden */)
+ return;
+ if (!container.current)
+ return;
+ if (show && state !== "visible" /* Visible */) {
+ setState("visible" /* Visible */);
+ return;
+ }
+ return match(state, {
+ ["hidden" /* Hidden */]: () => unregister(container),
+ ["visible" /* Visible */]: () => register(container)
+ });
+ }, [state, container, register, unregister, show, strategy]);
+ let classes = useLatestValue({
+ enter: splitClasses(enter),
+ enterFrom: splitClasses(enterFrom),
+ enterTo: splitClasses(enterTo),
+ entered: splitClasses(entered),
+ leave: splitClasses(leave),
+ leaveFrom: splitClasses(leaveFrom),
+ leaveTo: splitClasses(leaveTo)
+ });
+ let events = useEvents({
+ beforeEnter,
+ afterEnter,
+ beforeLeave,
+ afterLeave
+ });
+ let ready = useServerHandoffComplete();
+ (0, import_react44.useEffect)(() => {
+ if (ready && state === "visible" /* Visible */ && container.current === null) {
+ throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
+ }
+ }, [container, state, ready]);
+ let skip = initial && !appear;
+ let transitionDirection = (() => {
+ if (!ready)
+ return "idle";
+ if (skip)
+ return "idle";
+ if (prevShow.current === show)
+ return "idle";
+ return show ? "enter" : "leave";
+ })();
+ let transitionStateFlags = useFlags(0);
+ let beforeEvent = useEvent((direction) => {
+ return match(direction, {
+ enter: () => {
+ transitionStateFlags.addFlag(8 /* Opening */);
+ events.current.beforeEnter();
+ },
+ leave: () => {
+ transitionStateFlags.addFlag(4 /* Closing */);
+ events.current.beforeLeave();
+ },
+ idle: () => {
+ }
+ });
+ });
+ let afterEvent = useEvent((direction) => {
+ return match(direction, {
+ enter: () => {
+ transitionStateFlags.removeFlag(8 /* Opening */);
+ events.current.afterEnter();
+ },
+ leave: () => {
+ transitionStateFlags.removeFlag(4 /* Closing */);
+ events.current.afterLeave();
+ },
+ idle: () => {
+ }
+ });
+ });
+ let nesting = useNesting(() => {
+ setState("hidden" /* Hidden */);
+ unregister(container);
+ }, parentNesting);
+ useTransition({
+ container,
+ classes,
+ direction: transitionDirection,
+ onStart: useLatestValue((direction) => {
+ nesting.onStart(container, direction, beforeEvent);
+ }),
+ onStop: useLatestValue((direction) => {
+ nesting.onStop(container, direction, afterEvent);
+ if (direction === "leave" && !hasChildren(nesting)) {
+ setState("hidden" /* Hidden */);
+ unregister(container);
+ }
+ })
+ });
+ (0, import_react44.useEffect)(() => {
+ if (!skip)
+ return;
+ if (strategy === 1 /* Hidden */) {
+ prevShow.current = null;
+ } else {
+ prevShow.current = show;
+ }
+ }, [show, skip, state]);
+ let theirProps = rest;
+ let ourProps = { ref: transitionRef };
+ if (appear && show && initial) {
+ theirProps = {
+ ...theirProps,
+ // Already apply the `enter` and `enterFrom` on the server if required
+ className: classNames(rest.className, ...classes.current.enter, ...classes.current.enterFrom)
+ };
+ }
+ return /* @__PURE__ */ import_react44.default.createElement(NestingContext.Provider, { value: nesting }, /* @__PURE__ */ import_react44.default.createElement(
+ OpenClosedProvider,
+ {
+ value: match(state, {
+ ["visible" /* Visible */]: 1 /* Open */,
+ ["hidden" /* Hidden */]: 2 /* Closed */
+ }) | transitionStateFlags.flags
+ },
+ render({
+ ourProps,
+ theirProps,
+ defaultTag: DEFAULT_TRANSITION_CHILD_TAG,
+ features: TransitionChildRenderFeatures,
+ visible: state === "visible" /* Visible */,
+ name: "Transition.Child"
+ })
+ ));
+}
+function TransitionRootFn(props, ref) {
+ let { show, appear = false, unmount, ...theirProps } = props;
+ let internalTransitionRef = (0, import_react44.useRef)(null);
+ let transitionRef = useSyncRefs(internalTransitionRef, ref);
+ useServerHandoffComplete();
+ let usesOpenClosedState = useOpenClosed();
+ if (show === void 0 && usesOpenClosedState !== null) {
+ show = (usesOpenClosedState & 1 /* Open */) === 1 /* Open */;
+ }
+ if (![true, false].includes(show)) {
+ throw new Error("A is used but it is missing a `show={true | false}` prop.");
+ }
+ let [state, setState] = (0, import_react44.useState)(show ? "visible" /* Visible */ : "hidden" /* Hidden */);
+ let nestingBag = useNesting(() => {
+ setState("hidden" /* Hidden */);
+ });
+ let [initial, setInitial] = (0, import_react44.useState)(true);
+ let changes = (0, import_react44.useRef)([show]);
+ useIsoMorphicEffect(() => {
+ if (initial === false) {
+ return;
+ }
+ if (changes.current[changes.current.length - 1] !== show) {
+ changes.current.push(show);
+ setInitial(false);
+ }
+ }, [changes, show]);
+ let transitionBag = (0, import_react44.useMemo)(
+ () => ({ show, appear, initial }),
+ [show, appear, initial]
+ );
+ (0, import_react44.useEffect)(() => {
+ if (show) {
+ setState("visible" /* Visible */);
+ } else if (!hasChildren(nestingBag)) {
+ setState("hidden" /* Hidden */);
+ } else if (true) {
+ let node = internalTransitionRef.current;
+ if (!node)
+ return;
+ let rect = node.getBoundingClientRect();
+ if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) {
+ setState("hidden" /* Hidden */);
+ }
+ }
+ }, [show, nestingBag]);
+ let sharedProps = { unmount };
+ let beforeEnter = useEvent(() => {
+ var _a3;
+ if (initial)
+ setInitial(false);
+ (_a3 = props.beforeEnter) == null ? void 0 : _a3.call(props);
+ });
+ let beforeLeave = useEvent(() => {
+ var _a3;
+ if (initial)
+ setInitial(false);
+ (_a3 = props.beforeLeave) == null ? void 0 : _a3.call(props);
+ });
+ return /* @__PURE__ */ import_react44.default.createElement(NestingContext.Provider, { value: nestingBag }, /* @__PURE__ */ import_react44.default.createElement(TransitionContext.Provider, { value: transitionBag }, render({
+ ourProps: {
+ ...sharedProps,
+ as: import_react44.Fragment,
+ children: /* @__PURE__ */ import_react44.default.createElement(
+ TransitionChild,
+ {
+ ref: transitionRef,
+ ...sharedProps,
+ ...theirProps,
+ beforeEnter,
+ beforeLeave
+ }
+ )
+ },
+ theirProps: {},
+ defaultTag: import_react44.Fragment,
+ features: TransitionChildRenderFeatures,
+ visible: state === "visible" /* Visible */,
+ name: "Transition"
+ })));
+}
+function ChildFn(props, ref) {
+ let hasTransitionContext = (0, import_react44.useContext)(TransitionContext) !== null;
+ let hasOpenClosedContext = useOpenClosed() !== null;
+ return /* @__PURE__ */ import_react44.default.createElement(import_react44.default.Fragment, null, !hasTransitionContext && hasOpenClosedContext ? (
+ // @ts-expect-error This is an object
+ /* @__PURE__ */ import_react44.default.createElement(TransitionRoot, { ref, ...props })
+ ) : (
+ // @ts-expect-error This is an object
+ /* @__PURE__ */ import_react44.default.createElement(TransitionChild, { ref, ...props })
+ ));
+}
+var TransitionRoot = forwardRefWithAs(TransitionRootFn);
+var TransitionChild = forwardRefWithAs(TransitionChildFn);
+var Child = forwardRefWithAs(ChildFn);
+var Transition = Object.assign(TransitionRoot, { Child, Root: TransitionRoot });
+
+
+/***/ }),
+
+/***/ "../../../node_modules/@headlessui/react/dist/index.cjs":
+/*!**************************************************************!*\
+ !*** ../../../node_modules/@headlessui/react/dist/index.cjs ***!
+ \**************************************************************/
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+
+
+if (false) {} else {
+ module.exports = __webpack_require__(/*! ./headlessui.dev.cjs */ "../../../node_modules/@headlessui/react/dist/headlessui.dev.cjs")
+}
+
+
+/***/ }),
+
+/***/ "../../../node_modules/@babel/runtime/helpers/extends.js":
+/*!***************************************************************!*\
+ !*** ../../../node_modules/@babel/runtime/helpers/extends.js ***!
+ \***************************************************************/
+/***/ (function(module) {
+
+
+
+function _extends() {
+ module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+ for (var key in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+ return target;
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports;
+ return _extends.apply(this, arguments);
+}
+module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
+
+/***/ })
+
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/global */
+/******/ !function() {
+/******/ __webpack_require__.g = (function() {
+/******/ if (typeof globalThis === 'object') return globalThis;
+/******/ try {
+/******/ return this || new Function('return this')();
+/******/ } catch (e) {
+/******/ if (typeof window === 'object') return window;
+/******/ }
+/******/ })();
+/******/ }();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ !function() {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ }();
+/******/
+/******/ /* webpack/runtime/nonce */
+/******/ !function() {
+/******/ __webpack_require__.nc = undefined;
+/******/ }();
+/******/
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+!function() {
+var exports = __webpack_exports__;
+/*!****************!*\
+ !*** ./cdn.ts ***!
+ \****************/
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var GraphiQLReact = _interopRequireWildcard(__webpack_require__(/*! @graphiql/react */ "../../graphiql-react/dist/index.js"));
+var _toolkit = __webpack_require__(/*! @graphiql/toolkit */ "../../graphiql-toolkit/esm/index.js");
+var GraphQL = _interopRequireWildcard(__webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"));
+var _GraphiQL = __webpack_require__(/*! ./components/GraphiQL */ "./components/GraphiQL.tsx");
+__webpack_require__(/*! @graphiql/react/font/roboto.css */ "../../graphiql-react/font/roboto.css");
+__webpack_require__(/*! @graphiql/react/font/fira-code.css */ "../../graphiql-react/font/fira-code.css");
+__webpack_require__(/*! @graphiql/react/dist/style.css */ "../../graphiql-react/dist/style.css");
+__webpack_require__(/*! ./style.css */ "./style.css");
+function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
+function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
+/**
+ * Copyright (c) 2021 GraphQL Contributors.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+/**
+ * For the CDN bundle we add some static properties to the component function
+ * so that they can be accessed in the inline-script in the HTML file.
+ */
+
+/**
+ * This function is needed in order to easily create a fetcher function.
+ */
+// @ts-expect-error
+_GraphiQL.GraphiQL.createFetcher = _toolkit.createGraphiQLFetcher;
+
+/**
+ * This function is needed in order to easily generate a custom storage namespace
+ */
+// @ts-expect-error
+_GraphiQL.GraphiQL.createLocalStorage = _toolkit.createLocalStorage;
+
+/**
+ * We also add the complete `graphiql-js` exports so that this instance of
+ * `graphiql-js` can be reused from plugin CDN bundles.
+ */
+// @ts-expect-error
+_GraphiQL.GraphiQL.GraphQL = GraphQL;
+
+/**
+ * We also add the complete `@graphiql/react` exports. These will be included
+ * in the bundle anyway since they make up the `GraphiQL` component, so by
+ * doing this we can reuse them from plugin CDN bundles.
+ */
+// @ts-expect-error
+_GraphiQL.GraphiQL.React = GraphiQLReact;
+var _default = exports["default"] = _GraphiQL.GraphiQL;
+}();
+window.GraphiQL = __webpack_exports__["default"];
+/******/ })()
+;
+//# sourceMappingURL=graphiql.min.js.map
\ No newline at end of file
diff --git a/python_modules/dagster-webserver/dagster_webserver/graphiql/react-dom.production.min.js b/python_modules/dagster-webserver/dagster_webserver/graphiql/react-dom.production.min.js
new file mode 100644
index 0000000000000..fb4e099c05623
--- /dev/null
+++ b/python_modules/dagster-webserver/dagster_webserver/graphiql/react-dom.production.min.js
@@ -0,0 +1,267 @@
+/**
+ * @license React
+ * react-dom.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+(function(){/*
+ Modernizr 3.0.0pre (Custom Build) | MIT
+*/
+'use strict';(function(Q,zb){"object"===typeof exports&&"undefined"!==typeof module?zb(exports,require("react")):"function"===typeof define&&define.amd?define(["exports","react"],zb):(Q=Q||self,zb(Q.ReactDOM={},Q.React))})(this,function(Q,zb){function m(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cb}return!1}function Y(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}function $d(a,b,c,d){var e=R.hasOwnProperty(b)?R[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k="\n"+e[g].replace(" at new "," at ");a.displayName&&k.includes("")&&(k=k.replace("",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{ce=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:"")?bc(a):
+""}function fj(a){switch(a.tag){case 5:return bc(a.type);case 16:return bc("Lazy");case 13:return bc("Suspense");case 19:return bc("SuspenseList");case 0:case 2:case 15:return a=be(a.type,!1),a;case 11:return a=be(a.type.render,!1),a;case 1:return a=be(a.type,!0),a;default:return""}}function de(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case Bb:return"Fragment";case Cb:return"Portal";case ee:return"Profiler";case fe:return"StrictMode";
+case ge:return"Suspense";case he:return"SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case gg:return(a.displayName||"Context")+".Consumer";case hg:return(a._context.displayName||"Context")+".Provider";case ie:var b=a.render;a=a.displayName;a||(a=b.displayName||b.name||"",a=""!==a?"ForwardRef("+a+")":"ForwardRef");return a;case je:return b=a.displayName||null,null!==b?b:de(a.type)||"Memo";case Ta:b=a._payload;a=a._init;try{return de(a(b))}catch(c){}}return null}function gj(a){var b=a.type;
+switch(a.tag){case 24:return"Cache";case 9:return(b.displayName||"Context")+".Consumer";case 10:return(b._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=b.render,a=a.displayName||a.name||"",b.displayName||(""!==a?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return b;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(b);case 8:return b===fe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";
+case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof b)return b.displayName||b.name||null;if("string"===typeof b)return b}return null}function Ua(a){switch(typeof a){case "boolean":case "number":case "string":case "undefined":return a;case "object":return a;default:return""}}function ig(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===
+b)}function hj(a){var b=ig(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker=
+null;delete a[b]}}}}function Pc(a){a._valueTracker||(a._valueTracker=hj(a))}function jg(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=ig(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Qc(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}function ke(a,b){var c=b.checked;return E({},b,{defaultChecked:void 0,defaultValue:void 0,
+value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function kg(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Ua(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value}}function lg(a,b){b=b.checked;null!=b&&$d(a,"checked",b,!1)}function le(a,b){lg(a,b);var c=Ua(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=
+c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?me(a,b.type,c):b.hasOwnProperty("defaultValue")&&me(a,b.type,Ua(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}function mg(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;
+c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;""!==c&&(a.name="");a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c)}function me(a,b,c){if("number"!==b||Qc(a.ownerDocument)!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c)}function Db(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e>>=0;return 0===a?32:31-(qj(a)/rj|0)|0}function hc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&
+4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Vc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=hc(h):(f&=g,0!==f&&(d=hc(f)))}else g=c&~e,0!==g?d=hc(g):0!==f&&(d=hc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&
+(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);
+return b}function ic(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-ta(b);a[b]=c}function uj(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=$g(c)}}function bh(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?bh(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}function ch(){for(var a=window,b=Qc();b instanceof a.HTMLIFrameElement;){try{var c="string"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;
+b=Qc(a.document)}return b}function Ie(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)}function Tj(a){var b=ch(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&bh(c.ownerDocument.documentElement,c)){if(null!==d&&Ie(c))if(b=d.start,a=d.end,void 0===a&&(a=b),"selectionStart"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);
+else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=ah(c,f);var g=ah(c,d);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),
+a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});"function"===typeof c.focus&&c.focus();for(c=0;cMb||(a.current=Se[Mb],Se[Mb]=null,Mb--)}
+function y(a,b,c){Mb++;Se[Mb]=a.current;a.current=b}function Nb(a,b){var c=a.type.contextTypes;if(!c)return cb;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function ea(a){a=a.childContextTypes;return null!==a&&void 0!==a}function th(a,b,c){if(J.current!==cb)throw Error(m(168));
+y(J,b);y(S,c)}function uh(a,b,c){var d=a.stateNode;b=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(m(108,gj(a)||"Unknown",e));return E({},c,d)}function ld(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||cb;pb=J.current;y(J,a);y(S,S.current);return!0}function vh(a,b,c){var d=a.stateNode;if(!d)throw Error(m(169));c?(a=uh(a,b,pb),d.__reactInternalMemoizedMergedChildContext=a,v(S),v(J),y(J,a)):v(S);
+y(S,c)}function wh(a){null===La?La=[a]:La.push(a)}function jk(a){md=!0;wh(a)}function db(){if(!Te&&null!==La){Te=!0;var a=0,b=z;try{var c=La;for(z=1;a>=g;e-=g;Ma=1<<32-ta(b)+e|c<t?(q=l,l=null):q=l.sibling;var A=r(e,l,h[t],k);if(null===A){null===l&&(l=q);break}a&&l&&null===A.alternate&&b(e,l);g=f(A,g,t);null===m?n=A:m.sibling=A;m=A;l=q}if(t===h.length)return c(e,l),D&&qb(e,t),n;if(null===l){for(;t<
+h.length;t++)l=u(e,h[t],k),null!==l&&(g=f(l,g,t),null===m?n=l:m.sibling=l,m=l);D&&qb(e,t);return n}for(l=d(e,l);tt?(A=q,q=null):A=q.sibling;var x=r(e,q,w.value,k);if(null===x){null===q&&(q=A);break}a&&q&&null===x.alternate&&b(e,q);g=f(x,g,t);null===l?n=x:l.sibling=x;l=x;q=A}if(w.done)return c(e,q),D&&qb(e,t),n;if(null===q){for(;!w.done;t++,w=h.next())w=u(e,w.value,k),null!==w&&(g=f(w,g,t),null===l?n=w:l.sibling=w,l=w);D&&qb(e,t);return n}for(q=d(e,q);!w.done;t++,w=h.next())w=p(q,e,t,w.value,k),null!==w&&(a&&null!==w.alternate&&q.delete(null===w.key?t:w.key),g=f(w,g,t),null===l?n=w:l.sibling=
+w,l=w);a&&q.forEach(function(a){return b(e,a)});D&&qb(e,t);return n}function v(a,d,f,h){"object"===typeof f&&null!==f&&f.type===Bb&&null===f.key&&(f=f.props.children);if("object"===typeof f&&null!==f){switch(f.$$typeof){case sd:a:{for(var k=f.key,n=d;null!==n;){if(n.key===k){k=f.type;if(k===Bb){if(7===n.tag){c(a,n.sibling);d=e(n,f.props.children);d.return=a;a=d;break a}}else if(n.elementType===k||"object"===typeof k&&null!==k&&k.$$typeof===Ta&&Ch(k)===n.type){c(a,n.sibling);d=e(n,f.props);d.ref=vc(a,
+n,f);d.return=a;a=d;break a}c(a,n);break}else b(a,n);n=n.sibling}f.type===Bb?(d=sb(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=rd(f.type,f.key,f.props,null,a.mode,h),h.ref=vc(a,d,f),h.return=a,a=h)}return g(a);case Cb:a:{for(n=f.key;null!==d;){if(d.key===n)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=$e(f,a.mode,h);d.return=a;
+a=d}return g(a);case Ta:return n=f._init,v(a,d,n(f._payload),h)}if(cc(f))return x(a,d,f,h);if(ac(f))return I(a,d,f,h);qd(a,f)}return"string"===typeof f&&""!==f||"number"===typeof f?(f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ze(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return v}function af(){bf=Rb=td=null}function cf(a,b){b=ud.current;v(ud);a._currentValue=b}function df(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=
+b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return}}function Sb(a,b){td=a;bf=Rb=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(ha=!0),a.firstContext=null)}function qa(a){var b=a._currentValue;if(bf!==a)if(a={context:a,memoizedValue:b,next:null},null===Rb){if(null===td)throw Error(m(308));Rb=a;td.dependencies={lanes:0,firstContext:a}}else Rb=Rb.next=a;return b}function ef(a){null===tb?tb=[a]:tb.push(a)}function Eh(a,b,c,d){var e=b.interleaved;
+null===e?(c.next=c,ef(b)):(c.next=e.next,e.next=c);b.interleaved=c;return Oa(a,d)}function Oa(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}function ff(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue=
+{baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function Pa(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}function fb(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(p&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return kk(a,c)}e=d.interleaved;null===e?(b.next=b,ef(d)):(b.next=e.next,e.next=b);d.interleaved=b;return Oa(a,c)}function vd(a,b,c){b=
+b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;xe(a,c)}}function Gh(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,
+shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=b;c.lastBaseUpdate=b}function wd(a,b,c,d){var e=a.updateQueue;gb=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,n=k.next;k.next=null;null===g?f=n:g.next=n;g=k;var l=a.alternate;null!==l&&(l=l.updateQueue,h=l.lastBaseUpdate,h!==g&&(null===h?l.firstBaseUpdate=n:h.next=n,l.lastBaseUpdate=k))}if(null!==f){var m=e.baseState;g=0;l=
+n=k=null;h=f;do{var r=h.lane,p=h.eventTime;if((d&r)===r){null!==l&&(l=l.next={eventTime:p,lane:0,tag:h.tag,payload:h.payload,callback:h.callback,next:null});a:{var x=a,v=h;r=b;p=c;switch(v.tag){case 1:x=v.payload;if("function"===typeof x){m=x.call(p,m,r);break a}m=x;break a;case 3:x.flags=x.flags&-65537|128;case 0:x=v.payload;r="function"===typeof x?x.call(p,m,r):x;if(null===r||void 0===r)break a;m=E({},m,r);break a;case 2:gb=!0}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=
+[h]:r.push(h))}else p={eventTime:p,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===l?(n=l=p,k=m):l=l.next=p,g|=r;h=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null}while(1);null===l&&(k=m);e.baseState=k;e.firstBaseUpdate=n;e.lastBaseUpdate=l;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);ra|=g;a.lanes=g;a.memoizedState=m}}function Hh(a,
+b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=sf.transition;sf.transition=
+{};try{a(!1),b()}finally{z=c,sf.transition=d}}function $h(){return sa().memoizedState}function qk(a,b,c){var d=hb(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(ai(a))bi(b,c);else if(c=Eh(a,b,c,d),null!==c){var e=Z();xa(c,a,d,e);ci(c,b,d)}}function ok(a,b,c){var d=hb(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(ai(a))bi(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,
+h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(ua(h,g)){var k=b.interleaved;null===k?(e.next=e,ef(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(n){}finally{}c=Eh(a,b,e,d);null!==c&&(e=Z(),xa(c,a,d,e),ci(c,b,d))}}function ai(a){var b=a.alternate;return a===C||null!==b&&b===C}function bi(a,b){zc=Ad=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function ci(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;xe(a,c)}}function ya(a,b){if(a&&
+a.defaultProps){b=E({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c]);return b}return b}function tf(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:E({},b,c);a.memoizedState=c;0===a.lanes&&(a.updateQueue.baseState=c)}function di(a,b,c,d,e,f,g){a=a.stateNode;return"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!qc(c,d)||!qc(e,f):!0}function ei(a,b,c){var d=!1,e=cb;var f=b.contextType;"object"===typeof f&&
+null!==f?f=qa(f):(e=ea(b)?pb:J.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?Nb(a,e):cb);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=Dd;a.stateNode=b;b._reactInternals=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b}function fi(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&
+b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Dd.enqueueReplaceState(b,b.state,null)}function uf(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs={};ff(a);var f=b.contextType;"object"===typeof f&&null!==f?e.context=qa(f):(f=ea(b)?pb:J.current,e.context=Nb(a,f));e.state=a.memoizedState;f=b.getDerivedStateFromProps;"function"===typeof f&&(tf(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==
+typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(b=e.state,"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Dd.enqueueReplaceState(e,e.state,null),wd(a,c,e,d),e.state=a.memoizedState);"function"===typeof e.componentDidMount&&(a.flags|=4194308)}function Ub(a,b){try{var c="",d=b;do c+=fj(d),d=d.return;while(d);var e=c}catch(f){e="\nError generating stack: "+f.message+
+"\n"+f.stack}return{value:a,source:b,stack:e,digest:null}}function vf(a,b,c){return{value:a,source:null,stack:null!=c?c:null,digest:null!=b?b:null}}function wf(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}function gi(a,b,c){c=Pa(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Ed||(Ed=!0,xf=d);wf(a,b)};return c}function hi(a,b,c){c=Pa(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){return d(e)};
+c.callback=function(){wf(a,b)}}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){wf(a,b);"function"!==typeof d&&(null===ib?ib=new Set([this]):ib.add(this));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""})});return c}function ii(a,b,c){var d=a.pingCache;if(null===d){d=a.pingCache=new rk;var e=new Set;d.set(b,e)}else e=d.get(b),void 0===e&&(e=new Set,d.set(b,e));e.has(c)||(e.add(c),a=sk.bind(null,a,b,c),b.then(a,a))}function ji(a){do{var b;
+if(b=13===a.tag)b=a.memoizedState,b=null!==b?null!==b.dehydrated?!0:!1:!0;if(b)return a;a=a.return}while(null!==a);return null}function ki(a,b,c,d,e){if(0===(a.mode&1))return a===b?a.flags|=65536:(a.flags|=128,c.flags|=131072,c.flags&=-52805,1===c.tag&&(null===c.alternate?c.tag=17:(b=Pa(-1,1),b.tag=2,fb(c,b,1))),c.lanes|=1),a;a.flags|=65536;a.lanes=e;return a}function aa(a,b,c,d){b.child=null===a?li(b,null,c,d):Vb(b,a.child,c,d)}function mi(a,b,c,d,e){c=c.render;var f=b.ref;Sb(b,e);d=mf(a,b,c,d,f,
+e);c=nf();if(null!==a&&!ha)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Qa(a,b,e);D&&c&&Ue(b);b.flags|=1;aa(a,b,d,e);return b.child}function ni(a,b,c,d,e){if(null===a){var f=c.type;if("function"===typeof f&&!yf(f)&&void 0===f.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=f,oi(a,b,f,d,e);a=rd(c.type,null,d,b,b.mode,e);a.ref=b.ref;a.return=b;return b.child=a}f=a.child;if(0===(a.lanes&e)){var g=f.memoizedProps;c=c.compare;c=null!==c?c:qc;if(c(g,d)&&a.ref===
+b.ref)return Qa(a,b,e)}b.flags|=1;a=eb(f,d);a.ref=b.ref;a.return=b;return b.child=a}function oi(a,b,c,d,e){if(null!==a){var f=a.memoizedProps;if(qc(f,d)&&a.ref===b.ref)if(ha=!1,b.pendingProps=d=f,0!==(a.lanes&e))0!==(a.flags&131072)&&(ha=!0);else return b.lanes=a.lanes,Qa(a,b,e)}return zf(a,b,c,d,e)}function pi(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if("hidden"===d.mode)if(0===(b.mode&1))b.memoizedState={baseLanes:0,cachePool:null,transitions:null},y(Ga,ba),ba|=c;
+else{if(0===(c&1073741824))return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a,cachePool:null,transitions:null},b.updateQueue=null,y(Ga,ba),ba|=a,null;b.memoizedState={baseLanes:0,cachePool:null,transitions:null};d=null!==f?f.baseLanes:c;y(Ga,ba);ba|=d}else null!==f?(d=f.baseLanes|c,b.memoizedState=null):d=c,y(Ga,ba),ba|=d;aa(a,b,e,c);return b.child}function qi(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=512,b.flags|=2097152}function zf(a,
+b,c,d,e){var f=ea(c)?pb:J.current;f=Nb(b,f);Sb(b,e);c=mf(a,b,c,d,f,e);d=nf();if(null!==a&&!ha)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Qa(a,b,e);D&&d&&Ue(b);b.flags|=1;aa(a,b,c,e);return b.child}function ri(a,b,c,d,e){if(ea(c)){var f=!0;ld(b)}else f=!1;Sb(b,e);if(null===b.stateNode)Fd(a,b),ei(b,c,d),uf(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,n=c.contextType;"object"===typeof n&&null!==n?n=qa(n):(n=ea(c)?pb:J.current,n=Nb(b,
+n));var l=c.getDerivedStateFromProps,m="function"===typeof l||"function"===typeof g.getSnapshotBeforeUpdate;m||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||k!==n)&&fi(b,g,d,n);gb=!1;var r=b.memoizedState;g.state=r;wd(b,d,g,e);k=b.memoizedState;h!==d||r!==k||S.current||gb?("function"===typeof l&&(tf(b,c,l,d),k=b.memoizedState),(h=gb||di(b,c,h,d,r,k,n))?(m||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||
+("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.flags|=4194308)):("function"===typeof g.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=n,d=h):("function"===typeof g.componentDidMount&&(b.flags|=4194308),d=!1)}else{g=b.stateNode;Fh(a,b);h=b.memoizedProps;n=b.type===b.elementType?h:ya(b.type,h);g.props=
+n;m=b.pendingProps;r=g.context;k=c.contextType;"object"===typeof k&&null!==k?k=qa(k):(k=ea(c)?pb:J.current,k=Nb(b,k));var p=c.getDerivedStateFromProps;(l="function"===typeof p||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==m||r!==k)&&fi(b,g,d,k);gb=!1;r=b.memoizedState;g.state=r;wd(b,d,g,e);var x=b.memoizedState;h!==m||r!==x||S.current||gb?("function"===typeof p&&(tf(b,c,p,d),x=b.memoizedState),
+(n=gb||di(b,c,n,d,r,x,k)||!1)?(l||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,x,k),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,x,k)),"function"===typeof g.componentDidUpdate&&(b.flags|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=1024)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=
+4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=x),g.props=d,g.state=x,g.context=k,d=n):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),d=!1)}return Af(a,b,c,d,f,e)}function Af(a,b,c,d,e,f){qi(a,b);var g=0!==(b.flags&128);if(!d&&!g)return e&&vh(b,c,!1),
+Qa(a,b,f);d=b.stateNode;tk.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=Vb(b,a.child,null,f),b.child=Vb(b,null,h,f)):aa(a,b,h,f);b.memoizedState=d.state;e&&vh(b,c,!0);return b.child}function si(a){var b=a.stateNode;b.pendingContext?th(a,b.pendingContext,b.pendingContext!==b.context):b.context&&th(a,b.context,!1);gf(a,b.containerInfo)}function ti(a,b,c,d,e){Qb();Ye(e);b.flags|=256;aa(a,b,c,d);return b.child}function Bf(a){return{baseLanes:a,
+cachePool:null,transitions:null}}function ui(a,b,c){var d=b.pendingProps,e=F.current,f=!1,g=0!==(b.flags&128),h;(h=g)||(h=null!==a&&null===a.memoizedState?!1:0!==(e&2));if(h)f=!0,b.flags&=-129;else if(null===a||null!==a.memoizedState)e|=1;y(F,e&1);if(null===a){Xe(b);a=b.memoizedState;if(null!==a&&(a=a.dehydrated,null!==a))return 0===(b.mode&1)?b.lanes=1:"$!"===a.data?b.lanes=8:b.lanes=1073741824,null;g=d.children;a=d.fallback;return f?(d=b.mode,f=b.child,g={mode:"hidden",children:g},0===(d&1)&&null!==
+f?(f.childLanes=0,f.pendingProps=g):f=Gd(g,d,0,null),a=sb(a,d,c,null),f.return=b,a.return=b,f.sibling=a,b.child=f,b.child.memoizedState=Bf(c),b.memoizedState=Cf,a):Df(b,g)}e=a.memoizedState;if(null!==e&&(h=e.dehydrated,null!==h))return uk(a,b,g,d,h,e,c);if(f){f=d.fallback;g=b.mode;e=a.child;h=e.sibling;var k={mode:"hidden",children:d.children};0===(g&1)&&b.child!==e?(d=b.child,d.childLanes=0,d.pendingProps=k,b.deletions=null):(d=eb(e,k),d.subtreeFlags=e.subtreeFlags&14680064);null!==h?f=eb(h,f):(f=
+sb(f,g,c,null),f.flags|=2);f.return=b;d.return=b;d.sibling=f;b.child=d;d=f;f=b.child;g=a.child.memoizedState;g=null===g?Bf(c):{baseLanes:g.baseLanes|c,cachePool:null,transitions:g.transitions};f.memoizedState=g;f.childLanes=a.childLanes&~c;b.memoizedState=Cf;return d}f=a.child;a=f.sibling;d=eb(f,{mode:"visible",children:d.children});0===(b.mode&1)&&(d.lanes=c);d.return=b;d.sibling=null;null!==a&&(c=b.deletions,null===c?(b.deletions=[a],b.flags|=16):c.push(a));b.child=d;b.memoizedState=null;return d}
+function Df(a,b,c){b=Gd({mode:"visible",children:b},a.mode,0,null);b.return=a;return a.child=b}function Hd(a,b,c,d){null!==d&&Ye(d);Vb(b,a.child,null,c);a=Df(b,b.pendingProps.children);a.flags|=2;b.memoizedState=null;return a}function uk(a,b,c,d,e,f,g){if(c){if(b.flags&256)return b.flags&=-257,d=vf(Error(m(422))),Hd(a,b,g,d);if(null!==b.memoizedState)return b.child=a.child,b.flags|=128,null;f=d.fallback;e=b.mode;d=Gd({mode:"visible",children:d.children},e,0,null);f=sb(f,e,g,null);f.flags|=2;d.return=
+b;f.return=b;d.sibling=f;b.child=d;0!==(b.mode&1)&&Vb(b,a.child,null,g);b.child.memoizedState=Bf(g);b.memoizedState=Cf;return f}if(0===(b.mode&1))return Hd(a,b,g,null);if("$!"===e.data){d=e.nextSibling&&e.nextSibling.dataset;if(d)var h=d.dgst;d=h;f=Error(m(419));d=vf(f,d,void 0);return Hd(a,b,g,d)}h=0!==(g&a.childLanes);if(ha||h){d=O;if(null!==d){switch(g&-g){case 4:e=2;break;case 16:e=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:e=
+32;break;case 536870912:e=268435456;break;default:e=0}e=0!==(e&(d.suspendedLanes|g))?0:e;0!==e&&e!==f.retryLane&&(f.retryLane=e,Oa(a,e),xa(d,a,e,-1))}Ef();d=vf(Error(m(421)));return Hd(a,b,g,d)}if("$?"===e.data)return b.flags|=128,b.child=a.child,b=vk.bind(null,a),e._reactRetry=b,null;a=f.treeContext;fa=Ka(e.nextSibling);la=b;D=!0;wa=null;null!==a&&(na[oa++]=Ma,na[oa++]=Na,na[oa++]=rb,Ma=a.id,Na=a.overflow,rb=b);b=Df(b,d.children);b.flags|=4096;return b}function vi(a,b,c){a.lanes|=b;var d=a.alternate;
+null!==d&&(d.lanes|=b);df(a.return,b,c)}function Ff(a,b,c,d,e){var f=a.memoizedState;null===f?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e}:(f.isBackwards=b,f.rendering=null,f.renderingStartTime=0,f.last=d,f.tail=c,f.tailMode=e)}function wi(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;aa(a,b,d.children,c);d=F.current;if(0!==(d&2))d=d&1|2,b.flags|=128;else{if(null!==a&&0!==(a.flags&128))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&
+vi(a,c,b);else if(19===a.tag)vi(a,c,b);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return}a.sibling.return=a.return;a=a.sibling}d&=1}y(F,d);if(0===(b.mode&1))b.memoizedState=null;else switch(e){case "forwards":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===xd(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);Ff(b,!1,e,c,f);break;case "backwards":c=
+null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===xd(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a}Ff(b,!0,c,null,f);break;case "together":Ff(b,!1,null,null,void 0);break;default:b.memoizedState=null}return b.child}function Fd(a,b){0===(b.mode&1)&&null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2)}function Qa(a,b,c){null!==a&&(b.dependencies=a.dependencies);ra|=b.lanes;if(0===(c&b.childLanes))return null;if(null!==a&&b.child!==a.child)throw Error(m(153));if(null!==
+b.child){a=b.child;c=eb(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=eb(a,a.pendingProps),c.return=b;c.sibling=null}return b.child}function wk(a,b,c){switch(b.tag){case 3:si(b);Qb();break;case 5:Ih(b);break;case 1:ea(b.type)&&ld(b);break;case 4:gf(b,b.stateNode.containerInfo);break;case 10:var d=b.type._context,e=b.memoizedProps.value;y(ud,d._currentValue);d._currentValue=e;break;case 13:d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return y(F,F.current&
+1),b.flags|=128,null;if(0!==(c&b.child.childLanes))return ui(a,b,c);y(F,F.current&1);a=Qa(a,b,c);return null!==a?a.sibling:null}y(F,F.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&128)){if(d)return wi(a,b,c);b.flags|=128}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);y(F,F.current);if(d)break;else return null;case 22:case 23:return b.lanes=0,pi(a,b,c)}return Qa(a,b,c)}function Dc(a,b){if(!D)switch(a.tailMode){case "hidden":b=a.tail;for(var c=null;null!==
+b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null;break;case "collapsed":c=a.tail;for(var d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null}}function W(a){var b=null!==a.alternate&&a.alternate.child===a.child,c=0,d=0;if(b)for(var e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags&14680064,d|=e.flags&14680064,e.return=a,e=e.sibling;else for(e=a.child;null!==e;)c|=e.lanes|e.childLanes,
+d|=e.subtreeFlags,d|=e.flags,e.return=a,e=e.sibling;a.subtreeFlags|=d;a.childLanes=c;return b}function xk(a,b,c){var d=b.pendingProps;Ve(b);switch(b.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return W(b),null;case 1:return ea(b.type)&&(v(S),v(J)),W(b),null;case 3:d=b.stateNode;Tb();v(S);v(J);jf();d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null);if(null===a||null===a.child)pd(b)?b.flags|=4:null===a||a.memoizedState.isDehydrated&&0===(b.flags&
+256)||(b.flags|=1024,null!==wa&&(Gf(wa),wa=null));xi(a,b);W(b);return null;case 5:hf(b);var e=ub(xc.current);c=b.type;if(null!==a&&null!=b.stateNode)yk(a,b,c,d,e),a.ref!==b.ref&&(b.flags|=512,b.flags|=2097152);else{if(!d){if(null===b.stateNode)throw Error(m(166));W(b);return null}a=ub(Ea.current);if(pd(b)){d=b.stateNode;c=b.type;var f=b.memoizedProps;d[Da]=b;d[uc]=f;a=0!==(b.mode&1);switch(c){case "dialog":B("cancel",d);B("close",d);break;case "iframe":case "object":case "embed":B("load",d);break;
+case "video":case "audio":for(e=0;e\x3c/script>",a=a.removeChild(a.firstChild)):"string"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),"select"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Da]=b;a[uc]=d;zk(a,b,!1,!1);b.stateNode=a;a:{g=qe(c,d);switch(c){case "dialog":B("cancel",a);B("close",a);e=d;break;case "iframe":case "object":case "embed":B("load",a);e=d;break;
+case "video":case "audio":for(e=0;eHf&&(b.flags|=128,d=!0,Dc(f,!1),b.lanes=4194304)}else{if(!d)if(a=xd(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dc(f,!0),null===f.tail&&"hidden"===f.tailMode&&!g.alternate&&!D)return W(b),null}else 2*P()-f.renderingStartTime>Hf&&1073741824!==c&&(b.flags|=
+128,d=!0,Dc(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=b,f.tail=b.sibling,f.renderingStartTime=P(),b.sibling=null,c=F.current,y(F,d?c&1|2:c&1),b;W(b);return null;case 22:case 23:return ba=Ga.current,v(Ga),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(ba&1073741824)&&(W(b),b.subtreeFlags&6&&(b.flags|=8192)):W(b),null;case 24:return null;
+case 25:return null}throw Error(m(156,b.tag));}function Bk(a,b,c){Ve(b);switch(b.tag){case 1:return ea(b.type)&&(v(S),v(J)),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return Tb(),v(S),v(J),jf(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return hf(b),null;case 13:v(F);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(m(340));Qb()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return v(F),null;case 4:return Tb(),
+null;case 10:return cf(b.type._context),null;case 22:case 23:return ba=Ga.current,v(Ga),null;case 24:return null;default:return null}}function Wb(a,b){var c=a.ref;if(null!==c)if("function"===typeof c)try{c(null)}catch(d){G(a,b,d)}else c.current=null}function If(a,b,c){try{c()}catch(d){G(a,b,d)}}function Ck(a,b){Jf=Zc;a=ch();if(Ie(a)){if("selectionStart"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();
+if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(M){c=null;break a}var g=0,h=-1,k=-1,n=0,q=0,u=a,r=null;b:for(;;){for(var p;;){u!==c||0!==e&&3!==u.nodeType||(h=g+e);u!==f||0!==d&&3!==u.nodeType||(k=g+d);3===u.nodeType&&(g+=u.nodeValue.length);if(null===(p=u.firstChild))break;r=u;u=p}for(;;){if(u===a)break b;r===c&&++n===e&&(h=g);r===f&&++q===d&&(k=g);if(null!==(p=u.nextSibling))break;u=r;r=u.parentNode}u=p}c=-1===h||-1===k?null:
+{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Kf={focusedElem:a,selectionRange:c};Zc=!1;for(l=b;null!==l;)if(b=l,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,l=a;else for(;null!==l;){b=l;try{var x=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;case 1:if(null!==x){var v=x.memoizedProps,z=x.memoizedState,w=b.stateNode,A=w.getSnapshotBeforeUpdate(b.elementType===b.type?v:ya(b.type,v),z);w.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var t=
+b.stateNode.containerInfo;1===t.nodeType?t.textContent="":9===t.nodeType&&t.documentElement&&t.removeChild(t.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(m(163));}}catch(M){G(b,b.return,M)}a=b.sibling;if(null!==a){a.return=b.return;l=a;break}l=b.return}x=zi;zi=!1;return x}function Gc(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&If(b,c,f)}e=e.next}while(e!==d)}}
+function Id(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Lf(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}"function"===typeof b?b(a):b.current=a}}function Ai(a){var b=a.alternate;null!==b&&(a.alternate=null,Ai(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Da],delete b[uc],delete b[Me],delete b[Dk],
+delete b[Ek]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Bi(a){return 5===a.tag||3===a.tag||4===a.tag}function Ci(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Bi(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&
+2))return a.stateNode}}function Mf(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=kd));else if(4!==d&&(a=a.child,null!==a))for(Mf(a,b,c),a=a.sibling;null!==a;)Mf(a,b,c),a=a.sibling}function Nf(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);
+else if(4!==d&&(a=a.child,null!==a))for(Nf(a,b,c),a=a.sibling;null!==a;)Nf(a,b,c),a=a.sibling}function jb(a,b,c){for(c=c.child;null!==c;)Di(a,b,c),c=c.sibling}function Di(a,b,c){if(Ca&&"function"===typeof Ca.onCommitFiberUnmount)try{Ca.onCommitFiberUnmount(Uc,c)}catch(h){}switch(c.tag){case 5:X||Wb(c,b);case 6:var d=T,e=za;T=null;jb(a,b,c);T=d;za=e;null!==T&&(za?(a=T,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):T.removeChild(c.stateNode));break;case 18:null!==T&&(za?
+(a=T,c=c.stateNode,8===a.nodeType?Re(a.parentNode,c):1===a.nodeType&&Re(a,c),nc(a)):Re(T,c.stateNode));break;case 4:d=T;e=za;T=c.stateNode.containerInfo;za=!0;jb(a,b,c);T=d;za=e;break;case 0:case 11:case 14:case 15:if(!X&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?If(c,b,g):0!==(f&4)&&If(c,b,g));e=e.next}while(e!==d)}jb(a,b,c);break;case 1:if(!X&&(Wb(c,b),d=c.stateNode,"function"===typeof d.componentWillUnmount))try{d.props=
+c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){G(c,b,h)}jb(a,b,c);break;case 21:jb(a,b,c);break;case 22:c.mode&1?(X=(d=X)||null!==c.memoizedState,jb(a,b,c),X=d):jb(a,b,c);break;default:jb(a,b,c)}}function Ei(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Fk);b.forEach(function(b){var d=Gk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}function Aa(a,b,c){c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=P()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*Mk(d/1960))-d;if(10a?16:a;if(null===lb)var d=!1;else{a=lb;lb=null;Qd=0;if(0!==(p&6))throw Error(m(331));var e=p;p|=4;for(l=a.current;null!==l;){var f=l,g=f.child;if(0!==(l.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kP()-Of?wb(a,0):Sf|=c);ia(a,b)}function Ti(a,b){0===b&&(0===(a.mode&1)?b=1:(b=Rd,Rd<<=1,0===(Rd&130023424)&&(Rd=4194304)));var c=Z();a=Oa(a,b);null!==a&&(ic(a,b,c),ia(a,c))}function vk(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Ti(a,c)}function Gk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);
+break;case 19:d=a.stateNode;break;default:throw Error(m(314));}null!==d&&d.delete(b);Ti(a,c)}function Mi(a,b){return xh(a,b)}function Tk(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function yf(a){a=
+a.prototype;return!(!a||!a.isReactComponent)}function Uk(a){if("function"===typeof a)return yf(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===ie)return 11;if(a===je)return 14}return 2}function eb(a,b){var c=a.alternate;null===c?(c=pa(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=
+a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}function rd(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)yf(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case Bb:return sb(c.children,e,f,b);case fe:g=8;e|=8;break;case ee:return a=pa(12,c,b,e|2),a.elementType=ee,a.lanes=f,a;case ge:return a=
+pa(13,c,b,e),a.elementType=ge,a.lanes=f,a;case he:return a=pa(19,c,b,e),a.elementType=he,a.lanes=f,a;case Ui:return Gd(c,e,f,b);default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case hg:g=10;break a;case gg:g=9;break a;case ie:g=11;break a;case je:g=14;break a;case Ta:g=16;d=null;break a}throw Error(m(130,null==a?a:typeof a,""));}b=pa(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function sb(a,b,c,d){a=pa(7,a,d,b);a.lanes=c;return a}function Gd(a,b,c,d){a=pa(22,a,d,b);a.elementType=
+Ui;a.lanes=c;a.stateNode={isHidden:!1};return a}function Ze(a,b,c){a=pa(6,a,null,b);a.lanes=c;return a}function $e(a,b,c){b=pa(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}function Vk(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=
+0;this.eventTimes=we(0);this.expirationTimes=we(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=we(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=null}function Vf(a,b,c,d,e,f,g,h,k,l){a=new Vk(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=pa(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,
+pendingSuspenseBoundaries:null};ff(f);return a}function Wk(a,b,c){var d=3"+b.valueOf().toString()+"";for(b=Xd.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}}),Fc=function(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b},dc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,
+borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,
+strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},$k=["Webkit","ms","Moz","O"];Object.keys(dc).forEach(function(a){$k.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);dc[b]=dc[a]})});var ij=E({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ze=null,se=null,Eb=null,Fb=null,xg=function(a,b){return a(b)},yg=function(){},te=!1,Oe=!1;if(Ia)try{var Lc={};Object.defineProperty(Lc,
+"passive",{get:function(){Oe=!0}});window.addEventListener("test",Lc,Lc);window.removeEventListener("test",Lc,Lc)}catch(a){Oe=!1}var kj=function(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l)}catch(q){this.onError(q)}},gc=!1,Sc=null,Tc=!1,ue=null,lj={onError:function(a){gc=!0;Sc=a}},Ba=zb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler,Jg=Ba.unstable_scheduleCallback,Kg=Ba.unstable_NormalPriority,xh=Jg,Ki=Ba.unstable_cancelCallback,Pk=Ba.unstable_shouldYield,
+Sk=Ba.unstable_requestPaint,P=Ba.unstable_now,Dj=Ba.unstable_getCurrentPriorityLevel,De=Ba.unstable_ImmediatePriority,Mg=Ba.unstable_UserBlockingPriority,ad=Kg,Ej=Ba.unstable_LowPriority,Ng=Ba.unstable_IdlePriority,Uc=null,Ca=null,ta=Math.clz32?Math.clz32:pj,qj=Math.log,rj=Math.LN2,Wc=64,Rd=4194304,z=0,Ae=!1,Yc=[],Va=null,Wa=null,Xa=null,jc=new Map,kc=new Map,Ya=[],Bj="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "),
+Gb=Sa.ReactCurrentBatchConfig,Zc=!0,$c=null,Za=null,Ee=null,bd=null,Yb={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},He=ka(Yb),Mc=E({},Yb,{view:0,detail:0}),ak=ka(Mc),ag,bg,Nc,Yd=E({},Mc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fe,button:0,buttons:0,relatedTarget:function(a){return void 0===a.relatedTarget?a.fromElement===a.srcElement?a.toElement:a.fromElement:
+a.relatedTarget},movementX:function(a){if("movementX"in a)return a.movementX;a!==Nc&&(Nc&&"mousemove"===a.type?(ag=a.screenX-Nc.screenX,bg=a.screenY-Nc.screenY):bg=ag=0,Nc=a);return ag},movementY:function(a){return"movementY"in a?a.movementY:bg}}),ih=ka(Yd),al=E({},Yd,{dataTransfer:0}),Wj=ka(al),bl=E({},Mc,{relatedTarget:0}),Pe=ka(bl),cl=E({},Yb,{animationName:0,elapsedTime:0,pseudoElement:0}),Yj=ka(cl),dl=E({},Yb,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),
+ck=ka(dl),el=E({},Yb,{data:0}),qh=ka(el),fk=qh,fl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gl={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",
+112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"},hl=E({},Mc,{key:function(a){if(a.key){var b=fl[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=cd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?gl[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,
+metaKey:0,repeat:0,locale:0,getModifierState:Fe,charCode:function(a){return"keypress"===a.type?cd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===a.type?cd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),Vj=ka(hl),il=E({},Yd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nh=ka(il),jl=E({},Mc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,
+ctrlKey:0,shiftKey:0,getModifierState:Fe}),Xj=ka(jl),kl=E({},Yb,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zj=ka(kl),ll=E({},Yd,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),bk=ka(ll),Hj=[9,13,27,32],Ge=Ia&&"CompositionEvent"in window,Oc=null;Ia&&"documentMode"in document&&(Oc=document.documentMode);var ek=Ia&&"TextEvent"in
+window&&!Oc,Ug=Ia&&(!Ge||Oc&&8=Oc),Tg=String.fromCharCode(32),Sg=!1,Hb=!1,Kj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0},oc=null,pc=null,ph=!1;Ia&&(ph=Lj("input")&&(!document.documentMode||9=document.documentMode,Jb=null,Ke=null,rc=null,Je=!1,Kb={animationend:gd("Animation","AnimationEnd"),
+animationiteration:gd("Animation","AnimationIteration"),animationstart:gd("Animation","AnimationStart"),transitionend:gd("Transition","TransitionEnd")},Le={},eh={};Ia&&(eh=document.createElement("div").style,"AnimationEvent"in window||(delete Kb.animationend.animation,delete Kb.animationiteration.animation,delete Kb.animationstart.animation),"TransitionEvent"in window||delete Kb.transitionend.transition);var jh=hd("animationend"),kh=hd("animationiteration"),lh=hd("animationstart"),mh=hd("transitionend"),
+fh=new Map,Zi="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
+(function(){for(var a=0;a>>1,d=a[c];if(0>>1;cD(l,e))fD(g,l)?(a[c]=g,a[f]=e,c=f):(a[c]=l,a[h]=e,c=h);else if(fD(g,e))a[c]=g,a[f]=e,c=f;else break a}}return b}
+function D(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}function P(a){for(var b=p(r);null!==b;){if(null===b.callback)E(r);else if(b.startTime<=a)E(r),b.sortIndex=b.expirationTime,O(q,b);else break;b=p(r)}}function Q(a){z=!1;P(a);if(!u)if(null!==p(q))u=!0,R(S);else{var b=p(r);null!==b&&T(Q,b.startTime-a)}}function S(a,b){u=!1;z&&(z=!1,ea(A),A=-1);F=!0;var c=k;try{P(b);for(n=p(q);null!==n&&(!(n.expirationTime>b)||a&&!fa());){var m=n.callback;if("function"===typeof m){n.callback=null;
+k=n.priorityLevel;var d=m(n.expirationTime<=b);b=v();"function"===typeof d?n.callback=d:n===p(q)&&E(q);P(b)}else E(q);n=p(q)}if(null!==n)var g=!0;else{var h=p(r);null!==h&&T(Q,h.startTime-b);g=!1}return g}finally{n=null,k=c,F=!1}}function fa(){return v()-hae?(a.sortIndex=c,O(r,a),null===p(q)&&a===p(r)&&(z?(ea(A),A=-1):z=!0,T(Q,c-e))):(a.sortIndex=d,O(q,a),u||F||(u=!0,R(S)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=
+k;return function(){var c=k;k=b;try{return a.apply(this,arguments)}finally{k=c}}},unstable_getCurrentPriorityLevel:function(){return k},unstable_shouldYield:fa,unstable_requestPaint:function(){},unstable_continueExecution:function(){u||F||(u=!0,R(S))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return p(q)},get unstable_now(){return v},unstable_forceFrameRate:function(a){0>a||12514K=C8-Gk&c1F>}wI_xru`o>}+%JNMjsXMA_&UZ|x;
zto+rPd*^jO-{0??^E>B`S(^Qboni;sg+xoZ)aDqkFfX4-{oK-rUuxE
zkyybj*xBdUW$bJ=;yITs8^YsZFT3gDadz{^#@J1!yi#LE`<`{9^En(tw&VAr4P8>$
z3OaW&F`moL8X{(5XHUQlm^Ab~_W2LbunjM$%v%gFZyL%-W&Z?}I|IsstwfB(O3Z@&
zckH{vr;s3jV5?RInQ}^FzQfQljVZ@TT-OPysV<%D(zK>)#*%MVYR(X6KEG5zm!hII
z#7TIshS!pUx)f?dQej<6n4^Uvx|FCcA1Ow{YvOn--h;+R9y$84oV&B(qXRah}0i(ArQ6Rqf*B>48?1YBLbuocx-42$0V5OBTeJ=
zQob3fSsat*xHM4}@=_a+QgwN`DvVShpN994f_MxmA&&QeaRIDb!7SL>FW9Y1>0mGW
z0U1!ii+4kZxP;|Gc2E_f7VaJ;;R}vw5C7sF7
zW(=f*8X04Psw4uH8H00BPsT)Wj#CDJ^*%5QcD93k-7w((ZUgM_mH`&LBH^i3M5G0{
zgf}GMAv?U!jC3!&BBHGUo|EkGkRl8);JF>%>M}Y!bq^RYP6kj05WCHQDlTe|gttXs
zB~gk)8e~NN%)(3Q;63nMMxNl+#o^I<2^>QFjq}pDpqxyc{Go6JCkZ>tTRn2J9v9(<4vdr@R
z1Nb4u7I^{Q3$Jyyhfkz>F@peJntUxhLyPhTQi-x{iTF}Z?qT8KRl*$h0X8e{A{(K
z50Cf4pEk|me4oe*a0^~WUT?i*K-i4|e;{yMSaRyiFRiK;=V-{*v)Qkq7u9@Q{GE(mtWL3KX%b&)2&0UmpWHMVx~XG!|s;
zcqO9_k7)t6mg6%*m?BMhv^u;80`vfQ$b!eY6pmdPaDcmoA5y0I5(VI6BJzkBz!d_Y
z<(|=*09!pByW!DLeP6gLAj^$T=G!kPtFQa#>A1=B%_h$^#V~LzQBQsIH>p;<+@j|i
zCsK{X7oSKXb2QbnKBO&~2xAtB;Ik?1g|wmZC}s^xd0XUr;e8}BAnIg5gA9OC32^?o
zsWOaH18h_++_O7R=Tf&ln+mXXytrjwaiQK4nNfLZrV{z&{V|vs;+_p*d`FlM`=Y^f
zHpTGT2o&WWOmTMjWH&srB~6*)v>1W`-h%^5TMM48n+jjKEl~Nd*-|S}Znnb3W^voT
zZ0N$f0=ad&Qiyh&0BXB~mDu&$LjagnmyY@yC({iwBz(m-oLjHL1g>2$8EhxYtq#&Z
z_-C6!ezuYmbmhgFiZNpp?%7ieUa&ca&n{pZZQ=Fp>YKbCyuHYk((l
z-GCSvoeh9a*w*r9f2WimJsG;>o;jmW8*@2Sf&D!VhtN5(<{w28leJk>anY{*)nV+@$)
z*fHPeL_Yms8fM1PB}L@z@JbrWI2o`_8gOV(X^RV<_Ol;O74F`hp$kB&cI0So&gZ2^
z4;A?E7@*f+{-2<-HW0k%F0E6nw_#dKJAb1_k;mX^PIE9dSl=J1)BB^>JrKunNE?}m
zz>E+E(Qw}PrapT#+Y9ClBD+cXsbf_?yEBe4Xi<0#!nq81;w}vE9U|aNzoCIU)~uH(Bfw4go@T5{i_EfVm#Ozs!_j3}<3Iv4LSJ~aS(gTQ57XXVzv>QC4=re>
zqt`vCb!yFygtww`Bwpjg3a#S<=#ykXpt>s{2D8}TJ{rR@$A#Jp91rc=Z3u-g+Y+Np
zYR;sa{4AQ^p&=zkqkZM2>DuX8K*#YFzs%!v6DYU_z$=h1>BfK~j-~C8A_|YzSbc(3iB!72XWwnlxC!m@o!54b#f#7ma>SL8oKn}&;rh*i!}N2adQ)6@UE@g#PH~S
zzWNr|r^UbCo`Jb>zI0;373#q*{Lba7m2j|ME-<=V?*nxNFNr>qWXNajNbBE~Y**0<#A)Kp2oH
zJ**oLzH}QIkVXao+Pi4vRfyp6xBxbH22dYg44!xG+S2|V2Btu-0qazn=3<|FBqo=)
zRm>O~UfU0TvF$4oikgW8rGDuVJ>8RE`*ne)I@AlvE(3D90iw?X+8%icuNwe^oD68I
zv^w(%T-zn8Qp^NVl
zg$>f*<*uy-FO}rRa`r55syUr*QQ@PVKbgUTNgo6+yC0AnGWZS|b;u51BzT-F@po+i
zz@eVV6Eq1aN(OLs`50elV#tgD{sxOOF)iCV=+U>5b1+R9m=uq8JzfbwE`&aQH)TK;>l3tgc#?#Nd?hI7Xn@@G^xM*2MqU*y;E@5;=aaWQ
zlU(Sabk*`riad698hokTvi9ikQc+}r6?xkZjugPHMU7CJra6oyX{!0D3~o%N#I8~1
z_Lt`|24q!_SHP=_MIO=s50zaQFy4{NU@P)c-8Uy84e8EHJM^h;p<}HC3-`WLkkOBH
z!}IqFj{*mumBDzDN`L!>vfNQN*B+Hu=9+w|nB)7yLwHOEg|VQ3aj6HMOL$F(pN9%A4Dd|}@IF6C
zfB``mz_BXpF`)Za7xo8Rjl=OqD_CfeV1ygBdlZ0pzKyN5cH>yGg}ubKk^0ha%YZ$h
zRzMm+qkS(t1bCMQj4#lp=fEE%U^$D@R!iUdT-w~CY7#XhF9?xqCRRL|p+yZzj`(KU
z%XBxCB$lW<(2
z%y7y87~rKn0PggI1oX>bdB@>$cPe%&jSlwbD(!5wElc5ARP}-7tY3eDK1}cy2Xz
zZc*3_Z%pa~-kM|pqR7)oPw*H#(^TDMzV%|covR91)c*D0hd1Z(*}3p#+lsmMZ`2A~
z_tlgCyt9HkNPr*f3$I!5RdAG?4G_y3Y#K8DndQq*IA
z^RrBSe^lSn&Q>~^@4Qk}hrMJ{B6Q*Abn2F8im9(YTMU2n-YkqrLFxEsA1hFwr}toq
z-HcrQKoQ1ekwJNs#swPeXvBvKs6&d}L(q13O~Pvu-mL+rXesRG2MJuXUH~gmM2|$v
zSnBK4(rQjDX>s=`p8D6{6tEpGx<&m^teIW;TFE#z_V%;ie{~*rlIrrFLOc1Tr^^7$
zq29<5IJykrz4|~mJV7dT_jw84+vg>`R1G|37Y2A|02=(i{vbhL(kcn0yx7Fh&fS>8
z{r~xeM$4Ku+Z|mCW(~2BTlYpqUFywYP|IQ)EDy;d$6nfMr;YTsw6`K(!?9}vW}SYJ
zpt-*%57A&Zk;47FlM4@z-yEp@@JA35qXf1EkFP9Am{iQa>k4T9U1_b)WVYxKsnzT5&3b$N+!e
zU0ZiQNJ#d;L*{MpgJ{lRZ5e3=jMUIDL?Ecm{qEx~h_@EoG&
z2N|$c8W7+PyS9Dcll|Zc9G_#}tUxAYF&@xXH`;YMN_*@t^nveR+G_6t9`9+oG{6@i
z@Ikw_IPM#H%??j>y=~VP{XAz(bGVmK=mYOm+Exemc?(_|P;)Rqi~*{vU0Xm)^}8o;
zraW56ao5&9$0PCsO4|XER}A>31+TQo05@GgrIdHrwRHs#*&?r!9QN+qm$nwXYKNC;
zFX172-i-m=?XInAO><7Sr6H$XTM6&Jw1s*juS$4=?uOTN_;!~8TWkjGkp{?>V9cKO
zfRMG!vRKz(_Nl5l%sd>ok%TiTR
z5Rud@)$tlgX>_UCrIu8i#PzmAqUF41>6F=8k6XkD)-_-j?Cf^-Sr21u=@;1*A3Ms{
zzT#)z@*Eq>L3sxijQ0OoMVBgoZJrp3m6!$l66Rq;%rlJk?DN>!AG(QM^_Tz1uDN~%
zyXrG5*wqfY%8>K1rR&d>ZZcbE-OR4O{zi7?wZurQl9{o8V3#xcyM|pfd@Z~9Y&=|s
z)63DG^L~0;--t)e.removeChild(e.firstChild);return e}function n(e,n){return t(e).appendChild(n)}function r(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}function f(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function h(e){for(;Qa.length<=e;)Qa.push(m(Qa)+" ");return Qa[e]}function m(e){return e[e.length-1]}function g(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ka.test(e))}function C(e,t){return t?!!(t.source.indexOf("\\w")>-1&&x(e))||t.test(e):x(e)}function E(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function D(e){return e.charCodeAt(0)>=768&&Ja.test(e)}function w(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function k(e,t,n){var o=this;this.input=n,o.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=r("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=i("div",null,"CodeMirror-code"),o.selectionDiv=r("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=r("div",null,"CodeMirror-cursors"),o.measure=r("div",null,"CodeMirror-measure"),o.lineMeasure=r("div",null,"CodeMirror-measure"),o.lineSpace=i("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=i("div",[o.lineSpace],"CodeMirror-lines");o.mover=r("div",[a],null,"position: relative"),o.sizer=r("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=r("div",null,null,"position: absolute; height: "+Ga+"px; width: 1px;"),o.gutters=r("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=r("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=r("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),ba&&xa<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Ca||ma&&Oa||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function A(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?P(n,A(e,n).text.length):G(t,A(e,t.line).text.length)}function G(e,t){var n=e.ch;return null==n||n>t?P(e.line,t):n<0?P(e.line,0):e}function V(e,t){for(var n=[],r=0;r=t:o.to>t);(r||(r=[])).push(new W(a,o.from,u?null:o.to))}}return r}function X(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var u=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var C=0;C0)){var l=[u,1],p=M(c.from,s.from),d=M(c.to,s.to);(p<0||!a.inclusiveLeft&&!p)&&l.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&l.push({from:s.to,to:c.to}),i.splice.apply(i,l),u+=l.length-3}}return i}function ne(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!n||ae(n,o.marker)<0)&&(n=o.marker)}return n}function pe(e,t,n,r,i){var o=A(e,t),a=Xa&&o.markedSpans;if(a)for(var s=0;s=0&&p<=0||l<=0&&p>=0)&&(l<=0&&(u.marker.inclusiveRight&&i.inclusiveLeft?M(c.to,n)>=0:M(c.to,n)>0)||l>=0&&(u.marker.inclusiveRight&&i.inclusiveLeft?M(c.from,r)<=0:M(c.from,r)<0)))return!0}}}function fe(e){for(var t;t=ue(e);)e=t.find(-1,!0).line;return e}function de(e){for(var t;t=ce(e);)e=t.find(1,!0).line;return e}function he(e){for(var t,n;t=ce(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function me(e,t){var n=A(e,t),r=fe(n);return n==r?t:F(r)}function ge(e,t){if(t>e.lastLine())return t;var n,r=A(e,t);if(!ye(e,r))return t;for(;n=ce(r);)r=n.find(1,!0).line;return F(r)+1}function ye(e,t){var n=Xa&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function Ee(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}function De(e,t,n){var r;Za=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Za=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Za=i)}return null!=r?r:Za}function we(e,t){var n=e.order;return null==n&&(n=e.order=es(e.text,t)),n}function Se(e,t){return e._handlers&&e._handlers[t]||ts}function ke(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=f(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ae(e,t){var n=Se(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Fe(e){e.prototype.on=function(e,t){ns(this,e,t)},e.prototype.off=function(e,t){ke(this,e,t)}}function Ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Le(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Pe(e){Ne(e),Ie(e)}function Me(e){return e.target||e.srcElement}function je(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Fa&&e.ctrlKey&&1==t&&(t=3),t}function Re(e){if(null==Ua){var t=r("span","\u200b");n(e,r("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ua=t.offsetWidth<=1&&t.offsetHeight>2&&!(ba&&xa<8))}var i=Ua?r("span","\u200b"):r("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Be(e){if(null!=za)return za;var r=n(e,document.createTextNode("A\u062eA")),i=Pa(r,0,1).getBoundingClientRect(),o=Pa(r,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(za=o.right-i.right<3)}function $e(e){if(null!=ss)return ss;var t=n(e,r("span","x")),i=t.getBoundingClientRect(),o=Pa(t,0,1).getBoundingClientRect();return ss=Math.abs(i.left-o.left)>1}function Ue(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),us[e]=t}function ze(e,t){cs[e]=t}function Ge(e){if("string"==typeof e&&cs.hasOwnProperty(e))e=cs[e];else if(e&&"string"==typeof e.name&&cs.hasOwnProperty(e.name)){var t=cs[e.name];"string"==typeof t&&(t={name:t}),e=b(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ge("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ge("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ve(e,t){t=Ge(t);var n=us[t.name];if(!n)return Ve(e,"text/plain");var r=n(e,t);if(ls.hasOwnProperty(t.name)){var i=ls[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}function qe(e,t){l(t,ls.hasOwnProperty(e)?ls[e]:ls[e]={})}function He(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function We(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Qe(e,t,n){return!e.startState||e.startState(t,n)}function Ke(e,t,n,r){var i=[e.state.modeGen],o={};rt(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,s=0;se&&i.splice(u,1,e,i[u+1],r),u+=2,c=Math.min(e,r)}if(t)if(s.opaque)i.splice(n,u-n,e,"overlay "+t),u=n+2;else for(;ne.options.maxHighlightLength&&He(e.doc.mode,r.state),o=Ke(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ye(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ds(r,!0,t);var o=it(e,t,n),a=o>r.first&&A(r,o-1).stateAfter,s=a?ds.fromSaved(r,a,o):new ds(r,Qe(r.mode),o);return r.iter(o,t,function(n){Xe(e,n.text,s);var r=s.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function tt(e,t,n,r){var i,o=e.doc,a=o.mode;t=z(o,t);var s,u=A(o,t.line),c=Ye(e,t.line,n),l=new ps(u.text,e.options.tabSize,c);for(r&&(s=[]);(r||l.pose.options.maxHighlightLength?(s=!1,a&&Xe(e,t,r,p.pos),p.pos=t.length,u=null):u=nt(et(n,p,r.state,f),o),f){var d=f[0].name;d&&(u="m-"+(u?d+" "+u:d))}if(!s||l!=u){for(;ca;--s){if(s<=o.first)return o.first;var u=A(o,s-1),c=u.stateAfter;if(c&&(!n||s+(c instanceof fs?c.lookAhead:0)<=o.modeFrontier))return s;var l=p(u.text,null,e.options.tabSize);(null==i||r>l)&&(i=s-1,r=l)}return i}function ot(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=A(e,r).stateAfter;if(i&&(!(i instanceof fs)||r+i.lookAhead1&&!/ /.test(e))return e;for(var n=t,r="",i=0;ic&&p.from<=c));f++);if(p.to>=l)return e(n,r,i,o,a,s,u);e(n,r.slice(0,p.to-c),i,o,null,s,u),o=null,r=r.slice(p.to-c),c=p.to}}}function ht(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function mt(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,u,c,l,p,f,d=i.length,h=0,m=1,g="",y=0;;){if(y==h){u=c=l=p=s="",f=null,y=1/0;for(var v=[],b=void 0,x=0;xh||E.collapsed&&C.to==h&&C.from==h)?(null!=C.to&&C.to!=h&&y>C.to&&(y=C.to,c=""),E.className&&(u+=" "+E.className),E.css&&(s=(s?s+";":"")+E.css),E.startStyle&&C.from==h&&(l+=" "+E.startStyle),E.endStyle&&C.to==y&&(b||(b=[])).push(E.endStyle,C.to),E.title&&!p&&(p=E.title),E.collapsed&&(!f||ae(f.marker,E)<0)&&(f=C)):C.from>h&&y>C.from&&(y=C.from)}if(b)for(var D=0;D=d)break;for(var S=Math.min(d,y);;){if(g){var k=h+g.length;if(!f){var A=k>S?g.slice(0,S-h):g;t.addToken(t,A,a?a+u:u,l,h+A.length==y?c:"",p,s)}if(k>=S){g=g.slice(S-h),h=S;break}h=k,l=""}g=i.slice(o,o=n[m++]),a=ut(n[m++],t.cm.options)}}else for(var _=1;_2&&o.push((u.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Vt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function qt(e,t){t=fe(t);var r=F(t),i=e.display.externalMeasured=new gt(e.doc,t,r);i.lineN=r;var o=i.built=ct(e,i);return i.text=o.pre,n(e.display.lineMeasure,o.pre),i}function Ht(e,t,n,r){return Kt(e,Qt(e,t),n,r)}function Wt(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=u-s,i=o-1,t>=u&&(a="right")),null!=i){if(r=e[c+2],s==u&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==u-s)for(;c=0&&(n=e[i]).left==n.right;i--);return n}function Xt(e,t,n,r){var i,o=Jt(t.map,n,r),a=o.node,s=o.start,u=o.end,c=o.collapse;if(3==a.nodeType){for(var l=0;l<4;l++){for(;s&&D(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+u0&&(c=r="right");var p;i=e.options.lineWrapping&&(p=a.getClientRects()).length>1?p["right"==r?p.length-1:0]:a.getBoundingClientRect()}if(ba&&xa<9&&!s&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+Cn(e.display),top:f.top,bottom:f.bottom}:Cs}for(var d=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(d+h)/2,g=t.view.measure.heights,y=0;y=r.text.length?(c=r.text.length,l="before"):c<=0&&(c=0,l="after"),!u)return a("before"==l?c-1:c,"before"==l);var p=De(u,c,l),f=Za,d=s(c,p,"before"==l);return null!=f&&(d.other=s(c,f,"before"!=l)),d}function pn(e,t){var n=0;t=z(e.doc,t),e.options.lineWrapping||(n=Cn(e.display)*t.ch);var r=A(e.doc,t.line),i=be(r)+jt(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function fn(e,t,n,r,i){var o=P(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function dn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return fn(r.first,0,null,!0,-1);var i=N(r,n),o=r.first+r.size-1;if(i>o)return fn(r.first+r.size-1,A(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=A(r,i);;){var s=yn(e,a,i,t,n),u=le(a,s.ch+(s.xRel>0?1:0));if(!u)return s;var c=u.find(1);if(c.line==i)return c;a=A(r,i=c.line)}}function hn(e,t,n,r){r-=an(t);var i=t.text.length,o=S(function(t){return Kt(e,n,t-1).bottom<=r},i,0);return i=S(function(t){return Kt(e,n,t).top>r},o,i),{begin:o,end:i}}function mn(e,t,n,r){return n||(n=Qt(e,t)),hn(e,t,n,sn(e,t,Kt(e,n,r),"line").top)}function gn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function yn(e,t,n,r,i){i-=be(t);var o=Qt(e,t),a=an(t),s=0,u=t.text.length,c=!0,l=we(t,e.doc.direction);if(l){var p=(e.options.lineWrapping?bn:vn)(e,t,n,o,l,r,i);c=1!=p.level,s=c?p.from:p.to-1,u=c?p.to:p.from-1}var f,d,h=null,m=null,g=S(function(t){var n=Kt(e,o,t);return n.top+=a,n.bottom+=a,!!gn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(h=t,m=n),!0)},s,u),y=!1;if(m){var v=r-m.left=x.bottom}return g=w(t.text,g,1),fn(n,g,d,y,r-f)}function vn(e,t,n,r,i,o,a){var s=S(function(s){var u=i[s],c=1!=u.level;return gn(ln(e,P(n,c?u.to:u.from,c?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),u=i[s];if(s>0){var c=1!=u.level,l=ln(e,P(n,c?u.from:u.to,c?"after":"before"),"line",t,r);gn(l,o,a,!0)&&l.top>a&&(u=i[s-1])}return u}function bn(e,t,n,r,i,o,a){var s=hn(e,t,r,a),u=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var l=null,p=null,f=0;f=c||d.to<=u)){var h=1!=d.level,m=Kt(e,r,h?Math.min(c,d.to)-1:Math.max(u,d.from)).right,g=mg)&&(l=d,p=g)}}return l||(l=i[i.length-1]),l.fromc&&(l={from:l.from,to:c,level:l.level}),l}function xn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==gs){gs=r("pre");for(var i=0;i<49;++i)gs.appendChild(document.createTextNode("x")),gs.appendChild(r("br"));gs.appendChild(document.createTextNode("x"))}n(e.measure,gs);var o=gs.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function Cn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=r("span","xxxxxxxxxx"),i=r("pre",[t]);n(e.measure,i);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function En(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:Dn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Dn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function wn(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Cn(e.display)-3);return function(i){if(ye(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r=e.display.viewTo||s.to().line0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ln(e){e.state.focused||(e.display.input.focus(),Mn(e))}function Pn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,jn(e))},100)}function Mn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ae(e,"focus",e,t),e.state.focused=!0,s(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),Ca&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),In(e))}function jn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ae(e,"blur",e,t),e.state.focused=!1,Ra(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Rn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||u<-.005)&&(O(i.line,o),Bn(i.line),i.rest))for(var c=0;c=a&&(o=N(t,be(A(t,u))-e.wrapper.clientHeight),a=u)}return{from:o,to:Math.max(a,o+1)}}function Un(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Dn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Aa){var a=r("div","\u200b",null,"position: absolute;\n top: "+(t.top-n.viewOffset-jt(e.display))+"px;\n height: "+(t.bottom-t.top+$t(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(o),e.display.lineSpace.removeChild(a)}}}function Vn(e,t,n,r){null==r&&(r=0);var i;e.options.lineWrapping||t!=n||(t=t.ch?P(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?P(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,s=ln(e,t),u=n&&n!=t?ln(e,n):s;i={left:Math.min(s.left,u.left),top:Math.min(s.top,u.top)-r,right:Math.max(s.left,u.left),bottom:Math.max(s.bottom,u.bottom)+r};var c=Hn(e,i),l=e.doc.scrollTop,p=e.doc.scrollLeft;if(null!=c.scrollTop&&(Zn(e,c.scrollTop),Math.abs(e.doc.scrollTop-l)>1&&(a=!0)),null!=c.scrollLeft&&(tr(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(a=!0)),!a)break}return i}function qn(e,t){var n=Hn(e,t);null!=n.scrollTop&&Zn(e,n.scrollTop),null!=n.scrollLeft&&tr(e,n.scrollLeft)}function Hn(e,t){var n=e.display,r=xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=zt(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Rt(n),u=t.tops-r;if(t.topi+o){var l=Math.min(t.top,(c?s:t.bottom)-o);l!=i&&(a.scrollTop=l)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=Ut(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),d=t.right-t.left>f;return d&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.leftf+p-3&&(a.scrollLeft=t.right+(d?0:10)-f),a}function Wn(e,t){null!=t&&(Yn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Qn(e){Yn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Kn(e,t,n){null==t&&null==n||Yn(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Jn(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;Xn(e,pn(e,t.from),pn(e,t.to),t.margin)}}function Xn(e,t,n,r){var i=Hn(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Kn(e,i.scrollLeft,i.scrollTop)}function Zn(e,t){Math.abs(e.doc.scrollTop-t)<2||(ma||Fr(e,{top:t}),er(e,t,!0),ma&&Fr(e),wr(e,100))}function er(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function tr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Un(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function nr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Rt(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+$t(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function rr(e,t){t||(t=nr(e));var n=e.display.barWidth,r=e.display.barHeight;ir(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Rn(e),ir(e,nr(e)),n=e.display.barWidth,r=e.display.barHeight}function ir(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function or(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Ra(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ws[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ns(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?tr(e,t):Zn(e,t)},e),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)}function ar(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ss},vt(e.curOp)}function sr(e){xt(e.curOp,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ks(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function lr(e){e.updatedDisplay=e.mustUpdate&&Tr(e.cm,e.update)}function pr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Rn(t),e.barMeasure=nr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ht(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+$t(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ut(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function fr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeftt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Xa&&me(e.doc,t)i.viewFrom?xr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)xr(e);else if(t<=i.viewFrom){var o=Cr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):xr(e)}else if(n>=i.viewTo){var a=Cr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):xr(e)}else{var s=Cr(e,t,t,-1),u=Cr(e,n,n+r,1);s&&u?(i.view=i.view.slice(0,s.index).concat(yt(e,s.lineN,u.lineN)).concat(i.view.slice(u.index)),i.viewTo+=r):xr(e)}var c=i.externalMeasured;c&&(n=i.lineN&&t=r.viewTo)){var o=r.view[An(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==f(a,n)&&a.push(n)}}}function xr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Cr(e,t,n,r){var i,o=An(e,t),a=e.display.view;if(!Xa||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,u=0;u0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;me(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Er(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=yt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=yt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,An(e,n)))),r.viewTo=n}function Dr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Ye(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?He(t.mode,r.state):null,u=Ke(e,o,r,!0);s&&(r.state=s),o.styles=u.styles;var c=o.styleClasses,l=u.classes;l?o.styleClasses=l:c&&(o.styleClasses=null);for(var p=!a||a.length!=o.styles.length||c!=l&&(!c||!l||c.bgClass!=l.bgClass||c.textClass!=l.textClass),f=0;!p&&fn)return wr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&hr(e,function(){for(var t=0;t=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Dr(e))return!1;zn(e)&&(xr(e),n.dims=En(e));var o=i.first+i.size,a=Math.max(n.visible.from-e.options.viewportMargin,i.first),s=Math.min(o,n.visible.to+e.options.viewportMargin);r.viewFroms&&r.viewTo-s<20&&(s=Math.min(o,r.viewTo)),Xa&&(a=me(e.doc,a),s=ge(e.doc,s));var u=a!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;Er(e,a,s),r.viewOffset=be(A(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var c=Dr(e);if(!u&&0==c&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var l=Ar(e);return c>4&&(r.lineDiv.style.display="none"),Nr(e,r.updateLineNumbers,n.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,_r(l),t(r.cursorDiv),t(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,u&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,wr(e,400)),r.updateLineNumbers=null,!0}function Or(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ut(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Rt(e.display)-zt(e),n.top)}),t.visible=$n(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&Tr(e,t);r=!1){Rn(e);var i=nr(e);_n(e),rr(e,i),Lr(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Fr(e,t){var n=new ks(e,t);if(Tr(e,n)){Rn(e),Or(e,n);var r=nr(e);_n(e),rr(e,r),Lr(e,r),n.finish()}}function Nr(e,n,r){function i(t){var n=t.nextSibling;return Ca&&Fa&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var o=e.display,a=e.options.lineNumbers,s=o.lineDiv,u=s.firstChild,c=o.view,l=o.viewFrom,p=0;p-1&&(h=!1),Dt(e,d,l,r)),h&&(t(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(L(e.options,l)))),u=d.node.nextSibling}else{var m=Ft(e,d,l,r);s.insertBefore(m,u)}l+=d.size}for(;u;)u=i(u)}function Ir(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Lr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+$t(e)+"px"}function Pr(e){var n=e.display.gutters,i=e.options.gutters;t(n);for(var o=0;o-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function jr(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Rr(e){var t=jr(e);return t.x*=_s,t.y*=_s,t}function Br(e,t){var n=jr(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,u=a.scrollHeight>a.clientHeight;if(r&&s||i&&u){if(i&&Fa&&Ca)e:for(var c=t.target,l=o.view;c!=a;c=c.parentNode)for(var p=0;p=0){var a=$(o.from(),i.from()),s=B(o.to(),i.to()),u=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new Os(u?s:a,u?a:s))}}return new Ts(e,t)}function Ur(e,t){return new Ts([new Os(e,t||e)],0)}function zr(e){return e.text?P(e.from.line+e.text.length-1,m(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Gr(e,t){if(M(e,t.from)<0)return e;if(M(e,t.to)<=0)return zr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=zr(t).ch-t.to.ch),P(n,r)}function Vr(e,t){for(var n=[],r=0;r1&&e.remove(s.line+1,h-1),e.insert(s.line+1,v)}Ct(e,"change",e,t)}function Yr(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges?(e.done.pop(),m(e.done)):void 0}function oi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=ii(i,i.lastOp==r)))a=m(o.changes),0==M(t.from,t.to)&&0==M(t.from,a.to)?a.to=zr(t):o.changes.push(ni(e,t));else{var u=m(i.done);for(u&&u.ranges||ui(e.sel,i.done),o={changes:[ni(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||Ae(e,"historyAdded")}function ai(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function si(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ai(e,o,m(i.done),t))?i.done[i.done.length-1]=t:ui(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&ri(i.undone)}function ui(e,t){var n=m(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ci(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function li(e){if(!e)return null;for(var t,n=0;n-1&&(m(s)[p]=c[p],delete c[p])}}}return r}function hi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=M(t,i)<0;o!=M(n,i)<0?(i=t,t=n):o!=M(t,n)<0&&(t=n)}return new Os(i,t)}return new Os(n||t,t)}function mi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ci(e,new Ts([hi(e.sel.primary(),t,n,i)],0),r)}function gi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(i&&(Ae(u,"beforeCursorEnter"),u.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!u.atomic)continue;if(n){var c=u.find(r<0?1:-1),l=void 0;if((r<0?u.inclusiveRight:u.inclusiveLeft)&&(c=_i(e,c,-r,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(l=M(c,n))&&(r<0?l<0:l>0))return ki(e,c,t,r,i)}var p=u.find(r<0?-1:1);return(r<0?u.inclusiveLeft:u.inclusiveRight)&&(p=_i(e,p,r,p.line==t.line?o:null)),p?ki(e,p,t,r,i):null}}return t}function Ai(e,t,n,r,i){var o=r||1,a=ki(e,t,n,o,i)||!i&&ki(e,t,n,o,!0)||ki(e,t,n,-o,i)||!i&&ki(e,t,n,-o,!0);return a||(e.cantEdit=!0,P(e.first,0))}function _i(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?z(e,P(t.line-1)):null:n>0&&t.ch==(r||A(e,t.line)).text.length?t.line=0;--i)Ni(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ni(e,t)}}function Ni(e,t){if(1!=t.text.length||""!=t.text[0]||0!=M(t.from,t.to)){var n=Vr(e,t);oi(e,t,n,e.cm?e.cm.curOp.id:NaN),Pi(e,t,n,Z(e,t));var r=[];Yr(e,function(e,n){n||-1!=f(r,e.history)||($i(e.history,t),r.push(e.history)),Pi(e,t,null,Z(e,t))})}}function Ii(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,s="undo"==t?o.done:o.undone,u="undo"==t?o.undone:o.done,c=0;c=0;--d){var h=function(n){var r=i.changes[n];if(r.origin=t,p&&!Oi(e,r,!1))return s.length=0,{};l.push(ni(e,r));var o=n?Vr(e,r):m(s);Pi(e,r,o,fi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:zr(r)});var a=[];Yr(e,function(e,t){t||-1!=f(a,e.history)||($i(e.history,r),a.push(e.history)),Pi(e,r,null,fi(e,r))})}(d);if(h)return h.v}}}}function Li(e,t){if(0!=t&&(e.first+=t,e.sel=new Ts(g(e.sel.ranges,function(e){return new Os(P(e.anchor.line+t,e.anchor.ch),P(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){vr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:P(o,A(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=_(e,t.from,t.to),n||(n=Vr(e,t)),e.cm?Mi(e.cm,t,r):Jr(e,t,r),Ei(e,n,qa)}}function Mi(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,u=o.line;e.options.lineWrapping||(u=F(fe(A(r,o.line))),r.iter(u,a.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Te(e),Jr(r,t,n,wn(e)),e.options.lineWrapping||(r.iter(u,o.line+t.text.length,function(e){var t=xe(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),ot(r,o.line),wr(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?vr(e):o.line!=a.line||1!=t.text.length||Kr(e.doc,t)?vr(e,o.line,a.line+1,c):br(e,o.line,"text");var l=Oe(e,"changes"),p=Oe(e,"change");if(p||l){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};p&&Ct(e,"change",e,f),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function ji(e,t,n,r,i){if(r||(r=n),M(r,n)<0){var o;o=[r,n],n=o[0],r=o[1]}"string"==typeof t&&(t=e.splitLines(t)),Fi(e,{from:n,to:r,text:t,origin:i})}function Ri(e,t,n,r){n0||0==s&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=i("span",[a.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(pe(e,t.line,t,n,a)||t.line!=n.line&&pe(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");H()}a.addToHistory&&oi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u,c=t.line,p=e.cm;if(e.iter(c,n.line+1,function(e){p&&a.collapsed&&!p.options.lineWrapping&&fe(e)==p.display.maxLine&&(u=!0),a.collapsed&&c!=t.line&&O(e,0),J(e,new W(a,c==t.line?t.ch:null,c==n.line?n.ch:null)),++c}),a.collapsed&&e.iter(t.line,n.line+1,function(t){ye(e,t)&&O(t,0)}),a.clearOnEnter&&ns(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(q(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Ns,a.atomic=!0),p){if(u&&(p.curOp.updateMaxLine=!0),a.collapsed)vr(p,t.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var f=t.line;f<=n.line;f++)br(p,f,"text");a.atomic&&wi(p.doc),Ct(p,"markerAdded",p,a)}return a}function Wi(e,t,n,r,i){r=l(r),r.shared=!1;var o=[Hi(e,t,n,r,i)],a=o[0],s=r.widgetNode;return Yr(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(Hi(e,z(e,t),z(e,n),r,i));for(var u=0;u-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),Ei(t.doc,Ur(n,n)),c)for(var l=0;l=0;t--)ji(e.doc,"",r[t].from,r[t].to,"+delete");Qn(e)})}function ho(e,t,n){var r=w(e.text,t+n,n);return r<0||r>e.text.length?null:r}function mo(e,t,n){var r=ho(e,t.ch,n);return null==r?null:new P(t.line,r,n<0?"after":"before")}function go(e,t,n,r,i){if(e){var o=we(n,t.doc.direction);if(o){var a,s=i<0?m(o):o[0],u=i<0==(1==s.level),c=u?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var l=Qt(t,n);a=i<0?n.text.length-1:0;var p=Kt(t,l,a).top;a=S(function(e){return Kt(t,l,e).top==p},i<0==(1==s.level)?s.from:s.to-1,a),"before"==c&&(a=ho(n,a,1))}else a=i<0?s.to:s.from;return new P(r,a,c)}}return new P(r,i<0?n.text.length:0,i<0?"before":"after")}function yo(e,t,n,r){var i=we(t,e.doc.direction);if(!i)return mo(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=De(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&f>=l.begin)){var d=p?"before":"after";return new P(n.line,f,d)}}var h=function(e,t,r){for(var o=function(e,t){return t?new P(n.line,u(e,1),"before"):new P(n.line,e,"after")};e>=0&&e0==(1!=a.level),c=s?r.begin:u(r.end,-1);if(a.from<=c&&c0?l.end:u(l.begin,-1);return null==g||r>0&&g==t.text.length||!(m=h(r>0?0:i.length-1,r,c(g)))?null:m}function vo(e,t){var n=A(e.doc,t),r=fe(n);return r!=n&&(t=F(r)),go(!0,e,r,t,1)}function bo(e,t){var n=A(e.doc,t),r=de(n);return r!=n&&(t=F(r)),go(!0,e,n,t,-1)}function xo(e,t){var n=vo(e,t.line),r=A(e.doc,n.line),i=we(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return P(n.line,a?0:o,n.sticky)}return n}function Co(e,t,n){if("string"==typeof t&&!(t=Vs[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Va}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Eo(e,t,n){for(var r=0;r-1&&(M((i=s.ranges[i]).from(),t)<0||t.xRel>0)&&(M(i.to(),t)>0||t.xRel<0)?Mo(e,r,t,o):Ro(e,r,t,o)}function Mo(e,t,n,r){var i=e.display,o=!1,a=mr(e,function(t){Ca&&(i.scroller.draggable=!1),e.state.draggingText=!1,ke(i.wrapper.ownerDocument,"mouseup",a),ke(i.wrapper.ownerDocument,"mousemove",s),ke(i.scroller,"dragstart",u),ke(i.scroller,"drop",a),o||(Ne(t),r.addNew||mi(e.doc,n,null,null,r.extend),Ca||ba&&9==xa?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),s=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},u=function(){return o=!0};Ca&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ns(i.wrapper.ownerDocument,"mouseup",a),ns(i.wrapper.ownerDocument,"mousemove",s),ns(i.scroller,"dragstart",u),ns(i.scroller,"drop",a),Pn(e),setTimeout(function(){return i.input.focus()},20)}function jo(e,t,n){if("char"==n)return new Os(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Os(P(t.line,0),z(e.doc,P(t.line+1,0)));var r=n(e,t);return new Os(r.from,r.to)}function Ro(e,t,n,r){function i(t){if(0!=M(y,t))if(y=t,"rectangle"==r.unit){for(var i=[],o=e.options.tabSize,a=p(A(c,n.line).text,n.ch,o),s=p(A(c,t.line).text,t.ch,o),u=Math.min(a,s),m=Math.max(a,s),g=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=v;g++){var b=A(c,g).text,x=d(b,u,o);u==m?i.push(new Os(P(g,x),P(g,x))):b.length>x&&i.push(new Os(P(g,x),P(g,d(b,m,o))))}i.length||i.push(new Os(n,n)),Ci(c,$r(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var C,E=l,D=jo(e,t,r.unit),w=E.anchor;M(D.anchor,w)>0?(C=D.head,w=$(E.from(),D.anchor)):(C=D.anchor,w=B(E.to(),D.head));var S=h.ranges.slice(0);S[f]=Bo(e,new Os(z(c,w),C)),Ci(c,$r(S,f),Ha)}}function o(t){var n=++b,s=kn(e,t,!0,"rectangle"==r.unit);if(s)if(0!=M(s,y)){e.curOp.focus=a(),i(s);var l=$n(u,c);(s.line>=l.to||s.linev.bottom?20:0;p&&setTimeout(mr(e,function(){b==n&&(u.scroller.scrollTop+=p,o(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,Ne(t),u.input.focus(),ke(u.wrapper.ownerDocument,"mousemove",x),ke(u.wrapper.ownerDocument,"mouseup",C),c.history.lastSelOrigin=null}var u=e.display,c=e.doc;Ne(t);var l,f,h=c.sel,m=h.ranges;if(r.addNew&&!r.extend?(f=c.sel.contains(n),l=f>-1?m[f]:new Os(n,n)):(l=c.sel.primary(),f=c.sel.primIndex),"rectangle"==r.unit)r.addNew||(l=new Os(n,n)),n=kn(e,t,!0,!0),f=-1;else{var g=jo(e,n,r.unit);l=r.extend?hi(l,g.anchor,g.head,r.extend):g}r.addNew?-1==f?(f=m.length,Ci(c,$r(m.concat([l]),f),{scroll:!1,origin:"*mouse"})):m.length>1&&m[f].empty()&&"char"==r.unit&&!r.extend?(Ci(c,$r(m.slice(0,f).concat(m.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):yi(c,f,l,Ha):(f=0,Ci(c,new Ts([l],0),Ha),h=c.sel);var y=n,v=u.wrapper.getBoundingClientRect(),b=0,x=mr(e,function(e){0!==e.buttons&&je(e)?o(e):s(e)}),C=mr(e,s);e.state.selectingText=C,ns(u.wrapper.ownerDocument,"mousemove",x),ns(u.wrapper.ownerDocument,"mouseup",C)}function Bo(e,t){var n=t.anchor,r=t.head,i=A(e.doc,n.line);if(0==M(n,r)&&n.sticky==r.sticky)return t;var o=we(i);if(!o)return t;var a=De(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;var c;if(r.line!=n.line)c=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var l=De(o,r.ch,r.sticky),p=l-a||(r.ch-n.ch)*(1==s.level?-1:1);c=l==u-1||l==u?p<0:p>0}var f=o[u+(c?-1:0)],d=c==(1==f.level),h=d?f.from:f.to,m=d?"after":"before";return n.ch==h&&n.sticky==m?t:new Os(new P(n.line,h,m),r)}function $o(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ne(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Oe(e,n))return Le(t);o-=s.top-a.viewOffset;for(var u=0;u=i){return Ae(e,n,e,N(e.doc,o),e.options.gutters[u],t),Le(t)}}}function Uo(e,t){return $o(e,t,"gutterClick",!0)}function zo(e,t){Mt(e.display,t)||Go(e,t)||_e(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function Go(e,t){return!!Oe(e,"gutterContextMenu")&&$o(e,t,"gutterContextMenu",!1)}function Vo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),nn(e)}function qo(e){Pr(e),vr(e),Un(e)}function Ho(e,t,n){if(!t!=!(n&&n!=Js)){var r=e.display.dragFunctions,i=t?ns:ke;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Wo(e){e.options.lineWrapping?(s(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ra(e.display.wrapper,"CodeMirror-wrap"),Ce(e)),Sn(e),vr(e),nn(e),setTimeout(function(){return rr(e)},100)}function Qo(e,t){var n=this;if(!(this instanceof Qo))return new Qo(e,t);this.options=t=t?l(t):{},l(Ys,t,!1),Mr(t);var r=t.value;"string"==typeof r&&(r=new Ms(r,t.mode,null,t.lineSeparator,t.direction)),this.doc=r;var i=new Qo.inputStyles[t.inputStyle](this),o=this.display=new k(e,r,i);o.wrapper.CodeMirror=this,Pr(this),Vo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),or(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new $a,keySeq:null,specialChars:null},t.autofocus&&!Oa&&o.input.focus(),ba&&xa<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ko(this),no(),ar(this),this.curOp.forceUpdate=!0,Xr(this,r),t.autofocus&&!Oa||this.hasFocus()?setTimeout(c(Mn,this),20):jn(this);for(var a in Xs)Xs.hasOwnProperty(a)&&Xs[a](n,t[a],Js);zn(this),t.finishInit&&t.finishInit(this);for(var s=0;s400}var i=e.display;ns(i.scroller,"mousedown",mr(e,No)),ba&&xa<11?ns(i.scroller,"dblclick",mr(e,function(t){if(!_e(e,t)){var n=kn(e,t);if(n&&!Uo(e,t)&&!Mt(e.display,t)){Ne(t);var r=e.findWordAt(n);mi(e.doc,r.anchor,r.head)}}})):ns(i.scroller,"dblclick",function(t){return _e(e,t)||Ne(t)}),ja||ns(i.scroller,"contextmenu",function(t){return zo(e,t)});var o,a={end:0};ns(i.scroller,"touchstart",function(t){if(!_e(e,t)&&!n(t)&&!Uo(e,t)){i.input.ensurePolled(),clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),ns(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ns(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Mt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new Os(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new Os(P(s.line,0),z(e.doc,P(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ne(n)}t()}),ns(i.scroller,"touchcancel",t),ns(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Zn(e,i.scroller.scrollTop),tr(e,i.scroller.scrollLeft,!0),Ae(e,"scroll",e))}),ns(i.scroller,"mousewheel",function(t){return Br(e,t)}),ns(i.scroller,"DOMMouseScroll",function(t){return Br(e,t)}),ns(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){_e(e,t)||Pe(t)},over:function(t){_e(e,t)||(Zi(e,t),Pe(t))},start:function(t){return Xi(e,t)},drop:mr(e,Yi),leave:function(t){_e(e,t)||eo(e)}};var s=i.input.getField();ns(s,"keyup",function(t){return To.call(e,t)}),ns(s,"keydown",mr(e,Ao)),ns(s,"keypress",mr(e,Oo)),ns(s,"focus",function(t){return Mn(e,t)}),ns(s,"blur",function(t){return jn(e,t)})}function Jo(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=Ye(e,t).state:n="prev");var a=e.options.tabSize,s=A(o,t),u=p(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,l=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((c=o.mode.indent(i,s.text.slice(l.length),s.text))==Va||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?p(A(o,t-1).text,null,a):0:"add"==n?c=u+e.options.indentUnit:"subtract"==n?c=u-e.options.indentUnit:"number"==typeof n&&(c=u+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)d+=a,f+="\t";if(d1)if(eu&&eu.text.join("\n")==t){if(r.ranges.length%eu.text.length==0){u=[];for(var c=0;c=0;p--){var f=r.ranges[p],d=f.from(),h=f.to();f.empty()&&(n&&n>0?d=P(d.line,d.ch-n):e.state.overwrite&&!a?h=P(h.line,Math.min(A(o,h.line).text.length,h.ch+m(s).length)):eu&&eu.lineWise&&eu.text.join("\n")==t&&(d=h=P(d.line,0))),l=e.curOp.updateInput;var y={from:d,to:h,text:u?u[p%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Fi(e.doc,y),Ct(e,"inputRead",e,y)}t&&!a&&ea(e,t),Qn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Zo(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||hr(t,function(){return Xo(t,n,0,null,"paste")}),!0}function ea(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Jo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(A(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Jo(e,i.head.line,"smart"));a&&Ct(e,"electricInput",e,i.head.line)}}}function ta(e){for(var t=[],n=[],r=0;r=e.first+e.size)&&(t=new P(r,t.ch,t.sticky),c=A(e,r))}function a(r){var a;if(null==(a=i?yo(e.cm,c,t,n):mo(c,t,n))){if(r||!o())return!1;t=go(i,e.cm,c,t.line,n)}else t=a;return!0}var s=t,u=n,c=A(e,t.line);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var l=null,p="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||a(!d);d=!1){var h=c.text.charAt(t.ch)||"\n",m=C(h,f)?"w":p&&"\n"==h?"n":!p||/\s/.test(h)?null:"p";if(!p||d||m||(m="s"),l&&l!=m){n<0&&(n=1,a(),t.sticky="after");break}if(m&&(l=m),n>0&&!a(!d))break}var g=Ai(e,t,s,u,!0);return j(s,g)&&(g.hitSide=!0),g}function oa(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*xn(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(var c;c=dn(e,a,i),c.outside;){if(n<0?i<=0:i>=o.height){c.hitSide=!0;break}i+=5*n}return c}function aa(e,t){var n=Wt(e,t.line);if(!n||n.hidden)return null;var r=A(e.doc,t.line),i=Vt(n,r,t.line),o=we(r,e.doc.direction),a="left";if(o){a=De(o,t.ch)%2?"right":"left"}var s=Jt(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function sa(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ua(e,t){return t&&(e.bad=!0),e}function ca(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(){l&&(c+=p,f&&(c+=p),l=f=!1)}function s(e){e&&(a(),c+=e)}function u(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void s(n);var c,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(P(r,0),P(i+1,0),o(+d));return void(h.length&&(c=h[0].find(0))&&s(_(e.doc,c.from,c.to).join(p)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&a();for(var g=0;g=15&&(wa=!1,Ca=!0);var Pa,Ma=Fa&&(Ea||wa&&(null==La||La<12.11)),ja=ma||ba&&xa>=9,Ra=function(t,n){var r=t.className,i=e(n).exec(r);if(i){var o=r.slice(i.index+i[0].length);t.className=r.slice(0,i.index)+(o?i[1]+o:"")}};Pa=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Ba=function(e){e.select()};_a?Ba=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ba&&(Ba=function(e){try{e.select()}catch(e){}});var $a=function(){this.id=null};$a.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Ua,za,Ga=30,Va={toString:function(){return"CodeMirror.Pass"}},qa={scroll:!1},Ha={origin:"*mouse"},Wa={origin:"+move"},Qa=[""],Ka=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ja=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Ya=!1,Xa=!1,Za=null,es=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,u=/[1n]/;return function(n,r){var c="ltr"==r?"L":"R";if(0==n.length||"ltr"==r&&!i.test(n))return!1;for(var l=n.length,p=[],f=0;f=this.string.length},ps.prototype.sol=function(){return this.pos==this.lineStart},ps.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ps.prototype.next=function(){if(this.post},ps.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},ps.prototype.skipToEnd=function(){this.pos=this.string.length},ps.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},ps.prototype.backUp=function(e){this.pos-=e},ps.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},ps.prototype.current=function(){return this.string.slice(this.start,this.pos)},ps.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},ps.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},ps.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var fs=function(e,t){this.state=e,this.lookAhead=t},ds=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ds.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ds.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ds.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ds.fromSaved=function(e,t,n){return t instanceof fs?new ds(e,He(e.mode,t.state),n,t.lookAhead):new ds(e,He(e.mode,t),n)},ds.prototype.save=function(e){var t=!1!==e?He(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new fs(t,this.maxLookAhead):t};var hs=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n},ms=function(e,t,n){this.text=e,re(this,t),this.height=n?n(this):1};ms.prototype.lineNo=function(){return F(this)},Fe(ms);var gs,ys={},vs={},bs=null,xs=null,Cs={left:0,right:0,top:0,bottom:0},Es=function(e,t,n){this.cm=n;var i=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=r("div",[r("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=o.tabIndex=-1,e(i),e(o),ns(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),ns(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ba&&xa<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Es.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Es.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Es.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Es.prototype.zeroWidthHack=function(){var e=Fa&&!ka?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $a,this.disableVert=new $a},Es.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},Es.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ds=function(){};Ds.prototype.update=function(){return{bottom:0,right:0}},Ds.prototype.setScrollLeft=function(){},Ds.prototype.setScrollTop=function(){},Ds.prototype.clear=function(){};var ws={native:Es,null:Ds},Ss=0,ks=function(e,t,n){var r=e.display;this.viewport=t,this.visible=$n(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ut(e),this.force=n,this.dims=En(e),this.events=[]};ks.prototype.signal=function(e,t){Oe(e,t)&&this.events.push(arguments)},ks.prototype.finish=function(){for(var e=this,t=0;t=0&&M(e,i.to())<=0)return r}return-1};var Os=function(e,t){this.anchor=e,this.head=t};Os.prototype.from=function(){return $(this.anchor,this.head)},Os.prototype.to=function(){return B(this.anchor,this.head)},Os.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},zi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,r=e,i=e+t;r1||!(this.children[0]instanceof zi))){var u=[];this.collapse(u),this.children=[new zi(u)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n50){for(var s=o.lines.length%25+25,u=s;u10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=this,i=0;it.display.maxLineLength&&(t.display.maxLine=l,t.display.maxLineLength=p,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&vr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&wi(t.doc)),t&&Ct(t,"markerCleared",t,this,i,o),n&&sr(t),this.parent&&this.parent.clear()}},Is.prototype.find=function(e,t){var n=this;null==e&&"bookmark"==this.type&&(e=1);for(var r,i,o=0;o=0;c--)Fi(r,i[c]);u?xi(this,u):this.cm&&Qn(this.cm)}),undo:yr(function(){Ii(this,"undo")}),redo:yr(function(){Ii(this,"redo")}),undoSelection:yr(function(){Ii(this,"undo",!0)}),redoSelection:yr(function(){Ii(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=z(this,e),t=z(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s=u.to||null==u.from&&i!=e.line||null!=u.from&&i==t.line&&u.from>=t.ch||n&&!n(u.marker)||r.push(u.marker.parent||u.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),z(this,P(n,t))},indexFromPos:function(e){e=z(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.to0)i=new P(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),P(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=A(e.doc,i.line-1).text;a&&(i=new P(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),P(i.line-1,a.length-1),i,"+transpose"))}n.push(new Os(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return hr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&0==M(t,this.pos)&&n==this.button};var Qs,Ks,Js={toString:function(){return"CodeMirror.Init"}},Ys={},Xs={};Qo.defaults=Ys,Qo.optionHandlers=Xs;var Zs=[];Qo.defineInitHook=function(e){return Zs.push(e)};var eu=null,tu=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $a,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};tu.prototype.init=function(e){function t(e){if(!_e(i,e)){if(i.somethingSelected())Yo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=ta(i);Yo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,qa),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=eu.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var a=ra(),s=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),s.value=eu.text.join("\n");var u=document.activeElement;Ba(s),setTimeout(function(){i.display.lineSpace.removeChild(a),u.focus(),u==o&&r.showPrimarySelection()},50)}}var n=this,r=this,i=r.cm,o=r.div=e.lineDiv;na(o,i.options.spellcheck),ns(o,"paste",function(e){_e(i,e)||Zo(e,i)||xa<=11&&setTimeout(mr(i,function(){return n.updateFromDOM()}),20)}),ns(o,"compositionstart",function(e){n.composing={data:e.data,done:!1}}),ns(o,"compositionupdate",function(e){n.composing||(n.composing={data:e.data,done:!1})}),ns(o,"compositionend",function(e){n.composing&&(e.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),ns(o,"touchstart",function(){return r.forceCompositionEnd()}),ns(o,"input",function(){n.composing||n.readFromDOMSoon()}),ns(o,"copy",t),ns(o,"cut",t)},tu.prototype.prepareSelection=function(){var e=Tn(this.cm,!1);return e.focus=this.cm.state.focused,e},tu.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},tu.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},tu.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&aa(t,r)||{node:s[0].measure.map[2],offset:0},c=i.linee.firstLine()&&(r=P(r.line-1,A(e.doc,r.line-1).length)),i.ch==A(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,s;r.line==t.viewFrom||0==(o=An(e,r.line))?(a=F(t.view[0].line),s=t.view[0].node):(a=F(t.view[o].line),s=t.view[o-1].node.nextSibling);var u,c,l=An(e,i.line);if(l==t.view.length-1?(u=t.viewTo-1,c=t.lineDiv.lastChild):(u=F(t.view[l+1].line)-1,c=t.view[l+1].node.previousSibling),!s)return!1;for(var p=e.doc.splitLines(ca(e,s,c,a,u)),f=_(e.doc,P(a,0),P(u,A(e.doc,u).text.length));p.length>1&&f.length>1;)if(m(p)==m(f))p.pop(),f.pop(),u--;else{if(p[0]!=f[0])break;p.shift(),f.shift(),a++}for(var d=0,h=0,g=p[0],y=f[0],v=Math.min(g.length,y.length);dr.ch&&b.charCodeAt(b.length-h-1)==x.charCodeAt(x.length-h-1);)d--,h++;p[p.length-1]=b.slice(0,b.length-h).replace(/^\u200b+/,""),p[0]=p[0].slice(d).replace(/\u200b+$/,"");var E=P(a,d),D=P(u,f.length?m(f).length-h:0);return p.length>1||p[0]||M(E,D)?(ji(e.doc,p,E,D,"+input"),!0):void 0},tu.prototype.ensurePolled=function(){this.forceCompositionEnd()},tu.prototype.reset=function(){this.forceCompositionEnd()},tu.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},tu.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},tu.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||hr(this.cm,function(){return vr(e.cm)})},tu.prototype.setUneditable=function(e){e.contentEditable="false"},tu.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||mr(this.cm,Xo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},tu.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},tu.prototype.onContextMenu=function(){},tu.prototype.resetPosition=function(){},tu.prototype.needsContentAttribute=!0;var nu=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new $a,this.hasSelection=!1,this.composing=null};nu.prototype.init=function(e){function t(e){if(!_e(i,e)){if(i.somethingSelected())Yo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ta(i);Yo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,qa):(r.prevInput="",o.value=t.text.join("\n"),Ba(o))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var n=this,r=this,i=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),_a&&(o.style.width="0px"),ns(o,"input",function(){ba&&xa>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()}),ns(o,"paste",function(e){_e(i,e)||Zo(e,i)||(i.state.pasteIncoming=!0,r.fastPoll())}),ns(o,"cut",t),ns(o,"copy",t),ns(e.scroller,"paste",function(t){Mt(e,t)||_e(i,t)||(i.state.pasteIncoming=!0,r.focus())}),ns(e.lineSpace,"selectstart",function(t){Mt(e,t)||Ne(t)}),ns(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),ns(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},nu.prototype.createField=function(e){this.wrapper=ra(),this.textarea=this.wrapper.firstChild},nu.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Tn(e);if(e.options.moveInputWithCursor){var i=ln(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},nu.prototype.showSelection=function(e){var t=this.cm,r=t.display;n(r.cursorDiv,e.cursors),n(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},nu.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Ba(this.textarea),ba&&xa>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",ba&&xa>=9&&(this.hasSelection=null))}},nu.prototype.getField=function(){return this.textarea},nu.prototype.supportsTouch=function(){return!1},nu.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Oa||a()!=this.textarea))try{this.textarea.focus()}catch(e){}},nu.prototype.blur=function(){this.textarea.blur()},nu.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},nu.prototype.receivedFocus=function(){this.slowPoll()},nu.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},nu.prototype.fastPoll=function(){function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},nu.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||os(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(ba&&xa>=9&&this.hasSelection===i||Fa&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="\u200b"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,s=Math.min(r.length,i.length);a1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},nu.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},nu.prototype.onKeyPress=function(){ba&&xa>=9&&(this.hasSelection=null),this.fastPoll()},nu.prototype.onContextMenu=function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="\u200b"+(e?a.value:"");a.value="\u21da",a.value=t,r.prevInput=e?"":"\u200b",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=l,a.style.cssText=c,ba&&xa<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=u),null!=a.selectionStart){(!ba||ba&&xa<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"\u200b"==r.prevInput?mr(i,Ti)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,s=kn(i,e),u=o.scroller.scrollTop;if(s&&!wa){i.options.resetSelectionOnContextMenu&&-1==i.doc.sel.contains(s)&&mr(i,Ci)(i.doc,Ur(s),qa);var c=a.style.cssText,l=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var p=r.wrapper.getBoundingClientRect();a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(ba?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(Ca&&(f=window.scrollY),o.input.focus(),Ca&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ba&&xa>=9&&t(),ja){Pe(e);var d=function(){ke(window,"mouseup",d),setTimeout(n,20)};ns(window,"mouseup",d)}else setTimeout(n,50)}},nu.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},nu.prototype.setUneditable=function(){},nu.prototype.needsContentAttribute=!1,function(e){function t(t,r,i,o){e.defaults[t]=r,i&&(n[t]=o?function(e,t,n){n!=Js&&i(e,t,n)}:i)}var n=e.optionHandlers;e.defineOption=t,e.Init=Js,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Wr(e)},!0),t("indentUnit",2,Wr,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Qr(e),nn(e),vr(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(P(r,o))}r++});for(var i=n.length-1;i>=0;i--)ji(e.doc,t,n[i],P(n[i].line,n[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Js&&e.refresh()}),t("specialCharPlaceholder",lt,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Oa?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("rtlMoveVisually",!Ia),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Vo(e),qo(e)},!0),t("keyMap","default",function(e,t,n){var r=po(t),i=n!=Js&&po(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Wo,!0),t("gutters",[],function(e){Mr(e.options),qo(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Dn(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return rr(e)},!0),t("scrollbarStyle","native",function(e){or(e),rr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){Mr(e.options),qo(e)},!0),t("firstLineNumber",1,qo,!0),t("lineNumberFormatter",function(e){return e},qo,!0),t("showCursorWhenSelecting",!1,_n,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("readOnly",!1,function(e,t){"nocursor"==t&&(jn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Ho),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,_n,!0),t("singleCursorHeightPerLine",!0,_n,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Qr,!0),t("addModeClass",!1,Qr,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Qr,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(Qo),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&mr(this,t[e])(this,n,i),Ae(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](po(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nr&&(Jo(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Qn(t));else{var a=o.from(),s=o.to(),u=Math.max(r,a.line);r=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var c=u;c0&&yi(t.doc,i,new Os(a,l[i].to()),qa)}}}),getTokenAt:function(e,t){return tt(this,e,t)},getLineTokens:function(e,t){return tt(this,P(e),t,!0)},getTokenTypeAt:function(e){e=z(this.doc,e);var t,n=Je(this,A(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(e=o,i=!0),r=A(this.doc,e)}else r=e;return sn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-be(r):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Cn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=ln(this,z(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var u=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>u)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=u&&(a=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&qn(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:gr(Ao),triggerOnKeyPress:gr(Oo),triggerOnKeyUp:To,triggerOnMouseDown:gr(No),execCommand:function(e){if(Vs.hasOwnProperty(e))return Vs[e].call(null,this)},triggerElectric:gr(function(e){ea(this,e)}),findPosH:function(e,t,n,r){var i=this,o=1;t<0&&(o=-1,t=-t);for(var a=z(this.doc,e),s=0;s0&&s(n.charAt(r-1));)--r;for(;i.5)&&Sn(this),Ae(this,"refresh",this)}),swapDoc:gr(function(e){var t=this.doc;return t.cm=null,Xr(this,e),nn(this),this.display.input.reset(),Kn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Ct(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Fe(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Qo);var ru="iter insert remove copy getEditor constructor".split(" ");for(var iu in Ms.prototype)Ms.prototype.hasOwnProperty(iu)&&f(ru,iu)<0&&(Qo.prototype[iu]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ms.prototype[iu]));return Fe(Ms),Qo.inputStyles={textarea:nu,contenteditable:tu},Qo.defineMode=function(e){Qo.defaults.mode||"null"==e||(Qo.defaults.mode=e),Ue.apply(this,arguments)},Qo.defineMIME=ze,Qo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qo.defineMIME("text/plain","null"),Qo.defineExtension=function(e,t){Qo.prototype[e]=t},Qo.defineDocExtension=function(e,t){Ms.prototype[e]=t},Qo.fromTextArea=fa,function(e){e.off=ke,e.on=ns,e.wheelEventPixels=Rr,e.Doc=Ms,e.splitLines=is,e.countColumn=p,e.findColumn=d,e.isWordChar=x,e.Pass=Va,e.signal=Ae,e.Line=ms,e.changeEnd=zr,e.scrollbarModel=ws,e.Pos=P,e.cmpPos=M,e.modes=us,e.mimeModes=cs,e.resolveMode=Ge,e.getMode=Ve,e.modeExtensions=ls,e.extendMode=qe,e.copyState=He,e.startState=Qe,e.innerMode=We,e.commands=Vs,e.keyMap=Gs,e.keyName=lo,e.isModifierKey=uo,e.lookupKey=so,e.normalizeKeyMap=ao,e.StringStream=ps,e.SharedTextMarker=Ls,e.TextMarker=Is,e.LineWidget=Fs,e.e_preventDefault=Ne,e.e_stopPropagation=Ie,e.e_stop=Pe,e.addClass=s,e.contains=o,e.rmClass=Ra,e.keyNames=Bs}(Qo),Qo.version="5.38.0",Qo})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(43);Object.defineProperty(t,"GraphQLError",{enumerable:!0,get:function(){return r.GraphQLError}});var i=n(391);Object.defineProperty(t,"syntaxError",{enumerable:!0,get:function(){return i.syntaxError}});var o=n(180);Object.defineProperty(t,"locatedError",{enumerable:!0,get:function(){return o.locatedError}});var a=n(392);Object.defineProperty(t,"formatError",{enumerable:!0,get:function(){return a.formatError}})},function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===r(e)}function o(e,t){return C.call(e,t)}function a(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if("object"!==typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function s(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function u(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!==(65535&e)&&65534!==(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function c(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function l(e,t){var n=0;return o(k,t)?k[t]:35===t.charCodeAt(0)&&S.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?c(n):e}function p(e){return e.indexOf("\\")<0?e:e.replace(E,"$1")}function f(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(w,function(e,t,n){return t||l(e,n)})}function d(e){return T[e]}function h(e){return A.test(e)?e.replace(_,d):e}function m(e){return e.replace(O,"\\$&")}function g(e){switch(e){case 9:case 32:return!0}return!1}function y(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function v(e){return F.test(e)}function b(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function x(e){return e.trim().replace(/\s+/g," ").toUpperCase()}var C=Object.prototype.hasOwnProperty,E=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,D=/&([a-z#][a-z0-9]{1,31});/gi,w=new RegExp(E.source+"|"+D.source,"gi"),S=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,k=n(261),A=/[&<>"]/,_=/[&<>"]/g,T={"&":"&","<":"<",">":">",'"':"""},O=/[.?*+^$[\]\\(){}|-]/g,F=n(263);t.lib={},t.lib.mdurl=n(88),t.lib.ucmicro=n(543),t.assign=a,t.isString=i,t.has=o,t.unescapeMd=p,t.unescapeAll=f,t.isValidEntityCode=u,t.fromCodePoint=c,t.escapeHtml=h,t.arrayReplaceAt=s,t.isSpace=g,t.isWhiteSpace=y,t.isMdAsciiPunct=b,t.isPunctChar=v,t.escapeRE=m,t.normalizeReference=x},function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===r(e)}function o(e,t){return C.call(e,t)}function a(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if("object"!==typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function s(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function u(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!==(65535&e)&&65534!==(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function c(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function l(e,t){var n=0;return o(k,t)?k[t]:35===t.charCodeAt(0)&&S.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?c(n):e}function p(e){return e.indexOf("\\")<0?e:e.replace(E,"$1")}function f(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(w,function(e,t,n){return t||l(e,n)})}function d(e){return T[e]}function h(e){return A.test(e)?e.replace(_,d):e}function m(e){return e.replace(O,"\\$&")}function g(e){switch(e){case 9:case 32:return!0}return!1}function y(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function v(e){return F.test(e)}function b(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function x(e){return e.trim().replace(/\s+/g," ").toUpperCase()}var C=Object.prototype.hasOwnProperty,E=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,D=/&([a-z#][a-z0-9]{1,31});/gi,w=new RegExp(E.source+"|"+D.source,"gi"),S=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,k=n(294),A=/[&<>"]/,_=/[&<>"]/g,T={"&":"&","<":"<",">":">",'"':"""},O=/[.?*+^$[\]\\(){}|-]/g,F=n(136);t.lib={},t.lib.mdurl=n(88),t.lib.ucmicro=n(647),t.assign=a,t.isString=i,t.has=o,t.unescapeMd=p,t.unescapeAll=f,t.isValidEntityCode=u,t.fromCodePoint=c,t.escapeHtml=h,t.arrayReplaceAt=s,t.isSpace=g,t.isWhiteSpace=y,t.isMdAsciiPunct=b,t.isPunctChar=v,t.escapeRE=m,t.normalizeReference=x},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return e instanceof j||e instanceof R||e instanceof B||e instanceof $||e instanceof U||e instanceof z||e instanceof G||e instanceof V}function a(e){return o(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL type."),e}function s(e){return e instanceof j||e instanceof U||e instanceof z||e instanceof V&&s(e.ofType)||e instanceof G&&s(e.ofType)}function u(e){return s(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL input type."),e}function c(e){return e instanceof j||e instanceof R||e instanceof B||e instanceof $||e instanceof U||e instanceof V&&c(e.ofType)||e instanceof G&&c(e.ofType)}function l(e){return c(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL output type."),e}function p(e){return e instanceof j||e instanceof U}function f(e){return p(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL leaf type."),e}function d(e){return e instanceof R||e instanceof B||e instanceof $}function h(e){return d(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL composite type."),e}function m(e){return e instanceof B||e instanceof $}function g(e){return m(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL abstract type."),e}function y(e){return e instanceof V?e.ofType:e}function v(e){return e instanceof j||e instanceof R||e instanceof B||e instanceof $||e instanceof U||e instanceof z}function b(e){return v(e)||(0,F.default)(0,"Expected "+String(e)+" to be a GraphQL named type."),e}function x(e){if(e){for(var t=e;t instanceof G||t instanceof V;)t=t.ofType;return t}}function C(e){return"function"===typeof e?e():e}function E(e,t){var n=C(t);if(!n)return[];Array.isArray(n)||(0,F.default)(0,e.name+" interfaces must be an Array or a function which returns an Array.");var r=Object.create(null);return n.forEach(function(t){t instanceof B||(0,F.default)(0,e.name+" may only implement Interface types, it cannot implement: "+String(t)+"."),r[t.name]&&(0,F.default)(0,e.name+" may declare it implements "+t.name+" only once."),r[t.name]=!0,"function"!==typeof t.resolveType&&"function"!==typeof e.isTypeOf&&(0,F.default)(0,"Interface Type "+t.name+' does not provide a "resolveType" function and implementing Type '+e.name+' does not provide a "isTypeOf" function. There is no way to resolve this implementing type during execution.')}),n}function D(e,t){var n=C(t);w(n)||(0,F.default)(0,e.name+" fields must be an object with field names as keys or a function which returns such an object.");var r=Object.keys(n);r.length>0||(0,F.default)(0,e.name+" fields must be an object with field names as keys or a function which returns such an object.");var i=Object.create(null);return r.forEach(function(t){(0,M.assertValidName)(t);var r=n[t];w(r)||(0,F.default)(0,e.name+"."+t+" field config must be an object"),r.hasOwnProperty("isDeprecated")&&(0,F.default)(0,e.name+"."+t+' should provide "deprecationReason" instead of "isDeprecated".');var o=T({},r,{isDeprecated:Boolean(r.deprecationReason),name:t});c(o.type)||(0,F.default)(0,e.name+"."+t+" field type must be Output Type but got: "+String(o.type)+"."),S(o.resolve)||(0,F.default)(0,e.name+"."+t+" field resolver must be a function if provided, but got: "+String(o.resolve)+".");var a=r.args;a?(w(a)||(0,F.default)(0,e.name+"."+t+" args must be an object with argument names as keys."),o.args=Object.keys(a).map(function(n){(0,M.assertValidName)(n);var r=a[n];return s(r.type)||(0,F.default)(0,e.name+"."+t+"("+n+":) argument type must be Input Type but got: "+String(r.type)+"."),{name:n,description:void 0===r.description?null:r.description,type:r.type,defaultValue:r.defaultValue,astNode:r.astNode}})):o.args=[],i[t]=o}),i}function w(e){return e&&"object"===("undefined"===typeof e?"undefined":_(e))&&!Array.isArray(e)}function S(e){return null==e||"function"===typeof e}function k(e,t){var n=C(t);Array.isArray(n)&&n.length>0||(0,F.default)(0,"Must provide Array of types or a function which returns such an array for Union "+e.name+".");var r=Object.create(null);return n.forEach(function(t){t instanceof R||(0,F.default)(0,e.name+" may only contain Object types, it cannot contain: "+String(t)+"."),r[t.name]&&(0,F.default)(0,e.name+" can include "+t.name+" type only once."),r[t.name]=!0,"function"!==typeof e.resolveType&&"function"!==typeof t.isTypeOf&&(0,F.default)(0,'Union type "'+e.name+'" does not provide a "resolveType" function and possible type "'+t.name+'" does not provide an "isTypeOf" function. There is no way to resolve this possible type during execution.')}),n}function A(e,t){w(t)||(0,F.default)(0,e.name+" values must be an object with value names as keys.");var n=Object.keys(t);return n.length>0||(0,F.default)(0,e.name+" values must be an object with value names as keys."),n.map(function(n){(0,M.assertValidName)(n),-1!==["true","false","null"].indexOf(n)&&(0,F.default)(0,'Name "'+n+'" can not be used as an Enum value.');var r=t[n];return w(r)||(0,F.default)(0,e.name+"."+n+' must refer to an object with a "value" key representing an internal value but got: '+String(r)+"."),r.hasOwnProperty("isDeprecated")&&(0,F.default)(0,e.name+"."+n+' should provide "deprecationReason" instead of "isDeprecated".'),{name:n,description:r.description,isDeprecated:Boolean(r.deprecationReason),deprecationReason:r.deprecationReason,astNode:r.astNode,value:r.hasOwnProperty("value")?r.value:n}})}Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLNonNull=t.GraphQLList=t.GraphQLInputObjectType=t.GraphQLEnumType=t.GraphQLUnionType=t.GraphQLInterfaceType=t.GraphQLObjectType=t.GraphQLScalarType=void 0;var _="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T=Object.assign||function(e){for(var t=1;t0||(0,F.default)(0,this.name+" fields must be an object with field names as keys or a function which returns such an object.");var r=Object.create(null);return n.forEach(function(n){(0,M.assertValidName)(n);var i=T({},t[n],{name:n});s(i.type)||(0,F.default)(0,e.name+"."+n+" field type must be Input Type but got: "+String(i.type)+"."),null!=i.resolve&&(0,F.default)(0,e.name+"."+n+" field type has a resolve property, but Input Types cannot define resolvers."),r[n]=i}),r},e.prototype.toString=function(){return this.name},e}();z.prototype.toJSON=z.prototype.inspect=z.prototype.toString;var G=t.GraphQLList=function(){function e(t){i(this,e),o(t)||(0,F.default)(0,"Can only create List of a GraphQLType but got: "+String(t)+"."),this.ofType=t}return e.prototype.toString=function(){return"["+String(this.ofType)+"]"},e}();G.prototype.toJSON=G.prototype.inspect=G.prototype.toString;var V=t.GraphQLNonNull=function(){function e(t){i(this,e),(!o(t)||t instanceof e)&&(0,F.default)(0,"Can only create NonNull of a Nullable GraphQLType but got: "+String(t)+"."),this.ofType=t}return e.prototype.toString=function(){return this.ofType.toString()+"!"},e}();V.prototype.toJSON=V.prototype.inspect=V.prototype.toString},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(390);Object.defineProperty(t,"graphql",{enumerable:!0,get:function(){return r.graphql}});var i=n(393);Object.defineProperty(t,"GraphQLSchema",{enumerable:!0,get:function(){return i.GraphQLSchema}}),Object.defineProperty(t,"GraphQLScalarType",{enumerable:!0,get:function(){return i.GraphQLScalarType}}),Object.defineProperty(t,"GraphQLObjectType",{enumerable:!0,get:function(){return i.GraphQLObjectType}}),Object.defineProperty(t,"GraphQLInterfaceType",{enumerable:!0,get:function(){return i.GraphQLInterfaceType}}),Object.defineProperty(t,"GraphQLUnionType",{enumerable:!0,get:function(){return i.GraphQLUnionType}}),Object.defineProperty(t,"GraphQLEnumType",{enumerable:!0,get:function(){return i.GraphQLEnumType}}),Object.defineProperty(t,"GraphQLInputObjectType",{enumerable:!0,get:function(){return i.GraphQLInputObjectType}}),Object.defineProperty(t,"GraphQLList",{enumerable:!0,get:function(){return i.GraphQLList}}),Object.defineProperty(t,"GraphQLNonNull",{enumerable:!0,get:function(){return i.GraphQLNonNull}}),Object.defineProperty(t,"GraphQLDirective",{enumerable:!0,get:function(){return i.GraphQLDirective}}),Object.defineProperty(t,"TypeKind",{enumerable:!0,get:function(){return i.TypeKind}}),Object.defineProperty(t,"DirectiveLocation",{enumerable:!0,get:function(){return i.DirectiveLocation}}),Object.defineProperty(t,"GraphQLInt",{enumerable:!0,get:function(){return i.GraphQLInt}}),Object.defineProperty(t,"GraphQLFloat",{enumerable:!0,get:function(){return i.GraphQLFloat}}),Object.defineProperty(t,"GraphQLString",{enumerable:!0,get:function(){return i.GraphQLString}}),Object.defineProperty(t,"GraphQLBoolean",{enumerable:!0,get:function(){return i.GraphQLBoolean}}),Object.defineProperty(t,"GraphQLID",{enumerable:!0,get:function(){return i.GraphQLID}}),Object.defineProperty(t,"specifiedDirectives",{enumerable:!0,get:function(){return i.specifiedDirectives}}),Object.defineProperty(t,"GraphQLIncludeDirective",{enumerable:!0,get:function(){return i.GraphQLIncludeDirective}}),Object.defineProperty(t,"GraphQLSkipDirective",{enumerable:!0,get:function(){return i.GraphQLSkipDirective}}),Object.defineProperty(t,"GraphQLDeprecatedDirective",{enumerable:!0,get:function(){return i.GraphQLDeprecatedDirective}}),Object.defineProperty(t,"DEFAULT_DEPRECATION_REASON",{enumerable:!0,get:function(){return i.DEFAULT_DEPRECATION_REASON}}),Object.defineProperty(t,"SchemaMetaFieldDef",{enumerable:!0,get:function(){return i.SchemaMetaFieldDef}}),Object.defineProperty(t,"TypeMetaFieldDef",{enumerable:!0,get:function(){return i.TypeMetaFieldDef}}),Object.defineProperty(t,"TypeNameMetaFieldDef",{enumerable:!0,get:function(){return i.TypeNameMetaFieldDef}}),Object.defineProperty(t,"__Schema",{enumerable:!0,get:function(){return i.__Schema}}),Object.defineProperty(t,"__Directive",{enumerable:!0,get:function(){return i.__Directive}}),Object.defineProperty(t,"__DirectiveLocation",{enumerable:!0,get:function(){return i.__DirectiveLocation}}),Object.defineProperty(t,"__Type",{enumerable:!0,get:function(){return i.__Type}}),Object.defineProperty(t,"__Field",{enumerable:!0,get:function(){return i.__Field}}),Object.defineProperty(t,"__InputValue",{enumerable:!0,get:function(){return i.__InputValue}}),Object.defineProperty(t,"__EnumValue",{enumerable:!0,get:function(){return i.__EnumValue}}),Object.defineProperty(t,"__TypeKind",{enumerable:!0,get:function(){return i.__TypeKind}}),Object.defineProperty(t,"isType",{enumerable:!0,get:function(){return i.isType}}),Object.defineProperty(t,"isInputType",{enumerable:!0,get:function(){return i.isInputType}}),Object.defineProperty(t,"isOutputType",{enumerable:!0,get:function(){return i.isOutputType}}),Object.defineProperty(t,"isLeafType",{enumerable:!0,get:function(){return i.isLeafType}}),Object.defineProperty(t,"isCompositeType",{enumerable:!0,get:function(){return i.isCompositeType}}),Object.defineProperty(t,"isAbstractType",{enumerable:!0,get:function(){return i.isAbstractType}}),Object.defineProperty(t,"isNamedType",{enumerable:!0,get:function(){return i.isNamedType}}),Object.defineProperty(t,"assertType",{enumerable:!0,get:function(){return i.assertType}}),Object.defineProperty(t,"assertInputType",{enumerable:!0,get:function(){return i.assertInputType}}),Object.defineProperty(t,"assertOutputType",{enumerable:!0,get:function(){return i.assertOutputType}}),Object.defineProperty(t,"assertLeafType",{enumerable:!0,get:function(){return i.assertLeafType}}),Object.defineProperty(t,"assertCompositeType",{enumerable:!0,get:function(){return i.assertCompositeType}}),Object.defineProperty(t,"assertAbstractType",{enumerable:!0,get:function(){return i.assertAbstractType}}),Object.defineProperty(t,"assertNamedType",{enumerable:!0,get:function(){return i.assertNamedType}}),Object.defineProperty(t,"getNullableType",{enumerable:!0,get:function(){return i.getNullableType}}),Object.defineProperty(t,"getNamedType",{enumerable:!0,get:function(){return i.getNamedType}});var o=n(394);Object.defineProperty(t,"Source",{enumerable:!0,get:function(){return o.Source}}),Object.defineProperty(t,"getLocation",{enumerable:!0,get:function(){return o.getLocation}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return o.parse}}),Object.defineProperty(t,"parseValue",{enumerable:!0,get:function(){return o.parseValue}}),Object.defineProperty(t,"parseType",{enumerable:!0,get:function(){return o.parseType}}),Object.defineProperty(t,"print",{enumerable:!0,get:function(){return o.print}}),Object.defineProperty(t,"visit",{enumerable:!0,get:function(){return o.visit}}),Object.defineProperty(t,"visitInParallel",{enumerable:!0,get:function(){return o.visitInParallel}}),Object.defineProperty(t,"visitWithTypeInfo",{enumerable:!0,get:function(){return o.visitWithTypeInfo}}),Object.defineProperty(t,"getVisitFn",{enumerable:!0,get:function(){return o.getVisitFn}}),Object.defineProperty(t,"Kind",{enumerable:!0,get:function(){return o.Kind}}),Object.defineProperty(t,"TokenKind",{enumerable:!0,get:function(){return o.TokenKind}}),Object.defineProperty(t,"BREAK",{enumerable:!0,get:function(){return o.BREAK}});var a=n(395);Object.defineProperty(t,"execute",{enumerable:!0,get:function(){return a.execute}}),Object.defineProperty(t,"defaultFieldResolver",{enumerable:!0,get:function(){return a.defaultFieldResolver}}),Object.defineProperty(t,"responsePathAsArray",{enumerable:!0,get:function(){return a.responsePathAsArray}}),Object.defineProperty(t,"getDirectiveValues",{enumerable:!0,get:function(){return a.getDirectiveValues}});var s=n(396);Object.defineProperty(t,"subscribe",{enumerable:!0,get:function(){return s.subscribe}}),Object.defineProperty(t,"createSourceEventStream",{enumerable:!0,get:function(){return s.createSourceEventStream}});var u=n(399);Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return u.validate}}),Object.defineProperty(t,"ValidationContext",{enumerable:!0,get:function(){return u.ValidationContext}}),Object.defineProperty(t,"specifiedRules",{enumerable:!0,get:function(){return u.specifiedRules}}),Object.defineProperty(t,"ArgumentsOfCorrectTypeRule",{enumerable:!0,get:function(){return u.ArgumentsOfCorrectTypeRule}}),Object.defineProperty(t,"DefaultValuesOfCorrectTypeRule",{enumerable:!0,get:function(){return u.DefaultValuesOfCorrectTypeRule}}),Object.defineProperty(t,"FieldsOnCorrectTypeRule",{enumerable:!0,get:function(){return u.FieldsOnCorrectTypeRule}}),Object.defineProperty(t,"FragmentsOnCompositeTypesRule",{enumerable:!0,get:function(){return u.FragmentsOnCompositeTypesRule}}),Object.defineProperty(t,"KnownArgumentNamesRule",{enumerable:!0,get:function(){return u.KnownArgumentNamesRule}}),Object.defineProperty(t,"KnownDirectivesRule",{enumerable:!0,get:function(){return u.KnownDirectivesRule}}),Object.defineProperty(t,"KnownFragmentNamesRule",{enumerable:!0,get:function(){return u.KnownFragmentNamesRule}}),Object.defineProperty(t,"KnownTypeNamesRule",{enumerable:!0,get:function(){return u.KnownTypeNamesRule}}),Object.defineProperty(t,"LoneAnonymousOperationRule",{enumerable:!0,get:function(){return u.LoneAnonymousOperationRule}}),Object.defineProperty(t,"NoFragmentCyclesRule",{enumerable:!0,get:function(){return u.NoFragmentCyclesRule}}),Object.defineProperty(t,"NoUndefinedVariablesRule",{enumerable:!0,get:function(){return u.NoUndefinedVariablesRule}}),Object.defineProperty(t,"NoUnusedFragmentsRule",{enumerable:!0,get:function(){return u.NoUnusedFragmentsRule}}),Object.defineProperty(t,"NoUnusedVariablesRule",{enumerable:!0,get:function(){return u.NoUnusedVariablesRule}}),Object.defineProperty(t,"OverlappingFieldsCanBeMergedRule",{enumerable:!0,get:function(){return u.OverlappingFieldsCanBeMergedRule}}),Object.defineProperty(t,"PossibleFragmentSpreadsRule",{enumerable:!0,get:function(){return u.PossibleFragmentSpreadsRule}}),Object.defineProperty(t,"ProvidedNonNullArgumentsRule",{enumerable:!0,get:function(){return u.ProvidedNonNullArgumentsRule}}),Object.defineProperty(t,"ScalarLeafsRule",{enumerable:!0,get:function(){return u.ScalarLeafsRule}}),Object.defineProperty(t,"SingleFieldSubscriptionsRule",{enumerable:!0,get:function(){return u.SingleFieldSubscriptionsRule}}),Object.defineProperty(t,"UniqueArgumentNamesRule",{enumerable:!0,get:function(){return u.UniqueArgumentNamesRule}}),Object.defineProperty(t,"UniqueDirectivesPerLocationRule",{enumerable:!0,get:function(){return u.UniqueDirectivesPerLocationRule}}),Object.defineProperty(t,"UniqueFragmentNamesRule",{enumerable:!0,get:function(){return u.UniqueFragmentNamesRule}}),Object.defineProperty(t,"UniqueInputFieldNamesRule",{enumerable:!0,get:function(){return u.UniqueInputFieldNamesRule}}),Object.defineProperty(t,"UniqueOperationNamesRule",{enumerable:!0,get:function(){return u.UniqueOperationNamesRule}}),Object.defineProperty(t,"UniqueVariableNamesRule",{enumerable:!0,get:function(){return u.UniqueVariableNamesRule}}),Object.defineProperty(t,"VariablesAreInputTypesRule",{enumerable:!0,get:function(){return u.VariablesAreInputTypesRule}}),Object.defineProperty(t,"VariablesInAllowedPositionRule",{enumerable:!0,get:function(){return u.VariablesInAllowedPositionRule}});var c=n(3);Object.defineProperty(t,"GraphQLError",{enumerable:!0,get:function(){return c.GraphQLError}}),Object.defineProperty(t,"formatError",{enumerable:!0,get:function(){return c.formatError}});var l=n(400);Object.defineProperty(t,"introspectionQuery",{enumerable:!0,get:function(){return l.introspectionQuery}}),Object.defineProperty(t,"getOperationAST",{enumerable:!0,get:function(){return l.getOperationAST}}),Object.defineProperty(t,"buildClientSchema",{enumerable:!0,get:function(){return l.buildClientSchema}}),Object.defineProperty(t,"buildASTSchema",{enumerable:!0,get:function(){return l.buildASTSchema}}),Object.defineProperty(t,"buildSchema",{enumerable:!0,get:function(){return l.buildSchema}}),Object.defineProperty(t,"extendSchema",{enumerable:!0,get:function(){return l.extendSchema}}),Object.defineProperty(t,"printSchema",{enumerable:!0,get:function(){return l.printSchema}}),Object.defineProperty(t,"printIntrospectionSchema",{enumerable:!0,get:function(){return l.printIntrospectionSchema}}),Object.defineProperty(t,"printType",{enumerable:!0,get:function(){return l.printType}}),Object.defineProperty(t,"typeFromAST",{enumerable:!0,get:function(){return l.typeFromAST}}),Object.defineProperty(t,"valueFromAST",{enumerable:!0,get:function(){return l.valueFromAST}}),Object.defineProperty(t,"astFromValue",{enumerable:!0,get:function(){return l.astFromValue}}),Object.defineProperty(t,"TypeInfo",{enumerable:!0,get:function(){return l.TypeInfo}}),Object.defineProperty(t,"isValidJSValue",{enumerable:!0,get:function(){return l.isValidJSValue}}),Object.defineProperty(t,"isValidLiteralValue",{enumerable:!0,get:function(){return l.isValidLiteralValue}}),Object.defineProperty(t,"concatAST",{enumerable:!0,get:function(){return l.concatAST}}),Object.defineProperty(t,"separateOperations",{enumerable:!0,get:function(){return l.separateOperations}}),Object.defineProperty(t,"isEqualType",{enumerable:!0,get:function(){return l.isEqualType}}),Object.defineProperty(t,"isTypeSubTypeOf",{enumerable:!0,get:function(){return l.isTypeSubTypeOf}}),Object.defineProperty(t,"doTypesOverlap",{enumerable:!0,get:function(){return l.doTypesOverlap}}),Object.defineProperty(t,"assertValidName",{enumerable:!0,get:function(){return l.assertValidName}}),Object.defineProperty(t,"findBreakingChanges",{enumerable:!0,get:function(){return l.findBreakingChanges}}),Object.defineProperty(t,"findDangerousChanges",{enumerable:!0,get:function(){return l.findDangerousChanges}}),Object.defineProperty(t,"BreakingChangeType",{enumerable:!0,get:function(){return l.BreakingChangeType}}),Object.defineProperty(t,"DangerousChangeType",{enumerable:!0,get:function(){return l.DangerousChangeType}}),Object.defineProperty(t,"findDeprecatedUsages",{enumerable:!0,get:function(){return l.findDeprecatedUsages}})},function(e,t,n){"use strict";function r(e,t){return e===t}function i(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:r,n=null,o=null;return function(){return i(t,n,arguments)||(o=e.apply(null,arguments)),n=arguments,o}}function a(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every(function(e){return"function"===typeof e})){var n=t.map(function(e){return typeof e}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function s(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:c;if("object"!==typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e);return t(n.map(function(t){return e[t]}),function(){for(var e=arguments.length,t=Array(e),r=0;r>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?a(e)+t:t}function u(){return!0}function c(e,t,n){return(0===e&&!d(e)||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function l(e,t){return f(e,t,0)}function p(e,t){return f(e,t,t)}function f(e,t,n){return void 0===e?n:d(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function d(e){return e<0||0===e&&1/e===-1/0}function h(e){return m(e)||x(e)}function m(e){return!(!e||!e[hn])}function g(e){return!(!e||!e[mn])}function y(e){return!(!e||!e[gn])}function v(e){return g(e)||y(e)}function b(e){return!(!e||!e[yn])}function x(e){return!(!e||!e[vn])}function C(e){return!(!e||"function"!==typeof e.equals||"function"!==typeof e.hashCode)}function E(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function D(){return{value:void 0,done:!0}}function w(e){return!!A(e)}function S(e){return e&&"function"===typeof e.next}function k(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(kn&&e[kn]||e[An]);if("function"===typeof t)return t}function _(e){return e&&"number"===typeof e.length}function T(e){return!(!e||!e[Pn])}function O(){return Rn||(Rn=new Mn([]))}function F(e){var t=Array.isArray(e)?new Mn(e):S(e)?new Un(e):w(e)?new $n(e):void 0;if(t)return t.fromEntrySeq();if("object"===typeof e)return new jn(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function N(e){var t=L(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function I(e){var t=L(e);if(t)return t;if("object"===typeof e)return new jn(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}function L(e){return _(e)?new Mn(e):S(e)?new Un(e):w(e)?new $n(e):void 0}function P(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"===typeof e.valueOf&&"function"===typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!!(C(e)&&C(t)&&e.equals(t))}function M(e){return e>>>1&1073741824|3221225471&e}function j(e){if(!1===e||null===e||void 0===e)return 0;if("function"===typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return M(n)}if("string"===t)return e.length>Qn?R(e):B(e);if("function"===typeof e.hashCode)return M(e.hashCode());if("object"===t)return $(e);if("function"===typeof e.toString)return B(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function R(e){var t=Yn[e];return void 0===t&&(t=B(e),Jn===Kn&&(Jn=0,Yn={}),Jn++,Yn[e]=t),t}function B(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function z(e){var t=ue(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=ce,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===Sn){var r=e.__iterator(t,n);return new Tn(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===wn?Dn:wn,n)},t}function G(e,t,n){var r=ue(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,pn);return o===pn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(Sn,i);return new Tn(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return E(r,s,t.call(n,a[1],s,e),i)})},r}function V(e,t){var n=this,r=ue(e);return r._iter=e,r.size=e.size,r.reverse=function(){return e},e.flip&&(r.flip=function(){var t=z(e);return t.reverse=function(){return e.flip()},t}),r.get=function(n,r){return e.get(t?n:-1-n,r)},r.has=function(n){return e.has(t?n:-1-n)},r.includes=function(t){return e.includes(t)},r.cacheResult=ce,r.__iterate=function(n,r){var i=this,o=0;return r&&a(e),e.__iterate(function(e,a){return n(e,t?a:r?i.size-++o:o++,i)},!r)},r.__iterator=function(r,i){var o=0;i&&a(e);var s=e.__iterator(Sn,!i);return new Tn(function(){var e=s.next();if(e.done)return e;var a=e.value;return E(r,t?a[0]:i?n.size-++o:o++,a[1],e)})},r}function q(e,t,n,r){var i=ue(e);return r&&(i.has=function(r){var i=e.get(r,pn);return i!==pn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,pn);return o!==pn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(Sn,o),s=0;return new Tn(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,c=u[0],l=u[1];if(t.call(n,l,c,e))return E(i,r?c:s++,l,o)}})},i}function H(e,t,n){var r=nr().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function W(e,t,n){var r=g(e),i=(b(e)?Cr():nr()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=se(e);return i.map(function(t){return oe(e,o(t))})}function Q(e,t,n,r){var i=e.size;if(c(t,n,i))return e;var o=l(t,i),a=p(n,i);if(o!==o||a!==a)return Q(e.toSeq().cacheResult(),t,n,r);var u,f=a-o;f===f&&(u=f<0?0:f);var d=ue(e);return d.size=0===u?u:e.size&&u||void 0,!r&&T(e)&&u>=0&&(d.get=function(t,n){return t=s(this,t),t>=0&&tu)return D();var e=i.next();return r||t===wn||e.done?e:t===Dn?E(t,s-1,void 0,e):E(t,s-1,e.value[1],e)})},d}function K(e,t,n){var r=ue(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(Sn,i),s=!0;return new Tn(function(){if(!s)return D();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],c=i[1];return t.call(n,c,u,o)?r===Sn?e:E(r,u,c,e):(s=!1,D())})},r}function J(e,t,n,r){var i=ue(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,c){if(!s||!(s=t.call(n,e,o,c)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(Sn,o),u=!0,c=0;return new Tn(function(){var e,o,l;do{if(e=s.next(),e.done)return r||i===wn?e:i===Dn?E(i,c++,void 0,e):E(i,c++,e.value[1],e);var p=e.value;o=p[0],l=p[1],u&&(u=t.call(n,l,o,a))}while(u);return i===Sn?e:E(i,o,l,e)})},i}function Y(e,t){var n=g(e),r=[e].concat(t).map(function(e){return m(e)?n&&(e=xn(e)):e=n?F(e):N(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===r.length)return e;if(1===r.length){var i=r[0];if(i===e||n&&g(i)||y(e)&&y(i))return i}var o=new Mn(r);return n?o=o.toKeyedSeq():y(e)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=r.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),o}function X(e,t,n){var r=ue(e);return r.__iterateUncached=function(i,o){function a(e,c){e.__iterate(function(e,o){return(!t||c0}function ie(e,t,n,r){var i=ue(e),o=new Mn(n).map(function(e){return e.size});return i.size=r?o.max():o.min(),i.__iterate=function(e,t){for(var n,r=this,i=this.__iterator(wn,t),o=0;!(n=i.next()).done&&!1!==e(n.value,o++,r););return o},i.__iteratorUncached=function(e,i){var o=n.map(function(e){return e=bn(e),k(i?e.reverse():e)}),a=0,s=!1;return new Tn(function(){var n;return s||(n=o.map(function(e){return e.next()}),s=r?n.every(function(e){return e.done}):n.some(function(e){return e.done})),s?D():E(e,a++,t.apply(null,n.map(function(e){return e.value})))})},i}function oe(e,t){return e===t?e:T(e)?t:e.constructor(t)}function ae(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function se(e){return g(e)?xn:y(e)?Cn:En}function ue(e){return Object.create((g(e)?Nn:y(e)?In:Ln).prototype)}function ce(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Fn.prototype.cacheResult.call(this)}function le(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e0;)t[n]=arguments[n+1];return Le(this,t,e)}function Le(e,t,n){for(var r=[],i=0;i0;)t[n]=arguments[n+1];return $e(e,t)}function Me(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return $e(t,n,e)}function je(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return Be(e,t)}function Re(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return Be(t,n,e)}function Be(e,t,n){return $e(e,t,Ue(n))}function $e(e,t,n){if(!ge(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(h(e))return e.mergeWith?e.mergeWith.apply(e,[n].concat(t)):e.concat.apply(e,t);for(var r=Array.isArray(e),i=e,o=r?Cn:xn,a=r?function(t){i===e&&(i=xe(i)),i.push(t)}:function(t,r){var o=On.call(i,r),a=o&&n?n(i[r],t,r):t;o&&a===i[r]||(i===e&&(i=xe(i)),i[r]=a)},s=0;s0;)t[n]=arguments[n+1];return Be(this,t,e)}function Ve(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return De(this,e,et(),function(e){return $e(e,t)})}function qe(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return De(this,e,et(),function(e){return Be(e,t)})}function He(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function We(){return this.__ownerID?this:this.__ensureOwner(new o)}function Qe(){return this.__ensureOwner()}function Ke(){return this.__altered}function Je(e){return!(!e||!e[rr])}function Ye(e,t){return E(e,t[0],t[1])}function Xe(e,t){return{node:e,index:0,__prev:t}}function Ze(e,t,n,r){var i=Object.create(ir);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function et(){return lr||(lr=Ze(0))}function tt(e,t,n){var i,o;if(e._root){var a=r(fn),s=r(dn);if(i=nt(e._root,e.__ownerID,0,void 0,t,n,a,s),!s.value)return e;o=e.size+(a.value?n===pn?-1:1:0)}else{if(n===pn)return e;o=1,i=new or(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=i,e.__hash=void 0,e.__altered=!0,e):i?Ze(o,i):et()}function nt(e,t,n,r,o,a,s,u){return e?e.update(t,n,r,o,a,s,u):a===pn?e:(i(u),i(s),new cr(t,r,[o,a]))}function rt(e){return e.constructor===cr||e.constructor===ur}function it(e,t,n,r,i){if(e.keyHash===r)return new ur(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&ln,s=(0===n?r:r>>>n)&ln,u=a===s?[it(e,t,n+un,r,i)]:(o=new cr(t,r,i),a>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new sr(e,o+1,a)}function ut(e){return e-=e>>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function ct(e,t,n,r){var i=r?e:pe(e);return i[t]=n,i}function lt(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;so?0:o-n,c=a-n;return c>cn&&(c=cn),function(){if(i===c)return xr;var e=t?--c:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,c=i>o?0:o-i>>r,l=1+(a-i>>r);return l>cn&&(l=cn),function(){for(;;){if(s){var e=s();if(e!==xr)return e;s=null}if(c===l)return xr;var o=t?--l:c++;s=n(u&&u[o],r-un,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?xt(e,t).set(0,n):xt(e,0,t+1).set(t,n)});t+=e._origin;var i=e._tail,o=e._root,a=r(dn);return t>=Ct(e._capacity)?i=yt(i,e.__ownerID,0,t,n,a):o=yt(o,e.__ownerID,e._level,t,n,a),a.value?e.__ownerID?(e._root=o,e._tail=i,e.__hash=void 0,e.__altered=!0,e):ht(e._origin,e._capacity,e._level,o,i):e}function yt(e,t,n,r,o,a){var s=r>>>n&ln,u=e&&s0){var l=e&&e.array[s],p=yt(l,t,n-un,r,o,a);return p===l?e:(c=vt(e,t),c.array[s]=p,c)}return u&&e.array[s]===o?e:(i(a),c=vt(e,t),void 0===o&&s===c.array.length-1?c.array.pop():c.array[s]=o,c)}function vt(e,t){return t&&e&&t===e.ownerID?e:new vr(e?e.array.slice():[],t)}function bt(e,t){if(t>=Ct(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&ln],r-=un;return n}}function xt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new o,i=e._origin,a=e._capacity,s=i+t,u=void 0===n?a:n<0?a+n:i+n;if(s===i&&u===a)return e;if(s>=u)return e.clear();for(var c=e._level,l=e._root,p=0;s+p<0;)l=new vr(l&&l.array.length?[void 0,l]:[],r),c+=un,p+=1<=1<f?new vr([],r):h;if(h&&d>f&&sun;y-=un){var v=f>>>y&ln;g=g.array[v]=vt(g.array[v],r)}g.array[f>>>un&ln]=h}if(u=d)s-=d,u-=d,c=un,l=null,m=m&&m.removeBefore(r,0,s);else if(s>i||d>>c&ln;if(b!==d>>>c&ln)break;b&&(p+=(1<i&&(l=l.removeBefore(r,c,s-p)),l&&d>>un<=cn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):Dt(r,i)}function kt(e){return!(!e||!e[wr])}function At(e,t,n,r){var i=Object.create(Sr);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function _t(){return kr||(kr=At(0))}function Tt(e,t){if(e===t)return!0;if(!m(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||g(e)!==g(t)||y(e)!==y(t)||b(e)!==b(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!v(e);if(b(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&P(i[1],e)&&(n||P(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"===typeof e.cacheResult&&e.cacheResult();else{i=!0;var o=e;e=t,t=o}var a=!0,s=t.__iterate(function(t,r){if(n?!e.has(t):i?!P(t,e.get(r,pn)):!P(e.get(r,pn),t))return a=!1,!1});return a&&e.size===s}function Ot(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function Ft(e){return ge(e)?Fn(e).map(Ft).toJSON():e}function Nt(e){return!(!e||!e[_r])}function It(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function Lt(e,t){var n=Object.create(Tr);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Pt(){return Or||(Or=Lt(et()))}function Mt(e,t,n){for(var r=he(t),i=0;i!==r.length;)if((e=be(e,r[i++],pn))===pn)return n;return e}function jt(e,t){return Mt(this,e,t)}function Rt(e,t){return Mt(e,t,pn)!==pn}function Bt(e){return Rt(this,e)}function $t(){de(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e}function Ut(e,t,n,r,i,o){return de(e.size),e.__iterate(function(e,o,a){i?(i=!1,n=e):n=t.call(r,n,e,o,a)},o),n}function zt(e,t){return t}function Gt(e,t){return[t,e]}function Vt(e){return function(){return!e.apply(this,arguments)}}function qt(e){return function(){return-e.apply(this,arguments)}}function Ht(){return pe(arguments)}function Wt(e,t){return et?-1:0}function Qt(e){if(e.size===1/0)return 0;var t=b(e),n=g(e),r=t?1:0;return Kt(e.__iterate(n?t?function(e,t){r=31*r+Jt(j(e),j(t))|0}:function(e,t){r=r+Jt(j(e),j(t))|0}:t?function(e){r=31*r+j(e)|0}:function(e){r=r+j(e)|0}),r)}function Kt(e,t){return t=zn(t,3432918353),t=zn(t<<15|t>>>-15,461845907),t=zn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=zn(t^t>>>16,2246822507),t=zn(t^t>>>13,3266489909),t=M(t^t>>>16)}function Jt(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}function Yt(e){return Nt(e)&&b(e)}function Xt(e,t){var n=Object.create(jr);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Zt(){return Rr||(Rr=Xt(wt()))}function en(e,t,n){var r=Object.create(Object.getPrototypeOf(e));return r._values=t,r.__ownerID=n,r}function tn(e){return e._name||e.constructor.name||"Record"}function nn(e){return F(e._keys.map(function(t){return[t,e.get(t)]}))}function rn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){fe(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}function on(e,t){return an([],t||sn,e,"",t&&t.length>2?[]:void 0,{"":e})}function an(e,t,n,r,i,o){var a=Array.isArray(n)?In:me(n)?Nn:null;if(a){if(~e.indexOf(n))throw new TypeError("Cannot convert circular structure to Immutable");e.push(n),i&&""!==r&&i.push(r);var s=t.call(o,r,a(n).map(function(r,o){return an(e,t,r,o,i,n)}),i&&i.slice());return e.pop(),i&&i.pop(),s}return n}function sn(e,t){return g(t)?t.toMap():t.toList()}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"version",function(){return Gr}),n.d(t,"Collection",function(){return bn}),n.d(t,"Iterable",function(){return qr}),n.d(t,"Seq",function(){return Fn}),n.d(t,"Map",function(){return nr}),n.d(t,"OrderedMap",function(){return Cr}),n.d(t,"List",function(){return mr}),n.d(t,"Stack",function(){return Dr}),n.d(t,"Set",function(){return Ar}),n.d(t,"OrderedSet",function(){return Mr}),n.d(t,"Record",function(){return Br}),n.d(t,"Range",function(){return Nr}),n.d(t,"Repeat",function(){return zr}),n.d(t,"is",function(){return P}),n.d(t,"fromJS",function(){return on}),n.d(t,"hash",function(){return j}),n.d(t,"isImmutable",function(){return h}),n.d(t,"isCollection",function(){return m}),n.d(t,"isKeyed",function(){return g}),n.d(t,"isIndexed",function(){return y}),n.d(t,"isAssociative",function(){return v}),n.d(t,"isOrdered",function(){return b}),n.d(t,"isValueObject",function(){return C}),n.d(t,"get",function(){return be}),n.d(t,"getIn",function(){return Mt}),n.d(t,"has",function(){return ve}),n.d(t,"hasIn",function(){return Rt}),n.d(t,"merge",function(){return Pe}),n.d(t,"mergeDeep",function(){return je}),n.d(t,"mergeWith",function(){return Me}),n.d(t,"mergeDeepWith",function(){return Re}),n.d(t,"remove",function(){return Ce}),n.d(t,"removeIn",function(){return Ae}),n.d(t,"set",function(){return Ee}),n.d(t,"setIn",function(){return Se}),n.d(t,"update",function(){return Te}),n.d(t,"updateIn",function(){return De});var un=5,cn=1<=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return E(e,i,r[i++])})},t}(In),zn="function"===typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Gn=Object.isExtensible,Vn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),qn="function"===typeof WeakMap;qn&&(Bn=new WeakMap);var Hn=0,Wn="__immutablehash__";"function"===typeof Symbol&&(Wn=Symbol(Wn));var Qn=16,Kn=255,Jn=0,Yn={},Xn=function(e){function t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this._iter.get(e,t)},t.prototype.has=function(e){return this._iter.has(e)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var e=this,t=V(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var n=this,r=G(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},t.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t,r){return e(t,r,n)},t)},t.prototype.__iterator=function(e,t){return this._iter.__iterator(e,t)},t}(Nn);Xn.prototype[yn]=!0;var Zn=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.includes=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var n=this,r=0;return t&&a(this),this._iter.__iterate(function(i){return e(i,t?n.size-++r:r++,n)},t)},t.prototype.__iterator=function(e,t){var n=this,r=this._iter.__iterator(wn,t),i=0;return t&&a(this),new Tn(function(){var o=r.next();return o.done?o:E(e,t?n.size-++i:i++,o.value,o)})},t}(In),er=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.has=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},t.prototype.__iterator=function(e,t){var n=this._iter.__iterator(wn,t);return new Tn(function(){var t=n.next();return t.done?t:E(e,t.value,t.value,t)})},t}(Ln),tr=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){ae(t);var r=m(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},t.prototype.__iterator=function(e,t){var n=this._iter.__iterator(wn,t);return new Tn(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){ae(r);var i=m(r);return E(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},t}(Nn);Zn.prototype.cacheResult=Xn.prototype.cacheResult=er.prototype.cacheResult=tr.prototype.cacheResult=ce;var nr=function(e){function t(t){return null===t||void 0===t?et():Je(t)&&!b(t)?t:et().withMutations(function(n){var r=e(t);de(r.size),r.forEach(function(e,t){return n.set(t,e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return et().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return tt(this,e,t)},t.prototype.remove=function(e){return tt(this,e,pn)},t.prototype.deleteAll=function(e){var t=bn(e);return 0===t.size?this:this.withMutations(function(e){t.forEach(function(t){return e.remove(t)})})},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):et()},t.prototype.sort=function(e){return Cr(te(this,e))},t.prototype.sortBy=function(e,t){return Cr(te(this,t,e))},t.prototype.__iterator=function(e,t){return new pr(this,e,t)},t.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ze(this.size,this._root,e,this.__hash):0===this.size?et():(this.__ownerID=e,this.__altered=!1,this)},t}(xn);nr.isMap=Je;var rr="@@__IMMUTABLE_MAP__@@",ir=nr.prototype;ir[rr]=!0,ir.delete=ir.remove,ir.removeAll=ir.deleteAll,ir.concat=ir.merge,ir.setIn=ke,ir.removeIn=ir.deleteIn=_e,ir.update=Oe,ir.updateIn=Fe,ir.merge=Ne,ir.mergeWith=Ie,ir.mergeDeep=ze,ir.mergeDeepWith=Ge,ir.mergeIn=Ve,ir.mergeDeepIn=qe,ir.withMutations=He,ir.wasAltered=Ke,ir.asImmutable=Qe,ir["@@transducer/init"]=ir.asMutable=We,ir["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},ir["@@transducer/result"]=function(e){return e.asImmutable()};var or=function(e,t){this.ownerID=e,this.entries=t};or.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=fr)return ot(e,c,r,o);var d=e&&e===this.ownerID,h=d?c:pe(c);return f?u?l===p-1?h.pop():h[l]=h.pop():h[l]=[r,o]:h.push([r,o]),d?(this.entries=h,this):new or(e,h)}};var ar=function(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n};ar.prototype.get=function(e,t,n,r){void 0===t&&(t=j(n));var i=1<<((0===e?t:t>>>e)&ln),o=this.bitmap;return 0===(o&i)?r:this.nodes[ut(o&i-1)].get(e+un,t,n,r)},ar.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=j(r));var s=(0===t?n:n>>>t)&ln,u=1<=dr)return st(e,f,c,s,h);if(l&&!h&&2===f.length&&rt(f[1^p]))return f[1^p];if(l&&h&&1===f.length&&rt(h))return h;var m=e&&e===this.ownerID,g=l?h?c:c^u:c|u,y=l?h?ct(f,p,h,m):pt(f,p,m):lt(f,p,h,m);return m?(this.bitmap=g,this.nodes=y,this):new ar(e,g,y)};var sr=function(e,t,n){this.ownerID=e,this.count=t,this.nodes=n};sr.prototype.get=function(e,t,n,r){void 0===t&&(t=j(n));var i=(0===e?t:t>>>e)&ln,o=this.nodes[i];return o?o.get(e+un,t,n,r):r},sr.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=j(r));var s=(0===t?n:n>>>t)&ln,u=i===pn,c=this.nodes,l=c[s];if(u&&!l)return this;var p=nt(l,e,t+un,n,r,i,o,a);if(p===l)return this;var f=this.count;if(l){if(!p&&--f
0&&i=0&&e>>t&ln;if(r>=this.array.length)return new vr([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-un,n))===a&&o)return this}if(o&&!i)return this;var s=vt(this,e);if(!o)for(var u=0;u>>t&ln;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-un,n))===o&&r===this.array.length-1)return this}var a=vt(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var br,xr={},Cr=function(e){function t(e){return null===e||void 0===e?wt():Et(e)?e:wt().withMutations(function(t){var n=xn(e);de(n.size),n.forEach(function(e,n){return t.set(n,e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):wt()},t.prototype.set=function(e,t){return St(this,e,t)},t.prototype.remove=function(e){return St(this,e,pn)},t.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},t.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},t.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?Dt(t,n,e,this.__hash):0===this.size?wt():(this.__ownerID=e,this._map=t,this._list=n,this)},t}(nr);Cr.isOrderedMap=Et,Cr.prototype[yn]=!0,Cr.prototype.delete=Cr.prototype.remove;var Er,Dr=function(e){function t(e){return null===e||void 0===e?_t():kt(e)?e:_t().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var n=this._head;for(e=s(this,e);n&&e--;)n=n.next;return n?n.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,n=this._head,r=arguments.length-1;r>=0;r--)n={value:e[r],next:n};return this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):At(t,n)},t.prototype.pushAll=function(t){if(t=e(t),0===t.size)return this;if(0===this.size&&kt(t))return t;de(t.size);var n=this.size,r=this._head;return t.__iterate(function(e){n++,r={value:e,next:r}},!0),this.__ownerID?(this.size=n,this._head=r,this.__hash=void 0,this.__altered=!0,this):At(n,r)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):_t()},t.prototype.slice=function(t,n){if(c(t,n,this.size))return this;var r=l(t,this.size);if(p(n,this.size)!==this.size)return e.prototype.slice.call(this,t,n);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):At(i,o)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?At(this.size,this._head,e,this.__hash):0===this.size?_t():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var n=this;if(t)return new Mn(this.toArray()).__iterate(function(t,r){return e(t,r,n)},t);for(var r=0,i=this._head;i&&!1!==e(i.value,r++,n);)i=i.next;return r},t.prototype.__iterator=function(e,t){if(t)return new Mn(this.toArray()).__iterator(e,t);var n=0,r=this._head;return new Tn(function(){if(r){var t=r.value;return r=r.next,E(e,n++,t)}return D()})},t}(Cn);Dr.isStack=kt;var wr="@@__IMMUTABLE_STACK__@@",Sr=Dr.prototype;Sr[wr]=!0,Sr.shift=Sr.pop,Sr.unshift=Sr.push,Sr.unshiftAll=Sr.pushAll,Sr.withMutations=He,Sr.wasAltered=Ke,Sr.asImmutable=Qe,Sr["@@transducer/init"]=Sr.asMutable=We,Sr["@@transducer/step"]=function(e,t){return e.unshift(t)},Sr["@@transducer/result"]=function(e){return e.asImmutable()};var kr,Ar=function(e){function t(t){return null===t||void 0===t?Pt():Nt(t)&&!b(t)?t:Pt().withMutations(function(n){var r=e(t);de(r.size),r.forEach(function(e){return n.add(e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(xn(e).keySeq())},t.intersect=function(e){return e=bn(e).toArray(),e.length?Tr.intersect.apply(t(e.pop()),e):Pt()},t.union=function(e){return e=bn(e).toArray(),e.length?Tr.union.apply(t(e.pop()),e):Pt()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return It(this,this._map.set(e,e))},t.prototype.remove=function(e){return It(this,this._map.remove(e))},t.prototype.clear=function(){return It(this,this._map.clear())},t.prototype.union=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return t=t.filter(function(e){return 0!==e.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(n){for(var r=0;r=0&&t=0&&n