var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; (function() { "use strict"; var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs(x2) { return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2; } var jsxRuntime = { exports: {} }; var reactJsxRuntime_development = {}; var react = { exports: {} }; var react_development = { exports: {} }; /** * @license React * react.development.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. */ react_development.exports; (function(module, exports) { { (function() { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } var ReactVersion = "18.2.0"; var REACT_ELEMENT_TYPE = Symbol.for("react.element"); var REACT_PORTAL_TYPE = Symbol.for("react.portal"); var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); var REACT_CONTEXT_TYPE = Symbol.for("react.context"); var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); var REACT_MEMO_TYPE = Symbol.for("react.memo"); var REACT_LAZY_TYPE = Symbol.for("react.lazy"); var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== "object") { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === "function") { return maybeIterator; } return null; } var ReactCurrentDispatcher = { /** * @internal * @type {ReactComponent} */ current: null }; var ReactCurrentBatchConfig = { transition: null }; var ReactCurrentActQueue = { current: null, // Used to reproduce behavior of `batchedUpdates` in legacy mode. isBatchingLegacy: false, didScheduleLegacyUpdate: false }; var ReactCurrentOwner = { /** * @internal * @type {ReactComponent} */ current: null }; var ReactDebugCurrentFrame = {}; var currentExtraStackFrame = null; function setExtraStackFrame(stack) { { currentExtraStackFrame = stack; } } { ReactDebugCurrentFrame.setExtraStackFrame = function(stack) { { currentExtraStackFrame = stack; } }; ReactDebugCurrentFrame.getCurrentStack = null; ReactDebugCurrentFrame.getStackAddendum = function() { var stack = ""; if (currentExtraStackFrame) { stack += currentExtraStackFrame; } var impl = ReactDebugCurrentFrame.getCurrentStack; if (impl) { stack += impl() || ""; } return stack; }; } var enableScopeAPI = false; var enableCacheElement = false; var enableTransitionTracing = false; var enableLegacyHidden = false; var enableDebugTracing = false; var ReactSharedInternals = { ReactCurrentDispatcher, ReactCurrentBatchConfig, ReactCurrentOwner }; { ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; } function warn(format) { { { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } printWarning("warn", format, args); } } } function error(format) { { { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning("error", format, args); } } } function printWarning(level, format, args) { { var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame2.getStackAddendum(); if (stack !== "") { format += "%s"; args = args.concat([stack]); } var argsWithFormat = args.map(function(item) { return String(item); }); argsWithFormat.unshift("Warning: " + format); Function.prototype.apply.call(console[level], console, argsWithFormat); } } var didWarnStateUpdateForUnmountedComponent = {}; function warnNoop(publicInstance, callerName) { { var _constructor = publicInstance.constructor; var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass"; var warningKey = componentName + "." + callerName; if (didWarnStateUpdateForUnmountedComponent[warningKey]) { return; } error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName); didWarnStateUpdateForUnmountedComponent[warningKey] = true; } } var ReactNoopUpdateQueue = { /** * Checks whether or not this composite component is mounted. * @param {ReactClass} publicInstance The instance we want to test. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function(publicInstance) { return false; }, /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueForceUpdate: function(publicInstance, callback, callerName) { warnNoop(publicInstance, "forceUpdate"); }, /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} completeState Next state. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueReplaceState: function(publicInstance, completeState, callback, callerName) { warnNoop(publicInstance, "replaceState"); }, /** * Sets a subset of the state. This only exists because _pendingState is * internal. This provides a merging strategy that is not available to deep * properties which is confusing. TODO: Expose pendingState or don't use it * during the merge. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} partialState Next partial state to be merged with state. * @param {?function} callback Called after component is updated. * @param {?string} Name of the calling function in the public API. * @internal */ enqueueSetState: function(publicInstance, partialState, callback, callerName) { warnNoop(publicInstance, "setState"); } }; var assign = Object.assign; var emptyObject = {}; { Object.freeze(emptyObject); } function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; } Component.prototype.isReactComponent = {}; Component.prototype.setState = function(partialState, callback) { if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) { throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); } this.updater.enqueueSetState(this, partialState, callback, "setState"); }; Component.prototype.forceUpdate = function(callback) { this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); }; { var deprecatedAPIs = { isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."], replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."] }; var defineDeprecationWarning = function(methodName, info) { Object.defineProperty(Component.prototype, methodName, { get: function() { warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]); return void 0; } }); }; for (var fnName in deprecatedAPIs) { if (deprecatedAPIs.hasOwnProperty(fnName)) { defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); } } } function ComponentDummy() { } ComponentDummy.prototype = Component.prototype; function PureComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; } var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); pureComponentPrototype.constructor = PureComponent; assign(pureComponentPrototype, Component.prototype); pureComponentPrototype.isPureReactComponent = true; function createRef() { var refObject = { current: null }; { Object.seal(refObject); } return refObject; } var isArrayImpl = Array.isArray; function isArray(a2) { return isArrayImpl(a2); } function typeName2(value) { { var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object"; return type; } } function willCoercionThrow(value) { { try { testStringCoercion(value); return false; } catch (e2) { return true; } } } function testStringCoercion(value) { return "" + value; } function checkKeyStringCoercion(value) { { if (willCoercionThrow(value)) { error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName2(value)); return testStringCoercion(value); } } } function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { return displayName; } var functionName = innerType.displayName || innerType.name || ""; return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName; } function getContextName(type) { return type.displayName || "Context"; } function getComponentNameFromType(type) { if (type == null) { return null; } { if (typeof type.tag === "number") { error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."); } } if (typeof type === "function") { return type.displayName || type.name || null; } if (typeof type === "string") { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: return "Portal"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + ".Consumer"; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + ".Provider"; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; if (outerName !== null) { return outerName; } return getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentNameFromType(init(payload)); } catch (x2) { return null; } } } } return null; } var hasOwnProperty = Object.prototype.hasOwnProperty; var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; { didWarnAboutStringRefs = {}; } function hasValidRef(config) { { if (hasOwnProperty.call(config, "ref")) { var getter = Object.getOwnPropertyDescriptor(config, "ref").get; if (getter && getter.isReactWarning) { return false; } } } return config.ref !== void 0; } function hasValidKey(config) { { if (hasOwnProperty.call(config, "key")) { var getter = Object.getOwnPropertyDescriptor(config, "key").get; if (getter && getter.isReactWarning) { return false; } } } return config.key !== void 0; } function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function() { { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: true }); } function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function() { { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, "ref", { get: warnAboutAccessingRef, configurable: true }); } function warnIfStringRefCannotBeAutoConverted(config) { { if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); if (!didWarnAboutStringRefs[componentName]) { error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); didWarnAboutStringRefs[componentName] = true; } } } } var ReactElement = function(type, key, ref, self2, source, owner, props) { var element = { // This tag allows us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type, key, ref, props, // Record the component responsible for creating this element. _owner: owner }; { element._store = {}; Object.defineProperty(element._store, "validated", { configurable: false, enumerable: false, writable: true, value: false }); Object.defineProperty(element, "_self", { configurable: false, enumerable: false, writable: false, value: self2 }); Object.defineProperty(element, "_source", { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }; function createElement(type, config, children) { var propName; var props = {}; var key = null; var ref = null; var self2 = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; { warnIfStringRefCannotBeAutoConverted(config); } } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = "" + config.key; } self2 = config.__self === void 0 ? null : config.__self; source = config.__source === void 0 ? null : config.__source; for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i2 = 0; i2 < childrenLength; i2++) { childArray[i2] = arguments[i2 + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props); } function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; } function cloneElement(element, config, children) { if (element === null || element === void 0) { throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); } var propName; var props = assign({}, element.props); var key = element.key; var ref = element.ref; var self2 = element._self; var source = element._source; var owner = element._owner; if (config != null) { if (hasValidRef(config)) { ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = "" + config.key; } var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === void 0 && defaultProps !== void 0) { props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i2 = 0; i2 < childrenLength; i2++) { childArray[i2] = arguments[i2 + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self2, source, owner, props); } function isValidElement(object) { return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } var SEPARATOR = "."; var SUBSEPARATOR = ":"; function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { "=": "=0", ":": "=2" }; var escapedString = key.replace(escapeRegex, function(match) { return escaperLookup[match]; }); return "$" + escapedString; } var didWarnAboutMaps = false; var userProvidedKeyEscapeRegex = /\/+/g; function escapeUserProvidedKey(text) { return text.replace(userProvidedKeyEscapeRegex, "$&/"); } function getElementKey(element, index2) { if (typeof element === "object" && element !== null && element.key != null) { { checkKeyStringCoercion(element.key); } return escape("" + element.key); } return index2.toString(36); } function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { var type = typeof children; if (type === "undefined" || type === "boolean") { children = null; } var invokeCallback = false; if (children === null) { invokeCallback = true; } else { switch (type) { case "string": case "number": invokeCallback = true; break; case "object": switch (children.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: invokeCallback = true; } } } if (invokeCallback) { var _child = children; var mappedChild = callback(_child); var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; if (isArray(mappedChild)) { var escapedChildKey = ""; if (childKey != null) { escapedChildKey = escapeUserProvidedKey(childKey) + "/"; } mapIntoArray(mappedChild, array, escapedChildKey, "", function(c2) { return c2; }); } else if (mappedChild != null) { if (isValidElement(mappedChild)) { { if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { checkKeyStringCoercion(mappedChild.key); } } mappedChild = cloneAndReplaceKey( mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? ( // $FlowFixMe Flow incorrectly thinks existing element's key can be a number // eslint-disable-next-line react-internal/safe-string-coercion escapeUserProvidedKey("" + mappedChild.key) + "/" ) : "") + childKey ); } array.push(mappedChild); } return 1; } var child; var nextName; var subtreeCount = 0; var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (isArray(children)) { for (var i2 = 0; i2 < children.length; i2++) { child = children[i2]; nextName = nextNamePrefix + getElementKey(child, i2); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === "function") { var iterableChildren = children; { if (iteratorFn === iterableChildren.entries) { if (!didWarnAboutMaps) { warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."); } didWarnAboutMaps = true; } } var iterator = iteratorFn.call(iterableChildren); var step; var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = nextNamePrefix + getElementKey(child, ii++); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else if (type === "object") { var childrenString = String(children); throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead."); } } return subtreeCount; } function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; var count = 0; mapIntoArray(children, result, "", "", function(child) { return func.call(context, child, count++); }); return result; } function countChildren(children) { var n2 = 0; mapChildren(children, function() { n2++; }); return n2; } function forEachChildren(children, forEachFunc, forEachContext) { mapChildren(children, function() { forEachFunc.apply(this, arguments); }, forEachContext); } function toArray(children) { return mapChildren(children, function(child) { return child; }) || []; } function onlyChild(children) { if (!isValidElement(children)) { throw new Error("React.Children.only expected to receive a single React element child."); } return children; } function createContext(defaultValue) { var context = { $$typeof: REACT_CONTEXT_TYPE, // As a workaround to support multiple concurrent renderers, we categorize // some renderers as primary and others as secondary. We only expect // there to be two concurrent renderers at most: React Native (primary) and // Fabric (secondary); React DOM (primary) and React ART (secondary). // Secondary renderers store their context values on separate fields. _currentValue: defaultValue, _currentValue2: defaultValue, // Used to track how many concurrent renderers this context currently // supports within in a single renderer. Such as parallel server rendering. _threadCount: 0, // These are circular Provider: null, Consumer: null, // Add these to use same hidden class in VM as ServerContext _defaultValue: null, _globalName: null }; context.Provider = { $$typeof: REACT_PROVIDER_TYPE, _context: context }; var hasWarnedAboutUsingNestedContextConsumers = false; var hasWarnedAboutUsingConsumerProvider = false; var hasWarnedAboutDisplayNameOnConsumer = false; { var Consumer = { $$typeof: REACT_CONTEXT_TYPE, _context: context }; Object.defineProperties(Consumer, { Provider: { get: function() { if (!hasWarnedAboutUsingConsumerProvider) { hasWarnedAboutUsingConsumerProvider = true; error("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"); } return context.Provider; }, set: function(_Provider) { context.Provider = _Provider; } }, _currentValue: { get: function() { return context._currentValue; }, set: function(_currentValue) { context._currentValue = _currentValue; } }, _currentValue2: { get: function() { return context._currentValue2; }, set: function(_currentValue2) { context._currentValue2 = _currentValue2; } }, _threadCount: { get: function() { return context._threadCount; }, set: function(_threadCount) { context._threadCount = _threadCount; } }, Consumer: { get: function() { if (!hasWarnedAboutUsingNestedContextConsumers) { hasWarnedAboutUsingNestedContextConsumers = true; error("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"); } return context.Consumer; } }, displayName: { get: function() { return context.displayName; }, set: function(displayName) { if (!hasWarnedAboutDisplayNameOnConsumer) { warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName); hasWarnedAboutDisplayNameOnConsumer = true; } } } }); context.Consumer = Consumer; } { context._currentRenderer = null; context._currentRenderer2 = null; } return context; } var Uninitialized = -1; var Pending = 0; var Resolved = 1; var Rejected = 2; function lazyInitializer(payload) { if (payload._status === Uninitialized) { var ctor = payload._result; var thenable = ctor(); thenable.then(function(moduleObject2) { if (payload._status === Pending || payload._status === Uninitialized) { var resolved = payload; resolved._status = Resolved; resolved._result = moduleObject2; } }, function(error2) { if (payload._status === Pending || payload._status === Uninitialized) { var rejected = payload; rejected._status = Rejected; rejected._result = error2; } }); if (payload._status === Uninitialized) { var pending = payload; pending._status = Pending; pending._result = thenable; } } if (payload._status === Resolved) { var moduleObject = payload._result; { if (moduleObject === void 0) { error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject); } } { if (!("default" in moduleObject)) { error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); } } return moduleObject.default; } else { throw payload._result; } } function lazy(ctor) { var payload = { // We use these fields to store the result. _status: Uninitialized, _result: ctor }; var lazyType = { $$typeof: REACT_LAZY_TYPE, _payload: payload, _init: lazyInitializer }; { var defaultProps; var propTypes; Object.defineProperties(lazyType, { defaultProps: { configurable: true, get: function() { return defaultProps; }, set: function(newDefaultProps) { error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); defaultProps = newDefaultProps; Object.defineProperty(lazyType, "defaultProps", { enumerable: true }); } }, propTypes: { configurable: true, get: function() { return propTypes; }, set: function(newPropTypes) { error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); propTypes = newPropTypes; Object.defineProperty(lazyType, "propTypes", { enumerable: true }); } } }); } return lazyType; } function forwardRef(render) { { if (render != null && render.$$typeof === REACT_MEMO_TYPE) { error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."); } else if (typeof render !== "function") { error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render); } else { if (render.length !== 0 && render.length !== 2) { error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."); } } if (render != null) { if (render.defaultProps != null || render.propTypes != null) { error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"); } } } var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name2) { ownName = name2; if (!render.name && !render.displayName) { render.displayName = name2; } } }); } return elementType; } var REACT_MODULE_REFERENCE; { REACT_MODULE_REFERENCE = Symbol.for("react.module.reference"); } function isValidElementType(type) { if (typeof type === "string" || typeof type === "function") { return true; } if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { return true; } if (typeof type === "object" && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) { return true; } } return false; } function memo(type, compare2) { { if (!isValidElementType(type)) { error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type); } } var elementType = { $$typeof: REACT_MEMO_TYPE, type, compare: compare2 === void 0 ? null : compare2 }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name2) { ownName = name2; if (!type.name && !type.displayName) { type.displayName = name2; } } }); } return elementType; } function resolveDispatcher() { var dispatcher = ReactCurrentDispatcher.current; { if (dispatcher === null) { error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."); } } return dispatcher; } function useContext(Context) { var dispatcher = resolveDispatcher(); { if (Context._context !== void 0) { var realContext = Context._context; if (realContext.Consumer === Context) { error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"); } else if (realContext.Provider === Context) { error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?"); } } } return dispatcher.useContext(Context); } function useState(initialState) { var dispatcher = resolveDispatcher(); return dispatcher.useState(initialState); } function useReducer(reducer, initialArg, init) { var dispatcher = resolveDispatcher(); return dispatcher.useReducer(reducer, initialArg, init); } function useRef(initialValue) { var dispatcher = resolveDispatcher(); return dispatcher.useRef(initialValue); } function useEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useEffect(create, deps); } function useInsertionEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useInsertionEffect(create, deps); } function useLayoutEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useLayoutEffect(create, deps); } function useCallback(callback, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useCallback(callback, deps); } function useMemo(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useMemo(create, deps); } function useImperativeHandle(ref, create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useImperativeHandle(ref, create, deps); } function useDebugValue(value, formatterFn) { { var dispatcher = resolveDispatcher(); return dispatcher.useDebugValue(value, formatterFn); } } function useTransition() { var dispatcher = resolveDispatcher(); return dispatcher.useTransition(); } function useDeferredValue(value) { var dispatcher = resolveDispatcher(); return dispatcher.useDeferredValue(value); } function useId() { var dispatcher = resolveDispatcher(); return dispatcher.useId(); } function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var dispatcher = resolveDispatcher(); return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); } var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() { } disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { var props = { configurable: true, enumerable: true, writable: true }; Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); } if (disabledDepth < 0) { error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name2, source, ownerFn) { { if (prefix === void 0) { try { throw Error(); } catch (x2) { var match = x2.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; } } return "\n" + prefix + name2; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) { return ""; } { var frame = componentFrameCache.get(fn); if (frame !== void 0) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = null; disableLogs(); } try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if (typeof Reflect === "object" && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x2) { control = x2; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x2) { control = x2; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x2) { control = x2; } fn(); } } catch (sample) { if (sample && control && typeof sample.stack === "string") { var sampleLines = sample.stack.split("\n"); var controlLines = control.stack.split("\n"); var s2 = sampleLines.length - 1; var c2 = controlLines.length - 1; while (s2 >= 1 && c2 >= 0 && sampleLines[s2] !== controlLines[c2]) { c2--; } for (; s2 >= 1 && c2 >= 0; s2--, c2--) { if (sampleLines[s2] !== controlLines[c2]) { if (s2 !== 1 || c2 !== 1) { do { s2--; c2--; if (c2 < 0 || sampleLines[s2] !== controlLines[c2]) { var _frame = "\n" + sampleLines[s2].replace(" at new ", " at "); if (fn.displayName && _frame.includes("")) { _frame = _frame.replace("", fn.displayName); } { if (typeof fn === "function") { componentFrameCache.set(fn, _frame); } } return _frame; } } while (s2 >= 1 && c2 >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher$1.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } var name2 = fn ? fn.displayName || fn.name : ""; var syntheticFrame = name2 ? describeBuiltInComponentFrame(name2) : ""; { if (typeof fn === "function") { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component2) { var prototype = Component2.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ""; } if (typeof type === "function") { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === "string") { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x2) { } } } } return ""; } var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } } function checkPropTypes(typeSpecs, values, location, componentName, element) { { var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; try { if (typeof typeSpecs[typeSpecName] !== "function") { var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); err.name = "Invariant Violation"; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error("Failed %s type: %s", location, error$1.message); setCurrentlyValidatingElement(null); } } } } } function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); setExtraStackFrame(stack); } else { setExtraStackFrame(null); } } } var propTypesMisspellWarningShown; { propTypesMisspellWarningShown = false; } function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name2 = getComponentNameFromType(ReactCurrentOwner.current.type); if (name2) { return "\n\nCheck the render method of `" + name2 + "`."; } } return ""; } function getSourceInfoErrorAddendum(source) { if (source !== void 0) { var fileName = source.fileName.replace(/^.*[\\\/]/, ""); var lineNumber = source.lineNumber; return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; } return ""; } function getSourceInfoErrorAddendumForProps(elementProps) { if (elementProps !== null && elementProps !== void 0) { return getSourceInfoErrorAddendum(elementProps.__source); } return ""; } var ownerHasKeyUseWarning = {}; function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + parentName + ">."; } } return info; } function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; var childOwner = ""; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; } { setCurrentlyValidatingElement$1(element); error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); setCurrentlyValidatingElement$1(null); } } function validateChildKeys(node, parentType) { if (typeof node !== "object") { return; } if (isArray(node)) { for (var i2 = 0; i2 < node.length; i2++) { var child = node[i2]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === "function") { if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } } function validatePropTypes(element) { { var type = element.type; if (type === null || type === void 0 || typeof type === "string") { return; } var propTypes; if (typeof type === "function") { propTypes = type.propTypes; } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. type.$$typeof === REACT_MEMO_TYPE)) { propTypes = type.propTypes; } else { return; } if (propTypes) { var name2 = getComponentNameFromType(type); checkPropTypes(propTypes, element.props, "prop", name2, element); } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; var _name = getComponentNameFromType(type); error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown"); } if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) { error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } } function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i2 = 0; i2 < keys.length; i2++) { var key = keys[i2]; if (key !== "children" && key !== "key") { setCurrentlyValidatingElement$1(fragment); error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key); setCurrentlyValidatingElement$1(null); break; } } if (fragment.ref !== null) { setCurrentlyValidatingElement$1(fragment); error("Invalid attribute `ref` supplied to `React.Fragment`."); setCurrentlyValidatingElement$1(null); } } } function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); if (!validType) { var info = ""; if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) { info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendumForProps(props); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } var typeString; if (type === null) { typeString = "null"; } else if (isArray(type)) { typeString = "array"; } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) { typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />"; info = " Did you accidentally export a JSX literal instead of a component?"; } else { typeString = typeof type; } { error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } } var element = createElement.apply(this, arguments); if (element == null) { return element; } if (validType) { for (var i2 = 2; i2 < arguments.length; i2++) { validateChildKeys(arguments[i2], type); } } if (type === REACT_FRAGMENT_TYPE) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; } var didWarnAboutDeprecatedCreateFactory = false; function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); validatedFactory.type = type; { if (!didWarnAboutDeprecatedCreateFactory) { didWarnAboutDeprecatedCreateFactory = true; warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead."); } Object.defineProperty(validatedFactory, "type", { enumerable: false, get: function() { warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."); Object.defineProperty(this, "type", { value: type }); return type; } }); } return validatedFactory; } function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i2 = 2; i2 < arguments.length; i2++) { validateChildKeys(arguments[i2], newElement.type); } validatePropTypes(newElement); return newElement; } function startTransition(scope, options) { var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = {}; var currentTransition = ReactCurrentBatchConfig.transition; { ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set(); } try { scope(); } finally { ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { var updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."); } currentTransition._updatedFibers.clear(); } } } } var didWarnAboutMessageChannel = false; var enqueueTaskImpl = null; function enqueueTask(task) { if (enqueueTaskImpl === null) { try { var requireString = ("require" + Math.random()).slice(0, 7); var nodeRequire = module && module[requireString]; enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate; } catch (_err) { enqueueTaskImpl = function(callback) { { if (didWarnAboutMessageChannel === false) { didWarnAboutMessageChannel = true; if (typeof MessageChannel === "undefined") { error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."); } } } var channel = new MessageChannel(); channel.port1.onmessage = callback; channel.port2.postMessage(void 0); }; } } return enqueueTaskImpl(task); } var actScopeDepth = 0; var didWarnNoAwaitAct = false; function act(callback) { { var prevActScopeDepth = actScopeDepth; actScopeDepth++; if (ReactCurrentActQueue.current === null) { ReactCurrentActQueue.current = []; } var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; var result; try { ReactCurrentActQueue.isBatchingLegacy = true; result = callback(); if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { var queue = ReactCurrentActQueue.current; if (queue !== null) { ReactCurrentActQueue.didScheduleLegacyUpdate = false; flushActQueue(queue); } } } catch (error2) { popActScope(prevActScopeDepth); throw error2; } finally { ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; } if (result !== null && typeof result === "object" && typeof result.then === "function") { var thenableResult = result; var wasAwaited = false; var thenable = { then: function(resolve, reject) { wasAwaited = true; thenableResult.then(function(returnValue2) { popActScope(prevActScopeDepth); if (actScopeDepth === 0) { recursivelyFlushAsyncActWork(returnValue2, resolve, reject); } else { resolve(returnValue2); } }, function(error2) { popActScope(prevActScopeDepth); reject(error2); }); } }; { if (!didWarnNoAwaitAct && typeof Promise !== "undefined") { Promise.resolve().then(function() { }).then(function() { if (!wasAwaited) { didWarnNoAwaitAct = true; error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"); } }); } } return thenable; } else { var returnValue = result; popActScope(prevActScopeDepth); if (actScopeDepth === 0) { var _queue = ReactCurrentActQueue.current; if (_queue !== null) { flushActQueue(_queue); ReactCurrentActQueue.current = null; } var _thenable = { then: function(resolve, reject) { if (ReactCurrentActQueue.current === null) { ReactCurrentActQueue.current = []; recursivelyFlushAsyncActWork(returnValue, resolve, reject); } else { resolve(returnValue); } } }; return _thenable; } else { var _thenable2 = { then: function(resolve, reject) { resolve(returnValue); } }; return _thenable2; } } } } function popActScope(prevActScopeDepth) { { if (prevActScopeDepth !== actScopeDepth - 1) { error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "); } actScopeDepth = prevActScopeDepth; } } function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { { var queue = ReactCurrentActQueue.current; if (queue !== null) { try { flushActQueue(queue); enqueueTask(function() { if (queue.length === 0) { ReactCurrentActQueue.current = null; resolve(returnValue); } else { recursivelyFlushAsyncActWork(returnValue, resolve, reject); } }); } catch (error2) { reject(error2); } } else { resolve(returnValue); } } } var isFlushing = false; function flushActQueue(queue) { { if (!isFlushing) { isFlushing = true; var i2 = 0; try { for (; i2 < queue.length; i2++) { var callback = queue[i2]; do { callback = callback(true); } while (callback !== null); } queue.length = 0; } catch (error2) { queue = queue.slice(i2 + 1); throw error2; } finally { isFlushing = false; } } } } var createElement$1 = createElementWithValidation; var cloneElement$1 = cloneElementWithValidation; var createFactory = createFactoryWithValidation; var Children = { map: mapChildren, forEach: forEachChildren, count: countChildren, toArray, only: onlyChild }; exports.Children = Children; exports.Component = Component; exports.Fragment = REACT_FRAGMENT_TYPE; exports.Profiler = REACT_PROFILER_TYPE; exports.PureComponent = PureComponent; exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; exports.cloneElement = cloneElement$1; exports.createContext = createContext; exports.createElement = createElement$1; exports.createFactory = createFactory; exports.createRef = createRef; exports.forwardRef = forwardRef; exports.isValidElement = isValidElement; exports.lazy = lazy; exports.memo = memo; exports.startTransition = startTransition; exports.unstable_act = act; exports.useCallback = useCallback; exports.useContext = useContext; exports.useDebugValue = useDebugValue; exports.useDeferredValue = useDeferredValue; exports.useEffect = useEffect; exports.useId = useId; exports.useImperativeHandle = useImperativeHandle; exports.useInsertionEffect = useInsertionEffect; exports.useLayoutEffect = useLayoutEffect; exports.useMemo = useMemo; exports.useReducer = useReducer; exports.useRef = useRef; exports.useState = useState; exports.useSyncExternalStore = useSyncExternalStore; exports.useTransition = useTransition; exports.version = ReactVersion; if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); } })(); } })(react_development, react_development.exports); var react_developmentExports = react_development.exports; { react.exports = react_developmentExports; } var reactExports = react.exports; const React = /* @__PURE__ */ getDefaultExportFromCjs(reactExports); /** * @license React * react-jsx-runtime.development.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() { var React2 = reactExports; var REACT_ELEMENT_TYPE = Symbol.for("react.element"); var REACT_PORTAL_TYPE = Symbol.for("react.portal"); var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); var REACT_CONTEXT_TYPE = Symbol.for("react.context"); var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); var REACT_MEMO_TYPE = Symbol.for("react.memo"); var REACT_LAZY_TYPE = Symbol.for("react.lazy"); var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== "object") { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === "function") { return maybeIterator; } return null; } var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function error(format) { { { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning("error", format, args); } } } function printWarning(level, format, args) { { var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame2.getStackAddendum(); if (stack !== "") { format += "%s"; args = args.concat([stack]); } var argsWithFormat = args.map(function(item) { return String(item); }); argsWithFormat.unshift("Warning: " + format); Function.prototype.apply.call(console[level], console, argsWithFormat); } } var enableScopeAPI = false; var enableCacheElement = false; var enableTransitionTracing = false; var enableLegacyHidden = false; var enableDebugTracing = false; var REACT_MODULE_REFERENCE; { REACT_MODULE_REFERENCE = Symbol.for("react.module.reference"); } function isValidElementType(type) { if (typeof type === "string" || typeof type === "function") { return true; } if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { return true; } if (typeof type === "object" && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) { return true; } } return false; } function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { return displayName; } var functionName = innerType.displayName || innerType.name || ""; return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName; } function getContextName(type) { return type.displayName || "Context"; } function getComponentNameFromType(type) { if (type == null) { return null; } { if (typeof type.tag === "number") { error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."); } } if (typeof type === "function") { return type.displayName || type.name || null; } if (typeof type === "string") { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: return "Portal"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + ".Consumer"; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + ".Provider"; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; if (outerName !== null) { return outerName; } return getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentNameFromType(init(payload)); } catch (x2) { return null; } } } } return null; } var assign = Object.assign; var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() { } disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { var props = { configurable: true, enumerable: true, writable: true }; Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); } if (disabledDepth < 0) { error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } } var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name2, source, ownerFn) { { if (prefix === void 0) { try { throw Error(); } catch (x2) { var match = x2.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; } } return "\n" + prefix + name2; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) { return ""; } { var frame = componentFrameCache.get(fn); if (frame !== void 0) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher.current; ReactCurrentDispatcher.current = null; disableLogs(); } try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if (typeof Reflect === "object" && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x2) { control = x2; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x2) { control = x2; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x2) { control = x2; } fn(); } } catch (sample) { if (sample && control && typeof sample.stack === "string") { var sampleLines = sample.stack.split("\n"); var controlLines = control.stack.split("\n"); var s2 = sampleLines.length - 1; var c2 = controlLines.length - 1; while (s2 >= 1 && c2 >= 0 && sampleLines[s2] !== controlLines[c2]) { c2--; } for (; s2 >= 1 && c2 >= 0; s2--, c2--) { if (sampleLines[s2] !== controlLines[c2]) { if (s2 !== 1 || c2 !== 1) { do { s2--; c2--; if (c2 < 0 || sampleLines[s2] !== controlLines[c2]) { var _frame = "\n" + sampleLines[s2].replace(" at new ", " at "); if (fn.displayName && _frame.includes("")) { _frame = _frame.replace("", fn.displayName); } { if (typeof fn === "function") { componentFrameCache.set(fn, _frame); } } return _frame; } } while (s2 >= 1 && c2 >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } var name2 = fn ? fn.displayName || fn.name : ""; var syntheticFrame = name2 ? describeBuiltInComponentFrame(name2) : ""; { if (typeof fn === "function") { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ""; } if (typeof type === "function") { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === "string") { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x2) { } } } } return ""; } var hasOwnProperty = Object.prototype.hasOwnProperty; var loggedTypeFailures = {}; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame.setExtraStackFrame(null); } } } function checkPropTypes(typeSpecs, values, location, componentName, element) { { var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; try { if (typeof typeSpecs[typeSpecName] !== "function") { var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); err.name = "Invariant Violation"; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error("Failed %s type: %s", location, error$1.message); setCurrentlyValidatingElement(null); } } } } } var isArrayImpl = Array.isArray; function isArray(a2) { return isArrayImpl(a2); } function typeName2(value) { { var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object"; return type; } } function willCoercionThrow(value) { { try { testStringCoercion(value); return false; } catch (e2) { return true; } } } function testStringCoercion(value) { return "" + value; } function checkKeyStringCoercion(value) { { if (willCoercionThrow(value)) { error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName2(value)); return testStringCoercion(value); } } } var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; var specialPropKeyWarningShown; var specialPropRefWarningShown; var didWarnAboutStringRefs; { didWarnAboutStringRefs = {}; } function hasValidRef(config) { { if (hasOwnProperty.call(config, "ref")) { var getter = Object.getOwnPropertyDescriptor(config, "ref").get; if (getter && getter.isReactWarning) { return false; } } } return config.ref !== void 0; } function hasValidKey(config) { { if (hasOwnProperty.call(config, "key")) { var getter = Object.getOwnPropertyDescriptor(config, "key").get; if (getter && getter.isReactWarning) { return false; } } } return config.key !== void 0; } function warnIfStringRefCannotBeAutoConverted(config, self2) { { if (typeof config.ref === "string" && ReactCurrentOwner.current && self2 && ReactCurrentOwner.current.stateNode !== self2) { var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); if (!didWarnAboutStringRefs[componentName]) { error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref); didWarnAboutStringRefs[componentName] = true; } } } } function defineKeyPropWarningGetter(props, displayName) { { var warnAboutAccessingKey = function() { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: true }); } } function defineRefPropWarningGetter(props, displayName) { { var warnAboutAccessingRef = function() { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, "ref", { get: warnAboutAccessingRef, configurable: true }); } } var ReactElement = function(type, key, ref, self2, source, owner, props) { var element = { // This tag allows us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type, key, ref, props, // Record the component responsible for creating this element. _owner: owner }; { element._store = {}; Object.defineProperty(element._store, "validated", { configurable: false, enumerable: false, writable: true, value: false }); Object.defineProperty(element, "_self", { configurable: false, enumerable: false, writable: false, value: self2 }); Object.defineProperty(element, "_source", { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }; function jsxDEV(type, config, maybeKey, source, self2) { { var propName; var props = {}; var key = null; var ref = null; if (maybeKey !== void 0) { { checkKeyStringCoercion(maybeKey); } key = "" + maybeKey; } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = "" + config.key; } if (hasValidRef(config)) { ref = config.ref; warnIfStringRefCannotBeAutoConverted(config, self2); } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } if (key || ref) { var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props); } } var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } } var propTypesMisspellWarningShown; { propTypesMisspellWarningShown = false; } function isValidElement(object) { { return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } } function getDeclarationErrorAddendum() { { if (ReactCurrentOwner$1.current) { var name2 = getComponentNameFromType(ReactCurrentOwner$1.current.type); if (name2) { return "\n\nCheck the render method of `" + name2 + "`."; } } return ""; } } function getSourceInfoErrorAddendum(source) { { if (source !== void 0) { var fileName = source.fileName.replace(/^.*[\\\/]/, ""); var lineNumber = source.lineNumber; return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; } return ""; } } var ownerHasKeyUseWarning = {}; function getCurrentComponentErrorInfo(parentType) { { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + parentName + ">."; } } return info; } } function validateExplicitKey(element, parentType) { { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; var childOwner = ""; if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; } setCurrentlyValidatingElement$1(element); error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); setCurrentlyValidatingElement$1(null); } } function validateChildKeys(node, parentType) { { if (typeof node !== "object") { return; } if (isArray(node)) { for (var i2 = 0; i2 < node.length; i2++) { var child = node[i2]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === "function") { if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } } } function validatePropTypes(element) { { var type = element.type; if (type === null || type === void 0 || typeof type === "string") { return; } var propTypes; if (typeof type === "function") { propTypes = type.propTypes; } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. type.$$typeof === REACT_MEMO_TYPE)) { propTypes = type.propTypes; } else { return; } if (propTypes) { var name2 = getComponentNameFromType(type); checkPropTypes(propTypes, element.props, "prop", name2, element); } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; var _name = getComponentNameFromType(type); error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown"); } if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) { error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } } function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i2 = 0; i2 < keys.length; i2++) { var key = keys[i2]; if (key !== "children" && key !== "key") { setCurrentlyValidatingElement$1(fragment); error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key); setCurrentlyValidatingElement$1(null); break; } } if (fragment.ref !== null) { setCurrentlyValidatingElement$1(fragment); error("Invalid attribute `ref` supplied to `React.Fragment`."); setCurrentlyValidatingElement$1(null); } } } function jsxWithValidation(type, props, key, isStaticChildren, source, self2) { { var validType = isValidElementType(type); if (!validType) { var info = ""; if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) { info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendum(source); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } var typeString; if (type === null) { typeString = "null"; } else if (isArray(type)) { typeString = "array"; } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) { typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />"; info = " Did you accidentally export a JSX literal instead of a component?"; } else { typeString = typeof type; } error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } var element = jsxDEV(type, props, key, source, self2); if (element == null) { return element; } if (validType) { var children = props.children; if (children !== void 0) { if (isStaticChildren) { if (isArray(children)) { for (var i2 = 0; i2 < children.length; i2++) { validateChildKeys(children[i2], type); } if (Object.freeze) { Object.freeze(children); } } else { error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); } } else { validateChildKeys(children, type); } } } if (type === REACT_FRAGMENT_TYPE) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; } } function jsxWithValidationStatic(type, props, key) { { return jsxWithValidation(type, props, key, true); } } function jsxWithValidationDynamic(type, props, key) { { return jsxWithValidation(type, props, key, false); } } var jsx = jsxWithValidationDynamic; var jsxs = jsxWithValidationStatic; reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE; reactJsxRuntime_development.jsx = jsx; reactJsxRuntime_development.jsxs = jsxs; })(); } { jsxRuntime.exports = reactJsxRuntime_development; } var jsxRuntimeExports = jsxRuntime.exports; const DefaultBufferLength = 1024; let nextPropID = 0; let Range$1 = class Range { constructor(from, to) { this.from = from; this.to = to; } }; class NodeProp { /// Create a new node prop type. constructor(config = {}) { this.id = nextPropID++; this.perNode = !!config.perNode; this.deserialize = config.deserialize || (() => { throw new Error("This node type doesn't define a deserialize function"); }); } /// This is meant to be used with /// [`NodeSet.extend`](#common.NodeSet.extend) or /// [`LRParser.configure`](#lr.ParserConfig.props) to compute /// prop values for each node type in the set. Takes a [match /// object](#common.NodeType^match) or function that returns undefined /// if the node type doesn't get this prop, and the prop's value if /// it does. add(match) { if (this.perNode) throw new RangeError("Can't add per-node props to node types"); if (typeof match != "function") match = NodeType.match(match); return (type) => { let result = match(type); return result === void 0 ? null : [this, result]; }; } } NodeProp.closedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); NodeProp.openedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); NodeProp.group = new NodeProp({ deserialize: (str) => str.split(" ") }); NodeProp.contextHash = new NodeProp({ perNode: true }); NodeProp.lookAhead = new NodeProp({ perNode: true }); NodeProp.mounted = new NodeProp({ perNode: true }); const noProps = /* @__PURE__ */ Object.create(null); class NodeType { /// @internal constructor(name2, props, id, flags = 0) { this.name = name2; this.props = props; this.id = id; this.flags = flags; } /// Define a node type. static define(spec) { let props = spec.props && spec.props.length ? /* @__PURE__ */ Object.create(null) : noProps; let flags = (spec.top ? 1 : 0) | (spec.skipped ? 2 : 0) | (spec.error ? 4 : 0) | (spec.name == null ? 8 : 0); let type = new NodeType(spec.name || "", props, spec.id, flags); if (spec.props) for (let src of spec.props) { if (!Array.isArray(src)) src = src(type); if (src) { if (src[0].perNode) throw new RangeError("Can't store a per-node prop on a node type"); props[src[0].id] = src[1]; } } return type; } /// Retrieves a node prop for this type. Will return `undefined` if /// the prop isn't present on this node. prop(prop) { return this.props[prop.id]; } /// True when this is the top node of a grammar. get isTop() { return (this.flags & 1) > 0; } /// True when this node is produced by a skip rule. get isSkipped() { return (this.flags & 2) > 0; } /// Indicates whether this is an error node. get isError() { return (this.flags & 4) > 0; } /// When true, this node type doesn't correspond to a user-declared /// named node, for example because it is used to cache repetition. get isAnonymous() { return (this.flags & 8) > 0; } /// Returns true when this node's name or one of its /// [groups](#common.NodeProp^group) matches the given string. is(name2) { if (typeof name2 == "string") { if (this.name == name2) return true; let group = this.prop(NodeProp.group); return group ? group.indexOf(name2) > -1 : false; } return this.id == name2; } /// Create a function from node types to arbitrary values by /// specifying an object whose property names are node or /// [group](#common.NodeProp^group) names. Often useful with /// [`NodeProp.add`](#common.NodeProp.add). You can put multiple /// names, separated by spaces, in a single property name to map /// multiple node names to a single value. static match(map) { let direct = /* @__PURE__ */ Object.create(null); for (let prop in map) for (let name2 of prop.split(" ")) direct[name2] = map[prop]; return (node) => { for (let groups = node.prop(NodeProp.group), i2 = -1; i2 < (groups ? groups.length : 0); i2++) { let found = direct[i2 < 0 ? node.name : groups[i2]]; if (found) return found; } }; } } NodeType.none = new NodeType( "", /* @__PURE__ */ Object.create(null), 0, 8 /* NodeFlag.Anonymous */ ); class NodeSet { /// Create a set with the given types. The `id` property of each /// type should correspond to its position within the array. constructor(types2) { this.types = types2; for (let i2 = 0; i2 < types2.length; i2++) if (types2[i2].id != i2) throw new RangeError("Node type ids should correspond to array positions when creating a node set"); } /// Create a copy of this set with some node properties added. The /// arguments to this method can be created with /// [`NodeProp.add`](#common.NodeProp.add). extend(...props) { let newTypes = []; for (let type of this.types) { let newProps = null; for (let source of props) { let add = source(type); if (add) { if (!newProps) newProps = Object.assign({}, type.props); newProps[add[0].id] = add[1]; } } newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type); } return new NodeSet(newTypes); } } const CachedNode = /* @__PURE__ */ new WeakMap(), CachedInnerNode = /* @__PURE__ */ new WeakMap(); var IterMode; (function(IterMode2) { IterMode2[IterMode2["ExcludeBuffers"] = 1] = "ExcludeBuffers"; IterMode2[IterMode2["IncludeAnonymous"] = 2] = "IncludeAnonymous"; IterMode2[IterMode2["IgnoreMounts"] = 4] = "IgnoreMounts"; IterMode2[IterMode2["IgnoreOverlays"] = 8] = "IgnoreOverlays"; })(IterMode || (IterMode = {})); class Tree { /// Construct a new tree. See also [`Tree.build`](#common.Tree^build). constructor(type, children, positions, length, props) { this.type = type; this.children = children; this.positions = positions; this.length = length; this.props = null; if (props && props.length) { this.props = /* @__PURE__ */ Object.create(null); for (let [prop, value] of props) this.props[typeof prop == "number" ? prop : prop.id] = value; } } /// @internal toString() { let mounted = this.prop(NodeProp.mounted); if (mounted && !mounted.overlay) return mounted.tree.toString(); let children = ""; for (let ch of this.children) { let str = ch.toString(); if (str) { if (children) children += ","; children += str; } } return !this.type.name ? children : (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (children.length ? "(" + children + ")" : ""); } /// Get a [tree cursor](#common.TreeCursor) positioned at the top of /// the tree. Mode can be used to [control](#common.IterMode) which /// nodes the cursor visits. cursor(mode = 0) { return new TreeCursor(this.topNode, mode); } /// Get a [tree cursor](#common.TreeCursor) pointing into this tree /// at the given position and side (see /// [`moveTo`](#common.TreeCursor.moveTo). cursorAt(pos, side = 0, mode = 0) { let scope = CachedNode.get(this) || this.topNode; let cursor = new TreeCursor(scope); cursor.moveTo(pos, side); CachedNode.set(this, cursor._tree); return cursor; } /// Get a [syntax node](#common.SyntaxNode) object for the top of the /// tree. get topNode() { return new TreeNode(this, 0, 0, null); } /// Get the [syntax node](#common.SyntaxNode) at the given position. /// If `side` is -1, this will move into nodes that end at the /// position. If 1, it'll move into nodes that start at the /// position. With 0, it'll only enter nodes that cover the position /// from both sides. /// /// Note that this will not enter /// [overlays](#common.MountedTree.overlay), and you often want /// [`resolveInner`](#common.Tree.resolveInner) instead. resolve(pos, side = 0) { let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false); CachedNode.set(this, node); return node; } /// Like [`resolve`](#common.Tree.resolve), but will enter /// [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node /// pointing into the innermost overlaid tree at the given position /// (with parent links going through all parent structure, including /// the host trees). resolveInner(pos, side = 0) { let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true); CachedInnerNode.set(this, node); return node; } /// Iterate over the tree and its children, calling `enter` for any /// node that touches the `from`/`to` region (if given) before /// running over such a node's children, and `leave` (if given) when /// leaving the node. When `enter` returns `false`, that node will /// not have its children iterated over (or `leave` called). iterate(spec) { let { enter, leave, from = 0, to = this.length } = spec; let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0; for (let c2 = this.cursor(mode | IterMode.IncludeAnonymous); ; ) { let entered = false; if (c2.from <= to && c2.to >= from && (!anon && c2.type.isAnonymous || enter(c2) !== false)) { if (c2.firstChild()) continue; entered = true; } for (; ; ) { if (entered && leave && (anon || !c2.type.isAnonymous)) leave(c2); if (c2.nextSibling()) break; if (!c2.parent()) return; entered = true; } } } /// Get the value of the given [node prop](#common.NodeProp) for this /// node. Works with both per-node and per-type props. prop(prop) { return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : void 0; } /// Returns the node's [per-node props](#common.NodeProp.perNode) in a /// format that can be passed to the [`Tree`](#common.Tree) /// constructor. get propValues() { let result = []; if (this.props) for (let id in this.props) result.push([+id, this.props[id]]); return result; } /// Balance the direct children of this tree, producing a copy of /// which may have children grouped into subtrees with type /// [`NodeType.none`](#common.NodeType^none). balance(config = {}) { return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length))); } /// Build a tree from a postfix-ordered buffer of node information, /// or a cursor over such a buffer. static build(data) { return buildTree(data); } } Tree.empty = new Tree(NodeType.none, [], [], 0); class FlatBufferCursor { constructor(buffer, index2) { this.buffer = buffer; this.index = index2; } get id() { return this.buffer[this.index - 4]; } get start() { return this.buffer[this.index - 3]; } get end() { return this.buffer[this.index - 2]; } get size() { return this.buffer[this.index - 1]; } get pos() { return this.index; } next() { this.index -= 4; } fork() { return new FlatBufferCursor(this.buffer, this.index); } } class TreeBuffer { /// Create a tree buffer. constructor(buffer, length, set) { this.buffer = buffer; this.length = length; this.set = set; } /// @internal get type() { return NodeType.none; } /// @internal toString() { let result = []; for (let index2 = 0; index2 < this.buffer.length; ) { result.push(this.childString(index2)); index2 = this.buffer[index2 + 3]; } return result.join(","); } /// @internal childString(index2) { let id = this.buffer[index2], endIndex = this.buffer[index2 + 3]; let type = this.set.types[id], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); index2 += 4; if (endIndex == index2) return result; let children = []; while (index2 < endIndex) { children.push(this.childString(index2)); index2 = this.buffer[index2 + 3]; } return result + "(" + children.join(",") + ")"; } /// @internal findChild(startIndex, endIndex, dir, pos, side) { let { buffer } = this, pick = -1; for (let i2 = startIndex; i2 != endIndex; i2 = buffer[i2 + 3]) { if (checkSide(side, pos, buffer[i2 + 1], buffer[i2 + 2])) { pick = i2; if (dir > 0) break; } } return pick; } /// @internal slice(startI, endI, from) { let b2 = this.buffer; let copy = new Uint16Array(endI - startI), len = 0; for (let i2 = startI, j = 0; i2 < endI; ) { copy[j++] = b2[i2++]; copy[j++] = b2[i2++] - from; let to = copy[j++] = b2[i2++] - from; copy[j++] = b2[i2++] - startI; len = Math.max(len, to); } return new TreeBuffer(copy, len, this.set); } } function checkSide(side, pos, from, to) { switch (side) { case -2: return from < pos; case -1: return to >= pos && from < pos; case 0: return from < pos && to > pos; case 1: return from <= pos && to > pos; case 2: return to > pos; case 4: return true; } } function enterUnfinishedNodesBefore(node, pos) { let scan = node.childBefore(pos); while (scan) { let last = scan.lastChild; if (!last || last.to != scan.to) break; if (last.type.isError && last.from == last.to) { node = scan; scan = last.prevSibling; } else { scan = last; } } return node; } function resolveNode(node, pos, side, overlays) { var _a2; while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent; if (!parent) return node; node = parent; } let mode = overlays ? 0 : IterMode.IgnoreOverlays; if (overlays) for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { if (scan instanceof TreeNode && scan.index < 0 && ((_a2 = parent.enter(pos, side, mode)) === null || _a2 === void 0 ? void 0 : _a2.from) != scan.from) node = parent; } for (; ; ) { let inner = node.enter(pos, side, mode); if (!inner) return node; node = inner; } } class TreeNode { constructor(_tree, from, index2, _parent) { this._tree = _tree; this.from = from; this.index = index2; this._parent = _parent; } get type() { return this._tree.type; } get name() { return this._tree.type.name; } get to() { return this.from + this._tree.length; } nextChild(i2, dir, pos, side, mode = 0) { for (let parent = this; ; ) { for (let { children, positions } = parent._tree, e2 = dir > 0 ? children.length : -1; i2 != e2; i2 += dir) { let next = children[i2], start = positions[i2] + parent.from; if (!checkSide(side, pos, start, start + next.length)) continue; if (next instanceof TreeBuffer) { if (mode & IterMode.ExcludeBuffers) continue; let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); if (index2 > -1) return new BufferNode(new BufferContext(parent, next, i2, start), null, index2); } else if (mode & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) { let mounted; if (!(mode & IterMode.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp.mounted)) && !mounted.overlay) return new TreeNode(mounted.tree, start, i2, parent); let inner = new TreeNode(next, start, i2, parent); return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side); } } if (mode & IterMode.IncludeAnonymous || !parent.type.isAnonymous) return null; if (parent.index >= 0) i2 = parent.index + dir; else i2 = dir < 0 ? -1 : parent._parent._tree.children.length; parent = parent._parent; if (!parent) return null; } } get firstChild() { return this.nextChild( 0, 1, 0, 4 /* Side.DontCare */ ); } get lastChild() { return this.nextChild( this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */ ); } childAfter(pos) { return this.nextChild( 0, 1, pos, 2 /* Side.After */ ); } childBefore(pos) { return this.nextChild( this._tree.children.length - 1, -1, pos, -2 /* Side.Before */ ); } enter(pos, side, mode = 0) { let mounted; if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) { let rPos = pos - this.from; for (let { from, to } of mounted.overlay) { if ((side > 0 ? from <= rPos : from < rPos) && (side < 0 ? to >= rPos : to > rPos)) return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this); } } return this.nextChild(0, 1, pos, side, mode); } nextSignificantParent() { let val = this; while (val.type.isAnonymous && val._parent) val = val._parent; return val; } get parent() { return this._parent ? this._parent.nextSignificantParent() : null; } get nextSibling() { return this._parent && this.index >= 0 ? this._parent.nextChild( this.index + 1, 1, 0, 4 /* Side.DontCare */ ) : null; } get prevSibling() { return this._parent && this.index >= 0 ? this._parent.nextChild( this.index - 1, -1, 0, 4 /* Side.DontCare */ ) : null; } cursor(mode = 0) { return new TreeCursor(this, mode); } get tree() { return this._tree; } toTree() { return this._tree; } resolve(pos, side = 0) { return resolveNode(this, pos, side, false); } resolveInner(pos, side = 0) { return resolveNode(this, pos, side, true); } enterUnfinishedNodesBefore(pos) { return enterUnfinishedNodesBefore(this, pos); } getChild(type, before = null, after = null) { let r2 = getChildren(this, type, before, after); return r2.length ? r2[0] : null; } getChildren(type, before = null, after = null) { return getChildren(this, type, before, after); } /// @internal toString() { return this._tree.toString(); } get node() { return this; } matchContext(context) { return matchNodeContext(this, context); } } function getChildren(node, type, before, after) { let cur = node.cursor(), result = []; if (!cur.firstChild()) return result; if (before != null) { while (!cur.type.is(before)) if (!cur.nextSibling()) return result; } for (; ; ) { if (after != null && cur.type.is(after)) return result; if (cur.type.is(type)) result.push(cur.node); if (!cur.nextSibling()) return after == null ? result : []; } } function matchNodeContext(node, context, i2 = context.length - 1) { for (let p2 = node.parent; i2 >= 0; p2 = p2.parent) { if (!p2) return false; if (!p2.type.isAnonymous) { if (context[i2] && context[i2] != p2.name) return false; i2--; } } return true; } class BufferContext { constructor(parent, buffer, index2, start) { this.parent = parent; this.buffer = buffer; this.index = index2; this.start = start; } } class BufferNode { get name() { return this.type.name; } get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; } get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; } constructor(context, _parent, index2) { this.context = context; this._parent = _parent; this.index = index2; this.type = context.buffer.set.types[context.buffer.buffer[index2]]; } child(dir, pos, side) { let { buffer } = this.context; let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); return index2 < 0 ? null : new BufferNode(this.context, this, index2); } get firstChild() { return this.child( 1, 0, 4 /* Side.DontCare */ ); } get lastChild() { return this.child( -1, 0, 4 /* Side.DontCare */ ); } childAfter(pos) { return this.child( 1, pos, 2 /* Side.After */ ); } childBefore(pos) { return this.child( -1, pos, -2 /* Side.Before */ ); } enter(pos, side, mode = 0) { if (mode & IterMode.ExcludeBuffers) return null; let { buffer } = this.context; let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); return index2 < 0 ? null : new BufferNode(this.context, this, index2); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); } externalSibling(dir) { return this._parent ? null : this.context.parent.nextChild( this.context.index + dir, dir, 0, 4 /* Side.DontCare */ ); } get nextSibling() { let { buffer } = this.context; let after = buffer.buffer[this.index + 3]; if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) return new BufferNode(this.context, this._parent, after); return this.externalSibling(1); } get prevSibling() { let { buffer } = this.context; let parentStart = this._parent ? this._parent.index + 4 : 0; if (this.index == parentStart) return this.externalSibling(-1); return new BufferNode(this.context, this._parent, buffer.findChild( parentStart, this.index, -1, 0, 4 /* Side.DontCare */ )); } cursor(mode = 0) { return new TreeCursor(this, mode); } get tree() { return null; } toTree() { let children = [], positions = []; let { buffer } = this.context; let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; if (endI > startI) { let from = buffer.buffer[this.index + 1]; children.push(buffer.slice(startI, endI, from)); positions.push(0); } return new Tree(this.type, children, positions, this.to - this.from); } resolve(pos, side = 0) { return resolveNode(this, pos, side, false); } resolveInner(pos, side = 0) { return resolveNode(this, pos, side, true); } enterUnfinishedNodesBefore(pos) { return enterUnfinishedNodesBefore(this, pos); } /// @internal toString() { return this.context.buffer.childString(this.index); } getChild(type, before = null, after = null) { let r2 = getChildren(this, type, before, after); return r2.length ? r2[0] : null; } getChildren(type, before = null, after = null) { return getChildren(this, type, before, after); } get node() { return this; } matchContext(context) { return matchNodeContext(this, context); } } class TreeCursor { /// Shorthand for `.type.name`. get name() { return this.type.name; } /// @internal constructor(node, mode = 0) { this.mode = mode; this.buffer = null; this.stack = []; this.index = 0; this.bufferNode = null; if (node instanceof TreeNode) { this.yieldNode(node); } else { this._tree = node.context.parent; this.buffer = node.context; for (let n2 = node._parent; n2; n2 = n2._parent) this.stack.unshift(n2.index); this.bufferNode = node; this.yieldBuf(node.index); } } yieldNode(node) { if (!node) return false; this._tree = node; this.type = node.type; this.from = node.from; this.to = node.to; return true; } yieldBuf(index2, type) { this.index = index2; let { start, buffer } = this.buffer; this.type = type || buffer.set.types[buffer.buffer[index2]]; this.from = start + buffer.buffer[index2 + 1]; this.to = start + buffer.buffer[index2 + 2]; return true; } yield(node) { if (!node) return false; if (node instanceof TreeNode) { this.buffer = null; return this.yieldNode(node); } this.buffer = node.context; return this.yieldBuf(node.index, node.type); } /// @internal toString() { return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); } /// @internal enterChild(dir, pos, side) { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); let { buffer } = this.buffer; let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); if (index2 < 0) return false; this.stack.push(this.index); return this.yieldBuf(index2); } /// Move the cursor to this node's first child. When this returns /// false, the node has no child, and the cursor has not been moved. firstChild() { return this.enterChild( 1, 0, 4 /* Side.DontCare */ ); } /// Move the cursor to this node's last child. lastChild() { return this.enterChild( -1, 0, 4 /* Side.DontCare */ ); } /// Move the cursor to the first child that ends after `pos`. childAfter(pos) { return this.enterChild( 1, pos, 2 /* Side.After */ ); } /// Move to the last child that starts before `pos`. childBefore(pos) { return this.enterChild( -1, pos, -2 /* Side.Before */ ); } /// Move the cursor to the child around `pos`. If side is -1 the /// child may end at that position, when 1 it may start there. This /// will also enter [overlaid](#common.MountedTree.overlay) /// [mounted](#common.NodeProp^mounted) trees unless `overlays` is /// set to false. enter(pos, side, mode = this.mode) { if (!this.buffer) return this.yield(this._tree.enter(pos, side, mode)); return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side); } /// Move to the node's parent node, if this isn't the top node. parent() { if (!this.buffer) return this.yieldNode(this.mode & IterMode.IncludeAnonymous ? this._tree._parent : this._tree.parent); if (this.stack.length) return this.yieldBuf(this.stack.pop()); let parent = this.mode & IterMode.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); this.buffer = null; return this.yieldNode(parent); } /// @internal sibling(dir) { if (!this.buffer) return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); let { buffer } = this.buffer, d2 = this.stack.length - 1; if (dir < 0) { let parentStart = d2 < 0 ? 0 : this.stack[d2] + 4; if (this.index != parentStart) return this.yieldBuf(buffer.findChild( parentStart, this.index, -1, 0, 4 /* Side.DontCare */ )); } else { let after = buffer.buffer[this.index + 3]; if (after < (d2 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d2] + 3])) return this.yieldBuf(after); } return d2 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; } /// Move to this node's next sibling, if any. nextSibling() { return this.sibling(1); } /// Move to this node's previous sibling, if any. prevSibling() { return this.sibling(-1); } atLastNode(dir) { let index2, parent, { buffer } = this; if (buffer) { if (dir > 0) { if (this.index < buffer.buffer.buffer.length) return false; } else { for (let i2 = 0; i2 < this.index; i2++) if (buffer.buffer.buffer[i2 + 3] < this.index) return false; } ({ index: index2, parent } = buffer); } else { ({ index: index2, _parent: parent } = this._tree); } for (; parent; { index: index2, _parent: parent } = parent) { if (index2 > -1) for (let i2 = index2 + dir, e2 = dir < 0 ? -1 : parent._tree.children.length; i2 != e2; i2 += dir) { let child = parent._tree.children[i2]; if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) return false; } } return true; } move(dir, enter) { if (enter && this.enterChild( dir, 0, 4 /* Side.DontCare */ )) return true; for (; ; ) { if (this.sibling(dir)) return true; if (this.atLastNode(dir) || !this.parent()) return false; } } /// Move to the next node in a /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR) /// traversal, going from a node to its first child or, if the /// current node is empty or `enter` is false, its next sibling or /// the next sibling of the first parent node that has one. next(enter = true) { return this.move(1, enter); } /// Move to the next node in a last-to-first pre-order traveral. A /// node is followed by its last child or, if it has none, its /// previous sibling or the previous sibling of the first parent /// node that has one. prev(enter = true) { return this.move(-1, enter); } /// Move the cursor to the innermost node that covers `pos`. If /// `side` is -1, it will enter nodes that end at `pos`. If it is 1, /// it will enter nodes that start at `pos`. moveTo(pos, side = 0) { while (this.from == this.to || (side < 1 ? this.from >= pos : this.from > pos) || (side > -1 ? this.to <= pos : this.to < pos)) if (!this.parent()) break; while (this.enterChild(1, pos, side)) { } return this; } /// Get a [syntax node](#common.SyntaxNode) at the cursor's current /// position. get node() { if (!this.buffer) return this._tree; let cache = this.bufferNode, result = null, depth = 0; if (cache && cache.context == this.buffer) { scan: for (let index2 = this.index, d2 = this.stack.length; d2 >= 0; ) { for (let c2 = cache; c2; c2 = c2._parent) if (c2.index == index2) { if (index2 == this.index) return c2; result = c2; depth = d2 + 1; break scan; } index2 = this.stack[--d2]; } } for (let i2 = depth; i2 < this.stack.length; i2++) result = new BufferNode(this.buffer, result, this.stack[i2]); return this.bufferNode = new BufferNode(this.buffer, result, this.index); } /// Get the [tree](#common.Tree) that represents the current node, if /// any. Will return null when the node is in a [tree /// buffer](#common.TreeBuffer). get tree() { return this.buffer ? null : this._tree._tree; } /// Iterate over the current node and all its descendants, calling /// `enter` when entering a node and `leave`, if given, when leaving /// one. When `enter` returns `false`, any children of that node are /// skipped, and `leave` isn't called for it. iterate(enter, leave) { for (let depth = 0; ; ) { let mustLeave = false; if (this.type.isAnonymous || enter(this) !== false) { if (this.firstChild()) { depth++; continue; } if (!this.type.isAnonymous) mustLeave = true; } for (; ; ) { if (mustLeave && leave) leave(this); mustLeave = this.type.isAnonymous; if (this.nextSibling()) break; if (!depth) return; this.parent(); depth--; mustLeave = true; } } } /// Test whether the current node matches a given context—a sequence /// of direct parent node names. Empty strings in the context array /// are treated as wildcards. matchContext(context) { if (!this.buffer) return matchNodeContext(this.node, context); let { buffer } = this.buffer, { types: types2 } = buffer.set; for (let i2 = context.length - 1, d2 = this.stack.length - 1; i2 >= 0; d2--) { if (d2 < 0) return matchNodeContext(this.node, context, i2); let type = types2[buffer.buffer[this.stack[d2]]]; if (!type.isAnonymous) { if (context[i2] && context[i2] != type.name) return false; i2--; } } return true; } } function hasChild(tree) { return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch)); } function buildTree(data) { var _a2; let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data; let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer; let types2 = nodeSet.types; let contextHash = 0, lookAhead = 0; function takeNode(parentStart, minPos, children2, positions2, inRepeat) { let { id, start, end, size } = cursor; let lookAheadAtStart = lookAhead; while (size < 0) { cursor.next(); if (size == -1) { let node2 = reused[id]; children2.push(node2); positions2.push(start - parentStart); return; } else if (size == -3) { contextHash = id; return; } else if (size == -4) { lookAhead = id; return; } else { throw new RangeError(`Unrecognized record size: ${size}`); } } let type = types2[id], node, buffer2; let startPos = start - parentStart; if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor.pos - minPos, inRepeat))) { let data2 = new Uint16Array(buffer2.size - buffer2.skip); let endPos = cursor.pos - buffer2.size, index2 = data2.length; while (cursor.pos > endPos) index2 = copyToBuffer(buffer2.start, data2, index2); node = new TreeBuffer(data2, end - buffer2.start, nodeSet); startPos = buffer2.start - parentStart; } else { let endPos = cursor.pos - size; cursor.next(); let localChildren = [], localPositions = []; let localInRepeat = id >= minRepeatType ? id : -1; let lastGroup = 0, lastEnd = end; while (cursor.pos > endPos) { if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) { if (cursor.end <= lastEnd - maxBufferLength) { makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart); lastGroup = localChildren.length; lastEnd = cursor.end; } cursor.next(); } else { takeNode(start, endPos, localChildren, localPositions, localInRepeat); } } if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length) makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart); localChildren.reverse(); localPositions.reverse(); if (localInRepeat > -1 && lastGroup > 0) { let make = makeBalanced(type); node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); } else { node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); } } children2.push(node); positions2.push(startPos); } function makeBalanced(type) { return (children2, positions2, length2) => { let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp; if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) { if (!lastI && last.type == type && last.length == length2) return last; if (lookAheadProp = last.prop(NodeProp.lookAhead)) lookAhead2 = positions2[lastI] + last.length + lookAheadProp; } return makeTree(type, children2, positions2, length2, lookAhead2); }; } function makeRepeatLeaf(children2, positions2, base2, i2, from, to, type, lookAhead2) { let localChildren = [], localPositions = []; while (children2.length > i2) { localChildren.push(children2.pop()); localPositions.push(positions2.pop() + base2 - from); } children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead2 - to)); positions2.push(from - base2); } function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) { if (contextHash) { let pair2 = [NodeProp.contextHash, contextHash]; props = props ? [pair2].concat(props) : [pair2]; } if (lookAhead2 > 25) { let pair2 = [NodeProp.lookAhead, lookAhead2]; props = props ? [pair2].concat(props) : [pair2]; } return new Tree(type, children2, positions2, length2, props); } function findBufferSize(maxSize, inRepeat) { let fork = cursor.fork(); let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength; let result = { size: 0, start: 0, skip: 0 }; scan: for (let minPos = fork.pos - maxSize; fork.pos > minPos; ) { let nodeSize2 = fork.size; if (fork.id == inRepeat && nodeSize2 >= 0) { result.size = size; result.start = start; result.skip = skip; skip += 4; size += 4; fork.next(); continue; } let startPos = fork.pos - nodeSize2; if (nodeSize2 < 0 || startPos < minPos || fork.start < minStart) break; let localSkipped = fork.id >= minRepeatType ? 4 : 0; let nodeStart = fork.start; fork.next(); while (fork.pos > startPos) { if (fork.size < 0) { if (fork.size == -3) localSkipped += 4; else break scan; } else if (fork.id >= minRepeatType) { localSkipped += 4; } fork.next(); } start = nodeStart; size += nodeSize2; skip += localSkipped; } if (inRepeat < 0 || size == maxSize) { result.size = size; result.start = start; result.skip = skip; } return result.size > 4 ? result : void 0; } function copyToBuffer(bufferStart, buffer2, index2) { let { id, start, end, size } = cursor; cursor.next(); if (size >= 0 && id < minRepeatType) { let startIndex = index2; if (size > 4) { let endPos = cursor.pos - (size - 4); while (cursor.pos > endPos) index2 = copyToBuffer(bufferStart, buffer2, index2); } buffer2[--index2] = startIndex; buffer2[--index2] = end - bufferStart; buffer2[--index2] = start - bufferStart; buffer2[--index2] = id; } else if (size == -3) { contextHash = id; } else if (size == -4) { lookAhead = id; } return index2; } let children = [], positions = []; while (cursor.pos > 0) takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1); let length = (_a2 = data.length) !== null && _a2 !== void 0 ? _a2 : children.length ? positions[0] + children[0].length : 0; return new Tree(types2[data.topID], children.reverse(), positions.reverse(), length); } const nodeSizeCache = /* @__PURE__ */ new WeakMap(); function nodeSize(balanceType, node) { if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType) return 1; let size = nodeSizeCache.get(node); if (size == null) { size = 1; for (let child of node.children) { if (child.type != balanceType || !(child instanceof Tree)) { size = 1; break; } size += nodeSize(balanceType, child); } nodeSizeCache.set(node, size); } return size; } function balanceRange(balanceType, children, positions, from, to, start, length, mkTop, mkTree) { let total = 0; for (let i2 = from; i2 < to; i2++) total += nodeSize(balanceType, children[i2]); let maxChild = Math.ceil( total * 1.5 / 8 /* Balance.BranchFactor */ ); let localChildren = [], localPositions = []; function divide(children2, positions2, from2, to2, offset) { for (let i2 = from2; i2 < to2; ) { let groupFrom = i2, groupStart = positions2[i2], groupSize = nodeSize(balanceType, children2[i2]); i2++; for (; i2 < to2; i2++) { let nextSize = nodeSize(balanceType, children2[i2]); if (groupSize + nextSize >= maxChild) break; groupSize += nextSize; } if (i2 == groupFrom + 1) { if (groupSize > maxChild) { let only = children2[groupFrom]; divide(only.children, only.positions, 0, only.children.length, positions2[groupFrom] + offset); continue; } localChildren.push(children2[groupFrom]); } else { let length2 = positions2[i2 - 1] + children2[i2 - 1].length - groupStart; localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i2, groupStart, length2, null, mkTree)); } localPositions.push(groupStart + offset - start); } } divide(children, positions, from, to, 0); return (mkTop || mkTree)(localChildren, localPositions, length); } class TreeFragment { /// Construct a tree fragment. You'll usually want to use /// [`addTree`](#common.TreeFragment^addTree) and /// [`applyChanges`](#common.TreeFragment^applyChanges) instead of /// calling this directly. constructor(from, to, tree, offset, openStart = false, openEnd = false) { this.from = from; this.to = to; this.tree = tree; this.offset = offset; this.open = (openStart ? 1 : 0) | (openEnd ? 2 : 0); } /// Whether the start of the fragment represents the start of a /// parse, or the end of a change. (In the second case, it may not /// be safe to reuse some nodes at the start, depending on the /// parsing algorithm.) get openStart() { return (this.open & 1) > 0; } /// Whether the end of the fragment represents the end of a /// full-document parse, or the start of a change. get openEnd() { return (this.open & 2) > 0; } /// Create a set of fragments from a freshly parsed tree, or update /// an existing set of fragments by replacing the ones that overlap /// with a tree with content from the new tree. When `partial` is /// true, the parse is treated as incomplete, and the resulting /// fragment has [`openEnd`](#common.TreeFragment.openEnd) set to /// true. static addTree(tree, fragments = [], partial = false) { let result = [new TreeFragment(0, tree.length, tree, 0, false, partial)]; for (let f2 of fragments) if (f2.to > tree.length) result.push(f2); return result; } /// Apply a set of edits to an array of fragments, removing or /// splitting fragments as necessary to remove edited ranges, and /// adjusting offsets for fragments that moved. static applyChanges(fragments, changes, minGap = 128) { if (!changes.length) return fragments; let result = []; let fI = 1, nextF = fragments.length ? fragments[0] : null; for (let cI = 0, pos = 0, off = 0; ; cI++) { let nextC = cI < changes.length ? changes[cI] : null; let nextPos = nextC ? nextC.fromA : 1e9; if (nextPos - pos >= minGap) while (nextF && nextF.from < nextPos) { let cut = nextF; if (pos >= cut.from || nextPos <= cut.to || off) { let fFrom = Math.max(cut.from, pos) - off, fTo = Math.min(cut.to, nextPos) - off; cut = fFrom >= fTo ? null : new TreeFragment(fFrom, fTo, cut.tree, cut.offset + off, cI > 0, !!nextC); } if (cut) result.push(cut); if (nextF.to > nextPos) break; nextF = fI < fragments.length ? fragments[fI++] : null; } if (!nextC) break; pos = nextC.toA; off = nextC.toA - nextC.toB; } return result; } } class Parser { /// Start a parse, returning a [partial parse](#common.PartialParse) /// object. [`fragments`](#common.TreeFragment) can be passed in to /// make the parse incremental. /// /// By default, the entire input is parsed. You can pass `ranges`, /// which should be a sorted array of non-empty, non-overlapping /// ranges, to parse only those ranges. The tree returned in that /// case will start at `ranges[0].from`. startParse(input, fragments, ranges) { if (typeof input == "string") input = new StringInput(input); ranges = !ranges ? [new Range$1(0, input.length)] : ranges.length ? ranges.map((r2) => new Range$1(r2.from, r2.to)) : [new Range$1(0, 0)]; return this.createParse(input, fragments || [], ranges); } /// Run a full parse, returning the resulting tree. parse(input, fragments, ranges) { let parse = this.startParse(input, fragments, ranges); for (; ; ) { let done = parse.advance(); if (done) return done; } } } class StringInput { constructor(string2) { this.string = string2; } get length() { return this.string.length; } chunk(from) { return this.string.slice(from); } get lineChunks() { return false; } read(from, to) { return this.string.slice(from, to); } } new NodeProp({ perNode: true }); class Stack { /// @internal constructor(p2, stack, state, reducePos, pos, score, buffer, bufferBase, curContext, lookAhead = 0, parent) { this.p = p2; this.stack = stack; this.state = state; this.reducePos = reducePos; this.pos = pos; this.score = score; this.buffer = buffer; this.bufferBase = bufferBase; this.curContext = curContext; this.lookAhead = lookAhead; this.parent = parent; } /// @internal toString() { return `[${this.stack.filter((_2, i2) => i2 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; } // Start an empty stack /// @internal static start(p2, state, pos = 0) { let cx = p2.parser.context; return new Stack(p2, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null); } /// The stack's current [context](#lr.ContextTracker) value, if /// any. Its type will depend on the context tracker's type /// parameter, or it will be `null` if there is no context /// tracker. get context() { return this.curContext ? this.curContext.context : null; } // Push a state onto the stack, tracking its start position as well // as the buffer base at that point. /// @internal pushState(state, start) { this.stack.push(this.state, start, this.bufferBase + this.buffer.length); this.state = state; } // Apply a reduce action /// @internal reduce(action) { var _a2; let depth = action >> 19, type = action & 65535; let { parser: parser2 } = this.p; let dPrec = parser2.dynamicPrecedence(type); if (dPrec) this.score += dPrec; if (depth == 0) { this.pushState(parser2.getGoto(this.state, type, true), this.reducePos); if (type < parser2.minRepeatTerm) this.storeNode(type, this.reducePos, this.reducePos, 4, true); this.reduceContext(type, this.reducePos); return; } let base2 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0); let start = base2 ? this.stack[base2 - 2] : this.p.ranges[0].from, size = this.reducePos - start; if (size >= 2e3 && !((_a2 = this.p.parser.nodeSet.types[type]) === null || _a2 === void 0 ? void 0 : _a2.isAnonymous)) { if (start == this.p.lastBigReductionStart) { this.p.bigReductionCount++; this.p.lastBigReductionSize = size; } else if (this.p.lastBigReductionSize < size) { this.p.bigReductionCount = 1; this.p.lastBigReductionStart = start; this.p.lastBigReductionSize = size; } } let bufferBase = base2 ? this.stack[base2 - 1] : 0, count = this.bufferBase + this.buffer.length - bufferBase; if (type < parser2.minRepeatTerm || action & 131072) { let pos = parser2.stateFlag( this.state, 1 /* StateFlag.Skipped */ ) ? this.pos : this.reducePos; this.storeNode(type, start, pos, count + 4, true); } if (action & 262144) { this.state = this.stack[base2]; } else { let baseStateID = this.stack[base2 - 3]; this.state = parser2.getGoto(baseStateID, type, true); } while (this.stack.length > base2) this.stack.pop(); this.reduceContext(type, start); } // Shift a value into the buffer /// @internal storeNode(term, start, end, size = 4, isReduce = false) { if (term == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { let cur = this, top2 = this.buffer.length; if (top2 == 0 && cur.parent) { top2 = cur.bufferBase - cur.parent.bufferBase; cur = cur.parent; } if (top2 > 0 && cur.buffer[top2 - 4] == 0 && cur.buffer[top2 - 1] > -1) { if (start == end) return; if (cur.buffer[top2 - 2] >= start) { cur.buffer[top2 - 2] = end; return; } } } if (!isReduce || this.pos == end) { this.buffer.push(term, start, end, size); } else { let index2 = this.buffer.length; if (index2 > 0 && this.buffer[index2 - 4] != 0) while (index2 > 0 && this.buffer[index2 - 2] > end) { this.buffer[index2] = this.buffer[index2 - 4]; this.buffer[index2 + 1] = this.buffer[index2 - 3]; this.buffer[index2 + 2] = this.buffer[index2 - 2]; this.buffer[index2 + 3] = this.buffer[index2 - 1]; index2 -= 4; if (size > 4) size -= 4; } this.buffer[index2] = term; this.buffer[index2 + 1] = start; this.buffer[index2 + 2] = end; this.buffer[index2 + 3] = size; } } // Apply a shift action /// @internal shift(action, next, nextEnd) { let start = this.pos; if (action & 131072) { this.pushState(action & 65535, this.pos); } else if ((action & 262144) == 0) { let nextState = action, { parser: parser2 } = this.p; if (nextEnd > this.pos || next <= parser2.maxNode) { this.pos = nextEnd; if (!parser2.stateFlag( nextState, 1 /* StateFlag.Skipped */ )) this.reducePos = nextEnd; } this.pushState(nextState, start); this.shiftContext(next, start); if (next <= parser2.maxNode) this.buffer.push(next, start, nextEnd, 4); } else { this.pos = nextEnd; this.shiftContext(next, start); if (next <= this.p.parser.maxNode) this.buffer.push(next, start, nextEnd, 4); } } // Apply an action /// @internal apply(action, next, nextEnd) { if (action & 65536) this.reduce(action); else this.shift(action, next, nextEnd); } // Add a prebuilt (reused) node into the buffer. /// @internal useNode(value, next) { let index2 = this.p.reused.length - 1; if (index2 < 0 || this.p.reused[index2] != value) { this.p.reused.push(value); index2++; } let start = this.pos; this.reducePos = this.pos = start + value.length; this.pushState(next, start); this.buffer.push( index2, start, this.reducePos, -1 /* size == -1 means this is a reused value */ ); if (this.curContext) this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length))); } // Split the stack. Due to the buffer sharing and the fact // that `this.stack` tends to stay quite shallow, this isn't very // expensive. /// @internal split() { let parent = this; let off = parent.buffer.length; while (off > 0 && parent.buffer[off - 2] > parent.reducePos) off -= 4; let buffer = parent.buffer.slice(off), base2 = parent.bufferBase + off; while (parent && base2 == parent.bufferBase) parent = parent.parent; return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base2, this.curContext, this.lookAhead, parent); } // Try to recover from an error by 'deleting' (ignoring) one token. /// @internal recoverByDelete(next, nextEnd) { let isNode = next <= this.p.parser.maxNode; if (isNode) this.storeNode(next, this.pos, nextEnd, 4); this.storeNode(0, this.pos, nextEnd, isNode ? 8 : 4); this.pos = this.reducePos = nextEnd; this.score -= 190; } /// Check if the given term would be able to be shifted (optionally /// after some reductions) on this stack. This can be useful for /// external tokenizers that want to make sure they only provide a /// given token when it applies. canShift(term) { for (let sim = new SimulatedStack(this); ; ) { let action = this.p.parser.stateSlot( sim.state, 4 /* ParseState.DefaultReduce */ ) || this.p.parser.hasAction(sim.state, term); if (action == 0) return false; if ((action & 65536) == 0) return true; sim.reduce(action); } } // Apply up to Recover.MaxNext recovery actions that conceptually // inserts some missing token or rule. /// @internal recoverByInsert(next) { if (this.stack.length >= 300) return []; let nextStates = this.p.parser.nextStates(this.state); if (nextStates.length > 4 << 1 || this.stack.length >= 120) { let best = []; for (let i2 = 0, s2; i2 < nextStates.length; i2 += 2) { if ((s2 = nextStates[i2 + 1]) != this.state && this.p.parser.hasAction(s2, next)) best.push(nextStates[i2], s2); } if (this.stack.length < 120) for (let i2 = 0; best.length < 4 << 1 && i2 < nextStates.length; i2 += 2) { let s2 = nextStates[i2 + 1]; if (!best.some((v2, i3) => i3 & 1 && v2 == s2)) best.push(nextStates[i2], s2); } nextStates = best; } let result = []; for (let i2 = 0; i2 < nextStates.length && result.length < 4; i2 += 2) { let s2 = nextStates[i2 + 1]; if (s2 == this.state) continue; let stack = this.split(); stack.pushState(s2, this.pos); stack.storeNode(0, stack.pos, stack.pos, 4, true); stack.shiftContext(nextStates[i2], this.pos); stack.score -= 200; result.push(stack); } return result; } // Force a reduce, if possible. Return false if that can't // be done. /// @internal forceReduce() { let { parser: parser2 } = this.p; let reduce = parser2.stateSlot( this.state, 5 /* ParseState.ForcedReduce */ ); if ((reduce & 65536) == 0) return false; if (!parser2.validAction(this.state, reduce)) { let depth = reduce >> 19, term = reduce & 65535; let target = this.stack.length - depth * 3; if (target < 0 || parser2.getGoto(this.stack[target], term, false) < 0) { let backup = this.findForcedReduction(); if (backup == null) return false; reduce = backup; } this.storeNode(0, this.pos, this.pos, 4, true); this.score -= 100; } this.reducePos = this.pos; this.reduce(reduce); return true; } /// Try to scan through the automaton to find some kind of reduction /// that can be applied. Used when the regular ForcedReduce field /// isn't a valid action. @internal findForcedReduction() { let { parser: parser2 } = this.p, seen = []; let explore = (state, depth) => { if (seen.includes(state)) return; seen.push(state); return parser2.allActions(state, (action) => { if (action & (262144 | 131072)) ; else if (action & 65536) { let rDepth = (action >> 19) - depth; if (rDepth > 1) { let term = action & 65535, target = this.stack.length - rDepth * 3; if (target >= 0 && parser2.getGoto(this.stack[target], term, false) >= 0) return rDepth << 19 | 65536 | term; } } else { let found = explore(action, depth + 1); if (found != null) return found; } }); }; return explore(this.state, 0); } /// @internal forceAll() { while (!this.p.parser.stateFlag( this.state, 2 /* StateFlag.Accepting */ )) { if (!this.forceReduce()) { this.storeNode(0, this.pos, this.pos, 4, true); break; } } return this; } /// Check whether this state has no further actions (assumed to be a direct descendant of the /// top state, since any other states must be able to continue /// somehow). @internal get deadEnd() { if (this.stack.length != 3) return false; let { parser: parser2 } = this.p; return parser2.data[parser2.stateSlot( this.state, 1 /* ParseState.Actions */ )] == 65535 && !parser2.stateSlot( this.state, 4 /* ParseState.DefaultReduce */ ); } /// Restart the stack (put it back in its start state). Only safe /// when this.stack.length == 3 (state is directly below the top /// state). @internal restart() { this.state = this.stack[0]; this.stack.length = 0; } /// @internal sameState(other) { if (this.state != other.state || this.stack.length != other.stack.length) return false; for (let i2 = 0; i2 < this.stack.length; i2 += 3) if (this.stack[i2] != other.stack[i2]) return false; return true; } /// Get the parser used by this stack. get parser() { return this.p.parser; } /// Test whether a given dialect (by numeric ID, as exported from /// the terms file) is enabled. dialectEnabled(dialectID) { return this.p.parser.dialect.flags[dialectID]; } shiftContext(term, start) { if (this.curContext) this.updateContext(this.curContext.tracker.shift(this.curContext.context, term, this, this.p.stream.reset(start))); } reduceContext(term, start) { if (this.curContext) this.updateContext(this.curContext.tracker.reduce(this.curContext.context, term, this, this.p.stream.reset(start))); } /// @internal emitContext() { let last = this.buffer.length - 1; if (last < 0 || this.buffer[last] != -3) this.buffer.push(this.curContext.hash, this.pos, this.pos, -3); } /// @internal emitLookAhead() { let last = this.buffer.length - 1; if (last < 0 || this.buffer[last] != -4) this.buffer.push(this.lookAhead, this.pos, this.pos, -4); } updateContext(context) { if (context != this.curContext.context) { let newCx = new StackContext(this.curContext.tracker, context); if (newCx.hash != this.curContext.hash) this.emitContext(); this.curContext = newCx; } } /// @internal setLookAhead(lookAhead) { if (lookAhead > this.lookAhead) { this.emitLookAhead(); this.lookAhead = lookAhead; } } /// @internal close() { if (this.curContext && this.curContext.tracker.strict) this.emitContext(); if (this.lookAhead > 0) this.emitLookAhead(); } } class StackContext { constructor(tracker, context) { this.tracker = tracker; this.context = context; this.hash = tracker.strict ? tracker.hash(context) : 0; } } var Recover; (function(Recover2) { Recover2[Recover2["Insert"] = 200] = "Insert"; Recover2[Recover2["Delete"] = 190] = "Delete"; Recover2[Recover2["Reduce"] = 100] = "Reduce"; Recover2[Recover2["MaxNext"] = 4] = "MaxNext"; Recover2[Recover2["MaxInsertStackDepth"] = 300] = "MaxInsertStackDepth"; Recover2[Recover2["DampenInsertStackDepth"] = 120] = "DampenInsertStackDepth"; Recover2[Recover2["MinBigReduction"] = 2e3] = "MinBigReduction"; })(Recover || (Recover = {})); class SimulatedStack { constructor(start) { this.start = start; this.state = start.state; this.stack = start.stack; this.base = this.stack.length; } reduce(action) { let term = action & 65535, depth = action >> 19; if (depth == 0) { if (this.stack == this.start.stack) this.stack = this.stack.slice(); this.stack.push(this.state, 0, 0); this.base += 3; } else { this.base -= (depth - 1) * 3; } let goto = this.start.p.parser.getGoto(this.stack[this.base - 3], term, true); this.state = goto; } } class StackBufferCursor { constructor(stack, pos, index2) { this.stack = stack; this.pos = pos; this.index = index2; this.buffer = stack.buffer; if (this.index == 0) this.maybeNext(); } static create(stack, pos = stack.bufferBase + stack.buffer.length) { return new StackBufferCursor(stack, pos, pos - stack.bufferBase); } maybeNext() { let next = this.stack.parent; if (next != null) { this.index = this.stack.bufferBase - next.bufferBase; this.stack = next; this.buffer = next.buffer; } } get id() { return this.buffer[this.index - 4]; } get start() { return this.buffer[this.index - 3]; } get end() { return this.buffer[this.index - 2]; } get size() { return this.buffer[this.index - 1]; } next() { this.index -= 4; this.pos -= 4; if (this.index == 0) this.maybeNext(); } fork() { return new StackBufferCursor(this.stack, this.pos, this.index); } } function decodeArray(input, Type = Uint16Array) { if (typeof input != "string") return input; let array = null; for (let pos = 0, out = 0; pos < input.length; ) { let value = 0; for (; ; ) { let next = input.charCodeAt(pos++), stop = false; if (next == 126) { value = 65535; break; } if (next >= 92) next--; if (next >= 34) next--; let digit = next - 32; if (digit >= 46) { digit -= 46; stop = true; } value += digit; if (stop) break; value *= 46; } if (array) array[out++] = value; else array = new Type(value); } return array; } class CachedToken { constructor() { this.start = -1; this.value = -1; this.end = -1; this.extended = -1; this.lookAhead = 0; this.mask = 0; this.context = 0; } } const nullToken = new CachedToken(); class InputStream { /// @internal constructor(input, ranges) { this.input = input; this.ranges = ranges; this.chunk = ""; this.chunkOff = 0; this.chunk2 = ""; this.chunk2Pos = 0; this.next = -1; this.token = nullToken; this.rangeIndex = 0; this.pos = this.chunkPos = ranges[0].from; this.range = ranges[0]; this.end = ranges[ranges.length - 1].to; this.readNext(); } /// @internal resolveOffset(offset, assoc) { let range = this.range, index2 = this.rangeIndex; let pos = this.pos + offset; while (pos < range.from) { if (!index2) return null; let next = this.ranges[--index2]; pos -= range.from - next.to; range = next; } while (assoc < 0 ? pos > range.to : pos >= range.to) { if (index2 == this.ranges.length - 1) return null; let next = this.ranges[++index2]; pos += next.from - range.to; range = next; } return pos; } /// @internal clipPos(pos) { if (pos >= this.range.from && pos < this.range.to) return pos; for (let range of this.ranges) if (range.to > pos) return Math.max(pos, range.from); return this.end; } /// Look at a code unit near the stream position. `.peek(0)` equals /// `.next`, `.peek(-1)` gives you the previous character, and so /// on. /// /// Note that looking around during tokenizing creates dependencies /// on potentially far-away content, which may reduce the /// effectiveness incremental parsing—when looking forward—or even /// cause invalid reparses when looking backward more than 25 code /// units, since the library does not track lookbehind. peek(offset) { let idx = this.chunkOff + offset, pos, result; if (idx >= 0 && idx < this.chunk.length) { pos = this.pos + offset; result = this.chunk.charCodeAt(idx); } else { let resolved = this.resolveOffset(offset, 1); if (resolved == null) return -1; pos = resolved; if (pos >= this.chunk2Pos && pos < this.chunk2Pos + this.chunk2.length) { result = this.chunk2.charCodeAt(pos - this.chunk2Pos); } else { let i2 = this.rangeIndex, range = this.range; while (range.to <= pos) range = this.ranges[++i2]; this.chunk2 = this.input.chunk(this.chunk2Pos = pos); if (pos + this.chunk2.length > range.to) this.chunk2 = this.chunk2.slice(0, range.to - pos); result = this.chunk2.charCodeAt(0); } } if (pos >= this.token.lookAhead) this.token.lookAhead = pos + 1; return result; } /// Accept a token. By default, the end of the token is set to the /// current stream position, but you can pass an offset (relative to /// the stream position) to change that. acceptToken(token, endOffset = 0) { let end = endOffset ? this.resolveOffset(endOffset, -1) : this.pos; if (end == null || end < this.token.start) throw new RangeError("Token end out of bounds"); this.token.value = token; this.token.end = end; } getChunk() { if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) { let { chunk, chunkPos } = this; this.chunk = this.chunk2; this.chunkPos = this.chunk2Pos; this.chunk2 = chunk; this.chunk2Pos = chunkPos; this.chunkOff = this.pos - this.chunkPos; } else { this.chunk2 = this.chunk; this.chunk2Pos = this.chunkPos; let nextChunk = this.input.chunk(this.pos); let end = this.pos + nextChunk.length; this.chunk = end > this.range.to ? nextChunk.slice(0, this.range.to - this.pos) : nextChunk; this.chunkPos = this.pos; this.chunkOff = 0; } } readNext() { if (this.chunkOff >= this.chunk.length) { this.getChunk(); if (this.chunkOff == this.chunk.length) return this.next = -1; } return this.next = this.chunk.charCodeAt(this.chunkOff); } /// Move the stream forward N (defaults to 1) code units. Returns /// the new value of [`next`](#lr.InputStream.next). advance(n2 = 1) { this.chunkOff += n2; while (this.pos + n2 >= this.range.to) { if (this.rangeIndex == this.ranges.length - 1) return this.setDone(); n2 -= this.range.to - this.pos; this.range = this.ranges[++this.rangeIndex]; this.pos = this.range.from; } this.pos += n2; if (this.pos >= this.token.lookAhead) this.token.lookAhead = this.pos + 1; return this.readNext(); } setDone() { this.pos = this.chunkPos = this.end; this.range = this.ranges[this.rangeIndex = this.ranges.length - 1]; this.chunk = ""; return this.next = -1; } /// @internal reset(pos, token) { if (token) { this.token = token; token.start = pos; token.lookAhead = pos + 1; token.value = token.extended = -1; } else { this.token = nullToken; } if (this.pos != pos) { this.pos = pos; if (pos == this.end) { this.setDone(); return this; } while (pos < this.range.from) this.range = this.ranges[--this.rangeIndex]; while (pos >= this.range.to) this.range = this.ranges[++this.rangeIndex]; if (pos >= this.chunkPos && pos < this.chunkPos + this.chunk.length) { this.chunkOff = pos - this.chunkPos; } else { this.chunk = ""; this.chunkOff = 0; } this.readNext(); } return this; } /// @internal read(from, to) { if (from >= this.chunkPos && to <= this.chunkPos + this.chunk.length) return this.chunk.slice(from - this.chunkPos, to - this.chunkPos); if (from >= this.chunk2Pos && to <= this.chunk2Pos + this.chunk2.length) return this.chunk2.slice(from - this.chunk2Pos, to - this.chunk2Pos); if (from >= this.range.from && to <= this.range.to) return this.input.read(from, to); let result = ""; for (let r2 of this.ranges) { if (r2.from >= to) break; if (r2.to > from) result += this.input.read(Math.max(r2.from, from), Math.min(r2.to, to)); } return result; } } class TokenGroup { constructor(data, id) { this.data = data; this.id = id; } token(input, stack) { let { parser: parser2 } = stack.p; readToken(this.data, input, stack, this.id, parser2.data, parser2.tokenPrecTable); } } TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; class ExternalTokenizer { /// Create a tokenizer. The first argument is the function that, /// given an input stream, scans for the types of tokens it /// recognizes at the stream's position, and calls /// [`acceptToken`](#lr.InputStream.acceptToken) when it finds /// one. constructor(token, options = {}) { this.token = token; this.contextual = !!options.contextual; this.fallback = !!options.fallback; this.extend = !!options.extend; } } function readToken(data, input, stack, group, precTable, precOffset) { let state = 0, groupMask = 1 << group, { dialect } = stack.p.parser; scan: for (; ; ) { if ((groupMask & data[state]) == 0) break; let accEnd = data[state + 1]; for (let i2 = state + 3; i2 < accEnd; i2 += 2) if ((data[i2 + 1] & groupMask) > 0) { let term = data[i2]; if (dialect.allows(term) && (input.token.value == -1 || input.token.value == term || overrides(term, input.token.value, precTable, precOffset))) { input.acceptToken(term); break; } } let next = input.next, low = 0, high = data[state + 2]; if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 && data[accEnd + high * 3 - 3] == 65535) { state = data[accEnd + high * 3 - 1]; continue scan; } for (; low < high; ) { let mid = low + high >> 1; let index2 = accEnd + mid + (mid << 1); let from = data[index2], to = data[index2 + 1] || 65536; if (next < from) high = mid; else if (next >= to) low = mid + 1; else { state = data[index2 + 2]; input.advance(); continue scan; } } break; } } function findOffset(data, start, term) { for (let i2 = start, next; (next = data[i2]) != 65535; i2++) if (next == term) return i2 - start; return -1; } function overrides(token, prev, tableData, tableOffset) { let iPrev = findOffset(tableData, tableOffset, prev); return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev; } const verbose = typeof process != "undefined" && process.env && /\bparse\b/.test(process.env.LOG); let stackIDs = null; var Safety; (function(Safety2) { Safety2[Safety2["Margin"] = 25] = "Margin"; })(Safety || (Safety = {})); function cutAt(tree, pos, side) { let cursor = tree.cursor(IterMode.IncludeAnonymous); cursor.moveTo(pos); for (; ; ) { if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) for (; ; ) { if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) return side < 0 ? Math.max(0, Math.min( cursor.to - 1, pos - 25 /* Safety.Margin */ )) : Math.min(tree.length, Math.max( cursor.from + 1, pos + 25 /* Safety.Margin */ )); if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) break; if (!cursor.parent()) return side < 0 ? 0 : tree.length; } } } class FragmentCursor { constructor(fragments, nodeSet) { this.fragments = fragments; this.nodeSet = nodeSet; this.i = 0; this.fragment = null; this.safeFrom = -1; this.safeTo = -1; this.trees = []; this.start = []; this.index = []; this.nextFragment(); } nextFragment() { let fr = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; if (fr) { this.safeFrom = fr.openStart ? cutAt(fr.tree, fr.from + fr.offset, 1) - fr.offset : fr.from; this.safeTo = fr.openEnd ? cutAt(fr.tree, fr.to + fr.offset, -1) - fr.offset : fr.to; while (this.trees.length) { this.trees.pop(); this.start.pop(); this.index.pop(); } this.trees.push(fr.tree); this.start.push(-fr.offset); this.index.push(0); this.nextStart = this.safeFrom; } else { this.nextStart = 1e9; } } // `pos` must be >= any previously given `pos` for this cursor nodeAt(pos) { if (pos < this.nextStart) return null; while (this.fragment && this.safeTo <= pos) this.nextFragment(); if (!this.fragment) return null; for (; ; ) { let last = this.trees.length - 1; if (last < 0) { this.nextFragment(); return null; } let top2 = this.trees[last], index2 = this.index[last]; if (index2 == top2.children.length) { this.trees.pop(); this.start.pop(); this.index.pop(); continue; } let next = top2.children[index2]; let start = this.start[last] + top2.positions[index2]; if (start > pos) { this.nextStart = start; return null; } if (next instanceof Tree) { if (start == pos) { if (start < this.safeFrom) return null; let end = start + next.length; if (end <= this.safeTo) { let lookAhead = next.prop(NodeProp.lookAhead); if (!lookAhead || end + lookAhead < this.fragment.to) return next; } } this.index[last]++; if (start + next.length >= Math.max(this.safeFrom, pos)) { this.trees.push(next); this.start.push(start); this.index.push(0); } } else { this.index[last]++; this.nextStart = start + next.length; } } } } class TokenCache { constructor(parser2, stream) { this.stream = stream; this.tokens = []; this.mainToken = null; this.actions = []; this.tokens = parser2.tokenizers.map((_2) => new CachedToken()); } getActions(stack) { let actionIndex = 0; let main = null; let { parser: parser2 } = stack.p, { tokenizers } = parser2; let mask = parser2.stateSlot( stack.state, 3 /* ParseState.TokenizerMask */ ); let context = stack.curContext ? stack.curContext.hash : 0; let lookAhead = 0; for (let i2 = 0; i2 < tokenizers.length; i2++) { if ((1 << i2 & mask) == 0) continue; let tokenizer = tokenizers[i2], token = this.tokens[i2]; if (main && !tokenizer.fallback) continue; if (tokenizer.contextual || token.start != stack.pos || token.mask != mask || token.context != context) { this.updateCachedToken(token, tokenizer, stack); token.mask = mask; token.context = context; } if (token.lookAhead > token.end + 25) lookAhead = Math.max(token.lookAhead, lookAhead); if (token.value != 0) { let startIndex = actionIndex; if (token.extended > -1) actionIndex = this.addActions(stack, token.extended, token.end, actionIndex); actionIndex = this.addActions(stack, token.value, token.end, actionIndex); if (!tokenizer.extend) { main = token; if (actionIndex > startIndex) break; } } } while (this.actions.length > actionIndex) this.actions.pop(); if (lookAhead) stack.setLookAhead(lookAhead); if (!main && stack.pos == this.stream.end) { main = new CachedToken(); main.value = stack.p.parser.eofTerm; main.start = main.end = stack.pos; actionIndex = this.addActions(stack, main.value, main.end, actionIndex); } this.mainToken = main; return this.actions; } getMainToken(stack) { if (this.mainToken) return this.mainToken; let main = new CachedToken(), { pos, p: p2 } = stack; main.start = pos; main.end = Math.min(pos + 1, p2.stream.end); main.value = pos == p2.stream.end ? p2.parser.eofTerm : 0; return main; } updateCachedToken(token, tokenizer, stack) { let start = this.stream.clipPos(stack.pos); tokenizer.token(this.stream.reset(start, token), stack); if (token.value > -1) { let { parser: parser2 } = stack.p; for (let i2 = 0; i2 < parser2.specialized.length; i2++) if (parser2.specialized[i2] == token.value) { let result = parser2.specializers[i2](this.stream.read(token.start, token.end), stack); if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) { if ((result & 1) == 0) token.value = result >> 1; else token.extended = result >> 1; break; } } } else { token.value = 0; token.end = this.stream.clipPos(start + 1); } } putAction(action, token, end, index2) { for (let i2 = 0; i2 < index2; i2 += 3) if (this.actions[i2] == action) return index2; this.actions[index2++] = action; this.actions[index2++] = token; this.actions[index2++] = end; return index2; } addActions(stack, token, end, index2) { let { state } = stack, { parser: parser2 } = stack.p, { data } = parser2; for (let set = 0; set < 2; set++) { for (let i2 = parser2.stateSlot( state, set ? 2 : 1 /* ParseState.Actions */ ); ; i2 += 3) { if (data[i2] == 65535) { if (data[i2 + 1] == 1) { i2 = pair(data, i2 + 2); } else { if (index2 == 0 && data[i2 + 1] == 2) index2 = this.putAction(pair(data, i2 + 2), token, end, index2); break; } } if (data[i2] == token) index2 = this.putAction(pair(data, i2 + 1), token, end, index2); } } return index2; } } var Rec; (function(Rec2) { Rec2[Rec2["Distance"] = 5] = "Distance"; Rec2[Rec2["MaxRemainingPerStep"] = 3] = "MaxRemainingPerStep"; Rec2[Rec2["MinBufferLengthPrune"] = 500] = "MinBufferLengthPrune"; Rec2[Rec2["ForceReduceLimit"] = 10] = "ForceReduceLimit"; Rec2[Rec2["CutDepth"] = 15e3] = "CutDepth"; Rec2[Rec2["CutTo"] = 9e3] = "CutTo"; Rec2[Rec2["MaxLeftAssociativeReductionCount"] = 300] = "MaxLeftAssociativeReductionCount"; Rec2[Rec2["MaxStackCount"] = 12] = "MaxStackCount"; })(Rec || (Rec = {})); class Parse { constructor(parser2, input, fragments, ranges) { this.parser = parser2; this.input = input; this.ranges = ranges; this.recovering = 0; this.nextStackID = 9812; this.minStackPos = 0; this.reused = []; this.stoppedAt = null; this.lastBigReductionStart = -1; this.lastBigReductionSize = 0; this.bigReductionCount = 0; this.stream = new InputStream(input, ranges); this.tokens = new TokenCache(parser2, this.stream); this.topTerm = parser2.top[1]; let { from } = ranges[0]; this.stacks = [Stack.start(this, parser2.top[0], from)]; this.fragments = fragments.length && this.stream.end - from > parser2.bufferLength * 4 ? new FragmentCursor(fragments, parser2.nodeSet) : null; } get parsedPos() { return this.minStackPos; } // Move the parser forward. This will process all parse stacks at // `this.pos` and try to advance them to a further position. If no // stack for such a position is found, it'll start error-recovery. // // When the parse is finished, this will return a syntax tree. When // not, it returns `null`. advance() { let stacks = this.stacks, pos = this.minStackPos; let newStacks = this.stacks = []; let stopped, stoppedTokens; if (this.bigReductionCount > 300 && stacks.length == 1) { let [s2] = stacks; while (s2.forceReduce() && s2.stack.length && s2.stack[s2.stack.length - 2] >= this.lastBigReductionStart) { } this.bigReductionCount = this.lastBigReductionSize = 0; } for (let i2 = 0; i2 < stacks.length; i2++) { let stack = stacks[i2]; for (; ; ) { this.tokens.mainToken = null; if (stack.pos > pos) { newStacks.push(stack); } else if (this.advanceStack(stack, newStacks, stacks)) { continue; } else { if (!stopped) { stopped = []; stoppedTokens = []; } stopped.push(stack); let tok = this.tokens.getMainToken(stack); stoppedTokens.push(tok.value, tok.end); } break; } } if (!newStacks.length) { let finished = stopped && findFinished(stopped); if (finished) return this.stackToTree(finished); if (this.parser.strict) { if (verbose && stopped) console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")); throw new SyntaxError("No parse at " + pos); } if (!this.recovering) this.recovering = 5; } if (this.recovering && stopped) { let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0] : this.runRecovery(stopped, stoppedTokens, newStacks); if (finished) return this.stackToTree(finished.forceAll()); } if (this.recovering) { let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3; if (newStacks.length > maxRemaining) { newStacks.sort((a2, b2) => b2.score - a2.score); while (newStacks.length > maxRemaining) newStacks.pop(); } if (newStacks.some((s2) => s2.reducePos > pos)) this.recovering--; } else if (newStacks.length > 1) { outer: for (let i2 = 0; i2 < newStacks.length - 1; i2++) { let stack = newStacks[i2]; for (let j = i2 + 1; j < newStacks.length; j++) { let other = newStacks[j]; if (stack.sameState(other) || stack.buffer.length > 500 && other.buffer.length > 500) { if ((stack.score - other.score || stack.buffer.length - other.buffer.length) > 0) { newStacks.splice(j--, 1); } else { newStacks.splice(i2--, 1); continue outer; } } } } if (newStacks.length > 12) newStacks.splice( 12, newStacks.length - 12 /* Rec.MaxStackCount */ ); } this.minStackPos = newStacks[0].pos; for (let i2 = 1; i2 < newStacks.length; i2++) if (newStacks[i2].pos < this.minStackPos) this.minStackPos = newStacks[i2].pos; return null; } stopAt(pos) { if (this.stoppedAt != null && this.stoppedAt < pos) throw new RangeError("Can't move stoppedAt forward"); this.stoppedAt = pos; } // Returns an updated version of the given stack, or null if the // stack can't advance normally. When `split` and `stacks` are // given, stacks split off by ambiguous operations will be pushed to // `split`, or added to `stacks` if they move `pos` forward. advanceStack(stack, stacks, split) { let start = stack.pos, { parser: parser2 } = this; let base2 = verbose ? this.stackID(stack) + " -> " : ""; if (this.stoppedAt != null && start > this.stoppedAt) return stack.forceReduce() ? stack : null; if (this.fragments) { let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0; for (let cached = this.fragments.nodeAt(start); cached; ) { let match = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser2.getGoto(stack.state, cached.type.id) : -1; if (match > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) { stack.useNode(cached, match); if (verbose) console.log(base2 + this.stackID(stack) + ` (via reuse of ${parser2.getName(cached.type.id)})`); return true; } if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0) break; let inner = cached.children[0]; if (inner instanceof Tree && cached.positions[0] == 0) cached = inner; else break; } } let defaultReduce = parser2.stateSlot( stack.state, 4 /* ParseState.DefaultReduce */ ); if (defaultReduce > 0) { stack.reduce(defaultReduce); if (verbose) console.log(base2 + this.stackID(stack) + ` (via always-reduce ${parser2.getName( defaultReduce & 65535 /* Action.ValueMask */ )})`); return true; } if (stack.stack.length >= 15e3) { while (stack.stack.length > 9e3 && stack.forceReduce()) { } } let actions = this.tokens.getActions(stack); for (let i2 = 0; i2 < actions.length; ) { let action = actions[i2++], term = actions[i2++], end = actions[i2++]; let last = i2 == actions.length || !split; let localStack = last ? stack : stack.split(); localStack.apply(action, term, end); if (verbose) console.log(base2 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser2.getName( action & 65535 /* Action.ValueMask */ )}`} for ${parser2.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`); if (last) return true; else if (localStack.pos > start) stacks.push(localStack); else split.push(localStack); } return false; } // Advance a given stack forward as far as it will go. Returns the // (possibly updated) stack if it got stuck, or null if it moved // forward and was given to `pushStackDedup`. advanceFully(stack, newStacks) { let pos = stack.pos; for (; ; ) { if (!this.advanceStack(stack, null, null)) return false; if (stack.pos > pos) { pushStackDedup(stack, newStacks); return true; } } } runRecovery(stacks, tokens, newStacks) { let finished = null, restarted = false; for (let i2 = 0; i2 < stacks.length; i2++) { let stack = stacks[i2], token = tokens[i2 << 1], tokenEnd = tokens[(i2 << 1) + 1]; let base2 = verbose ? this.stackID(stack) + " -> " : ""; if (stack.deadEnd) { if (restarted) continue; restarted = true; stack.restart(); if (verbose) console.log(base2 + this.stackID(stack) + " (restarted)"); let done = this.advanceFully(stack, newStacks); if (done) continue; } let force = stack.split(), forceBase = base2; for (let j = 0; force.forceReduce() && j < 10; j++) { if (verbose) console.log(forceBase + this.stackID(force) + " (via force-reduce)"); let done = this.advanceFully(force, newStacks); if (done) break; if (verbose) forceBase = this.stackID(force) + " -> "; } for (let insert2 of stack.recoverByInsert(token)) { if (verbose) console.log(base2 + this.stackID(insert2) + " (via recover-insert)"); this.advanceFully(insert2, newStacks); } if (this.stream.end > stack.pos) { if (tokenEnd == stack.pos) { tokenEnd++; token = 0; } stack.recoverByDelete(token, tokenEnd); if (verbose) console.log(base2 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`); pushStackDedup(stack, newStacks); } else if (!finished || finished.score < stack.score) { finished = stack; } } return finished; } // Convert the stack's buffer to a syntax tree. stackToTree(stack) { stack.close(); return Tree.build({ buffer: StackBufferCursor.create(stack), nodeSet: this.parser.nodeSet, topID: this.topTerm, maxBufferLength: this.parser.bufferLength, reused: this.reused, start: this.ranges[0].from, length: stack.pos - this.ranges[0].from, minRepeatType: this.parser.minRepeatTerm }); } stackID(stack) { let id = (stackIDs || (stackIDs = /* @__PURE__ */ new WeakMap())).get(stack); if (!id) stackIDs.set(stack, id = String.fromCodePoint(this.nextStackID++)); return id + stack; } } function pushStackDedup(stack, newStacks) { for (let i2 = 0; i2 < newStacks.length; i2++) { let other = newStacks[i2]; if (other.pos == stack.pos && other.sameState(stack)) { if (newStacks[i2].score < stack.score) newStacks[i2] = stack; return; } } newStacks.push(stack); } class Dialect { constructor(source, flags, disabled) { this.source = source; this.flags = flags; this.disabled = disabled; } allows(term) { return !this.disabled || this.disabled[term] == 0; } } class LRParser extends Parser { /// @internal constructor(spec) { super(); this.wrappers = []; if (spec.version != 14) throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14})`); let nodeNames = spec.nodeNames.split(" "); this.minRepeatTerm = nodeNames.length; for (let i2 = 0; i2 < spec.repeatNodeCount; i2++) nodeNames.push(""); let topTerms = Object.keys(spec.topRules).map((r2) => spec.topRules[r2][1]); let nodeProps = []; for (let i2 = 0; i2 < nodeNames.length; i2++) nodeProps.push([]); function setProp(nodeID, prop, value) { nodeProps[nodeID].push([prop, prop.deserialize(String(value))]); } if (spec.nodeProps) for (let propSpec of spec.nodeProps) { let prop = propSpec[0]; if (typeof prop == "string") prop = NodeProp[prop]; for (let i2 = 1; i2 < propSpec.length; ) { let next = propSpec[i2++]; if (next >= 0) { setProp(next, prop, propSpec[i2++]); } else { let value = propSpec[i2 + -next]; for (let j = -next; j > 0; j--) setProp(propSpec[i2++], prop, value); i2++; } } } this.nodeSet = new NodeSet(nodeNames.map((name2, i2) => NodeType.define({ name: i2 >= this.minRepeatTerm ? void 0 : name2, id: i2, props: nodeProps[i2], top: topTerms.indexOf(i2) > -1, error: i2 == 0, skipped: spec.skippedNodes && spec.skippedNodes.indexOf(i2) > -1 }))); if (spec.propSources) this.nodeSet = this.nodeSet.extend(...spec.propSources); this.strict = false; this.bufferLength = DefaultBufferLength; let tokenArray = decodeArray(spec.tokenData); this.context = spec.context; this.specializerSpecs = spec.specialized || []; this.specialized = new Uint16Array(this.specializerSpecs.length); for (let i2 = 0; i2 < this.specializerSpecs.length; i2++) this.specialized[i2] = this.specializerSpecs[i2].term; this.specializers = this.specializerSpecs.map(getSpecializer); this.states = decodeArray(spec.states, Uint32Array); this.data = decodeArray(spec.stateData); this.goto = decodeArray(spec.goto); this.maxTerm = spec.maxTerm; this.tokenizers = spec.tokenizers.map((value) => typeof value == "number" ? new TokenGroup(tokenArray, value) : value); this.topRules = spec.topRules; this.dialects = spec.dialects || {}; this.dynamicPrecedences = spec.dynamicPrecedences || null; this.tokenPrecTable = spec.tokenPrec; this.termNames = spec.termNames || null; this.maxNode = this.nodeSet.types.length - 1; this.dialect = this.parseDialect(); this.top = this.topRules[Object.keys(this.topRules)[0]]; } createParse(input, fragments, ranges) { let parse = new Parse(this, input, fragments, ranges); for (let w2 of this.wrappers) parse = w2(parse, input, fragments, ranges); return parse; } /// Get a goto table entry @internal getGoto(state, term, loose = false) { let table = this.goto; if (term >= table[0]) return -1; for (let pos = table[term + 1]; ; ) { let groupTag = table[pos++], last = groupTag & 1; let target = table[pos++]; if (last && loose) return target; for (let end = pos + (groupTag >> 1); pos < end; pos++) if (table[pos] == state) return target; if (last) return -1; } } /// Check if this state has an action for a given terminal @internal hasAction(state, terminal) { let data = this.data; for (let set = 0; set < 2; set++) { for (let i2 = this.stateSlot( state, set ? 2 : 1 /* ParseState.Actions */ ), next; ; i2 += 3) { if ((next = data[i2]) == 65535) { if (data[i2 + 1] == 1) next = data[i2 = pair(data, i2 + 2)]; else if (data[i2 + 1] == 2) return pair(data, i2 + 2); else break; } if (next == terminal || next == 0) return pair(data, i2 + 1); } } return 0; } /// @internal stateSlot(state, slot) { return this.states[state * 6 + slot]; } /// @internal stateFlag(state, flag) { return (this.stateSlot( state, 0 /* ParseState.Flags */ ) & flag) > 0; } /// @internal validAction(state, action) { return !!this.allActions(state, (a2) => a2 == action ? true : null); } /// @internal allActions(state, action) { let deflt = this.stateSlot( state, 4 /* ParseState.DefaultReduce */ ); let result = deflt ? action(deflt) : void 0; for (let i2 = this.stateSlot( state, 1 /* ParseState.Actions */ ); result == null; i2 += 3) { if (this.data[i2] == 65535) { if (this.data[i2 + 1] == 1) i2 = pair(this.data, i2 + 2); else break; } result = action(pair(this.data, i2 + 1)); } return result; } /// Get the states that can follow this one through shift actions or /// goto jumps. @internal nextStates(state) { let result = []; for (let i2 = this.stateSlot( state, 1 /* ParseState.Actions */ ); ; i2 += 3) { if (this.data[i2] == 65535) { if (this.data[i2 + 1] == 1) i2 = pair(this.data, i2 + 2); else break; } if ((this.data[i2 + 2] & 65536 >> 16) == 0) { let value = this.data[i2 + 1]; if (!result.some((v2, i3) => i3 & 1 && v2 == value)) result.push(this.data[i2], value); } } return result; } /// Configure the parser. Returns a new parser instance that has the /// given settings modified. Settings not provided in `config` are /// kept from the original parser. configure(config) { let copy = Object.assign(Object.create(LRParser.prototype), this); if (config.props) copy.nodeSet = this.nodeSet.extend(...config.props); if (config.top) { let info = this.topRules[config.top]; if (!info) throw new RangeError(`Invalid top rule name ${config.top}`); copy.top = info; } if (config.tokenizers) copy.tokenizers = this.tokenizers.map((t2) => { let found = config.tokenizers.find((r2) => r2.from == t2); return found ? found.to : t2; }); if (config.specializers) { copy.specializers = this.specializers.slice(); copy.specializerSpecs = this.specializerSpecs.map((s2, i2) => { let found = config.specializers.find((r2) => r2.from == s2.external); if (!found) return s2; let spec = Object.assign(Object.assign({}, s2), { external: found.to }); copy.specializers[i2] = getSpecializer(spec); return spec; }); } if (config.contextTracker) copy.context = config.contextTracker; if (config.dialect) copy.dialect = this.parseDialect(config.dialect); if (config.strict != null) copy.strict = config.strict; if (config.wrap) copy.wrappers = copy.wrappers.concat(config.wrap); if (config.bufferLength != null) copy.bufferLength = config.bufferLength; return copy; } /// Tells you whether any [parse wrappers](#lr.ParserConfig.wrap) /// are registered for this parser. hasWrappers() { return this.wrappers.length > 0; } /// Returns the name associated with a given term. This will only /// work for all terms when the parser was generated with the /// `--names` option. By default, only the names of tagged terms are /// stored. getName(term) { return this.termNames ? this.termNames[term] : String(term <= this.maxNode && this.nodeSet.types[term].name || term); } /// The eof term id is always allocated directly after the node /// types. @internal get eofTerm() { return this.maxNode + 1; } /// The type of top node produced by the parser. get topNode() { return this.nodeSet.types[this.top[1]]; } /// @internal dynamicPrecedence(term) { let prec2 = this.dynamicPrecedences; return prec2 == null ? 0 : prec2[term] || 0; } /// @internal parseDialect(dialect) { let values = Object.keys(this.dialects), flags = values.map(() => false); if (dialect) for (let part of dialect.split(" ")) { let id = values.indexOf(part); if (id >= 0) flags[id] = true; } let disabled = null; for (let i2 = 0; i2 < values.length; i2++) if (!flags[i2]) { for (let j = this.dialects[values[i2]], id; (id = this.data[j++]) != 65535; ) (disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id] = 1; } return new Dialect(dialect, flags, disabled); } /// Used by the output of the parser generator. Not available to /// user code. @hide static deserialize(spec) { return new LRParser(spec); } } function pair(data, off) { return data[off] | data[off + 1] << 16; } function findFinished(stacks) { let best = null; for (let stack of stacks) { let stopped = stack.p.stoppedAt; if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) && stack.p.parser.stateFlag( stack.state, 2 /* StateFlag.Accepting */ ) && (!best || best.score < stack.score)) best = stack; } return best; } function getSpecializer(spec) { if (spec.external) { let mask = spec.extend ? 1 : 0; return (value, stack) => spec.external(value, stack) << 1 | mask; } return spec.get; } let nextTagID = 0; class Tag { /** @internal */ constructor(set, base2, modified) { this.set = set; this.base = base2; this.modified = modified; this.id = nextTagID++; } /** Define a new tag. If `parent` is given, the tag is treated as a sub-tag of that parent, and [highlighters](#highlight.tagHighlighter) that don't mention this tag will try to fall back to the parent tag (or grandparent tag, etc). */ static define(parent) { if (parent === null || parent === void 0 ? void 0 : parent.base) throw new Error("Can not derive from a modified tag"); let tag = new Tag([], null, []); tag.set.push(tag); if (parent) for (let t2 of parent.set) tag.set.push(t2); return tag; } /** Define a tag _modifier_, which is a function that, given a tag, will return a tag that is a subtag of the original. Applying the same modifier to a twice tag will return the same value (`m1(t1) == m1(t1)`) and applying multiple modifiers will, regardless or order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`). When multiple modifiers are applied to a given base tag, each smaller set of modifiers is registered as a parent, so that for example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`, `m1(m3(t1)`, and so on. */ static defineModifier() { let mod = new Modifier(); return (tag) => { if (tag.modified.indexOf(mod) > -1) return tag; return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a2, b2) => a2.id - b2.id)); }; } } let nextModifierID = 0; class Modifier { constructor() { this.instances = []; this.id = nextModifierID++; } static get(base2, mods) { if (!mods.length) return base2; let exists = mods[0].instances.find((t2) => t2.base == base2 && sameArray$1(mods, t2.modified)); if (exists) return exists; let set = [], tag = new Tag(set, base2, mods); for (let m2 of mods) m2.instances.push(tag); let configs = powerSet(mods); for (let parent of base2.set) if (!parent.modified.length) for (let config of configs) set.push(Modifier.get(parent, config)); return tag; } } function sameArray$1(a2, b2) { return a2.length == b2.length && a2.every((x2, i2) => x2 == b2[i2]); } function powerSet(array) { let sets = [[]]; for (let i2 = 0; i2 < array.length; i2++) { for (let j = 0, e2 = sets.length; j < e2; j++) { sets.push(sets[j].concat(array[i2])); } } return sets.sort((a2, b2) => b2.length - a2.length); } function styleTags(spec) { let byName = /* @__PURE__ */ Object.create(null); for (let prop in spec) { let tags2 = spec[prop]; if (!Array.isArray(tags2)) tags2 = [tags2]; for (let part of prop.split(" ")) if (part) { let pieces = [], mode = 2, rest = part; for (let pos = 0; ; ) { if (rest == "..." && pos > 0 && pos + 3 == part.length) { mode = 1; break; } let m2 = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest); if (!m2) throw new RangeError("Invalid path: " + part); pieces.push(m2[0] == "*" ? "" : m2[0][0] == '"' ? JSON.parse(m2[0]) : m2[0]); pos += m2[0].length; if (pos == part.length) break; let next = part[pos++]; if (pos == part.length && next == "!") { mode = 0; break; } if (next != "/") throw new RangeError("Invalid path: " + part); rest = part.slice(pos); } let last = pieces.length - 1, inner = pieces[last]; if (!inner) throw new RangeError("Invalid path: " + part); let rule = new Rule(tags2, mode, last > 0 ? pieces.slice(0, last) : null); byName[inner] = rule.sort(byName[inner]); } } return ruleNodeProp.add(byName); } const ruleNodeProp = new NodeProp(); class Rule { constructor(tags2, mode, context, next) { this.tags = tags2; this.mode = mode; this.context = context; this.next = next; } get opaque() { return this.mode == 0; } get inherit() { return this.mode == 1; } sort(other) { if (!other || other.depth < this.depth) { this.next = other; return this; } other.next = this.sort(other.next); return other; } get depth() { return this.context ? this.context.length : 0; } } Rule.empty = new Rule([], 2, null); function tagHighlighter(tags2, options) { let map = /* @__PURE__ */ Object.create(null); for (let style of tags2) { if (!Array.isArray(style.tag)) map[style.tag.id] = style.class; else for (let tag of style.tag) map[tag.id] = style.class; } let { scope, all = null } = options || {}; return { style: (tags3) => { let cls = all; for (let tag of tags3) { for (let sub of tag.set) { let tagClass = map[sub.id]; if (tagClass) { cls = cls ? cls + " " + tagClass : tagClass; break; } } } return cls; }, scope }; } function highlightTags(highlighters, tags2) { let result = null; for (let highlighter of highlighters) { let value = highlighter.style(tags2); if (value) result = result ? result + " " + value : value; } return result; } function highlightTree(tree, highlighter, putStyle, from = 0, to = tree.length) { let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle); builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters); builder.flush(to); } class HighlightBuilder { constructor(at, highlighters, span) { this.at = at; this.highlighters = highlighters; this.span = span; this.class = ""; } startSpan(at, cls) { if (cls != this.class) { this.flush(at); if (at > this.at) this.at = at; this.class = cls; } } flush(to) { if (to > this.at && this.class) this.span(this.at, to, this.class); } highlightRange(cursor, from, to, inheritedClass, highlighters) { let { type, from: start, to: end } = cursor; if (start >= to || end <= from) return; if (type.isTop) highlighters = this.highlighters.filter((h2) => !h2.scope || h2.scope(type)); let cls = inheritedClass; let rule = getStyleTags(cursor) || Rule.empty; let tagCls = highlightTags(highlighters, rule.tags); if (tagCls) { if (cls) cls += " "; cls += tagCls; if (rule.mode == 1) inheritedClass += (inheritedClass ? " " : "") + tagCls; } this.startSpan(Math.max(from, start), cls); if (rule.opaque) return; let mounted = cursor.tree && cursor.tree.prop(NodeProp.mounted); if (mounted && mounted.overlay) { let inner = cursor.node.enter(mounted.overlay[0].from + start, 1); let innerHighlighters = this.highlighters.filter((h2) => !h2.scope || h2.scope(mounted.tree.type)); let hasChild2 = cursor.firstChild(); for (let i2 = 0, pos = start; ; i2++) { let next = i2 < mounted.overlay.length ? mounted.overlay[i2] : null; let nextPos = next ? next.from + start : end; let rangeFrom = Math.max(from, pos), rangeTo = Math.min(to, nextPos); if (rangeFrom < rangeTo && hasChild2) { while (cursor.from < rangeTo) { this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters); this.startSpan(Math.min(rangeTo, cursor.to), cls); if (cursor.to >= nextPos || !cursor.nextSibling()) break; } } if (!next || nextPos > to) break; pos = next.to + start; if (pos > from) { this.highlightRange(inner.cursor(), Math.max(from, next.from + start), Math.min(to, pos), "", innerHighlighters); this.startSpan(Math.min(to, pos), cls); } } if (hasChild2) cursor.parent(); } else if (cursor.firstChild()) { if (mounted) inheritedClass = ""; do { if (cursor.to <= from) continue; if (cursor.from >= to) break; this.highlightRange(cursor, from, to, inheritedClass, highlighters); this.startSpan(Math.min(to, cursor.to), cls); } while (cursor.nextSibling()); cursor.parent(); } } } function getStyleTags(node) { let rule = node.type.prop(ruleNodeProp); while (rule && rule.context && !node.matchContext(rule.context)) rule = rule.next; return rule || null; } const t$1 = Tag.define; const comment = t$1(), name = t$1(), typeName = t$1(name), propertyName = t$1(name), literal = t$1(), string = t$1(literal), number = t$1(literal), content = t$1(), heading = t$1(content), keyword = t$1(), operator = t$1(), punctuation = t$1(), bracket = t$1(punctuation), meta = t$1(); const tags = { /** A comment. */ comment, /** A line [comment](#highlight.tags.comment). */ lineComment: t$1(comment), /** A block [comment](#highlight.tags.comment). */ blockComment: t$1(comment), /** A documentation [comment](#highlight.tags.comment). */ docComment: t$1(comment), /** Any kind of identifier. */ name, /** The [name](#highlight.tags.name) of a variable. */ variableName: t$1(name), /** A type [name](#highlight.tags.name). */ typeName, /** A tag name (subtag of [`typeName`](#highlight.tags.typeName)). */ tagName: t$1(typeName), /** A property or field [name](#highlight.tags.name). */ propertyName, /** An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)). */ attributeName: t$1(propertyName), /** The [name](#highlight.tags.name) of a class. */ className: t$1(name), /** A label [name](#highlight.tags.name). */ labelName: t$1(name), /** A namespace [name](#highlight.tags.name). */ namespace: t$1(name), /** The [name](#highlight.tags.name) of a macro. */ macroName: t$1(name), /** A literal value. */ literal, /** A string [literal](#highlight.tags.literal). */ string, /** A documentation [string](#highlight.tags.string). */ docString: t$1(string), /** A character literal (subtag of [string](#highlight.tags.string)). */ character: t$1(string), /** An attribute value (subtag of [string](#highlight.tags.string)). */ attributeValue: t$1(string), /** A number [literal](#highlight.tags.literal). */ number, /** An integer [number](#highlight.tags.number) literal. */ integer: t$1(number), /** A floating-point [number](#highlight.tags.number) literal. */ float: t$1(number), /** A boolean [literal](#highlight.tags.literal). */ bool: t$1(literal), /** Regular expression [literal](#highlight.tags.literal). */ regexp: t$1(literal), /** An escape [literal](#highlight.tags.literal), for example a backslash escape in a string. */ escape: t$1(literal), /** A color [literal](#highlight.tags.literal). */ color: t$1(literal), /** A URL [literal](#highlight.tags.literal). */ url: t$1(literal), /** A language keyword. */ keyword, /** The [keyword](#highlight.tags.keyword) for the self or this object. */ self: t$1(keyword), /** The [keyword](#highlight.tags.keyword) for null. */ null: t$1(keyword), /** A [keyword](#highlight.tags.keyword) denoting some atomic value. */ atom: t$1(keyword), /** A [keyword](#highlight.tags.keyword) that represents a unit. */ unit: t$1(keyword), /** A modifier [keyword](#highlight.tags.keyword). */ modifier: t$1(keyword), /** A [keyword](#highlight.tags.keyword) that acts as an operator. */ operatorKeyword: t$1(keyword), /** A control-flow related [keyword](#highlight.tags.keyword). */ controlKeyword: t$1(keyword), /** A [keyword](#highlight.tags.keyword) that defines something. */ definitionKeyword: t$1(keyword), /** A [keyword](#highlight.tags.keyword) related to defining or interfacing with modules. */ moduleKeyword: t$1(keyword), /** An operator. */ operator, /** An [operator](#highlight.tags.operator) that dereferences something. */ derefOperator: t$1(operator), /** Arithmetic-related [operator](#highlight.tags.operator). */ arithmeticOperator: t$1(operator), /** Logical [operator](#highlight.tags.operator). */ logicOperator: t$1(operator), /** Bit [operator](#highlight.tags.operator). */ bitwiseOperator: t$1(operator), /** Comparison [operator](#highlight.tags.operator). */ compareOperator: t$1(operator), /** [Operator](#highlight.tags.operator) that updates its operand. */ updateOperator: t$1(operator), /** [Operator](#highlight.tags.operator) that defines something. */ definitionOperator: t$1(operator), /** Type-related [operator](#highlight.tags.operator). */ typeOperator: t$1(operator), /** Control-flow [operator](#highlight.tags.operator). */ controlOperator: t$1(operator), /** Program or markup punctuation. */ punctuation, /** [Punctuation](#highlight.tags.punctuation) that separates things. */ separator: t$1(punctuation), /** Bracket-style [punctuation](#highlight.tags.punctuation). */ bracket, /** Angle [brackets](#highlight.tags.bracket) (usually `<` and `>` tokens). */ angleBracket: t$1(bracket), /** Square [brackets](#highlight.tags.bracket) (usually `[` and `]` tokens). */ squareBracket: t$1(bracket), /** Parentheses (usually `(` and `)` tokens). Subtag of [bracket](#highlight.tags.bracket). */ paren: t$1(bracket), /** Braces (usually `{` and `}` tokens). Subtag of [bracket](#highlight.tags.bracket). */ brace: t$1(bracket), /** Content, for example plain text in XML or markup documents. */ content, /** [Content](#highlight.tags.content) that represents a heading. */ heading, /** A level 1 [heading](#highlight.tags.heading). */ heading1: t$1(heading), /** A level 2 [heading](#highlight.tags.heading). */ heading2: t$1(heading), /** A level 3 [heading](#highlight.tags.heading). */ heading3: t$1(heading), /** A level 4 [heading](#highlight.tags.heading). */ heading4: t$1(heading), /** A level 5 [heading](#highlight.tags.heading). */ heading5: t$1(heading), /** A level 6 [heading](#highlight.tags.heading). */ heading6: t$1(heading), /** A prose separator (such as a horizontal rule). */ contentSeparator: t$1(content), /** [Content](#highlight.tags.content) that represents a list. */ list: t$1(content), /** [Content](#highlight.tags.content) that represents a quote. */ quote: t$1(content), /** [Content](#highlight.tags.content) that is emphasized. */ emphasis: t$1(content), /** [Content](#highlight.tags.content) that is styled strong. */ strong: t$1(content), /** [Content](#highlight.tags.content) that is part of a link. */ link: t$1(content), /** [Content](#highlight.tags.content) that is styled as code or monospace. */ monospace: t$1(content), /** [Content](#highlight.tags.content) that has a strike-through style. */ strikethrough: t$1(content), /** Inserted text in a change-tracking format. */ inserted: t$1(), /** Deleted text. */ deleted: t$1(), /** Changed text. */ changed: t$1(), /** An invalid or unsyntactic element. */ invalid: t$1(), /** Metadata or meta-instruction. */ meta, /** [Metadata](#highlight.tags.meta) that applies to the entire document. */ documentMeta: t$1(meta), /** [Metadata](#highlight.tags.meta) that annotates or adds attributes to a given syntactic element. */ annotation: t$1(meta), /** Processing instruction or preprocessor directive. Subtag of [meta](#highlight.tags.meta). */ processingInstruction: t$1(meta), /** [Modifier](#highlight.Tag^defineModifier) that indicates that a given element is being defined. Expected to be used with the various [name](#highlight.tags.name) tags. */ definition: Tag.defineModifier(), /** [Modifier](#highlight.Tag^defineModifier) that indicates that something is constant. Mostly expected to be used with [variable names](#highlight.tags.variableName). */ constant: Tag.defineModifier(), /** [Modifier](#highlight.Tag^defineModifier) used to indicate that a [variable](#highlight.tags.variableName) or [property name](#highlight.tags.propertyName) is being called or defined as a function. */ function: Tag.defineModifier(), /** [Modifier](#highlight.Tag^defineModifier) that can be applied to [names](#highlight.tags.name) to indicate that they belong to the language's standard environment. */ standard: Tag.defineModifier(), /** [Modifier](#highlight.Tag^defineModifier) that indicates a given [names](#highlight.tags.name) is local to some scope. */ local: Tag.defineModifier(), /** A generic variant [modifier](#highlight.Tag^defineModifier) that can be used to tag language-specific alternative variants of some common tag. It is recommended for themes to define special forms of at least the [string](#highlight.tags.string) and [variable name](#highlight.tags.variableName) tags, since those come up a lot. */ special: Tag.defineModifier() }; tagHighlighter([ { tag: tags.link, class: "tok-link" }, { tag: tags.heading, class: "tok-heading" }, { tag: tags.emphasis, class: "tok-emphasis" }, { tag: tags.strong, class: "tok-strong" }, { tag: tags.keyword, class: "tok-keyword" }, { tag: tags.atom, class: "tok-atom" }, { tag: tags.bool, class: "tok-bool" }, { tag: tags.url, class: "tok-url" }, { tag: tags.labelName, class: "tok-labelName" }, { tag: tags.inserted, class: "tok-inserted" }, { tag: tags.deleted, class: "tok-deleted" }, { tag: tags.literal, class: "tok-literal" }, { tag: tags.string, class: "tok-string" }, { tag: tags.number, class: "tok-number" }, { tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" }, { tag: tags.variableName, class: "tok-variableName" }, { tag: tags.local(tags.variableName), class: "tok-variableName tok-local" }, { tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" }, { tag: tags.special(tags.variableName), class: "tok-variableName2" }, { tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" }, { tag: tags.typeName, class: "tok-typeName" }, { tag: tags.namespace, class: "tok-namespace" }, { tag: tags.className, class: "tok-className" }, { tag: tags.macroName, class: "tok-macroName" }, { tag: tags.propertyName, class: "tok-propertyName" }, { tag: tags.operator, class: "tok-operator" }, { tag: tags.comment, class: "tok-comment" }, { tag: tags.meta, class: "tok-meta" }, { tag: tags.invalid, class: "tok-invalid" }, { tag: tags.punctuation, class: "tok-punctuation" } ]); const closureParamDelim = 1, tpOpen = 2, tpClose = 3, RawString = 4, Float = 5; const _b = 98, _e = 101, _f = 102, _r = 114, _E = 69, Zero = 48, Dot = 46, Plus = 43, Minus = 45, Hash = 35, Quote = 34, Pipe = 124, LessThan = 60, GreaterThan = 62; function isNum(ch) { return ch >= 48 && ch <= 57; } function isNum_(ch) { return isNum(ch) || ch == 95; } const literalTokens = new ExternalTokenizer((input, stack) => { if (isNum(input.next)) { let isFloat = false; do { input.advance(); } while (isNum_(input.next)); if (input.next == Dot) { isFloat = true; input.advance(); if (isNum(input.next)) { do { input.advance(); } while (isNum_(input.next)); } else if (input.next == Dot || input.next > 127 || /\w/.test(String.fromCharCode(input.next))) { return; } } if (input.next == _e || input.next == _E) { isFloat = true; input.advance(); if (input.next == Plus || input.next == Minus) input.advance(); if (!isNum_(input.next)) return; do { input.advance(); } while (isNum_(input.next)); } if (input.next == _f) { let after = input.peek(1); if (after == Zero + 3 && input.peek(2) == Zero + 2 || after == Zero + 6 && input.peek(2) == Zero + 4) { input.advance(3); isFloat = true; } else { return; } } if (isFloat) input.acceptToken(Float); } else if (input.next == _b || input.next == _r) { if (input.next == _b) input.advance(); if (input.next != _r) return; input.advance(); let count = 0; while (input.next == Hash) { count++; input.advance(); } if (input.next != Quote) return; input.advance(); content: for (; ; ) { if (input.next < 0) return; let isQuote = input.next == Quote; input.advance(); if (isQuote) { for (let i2 = 0; i2 < count; i2++) { if (input.next != Hash) continue content; input.advance(); } input.acceptToken(RawString); return; } } } }); const closureParam = new ExternalTokenizer((input) => { if (input.next == Pipe) input.acceptToken(closureParamDelim, 1); }); const tpDelim = new ExternalTokenizer((input) => { if (input.next == LessThan) input.acceptToken(tpOpen, 1); else if (input.next == GreaterThan) input.acceptToken(tpClose, 1); }); const rustHighlighting = styleTags({ "const macro_rules struct union enum type fn impl trait let static": tags.definitionKeyword, "mod use crate": tags.moduleKeyword, "pub unsafe async mut extern default move": tags.modifier, "for if else loop while match continue break return await": tags.controlKeyword, "as in ref": tags.operatorKeyword, "where _ crate super dyn": tags.keyword, "self": tags.self, String: tags.string, Char: tags.character, RawString: tags.special(tags.string), Boolean: tags.bool, Identifier: tags.variableName, "CallExpression/Identifier": tags.function(tags.variableName), BoundIdentifier: tags.definition(tags.variableName), "FunctionItem/BoundIdentifier": tags.function(tags.definition(tags.variableName)), LoopLabel: tags.labelName, FieldIdentifier: tags.propertyName, "CallExpression/FieldExpression/FieldIdentifier": tags.function(tags.propertyName), Lifetime: tags.special(tags.variableName), ScopeIdentifier: tags.namespace, TypeIdentifier: tags.typeName, "MacroInvocation/Identifier MacroInvocation/ScopedIdentifier/Identifier": tags.macroName, "MacroInvocation/TypeIdentifier MacroInvocation/ScopedIdentifier/TypeIdentifier": tags.macroName, '"!"': tags.macroName, UpdateOp: tags.updateOperator, LineComment: tags.lineComment, BlockComment: tags.blockComment, Integer: tags.integer, Float: tags.float, ArithOp: tags.arithmeticOperator, LogicOp: tags.logicOperator, BitOp: tags.bitwiseOperator, CompareOp: tags.compareOperator, "=": tags.definitionOperator, ".. ... => ->": tags.punctuation, "( )": tags.paren, "[ ]": tags.squareBracket, "{ }": tags.brace, ". DerefOp": tags.derefOperator, "&": tags.operator, ", ; ::": tags.separator, "Attribute/...": tags.meta }); const spec_identifier = { __proto__: null, self: 28, super: 32, crate: 34, impl: 46, true: 72, false: 72, pub: 88, in: 92, const: 96, unsafe: 104, async: 108, move: 110, if: 114, let: 118, ref: 142, mut: 144, _: 198, else: 200, match: 204, as: 248, return: 252, await: 262, break: 270, continue: 276, while: 312, loop: 316, for: 320, macro_rules: 327, mod: 334, extern: 342, struct: 346, where: 364, union: 379, enum: 382, type: 390, default: 395, fn: 396, trait: 412, use: 420, static: 438, dyn: 476 }; const parser = LRParser.deserialize({ version: 14, states: "$2xQ]Q_OOP$wOWOOO&sQWO'#CnO)WQWO'#I`OOQP'#I`'#I`OOQQ'#Ie'#IeO)hO`O'#C}OOQR'#Ih'#IhO)sQWO'#IuOOQO'#Hk'#HkO)xQWO'#DpOOQR'#Iw'#IwO)xQWO'#DpO*ZQWO'#DpOOQO'#Iv'#IvO,SQWO'#J`O,ZQWO'#EiOOQV'#Hp'#HpO,cQYO'#F{OOQV'#El'#ElOOQV'#Em'#EmOOQV'#En'#EnO.YQ_O'#EkO0_Q_O'#EoO2gQWOOO4QQ_O'#FPO7hQWO'#J`OOQV'#FY'#FYO7{Q_O'#F^O:WQ_O'#FaOOQO'#F`'#F`O=sQ_O'#FcO=}Q_O'#FbO@VQWO'#FgOOQO'#J`'#J`OOQV'#Io'#IoOA]Q_O'#InOEPQWO'#InOOQV'#Fw'#FwOF[QWO'#JuOFcQWO'#F|OOQO'#IO'#IOOGrQWO'#GhOOQV'#Im'#ImOOQV'#Il'#IlOOQV'#Hj'#HjQGyQ_OOOKeQ_O'#DUOKlQYO'#CqOOQP'#I_'#I_OOQV'#Hg'#HgQ]Q_OOOLuQWO'#I`ONsQYO'#DXO!!eQWO'#JuO!!lQWO'#JuO!!vQ_O'#DfO!%]Q_O'#E}O!(sQ_O'#FWO!,ZQWO'#FZO!.^QXO'#FbO!.cQ_O'#EeO!!vQ_O'#FmO!0uQWO'#FoO!0zQWO'#FoO!1PQ^O'#FqO!1WQWO'#JuO!1_QWO'#FtO!1dQWO'#FxO!2WQWO'#JjO!2_QWO'#GOO!2_QWO'#G`O!2_QWO'#GbO!2_QWO'#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O-ohwOb!O!P!T$y%_%b)S)U)i-t$l!lz!Q!n$O$u$|%f%n%o%p%q%y%{&P&o&p&r'](q)s)v)x)y*O*P*R*V*[*^*e*n*w*x+U+V+h+o+}-i-v.U.`.p.t.x.y/Z/[/{/}0`0r0w1O1Y1Z1y2a2h2j2m2s2v3V3u3{3|4R4U4_4e4t5`5d5v6R6Y6p6v6x7c7r8gR${xR0b+UR0W*xR0U*xR6{4PR/y*vR/x*vR0P*wR0O*wR0_+QR0^+Q%XyObxz!O!P!Q!T!n$O$u$y$|%_%b%f%n%o%p%q%y%{&P&o&p&r'](q)S)U)i)s)v)x)y*O*P*R*V*[*^*e*n*w*x+U+V+h+o+}-i-t-v.U.`.p.t.x.y/Z/[/{/}0`0r0w1O1Y1Z1y2a2h2j2m2s2v3V3u3{3|4R4U4_4e4t5`5d5v6R6Y6p6v6x7c7r8gR0k+ZR0j+ZQ'R!qQ)c%XQ+w&|R4y1PX'Q!q%X&|1PR+y&|R+x&|T/S*S4TT/R*S4TR.o)sR.n)sR){%p", nodeNames: "⚠ | < > RawString Float LineComment BlockComment SourceFile ] InnerAttribute ! [ MetaItem self Metavariable super crate Identifier ScopedIdentifier :: QualifiedScope AbstractType impl SelfType MetaType TypeIdentifier ScopedTypeIdentifier ScopeIdentifier TypeArgList TypeBinding = Lifetime String Escape Char Boolean Integer } { Block ; ConstItem Vis pub ( in ) const BoundIdentifier : UnsafeBlock unsafe AsyncBlock async move IfExpression if LetDeclaration let LiteralPattern ArithOp MetaPattern SelfPattern ScopedIdentifier TuplePattern ScopedTypeIdentifier , StructPattern FieldPatternList FieldPattern ref mut FieldIdentifier .. RefPattern SlicePattern CapturedPattern ReferencePattern & MutPattern RangePattern ... OrPattern MacroPattern ParenthesizedTokens TokenBinding Identifier TokenRepetition ArithOp BitOp LogicOp UpdateOp CompareOp -> => ArithOp BracketedTokens BracedTokens _ else MatchExpression match MatchBlock MatchArm Attribute Guard UnaryExpression ArithOp DerefOp LogicOp ReferenceExpression TryExpression BinaryExpression ArithOp ArithOp BitOp BitOp BitOp BitOp LogicOp LogicOp AssignmentExpression TypeCastExpression as ReturnExpression return RangeExpression CallExpression ArgList AwaitExpression await FieldExpression GenericFunction BreakExpression break LoopLabel ContinueExpression continue IndexExpression ArrayExpression TupleExpression MacroInvocation UnitExpression ClosureExpression ParamList Parameter Parameter ParenthesizedExpression StructExpression FieldInitializerList ShorthandFieldInitializer FieldInitializer BaseFieldInitializer MatchArm WhileExpression while LoopExpression loop ForExpression for MacroInvocation MacroDefinition macro_rules MacroRule EmptyStatement ModItem mod DeclarationList AttributeItem ForeignModItem extern StructItem struct TypeParamList ConstrainedTypeParameter TraitBounds HigherRankedTraitBound RemovedTraitBound OptionalTypeParameter ConstParameter WhereClause where LifetimeClause TypeBoundClause FieldDeclarationList FieldDeclaration OrderedFieldDeclarationList UnionItem union EnumItem enum EnumVariantList EnumVariant TypeItem type FunctionItem default fn ParamList Parameter SelfParameter VariadicParameter VariadicParameter ImplItem TraitItem trait AssociatedType LetDeclaration UseDeclaration use ScopedIdentifier UseAsClause ScopedIdentifier UseList ScopedUseList UseWildcard ExternCrateDeclaration StaticItem static ExpressionStatement ExpressionStatement GenericType FunctionType ForLifetimes ParamList VariadicParameter Parameter VariadicParameter Parameter ReferenceType PointerType TupleType UnitType ArrayType MacroInvocation EmptyType DynamicType dyn BoundedType", maxTerm: 359, nodeProps: [ ["group", -42, 4, 5, 14, 15, 16, 17, 18, 19, 33, 35, 36, 37, 40, 51, 53, 56, 101, 107, 111, 112, 113, 122, 123, 125, 127, 128, 130, 132, 133, 134, 137, 139, 140, 141, 142, 143, 144, 148, 149, 155, 157, 159, "Expression", -16, 22, 24, 25, 26, 27, 222, 223, 230, 231, 232, 233, 234, 235, 236, 237, 239, "Type", -20, 42, 161, 162, 165, 166, 169, 170, 172, 188, 190, 194, 196, 204, 205, 207, 208, 209, 217, 218, 220, "Statement", -17, 49, 60, 62, 63, 64, 65, 68, 74, 75, 76, 77, 78, 80, 81, 83, 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R$n#R#S#MX#S#T$n#T#o#MX#o${$n${$|#MX$|4w$n4w5b#MX5b5i$n5i6S#MX6S;'S$n;'S;=`4s<%lO$n_$ ]]wX'_Q'OSOY$nYZ%nZr$nrs&[sz$nz{+O{!P$n!P!Q,z!Q#O$n#O#P&[#P;'S$n;'S;=`4s<%lO$n_$!_a'rX'_Q'OSOY$nYZ%nZr$nrs&[sz$nz{+O{!P$n!P!Q,z!Q!_$n!_!`@O!`#O$n#O#P&[#P#p$n#p#q$#d#q;'S$n;'S;=`4s<%lO$n_$#m]'|X'_Q'OSOY$nYZ%nZr$nrs&[sz$nz{+O{!P$n!P!Q,z!Q#O$n#O#P&[#P;'S$n;'S;=`4s<%lO$n_$$o]vX'_Q'OSOY$nYZ%nZr$nrs&[sz$nz{+O{!P$n!P!Q,z!Q#O$n#O#P&[#P;'S$n;'S;=`4s<%lO$n", tokenizers: [closureParam, tpDelim, literalTokens, 0, 1, 2, 3], topRules: { "SourceFile": [0, 8] }, specialized: [{ term: 281, get: (value) => spec_identifier[value] || -1 }], tokenPrec: 15596 }); class Text { /** Get the line description around the given position. */ lineAt(pos) { if (pos < 0 || pos > this.length) throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`); return this.lineInner(pos, false, 1, 0); } /** Get the description for the given (1-based) line number. */ line(n2) { if (n2 < 1 || n2 > this.lines) throw new RangeError(`Invalid line number ${n2} in ${this.lines}-line document`); return this.lineInner(n2, true, 1, 0); } /** Replace a range of the text with the given content. */ replace(from, to, text) { let parts = []; this.decompose( 0, from, parts, 2 /* Open.To */ ); if (text.length) text.decompose( 0, text.length, parts, 1 | 2 /* Open.To */ ); this.decompose( to, this.length, parts, 1 /* Open.From */ ); return TextNode.from(parts, this.length - (to - from) + text.length); } /** Append another document to this one. */ append(other) { return this.replace(this.length, this.length, other); } /** Retrieve the text between the given points. */ slice(from, to = this.length) { let parts = []; this.decompose(from, to, parts, 0); return TextNode.from(parts, to - from); } /** Test whether this text is equal to another instance. */ eq(other) { if (other == this) return true; if (other.length != this.length || other.lines != this.lines) return false; let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1); let a2 = new RawTextCursor(this), b2 = new RawTextCursor(other); for (let skip = start, pos = start; ; ) { a2.next(skip); b2.next(skip); skip = 0; if (a2.lineBreak != b2.lineBreak || a2.done != b2.done || a2.value != b2.value) return false; pos += a2.value.length; if (a2.done || pos >= end) return true; } } /** Iterate over the text. When `dir` is `-1`, iteration happens from end to start. This will return lines and the breaks between them as separate strings. */ iter(dir = 1) { return new RawTextCursor(this, dir); } /** Iterate over a range of the text. When `from` > `to`, the iterator will run in reverse. */ iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); } /** Return a cursor that iterates over the given range of lines, _without_ returning the line breaks between, and yielding empty strings for empty lines. When `from` and `to` are given, they should be 1-based line numbers. */ iterLines(from, to) { let inner; if (from == null) { inner = this.iter(); } else { if (to == null) to = this.lines + 1; let start = this.line(from).from; inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to)); } return new LineCursor(inner); } /** Return the document as a string, using newline characters to separate lines. */ toString() { return this.sliceString(0); } /** Convert the document to an array of lines (which can be deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). */ toJSON() { let lines = []; this.flatten(lines); return lines; } /** @internal */ constructor() { } /** Create a `Text` instance for the given array of lines. */ static of(text) { if (text.length == 0) throw new RangeError("A document must have at least one line"); if (text.length == 1 && !text[0]) return Text.empty; return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, [])); } } class TextLeaf extends Text { constructor(text, length = textLength(text)) { super(); this.text = text; this.length = length; } get lines() { return this.text.length; } get children() { return null; } lineInner(target, isLine, line, offset) { for (let i2 = 0; ; i2++) { let string2 = this.text[i2], end = offset + string2.length; if ((isLine ? line : end) >= target) return new Line(offset, end, line, string2); offset = end + 1; line++; } } decompose(from, to, target, open) { let text = from <= 0 && to >= this.length ? this : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from)); if (open & 1) { let prev = target.pop(); let joined = appendText(text.text, prev.text.slice(), 0, text.length); if (joined.length <= 32) { target.push(new TextLeaf(joined, prev.length + text.length)); } else { let mid = joined.length >> 1; target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid))); } } else { target.push(text); } } replace(from, to, text) { if (!(text instanceof TextLeaf)) return super.replace(from, to, text); let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to); let newLen = this.length + text.length - (to - from); if (lines.length <= 32) return new TextLeaf(lines, newLen); return TextNode.from(TextLeaf.split(lines, []), newLen); } sliceString(from, to = this.length, lineSep = "\n") { let result = ""; for (let pos = 0, i2 = 0; pos <= to && i2 < this.text.length; i2++) { let line = this.text[i2], end = pos + line.length; if (pos > from && i2) result += lineSep; if (from < end && to > pos) result += line.slice(Math.max(0, from - pos), to - pos); pos = end + 1; } return result; } flatten(target) { for (let line of this.text) target.push(line); } scanIdentical() { return 0; } static split(text, target) { let part = [], len = -1; for (let line of text) { part.push(line); len += line.length + 1; if (part.length == 32) { target.push(new TextLeaf(part, len)); part = []; len = -1; } } if (len > -1) target.push(new TextLeaf(part, len)); return target; } } class TextNode extends Text { constructor(children, length) { super(); this.children = children; this.length = length; this.lines = 0; for (let child of children) this.lines += child.lines; } lineInner(target, isLine, line, offset) { for (let i2 = 0; ; i2++) { let child = this.children[i2], end = offset + child.length, endLine = line + child.lines - 1; if ((isLine ? endLine : end) >= target) return child.lineInner(target, isLine, line, offset); offset = end + 1; line = endLine + 1; } } decompose(from, to, target, open) { for (let i2 = 0, pos = 0; pos <= to && i2 < this.children.length; i2++) { let child = this.children[i2], end = pos + child.length; if (from <= end && to >= pos) { let childOpen = open & ((pos <= from ? 1 : 0) | (end >= to ? 2 : 0)); if (pos >= from && end <= to && !childOpen) target.push(child); else child.decompose(from - pos, to - pos, target, childOpen); } pos = end + 1; } } replace(from, to, text) { if (text.lines < this.lines) for (let i2 = 0, pos = 0; i2 < this.children.length; i2++) { let child = this.children[i2], end = pos + child.length; if (from >= pos && to <= end) { let updated = child.replace(from - pos, to - pos, text); let totalLines = this.lines - child.lines + updated.lines; if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) { let copy = this.children.slice(); copy[i2] = updated; return new TextNode(copy, this.length - (to - from) + text.length); } return super.replace(pos, end, updated); } pos = end + 1; } return super.replace(from, to, text); } sliceString(from, to = this.length, lineSep = "\n") { let result = ""; for (let i2 = 0, pos = 0; i2 < this.children.length && pos <= to; i2++) { let child = this.children[i2], end = pos + child.length; if (pos > from && i2) result += lineSep; if (from < end && to > pos) result += child.sliceString(from - pos, to - pos, lineSep); pos = end + 1; } return result; } flatten(target) { for (let child of this.children) child.flatten(target); } scanIdentical(other, dir) { if (!(other instanceof TextNode)) return 0; let length = 0; let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length] : [this.children.length - 1, other.children.length - 1, -1, -1]; for (; ; iA += dir, iB += dir) { if (iA == eA || iB == eB) return length; let chA = this.children[iA], chB = other.children[iB]; if (chA != chB) return length + chA.scanIdentical(chB, dir); length += chA.length + 1; } } static from(children, length = children.reduce((l2, ch) => l2 + ch.length + 1, -1)) { let lines = 0; for (let ch of children) lines += ch.lines; if (lines < 32) { let flat = []; for (let ch of children) ch.flatten(flat); return new TextLeaf(flat, length); } let chunk = Math.max( 32, lines >> 5 /* Tree.BranchShift */ ), maxChunk = chunk << 1, minChunk = chunk >> 1; let chunked = [], currentLines = 0, currentLen = -1, currentChunk = []; function add(child) { let last; if (child.lines > maxChunk && child instanceof TextNode) { for (let node of child.children) add(node); } else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) { flush(); chunked.push(child); } else if (child instanceof TextLeaf && currentLines && (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && child.lines + last.lines <= 32) { currentLines += child.lines; currentLen += child.length + 1; currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length); } else { if (currentLines + child.lines > chunk) flush(); currentLines += child.lines; currentLen += child.length + 1; currentChunk.push(child); } } function flush() { if (currentLines == 0) return; chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen)); currentLen = -1; currentLines = currentChunk.length = 0; } for (let child of children) add(child); flush(); return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length); } } Text.empty = /* @__PURE__ */ new TextLeaf([""], 0); function textLength(text) { let length = -1; for (let line of text) length += line.length + 1; return length; } function appendText(text, target, from = 0, to = 1e9) { for (let pos = 0, i2 = 0, first = true; i2 < text.length && pos <= to; i2++) { let line = text[i2], end = pos + line.length; if (end >= from) { if (end > to) line = line.slice(0, to - pos); if (pos < from) line = line.slice(from - pos); if (first) { target[target.length - 1] += line; first = false; } else target.push(line); } pos = end + 1; } return target; } function sliceText(text, from, to) { return appendText(text, [""], from, to); } class RawTextCursor { constructor(text, dir = 1) { this.dir = dir; this.done = false; this.lineBreak = false; this.value = ""; this.nodes = [text]; this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1]; } nextInner(skip, dir) { this.done = this.lineBreak = false; for (; ; ) { let last = this.nodes.length - 1; let top2 = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1; let size = top2 instanceof TextLeaf ? top2.text.length : top2.children.length; if (offset == (dir > 0 ? size : 0)) { if (last == 0) { this.done = true; this.value = ""; return this; } if (dir > 0) this.offsets[last - 1]++; this.nodes.pop(); this.offsets.pop(); } else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) { this.offsets[last] += dir; if (skip == 0) { this.lineBreak = true; this.value = "\n"; return this; } skip--; } else if (top2 instanceof TextLeaf) { let next = top2.text[offset + (dir < 0 ? -1 : 0)]; this.offsets[last] += dir; if (next.length > Math.max(0, skip)) { this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip); return this; } skip -= next.length; } else { let next = top2.children[offset + (dir < 0 ? -1 : 0)]; if (skip > next.length) { skip -= next.length; this.offsets[last] += dir; } else { if (dir < 0) this.offsets[last]--; this.nodes.push(next); this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1); } } } } next(skip = 0) { if (skip < 0) { this.nextInner(-skip, -this.dir); skip = this.value.length; } return this.nextInner(skip, this.dir); } } class PartialTextCursor { constructor(text, start, end) { this.value = ""; this.done = false; this.cursor = new RawTextCursor(text, start > end ? -1 : 1); this.pos = start > end ? text.length : 0; this.from = Math.min(start, end); this.to = Math.max(start, end); } nextInner(skip, dir) { if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) { this.value = ""; this.done = true; return this; } skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos); let limit = dir < 0 ? this.pos - this.from : this.to - this.pos; if (skip > limit) skip = limit; limit -= skip; let { value } = this.cursor.next(skip); this.pos += (value.length + skip) * dir; this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit); this.done = !this.value; return this; } next(skip = 0) { if (skip < 0) skip = Math.max(skip, this.from - this.pos); else if (skip > 0) skip = Math.min(skip, this.to - this.pos); return this.nextInner(skip, this.cursor.dir); } get lineBreak() { return this.cursor.lineBreak && this.value != ""; } } class LineCursor { constructor(inner) { this.inner = inner; this.afterBreak = true; this.value = ""; this.done = false; } next(skip = 0) { let { done, lineBreak, value } = this.inner.next(skip); if (done) { this.done = true; this.value = ""; } else if (lineBreak) { if (this.afterBreak) { this.value = ""; } else { this.afterBreak = true; this.next(); } } else { this.value = value; this.afterBreak = false; } return this; } get lineBreak() { return false; } } if (typeof Symbol != "undefined") { Text.prototype[Symbol.iterator] = function() { return this.iter(); }; RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] = LineCursor.prototype[Symbol.iterator] = function() { return this; }; } class Line { /** @internal */ constructor(from, to, number2, text) { this.from = from; this.to = to; this.number = number2; this.text = text; } /** The length of the line (not including any line break after it). */ get length() { return this.to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2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((s2) => s2 ? parseInt(s2, 36) : 1); for (let i2 = 1; i2 < extend.length; i2++) extend[i2] += extend[i2 - 1]; function isExtendingChar(code2) { for (let i2 = 1; i2 < extend.length; i2 += 2) if (extend[i2] > code2) return extend[i2 - 1] <= code2; return false; } function isRegionalIndicator(code2) { return code2 >= 127462 && code2 <= 127487; } const ZWJ = 8205; function findClusterBreak(str, pos, forward = true, includeExtending = true) { return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending); } function nextClusterBreak(str, pos, includeExtending) { if (pos == str.length) return pos; if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--; let prev = codePointAt(str, pos); pos += codePointSize(prev); while (pos < str.length) { let next = codePointAt(str, pos); if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) { pos += codePointSize(next); prev = next; } else if (isRegionalIndicator(next)) { let countBefore = 0, i2 = pos - 2; while (i2 >= 0 && isRegionalIndicator(codePointAt(str, i2))) { countBefore++; i2 -= 2; } if (countBefore % 2 == 0) break; else pos += 2; } else { break; } } return pos; } function prevClusterBreak(str, pos, includeExtending) { while (pos > 0) { let found = nextClusterBreak(str, pos - 2, includeExtending); if (found < pos) return found; pos--; } return 0; } function surrogateLow(ch) { return ch >= 56320 && ch < 57344; } function surrogateHigh(ch) { return ch >= 55296 && ch < 56320; } function codePointAt(str, pos) { let code0 = str.charCodeAt(pos); if (!surrogateHigh(code0) || pos + 1 == str.length) return code0; let code1 = str.charCodeAt(pos + 1); if (!surrogateLow(code1)) return code0; return (code0 - 55296 << 10) + (code1 - 56320) + 65536; } function codePointSize(code2) { return code2 < 65536 ? 1 : 2; } const DefaultSplit = /\r\n?|\n/; var MapMode = /* @__PURE__ */ function(MapMode2) { MapMode2[MapMode2["Simple"] = 0] = "Simple"; MapMode2[MapMode2["TrackDel"] = 1] = "TrackDel"; MapMode2[MapMode2["TrackBefore"] = 2] = "TrackBefore"; MapMode2[MapMode2["TrackAfter"] = 3] = "TrackAfter"; return MapMode2; }(MapMode || (MapMode = {})); class ChangeDesc { // Sections are encoded as pairs of integers. The first is the // length in the current document, and the second is -1 for // unaffected sections, and the length of the replacement content // otherwise. So an insertion would be (0, n>0), a deletion (n>0, // 0), and a replacement two positive numbers. /** @internal */ constructor(sections) { this.sections = sections; } /** The length of the document before the change. */ get length() { let result = 0; for (let i2 = 0; i2 < this.sections.length; i2 += 2) result += this.sections[i2]; return result; } /** The length of the document after the change. */ get newLength() { let result = 0; for (let i2 = 0; i2 < this.sections.length; i2 += 2) { let ins = this.sections[i2 + 1]; result += ins < 0 ? this.sections[i2] : ins; } return result; } /** False when there are actual changes in this set. */ get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; } /** Iterate over the unchanged parts left by these changes. `posA` provides the position of the range in the old document, `posB` the new position in the changed document. */ iterGaps(f2) { for (let i2 = 0, posA = 0, posB = 0; i2 < this.sections.length; ) { let len = this.sections[i2++], ins = this.sections[i2++]; if (ins < 0) { f2(posA, posB, len); posB += len; } else { posB += ins; } posA += len; } } /** Iterate over the ranges changed by these changes. (See [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a variant that also provides you with the inserted text.) `fromA`/`toA` provides the extent of the change in the starting document, `fromB`/`toB` the extent of the replacement in the changed document. When `individual` is true, adjacent changes (which are kept separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are reported separately. */ iterChangedRanges(f2, individual = false) { iterChanges(this, f2, individual); } /** Get a description of the inverted form of these changes. */ get invertedDesc() { let sections = []; for (let i2 = 0; i2 < this.sections.length; ) { let len = this.sections[i2++], ins = this.sections[i2++]; if (ins < 0) sections.push(len, ins); else sections.push(ins, len); } return new ChangeDesc(sections); } /** Compute the combined effect of applying another set of changes after this one. The length of the document after this set should match the length before `other`. */ composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); } /** Map this description, which should start with the same document as `other`, over another set of changes, so that it can be applied after it. When `before` is true, map as if the changes in `other` happened before the ones in `this`. */ mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); } mapPos(pos, assoc = -1, mode = MapMode.Simple) { let posA = 0, posB = 0; for (let i2 = 0; i2 < this.sections.length; ) { let len = this.sections[i2++], ins = this.sections[i2++], endA = posA + len; if (ins < 0) { if (endA > pos) return posB + (pos - posA); posB += len; } else { if (mode != MapMode.Simple && endA >= pos && (mode == MapMode.TrackDel && posA < pos && endA > pos || mode == MapMode.TrackBefore && posA < pos || mode == MapMode.TrackAfter && endA > pos)) return null; if (endA > pos || endA == pos && assoc < 0 && !len) return pos == posA || assoc < 0 ? posB : posB + ins; posB += ins; } posA = endA; } if (pos > posA) throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`); return posB; } /** Check whether these changes touch a given range. When one of the changes entirely covers the range, the string `"cover"` is returned. */ touchesRange(from, to = from) { for (let i2 = 0, pos = 0; i2 < this.sections.length && pos <= to; ) { let len = this.sections[i2++], ins = this.sections[i2++], end = pos + len; if (ins >= 0 && pos <= to && end >= from) return pos < from && end > to ? "cover" : true; pos = end; } return false; } /** @internal */ toString() { let result = ""; for (let i2 = 0; i2 < this.sections.length; ) { let len = this.sections[i2++], ins = this.sections[i2++]; result += (result ? " " : "") + len + (ins >= 0 ? ":" + ins : ""); } return result; } /** Serialize this change desc to a JSON-representable value. */ toJSON() { return this.sections; } /** Create a change desc from its JSON representation (as produced by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). */ static fromJSON(json) { if (!Array.isArray(json) || json.length % 2 || json.some((a2) => typeof a2 != "number")) throw new RangeError("Invalid JSON representation of ChangeDesc"); return new ChangeDesc(json); } /** @internal */ static create(sections) { return new ChangeDesc(sections); } } class ChangeSet extends ChangeDesc { constructor(sections, inserted) { super(sections); this.inserted = inserted; } /** Apply the changes to a document, returning the modified document. */ apply(doc2) { if (this.length != doc2.length) throw new RangeError("Applying change set to a document with the wrong length"); iterChanges(this, (fromA, toA, fromB, _toB, text) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text), false); return doc2; } mapDesc(other, before = false) { return mapSet(this, other, before, true); } /** Given the document as it existed _before_ the changes, return a change set that represents the inverse of this set, which could be used to go from the document created by the changes back to the document as it existed before the changes. */ invert(doc2) { let sections = this.sections.slice(), inserted = []; for (let i2 = 0, pos = 0; i2 < sections.length; i2 += 2) { let len = sections[i2], ins = sections[i2 + 1]; if (ins >= 0) { sections[i2] = ins; sections[i2 + 1] = len; let index2 = i2 >> 1; while (inserted.length < index2) inserted.push(Text.empty); inserted.push(len ? doc2.slice(pos, pos + len) : Text.empty); } pos += len; } return new ChangeSet(sections, inserted); } /** Combine two subsequent change sets into a single set. `other` must start in the document produced by `this`. If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the returned value will represent the change `docA` → `docC`. */ compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); } /** Given another change set starting in the same document, maps this change set over the other, producing a new change set that can be applied to the document produced by applying `other`. When `before` is `true`, order changes as if `this` comes before `other`, otherwise (the default) treat `other` as coming first. Given two changes `A` and `B`, `A.compose(B.map(A))` and `B.compose(A.map(B, true))` will produce the same document. This provides a basic form of [operational transformation](https://en.wikipedia.org/wiki/Operational_transformation), and can be used for collaborative editing. */ map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); } /** Iterate over the changed ranges in the document, calling `f` for each, with the range in the original document (`fromA`-`toA`) and the range that replaces it in the new document (`fromB`-`toB`). When `individual` is true, adjacent changes are reported separately. */ iterChanges(f2, individual = false) { iterChanges(this, f2, individual); } /** Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change set. */ get desc() { return ChangeDesc.create(this.sections); } /** @internal */ filter(ranges) { let resultSections = [], resultInserted = [], filteredSections = []; let iter = new SectionIter(this); done: for (let i2 = 0, pos = 0; ; ) { let next = i2 == ranges.length ? 1e9 : ranges[i2++]; while (pos < next || pos == next && iter.len == 0) { if (iter.done) break done; let len = Math.min(iter.len, next - pos); addSection(filteredSections, len, -1); let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0; addSection(resultSections, len, ins); if (ins > 0) addInsert(resultInserted, resultSections, iter.text); iter.forward(len); pos += len; } let end = ranges[i2++]; while (pos < end) { if (iter.done) break done; let len = Math.min(iter.len, end - pos); addSection(resultSections, len, -1); addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0); iter.forward(len); pos += len; } } return { changes: new ChangeSet(resultSections, resultInserted), filtered: ChangeDesc.create(filteredSections) }; } /** Serialize this change set to a JSON-representable value. */ toJSON() { let parts = []; for (let i2 = 0; i2 < this.sections.length; i2 += 2) { let len = this.sections[i2], ins = this.sections[i2 + 1]; if (ins < 0) parts.push(len); else if (ins == 0) parts.push([len]); else parts.push([len].concat(this.inserted[i2 >> 1].toJSON())); } return parts; } /** Create a change set for the given changes, for a document of the given length, using `lineSep` as line separator. */ static of(changes, length, lineSep) { let sections = [], inserted = [], pos = 0; let total = null; function flush(force = false) { if (!force && !sections.length) return; if (pos < length) addSection(sections, length - pos, -1); let set = new ChangeSet(sections, inserted); total = total ? total.compose(set.map(total)) : set; sections = []; inserted = []; pos = 0; } function process2(spec) { if (Array.isArray(spec)) { for (let sub of spec) process2(sub); } else if (spec instanceof ChangeSet) { if (spec.length != length) throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`); flush(); total = total ? total.compose(spec.map(total)) : spec; } else { let { from, to = from, insert: insert2 } = spec; if (from > to || from < 0 || to > length) throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`); let insText = !insert2 ? Text.empty : typeof insert2 == "string" ? Text.of(insert2.split(lineSep || DefaultSplit)) : insert2; let insLen = insText.length; if (from == to && insLen == 0) return; if (from < pos) flush(); if (from > pos) addSection(sections, from - pos, -1); addSection(sections, to - from, insLen); addInsert(inserted, sections, insText); pos = to; } } process2(changes); flush(!total); return total; } /** Create an empty changeset of the given length. */ static empty(length) { return new ChangeSet(length ? [length, -1] : [], []); } /** Create a changeset from its JSON representation (as produced by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). */ static fromJSON(json) { if (!Array.isArray(json)) throw new RangeError("Invalid JSON representation of ChangeSet"); let sections = [], inserted = []; for (let i2 = 0; i2 < json.length; i2++) { let part = json[i2]; if (typeof part == "number") { sections.push(part, -1); } else if (!Array.isArray(part) || typeof part[0] != "number" || part.some((e2, i3) => i3 && typeof e2 != "string")) { throw new RangeError("Invalid JSON representation of ChangeSet"); } else if (part.length == 1) { sections.push(part[0], 0); } else { while (inserted.length < i2) inserted.push(Text.empty); inserted[i2] = Text.of(part.slice(1)); sections.push(part[0], inserted[i2].length); } } return new ChangeSet(sections, inserted); } /** @internal */ static createSet(sections, inserted) { return new ChangeSet(sections, inserted); } } function addSection(sections, len, ins, forceJoin = false) { if (len == 0 && ins <= 0) return; let last = sections.length - 2; if (last >= 0 && ins <= 0 && ins == sections[last + 1]) sections[last] += len; else if (len == 0 && sections[last] == 0) sections[last + 1] += ins; else if (forceJoin) { sections[last] += len; sections[last + 1] += ins; } else sections.push(len, ins); } function addInsert(values, sections, value) { if (value.length == 0) return; let index2 = sections.length - 2 >> 1; if (index2 < values.length) { values[values.length - 1] = values[values.length - 1].append(value); } else { while (values.length < index2) values.push(Text.empty); values.push(value); } } function iterChanges(desc, f2, individual) { let inserted = desc.inserted; for (let posA = 0, posB = 0, i2 = 0; i2 < desc.sections.length; ) { let len = desc.sections[i2++], ins = desc.sections[i2++]; if (ins < 0) { posA += len; posB += len; } else { let endA = posA, endB = posB, text = Text.empty; for (; ; ) { endA += len; endB += ins; if (ins && inserted) text = text.append(inserted[i2 - 2 >> 1]); if (individual || i2 == desc.sections.length || desc.sections[i2 + 1] < 0) break; len = desc.sections[i2++]; ins = desc.sections[i2++]; } f2(posA, endA, posB, endB, text); posA = endA; posB = endB; } } } function mapSet(setA, setB, before, mkSet = false) { let sections = [], insert2 = mkSet ? [] : null; let a2 = new SectionIter(setA), b2 = new SectionIter(setB); for (let inserted = -1; ; ) { if (a2.ins == -1 && b2.ins == -1) { let len = Math.min(a2.len, b2.len); addSection(sections, len, -1); a2.forward(len); b2.forward(len); } else if (b2.ins >= 0 && (a2.ins < 0 || inserted == a2.i || a2.off == 0 && (b2.len < a2.len || b2.len == a2.len && !before))) { let len = b2.len; addSection(sections, b2.ins, -1); while (len) { let piece = Math.min(a2.len, len); if (a2.ins >= 0 && inserted < a2.i && a2.len <= piece) { addSection(sections, 0, a2.ins); if (insert2) addInsert(insert2, sections, a2.text); inserted = a2.i; } a2.forward(piece); len -= piece; } b2.next(); } else if (a2.ins >= 0) { let len = 0, left = a2.len; while (left) { if (b2.ins == -1) { let piece = Math.min(left, b2.len); len += piece; left -= piece; b2.forward(piece); } else if (b2.ins == 0 && b2.len < left) { left -= b2.len; b2.next(); } else { break; } } addSection(sections, len, inserted < a2.i ? a2.ins : 0); if (insert2 && inserted < a2.i) addInsert(insert2, sections, a2.text); inserted = a2.i; a2.forward(a2.len - left); } else if (a2.done && b2.done) { return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); } else { throw new Error("Mismatched change set lengths"); } } } function composeSets(setA, setB, mkSet = false) { let sections = []; let insert2 = mkSet ? [] : null; let a2 = new SectionIter(setA), b2 = new SectionIter(setB); for (let open = false; ; ) { if (a2.done && b2.done) { return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); } else if (a2.ins == 0) { addSection(sections, a2.len, 0, open); a2.next(); } else if (b2.len == 0 && !b2.done) { addSection(sections, 0, b2.ins, open); if (insert2) addInsert(insert2, sections, b2.text); b2.next(); } else if (a2.done || b2.done) { throw new Error("Mismatched change set lengths"); } else { let len = Math.min(a2.len2, b2.len), sectionLen = sections.length; if (a2.ins == -1) { let insB = b2.ins == -1 ? -1 : b2.off ? 0 : b2.ins; addSection(sections, len, insB, open); if (insert2 && insB) addInsert(insert2, sections, b2.text); } else if (b2.ins == -1) { addSection(sections, a2.off ? 0 : a2.len, len, open); if (insert2) addInsert(insert2, sections, a2.textBit(len)); } else { addSection(sections, a2.off ? 0 : a2.len, b2.off ? 0 : b2.ins, open); if (insert2 && !b2.off) addInsert(insert2, sections, b2.text); } open = (a2.ins > len || b2.ins >= 0 && b2.len > len) && (open || sections.length > sectionLen); a2.forward2(len); b2.forward(len); } } } class SectionIter { constructor(set) { this.set = set; this.i = 0; this.next(); } next() { let { sections } = this.set; if (this.i < sections.length) { this.len = sections[this.i++]; this.ins = sections[this.i++]; } else { this.len = 0; this.ins = -2; } this.off = 0; } get done() { return this.ins == -2; } get len2() { return this.ins < 0 ? this.len : this.ins; } get text() { let { inserted } = this.set, index2 = this.i - 2 >> 1; return index2 >= inserted.length ? Text.empty : inserted[index2]; } textBit(len) { let { inserted } = this.set, index2 = this.i - 2 >> 1; return index2 >= inserted.length && !len ? Text.empty : inserted[index2].slice(this.off, len == null ? void 0 : this.off + len); } forward(len) { if (len == this.len) this.next(); else { this.len -= len; this.off += len; } } forward2(len) { if (this.ins == -1) this.forward(len); else if (len == this.ins) this.next(); else { this.ins -= len; this.off += len; } } } class SelectionRange { constructor(from, to, flags) { this.from = from; this.to = to; this.flags = flags; } /** The anchor of the range—the side that doesn't move when you extend it. */ get anchor() { return this.flags & 16 ? this.to : this.from; } /** The head of the range, which is moved when the range is [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). */ get head() { return this.flags & 16 ? this.from : this.to; } /** True when `anchor` and `head` are at the same position. */ get empty() { return this.from == this.to; } /** If this is a cursor that is explicitly associated with the character on one of its sides, this returns the side. -1 means the character before its position, 1 the character after, and 0 means no association. */ get assoc() { return this.flags & 4 ? -1 : this.flags & 8 ? 1 : 0; } /** The bidirectional text level associated with this cursor, if any. */ get bidiLevel() { let level = this.flags & 3; return level == 3 ? null : level; } /** The goal column (stored vertical offset) associated with a cursor. This is used to preserve the vertical position when [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across lines of different length. */ get goalColumn() { let value = this.flags >> 5; return value == 33554431 ? void 0 : value; } /** Map this range through a change, producing a valid range in the updated document. */ map(change, assoc = -1) { let from, to; if (this.empty) { from = to = change.mapPos(this.from, assoc); } else { from = change.mapPos(this.from, 1); to = change.mapPos(this.to, -1); } return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags); } /** Extend this range to cover at least `from` to `to`. */ extend(from, to = from) { if (from <= this.anchor && to >= this.anchor) return EditorSelection.range(from, to); let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to; return EditorSelection.range(this.anchor, head); } /** Compare this range to another range. */ eq(other) { return this.anchor == other.anchor && this.head == other.head; } /** Return a JSON-serializable object representing the range. */ toJSON() { return { anchor: this.anchor, head: this.head }; } /** Convert a JSON representation of a range to a `SelectionRange` instance. */ static fromJSON(json) { if (!json || typeof json.anchor != "number" || typeof json.head != "number") throw new RangeError("Invalid JSON representation for SelectionRange"); return EditorSelection.range(json.anchor, json.head); } /** @internal */ static create(from, to, flags) { return new SelectionRange(from, to, flags); } } class EditorSelection { constructor(ranges, mainIndex) { this.ranges = ranges; this.mainIndex = mainIndex; } /** Map a selection through a change. Used to adjust the selection position for changes. */ map(change, assoc = -1) { if (change.empty) return this; return EditorSelection.create(this.ranges.map((r2) => r2.map(change, assoc)), this.mainIndex); } /** Compare this selection to another selection. */ eq(other) { if (this.ranges.length != other.ranges.length || this.mainIndex != other.mainIndex) return false; for (let i2 = 0; i2 < this.ranges.length; i2++) if (!this.ranges[i2].eq(other.ranges[i2])) return false; return true; } /** Get the primary selection range. Usually, you should make sure your code applies to _all_ ranges, by using methods like [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange). */ get main() { return this.ranges[this.mainIndex]; } /** Make sure the selection only has one range. Returns a selection holding only the main range from this selection. */ asSingle() { return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0); } /** Extend this selection with an extra range. */ addRange(range, main = true) { return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1); } /** Replace a given range with another range, and then normalize the selection to merge and sort ranges if necessary. */ replaceRange(range, which = this.mainIndex) { let ranges = this.ranges.slice(); ranges[which] = range; return EditorSelection.create(ranges, this.mainIndex); } /** Convert this selection to an object that can be serialized to JSON. */ toJSON() { return { ranges: this.ranges.map((r2) => r2.toJSON()), main: this.mainIndex }; } /** Create a selection from a JSON representation. */ static fromJSON(json) { if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length) throw new RangeError("Invalid JSON representation for EditorSelection"); return new EditorSelection(json.ranges.map((r2) => SelectionRange.fromJSON(r2)), json.main); } /** Create a selection holding a single range. */ static single(anchor, head = anchor) { return new EditorSelection([EditorSelection.range(anchor, head)], 0); } /** Sort and merge the given set of ranges, creating a valid selection. */ static create(ranges, mainIndex = 0) { if (ranges.length == 0) throw new RangeError("A selection needs at least one range"); for (let pos = 0, i2 = 0; i2 < ranges.length; i2++) { let range = ranges[i2]; if (range.empty ? range.from <= pos : range.from < pos) return EditorSelection.normalized(ranges.slice(), mainIndex); pos = range.to; } return new EditorSelection(ranges, mainIndex); } /** Create a cursor selection range at the given position. You can safely ignore the optional arguments in most situations. */ static cursor(pos, assoc = 0, bidiLevel, goalColumn) { return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 : 8) | (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) | (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431) << 5); } /** Create a selection range. */ static range(anchor, head, goalColumn, bidiLevel) { let flags = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431) << 5 | (bidiLevel == null ? 3 : Math.min(2, bidiLevel)); return head < anchor ? SelectionRange.create(head, anchor, 16 | 8 | flags) : SelectionRange.create(anchor, head, (head > anchor ? 4 : 0) | flags); } /** @internal */ static normalized(ranges, mainIndex = 0) { let main = ranges[mainIndex]; ranges.sort((a2, b2) => a2.from - b2.from); mainIndex = ranges.indexOf(main); for (let i2 = 1; i2 < ranges.length; i2++) { let range = ranges[i2], prev = ranges[i2 - 1]; if (range.empty ? range.from <= prev.to : range.from < prev.to) { let from = prev.from, to = Math.max(range.to, prev.to); if (i2 <= mainIndex) mainIndex--; ranges.splice(--i2, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to)); } } return new EditorSelection(ranges, mainIndex); } } function checkSelection(selection, docLength) { for (let range of selection.ranges) if (range.to > docLength) throw new RangeError("Selection points outside of document"); } let nextID = 0; class Facet { constructor(combine, compareInput, compare2, isStatic, enables) { this.combine = combine; this.compareInput = compareInput; this.compare = compare2; this.isStatic = isStatic; this.id = nextID++; this.default = combine([]); this.extensions = typeof enables == "function" ? enables(this) : enables; } /** Define a new facet. */ static define(config = {}) { return new Facet(config.combine || ((a2) => a2), config.compareInput || ((a2, b2) => a2 === b2), config.compare || (!config.combine ? sameArray : (a2, b2) => a2 === b2), !!config.static, config.enables); } /** Returns an extension that adds the given value to this facet. */ of(value) { return new FacetProvider([], this, 0, value); } /** Create an extension that computes a value for the facet from a state. You must take care to declare the parts of the state that this value depends on, since your function is only called again for a new state when one of those parts changed. In cases where your value depends only on a single field, you'll want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. */ compute(deps, get) { if (this.isStatic) throw new Error("Can't compute a static facet"); return new FacetProvider(deps, this, 1, get); } /** Create an extension that computes zero or more values for this facet from a state. */ computeN(deps, get) { if (this.isStatic) throw new Error("Can't compute a static facet"); return new FacetProvider(deps, this, 2, get); } from(field, get) { if (!get) get = (x2) => x2; return this.compute([field], (state) => get(state.field(field))); } } function sameArray(a2, b2) { return a2 == b2 || a2.length == b2.length && a2.every((e2, i2) => e2 === b2[i2]); } class FacetProvider { constructor(dependencies, facet, type, value) { this.dependencies = dependencies; this.facet = facet; this.type = type; this.value = value; this.id = nextID++; } dynamicSlot(addresses) { var _a2; let getter = this.value; let compare2 = this.facet.compareInput; let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2; let depDoc = false, depSel = false, depAddrs = []; for (let dep of this.dependencies) { if (dep == "doc") depDoc = true; else if (dep == "selection") depSel = true; else if ((((_a2 = addresses[dep.id]) !== null && _a2 !== void 0 ? _a2 : 1) & 1) == 0) depAddrs.push(addresses[dep.id]); } return { create(state) { state.values[idx] = getter(state); return 1; }, update(state, tr) { if (depDoc && tr.docChanged || depSel && (tr.docChanged || tr.selection) || ensureAll(state, depAddrs)) { let newVal = getter(state); if (multi ? !compareArray(newVal, state.values[idx], compare2) : !compare2(newVal, state.values[idx])) { state.values[idx] = newVal; return 1; } } return 0; }, reconfigure: (state, oldState) => { let newVal, oldAddr = oldState.config.address[id]; if (oldAddr != null) { let oldVal = getAddr(oldState, oldAddr); if (this.dependencies.every((dep) => { return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) : dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true; }) || (multi ? compareArray(newVal = getter(state), oldVal, compare2) : compare2(newVal = getter(state), oldVal))) { state.values[idx] = oldVal; return 0; } } else { newVal = getter(state); } state.values[idx] = newVal; return 1; } }; } } function compareArray(a2, b2, compare2) { if (a2.length != b2.length) return false; for (let i2 = 0; i2 < a2.length; i2++) if (!compare2(a2[i2], b2[i2])) return false; return true; } function ensureAll(state, addrs) { let changed = false; for (let addr of addrs) if (ensureAddr(state, addr) & 1) changed = true; return changed; } function dynamicFacetSlot(addresses, facet, providers) { let providerAddrs = providers.map((p2) => addresses[p2.id]); let providerTypes = providers.map((p2) => p2.type); let dynamic = providerAddrs.filter((p2) => !(p2 & 1)); let idx = addresses[facet.id] >> 1; function get(state) { let values = []; for (let i2 = 0; i2 < providerAddrs.length; i2++) { let value = getAddr(state, providerAddrs[i2]); if (providerTypes[i2] == 2) for (let val of value) values.push(val); else values.push(value); } return facet.combine(values); } return { create(state) { for (let addr of providerAddrs) ensureAddr(state, addr); state.values[idx] = get(state); return 1; }, update(state, tr) { if (!ensureAll(state, dynamic)) return 0; let value = get(state); if (facet.compare(value, state.values[idx])) return 0; state.values[idx] = value; return 1; }, reconfigure(state, oldState) { let depChanged = ensureAll(state, providerAddrs); let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet); if (oldProviders && !depChanged && sameArray(providers, oldProviders)) { state.values[idx] = oldValue; return 0; } let value = get(state); if (facet.compare(value, oldValue)) { state.values[idx] = oldValue; return 0; } state.values[idx] = value; return 1; } }; } const initField = /* @__PURE__ */ Facet.define({ static: true }); class StateField { constructor(id, createF, updateF, compareF, spec) { this.id = id; this.createF = createF; this.updateF = updateF; this.compareF = compareF; this.spec = spec; this.provides = void 0; } /** Define a state field. */ static define(config) { let field = new StateField(nextID++, config.create, config.update, config.compare || ((a2, b2) => a2 === b2), config); if (config.provide) field.provides = config.provide(field); return field; } create(state) { let init = state.facet(initField).find((i2) => i2.field == this); return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state); } /** @internal */ slot(addresses) { let idx = addresses[this.id] >> 1; return { create: (state) => { state.values[idx] = this.create(state); return 1; }, update: (state, tr) => { let oldVal = state.values[idx]; let value = this.updateF(oldVal, tr); if (this.compareF(oldVal, value)) return 0; state.values[idx] = value; return 1; }, reconfigure: (state, oldState) => { if (oldState.config.address[this.id] != null) { state.values[idx] = oldState.field(this); return 0; } state.values[idx] = this.create(state); return 1; } }; } /** Returns an extension that enables this field and overrides the way it is initialized. Can be useful when you need to provide a non-default starting value for the field. */ init(create) { return [this, initField.of({ field: this, create })]; } /** State field instances can be used as [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a given state. */ get extension() { return this; } } const Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; function prec(value) { return (ext) => new PrecExtension(ext, value); } const Prec = { /** The highest precedence level, for extensions that should end up near the start of the precedence ordering. */ highest: /* @__PURE__ */ prec(Prec_.highest), /** A higher-than-default precedence, for extensions that should come before those with default precedence. */ high: /* @__PURE__ */ prec(Prec_.high), /** The default precedence, which is also used for extensions without an explicit precedence. */ default: /* @__PURE__ */ prec(Prec_.default), /** A lower-than-default precedence. */ low: /* @__PURE__ */ prec(Prec_.low), /** The lowest precedence level. Meant for things that should end up near the end of the extension order. */ lowest: /* @__PURE__ */ prec(Prec_.lowest) }; class PrecExtension { constructor(inner, prec2) { this.inner = inner; this.prec = prec2; } } class Compartment { /** Create an instance of this compartment to add to your [state configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). */ of(ext) { return new CompartmentInstance(this, ext); } /** Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that reconfigures this compartment. */ reconfigure(content2) { return Compartment.reconfigure.of({ compartment: this, extension: content2 }); } /** Get the current content of the compartment in the state, or `undefined` if it isn't present. */ get(state) { return state.config.compartments.get(this); } } class CompartmentInstance { constructor(compartment, inner) { this.compartment = compartment; this.inner = inner; } } class Configuration { constructor(base2, compartments, dynamicSlots, address, staticValues, facets) { this.base = base2; this.compartments = compartments; this.dynamicSlots = dynamicSlots; this.address = address; this.staticValues = staticValues; this.facets = facets; this.statusTemplate = []; while (this.statusTemplate.length < dynamicSlots.length) this.statusTemplate.push( 0 /* SlotStatus.Unresolved */ ); } staticFacet(facet) { let addr = this.address[facet.id]; return addr == null ? facet.default : this.staticValues[addr >> 1]; } static resolve(base2, compartments, oldState) { let fields = []; let facets = /* @__PURE__ */ Object.create(null); let newCompartments = /* @__PURE__ */ new Map(); for (let ext of flatten(base2, compartments, newCompartments)) { if (ext instanceof StateField) fields.push(ext); else (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext); } let address = /* @__PURE__ */ Object.create(null); let staticValues = []; let dynamicSlots = []; for (let field of fields) { address[field.id] = dynamicSlots.length << 1; dynamicSlots.push((a2) => field.slot(a2)); } let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets; for (let id in facets) { let providers = facets[id], facet = providers[0].facet; let oldProviders = oldFacets && oldFacets[id] || []; if (providers.every( (p2) => p2.type == 0 /* Provider.Static */ )) { address[facet.id] = staticValues.length << 1 | 1; if (sameArray(oldProviders, providers)) { staticValues.push(oldState.facet(facet)); } else { let value = facet.combine(providers.map((p2) => p2.value)); staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value); } } else { for (let p2 of providers) { if (p2.type == 0) { address[p2.id] = staticValues.length << 1 | 1; staticValues.push(p2.value); } else { address[p2.id] = dynamicSlots.length << 1; dynamicSlots.push((a2) => p2.dynamicSlot(a2)); } } address[facet.id] = dynamicSlots.length << 1; dynamicSlots.push((a2) => dynamicFacetSlot(a2, facet, providers)); } } let dynamic = dynamicSlots.map((f2) => f2(address)); return new Configuration(base2, newCompartments, dynamic, address, staticValues, facets); } } function flatten(extension, compartments, newCompartments) { let result = [[], [], [], [], []]; let seen = /* @__PURE__ */ new Map(); function inner(ext, prec2) { let known = seen.get(ext); if (known != null) { if (known <= prec2) return; let found = result[known].indexOf(ext); if (found > -1) result[known].splice(found, 1); if (ext instanceof CompartmentInstance) newCompartments.delete(ext.compartment); } seen.set(ext, prec2); if (Array.isArray(ext)) { for (let e2 of ext) inner(e2, prec2); } else if (ext instanceof CompartmentInstance) { if (newCompartments.has(ext.compartment)) throw new RangeError(`Duplicate use of compartment in extensions`); let content2 = compartments.get(ext.compartment) || ext.inner; newCompartments.set(ext.compartment, content2); inner(content2, prec2); } else if (ext instanceof PrecExtension) { inner(ext.inner, ext.prec); } else if (ext instanceof StateField) { result[prec2].push(ext); if (ext.provides) inner(ext.provides, prec2); } else if (ext instanceof FacetProvider) { result[prec2].push(ext); if (ext.facet.extensions) inner(ext.facet.extensions, Prec_.default); } else { let content2 = ext.extension; if (!content2) throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); inner(content2, prec2); } } inner(extension, Prec_.default); return result.reduce((a2, b2) => a2.concat(b2)); } function ensureAddr(state, addr) { if (addr & 1) return 2; let idx = addr >> 1; let status = state.status[idx]; if (status == 4) throw new Error("Cyclic dependency between fields and/or facets"); if (status & 2) return status; state.status[idx] = 4; let changed = state.computeSlot(state, state.config.dynamicSlots[idx]); return state.status[idx] = 2 | changed; } function getAddr(state, addr) { return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1]; } const languageData = /* @__PURE__ */ Facet.define(); const allowMultipleSelections = /* @__PURE__ */ Facet.define({ combine: (values) => values.some((v2) => v2), static: true }); const lineSeparator = /* @__PURE__ */ Facet.define({ combine: (values) => values.length ? values[0] : void 0, static: true }); const changeFilter = /* @__PURE__ */ Facet.define(); const transactionFilter = /* @__PURE__ */ Facet.define(); const transactionExtender = /* @__PURE__ */ Facet.define(); const readOnly$1 = /* @__PURE__ */ Facet.define({ combine: (values) => values.length ? values[0] : false }); class Annotation { /** @internal */ constructor(type, value) { this.type = type; this.value = value; } /** Define a new type of annotation. */ static define() { return new AnnotationType(); } } class AnnotationType { /** Create an instance of this annotation. */ of(value) { return new Annotation(this, value); } } class StateEffectType { /** @internal */ constructor(map) { this.map = map; } /** Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this type. */ of(value) { return new StateEffect(this, value); } } class StateEffect { /** @internal */ constructor(type, value) { this.type = type; this.value = value; } /** Map this effect through a position mapping. Will return `undefined` when that ends up deleting the effect. */ map(mapping) { let mapped = this.type.map(this.value, mapping); return mapped === void 0 ? void 0 : mapped == this.value ? this : new StateEffect(this.type, mapped); } /** Tells you whether this effect object is of a given [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). */ is(type) { return this.type == type; } /** Define a new effect type. The type parameter indicates the type of values that his effect holds. It should be a type that doesn't include `undefined`, since that is used in [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is removed. */ static define(spec = {}) { return new StateEffectType(spec.map || ((v2) => v2)); } /** Map an array of effects through a change set. */ static mapEffects(effects, mapping) { if (!effects.length) return effects; let result = []; for (let effect of effects) { let mapped = effect.map(mapping); if (mapped) result.push(mapped); } return result; } } StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define(); StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define(); class Transaction { constructor(startState, changes, selection, effects, annotations, scrollIntoView2) { this.startState = startState; this.changes = changes; this.selection = selection; this.effects = effects; this.annotations = annotations; this.scrollIntoView = scrollIntoView2; this._doc = null; this._state = null; if (selection) checkSelection(selection, changes.newLength); if (!annotations.some((a2) => a2.type == Transaction.time)) this.annotations = annotations.concat(Transaction.time.of(Date.now())); } /** @internal */ static create(startState, changes, selection, effects, annotations, scrollIntoView2) { return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView2); } /** The new document produced by the transaction. Contrary to [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't force the entire new state to be computed right away, so it is recommended that [transaction filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter when they need to look at the new document. */ get newDoc() { return this._doc || (this._doc = this.changes.apply(this.startState.doc)); } /** The new selection produced by the transaction. If [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's current selection through the changes made by the transaction. */ get newSelection() { return this.selection || this.startState.selection.map(this.changes); } /** The new state created by the transaction. Computed on demand (but retained for subsequent access), so it is recommended not to access it in [transaction filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. */ get state() { if (!this._state) this.startState.applyTransaction(this); return this._state; } /** Get the value of the given annotation type, if any. */ annotation(type) { for (let ann of this.annotations) if (ann.type == type) return ann.value; return void 0; } /** Indicates whether the transaction changed the document. */ get docChanged() { return !this.changes.empty; } /** Indicates whether this transaction reconfigures the state (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or with a top-level configuration [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). */ get reconfigured() { return this.startState.config != this.state.config; } /** Returns true if the transaction has a [user event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to or more specific than `event`. For example, if the transaction has `"select.pointer"` as user event, `"select"` and `"select.pointer"` will match it. */ isUserEvent(event) { let e2 = this.annotation(Transaction.userEvent); return !!(e2 && (e2 == event || e2.length > event.length && e2.slice(0, event.length) == event && e2[event.length] == ".")); } } Transaction.time = /* @__PURE__ */ Annotation.define(); Transaction.userEvent = /* @__PURE__ */ Annotation.define(); Transaction.addToHistory = /* @__PURE__ */ Annotation.define(); Transaction.remote = /* @__PURE__ */ Annotation.define(); function joinRanges(a2, b2) { let result = []; for (let iA = 0, iB = 0; ; ) { let from, to; if (iA < a2.length && (iB == b2.length || b2[iB] >= a2[iA])) { from = a2[iA++]; to = a2[iA++]; } else if (iB < b2.length) { from = b2[iB++]; to = b2[iB++]; } else return result; if (!result.length || result[result.length - 1] < from) result.push(from, to); else if (result[result.length - 1] < to) result[result.length - 1] = to; } } function mergeTransaction(a2, b2, sequential) { var _a2; let mapForA, mapForB, changes; if (sequential) { mapForA = b2.changes; mapForB = ChangeSet.empty(b2.changes.length); changes = a2.changes.compose(b2.changes); } else { mapForA = b2.changes.map(a2.changes); mapForB = a2.changes.mapDesc(b2.changes, true); changes = a2.changes.compose(mapForA); } return { changes, selection: b2.selection ? b2.selection.map(mapForB) : (_a2 = a2.selection) === null || _a2 === void 0 ? void 0 : _a2.map(mapForA), effects: StateEffect.mapEffects(a2.effects, mapForA).concat(StateEffect.mapEffects(b2.effects, mapForB)), annotations: a2.annotations.length ? a2.annotations.concat(b2.annotations) : b2.annotations, scrollIntoView: a2.scrollIntoView || b2.scrollIntoView }; } function resolveTransactionInner(state, spec, docSize) { let sel = spec.selection, annotations = asArray(spec.annotations); if (spec.userEvent) annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent)); return { changes: spec.changes instanceof ChangeSet ? spec.changes : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)), selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)), effects: asArray(spec.effects), annotations, scrollIntoView: !!spec.scrollIntoView }; } function resolveTransaction(state, specs, filter) { let s2 = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length); if (specs.length && specs[0].filter === false) filter = false; for (let i2 = 1; i2 < specs.length; i2++) { if (specs[i2].filter === false) filter = false; let seq = !!specs[i2].sequential; s2 = mergeTransaction(s2, resolveTransactionInner(state, specs[i2], seq ? s2.changes.newLength : state.doc.length), seq); } let tr = Transaction.create(state, s2.changes, s2.selection, s2.effects, s2.annotations, s2.scrollIntoView); return extendTransaction(filter ? filterTransaction(tr) : tr); } function filterTransaction(tr) { let state = tr.startState; let result = true; for (let filter of state.facet(changeFilter)) { let value = filter(tr); if (value === false) { result = false; break; } if (Array.isArray(value)) result = result === true ? value : joinRanges(result, value); } if (result !== true) { let changes, back; if (result === false) { back = tr.changes.invertedDesc; changes = ChangeSet.empty(state.doc.length); } else { let filtered = tr.changes.filter(result); changes = filtered.changes; back = filtered.filtered.mapDesc(filtered.changes).invertedDesc; } tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView); } let filters = state.facet(transactionFilter); for (let i2 = filters.length - 1; i2 >= 0; i2--) { let filtered = filters[i2](tr); if (filtered instanceof Transaction) tr = filtered; else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) tr = filtered[0]; else tr = resolveTransaction(state, asArray(filtered), false); } return tr; } function extendTransaction(tr) { let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr; for (let i2 = extenders.length - 1; i2 >= 0; i2--) { let extension = extenders[i2](tr); if (extension && Object.keys(extension).length) spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true); } return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView); } const none$1 = []; function asArray(value) { return value == null ? none$1 : Array.isArray(value) ? value : [value]; } var CharCategory = /* @__PURE__ */ function(CharCategory2) { CharCategory2[CharCategory2["Word"] = 0] = "Word"; CharCategory2[CharCategory2["Space"] = 1] = "Space"; CharCategory2[CharCategory2["Other"] = 2] = "Other"; return CharCategory2; }(CharCategory || (CharCategory = {})); const nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; let wordChar; try { wordChar = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); } catch (_2) { } function hasWordChar(str) { if (wordChar) return wordChar.test(str); for (let i2 = 0; i2 < str.length; i2++) { let ch = str[i2]; if (/\w/.test(ch) || ch > "€" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))) return true; } return false; } function makeCategorizer(wordChars) { return (char) => { if (!/\S/.test(char)) return CharCategory.Space; if (hasWordChar(char)) return CharCategory.Word; for (let i2 = 0; i2 < wordChars.length; i2++) if (char.indexOf(wordChars[i2]) > -1) return CharCategory.Word; return CharCategory.Other; }; } class EditorState { constructor(config, doc2, selection, values, computeSlot, tr) { this.config = config; this.doc = doc2; this.selection = selection; this.values = values; this.status = config.statusTemplate.slice(); this.computeSlot = computeSlot; if (tr) tr._state = this; for (let i2 = 0; i2 < this.config.dynamicSlots.length; i2++) ensureAddr(this, i2 << 1); this.computeSlot = null; } field(field, require2 = true) { let addr = this.config.address[field.id]; if (addr == null) { if (require2) throw new RangeError("Field is not present in this state"); return void 0; } ensureAddr(this, addr); return getAddr(this, addr); } /** Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec) can be passed. Unless [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec are assumed to start in the _current_ document (not the document produced by previous specs), and its [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer to the document created by its _own_ changes. The resulting transaction contains the combined effect of all the different specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later specs take precedence over earlier ones. */ update(...specs) { return resolveTransaction(this, specs, true); } /** @internal */ applyTransaction(tr) { let conf = this.config, { base: base2, compartments } = conf; for (let effect of tr.effects) { if (effect.is(Compartment.reconfigure)) { if (conf) { compartments = /* @__PURE__ */ new Map(); conf.compartments.forEach((val, key) => compartments.set(key, val)); conf = null; } compartments.set(effect.value.compartment, effect.value.extension); } else if (effect.is(StateEffect.reconfigure)) { conf = null; base2 = effect.value; } else if (effect.is(StateEffect.appendConfig)) { conf = null; base2 = asArray(base2).concat(effect.value); } } let startValues; if (!conf) { conf = Configuration.resolve(base2, compartments, this); let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null); startValues = intermediateState.values; } else { startValues = tr.startState.values.slice(); } new EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr); } /** Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that replaces every selection range with the given content. */ replaceSelection(text) { if (typeof text == "string") text = this.toText(text); return this.changeByRange((range) => ({ changes: { from: range.from, to: range.to, insert: text }, range: EditorSelection.cursor(range.from + text.length) })); } /** Create a set of changes and a new selection by running the given function for each range in the active selection. The function can return an optional set of changes (in the coordinate space of the start document), plus an updated range (in the coordinate space of the document produced by the call's own changes). This method will merge all the changes and ranges into a single changeset and selection, and return it as a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). */ changeByRange(f2) { let sel = this.selection; let result1 = f2(sel.ranges[0]); let changes = this.changes(result1.changes), ranges = [result1.range]; let effects = asArray(result1.effects); for (let i2 = 1; i2 < sel.ranges.length; i2++) { let result = f2(sel.ranges[i2]); let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes); for (let j = 0; j < i2; j++) ranges[j] = ranges[j].map(newMapped); let mapBy = changes.mapDesc(newChanges, true); ranges.push(result.range.map(mapBy)); changes = changes.compose(newMapped); effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy)); } return { changes, selection: EditorSelection.create(ranges, sel.mainIndex), effects }; } /** Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change description, taking the state's document length and line separator into account. */ changes(spec = []) { if (spec instanceof ChangeSet) return spec; return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator)); } /** Using the state's [line separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string. */ toText(string2) { return Text.of(string2.split(this.facet(EditorState.lineSeparator) || DefaultSplit)); } /** Return the given range of the document as a string. */ sliceDoc(from = 0, to = this.doc.length) { return this.doc.sliceString(from, to, this.lineBreak); } /** Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet). */ facet(facet) { let addr = this.config.address[facet.id]; if (addr == null) return facet.default; ensureAddr(this, addr); return getAddr(this, addr); } /** Convert this state to a JSON-serializable object. When custom fields should be serialized, you can pass them in as an object mapping property names (in the resulting object, which should not use `doc` or `selection`) to fields. */ toJSON(fields) { let result = { doc: this.sliceDoc(), selection: this.selection.toJSON() }; if (fields) for (let prop in fields) { let value = fields[prop]; if (value instanceof StateField && this.config.address[value.id] != null) result[prop] = value.spec.toJSON(this.field(fields[prop]), this); } return result; } /** Deserialize a state from its JSON representation. When custom fields should be deserialized, pass the same object you passed to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as third argument. */ static fromJSON(json, config = {}, fields) { if (!json || typeof json.doc != "string") throw new RangeError("Invalid JSON representation for EditorState"); let fieldInit = []; if (fields) for (let prop in fields) { if (Object.prototype.hasOwnProperty.call(json, prop)) { let field = fields[prop], value = json[prop]; fieldInit.push(field.init((state) => field.spec.fromJSON(value, state))); } } return EditorState.create({ doc: json.doc, selection: EditorSelection.fromJSON(json.selection), extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit }); } /** Create a new state. You'll usually only need this when initializing an editor—updated states are created by applying transactions. */ static create(config = {}) { let configuration = Configuration.resolve(config.extensions || [], /* @__PURE__ */ new Map()); let doc2 = config.doc instanceof Text ? config.doc : Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit)); let selection = !config.selection ? EditorSelection.single(0) : config.selection instanceof EditorSelection ? config.selection : EditorSelection.single(config.selection.anchor, config.selection.head); checkSelection(selection, doc2.length); if (!configuration.staticFacet(allowMultipleSelections)) selection = selection.asSingle(); return new EditorState(configuration, doc2, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null); } /** The size (in columns) of a tab in the document, determined by the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. */ get tabSize() { return this.facet(EditorState.tabSize); } /** Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) string for this state. */ get lineBreak() { return this.facet(EditorState.lineSeparator) || "\n"; } /** Returns true when the editor is [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. */ get readOnly() { return this.facet(readOnly$1); } /** Look up a translation for the given phrase (via the [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the original string if no translation is found. If additional arguments are passed, they will be inserted in place of markers like `$1` (for the first value) and `$2`, etc. A single `$` is equivalent to `$1`, and `$$` will produce a literal dollar sign. */ phrase(phrase, ...insert2) { for (let map of this.facet(EditorState.phrases)) if (Object.prototype.hasOwnProperty.call(map, phrase)) { phrase = map[phrase]; break; } if (insert2.length) phrase = phrase.replace(/\$(\$|\d*)/g, (m2, i2) => { if (i2 == "$") return "$"; let n2 = +(i2 || 1); return !n2 || n2 > insert2.length ? m2 : insert2[n2 - 1]; }); return phrase; } /** Find the values for a given language data field, provided by the the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. Examples of language data fields are... - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying comment syntax. - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override) for providing language-specific completion sources. - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding characters that should be considered part of words in this language. - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls bracket closing behavior. */ languageDataAt(name2, pos, side = -1) { let values = []; for (let provider of this.facet(languageData)) { for (let result of provider(this, pos, side)) { if (Object.prototype.hasOwnProperty.call(result, name2)) values.push(result[name2]); } } return values; } /** Return a function that can categorize strings (expected to represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) into one of: - Word (contains an alphanumeric character or a character explicitly listed in the local language's `"wordChars"` language data, which should be a string) - Space (contains only whitespace) - Other (anything else) */ charCategorizer(at) { return makeCategorizer(this.languageDataAt("wordChars", at).join("")); } /** Find the word at the given position, meaning the range containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters around it. If no word characters are adjacent to the position, this returns null. */ wordAt(pos) { let { text, from, length } = this.doc.lineAt(pos); let cat = this.charCategorizer(pos); let start = pos - from, end = pos - from; while (start > 0) { let prev = findClusterBreak(text, start, false); if (cat(text.slice(prev, start)) != CharCategory.Word) break; start = prev; } while (end < length) { let next = findClusterBreak(text, end); if (cat(text.slice(end, next)) != CharCategory.Word) break; end = next; } return start == end ? null : EditorSelection.range(start + from, end + from); } } EditorState.allowMultipleSelections = allowMultipleSelections; EditorState.tabSize = /* @__PURE__ */ Facet.define({ combine: (values) => values.length ? values[0] : 4 }); EditorState.lineSeparator = lineSeparator; EditorState.readOnly = readOnly$1; EditorState.phrases = /* @__PURE__ */ Facet.define({ compare(a2, b2) { let kA = Object.keys(a2), kB = Object.keys(b2); return kA.length == kB.length && kA.every((k) => a2[k] == b2[k]); } }); EditorState.languageData = languageData; EditorState.changeFilter = changeFilter; EditorState.transactionFilter = transactionFilter; EditorState.transactionExtender = transactionExtender; Compartment.reconfigure = /* @__PURE__ */ StateEffect.define(); function combineConfig(configs, defaults, combine = {}) { let result = {}; for (let config of configs) for (let key of Object.keys(config)) { let value = config[key], current = result[key]; if (current === void 0) result[key] = value; else if (current === value || value === void 0) ; else if (Object.hasOwnProperty.call(combine, key)) result[key] = combine[key](current, value); else throw new Error("Config merge conflict for field " + key); } for (let key in defaults) if (result[key] === void 0) result[key] = defaults[key]; return result; } class RangeValue { /** Compare this value with another value. Used when comparing rangesets. The default implementation compares by identity. Unless you are only creating a fixed number of unique instances of your value type, it is a good idea to implement this properly. */ eq(other) { return this == other; } /** Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. */ range(from, to = from) { return Range.create(from, to, this); } } RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0; RangeValue.prototype.point = false; RangeValue.prototype.mapMode = MapMode.TrackDel; class Range { constructor(from, to, value) { this.from = from; this.to = to; this.value = value; } /** @internal */ static create(from, to, value) { return new Range(from, to, value); } } function cmpRange(a2, b2) { return a2.from - b2.from || a2.value.startSide - b2.value.startSide; } class Chunk { constructor(from, to, value, maxPoint) { this.from = from; this.to = to; this.value = value; this.maxPoint = maxPoint; } get length() { return this.to[this.to.length - 1]; } // Find the index of the given position and side. Use the ranges' // `from` pos when `end == false`, `to` when `end == true`. findIndex(pos, side, end, startAt = 0) { let arr = end ? this.to : this.from; for (let lo = startAt, hi = arr.length; ; ) { if (lo == hi) return lo; let mid = lo + hi >> 1; let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side; if (mid == lo) return diff >= 0 ? lo : hi; if (diff >= 0) hi = mid; else lo = mid + 1; } } between(offset, from, to, f2) { for (let i2 = this.findIndex(from, -1e9, true), e2 = this.findIndex(to, 1e9, false, i2); i2 < e2; i2++) if (f2(this.from[i2] + offset, this.to[i2] + offset, this.value[i2]) === false) return false; } map(offset, changes) { let value = [], from = [], to = [], newPos = -1, maxPoint = -1; for (let i2 = 0; i2 < this.value.length; i2++) { let val = this.value[i2], curFrom = this.from[i2] + offset, curTo = this.to[i2] + offset, newFrom, newTo; if (curFrom == curTo) { let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode); if (mapped == null) continue; newFrom = newTo = mapped; if (val.startSide != val.endSide) { newTo = changes.mapPos(curFrom, val.endSide); if (newTo < newFrom) continue; } } else { newFrom = changes.mapPos(curFrom, val.startSide); newTo = changes.mapPos(curTo, val.endSide); if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0) continue; } if ((newTo - newFrom || val.endSide - val.startSide) < 0) continue; if (newPos < 0) newPos = newFrom; if (val.point) maxPoint = Math.max(maxPoint, newTo - newFrom); value.push(val); from.push(newFrom - newPos); to.push(newTo - newPos); } return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos }; } } class RangeSet { constructor(chunkPos, chunk, nextLayer, maxPoint) { this.chunkPos = chunkPos; this.chunk = chunk; this.nextLayer = nextLayer; this.maxPoint = maxPoint; } /** @internal */ static create(chunkPos, chunk, nextLayer, maxPoint) { return new RangeSet(chunkPos, chunk, nextLayer, maxPoint); } /** @internal */ get length() { let last = this.chunk.length - 1; return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length); } /** The number of ranges in the set. */ get size() { if (this.isEmpty) return 0; let size = this.nextLayer.size; for (let chunk of this.chunk) size += chunk.value.length; return size; } /** @internal */ chunkEnd(index2) { return this.chunkPos[index2] + this.chunk[index2].length; } /** Update the range set, optionally adding new ranges or filtering out existing ones. (Note: The type parameter is just there as a kludge to work around TypeScript variance issues that prevented `RangeSet` from being a subtype of `RangeSet` when `X` is a subtype of `Y`.) */ update(updateSpec) { let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec; let filter = updateSpec.filter; if (add.length == 0 && !filter) return this; if (sort) add = add.slice().sort(cmpRange); if (this.isEmpty) return add.length ? RangeSet.of(add) : this; let cur = new LayerCursor(this, null, -1).goto(0), i2 = 0, spill = []; let builder = new RangeSetBuilder(); while (cur.value || i2 < add.length) { if (i2 < add.length && (cur.from - add[i2].from || cur.startSide - add[i2].value.startSide) >= 0) { let range = add[i2++]; if (!builder.addInner(range.from, range.to, range.value)) spill.push(range); } else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length && (i2 == add.length || this.chunkEnd(cur.chunkIndex) < add[i2].from) && (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) && builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) { cur.nextChunk(); } else { if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) { if (!builder.addInner(cur.from, cur.to, cur.value)) spill.push(Range.create(cur.from, cur.to, cur.value)); } cur.next(); } } return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo })); } /** Map this range set through a set of changes, return the new set. */ map(changes) { if (changes.empty || this.isEmpty) return this; let chunks = [], chunkPos = [], maxPoint = -1; for (let i2 = 0; i2 < this.chunk.length; i2++) { let start = this.chunkPos[i2], chunk = this.chunk[i2]; let touch = changes.touchesRange(start, start + chunk.length); if (touch === false) { maxPoint = Math.max(maxPoint, chunk.maxPoint); chunks.push(chunk); chunkPos.push(changes.mapPos(start)); } else if (touch === true) { let { mapped, pos } = chunk.map(start, changes); if (mapped) { maxPoint = Math.max(maxPoint, mapped.maxPoint); chunks.push(mapped); chunkPos.push(pos); } } } let next = this.nextLayer.map(changes); return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint); } /** Iterate over the ranges that touch the region `from` to `to`, calling `f` for each. There is no guarantee that the ranges will be reported in any specific order. When the callback returns `false`, iteration stops. */ between(from, to, f2) { if (this.isEmpty) return; for (let i2 = 0; i2 < this.chunk.length; i2++) { let start = this.chunkPos[i2], chunk = this.chunk[i2]; if (to >= start && from <= start + chunk.length && chunk.between(start, from - start, to - start, f2) === false) return; } this.nextLayer.between(from, to, f2); } /** Iterate over the ranges in this set, in order, including all ranges that end at or after `from`. */ iter(from = 0) { return HeapCursor.from([this]).goto(from); } /** @internal */ get isEmpty() { return this.nextLayer == this; } /** Iterate over the ranges in a collection of sets, in order, starting from `from`. */ static iter(sets, from = 0) { return HeapCursor.from(sets).goto(from); } /** Iterate over two groups of sets, calling methods on `comparator` to notify it of possible differences. */ static compare(oldSets, newSets, textDiff, comparator, minPointSize = -1) { let a2 = oldSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); let b2 = newSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); let sharedChunks = findSharedChunks(a2, b2, textDiff); let sideA = new SpanCursor(a2, sharedChunks, minPointSize); let sideB = new SpanCursor(b2, sharedChunks, minPointSize); textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator)); if (textDiff.empty && textDiff.length == 0) compare(sideA, 0, sideB, 0, 0, comparator); } /** Compare the contents of two groups of range sets, returning true if they are equivalent in the given range. */ static eq(oldSets, newSets, from = 0, to) { if (to == null) to = 1e9 - 1; let a2 = oldSets.filter((set) => !set.isEmpty && newSets.indexOf(set) < 0); let b2 = newSets.filter((set) => !set.isEmpty && oldSets.indexOf(set) < 0); if (a2.length != b2.length) return false; if (!a2.length) return true; let sharedChunks = findSharedChunks(a2, b2); let sideA = new SpanCursor(a2, sharedChunks, 0).goto(from), sideB = new SpanCursor(b2, sharedChunks, 0).goto(from); for (; ; ) { if (sideA.to != sideB.to || !sameValues(sideA.active, sideB.active) || sideA.point && (!sideB.point || !sideA.point.eq(sideB.point))) return false; if (sideA.to > to) return true; sideA.next(); sideB.next(); } } /** Iterate over a group of range sets at the same time, notifying the iterator about the ranges covering every given piece of content. Returns the open count (see [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end of the iteration. */ static spans(sets, from, to, iterator, minPointSize = -1) { let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from; let openRanges = cursor.openStart; for (; ; ) { let curTo = Math.min(cursor.to, to); if (cursor.point) { let active = cursor.activeForPoint(cursor.to); let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges); iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank); openRanges = Math.min(cursor.openEnd(curTo), active.length); } else if (curTo > pos) { iterator.span(pos, curTo, cursor.active, openRanges); openRanges = cursor.openEnd(curTo); } if (cursor.to > to) return openRanges + (cursor.point && cursor.to > to ? 1 : 0); pos = cursor.to; cursor.next(); } } /** Create a range set for the given range or array of ranges. By default, this expects the ranges to be _sorted_ (by start position and, if two start at the same position, `value.startSide`). You can pass `true` as second argument to cause the method to sort them. */ static of(ranges, sort = false) { let build = new RangeSetBuilder(); for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges) build.add(range.from, range.to, range.value); return build.finish(); } } RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1); function lazySort(ranges) { if (ranges.length > 1) for (let prev = ranges[0], i2 = 1; i2 < ranges.length; i2++) { let cur = ranges[i2]; if (cmpRange(prev, cur) > 0) return ranges.slice().sort(cmpRange); prev = cur; } return ranges; } RangeSet.empty.nextLayer = RangeSet.empty; class RangeSetBuilder { finishChunk(newArrays) { this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint)); this.chunkPos.push(this.chunkStart); this.chunkStart = -1; this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint); this.maxPoint = -1; if (newArrays) { this.from = []; this.to = []; this.value = []; } } /** Create an empty builder. */ constructor() { this.chunks = []; this.chunkPos = []; this.chunkStart = -1; this.last = null; this.lastFrom = -1e9; this.lastTo = -1e9; this.from = []; this.to = []; this.value = []; this.maxPoint = -1; this.setMaxPoint = -1; this.nextLayer = null; } /** Add a range. Ranges should be added in sorted (by `from` and `value.startSide`) order. */ add(from, to, value) { if (!this.addInner(from, to, value)) (this.nextLayer || (this.nextLayer = new RangeSetBuilder())).add(from, to, value); } /** @internal */ addInner(from, to, value) { let diff = from - this.lastTo || value.startSide - this.last.endSide; if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0) throw new Error("Ranges must be added sorted by `from` position and `startSide`"); if (diff < 0) return false; if (this.from.length == 250) this.finishChunk(true); if (this.chunkStart < 0) this.chunkStart = from; this.from.push(from - this.chunkStart); this.to.push(to - this.chunkStart); this.last = value; this.lastFrom = from; this.lastTo = to; this.value.push(value); if (value.point) this.maxPoint = Math.max(this.maxPoint, to - from); return true; } /** @internal */ addChunk(from, chunk) { if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0) return false; if (this.from.length) this.finishChunk(true); this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint); this.chunks.push(chunk); this.chunkPos.push(from); let last = chunk.value.length - 1; this.last = chunk.value[last]; this.lastFrom = chunk.from[last] + from; this.lastTo = chunk.to[last] + from; return true; } /** Finish the range set. Returns the new set. The builder can't be used anymore after this has been called. */ finish() { return this.finishInner(RangeSet.empty); } /** @internal */ finishInner(next) { if (this.from.length) this.finishChunk(false); if (this.chunks.length == 0) return next; let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint); this.from = null; return result; } } function findSharedChunks(a2, b2, textDiff) { let inA = /* @__PURE__ */ new Map(); for (let set of a2) for (let i2 = 0; i2 < set.chunk.length; i2++) if (set.chunk[i2].maxPoint <= 0) inA.set(set.chunk[i2], set.chunkPos[i2]); let shared = /* @__PURE__ */ new Set(); for (let set of b2) for (let i2 = 0; i2 < set.chunk.length; i2++) { let known = inA.get(set.chunk[i2]); if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i2] && !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i2].length))) shared.add(set.chunk[i2]); } return shared; } class LayerCursor { constructor(layer2, skip, minPoint, rank = 0) { this.layer = layer2; this.skip = skip; this.minPoint = minPoint; this.rank = rank; } get startSide() { return this.value ? this.value.startSide : 0; } get endSide() { return this.value ? this.value.endSide : 0; } goto(pos, side = -1e9) { this.chunkIndex = this.rangeIndex = 0; this.gotoInner(pos, side, false); return this; } gotoInner(pos, side, forward) { while (this.chunkIndex < this.layer.chunk.length) { let next = this.layer.chunk[this.chunkIndex]; if (!(this.skip && this.skip.has(next) || this.layer.chunkEnd(this.chunkIndex) < pos || next.maxPoint < this.minPoint)) break; this.chunkIndex++; forward = false; } if (this.chunkIndex < this.layer.chunk.length) { let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); if (!forward || this.rangeIndex < rangeIndex) this.setRangeIndex(rangeIndex); } this.next(); } forward(pos, side) { if ((this.to - pos || this.endSide - side) < 0) this.gotoInner(pos, side, true); } next() { for (; ; ) { if (this.chunkIndex == this.layer.chunk.length) { this.from = this.to = 1e9; this.value = null; break; } else { let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex]; let from = chunkPos + chunk.from[this.rangeIndex]; this.from = from; this.to = chunkPos + chunk.to[this.rangeIndex]; this.value = chunk.value[this.rangeIndex]; this.setRangeIndex(this.rangeIndex + 1); if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) break; } } } setRangeIndex(index2) { if (index2 == this.layer.chunk[this.chunkIndex].value.length) { this.chunkIndex++; if (this.skip) { while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) this.chunkIndex++; } this.rangeIndex = 0; } else { this.rangeIndex = index2; } } nextChunk() { this.chunkIndex++; this.rangeIndex = 0; this.next(); } compare(other) { return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || this.to - other.to || this.endSide - other.endSide; } } class HeapCursor { constructor(heap) { this.heap = heap; } static from(sets, skip = null, minPoint = -1) { let heap = []; for (let i2 = 0; i2 < sets.length; i2++) { for (let cur = sets[i2]; !cur.isEmpty; cur = cur.nextLayer) { if (cur.maxPoint >= minPoint) heap.push(new LayerCursor(cur, skip, minPoint, i2)); } } return heap.length == 1 ? heap[0] : new HeapCursor(heap); } get startSide() { return this.value ? this.value.startSide : 0; } goto(pos, side = -1e9) { for (let cur of this.heap) cur.goto(pos, side); for (let i2 = this.heap.length >> 1; i2 >= 0; i2--) heapBubble(this.heap, i2); this.next(); return this; } forward(pos, side) { for (let cur of this.heap) cur.forward(pos, side); for (let i2 = this.heap.length >> 1; i2 >= 0; i2--) heapBubble(this.heap, i2); if ((this.to - pos || this.value.endSide - side) < 0) this.next(); } next() { if (this.heap.length == 0) { this.from = this.to = 1e9; this.value = null; this.rank = -1; } else { let top2 = this.heap[0]; this.from = top2.from; this.to = top2.to; this.value = top2.value; this.rank = top2.rank; if (top2.value) top2.next(); heapBubble(this.heap, 0); } } } function heapBubble(heap, index2) { for (let cur = heap[index2]; ; ) { let childIndex = (index2 << 1) + 1; if (childIndex >= heap.length) break; let child = heap[childIndex]; if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) { child = heap[childIndex + 1]; childIndex++; } if (cur.compare(child) < 0) break; heap[childIndex] = cur; heap[index2] = child; index2 = childIndex; } } class SpanCursor { constructor(sets, skip, minPoint) { this.minPoint = minPoint; this.active = []; this.activeTo = []; this.activeRank = []; this.minActive = -1; this.point = null; this.pointFrom = 0; this.pointRank = 0; this.to = -1e9; this.endSide = 0; this.openStart = -1; this.cursor = HeapCursor.from(sets, skip, minPoint); } goto(pos, side = -1e9) { this.cursor.goto(pos, side); this.active.length = this.activeTo.length = this.activeRank.length = 0; this.minActive = -1; this.to = pos; this.endSide = side; this.openStart = -1; this.next(); return this; } forward(pos, side) { while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0) this.removeActive(this.minActive); this.cursor.forward(pos, side); } removeActive(index2) { remove(this.active, index2); remove(this.activeTo, index2); remove(this.activeRank, index2); this.minActive = findMinIndex(this.active, this.activeTo); } addActive(trackOpen) { let i2 = 0, { value, to, rank } = this.cursor; while (i2 < this.activeRank.length && this.activeRank[i2] <= rank) i2++; insert(this.active, i2, value); insert(this.activeTo, i2, to); insert(this.activeRank, i2, rank); if (trackOpen) insert(trackOpen, i2, this.cursor.from); this.minActive = findMinIndex(this.active, this.activeTo); } // After calling this, if `this.point` != null, the next range is a // point. Otherwise, it's a regular range, covered by `this.active`. next() { let from = this.to, wasPoint = this.point; this.point = null; let trackOpen = this.openStart < 0 ? [] : null; for (; ; ) { let a2 = this.minActive; if (a2 > -1 && (this.activeTo[a2] - this.cursor.from || this.active[a2].endSide - this.cursor.startSide) < 0) { if (this.activeTo[a2] > from) { this.to = this.activeTo[a2]; this.endSide = this.active[a2].endSide; break; } this.removeActive(a2); if (trackOpen) remove(trackOpen, a2); } else if (!this.cursor.value) { this.to = this.endSide = 1e9; break; } else if (this.cursor.from > from) { this.to = this.cursor.from; this.endSide = this.cursor.startSide; break; } else { let nextVal = this.cursor.value; if (!nextVal.point) { this.addActive(trackOpen); this.cursor.next(); } else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) { this.cursor.next(); } else { this.point = nextVal; this.pointFrom = this.cursor.from; this.pointRank = this.cursor.rank; this.to = this.cursor.to; this.endSide = nextVal.endSide; this.cursor.next(); this.forward(this.to, this.endSide); break; } } } if (trackOpen) { this.openStart = 0; for (let i2 = trackOpen.length - 1; i2 >= 0 && trackOpen[i2] < from; i2--) this.openStart++; } } activeForPoint(to) { if (!this.active.length) return this.active; let active = []; for (let i2 = this.active.length - 1; i2 >= 0; i2--) { if (this.activeRank[i2] < this.pointRank) break; if (this.activeTo[i2] > to || this.activeTo[i2] == to && this.active[i2].endSide >= this.point.endSide) active.push(this.active[i2]); } return active.reverse(); } openEnd(to) { let open = 0; for (let i2 = this.activeTo.length - 1; i2 >= 0 && this.activeTo[i2] > to; i2--) open++; return open; } } function compare(a2, startA, b2, startB, length, comparator) { a2.goto(startA); b2.goto(startB); let endB = startB + length; let pos = startB, dPos = startB - startA; for (; ; ) { let diff = a2.to + dPos - b2.to || a2.endSide - b2.endSide; let end = diff < 0 ? a2.to + dPos : b2.to, clipEnd = Math.min(end, endB); if (a2.point || b2.point) { if (!(a2.point && b2.point && (a2.point == b2.point || a2.point.eq(b2.point)) && sameValues(a2.activeForPoint(a2.to), b2.activeForPoint(b2.to)))) comparator.comparePoint(pos, clipEnd, a2.point, b2.point); } else { if (clipEnd > pos && !sameValues(a2.active, b2.active)) comparator.compareRange(pos, clipEnd, a2.active, b2.active); } if (end > endB) break; pos = end; if (diff <= 0) a2.next(); if (diff >= 0) b2.next(); } } function sameValues(a2, b2) { if (a2.length != b2.length) return false; for (let i2 = 0; i2 < a2.length; i2++) if (a2[i2] != b2[i2] && !a2[i2].eq(b2[i2])) return false; return true; } function remove(array, index2) { for (let i2 = index2, e2 = array.length - 1; i2 < e2; i2++) array[i2] = array[i2 + 1]; array.pop(); } function insert(array, index2, value) { for (let i2 = array.length - 1; i2 >= index2; i2--) array[i2 + 1] = array[i2]; array[index2] = value; } function findMinIndex(value, array) { let found = -1, foundPos = 1e9; for (let i2 = 0; i2 < array.length; i2++) if ((array[i2] - foundPos || value[i2].endSide - value[found].endSide) < 0) { found = i2; foundPos = array[i2]; } return found; } function countColumn(string2, tabSize, to = string2.length) { let n2 = 0; for (let i2 = 0; i2 < to; ) { if (string2.charCodeAt(i2) == 9) { n2 += tabSize - n2 % tabSize; i2++; } else { n2++; i2 = findClusterBreak(string2, i2); } } return n2; } function findColumn(string2, col, tabSize, strict) { for (let i2 = 0, n2 = 0; ; ) { if (n2 >= col) return i2; if (i2 == string2.length) break; n2 += string2.charCodeAt(i2) == 9 ? tabSize - n2 % tabSize : 1; i2 = findClusterBreak(string2, i2); } return strict === true ? -1 : string2.length; } const C$1 = "ͼ"; const COUNT = typeof Symbol == "undefined" ? "__" + C$1 : Symbol.for(C$1); const SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"); const top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {}; class StyleModule { // :: (Object', ae = { disc: { elmId: "leader-line-disc", noRotate: true, bBox: { left: -5, top: -5, width: 10, height: 10, right: 5, bottom: 5 }, widthR: 2.5, heightR: 2.5, bCircle: 5, sideLen: 5, backLen: 5, overhead: 0, outlineBase: 1, outlineMax: 4 }, square: { elmId: "leader-line-square", noRotate: true, bBox: { left: -5, top: -5, width: 10, height: 10, right: 5, bottom: 5 }, widthR: 2.5, heightR: 2.5, bCircle: 5, sideLen: 5, backLen: 5, overhead: 0, outlineBase: 1, outlineMax: 4 }, arrow1: { elmId: "leader-line-arrow1", bBox: { left: -8, top: -8, width: 16, height: 16, right: 8, bottom: 8 }, widthR: 4, heightR: 4, bCircle: 8, sideLen: 8, backLen: 8, overhead: 8, outlineBase: 2, outlineMax: 1.5 }, arrow2: { elmId: "leader-line-arrow2", bBox: { left: -7, top: -8, width: 11, height: 16, right: 4, bottom: 8 }, widthR: 2.75, heightR: 4, bCircle: 8, sideLen: 8, backLen: 7, overhead: 4, outlineBase: 1, outlineMax: 1.75 }, arrow3: { elmId: "leader-line-arrow3", bBox: { left: -4, top: -5, width: 12, height: 10, right: 8, bottom: 5 }, widthR: 3, heightR: 2.5, bCircle: 8, sideLen: 5, backLen: 4, overhead: 8, outlineBase: 1, outlineMax: 2.5 }, hand: { elmId: "leader-line-hand", bBox: { left: -3, top: -12, width: 40, height: 24, right: 37, bottom: 12 }, widthR: 10, heightR: 6, bCircle: 37, sideLen: 12, backLen: 3, overhead: 37 }, crosshair: { elmId: "leader-line-crosshair", noRotate: true, bBox: { left: -96, top: -96, width: 192, height: 192, right: 96, bottom: 96 }, widthR: 48, heightR: 48, bCircle: 96, sideLen: 96, backLen: 96, overhead: 0 } }, j = { behind: ne, disc: "disc", square: "square", arrow1: "arrow1", arrow2: "arrow2", arrow3: "arrow3", hand: "hand", crosshair: "crosshair" }, ie2 = { disc: "disc", square: "square", arrow1: "arrow1", arrow2: "arrow2", arrow3: "arrow3", hand: "hand", crosshair: "crosshair" }, H2 = [V2, P2, N, T2], U = "auto", oe = { x: "left", y: "top", width: "width", height: "height" }, Z = 80, Y = 4, X = 5, q = 120, Q = 8, K = 3.75, J = 10, $ = 30, ee = 0.5522847, le = 0.25 * Math.PI, m2 = /^\s*(\-?[\d\.]+)\s*(\%)?\s*$/, re = "http://www.w3.org/2000/svg", S2 = "-ms-scroll-limit" in document.documentElement.style && "-ms-ime-align" in document.documentElement.style && !window.navigator.msPointerEnabled, se = !S2 && !!document.uniqueID, ue = "MozAppearance" in document.documentElement.style, he = !(S2 || ue || !window.chrome || !window.CSS), pe = !S2 && !se && !ue && !he && !window.chrome && "WebkitAppearance" in document.documentElement.style, ce = se || S2 ? 0.2 : 0.1, de = { path: F2, lineColor: "coral", lineSize: 4, plugSE: [ne, "arrow1"], plugSizeSE: [1, 1], lineOutlineEnabled: false, lineOutlineColor: "indianred", lineOutlineSize: 0.25, plugOutlineEnabledSE: [false, false], plugOutlineSizeSE: [1, 1] }, fe = (s2 = {}.toString, u2 = {}.hasOwnProperty.toString, c2 = u2.call(Object), function(e3) { var t3, n3; return e3 && "[object Object]" === s2.call(e3) && (!(t3 = Object.getPrototypeOf(e3)) || (n3 = t3.hasOwnProperty("constructor") && t3.constructor) && "function" == typeof n3 && u2.call(n3) === c2); }), ye = Number.isFinite || function(e3) { return "number" == typeof e3 && window.isFinite(e3); }, g = (x2 = { ease: [0.25, 0.1, 0.25, 1], linear: [0, 0, 1, 1], "ease-in": [0.42, 0, 1, 1], "ease-out": [0, 0, 0.58, 1], "ease-in-out": [0.42, 0, 0.58, 1] }, b2 = 1e3 / 60 / 2, l2 = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(e3) { setTimeout(e3, b2); }, r2 = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || function(e3) { clearTimeout(e3); }, i2 = Number.isFinite || function(e3) { return "number" == typeof e3 && window.isFinite(e3); }, k = [], w2 = 0, { add: function(n3, e3, t3, a3, i3, o3, l3) { var r3, s3, u3, h3, p3, c3, d3, f3, y3, m3, S3, g2, _3, v3 = ++w2; function E3(e4, t4) { return { value: n3(t4), timeRatio: e4, outputRatio: t4 }; } if ("string" == typeof i3 && (i3 = x2[i3]), n3 = n3 || function() { }, t3 < b2) s3 = [E3(0, 0), E3(1, 1)]; else { if (u3 = b2 / t3, s3 = [E3(0, 0)], 0 === i3[0] && 0 === i3[1] && 1 === i3[2] && 1 === i3[3]) for (p3 = u3; p3 <= 1; p3 += u3) s3.push(E3(p3, p3)); else for (c3 = h3 = (p3 = u3) / 10; c3 <= 1; c3 += h3) _3 = g2 = S3 = m3 = y3 = void 0, m3 = (y3 = (f3 = c3) * f3) * f3, _3 = 3 * (S3 = 1 - f3) * y3, p3 <= (d3 = { x: (g2 = S3 * S3 * 3 * f3) * i3[0] + _3 * i3[2] + m3, y: g2 * i3[1] + _3 * i3[3] + m3 }).x && (s3.push(E3(d3.x, d3.y)), p3 += u3); s3.push(E3(1, 1)); } return r3 = { animId: v3, frameCallback: e3, duration: t3, count: a3, frames: s3, reverse: !!o3 }, k.push(r3), false !== l3 && ke(r3, l3), v3; }, remove: function(n3) { var a3; k.some(function(e3, t3) { return e3.animId === n3 && (a3 = t3, !(e3.framesStart = null)); }) && k.splice(a3, 1); }, start: function(t3, n3, a3) { k.some(function(e3) { return e3.animId === t3 && (e3.reverse = !!n3, ke(e3, a3), true); }); }, stop: function(t3, n3) { var a3; return k.some(function(e3) { return e3.animId === t3 && (n3 ? null != e3.lastFrame && (a3 = e3.frames[e3.lastFrame].timeRatio) : (a3 = (Date.now() - e3.framesStart) / e3.duration, e3.reverse && (a3 = 1 - a3), a3 < 0 ? a3 = 0 : 1 < a3 && (a3 = 1)), !(e3.framesStart = null)); }), a3; }, validTiming: function(t3) { return "string" == typeof t3 ? x2[t3] : Array.isArray(t3) && [0, 1, 2, 3].every(function(e3) { return i2(t3[e3]) && 0 <= t3[e3] && t3[e3] <= 1; }) ? [t3[0], t3[1], t3[2], t3[3]] : null; } }), _2 = function(e3) { e3.SVGPathElement.prototype.getPathData && e3.SVGPathElement.prototype.setPathData || function() { function i3(e4) { this._string = e4, this._currentIndex = 0, this._endIndex = this._string.length, this._prevCommand = null, this._skipOptionalSpaces(); } var o3 = { Z: "Z", M: "M", L: "L", C: "C", Q: "Q", A: "A", H: "H", V: "V", S: "S", T: "T", z: "Z", m: "m", l: "l", c: "c", q: "q", a: "a", h: "h", v: "v", s: "s", t: "t" }, l3 = -1 !== e3.navigator.userAgent.indexOf("MSIE "); i3.prototype = { parseSegment: function() { var e4 = this._string[this._currentIndex], t3 = o3[e4] ? o3[e4] : null; if (null === t3) { if (null === this._prevCommand) return null; if (null === (t3 = ("+" === e4 || "-" === e4 || "." === e4 || "0" <= e4 && e4 <= "9") && "Z" !== this._prevCommand ? "M" === this._prevCommand ? "L" : "m" === this._prevCommand ? "l" : this._prevCommand : null)) return null; } else this._currentIndex += 1; var n4 = null, a4 = (this._prevCommand = t3).toUpperCase(); return "H" === a4 || "V" === a4 ? n4 = [this._parseNumber()] : "M" === a4 || "L" === a4 || "T" === a4 ? n4 = [this._parseNumber(), this._parseNumber()] : "S" === a4 || "Q" === a4 ? n4 = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber()] : "C" === a4 ? n4 = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber()] : "A" === a4 ? n4 = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseArcFlag(), this._parseArcFlag(), this._parseNumber(), this._parseNumber()] : "Z" === a4 && (this._skipOptionalSpaces(), n4 = []), null === n4 || 0 <= n4.indexOf(null) ? null : { type: t3, values: n4 }; }, hasMoreData: function() { return this._currentIndex < this._endIndex; }, peekSegmentType: function() { var e4 = this._string[this._currentIndex]; return o3[e4] ? o3[e4] : null; }, initialCommandIsMoveTo: function() { if (!this.hasMoreData()) return true; var e4 = this.peekSegmentType(); return "M" === e4 || "m" === e4; }, _isCurrentSpace: function() { var e4 = this._string[this._currentIndex]; return e4 <= " " && (" " === e4 || "\n" === e4 || " " === e4 || "\r" === e4 || "\f" === e4); }, _skipOptionalSpaces: function() { for (; this._currentIndex < this._endIndex && this._isCurrentSpace(); ) this._currentIndex += 1; return this._currentIndex < this._endIndex; }, _skipOptionalSpacesOrDelimiter: function() { return !(this._currentIndex < this._endIndex && !this._isCurrentSpace() && "," !== this._string[this._currentIndex]) && (this._skipOptionalSpaces() && this._currentIndex < this._endIndex && "," === this._string[this._currentIndex] && (this._currentIndex += 1, this._skipOptionalSpaces()), this._currentIndex < this._endIndex); }, _parseNumber: function() { var e4 = 0, t3 = 0, n4 = 1, a4 = 0, i4 = 1, o4 = 1, l4 = this._currentIndex; if (this._skipOptionalSpaces(), this._currentIndex < this._endIndex && "+" === this._string[this._currentIndex] ? this._currentIndex += 1 : this._currentIndex < this._endIndex && "-" === this._string[this._currentIndex] && (this._currentIndex += 1, i4 = -1), this._currentIndex === this._endIndex || (this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) && "." !== this._string[this._currentIndex]) return null; for (var r4 = this._currentIndex; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9"; ) this._currentIndex += 1; if (this._currentIndex !== r4) for (var s4 = this._currentIndex - 1, u3 = 1; r4 <= s4; ) t3 += u3 * (this._string[s4] - "0"), --s4, u3 *= 10; if (this._currentIndex < this._endIndex && "." === this._string[this._currentIndex]) { if (this._currentIndex += 1, this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) return null; for (; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9"; ) n4 *= 10, a4 += (this._string.charAt(this._currentIndex) - "0") / n4, this._currentIndex += 1; } if (this._currentIndex !== l4 && this._currentIndex + 1 < this._endIndex && ("e" === this._string[this._currentIndex] || "E" === this._string[this._currentIndex]) && "x" !== this._string[this._currentIndex + 1] && "m" !== this._string[this._currentIndex + 1]) { if (this._currentIndex += 1, "+" === this._string[this._currentIndex] ? this._currentIndex += 1 : "-" === this._string[this._currentIndex] && (this._currentIndex += 1, o4 = -1), this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) return null; for (; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9"; ) e4 *= 10, e4 += this._string[this._currentIndex] - "0", this._currentIndex += 1; } var h3 = t3 + a4; return h3 *= i4, e4 && (h3 *= Math.pow(10, o4 * e4)), l4 === this._currentIndex ? null : (this._skipOptionalSpacesOrDelimiter(), h3); }, _parseArcFlag: function() { if (this._currentIndex >= this._endIndex) return null; var e4 = null, t3 = this._string[this._currentIndex]; if (this._currentIndex += 1, "0" === t3) e4 = 0; else { if ("1" !== t3) return null; e4 = 1; } return this._skipOptionalSpacesOrDelimiter(), e4; } }; function a3(e4) { if (!e4 || 0 === e4.length) return []; var t3 = new i3(e4), n4 = []; if (t3.initialCommandIsMoveTo()) for (; t3.hasMoreData(); ) { var a4 = t3.parseSegment(); if (null === a4) break; n4.push(a4); } return n4; } function r3(e4) { return e4.map(function(e5) { return { type: e5.type, values: Array.prototype.slice.call(e5.values) }; }); } function d3(e4) { var m3 = [], S3 = null, g2 = null, _3 = null, v3 = null, E3 = null, x3 = null, b3 = null; return e4.forEach(function(e5) { var t3, n4, a4, i4, o4, l4, r4, s4, u3, h3, p3, c3, d4, f4, y4; "M" === e5.type ? (f4 = e5.values[0], y4 = e5.values[1], m3.push({ type: "M", values: [f4, y4] }), v3 = x3 = f4, E3 = b3 = y4) : "C" === e5.type ? (a4 = e5.values[0], i4 = e5.values[1], t3 = e5.values[2], n4 = e5.values[3], f4 = e5.values[4], y4 = e5.values[5], m3.push({ type: "C", values: [a4, i4, t3, n4, f4, y4] }), g2 = t3, _3 = n4, v3 = f4, E3 = y4) : "L" === e5.type ? (f4 = e5.values[0], y4 = e5.values[1], m3.push({ type: "L", values: [f4, y4] }), v3 = f4, E3 = y4) : "H" === e5.type ? (f4 = e5.values[0], m3.push({ type: "L", values: [f4, E3] }), v3 = f4) : "V" === e5.type ? (y4 = e5.values[0], m3.push({ type: "L", values: [v3, y4] }), E3 = y4) : "S" === e5.type ? (t3 = e5.values[0], n4 = e5.values[1], f4 = e5.values[2], y4 = e5.values[3], l4 = "C" === S3 || "S" === S3 ? (o4 = v3 + (v3 - g2), E3 + (E3 - _3)) : (o4 = v3, E3), m3.push({ type: "C", values: [o4, l4, t3, n4, f4, y4] }), g2 = t3, _3 = n4, v3 = f4, E3 = y4) : "T" === e5.type ? (f4 = e5.values[0], y4 = e5.values[1], i4 = "Q" === S3 || "T" === S3 ? (a4 = v3 + (v3 - g2), E3 + (E3 - _3)) : (a4 = v3, E3), o4 = v3 + 2 * (a4 - v3) / 3, l4 = E3 + 2 * (i4 - E3) / 3, r4 = f4 + 2 * (a4 - f4) / 3, s4 = y4 + 2 * (i4 - y4) / 3, m3.push({ type: "C", values: [o4, l4, r4, s4, f4, y4] }), g2 = a4, _3 = i4, v3 = f4, E3 = y4) : "Q" === e5.type ? (a4 = e5.values[0], i4 = e5.values[1], f4 = e5.values[2], y4 = e5.values[3], o4 = v3 + 2 * (a4 - v3) / 3, l4 = E3 + 2 * (i4 - E3) / 3, r4 = f4 + 2 * (a4 - f4) / 3, s4 = y4 + 2 * (i4 - y4) / 3, m3.push({ type: "C", values: [o4, l4, r4, s4, f4, y4] }), g2 = a4, _3 = i4, v3 = f4, E3 = y4) : "A" === e5.type ? (u3 = e5.values[0], h3 = e5.values[1], p3 = e5.values[2], c3 = e5.values[3], d4 = e5.values[4], f4 = e5.values[5], y4 = e5.values[6], 0 === u3 || 0 === h3 ? (m3.push({ type: "C", values: [v3, E3, f4, y4, f4, y4] }), v3 = f4, E3 = y4) : v3 === f4 && E3 === y4 || U2(v3, E3, f4, y4, u3, h3, p3, c3, d4).forEach(function(e6) { m3.push({ type: "C", values: e6 }), v3 = f4, E3 = y4; })) : "Z" === e5.type && (m3.push(e5), v3 = x3, E3 = b3), S3 = e5.type; }), m3; } var n3 = e3.SVGPathElement.prototype.setAttribute, s3 = e3.SVGPathElement.prototype.removeAttribute, f3 = e3.Symbol ? e3.Symbol() : "__cachedPathData", y3 = e3.Symbol ? e3.Symbol() : "__cachedNormalizedPathData", U2 = function(e4, t3, n4, a4, i4, o4, l4, r4, s4, u3) { function h3(e5, t4, n5) { return { x: e5 * Math.cos(n5) - t4 * Math.sin(n5), y: e5 * Math.sin(n5) + t4 * Math.cos(n5) }; } var p3, c3, d4, f4, y4, m3, S3, g2, _3, v3, E3, x3, b3, k2, w3, O3 = (p3 = l4, Math.PI * p3 / 180), M3 = []; u3 ? (k2 = u3[0], w3 = u3[1], x3 = u3[2], b3 = u3[3]) : (e4 = (c3 = h3(e4, t3, -O3)).x, t3 = c3.y, 1 < (m3 = (f4 = (e4 - (n4 = (d4 = h3(n4, a4, -O3)).x)) / 2) * f4 / (i4 * i4) + (y4 = (t3 - (a4 = d4.y)) / 2) * y4 / (o4 * o4)) && (i4 *= m3 = Math.sqrt(m3), o4 *= m3), _3 = (S3 = i4 * i4) * (g2 = o4 * o4) - S3 * y4 * y4 - g2 * f4 * f4, v3 = S3 * y4 * y4 + g2 * f4 * f4, x3 = (E3 = (r4 === s4 ? -1 : 1) * Math.sqrt(Math.abs(_3 / v3))) * i4 * y4 / o4 + (e4 + n4) / 2, b3 = E3 * -o4 * f4 / i4 + (t3 + a4) / 2, k2 = Math.asin(parseFloat(((t3 - b3) / o4).toFixed(9))), w3 = Math.asin(parseFloat(((a4 - b3) / o4).toFixed(9))), e4 < x3 && (k2 = Math.PI - k2), n4 < x3 && (w3 = Math.PI - w3), k2 < 0 && (k2 = 2 * Math.PI + k2), w3 < 0 && (w3 = 2 * Math.PI + w3), s4 && w3 < k2 && (k2 -= 2 * Math.PI), !s4 && k2 < w3 && (w3 -= 2 * Math.PI)); var I2, C3, L3, A2 = w3 - k2; Math.abs(A2) > 120 * Math.PI / 180 && (I2 = w3, C3 = n4, L3 = a4, w3 = s4 && k2 < w3 ? k2 + 120 * Math.PI / 180 * 1 : k2 + 120 * Math.PI / 180 * -1, n4 = x3 + i4 * Math.cos(w3), a4 = b3 + o4 * Math.sin(w3), M3 = U2(n4, a4, C3, L3, i4, o4, l4, 0, s4, [w3, I2, x3, b3])), A2 = w3 - k2; var V3 = Math.cos(k2), P3 = Math.sin(k2), N2 = Math.cos(w3), T3 = Math.sin(w3), W3 = Math.tan(A2 / 4), B3 = 4 / 3 * i4 * W3, R3 = 4 / 3 * o4 * W3, F3 = [e4, t3], G2 = [e4 + B3 * P3, t3 - R3 * V3], D3 = [n4 + B3 * T3, a4 - R3 * N2], z3 = [n4, a4]; if (G2[0] = 2 * F3[0] - G2[0], G2[1] = 2 * F3[1] - G2[1], u3) return [G2, D3, z3].concat(M3); M3 = [G2, D3, z3].concat(M3).join().split(","); var j2 = [], H3 = []; return M3.forEach(function(e5, t4) { t4 % 2 ? H3.push(h3(M3[t4 - 1], M3[t4], O3).y) : H3.push(h3(M3[t4], M3[t4 + 1], O3).x), 6 === H3.length && (j2.push(H3), H3 = []); }), j2; }; e3.SVGPathElement.prototype.setAttribute = function(e4, t3) { "d" === e4 && (this[f3] = null, this[y3] = null), n3.call(this, e4, t3); }, e3.SVGPathElement.prototype.removeAttribute = function(e4, t3) { "d" === e4 && (this[f3] = null, this[y3] = null), s3.call(this, e4); }, e3.SVGPathElement.prototype.getPathData = function(e4) { if (e4 && e4.normalize) { if (this[y3]) return r3(this[y3]); this[f3] ? n4 = r3(this[f3]) : (n4 = a3(this.getAttribute("d") || ""), this[f3] = r3(n4)); var t3 = d3((s4 = [], c3 = p3 = h3 = u3 = null, n4.forEach(function(e5) { var t4, n5, a4, i4, o4, l4, r4 = e5.type; "M" === r4 ? (o4 = e5.values[0], l4 = e5.values[1], s4.push({ type: "M", values: [o4, l4] }), u3 = p3 = o4, h3 = c3 = l4) : "m" === r4 ? (o4 = u3 + e5.values[0], l4 = h3 + e5.values[1], s4.push({ type: "M", values: [o4, l4] }), u3 = p3 = o4, h3 = c3 = l4) : "L" === r4 ? (o4 = e5.values[0], l4 = e5.values[1], s4.push({ type: "L", values: [o4, l4] }), u3 = o4, h3 = l4) : "l" === r4 ? (o4 = u3 + e5.values[0], l4 = h3 + e5.values[1], s4.push({ type: "L", values: [o4, l4] }), u3 = o4, h3 = l4) : "C" === r4 ? (t4 = e5.values[0], n5 = e5.values[1], a4 = e5.values[2], i4 = e5.values[3], o4 = e5.values[4], l4 = e5.values[5], s4.push({ type: "C", values: [t4, n5, a4, i4, o4, l4] }), u3 = o4, h3 = l4) : "c" === r4 ? (t4 = u3 + e5.values[0], n5 = h3 + e5.values[1], a4 = u3 + e5.values[2], i4 = h3 + e5.values[3], o4 = u3 + e5.values[4], l4 = h3 + e5.values[5], s4.push({ type: "C", values: [t4, n5, a4, i4, o4, l4] }), u3 = o4, h3 = l4) : "Q" === r4 ? (t4 = e5.values[0], n5 = e5.values[1], o4 = e5.values[2], l4 = e5.values[3], s4.push({ type: "Q", values: [t4, n5, o4, l4] }), u3 = o4, h3 = l4) : "q" === r4 ? (t4 = u3 + e5.values[0], n5 = h3 + e5.values[1], o4 = u3 + e5.values[2], l4 = h3 + e5.values[3], s4.push({ type: "Q", values: [t4, n5, o4, l4] }), u3 = o4, h3 = l4) : "A" === r4 ? (o4 = e5.values[5], l4 = e5.values[6], s4.push({ type: "A", values: [e5.values[0], e5.values[1], e5.values[2], e5.values[3], e5.values[4], o4, l4] }), u3 = o4, h3 = l4) : "a" === r4 ? (o4 = u3 + e5.values[5], l4 = h3 + e5.values[6], s4.push({ type: "A", values: [e5.values[0], e5.values[1], e5.values[2], e5.values[3], e5.values[4], o4, l4] }), u3 = o4, h3 = l4) : "H" === r4 ? (o4 = e5.values[0], s4.push({ type: "H", values: [o4] }), u3 = o4) : "h" === r4 ? (o4 = u3 + e5.values[0], s4.push({ type: "H", values: [o4] }), u3 = o4) : "V" === r4 ? (l4 = e5.values[0], s4.push({ type: "V", values: [l4] }), h3 = l4) : "v" === r4 ? (l4 = h3 + e5.values[0], s4.push({ type: "V", values: [l4] }), h3 = l4) : "S" === r4 ? (a4 = e5.values[0], i4 = e5.values[1], o4 = e5.values[2], l4 = e5.values[3], s4.push({ type: "S", values: [a4, i4, o4, l4] }), u3 = o4, h3 = l4) : "s" === r4 ? (a4 = u3 + e5.values[0], i4 = h3 + e5.values[1], o4 = u3 + e5.values[2], l4 = h3 + e5.values[3], s4.push({ type: "S", values: [a4, i4, o4, l4] }), u3 = o4, h3 = l4) : "T" === r4 ? (o4 = e5.values[0], l4 = e5.values[1], s4.push({ type: "T", values: [o4, l4] }), u3 = o4, h3 = l4) : "t" === r4 ? (o4 = u3 + e5.values[0], l4 = h3 + e5.values[1], s4.push({ type: "T", values: [o4, l4] }), u3 = o4, h3 = l4) : "Z" !== r4 && "z" !== r4 || (s4.push({ type: "Z", values: [] }), u3 = p3, h3 = c3); }), s4)); return this[y3] = r3(t3), t3; } if (this[f3]) return r3(this[f3]); var s4, u3, h3, p3, c3, n4 = a3(this.getAttribute("d") || ""); return this[f3] = r3(n4), n4; }, e3.SVGPathElement.prototype.setPathData = function(e4) { if (0 === e4.length) l3 ? this.setAttribute("d", "") : this.removeAttribute("d"); else { for (var t3 = "", n4 = 0, a4 = e4.length; n4 < a4; n4 += 1) { var i4 = e4[n4]; 0 < n4 && (t3 += " "), t3 += i4.type, i4.values && 0 < i4.values.length && (t3 += " " + i4.values.join(" ")); } this.setAttribute("d", t3); } }, e3.SVGRectElement.prototype.getPathData = function(e4) { var t3 = this.x.baseVal.value, n4 = this.y.baseVal.value, a4 = this.width.baseVal.value, i4 = this.height.baseVal.value, o4 = this.hasAttribute("rx") ? this.rx.baseVal.value : this.ry.baseVal.value, l4 = this.hasAttribute("ry") ? this.ry.baseVal.value : this.rx.baseVal.value; a4 / 2 < o4 && (o4 = a4 / 2), i4 / 2 < l4 && (l4 = i4 / 2); var r4 = (r4 = [{ type: "M", values: [t3 + o4, n4] }, { type: "H", values: [t3 + a4 - o4] }, { type: "A", values: [o4, l4, 0, 0, 1, t3 + a4, n4 + l4] }, { type: "V", values: [n4 + i4 - l4] }, { type: "A", values: [o4, l4, 0, 0, 1, t3 + a4 - o4, n4 + i4] }, { type: "H", values: [t3 + o4] }, { type: "A", values: [o4, l4, 0, 0, 1, t3, n4 + i4 - l4] }, { type: "V", values: [n4 + l4] }, { type: "A", values: [o4, l4, 0, 0, 1, t3 + o4, n4] }, { type: "Z", values: [] }]).filter(function(e5) { return "A" !== e5.type || 0 !== e5.values[0] && 0 !== e5.values[1]; }); return e4 && true === e4.normalize && (r4 = d3(r4)), r4; }, e3.SVGCircleElement.prototype.getPathData = function(e4) { var t3 = this.cx.baseVal.value, n4 = this.cy.baseVal.value, a4 = this.r.baseVal.value, i4 = [{ type: "M", values: [t3 + a4, n4] }, { type: "A", values: [a4, a4, 0, 0, 1, t3, n4 + a4] }, { type: "A", values: [a4, a4, 0, 0, 1, t3 - a4, n4] }, { type: "A", values: [a4, a4, 0, 0, 1, t3, n4 - a4] }, { type: "A", values: [a4, a4, 0, 0, 1, t3 + a4, n4] }, { type: "Z", values: [] }]; return e4 && true === e4.normalize && (i4 = d3(i4)), i4; }, e3.SVGEllipseElement.prototype.getPathData = function(e4) { var t3 = this.cx.baseVal.value, n4 = this.cy.baseVal.value, a4 = this.rx.baseVal.value, i4 = this.ry.baseVal.value, o4 = [{ type: "M", values: [t3 + a4, n4] }, { type: "A", values: [a4, i4, 0, 0, 1, t3, n4 + i4] }, { type: "A", values: [a4, i4, 0, 0, 1, t3 - a4, n4] }, { type: "A", values: [a4, i4, 0, 0, 1, t3, n4 - i4] }, { type: "A", values: [a4, i4, 0, 0, 1, t3 + a4, n4] }, { type: "Z", values: [] }]; return e4 && true === e4.normalize && (o4 = d3(o4)), o4; }, e3.SVGLineElement.prototype.getPathData = function() { return [{ type: "M", values: [this.x1.baseVal.value, this.y1.baseVal.value] }, { type: "L", values: [this.x2.baseVal.value, this.y2.baseVal.value] }]; }, e3.SVGPolylineElement.prototype.getPathData = function() { for (var e4 = [], t3 = 0; t3 < this.points.numberOfItems; t3 += 1) { var n4 = this.points.getItem(t3); e4.push({ type: 0 === t3 ? "M" : "L", values: [n4.x, n4.y] }); } return e4; }, e3.SVGPolygonElement.prototype.getPathData = function() { for (var e4 = [], t3 = 0; t3 < this.points.numberOfItems; t3 += 1) { var n4 = this.points.getItem(t3); e4.push({ type: 0 === t3 ? "M" : "L", values: [n4.x, n4.y] }); } return e4.push({ type: "Z", values: [] }), e4; }; }(); }, v2 = (a2 = {}, xe.m = n2 = [function(e3, t3, n3) { n3.r(t3); var a3 = 500, i3 = [], o3 = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(e4) { return setTimeout(e4, 1e3 / 60); }, l3 = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || function(e4) { return clearTimeout(e4); }, r3 = Date.now(), s3 = void 0; function u3() { var n4 = void 0, e4 = void 0; s3 && (l3.call(window, s3), s3 = null), i3.forEach(function(e5) { var t4; (t4 = e5.event) && (e5.event = null, e5.listener(t4), n4 = true); }), n4 ? (r3 = Date.now(), e4 = true) : Date.now() - r3 < a3 && (e4 = true), e4 && (s3 = o3.call(window, u3)); } function h3(n4) { var a4 = -1; return i3.some(function(e4, t4) { return e4.listener === n4 && (a4 = t4, true); }), a4; } var p3 = { add: function(e4) { var t4 = void 0; return -1 === h3(e4) ? (i3.push(t4 = { listener: e4 }), function(e5) { t4.event = e5, s3 || u3(); }) : null; }, remove: function(e4) { var t4; -1 < (t4 = h3(e4)) && (i3.splice(t4, 1), !i3.length && s3 && (l3.call(window, s3), s3 = null)); } }; t3.default = p3; }], xe.c = a2, xe.d = function(e3, t3, n3) { xe.o(e3, t3) || Object.defineProperty(e3, t3, { enumerable: true, get: n3 }); }, xe.r = function(e3) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e3, "__esModule", { value: true }); }, xe.t = function(t3, e3) { if (1 & e3 && (t3 = xe(t3)), 8 & e3) return t3; if (4 & e3 && "object" == typeof t3 && t3 && t3.__esModule) return t3; var n3 = /* @__PURE__ */ Object.create(null); if (xe.r(n3), Object.defineProperty(n3, "default", { enumerable: true, value: t3 }), 2 & e3 && "string" != typeof t3) for (var a3 in t3) xe.d(n3, a3, (function(e4) { return t3[e4]; }).bind(null, a3)); return n3; }, xe.n = function(e3) { var t3 = e3 && e3.__esModule ? function() { return e3.default; } : function() { return e3; }; return xe.d(t3, "a", t3), t3; }, xe.o = function(e3, t3) { return Object.prototype.hasOwnProperty.call(e3, t3); }, xe.p = "", xe(xe.s = 0).default), me = { line_altColor: { iniValue: false }, line_color: {}, line_colorTra: { iniValue: false }, line_strokeWidth: {}, plug_enabled: { iniValue: false }, plug_enabledSE: { hasSE: true, iniValue: false }, plug_plugSE: { hasSE: true, iniValue: ne }, plug_colorSE: { hasSE: true }, plug_colorTraSE: { hasSE: true, iniValue: false }, plug_markerWidthSE: { hasSE: true }, plug_markerHeightSE: { hasSE: true }, lineOutline_enabled: { iniValue: false }, lineOutline_color: {}, lineOutline_colorTra: { iniValue: false }, lineOutline_strokeWidth: {}, lineOutline_inStrokeWidth: {}, plugOutline_enabledSE: { hasSE: true, iniValue: false }, plugOutline_plugSE: { hasSE: true, iniValue: ne }, plugOutline_colorSE: { hasSE: true }, plugOutline_colorTraSE: { hasSE: true, iniValue: false }, plugOutline_strokeWidthSE: { hasSE: true }, plugOutline_inStrokeWidthSE: { hasSE: true }, position_socketXYSE: { hasSE: true, hasProps: true }, position_plugOverheadSE: { hasSE: true }, position_path: {}, position_lineStrokeWidth: {}, position_socketGravitySE: { hasSE: true }, path_pathData: {}, path_edge: { hasProps: true }, viewBox_bBox: { hasProps: true }, viewBox_plugBCircleSE: { hasSE: true }, lineMask_enabled: { iniValue: false }, lineMask_outlineMode: { iniValue: false }, lineMask_x: {}, lineMask_y: {}, lineOutlineMask_x: {}, lineOutlineMask_y: {}, maskBGRect_x: {}, maskBGRect_y: {}, capsMaskAnchor_enabledSE: { hasSE: true, iniValue: false }, capsMaskAnchor_pathDataSE: { hasSE: true }, capsMaskAnchor_strokeWidthSE: { hasSE: true }, capsMaskMarker_enabled: { iniValue: false }, capsMaskMarker_enabledSE: { hasSE: true, iniValue: false }, capsMaskMarker_plugSE: { hasSE: true, iniValue: ne }, capsMaskMarker_markerWidthSE: { hasSE: true }, capsMaskMarker_markerHeightSE: { hasSE: true }, caps_enabled: { iniValue: false }, attach_plugSideLenSE: { hasSE: true }, attach_plugBackLenSE: { hasSE: true } }, E2 = { show_on: {}, show_effect: {}, show_animOptions: {}, show_animId: {}, show_inAnim: {} }, O2 = "fade", Se = [], ge = {}, _e2 = 0, ve = {}, Ee = 0; function xe(e3) { if (a2[e3]) return a2[e3].exports; var t3 = a2[e3] = { i: e3, l: false, exports: {} }; return n2[e3].call(t3.exports, t3, t3.exports, xe), t3.l = true, t3.exports; } function be() { var i3 = Date.now(), o3 = false; e2 && (r2.call(window, e2), e2 = null), k.forEach(function(e3) { var t3, n3, a3; if (e3.framesStart) { if ((t3 = i3 - e3.framesStart) >= e3.duration && e3.count && e3.loopsLeft <= 1) return a3 = e3.frames[e3.lastFrame = e3.reverse ? 0 : e3.frames.length - 1], e3.frameCallback(a3.value, true, a3.timeRatio, a3.outputRatio), void (e3.framesStart = null); if (t3 > e3.duration) { if (n3 = Math.floor(t3 / e3.duration), e3.count) { if (n3 >= e3.loopsLeft) return a3 = e3.frames[e3.lastFrame = e3.reverse ? 0 : e3.frames.length - 1], e3.frameCallback(a3.value, true, a3.timeRatio, a3.outputRatio), void (e3.framesStart = null); e3.loopsLeft -= n3; } e3.framesStart += e3.duration * n3, t3 = i3 - e3.framesStart; } e3.reverse && (t3 = e3.duration - t3), a3 = e3.frames[e3.lastFrame = Math.round(t3 / b2)], false !== e3.frameCallback(a3.value, false, a3.timeRatio, a3.outputRatio) ? o3 = true : e3.framesStart = null; } }), o3 && (e2 = l2.call(window, be)); } function ke(e3, t3) { e3.framesStart = Date.now(), null != t3 && (e3.framesStart -= e3.duration * (e3.reverse ? 1 - t3 : t3)), e3.loopsLeft = e3.count, e3.lastFrame = null, be(); } function we(t3, n3) { var e3, a3; return typeof t3 != typeof n3 || (e3 = fe(t3) ? "obj" : Array.isArray(t3) ? "array" : "") != (fe(n3) ? "obj" : Array.isArray(n3) ? "array" : "") || ("obj" === e3 ? we(a3 = Object.keys(t3).sort(), Object.keys(n3).sort()) || a3.some(function(e4) { return we(t3[e4], n3[e4]); }) : "array" === e3 ? t3.length !== n3.length || t3.some(function(e4, t4) { return we(e4, n3[t4]); }) : t3 !== n3); } function Oe(n3) { return n3 ? fe(n3) ? Object.keys(n3).reduce(function(e3, t3) { return e3[t3] = Oe(n3[t3]), e3; }, {}) : Array.isArray(n3) ? n3.map(Oe) : n3 : n3; } function Me(e3) { var t3, n3, a3, i3 = 1, o3 = e3 = (e3 + "").trim(); function l3(e4) { var t4 = 1, n4 = m2.exec(e4); return n4 && (t4 = parseFloat(n4[1]), n4[2] ? t4 = 0 <= t4 && t4 <= 100 ? t4 / 100 : 1 : (t4 < 0 || 1 < t4) && (t4 = 1)), t4; } return (t3 = /^(rgba|hsla|hwb|gray|device\-cmyk)\s*\(([\s\S]+)\)$/i.exec(e3)) ? (n3 = t3[1].toLowerCase(), a3 = t3[2].trim().split(/\s*,\s*/), "rgba" === n3 && 4 === a3.length ? (i3 = l3(a3[3]), o3 = "rgb(" + a3.slice(0, 3).join(", ") + ")") : "hsla" === n3 && 4 === a3.length ? (i3 = l3(a3[3]), o3 = "hsl(" + a3.slice(0, 3).join(", ") + ")") : "hwb" === n3 && 4 === a3.length ? (i3 = l3(a3[3]), o3 = "hwb(" + a3.slice(0, 3).join(", ") + ")") : "gray" === n3 && 2 === a3.length ? (i3 = l3(a3[1]), o3 = "gray(" + a3[0] + ")") : "device-cmyk" === n3 && 5 <= a3.length && (i3 = l3(a3[4]), o3 = "device-cmyk(" + a3.slice(0, 4).join(", ") + ")")) : (t3 = /^\#(?:([\da-f]{6})([\da-f]{2})|([\da-f]{3})([\da-f]))$/i.exec(e3)) ? o3 = t3[1] ? (i3 = parseInt(t3[2], 16) / 255, "#" + t3[1]) : (i3 = parseInt(t3[4] + t3[4], 16) / 255, "#" + t3[3]) : "transparent" === e3.toLocaleLowerCase() && (i3 = 0), [i3, o3]; } function Ie(e3) { return !(!e3 || e3.nodeType !== Node.ELEMENT_NODE || "function" != typeof e3.getBoundingClientRect); } function Ce(e3, t3) { var n3, a3, i3, o3, l3 = {}; if (!(i3 = e3.ownerDocument)) return console.error("Cannot get document that contains the element."), null; if (e3.compareDocumentPosition(i3) & Node.DOCUMENT_POSITION_DISCONNECTED) return console.error("A disconnected element was passed."), null; for (a3 in n3 = e3.getBoundingClientRect()) l3[a3] = n3[a3]; if (!t3) { if (!(o3 = i3.defaultView)) return console.error("Cannot get window that contains the element."), null; l3.left += o3.pageXOffset, l3.right += o3.pageXOffset, l3.top += o3.pageYOffset, l3.bottom += o3.pageYOffset; } return l3; } function Le(e3, t3) { var n3, a3, i3 = [], o3 = e3; for (t3 = t3 || window; ; ) { if (!(n3 = o3.ownerDocument)) return console.error("Cannot get document that contains the element."), null; if (!(a3 = n3.defaultView)) return console.error("Cannot get window that contains the element."), null; if (a3 === t3) break; if (!(o3 = a3.frameElement)) return console.error("`baseWindow` was not found."), null; i3.unshift(o3); } return i3; } function Ae(e3, t3) { var n3, a3, o3 = 0, l3 = 0; return (a3 = Le(e3, t3 = t3 || window)) ? a3.length ? (a3.forEach(function(e4, t4) { var n4, a4, i3 = Ce(e4, 0 < t4); o3 += i3.left, l3 += i3.top, a4 = (n4 = e4).ownerDocument.defaultView.getComputedStyle(n4, ""), i3 = { left: n4.clientLeft + parseFloat(a4.paddingLeft), top: n4.clientTop + parseFloat(a4.paddingTop) }, o3 += i3.left, l3 += i3.top; }), (n3 = Ce(e3, true)).left += o3, n3.right += o3, n3.top += l3, n3.bottom += l3, n3) : Ce(e3) : null; } function Ve(e3, t3) { var n3 = e3.x - t3.x, a3 = e3.y - t3.y; return Math.sqrt(n3 * n3 + a3 * a3); } function Pe(e3, t3, n3) { var a3 = t3.x - e3.x, i3 = t3.y - e3.y; return { x: e3.x + a3 * n3, y: e3.y + i3 * n3, angle: Math.atan2(i3, a3) / (Math.PI / 180) }; } function Ne(e3, t3, n3) { var a3 = Math.atan2(e3.y - t3.y, t3.x - e3.x); return { x: t3.x + Math.cos(a3) * n3, y: t3.y + Math.sin(a3) * n3 * -1 }; } function Te(e3, t3, n3, a3, i3) { var o3 = i3 * i3, l3 = o3 * i3, r3 = 1 - i3, s3 = r3 * r3, u3 = s3 * r3, h3 = u3 * e3.x + 3 * s3 * i3 * t3.x + 3 * r3 * o3 * n3.x + l3 * a3.x, p3 = u3 * e3.y + 3 * s3 * i3 * t3.y + 3 * r3 * o3 * n3.y + l3 * a3.y, c3 = e3.x + 2 * i3 * (t3.x - e3.x) + o3 * (n3.x - 2 * t3.x + e3.x), d3 = e3.y + 2 * i3 * (t3.y - e3.y) + o3 * (n3.y - 2 * t3.y + e3.y), f3 = t3.x + 2 * i3 * (n3.x - t3.x) + o3 * (a3.x - 2 * n3.x + t3.x), y3 = t3.y + 2 * i3 * (n3.y - t3.y) + o3 * (a3.y - 2 * n3.y + t3.y), m3 = r3 * e3.x + i3 * t3.x, S3 = r3 * e3.y + i3 * t3.y, g2 = r3 * n3.x + i3 * a3.x, _3 = r3 * n3.y + i3 * a3.y, v3 = 90 - 180 * Math.atan2(c3 - f3, d3 - y3) / Math.PI; return { x: h3, y: p3, fromP2: { x: c3, y: d3 }, toP1: { x: f3, y: y3 }, fromP1: { x: m3, y: S3 }, toP2: { x: g2, y: _3 }, angle: v3 += 180 < v3 ? -180 : 180 }; } function We(n3, a3, i3, o3, e3) { function l3(e4, t3, n4, a4, i4) { return e4 * (e4 * (-3 * t3 + 9 * n4 - 9 * a4 + 3 * i4) + 6 * t3 - 12 * n4 + 6 * a4) - 3 * t3 + 3 * n4; } var r3, s3, u3, h3, p3 = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472], c3 = 0, d3 = (e3 = null == e3 || 1 < e3 ? 1 : e3 < 0 ? 0 : e3) / 2; return [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816].forEach(function(e4, t3) { s3 = l3(r3 = d3 * e4 + d3, n3.x, a3.x, i3.x, o3.x), u3 = l3(r3, n3.y, a3.y, i3.y, o3.y), h3 = s3 * s3 + u3 * u3, c3 += p3[t3] * Math.sqrt(h3); }), d3 * c3; } function Be(e3, t3, n3, a3, i3) { for (var o3, l3 = 0.5, r3 = 1 - l3; o3 = We(e3, t3, n3, a3, r3), !(Math.abs(o3 - i3) <= 0.01); ) r3 += (o3 < i3 ? 1 : -1) * (l3 /= 2); return r3; } function Re(e3, n3) { var a3; return e3.forEach(function(e4) { var t3 = n3 ? e4.map(function(e5) { var t4 = { x: e5.x, y: e5.y }; return n3(t4), t4; }) : e4; (a3 = a3 || [{ type: "M", values: [t3[0].x, t3[0].y] }]).push(t3.length ? 2 === t3.length ? { type: "L", values: [t3[1].x, t3[1].y] } : { type: "C", values: [t3[1].x, t3[1].y, t3[2].x, t3[2].y, t3[3].x, t3[3].y] } : { type: "Z", values: [] }); }), a3; } function Fe(e3) { var n3 = [], a3 = 0; return e3.forEach(function(e4) { var t3 = (2 === e4.length ? Ve : We).apply(null, e4); n3.push(t3), a3 += t3; }), { segsLen: n3, lenAll: a3 }; } function Ge(e3, a3) { return null == e3 || null == a3 || e3.length !== a3.length || e3.some(function(e4, t3) { var n3 = a3[t3]; return e4.type !== n3.type || e4.values.some(function(e5, t4) { return e5 !== n3.values[t4]; }); }); } function De(e3, t3, n3) { e3.events[t3] ? e3.events[t3].indexOf(n3) < 0 && e3.events[t3].push(n3) : e3.events[t3] = [n3]; } function ze(e3, t3, n3) { var a3; e3.events[t3] && -1 < (a3 = e3.events[t3].indexOf(n3)) && e3.events[t3].splice(a3, 1); } function je(e3) { t2 && clearTimeout(t2), Se.push(e3), t2 = setTimeout(function() { Se.forEach(function(e4) { e4(); }), Se = []; }, 0); } function He(e3, t3) { e3.reflowTargets.indexOf(t3) < 0 && e3.reflowTargets.push(t3); } function Ue(e3) { e3.reflowTargets.forEach(function(e4) { var n3; n3 = e4, setTimeout(function() { var e5 = n3.parentNode, t3 = n3.nextSibling; e5.insertBefore(e5.removeChild(n3), t3); }, 0); }), e3.reflowTargets = []; } function Ze(e3, t3, n3, a3, i3, o3, l3) { var r3, s3, u3; "auto-start-reverse" === n3 ? ("boolean" != typeof h2 && (t3.setAttribute("orient", "auto-start-reverse"), h2 = t3.orientType.baseVal === SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN), h2 ? t3.setAttribute("orient", n3) : ((r3 = i3.createSVGTransform()).setRotate(180, 0, 0), o3.transform.baseVal.appendItem(r3), t3.setAttribute("orient", "auto"), u3 = true)) : (t3.setAttribute("orient", n3), false === h2 && o3.transform.baseVal.clear()), s3 = t3.viewBox.baseVal, u3 ? (s3.x = -a3.right, s3.y = -a3.bottom) : (s3.x = a3.left, s3.y = a3.top), s3.width = a3.width, s3.height = a3.height, se && He(e3, l3); } function Ye(e3, t3) { return { prop: e3 ? "markerEnd" : "markerStart", orient: t3 ? t3.noRotate ? "0" : e3 ? "auto" : "auto-start-reverse" : null }; } function Xe(n3, a3) { Object.keys(a3).forEach(function(e3) { var t3 = a3[e3]; n3[e3] = null != t3.iniValue ? t3.hasSE ? [t3.iniValue, t3.iniValue] : t3.iniValue : t3.hasSE ? t3.hasProps ? [{}, {}] : [] : t3.hasProps ? {} : null; }); } function qe(t3, e3, n3, a3, i3) { return a3 !== e3[n3] && (e3[n3] = a3, i3 && i3.forEach(function(e4) { e4(t3, a3, n3); }), true); } function Qe(e3) { function t3(e4, t4) { return e4 + parseFloat(t4); } var n3 = e3.document, a3 = e3.getComputedStyle(n3.documentElement, ""), i3 = e3.getComputedStyle(n3.body, ""), o3 = { x: 0, y: 0 }; return "static" !== i3.position ? (o3.x -= [a3.marginLeft, a3.borderLeftWidth, a3.paddingLeft, i3.marginLeft, i3.borderLeftWidth].reduce(t3, 0), o3.y -= [a3.marginTop, a3.borderTopWidth, a3.paddingTop, i3.marginTop, i3.borderTopWidth].reduce(t3, 0)) : "static" !== a3.position && (o3.x -= [a3.marginLeft, a3.borderLeftWidth].reduce(t3, 0), o3.y -= [a3.marginTop, a3.borderTopWidth].reduce(t3, 0)), o3; } function Ke(e3) { var t3, n3 = e3.document; n3.getElementById(d2) || (t3 = new e3.DOMParser().parseFromString(y2, "image/svg+xml"), n3.body.appendChild(t3.documentElement), _2(e3)); } function Je(u3) { var _3, f3, v3, e3, n3, a3, i3, y3, s3, h3, p3, t3, o3, l3, r3, c3, d3, m3, S3, g2 = u3.options, E3 = u3.curStats, x3 = u3.aplStats, b3 = E3.position_socketXYSE, k2 = false; function w3(e4, t4) { var n4 = t4 === V2 ? { x: e4.left + e4.width / 2, y: e4.top } : t4 === P2 ? { x: e4.right, y: e4.top + e4.height / 2 } : t4 === N ? { x: e4.left + e4.width / 2, y: e4.bottom } : { x: e4.left, y: e4.top + e4.height / 2 }; return n4.socketId = t4, n4; } function O3(e4) { return { x: e4.x, y: e4.y }; } if (E3.position_path = g2.path, E3.position_lineStrokeWidth = E3.line_strokeWidth, E3.position_socketGravitySE = _3 = Oe(g2.socketGravitySE), f3 = [0, 1].map(function(e4) { var t4, n4, a4, i4 = g2.anchorSE[e4], o4 = u3.optionIsAttach.anchorSE[e4], l4 = false !== o4 ? ve[i4._id] : null, r4 = false !== o4 && l4.conf.getStrokeWidth ? l4.conf.getStrokeWidth(l4, u3) : 0, s4 = false !== o4 && l4.conf.getBBoxNest ? l4.conf.getBBoxNest(l4, u3, r4) : Ae(i4, u3.baseWindow); return E3.capsMaskAnchor_pathDataSE[e4] = false !== o4 && l4.conf.getPathData ? l4.conf.getPathData(l4, u3, r4) : (n4 = null != (t4 = s4).right ? t4.right : t4.left + t4.width, a4 = null != t4.bottom ? t4.bottom : t4.top + t4.height, [{ type: "M", values: [t4.left, t4.top] }, { type: "L", values: [n4, t4.top] }, { type: "L", values: [n4, a4] }, { type: "L", values: [t4.left, a4] }, { type: "Z", values: [] }]), E3.capsMaskAnchor_strokeWidthSE[e4] = r4, s4; }), i3 = -1, g2.socketSE[0] && g2.socketSE[1] ? (b3[0] = w3(f3[0], g2.socketSE[0]), b3[1] = w3(f3[1], g2.socketSE[1])) : (g2.socketSE[0] || g2.socketSE[1] ? (a3 = g2.socketSE[0] ? (n3 = 0, 1) : (n3 = 1, 0), b3[n3] = w3(f3[n3], g2.socketSE[n3]), (e3 = H2.map(function(e4) { return w3(f3[a3], e4); })).forEach(function(e4) { var t4 = Ve(e4, b3[n3]); (t4 < i3 || -1 === i3) && (b3[a3] = e4, i3 = t4); })) : (e3 = H2.map(function(e4) { return w3(f3[1], e4); }), H2.map(function(e4) { return w3(f3[0], e4); }).forEach(function(n4) { e3.forEach(function(e4) { var t4 = Ve(n4, e4); (t4 < i3 || -1 === i3) && (b3[0] = n4, b3[1] = e4, i3 = t4); }); })), [0, 1].forEach(function(e4) { var t4, n4; g2.socketSE[e4] || (f3[e4].width || f3[e4].height ? f3[e4].width || b3[e4].socketId !== T2 && b3[e4].socketId !== P2 ? f3[e4].height || b3[e4].socketId !== V2 && b3[e4].socketId !== N || (b3[e4].socketId = 0 <= b3[e4 ? 0 : 1].y - f3[e4].top ? N : V2) : b3[e4].socketId = 0 <= b3[e4 ? 0 : 1].x - f3[e4].left ? P2 : T2 : (t4 = b3[e4 ? 0 : 1].x - f3[e4].left, n4 = b3[e4 ? 0 : 1].y - f3[e4].top, b3[e4].socketId = Math.abs(t4) >= Math.abs(n4) ? 0 <= t4 ? P2 : T2 : 0 <= n4 ? N : V2)); })), E3.position_path !== x3.position_path || E3.position_lineStrokeWidth !== x3.position_lineStrokeWidth || [0, 1].some(function(e4) { return E3.position_plugOverheadSE[e4] !== x3.position_plugOverheadSE[e4] || (i4 = b3[e4], o4 = x3.position_socketXYSE[e4], i4.x !== o4.x || i4.y !== o4.y || i4.socketId !== o4.socketId) || (t4 = _3[e4], n4 = x3.position_socketGravitySE[e4], (a4 = null == t4 ? "auto" : Array.isArray(t4) ? "array" : "number") != (null == n4 ? "auto" : Array.isArray(n4) ? "array" : "number") || ("array" == a4 ? t4[0] !== n4[0] || t4[1] !== n4[1] : t4 !== n4)); var t4, n4, a4, i4, o4; })) { switch (u3.pathList.baseVal = v3 = [], u3.pathList.animVal = null, E3.position_path) { case B2: v3.push([O3(b3[0]), O3(b3[1])]); break; case R2: t3 = "number" == typeof _3[0] && 0 < _3[0] || "number" == typeof _3[1] && 0 < _3[1], o3 = le * (t3 ? -1 : 1), l3 = Math.atan2(b3[1].y - b3[0].y, b3[1].x - b3[0].x), r3 = o3 - l3, c3 = Math.PI - l3 - o3, d3 = Ve(b3[0], b3[1]) / Math.sqrt(2) * ee, m3 = { x: b3[0].x + Math.cos(r3) * d3, y: b3[0].y + Math.sin(r3) * d3 * -1 }, S3 = { x: b3[1].x + Math.cos(c3) * d3, y: b3[1].y + Math.sin(c3) * d3 * -1 }, v3.push([O3(b3[0]), m3, S3, O3(b3[1])]); break; case F2: case G: s3 = [_3[0], E3.position_path === G ? 0 : _3[1]], h3 = [], p3 = [], b3.forEach(function(e4, t4) { var n4, a4, i4, o4, l4 = s3[t4], r4 = Array.isArray(l4) ? { x: l4[0], y: l4[1] } : "number" == typeof l4 ? e4.socketId === V2 ? { x: 0, y: -l4 } : e4.socketId === P2 ? { x: l4, y: 0 } : e4.socketId === N ? { x: 0, y: l4 } : { x: -l4, y: 0 } : (n4 = b3[t4 ? 0 : 1], i4 = 0 < (a4 = E3.position_plugOverheadSE[t4]) ? q + (Q < a4 ? (a4 - Q) * K : 0) : Z + (E3.position_lineStrokeWidth > Y ? (E3.position_lineStrokeWidth - Y) * X : 0), e4.socketId === V2 ? ((o4 = (e4.y - n4.y) / 2) < i4 && (o4 = i4), { x: 0, y: -o4 }) : e4.socketId === P2 ? ((o4 = (n4.x - e4.x) / 2) < i4 && (o4 = i4), { x: o4, y: 0 }) : e4.socketId === N ? ((o4 = (n4.y - e4.y) / 2) < i4 && (o4 = i4), { x: 0, y: o4 }) : ((o4 = (e4.x - n4.x) / 2) < i4 && (o4 = i4), { x: -o4, y: 0 })); h3[t4] = e4.x + r4.x, p3[t4] = e4.y + r4.y; }), v3.push([O3(b3[0]), { x: h3[0], y: p3[0] }, { x: h3[1], y: p3[1] }, O3(b3[1])]); break; case D2: !function() { var a4, o4 = 1, l4 = 2, r4 = 3, s4 = 4, u4 = [[], []], h4 = []; function p4(e4) { return e4 === o4 ? r4 : e4 === l4 ? s4 : e4 === r4 ? o4 : l4; } function c4(e4) { return e4 === l4 || e4 === s4 ? "x" : "y"; } function d4(e4, t4, n4) { var a5 = { x: e4.x, y: e4.y }; if (n4) { if (n4 === p4(e4.dirId)) throw new Error("Invalid dirId: " + n4); a5.dirId = n4; } else a5.dirId = e4.dirId; return a5.dirId === o4 ? a5.y -= t4 : a5.dirId === l4 ? a5.x += t4 : a5.dirId === r4 ? a5.y += t4 : a5.x -= t4, a5; } function f4(e4, t4) { return t4.dirId === o4 ? e4.y <= t4.y : t4.dirId === l4 ? e4.x >= t4.x : t4.dirId === r4 ? e4.y >= t4.y : e4.x <= t4.x; } function y4(e4, t4) { return t4.dirId === o4 || t4.dirId === r4 ? e4.x === t4.x : e4.y === t4.y; } function m4(e4) { return e4[0] ? { contain: 0, notContain: 1 } : { contain: 1, notContain: 0 }; } function S4(e4, t4, n4) { return Math.abs(t4[n4] - e4[n4]); } function g3(e4, t4, n4) { return "x" === n4 ? e4.x < t4.x ? l4 : s4 : e4.y < t4.y ? r4 : o4; } for (b3.forEach(function(e4, t4) { var n4, a5 = O3(e4), i4 = _3[t4]; n4 = Array.isArray(i4) ? i4[0] < 0 ? [s4, -i4[0]] : 0 < i4[0] ? [l4, i4[0]] : i4[1] < 0 ? [o4, -i4[1]] : 0 < i4[1] ? [r4, i4[1]] : [e4.socketId, 0] : "number" != typeof i4 ? [e4.socketId, $] : 0 <= i4 ? [e4.socketId, i4] : [p4(e4.socketId), -i4], a5.dirId = n4[0], i4 = n4[1], u4[t4].push(a5), h4[t4] = d4(a5, i4); }); function() { var e4, t4, a5, i4, n4 = [f4(h4[1], h4[0]), f4(h4[0], h4[1])], o5 = [c4(h4[0].dirId), c4(h4[1].dirId)]; if (o5[0] === o5[1]) { if (n4[0] && n4[1]) return void (y4(h4[1], h4[0]) || (h4[0][o5[0]] === h4[1][o5[1]] ? (u4[0].push(h4[0]), u4[1].push(h4[1])) : (e4 = h4[0][o5[0]] + (h4[1][o5[1]] - h4[0][o5[0]]) / 2, u4[0].push(d4(h4[0], Math.abs(e4 - h4[0][o5[0]]))), u4[1].push(d4(h4[1], Math.abs(e4 - h4[1][o5[1]])))))); n4[0] !== n4[1] ? (t4 = m4(n4), (a5 = S4(h4[t4.notContain], h4[t4.contain], o5[t4.notContain])) < $ && (h4[t4.notContain] = d4(h4[t4.notContain], $ - a5)), u4[t4.notContain].push(h4[t4.notContain]), h4[t4.notContain] = d4(h4[t4.notContain], $, y4(h4[t4.contain], h4[t4.notContain]) ? "x" === o5[t4.notContain] ? r4 : l4 : g3(h4[t4.notContain], h4[t4.contain], "x" === o5[t4.notContain] ? "y" : "x"))) : (a5 = S4(h4[0], h4[1], "x" === o5[0] ? "y" : "x"), u4.forEach(function(e5, t5) { var n5 = 0 === t5 ? 1 : 0; e5.push(h4[t5]), h4[t5] = d4(h4[t5], $, 2 * $ <= a5 ? g3(h4[t5], h4[n5], "x" === o5[t5] ? "y" : "x") : "x" === o5[t5] ? r4 : l4); })); } else { if (n4[0] && n4[1]) return void (y4(h4[1], h4[0]) ? u4[1].push(h4[1]) : y4(h4[0], h4[1]) ? u4[0].push(h4[0]) : u4[0].push("x" === o5[0] ? { x: h4[1].x, y: h4[0].y } : { x: h4[0].x, y: h4[1].y })); n4[0] !== n4[1] ? (t4 = m4(n4), u4[t4.notContain].push(h4[t4.notContain]), h4[t4.notContain] = d4(h4[t4.notContain], $, S4(h4[t4.notContain], h4[t4.contain], o5[t4.contain]) >= $ ? g3(h4[t4.notContain], h4[t4.contain], o5[t4.contain]) : h4[t4.contain].dirId)) : (i4 = [{ x: h4[0].x, y: h4[0].y }, { x: h4[1].x, y: h4[1].y }], u4.forEach(function(e5, t5) { var n5 = 0 === t5 ? 1 : 0, a6 = S4(i4[t5], i4[n5], o5[t5]); a6 < $ && (h4[t5] = d4(h4[t5], $ - a6)), e5.push(h4[t5]), h4[t5] = d4(h4[t5], $, g3(h4[t5], h4[n5], o5[n5])); })); } return 1; }(); ) ; u4[1].reverse(), u4[0].concat(u4[1]).forEach(function(e4, t4) { var n4 = { x: e4.x, y: e4.y }; 0 < t4 && v3.push([a4, n4]), a4 = n4; }); }(); } y3 = [], E3.position_plugOverheadSE.forEach(function(e4, t4) { var n4, a4, i4, o4, l4, r4, s4, u4, h4, p4, c4, d4 = !t4; 0 < e4 ? 2 === (n4 = v3[a4 = d4 ? 0 : v3.length - 1]).length ? (y3[a4] = y3[a4] || Ve.apply(null, n4), y3[a4] > J && (y3[a4] - e4 < J && (e4 = y3[a4] - J), i4 = Pe(n4[0], n4[1], (d4 ? e4 : y3[a4] - e4) / y3[a4]), v3[a4] = d4 ? [i4, n4[1]] : [n4[0], i4], y3[a4] -= e4)) : (y3[a4] = y3[a4] || We.apply(null, n4), y3[a4] > J && (y3[a4] - e4 < J && (e4 = y3[a4] - J), i4 = Te(n4[0], n4[1], n4[2], n4[3], Be(n4[0], n4[1], n4[2], n4[3], d4 ? e4 : y3[a4] - e4)), l4 = d4 ? (o4 = n4[0], i4.toP1) : (o4 = n4[3], i4.fromP2), r4 = Math.atan2(o4.y - i4.y, i4.x - o4.x), s4 = Ve(i4, l4), i4.x = o4.x + Math.cos(r4) * e4, i4.y = o4.y + Math.sin(r4) * e4 * -1, l4.x = i4.x + Math.cos(r4) * s4, l4.y = i4.y + Math.sin(r4) * s4 * -1, v3[a4] = d4 ? [i4, i4.toP1, i4.toP2, n4[3]] : [n4[0], i4.fromP1, i4.fromP2, i4], y3[a4] = null)) : e4 < 0 && (n4 = v3[a4 = d4 ? 0 : v3.length - 1], u4 = b3[t4].socketId, h4 = u4 === T2 || u4 === P2 ? "x" : "y", e4 < (c4 = -f3[t4]["x" == h4 ? "width" : "height"]) && (e4 = c4), p4 = e4 * (u4 === T2 || u4 === V2 ? -1 : 1), 2 === n4.length ? n4[d4 ? 0 : n4.length - 1][h4] += p4 : (d4 ? [0, 1] : [n4.length - 2, n4.length - 1]).forEach(function(e5) { n4[e5][h4] += p4; }), y3[a4] = null); }), x3.position_socketXYSE = Oe(b3), x3.position_plugOverheadSE = Oe(E3.position_plugOverheadSE), x3.position_path = E3.position_path, x3.position_lineStrokeWidth = E3.position_lineStrokeWidth, x3.position_socketGravitySE = Oe(_3), k2 = true, u3.events.apl_position && u3.events.apl_position.forEach(function(e4) { e4(u3, v3); }); } return k2; } function $e(t3, n3) { n3 !== t3.isShown && (!!n3 != !!t3.isShown && (t3.svg.style.visibility = n3 ? "" : "hidden"), t3.isShown = n3, t3.events && t3.events.svgShow && t3.events.svgShow.forEach(function(e3) { e3(t3, n3); })); } function et(e3, t3) { var n3, a3, i3, o3, l3, h3, p3, c3, d3, f3, r3, s3, u3, y3, m3, S3, g2, _3, v3, E3, x3, b3, k2, w3, O3, M3, I2, C3, L3, A2, V3, P3, N2, T3, W3, B3, R3, F3, G2, D3, z3, j2, H3, U2, Z2, Y2, X2, q2, Q2, K2, J2, $2, ee2 = {}; t3.line && (ee2.line = (a3 = (n3 = e3).options, i3 = n3.curStats, o3 = n3.events, l3 = false, l3 = qe(n3, i3, "line_color", a3.lineColor, o3.cur_line_color) || l3, l3 = qe(n3, i3, "line_colorTra", Me(i3.line_color)[0] < 1) || l3, l3 = qe(n3, i3, "line_strokeWidth", a3.lineSize, o3.cur_line_strokeWidth) || l3)), (t3.plug || ee2.line) && (ee2.plug = (p3 = (h3 = e3).options, c3 = h3.curStats, d3 = h3.events, f3 = false, [0, 1].forEach(function(e4) { var t4, n4, a4, i4, o4, l4, r4, s4, u4 = p3.plugSE[e4]; f3 = qe(h3, c3.plug_enabledSE, e4, u4 !== ne) || f3, f3 = qe(h3, c3.plug_plugSE, e4, u4) || f3, f3 = qe(h3, c3.plug_colorSE, e4, s4 = p3.plugColorSE[e4] || c3.line_color, d3.cur_plug_colorSE) || f3, f3 = qe(h3, c3.plug_colorTraSE, e4, Me(s4)[0] < 1) || f3, u4 !== ne && (i4 = n4 = (t4 = ae[ie2[u4]]).widthR * p3.plugSizeSE[e4], o4 = a4 = t4.heightR * p3.plugSizeSE[e4], pe && (i4 *= c3.line_strokeWidth, o4 *= c3.line_strokeWidth), f3 = qe(h3, c3.plug_markerWidthSE, e4, i4) || f3, f3 = qe(h3, c3.plug_markerHeightSE, e4, o4) || f3, c3.capsMaskMarker_markerWidthSE[e4] = n4, c3.capsMaskMarker_markerHeightSE[e4] = a4), c3.plugOutline_plugSE[e4] = c3.capsMaskMarker_plugSE[e4] = u4, c3.plug_enabledSE[e4] ? (s4 = c3.line_strokeWidth / de.lineSize * p3.plugSizeSE[e4], c3.position_plugOverheadSE[e4] = t4.overhead * s4, c3.viewBox_plugBCircleSE[e4] = t4.bCircle * s4, l4 = t4.sideLen * s4, r4 = t4.backLen * s4) : (c3.position_plugOverheadSE[e4] = -c3.line_strokeWidth / 2, c3.viewBox_plugBCircleSE[e4] = l4 = r4 = 0), qe(h3, c3.attach_plugSideLenSE, e4, l4, d3.cur_attach_plugSideLenSE), qe(h3, c3.attach_plugBackLenSE, e4, r4, d3.cur_attach_plugBackLenSE), c3.capsMaskAnchor_enabledSE[e4] = !c3.plug_enabledSE[e4]; }), f3 = qe(h3, c3, "plug_enabled", c3.plug_enabledSE[0] || c3.plug_enabledSE[1]) || f3)), (t3.lineOutline || ee2.line) && (ee2.lineOutline = (u3 = (r3 = e3).options, y3 = r3.curStats, m3 = false, m3 = qe(r3, y3, "lineOutline_enabled", u3.lineOutlineEnabled) || m3, m3 = qe(r3, y3, "lineOutline_color", u3.lineOutlineColor) || m3, m3 = qe(r3, y3, "lineOutline_colorTra", Me(y3.lineOutline_color)[0] < 1) || m3, s3 = y3.line_strokeWidth * u3.lineOutlineSize, m3 = qe(r3, y3, "lineOutline_strokeWidth", y3.line_strokeWidth - 2 * s3) || m3, m3 = qe(r3, y3, "lineOutline_inStrokeWidth", y3.lineOutline_colorTra ? y3.lineOutline_strokeWidth + 2 * ce : y3.line_strokeWidth - s3) || m3)), (t3.plugOutline || ee2.line || ee2.plug || ee2.lineOutline) && (ee2.plugOutline = (g2 = (S3 = e3).options, _3 = S3.curStats, v3 = false, [0, 1].forEach(function(e4) { var t4, n4 = _3.plugOutline_plugSE[e4], a4 = n4 !== ne ? ae[ie2[n4]] : null; v3 = qe(S3, _3.plugOutline_enabledSE, e4, g2.plugOutlineEnabledSE[e4] && _3.plug_enabled && _3.plug_enabledSE[e4] && !!a4 && !!a4.outlineBase) || v3, v3 = qe(S3, _3.plugOutline_colorSE, e4, t4 = g2.plugOutlineColorSE[e4] || _3.lineOutline_color) || v3, v3 = qe(S3, _3.plugOutline_colorTraSE, e4, Me(t4)[0] < 1) || v3, a4 && a4.outlineBase && ((t4 = g2.plugOutlineSizeSE[e4]) > a4.outlineMax && (t4 = a4.outlineMax), t4 *= 2 * a4.outlineBase, v3 = qe(S3, _3.plugOutline_strokeWidthSE, e4, t4) || v3, v3 = qe(S3, _3.plugOutline_inStrokeWidthSE, e4, _3.plugOutline_colorTraSE[e4] ? t4 - ce / (_3.line_strokeWidth / de.lineSize) / g2.plugSizeSE[e4] * 2 : t4 / 2) || v3); }), v3)), (t3.faces || ee2.line || ee2.plug || ee2.lineOutline || ee2.plugOutline) && (ee2.faces = (b3 = (E3 = e3).curStats, k2 = E3.aplStats, w3 = E3.events, O3 = false, !b3.line_altColor && qe(E3, k2, "line_color", x3 = b3.line_color, w3.apl_line_color) && (E3.lineFace.style.stroke = x3, O3 = true), qe(E3, k2, "line_strokeWidth", x3 = b3.line_strokeWidth, w3.apl_line_strokeWidth) && (E3.lineShape.style.strokeWidth = x3 + "px", O3 = true, (ue || se) && (He(E3, E3.lineShape), se && (He(E3, E3.lineFace), He(E3, E3.lineMaskCaps)))), qe(E3, k2, "lineOutline_enabled", x3 = b3.lineOutline_enabled, w3.apl_lineOutline_enabled) && (E3.lineOutlineFace.style.display = x3 ? "inline" : "none", O3 = true), b3.lineOutline_enabled && (qe(E3, k2, "lineOutline_color", x3 = b3.lineOutline_color, w3.apl_lineOutline_color) && (E3.lineOutlineFace.style.stroke = x3, O3 = true), qe(E3, k2, "lineOutline_strokeWidth", x3 = b3.lineOutline_strokeWidth, w3.apl_lineOutline_strokeWidth) && (E3.lineOutlineMaskShape.style.strokeWidth = x3 + "px", O3 = true, se && (He(E3, E3.lineOutlineMaskCaps), He(E3, E3.lineOutlineFace))), qe(E3, k2, "lineOutline_inStrokeWidth", x3 = b3.lineOutline_inStrokeWidth, w3.apl_lineOutline_inStrokeWidth) && (E3.lineMaskShape.style.strokeWidth = x3 + "px", O3 = true, se && (He(E3, E3.lineOutlineMaskCaps), He(E3, E3.lineOutlineFace)))), qe(E3, k2, "plug_enabled", x3 = b3.plug_enabled, w3.apl_plug_enabled) && (E3.plugsFace.style.display = x3 ? "inline" : "none", O3 = true), b3.plug_enabled && [0, 1].forEach(function(n4) { var e4 = b3.plug_plugSE[n4], t4 = e4 !== ne ? ae[ie2[e4]] : null, a4 = Ye(n4, t4); qe(E3, k2.plug_enabledSE, n4, x3 = b3.plug_enabledSE[n4], w3.apl_plug_enabledSE) && (E3.plugsFace.style[a4.prop] = x3 ? "url(#" + E3.plugMarkerIdSE[n4] + ")" : "none", O3 = true), b3.plug_enabledSE[n4] && (qe(E3, k2.plug_plugSE, n4, e4, w3.apl_plug_plugSE) && (E3.plugFaceSE[n4].href.baseVal = "#" + t4.elmId, Ze(E3, E3.plugMarkerSE[n4], a4.orient, t4.bBox, E3.svg, E3.plugMarkerShapeSE[n4], E3.plugsFace), O3 = true, ue && He(E3, E3.plugsFace)), qe(E3, k2.plug_colorSE, n4, x3 = b3.plug_colorSE[n4], w3.apl_plug_colorSE) && (E3.plugFaceSE[n4].style.fill = x3, O3 = true, (he || pe || se) && !b3.line_colorTra && He(E3, se ? E3.lineMaskCaps : E3.capsMaskLine)), ["markerWidth", "markerHeight"].forEach(function(e5) { var t5 = "plug_" + e5 + "SE"; qe(E3, k2[t5], n4, x3 = b3[t5][n4], w3["apl_" + t5]) && (E3.plugMarkerSE[n4][e5].baseVal.value = x3, O3 = true); }), qe(E3, k2.plugOutline_enabledSE, n4, x3 = b3.plugOutline_enabledSE[n4], w3.apl_plugOutline_enabledSE) && (x3 ? (E3.plugFaceSE[n4].style.mask = "url(#" + E3.plugMaskIdSE[n4] + ")", E3.plugOutlineFaceSE[n4].style.display = "inline") : (E3.plugFaceSE[n4].style.mask = "none", E3.plugOutlineFaceSE[n4].style.display = "none"), O3 = true), b3.plugOutline_enabledSE[n4] && (qe(E3, k2.plugOutline_plugSE, n4, e4, w3.apl_plugOutline_plugSE) && (E3.plugOutlineFaceSE[n4].href.baseVal = E3.plugMaskShapeSE[n4].href.baseVal = E3.plugOutlineMaskShapeSE[n4].href.baseVal = "#" + t4.elmId, [E3.plugMaskSE[n4], E3.plugOutlineMaskSE[n4]].forEach(function(e5) { e5.x.baseVal.value = t4.bBox.left, e5.y.baseVal.value = t4.bBox.top, e5.width.baseVal.value = t4.bBox.width, e5.height.baseVal.value = t4.bBox.height; }), O3 = true), qe(E3, k2.plugOutline_colorSE, n4, x3 = b3.plugOutline_colorSE[n4], w3.apl_plugOutline_colorSE) && (E3.plugOutlineFaceSE[n4].style.fill = x3, O3 = true, se && (He(E3, E3.lineMaskCaps), He(E3, E3.lineOutlineMaskCaps))), qe(E3, k2.plugOutline_strokeWidthSE, n4, x3 = b3.plugOutline_strokeWidthSE[n4], w3.apl_plugOutline_strokeWidthSE) && (E3.plugOutlineMaskShapeSE[n4].style.strokeWidth = x3 + "px", O3 = true), qe(E3, k2.plugOutline_inStrokeWidthSE, n4, x3 = b3.plugOutline_inStrokeWidthSE[n4], w3.apl_plugOutline_inStrokeWidthSE) && (E3.plugMaskShapeSE[n4].style.strokeWidth = x3 + "px", O3 = true))); }), O3)), (t3.position || ee2.line || ee2.plug) && (ee2.position = Je(e3)), (t3.path || ee2.position) && (ee2.path = (C3 = (M3 = e3).curStats, L3 = M3.aplStats, A2 = M3.pathList.animVal || M3.pathList.baseVal, V3 = C3.path_edge, P3 = false, A2 && (V3.x1 = V3.x2 = A2[0][0].x, V3.y1 = V3.y2 = A2[0][0].y, C3.path_pathData = I2 = Re(A2, function(e4) { e4.x < V3.x1 && (V3.x1 = e4.x), e4.y < V3.y1 && (V3.y1 = e4.y), e4.x > V3.x2 && (V3.x2 = e4.x), e4.y > V3.y2 && (V3.y2 = e4.y); }), Ge(I2, L3.path_pathData) && (M3.linePath.setPathData(I2), L3.path_pathData = I2, P3 = true, se ? (He(M3, M3.plugsFace), He(M3, M3.lineMaskCaps)) : ue && He(M3, M3.linePath), M3.events.apl_path && M3.events.apl_path.forEach(function(e4) { e4(M3, I2); }))), P3)), ee2.viewBox = (T3 = (N2 = e3).curStats, W3 = N2.aplStats, B3 = T3.path_edge, R3 = T3.viewBox_bBox, F3 = W3.viewBox_bBox, G2 = N2.svg.viewBox.baseVal, D3 = N2.svg.style, z3 = false, j2 = Math.max(T3.line_strokeWidth / 2, T3.viewBox_plugBCircleSE[0] || 0, T3.viewBox_plugBCircleSE[1] || 0), H3 = { x1: B3.x1 - j2, y1: B3.y1 - j2, x2: B3.x2 + j2, y2: B3.y2 + j2 }, N2.events.new_edge4viewBox && N2.events.new_edge4viewBox.forEach(function(e4) { e4(N2, H3); }), R3.x = T3.lineMask_x = T3.lineOutlineMask_x = T3.maskBGRect_x = H3.x1, R3.y = T3.lineMask_y = T3.lineOutlineMask_y = T3.maskBGRect_y = H3.y1, R3.width = H3.x2 - H3.x1, R3.height = H3.y2 - H3.y1, ["x", "y", "width", "height"].forEach(function(e4) { var t4; (t4 = R3[e4]) !== F3[e4] && (G2[e4] = F3[e4] = t4, D3[oe[e4]] = t4 + ("x" === e4 || "y" === e4 ? N2.bodyOffset[e4] : 0) + "px", z3 = true); }), z3), ee2.mask = (Y2 = (U2 = e3).curStats, X2 = U2.aplStats, q2 = false, Y2.plug_enabled ? [0, 1].forEach(function(e4) { Y2.capsMaskMarker_enabledSE[e4] = Y2.plug_enabledSE[e4] && Y2.plug_colorTraSE[e4] || Y2.plugOutline_enabledSE[e4] && Y2.plugOutline_colorTraSE[e4]; }) : Y2.capsMaskMarker_enabledSE[0] = Y2.capsMaskMarker_enabledSE[1] = false, Y2.capsMaskMarker_enabled = Y2.capsMaskMarker_enabledSE[0] || Y2.capsMaskMarker_enabledSE[1], Y2.lineMask_outlineMode = Y2.lineOutline_enabled, Y2.caps_enabled = Y2.capsMaskMarker_enabled || Y2.capsMaskAnchor_enabledSE[0] || Y2.capsMaskAnchor_enabledSE[1], Y2.lineMask_enabled = Y2.caps_enabled || Y2.lineMask_outlineMode, (Y2.lineMask_enabled && !Y2.lineMask_outlineMode || Y2.lineOutline_enabled) && ["x", "y"].forEach(function(e4) { var t4 = "maskBGRect_" + e4; qe(U2, X2, t4, Z2 = Y2[t4]) && (U2.maskBGRect[e4].baseVal.value = Z2, q2 = true); }), qe(U2, X2, "lineMask_enabled", Z2 = Y2.lineMask_enabled) && (U2.lineFace.style.mask = Z2 ? "url(#" + U2.lineMaskId + ")" : "none", q2 = true, pe && He(U2, U2.lineMask)), Y2.lineMask_enabled && (qe(U2, X2, "lineMask_outlineMode", Z2 = Y2.lineMask_outlineMode) && (Z2 ? (U2.lineMaskBG.style.display = "none", U2.lineMaskShape.style.display = "inline") : (U2.lineMaskBG.style.display = "inline", U2.lineMaskShape.style.display = "none"), q2 = true), ["x", "y"].forEach(function(e4) { var t4 = "lineMask_" + e4; qe(U2, X2, t4, Z2 = Y2[t4]) && (U2.lineMask[e4].baseVal.value = Z2, q2 = true); }), qe(U2, X2, "caps_enabled", Z2 = Y2.caps_enabled) && (U2.lineMaskCaps.style.display = U2.lineOutlineMaskCaps.style.display = Z2 ? "inline" : "none", q2 = true, pe && He(U2, U2.capsMaskLine)), Y2.caps_enabled && ([0, 1].forEach(function(e4) { var t4; qe(U2, X2.capsMaskAnchor_enabledSE, e4, Z2 = Y2.capsMaskAnchor_enabledSE[e4]) && (U2.capsMaskAnchorSE[e4].style.display = Z2 ? "inline" : "none", q2 = true, pe && He(U2, U2.lineMask)), Y2.capsMaskAnchor_enabledSE[e4] && (Ge(t4 = Y2.capsMaskAnchor_pathDataSE[e4], X2.capsMaskAnchor_pathDataSE[e4]) && (U2.capsMaskAnchorSE[e4].setPathData(t4), X2.capsMaskAnchor_pathDataSE[e4] = t4, q2 = true), qe(U2, X2.capsMaskAnchor_strokeWidthSE, e4, Z2 = Y2.capsMaskAnchor_strokeWidthSE[e4]) && (U2.capsMaskAnchorSE[e4].style.strokeWidth = Z2 + "px", q2 = true)); }), qe(U2, X2, "capsMaskMarker_enabled", Z2 = Y2.capsMaskMarker_enabled) && (U2.capsMaskLine.style.display = Z2 ? "inline" : "none", q2 = true), Y2.capsMaskMarker_enabled && [0, 1].forEach(function(n4) { var e4 = Y2.capsMaskMarker_plugSE[n4], t4 = e4 !== ne ? ae[ie2[e4]] : null, a4 = Ye(n4, t4); qe(U2, X2.capsMaskMarker_enabledSE, n4, Z2 = Y2.capsMaskMarker_enabledSE[n4]) && (U2.capsMaskLine.style[a4.prop] = Z2 ? "url(#" + U2.lineMaskMarkerIdSE[n4] + ")" : "none", q2 = true), Y2.capsMaskMarker_enabledSE[n4] && (qe(U2, X2.capsMaskMarker_plugSE, n4, e4) && (U2.capsMaskMarkerShapeSE[n4].href.baseVal = "#" + t4.elmId, Ze(U2, U2.capsMaskMarkerSE[n4], a4.orient, t4.bBox, U2.svg, U2.capsMaskMarkerShapeSE[n4], U2.capsMaskLine), q2 = true, ue && (He(U2, U2.capsMaskLine), He(U2, U2.lineFace))), ["markerWidth", "markerHeight"].forEach(function(e5) { var t5 = "capsMaskMarker_" + e5 + "SE"; qe(U2, X2[t5], n4, Z2 = Y2[t5][n4]) && (U2.capsMaskMarkerSE[n4][e5].baseVal.value = Z2, q2 = true); })); }))), Y2.lineOutline_enabled && ["x", "y"].forEach(function(e4) { var t4 = "lineOutlineMask_" + e4; qe(U2, X2, t4, Z2 = Y2[t4]) && (U2.lineOutlineMask[e4].baseVal.value = Z2, q2 = true); }), q2), t3.effect && (J2 = (Q2 = e3).curStats, $2 = Q2.aplStats, Object.keys(te).forEach(function(e4) { var t4 = te[e4], n4 = e4 + "_enabled", a4 = e4 + "_options", i4 = J2[a4]; qe(Q2, $2, n4, K2 = J2[n4]) ? (K2 && ($2[a4] = Oe(i4)), t4[K2 ? "init" : "remove"](Q2)) : K2 && we(i4, $2[a4]) && (t4.remove(Q2), $2[n4] = true, $2[a4] = Oe(i4), t4.init(Q2)); })), (he || pe) && ee2.line && !ee2.path && He(e3, e3.lineShape), he && ee2.plug && !ee2.line && He(e3, e3.plugsFace), Ue(e3); } function tt2(e3, t3) { return { duration: ye(e3.duration) && 0 < e3.duration ? e3.duration : t3.duration, timing: g.validTiming(e3.timing) ? e3.timing : Oe(t3.timing) }; } function nt(e3, t3, n3, a3) { var i3, o3 = e3.curStats, l3 = e3.aplStats, r3 = {}; function s3() { ["show_on", "show_effect", "show_animOptions"].forEach(function(e4) { l3[e4] = o3[e4]; }); } o3.show_on = t3, n3 && M2[n3] && (o3.show_effect = n3, o3.show_animOptions = tt2(fe(a3) ? a3 : {}, M2[n3].defaultAnimOptions)), r3.show_on = o3.show_on !== l3.show_on, r3.show_effect = o3.show_effect !== l3.show_effect, r3.show_animOptions = we(o3.show_animOptions, l3.show_animOptions), r3.show_effect || r3.show_animOptions ? o3.show_inAnim ? (i3 = r3.show_effect ? M2[l3.show_effect].stop(e3, true, true) : M2[l3.show_effect].stop(e3), s3(), M2[l3.show_effect].init(e3, i3)) : r3.show_on && (l3.show_effect && r3.show_effect && M2[l3.show_effect].stop(e3, true, true), s3(), M2[l3.show_effect].init(e3)) : r3.show_on && (s3(), M2[l3.show_effect].start(e3)); } function at(e3, t3, n3) { var a3 = { props: e3, optionName: n3 }; return e3.attachments.indexOf(t3) < 0 && (!t3.conf.bind || t3.conf.bind(t3, a3)) && (e3.attachments.push(t3), t3.boundTargets.push(a3), 1); } function it(n3, a3, e3) { var i3 = n3.attachments.indexOf(a3); -1 < i3 && n3.attachments.splice(i3, 1), a3.boundTargets.some(function(e4, t3) { return e4.props === n3 && (a3.conf.unbind && a3.conf.unbind(a3, e4), i3 = t3, true); }) && (a3.boundTargets.splice(i3, 1), e3 || je(function() { a3.boundTargets.length || o2(a3); })); } function ot(s3, u3) { var e3, i3, a3, t3, n3, o3, l3, r3, h3, p3, c3, d3, f3, y3, m3, S3, g2, _3 = s3.options, v3 = {}; function E3(e4, t4, n4, a4, i4) { var o4 = {}; return n4 ? null != a4 ? (o4.container = e4[n4], o4.key = a4) : (o4.container = e4, o4.key = n4) : (o4.container = e4, o4.key = t4), o4.default = i4, o4.acceptsAuto = null == o4.default, o4; } function x3(e4, t4, n4, a4, i4, o4, l4) { var r4, s4, u4, h4 = E3(e4, n4, i4, o4, l4); return null != t4[n4] && (s4 = (t4[n4] + "").toLowerCase()) && (h4.acceptsAuto && s4 === U || (u4 = a4[s4])) && u4 !== h4.container[h4.key] && (h4.container[h4.key] = u4, r4 = true), null != h4.container[h4.key] || h4.acceptsAuto || (h4.container[h4.key] = h4.default, r4 = true), r4; } function b3(e4, t4, n4, a4, i4, o4, l4, r4, s4) { var u4, h4, p4, c4, d4 = E3(e4, n4, i4, o4, l4); if (!a4) { if (null == d4.default) throw new Error("Invalid `type`: " + n4); a4 = typeof d4.default; } return null != t4[n4] && (d4.acceptsAuto && (t4[n4] + "").toLowerCase() === U || (p4 = h4 = t4[n4], ("number" === (c4 = a4) ? ye(p4) : typeof p4 === c4) && (h4 = s4 && "string" === a4 && h4 ? h4.trim() : h4, 1) && (!r4 || r4(h4)))) && h4 !== d4.container[d4.key] && (d4.container[d4.key] = h4, u4 = true), null != d4.container[d4.key] || d4.acceptsAuto || (d4.container[d4.key] = d4.default, u4 = true), u4; } if (u3 = u3 || {}, ["start", "end"].forEach(function(e4, t4) { var n4 = u3[e4], a4 = false; if (n4 && (Ie(n4) || (a4 = L2(n4, "anchor"))) && n4 !== _3.anchorSE[t4]) { if (false !== s3.optionIsAttach.anchorSE[t4] && it(s3, ve[_3.anchorSE[t4]._id]), a4 && !at(s3, ve[n4._id], e4)) throw new Error("Can't bind attachment"); _3.anchorSE[t4] = n4, s3.optionIsAttach.anchorSE[t4] = a4, i3 = v3.position = true; } }), !_3.anchorSE[0] || !_3.anchorSE[1] || _3.anchorSE[0] === _3.anchorSE[1]) throw new Error("`start` and `end` are required."); function k2(e4) { var t4 = o3.appendChild(S3.createElementNS(re, "mask")); return t4.id = e4, t4.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, [t4.x, t4.y, t4.width, t4.height].forEach(function(e5) { e5.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0); }), t4; } function w3(e4) { var t4 = o3.appendChild(S3.createElementNS(re, "marker")); return t4.id = e4, t4.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH, t4.viewBox.baseVal || t4.setAttribute("viewBox", "0 0 0 0"), t4; } function O3(e4) { return [e4.width, e4.height].forEach(function(e5) { e5.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100); }), e4; } i3 && (e3 = function(e4, t4) { var n4, a4, i4; if (!(n4 = Le(e4)) || !(a4 = Le(t4))) throw new Error("Cannot get frames."); return n4.length && a4.length && (n4.reverse(), a4.reverse(), n4.some(function(t5) { return a4.some(function(e5) { return e5 === t5 && (i4 = e5.contentWindow, true); }); })), i4 || window; }(false !== s3.optionIsAttach.anchorSE[0] ? ve[_3.anchorSE[0]._id].element : _3.anchorSE[0], false !== s3.optionIsAttach.anchorSE[1] ? ve[_3.anchorSE[1]._id].element : _3.anchorSE[1])) !== s3.baseWindow && (t3 = e3, m3 = (a3 = s3).aplStats, S3 = t3.document, g2 = A + "-" + a3._id, a3.pathList = {}, Xe(m3, me), Object.keys(te).forEach(function(e4) { var t4 = e4 + "_enabled"; m3[t4] && (te[e4].remove(a3), m3[t4] = false); }), a3.baseWindow && a3.svg && a3.baseWindow.document.body.removeChild(a3.svg), Ke(a3.baseWindow = t3), a3.bodyOffset = Qe(t3), a3.svg = n3 = S3.createElementNS(re, "svg"), n3.className.baseVal = A, n3.viewBox.baseVal || n3.setAttribute("viewBox", "0 0 0 0"), a3.defs = o3 = n3.appendChild(S3.createElementNS(re, "defs")), a3.linePath = r3 = o3.appendChild(S3.createElementNS(re, "path")), r3.id = h3 = g2 + "-line-path", r3.className.baseVal = A + "-line-path", pe && (r3.style.fill = "none"), a3.lineShape = r3 = o3.appendChild(S3.createElementNS(re, "use")), r3.id = p3 = g2 + "-line-shape", r3.href.baseVal = "#" + h3, (l3 = o3.appendChild(S3.createElementNS(re, "g"))).id = c3 = g2 + "-caps", a3.capsMaskAnchorSE = [0, 1].map(function() { var e4 = l3.appendChild(S3.createElementNS(re, "path")); return e4.className.baseVal = A + "-caps-mask-anchor", e4; }), a3.lineMaskMarkerIdSE = [g2 + "-caps-mask-marker-0", g2 + "-caps-mask-marker-1"], a3.capsMaskMarkerSE = [0, 1].map(function(e4) { return w3(a3.lineMaskMarkerIdSE[e4]); }), a3.capsMaskMarkerShapeSE = [0, 1].map(function(e4) { var t4 = a3.capsMaskMarkerSE[e4].appendChild(S3.createElementNS(re, "use")); return t4.className.baseVal = A + "-caps-mask-marker-shape", t4; }), a3.capsMaskLine = r3 = l3.appendChild(S3.createElementNS(re, "use")), r3.className.baseVal = A + "-caps-mask-line", r3.href.baseVal = "#" + p3, a3.maskBGRect = r3 = O3(o3.appendChild(S3.createElementNS(re, "rect"))), r3.id = d3 = g2 + "-mask-bg-rect", r3.className.baseVal = A + "-mask-bg-rect", pe && (r3.style.fill = "white"), a3.lineMask = O3(k2(a3.lineMaskId = g2 + "-line-mask")), a3.lineMaskBG = r3 = a3.lineMask.appendChild(S3.createElementNS(re, "use")), r3.href.baseVal = "#" + d3, a3.lineMaskShape = r3 = a3.lineMask.appendChild(S3.createElementNS(re, "use")), r3.className.baseVal = A + "-line-mask-shape", r3.href.baseVal = "#" + h3, r3.style.display = "none", a3.lineMaskCaps = r3 = a3.lineMask.appendChild(S3.createElementNS(re, "use")), r3.href.baseVal = "#" + c3, a3.lineOutlineMask = O3(k2(f3 = g2 + "-line-outline-mask")), (r3 = a3.lineOutlineMask.appendChild(S3.createElementNS(re, "use"))).href.baseVal = "#" + d3, a3.lineOutlineMaskShape = r3 = a3.lineOutlineMask.appendChild(S3.createElementNS(re, "use")), r3.className.baseVal = A + "-line-outline-mask-shape", r3.href.baseVal = "#" + h3, a3.lineOutlineMaskCaps = r3 = a3.lineOutlineMask.appendChild(S3.createElementNS(re, "use")), r3.href.baseVal = "#" + c3, a3.face = n3.appendChild(S3.createElementNS(re, "g")), a3.lineFace = r3 = a3.face.appendChild(S3.createElementNS(re, "use")), r3.href.baseVal = "#" + p3, a3.lineOutlineFace = r3 = a3.face.appendChild(S3.createElementNS(re, "use")), r3.href.baseVal = "#" + p3, r3.style.mask = "url(#" + f3 + ")", r3.style.display = "none", a3.plugMaskIdSE = [g2 + "-plug-mask-0", g2 + "-plug-mask-1"], a3.plugMaskSE = [0, 1].map(function(e4) { return k2(a3.plugMaskIdSE[e4]); }), a3.plugMaskShapeSE = [0, 1].map(function(e4) { var t4 = a3.plugMaskSE[e4].appendChild(S3.createElementNS(re, "use")); return t4.className.baseVal = A + "-plug-mask-shape", t4; }), y3 = [], a3.plugOutlineMaskSE = [0, 1].map(function(e4) { return k2(y3[e4] = g2 + "-plug-outline-mask-" + e4); }), a3.plugOutlineMaskShapeSE = [0, 1].map(function(e4) { var t4 = a3.plugOutlineMaskSE[e4].appendChild(S3.createElementNS(re, "use")); return t4.className.baseVal = A + "-plug-outline-mask-shape", t4; }), a3.plugMarkerIdSE = [g2 + "-plug-marker-0", g2 + "-plug-marker-1"], a3.plugMarkerSE = [0, 1].map(function(e4) { var t4 = w3(a3.plugMarkerIdSE[e4]); return pe && (t4.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE), t4; }), a3.plugMarkerShapeSE = [0, 1].map(function(e4) { return a3.plugMarkerSE[e4].appendChild(S3.createElementNS(re, "g")); }), a3.plugFaceSE = [0, 1].map(function(e4) { return a3.plugMarkerShapeSE[e4].appendChild(S3.createElementNS(re, "use")); }), a3.plugOutlineFaceSE = [0, 1].map(function(e4) { var t4 = a3.plugMarkerShapeSE[e4].appendChild(S3.createElementNS(re, "use")); return t4.style.mask = "url(#" + y3[e4] + ")", t4.style.display = "none", t4; }), a3.plugsFace = r3 = a3.face.appendChild(S3.createElementNS(re, "use")), r3.className.baseVal = A + "-plugs-face", r3.href.baseVal = "#" + p3, r3.style.display = "none", a3.curStats.show_inAnim ? (a3.isShown = 1, M2[m3.show_effect].stop(a3, true)) : a3.isShown || (n3.style.visibility = "hidden"), S3.body.appendChild(n3), [0, 1, 2].forEach(function(e4) { var t4, n4 = a3.options.labelSEM[e4]; n4 && L2(n4, "label") && (t4 = ve[n4._id]).conf.initSvg && t4.conf.initSvg(t4, a3); }), v3.line = v3.plug = v3.lineOutline = v3.plugOutline = v3.faces = v3.effect = true), v3.position = x3(_3, u3, "path", z2, null, null, de.path) || v3.position, v3.position = x3(_3, u3, "startSocket", W2, "socketSE", 0) || v3.position, v3.position = x3(_3, u3, "endSocket", W2, "socketSE", 1) || v3.position, [u3.startSocketGravity, u3.endSocketGravity].forEach(function(e4, t4) { var n4, a4, i4 = false; null != e4 && (Array.isArray(e4) ? ye(e4[0]) && ye(e4[1]) && (i4 = [e4[0], e4[1]], Array.isArray(_3.socketGravitySE[t4]) && (n4 = i4, a4 = _3.socketGravitySE[t4], n4.length === a4.length && n4.every(function(e5, t5) { return e5 === a4[t5]; })) && (i4 = false)) : ((e4 + "").toLowerCase() === U ? i4 = null : ye(e4) && 0 <= e4 && (i4 = e4), i4 === _3.socketGravitySE[t4] && (i4 = false)), false !== i4 && (_3.socketGravitySE[t4] = i4, v3.position = true)); }), v3.line = b3(_3, u3, "color", null, "lineColor", null, de.lineColor, null, true) || v3.line, v3.line = b3(_3, u3, "size", null, "lineSize", null, de.lineSize, function(e4) { return 0 < e4; }) || v3.line, ["startPlug", "endPlug"].forEach(function(e4, t4) { v3.plug = x3(_3, u3, e4, j, "plugSE", t4, de.plugSE[t4]) || v3.plug, v3.plug = b3(_3, u3, e4 + "Color", "string", "plugColorSE", t4, null, null, true) || v3.plug, v3.plug = b3(_3, u3, e4 + "Size", null, "plugSizeSE", t4, de.plugSizeSE[t4], function(e5) { return 0 < e5; }) || v3.plug; }), v3.lineOutline = b3(_3, u3, "outline", null, "lineOutlineEnabled", null, de.lineOutlineEnabled) || v3.lineOutline, v3.lineOutline = b3(_3, u3, "outlineColor", null, "lineOutlineColor", null, de.lineOutlineColor, null, true) || v3.lineOutline, v3.lineOutline = b3(_3, u3, "outlineSize", null, "lineOutlineSize", null, de.lineOutlineSize, function(e4) { return 0 < e4 && e4 <= 0.48; }) || v3.lineOutline, ["startPlugOutline", "endPlugOutline"].forEach(function(e4, t4) { v3.plugOutline = b3(_3, u3, e4, null, "plugOutlineEnabledSE", t4, de.plugOutlineEnabledSE[t4]) || v3.plugOutline, v3.plugOutline = b3(_3, u3, e4 + "Color", "string", "plugOutlineColorSE", t4, null, null, true) || v3.plugOutline, v3.plugOutline = b3(_3, u3, e4 + "Size", null, "plugOutlineSizeSE", t4, de.plugOutlineSizeSE[t4], function(e5) { return 1 <= e5; }) || v3.plugOutline; }), ["startLabel", "endLabel", "middleLabel"].forEach(function(e4, t4) { var n4, a4, i4, o4 = u3[e4], l4 = _3.labelSEM[t4] && !s3.optionIsAttach.labelSEM[t4] ? ve[_3.labelSEM[t4]._id].text : _3.labelSEM[t4], r4 = false; if ((n4 = "string" == typeof o4) && (o4 = o4.trim()), (n4 || o4 && (r4 = L2(o4, "label"))) && o4 !== l4) { if (_3.labelSEM[t4] && (it(s3, ve[_3.labelSEM[t4]._id]), _3.labelSEM[t4] = ""), o4) { if (r4 ? (a4 = ve[(i4 = o4)._id]).boundTargets.slice().forEach(function(e5) { a4.conf.removeOption(a4, e5); }) : i4 = new C2(I.captionLabel, [o4]), !at(s3, ve[i4._id], e4)) throw new Error("Can't bind attachment"); _3.labelSEM[t4] = i4; } s3.optionIsAttach.labelSEM[t4] = r4; } }), Object.keys(te).forEach(function(a4) { var e4, t4, o4 = te[a4], n4 = a4 + "_enabled", i4 = a4 + "_options"; function l4(a5) { var i5 = {}; return o4.optionsConf.forEach(function(e5) { var t5 = e5[0], n5 = e5[3]; null == e5[4] || i5[n5] || (i5[n5] = []), ("function" == typeof t5 ? t5 : "id" === t5 ? x3 : b3).apply(null, [i5, a5].concat(e5.slice(1))); }), i5; } function r4(e5) { var t5, n5 = a4 + "_animOptions"; return e5.hasOwnProperty("animation") ? fe(e5.animation) ? t5 = s3.curStats[n5] = tt2(e5.animation, o4.defaultAnimOptions) : (t5 = !!e5.animation, s3.curStats[n5] = t5 ? tt2({}, o4.defaultAnimOptions) : null) : (t5 = !!o4.defaultEnabled, s3.curStats[n5] = t5 ? tt2({}, o4.defaultAnimOptions) : null), t5; } u3.hasOwnProperty(a4) && (e4 = u3[a4], fe(e4) ? (s3.curStats[n4] = true, t4 = s3.curStats[i4] = l4(e4), o4.anim && (s3.curStats[i4].animation = r4(e4))) : (t4 = s3.curStats[n4] = !!e4) && (s3.curStats[i4] = l4({}), o4.anim && (s3.curStats[i4].animation = r4({}))), we(t4, _3[a4]) && (_3[a4] = t4, v3.effect = true)); }), et(s3, v3); } function lt(e3, t3, n3) { var a3 = { options: { anchorSE: [], socketSE: [], socketGravitySE: [], plugSE: [], plugColorSE: [], plugSizeSE: [], plugOutlineEnabledSE: [], plugOutlineColorSE: [], plugOutlineSizeSE: [], labelSEM: ["", "", ""] }, optionIsAttach: { anchorSE: [false, false], labelSEM: [false, false, false] }, curStats: {}, aplStats: {}, attachments: [], events: {}, reflowTargets: [] }; Xe(a3.curStats, me), Xe(a3.aplStats, me), Object.keys(te).forEach(function(e4) { var t4 = te[e4].stats; Xe(a3.curStats, t4), Xe(a3.aplStats, t4), a3.options[e4] = false; }), Xe(a3.curStats, E2), Xe(a3.aplStats, E2), a3.curStats.show_effect = O2, a3.curStats.show_animOptions = Oe(M2[O2].defaultAnimOptions), Object.defineProperty(this, "_id", { value: ++_e2 }), a3._id = this._id, ge[this._id] = a3, 1 === arguments.length && (n3 = e3, e3 = null), n3 = n3 || {}, (e3 || t3) && (n3 = Oe(n3), e3 && (n3.start = e3), t3 && (n3.end = t3)), a3.isShown = a3.aplStats.show_on = !n3.hide, this.setOptions(n3); } function rt(n3) { return function(e3) { var t3 = {}; t3[n3] = e3, this.setOptions(t3); }; } function st(e3, t3) { var n3, a3 = { conf: e3, curStats: {}, aplStats: {}, boundTargets: [] }, i3 = {}; e3.argOptions.every(function(e4) { return !(!t3.length || ("string" == typeof e4.type ? typeof t3[0] !== e4.type : "function" != typeof e4.type || !e4.type(t3[0]))) && (i3[e4.optionName] = t3.shift(), true); }), n3 = t3.length && fe(t3[0]) ? Oe(t3[0]) : {}, Object.keys(i3).forEach(function(e4) { n3[e4] = i3[e4]; }), e3.stats && (Xe(a3.curStats, e3.stats), Xe(a3.aplStats, e3.stats)), Object.defineProperty(this, "_id", { value: ++Ee }), Object.defineProperty(this, "isRemoved", { get: function() { return !ve[this._id]; } }), a3._id = this._id, e3.init && !e3.init(a3, n3) || (ve[this._id] = a3); } return te = { dash: { stats: { dash_len: {}, dash_gap: {}, dash_maxOffset: {} }, anim: true, defaultAnimOptions: { duration: 1e3, timing: "linear" }, optionsConf: [["type", "len", "number", null, null, null, function(e3) { return 0 < e3; }], ["type", "gap", "number", null, null, null, function(e3) { return 0 < e3; }]], init: function(e3) { De(e3, "apl_line_strokeWidth", te.dash.update), e3.lineFace.style.strokeDashoffset = 0, te.dash.update(e3); }, remove: function(e3) { var t3 = e3.curStats; ze(e3, "apl_line_strokeWidth", te.dash.update), t3.dash_animId && (g.remove(t3.dash_animId), t3.dash_animId = null), e3.lineFace.style.strokeDasharray = "none", e3.lineFace.style.strokeDashoffset = 0, Xe(e3.aplStats, te.dash.stats); }, update: function(t3) { var e3, n3 = t3.curStats, a3 = t3.aplStats, i3 = a3.dash_options, o3 = false; n3.dash_len = i3.len || 2 * a3.line_strokeWidth, n3.dash_gap = i3.gap || a3.line_strokeWidth, n3.dash_maxOffset = n3.dash_len + n3.dash_gap, o3 = qe(t3, a3, "dash_len", n3.dash_len) || o3, (o3 = qe(t3, a3, "dash_gap", n3.dash_gap) || o3) && (t3.lineFace.style.strokeDasharray = a3.dash_len + "," + a3.dash_gap), n3.dash_animOptions ? (o3 = qe(t3, a3, "dash_maxOffset", n3.dash_maxOffset), a3.dash_animOptions && (o3 || we(n3.dash_animOptions, a3.dash_animOptions)) && (n3.dash_animId && (e3 = g.stop(n3.dash_animId), g.remove(n3.dash_animId)), a3.dash_animOptions = null), a3.dash_animOptions || (n3.dash_animId = g.add(function(e4) { return (1 - e4) * a3.dash_maxOffset + "px"; }, function(e4) { t3.lineFace.style.strokeDashoffset = e4; }, n3.dash_animOptions.duration, 0, n3.dash_animOptions.timing, false, e3), a3.dash_animOptions = Oe(n3.dash_animOptions))) : a3.dash_animOptions && (n3.dash_animId && (g.remove(n3.dash_animId), n3.dash_animId = null), t3.lineFace.style.strokeDashoffset = 0, a3.dash_animOptions = null); } }, gradient: { stats: { gradient_colorSE: { hasSE: true }, gradient_pointSE: { hasSE: true, hasProps: true } }, optionsConf: [["type", "startColor", "string", "colorSE", 0, null, null, true], ["type", "endColor", "string", "colorSE", 1, null, null, true]], init: function(e3) { var t3, a3 = e3.baseWindow.document, n3 = e3.defs, i3 = A + "-" + e3._id + "-gradient"; e3.efc_gradient_gradient = t3 = n3.appendChild(a3.createElementNS(re, "linearGradient")), t3.id = i3, t3.gradientUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, [t3.x1, t3.y1, t3.x2, t3.y2].forEach(function(e4) { e4.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0); }), e3.efc_gradient_stopSE = [0, 1].map(function(t4) { var n4 = e3.efc_gradient_gradient.appendChild(a3.createElementNS(re, "stop")); try { n4.offset.baseVal = t4; } catch (e4) { if (e4.code !== DOMException.NO_MODIFICATION_ALLOWED_ERR) throw e4; n4.setAttribute("offset", t4); } return n4; }), De(e3, "cur_plug_colorSE", te.gradient.update), De(e3, "apl_path", te.gradient.update), e3.curStats.line_altColor = true, e3.lineFace.style.stroke = "url(#" + i3 + ")", te.gradient.update(e3); }, remove: function(e3) { e3.efc_gradient_gradient && (e3.defs.removeChild(e3.efc_gradient_gradient), e3.efc_gradient_gradient = e3.efc_gradient_stopSE = null), ze(e3, "cur_plug_colorSE", te.gradient.update), ze(e3, "apl_path", te.gradient.update), e3.curStats.line_altColor = false, e3.lineFace.style.stroke = e3.curStats.line_color, Xe(e3.aplStats, te.gradient.stats); }, update: function(a3) { var e3, t3, i3 = a3.curStats, o3 = a3.aplStats, n3 = o3.gradient_options, l3 = a3.pathList.animVal || a3.pathList.baseVal; [0, 1].forEach(function(e4) { i3.gradient_colorSE[e4] = n3.colorSE[e4] || i3.plug_colorSE[e4]; }), t3 = l3[0][0], i3.gradient_pointSE[0] = { x: t3.x, y: t3.y }, t3 = (e3 = l3[l3.length - 1])[e3.length - 1], i3.gradient_pointSE[1] = { x: t3.x, y: t3.y }, [0, 1].forEach(function(t4) { var n4; qe(a3, o3.gradient_colorSE, t4, n4 = i3.gradient_colorSE[t4]) && (pe ? (n4 = Me(n4), a3.efc_gradient_stopSE[t4].style.stopColor = n4[1], a3.efc_gradient_stopSE[t4].style.stopOpacity = n4[0]) : a3.efc_gradient_stopSE[t4].style.stopColor = n4), ["x", "y"].forEach(function(e4) { (n4 = i3.gradient_pointSE[t4][e4]) !== o3.gradient_pointSE[t4][e4] && (a3.efc_gradient_gradient[e4 + (t4 + 1)].baseVal.value = o3.gradient_pointSE[t4][e4] = n4); }); }); } }, dropShadow: { stats: { dropShadow_dx: {}, dropShadow_dy: {}, dropShadow_blur: {}, dropShadow_color: {}, dropShadow_opacity: {}, dropShadow_x: {}, dropShadow_y: {} }, optionsConf: [["type", "dx", null, null, null, 2], ["type", "dy", null, null, null, 4], ["type", "blur", null, null, null, 3, function(e3) { return 0 <= e3; }], ["type", "color", null, null, null, "#000", null, true], ["type", "opacity", null, null, null, 0.8, function(e3) { return 0 <= e3 && e3 <= 1; }]], init: function(t3) { var e3, n3, a3, i3, o3, l3 = t3.baseWindow.document, r3 = t3.defs, s3 = A + "-" + t3._id + "-dropShadow", u3 = (e3 = l3, n3 = s3, o3 = {}, "boolean" != typeof p2 && (p2 = !!window.SVGFEDropShadowElement && !pe), o3.elmsAppend = [o3.elmFilter = a3 = e3.createElementNS(re, "filter")], a3.filterUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, a3.x.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), a3.y.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), a3.width.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100), a3.height.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100), a3.id = n3, p2 ? (o3.elmOffset = o3.elmBlur = i3 = a3.appendChild(e3.createElementNS(re, "feDropShadow")), o3.styleFlood = i3.style) : (o3.elmBlur = a3.appendChild(e3.createElementNS(re, "feGaussianBlur")), o3.elmOffset = i3 = a3.appendChild(e3.createElementNS(re, "feOffset")), i3.result.baseVal = "offsetblur", i3 = a3.appendChild(e3.createElementNS(re, "feFlood")), o3.styleFlood = i3.style, (i3 = a3.appendChild(e3.createElementNS(re, "feComposite"))).in2.baseVal = "offsetblur", i3.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_IN, (i3 = a3.appendChild(e3.createElementNS(re, "feMerge"))).appendChild(e3.createElementNS(re, "feMergeNode")), i3.appendChild(e3.createElementNS(re, "feMergeNode")).in1.baseVal = "SourceGraphic"), o3); ["elmFilter", "elmOffset", "elmBlur", "styleFlood", "elmsAppend"].forEach(function(e4) { t3["efc_dropShadow_" + e4] = u3[e4]; }), u3.elmsAppend.forEach(function(e4) { r3.appendChild(e4); }), t3.face.setAttribute("filter", "url(#" + s3 + ")"), De(t3, "new_edge4viewBox", te.dropShadow.adjustEdge), te.dropShadow.update(t3); }, remove: function(e3) { var t3 = e3.defs; e3.efc_dropShadow_elmsAppend && (e3.efc_dropShadow_elmsAppend.forEach(function(e4) { t3.removeChild(e4); }), e3.efc_dropShadow_elmFilter = e3.efc_dropShadow_elmOffset = e3.efc_dropShadow_elmBlur = e3.efc_dropShadow_styleFlood = e3.efc_dropShadow_elmsAppend = null), ze(e3, "new_edge4viewBox", te.dropShadow.adjustEdge), et(e3, {}), e3.face.removeAttribute("filter"), Xe(e3.aplStats, te.dropShadow.stats); }, update: function(e3) { var t3, n3, a3 = e3.curStats, i3 = e3.aplStats, o3 = i3.dropShadow_options; a3.dropShadow_dx = t3 = o3.dx, qe(e3, i3, "dropShadow_dx", t3) && (e3.efc_dropShadow_elmOffset.dx.baseVal = t3, n3 = true), a3.dropShadow_dy = t3 = o3.dy, qe(e3, i3, "dropShadow_dy", t3) && (e3.efc_dropShadow_elmOffset.dy.baseVal = t3, n3 = true), a3.dropShadow_blur = t3 = o3.blur, qe(e3, i3, "dropShadow_blur", t3) && (e3.efc_dropShadow_elmBlur.setStdDeviation(t3, t3), n3 = true), n3 && et(e3, {}), a3.dropShadow_color = t3 = o3.color, qe(e3, i3, "dropShadow_color", t3) && (e3.efc_dropShadow_styleFlood.floodColor = t3), a3.dropShadow_opacity = t3 = o3.opacity, qe(e3, i3, "dropShadow_opacity", t3) && (e3.efc_dropShadow_styleFlood.floodOpacity = t3); }, adjustEdge: function(a3, i3) { var e3, t3, o3 = a3.curStats, l3 = a3.aplStats; null != o3.dropShadow_dx && (e3 = 3 * o3.dropShadow_blur, (t3 = { x1: i3.x1 - e3 + o3.dropShadow_dx, y1: i3.y1 - e3 + o3.dropShadow_dy, x2: i3.x2 + e3 + o3.dropShadow_dx, y2: i3.y2 + e3 + o3.dropShadow_dy }).x1 < i3.x1 && (i3.x1 = t3.x1), t3.y1 < i3.y1 && (i3.y1 = t3.y1), t3.x2 > i3.x2 && (i3.x2 = t3.x2), t3.y2 > i3.y2 && (i3.y2 = t3.y2), ["x", "y"].forEach(function(e4) { var t4, n3 = "dropShadow_" + e4; o3[n3] = t4 = i3[e4 + "1"], qe(a3, l3, n3, t4) && (a3.efc_dropShadow_elmFilter[e4].baseVal.value = t4); })); } } }, Object.keys(te).forEach(function(e3) { var t3 = te[e3], n3 = t3.stats; n3[e3 + "_enabled"] = { iniValue: false }, n3[e3 + "_options"] = { hasProps: true }, t3.anim && (n3[e3 + "_animOptions"] = {}, n3[e3 + "_animId"] = {}); }), M2 = { none: { defaultAnimOptions: {}, init: function(e3, t3) { var n3 = e3.curStats; n3.show_animId && (g.remove(n3.show_animId), n3.show_animId = null), M2.none.start(e3, t3); }, start: function(e3, t3) { M2.none.stop(e3, true); }, stop: function(e3, t3, n3) { var a3 = e3.curStats; return n3 = null != n3 ? n3 : e3.aplStats.show_on, a3.show_inAnim = false, t3 && $e(e3, n3), n3 ? 1 : 0; } }, fade: { defaultAnimOptions: { duration: 300, timing: "linear" }, init: function(n3, e3) { var t3 = n3.curStats, a3 = n3.aplStats; t3.show_animId && g.remove(t3.show_animId), t3.show_animId = g.add(function(e4) { return e4; }, function(e4, t4) { t4 ? M2.fade.stop(n3, true) : (n3.svg.style.opacity = e4 + "", se && (He(n3, n3.svg), Ue(n3))); }, a3.show_animOptions.duration, 1, a3.show_animOptions.timing, null, false), M2.fade.start(n3, e3); }, start: function(e3, t3) { var n3, a3 = e3.curStats; a3.show_inAnim && (n3 = g.stop(a3.show_animId)), $e(e3, 1), a3.show_inAnim = true, g.start(a3.show_animId, !e3.aplStats.show_on, null != t3 ? t3 : n3); }, stop: function(e3, t3, n3) { var a3, i3 = e3.curStats; return n3 = null != n3 ? n3 : e3.aplStats.show_on, a3 = i3.show_inAnim ? g.stop(i3.show_animId) : n3 ? 1 : 0, i3.show_inAnim = false, t3 && (e3.svg.style.opacity = n3 ? "" : "0", $e(e3, n3)), a3; } }, draw: { defaultAnimOptions: { duration: 500, timing: [0.58, 0, 0.42, 1] }, init: function(n3, e3) { var t3 = n3.curStats, a3 = n3.aplStats, l3 = n3.pathList.baseVal, i3 = Fe(l3), r3 = i3.segsLen, s3 = i3.lenAll; t3.show_animId && g.remove(t3.show_animId), t3.show_animId = g.add(function(e4) { var t4, n4, a4, i4, o3 = -1; if (0 === e4) n4 = [[l3[0][0], l3[0][0]]]; else if (1 === e4) n4 = l3; else { for (t4 = s3 * e4, n4 = []; t4 >= r3[++o3]; ) n4.push(l3[o3]), t4 -= r3[o3]; t4 && (2 === (a4 = l3[o3]).length ? n4.push([a4[0], Pe(a4[0], a4[1], t4 / r3[o3])]) : (i4 = Te(a4[0], a4[1], a4[2], a4[3], Be(a4[0], a4[1], a4[2], a4[3], t4)), n4.push([a4[0], i4.fromP1, i4.fromP2, i4]))); } return n4; }, function(e4, t4) { t4 ? M2.draw.stop(n3, true) : (n3.pathList.animVal = e4, et(n3, { path: true })); }, a3.show_animOptions.duration, 1, a3.show_animOptions.timing, null, false), M2.draw.start(n3, e3); }, start: function(e3, t3) { var n3, a3 = e3.curStats; a3.show_inAnim && (n3 = g.stop(a3.show_animId)), $e(e3, 1), a3.show_inAnim = true, De(e3, "apl_position", M2.draw.update), g.start(a3.show_animId, !e3.aplStats.show_on, null != t3 ? t3 : n3); }, stop: function(e3, t3, n3) { var a3, i3 = e3.curStats; return n3 = null != n3 ? n3 : e3.aplStats.show_on, a3 = i3.show_inAnim ? g.stop(i3.show_animId) : n3 ? 1 : 0, i3.show_inAnim = false, t3 && (e3.pathList.animVal = n3 ? null : [[e3.pathList.baseVal[0][0], e3.pathList.baseVal[0][0]]], et(e3, { path: true }), $e(e3, n3)), a3; }, update: function(e3) { ze(e3, "apl_position", M2.draw.update), e3.curStats.show_inAnim ? M2.draw.init(e3, M2.draw.stop(e3)) : e3.aplStats.show_animOptions = {}; } } }, [["start", "anchorSE", 0], ["end", "anchorSE", 1], ["color", "lineColor"], ["size", "lineSize"], ["startSocketGravity", "socketGravitySE", 0], ["endSocketGravity", "socketGravitySE", 1], ["startPlugColor", "plugColorSE", 0], ["endPlugColor", "plugColorSE", 1], ["startPlugSize", "plugSizeSE", 0], ["endPlugSize", "plugSizeSE", 1], ["outline", "lineOutlineEnabled"], ["outlineColor", "lineOutlineColor"], ["outlineSize", "lineOutlineSize"], ["startPlugOutline", "plugOutlineEnabledSE", 0], ["endPlugOutline", "plugOutlineEnabledSE", 1], ["startPlugOutlineColor", "plugOutlineColorSE", 0], ["endPlugOutlineColor", "plugOutlineColorSE", 1], ["startPlugOutlineSize", "plugOutlineSizeSE", 0], ["endPlugOutlineSize", "plugOutlineSizeSE", 1]].forEach(function(e3) { var t3 = e3[0], n3 = e3[1], a3 = e3[2]; Object.defineProperty(lt.prototype, t3, { get: function() { var e4 = null != a3 ? ge[this._id].options[n3][a3] : n3 ? ge[this._id].options[n3] : ge[this._id].options[t3]; return null == e4 ? U : Oe(e4); }, set: rt(t3), enumerable: true }); }), [["path", z2], ["startSocket", W2, "socketSE", 0], ["endSocket", W2, "socketSE", 1], ["startPlug", j, "plugSE", 0], ["endPlug", j, "plugSE", 1]].forEach(function(e3) { var a3 = e3[0], i3 = e3[1], o3 = e3[2], l3 = e3[3]; Object.defineProperty(lt.prototype, a3, { get: function() { var t3, n3 = null != l3 ? ge[this._id].options[o3][l3] : o3 ? ge[this._id].options[o3] : ge[this._id].options[a3]; return n3 ? Object.keys(i3).some(function(e4) { return i3[e4] === n3 && (t3 = e4, true); }) ? t3 : new Error("It's broken") : U; }, set: rt(a3), enumerable: true }); }), Object.keys(te).forEach(function(n3) { var a3 = te[n3]; Object.defineProperty(lt.prototype, n3, { get: function() { var u3, e3, t3 = ge[this._id].options[n3]; return fe(t3) ? (u3 = t3, e3 = a3.optionsConf.reduce(function(e4, t4) { var n4, a4 = t4[0], i3 = t4[1], o3 = t4[2], l3 = t4[3], r3 = t4[4], s3 = null != r3 ? u3[l3][r3] : l3 ? u3[l3] : u3[i3]; return e4[i3] = "id" === a4 ? s3 ? Object.keys(o3).some(function(e5) { return o3[e5] === s3 && (n4 = e5, true); }) ? n4 : new Error("It's broken") : U : null == s3 ? U : Oe(s3), e4; }, {}), a3.anim && (e3.animation = Oe(u3.animation)), e3) : t3; }, set: rt(n3), enumerable: true }); }), ["startLabel", "endLabel", "middleLabel"].forEach(function(e3, n3) { Object.defineProperty(lt.prototype, e3, { get: function() { var e4 = ge[this._id], t3 = e4.options; return t3.labelSEM[n3] && !e4.optionIsAttach.labelSEM[n3] ? ve[t3.labelSEM[n3]._id].text : t3.labelSEM[n3] || ""; }, set: rt(e3), enumerable: true }); }), lt.prototype.setOptions = function(e3) { return ot(ge[this._id], e3), this; }, lt.prototype.position = function() { return et(ge[this._id], { position: true }), this; }, lt.prototype.remove = function() { var t3 = ge[this._id], n3 = t3.curStats; Object.keys(te).forEach(function(e3) { var t4 = e3 + "_animId"; n3[t4] && g.remove(n3[t4]); }), n3.show_animId && g.remove(n3.show_animId), t3.attachments.slice().forEach(function(e3) { it(t3, e3); }), t3.baseWindow && t3.svg && t3.baseWindow.document.body.removeChild(t3.svg), delete ge[this._id]; }, lt.prototype.show = function(e3, t3) { return nt(ge[this._id], true, e3, t3), this; }, lt.prototype.hide = function(e3, t3) { return nt(ge[this._id], false, e3, t3), this; }, o2 = function(t3) { t3 && ve[t3._id] && (t3.boundTargets.slice().forEach(function(e3) { it(e3.props, t3, true); }), t3.conf.remove && t3.conf.remove(t3), delete ve[t3._id]); }, st.prototype.remove = function() { var t3 = this, n3 = ve[t3._id]; n3 && (n3.boundTargets.slice().forEach(function(e3) { n3.conf.removeOption(n3, e3); }), je(function() { var e3 = ve[t3._id]; e3 && (console.error("LeaderLineAttachment was not removed by removeOption"), o2(e3)); })); }, C2 = st, window.LeaderLineAttachment = C2, L2 = function(e3, t3) { return e3 instanceof C2 && (!(e3.isRemoved || t3 && ve[e3._id].conf.type !== t3) || null); }, I = { pointAnchor: { type: "anchor", argOptions: [{ optionName: "element", type: Ie }], init: function(e3, t3) { return e3.element = I.pointAnchor.checkElement(t3.element), e3.x = I.pointAnchor.parsePercent(t3.x, true) || [0.5, true], e3.y = I.pointAnchor.parsePercent(t3.y, true) || [0.5, true], true; }, removeOption: function(e3, t3) { var n3 = t3.props, a3 = {}, i3 = e3.element, o3 = n3.options.anchorSE["start" === t3.optionName ? 1 : 0]; i3 === o3 && (i3 = o3 === document.body ? new C2(I.pointAnchor, [i3]) : document.body), a3[t3.optionName] = i3, ot(n3, a3); }, getBBoxNest: function(e3, t3) { var n3 = Ae(e3.element, t3.baseWindow), a3 = n3.width, i3 = n3.height; return n3.width = n3.height = 0, n3.left = n3.right = n3.left + e3.x[0] * (e3.x[1] ? a3 : 1), n3.top = n3.bottom = n3.top + e3.y[0] * (e3.y[1] ? i3 : 1), n3; }, parsePercent: function(e3, t3) { var n3, a3, i3 = false; return ye(e3) ? a3 = e3 : "string" == typeof e3 && (n3 = m2.exec(e3)) && n3[2] && (i3 = 0 !== (a3 = parseFloat(n3[1]) / 100)), null != a3 && (t3 || 0 <= a3) ? [a3, i3] : null; }, checkElement: function(e3) { if (null == e3) e3 = document.body; else if (!Ie(e3)) throw new Error("`element` must be Element"); return e3; } }, areaAnchor: { type: "anchor", argOptions: [{ optionName: "element", type: Ie }, { optionName: "shape", type: "string" }], stats: { color: {}, strokeWidth: {}, elementWidth: {}, elementHeight: {}, elementLeft: {}, elementTop: {}, pathListRel: {}, bBoxRel: {}, pathData: {}, viewBoxBBox: { hasProps: true }, dashLen: {}, dashGap: {} }, init: function(i3, e3) { var t3, n3, a3, o3 = []; return i3.element = I.pointAnchor.checkElement(e3.element), "string" == typeof e3.color && (i3.color = e3.color.trim()), "string" == typeof e3.fillColor && (i3.fill = e3.fillColor.trim()), ye(e3.size) && 0 <= e3.size && (i3.size = e3.size), e3.dash && (i3.dash = true, ye(e3.dash.len) && 0 < e3.dash.len && (i3.dashLen = e3.dash.len), ye(e3.dash.gap) && 0 < e3.dash.gap && (i3.dashGap = e3.dash.gap)), "circle" === e3.shape ? i3.shape = e3.shape : "polygon" === e3.shape && Array.isArray(e3.points) && 3 <= e3.points.length && e3.points.every(function(e4) { var t4 = {}; return !(!(t4.x = I.pointAnchor.parsePercent(e4[0], true)) || !(t4.y = I.pointAnchor.parsePercent(e4[1], true))) && (o3.push(t4), (t4.x[1] || t4.y[1]) && (i3.hasRatio = true), true); }) ? (i3.shape = e3.shape, i3.points = o3) : (i3.shape = "rect", i3.radius = ye(e3.radius) && 0 <= e3.radius ? e3.radius : 0), "rect" !== i3.shape && "circle" !== i3.shape || (i3.x = I.pointAnchor.parsePercent(e3.x, true) || [-0.05, true], i3.y = I.pointAnchor.parsePercent(e3.y, true) || [-0.05, true], i3.width = I.pointAnchor.parsePercent(e3.width) || [1.1, true], i3.height = I.pointAnchor.parsePercent(e3.height) || [1.1, true], (i3.x[1] || i3.y[1] || i3.width[1] || i3.height[1]) && (i3.hasRatio = true)), t3 = i3.element.ownerDocument, i3.svg = n3 = t3.createElementNS(re, "svg"), n3.className.baseVal = A + "-areaAnchor", n3.viewBox.baseVal || n3.setAttribute("viewBox", "0 0 0 0"), i3.path = n3.appendChild(t3.createElementNS(re, "path")), i3.path.style.fill = i3.fill || "none", i3.isShown = false, n3.style.visibility = "hidden", t3.body.appendChild(n3), Ke(a3 = t3.defaultView), i3.bodyOffset = Qe(a3), i3.updateColor = function() { var e4, t4 = i3.curStats, n4 = i3.aplStats, a4 = i3.boundTargets.length ? i3.boundTargets[0].props.curStats : null; t4.color = e4 = i3.color || (a4 ? a4.line_color : de.lineColor), qe(i3, n4, "color", e4) && (i3.path.style.stroke = e4); }, i3.updateShow = function() { $e(i3, i3.boundTargets.some(function(e4) { return true === e4.props.isShown; })); }, true; }, bind: function(e3, t3) { var n3 = t3.props; return e3.color || De(n3, "cur_line_color", e3.updateColor), De(n3, "svgShow", e3.updateShow), je(function() { e3.updateColor(), e3.updateShow(); }), true; }, unbind: function(e3, t3) { var n3 = t3.props; e3.color || ze(n3, "cur_line_color", e3.updateColor), ze(n3, "svgShow", e3.updateShow), 1 < e3.boundTargets.length && je(function() { e3.updateColor(), e3.updateShow(), I.areaAnchor.update(e3) && e3.boundTargets.forEach(function(e4) { et(e4.props, { position: true }); }); }); }, removeOption: function(e3, t3) { I.pointAnchor.removeOption(e3, t3); }, remove: function(t3) { t3.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t3.boundTargets.forEach(function(e3) { I.areaAnchor.unbind(t3, e3); })), t3.svg.parentNode.removeChild(t3.svg); }, getStrokeWidth: function(e3, t3) { return I.areaAnchor.update(e3) && 1 < e3.boundTargets.length && je(function() { e3.boundTargets.forEach(function(e4) { e4.props !== t3 && et(e4.props, { position: true }); }); }), e3.curStats.strokeWidth; }, getPathData: function(e3, t3) { var n3 = Ae(e3.element, t3.baseWindow); return Re(e3.curStats.pathListRel, function(e4) { e4.x += n3.left, e4.y += n3.top; }); }, getBBoxNest: function(e3, t3) { var n3 = Ae(e3.element, t3.baseWindow), a3 = e3.curStats.bBoxRel; return { left: a3.left + n3.left, top: a3.top + n3.top, right: a3.right + n3.left, bottom: a3.bottom + n3.top, width: a3.width, height: a3.height }; }, update: function(t3) { var a3, n3, i3, o3, e3, l3, r3, s3, u3, h3, p3, c3, d3, f3, y3, m3, S3, g2, _3, v3, E3, x3, b3, k2, w3, O3, M3, I2, C3, L3, A2, V3, P3 = t3.curStats, N2 = t3.aplStats, T3 = t3.boundTargets.length ? t3.boundTargets[0].props.curStats : null, W3 = {}; if (W3.strokeWidth = qe(t3, P3, "strokeWidth", null != t3.size ? t3.size : T3 ? T3.line_strokeWidth : de.lineSize), a3 = Ce(t3.element), W3.elementWidth = qe(t3, P3, "elementWidth", a3.width), W3.elementHeight = qe(t3, P3, "elementHeight", a3.height), W3.elementLeft = qe(t3, P3, "elementLeft", a3.left), W3.elementTop = qe(t3, P3, "elementTop", a3.top), W3.strokeWidth || t3.hasRatio && (W3.elementWidth || W3.elementHeight)) { switch (t3.shape) { case "rect": (I2 = { left: t3.x[0] * (t3.x[1] ? a3.width : 1), top: t3.y[0] * (t3.y[1] ? a3.height : 1), width: t3.width[0] * (t3.width[1] ? a3.width : 1), height: t3.height[0] * (t3.height[1] ? a3.height : 1) }).right = I2.left + I2.width, I2.bottom = I2.top + I2.height, b3 = P3.strokeWidth / 2, E3 = (x3 = Math.min(I2.width, I2.height)) ? x3 / 2 * Math.SQRT2 + b3 : 0, O3 = (v3 = t3.radius ? t3.radius <= E3 ? t3.radius : E3 : 0) ? (w3 = v3 - (k2 = (v3 - b3) / Math.SQRT2), M3 = v3 * ee, O3 = [{ x: I2.left - w3, y: I2.top + k2 }, { x: I2.left + k2, y: I2.top - w3 }, { x: I2.right - k2, y: I2.top - w3 }, { x: I2.right + w3, y: I2.top + k2 }, { x: I2.right + w3, y: I2.bottom - k2 }, { x: I2.right - k2, y: I2.bottom + w3 }, { x: I2.left + k2, y: I2.bottom + w3 }, { x: I2.left - w3, y: I2.bottom - k2 }], P3.pathListRel = [[O3[0], { x: O3[0].x, y: O3[0].y - M3 }, { x: O3[1].x - M3, y: O3[1].y }, O3[1]]], O3[1].x !== O3[2].x && P3.pathListRel.push([O3[1], O3[2]]), P3.pathListRel.push([O3[2], { x: O3[2].x + M3, y: O3[2].y }, { x: O3[3].x, y: O3[3].y - M3 }, O3[3]]), O3[3].y !== O3[4].y && P3.pathListRel.push([O3[3], O3[4]]), P3.pathListRel.push([O3[4], { x: O3[4].x, y: O3[4].y + M3 }, { x: O3[5].x + M3, y: O3[5].y }, O3[5]]), O3[5].x !== O3[6].x && P3.pathListRel.push([O3[5], O3[6]]), P3.pathListRel.push([O3[6], { x: O3[6].x - M3, y: O3[6].y }, { x: O3[7].x, y: O3[7].y + M3 }, O3[7]]), O3[7].y !== O3[0].y && P3.pathListRel.push([O3[7], O3[0]]), P3.pathListRel.push([]), w3 = v3 - k2 + P3.strokeWidth / 2, [{ x: I2.left - w3, y: I2.top - w3 }, { x: I2.right + w3, y: I2.bottom + w3 }]) : (w3 = P3.strokeWidth / 2, O3 = [{ x: I2.left - w3, y: I2.top - w3 }, { x: I2.right + w3, y: I2.bottom + w3 }], P3.pathListRel = [[O3[0], { x: O3[1].x, y: O3[0].y }], [{ x: O3[1].x, y: O3[0].y }, O3[1]], [O3[1], { x: O3[0].x, y: O3[1].y }], []], [{ x: I2.left - P3.strokeWidth, y: I2.top - P3.strokeWidth }, { x: I2.right + P3.strokeWidth, y: I2.bottom + P3.strokeWidth }]), P3.bBoxRel = { left: O3[0].x, top: O3[0].y, right: O3[1].x, bottom: O3[1].y, width: O3[1].x - O3[0].x, height: O3[1].y - O3[0].y }; break; case "circle": (_3 = { left: t3.x[0] * (t3.x[1] ? a3.width : 1), top: t3.y[0] * (t3.y[1] ? a3.height : 1), width: t3.width[0] * (t3.width[1] ? a3.width : 1), height: t3.height[0] * (t3.height[1] ? a3.height : 1) }).width || _3.height || (_3.width = _3.height = 10), _3.width || (_3.width = _3.height), _3.height || (_3.height = _3.width), _3.right = _3.left + _3.width, _3.bottom = _3.top + _3.height, r3 = _3.left + _3.width / 2, s3 = _3.top + _3.height / 2, d3 = P3.strokeWidth / 2, f3 = _3.width / 2, y3 = _3.height / 2, u3 = f3 * Math.SQRT2 + d3, h3 = y3 * Math.SQRT2 + d3, p3 = u3 * ee, c3 = h3 * ee, g2 = [{ x: r3 - u3, y: s3 }, { x: r3, y: s3 - h3 }, { x: r3 + u3, y: s3 }, { x: r3, y: s3 + h3 }], P3.pathListRel = [[g2[0], { x: g2[0].x, y: g2[0].y - c3 }, { x: g2[1].x - p3, y: g2[1].y }, g2[1]], [g2[1], { x: g2[1].x + p3, y: g2[1].y }, { x: g2[2].x, y: g2[2].y - c3 }, g2[2]], [g2[2], { x: g2[2].x, y: g2[2].y + c3 }, { x: g2[3].x + p3, y: g2[3].y }, g2[3]], [g2[3], { x: g2[3].x - p3, y: g2[3].y }, { x: g2[0].x, y: g2[0].y + c3 }, g2[0]], []], m3 = u3 - f3 + P3.strokeWidth / 2, S3 = h3 - y3 + P3.strokeWidth / 2, g2 = [{ x: _3.left - m3, y: _3.top - S3 }, { x: _3.right + m3, y: _3.bottom + S3 }], P3.bBoxRel = { left: g2[0].x, top: g2[0].y, right: g2[1].x, bottom: g2[1].y, width: g2[1].x - g2[0].x, height: g2[1].y - g2[0].y }; break; case "polygon": t3.points.forEach(function(e4) { var t4 = e4.x[0] * (e4.x[1] ? a3.width : 1), n4 = e4.y[0] * (e4.y[1] ? a3.height : 1); i3 ? (t4 < i3.left && (i3.left = t4), t4 > i3.right && (i3.right = t4), n4 < i3.top && (i3.top = n4), n4 > i3.bottom && (i3.bottom = n4)) : i3 = { left: t4, right: t4, top: n4, bottom: n4 }, o3 ? P3.pathListRel.push([o3, { x: t4, y: n4 }]) : P3.pathListRel = [], o3 = { x: t4, y: n4 }; }), P3.pathListRel.push([]), e3 = P3.strokeWidth / 2, l3 = [{ x: i3.left - e3, y: i3.top - e3 }, { x: i3.right + e3, y: i3.bottom + e3 }], P3.bBoxRel = { left: l3[0].x, top: l3[0].y, right: l3[1].x, bottom: l3[1].y, width: l3[1].x - l3[0].x, height: l3[1].y - l3[0].y }; } W3.pathListRel = W3.bBoxRel = true; } return (W3.pathListRel || W3.elementLeft || W3.elementTop) && (P3.pathData = Re(P3.pathListRel, function(e4) { e4.x += a3.left, e4.y += a3.top; })), qe(t3, N2, "strokeWidth", n3 = P3.strokeWidth) && (t3.path.style.strokeWidth = n3 + "px"), Ge(n3 = P3.pathData, N2.pathData) && (t3.path.setPathData(n3), N2.pathData = n3, W3.pathData = true), t3.dash && (!W3.pathData && (!W3.strokeWidth || t3.dashLen && t3.dashGap) || (P3.dashLen = t3.dashLen || 2 * P3.strokeWidth, P3.dashGap = t3.dashGap || P3.strokeWidth), W3.dash = qe(t3, N2, "dashLen", P3.dashLen) || W3.dash, W3.dash = qe(t3, N2, "dashGap", P3.dashGap) || W3.dash, W3.dash && (t3.path.style.strokeDasharray = N2.dashLen + "," + N2.dashGap)), C3 = P3.viewBoxBBox, L3 = N2.viewBoxBBox, A2 = t3.svg.viewBox.baseVal, V3 = t3.svg.style, C3.x = P3.bBoxRel.left + a3.left, C3.y = P3.bBoxRel.top + a3.top, C3.width = P3.bBoxRel.width, C3.height = P3.bBoxRel.height, ["x", "y", "width", "height"].forEach(function(e4) { (n3 = C3[e4]) !== L3[e4] && (A2[e4] = L3[e4] = n3, V3[oe[e4]] = n3 + ("x" === e4 || "y" === e4 ? t3.bodyOffset[e4] : 0) + "px"); }), W3.strokeWidth || W3.pathListRel || W3.bBoxRel; } }, mouseHoverAnchor: { type: "anchor", argOptions: [{ optionName: "element", type: Ie }, { optionName: "showEffectName", type: "string" }], style: { backgroundImage: "url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cG9seWdvbiBwb2ludHM9IjI0LDAgMCw4IDgsMTEgMCwxOSA1LDI0IDEzLDE2IDE2LDI0IiBmaWxsPSJjb3JhbCIvPjwvc3ZnPg==')", backgroundSize: "", backgroundRepeat: "no-repeat", backgroundColor: "#f8f881", cursor: "default" }, hoverStyle: { backgroundImage: "none", backgroundColor: "#fadf8f" }, padding: { top: 1, right: 15, bottom: 1, left: 2 }, minHeight: 15, backgroundPosition: { right: 2, top: 2 }, backgroundSize: { width: 12, height: 12 }, dirKeys: [["top", "Top"], ["right", "Right"], ["bottom", "Bottom"], ["left", "Left"]], init: function(a3, i3) { var o3, t3, e3, n3, l3, r3, s3, u3, h3, p3, c3, d3 = I.mouseHoverAnchor, f3 = {}; if (a3.element = I.pointAnchor.checkElement(i3.element), u3 = a3.element, !((p3 = u3.ownerDocument) && (h3 = p3.defaultView) && h3.HTMLElement && u3 instanceof h3.HTMLElement)) throw new Error("`element` must be HTML element"); return d3.style.backgroundSize = d3.backgroundSize.width + "px " + d3.backgroundSize.height + "px", ["style", "hoverStyle"].forEach(function(e4) { var n4 = d3[e4]; a3[e4] = Object.keys(n4).reduce(function(e5, t4) { return e5[t4] = n4[t4], e5; }, {}); }), "inline" === (o3 = a3.element.ownerDocument.defaultView.getComputedStyle(a3.element, "")).display ? a3.style.display = "inline-block" : "none" === o3.display && (a3.style.display = "block"), I.mouseHoverAnchor.dirKeys.forEach(function(e4) { var t4 = e4[0], n4 = "padding" + e4[1]; parseFloat(o3[n4]) < d3.padding[t4] && (a3.style[n4] = d3.padding[t4] + "px"); }), a3.style.display && (n3 = a3.element.style.display, a3.element.style.display = a3.style.display), I.mouseHoverAnchor.dirKeys.forEach(function(e4) { var t4 = "padding" + e4[1]; a3.style[t4] && (f3[t4] = a3.element.style[t4], a3.element.style[t4] = a3.style[t4]); }), (e3 = a3.element.getBoundingClientRect()).height < d3.minHeight && (se ? (c3 = d3.minHeight, "content-box" === o3.boxSizing ? c3 -= parseFloat(o3.borderTopWidth) + parseFloat(o3.borderBottomWidth) + parseFloat(o3.paddingTop) + parseFloat(o3.paddingBottom) : "padding-box" === o3.boxSizing && (c3 -= parseFloat(o3.borderTopWidth) + parseFloat(o3.borderBottomWidth)), a3.style.height = c3 + "px") : a3.style.height = parseFloat(o3.height) + (d3.minHeight - e3.height) + "px"), a3.style.backgroundPosition = pe ? e3.width - d3.backgroundSize.width - d3.backgroundPosition.right + "px " + d3.backgroundPosition.top + "px" : "right " + d3.backgroundPosition.right + "px top " + d3.backgroundPosition.top + "px", a3.style.display && (a3.element.style.display = n3), I.mouseHoverAnchor.dirKeys.forEach(function(e4) { var t4 = "padding" + e4[1]; a3.style[t4] && (a3.element.style[t4] = f3[t4]); }), ["style", "hoverStyle"].forEach(function(e4) { var t4 = a3[e4], n4 = i3[e4]; fe(n4) && Object.keys(n4).forEach(function(e5) { "string" == typeof n4[e5] || ye(n4[e5]) ? t4[e5] = n4[e5] : null == n4[e5] && delete t4[e5]; }); }), "function" == typeof i3.onSwitch && (s3 = i3.onSwitch), i3.showEffectName && M2[i3.showEffectName] && (a3.showEffectName = l3 = i3.showEffectName), r3 = i3.animOptions, a3.elmStyle = t3 = a3.element.style, a3.mouseenter = function(e4) { a3.hoverStyleSave = d3.getStyles(t3, Object.keys(a3.hoverStyle)), d3.setStyles(t3, a3.hoverStyle), a3.boundTargets.forEach(function(e5) { nt(e5.props, true, l3, r3); }), s3 && s3(e4); }, a3.mouseleave = function(e4) { d3.setStyles(t3, a3.hoverStyleSave), a3.boundTargets.forEach(function(e5) { nt(e5.props, false, l3, r3); }), s3 && s3(e4); }, true; }, bind: function(e3, t3) { var n3, a3, i3, o3, l3; return t3.props.svg ? I.mouseHoverAnchor.llShow(t3.props, false, e3.showEffectName) : je(function() { I.mouseHoverAnchor.llShow(t3.props, false, e3.showEffectName); }), e3.enabled || (e3.styleSave = I.mouseHoverAnchor.getStyles(e3.elmStyle, Object.keys(e3.style)), I.mouseHoverAnchor.setStyles(e3.elmStyle, e3.style), e3.removeEventListener = (n3 = e3.element, a3 = e3.mouseenter, i3 = e3.mouseleave, "onmouseenter" in n3 && "onmouseleave" in n3 ? (n3.addEventListener("mouseenter", a3, false), n3.addEventListener("mouseleave", i3, false), function() { n3.removeEventListener("mouseenter", a3, false), n3.removeEventListener("mouseleave", i3, false); }) : (console.warn("mouseenter and mouseleave events polyfill is enabled."), o3 = function(e4) { e4.relatedTarget && (e4.relatedTarget === this || this.compareDocumentPosition(e4.relatedTarget) & Node.DOCUMENT_POSITION_CONTAINED_BY) || a3.apply(this, arguments); }, n3.addEventListener("mouseover", o3), l3 = function(e4) { e4.relatedTarget && (e4.relatedTarget === this || this.compareDocumentPosition(e4.relatedTarget) & Node.DOCUMENT_POSITION_CONTAINED_BY) || i3.apply(this, arguments); }, n3.addEventListener("mouseout", l3), function() { n3.removeEventListener("mouseover", o3, false), n3.removeEventListener("mouseout", l3, false); })), e3.enabled = true), true; }, unbind: function(e3, t3) { e3.enabled && e3.boundTargets.length <= 1 && (e3.removeEventListener(), I.mouseHoverAnchor.setStyles(e3.elmStyle, e3.styleSave), e3.enabled = false), I.mouseHoverAnchor.llShow(t3.props, true, e3.showEffectName); }, removeOption: function(e3, t3) { I.pointAnchor.removeOption(e3, t3); }, remove: function(t3) { t3.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t3.boundTargets.forEach(function(e3) { I.mouseHoverAnchor.unbind(t3, e3); })); }, getBBoxNest: function(e3, t3) { return Ae(e3.element, t3.baseWindow); }, llShow: function(e3, t3, n3) { M2[n3 || e3.curStats.show_effect].stop(e3, true, t3), e3.aplStats.show_on = t3; }, getStyles: function(n3, e3) { return e3.reduce(function(e4, t3) { return e4[t3] = n3[t3], e4; }, {}); }, setStyles: function(t3, n3) { Object.keys(n3).forEach(function(e3) { t3[e3] = n3[e3]; }); } }, captionLabel: { type: "label", argOptions: [{ optionName: "text", type: "string" }], stats: { color: {}, x: {}, y: {} }, textStyleProps: ["fontFamily", "fontStyle", "fontVariant", "fontWeight", "fontStretch", "fontSize", "fontSizeAdjust", "kerning", "letterSpacing", "wordSpacing", "textDecoration"], init: function(u3, t3) { return "string" == typeof t3.text && (u3.text = t3.text.trim()), !!u3.text && ("string" == typeof t3.color && (u3.color = t3.color.trim()), u3.outlineColor = "string" == typeof t3.outlineColor ? t3.outlineColor.trim() : "#fff", Array.isArray(t3.offset) && ye(t3.offset[0]) && ye(t3.offset[1]) && (u3.offset = { x: t3.offset[0], y: t3.offset[1] }), ye(t3.lineOffset) && (u3.lineOffset = t3.lineOffset), I.captionLabel.textStyleProps.forEach(function(e3) { null != t3[e3] && (u3[e3] = t3[e3]); }), u3.updateColor = function(e3) { I.captionLabel.updateColor(u3, e3); }, u3.updateSocketXY = function(e3) { var t4, n3, a3, i3, o3 = u3.curStats, l3 = u3.aplStats, r3 = e3.curStats, s3 = r3.position_socketXYSE[u3.socketIndex]; null != s3.x && (u3.offset ? (o3.x = s3.x + u3.offset.x, o3.y = s3.y + u3.offset.y) : (t4 = u3.height / 2, n3 = Math.max(r3.attach_plugSideLenSE[u3.socketIndex] || 0, r3.line_strokeWidth / 2), a3 = r3.position_socketXYSE[u3.socketIndex ? 0 : 1], s3.socketId === T2 || s3.socketId === P2 ? (o3.x = s3.socketId === T2 ? s3.x - t4 - u3.width : s3.x + t4, o3.y = a3.y < s3.y ? s3.y + n3 + t4 : s3.y - n3 - t4 - u3.height) : (o3.x = a3.x < s3.x ? s3.x + n3 + t4 : s3.x - n3 - t4 - u3.width, o3.y = s3.socketId === V2 ? s3.y - t4 - u3.height : s3.y + t4)), qe(u3, l3, "x", i3 = o3.x) && (u3.elmPosition.x.baseVal.getItem(0).value = i3), qe(u3, l3, "y", i3 = o3.y) && (u3.elmPosition.y.baseVal.getItem(0).value = i3 + u3.height)); }, u3.updatePath = function(e3) { var t4, n3, a3 = u3.curStats, i3 = u3.aplStats, o3 = e3.pathList.animVal || e3.pathList.baseVal; o3 && (t4 = I.captionLabel.getMidPoint(o3, u3.lineOffset), a3.x = t4.x - u3.width / 2, a3.y = t4.y - u3.height / 2, qe(u3, i3, "x", n3 = a3.x) && (u3.elmPosition.x.baseVal.getItem(0).value = n3), qe(u3, i3, "y", n3 = a3.y) && (u3.elmPosition.y.baseVal.getItem(0).value = n3 + u3.height)); }, u3.updateShow = function(e3) { I.captionLabel.updateShow(u3, e3); }, pe && (u3.adjustEdge = function(e3, t4) { var n3 = u3.curStats; null != n3.x && I.captionLabel.adjustEdge(t4, { x: n3.x, y: n3.y, width: u3.width, height: u3.height }, u3.strokeWidth / 2); }), true); }, updateColor: function(e3, t3) { var n3, a3 = e3.curStats, i3 = e3.aplStats, o3 = t3.curStats; a3.color = n3 = e3.color || o3.line_color, qe(e3, i3, "color", n3) && (e3.styleFill.fill = n3); }, updateShow: function(e3, t3) { var n3 = true === t3.isShown; n3 !== e3.isShown && (e3.styleShow.visibility = n3 ? "" : "hidden", e3.isShown = n3); }, adjustEdge: function(e3, t3, n3) { var a3 = { x1: t3.x - n3, y1: t3.y - n3, x2: t3.x + t3.width + n3, y2: t3.y + t3.height + n3 }; a3.x1 < e3.x1 && (e3.x1 = a3.x1), a3.y1 < e3.y1 && (e3.y1 = a3.y1), a3.x2 > e3.x2 && (e3.x2 = a3.x2), a3.y2 > e3.y2 && (e3.y2 = a3.y2); }, newText: function(e3, t3, n3, a3, i3) { var o3, l3, r3, s3, u3, h3 = t3.createElementNS(re, "text"); return h3.textContent = e3, [h3.x, h3.y].forEach(function(e4) { var t4 = n3.createSVGLength(); t4.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), e4.baseVal.initialize(t4); }), "boolean" != typeof f2 && (f2 = "paintOrder" in h3.style), i3 && !f2 ? (l3 = t3.createElementNS(re, "defs"), h3.id = a3, l3.appendChild(h3), (s3 = (o3 = t3.createElementNS(re, "g")).appendChild(t3.createElementNS(re, "use"))).href.baseVal = "#" + a3, (r3 = o3.appendChild(t3.createElementNS(re, "use"))).href.baseVal = "#" + a3, (u3 = s3.style).strokeLinejoin = "round", { elmPosition: h3, styleText: h3.style, styleFill: r3.style, styleStroke: u3, styleShow: o3.style, elmsAppend: [l3, o3] }) : (u3 = h3.style, i3 && (u3.strokeLinejoin = "round", u3.paintOrder = "stroke"), { elmPosition: h3, styleText: u3, styleFill: u3, styleStroke: i3 ? u3 : null, styleShow: u3, elmsAppend: [h3] }); }, getMidPoint: function(e3, t3) { var n3, a3, i3 = Fe(e3), o3 = i3.segsLen, l3 = i3.lenAll, r3 = -1, s3 = l3 / 2 + (t3 || 0); if (s3 <= 0) return 2 === (n3 = e3[0]).length ? Pe(n3[0], n3[1], 0) : Te(n3[0], n3[1], n3[2], n3[3], 0); if (l3 <= s3) return 2 === (n3 = e3[e3.length - 1]).length ? Pe(n3[0], n3[1], 1) : Te(n3[0], n3[1], n3[2], n3[3], 1); for (a3 = []; s3 > o3[++r3]; ) a3.push(e3[r3]), s3 -= o3[r3]; return 2 === (n3 = e3[r3]).length ? Pe(n3[0], n3[1], s3 / o3[r3]) : Te(n3[0], n3[1], n3[2], n3[3], Be(n3[0], n3[1], n3[2], n3[3], s3)); }, initSvg: function(t3, n3) { var e3, a3, i3 = I.captionLabel.newText(t3.text, n3.baseWindow.document, n3.svg, A + "-captionLabel-" + t3._id, t3.outlineColor); ["elmPosition", "styleFill", "styleShow", "elmsAppend"].forEach(function(e4) { t3[e4] = i3[e4]; }), t3.isShown = false, t3.styleShow.visibility = "hidden", I.captionLabel.textStyleProps.forEach(function(e4) { null != t3[e4] && (i3.styleText[e4] = t3[e4]); }), i3.elmsAppend.forEach(function(e4) { n3.svg.appendChild(e4); }), e3 = i3.elmPosition.getBBox(), t3.width = e3.width, t3.height = e3.height, t3.outlineColor && (a3 = 10 < (a3 = e3.height / 9) ? 10 : a3 < 2 ? 2 : a3, i3.styleStroke.strokeWidth = a3 + "px", i3.styleStroke.stroke = t3.outlineColor), t3.strokeWidth = a3 || 0, Xe(t3.aplStats, I.captionLabel.stats), t3.updateColor(n3), t3.refSocketXY ? t3.updateSocketXY(n3) : t3.updatePath(n3), pe && et(n3, {}), t3.updateShow(n3); }, bind: function(e3, t3) { var n3 = t3.props; return e3.color || De(n3, "cur_line_color", e3.updateColor), (e3.refSocketXY = "startLabel" === t3.optionName || "endLabel" === t3.optionName) ? (e3.socketIndex = "startLabel" === t3.optionName ? 0 : 1, De(n3, "apl_position", e3.updateSocketXY), e3.offset || (De(n3, "cur_attach_plugSideLenSE", e3.updateSocketXY), De(n3, "cur_line_strokeWidth", e3.updateSocketXY))) : De(n3, "apl_path", e3.updatePath), De(n3, "svgShow", e3.updateShow), pe && De(n3, "new_edge4viewBox", e3.adjustEdge), I.captionLabel.initSvg(e3, n3), true; }, unbind: function(e3, t3) { var n3 = t3.props; e3.elmsAppend && (e3.elmsAppend.forEach(function(e4) { n3.svg.removeChild(e4); }), e3.elmPosition = e3.styleFill = e3.styleShow = e3.elmsAppend = null), Xe(e3.curStats, I.captionLabel.stats), Xe(e3.aplStats, I.captionLabel.stats), e3.color || ze(n3, "cur_line_color", e3.updateColor), e3.refSocketXY ? (ze(n3, "apl_position", e3.updateSocketXY), e3.offset || (ze(n3, "cur_attach_plugSideLenSE", e3.updateSocketXY), ze(n3, "cur_line_strokeWidth", e3.updateSocketXY))) : ze(n3, "apl_path", e3.updatePath), ze(n3, "svgShow", e3.updateShow), pe && (ze(n3, "new_edge4viewBox", e3.adjustEdge), et(n3, {})); }, removeOption: function(e3, t3) { var n3 = t3.props, a3 = {}; a3[t3.optionName] = "", ot(n3, a3); }, remove: function(t3) { t3.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t3.boundTargets.forEach(function(e3) { I.captionLabel.unbind(t3, e3); })); } }, pathLabel: { type: "label", argOptions: [{ optionName: "text", type: "string" }], stats: { color: {}, startOffset: {}, pathData: {} }, init: function(s3, t3) { return "string" == typeof t3.text && (s3.text = t3.text.trim()), !!s3.text && ("string" == typeof t3.color && (s3.color = t3.color.trim()), s3.outlineColor = "string" == typeof t3.outlineColor ? t3.outlineColor.trim() : "#fff", ye(t3.lineOffset) && (s3.lineOffset = t3.lineOffset), I.captionLabel.textStyleProps.forEach(function(e3) { null != t3[e3] && (s3[e3] = t3[e3]); }), s3.updateColor = function(e3) { I.captionLabel.updateColor(s3, e3); }, s3.updatePath = function(e3) { var t4, n3 = s3.curStats, a3 = s3.aplStats, i3 = e3.curStats, o3 = e3.pathList.animVal || e3.pathList.baseVal; o3 && (n3.pathData = t4 = I.pathLabel.getOffsetPathData(o3, i3.line_strokeWidth / 2 + s3.strokeWidth / 2 + s3.height / 4, 1.25 * s3.height), Ge(t4, a3.pathData) && (s3.elmPath.setPathData(t4), a3.pathData = t4, s3.bBox = s3.elmPosition.getBBox(), s3.updateStartOffset(e3))); }, s3.updateStartOffset = function(e3) { var t4, i3, n3, a3, o3 = s3.curStats, l3 = s3.aplStats, r3 = e3.curStats; o3.pathData && (2 === s3.semIndex && !s3.lineOffset || (n3 = o3.pathData.reduce(function(e4, t5) { var n4, a4 = t5.values; switch (t5.type) { case "M": i3 = { x: a4[0], y: a4[1] }; break; case "L": n4 = { x: a4[0], y: a4[1] }, i3 && (e4 += Ve(i3, n4)), i3 = n4; break; case "C": n4 = { x: a4[4], y: a4[5] }, i3 && (e4 += We(i3, { x: a4[0], y: a4[1] }, { x: a4[2], y: a4[3] }, n4)), i3 = n4; } return e4; }, 0), a3 = 0 === s3.semIndex ? 0 : 1 === s3.semIndex ? n3 : n3 / 2, 2 !== s3.semIndex && (t4 = Math.max(r3.attach_plugBackLenSE[s3.semIndex] || 0, r3.line_strokeWidth / 2) + s3.strokeWidth / 2 + s3.height / 4, a3 = (a3 += 0 === s3.semIndex ? t4 : -t4) < 0 ? 0 : n3 < a3 ? n3 : a3), s3.lineOffset && (a3 = (a3 += s3.lineOffset) < 0 ? 0 : n3 < a3 ? n3 : a3), o3.startOffset = a3, qe(s3, l3, "startOffset", a3) && (s3.elmOffset.startOffset.baseVal.value = a3))); }, s3.updateShow = function(e3) { I.captionLabel.updateShow(s3, e3); }, pe && (s3.adjustEdge = function(e3, t4) { s3.bBox && I.captionLabel.adjustEdge(t4, s3.bBox, s3.strokeWidth / 2); }), true); }, getOffsetPathData: function(e3, x3, n3) { var b3, a3, k2 = []; function w3(e4, t3) { return Math.abs(e4.x - t3.x) < 3 && Math.abs(e4.y - t3.y) < 3; } return e3.forEach(function(e4) { var t3, n4, a4, i3, o3, l3, r3, s3, u3, h3, p3, c3, d3, f3, y3, m3, S3, g2, _3, v3, E3; 2 === e4.length ? (g2 = e4[0], _3 = e4[1], v3 = x3, E3 = Math.atan2(g2.y - _3.y, _3.x - g2.x) + 0.5 * Math.PI, t3 = [{ x: g2.x + Math.cos(E3) * v3, y: g2.y + Math.sin(E3) * v3 * -1 }, { x: _3.x + Math.cos(E3) * v3, y: _3.y + Math.sin(E3) * v3 * -1 }], b3 ? (a4 = b3.points, 0 <= (i3 = Math.atan2(a4[1].y - a4[0].y, a4[0].x - a4[1].x) - Math.atan2(e4[0].y - e4[1].y, e4[1].x - e4[0].x)) && i3 <= Math.PI ? n4 = { type: "line", points: t3, inside: true } : (l3 = Ne(a4[0], a4[1], x3), o3 = Ne(t3[1], t3[0], x3), s3 = a4[0], h3 = o3, p3 = t3[1], c3 = (u3 = l3).x - s3.x, d3 = u3.y - s3.y, f3 = p3.x - h3.x, y3 = p3.y - h3.y, m3 = (-d3 * (s3.x - h3.x) + c3 * (s3.y - h3.y)) / (-f3 * d3 + c3 * y3), S3 = (f3 * (s3.y - h3.y) - y3 * (s3.x - h3.x)) / (-f3 * d3 + c3 * y3), n4 = (r3 = 0 <= m3 && m3 <= 1 && 0 <= S3 && S3 <= 1 ? { x: s3.x + S3 * c3, y: s3.y + S3 * d3 } : null) ? { type: "line", points: [a4[1] = r3, t3[1]] } : (a4[1] = w3(o3, l3) ? o3 : l3, { type: "line", points: [o3, t3[1]] }), b3.len = Ve(a4[0], a4[1]))) : n4 = { type: "line", points: t3 }, n4.len = Ve(n4.points[0], n4.points[1]), k2.push(b3 = n4)) : (k2.push({ type: "cubic", points: function(e5, t4, n5, a5, i4, o4) { for (var l4, r4, s4 = We(e5, t4, n5, a5) / o4, u4 = 1 / (o4 < i4 ? i4 / o4 * s4 : s4), h4 = [], p4 = 0; r4 = (90 - (l4 = Te(e5, t4, n5, a5, p4)).angle) * (Math.PI / 180), h4.push({ x: l4.x + Math.cos(r4) * i4, y: l4.y + Math.sin(r4) * i4 * -1 }), !(1 <= p4); ) 1 < (p4 += u4) && (p4 = 1); return h4; }(e4[0], e4[1], e4[2], e4[3], x3, 16) }), b3 = null); }), b3 = null, k2.forEach(function(e4) { var t3; b3 = "line" === e4.type ? (e4.inside && (b3.len > x3 ? ((t3 = b3.points)[1] = Ne(t3[0], t3[1], -x3), b3.len = Ve(t3[0], t3[1])) : (b3.points = null, b3.len = 0), e4.len > x3 + n3 ? ((t3 = e4.points)[0] = Ne(t3[1], t3[0], -(x3 + n3)), e4.len = Ve(t3[0], t3[1])) : (e4.points = null, e4.len = 0)), e4) : null; }), k2.reduce(function(t3, e4) { var n4 = e4.points; return n4 && (a3 && w3(n4[0], a3) || t3.push({ type: "M", values: [n4[0].x, n4[0].y] }), "line" === e4.type ? t3.push({ type: "L", values: [n4[1].x, n4[1].y] }) : (n4.shift(), n4.forEach(function(e5) { t3.push({ type: "L", values: [e5.x, e5.y] }); })), a3 = n4[n4.length - 1]), t3; }, []); }, newText: function(e3, t3, n3, a3) { var i3, o3, l3, r3, s3, u3, h3, p3, c3 = t3.createElementNS(re, "defs"), d3 = c3.appendChild(t3.createElementNS(re, "path")); return d3.id = i3 = n3 + "-path", (r3 = (l3 = t3.createElementNS(re, "text")).appendChild(t3.createElementNS(re, "textPath"))).href.baseVal = "#" + i3, r3.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), r3.textContent = e3, "boolean" != typeof f2 && (f2 = "paintOrder" in l3.style), a3 && !f2 ? (l3.id = o3 = n3 + "-text", c3.appendChild(l3), (h3 = (s3 = t3.createElementNS(re, "g")).appendChild(t3.createElementNS(re, "use"))).href.baseVal = "#" + o3, (u3 = s3.appendChild(t3.createElementNS(re, "use"))).href.baseVal = "#" + o3, (p3 = h3.style).strokeLinejoin = "round", { elmPosition: l3, elmPath: d3, elmOffset: r3, styleText: l3.style, styleFill: u3.style, styleStroke: p3, styleShow: s3.style, elmsAppend: [c3, s3] }) : (p3 = l3.style, a3 && (p3.strokeLinejoin = "round", p3.paintOrder = "stroke"), { elmPosition: l3, elmPath: d3, elmOffset: r3, styleText: p3, styleFill: p3, styleStroke: a3 ? p3 : null, styleShow: p3, elmsAppend: [c3, l3] }); }, initSvg: function(t3, n3) { var e3, a3, i3 = I.pathLabel.newText(t3.text, n3.baseWindow.document, A + "-pathLabel-" + t3._id, t3.outlineColor); ["elmPosition", "elmPath", "elmOffset", "styleFill", "styleShow", "elmsAppend"].forEach(function(e4) { t3[e4] = i3[e4]; }), t3.isShown = false, t3.styleShow.visibility = "hidden", I.captionLabel.textStyleProps.forEach(function(e4) { null != t3[e4] && (i3.styleText[e4] = t3[e4]); }), i3.elmsAppend.forEach(function(e4) { n3.svg.appendChild(e4); }), i3.elmPath.setPathData([{ type: "M", values: [0, 100] }, { type: "h", values: [100] }]), e3 = i3.elmPosition.getBBox(), i3.styleText.textAnchor = ["start", "end", "middle"][t3.semIndex], 2 !== t3.semIndex || t3.lineOffset || i3.elmOffset.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 50), t3.height = e3.height, t3.outlineColor && (a3 = 10 < (a3 = e3.height / 9) ? 10 : a3 < 2 ? 2 : a3, i3.styleStroke.strokeWidth = a3 + "px", i3.styleStroke.stroke = t3.outlineColor), t3.strokeWidth = a3 || 0, Xe(t3.aplStats, I.pathLabel.stats), t3.updateColor(n3), t3.updatePath(n3), t3.updateStartOffset(n3), pe && et(n3, {}), t3.updateShow(n3); }, bind: function(e3, t3) { var n3 = t3.props; return e3.color || De(n3, "cur_line_color", e3.updateColor), De(n3, "cur_line_strokeWidth", e3.updatePath), De(n3, "apl_path", e3.updatePath), e3.semIndex = "startLabel" === t3.optionName ? 0 : "endLabel" === t3.optionName ? 1 : 2, 2 === e3.semIndex && !e3.lineOffset || De(n3, "cur_attach_plugBackLenSE", e3.updateStartOffset), De(n3, "svgShow", e3.updateShow), pe && De(n3, "new_edge4viewBox", e3.adjustEdge), I.pathLabel.initSvg(e3, n3), true; }, unbind: function(e3, t3) { var n3 = t3.props; e3.elmsAppend && (e3.elmsAppend.forEach(function(e4) { n3.svg.removeChild(e4); }), e3.elmPosition = e3.elmPath = e3.elmOffset = e3.styleFill = e3.styleShow = e3.elmsAppend = null), Xe(e3.curStats, I.pathLabel.stats), Xe(e3.aplStats, I.pathLabel.stats), e3.color || ze(n3, "cur_line_color", e3.updateColor), ze(n3, "cur_line_strokeWidth", e3.updatePath), ze(n3, "apl_path", e3.updatePath), 2 === e3.semIndex && !e3.lineOffset || ze(n3, "cur_attach_plugBackLenSE", e3.updateStartOffset), ze(n3, "svgShow", e3.updateShow), pe && (ze(n3, "new_edge4viewBox", e3.adjustEdge), et(n3, {})); }, removeOption: function(e3, t3) { var n3 = t3.props, a3 = {}; a3[t3.optionName] = "", ot(n3, a3); }, remove: function(t3) { t3.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t3.boundTargets.forEach(function(e3) { I.pathLabel.unbind(t3, e3); })); } } }, Object.keys(I).forEach(function(e3) { lt[e3] = function() { return new C2(I[e3], Array.prototype.slice.call(arguments)); }; }), lt.positionByWindowResize = true, window.addEventListener("resize", v2.add(function() { lt.positionByWindowResize && Object.keys(ge).forEach(function(e3) { et(ge[e3], { position: true }); }); }), false), lt; }(); !function(e2, t2) { module.exports = t2(); }(commonjsGlobal, function() { return LeaderLine2; }); })(leaderLine_min); var leaderLine_minExports = leaderLine_min.exports; const LeaderLine = /* @__PURE__ */ getDefaultExportFromCjs(leaderLine_minExports); let ConfigContext = React.createContext({}); let CodeContext$1 = React.createContext(void 0); let PathContext = React.createContext([]); let ErrorContext = React.createContext(void 0); let codeRange = (view, range) => { let start = linecolToPosition(range.start, view.state.doc); let end = linecolToPosition(range.end, view.state.doc); return view.state.doc.sliceString(start, end); }; let AbbreviatedView = ({ value }) => { let pathCtx = reactExports.useContext(PathContext); let IndexedContainer = ({ children, index: index2 }) => { let path = [...pathCtx, "index", index2.toString()]; return React.createElement( PathContext.Provider, { value: path }, React.createElement("td", { className: path.join("-"), "data-connector": "bottom" }, children) ); }; return React.createElement( "table", { className: "array" }, React.createElement( "tbody", null, React.createElement("tr", null, value.type === "All" ? value.value.map((el, i2) => React.createElement( IndexedContainer, { key: i2, index: i2 }, React.createElement(ValueView, { value: el }) )) : React.createElement( React.Fragment, null, value.value[0].map((el, i2) => React.createElement( IndexedContainer, { key: i2, index: i2 }, React.createElement(ValueView, { value: el }) )), React.createElement("td", null, "..."), React.createElement( IndexedContainer, { index: 100 }, React.createElement(ValueView, { value: value.value[1] }) ) )) ) ); }; let read_field = (v2, k) => { let field = v2.fields.find(([k2]) => k === k2); if (!field) { let v_pretty = JSON.stringify(v2, void 0, 2); throw new Error(`Could not find field "${k}" in struct: ${v_pretty}`); } return field[1].value; }; let read_unique = (unique) => { let non_null = read_field(unique, "pointer"); return non_null; }; let read_vec = (vec) => { let raw_vec = read_field(vec, "buf"); let unique = read_field(raw_vec, "ptr"); return read_unique(unique); }; let specialPtr = (value) => { if (value.alloc_kind === null) return; let alloc_type = value.alloc_kind.type; let non_null; if (alloc_type === "String") { let vec = read_field(value, "vec"); non_null = read_vec(vec); } else if (alloc_type === "Vec") { non_null = read_vec(value); } else if (alloc_type === "Box") { let unique = read_field(value, "0"); non_null = read_unique(unique); } else { throw new Error(`Unimplemented alloc type: ${alloc_type}`); } let ptr = non_null.fields[0][1]; return ptr; }; let AdtView = ({ value }) => { let pathCtx = reactExports.useContext(PathContext); let config = reactExports.useContext(ConfigContext); let ptr = specialPtr(value); if (ptr && !config.concreteTypes) return React.createElement(ValueView, { value: ptr }); if (value.name === "Iter" && !config.concreteTypes) { let non_null = read_field(value, "ptr"); let ptr2 = non_null.fields[0][1]; return React.createElement(ValueView, { value: ptr2 }); } let adtName = value.variant ?? value.name; let isTuple = value.fields.length > 0 && value.fields[0][0] === "0"; if (isTuple && value.fields.length === 1) { let path = [...pathCtx, "field", "0"]; let field = value.fields[0][1]; let inner = React.createElement( PathContext.Provider, { value: path }, React.createElement(ValueView, { value: field }) ); let smallInside = field.type === "Adt" && !config.concreteTypes && specialPtr(field.value) !== void 0; return React.createElement("span", { className: path.join("-") }, smallInside ? React.createElement( React.Fragment, null, adtName, "(", inner, ")" ) : React.createElement( React.Fragment, null, " ", adtName, " / ", inner )); } let cells = value.fields.map(([k, v2], i2) => { let path = [...pathCtx, "field", i2.toString()]; return React.createElement( "td", { key: k, className: path.join("-") }, React.createElement( PathContext.Provider, { value: path }, React.createElement(ValueView, { value: v2 }) ) ); }); return React.createElement( React.Fragment, null, adtName, React.createElement( "table", null, React.createElement("tbody", null, isTuple ? React.createElement("tr", null, cells) : value.fields.map(([k, _v], i2) => React.createElement( "tr", { key: i2 }, React.createElement("td", null, k), cells[i2] ))) ) ); }; let PointerView = ({ value: { path, range } }) => { let config = reactExports.useContext(ConfigContext); let segment = path.segment.type === "Heap" ? `heap-${path.segment.value.index}` : `stack-${path.segment.value.frame}-${path.segment.value.local}`; let parts = [...path.parts]; let lastPart = _.last(parts); let slice = lastPart && lastPart.type === "Subslice" ? lastPart.value : void 0; if (lastPart && lastPart.type === "Index" && lastPart.value === 0) parts.pop(); let partClass = parts.map((part) => part.type === "Index" ? `index-${part.value}` : part.type === "Field" ? `field-${part.value}` : part.type === "Subslice" ? `index-${part.value[0]}` : ""); let attrs = { "data-point-to": [segment, ...partClass].join("-") }; if (slice) { attrs["data-point-to-range"] = [ segment, ...partClass.slice(0, -1), `index-${slice[1]}` ].join("-"); } let ptrView = React.createElement("span", { className: "pointer", ...attrs }, "●"); return config.concreteTypes && range ? React.createElement( "table", null, React.createElement( "tbody", null, React.createElement( "tr", null, React.createElement("td", null, "ptr"), React.createElement("td", null, ptrView) ), React.createElement( "tr", null, React.createElement("td", null, "len"), React.createElement("td", null, range.toString()) ) ) ) : ptrView; }; let ValueView = ({ value }) => { let pathCtx = reactExports.useContext(PathContext); let error = reactExports.useContext(ErrorContext); return React.createElement(React.Fragment, null, value.type === "Bool" || value.type === "Uint" || value.type === "Int" || value.type === "Float" ? value.value.toString() : value.type === "Char" ? String.fromCharCode(value.value).replace(" ", " ") : value.type === "Tuple" ? React.createElement( React.Fragment, null, React.createElement( "table", null, React.createElement( "tbody", null, React.createElement("tr", null, value.value.map((v2, i2) => { let path = [...pathCtx, "field", i2.toString()]; return React.createElement( "td", { key: i2, className: path.join("-") }, React.createElement( PathContext.Provider, { value: path }, React.createElement(ValueView, { value: v2 }) ) ); })) ) ) ) : value.type === "Adt" ? React.createElement(AdtView, { value: value.value }) : value.type === "Pointer" ? React.createElement(PointerView, { value: value.value }) : value.type === "Array" ? React.createElement(AbbreviatedView, { value: value.value }) : value.type === "Unallocated" ? (() => { let isError = error && error.type === "PointerUseAfterFree" && error.value.alloc_id === value.value.alloc_id; return React.createElement("span", { className: classNames("unallocated", { error: isError }) }, "⦻"); })() : React.createElement(React.Fragment, null, "TODO")); }; let LocalsView = ({ index: index2, locals }) => locals.length === 0 ? React.createElement("div", { className: "locals empty-frame" }, "(empty frame)") : React.createElement( "table", { className: "locals" }, React.createElement("tbody", null, locals.map(({ name: name2, value, moved_paths }, i2) => { let path = ["stack", index2.toString(), name2]; let isMoved = moved_paths.some((p2) => p2.length === 0); return React.createElement( "tr", { key: i2, className: classNames({ moved: isMoved }) }, React.createElement("td", null, name2), React.createElement( "td", { className: path.join("-"), "data-connector": "right" }, React.createElement( PathContext.Provider, { value: path }, React.createElement(ValueView, { value }) ) ) ); })) ); let Header = ({ children, className }) => React.createElement( "div", { className: `header ${className ?? ""}` }, React.createElement("div", { className: "header-text" }, children), React.createElement("div", { className: "header-bg" }) ); let FrameView = ({ index: index2, frame }) => { let code2 = reactExports.useContext(CodeContext$1); codeRange(code2, frame.location); return React.createElement( "div", { className: "frame" }, React.createElement(Header, { className: "frame-header" }, frame.name), null, React.createElement(LocalsView, { index: index2, locals: frame.locals }) ); }; let StackView = ({ stack }) => React.createElement( "div", { className: "memory stack" }, React.createElement(Header, { className: "memory-header" }, "Stack"), React.createElement("div", { className: "frames" }, stack.frames.map((frame, i2) => React.createElement(FrameView, { key: i2, index: i2, frame }))) ); let HeapView = ({ heap }) => React.createElement( "div", { className: "memory heap" }, React.createElement(Header, { className: "memory-header" }, "Heap"), React.createElement( "table", null, React.createElement("tbody", null, heap.locations.map((value, i2) => { let path = ["heap", i2.toString()]; return React.createElement( "tr", { key: i2 }, React.createElement( "td", { className: path.join("-"), "data-connector": "left" }, React.createElement( PathContext.Provider, { value: path }, React.createElement(ValueView, { value }) ) ) ); })) ) ); LeaderLine.positionByWindowResize = false; const PALETTE = { // to_rgb(sns.color_palette("rocket", 15)[:6]) light: [ "rgba(24, 15, 41, 1)", "rgba(47, 23, 57, 1)", "rgba(71, 28, 72, 1)", "rgba(97, 30, 82, 1)", "rgba(123, 30, 89, 1)", "rgba(150, 27, 91, 1)" ], // to_rgb(sns.color_palette("rocket_r", 20, desat=0.5)[:6]) dark: [ "rgba(234, 219, 207, 1)", "rgba(227, 203, 187, 1)", "rgba(220, 187, 168, 1)", "rgba(214, 172, 151, 1)", "rgba(208, 156, 136, 1)", "rgba(202, 140, 121, 1)" ] }; let renderArrows = (containerRef, stepContainerRef, arrowContainerRef) => { reactExports.useEffect(() => { let container = containerRef.current; let stepContainer = stepContainerRef.current; let arrowContainer = arrowContainerRef.current; let sources = stepContainer.querySelectorAll(".pointer"); let mdbookEmbed = getComputedStyle(document.body).getPropertyValue("--inline-code-color"); let query = (sel) => { let dst = stepContainer.querySelector(`.${CSS.escape(sel)}`); if (!dst) throw new Error(`Could not find endpoint for pointer selector: ${CSS.escape(sel)}`); return dst; }; let getMemoryRegion = (el) => el.closest(".heap") !== null ? "heap" : "stack"; let dstCounts = {}; let pointers = Array.from(sources).map((src) => { let dstSel = src.dataset.pointTo; let dst = query(dstSel); let dstRange = src.dataset.pointToRange ? query(src.dataset.pointToRange) : void 0; let endSocket = dst.dataset.connector; let group = { srcRegion: getMemoryRegion(src), dstRegion: getMemoryRegion(dst) }; if (!(dstSel in dstCounts)) dstCounts[dstSel] = 0; let dstIndex = dstCounts[dstSel]; dstCounts[dstSel] += 1; return { src, dst, dstRange, dstSel, endSocket, dstIndex, group }; }); let groups = _.groupBy(pointers, "group"); let renderPtr = (ptr, i2) => { try { let { srcRegion, dstRegion } = ptr.group; let startSocket = srcRegion === "heap" && dstRegion === "stack" ? "left" : "right"; let dstAnchor; if (ptr.dstRange) { dstAnchor = LeaderLine.areaAnchor(ptr.dst, { shape: "rect", width: ptr.dstRange.offsetLeft + ptr.dst.offsetWidth - ptr.dst.offsetLeft, height: 2, y: "100%", fillColor: mdbookEmbed ? "var(--search-mark-bg)" : "red" }); } else if (srcRegion === "stack" && dstRegion === "stack") { dstAnchor = LeaderLine.pointAnchor(ptr.dst, { x: "100%", y: "75%" }); } else if (ptr.endSocket === "bottom") { dstAnchor = ptr.dst; } else { let x2 = dstRegion === "stack" ? 100 : 0; let y2 = evenlySpaceAround({ center: 50, spacing: 30, index: ptr.dstIndex, total: dstCounts[ptr.dstSel] - 1 }); dstAnchor = LeaderLine.pointAnchor(ptr.dst, { x: `${x2}%`, y: `${y2}%` }); } const MDBOOK_DARK_THEMES = ["navy", "coal", "ayu"]; let isDark = MDBOOK_DARK_THEMES.some((s2) => document.documentElement.classList.contains(s2)); let theme2 = isDark ? "dark" : "light"; let palette = PALETTE[theme2]; let color = palette[i2 % palette.length]; let srcIsMoved = ptr.src.closest(".moved") !== null; let moveOpacity = isDark ? 0.5 : 0.3; if (srcIsMoved) color = color.replace(", 1)", `, ${moveOpacity})`); let startSocketGravity = void 0; let endSocketGravity = void 0; if (ptr.group.srcRegion === "stack" && ptr.group.dstRegion === "heap") { startSocketGravity = 60; endSocketGravity = 100 - i2 * 10; } let line = new LeaderLine(ptr.src, dstAnchor, { color, size: 1, endPlugSize: 2, startSocket, endSocket: ptr.endSocket, startSocketGravity, endSocketGravity }); let svgSelectors = [".leader-line"]; if (ptr.dstRange) svgSelectors.push(".leader-line-areaAnchor"); let svgElements = svgSelectors.map((sel) => { let el = document.body.querySelector(`:scope > ${sel}`); if (!el) throw new Error(`Missing LineLeader element: ${sel}`); return el; }); svgElements.forEach((el) => arrowContainer.appendChild(el)); return { line, svgElements }; } catch (e2) { console.error("Leader line failed to render", e2.stack); return void 0; } }; let lines = Object.entries(groups).flatMap(([_g, ptrs]) => ptrs.map((ptr, i2) => renderPtr(ptr, i2))).filter((obj) => obj !== void 0); let curCoords = () => { let stepBox = stepContainer.getBoundingClientRect(); let x2 = stepBox.left + window.scrollX + container.scrollLeft; let y2 = stepBox.top + window.scrollY + container.scrollTop; return [x2, y2]; }; let positionArrowContainer = (x2, y2) => { lines.forEach(({ line }) => line.position()); arrowContainer.style.transform = `translate(-${x2}px, -${y2}px)`; }; let lastCoords = curCoords(); positionArrowContainer(...lastCoords); let interval = setInterval(() => { let newCoords = curCoords(); if (newCoords[0] !== lastCoords[0] || newCoords[1] !== lastCoords[1]) { positionArrowContainer(...newCoords); } lastCoords = newCoords; }, 300); return () => { clearInterval(interval); lines.forEach(({ svgElements }) => { svgElements.forEach((el) => { el.parentNode.removeChild(el); }); }); }; }); }; let StepView = ({ step, index: index2, containerRef }) => { let stepContainerRef = reactExports.useRef(null); let arrowContainerRef = reactExports.useRef(null); let error = reactExports.useContext(ErrorContext); renderArrows(containerRef, stepContainerRef, arrowContainerRef); return React.createElement( "div", { className: "step" }, React.createElement( "div", { className: "step-header" }, React.createElement(StepMarkerView, { index: index2, fail: error !== void 0 }), error !== void 0 ? React.createElement( "span", { className: "undefined-behavior" }, "undefined behavior:", " ", error.type === "PointerUseAfterFree" ? React.createElement(React.Fragment, null, "pointer used after its pointee is freed") : error.value ) : null ), React.createElement( "div", { className: "memory-container", ref: stepContainerRef }, React.createElement("div", { className: "arrow-container", ref: arrowContainerRef }), React.createElement( "div", { className: "memory-container-flex" }, React.createElement(StackView, { stack: step.stack }), step.heap.locations.length > 0 ? React.createElement(HeapView, { heap: step.heap }) : null ) ) ); }; let InterpreterView = ({ trace, config }) => { let ref = reactExports.useRef(null); let [concreteTypes, setConcreteTypes] = reactExports.useState((config == null ? void 0 : config.concreteTypes) ?? false); let [buttonVisible, setButtonVisible] = reactExports.useState(false); let flexDirection = (config == null ? void 0 : config.horizontal) ? "row" : "column"; return React.createElement( ConfigContext.Provider, { value: { ...config, concreteTypes } }, React.createElement( "div", { ref, className: "interpreter", style: { flexDirection }, onMouseEnter: () => setButtonVisible(true), onMouseLeave: () => setButtonVisible(false) }, React.createElement( "button", { type: "button", className: classNames("concrete-types", { active: concreteTypes }), onClick: () => setConcreteTypes(!concreteTypes), style: { opacity: buttonVisible ? "1" : "0" } }, React.createElement("i", { className: "fa fa-binoculars" }) ), trace.steps.map((step, i2) => { let error = i2 === trace.steps.length - 1 && trace.result.type === "Error" ? trace.result.value : void 0; return React.createElement( ErrorContext.Provider, { key: i2, value: error }, React.createElement(StepView, { index: i2, step, containerRef: ref }) ); }) ) ); }; let filterSteps = (view, steps, marks) => { let stepsRev = [...steps].reverse(); let indexedMarks = marks.map((idx) => { let stepRevIdx = stepsRev.findIndex((step) => { let frame = _.last(step.stack.frames); let markInFrame = linecolToPosition(frame.body_span.start, view.state.doc) <= idx && idx <= linecolToPosition(frame.body_span.end, view.state.doc); let markAfterLoc = idx > linecolToPosition(frame.location.start, view.state.doc); return markInFrame && markAfterLoc; }); if (stepRevIdx === -1) throw new Error(`Could not find step for range: ${JSON.stringify(idx, void 0, 2)}`); return [steps.length - stepRevIdx, idx, stepsRev[stepRevIdx]]; }); let sortedMarks = _.sortBy(indexedMarks, ([idx]) => idx); return [ sortedMarks.map(([_stepIdx, mark]) => mark), sortedMarks.map(([_stepIdx, _mark, step]) => step) ]; }; let StepMarkerView = ({ index: index2, fail }) => { return React.createElement( "span", { className: classNames("step-marker", { fail }) }, React.createElement( "span", null, "L", index2 + 1 ) ); }; class StepMarkerWidget extends WidgetType { constructor(index2, fail) { super(); __publicField(this, "index"); __publicField(this, "fail"); this.index = index2; this.fail = fail; } toDOM() { let container = document.createElement("span"); client.createRoot(container).render(React.createElement(StepMarkerView, { index: this.index, fail: this.fail })); return container; } } let markerField = makeDecorationField(); function renderInterpreter(view, container, trace, config, annotations) { let root = client.createRoot(container); let marks = (annotations == null ? void 0 : annotations.state_locations) || []; let widgetRanges; if (marks.length > 0) { let [sortedMarks, filteredSteps] = filterSteps(view, trace.steps, marks); widgetRanges = sortedMarks; trace.steps = filteredSteps; } else { widgetRanges = trace.steps.map((step) => linecolToPosition(_.last(step.stack.frames).location.end, view.state.doc)); } let decos = widgetRanges.map((mark, i2) => Decoration.widget({ widget: new StepMarkerWidget(i2, i2 === trace.steps.length - 1 && trace.result.type === "Error") }).range(mark)); view.dispatch({ effects: [markerField.setEffect.of(decos)] }); root.render(React.createElement( CodeContext$1.Provider, { value: view }, React.createElement(InterpreterView, { trace, config }) )); } let PermChar = ({ perm, facts }) => { let getInner = () => { let kind = permName(perm.perm); let Perm = ({ children }) => React.createElement("span", { className: classNames("perm", kind) }, children); if (perm.step.type === "None") { return perm.step.value ? React.createElement( "div", { className: "perm-diff-present", title: `Path had ${kind} permissions before the preceding line, and that didn't change after this line.` }, React.createElement(Perm, null, perm.perm) ) : React.createElement( "div", { className: "perm-diff-none", title: `Path did not have ${kind} permissions before the preceding line, and that didn't change after this line.` }, React.createElement(Perm, null, "‒") ); } else if (perm.step.type === "Low") { return React.createElement( "div", { className: "perm-diff-sub-container", title: `Path had ${kind} permissions before the preceding line, and lost it after this line.` }, React.createElement("div", { className: "perm-diff-sub" }), React.createElement(Perm, null, perm.perm) ); } else { return React.createElement( "div", { title: `Path did not have ${kind} permissions before the preceding line, and gained it after this line.` }, React.createElement("span", { className: "perm-diff-add" }, "+"), React.createElement(Perm, null, perm.perm) ); } }; return React.createElement("td", { onMouseEnter: () => { showLoanRegion(facts, perm.loanKey, [permName(perm.perm)]); showMoveRegion(facts, perm.moveKey, [permName(perm.perm)]); }, onMouseLeave: () => { hideLoanRegion(facts, perm.loanKey, [permName(perm.perm)]); hideMoveRegion(facts, perm.moveKey, [permName(perm.perm)]); }, className: "perm-char" }, getInner()); }; let PermDiffRow = ({ path, diffs, facts }) => { let visualFacts = [ { fact: "path_moved", states: [ { value: { type: "High", value: 0 }, icon: "sign-out", desc: "Path is moved here" }, { value: { type: "Low" }, icon: "recycle", desc: "Path is re-initialized after move here" } ] }, { fact: "loan_read_refined", states: [ { value: { type: "High", value: 0 }, icon: "arrow-right", desc: "Path is borrowed here" }, { value: { type: "Low" }, icon: "rotate-left", desc: "Borrow on path is dropped here" } ] }, { fact: "loan_write_refined", states: [ { value: { type: "High", value: 0 }, icon: "arrow-right", desc: "Path is borrowed here" }, { value: { type: "Low" }, icon: "rotate-left", desc: "Borrow on path is no longer used here" } ] }, { fact: "is_live", states: [ { value: { type: "High", value: 0 }, icon: "level-up", desc: "Path is initialized here" }, { value: { type: "Low" }, icon: "level-down", desc: "Path is no longer used here" } ] }, { fact: "path_uninitialized", states: [ { value: { type: "High", value: 0 }, icon: "sign-out", desc: "Path contains uninitialized data" }, { value: { type: "Low" }, icon: "recycle", desc: "Path data is initialized after move here" } ] } ]; let ico = null; loop: for (let { fact, states } of visualFacts) { for (let { value, icon, desc } of states) { if (_.isEqual(diffs[fact].type, value.type)) { ico = React.createElement("i", { className: `fa fa-${icon} aquascope-action-indicator`, title: desc }); break loop; } } } let unwrap = (v2) => v2.type === "None" || v2.type === "High" ? v2.value : void 0; let moveKey = unwrap(diffs.path_moved); let perms = [ { perm: readChar, step: diffs.permissions.read, loanKey: unwrap(diffs.loan_read_refined), moveKey }, { perm: writeChar, step: diffs.permissions.write, loanKey: unwrap(diffs.loan_write_refined), moveKey }, { perm: ownChar, step: diffs.permissions.drop, loanKey: unwrap(diffs.loan_drop_refined), moveKey } ]; let pathCol = React.createElement("td", { className: "perm-step-path" }, path); return React.createElement( "tr", null, pathCol, React.createElement("td", { className: "perm-step-event" }, ico), perms.map((perm) => React.createElement(PermChar, { key: perm.perm, perm, facts })) ); }; let stepLocation = (step) => { return step.location.end; }; let StepTable = ({ rows, facts }) => React.createElement( "table", { className: "perm-step-table" }, React.createElement("tbody", null, rows.map(([path, diffs], i2) => React.createElement(PermDiffRow, { key: i2, path, diffs, facts }))) ); let StepTableIndividual = ({ focused, hidden, facts }) => { let [displayAll, setDisplayAll] = reactExports.useState(false); let hiddenDropdown = hidden.length > 0 ? React.createElement( React.Fragment, null, React.createElement("div", { className: "step-table-dropdown step-widget-toggle" }, "● ● ●"), React.createElement( "div", { className: classNames({ "hidden-height": !displayAll }) }, React.createElement(StepTable, { rows: hidden, facts }) ) ) : null; return ( // biome-ignore lint/a11y/useKeyWithClickEvents: TODO React.createElement( "div", { className: classNames("step-table-container", { "contains-hidden": hidden.length > 0 }), onClick: () => setDisplayAll(!displayAll) }, React.createElement(StepTable, { rows: focused, facts }), hiddenDropdown ) ); }; let StepLine = ({ spaces, focusedRegex, tables, init, facts }) => { let [display, setDisplay] = reactExports.useState(init); let arrowOut = "»"; let arrowIn = "«"; let together = tables.map((table, i2) => { let [focusedDiffs, hiddenDiffs] = _.partition(table.state, ([path, _2]) => !!path.match(focusedRegex)); return React.createElement(StepTableIndividual, { key: i2, focused: focusedDiffs, hidden: hiddenDiffs, facts }); }); return React.createElement( "div", { className: "perm-step-widget" }, React.createElement("span", { className: "step-widget-toggle", onClick: () => setDisplay(!display) }, display ? arrowIn : arrowOut), React.createElement( "div", { className: classNames("step-widget-container", { "hidden-width": !display }) }, React.createElement("div", { className: "step-widget-spacer" }, spaces), together ) ); }; class PermissionStepLineWidget extends WidgetType { constructor(view, step, facts, annotations) { super(); __publicField(this, "view"); __publicField(this, "step"); __publicField(this, "facts"); __publicField(this, "annotations"); __publicField(this, "line"); __publicField(this, "rowHTML"); this.view = view; this.step = step; this.facts = facts; this.annotations = annotations; this.line = view.state.doc.lineAt(linecolToPosition(stepLocation(step), view.state.doc)); } eq(other) { return this.line.number === other.line.number; } toDOM() { var _a2; let container = document.createElement("span"); let doc2 = this.view.state.doc; let currLine = this.line; let initDisplay = this.annotations && this.annotations.focused_lines.length > 0 ? this.annotations.focused_lines.includes(currLine.number) : true; let maxLineLen = 0; for (let line of doc2.iterLines()) { maxLineLen = Math.max(maxLineLen, line.length); } let padding = 2 + maxLineLen - currLine.length; let spaces = "―".repeat(padding); let matchers = (_a2 = this.annotations) == null ? void 0 : _a2.focused_paths[currLine.number]; let rx = matchers == null ? void 0 : matchers.map((matcher) => matcher.type === "Literal" ? _.escapeRegExp(matcher.value) : matcher.value).map((s2) => `(${s2})`).join("|"); let r2 = new RegExp(rx ?? "(.*)?"); let tables = this.step.state; client.createRoot(container).render(React.createElement(StepLine, { spaces, focusedRegex: r2, tables, init: initDisplay, facts: this.facts })); return container; } ignoreEvent() { return true; } } let stepField = makeDecorationField(); function makeStepDecorations(view, facts, stateSteps, annotations) { return stateSteps.map((step) => Decoration.widget({ widget: new PermissionStepLineWidget(view, step, facts, annotations), side: 1 }).range(linecolToPosition(stepLocation(step), view.state.doc))); } function makePermissionsDecorations(view, results, annotations) { let stepDecos = []; let boundaryDecos = []; let actionDecos = []; results.forEach((res) => { let [facts, actionFacts] = generateAnalysisDecorationFacts(res); let bs = makeBoundaryDecorations(view, facts, res.boundaries, annotations == null ? void 0 : annotations.boundaries); let ss = makeStepDecorations(view, facts, res.steps, annotations == null ? void 0 : annotations.stepper); boundaryDecos.push(bs); stepDecos.push(ss); actionDecos.push(actionFacts); }); return { stepper: stepDecos.flat(), boundaries: _.uniqBy(boundaryDecos.flat(), (d2) => d2.from), facts: actionDecos.flat() }; } function renderPermissions(view, decorations2, cfg) { console.debug("rendering permissions with", cfg); if (decorations2 !== void 0) { let useSteps = String(cfg == null ? void 0 : cfg.stepper) === "true"; let useBoundaries = String(cfg == null ? void 0 : cfg.boundaries) === "true"; view.dispatch({ effects: [ loanFactsStateType.of(decorations2.facts), stepField.setEffect.of(useSteps ? decorations2.stepper : []), boundariesField.setEffect.of(useBoundaries ? decorations2.boundaries : []) ] }); } } const styles$1 = ""; const DEFAULT_SERVER_URL = new URL("http://127.0.0.1:8008"); const defaultCodeExample = ` fn main() { let mut v = vec![1, 2, 3]; let n = &v[0]; v.push(0); let x = *n; } `.trim(); let readOnly = new Compartment(); let mainKeybinding = new Compartment(); let CopyButton = ({ view }) => React.createElement( "button", { type: "button", className: "cm-button", onClick: () => { let contents = view.state.doc.toJSON().join("\n"); navigator.clipboard.writeText(contents); } }, React.createElement("i", { className: "fa fa-copy" }) ); let HideButton = ({ container }) => { let [hidden, setHidden] = reactExports.useState(true); reactExports.useEffect(() => { if (!hidden) container.classList.add("show-hidden"); else container.classList.remove("show-hidden"); }, [hidden]); return ( // biome-ignore lint/a11y/useButtonType: TODO React.createElement( "button", { className: "cm-button", onClick: () => setHidden(!hidden) }, React.createElement("i", { className: `fa ${hidden ? "fa-eye" : "fa-eye-slash"}` }) ) ); }; let resetMarkedRangesOnEdit = EditorView.updateListener.of((upd) => { if (upd.docChanged) { upd.view.dispatch({ effects: [ boundariesField.setEffect.of([]), stepField.setEffect.of([]), markerField.setEffect.of([]) ] }); } }); class Editor { constructor(dom, setup2, code2 = defaultCodeExample, reportStdErr = (err) => { console.error("An error occurred: "); console.error(err); }, serverUrl = DEFAULT_SERVER_URL, noInteract = false, shouldFailHtml = "This code does not compile!", buttonList = []) { __publicField(this, "setup"); __publicField(this, "reportStdErr"); __publicField(this, "serverUrl"); __publicField(this, "noInteract"); __publicField(this, "shouldFailHtml"); __publicField(this, "buttonList"); __publicField(this, "view"); __publicField(this, "interpreterContainer"); __publicField(this, "editorContainer"); __publicField(this, "permissionsDecos"); __publicField(this, "metaContainer"); __publicField(this, "buttons"); __publicField(this, "shouldFail", false); this.setup = setup2; this.reportStdErr = reportStdErr; this.serverUrl = serverUrl; this.noInteract = noInteract; this.shouldFailHtml = shouldFailHtml; this.buttonList = buttonList; this.buttons = new Set(buttonList); let initialState = EditorState.create({ doc: code2, extensions: [ mainKeybinding.of(setup2), readOnly.of(EditorState.readOnly.of(noInteract)), EditorView.editable.of(!noInteract), resetMarkedRangesOnEdit, setup2, rust(), indentUnit.of(" "), hiddenLines, loanFactsField, boundariesField.field, stepField.field, markerField.field ] }); this.editorContainer = document.createElement("div"); this.view = new EditorView({ state: initialState, parent: this.editorContainer }); let buttonContainer = document.createElement("div"); this.metaContainer = client.createRoot(buttonContainer); this.renderMeta(); this.editorContainer.appendChild(buttonContainer); this.interpreterContainer = document.createElement("div"); dom.appendChild(this.editorContainer); dom.appendChild(this.interpreterContainer); } renderMeta() { this.metaContainer.render(React.createElement( "div", { className: "meta-container" }, React.createElement("div", { className: "top-right" }, Array.from(this.buttons).map((button, i2) => button === "copy" ? React.createElement(CopyButton, { key: i2, view: this.view }) : button === "eye" ? React.createElement(HideButton, { key: i2, container: this.editorContainer }) : null)), this.shouldFail ? React.createElement("div", { // biome-ignore lint/security/noDangerouslySetInnerHtml: not user-configurable dangerouslySetInnerHTML: { __html: this.shouldFailHtml } }) : null )); } getCurrentCode() { return this.view.state.doc.toString(); } reconfigure(extensions) { this.view.dispatch({ effects: [mainKeybinding.reconfigure([...extensions, this.setup])] }); } removeIconField(f2) { this.view.dispatch({ effects: [f2.effectType.of([])] }); } addPermissionsField(f2, methodCallPoints, facts) { let newEffects = methodCallPoints.map((v2) => f2.fromOutput(v2, facts)); this.view.dispatch({ effects: [f2.effectType.of(newEffects)] }); } async renderPermissions(cfg) { await this.renderOperation("permissions", { config: cfg }); renderPermissions(this.view, this.permissionsDecos, cfg); } destroy() { this.view.destroy(); } // Actions to communicate with the aquascope server async callBackendWithCode(endpoint, config) { let inEditor = this.getCurrentCode(); let endpointUrl = new URL(endpoint, this.serverUrl); let serverResponseRaw = await fetch(endpointUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ code: inEditor, config }) }); let serverResponse = await serverResponseRaw.json(); return serverResponse; } renderInterpreter(trace, config, annotations) { if (config == null ? void 0 : config.hideCode) { this.view.destroy(); this.metaContainer.unmount(); } renderInterpreter(this.view, this.interpreterContainer, trace, config, annotations); } async renderOperation(operation, { response, config, annotations } = {}) { console.debug(`Rendering operation: ${operation}`); if (!response) { let serverResponse = await this.callBackendWithCode(operation, config); if (serverResponse.success) { response = JSON.parse(serverResponse.stdout); this.reportStdErr({ type: "ServerStderr", error: serverResponse.stderr }); } else { return this.reportStdErr({ type: "ServerStderr", error: serverResponse.stderr }); } } if ((annotations == null ? void 0 : annotations.hidden_lines) && annotations.hidden_lines.length > 0) { this.view.dispatch({ effects: annotations.hidden_lines.map((line) => hideLine.of({ line })) }); this.buttons.add("eye"); } if (config == null ? void 0 : config.shouldFail) { this.shouldFail = true; } this.renderMeta(); if (operation === "interpreter") { if ("Ok" in response) { this.renderInterpreter(response.Ok, config, annotations == null ? void 0 : annotations.interp); } else { this.reportStdErr(response.Err); } } else if (operation === "permissions") { let cast = response; let results = []; for (const res of cast) { if ("Ok" in res) { results.push(res.Ok); } else { this.reportStdErr(res.Err); } } this.permissionsDecos = makePermissionsDecorations(this.view, results, annotations); renderPermissions(this.view, this.permissionsDecos, config); } } } function t(t2) { return t2.split("-")[1]; } function e(t2) { return "y" === t2 ? "height" : "width"; } function n$1(t2) { return t2.split("-")[0]; } function o$1(t2) { return ["top", "bottom"].includes(n$1(t2)) ? "x" : "y"; } function i$1(i2, r2, a2) { let { reference: l2, floating: s2 } = i2; const c2 = l2.x + l2.width / 2 - s2.width / 2, f2 = l2.y + l2.height / 2 - s2.height / 2, m2 = o$1(r2), u2 = e(m2), g = l2[u2] / 2 - s2[u2] / 2, d2 = "x" === m2; let p2; switch (n$1(r2)) { case "top": p2 = { x: c2, y: l2.y - s2.height }; break; case "bottom": p2 = { x: c2, y: l2.y + l2.height }; break; case "right": p2 = { x: l2.x + l2.width, y: f2 }; break; case "left": p2 = { x: l2.x - s2.width, y: f2 }; break; default: p2 = { x: l2.x, y: l2.y }; } switch (t(r2)) { case "start": p2[m2] -= g * (a2 && d2 ? -1 : 1); break; case "end": p2[m2] += g * (a2 && d2 ? -1 : 1); } return p2; } const r$1 = async (t2, e2, n2) => { const { placement: o2 = "bottom", strategy: r2 = "absolute", middleware: a2 = [], platform: l2 } = n2, s2 = a2.filter(Boolean), c2 = await (null == l2.isRTL ? void 0 : l2.isRTL(e2)); let f2 = await l2.getElementRects({ reference: t2, floating: e2, strategy: r2 }), { x: m2, y: u2 } = i$1(f2, o2, c2), g = o2, d2 = {}, p2 = 0; for (let n3 = 0; n3 < s2.length; n3++) { const { name: a3, fn: h2 } = s2[n3], { x: y2, y: x2, data: w2, reset: v2 } = await h2({ x: m2, y: u2, initialPlacement: o2, placement: g, strategy: r2, middlewareData: d2, rects: f2, platform: l2, elements: { reference: t2, floating: e2 } }); m2 = null != y2 ? y2 : m2, u2 = null != x2 ? x2 : u2, d2 = { ...d2, [a3]: { ...d2[a3], ...w2 } }, v2 && p2 <= 50 && (p2++, "object" == typeof v2 && (v2.placement && (g = v2.placement), v2.rects && (f2 = true === v2.rects ? await l2.getElementRects({ reference: t2, floating: e2, strategy: r2 }) : v2.rects), { x: m2, y: u2 } = i$1(f2, g, c2)), n3 = -1); } return { x: m2, y: u2, placement: g, strategy: r2, middlewareData: d2 }; }; function s$1(t2) { return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height }; } const d$1 = ["top", "right", "bottom", "left"]; d$1.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []); function n(t2) { var e2; return (null == t2 || null == (e2 = t2.ownerDocument) ? void 0 : e2.defaultView) || window; } function o(t2) { return n(t2).getComputedStyle(t2); } function i(t2) { return t2 instanceof n(t2).Node; } function r(t2) { return i(t2) ? (t2.nodeName || "").toLowerCase() : "#document"; } function c(t2) { return t2 instanceof HTMLElement || t2 instanceof n(t2).HTMLElement; } function l(t2) { return "undefined" != typeof ShadowRoot && (t2 instanceof n(t2).ShadowRoot || t2 instanceof ShadowRoot); } function s(t2) { const { overflow: e2, overflowX: n2, overflowY: i2, display: r2 } = o(t2); return /auto|scroll|overlay|hidden|clip/.test(e2 + i2 + n2) && !["inline", "contents"].includes(r2); } function f(t2) { return ["table", "td", "th"].includes(r(t2)); } function u(t2) { const e2 = a(), n2 = o(t2); return "none" !== n2.transform || "none" !== n2.perspective || !!n2.containerType && "normal" !== n2.containerType || !e2 && !!n2.backdropFilter && "none" !== n2.backdropFilter || !e2 && !!n2.filter && "none" !== n2.filter || ["transform", "perspective", "filter"].some((t3) => (n2.willChange || "").includes(t3)) || ["paint", "layout", "strict", "content"].some((t3) => (n2.contain || "").includes(t3)); } function a() { return !("undefined" == typeof CSS || !CSS.supports) && CSS.supports("-webkit-backdrop-filter", "none"); } function d(t2) { return ["html", "body", "#document"].includes(r(t2)); } const h = Math.min, p = Math.max, m = Math.round, y = (t2) => ({ x: t2, y: t2 }); function w(t2) { const e2 = o(t2); let n2 = parseFloat(e2.width) || 0, i2 = parseFloat(e2.height) || 0; const r2 = c(t2), l2 = r2 ? t2.offsetWidth : n2, s2 = r2 ? t2.offsetHeight : i2, f2 = m(n2) !== l2 || m(i2) !== s2; return f2 && (n2 = l2, i2 = s2), { width: n2, height: i2, $: f2 }; } function x(t2) { return t2 instanceof Element || t2 instanceof n(t2).Element; } function v(t2) { return x(t2) ? t2 : t2.contextElement; } function b(t2) { const e2 = v(t2); if (!c(e2)) return y(1); const n2 = e2.getBoundingClientRect(), { width: o2, height: i2, $: r2 } = w(e2); let l2 = (r2 ? m(n2.width) : n2.width) / o2, s2 = (r2 ? m(n2.height) : n2.height) / i2; return l2 && Number.isFinite(l2) || (l2 = 1), s2 && Number.isFinite(s2) || (s2 = 1), { x: l2, y: s2 }; } const L = y(0); function T(t2) { const e2 = n(t2); return a() && e2.visualViewport ? { x: e2.visualViewport.offsetLeft, y: e2.visualViewport.offsetTop } : L; } function R(e2, o2, i2, r2) { void 0 === o2 && (o2 = false), void 0 === i2 && (i2 = false); const c2 = e2.getBoundingClientRect(), l2 = v(e2); let s2 = y(1); o2 && (r2 ? x(r2) && (s2 = b(r2)) : s2 = b(e2)); const f2 = function(t2, e3, o3) { return void 0 === e3 && (e3 = false), !(!o3 || e3 && o3 !== n(t2)) && e3; }(l2, i2, r2) ? T(l2) : y(0); let u2 = (c2.left + f2.x) / s2.x, a2 = (c2.top + f2.y) / s2.y, d2 = c2.width / s2.x, h2 = c2.height / s2.y; if (l2) { const t2 = n(l2), e3 = r2 && x(r2) ? n(r2) : r2; let o3 = t2.frameElement; for (; o3 && r2 && e3 !== t2; ) { const t3 = b(o3), e4 = o3.getBoundingClientRect(), i3 = getComputedStyle(o3), r3 = e4.left + (o3.clientLeft + parseFloat(i3.paddingLeft)) * t3.x, c3 = e4.top + (o3.clientTop + parseFloat(i3.paddingTop)) * t3.y; u2 *= t3.x, a2 *= t3.y, d2 *= t3.x, h2 *= t3.y, u2 += r3, a2 += c3, o3 = n(o3).frameElement; } } return s$1({ width: d2, height: h2, x: u2, y: a2 }); } function E(t2) { return x(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset }; } function S(t2) { var e2; return null == (e2 = (i(t2) ? t2.ownerDocument : t2.document) || window.document) ? void 0 : e2.documentElement; } function C(t2) { return R(S(t2)).left + E(t2).scrollLeft; } function F(t2) { if ("html" === r(t2)) return t2; const e2 = t2.assignedSlot || t2.parentNode || l(t2) && t2.host || S(t2); return l(e2) ? e2.host : e2; } function O(t2) { const e2 = F(t2); return d(e2) ? t2.ownerDocument ? t2.ownerDocument.body : t2.body : c(e2) && s(e2) ? e2 : O(e2); } function D(t2, e2) { var o2; void 0 === e2 && (e2 = []); const i2 = O(t2), r2 = i2 === (null == (o2 = t2.ownerDocument) ? void 0 : o2.body), c2 = n(i2); return r2 ? e2.concat(c2, c2.visualViewport || [], s(i2) ? i2 : []) : e2.concat(i2, D(i2)); } function H(e2, i2, r2) { let l2; if ("viewport" === i2) l2 = function(t2, e3) { const o2 = n(t2), i3 = S(t2), r3 = o2.visualViewport; let c2 = i3.clientWidth, l3 = i3.clientHeight, s2 = 0, f2 = 0; if (r3) { c2 = r3.width, l3 = r3.height; const t3 = a(); (!t3 || t3 && "fixed" === e3) && (s2 = r3.offsetLeft, f2 = r3.offsetTop); } return { width: c2, height: l3, x: s2, y: f2 }; }(e2, r2); else if ("document" === i2) l2 = function(t2) { const e3 = S(t2), n2 = E(t2), i3 = t2.ownerDocument.body, r3 = p(e3.scrollWidth, e3.clientWidth, i3.scrollWidth, i3.clientWidth), c2 = p(e3.scrollHeight, e3.clientHeight, i3.scrollHeight, i3.clientHeight); let l3 = -n2.scrollLeft + C(t2); const s2 = -n2.scrollTop; return "rtl" === o(i3).direction && (l3 += p(e3.clientWidth, i3.clientWidth) - r3), { width: r3, height: c2, x: l3, y: s2 }; }(S(e2)); else if (x(i2)) l2 = function(t2, e3) { const n2 = R(t2, true, "fixed" === e3), o2 = n2.top + t2.clientTop, i3 = n2.left + t2.clientLeft, r3 = c(t2) ? b(t2) : y(1); return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i3 * r3.x, y: o2 * r3.y }; }(i2, r2); else { const t2 = T(e2); l2 = { ...i2, x: i2.x - t2.x, y: i2.y - t2.y }; } return s$1(l2); } function W(t2, e2) { const n2 = F(t2); return !(n2 === e2 || !x(n2) || d(n2)) && ("fixed" === o(n2).position || W(n2, e2)); } function M(t2, e2, n2) { const o2 = c(e2), i2 = S(e2), l2 = "fixed" === n2, f2 = R(t2, true, l2, e2); let u2 = { scrollLeft: 0, scrollTop: 0 }; const a2 = y(0); if (o2 || !o2 && !l2) if (("body" !== r(e2) || s(i2)) && (u2 = E(e2)), c(e2)) { const t3 = R(e2, true, l2, e2); a2.x = t3.x + e2.clientLeft, a2.y = t3.y + e2.clientTop; } else i2 && (a2.x = C(i2)); return { x: f2.left + u2.scrollLeft - a2.x, y: f2.top + u2.scrollTop - a2.y, width: f2.width, height: f2.height }; } function z(t2, e2) { return c(t2) && "fixed" !== o(t2).position ? e2 ? e2(t2) : t2.offsetParent : null; } function P(t2, e2) { const i2 = n(t2); if (!c(t2)) return i2; let l2 = z(t2, e2); for (; l2 && f(l2) && "static" === o(l2).position; ) l2 = z(l2, e2); return l2 && ("html" === r(l2) || "body" === r(l2) && "static" === o(l2).position && !u(l2)) ? i2 : l2 || function(t3) { let e3 = F(t3); for (; c(e3) && !d(e3); ) { if (u(e3)) return e3; e3 = F(e3); } return null; }(t2) || i2; } const V = { convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) { let { rect: e2, offsetParent: n2, strategy: o2 } = t2; const i2 = c(n2), l2 = S(n2); if (n2 === l2) return e2; let f2 = { scrollLeft: 0, scrollTop: 0 }, u2 = y(1); const a2 = y(0); if ((i2 || !i2 && "fixed" !== o2) && (("body" !== r(n2) || s(l2)) && (f2 = E(n2)), c(n2))) { const t3 = R(n2); u2 = b(n2), a2.x = t3.x + n2.clientLeft, a2.y = t3.y + n2.clientTop; } return { width: e2.width * u2.x, height: e2.height * u2.y, x: e2.x * u2.x - f2.scrollLeft * u2.x + a2.x, y: e2.y * u2.y - f2.scrollTop * u2.y + a2.y }; }, getDocumentElement: S, getClippingRect: function(t2) { let { element: e2, boundary: n2, rootBoundary: i2, strategy: c2 } = t2; const l2 = [..."clippingAncestors" === n2 ? function(t3, e3) { const n3 = e3.get(t3); if (n3) return n3; let i3 = D(t3).filter((t4) => x(t4) && "body" !== r(t4)), c3 = null; const l3 = "fixed" === o(t3).position; let f3 = l3 ? F(t3) : t3; for (; x(f3) && !d(f3); ) { const e4 = o(f3), n4 = u(f3); n4 || "fixed" !== e4.position || (c3 = null), (l3 ? !n4 && !c3 : !n4 && "static" === e4.position && c3 && ["absolute", "fixed"].includes(c3.position) || s(f3) && !n4 && W(t3, f3)) ? i3 = i3.filter((t4) => t4 !== f3) : c3 = e4, f3 = F(f3); } return e3.set(t3, i3), i3; }(e2, this._c) : [].concat(n2), i2], f2 = l2[0], a2 = l2.reduce((t3, n3) => { const o2 = H(e2, n3, c2); return t3.top = p(o2.top, t3.top), t3.right = h(o2.right, t3.right), t3.bottom = h(o2.bottom, t3.bottom), t3.left = p(o2.left, t3.left), t3; }, H(e2, f2, c2)); return { width: a2.right - a2.left, height: a2.bottom - a2.top, x: a2.left, y: a2.top }; }, getOffsetParent: P, getElementRects: async function(t2) { let { reference: e2, floating: n2, strategy: o2 } = t2; const i2 = this.getOffsetParent || P, r2 = this.getDimensions; return { reference: M(e2, await i2(n2), o2), floating: { x: 0, y: 0, ...await r2(n2) } }; }, getClientRects: function(t2) { return Array.from(t2.getClientRects()); }, getDimensions: function(t2) { return w(t2); }, getScale: b, isElement: x, isRTL: function(t2) { return "rtl" === getComputedStyle(t2).direction; } }; const B = (t2, n2, o2) => { const i2 = /* @__PURE__ */ new Map(), r2 = { platform: V, ...o2 }, c2 = { ...r2.platform, _c: i2 }; return r$1(t2, n2, { ...r2, platform: c2 }); }; var index = typeof document !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect; function deepEqual(a2, b2) { if (a2 === b2) { return true; } if (typeof a2 !== typeof b2) { return false; } if (typeof a2 === "function" && a2.toString() === b2.toString()) { return true; } let length, i2, keys; if (a2 && b2 && typeof a2 == "object") { if (Array.isArray(a2)) { length = a2.length; if (length != b2.length) return false; for (i2 = length; i2-- !== 0; ) { if (!deepEqual(a2[i2], b2[i2])) { return false; } } return true; } keys = Object.keys(a2); length = keys.length; if (length !== Object.keys(b2).length) { return false; } for (i2 = length; i2-- !== 0; ) { if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) { return false; } } for (i2 = length; i2-- !== 0; ) { const key = keys[i2]; if (key === "_owner" && a2.$$typeof) { continue; } if (!deepEqual(a2[key], b2[key])) { return false; } } return true; } return a2 !== a2 && b2 !== b2; } function useLatestRef(value) { const ref = reactExports.useRef(value); index(() => { ref.current = value; }); return ref; } function useFloating(options) { if (options === void 0) { options = {}; } const { placement = "bottom", strategy = "absolute", middleware = [], platform, whileElementsMounted, open } = options; const [data, setData] = reactExports.useState({ x: null, y: null, strategy, placement, middlewareData: {}, isPositioned: false }); const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware); if (!deepEqual(latestMiddleware, middleware)) { setLatestMiddleware(middleware); } const referenceRef = reactExports.useRef(null); const floatingRef = reactExports.useRef(null); const dataRef = reactExports.useRef(data); const whileElementsMountedRef = useLatestRef(whileElementsMounted); const platformRef = useLatestRef(platform); const [reference, _setReference] = reactExports.useState(null); const [floating, _setFloating] = reactExports.useState(null); const setReference = reactExports.useCallback((node) => { if (referenceRef.current !== node) { referenceRef.current = node; _setReference(node); } }, []); const setFloating = reactExports.useCallback((node) => { if (floatingRef.current !== node) { floatingRef.current = node; _setFloating(node); } }, []); const update = reactExports.useCallback(() => { if (!referenceRef.current || !floatingRef.current) { return; } const config = { placement, strategy, middleware: latestMiddleware }; if (platformRef.current) { config.platform = platformRef.current; } B(referenceRef.current, floatingRef.current, config).then((data2) => { const fullData = { ...data2, isPositioned: true }; if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { dataRef.current = fullData; reactDomExports.flushSync(() => { setData(fullData); }); } }); }, [latestMiddleware, placement, strategy, platformRef]); index(() => { if (open === false && dataRef.current.isPositioned) { dataRef.current.isPositioned = false; setData((data2) => ({ ...data2, isPositioned: false })); } }, [open]); const isMountedRef = reactExports.useRef(false); index(() => { isMountedRef.current = true; return () => { isMountedRef.current = false; }; }, []); index(() => { if (reference && floating) { if (whileElementsMountedRef.current) { return whileElementsMountedRef.current(reference, floating, update); } else { update(); } } }, [reference, floating, update, whileElementsMountedRef]); const refs = reactExports.useMemo(() => ({ reference: referenceRef, floating: floatingRef, setReference, setFloating }), [setReference, setFloating]); const elements = reactExports.useMemo(() => ({ reference, floating }), [reference, floating]); return reactExports.useMemo(() => ({ ...data, update, refs, elements, reference: setReference, floating: setFloating }), [data, update, refs, elements, setReference, setFloating]); } const toggleComment = (target) => { let config = getConfig(target.state); return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false; }; function command(f2, option) { return ({ state, dispatch }) => { if (state.readOnly) return false; let tr = f2(option, state); if (!tr) return false; dispatch(state.update(tr)); return true; }; } const toggleLineComment = /* @__PURE__ */ command( changeLineComment, 0 /* CommentOption.Toggle */ ); const toggleBlockComment = /* @__PURE__ */ command( changeBlockComment, 0 /* CommentOption.Toggle */ ); const toggleBlockCommentByLine = /* @__PURE__ */ command( (o2, s2) => changeBlockComment(o2, s2, selectedLineRanges(s2)), 0 /* CommentOption.Toggle */ ); function getConfig(state, pos = state.selection.main.head) { let data = state.languageDataAt("commentTokens", pos); return data.length ? data[0] : {}; } const SearchMargin = 50; function findBlockComment(state, { open, close }, from, to) { let textBefore = state.sliceDoc(from - SearchMargin, from); let textAfter = state.sliceDoc(to, to + SearchMargin); let spaceBefore = /\s*$/.exec(textBefore)[0].length, spaceAfter = /^\s*/.exec(textAfter)[0].length; let beforeOff = textBefore.length - spaceBefore; if (textBefore.slice(beforeOff - open.length, beforeOff) == open && textAfter.slice(spaceAfter, spaceAfter + close.length) == close) { return { open: { pos: from - spaceBefore, margin: spaceBefore && 1 }, close: { pos: to + spaceAfter, margin: spaceAfter && 1 } }; } let startText, endText; if (to - from <= 2 * SearchMargin) { startText = endText = state.sliceDoc(from, to); } else { startText = state.sliceDoc(from, from + SearchMargin); endText = state.sliceDoc(to - SearchMargin, to); } let startSpace = /^\s*/.exec(startText)[0].length, endSpace = /\s*$/.exec(endText)[0].length; let endOff = endText.length - endSpace - close.length; if (startText.slice(startSpace, startSpace + open.length) == open && endText.slice(endOff, endOff + close.length) == close) { return { open: { pos: from + startSpace + open.length, margin: /\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0 }, close: { pos: to - endSpace - close.length, margin: /\s/.test(endText.charAt(endOff - 1)) ? 1 : 0 } }; } return null; } function selectedLineRanges(state) { let ranges = []; for (let r2 of state.selection.ranges) { let fromLine = state.doc.lineAt(r2.from); let toLine = r2.to <= fromLine.to ? fromLine : state.doc.lineAt(r2.to); let last = ranges.length - 1; if (last >= 0 && ranges[last].to > fromLine.from) ranges[last].to = toLine.to; else ranges.push({ from: fromLine.from, to: toLine.to }); } return ranges; } function changeBlockComment(option, state, ranges = state.selection.ranges) { let tokens = ranges.map((r2) => getConfig(state, r2.from).block); if (!tokens.every((c2) => c2)) return null; let comments = ranges.map((r2, i2) => findBlockComment(state, tokens[i2], r2.from, r2.to)); if (option != 2 && !comments.every((c2) => c2)) { return { changes: state.changes(ranges.map((range, i2) => { if (comments[i2]) return []; return [{ from: range.from, insert: tokens[i2].open + " " }, { from: range.to, insert: " " + tokens[i2].close }]; })) }; } else if (option != 1 && comments.some((c2) => c2)) { let changes = []; for (let i2 = 0, comment2; i2 < comments.length; i2++) if (comment2 = comments[i2]) { let token = tokens[i2], { open, close } = comment2; changes.push({ from: open.pos - token.open.length, to: open.pos + open.margin }, { from: close.pos - close.margin, to: close.pos + token.close.length }); } return { changes }; } return null; } function changeLineComment(option, state, ranges = state.selection.ranges) { let lines = []; let prevLine = -1; for (let { from, to } of ranges) { let startI = lines.length, minIndent = 1e9; for (let pos = from; pos <= to; ) { let line = state.doc.lineAt(pos); if (line.from > prevLine && (from == to || to > line.from)) { prevLine = line.from; let token = getConfig(state, pos).line; if (!token) continue; let indent = /^\s*/.exec(line.text)[0].length; let empty = indent == line.length; let comment2 = line.text.slice(indent, indent + token.length) == token ? indent : -1; if (indent < line.text.length && indent < minIndent) minIndent = indent; lines.push({ line, comment: comment2, token, indent, empty, single: false }); } pos = line.to + 1; } if (minIndent < 1e9) { for (let i2 = startI; i2 < lines.length; i2++) if (lines[i2].indent < lines[i2].line.text.length) lines[i2].indent = minIndent; } if (lines.length == startI + 1) lines[startI].single = true; } if (option != 2 && lines.some((l2) => l2.comment < 0 && (!l2.empty || l2.single))) { let changes = []; for (let { line, token, indent, empty, single } of lines) if (single || !empty) changes.push({ from: line.from + indent, insert: token + " " }); let changeSet = state.changes(changes); return { changes: changeSet, selection: state.selection.map(changeSet, 1) }; } else if (option != 1 && lines.some((l2) => l2.comment >= 0)) { let changes = []; for (let { line, comment: comment2, token } of lines) if (comment2 >= 0) { let from = line.from + comment2, to = from + token.length; if (line.text[to - line.from] == " ") to++; changes.push({ from, to }); } return { changes }; } return null; } const fromHistory = /* @__PURE__ */ Annotation.define(); const isolateHistory = /* @__PURE__ */ Annotation.define(); const invertedEffects = /* @__PURE__ */ Facet.define(); const historyConfig = /* @__PURE__ */ Facet.define({ combine(configs) { return combineConfig(configs, { minDepth: 100, newGroupDelay: 500 }, { minDepth: Math.max, newGroupDelay: Math.min }); } }); function changeEnd(changes) { let end = 0; changes.iterChangedRanges((_2, to) => end = to); return end; } const historyField_ = /* @__PURE__ */ StateField.define({ create() { return HistoryState.empty; }, update(state, tr) { let config = tr.state.facet(historyConfig); let fromHist = tr.annotation(fromHistory); if (fromHist) { let selection = tr.docChanged ? EditorSelection.single(changeEnd(tr.changes)) : void 0; let item = HistEvent.fromTransaction(tr, selection), from = fromHist.side; let other = from == 0 ? state.undone : state.done; if (item) other = updateBranch(other, other.length, config.minDepth, item); else other = addSelection(other, tr.startState.selection); return new HistoryState(from == 0 ? fromHist.rest : other, from == 0 ? other : fromHist.rest); } let isolate = tr.annotation(isolateHistory); if (isolate == "full" || isolate == "before") state = state.isolate(); if (tr.annotation(Transaction.addToHistory) === false) return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state; let event = HistEvent.fromTransaction(tr); let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent); if (event) state = state.addChanges(event, time, userEvent, config.newGroupDelay, config.minDepth); else if (tr.selection) state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay); if (isolate == "full" || isolate == "after") state = state.isolate(); return state; }, toJSON(value) { return { done: value.done.map((e2) => e2.toJSON()), undone: value.undone.map((e2) => e2.toJSON()) }; }, fromJSON(json) { return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON)); } }); function history(config = {}) { return [ historyField_, historyConfig.of(config), EditorView.domEventHandlers({ beforeinput(e2, view) { let command2 = e2.inputType == "historyUndo" ? undo : e2.inputType == "historyRedo" ? redo : null; if (!command2) return false; e2.preventDefault(); return command2(view); } }) ]; } function cmd(side, selection) { return function({ state, dispatch }) { if (!selection && state.readOnly) return false; let historyState = state.field(historyField_, false); if (!historyState) return false; let tr = historyState.pop(side, state, selection); if (!tr) return false; dispatch(tr); return true; }; } const undo = /* @__PURE__ */ cmd(0, false); const redo = /* @__PURE__ */ cmd(1, false); const undoSelection = /* @__PURE__ */ cmd(0, true); const redoSelection = /* @__PURE__ */ cmd(1, true); class HistEvent { constructor(changes, effects, mapped, startSelection, selectionsAfter) { this.changes = changes; this.effects = effects; this.mapped = mapped; this.startSelection = startSelection; this.selectionsAfter = selectionsAfter; } setSelAfter(after) { return new HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after); } toJSON() { var _a2, _b2, _c; return { changes: (_a2 = this.changes) === null || _a2 === void 0 ? void 0 : _a2.toJSON(), mapped: (_b2 = this.mapped) === null || _b2 === void 0 ? void 0 : _b2.toJSON(), startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(), selectionsAfter: this.selectionsAfter.map((s2) => s2.toJSON()) }; } static fromJSON(json) { return new HistEvent(json.changes && ChangeSet.fromJSON(json.changes), [], json.mapped && ChangeDesc.fromJSON(json.mapped), json.startSelection && EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(EditorSelection.fromJSON)); } // This does not check `addToHistory` and such, it assumes the // transaction needs to be converted to an item. Returns null when // there are no changes or effects in the transaction. static fromTransaction(tr, selection) { let effects = none; for (let invert of tr.startState.facet(invertedEffects)) { let result = invert(tr); if (result.length) effects = effects.concat(result); } if (!effects.length && tr.changes.empty) return null; return new HistEvent(tr.changes.invert(tr.startState.doc), effects, void 0, selection || tr.startState.selection, none); } static selection(selections) { return new HistEvent(void 0, none, void 0, void 0, selections); } } function updateBranch(branch, to, maxLen, newEvent) { let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0; let newBranch = branch.slice(start, to); newBranch.push(newEvent); return newBranch; } function isAdjacent(a2, b2) { let ranges = [], isAdjacent2 = false; a2.iterChangedRanges((f2, t2) => ranges.push(f2, t2)); b2.iterChangedRanges((_f2, _t, f2, t2) => { for (let i2 = 0; i2 < ranges.length; ) { let from = ranges[i2++], to = ranges[i2++]; if (t2 >= from && f2 <= to) isAdjacent2 = true; } }); return isAdjacent2; } function eqSelectionShape(a2, b2) { return a2.ranges.length == b2.ranges.length && a2.ranges.filter((r2, i2) => r2.empty != b2.ranges[i2].empty).length === 0; } function conc(a2, b2) { return !a2.length ? b2 : !b2.length ? a2 : a2.concat(b2); } const none = []; const MaxSelectionsPerEvent = 200; function addSelection(branch, selection) { if (!branch.length) { return [HistEvent.selection([selection])]; } else { let lastEvent = branch[branch.length - 1]; let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent)); if (sels.length && sels[sels.length - 1].eq(selection)) return branch; sels.push(selection); return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels)); } } function popSelection(branch) { let last = branch[branch.length - 1]; let newBranch = branch.slice(); newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1)); return newBranch; } function addMappingToBranch(branch, mapping) { if (!branch.length) return branch; let length = branch.length, selections = none; while (length) { let event = mapEvent(branch[length - 1], mapping, selections); if (event.changes && !event.changes.empty || event.effects.length) { let result = branch.slice(0, length); result[length - 1] = event; return result; } else { mapping = event.mapped; length--; selections = event.selectionsAfter; } } return selections.length ? [HistEvent.selection(selections)] : none; } function mapEvent(event, mapping, extraSelections) { let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map((s2) => s2.map(mapping)) : none, extraSelections); if (!event.changes) return HistEvent.selection(selections); let mappedChanges = event.changes.map(mapping), before = mapping.mapDesc(event.changes, true); let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before; return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections); } const joinableUserEvent = /^(input\.type|delete)($|\.)/; class HistoryState { constructor(done, undone, prevTime = 0, prevUserEvent = void 0) { this.done = done; this.undone = undone; this.prevTime = prevTime; this.prevUserEvent = prevUserEvent; } isolate() { return this.prevTime ? new HistoryState(this.done, this.undone) : this; } addChanges(event, time, userEvent, newGroupDelay, maxLen) { let done = this.done, lastEvent = done[done.length - 1]; if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes && (!userEvent || joinableUserEvent.test(userEvent)) && (!lastEvent.selectionsAfter.length && time - this.prevTime < newGroupDelay && isAdjacent(lastEvent.changes, event.changes) || // For compose (but not compose.start) events, always join with previous event userEvent == "input.type.compose")) { done = updateBranch(done, done.length - 1, maxLen, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none)); } else { done = updateBranch(done, done.length, maxLen, event); } return new HistoryState(done, none, time, userEvent); } addSelection(selection, time, userEvent, newGroupDelay) { let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none; if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection)) return this; return new HistoryState(addSelection(this.done, selection), this.undone, time, userEvent); } addMapping(mapping) { return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent); } pop(side, state, selection) { let branch = side == 0 ? this.done : this.undone; if (branch.length == 0) return null; let event = branch[branch.length - 1]; if (selection && event.selectionsAfter.length) { return state.update({ selection: event.selectionsAfter[event.selectionsAfter.length - 1], annotations: fromHistory.of({ side, rest: popSelection(branch) }), userEvent: side == 0 ? "select.undo" : "select.redo", scrollIntoView: true }); } else if (!event.changes) { return null; } else { let rest = branch.length == 1 ? none : branch.slice(0, branch.length - 1); if (event.mapped) rest = addMappingToBranch(rest, event.mapped); return state.update({ changes: event.changes, selection: event.startSelection, effects: event.effects, annotations: fromHistory.of({ side, rest }), filter: false, userEvent: side == 0 ? "undo" : "redo", scrollIntoView: true }); } } } HistoryState.empty = /* @__PURE__ */ new HistoryState(none, none); const historyKeymap = [ { key: "Mod-z", run: undo, preventDefault: true }, { key: "Mod-y", mac: "Mod-Shift-z", run: redo, preventDefault: true }, { linux: "Ctrl-Shift-z", run: redo, preventDefault: true }, { key: "Mod-u", run: undoSelection, preventDefault: true }, { key: "Alt-u", mac: "Mod-Shift-u", run: redoSelection, preventDefault: true } ]; function updateSel(sel, by) { return EditorSelection.create(sel.ranges.map(by), sel.mainIndex); } function setSel(state, selection) { return state.update({ selection, scrollIntoView: true, userEvent: "select" }); } function moveSel({ state, dispatch }, how) { let selection = updateSel(state.selection, how); if (selection.eq(state.selection)) return false; dispatch(setSel(state, selection)); return true; } function rangeEnd(range, forward) { return EditorSelection.cursor(forward ? range.to : range.from); } function cursorByChar(view, forward) { return moveSel(view, (range) => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward)); } function ltrAtCursor(view) { return view.textDirectionAt(view.state.selection.main.head) == Direction.LTR; } const cursorCharLeft = (view) => cursorByChar(view, !ltrAtCursor(view)); const cursorCharRight = (view) => cursorByChar(view, ltrAtCursor(view)); function cursorByGroup(view, forward) { return moveSel(view, (range) => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward)); } const cursorGroupLeft = (view) => cursorByGroup(view, !ltrAtCursor(view)); const cursorGroupRight = (view) => cursorByGroup(view, ltrAtCursor(view)); function interestingNode(state, node, bracketProp) { if (node.type.prop(bracketProp)) return true; let len = node.to - node.from; return len && (len > 2 || /[^\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild; } function moveBySyntax(state, start, forward) { let pos = syntaxTree(state).resolveInner(start.head); let bracketProp = forward ? NodeProp.closedBy : NodeProp.openedBy; for (let at = start.head; ; ) { let next = forward ? pos.childAfter(at) : pos.childBefore(at); if (!next) break; if (interestingNode(state, next, bracketProp)) pos = next; else at = forward ? next.to : next.from; } let bracket2 = pos.type.prop(bracketProp), match, newPos; if (bracket2 && (match = forward ? matchBrackets(state, pos.from, 1) : matchBrackets(state, pos.to, -1)) && match.matched) newPos = forward ? match.end.to : match.end.from; else newPos = forward ? pos.to : pos.from; return EditorSelection.cursor(newPos, forward ? -1 : 1); } const cursorSyntaxLeft = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, !ltrAtCursor(view))); const cursorSyntaxRight = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, ltrAtCursor(view))); function cursorByLine(view, forward) { return moveSel(view, (range) => { if (!range.empty) return rangeEnd(range, forward); let moved = view.moveVertically(range, forward); return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward); }); } const cursorLineUp = (view) => cursorByLine(view, false); const cursorLineDown = (view) => cursorByLine(view, true); function pageHeight(view) { return Math.max(view.defaultLineHeight, Math.min(view.dom.clientHeight, innerHeight) - 5); } function cursorByPage(view, forward) { let { state } = view, selection = updateSel(state.selection, (range) => { return range.empty ? view.moveVertically(range, forward, pageHeight(view)) : rangeEnd(range, forward); }); if (selection.eq(state.selection)) return false; let startPos = view.coordsAtPos(state.selection.main.head); let scrollRect = view.scrollDOM.getBoundingClientRect(); let effect; if (startPos && startPos.top > scrollRect.top && startPos.bottom < scrollRect.bottom && startPos.top - scrollRect.top <= view.scrollDOM.scrollHeight - view.scrollDOM.scrollTop - view.scrollDOM.clientHeight) effect = EditorView.scrollIntoView(selection.main.head, { y: "start", yMargin: startPos.top - scrollRect.top }); view.dispatch(setSel(state, selection), { effects: effect }); return true; } const cursorPageUp = (view) => cursorByPage(view, false); const cursorPageDown = (view) => cursorByPage(view, true); function moveByLineBoundary(view, start, forward) { let line = view.lineBlockAt(start.head), moved = view.moveToLineBoundary(start, forward); if (moved.head == start.head && moved.head != (forward ? line.to : line.from)) moved = view.moveToLineBoundary(start, forward, false); if (!forward && moved.head == line.from && line.length) { let space = /^\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length; if (space && start.head != line.from + space) moved = EditorSelection.cursor(line.from + space); } return moved; } const cursorLineBoundaryForward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, true)); const cursorLineBoundaryBackward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, false)); const cursorLineBoundaryLeft = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, !ltrAtCursor(view))); const cursorLineBoundaryRight = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, ltrAtCursor(view))); const cursorLineStart = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from, 1)); const cursorLineEnd = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to, -1)); function toMatchingBracket(state, dispatch, extend2) { let found = false, selection = updateSel(state.selection, (range) => { let matching = matchBrackets(state, range.head, -1) || matchBrackets(state, range.head, 1) || range.head > 0 && matchBrackets(state, range.head - 1, 1) || range.head < state.doc.length && matchBrackets(state, range.head + 1, -1); if (!matching || !matching.end) return range; found = true; let head = matching.start.from == range.head ? matching.end.to : matching.end.from; return extend2 ? EditorSelection.range(range.anchor, head) : EditorSelection.cursor(head); }); if (!found) return false; dispatch(setSel(state, selection)); return true; } const cursorMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, false); function extendSel(view, how) { let selection = updateSel(view.state.selection, (range) => { let head = how(range); return EditorSelection.range(range.anchor, head.head, head.goalColumn); }); if (selection.eq(view.state.selection)) return false; view.dispatch(setSel(view.state, selection)); return true; } function selectByChar(view, forward) { return extendSel(view, (range) => view.moveByChar(range, forward)); } const selectCharLeft = (view) => selectByChar(view, !ltrAtCursor(view)); const selectCharRight = (view) => selectByChar(view, ltrAtCursor(view)); function selectByGroup(view, forward) { return extendSel(view, (range) => view.moveByGroup(range, forward)); } const selectGroupLeft = (view) => selectByGroup(view, !ltrAtCursor(view)); const selectGroupRight = (view) => selectByGroup(view, ltrAtCursor(view)); const selectSyntaxLeft = (view) => extendSel(view, (range) => moveBySyntax(view.state, range, !ltrAtCursor(view))); const selectSyntaxRight = (view) => extendSel(view, (range) => moveBySyntax(view.state, range, ltrAtCursor(view))); function selectByLine(view, forward) { return extendSel(view, (range) => view.moveVertically(range, forward)); } const selectLineUp = (view) => selectByLine(view, false); const selectLineDown = (view) => selectByLine(view, true); function selectByPage(view, forward) { return extendSel(view, (range) => view.moveVertically(range, forward, pageHeight(view))); } const selectPageUp = (view) => selectByPage(view, false); const selectPageDown = (view) => selectByPage(view, true); const selectLineBoundaryForward = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, true)); const selectLineBoundaryBackward = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, false)); const selectLineBoundaryLeft = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, !ltrAtCursor(view))); const selectLineBoundaryRight = (view) => extendSel(view, (range) => moveByLineBoundary(view, range, ltrAtCursor(view))); const selectLineStart = (view) => extendSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from)); const selectLineEnd = (view) => extendSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to)); const cursorDocStart = ({ state, dispatch }) => { dispatch(setSel(state, { anchor: 0 })); return true; }; const cursorDocEnd = ({ state, dispatch }) => { dispatch(setSel(state, { anchor: state.doc.length })); return true; }; const selectDocStart = ({ state, dispatch }) => { dispatch(setSel(state, { anchor: state.selection.main.anchor, head: 0 })); return true; }; const selectDocEnd = ({ state, dispatch }) => { dispatch(setSel(state, { anchor: state.selection.main.anchor, head: state.doc.length })); return true; }; const selectAll = ({ state, dispatch }) => { dispatch(state.update({ selection: { anchor: 0, head: state.doc.length }, userEvent: "select" })); return true; }; const selectLine = ({ state, dispatch }) => { let ranges = selectedLineBlocks(state).map(({ from, to }) => EditorSelection.range(from, Math.min(to + 1, state.doc.length))); dispatch(state.update({ selection: EditorSelection.create(ranges), userEvent: "select" })); return true; }; const selectParentSyntax = ({ state, dispatch }) => { let selection = updateSel(state.selection, (range) => { var _a2; let context = syntaxTree(state).resolveInner(range.head, 1); while (!(context.from < range.from && context.to >= range.to || context.to > range.to && context.from <= range.from || !((_a2 = context.parent) === null || _a2 === void 0 ? void 0 : _a2.parent))) context = context.parent; return EditorSelection.range(context.to, context.from); }); dispatch(setSel(state, selection)); return true; }; const simplifySelection = ({ state, dispatch }) => { let cur = state.selection, selection = null; if (cur.ranges.length > 1) selection = EditorSelection.create([cur.main]); else if (!cur.main.empty) selection = EditorSelection.create([EditorSelection.cursor(cur.main.head)]); if (!selection) return false; dispatch(setSel(state, selection)); return true; }; function deleteBy(target, by) { if (target.state.readOnly) return false; let event = "delete.selection", { state } = target; let changes = state.changeByRange((range) => { let { from, to } = range; if (from == to) { let towards = by(from); if (towards < from) { event = "delete.backward"; towards = skipAtomic(target, towards, false); } else if (towards > from) { event = "delete.forward"; towards = skipAtomic(target, towards, true); } from = Math.min(from, towards); to = Math.max(to, towards); } else { from = skipAtomic(target, from, false); to = skipAtomic(target, to, true); } return from == to ? { range } : { changes: { from, to }, range: EditorSelection.cursor(from) }; }); if (changes.changes.empty) return false; target.dispatch(state.update(changes, { scrollIntoView: true, userEvent: event, effects: event == "delete.selection" ? EditorView.announce.of(state.phrase("Selection deleted")) : void 0 })); return true; } function skipAtomic(target, pos, forward) { if (target instanceof EditorView) for (let ranges of target.state.facet(EditorView.atomicRanges).map((f2) => f2(target))) ranges.between(pos, pos, (from, to) => { if (from < pos && to > pos) pos = forward ? to : from; }); return pos; } const deleteByChar = (target, forward) => deleteBy(target, (pos) => { let { state } = target, line = state.doc.lineAt(pos), before, targetPos; if (!forward && pos > line.from && pos < line.from + 200 && !/[^ \t]/.test(before = line.text.slice(0, pos - line.from))) { if (before[before.length - 1] == " ") return pos - 1; let col = countColumn(before, state.tabSize), drop = col % getIndentUnit(state) || getIndentUnit(state); for (let i2 = 0; i2 < drop && before[before.length - 1 - i2] == " "; i2++) pos--; targetPos = pos; } else { targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from; if (targetPos == pos && line.number != (forward ? state.doc.lines : 1)) targetPos += forward ? 1 : -1; } return targetPos; }); const deleteCharBackward = (view) => deleteByChar(view, false); const deleteCharForward = (view) => deleteByChar(view, true); const deleteByGroup = (target, forward) => deleteBy(target, (start) => { let pos = start, { state } = target, line = state.doc.lineAt(pos); let categorize = state.charCategorizer(pos); for (let cat = null; ; ) { if (pos == (forward ? line.to : line.from)) { if (pos == start && line.number != (forward ? state.doc.lines : 1)) pos += forward ? 1 : -1; break; } let next = findClusterBreak(line.text, pos - line.from, forward) + line.from; let nextChar = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from); let nextCat = categorize(nextChar); if (cat != null && nextCat != cat) break; if (nextChar != " " || pos != start) cat = nextCat; pos = next; } return pos; }); const deleteGroupBackward = (target) => deleteByGroup(target, false); const deleteGroupForward = (target) => deleteByGroup(target, true); const deleteToLineEnd = (view) => deleteBy(view, (pos) => { let lineEnd = view.lineBlockAt(pos).to; return pos < lineEnd ? lineEnd : Math.min(view.state.doc.length, pos + 1); }); const deleteToLineStart = (view) => deleteBy(view, (pos) => { let lineStart = view.lineBlockAt(pos).from; return pos > lineStart ? lineStart : Math.max(0, pos - 1); }); const splitLine = ({ state, dispatch }) => { if (state.readOnly) return false; let changes = state.changeByRange((range) => { return { changes: { from: range.from, to: range.to, insert: Text.of(["", ""]) }, range: EditorSelection.cursor(range.from) }; }); dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" })); return true; }; const transposeChars = ({ state, dispatch }) => { if (state.readOnly) return false; let changes = state.changeByRange((range) => { if (!range.empty || range.from == 0 || range.from == state.doc.length) return { range }; let pos = range.from, line = state.doc.lineAt(pos); let from = pos == line.from ? pos - 1 : findClusterBreak(line.text, pos - line.from, false) + line.from; let to = pos == line.to ? pos + 1 : findClusterBreak(line.text, pos - line.from, true) + line.from; return { changes: { from, to, insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos)) }, range: EditorSelection.cursor(to) }; }); if (changes.changes.empty) return false; dispatch(state.update(changes, { scrollIntoView: true, userEvent: "move.character" })); return true; }; function selectedLineBlocks(state) { let blocks = [], upto = -1; for (let range of state.selection.ranges) { let startLine = state.doc.lineAt(range.from), endLine = state.doc.lineAt(range.to); if (!range.empty && range.to == endLine.from) endLine = state.doc.lineAt(range.to - 1); if (upto >= startLine.number) { let prev = blocks[blocks.length - 1]; prev.to = endLine.to; prev.ranges.push(range); } else { blocks.push({ from: startLine.from, to: endLine.to, ranges: [range] }); } upto = endLine.number + 1; } return blocks; } function moveLine(state, dispatch, forward) { if (state.readOnly) return false; let changes = [], ranges = []; for (let block of selectedLineBlocks(state)) { if (forward ? block.to == state.doc.length : block.from == 0) continue; let nextLine = state.doc.lineAt(forward ? block.to + 1 : block.from - 1); let size = nextLine.length + 1; if (forward) { changes.push({ from: block.to, to: nextLine.to }, { from: block.from, insert: nextLine.text + state.lineBreak }); for (let r2 of block.ranges) ranges.push(EditorSelection.range(Math.min(state.doc.length, r2.anchor + size), Math.min(state.doc.length, r2.head + size))); } else { changes.push({ from: nextLine.from, to: block.from }, { from: block.to, insert: state.lineBreak + nextLine.text }); for (let r2 of block.ranges) ranges.push(EditorSelection.range(r2.anchor - size, r2.head - size)); } } if (!changes.length) return false; dispatch(state.update({ changes, scrollIntoView: true, selection: EditorSelection.create(ranges, state.selection.mainIndex), userEvent: "move.line" })); return true; } const moveLineUp = ({ state, dispatch }) => moveLine(state, dispatch, false); const moveLineDown = ({ state, dispatch }) => moveLine(state, dispatch, true); function copyLine(state, dispatch, forward) { if (state.readOnly) return false; let changes = []; for (let block of selectedLineBlocks(state)) { if (forward) changes.push({ from: block.from, insert: state.doc.slice(block.from, block.to) + state.lineBreak }); else changes.push({ from: block.to, insert: state.lineBreak + state.doc.slice(block.from, block.to) }); } dispatch(state.update({ changes, scrollIntoView: true, userEvent: "input.copyline" })); return true; } const copyLineUp = ({ state, dispatch }) => copyLine(state, dispatch, false); const copyLineDown = ({ state, dispatch }) => copyLine(state, dispatch, true); const deleteLine = (view) => { if (view.state.readOnly) return false; let { state } = view, changes = state.changes(selectedLineBlocks(state).map(({ from, to }) => { if (from > 0) from--; else if (to < state.doc.length) to++; return { from, to }; })); let selection = updateSel(state.selection, (range) => view.moveVertically(range, true)).map(changes); view.dispatch({ changes, selection, scrollIntoView: true, userEvent: "delete.line" }); return true; }; function isBetweenBrackets(state, pos) { if (/\(\)|\[\]|\{\}/.test(state.sliceDoc(pos - 1, pos + 1))) return { from: pos, to: pos }; let context = syntaxTree(state).resolveInner(pos); let before = context.childBefore(pos), after = context.childAfter(pos), closedBy; if (before && after && before.to <= pos && after.from >= pos && (closedBy = before.type.prop(NodeProp.closedBy)) && closedBy.indexOf(after.name) > -1 && state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from) return { from: before.to, to: after.from }; return null; } const insertNewlineAndIndent = /* @__PURE__ */ newlineAndIndent(false); const insertBlankLine = /* @__PURE__ */ newlineAndIndent(true); function newlineAndIndent(atEof) { return ({ state, dispatch }) => { if (state.readOnly) return false; let changes = state.changeByRange((range) => { let { from, to } = range, line = state.doc.lineAt(from); let explode = !atEof && from == to && isBetweenBrackets(state, from); if (atEof) from = to = (to <= line.to ? line : state.doc.lineAt(to)).to; let cx = new IndentContext(state, { simulateBreak: from, simulateDoubleBreak: !!explode }); let indent = getIndentation(cx, from); if (indent == null) indent = /^\s*/.exec(state.doc.lineAt(from).text)[0].length; while (to < line.to && /\s/.test(line.text[to - line.from])) to++; if (explode) ({ from, to } = explode); else if (from > line.from && from < line.from + 100 && !/\S/.test(line.text.slice(0, from))) from = line.from; let insert2 = ["", indentString(state, indent)]; if (explode) insert2.push(indentString(state, cx.lineIndent(line.from, -1))); return { changes: { from, to, insert: Text.of(insert2) }, range: EditorSelection.cursor(from + 1 + insert2[1].length) }; }); dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" })); return true; }; } function changeBySelectedLine(state, f2) { let atLine = -1; return state.changeByRange((range) => { let changes = []; for (let pos = range.from; pos <= range.to; ) { let line = state.doc.lineAt(pos); if (line.number > atLine && (range.empty || range.to > line.from)) { f2(line, changes, range); atLine = line.number; } pos = line.to + 1; } let changeSet = state.changes(changes); return { changes, range: EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1)) }; }); } const indentSelection = ({ state, dispatch }) => { if (state.readOnly) return false; let updated = /* @__PURE__ */ Object.create(null); let context = new IndentContext(state, { overrideIndentation: (start) => { let found = updated[start]; return found == null ? -1 : found; } }); let changes = changeBySelectedLine(state, (line, changes2, range) => { let indent = getIndentation(context, line.from); if (indent == null) return; if (!/\S/.test(line.text)) indent = 0; let cur = /^\s*/.exec(line.text)[0]; let norm = indentString(state, indent); if (cur != norm || range.from < line.from + cur.length) { updated[line.from] = indent; changes2.push({ from: line.from, to: line.from + cur.length, insert: norm }); } }); if (!changes.changes.empty) dispatch(state.update(changes, { userEvent: "indent" })); return true; }; const indentMore = ({ state, dispatch }) => { if (state.readOnly) return false; dispatch(state.update(changeBySelectedLine(state, (line, changes) => { changes.push({ from: line.from, insert: state.facet(indentUnit) }); }), { userEvent: "input.indent" })); return true; }; const indentLess = ({ state, dispatch }) => { if (state.readOnly) return false; dispatch(state.update(changeBySelectedLine(state, (line, changes) => { let space = /^\s*/.exec(line.text)[0]; if (!space) return; let col = countColumn(space, state.tabSize), keep = 0; let insert2 = indentString(state, Math.max(0, col - getIndentUnit(state))); while (keep < space.length && keep < insert2.length && space.charCodeAt(keep) == insert2.charCodeAt(keep)) keep++; changes.push({ from: line.from + keep, to: line.from + space.length, insert: insert2.slice(keep) }); }), { userEvent: "delete.dedent" })); return true; }; const emacsStyleKeymap = [ { key: "Ctrl-b", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true }, { key: "Ctrl-f", run: cursorCharRight, shift: selectCharRight }, { key: "Ctrl-p", run: cursorLineUp, shift: selectLineUp }, { key: "Ctrl-n", run: cursorLineDown, shift: selectLineDown }, { key: "Ctrl-a", run: cursorLineStart, shift: selectLineStart }, { key: "Ctrl-e", run: cursorLineEnd, shift: selectLineEnd }, { key: "Ctrl-d", run: deleteCharForward }, { key: "Ctrl-h", run: deleteCharBackward }, { key: "Ctrl-k", run: deleteToLineEnd }, { key: "Ctrl-Alt-h", run: deleteGroupBackward }, { key: "Ctrl-o", run: splitLine }, { key: "Ctrl-t", run: transposeChars }, { key: "Ctrl-v", run: cursorPageDown } ]; const standardKeymap = /* @__PURE__ */ [ { key: "ArrowLeft", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true }, { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: cursorGroupLeft, shift: selectGroupLeft, preventDefault: true }, { mac: "Cmd-ArrowLeft", run: cursorLineBoundaryLeft, shift: selectLineBoundaryLeft, preventDefault: true }, { key: "ArrowRight", run: cursorCharRight, shift: selectCharRight, preventDefault: true }, { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: cursorGroupRight, shift: selectGroupRight, preventDefault: true }, { mac: "Cmd-ArrowRight", run: cursorLineBoundaryRight, shift: selectLineBoundaryRight, preventDefault: true }, { key: "ArrowUp", run: cursorLineUp, shift: selectLineUp, preventDefault: true }, { mac: "Cmd-ArrowUp", run: cursorDocStart, shift: selectDocStart }, { mac: "Ctrl-ArrowUp", run: cursorPageUp, shift: selectPageUp }, { key: "ArrowDown", run: cursorLineDown, shift: selectLineDown, preventDefault: true }, { mac: "Cmd-ArrowDown", run: cursorDocEnd, shift: selectDocEnd }, { mac: "Ctrl-ArrowDown", run: cursorPageDown, shift: selectPageDown }, { key: "PageUp", run: cursorPageUp, shift: selectPageUp }, { key: "PageDown", run: cursorPageDown, shift: selectPageDown }, { key: "Home", run: cursorLineBoundaryBackward, shift: selectLineBoundaryBackward, preventDefault: true }, { key: "Mod-Home", run: cursorDocStart, shift: selectDocStart }, { key: "End", run: cursorLineBoundaryForward, shift: selectLineBoundaryForward, preventDefault: true }, { key: "Mod-End", run: cursorDocEnd, shift: selectDocEnd }, { key: "Enter", run: insertNewlineAndIndent }, { key: "Mod-a", run: selectAll }, { key: "Backspace", run: deleteCharBackward, shift: deleteCharBackward }, { key: "Delete", run: deleteCharForward }, { key: "Mod-Backspace", mac: "Alt-Backspace", run: deleteGroupBackward }, { key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward }, { mac: "Mod-Backspace", run: deleteToLineStart }, { mac: "Mod-Delete", run: deleteToLineEnd } ].concat(/* @__PURE__ */ emacsStyleKeymap.map((b2) => ({ mac: b2.key, run: b2.run, shift: b2.shift }))); const defaultKeymap = /* @__PURE__ */ [ { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: cursorSyntaxLeft, shift: selectSyntaxLeft }, { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: cursorSyntaxRight, shift: selectSyntaxRight }, { key: "Alt-ArrowUp", run: moveLineUp }, { key: "Shift-Alt-ArrowUp", run: copyLineUp }, { key: "Alt-ArrowDown", run: moveLineDown }, { key: "Shift-Alt-ArrowDown", run: copyLineDown }, { key: "Escape", run: simplifySelection }, { key: "Mod-Enter", run: insertBlankLine }, { key: "Alt-l", mac: "Ctrl-l", run: selectLine }, { key: "Mod-i", run: selectParentSyntax, preventDefault: true }, { key: "Mod-[", run: indentLess }, { key: "Mod-]", run: indentMore }, { key: "Mod-Alt-\\", run: indentSelection }, { key: "Shift-Mod-k", run: deleteLine }, { key: "Shift-Mod-\\", run: cursorMatchingBracket }, { key: "Mod-/", run: toggleComment }, { key: "Alt-A", run: toggleBlockComment } ].concat(standardKeymap); let tf = (tag, hljs) => ({ tag, class: `hljs-${hljs}` }); let tt = (cm, hljs) => tf(tags[cm], hljs); let highlightStyle = HighlightStyle.define([ tt("comment", "comment"), tt("lineComment", "comment"), tt("blockComment", "comment"), tt("docComment", "comment"), // tt("variableName", "variable"), tt("typeName", "type"), tt("tagName", "type"), tt("literal", "literal"), tt("string", "string"), tt("docString", "string"), tt("number", "number"), tt("integer", "number"), tt("float", "number"), tt("regexp", "regexp"), tt("keyword", "keyword"), tt("self", "variable.language"), tt("operator", "operator"), tf(tags.function(tags.definition(tags.variableName)), "title") ]); let suppressKeyEvents = () => { let captureKeyboard = (e2) => e2.stopPropagation(); return EditorView.domEventHandlers({ focusin: () => { document.documentElement.addEventListener( "keydown", captureKeyboard, false ); }, focusout: () => { document.documentElement.removeEventListener( "keydown", captureKeyboard, false ); } }); }; let setup = (() => [ highlightSpecialChars(), history(), drawSelection(), syntaxHighlighting(highlightStyle, { fallback: true }), keymap.of([...defaultKeymap, ...historyKeymap]), suppressKeyEvents() ])(); const styles = ""; const AQUASCOPE_NAME = "aquascope"; const EMBED_NAME = "aquascope-embed"; let CodeContext = React.createContext(""); let useCaptureMdbookShortcuts = (capture) => { reactExports.useLayoutEffect(() => { if (capture) { let captureKeyboard = (e2) => e2.stopPropagation(); document.documentElement.addEventListener( "keydown", captureKeyboard, false ); return () => document.documentElement.removeEventListener( "keydown", captureKeyboard, false ); } }, [capture]); }; let ContextProvider = ({ title, buttonText, children }) => { let [open, setOpen] = reactExports.useState(false); let { x: x2, y: y2, strategy, refs } = useFloating({ placement: "bottom-end", open }); useCaptureMdbookShortcuts(open); let childEl = children(() => setOpen(false)); return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "context-provider", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx( "button", { type: "button", title, onClick: () => setOpen(!open), ref: refs.setReference, children: buttonText } ), open ? /* @__PURE__ */ jsxRuntimeExports.jsxs( "div", { className: "popup-context", ref: refs.setFloating, style: { position: strategy, top: y2 ?? 0, left: x2 ?? 0 }, children: [ /* @__PURE__ */ jsxRuntimeExports.jsx( "button", { type: "button", className: "close", onClick: () => setOpen(false), children: "✕" } ), childEl ] } ) : null ] }); }; let BugReporter = () => /* @__PURE__ */ jsxRuntimeExports.jsx(ContextProvider, { title: "Report a bug", buttonText: "🐞", children: (close) => { let code2 = reactExports.useContext(CodeContext); let onSubmit = (event) => { let data = new FormData(event.target); let feedback = data.get("feedback").toString(); window.telemetry.log("aquascopeBug", { code: code2, feedback }); event.preventDefault(); close(); }; return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { children: "Report a bug" }), /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "If you found an issue in this diagram (e.g. a typo, a visual bug, anything confusing), please describe the issue and report it:" }), /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit, children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { name: "feedback", "aria-label": "Bug feedback" }) }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "submit", "aria-label": "Submit bug feedback" }) }) ] }) ] }); } }); let QuestionMark = () => /* @__PURE__ */ jsxRuntimeExports.jsx(ContextProvider, { title: "What is this diagram?", buttonText: "❓", children: () => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { children: "What is this diagram?" }), /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ "This diagram is a new way of visualizing Rust programs. To learn more about what the symbols mean, you will need to read the updated", " ", /* @__PURE__ */ jsxRuntimeExports.jsx( "a", { href: "ch04-01-what-is-ownership.html", target: "_blank", rel: "noreferrer", children: "Chapter 4: Understanding Ownership" } ), "." ] }) ] }) }); let ExtraInfo = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "extra-info", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(BugReporter, {}), /* @__PURE__ */ jsxRuntimeExports.jsx(QuestionMark, {}) ] }); window.initAquascopeBlocks = (root) => { root.querySelectorAll(`.${EMBED_NAME}`).forEach((elem) => { elem.classList.remove(EMBED_NAME); elem.classList.add(AQUASCOPE_NAME); let maybeParseJson = (s2) => s2 ? JSON.parse(s2) : void 0; let readOnly2 = maybeParseJson(elem.dataset.noInteract) === true; let showBugReporter = maybeParseJson(elem.dataset.showBugReporter) === true; let computePermBtn; if (!readOnly2) { let btnWrap = document.createElement("div"); btnWrap.classList.add("top-right"); computePermBtn = document.createElement("button"); computePermBtn.className = "fa fa-refresh cm-button"; btnWrap.appendChild(computePermBtn); elem.appendChild(btnWrap); } let initialCode = maybeParseJson(elem.dataset.code); if (!initialCode) throw new Error("Missing data-code attribute"); if (window.telemetry && showBugReporter) { let extraInfo = document.createElement("div"); elem.appendChild(extraInfo); client.createRoot(extraInfo).render( /* @__PURE__ */ jsxRuntimeExports.jsx(CodeContext.Provider, { value: initialCode, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ExtraInfo, {}) }) ); } let serverUrl = elem.dataset.serverUrl ? new URL(elem.dataset.serverUrl) : void 0; let shouldFailHtml = ` `; let ed = new Editor( elem, setup, initialCode, (err) => { console.error(err); }, serverUrl, readOnly2, shouldFailHtml, ["copy"] ); let operations = maybeParseJson(elem.dataset.operations); if (!operations) throw new Error("Missing data-operations attribute"); let responses = maybeParseJson( elem.dataset.responses ); let config = maybeParseJson(elem.dataset.config); let annotations = maybeParseJson( elem.dataset.annotations ); if (responses) { operations.forEach((operation) => { ed.renderOperation(operation, { response: responses[operation], config, annotations }); }); } computePermBtn == null ? void 0 : computePermBtn.addEventListener("click", (_2) => { operations.forEach((operation) => ed.renderOperation(operation, {})); }); }); }; window.addEventListener( "load", () => initAquascopeBlocks(document.body), false ); })(); //# sourceMappingURL=embed.iife.js.map